1 // Created on: 1995-10-09
2 // Created by: Arnaud BOUZY/Odile Olivier
3 // Copyright (c) 1995-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_Trihedron_HeaderFile
18 #define _AIS_Trihedron_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Standard_Boolean.hxx>
24 #include <Quantity_NameOfColor.hxx>
25 #include <AIS_InteractiveObject.hxx>
26 #include <Standard_Real.hxx>
27 #include <Standard_Integer.hxx>
28 #include <PrsMgr_PresentationManager3d.hxx>
29 #include <SelectMgr_Selection.hxx>
30 #include <AIS_KindOfInteractive.hxx>
31 #include <TColgp_Array1OfPnt.hxx>
32 class Geom_Axis2Placement;
33 class AIS_InteractiveObject;
37 class AIS_InteractiveContext;
38 class Prs3d_Presentation;
39 class Prs3d_Projector;
40 class Geom_Transformation;
46 DEFINE_STANDARD_HANDLE(AIS_Trihedron, AIS_InteractiveObject)
48 //! Create a selectable trihedron
49 //! there are 4 modes of selection :
50 //! mode = 0 to select triedron ,priority = 1
51 //! mode = 1 to select its origine ,priority = 5
52 //! mode = 2 to select its axis ,priority = 3
53 //! mode = 3 to select its planes ,priority = 2
54 //! a trihedron has 1 origine,3 axes,3 planes.
56 //! For the presentation of trihedra, the default unit of
57 //! length is the millimetre, and the default value for the
58 //! representation of the axes is 100. If you modify these
59 //! dimensions, you must temporarily recover the Drawer.
60 //! From inside it, you take the aspect in which the values
61 //! for length are stocked. For trihedra, this is
62 //! Prs3d_Drawer_FirstAxisAspect. You change the
63 //! values inside this Aspect and recalculate the presentation.
64 //! If you want to use extended selection modes, different than 0,
65 //! you should take care of removing of the shapes from the interactive
66 //! context that has been computed for selection; it might be necessary
67 //! when you change selection mode. You can use methods Axis, Point,
68 //! Plane to retrieve the shapes.
69 class AIS_Trihedron : public AIS_InteractiveObject
75 //! Initializes a trihedron entity.
76 Standard_EXPORT AIS_Trihedron(const Handle(Geom_Axis2Placement)& aComponent);
78 //! Returns the right-handed coordinate system set in SetComponent.
79 const Handle(Geom_Axis2Placement)& Component() const;
81 //! Constructs the right-handed coordinate system aComponent.
82 Standard_EXPORT void SetComponent (const Handle(Geom_Axis2Placement)& aComponent);
84 //! Returns true if the trihedron object has a size other
85 //! than the default size of 100 mm. along each axis.
86 Standard_Boolean HasOwnSize() const;
88 //! Sets the size aValue for the trihedron object.
89 //! The default value is 100 mm.
90 Standard_EXPORT void SetSize (const Standard_Real aValue);
92 //! Removes any non-default settings for size of this
94 Standard_EXPORT void UnsetSize();
96 Standard_EXPORT Standard_Real Size() const;
98 //! Returns the "XAxis".
99 Standard_EXPORT Handle(AIS_Axis) XAxis() const;
101 //! Returns the "YAxis".
102 Standard_EXPORT Handle(AIS_Axis) YAxis() const;
104 //! Returns the main Axis.
105 Standard_EXPORT Handle(AIS_Axis) Axis() const;
107 //! Returns the origine.
108 Standard_EXPORT Handle(AIS_Point) Position() const;
110 //! Returns the "XYPlane".
111 Standard_EXPORT Handle(AIS_Plane) XYPlane() const;
113 //! Returns the "XZPlane".
114 Standard_EXPORT Handle(AIS_Plane) XZPlane() const;
116 //! Returns the "YZPlane".
117 Standard_EXPORT Handle(AIS_Plane) YZPlane() const;
119 //! connection to <aCtx> default drawer implies a recomputation
120 //! of SubObjects values.
121 Standard_EXPORT virtual void SetContext (const Handle(AIS_InteractiveContext)& aCtx) Standard_OVERRIDE;
123 //! Returns true if the display mode selected, aMode, is
124 //! valid for trihedron datums.
125 Standard_EXPORT Standard_Boolean AcceptDisplayMode (const Standard_Integer aMode) const Standard_OVERRIDE;
127 //! Computes the presentation according to a point of view
128 //! given by <aProjector>.
129 //! To be Used when the associated degenerated Presentations
130 //! have been transformed by <aTrsf> which is not a Pure
131 //! Translation. The HLR Prs can't be deducted automatically
132 //! WARNING :<aTrsf> must be applied
133 //! to the object to display before computation !!!
134 Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
136 Standard_EXPORT void SetLocalTransformation (const gp_Trsf& theTransformation) Standard_OVERRIDE;
138 //! Returns index 3, selection of the planes XOY, YOZ, XOZ.
139 Standard_EXPORT virtual Standard_Integer Signature() const Standard_OVERRIDE;
141 //! Indicates that the type of Interactive Object is datum.
142 Standard_EXPORT virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE;
144 Standard_EXPORT void SetColor (const Quantity_NameOfColor aColor) Standard_OVERRIDE;
146 //! Sets the color aColor for this trihedron object.
147 Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE;
149 Standard_EXPORT void SetTextColor (const Quantity_NameOfColor aColor);
151 Standard_EXPORT Standard_Boolean HasTextColor() const;
153 Standard_EXPORT Quantity_NameOfColor TextColor() const;
155 Standard_EXPORT void SetArrowColor (const Quantity_NameOfColor aColor);
157 Standard_EXPORT Standard_Boolean HasArrowColor() const;
159 Standard_EXPORT Quantity_NameOfColor ArrowColor() const;
161 //! Returns the four extremities of the trihedron from the
162 //! array of points, TheExtrem.
163 Standard_EXPORT void ExtremityPoints (TColgp_Array1OfPnt& TheExtrem) const;
165 //! Removes the settings for color.
166 Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
168 //! Removes the non-default settings for width set in SetWidth.
169 Standard_EXPORT void UnsetWidth() Standard_OVERRIDE;
171 DEFINE_STANDARD_RTTI(AIS_Trihedron,AIS_InteractiveObject)
181 Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
183 Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
185 Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
187 Standard_EXPORT void LoadSubObjects();
191 Handle(Geom_Axis2Placement) myComponent;
192 Handle(AIS_InteractiveObject) myShapes[7];
193 Standard_Boolean myHasOwnSize;
194 Standard_Boolean myHasOwnTextColor;
195 Quantity_NameOfColor myOwnTextColor;
196 Standard_Boolean myHasOwnArrowColor;
197 Quantity_NameOfColor myOwnArrowColor;
201 #include <AIS_Trihedron.lxx>
207 #endif // _AIS_Trihedron_HeaderFile