X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FSketchSolver%2FPlaneGCSSolver%2FPlaneGCSSolver_Storage.h;h=370760cf9102f3077b2160cce69f719948f6f028;hb=87447545000c44e455431ed0d401f850f373374e;hp=ca8fa22212ae247acadaed0fbbeae88068075669;hpb=a3d263fc39996448910ac7155de337e9868cfa1f;p=modules%2Fshaper.git diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.h index ca8fa2221..370760cf9 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.h @@ -1,17 +1,27 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: PlaneGCSSolver_Storage.h -// Created: 14 Dec 2015 -// Author: Artem ZHIDKOV +// Copyright (C) 2014-2020 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 PlaneGCSSolver_Storage_H_ #define PlaneGCSSolver_Storage_H_ #include - -#include #include -#include class PlaneGCSSolver_EntityBuilder; @@ -33,10 +43,10 @@ public: virtual void addConstraint(ConstraintPtr theConstraint, ConstraintWrapperPtr theSolverConstraint); - /// \brief Add list of temporary constraints which will be destroyed + /// \brief Add a movement constraint which will be destroyed /// after the next solving of the set of constraints. /// \param theSolverConstraint [in] solver's constraint - virtual void addTemporaryConstraint(const ConstraintWrapperPtr& theSolverConstraint); + virtual void addMovementConstraint(const ConstraintWrapperPtr& theSolverConstraint); /// \brief Convert feature to the form applicable for specific solver and map it @@ -51,11 +61,20 @@ public: /// \return \c true if the attribute has been created or updated virtual bool update(AttributePtr theAttribute, bool theForce = false); + /// \brief Make entity external + virtual void makeExternal(const EntityWrapperPtr& theEntity); + /// \brief Make entity non-external + virtual void makeNonExternal(const EntityWrapperPtr& theEntity); /// \brief Removes constraint from the storage /// \return \c true if the constraint and all its parameters are removed successfully virtual bool removeConstraint(ConstraintPtr theConstraint); + /// \brief Verify, the sketch contains degenerated geometry + /// after resolving the set of constraints + /// \return STATUS_OK if the geometry is valid, STATUS_DEGENERATED otherwise. + virtual PlaneGCSSolver_Solver::SolveStatus checkDegeneratedGeometry() const; + /// \brief Update SketchPlugin features after resolving constraints virtual void refresh() const; @@ -67,15 +86,19 @@ public: /// \brief Remove all features became invalid virtual void removeInvalidEntities(); -private: - /// \brief Verifies the constraint should not be added into the solver - /// - /// This is a workaround method to avoid some kinds of conflicting constraints: - /// * symmetric of two points placed on the mirror line (do not add perpendicular constraint) - bool isRedundant(GCSConstraintPtr theCheckedConstraint, - ConstraintWrapperPtr theParentConstraint, - std::list >& theCoincidentPoints) const; + /// \brief Check the storage has constraints + virtual bool isEmpty() const + { return SketchSolver_Storage::isEmpty() && myAuxConstraintMap.empty(); } + /// \brief Make parametrization of arcs consistent. + /// Forward arcs should have the last parameter greater than the first parameter. + /// Reversed arcs should have the last parameter lesser than the first parameter. + virtual void adjustParametrizationOfArcs(); + + /// \brief Return list of features which are not fully constrained + virtual void getUnderconstrainedGeometry(std::set& theFeatures) const; + +private: /// \brief Convert feature using specified builder. EntityWrapperPtr createFeature(const FeaturePtr& theFeature, PlaneGCSSolver_EntityBuilder* theBuilder); @@ -84,11 +107,17 @@ private: EntityWrapperPtr createAttribute(const AttributePtr& theAttribute, PlaneGCSSolver_EntityBuilder* theBuilder); + /// \brief Create additional constaints: + /// * for arc to fix extra parameters; + /// * for ellipse to keep auxiliary points on their places + void createAuxiliaryConstraints(const EntityWrapperPtr& theEntity); + void removeAuxiliaryConstraints(const EntityWrapperPtr& theEntity); + private: ConstraintID myConstraintLastID; ///< identifier of last added constraint - /// additional constraints for correct processing of the arcs - std::map myArcConstraintMap; + /// additional constraints for correct processing of the arcs, ellipses, elliptic arcs + std::map myAuxConstraintMap; /// list of removed constraints to notify solver std::list myRemovedConstraints;