0027111: Add generalized copy constructor in handle class for old compilers
[occt.git] / src / GC / GC_MakeLine.hxx
CommitLineData
42cf5bc1 1// Created on: 1992-09-28
2// Created by: Remi GILET
3// Copyright (c) 1992-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _GC_MakeLine_HeaderFile
18#define _GC_MakeLine_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <GC_Root.hxx>
d1a67b9d 25#include <Geom_Line.hxx>
26
42cf5bc1 27class StdFail_NotDone;
28class gp_Ax1;
29class gp_Lin;
30class gp_Pnt;
31class gp_Dir;
32
33
34//! This class implements the following algorithms used
35//! to create a Line from Geom.
36//! * Create a Line parallel to another and passing
37//! through a point.
38//! * Create a Line passing through 2 points.
39//! A MakeLine object provides a framework for:
40//! - defining the construction of the line,
41//! - implementing the construction algorithm, and
42//! - consulting the results. In particular, the Value
43//! function returns the constructed line.
44class GC_MakeLine : public GC_Root
45{
46public:
47
48 DEFINE_STANDARD_ALLOC
49
50
51
52 //! Creates a line located in 3D space with the axis placement A1.
53 //! The Location of A1 is the origin of the line.
54 Standard_EXPORT GC_MakeLine(const gp_Ax1& A1);
55
56
57 //! Creates a line from a non persistent line from package gp.
58 Standard_EXPORT GC_MakeLine(const gp_Lin& L);
59
60
61 //! P is the origin and V is the direction of the line.
62 Standard_EXPORT GC_MakeLine(const gp_Pnt& P, const gp_Dir& V);
63
64 //! Make a Line from Geom <TheLin> parallel to another
65 //! Lin <Lin> and passing through a Pnt <Point>.
66 Standard_EXPORT GC_MakeLine(const gp_Lin& Lin, const gp_Pnt& Point);
67
68 //! Make a Line from Geom <TheLin> passing through 2
69 //! Pnt <P1>,<P2>.
70 //! It returns false if <p1> and <P2> are confused.
71 //! Warning
72 //! If the points P1 and P2 are coincident (that is, when
73 //! IsDone returns false), the Status function returns gce_ConfusedPoints.
74 Standard_EXPORT GC_MakeLine(const gp_Pnt& P1, const gp_Pnt& P2);
75
76 //! Returns the constructed line.
77 //! Exceptions StdFail_NotDone if no line is constructed.
78 Standard_EXPORT const Handle(Geom_Line)& Value() const;
42cf5bc1 79
d1a67b9d 80 operator const Handle(Geom_Line)& () const { return Value(); }
42cf5bc1 81
82private:
42cf5bc1 83 Handle(Geom_Line) TheLine;
42cf5bc1 84};
85
42cf5bc1 86#endif // _GC_MakeLine_HeaderFile