Salome HOME
18fd8fa94ff576a38c69d0048d96d3996c088419
[modules/shaper.git] / src / GeomAPI / GeomAPI_AISObject.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAPI_AISObject.hxx
4 // Created:     25 Jun 2014
5 // Author:      Artem ZHIDKOV
6
7 #ifndef GeomAPI_AISObject_H_
8 #define GeomAPI_AISObject_H_
9
10 #include <GeomAPI_Interface.h>
11
12 #include <memory>
13
14 class GeomAPI_Circ;
15 class GeomAPI_Lin;
16 class GeomAPI_Pln;
17 class GeomAPI_Pnt;
18 class GeomAPI_Shape;
19
20 /** \class GeomAPI_AISObject
21  *  \ingroup DataModel
22  *  \brief Interface for AIS_InteractiveObject
23  */
24
25 class GeomAPI_AISObject : public GeomAPI_Interface
26 {
27  public:
28   /// \brief Creation of empty AIS object
29   GEOMAPI_EXPORT 
30   GeomAPI_AISObject();
31
32   GEOMAPI_EXPORT 
33   ~GeomAPI_AISObject();
34
35   /// \brief Creates AIS_Shape object using specified shape
36   GEOMAPI_EXPORT 
37   void createShape(std::shared_ptr<GeomAPI_Shape> theShape);
38
39   /// Reyirns shape used for the presentation creation (can be NULL)
40   GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Shape> getShape() const;
41
42   /** \brief Creates AIS_LengthDimension object
43    *  \param[in] theStartPoint  first point for dimension
44    *  \param[in] theEndPoint    second point for dimension
45    *  \param[in] theFlyoutPoint the flyout of dimension relative to the measured line
46    *  \param[in] thePlane       the plane which contains all points above
47    *  \param[in] theDistance    value of the distance to be shown
48    */
49   GEOMAPI_EXPORT 
50   void createDistance(std::shared_ptr<GeomAPI_Pnt> theStartPoint,
51                       std::shared_ptr<GeomAPI_Pnt> theEndPoint,
52                       std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
53                       std::shared_ptr<GeomAPI_Pln> thePlane, double theDistance);
54
55   /**
56    * Returns validity of the AIS distance. It is invalid if set measured geometry is not valid,
57    * e.g. the distance points are equal.
58    * \return a boolean result
59    */
60   GEOMAPI_EXPORT 
61   bool isEmptyDistanceGeometry();
62
63   /** \brief Creates AIS_RadiusDimension object
64    *  \param[in] theCircle      the radius is created for this circle
65    *  \param[in] theFlyoutPoint the flyout of dimension
66    *  \param[in] theRadius      value of the radius to be shown
67    */
68   GEOMAPI_EXPORT 
69   void createRadius(std::shared_ptr<GeomAPI_Circ> theCircle,
70                     std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint, double theRadius);
71
72   /** \brief Creates AIS_ParallelRelation object for two lines
73    *  \param[in] theLine1       first parallel line
74    *  \param[in] theLine2       second parallel line
75    *  \param[in] theFlyoutPoint the flyout point for relation
76    *  \param[in] thePlane       the plane which contains the lines
77    */
78   GEOMAPI_EXPORT 
79   void createParallel(std::shared_ptr<GeomAPI_Shape> theLine1,
80                       std::shared_ptr<GeomAPI_Shape> theLine2,
81                       std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
82                       std::shared_ptr<GeomAPI_Pln> thePlane);
83
84   /** \brief Creates AIS_PerpendicularRelation object for two lines
85    *  \param[in] theLine1       first parallel line
86    *  \param[in] theLine2       second parallel line
87    *  \param[in] thePlane       the plane which contains the lines
88    */
89   GEOMAPI_EXPORT 
90   void createPerpendicular(std::shared_ptr<GeomAPI_Shape> theLine1,
91                            std::shared_ptr<GeomAPI_Shape> theLine2,
92                            std::shared_ptr<GeomAPI_Pln> thePlane);
93
94   /** \brief Creates AIS_FixedRelation object for an object
95    *  \param[in] theShape       the object
96    *  \param[in] thePlane       the plane which contains the lines
97    */
98   GEOMAPI_EXPORT 
99   void createFixed(std::shared_ptr<GeomAPI_Shape> theShape,
100                    std::shared_ptr<GeomAPI_Pln> thePlane);
101
102   /** \brief Assigns the color for the shape
103    *  \param[in] theColor index of the color
104    */
105   GEOMAPI_EXPORT 
106   void setColor(const int& theColor);
107
108   /** \brief Assigns the color for the shape
109    *  \param[in] theR value of the red component
110    *  \param[in] theG value of the green component
111    *  \param[in] theB value of the blue component
112    *  \returns true if the presentation color is changed
113    */
114   GEOMAPI_EXPORT 
115   bool setColor(int theR, int theG, int theB);
116
117   /** \brief Returns the color for the shape
118    *  \param[in] theR value of the red component
119    *  \param[in] theG value of the green component
120    *  \param[in] theB value of the blue component
121    */
122   GEOMAPI_EXPORT 
123   void getColor(int& theR, int& theG, int& theB);
124
125   /// \return Current width of the lines of shape
126   GEOMAPI_EXPORT 
127   double width();
128
129   /// \brief Assigns the width of the lines of shape
130   GEOMAPI_EXPORT 
131   bool setWidth(const double& theWidth);
132
133   /// \brief Checks if the object is empty
134   GEOMAPI_EXPORT 
135   bool empty() const;
136
137   /// Return shape type according to TopAbs_ShapeEnum if the AIS is AIS_Shape
138   /// Otherwise returns -1
139   GEOMAPI_EXPORT 
140   int getShapeType() const;
141
142   /// Sets marker type for vertex.
143   /// The type has to be defined according to Acpect_TypeOfMarker
144   GEOMAPI_EXPORT 
145   void setPointMarker(int theType, double theScale);
146
147   /// Set line type of edges
148   /// Has to be defined according to Aspect_TypeOfLine
149   /// \returns true if the object value differs from the current
150   GEOMAPI_EXPORT 
151   bool setLineStyle(int theStyle);
152
153   /// Set transparency of the presentation (theVal = 0 ... 1)
154   /// \returns true if the object value differs from the current
155   GEOMAPI_EXPORT 
156   bool setTransparensy(double theVal);
157 };
158
159 //! Pointer on attribute object
160 typedef std::shared_ptr<GeomAPI_AISObject> AISObjectPtr;
161
162 #endif
163