SHAPER 9.16.0
PlaneGCSSolver_Tools.h
1// Copyright (C) 2014-2026 CEA, EDF
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#ifndef PlaneGCSSolver_Tools_H_
21#define PlaneGCSSolver_Tools_H_
22
23#include <SketchSolver_Constraint.h>
24#include <SketchSolver_ConstraintMovement.h>
25#include <SketchPlugin_Constraint.h>
26
28class GeomAPI_Circ2d;
30class GeomAPI_Lin2d;
31class GeomAPI_Pnt2d;
32
35
41{
44 SolverConstraintPtr createConstraint(ConstraintPtr theConstraint);
45
47 std::shared_ptr<SketchSolver_ConstraintMovement>
48 createMovementConstraint(FeaturePtr theMovedFeature);
50 std::shared_ptr<SketchSolver_ConstraintMovement>
51 createMovementConstraint(AttributePtr theMovedAttribute);
53 std::shared_ptr<SketchSolver_ConstraintMovement>
54 createMovementConstraint(const std::pair<AttributePtr, int>& theMovedPointInArray);
55
66 ConstraintWrapperPtr createConstraint(ConstraintPtr theConstraint,
67 const SketchSolver_ConstraintType& theType,
68 const EntityWrapperPtr& theValue,
69 const EntityWrapperPtr& theEntity1,
70 const EntityWrapperPtr& theEntity2 = EntityWrapperPtr(),
71 const EntityWrapperPtr& theEntity3 = EntityWrapperPtr(),
72 const EntityWrapperPtr& theEntity4 = EntityWrapperPtr());
73
77 bool isAttributeApplicable(const std::string& theAttrName,
78 const std::string& theOwnerName);
79
82 std::shared_ptr<GeomAPI_Pnt2d> point(EntityWrapperPtr theEntity);
85 std::shared_ptr<GeomAPI_Lin2d> line(EntityWrapperPtr theEntity);
88 std::shared_ptr<GeomAPI_Circ2d> circle(EntityWrapperPtr theEntity);
91 std::shared_ptr<GeomAPI_Ellipse2d> ellipse(EntityWrapperPtr theEntity);
94 std::shared_ptr<GeomAPI_BSpline2d> bspline(EntityWrapperPtr theEntity);
95
98 std::shared_ptr<GeomAPI_Lin2d> line(FeaturePtr theFeature);
99
103 void recalculateArcParameters(EntityWrapperPtr theArc);
104
106 GCS::SET_pD parameters(const EntityWrapperPtr& theEntity);
107
110 bool updateValue(const double& theSource, double& theDest,
111 const double theTolerance = 1.e4 * tolerance);
112
113 double distance(const GCS::Point& thePnt1, const GCS::Point& thePnt2);
114
117 {
118 public:
119 AttributeArray(AttributePtr theAttribute);
120
121 bool isInitialized() const;
122
123 int size() const;
124
125 double value(const int theIndex) const;
126
127 private:
128 std::shared_ptr<ModelAPI_AttributeDoubleArray> myDouble;
129 std::shared_ptr<ModelAPI_AttributeIntArray> myInteger;
130 };
131};
132
133#endif
B-spline curve in 2D.
Definition: GeomAPI_BSpline2d.h:36
Circle in 2D.
Definition: GeomAPI_Circ2d.h:37
Ellipse in 2D.
Definition: GeomAPI_Ellipse2d.h:39
Line in 2D.
Definition: GeomAPI_Lin2d.h:35
2D point defined by two coordinates
Definition: GeomAPI_Pnt2d.h:36
API for the attribute that contains several double in the array inside.
Definition: ModelAPI_AttributeDoubleArray.h:32
API for the attribute that contains several integers in the array inside.
Definition: ModelAPI_AttributeIntArray.h:36
Provide an interface to access values in attribute which is an array of values.
Definition: PlaneGCSSolver_Tools.h:117
Converter tools.
void recalculateArcParameters(EntityWrapperPtr theArc)
Update start and end parameters of circular and elliptic arcs respectively to start and end points on...
Definition: PlaneGCSSolver_Tools.cpp:401
bool updateValue(const double &theSource, double &theDest, const double theTolerance=1.e4 *tolerance)
Update value in theDest if theSource is differ more than theTolerance.
Definition: PlaneGCSSolver_Tools.cpp:535
std::shared_ptr< GeomAPI_Lin2d > line(EntityWrapperPtr theEntity)
Convert entity to line.
Definition: PlaneGCSSolver_Tools.cpp:313
SolverConstraintPtr createConstraint(ConstraintPtr theConstraint)
Creates a solver's constraint using given SketchPlugin constraint or returns empty pointer if not all...
Definition: PlaneGCSSolver_Tools.cpp:160
std::shared_ptr< GeomAPI_Circ2d > circle(EntityWrapperPtr theEntity)
Convert entity to circle.
Definition: PlaneGCSSolver_Tools.cpp:338
std::shared_ptr< GeomAPI_Ellipse2d > ellipse(EntityWrapperPtr theEntity)
Convert entity to ellipse.
Definition: PlaneGCSSolver_Tools.cpp:350
std::shared_ptr< SketchSolver_ConstraintMovement > createMovementConstraint(FeaturePtr theMovedFeature)
Creates temporary constraint to fix the feature after movement.
Definition: PlaneGCSSolver_Tools.cpp:198
std::shared_ptr< GeomAPI_Pnt2d > point(EntityWrapperPtr theEntity)
Convert entity to point.
Definition: PlaneGCSSolver_Tools.cpp:302
std::shared_ptr< GeomAPI_BSpline2d > bspline(EntityWrapperPtr theEntity)
Convert entity to Bs-pline.
Definition: PlaneGCSSolver_Tools.cpp:370
GCS::SET_pD parameters(const EntityWrapperPtr &theEntity)
brief Return list of parameters for the given entity
Definition: PlaneGCSSolver_Tools.cpp:443
bool isAttributeApplicable(const std::string &theAttrName, const std::string &theOwnerName)
Return true if the attribute is used in PlaneGCS solver.
Definition: PlaneGCSSolver_Tools.cpp:472