0028726: Quantity_NameOfColor should be replaced by Quantity_Color in function input...
[occt.git] / src / AIS / AIS_Plane.hxx
CommitLineData
42cf5bc1 1// Created on: 1995-08-02
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_Plane_HeaderFile
18#define _AIS_Plane_HeaderFile
19
87432b82 20#include <AIS_InteractiveObject.hxx>
42cf5bc1 21#include <AIS_TypeOfPlane.hxx>
87432b82 22#include <gp_Pnt.hxx>
42cf5bc1 23#include <Select3D_TypeOfSensitivity.hxx>
87432b82 24
42cf5bc1 25class Geom_Plane;
26class Geom_Axis2Placement;
27class gp_Pnt;
42cf5bc1 28
29//! Constructs plane datums to be used in construction of
30//! composite shapes.
31class AIS_Plane : public AIS_InteractiveObject
32{
87432b82 33 DEFINE_STANDARD_RTTIEXT(AIS_Plane, AIS_InteractiveObject)
42cf5bc1 34public:
35
42cf5bc1 36 //! initializes the plane aComponent. If
37 //! the mode aCurrentMode equals true, the drawing
38 //! tool, "Drawer" is not initialized.
39 Standard_EXPORT AIS_Plane(const Handle(Geom_Plane)& aComponent, const Standard_Boolean aCurrentMode = Standard_False);
40
41 //! initializes the plane aComponent and
42 //! the point aCenter. If the mode aCurrentMode
43 //! equals true, the drawing tool, "Drawer" is not
44 //! initialized. aCurrentMode equals true, the drawing
45 //! tool, "Drawer" is not initialized.
46 Standard_EXPORT AIS_Plane(const Handle(Geom_Plane)& aComponent, const gp_Pnt& aCenter, const Standard_Boolean aCurrentMode = Standard_False);
47
48 //! initializes the plane aComponent, the
49 //! point aCenter, and the minimum and maximum
50 //! points, aPmin and aPmax. If the mode
51 //! aCurrentMode equals true, the drawing tool, "Drawer" is not initialized.
52 Standard_EXPORT AIS_Plane(const Handle(Geom_Plane)& aComponent, const gp_Pnt& aCenter, const gp_Pnt& aPmin, const gp_Pnt& aPmax, const Standard_Boolean aCurrentMode = Standard_False);
53
54 Standard_EXPORT AIS_Plane(const Handle(Geom_Axis2Placement)& aComponent, const AIS_TypeOfPlane aPlaneType, const Standard_Boolean aCurrentMode = Standard_False);
55
56 //! Same value for x and y directions
57 Standard_EXPORT void SetSize (const Standard_Real aValue);
58
59 //! Sets the size defined by the length along the X axis
60 //! XVal and the length along the Y axis YVal.
61 Standard_EXPORT void SetSize (const Standard_Real Xval, const Standard_Real YVal);
62
63 Standard_EXPORT void UnsetSize();
64
65 Standard_EXPORT Standard_Boolean Size (Standard_Real& X, Standard_Real& Y) const;
87432b82 66
67 Standard_Boolean HasOwnSize() const { return myHasOwnSize; }
68
42cf5bc1 69 Standard_EXPORT virtual Standard_Integer Signature() const Standard_OVERRIDE;
70
71 Standard_EXPORT virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE;
72
73 //! Returns the component specified in SetComponent.
87432b82 74 const Handle(Geom_Plane)& Component() { return myComponent; }
75
42cf5bc1 76 //! Creates an instance of the plane aComponent.
77 Standard_EXPORT void SetComponent (const Handle(Geom_Plane)& aComponent);
78
79 //! Returns the settings for the selected plane
80 //! aComponent, provided in SetPlaneAttributes.
81 //! These include the points aCenter, aPmin, and aPmax
82 Standard_EXPORT Standard_Boolean PlaneAttributes (Handle(Geom_Plane)& aComponent, gp_Pnt& aCenter, gp_Pnt& aPmin, gp_Pnt& aPmax);
83
84 //! Allows you to provide settings other than default ones
85 //! for the selected plane. These include: center point
86 //! aCenter, maximum aPmax and minimum aPmin.
87 Standard_EXPORT void SetPlaneAttributes (const Handle(Geom_Plane)& aComponent, const gp_Pnt& aCenter, const gp_Pnt& aPmin, const gp_Pnt& aPmax);
87432b82 88
42cf5bc1 89 //! Returns the coordinates of the center point.
87432b82 90 const gp_Pnt& Center() const { return myCenter; }
91
92 //! Provides settings for the center theCenter other than (0, 0, 0).
93 void SetCenter (const gp_Pnt& theCenter) { myCenter = theCenter; }
42cf5bc1 94
42cf5bc1 95 //! Allows you to provide settings for the position and
96 //! direction of one of the plane's axes, aComponent, in
97 //! 3D space. The coordinate system used is
98 //! right-handed, and the type of plane aPlaneType is one of:
99 //! - AIS_ TOPL_Unknown
100 //! - AIS_ TOPL_XYPlane
101 //! - AIS_ TOPL_XZPlane
102 //! - AIS_ TOPL_YZPlane}.
103 Standard_EXPORT void SetAxis2Placement (const Handle(Geom_Axis2Placement)& aComponent, const AIS_TypeOfPlane aPlaneType);
104
105 //! Returns the position of the plane's axis2 system
106 //! identifying the x, y, or z axis and giving the plane a
107 //! direction in 3D space. An axis2 system is a right-handed coordinate system.
108 Standard_EXPORT Handle(Geom_Axis2Placement) Axis2Placement();
109
110 //! Returns the type of plane - xy, yz, xz or unknown.
87432b82 111 AIS_TypeOfPlane TypeOfPlane() { return myTypeOfPlane; }
112
42cf5bc1 113 //! Returns the type of plane - xy, yz, or xz.
87432b82 114 Standard_Boolean IsXYZPlane() { return myIsXYZPlane; }
115
42cf5bc1 116 //! Returns the non-default current display mode set by SetCurrentMode.
87432b82 117 Standard_Boolean CurrentMode() { return myCurrentMode; }
42cf5bc1 118
119 //! Allows you to provide settings for a non-default
120 //! current display mode.
87432b82 121 void SetCurrentMode (const Standard_Boolean theCurrentMode) { myCurrentMode = theCurrentMode; }
122
42cf5bc1 123 //! Returns true if the display mode selected, aMode, is valid for planes.
124 Standard_EXPORT virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer aMode) const Standard_OVERRIDE;
125
126 //! connection to <aCtx> default drawer implies a recomputation of Frame values.
127 Standard_EXPORT virtual void SetContext (const Handle(AIS_InteractiveContext)& aCtx) Standard_OVERRIDE;
87432b82 128
42cf5bc1 129 //! Returns the type of sensitivity for the plane;
87432b82 130 Select3D_TypeOfSensitivity TypeOfSensitivity() const { return myTypeOfSensitivity; }
131
42cf5bc1 132 //! Sets the type of sensitivity for the plane.
87432b82 133 void SetTypeOfSensitivity (Select3D_TypeOfSensitivity theTypeOfSensitivity) { myTypeOfSensitivity = theTypeOfSensitivity; }
134
42cf5bc1 135 //! computes the presentation according to a point of view
136 //! given by <aProjector>.
137 //! To be Used when the associated degenerated Presentations
138 //! have been transformed by <aTrsf> which is not a Pure
139 //! Translation. The HLR Prs can't be deducted automatically
140 //! WARNING :<aTrsf> must be applied
141 //! to the object to display before computation !!!
142 Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
143
144 Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection, const Standard_Integer theMode) Standard_OVERRIDE;
42cf5bc1 145
87432b82 146 Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE;
42cf5bc1 147
87432b82 148 Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
42cf5bc1 149
150private:
151
42cf5bc1 152 Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
153
154 Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
155
156 Standard_EXPORT void ComputeFrame();
157
158 Standard_EXPORT void ComputeFields();
159
160 Standard_EXPORT void InitDrawerAttributes();
161
87432b82 162private:
163
42cf5bc1 164 Handle(Geom_Plane) myComponent;
165 Handle(Geom_Axis2Placement) myAx2;
166 gp_Pnt myCenter;
167 gp_Pnt myPmin;
168 gp_Pnt myPmax;
169 Standard_Boolean myCurrentMode;
170 Standard_Boolean myAutomaticPosition;
171 AIS_TypeOfPlane myTypeOfPlane;
172 Standard_Boolean myIsXYZPlane;
173 Standard_Boolean myHasOwnSize;
174 Select3D_TypeOfSensitivity myTypeOfSensitivity;
175
42cf5bc1 176};
177
87432b82 178DEFINE_STANDARD_HANDLE(AIS_Plane, AIS_InteractiveObject)
42cf5bc1 179
180#endif // _AIS_Plane_HeaderFile