1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef GeomAPI_AISObject_H_
22 #define GeomAPI_AISObject_H_
24 #include <GeomAPI_Interface.h>
34 /** \class GeomAPI_AISObject
36 * \brief Interface for AIS_InteractiveObject
39 class GeomAPI_AISObject : public GeomAPI_Interface
42 /// \brief Creation of empty AIS object
49 /// \brief Creates AIS_Shape object using specified shape
51 void createShape(std::shared_ptr<GeomAPI_Shape> theShape);
53 /// Reyirns shape used for the presentation creation (can be NULL)
54 GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Shape> getShape() const;
56 /** \brief Creates AIS_LengthDimension object
57 * \param[in] theStartPoint first point for dimension
58 * \param[in] theEndPoint second point for dimension
59 * \param[in] theFlyoutPoint the flyout of dimension relative to the measured line
60 * \param[in] thePlane the plane which contains all points above
61 * \param[in] theDistance value of the distance to be shown
64 void createDistance(std::shared_ptr<GeomAPI_Pnt> theStartPoint,
65 std::shared_ptr<GeomAPI_Pnt> theEndPoint,
66 std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
67 std::shared_ptr<GeomAPI_Pln> thePlane, double theDistance);
70 * Returns validity of the AIS distance. It is invalid if set measured geometry is not valid,
71 * e.g. the distance points are equal.
72 * \return a boolean result
75 bool isEmptyDistanceGeometry();
77 /** \brief Creates AIS_RadiusDimension object
78 * \param[in] theCircle the radius is created for this circle
79 * \param[in] theFlyoutPoint the flyout of dimension
80 * \param[in] theRadius value of the radius to be shown
83 void createRadius(std::shared_ptr<GeomAPI_Circ> theCircle,
84 std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint, double theRadius);
86 /** \brief Creates AIS_ParallelRelation object for two lines
87 * \param[in] theLine1 first parallel line
88 * \param[in] theLine2 second parallel line
89 * \param[in] theFlyoutPoint the flyout point for relation
90 * \param[in] thePlane the plane which contains the lines
93 void createParallel(std::shared_ptr<GeomAPI_Shape> theLine1,
94 std::shared_ptr<GeomAPI_Shape> theLine2,
95 std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
96 std::shared_ptr<GeomAPI_Pln> thePlane);
98 /** \brief Creates AIS_PerpendicularRelation object for two lines
99 * \param[in] theLine1 first parallel line
100 * \param[in] theLine2 second parallel line
101 * \param[in] thePlane the plane which contains the lines
104 void createPerpendicular(std::shared_ptr<GeomAPI_Shape> theLine1,
105 std::shared_ptr<GeomAPI_Shape> theLine2,
106 std::shared_ptr<GeomAPI_Pln> thePlane);
108 /** \brief Creates AIS_FixedRelation object for an object
109 * \param[in] theShape the object
110 * \param[in] thePlane the plane which contains the lines
113 void createFixed(std::shared_ptr<GeomAPI_Shape> theShape,
114 std::shared_ptr<GeomAPI_Pln> thePlane);
116 /** \brief Assigns the color for the shape
117 * \param[in] theColor index of the color
120 void setColor(const int& theColor);
122 /** \brief Assigns the color for the shape
123 * \param[in] theR value of the red component
124 * \param[in] theG value of the green component
125 * \param[in] theB value of the blue component
126 * \returns true if the presentation color is changed
129 bool setColor(int theR, int theG, int theB);
131 /** \brief Returns the color for the shape
132 * \param[in] theR value of the red component
133 * \param[in] theG value of the green component
134 * \param[in] theB value of the blue component
137 void getColor(int& theR, int& theG, int& theB);
139 /** \brief Assigns the deflection to the shape
140 * \param[in] theDeflection value of deflection
143 bool setDeflection(const double theDeflection);
145 /** \brief Returns deflection for the shape
146 * \return double value
149 double getDeflection() const;
151 /** \brief Assigns the transparency to the shape
152 * \param[in] theTransparency value of transparency
155 bool setTransparency(const double theTransparency);
157 /** \brief Returns deflection for the shape
158 * \return double value
161 double getTransparency() const;
163 /// \return Current width of the lines of shape
167 /// \brief Assigns the width of the lines of shape
169 bool setWidth(const double& theWidth);
171 /// \brief Checks if the object is empty
175 /// Return shape type according to TopAbs_ShapeEnum if the AIS is AIS_Shape
176 /// Otherwise returns -1
178 int getShapeType() const;
180 /// Sets marker type for vertex.
181 /// The type has to be defined according to Acpect_TypeOfMarker
183 void setPointMarker(int theType, double theScale);
185 /// Set line type of edges
186 /// Has to be defined according to Aspect_TypeOfLine
187 /// \returns true if the object value differs from the current
189 bool setLineStyle(int theStyle);
191 /// Set transparency of the presentation (theVal = 0 ... 1)
192 /// \returns true if the object value differs from the current
194 bool setTransparensy(double theVal);
197 //! Pointer on attribute object
198 typedef std::shared_ptr<GeomAPI_AISObject> AISObjectPtr;