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 | //! Returns the signature 5. |
87432b82 |
41 | virtual Standard_Integer Signature() const Standard_OVERRIDE { return 5; } |
42 | |
42cf5bc1 |
43 | //! Returns the type Datum. |
82b856b8 |
44 | virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KindOfInteractive_Datum; } |
87432b82 |
45 | |
42cf5bc1 |
46 | //! Constructs an infinite line. |
87432b82 |
47 | const Handle(Geom_Line)& Line() const { return myComponent; } |
48 | |
49 | //! Returns the starting point thePStart and the end point thePEnd of the line set by SetPoints. |
50 | void Points (Handle(Geom_Point)& thePStart, Handle(Geom_Point)& thePEnd) const |
51 | { |
52 | thePStart = myStartPoint; |
53 | thePEnd = myEndPoint; |
54 | } |
55 | |
42cf5bc1 |
56 | //! instantiates an infinite line. |
87432b82 |
57 | void SetLine (const Handle(Geom_Line)& theLine) |
58 | { |
59 | myComponent = theLine; |
60 | myLineIsSegment = Standard_False; |
61 | } |
42cf5bc1 |
62 | |
87432b82 |
63 | //! Sets the starting point thePStart and ending point thePEnd of the |
42cf5bc1 |
64 | //! infinite line to create a finite line segment. |
87432b82 |
65 | void SetPoints (const Handle(Geom_Point)& thePStart, const Handle(Geom_Point)& thePEnd) |
66 | { |
67 | myStartPoint = thePStart; |
68 | myEndPoint = thePEnd; |
69 | myLineIsSegment = Standard_True; |
70 | } |
71 | |
72 | //! Provides a new color setting aColor for the line in the drawing tool, or "Drawer". |
42cf5bc1 |
73 | Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE; |
87432b82 |
74 | |
42cf5bc1 |
75 | //! Provides the new width setting aValue for the line in |
76 | //! the drawing tool, or "Drawer". |
77 | Standard_EXPORT void SetWidth (const Standard_Real aValue) Standard_OVERRIDE; |
87432b82 |
78 | |
42cf5bc1 |
79 | //! Removes the color setting and returns the original color. |
80 | Standard_EXPORT void UnsetColor() Standard_OVERRIDE; |
87432b82 |
81 | |
42cf5bc1 |
82 | //! Removes the width setting and returns the original width. |
83 | Standard_EXPORT void UnsetWidth() Standard_OVERRIDE; |
84 | |
42cf5bc1 |
85 | private: |
decbff0d |
86 | |
87 | Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, |
88 | const Handle(Prs3d_Presentation)& thePrs, |
89 | const Standard_Integer theMode) Standard_OVERRIDE; |
90 | |
91 | Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSel, |
92 | const Standard_Integer theMode) Standard_OVERRIDE; |
93 | |
42cf5bc1 |
94 | Standard_EXPORT void ComputeInfiniteLine (const Handle(Prs3d_Presentation)& aPresentation); |
decbff0d |
95 | |
42cf5bc1 |
96 | Standard_EXPORT void ComputeSegmentLine (const Handle(Prs3d_Presentation)& aPresentation); |
decbff0d |
97 | |
42cf5bc1 |
98 | Standard_EXPORT void ComputeInfiniteLineSelection (const Handle(SelectMgr_Selection)& aSelection); |
42cf5bc1 |
99 | |
decbff0d |
100 | Standard_EXPORT void ComputeSegmentLineSelection (const Handle(SelectMgr_Selection)& aSelection); |
226fce20 |
101 | //! Replace aspects of already computed groups with the new value. |
102 | void replaceWithNewLineAspect (const Handle(Prs3d_LineAspect)& theAspect); |
103 | |
87432b82 |
104 | private: |
105 | |
42cf5bc1 |
106 | Handle(Geom_Line) myComponent; |
107 | Handle(Geom_Point) myStartPoint; |
108 | Handle(Geom_Point) myEndPoint; |
109 | Standard_Boolean myLineIsSegment; |
110 | |
42cf5bc1 |
111 | }; |
112 | |
87432b82 |
113 | DEFINE_STANDARD_HANDLE(AIS_Line, AIS_InteractiveObject) |
42cf5bc1 |
114 | |
115 | #endif // _AIS_Line_HeaderFile |