1 // Copyright (C) 2014-2019 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef GeomAPI_AISObject_H_
21 #define GeomAPI_AISObject_H_
23 #include <GeomAPI_Interface.h>
33 /** \class GeomAPI_AISObject
35 * \brief Interface for AIS_InteractiveObject
38 class GeomAPI_AISObject : public GeomAPI_Interface
41 /// \brief Creation of empty AIS object
48 /// \brief Creates AIS_Shape object using specified shape
50 void createShape(std::shared_ptr<GeomAPI_Shape> theShape);
52 /// Returns shape used for the presentation creation (can be NULL)
53 GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Shape> getShape() const;
55 /** \brief Creates AIS_LengthDimension object
56 * \param[in] theStartPoint first point for dimension
57 * \param[in] theEndPoint second point for dimension
58 * \param[in] theFlyoutPoint the flyout of dimension relative to the measured line
59 * \param[in] thePlane the plane which contains all points above
60 * \param[in] theDistance value of the distance to be shown
63 void createDistance(std::shared_ptr<GeomAPI_Pnt> theStartPoint,
64 std::shared_ptr<GeomAPI_Pnt> theEndPoint,
65 std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
66 std::shared_ptr<GeomAPI_Pln> thePlane, double theDistance);
69 * Returns validity of the AIS distance. It is invalid if set measured geometry is not valid,
70 * e.g. the distance points are equal.
71 * \return a boolean result
74 bool isEmptyDistanceGeometry();
76 /** \brief Creates AIS_RadiusDimension object
77 * \param[in] theCircle the radius is created for this circle
78 * \param[in] theFlyoutPoint the flyout of dimension
79 * \param[in] theRadius value of the radius to be shown
82 void createRadius(std::shared_ptr<GeomAPI_Circ> theCircle,
83 std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint, double theRadius);
85 /** \brief Creates AIS_ParallelRelation object for two lines
86 * \param[in] theLine1 first parallel line
87 * \param[in] theLine2 second parallel line
88 * \param[in] theFlyoutPoint the flyout point for relation
89 * \param[in] thePlane the plane which contains the lines
92 void createParallel(std::shared_ptr<GeomAPI_Shape> theLine1,
93 std::shared_ptr<GeomAPI_Shape> theLine2,
94 std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
95 std::shared_ptr<GeomAPI_Pln> thePlane);
97 /** \brief Creates AIS_PerpendicularRelation object for two lines
98 * \param[in] theLine1 first parallel line
99 * \param[in] theLine2 second parallel line
100 * \param[in] thePlane the plane which contains the lines
103 void createPerpendicular(std::shared_ptr<GeomAPI_Shape> theLine1,
104 std::shared_ptr<GeomAPI_Shape> theLine2,
105 std::shared_ptr<GeomAPI_Pln> thePlane);
107 /** \brief Creates AIS_FixedRelation object for an object
108 * \param[in] theShape the object
109 * \param[in] thePlane the plane which contains the lines
112 void createFixed(std::shared_ptr<GeomAPI_Shape> theShape,
113 std::shared_ptr<GeomAPI_Pln> thePlane);
115 /** \brief Assigns the color for the shape
116 * \param[in] theColor index of the color
119 void setColor(const int& theColor);
121 /** \brief Assigns the color for the shape
122 * \param[in] theR value of the red component
123 * \param[in] theG value of the green component
124 * \param[in] theB value of the blue component
125 * \returns true if the presentation color is changed
128 bool setColor(int theR, int theG, int theB);
130 /** \brief Returns the color for the shape
131 * \param[in] theR value of the red component
132 * \param[in] theG value of the green component
133 * \param[in] theB value of the blue component
136 void getColor(int& theR, int& theG, int& theB);
138 /** \brief Assigns the deflection to the shape
139 * \param[in] theDeflection value of deflection
142 bool setDeflection(const double theDeflection);
144 /** \brief Returns deflection for the shape
145 * \return double value
148 double getDeflection() const;
150 /** \brief Assigns the transparency to the shape
151 * \param[in] theTransparency value of transparency
154 bool setTransparency(const double theTransparency);
156 /** \brief Returns deflection for the shape
157 * \return double value
160 double getTransparency() const;
162 /// \return Current width of the lines of shape
166 /// \brief Assigns the width of the lines of shape
168 bool setWidth(const double& theWidth);
170 /// \brief Checks if the object is empty
174 /// Return shape type according to TopAbs_ShapeEnum if the AIS is AIS_Shape
175 /// Otherwise returns -1
177 int getShapeType() const;
179 /// Sets marker type for vertex.
180 /// The type has to be defined according to Acpect_TypeOfMarker
182 void setPointMarker(int theType, double theScale);
184 /// Set line type of edges
185 /// Has to be defined according to Aspect_TypeOfLine
186 /// \returns true if the object value differs from the current
188 bool setLineStyle(int theStyle);
190 /// Set transparency of the presentation (theVal = 0 ... 1)
191 /// \returns true if the object value differs from the current
193 bool setTransparensy(double theVal);
196 //! Pointer on attribute object
197 typedef std::shared_ptr<GeomAPI_AISObject> AISObjectPtr;