42cf5bc1 |
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 | |
42cf5bc1 |
20 | #include <AIS_InteractiveObject.hxx> |
42cf5bc1 |
21 | #include <AIS_KindOfInteractive.hxx> |
87432b82 |
22 | |
42cf5bc1 |
23 | class Geom_Line; |
24 | class Geom_Point; |
42cf5bc1 |
25 | |
26 | //! Constructs line datums to be used in construction of |
27 | //! composite shapes. |
28 | class AIS_Line : public AIS_InteractiveObject |
29 | { |
87432b82 |
30 | DEFINE_STANDARD_RTTIEXT(AIS_Line, AIS_InteractiveObject) |
42cf5bc1 |
31 | public: |
32 | |
42cf5bc1 |
33 | //! Initializes the line aLine. |
34 | Standard_EXPORT AIS_Line(const Handle(Geom_Line)& aLine); |
87432b82 |
35 | |
42cf5bc1 |
36 | //! Initializes a starting point aStartPoint |
37 | //! and a finishing point aEndPoint for the line. |
38 | Standard_EXPORT AIS_Line(const Handle(Geom_Point)& aStartPoint, const Handle(Geom_Point)& aEndPoint); |
87432b82 |
39 | |
42cf5bc1 |
40 | //! computes the presentation according to a point of view |
41 | //! given by <aProjector>. |
42 | //! To be Used when the associated degenerated Presentations |
43 | //! have been transformed by <aTrsf> which is not a Pure |
44 | //! Translation. The HLR Prs can't be deducted automatically |
45 | //! WARNING :<aTrsf> must be applied |
46 | //! to the object to display before computation !!! |
47 | Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; |
87432b82 |
48 | |
42cf5bc1 |
49 | //! Returns the signature 5. |
87432b82 |
50 | virtual Standard_Integer Signature() const Standard_OVERRIDE { return 5; } |
51 | |
42cf5bc1 |
52 | //! Returns the type Datum. |
87432b82 |
53 | virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; } |
54 | |
42cf5bc1 |
55 | //! Constructs an infinite line. |
87432b82 |
56 | const Handle(Geom_Line)& Line() const { return myComponent; } |
57 | |
58 | //! Returns the starting point thePStart and the end point thePEnd of the line set by SetPoints. |
59 | void Points (Handle(Geom_Point)& thePStart, Handle(Geom_Point)& thePEnd) const |
60 | { |
61 | thePStart = myStartPoint; |
62 | thePEnd = myEndPoint; |
63 | } |
64 | |
42cf5bc1 |
65 | //! instantiates an infinite line. |
87432b82 |
66 | void SetLine (const Handle(Geom_Line)& theLine) |
67 | { |
68 | myComponent = theLine; |
69 | myLineIsSegment = Standard_False; |
70 | } |
42cf5bc1 |
71 | |
87432b82 |
72 | //! Sets the starting point thePStart and ending point thePEnd of the |
42cf5bc1 |
73 | //! infinite line to create a finite line segment. |
87432b82 |
74 | void SetPoints (const Handle(Geom_Point)& thePStart, const Handle(Geom_Point)& thePEnd) |
75 | { |
76 | myStartPoint = thePStart; |
77 | myEndPoint = thePEnd; |
78 | myLineIsSegment = Standard_True; |
79 | } |
80 | |
81 | //! Provides a new color setting aColor for the line in the drawing tool, or "Drawer". |
42cf5bc1 |
82 | Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE; |
87432b82 |
83 | |
42cf5bc1 |
84 | //! Provides the new width setting aValue for the line in |
85 | //! the drawing tool, or "Drawer". |
86 | Standard_EXPORT void SetWidth (const Standard_Real aValue) Standard_OVERRIDE; |
87432b82 |
87 | |
42cf5bc1 |
88 | //! Removes the color setting and returns the original color. |
89 | Standard_EXPORT void UnsetColor() Standard_OVERRIDE; |
87432b82 |
90 | |
42cf5bc1 |
91 | //! Removes the width setting and returns the original width. |
92 | Standard_EXPORT void UnsetWidth() Standard_OVERRIDE; |
93 | |
42cf5bc1 |
94 | private: |
42cf5bc1 |
95 | |
96 | Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; |
97 | |
98 | Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; |
99 | |
79104795 |
100 | Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE; |
42cf5bc1 |
101 | |
102 | Standard_EXPORT void ComputeInfiniteLine (const Handle(Prs3d_Presentation)& aPresentation); |
103 | |
104 | Standard_EXPORT void ComputeSegmentLine (const Handle(Prs3d_Presentation)& aPresentation); |
105 | |
106 | Standard_EXPORT void ComputeInfiniteLineSelection (const Handle(SelectMgr_Selection)& aSelection); |
107 | |
108 | Standard_EXPORT void ComputeSegmentLineSelection (const Handle(SelectMgr_Selection)& aSelection); |
109 | |
226fce20 |
110 | //! Replace aspects of already computed groups with the new value. |
111 | void replaceWithNewLineAspect (const Handle(Prs3d_LineAspect)& theAspect); |
112 | |
87432b82 |
113 | private: |
114 | |
42cf5bc1 |
115 | Handle(Geom_Line) myComponent; |
116 | Handle(Geom_Point) myStartPoint; |
117 | Handle(Geom_Point) myEndPoint; |
118 | Standard_Boolean myLineIsSegment; |
119 | |
42cf5bc1 |
120 | }; |
121 | |
87432b82 |
122 | DEFINE_STANDARD_HANDLE(AIS_Line, AIS_InteractiveObject) |
42cf5bc1 |
123 | |
124 | #endif // _AIS_Line_HeaderFile |