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 <AIS_InteractiveObject.hxx>
21 #include <AIS_TypeOfAxis.hxx>
24 #include <SelectMgr_Selection.hxx>
27 class Geom_Axis1Placement;
28 class Geom_Axis2Placement;
29 class Prs3d_LineAspect;
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
39 DEFINE_STANDARD_RTTIEXT(AIS_Axis, AIS_InteractiveObject)
42 //! Initializes the line aComponent
43 Standard_EXPORT AIS_Axis(const Handle(Geom_Line)& aComponent);
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);
49 //! Initializes the axis1 position anAxis.
50 Standard_EXPORT AIS_Axis(const Handle(Geom_Axis1Placement)& anAxis);
52 //! Returns the axis entity aComponent and identifies it
53 //! as a component of a shape.
54 const Handle(Geom_Line)& Component() const { return myComponent; }
56 //! Sets the coordinates of the lin aComponent.
57 Standard_EXPORT void SetComponent (const Handle(Geom_Line)& aComponent);
59 //! Returns the position of axis2 and positions it by
60 //! identifying it as the x, y, or z axis and giving its
61 //! direction in 3D space. The coordinate system used is right-handed.
62 const Handle(Geom_Axis2Placement)& Axis2Placement() const { return myAx2; }
64 //! Allows you to provide settings for aComponent:the
65 //! position and direction of an axis in 3D space. The
66 //! coordinate system used is right-handed.
67 Standard_EXPORT void SetAxis2Placement (const Handle(Geom_Axis2Placement)& aComponent, const AIS_TypeOfAxis anAxisType);
69 //! Constructs a new line to serve as the axis anAxis in 3D space.
70 Standard_EXPORT void SetAxis1Placement (const Handle(Geom_Axis1Placement)& anAxis);
72 //! Returns the type of axis.
73 AIS_TypeOfAxis TypeOfAxis() const { return myTypeOfAxis; }
75 //! Constructs the entity theTypeAxis to stock information
76 //! concerning type of axis.
77 void SetTypeOfAxis (const AIS_TypeOfAxis theTypeAxis) { myTypeOfAxis = theTypeAxis; }
79 //! Returns a signature of 2 for axis datums. When you
80 //! activate mode 2 by a signature, you pick AIS objects
82 Standard_Boolean IsXYZAxis() const { return myIsXYZAxis; }
84 //! Returns true if the interactive object accepts the display mode aMode.
85 Standard_EXPORT Standard_Boolean AcceptDisplayMode (const Standard_Integer aMode) const Standard_OVERRIDE;
87 //! computes the presentation according to a point of view
88 //! given by <aProjector>.
89 //! To be Used when the associated degenerated Presentations
90 //! have been transformed by <aTrsf> which is not a Pure
91 //! Translation. The HLR Prs can't be deducted automatically
92 //! WARNING :<aTrsf> must be applied
93 //! to the object to display before computation !!!
94 Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
96 virtual Standard_Integer Signature() const Standard_OVERRIDE { return 2; }
98 virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; }
100 Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE;
102 Standard_EXPORT void SetWidth (const Standard_Real aValue) Standard_OVERRIDE;
104 Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
106 Standard_EXPORT void UnsetWidth() Standard_OVERRIDE;
110 Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
112 Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
114 Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
116 Standard_EXPORT void ComputeFields();
120 Handle(Geom_Line) myComponent;
121 Handle(Geom_Axis2Placement) myAx2;
124 AIS_TypeOfAxis myTypeOfAxis;
125 Standard_Boolean myIsXYZAxis;
128 Standard_CString myText;
129 Handle(Prs3d_LineAspect) myLineAspect;
133 DEFINE_STANDARD_HANDLE(AIS_Axis, AIS_InteractiveObject)
135 #endif // _AIS_Axis_HeaderFile