0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / GCE2d / GCE2d_MakeLine.hxx
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 _GCE2d_MakeLine_HeaderFile
18 #define _GCE2d_MakeLine_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <GCE2d_Root.hxx>
25 #include <Geom2d_Line.hxx>
26
27 class StdFail_NotDone;
28 class gp_Ax2d;
29 class gp_Lin2d;
30 class gp_Pnt2d;
31 class gp_Dir2d;
32
33
34 //! This class implements the following algorithms used
35 //! to create a Line from Geom2d.
36 //! * Create a Line parallel to another and passing
37 //! through a point.
38 //! * Create a Line passing through 2 points.
39 class GCE2d_MakeLine  : public GCE2d_Root
40 {
41 public:
42
43   DEFINE_STANDARD_ALLOC
44
45   
46
47   //! Creates a line located in 2D space with the axis placement A.
48   //! The Location of A is the origin of the line.
49   Standard_EXPORT GCE2d_MakeLine(const gp_Ax2d& A);
50   
51
52   //! Creates a line from a non persistent line from package gp.
53   Standard_EXPORT GCE2d_MakeLine(const gp_Lin2d& L);
54   
55
56   //! P is the origin and V is the direction of the line.
57   Standard_EXPORT GCE2d_MakeLine(const gp_Pnt2d& P, const gp_Dir2d& V);
58   
59   //! Make a Line from Geom2d <TheLin> parallel to another
60   //! Lin <Lin> and passing through a Pnt <Point>.
61   Standard_EXPORT GCE2d_MakeLine(const gp_Lin2d& Lin, const gp_Pnt2d& Point);
62   
63   //! Make a Line from Geom2d <TheLin> parallel to another
64   //! Lin <Lin> at a distance <Dist>.
65   Standard_EXPORT GCE2d_MakeLine(const gp_Lin2d& Lin, const Standard_Real Dist);
66   
67   //! Make a Line from Geom2d <TheLin> passing through 2
68   //! Pnt <P1>,<P2>.
69   //! It returns false if <p1> and <P2> are confused.
70   //! Warning
71   //! If points P1 and P2 coincident (that is, when IsDone
72   //! returns false), the Status function returns gce_ConfusedPoints.
73   Standard_EXPORT GCE2d_MakeLine(const gp_Pnt2d& P1, const gp_Pnt2d& P2);
74   
75   //! Returns the constructed line.
76   //! Exceptions StdFail_NotDone if no line is constructed.
77   Standard_EXPORT const Handle(Geom2d_Line)& Value() const;
78
79   operator const Handle(Geom2d_Line)& () const { return Value(); }
80
81 private:
82   Handle(Geom2d_Line) TheLine;
83 };
84
85 #endif // _GCE2d_MakeLine_HeaderFile