Salome HOME
The flyout widget should not accept the focus if the corresponded presentation is...
[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   /** \brief Creates AIS_LengthDimension object
40    *  \param[in] theStartPoint  first point for dimension
41    *  \param[in] theEndPoint    second point for dimension
42    *  \param[in] theFlyoutPoint the flyout of dimension relative to the measured line
43    *  \param[in] thePlane       the plane which contains all points above
44    *  \param[in] theDistance    value of the distance to be shown
45    */
46   GEOMAPI_EXPORT 
47   void createDistance(std::shared_ptr<GeomAPI_Pnt> theStartPoint,
48                       std::shared_ptr<GeomAPI_Pnt> theEndPoint,
49                       std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
50                       std::shared_ptr<GeomAPI_Pln> thePlane, double theDistance);
51
52   /**
53    * Returns validity of the AIS distance. It is invalid if set measured geometry is not valid,
54    * e.g. the distance points are equal.
55    * \return a boolean result
56    */
57   GEOMAPI_EXPORT 
58   bool isEmptyDistanceGeometry();
59
60   /** \brief Creates AIS_RadiusDimension object
61    *  \param[in] theCircle      the radius is created for this circle
62    *  \param[in] theFlyoutPoint the flyout of dimension
63    *  \param[in] theRadius      value of the radius to be shown
64    */
65   GEOMAPI_EXPORT 
66   void createRadius(std::shared_ptr<GeomAPI_Circ> theCircle,
67                     std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint, double theRadius);
68
69   /** \brief Creates AIS_ParallelRelation object for two lines
70    *  \param[in] theLine1       first parallel line
71    *  \param[in] theLine2       second parallel line
72    *  \param[in] theFlyoutPoint the flyout point for relation
73    *  \param[in] thePlane       the plane which contains the lines
74    */
75   GEOMAPI_EXPORT 
76   void createParallel(std::shared_ptr<GeomAPI_Shape> theLine1,
77                       std::shared_ptr<GeomAPI_Shape> theLine2,
78                       std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
79                       std::shared_ptr<GeomAPI_Pln> thePlane);
80
81   /** \brief Creates AIS_PerpendicularRelation object for two lines
82    *  \param[in] theLine1       first parallel line
83    *  \param[in] theLine2       second parallel line
84    *  \param[in] thePlane       the plane which contains the lines
85    */
86   GEOMAPI_EXPORT 
87   void createPerpendicular(std::shared_ptr<GeomAPI_Shape> theLine1,
88                            std::shared_ptr<GeomAPI_Shape> theLine2,
89                            std::shared_ptr<GeomAPI_Pln> thePlane);
90
91   /** \brief Creates AIS_FixedRelation object for an object
92    *  \param[in] theShape       the object
93    *  \param[in] thePlane       the plane which contains the lines
94    */
95   GEOMAPI_EXPORT 
96   void createFixed(std::shared_ptr<GeomAPI_Shape> theShape,
97                    std::shared_ptr<GeomAPI_Pln> thePlane);
98
99   /** \brief Assigns the color for the shape
100    *  \param[in] theColor index of the color
101    */
102   GEOMAPI_EXPORT 
103   void setColor(const int& theColor);
104
105   /** \brief Assigns the color for the shape
106    *  \param[in] theR value of the red component
107    *  \param[in] theG value of the green component
108    *  \param[in] theB value of the blue component
109    *  \returns true if the presentation color is changed
110    */
111   GEOMAPI_EXPORT 
112   bool setColor(int theR, int theG, int theB);
113
114   /** \brief Returns the color for the shape
115    *  \param[in] theR value of the red component
116    *  \param[in] theG value of the green component
117    *  \param[in] theB value of the blue component
118    */
119   GEOMAPI_EXPORT 
120   void getColor(int& theR, int& theG, int& theB);
121
122   /// \brief Assigns the width of the lines of shape
123   GEOMAPI_EXPORT 
124   bool setWidth(const double& theWidth);
125
126   /// \brief Checks if the object is empty
127   GEOMAPI_EXPORT 
128   bool empty() const;
129
130   /// Return shape type according to TopAbs_ShapeEnum if the AIS is AIS_Shape
131   /// Otherwise returns -1
132   GEOMAPI_EXPORT 
133   int getShapeType() const;
134
135   /// Sets marker type for vertex.
136   /// The type has to be defined according to Acpect_TypeOfMarker
137   GEOMAPI_EXPORT 
138   void setPointMarker(int theType, double theScale);
139
140   /// Set line type of edges
141   /// Has to be defined according to Aspect_TypeOfLine
142   /// \returns true if the object value differs from the current
143   GEOMAPI_EXPORT 
144   bool setLineStyle(int theStyle);
145
146   /// Set transparency of the presentation (theVal = 0 ... 1)
147   /// \returns true if the object value differs from the current
148   GEOMAPI_EXPORT 
149   bool setTransparensy(double theVal);
150 };
151
152 //! Pointer on attribute object
153 typedef std::shared_ptr<GeomAPI_AISObject> AISObjectPtr;
154
155 #endif
156