Salome HOME
Merge branch 'master' into cgt/devCEA
[modules/shaper.git] / src / SketcherPrs / SketcherPrs_Coincident.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        SketcherPrs_Coincident.h
4 // Created:     12 February 2015
5 // Author:      Vitaly SMETANNIKOV
6
7 #ifndef SketcherPrs_Coincident_H
8 #define SketcherPrs_Coincident_H
9
10 #include <GeomAPI_Ax3.h>
11 #include <ModelAPI_Feature.h>
12
13 #include <AIS_InteractiveObject.hxx>
14 #include <Standard_DefineHandle.hxx>
15
16
17 DEFINE_STANDARD_HANDLE(SketcherPrs_Coincident, AIS_InteractiveObject)
18
19 /**
20 * \ingroup GUI
21 * A redefinition of standard AIS Interactive Object in order to provide  
22 * presentation of coincident constraint
23 */
24 class SketcherPrs_Coincident: public AIS_InteractiveObject
25 {
26 public:
27   /// Constructor
28   /// \param theConstraint a constraint object
29   /// \param thePlane plane of a sketch
30   Standard_EXPORT SketcherPrs_Coincident(ModelAPI_Feature* theConstraint,
31                                          const std::shared_ptr<GeomAPI_Ax3>& thePlane);
32
33   /// Defines color for the presentation
34   /// \param aColor a color object
35   Standard_EXPORT virtual void SetColor(const Quantity_Color& aColor);
36
37   /// Defines color for the presentation
38   /// \param aColor a color name
39   Standard_EXPORT virtual void SetColor(const Quantity_NameOfColor aColor);
40
41   /// Set state of the presentation, in case of conflicting state, the icon of the presentation is
42   /// visualized in error color.
43   /// The state is stored in an internal field, so should be changed when
44   /// constraint become not conflicting
45   /// \param theConflicting a state
46   /// \param theColor a color for conflicting object
47   Standard_EXPORT void SetConflictingConstraint(const bool& theConflicting,
48                                                 const std::vector<int>& theColor);
49
50   /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation
51   /// \param theConstraint a constraint feature
52   /// \param thePlane a coordinate plane of current sketch
53   /// \return boolean result value
54   static bool IsReadyToDisplay(ModelAPI_Feature* theConstraint,
55                                const std::shared_ptr<GeomAPI_Ax3>& thePlane);
56
57   DEFINE_STANDARD_RTTIEXT(SketcherPrs_Coincident, AIS_InteractiveObject)
58 protected:
59   /// Redefinition of virtual function
60   Standard_EXPORT virtual void Compute(
61     const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
62     const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0);
63
64   /// Redefinition of virtual function
65   Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
66     const Standard_Integer aMode) ;
67
68 private:
69   static bool readyToDisplay(ModelAPI_Feature* theConstraint,
70                       const std::shared_ptr<GeomAPI_Ax3>& thePlane,
71                       gp_Pnt& thePoint);
72
73 private:
74   ModelAPI_Feature* myConstraint;
75   std::shared_ptr<GeomAPI_Ax3> mySketcherPlane;
76   gp_Pnt myPoint;
77   bool myIsConflicting; /// state if the presentation is visualized in error state
78   Quantity_Color myConflictingColor; /// the color of mid ring if there is a conflict
79 };
80
81
82 #endif