0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / AIS / AIS_Line.hxx
CommitLineData
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 23class Geom_Line;
24class Geom_Point;
42cf5bc1 25
26//! Constructs line datums to be used in construction of
27//! composite shapes.
28class AIS_Line : public AIS_InteractiveObject
29{
87432b82 30 DEFINE_STANDARD_RTTIEXT(AIS_Line, AIS_InteractiveObject)
42cf5bc1 31public:
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.
87432b82 44 virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; }
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 85private:
42cf5bc1 86
87 Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
88
79104795 89 Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
42cf5bc1 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
226fce20 99 //! Replace aspects of already computed groups with the new value.
100 void replaceWithNewLineAspect (const Handle(Prs3d_LineAspect)& theAspect);
101
87432b82 102private:
103
42cf5bc1 104 Handle(Geom_Line) myComponent;
105 Handle(Geom_Point) myStartPoint;
106 Handle(Geom_Point) myEndPoint;
107 Standard_Boolean myLineIsSegment;
108
42cf5bc1 109};
110
87432b82 111DEFINE_STANDARD_HANDLE(AIS_Line, AIS_InteractiveObject)
42cf5bc1 112
113#endif // _AIS_Line_HeaderFile