1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: SketcherPrs_Angle.h
4 // Created: 20 August 2015
5 // Author: Vitaly SMETANNIKOV
8 #ifndef SketcherPrs_Angle_H
9 #define SketcherPrs_Angle_H
11 #include <GeomAPI_Ax3.h>
12 #include <ModelAPI_Feature.h>
14 #include <AIS_AngleDimension.hxx>
15 #include <Standard_DefineHandle.hxx>
17 #include <SketcherPrs_DimensionStyleListener.h>
19 DEFINE_STANDARD_HANDLE(SketcherPrs_Angle, AIS_AngleDimension)
23 * A class for representation of angle constraint
25 class SketcherPrs_Angle : public AIS_AngleDimension
29 /// \param theConstraint a constraint feature
30 /// \param thePlane a coordinate plane of current sketch
31 Standard_EXPORT SketcherPrs_Angle(ModelAPI_Feature* theConstraint,
32 const std::shared_ptr<GeomAPI_Ax3>& thePlane);
35 Standard_EXPORT ~SketcherPrs_Angle();
37 DEFINE_STANDARD_RTTI(SketcherPrs_Angle)
39 /// Returns true if the constraint feature arguments are correcly filled
40 /// to build AIS presentation
41 /// \param theConstraint a constraint feature
42 /// \param thePlane a coordinate plane of current sketch
43 /// \return boolean result value
44 static bool IsReadyToDisplay(ModelAPI_Feature* theConstraint,
45 const std::shared_ptr<GeomAPI_Ax3>& thePlane);
47 /// Redefinition of virtual function
48 Standard_EXPORT virtual void Compute(
49 const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
50 const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0);
52 /// Redefinition of virtual function
53 Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
54 const Standard_Integer aMode);
56 /// Checks is the angle plane has inverted direction of normal to the plane of current sketcher
57 /// Returns true if crossed product is negative.
58 /// \return bolean value
59 bool isAnglePlaneReversedToSketchPlane();
61 /// Calculates a distance between center of the angle presentation and the value of flyout point
62 /// attribute. It should be used after setting measured geometry for the angle presentation as
63 /// it uses calculated center/first/second point coordinates
64 /// \return real value
65 double calculateDistanceToFlyoutPoint();
67 static bool readyToDisplay(ModelAPI_Feature* theConstraint,
68 const std::shared_ptr<GeomAPI_Ax3>& thePlane,
69 gp_Pnt& theFirstPoint, gp_Pnt& theSecondPoint,
70 gp_Pnt& theCenterPoint);
73 /// Constraint feature
74 ModelAPI_Feature* myConstraint;
76 /// Plane of the current sketcher
77 std::shared_ptr<GeomAPI_Ax3> mySketcherPlane;
79 Handle(Prs3d_DimensionAspect) myAspect;
81 /// Listener to update dimension visualization style
82 SketcherPrs_DimensionStyleListener* myStyleListener;
84 /// container of values obtained from the constraint, which are necessary to fill the presentation
85 gp_Pnt myFirstPoint; ///< the dimension first point for measured geometry
86 gp_Pnt mySecondPoint; ///< the dimension second point for measured geometry
87 gp_Pnt myCenterPoint; ///< the dimension center point for measured geometry
88 gp_Pnt myFlyOutPoint; ///< the dimension fly out point for measured geometry
90 SketcherPrs_DimensionStyleListener::DimensionValue myValue; /// the structure filled by constraint