0028726: Quantity_NameOfColor should be replaced by Quantity_Color in function input...
[occt.git] / src / AIS / AIS_Axis.hxx
CommitLineData
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 26class Geom_Line;
87432b82 27class Geom_Axis1Placement;
42cf5bc1 28class Geom_Axis2Placement;
29class 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.
37class AIS_Axis : public AIS_InteractiveObject
38{
87432b82 39 DEFINE_STANDARD_RTTIEXT(AIS_Axis, AIS_InteractiveObject)
42cf5bc1 40public:
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
52 //! Returns the axis entity aComponent and identifies it
53 //! as a component of a shape.
87432b82 54 const Handle(Geom_Line)& Component() const { return myComponent; }
55
42cf5bc1 56 //! Sets the coordinates of the lin aComponent.
57 Standard_EXPORT void SetComponent (const Handle(Geom_Line)& aComponent);
42cf5bc1 58
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.
87432b82 62 const Handle(Geom_Axis2Placement)& Axis2Placement() const { return myAx2; }
42cf5bc1 63
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);
68
69 //! Constructs a new line to serve as the axis anAxis in 3D space.
70 Standard_EXPORT void SetAxis1Placement (const Handle(Geom_Axis1Placement)& anAxis);
71
72 //! Returns the type of axis.
87432b82 73 AIS_TypeOfAxis TypeOfAxis() const { return myTypeOfAxis; }
42cf5bc1 74
87432b82 75 //! Constructs the entity theTypeAxis to stock information
42cf5bc1 76 //! concerning type of axis.
87432b82 77 void SetTypeOfAxis (const AIS_TypeOfAxis theTypeAxis) { myTypeOfAxis = theTypeAxis; }
42cf5bc1 78
79 //! Returns a signature of 2 for axis datums. When you
80 //! activate mode 2 by a signature, you pick AIS objects
81 //! of type AIS_Axis.
87432b82 82 Standard_Boolean IsXYZAxis() const { return myIsXYZAxis; }
83
42cf5bc1 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;
86
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;
87432b82 95
96 virtual Standard_Integer Signature() const Standard_OVERRIDE { return 2; }
97
98 virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; }
99
42cf5bc1 100 Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE;
101
102 Standard_EXPORT void SetWidth (const Standard_Real aValue) Standard_OVERRIDE;
103
104 Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
105
106 Standard_EXPORT void UnsetWidth() Standard_OVERRIDE;
107
42cf5bc1 108private:
109
42cf5bc1 110 Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
111
112 Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
113
79104795 114 Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
42cf5bc1 115
116 Standard_EXPORT void ComputeFields();
117
87432b82 118private:
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 133DEFINE_STANDARD_HANDLE(AIS_Axis, AIS_InteractiveObject)
42cf5bc1 134
135#endif // _AIS_Axis_HeaderFile