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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _AIS_Line_HeaderFile
18 #define _AIS_Line_HeaderFile
20 #include <AIS_InteractiveObject.hxx>
21 #include <AIS_KindOfInteractive.hxx>
26 //! Constructs line datums to be used in construction of
28 class AIS_Line : public AIS_InteractiveObject
30 DEFINE_STANDARD_RTTIEXT(AIS_Line, AIS_InteractiveObject)
33 //! Initializes the line aLine.
34 Standard_EXPORT AIS_Line(const Handle(Geom_Line)& aLine);
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);
40 //! Returns the signature 5.
41 virtual Standard_Integer Signature() const Standard_OVERRIDE { return 5; }
43 //! Returns the type Datum.
44 virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; }
46 //! Constructs an infinite line.
47 const Handle(Geom_Line)& Line() const { return myComponent; }
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
52 thePStart = myStartPoint;
56 //! instantiates an infinite line.
57 void SetLine (const Handle(Geom_Line)& theLine)
59 myComponent = theLine;
60 myLineIsSegment = Standard_False;
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)
67 myStartPoint = thePStart;
69 myLineIsSegment = Standard_True;
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;
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;
79 //! Removes the color setting and returns the original color.
80 Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
82 //! Removes the width setting and returns the original width.
83 Standard_EXPORT void UnsetWidth() Standard_OVERRIDE;
87 Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
89 Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
91 Standard_EXPORT void ComputeInfiniteLine (const Handle(Prs3d_Presentation)& aPresentation);
93 Standard_EXPORT void ComputeSegmentLine (const Handle(Prs3d_Presentation)& aPresentation);
95 Standard_EXPORT void ComputeInfiniteLineSelection (const Handle(SelectMgr_Selection)& aSelection);
97 Standard_EXPORT void ComputeSegmentLineSelection (const Handle(SelectMgr_Selection)& aSelection);
99 //! Replace aspects of already computed groups with the new value.
100 void replaceWithNewLineAspect (const Handle(Prs3d_LineAspect)& theAspect);
104 Handle(Geom_Line) myComponent;
105 Handle(Geom_Point) myStartPoint;
106 Handle(Geom_Point) myEndPoint;
107 Standard_Boolean myLineIsSegment;
111 DEFINE_STANDARD_HANDLE(AIS_Line, AIS_InteractiveObject)
113 #endif // _AIS_Line_HeaderFile