1 // Copyright (C) 2014-2020 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef SketcherPrs_DimensionStyleListener_H
21 #define SketcherPrs_DimensionStyleListener_H
23 //#include <Events_Listener.h>
25 #include <ModelAPI_AttributeDouble.h>
26 #include <AIS_Dimension.hxx>
28 #include "SketcherPrs_Tools.h"
30 #include <Standard.hxx>
35 * \class SketcherPrs_DimensionStyleListener
37 * A class for representation of linear dimension constraint.
38 * It supports SketchPlugin_ConstraintLength and SketchPlugin_ConstraintDistance features.
40 class SketcherPrs_DimensionStyle
43 class DimensionValue {
45 DimensionValue(double theDoubleValue, bool theHasParameters, const std::string& theTextValue);
46 /// Fills internal fields by the given attribute
47 /// \param theAttributeValue a model attribute
48 void init(const AttributeDoublePtr& theAttributeValue);
51 double myDoubleValue; ///< the angle value to be shown as custom value of presentation
52 bool myHasParameters; ///< true if the atrribute value has used parameters
53 std::string myTextValue; ///< the angle value depending on angle type
58 Standard_EXPORT SketcherPrs_DimensionStyle();
61 Standard_EXPORT ~SketcherPrs_DimensionStyle();
63 /// Visualizes the dimension text or dimension value depending on the has parameters state
64 /// \param theDimension a modified dimension
65 /// \param theDimensionValue container filled by the model double attribute
66 Standard_EXPORT void updateDimensions(AIS_Dimension* theDimension,
67 const DimensionValue& theDimensionValue);
70 /// Visualizes the dimension text or dimension value depending on the has parameters state
71 /// \param theDimension a modified dimension
72 /// \param theHasParameters if true, the text is shown, else digit
73 /// \param theTextValue a dimension text value
74 /// \param theDoubleValue a dimension digit value
75 void updateDimensions(AIS_Dimension* theDimension,
76 const bool theHasParameters,
77 const std::string& theTextValue,
78 const double theDoubleValue);