X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_ConstraintDistance.h;h=c2dc3ee409e95ec77131d4488abee32c29f2cdb4;hb=5f280e7dc45a1f3345fe0f3a9080ac10265219e5;hp=b5981d017f24d418bcb0f0e3811f8cb07906a72e;hpb=71bb37b9d15aba5dae5cafa16949e6cc5a08c07a;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistance.h b/src/SketchPlugin/SketchPlugin_ConstraintDistance.h index b5981d017..c2dc3ee40 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistance.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistance.h @@ -1,6 +1,22 @@ -// File: SketchPlugin_ConstraintDistance.h -// Created: 23 May 2014 -// Author: Artem ZHIDKOV +// 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 SketchPlugin_ConstraintDistance_H_ #define SketchPlugin_ConstraintDistance_H_ @@ -10,15 +26,15 @@ #include "SketchPlugin_Sketch.h" #include "ModelAPI_Data.h" +#include + #include class SketchPlugin_Line; class GeomDataAPI_Point2D; -#define DISTANCE_COLOR "#ff00ff" - /** \class SketchPlugin_ConstraintDistance - * \ingroup DataModel + * \ingroup Plugins * \brief Feature for creation of a new constraint which defines a distance * between a point and another feature (point, line, plane or face) * @@ -48,6 +64,10 @@ class SketchPlugin_ConstraintDistance : public SketchPlugin_ConstraintBase /// \brief Request for initialization of data model of the feature: adding all attributes SKETCHPLUGIN_EXPORT virtual void initAttributes(); + /// Retuns the parameters of color definition in the resources config manager + SKETCHPLUGIN_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName, + std::string& theDefault); + /// Returns the AIS preview SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious); @@ -56,22 +76,22 @@ class SketchPlugin_ConstraintDistance : public SketchPlugin_ConstraintBase /// \param theDeltaY the delta for Y coordinate is moved SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY); - /// Returns the current distance between the feature attributes - double calculateCurrentDistance() const; + /// Called on change of any argument-attribute of this object + /// \param theID identifier of changed attribute + SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); /// \brief Use plugin manager for features creation SketchPlugin_ConstraintDistance(); -}; -/// Obtain the point object from specified constraint parameter -boost::shared_ptr getFeaturePoint(DataPtr theData, - const std::string& theAttribute); +protected: + /// Returns the current distance between the feature attributes + virtual double calculateCurrentDistance(); -boost::shared_ptr getFeatureLine(DataPtr theData, - const std::string& theAttribute); + /// Check the attributes related to distanced points/features are initialized + bool areAttributesInitialized(); -boost::shared_ptr getProjectionPoint( - const boost::shared_ptr& theLine, - const boost::shared_ptr& thePoint); +private: + bool myFlyoutUpdate; ///< to avoid cyclic dependencies on automatic updates of flyout point +}; #endif