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
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_Axis_HeaderFile
18 #define _AIS_Axis_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
24 #include <AIS_TypeOfAxis.hxx>
25 #include <Standard_Boolean.hxx>
27 #include <Standard_Real.hxx>
28 #include <Standard_CString.hxx>
29 #include <AIS_InteractiveObject.hxx>
30 #include <Standard_Integer.hxx>
31 #include <PrsMgr_PresentationManager3d.hxx>
32 #include <SelectMgr_Selection.hxx>
33 #include <AIS_KindOfInteractive.hxx>
34 #include <Quantity_NameOfColor.hxx>
36 class Geom_Axis2Placement;
37 class Prs3d_LineAspect;
38 class Geom_Axis1Placement;
39 class Prs3d_Presentation;
40 class Prs3d_Projector;
41 class Geom_Transformation;
46 DEFINE_STANDARD_HANDLE(AIS_Axis, AIS_InteractiveObject)
48 //! Locates the x, y and z axes in an Interactive Object.
49 //! These are used to orient it correctly in presentations
50 //! from different viewpoints, or to construct a revolved
51 //! shape, for example, from one of the axes. Conversely,
52 //! an axis can be created to build a revolved shape and
53 //! then situated relative to one of the axes of the view.
54 class AIS_Axis : public AIS_InteractiveObject
60 //! Initializes the line aComponent
61 Standard_EXPORT AIS_Axis(const Handle(Geom_Line)& aComponent);
63 //! initializes the axis2 position
64 //! aComponent. The coordinate system used is right-handed.
65 Standard_EXPORT AIS_Axis(const Handle(Geom_Axis2Placement)& aComponent, const AIS_TypeOfAxis anAxisType);
67 //! Initializes the axis1 position anAxis.
68 Standard_EXPORT AIS_Axis(const Handle(Geom_Axis1Placement)& anAxis);
71 //! Returns the axis entity aComponent and identifies it
72 //! as a component of a shape.
73 const Handle(Geom_Line)& Component() const;
75 //! Sets the coordinates of the lin aComponent.
76 Standard_EXPORT void SetComponent (const Handle(Geom_Line)& aComponent);
79 //! Returns the position of axis2 and positions it by
80 //! identifying it as the x, y, or z axis and giving its
81 //! direction in 3D space. The coordinate system used is right-handed.
82 const Handle(Geom_Axis2Placement)& Axis2Placement() const;
85 //! Allows you to provide settings for aComponent:the
86 //! position and direction of an axis in 3D space. The
87 //! coordinate system used is right-handed.
88 Standard_EXPORT void SetAxis2Placement (const Handle(Geom_Axis2Placement)& aComponent, const AIS_TypeOfAxis anAxisType);
90 //! Constructs a new line to serve as the axis anAxis in 3D space.
91 Standard_EXPORT void SetAxis1Placement (const Handle(Geom_Axis1Placement)& anAxis);
93 //! Returns the type of axis.
94 AIS_TypeOfAxis TypeOfAxis() const;
97 //! Constructs the entity aTypeAxis to stock information
98 //! concerning type of axis.
99 void SetTypeOfAxis (const AIS_TypeOfAxis aTypeAxis);
102 //! Returns a signature of 2 for axis datums. When you
103 //! activate mode 2 by a signature, you pick AIS objects
104 //! of type AIS_Axis.
105 Standard_Boolean IsXYZAxis() const;
107 //! Returns true if the interactive object accepts the display mode aMode.
108 Standard_EXPORT Standard_Boolean AcceptDisplayMode (const Standard_Integer aMode) const Standard_OVERRIDE;
110 //! computes the presentation according to a point of view
111 //! given by <aProjector>.
112 //! To be Used when the associated degenerated Presentations
113 //! have been transformed by <aTrsf> which is not a Pure
114 //! Translation. The HLR Prs can't be deducted automatically
115 //! WARNING :<aTrsf> must be applied
116 //! to the object to display before computation !!!
117 Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
119 virtual Standard_Integer Signature() const Standard_OVERRIDE;
121 virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE;
123 Standard_EXPORT void SetColor (const Quantity_NameOfColor aColor) Standard_OVERRIDE;
125 Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE;
127 Standard_EXPORT void SetWidth (const Standard_Real aValue) Standard_OVERRIDE;
129 Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
131 Standard_EXPORT void UnsetWidth() Standard_OVERRIDE;
136 DEFINE_STANDARD_RTTIEXT(AIS_Axis,AIS_InteractiveObject)
146 Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
148 Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
150 Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
152 Standard_EXPORT void ComputeFields();
154 Handle(Geom_Line) myComponent;
155 Handle(Geom_Axis2Placement) myAx2;
158 AIS_TypeOfAxis myTypeOfAxis;
159 Standard_Boolean myIsXYZAxis;
162 Standard_CString myText;
163 Handle(Prs3d_LineAspect) myLineAspect;
169 #include <AIS_Axis.lxx>
175 #endif // _AIS_Axis_HeaderFile