Salome HOME
empty AIS presentation should not be visualized in the viewer. It is caused by OCCT...
[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
17 DEFINE_STANDARD_HANDLE(SketcherPrs_LengthDimension, AIS_LengthDimension)
18
19 /**
20 * \ingroup GUI
21 * A class for representation of linear dimension constraint.
22 * It supports SketchPlugin_ConstraintLength and SketchPlugin_ConstraintDistance features.
23 */
24 class SketcherPrs_LengthDimension : public AIS_LengthDimension
25 {
26 public:
27   /// Constructor
28   /// \param theConstraint a constraint feature
29   /// \param thePlane a coordinate plane of current sketch
30   Standard_EXPORT SketcherPrs_LengthDimension(ModelAPI_Feature* theConstraint, 
31                         const std::shared_ptr<GeomAPI_Ax3>& thePlane);
32
33   DEFINE_STANDARD_RTTI(SketcherPrs_LengthDimension)
34
35   /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation
36   /// \param theConstraint a constraint feature
37   /// \param thePlane a coordinate plane of current sketch
38   /// \return boolean result value
39   static bool IsReadyToDisplay(ModelAPI_Feature* theConstraint,
40                                const std::shared_ptr<GeomAPI_Ax3>& thePlane);
41 protected:
42   /// Redefinition of virtual function
43   Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
44     const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0);
45
46   /// Redefinition of virtual function
47   Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
48     const Standard_Integer aMode);
49
50 private:
51   static bool getPoints(ModelAPI_Feature* theConstraint,
52                  const std::shared_ptr<GeomAPI_Ax3>& thePlane,
53                  gp_Pnt& thePnt1, gp_Pnt& thePnt2);
54
55   /// Constraint feature
56   ModelAPI_Feature* myConstraint;
57
58   /// Plane of the current sketcher
59   std::shared_ptr<GeomAPI_Ax3> myPlane;
60
61   Handle(Prs3d_DimensionAspect) myAspect;
62 };
63
64 #endif