Salome HOME
Copyright update 2020
[modules/shaper.git] / src / GeomAPI / GeomAPI_AISObject.h
1 // Copyright (C) 2014-2020  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef GeomAPI_AISObject_H_
21 #define GeomAPI_AISObject_H_
22
23 #include <GeomAPI_Interface.h>
24
25 #include <memory>
26
27 class GeomAPI_Circ;
28 class GeomAPI_Lin;
29 class GeomAPI_Pln;
30 class GeomAPI_Pnt;
31 class GeomAPI_Shape;
32
33 /** \class GeomAPI_AISObject
34  *  \ingroup DataModel
35  *  \brief Interface for AIS_InteractiveObject
36  */
37
38 class GeomAPI_AISObject : public GeomAPI_Interface
39 {
40  public:
41   /// \brief Creation of empty AIS object
42   GEOMAPI_EXPORT
43   GeomAPI_AISObject();
44
45   GEOMAPI_EXPORT
46   ~GeomAPI_AISObject();
47
48   /// \brief Creates AIS_Shape object using specified shape
49   GEOMAPI_EXPORT
50   void createShape(std::shared_ptr<GeomAPI_Shape> theShape);
51
52   /// Returns shape used for the presentation creation (can be NULL)
53   GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Shape> getShape() const;
54
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
61    */
62   GEOMAPI_EXPORT
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);
67
68   /**
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
72    */
73   GEOMAPI_EXPORT
74   bool isEmptyDistanceGeometry();
75
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
80    */
81   GEOMAPI_EXPORT
82   void createRadius(std::shared_ptr<GeomAPI_Circ> theCircle,
83                     std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint, double theRadius);
84
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
90    */
91   GEOMAPI_EXPORT
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);
96
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
101    */
102   GEOMAPI_EXPORT
103   void createPerpendicular(std::shared_ptr<GeomAPI_Shape> theLine1,
104                            std::shared_ptr<GeomAPI_Shape> theLine2,
105                            std::shared_ptr<GeomAPI_Pln> thePlane);
106
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
110    */
111   GEOMAPI_EXPORT
112   void createFixed(std::shared_ptr<GeomAPI_Shape> theShape,
113                    std::shared_ptr<GeomAPI_Pln> thePlane);
114
115   /** \brief Assigns the color for the shape
116    *  \param[in] theColor index of the color
117    */
118   GEOMAPI_EXPORT
119   void setColor(const int& theColor);
120
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
126    */
127   GEOMAPI_EXPORT
128   bool setColor(int theR, int theG, int theB);
129
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
134    */
135   GEOMAPI_EXPORT
136   void getColor(int& theR, int& theG, int& theB);
137
138   /** \brief Assigns the deflection to the shape
139    *  \param[in] theDeflection value of deflection
140    */
141   GEOMAPI_EXPORT
142   bool setDeflection(const double theDeflection);
143
144   /** \brief Returns deflection for the shape
145    *  \return double value
146    */
147   GEOMAPI_EXPORT
148   double getDeflection() const;
149
150   /** \brief Assigns the transparency to the shape
151    *  \param[in] theTransparency value of transparency
152    */
153   GEOMAPI_EXPORT
154   bool setTransparency(const double theTransparency);
155
156   /** \brief Returns deflection for the shape
157    *  \return double value
158    */
159   GEOMAPI_EXPORT
160   double getTransparency() const;
161
162   /// \return Current width of the lines of shape
163   GEOMAPI_EXPORT
164   double width();
165
166   /// \brief Assigns the width of the lines of shape
167   GEOMAPI_EXPORT
168   bool setWidth(const double& theWidth);
169
170   /// \brief Checks if the object is empty
171   GEOMAPI_EXPORT
172   bool empty() const;
173
174   /// Return shape type according to TopAbs_ShapeEnum if the AIS is AIS_Shape
175   /// Otherwise returns -1
176   GEOMAPI_EXPORT
177   int getShapeType() const;
178
179   /// Sets marker type for vertex.
180   /// The type has to be defined according to Acpect_TypeOfMarker
181   GEOMAPI_EXPORT
182   void setPointMarker(int theType, double theScale);
183
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
187   GEOMAPI_EXPORT
188   bool setLineStyle(int theStyle);
189
190   /// Set transparency of the presentation (theVal = 0 ... 1)
191   /// \returns true if the object value differs from the current
192   GEOMAPI_EXPORT
193   bool setTransparensy(double theVal);
194 };
195
196 //! Pointer on attribute object
197 typedef std::shared_ptr<GeomAPI_AISObject> AISObjectPtr;
198
199 #endif
200