Salome HOME
6dc4aa0f4daad18995d0ed8b20ba3f69df039037
[modules/shaper.git] / src / SketchSolver / SolveSpaceSolver / SolveSpaceSolver_EntityWrapper.h
1 // Copyright (C) 2014-2023  CEA/DEN, EDF R&D
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 SolveSpaceSolver_EntityWrapper_H_
21 #define SolveSpaceSolver_EntityWrapper_H_
22
23 #include <SketchSolver_IEntityWrapper.h>
24 #include <SolveSpaceSolver_Solver.h>
25
26 /**
27  *  Wrapper providing operations with SolveSpace entities.
28  */
29 class SolveSpaceSolver_EntityWrapper : public SketchSolver_IEntityWrapper
30 {
31 public:
32   SolveSpaceSolver_EntityWrapper(const FeaturePtr theFeature, const Slvs_Entity& theEntity);
33   SolveSpaceSolver_EntityWrapper(const AttributePtr theAttribute, const Slvs_Entity& theEntity);
34
35   /// \brief Constructor useful for SketchPlugin_Point only
36   SolveSpaceSolver_EntityWrapper(const FeaturePtr thePointFeature,
37                                  const AttributePtr thePointAttribute,
38                                  const Slvs_Entity& theEntity);
39
40   /// \brief Return SolveSpace entity
41   const Slvs_Entity& entity() const
42   { return myEntity; }
43   /// \brief Return SolveSpace entity to change
44   Slvs_Entity& changeEntity()
45   { return myEntity; }
46
47   /// \brief Return ID of current entity
48   virtual EntityID id() const;
49
50   /// \brief Change group for the entity
51   virtual void setGroup(const GroupID& theGroup);
52   /// \brief Return identifier of the group the entity belongs to
53   virtual GroupID group() const
54   { return (GroupID)myEntity.group; }
55
56   /// \brief Return type of current entity
57   virtual SketchSolver_EntityType type() const;
58
59   /// \brief Verify the feature is used in the entity
60   virtual bool isUsed(FeaturePtr theFeature) const;
61   /// \brief Verify the attribute is used in the entity
62   virtual bool isUsed(AttributePtr theAttribute) const;
63
64   /// \brief Compare current entity with other
65   virtual bool isEqual(const EntityWrapperPtr& theOther);
66
67   /// \brief Update values of parameters of this entity by the parameters of given one
68   /// \return \c true if some parameters change their values
69   virtual bool update(const std::shared_ptr<SketchSolver_IEntityWrapper>& theOther);
70
71 private:
72   Slvs_Entity  myEntity;
73 };
74
75 #endif