0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[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;
87432b82 86
87 virtual Standard_Integer Signature() const Standard_OVERRIDE { return 2; }
88
89 virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; }
90
42cf5bc1 91 Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE;
92
93 Standard_EXPORT void SetWidth (const Standard_Real aValue) Standard_OVERRIDE;
94
95 Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
96
97 Standard_EXPORT void UnsetWidth() Standard_OVERRIDE;
98
42cf5bc1 99private:
100
42cf5bc1 101 Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
102
79104795 103 Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
42cf5bc1 104
105 Standard_EXPORT void ComputeFields();
106
87432b82 107private:
108
42cf5bc1 109 Handle(Geom_Line) myComponent;
110 Handle(Geom_Axis2Placement) myAx2;
111 gp_Pnt myPfirst;
112 gp_Pnt myPlast;
113 AIS_TypeOfAxis myTypeOfAxis;
114 Standard_Boolean myIsXYZAxis;
115 gp_Dir myDir;
116 Standard_Real myVal;
117 Standard_CString myText;
118 Handle(Prs3d_LineAspect) myLineAspect;
119
42cf5bc1 120};
121
87432b82 122DEFINE_STANDARD_HANDLE(AIS_Axis, AIS_InteractiveObject)
42cf5bc1 123
124#endif // _AIS_Axis_HeaderFile