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>
22 * A class for representation of linear dimension constraint.
23 * It supports SketchPlugin_ConstraintLength and SketchPlugin_ConstraintDistance features.
25 class SketcherPrs_DimensionStyleListener : public Events_Listener
28 class DimensionValue {
30 DimensionValue(double theDoubleValue, bool theHasParameters, const std::string& theTextValue);
31 /// Fills internal fields by the given attribute
32 /// \param theAttributeValue a model attribute
33 void init(const AttributeDoublePtr& theAttributeValue);
36 double myDoubleValue; ///< the angle value to be shown as custom value of presentation
37 bool myHasParameters; ///< true if the atrribute value has used parameters
38 std::string myTextValue; ///< the angle value depending on angle type
43 Standard_EXPORT SketcherPrs_DimensionStyleListener();
46 Standard_EXPORT ~SketcherPrs_DimensionStyleListener();
48 /// Process the ModelAPI_DocumentCreatedMessage to fulfill a document
49 /// from the message with origin and planes
50 virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
52 /// Visualizes the dimension text or dimension value depending on the has parameters state
53 /// \param theDimension a modified dimension
54 /// \param theDimensionValue container filled by the model double attribute
55 Standard_EXPORT void updateDimensions(AIS_Dimension* theDimension,
56 const DimensionValue& theDimensionValue);
59 /// Visualizes the dimension text or dimension value depending on the has parameters state
60 /// \param theDimension a modified dimension
61 /// \param theHasParameters if true, the text is shown, else digit
62 /// \param theTextValue a dimension text value
63 /// \param theDoubleValue a dimension digit value
64 void updateDimensions(AIS_Dimension* theDimension,
65 const bool theHasParameters,
66 const std::string& theTextValue,
67 const double theDoubleValue);
69 /// Style how the parameter of dimension should be visualized
70 SketcherPrs_ParameterStyleMessage::ParameterStyle myStyle;