0025180: Visualization - Homogeneous transformation API in TKV3d
[occt.git] / src / AIS / AIS_Relation.hxx
CommitLineData
42cf5bc1 1// Created on: 1997-02-27
2// Created by: Odile Olivier
3// Copyright (c) 1997-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_Relation_HeaderFile
18#define _AIS_Relation_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_Type.hxx>
22
23#include <TopoDS_Shape.hxx>
24#include <Standard_Real.hxx>
25#include <gp_Pnt.hxx>
26#include <TCollection_ExtendedString.hxx>
27#include <Standard_Boolean.hxx>
28#include <DsgPrs_ArrowSide.hxx>
29#include <Standard_Integer.hxx>
30#include <gp_Pln.hxx>
31#include <AIS_KindOfSurface.hxx>
32#include <Bnd_Box.hxx>
33#include <AIS_InteractiveObject.hxx>
34#include <PrsMgr_TypeOfPresentation3d.hxx>
35#include <Quantity_NameOfColor.hxx>
36#include <AIS_KindOfInteractive.hxx>
37#include <AIS_KindOfDimension.hxx>
38#include <Aspect_TypeOfLine.hxx>
39#include <Aspect_TypeOfMarker.hxx>
40class Geom_Plane;
41class Geom_Surface;
42class Quantity_Color;
43class TopoDS_Shape;
44class gp_Pnt;
45class TCollection_ExtendedString;
46class Prs3d_Presentation;
47class TopoDS_Edge;
48class Geom_Curve;
49class TopoDS_Vertex;
50
51
52class AIS_Relation;
53DEFINE_STANDARD_HANDLE(AIS_Relation, AIS_InteractiveObject)
54
55//! One of the four types of interactive object in
56//! AIS,comprising dimensions and constraints. Serves
57//! as the abstract class for the seven relation classes as
58//! well as the seven dimension classes.
59//! The statuses available for relations between shapes are as follows:
60//! - 0 - there is no connection to a shape;
61//! - 1 - there is a connection to the first shape;
62//! - 2 - there is a connection to the second shape.
63//! The connection takes the form of an edge between the two shapes.
64class AIS_Relation : public AIS_InteractiveObject
65{
66
67public:
68
69
70 //! Allows you to provide settings for the color aColor
71 //! of the lines representing the relation between the two shapes.
72 Standard_EXPORT void SetColor (const Quantity_NameOfColor aColor) Standard_OVERRIDE;
73
74 Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE;
75
76 //! Allows you to remove settings for the color of the
77 //! lines representing the relation between the two shapes.
78 Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
79
80 virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE;
81
82 //! Indicates that the type of dimension is unknown.
83 Standard_EXPORT virtual AIS_KindOfDimension KindOfDimension() const;
84
85 //! Returns true if the interactive object is movable.
86 Standard_EXPORT virtual Standard_Boolean IsMovable() const;
87
88 const TopoDS_Shape& FirstShape() const;
89
90 Standard_EXPORT virtual void SetFirstShape (const TopoDS_Shape& aFShape);
91
92 //! Returns the second shape.
93 const TopoDS_Shape& SecondShape() const;
94
95 //! Allows you to identify the second shape aSShape
96 //! relative to the first.
97 Standard_EXPORT virtual void SetSecondShape (const TopoDS_Shape& aSShape);
98
99 void SetBndBox (const Standard_Real Xmin, const Standard_Real Ymin, const Standard_Real Zmin, const Standard_Real Xmax, const Standard_Real Ymax, const Standard_Real Zmax);
100
101 void UnsetBndBox();
102
103 //! Returns the plane.
104 const Handle(Geom_Plane)& Plane() const;
105
106
107 //! Allows you to set the plane aPlane. This is used to
108 //! define relations and dimensions in several daughter classes.
109 void SetPlane (const Handle(Geom_Plane)& aPlane);
110
111 //! Returns the value of each object in the relation.
112 Standard_Real Value() const;
113
114 //! Allows you to provide settings for the value aVal for
115 //! each object in the relation.
116 void SetValue (const Standard_Real aVal);
117
118 //! Returns the position set using SetPosition.
119 const gp_Pnt& Position() const;
120
121
122 //! Allows you to provide the objects in the relation with
123 //! settings for a non-default position.
124 void SetPosition (const gp_Pnt& aPosition);
125
126 //! Returns settings for text aspect.
127 const TCollection_ExtendedString& Text() const;
128
129 //! Allows you to provide the settings aText for text aspect.
130 void SetText (const TCollection_ExtendedString& aText);
131
132
133 //! Returns the value for the size of the arrow identifying
134 //! the relation between the two shapes.
135 Standard_Real ArrowSize() const;
136
137
138 //! Allows you to provide settings for the size of the
139 //! arrow anArrowsize identifying the relation between the two shapes.
140 void SetArrowSize (const Standard_Real anArrowSize);
141
142
143 //! Returns the value of the symbol presentation. This will be one of:
144 //! - AS_NONE - none
145 //! - AS_FIRSTAR - first arrow
146 //! - AS_LASTAR - last arrow
147 //! - AS_BOTHAR - both arrows
148 //! - AS_FIRSTPT - first point
149 //! - AS_LASTPT - last point
150 //! - AS_BOTHPT - both points
151 //! - AS_FIRSTAR_LASTPT - first arrow, last point
152 //! - AS_FIRSTPT_LASTAR - first point, last arrow
153 DsgPrs_ArrowSide SymbolPrs() const;
154
155
156 //! Allows you to provide settings for the symbol presentation.
157 void SetSymbolPrs (const DsgPrs_ArrowSide aSymbolPrs);
158
159
160 //! Allows you to set the status of the extension shape by
161 //! the index aIndex.
162 //! The status will be one of the following:
163 //! - 0 - there is no connection to a shape;
164 //! - 1 - there is a connection to the first shape;
165 //! - 2 - there is a connection to the second shape.
166 void SetExtShape (const Standard_Integer aIndex);
167
168
169 //! Returns the status index of the extension shape.
170 Standard_Integer ExtShape() const;
171
172
173 //! Returns true if the display mode aMode is accepted
174 //! for the Interactive Objects in the relation.
175 //! ComputeProjPresentation(me;
176 //! aPres : Presentation from Prs3d;
177 //! Curve1 : Curve from Geom;
178 //! Curve2 : Curve from Geom;
179 //! FirstP1 : Pnt from gp;
180 //! LastP1 : Pnt from gp;
181 //! FirstP2 : Pnt from gp;
182 //! LastP2 : Pnt from gp;
183 //! aColor : NameOfColor from Quantity = Quantity_NOC_PURPLE;
184 //! aWidth : Real from Standard = 2;
185 //! aProjTOL : TypeOfLine from Aspect = Aspect_TOL_DASH;
186 //! aCallTOL : TypeOfLine from Aspect = Aspect_TOL_DOT)
187 Standard_EXPORT virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer aMode) const Standard_OVERRIDE;
188
189 void SetAutomaticPosition (const Standard_Boolean aStatus);
190
191 Standard_Boolean AutomaticPosition() const;
192
193
194
195
92efcf78 196 DEFINE_STANDARD_RTTIEXT(AIS_Relation,AIS_InteractiveObject)
42cf5bc1 197
198protected:
199
200
201 Standard_EXPORT AIS_Relation(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView);
202
203 //! Calculates the presentation aPres of the the edge
204 //! anEdge and the curve it defines, ProjCurve. The later
205 //! is also specified by the first point FirstP and the last point LastP.
206 //! The presentation includes settings for color aColor,
207 //! type - aProjTOL and aCallTOL - and width of line, aWidth.
208 Standard_EXPORT void ComputeProjEdgePresentation (const Handle(Prs3d_Presentation)& aPres, const TopoDS_Edge& anEdge, const Handle(Geom_Curve)& ProjCurve, const gp_Pnt& FirstP, const gp_Pnt& LastP, const Quantity_NameOfColor aColor = Quantity_NOC_PURPLE, const Standard_Real aWidth = 2, const Aspect_TypeOfLine aProjTOL = Aspect_TOL_DASH, const Aspect_TypeOfLine aCallTOL = Aspect_TOL_DOT) const;
209
210 //! Calculates the presentation aPres of the the vertex
211 //! aVertex and the point it defines, ProjPoint.
212 //! The presentation includes settings for color aColor,
213 //! type - aProjTOM and aCallTOL - and width of line, aWidth.
214 Standard_EXPORT void ComputeProjVertexPresentation (const Handle(Prs3d_Presentation)& aPres, const TopoDS_Vertex& aVertex, const gp_Pnt& ProjPoint, const Quantity_NameOfColor aColor = Quantity_NOC_PURPLE, const Standard_Real aWidth = 2, const Aspect_TypeOfMarker aProjTOM = Aspect_TOM_PLUS, const Aspect_TypeOfLine aCallTOL = Aspect_TOL_DOT) const;
215
216 TopoDS_Shape myFShape;
217 TopoDS_Shape mySShape;
218 Handle(Geom_Plane) myPlane;
219 Standard_Real myVal;
220 gp_Pnt myPosition;
221 TCollection_ExtendedString myText;
222 Standard_Real myArrowSize;
223 Standard_Boolean myAutomaticPosition;
224 DsgPrs_ArrowSide mySymbolPrs;
225 Standard_Integer myExtShape;
226 gp_Pln myFirstPlane;
227 gp_Pln mySecondPlane;
228 Handle(Geom_Surface) myFirstBasisSurf;
229 Handle(Geom_Surface) mySecondBasisSurf;
230 AIS_KindOfSurface myFirstSurfType;
231 AIS_KindOfSurface mySecondSurfType;
232 Standard_Real myFirstOffset;
233 Standard_Real mySecondOffset;
234 Bnd_Box myBndBox;
235 Standard_Boolean myIsSetBndBox;
236 Standard_Boolean myArrowSizeIsDefined;
237
238
239private:
240
241
242
243
244};
245
246
247#include <AIS_Relation.lxx>
248
249
250
251
252
253#endif // _AIS_Relation_HeaderFile