X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketcherPrs%2FSketcherPrs_DimensionStyleListener.h;h=60e0a21e867bbc58515f07ccbbfd07657b67b262;hb=53445a818411b3b71e3457f5e2e97c5f23d69cb7;hp=3ff9696b7415bb2566edebece96820a366c6242f;hpb=a49ed1bc5c4745f07d1aabbaf465f25f00ff1040;p=modules%2Fshaper.git diff --git a/src/SketcherPrs/SketcherPrs_DimensionStyleListener.h b/src/SketcherPrs/SketcherPrs_DimensionStyleListener.h index 3ff9696b7..60e0a21e8 100755 --- a/src/SketcherPrs/SketcherPrs_DimensionStyleListener.h +++ b/src/SketcherPrs/SketcherPrs_DimensionStyleListener.h @@ -1,8 +1,22 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: SketcherPrs_DimensionStyleListener.h -// Created: 31 March 2016 -// Author: Natalia ERMOLAEVA +// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or +// email : webmaster.salome@opencascade.com +// #ifndef SketcherPrs_DimensionStyleListener_H #define SketcherPrs_DimensionStyleListener_H @@ -18,16 +32,29 @@ #include /** +* \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 @@ -37,18 +64,22 @@ public: /// from the message with origin and planes virtual void processEvent(const std::shared_ptr& 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 theValue a dimension value - Standard_EXPORT void updateDimensions(AIS_Dimension* theDimension, - const bool theHasParameters, - const std::string& theValue); - + /// \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;