1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: SketcherPrs_DimensionStyleListener.h
4 // Created: 31 March 2016
5 // Author: Natalia ERMOLAEVA
7 #ifndef SketcherPrs_DimensionStyleListener_H
8 #define SketcherPrs_DimensionStyleListener_H
10 #include <Events_Listener.h>
12 #include <ModelAPI_AttributeDouble.h>
14 #include "SketcherPrs_Tools.h"
16 #include <Standard.hxx>
21 * \class SketcherPrs_DimensionStyleListener
23 * A class for representation of linear dimension constraint.
24 * It supports SketchPlugin_ConstraintLength and SketchPlugin_ConstraintDistance features.
26 class SketcherPrs_DimensionStyleListener : public Events_Listener
29 class DimensionValue {
31 DimensionValue(double theDoubleValue, bool theHasParameters, const std::string& theTextValue);
32 /// Fills internal fields by the given attribute
33 /// \param theAttributeValue a model attribute
34 void init(const AttributeDoublePtr& theAttributeValue);
37 double myDoubleValue; ///< the angle value to be shown as custom value of presentation
38 bool myHasParameters; ///< true if the atrribute value has used parameters
39 std::string myTextValue; ///< the angle value depending on angle type
44 Standard_EXPORT SketcherPrs_DimensionStyleListener();
47 Standard_EXPORT ~SketcherPrs_DimensionStyleListener();
49 /// Process the ModelAPI_DocumentCreatedMessage to fulfill a document
50 /// from the message with origin and planes
51 virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
53 /// Visualizes the dimension text or dimension value depending on the has parameters state
54 /// \param theDimension a modified dimension
55 /// \param theDimensionValue container filled by the model double attribute
56 Standard_EXPORT void updateDimensions(AIS_Dimension* theDimension,
57 const DimensionValue& theDimensionValue);
60 /// Visualizes the dimension text or dimension value depending on the has parameters state
61 /// \param theDimension a modified dimension
62 /// \param theHasParameters if true, the text is shown, else digit
63 /// \param theTextValue a dimension text value
64 /// \param theDoubleValue a dimension digit value
65 void updateDimensions(AIS_Dimension* theDimension,
66 const bool theHasParameters,
67 const std::string& theTextValue,
68 const double theDoubleValue);
70 /// Style how the parameter of dimension should be visualized
71 SketcherPrs_ParameterStyleMessage::ParameterStyle myStyle;