1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: SketcherPrs_LengthDimension.h
4 // Created: 27 March 2015
5 // Author: Vitaly SMETANNIKOV
8 #ifndef SketcherPrs_LinearDimension_H
9 #define SketcherPrs_LinearDimension_H
11 #include <GeomAPI_Ax3.h>
12 #include <ModelAPI_Feature.h>
13 #include <AIS_LengthDimension.hxx>
14 #include <Standard_DefineHandle.hxx>
20 #include <SketcherPrs_DimensionStyleListener.h>
22 DEFINE_STANDARD_HANDLE(SketcherPrs_LengthDimension, AIS_LengthDimension)
26 * A class for representation of linear dimension constraint.
27 * It supports SketchPlugin_ConstraintLength and SketchPlugin_ConstraintDistance features.
29 class SketcherPrs_LengthDimension : public AIS_LengthDimension
33 /// \param theConstraint a constraint feature
34 /// \param thePlane a coordinate plane of current sketch
35 Standard_EXPORT SketcherPrs_LengthDimension(ModelAPI_Feature* theConstraint,
36 const std::shared_ptr<GeomAPI_Ax3>& thePlane);
39 Standard_EXPORT ~SketcherPrs_LengthDimension();
41 DEFINE_STANDARD_RTTI(SketcherPrs_LengthDimension)
43 /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation
44 /// \param theConstraint a constraint feature
45 /// \param thePlane a coordinate plane of current sketch
46 /// \return boolean result value
47 static bool IsReadyToDisplay(ModelAPI_Feature* theConstraint,
48 const std::shared_ptr<GeomAPI_Ax3>& thePlane);
50 /// Redefinition of virtual function
51 Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
52 const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0);
54 /// Redefinition of virtual function
55 Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
56 const Standard_Integer aMode);
59 static bool readyToDisplay(ModelAPI_Feature* theConstraint,
60 const std::shared_ptr<GeomAPI_Ax3>& thePlane,
61 gp_Pnt& thePnt1, gp_Pnt& thePnt2);
63 /// Constraint feature
64 ModelAPI_Feature* myConstraint;
66 /// Plane of the current sketcher
67 std::shared_ptr<GeomAPI_Ax3> mySketcherPlane;
69 //Handle(Prs3d_DimensionAspect) myAspect;
71 /// Listener to update dimension visualization style
72 SketcherPrs_DimensionStyleListener* myStyleListener;
74 /// container of values obtained from the constraint, which are necessary to fill the presentation
75 gp_Pnt myFirstPoint; ///< the dimension first point for measured geometry
76 gp_Pnt mySecondPoint; ///< the dimension first point for measured geometry
77 gp_Pln myPlane; ///< the plane(plane of the sketch) for measured geometry
78 double myDistance; ///< the flyout distance
80 SketcherPrs_DimensionStyleListener::DimensionValue myValue; /// the structure filled by constraint