#include <Standard.hxx>
+#include <string>
+
/**
+* \class SketcherPrs_DimensionStyleListener
* \ingroup GUI
* A class for representation of linear dimension constraint.
* It supports SketchPlugin_ConstraintLength and SketchPlugin_ConstraintDistance features.
*/
class SketcherPrs_DimensionStyleListener : public Events_Listener
{
+public:
+ class DimensionValue {
+ public:
+ DimensionValue(double theDoubleValue, bool theHasParameters, const std::string& theTextValue);
+ /// Fills internal fields by the given attribute
+ /// \param theAttributeValue a model attribute
+ void init(const AttributeDoublePtr& theAttributeValue);
+
+ public:
+ double myDoubleValue; ///< the angle value to be shown as custom value of presentation
+ bool myHasParameters; ///< true if the atrribute value has used parameters
+ std::string myTextValue; ///< the angle value depending on angle type
+ };
+
public:
/// Constructor
- /// \param theConstraint a constraint feature
- /// \param thePlane a coordinate plane of current sketch
Standard_EXPORT SketcherPrs_DimensionStyleListener();
/// Destructor
/// from the message with origin and planes
virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
- /// Redefinition of virtual function
+ /// Visualizes the dimension text or dimension value depending on the has parameters state
+ /// \param theDimension a modified dimension
+ /// \param theDimensionValue container filled by the model double attribute
Standard_EXPORT void updateDimensions(AIS_Dimension* theDimension,
- const AttributeDoublePtr& theAttributeValue);
+ const DimensionValue& theDimensionValue);
+private:
+ /// Visualizes the dimension text or dimension value depending on the has parameters state
+ /// \param theDimension a modified dimension
+ /// \param theHasParameters if true, the text is shown, else digit
+ /// \param theTextValue a dimension text value
+ /// \param theDoubleValue a dimension digit value
+ void updateDimensions(AIS_Dimension* theDimension,
+ const bool theHasParameters,
+ const std::string& theTextValue,
+ const double theDoubleValue);
private:
/// Style how the parameter of dimension should be visualized
SketcherPrs_ParameterStyleMessage::ParameterStyle myStyle;