X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchSolver%2FSketchSolver_ConstraintMulti.h;h=67caff02942040bc87a7fb76f11985a8ecd2e928;hb=cebc389b9c6b16a2a68510b04702655a40fd91e8;hp=4786ee430436040987a5dfe405366e9d8eff4892;hpb=8f10db487ef409d859a62aa6e2235a17d9b56723;p=modules%2Fshaper.git diff --git a/src/SketchSolver/SketchSolver_ConstraintMulti.h b/src/SketchSolver/SketchSolver_ConstraintMulti.h index 4786ee430..67caff029 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMulti.h +++ b/src/SketchSolver/SketchSolver_ConstraintMulti.h @@ -1,13 +1,26 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: SketchSolver_ConstraintMulti.h -// Created: 2 Sep 2015 -// 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 SketchSolver_ConstraintMulti_H_ #define SketchSolver_ConstraintMulti_H_ -#include "SketchSolver.h" #include #include @@ -24,45 +37,35 @@ public: SketchSolver_Constraint(theConstraint), myNumberOfObjects(0), myNumberOfCopies(0), - myAdjusted(false) + myIsFullValue(false), + myAdjusted(false), + myIsEventsBlocked(false) {} - virtual int getType() const - { return SLVS_C_UNKNOWN; } - /// \brief Update constraint - virtual void update(ConstraintPtr theConstraint = ConstraintPtr()); - - /// \brief Tries to remove constraint - /// \return \c false, if current constraint contains another SketchPlugin constraints (like for multiple coincidence) - virtual bool remove(ConstraintPtr theConstraint = ConstraintPtr()); + virtual void update(); - /// \brief Adds a feature to constraint and create its analogue in SolveSpace - virtual void addFeature(FeaturePtr theFeature); + /// \brief Notify this object about the feature is changed somewhere + virtual void notify(const FeaturePtr& theFeature, PlaneGCSSolver_Update*); - /// \brief Update SketchPlugin attributes using the data obtained from SolveSpace entities - virtual void refresh() - { - myAdjusted = false; - SketchSolver_Constraint::refresh(); - } + /// \brief Tries to remove constraint + /// \return \c false, if current constraint contains another SketchPlugin + /// constraints (like for multiple coincidence) + virtual bool remove(); - /// \brief Verifies, the coincidence between points of copied entities appears or disappears, - /// and removes or adds fixing of corresponding points. - void checkCoincidence(); + /// \brief Block or unblock events from this constraint + virtual void blockEvents(bool isBlocked); protected: /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints virtual void process() { /* do nothing here */ } - /// \brief Collect entities and their copies, like circles and arcs - void processEntities(const std::vector< std::vector >& theEntAndCopies); + /// \brief Collect entities which are translated or rotated (not their copies) + void getEntities(std::list& theEntities); /// \brief Generate list of attributes of constraint in order useful for SolveSpace constraints - /// \param[out] theValue numerical characteristic of constraint (e.g. distance) - /// \param[out] theAttributes list of attributes to be filled - virtual void getAttributes(double& theValue, std::vector& theAttributes) + virtual void getAttributes(EntityWrapperPtr&, std::vector&) { /* do nothing here */ } /// \brief This method is used in derived objects to check consistence of constraint. @@ -73,7 +76,7 @@ protected: /// \brief Returns name of NUMBER_OF_COPIES parameter for corresponding feature virtual const std::string& nameNbObjects() = 0; - + protected: /// \brief Convert absolute coordinates to relative coordinates virtual void getRelative(double theAbsX, double theAbsY, double& theRelX, double& theRelY) = 0; @@ -83,16 +86,17 @@ protected: virtual void transformRelative(double& theX, double& theY) = 0; protected: - size_t myNumberOfObjects; ///< number of previous initial objects - size_t myNumberOfCopies; ///< number of previous copies of initial objects + int myNumberOfObjects; ///< number of previous initial objects + int myNumberOfCopies; ///< number of previous copies of initial objects + bool myIsFullValue; ///< value whether the angle/distance is a full or single for objects - std::vector< std::vector > myPointsAndCopies; ///< list of initial points and their copies - std::vector< std::vector > myCircsAndCopies; ///< list of circles and their copies (to change their radii together) + bool myAdjusted; ///< the constraint is already adjusted (to not do it several times) - std::set myPointsJustUpdated; ///< list of points touched by user - std::set myInitialPoints; ///< list of points containing initial objects + /// lists of original features and their copies to find whether some of them are disappeared + std::set myOriginalFeatures; + std::set myCopiedFeatures; - bool myAdjusted; ///< the constraint is already adjusted (to not do it several times) + bool myIsEventsBlocked; }; #endif