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