0025695: Visualization, AIS_InteractiveContext - define default HilightMode
[occt.git] / src / AIS / AIS_Line.hxx
1 // Created on: 1997-01-21
2 // Created by: Prestataire Christiane ARMAND
3 // Copyright (c) 1997-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 _AIS_Line_HeaderFile
18 #define _AIS_Line_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <Standard_Boolean.hxx>
24 #include <AIS_InteractiveObject.hxx>
25 #include <PrsMgr_PresentationManager3d.hxx>
26 #include <Standard_Integer.hxx>
27 #include <SelectMgr_Selection.hxx>
28 #include <AIS_KindOfInteractive.hxx>
29 #include <Quantity_NameOfColor.hxx>
30 #include <Standard_Real.hxx>
31 class Geom_Line;
32 class Geom_Point;
33 class Prs3d_Presentation;
34 class Prs3d_Projector;
35 class Geom_Transformation;
36 class Quantity_Color;
37
38
39 class AIS_Line;
40 DEFINE_STANDARD_HANDLE(AIS_Line, AIS_InteractiveObject)
41
42 //! Constructs line datums to be used in construction of
43 //! composite shapes.
44 class AIS_Line : public AIS_InteractiveObject
45 {
46
47 public:
48
49   
50   //! Initializes the line aLine.
51   Standard_EXPORT AIS_Line(const Handle(Geom_Line)& aLine);
52   
53   //! Initializes a starting point aStartPoint
54   //! and a finishing point aEndPoint for the line.
55   Standard_EXPORT AIS_Line(const Handle(Geom_Point)& aStartPoint, const Handle(Geom_Point)& aEndPoint);
56   
57   //! computes the presentation according to a point of view
58   //! given by <aProjector>.
59   //! To be Used when the associated degenerated Presentations
60   //! have been transformed by <aTrsf> which is not a Pure
61   //! Translation. The HLR Prs can't be deducted automatically
62   //! WARNING :<aTrsf> must be applied
63   //! to the object to display before computation  !!!
64   Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
65   
66   //! Returns the signature 5.
67     virtual Standard_Integer Signature() const Standard_OVERRIDE;
68   
69   //! Returns the type Datum.
70     virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE;
71   
72   //! Constructs an infinite line.
73     const Handle(Geom_Line)& Line() const;
74   
75   //! Returns the starting point PStart and the end point
76   //! PEnd of the line set by SetPoints.
77     void Points (Handle(Geom_Point)& PStart, Handle(Geom_Point)& PEnd) const;
78   
79   //! instantiates an infinite line.
80     void SetLine (const Handle(Geom_Line)& L);
81   
82
83   //! Sets the starting point P1 and ending point P2 of the
84   //! infinite line to create a finite line segment.
85     void SetPoints (const Handle(Geom_Point)& P1, const Handle(Geom_Point)& P2);
86   
87   //! Provides a new color setting aColor for the line in the
88   //! drawing tool, or "Drawer".
89   Standard_EXPORT void SetColor (const Quantity_NameOfColor aColor) Standard_OVERRIDE;
90   
91   Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE;
92   
93   //! Provides the new width setting aValue for the line in
94   //! the drawing tool, or "Drawer".
95   Standard_EXPORT void SetWidth (const Standard_Real aValue) Standard_OVERRIDE;
96   
97   //! Removes the color setting and returns the original color.
98   Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
99   
100   //! Removes the width setting and returns the original width.
101   Standard_EXPORT void UnsetWidth() Standard_OVERRIDE;
102
103
104
105
106   DEFINE_STANDARD_RTTIEXT(AIS_Line,AIS_InteractiveObject)
107
108 protected:
109
110
111
112
113 private:
114
115   
116   Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
117   
118   Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
119   
120   Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
121   
122   Standard_EXPORT void ComputeInfiniteLine (const Handle(Prs3d_Presentation)& aPresentation);
123   
124   Standard_EXPORT void ComputeSegmentLine (const Handle(Prs3d_Presentation)& aPresentation);
125   
126   Standard_EXPORT void ComputeInfiniteLineSelection (const Handle(SelectMgr_Selection)& aSelection);
127   
128   Standard_EXPORT void ComputeSegmentLineSelection (const Handle(SelectMgr_Selection)& aSelection);
129
130   Handle(Geom_Line) myComponent;
131   Handle(Geom_Point) myStartPoint;
132   Handle(Geom_Point) myEndPoint;
133   Standard_Boolean myLineIsSegment;
134
135
136 };
137
138
139 #include <AIS_Line.lxx>
140
141
142
143
144
145 #endif // _AIS_Line_HeaderFile