X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FSketchSolver%2FPlaneGCSSolver%2FPlaneGCSSolver_Tools.h;h=986afef61bd4b66b009a1bc64a999729af52c281;hb=6c9733606d54a0813c3b7d5522dd74a3af989917;hp=4e5b666b67268986f7f77026cfd8058f12e10a1c;hpb=6e421e939851e0de46554ae45a3ca0e1f67cd91d;p=modules%2Fshaper.git diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Tools.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Tools.h index 4e5b666b6..986afef61 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Tools.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Tools.h @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2019 CEA/DEN, EDF R&D +// Copyright (C) 2014-2022 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 @@ -24,8 +24,14 @@ #include #include -#include -#include +class GeomAPI_BSpline2d; +class GeomAPI_Circ2d; +class GeomAPI_Ellipse2d; +class GeomAPI_Lin2d; +class GeomAPI_Pnt2d; + +class ModelAPI_AttributeDoubleArray; +class ModelAPI_AttributeIntArray; /** \namespace PlaneGCSSolver_Tools * \ingroup Plugins @@ -43,6 +49,9 @@ namespace PlaneGCSSolver_Tools /// \brief Creates temporary constraint to fix the attribute after movement std::shared_ptr createMovementConstraint(AttributePtr theMovedAttribute); + /// \brief Creates temporary constraint to fix the point in array after movement + std::shared_ptr + createMovementConstraint(const std::pair& theMovedPointInArray); /// \brief Creates new constraint using given parameters /// \param theConstraint [in] original constraint @@ -62,19 +71,63 @@ namespace PlaneGCSSolver_Tools const EntityWrapperPtr& theEntity3 = EntityWrapperPtr(), const EntityWrapperPtr& theEntity4 = EntityWrapperPtr()); + /// \brief Return \c true if the attribute is used in PlaneGCS solver + /// \param[in] theAttrName name of the attribute + /// \param[in] theOwnerName name of the parent feature + bool isAttributeApplicable(const std::string& theAttrName, + const std::string& theOwnerName); + /// \brief Convert entity to point /// \return empty pointer if the entity is not a point std::shared_ptr point(EntityWrapperPtr theEntity); /// \brief Convert entity to line /// \return empty pointer if the entity is not a line std::shared_ptr line(EntityWrapperPtr theEntity); + /// \brief Convert entity to circle + /// \return empty pointer if the entity is not a circle + std::shared_ptr circle(EntityWrapperPtr theEntity); + /// \brief Convert entity to ellipse + /// \return empty pointer if the entity is not an ellipse + std::shared_ptr ellipse(EntityWrapperPtr theEntity); + /// \brief Convert entity to Bs-pline + /// \return empty pointer if the entity is not an ellipse + std::shared_ptr bspline(EntityWrapperPtr theEntity); /// \brief Convert entity to line /// \return empty pointer if the entity is not a line std::shared_ptr line(FeaturePtr theFeature); + /// \brief Update start and end parameters of circular and elliptic arcs + /// respectively to start and end points on the arc. + /// For the circular arc, the radius is calculated too. + void recalculateArcParameters(EntityWrapperPtr theArc); + /// brief Return list of parameters for the given entity GCS::SET_pD parameters(const EntityWrapperPtr& theEntity); + + /// \brief Update value in theDest if theSource is differ more than theTolerance + /// \return \c true if the value was updated. + bool updateValue(const double& theSource, double& theDest, + const double theTolerance = 1.e4 * tolerance); + + double distance(const GCS::Point& thePnt1, const GCS::Point& thePnt2); + + /// \brief Provide an interface to access values in attribute which is an array of values + class AttributeArray + { + public: + AttributeArray(AttributePtr theAttribute); + + bool isInitialized() const; + + int size() const; + + double value(const int theIndex) const; + + private: + std::shared_ptr myDouble; + std::shared_ptr myInteger; + }; }; #endif