]> SALOME platform Git repositories - modules/shaper.git/blob - src/SketcherPrs/SketcherPrs_LengthDimension.h
Salome HOME
Issue #805 In the sketch presentation, show both the parameter and its value: providi...
[modules/shaper.git] / src / SketcherPrs / SketcherPrs_LengthDimension.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        SketcherPrs_LengthDimension.h
4 // Created:     27 March 2015
5 // Author:      Vitaly SMETANNIKOV
6
7
8 #ifndef SketcherPrs_LinearDimension_H
9 #define SketcherPrs_LinearDimension_H
10
11 #include <GeomAPI_Ax3.h>
12 #include <ModelAPI_Feature.h>
13 #include <AIS_LengthDimension.hxx>
14 #include <Standard_DefineHandle.hxx>
15
16 #include <SketcherPrs_Tools.h>
17
18 #include <Events_Listener.h>
19
20
21 DEFINE_STANDARD_HANDLE(SketcherPrs_LengthDimension, AIS_LengthDimension)
22
23 /**
24 * \ingroup GUI
25 * A class for representation of linear dimension constraint.
26 * It supports SketchPlugin_ConstraintLength and SketchPlugin_ConstraintDistance features.
27 */
28 class SketcherPrs_LengthDimension : public AIS_LengthDimension, public Events_Listener
29 {
30 public:
31   /// Constructor
32   /// \param theConstraint a constraint feature
33   /// \param thePlane a coordinate plane of current sketch
34   Standard_EXPORT SketcherPrs_LengthDimension(ModelAPI_Feature* theConstraint, 
35                         const std::shared_ptr<GeomAPI_Ax3>& thePlane);
36
37   /// Destructor
38   Standard_EXPORT ~SketcherPrs_LengthDimension();
39
40   DEFINE_STANDARD_RTTI(SketcherPrs_LengthDimension)
41
42   /// Process the ModelAPI_DocumentCreatedMessage to fulfill a document
43   /// from the message with origin and planes
44   virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
45
46   /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation
47   /// \param theConstraint a constraint feature
48   /// \param thePlane a coordinate plane of current sketch
49   /// \return boolean result value
50   static bool IsReadyToDisplay(ModelAPI_Feature* theConstraint,
51                                const std::shared_ptr<GeomAPI_Ax3>& thePlane);
52 protected:
53   /// Redefinition of virtual function
54   Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
55     const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0);
56
57   /// Redefinition of virtual function
58   Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
59     const Standard_Integer aMode);
60
61 private:
62   static bool getPoints(ModelAPI_Feature* theConstraint,
63                  const std::shared_ptr<GeomAPI_Ax3>& thePlane,
64                  gp_Pnt& thePnt1, gp_Pnt& thePnt2);
65
66   /// Constraint feature
67   ModelAPI_Feature* myConstraint;
68
69   /// Plane of the current sketcher
70   std::shared_ptr<GeomAPI_Ax3> myPlane;
71
72   Handle(Prs3d_DimensionAspect) myAspect;
73
74   /// Style how the parameter of dimension should be visualized
75   SketcherPrs_ParameterStyleMessage::ParameterStyle myStyle;
76 };
77
78 #endif