0030537: Visualization - wrapping text in font text formatter
[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 <AIS_InteractiveObject.hxx>
21 #include <AIS_KindOfInteractive.hxx>
22
23 class Geom_Line;
24 class Geom_Point;
25
26 //! Constructs line datums to be used in construction of
27 //! composite shapes.
28 class AIS_Line : public AIS_InteractiveObject
29 {
30   DEFINE_STANDARD_RTTIEXT(AIS_Line, AIS_InteractiveObject)
31 public:
32
33   //! Initializes the line aLine.
34   Standard_EXPORT AIS_Line(const Handle(Geom_Line)& aLine);
35
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);
39
40   //! Returns the signature 5.
41   virtual Standard_Integer Signature() const Standard_OVERRIDE { return 5; }
42
43   //! Returns the type Datum.
44   virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; }
45
46   //! Constructs an infinite line.
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
56   //! instantiates an infinite line.
57   void SetLine (const Handle(Geom_Line)& theLine)
58   {
59     myComponent = theLine;
60     myLineIsSegment = Standard_False;
61   }
62
63   //! Sets the starting point thePStart and ending point thePEnd of the
64   //! infinite line to create a finite line segment.
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".
73   Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE;
74
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;
78
79   //! Removes the color setting and returns the original color.
80   Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
81
82   //! Removes the width setting and returns the original width.
83   Standard_EXPORT void UnsetWidth() Standard_OVERRIDE;
84
85 private:
86   
87   Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
88   
89   Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
90   
91   Standard_EXPORT void ComputeInfiniteLine (const Handle(Prs3d_Presentation)& aPresentation);
92   
93   Standard_EXPORT void ComputeSegmentLine (const Handle(Prs3d_Presentation)& aPresentation);
94   
95   Standard_EXPORT void ComputeInfiniteLineSelection (const Handle(SelectMgr_Selection)& aSelection);
96   
97   Standard_EXPORT void ComputeSegmentLineSelection (const Handle(SelectMgr_Selection)& aSelection);
98
99   //! Replace aspects of already computed groups with the new value.
100   void replaceWithNewLineAspect (const Handle(Prs3d_LineAspect)& theAspect);
101
102 private:
103
104   Handle(Geom_Line) myComponent;
105   Handle(Geom_Point) myStartPoint;
106   Handle(Geom_Point) myEndPoint;
107   Standard_Boolean myLineIsSegment;
108
109 };
110
111 DEFINE_STANDARD_HANDLE(AIS_Line, AIS_InteractiveObject)
112
113 #endif // _AIS_Line_HeaderFile