X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_Constraint.h;h=be9db5e0be188c4b684359bdac8c97200c1d5697;hb=026f4997e7531acff5d6677877d4e948088c46ac;hp=5417111e399fe5948c34226ce4b683443d018d7e;hpb=96ff1d1fb2acb842cee193f15492de81060a1d58;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_Constraint.h b/src/SketchPlugin/SketchPlugin_Constraint.h index 5417111e3..be9db5e0b 100644 --- a/src/SketchPlugin/SketchPlugin_Constraint.h +++ b/src/SketchPlugin/SketchPlugin_Constraint.h @@ -1,46 +1,39 @@ -// File: SketchPlugin_Constraint.h -// Created: 08 May 2014 -// Author: Artem ZHIDKOV +// Copyright (C) 2014-2021 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_Constraint_H_ #define SketchPlugin_Constraint_H_ -#include "SketchPlugin.h" -#include "SketchPlugin_Feature.h" -#include -#include -#include +#include -#include - -#include - - -/* Description: - * Each constraint uses a set of parameters. In the SolveSpace library - * these parameters are named "valA", "ptA", "ptB", "entityA", "entityB". - * The "ptA" and "ptB" parameters represents a point in the constraint. - * The "entityA" and "entityB" represents any other object (and a point too). - * And the "valA" represents a real value. - * - * The attributes below are named independent of the SolveSpace. - * Some of them may be unused. - * - * Also the list of possible attributes is provided to simplify assignment. - */ +#include /// Size of the list of constraint attributes -const unsigned int CONSTRAINT_ATTR_SIZE = 4; +const int CONSTRAINT_ATTR_SIZE = 4; /** \class SketchPlugin_Constraint - * \ingroup DataModel - * \brief Feature for creation of a new constraint between other features. - * Base class for all constraints. + * \brief Abstract interface to the SketchPlugin_ConstraintBase + * For more info see: SketchPlugin_ConstraintBase.h */ -class SketchPlugin_Constraint: public SketchPlugin_Feature, - public GeomAPI_IPresentable +class SketchPlugin_Constraint : public SketchPlugin_Feature { -public: + public: /// The value parameter for the constraint inline static const std::string& VALUE() { @@ -79,44 +72,29 @@ public: } /// List of constraint attributes - inline static const std::string& ATTRIBUTE(const int theNumber) { + inline static const std::string& ATTRIBUTE(const int theNumber) + { switch (theNumber) { - case 0: return ENTITY_A(); - case 1: return ENTITY_B(); - case 2: return ENTITY_C(); - case 3: return ENTITY_D(); - default: break; + case 0: + return ENTITY_A(); + case 1: + return ENTITY_B(); + case 2: + return ENTITY_C(); + case 3: + return ENTITY_D(); + default: + break; } static const std::string EMPTY_STRING(""); return EMPTY_STRING; } - /// \brief Returns to which group in the document must be added feature - SKETCHPLUGIN_EXPORT virtual const std::string& getGroup() - {static std::string MY_GROUP = SketchPlugin_Sketch::ID(); return MY_GROUP;} - - /** \brief Adds sub-feature of the higher level feature (sub-element of the sketch) - * \param theFeature sub-feature - */ - SKETCHPLUGIN_EXPORT virtual const void addSub( - const FeaturePtr& theFeature) {} - - /// Returns the AIS preview - SKETCHPLUGIN_EXPORT virtual boost::shared_ptr getAISObject( - boost::shared_ptr thePrevious); - - /// Moves the feature - /// \param theDeltaX the delta for X coordinate is moved - /// \param theDeltaY the delta for Y coordinate is moved - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY) {}; - - /// Return the distance between the feature and the point - /// \param thePoint the point - virtual double distanceToPoint(const boost::shared_ptr& thePoint) { return 0; }; - -protected: + protected: /// \brief Use plugin manager for features creation - SketchPlugin_Constraint() {} + SketchPlugin_Constraint(); }; +typedef std::shared_ptr ConstraintPtr; + #endif