Salome HOME
Documentation update
[modules/shaper.git] / src / SketcherPrs / SketcherPrs_DimensionStyleListener.h
index 03e92957c007b9d270e7917b92038b1e3af30253..9d49b9e84e34f0339e174b495df5d117549c15f9 100755 (executable)
 
 #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
@@ -35,10 +50,22 @@ public:
   /// 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;