42cf5bc1 |
1 | // Created on: 1995-08-09 |
2 | // Created by: Arnaud BOUZY/Odile Olivier |
3 | // Copyright (c) 1995-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_Axis_HeaderFile |
18 | #define _AIS_Axis_HeaderFile |
19 | |
87432b82 |
20 | #include <AIS_InteractiveObject.hxx> |
42cf5bc1 |
21 | #include <AIS_TypeOfAxis.hxx> |
42cf5bc1 |
22 | #include <gp_Dir.hxx> |
87432b82 |
23 | #include <gp_Pnt.hxx> |
42cf5bc1 |
24 | #include <SelectMgr_Selection.hxx> |
87432b82 |
25 | |
42cf5bc1 |
26 | class Geom_Line; |
87432b82 |
27 | class Geom_Axis1Placement; |
42cf5bc1 |
28 | class Geom_Axis2Placement; |
29 | class Prs3d_LineAspect; |
42cf5bc1 |
30 | |
31 | //! Locates the x, y and z axes in an Interactive Object. |
32 | //! These are used to orient it correctly in presentations |
33 | //! from different viewpoints, or to construct a revolved |
34 | //! shape, for example, from one of the axes. Conversely, |
35 | //! an axis can be created to build a revolved shape and |
36 | //! then situated relative to one of the axes of the view. |
37 | class AIS_Axis : public AIS_InteractiveObject |
38 | { |
87432b82 |
39 | DEFINE_STANDARD_RTTIEXT(AIS_Axis, AIS_InteractiveObject) |
42cf5bc1 |
40 | public: |
41 | |
42cf5bc1 |
42 | //! Initializes the line aComponent |
43 | Standard_EXPORT AIS_Axis(const Handle(Geom_Line)& aComponent); |
87432b82 |
44 | |
42cf5bc1 |
45 | //! initializes the axis2 position |
46 | //! aComponent. The coordinate system used is right-handed. |
47 | Standard_EXPORT AIS_Axis(const Handle(Geom_Axis2Placement)& aComponent, const AIS_TypeOfAxis anAxisType); |
87432b82 |
48 | |
42cf5bc1 |
49 | //! Initializes the axis1 position anAxis. |
50 | Standard_EXPORT AIS_Axis(const Handle(Geom_Axis1Placement)& anAxis); |
42cf5bc1 |
51 | |
1f3c5058 |
52 | //! Initializes the ray as axis with start point and direction |
53 | //! @param[in] theAxis Start point and direction of the ray |
54 | //! @param[in] theLength Optional length of the ray (ray is infinite by default). |
55 | Standard_EXPORT AIS_Axis (const gp_Ax1& theAxis, const Standard_Real theLength = -1); |
56 | |
42cf5bc1 |
57 | //! Returns the axis entity aComponent and identifies it |
58 | //! as a component of a shape. |
87432b82 |
59 | const Handle(Geom_Line)& Component() const { return myComponent; } |
60 | |
42cf5bc1 |
61 | //! Sets the coordinates of the lin aComponent. |
62 | Standard_EXPORT void SetComponent (const Handle(Geom_Line)& aComponent); |
42cf5bc1 |
63 | |
64 | //! Returns the position of axis2 and positions it by |
65 | //! identifying it as the x, y, or z axis and giving its |
66 | //! direction in 3D space. The coordinate system used is right-handed. |
87432b82 |
67 | const Handle(Geom_Axis2Placement)& Axis2Placement() const { return myAx2; } |
42cf5bc1 |
68 | |
69 | //! Allows you to provide settings for aComponent:the |
70 | //! position and direction of an axis in 3D space. The |
71 | //! coordinate system used is right-handed. |
72 | Standard_EXPORT void SetAxis2Placement (const Handle(Geom_Axis2Placement)& aComponent, const AIS_TypeOfAxis anAxisType); |
73 | |
74 | //! Constructs a new line to serve as the axis anAxis in 3D space. |
75 | Standard_EXPORT void SetAxis1Placement (const Handle(Geom_Axis1Placement)& anAxis); |
76 | |
77 | //! Returns the type of axis. |
87432b82 |
78 | AIS_TypeOfAxis TypeOfAxis() const { return myTypeOfAxis; } |
42cf5bc1 |
79 | |
87432b82 |
80 | //! Constructs the entity theTypeAxis to stock information |
42cf5bc1 |
81 | //! concerning type of axis. |
87432b82 |
82 | void SetTypeOfAxis (const AIS_TypeOfAxis theTypeAxis) { myTypeOfAxis = theTypeAxis; } |
42cf5bc1 |
83 | |
84 | //! Returns a signature of 2 for axis datums. When you |
85 | //! activate mode 2 by a signature, you pick AIS objects |
86 | //! of type AIS_Axis. |
87432b82 |
87 | Standard_Boolean IsXYZAxis() const { return myIsXYZAxis; } |
88 | |
42cf5bc1 |
89 | //! Returns true if the interactive object accepts the display mode aMode. |
90 | Standard_EXPORT Standard_Boolean AcceptDisplayMode (const Standard_Integer aMode) const Standard_OVERRIDE; |
87432b82 |
91 | |
92 | virtual Standard_Integer Signature() const Standard_OVERRIDE { return 2; } |
93 | |
82b856b8 |
94 | virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KindOfInteractive_Datum; } |
87432b82 |
95 | |
42cf5bc1 |
96 | Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE; |
1f3c5058 |
97 | |
42cf5bc1 |
98 | Standard_EXPORT void SetWidth (const Standard_Real aValue) Standard_OVERRIDE; |
1f3c5058 |
99 | |
100 | //! Set required visualization parameters. |
101 | Standard_EXPORT void SetDisplayAspect (const Handle(Prs3d_LineAspect)& theNewDatumAspect); |
102 | |
42cf5bc1 |
103 | Standard_EXPORT void UnsetColor() Standard_OVERRIDE; |
1f3c5058 |
104 | |
42cf5bc1 |
105 | Standard_EXPORT void UnsetWidth() Standard_OVERRIDE; |
106 | |
42cf5bc1 |
107 | private: |
108 | |
decbff0d |
109 | Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, |
110 | const Handle(Prs3d_Presentation)& thePrs, |
111 | const Standard_Integer theMode) Standard_OVERRIDE; |
112 | |
113 | Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSel, |
114 | const Standard_Integer theMode) Standard_OVERRIDE; |
115 | |
42cf5bc1 |
116 | Standard_EXPORT void ComputeFields(); |
117 | |
87432b82 |
118 | private: |
119 | |
42cf5bc1 |
120 | Handle(Geom_Line) myComponent; |
121 | Handle(Geom_Axis2Placement) myAx2; |
122 | gp_Pnt myPfirst; |
123 | gp_Pnt myPlast; |
124 | AIS_TypeOfAxis myTypeOfAxis; |
125 | Standard_Boolean myIsXYZAxis; |
126 | gp_Dir myDir; |
127 | Standard_Real myVal; |
128 | Standard_CString myText; |
129 | Handle(Prs3d_LineAspect) myLineAspect; |
130 | |
42cf5bc1 |
131 | }; |
132 | |
87432b82 |
133 | DEFINE_STANDARD_HANDLE(AIS_Axis, AIS_InteractiveObject) |
42cf5bc1 |
134 | |
135 | #endif // _AIS_Axis_HeaderFile |