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
44 /// to build AIS presentation
45 /// \param theConstraint a constraint feature
46 /// \param thePlane a coordinate plane of current sketch
47 /// \return boolean result value
48 static bool IsReadyToDisplay(ModelAPI_Feature* theConstraint,
49 const std::shared_ptr<GeomAPI_Ax3>& thePlane);
51 /// Redefinition of virtual function
52 Standard_EXPORT virtual void Compute(
53 const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
54 const Handle(Prs3d_Presentation)& thePresentation,
55 const Standard_Integer theMode = 0);
57 /// Redefinition of virtual function
58 Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
59 const Standard_Integer aMode);
62 static bool readyToDisplay(ModelAPI_Feature* theConstraint,
63 const std::shared_ptr<GeomAPI_Ax3>& thePlane,
64 gp_Pnt& thePnt1, gp_Pnt& thePnt2);
66 /// Constraint feature
67 ModelAPI_Feature* myConstraint;
69 /// Plane of the current sketcher
70 std::shared_ptr<GeomAPI_Ax3> mySketcherPlane;
72 //Handle(Prs3d_DimensionAspect) myAspect;
74 /// Listener to update dimension visualization style
75 SketcherPrs_DimensionStyleListener* myStyleListener;
77 /// container of values obtained from the constraint, which are necessary
78 /// to fill the presentation
79 gp_Pnt myFirstPoint; ///< the dimension first point for measured geometry
80 gp_Pnt mySecondPoint; ///< the dimension first point for measured geometry
81 gp_Pln myPlane; ///< the plane(plane of the sketch) for measured geometry
82 double myDistance; ///< the flyout distance
84 /// the structure filled by constraint
85 SketcherPrs_DimensionStyleListener::DimensionValue myValue;