INCLUDE(Common)
SET(SKETCHSOLVER_HEADERS
- SketchSolver.h
SketchSolver_Error.h
SketchSolver_Group.h
- SketchSolver_IConstraintWrapper.h
- SketchSolver_IEntityWrapper.h
SketchSolver_Manager.h
SketchSolver_Storage.h
)
PlaneGCSSolver_Solver.h
PlaneGCSSolver_Storage.h
PlaneGCSSolver_ConstraintWrapper.h
- PlaneGCSSolver_EntityWrapper.h
+ PlaneGCSSolver_EdgeWrapper.h
+ PlaneGCSSolver_EdgeWrapper.h
PlaneGCSSolver_PointWrapper.h
PlaneGCSSolver_ScalarWrapper.h
PlaneGCSSolver_AngleWrapper.h
PlaneGCSSolver_Solver.cpp
PlaneGCSSolver_Storage.cpp
PlaneGCSSolver_ConstraintWrapper.cpp
- PlaneGCSSolver_EntityWrapper.cpp
+ PlaneGCSSolver_EdgeWrapper.cpp
PlaneGCSSolver_PointWrapper.cpp
PlaneGCSSolver_ScalarWrapper.cpp
PlaneGCSSolver_AngleWrapper.cpp
#define PlaneGCSSolver_ConstraintWrapper_H_
#include <PlaneGCSSolver_Defs.h>
-#include <PlaneGCSSolver_Solver.h>
#include <PlaneGCSSolver_ScalarWrapper.h>
-#include <SketchSolver_IConstraintWrapper.h>
-
/**
* Wrapper providing operations with PlaneGCS constraints.
*/
-class PlaneGCSSolver_ConstraintWrapper : public SketchSolver_IConstraintWrapper
+class PlaneGCSSolver_ConstraintWrapper
{
public:
PlaneGCSSolver_ConstraintWrapper(const GCSConstraintPtr& theConstraint,
void setConstraints(const std::list<GCSConstraintPtr>& theConstraints)
{ myGCSConstraints = theConstraints; }
+ /// \brief Return ID of current constraint
+ const ConstraintID& id() const
+ { return myID; }
/// \brief Change constraint ID
virtual void setId(const ConstraintID& theID);
{ return myValueParam; }
private:
+ ConstraintID myID;
SketchSolver_ConstraintType myType;
ScalarWrapperPtr myValueParam;
std::list<GCSConstraintPtr> myGCSConstraints;
};
+typedef std::shared_ptr<PlaneGCSSolver_ConstraintWrapper> ConstraintWrapperPtr;
+
#endif
#ifndef PlaneGCSSolver_Defs_H_
#define PlaneGCSSolver_Defs_H_
-#include <SketchSolver.h>
-
#include <Constraints.h>
#include <Geo.h>
#include <memory>
typedef std::shared_ptr<GCS::Curve> GCSCurvePtr;
typedef std::shared_ptr<GCS::Constraint> GCSConstraintPtr;
+// Tolerance for value of parameters
+const double tolerance = 1.e-10;
+
+#define PI 3.1415926535897932
+
+// Types for data entities enumeration
+typedef int ConstraintID;
+
+// Predefined values for identifiers
+const ConstraintID CID_UNKNOWN = 0;
+const ConstraintID CID_MOVEMENT = -1;
+
+/// Types of entities
+enum SketchSolver_EntityType {
+ ENTITY_UNKNOWN = 0,
+ ENTITY_SCALAR,
+ ENTITY_ANGLE,
+ ENTITY_POINT,
+ ENTITY_LINE,
+ ENTITY_CIRCLE,
+ ENTITY_ARC
+};
+
+/// Types of constraints
+enum SketchSolver_ConstraintType {
+ CONSTRAINT_UNKNOWN = 0,
+ CONSTRAINT_COINCIDENCE, // base coincidence if we don't know exact type yet
+ CONSTRAINT_PT_PT_COINCIDENT,
+ CONSTRAINT_PT_ON_LINE,
+ CONSTRAINT_PT_ON_CIRCLE,
+ CONSTRAINT_MIDDLE_POINT,
+ CONSTRAINT_DISTANCE, // base distance if we don't know the measured objects yet
+ CONSTRAINT_PT_PT_DISTANCE,
+ CONSTRAINT_PT_LINE_DISTANCE,
+ CONSTRAINT_RADIUS,
+ CONSTRAINT_ANGLE,
+ CONSTRAINT_FIXED,
+ CONSTRAINT_HORIZONTAL,
+ CONSTRAINT_VERTICAL,
+ CONSTRAINT_PARALLEL,
+ CONSTRAINT_PERPENDICULAR,
+ CONSTRAINT_SYMMETRIC,
+ CONSTRAINT_EQUAL, // base equality if we don't know the measured objects yet
+ CONSTRAINT_EQUAL_LINES,
+ CONSTRAINT_EQUAL_LINE_ARC,
+ CONSTRAINT_EQUAL_RADIUS,
+ CONSTRAINT_TANGENT, // base tangency if we don't know the measured objects yet
+ CONSTRAINT_TANGENT_CIRCLE_LINE,
+ CONSTRAINT_TANGENT_CIRCLE_CIRCLE,
+ CONSTRAINT_COLLINEAR,
+ CONSTRAINT_MULTI_TRANSLATION,
+ CONSTRAINT_MULTI_ROTATION
+};
+
#endif
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: PlaneGCSSolver_EdgeWrapper.cpp
+// Created: 14 Dec 2015
+// Author: Artem ZHIDKOV
+
+#include <PlaneGCSSolver_EdgeWrapper.h>
+
+PlaneGCSSolver_EdgeWrapper::PlaneGCSSolver_EdgeWrapper(const GCSCurvePtr theEntity)
+ : myEntity(theEntity)
+{
+ std::shared_ptr<GCS::Line> aLine = std::dynamic_pointer_cast<GCS::Line>(myEntity);
+ if (aLine) myType = ENTITY_LINE;
+ else {
+ std::shared_ptr<GCS::Arc> anArc = std::dynamic_pointer_cast<GCS::Arc>(myEntity);
+ if (anArc) myType = ENTITY_ARC;
+ else {
+ std::shared_ptr<GCS::Circle> aCircle = std::dynamic_pointer_cast<GCS::Circle>(myEntity);
+ if (aCircle) myType = ENTITY_CIRCLE;
+ }
+ }
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: PlaneGCSSolver_EdgeWrapper.h
+// Created: 14 Dec 2015
+// Author: Artem ZHIDKOV
+
+#ifndef PlaneGCSSolver_EdgeWrapper_H_
+#define PlaneGCSSolver_EdgeWrapper_H_
+
+#include <PlaneGCSSolver_Defs.h>
+#include <PlaneGCSSolver_EntityWrapper.h>
+
+/**
+ * Wrapper providing operations with PlaneGCS entities (lines, circles and arcs).
+ */
+class PlaneGCSSolver_EdgeWrapper : public PlaneGCSSolver_EntityWrapper
+{
+public:
+ PlaneGCSSolver_EdgeWrapper(const GCSCurvePtr theEntity);
+
+ /// \brief Return PlaneGCS geometric entity
+ const GCSCurvePtr& entity() const
+ { return myEntity; }
+ /// \brief Return PlaneGCS geometric entity to change
+ GCSCurvePtr& changeEntity()
+ { return myEntity; }
+
+ /// \brief Return type of current entity
+ virtual SketchSolver_EntityType type() const
+ { return myType; }
+
+private:
+ SketchSolver_EntityType myType;
+ GCSCurvePtr myEntity;
+};
+
+#endif
#include <PlaneGCSSolver_PointWrapper.h>
#include <PlaneGCSSolver_ScalarWrapper.h>
-#include <PlaneGCSSolver_EntityWrapper.h>
+#include <PlaneGCSSolver_EdgeWrapper.h>
static void destroyScalar(const EntityWrapperPtr& theEntity, GCS::SET_pD& theParams)
{
static void destroyLine(const EntityWrapperPtr& theEntity, GCS::SET_pD& theParams)
{
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> anEntity =
- std::dynamic_pointer_cast<PlaneGCSSolver_EntityWrapper>(theEntity);
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> anEntity =
+ std::dynamic_pointer_cast<PlaneGCSSolver_EdgeWrapper>(theEntity);
std::shared_ptr<GCS::Line> aLine = std::dynamic_pointer_cast<GCS::Line>(anEntity->entity());
theParams.insert(aLine->p1.x);
theParams.insert(aLine->p1.y);
static void destroyCircle(const EntityWrapperPtr& theEntity, GCS::SET_pD& theParams)
{
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> anEntity =
- std::dynamic_pointer_cast<PlaneGCSSolver_EntityWrapper>(theEntity);
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> anEntity =
+ std::dynamic_pointer_cast<PlaneGCSSolver_EdgeWrapper>(theEntity);
std::shared_ptr<GCS::Circle> aCirc = std::dynamic_pointer_cast<GCS::Circle>(anEntity->entity());
theParams.insert(aCirc->center.x);
theParams.insert(aCirc->center.y);
static void destroyArc(const EntityWrapperPtr& theEntity, GCS::SET_pD& theParams)
{
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> anEntity =
- std::dynamic_pointer_cast<PlaneGCSSolver_EntityWrapper>(theEntity);
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> anEntity =
+ std::dynamic_pointer_cast<PlaneGCSSolver_EdgeWrapper>(theEntity);
std::shared_ptr<GCS::Arc> anArc = std::dynamic_pointer_cast<GCS::Arc>(anEntity->entity());
theParams.insert(anArc->center.x);
theParams.insert(anArc->center.y);
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: PlaneGCSSolver_EntityWrapper.cpp
-// Created: 14 Dec 2015
-// Author: Artem ZHIDKOV
-
-#include <PlaneGCSSolver_EntityWrapper.h>
-
-PlaneGCSSolver_EntityWrapper::PlaneGCSSolver_EntityWrapper(const GCSCurvePtr theEntity)
- : myEntity(theEntity)
-{
- std::shared_ptr<GCS::Line> aLine = std::dynamic_pointer_cast<GCS::Line>(myEntity);
- if (aLine) myType = ENTITY_LINE;
- else {
- std::shared_ptr<GCS::Arc> anArc = std::dynamic_pointer_cast<GCS::Arc>(myEntity);
- if (anArc) myType = ENTITY_ARC;
- else {
- std::shared_ptr<GCS::Circle> aCircle = std::dynamic_pointer_cast<GCS::Circle>(myEntity);
- if (aCircle) myType = ENTITY_CIRCLE;
- }
- }
-}
// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// File: PlaneGCSSolver_EntityWrapper.h
-// Created: 14 Dec 2015
+// Created: 30 Nov 2015
// Author: Artem ZHIDKOV
#ifndef PlaneGCSSolver_EntityWrapper_H_
#define PlaneGCSSolver_EntityWrapper_H_
#include <PlaneGCSSolver_Defs.h>
-#include <SketchSolver_IEntityWrapper.h>
+
+#include <ModelAPI_Attribute.h>
+#include <ModelAPI_Feature.h>
+
+#include <list>
+#include <memory>
/**
- * Wrapper providing operations with PlaneGCS entities (lines, circles and arcs).
+ * Wrapper providing operations with entities regardless the solver.
*/
-class PlaneGCSSolver_EntityWrapper : public SketchSolver_IEntityWrapper
+class PlaneGCSSolver_EntityWrapper
{
public:
- PlaneGCSSolver_EntityWrapper(const GCSCurvePtr theEntity);
-
- /// \brief Return PlaneGCS geometric entity
- const GCSCurvePtr& entity() const
- { return myEntity; }
- /// \brief Return PlaneGCS geometric entity to change
- GCSCurvePtr& changeEntity()
- { return myEntity; }
+ PlaneGCSSolver_EntityWrapper() : myExternal(false) {}
+ virtual ~PlaneGCSSolver_EntityWrapper() {}
/// \brief Return type of current entity
- virtual SketchSolver_EntityType type() const
- { return myType; }
+ virtual SketchSolver_EntityType type() const = 0;
+
+ /// \brief Change flag indicating the entity cannot be changed in the solver
+ void setExternal(bool theExternal) { myExternal = theExternal; }
+ /// \brief Return the External flag
+ bool isExternal() const { return myExternal; }
private:
- SketchSolver_EntityType myType;
- GCSCurvePtr myEntity;
+ bool myExternal;
};
+typedef std::shared_ptr<PlaneGCSSolver_EntityWrapper> EntityWrapperPtr;
+
#endif
// Author: Artem ZHIDKOV
#include <PlaneGCSSolver_FeatureBuilder.h>
-#include <PlaneGCSSolver_EntityWrapper.h>
+#include <PlaneGCSSolver_EdgeWrapper.h>
#include <PlaneGCSSolver_PointWrapper.h>
#include <PlaneGCSSolver_ScalarWrapper.h>
aNewLine->p2 = *(aPoint->point());
}
- return EntityWrapperPtr(new PlaneGCSSolver_EntityWrapper(aNewLine));
+ return EntityWrapperPtr(new PlaneGCSSolver_EdgeWrapper(aNewLine));
}
EntityWrapperPtr createCircle(const AttributeEntityMap& theAttributes)
}
}
- return EntityWrapperPtr(new PlaneGCSSolver_EntityWrapper(aNewCircle));
+ return EntityWrapperPtr(new PlaneGCSSolver_EdgeWrapper(aNewCircle));
}
static double* createParameter(PlaneGCSSolver_Storage* theStorage)
aNewArc->center, aNewArc->end, aNewArc->endAngle)));
}
- return EntityWrapperPtr(new PlaneGCSSolver_EntityWrapper(aNewArc));
+ return EntityWrapperPtr(new PlaneGCSSolver_EdgeWrapper(aNewArc));
}
bool isAttributeApplicable(const std::string& theAttrName, const std::string& theOwnerName)
#define PlaneGCSSolver_PointWrapper_H_
#include <PlaneGCSSolver_Defs.h>
-#include <SketchSolver_IEntityWrapper.h>
+#include <PlaneGCSSolver_EntityWrapper.h>
/**
* Wrapper providing operations with PlaneGCS points.
*/
-class PlaneGCSSolver_PointWrapper : public SketchSolver_IEntityWrapper
+class PlaneGCSSolver_PointWrapper : public PlaneGCSSolver_EntityWrapper
{
public:
PlaneGCSSolver_PointWrapper(const GCSPointPtr thePoint);
#define PlaneGCSSolver_ScalarWrapper_H_
#include <PlaneGCSSolver_Defs.h>
-#include <SketchSolver_IEntityWrapper.h>
+#include <PlaneGCSSolver_EntityWrapper.h>
/**
* Wrapper providing operations with PlaneGCS scalars.
*/
-class PlaneGCSSolver_ScalarWrapper : public SketchSolver_IEntityWrapper
+class PlaneGCSSolver_ScalarWrapper : public PlaneGCSSolver_EntityWrapper
{
public:
PlaneGCSSolver_ScalarWrapper(double *const theParam);
#ifndef PlaneGCSSolver_Solver_H_
#define PlaneGCSSolver_Solver_H_
-#include <SketchSolver_IConstraintWrapper.h>
#include <PlaneGCSSolver_Defs.h>
+#include <PlaneGCSSolver_ConstraintWrapper.h>
#include <GCS.h>
#include <PlaneGCSSolver_Storage.h>
#include <PlaneGCSSolver_Solver.h>
#include <PlaneGCSSolver_ConstraintWrapper.h>
-#include <PlaneGCSSolver_EntityWrapper.h>
+#include <PlaneGCSSolver_EdgeWrapper.h>
#include <PlaneGCSSolver_PointWrapper.h>
#include <PlaneGCSSolver_AttributeBuilder.h>
if (aRelated && aRelated->type() == ENTITY_ARC) {
/// TODO: this code should be shared with FeatureBuilder somehow
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> anEntity =
- std::dynamic_pointer_cast<PlaneGCSSolver_EntityWrapper>(aRelated);
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> anEntity =
+ std::dynamic_pointer_cast<PlaneGCSSolver_EdgeWrapper>(aRelated);
std::shared_ptr<GCS::Arc> anArc = std::dynamic_pointer_cast<GCS::Arc>(anEntity->entity());
static std::shared_ptr<GeomAPI_Dir2d> OX(new GeomAPI_Dir2d(1.0, 0.0));
#define PlaneGCSSolver_Storage_H_
#include <PlaneGCSSolver_Defs.h>
-
-#include <SketchSolver.h>
#include <SketchSolver_Storage.h>
class PlaneGCSSolver_EntityBuilder;
// Author: Artem ZHIDKOV
#include <PlaneGCSSolver_Tools.h>
-#include <PlaneGCSSolver_EntityWrapper.h>
+#include <PlaneGCSSolver_EdgeWrapper.h>
#include <PlaneGCSSolver_PointWrapper.h>
#include <PlaneGCSSolver_ScalarWrapper.h>
#include <PlaneGCSSolver_ConstraintWrapper.h>
#include <cmath>
-#define GCS_ENTITY_WRAPPER(x) std::dynamic_pointer_cast<PlaneGCSSolver_EntityWrapper>(x)
+#define GCS_EDGE_WRAPPER(x) std::dynamic_pointer_cast<PlaneGCSSolver_EdgeWrapper>(x)
#define GCS_POINT_WRAPPER(x) std::dynamic_pointer_cast<PlaneGCSSolver_PointWrapper>(x)
#define GCS_SCALAR_WRAPPER(x) std::dynamic_pointer_cast<PlaneGCSSolver_ScalarWrapper>(x)
static ConstraintWrapperPtr
createConstraintPointOnEntity(const SketchSolver_ConstraintType& theType,
std::shared_ptr<PlaneGCSSolver_PointWrapper> thePoint,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity);
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity);
static ConstraintWrapperPtr
createConstraintDistancePointPoint(std::shared_ptr<PlaneGCSSolver_ScalarWrapper> theValue,
std::shared_ptr<PlaneGCSSolver_PointWrapper> thePoint1,
static ConstraintWrapperPtr
createConstraintDistancePointLine(std::shared_ptr<PlaneGCSSolver_ScalarWrapper> theValue,
std::shared_ptr<PlaneGCSSolver_PointWrapper> thePoint,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity);
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity);
static ConstraintWrapperPtr
createConstraintRadius(std::shared_ptr<PlaneGCSSolver_ScalarWrapper> theValue,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity);
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity);
static ConstraintWrapperPtr
createConstraintAngle(ConstraintPtr theConstraint,
std::shared_ptr<PlaneGCSSolver_ScalarWrapper> theValue,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity1,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity2);
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity1,
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity2);
static ConstraintWrapperPtr
createConstraintHorizVert(const SketchSolver_ConstraintType& theType,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity);
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity);
static ConstraintWrapperPtr
- createConstraintParallel(std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity1,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity2);
+ createConstraintParallel(std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity1,
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity2);
static ConstraintWrapperPtr
- createConstraintPerpendicular(std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity1,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity2);
+ createConstraintPerpendicular(std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity1,
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity2);
static ConstraintWrapperPtr
createConstraintEqual(const SketchSolver_ConstraintType& theType,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity1,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity2,
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity1,
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity2,
std::shared_ptr<PlaneGCSSolver_ScalarWrapper> theIntermed);
static ConstraintWrapperPtr
createConstraintTangent(const SketchSolver_ConstraintType& theType,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity1,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity2);
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity1,
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity2);
static ConstraintWrapperPtr
createConstraintMiddlePoint(std::shared_ptr<PlaneGCSSolver_PointWrapper> thePoint,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity);
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity);
break;
case CONSTRAINT_PT_ON_LINE:
case CONSTRAINT_PT_ON_CIRCLE:
- aResult = createConstraintPointOnEntity(theType, aPoint1, GCS_ENTITY_WRAPPER(theEntity1));
+ aResult = createConstraintPointOnEntity(theType, aPoint1, GCS_EDGE_WRAPPER(theEntity1));
break;
case CONSTRAINT_MIDDLE_POINT:
- aResult = createConstraintMiddlePoint(aPoint1, GCS_ENTITY_WRAPPER(theEntity1));
+ aResult = createConstraintMiddlePoint(aPoint1, GCS_EDGE_WRAPPER(theEntity1));
break;
case CONSTRAINT_PT_PT_DISTANCE:
aResult = createConstraintDistancePointPoint(GCS_SCALAR_WRAPPER(theValue), aPoint1, aPoint2);
case CONSTRAINT_PT_LINE_DISTANCE:
aResult = createConstraintDistancePointLine(GCS_SCALAR_WRAPPER(theValue),
aPoint1,
- GCS_ENTITY_WRAPPER(theEntity1));
+ GCS_EDGE_WRAPPER(theEntity1));
break;
case CONSTRAINT_RADIUS:
aResult = createConstraintRadius(GCS_SCALAR_WRAPPER(theValue),
- GCS_ENTITY_WRAPPER(theEntity1));
+ GCS_EDGE_WRAPPER(theEntity1));
break;
case CONSTRAINT_ANGLE:
aResult = createConstraintAngle(theConstraint,
GCS_SCALAR_WRAPPER(theValue),
- GCS_ENTITY_WRAPPER(theEntity1), GCS_ENTITY_WRAPPER(theEntity2));
+ GCS_EDGE_WRAPPER(theEntity1), GCS_EDGE_WRAPPER(theEntity2));
break;
case CONSTRAINT_FIXED:
break;
case CONSTRAINT_HORIZONTAL:
case CONSTRAINT_VERTICAL:
- aResult = createConstraintHorizVert(theType, GCS_ENTITY_WRAPPER(theEntity1));
+ aResult = createConstraintHorizVert(theType, GCS_EDGE_WRAPPER(theEntity1));
break;
case CONSTRAINT_PARALLEL:
- aResult = createConstraintParallel(GCS_ENTITY_WRAPPER(theEntity1),
- GCS_ENTITY_WRAPPER(theEntity2));
+ aResult = createConstraintParallel(GCS_EDGE_WRAPPER(theEntity1),
+ GCS_EDGE_WRAPPER(theEntity2));
break;
case CONSTRAINT_PERPENDICULAR:
- aResult = createConstraintPerpendicular(GCS_ENTITY_WRAPPER(theEntity1),
- GCS_ENTITY_WRAPPER(theEntity2));
+ aResult = createConstraintPerpendicular(GCS_EDGE_WRAPPER(theEntity1),
+ GCS_EDGE_WRAPPER(theEntity2));
break;
case CONSTRAINT_EQUAL_LINES:
anIntermediate = GCS_SCALAR_WRAPPER(theValue); // parameter is used to store length of lines
case CONSTRAINT_EQUAL_LINE_ARC:
case CONSTRAINT_EQUAL_RADIUS:
aResult = createConstraintEqual(theType,
- GCS_ENTITY_WRAPPER(theEntity1),
- GCS_ENTITY_WRAPPER(theEntity2),
+ GCS_EDGE_WRAPPER(theEntity1),
+ GCS_EDGE_WRAPPER(theEntity2),
anIntermediate);
break;
case CONSTRAINT_TANGENT_CIRCLE_LINE:
case CONSTRAINT_TANGENT_CIRCLE_CIRCLE:
aResult = createConstraintTangent(theType,
- GCS_ENTITY_WRAPPER(theEntity1),
- GCS_ENTITY_WRAPPER(theEntity2));
+ GCS_EDGE_WRAPPER(theEntity1),
+ GCS_EDGE_WRAPPER(theEntity2));
break;
case CONSTRAINT_MULTI_TRANSLATION:
case CONSTRAINT_MULTI_ROTATION:
if (theEntity->type() != ENTITY_LINE)
return std::shared_ptr<GeomAPI_Lin2d>();
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> anEntity =
- std::dynamic_pointer_cast<PlaneGCSSolver_EntityWrapper>(theEntity);
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> anEntity =
+ std::dynamic_pointer_cast<PlaneGCSSolver_EdgeWrapper>(theEntity);
std::shared_ptr<GCS::Line> aLine = std::dynamic_pointer_cast<GCS::Line>(anEntity->entity());
return std::shared_ptr<GeomAPI_Lin2d>(
new GeomAPI_Lin2d(*(aLine->p1.x), *(aLine->p1.y), *(aLine->p2.x), *(aLine->p2.y)));
ConstraintWrapperPtr createConstraintPointOnEntity(
const SketchSolver_ConstraintType& theType,
std::shared_ptr<PlaneGCSSolver_PointWrapper> thePoint,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity)
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity)
{
GCSConstraintPtr aNewConstr;
ConstraintWrapperPtr createConstraintMiddlePoint(
std::shared_ptr<PlaneGCSSolver_PointWrapper> thePoint,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity)
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity)
{
GCSPointPtr aPoint = thePoint->point();
std::shared_ptr<GCS::Line> aLine = std::dynamic_pointer_cast<GCS::Line>(theEntity->entity());
ConstraintWrapperPtr createConstraintDistancePointLine(
std::shared_ptr<PlaneGCSSolver_ScalarWrapper> theValue,
std::shared_ptr<PlaneGCSSolver_PointWrapper> thePoint,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity)
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity)
{
std::shared_ptr<GCS::Line> aLine = std::dynamic_pointer_cast<GCS::Line>(theEntity->entity());
GCSConstraintPtr aNewConstr(new GCS::ConstraintP2LDistance(
ConstraintWrapperPtr createConstraintRadius(
std::shared_ptr<PlaneGCSSolver_ScalarWrapper> theValue,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity)
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity)
{
std::shared_ptr<GCS::Circle> aCircle =
std::dynamic_pointer_cast<GCS::Circle>(theEntity->entity());
ConstraintWrapperPtr createConstraintAngle(
ConstraintPtr theConstraint,
std::shared_ptr<PlaneGCSSolver_ScalarWrapper> theValue,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity1,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity2)
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity1,
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity2)
{
std::shared_ptr<GCS::Line> aLine1 = std::dynamic_pointer_cast<GCS::Line>(theEntity1->entity());
bool isLine1Rev = theConstraint->boolean(
ConstraintWrapperPtr createConstraintHorizVert(
const SketchSolver_ConstraintType& theType,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity)
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity)
{
std::shared_ptr<GCS::Line> aLine = std::dynamic_pointer_cast<GCS::Line>(theEntity->entity());
GCSConstraintPtr aNewConstr;
}
ConstraintWrapperPtr createConstraintParallel(
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity1,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity2)
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity1,
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity2)
{
std::shared_ptr<GCS::Line> aLine1 = std::dynamic_pointer_cast<GCS::Line>(theEntity1->entity());
std::shared_ptr<GCS::Line> aLine2 = std::dynamic_pointer_cast<GCS::Line>(theEntity2->entity());
}
ConstraintWrapperPtr createConstraintPerpendicular(
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity1,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity2)
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity1,
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity2)
{
std::shared_ptr<GCS::Line> aLine1 = std::dynamic_pointer_cast<GCS::Line>(theEntity1->entity());
std::shared_ptr<GCS::Line> aLine2 = std::dynamic_pointer_cast<GCS::Line>(theEntity2->entity());
ConstraintWrapperPtr createConstraintEqual(
const SketchSolver_ConstraintType& theType,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity1,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity2,
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity1,
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity2,
std::shared_ptr<PlaneGCSSolver_ScalarWrapper> theIntermed)
{
if (theType == CONSTRAINT_EQUAL_LINE_ARC)
ConstraintWrapperPtr createConstraintTangent(
const SketchSolver_ConstraintType& theType,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity1,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theEntity2)
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity1,
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity2)
{
GCSConstraintPtr aNewConstr;
if (theType == CONSTRAINT_TANGENT_CIRCLE_LINE) {
EntityWrapperPtr theArc1, EntityWrapperPtr theArc2)
{
std::shared_ptr<GCS::Circle> aCirc1 = std::dynamic_pointer_cast<GCS::Circle>(
- GCS_ENTITY_WRAPPER(theArc1)->entity());
+ GCS_EDGE_WRAPPER(theArc1)->entity());
std::shared_ptr<GCS::Circle> aCirc2 = std::dynamic_pointer_cast<GCS::Circle>(
- GCS_ENTITY_WRAPPER(theArc2)->entity());
+ GCS_EDGE_WRAPPER(theArc2)->entity());
if (!aCirc1 || !aCirc2)
return false;
// Author: Artem ZHIDKOV
#include <PlaneGCSSolver_UpdateCoincidence.h>
-#include <PlaneGCSSolver_EntityWrapper.h>
+#include <PlaneGCSSolver_EdgeWrapper.h>
#include <PlaneGCSSolver_PointWrapper.h>
#include <SketchSolver_Constraint.h>
if (theEntity->type() == ENTITY_LINE) {
std::shared_ptr<GCS::Line> aLine = std::dynamic_pointer_cast<GCS::Line>(
- std::dynamic_pointer_cast<PlaneGCSSolver_EntityWrapper>(theEntity)->entity());
+ std::dynamic_pointer_cast<PlaneGCSSolver_EdgeWrapper>(theEntity)->entity());
return anIt->isExist(aLine->p1) || anIt->isExist(aLine->p2);
}
return false;
#define PlaneGCSSolver_UpdateCoincidence_H_
#include <PlaneGCSSolver_Update.h>
-#include <SketchSolver_IEntityWrapper.h>
+#include <PlaneGCSSolver_EntityWrapper.h>
#include <GCS.h>
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-#ifndef SKETCHSOLVER_H
-#define SKETCHSOLVER_H
-
-#include <stdlib.h>
-
-/// Tolerance for value of parameters
-const double tolerance = 1.e-10;
-
-#define PI 3.1415926535897932
-
-// Types for data entities enumeration
-typedef int ConstraintID;
-
-// Predefined values for identifiers
-const ConstraintID CID_UNKNOWN = 0;
-const ConstraintID CID_MOVEMENT = -1;
-
-#endif
#ifndef SketchSolver_Constraint_H_
#define SketchSolver_Constraint_H_
-#include "SketchSolver.h"
#include <SketchSolver_Storage.h>
#include <PlaneGCSSolver_Update.h>
#ifndef SketchSolver_ConstraintCoincidence_H_
#define SketchSolver_ConstraintCoincidence_H_
-#include "SketchSolver.h"
#include <SketchSolver_Constraint.h>
/** \class SketchSolver_ConstraintCoincidence
#include <SketchSolver_Error.h>
#include <PlaneGCSSolver_ConstraintWrapper.h>
-#include <PlaneGCSSolver_EntityWrapper.h>
+#include <PlaneGCSSolver_EdgeWrapper.h>
#include <PlaneGCSSolver_PointWrapper.h>
#include <PlaneGCSSolver_UpdateCoincidence.h>
static ConstraintWrapperPtr createPointsOnLine(
std::shared_ptr<PlaneGCSSolver_PointWrapper> thePoint1,
std::shared_ptr<PlaneGCSSolver_PointWrapper> thePoint2,
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> theLine)
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theLine)
{
std::shared_ptr<GCS::Line> aGCSLine = std::dynamic_pointer_cast<GCS::Line>(theLine->entity());
bool aConstraintToApply[4] = {false, false, false, false};
ConstraintWrapperPtr aNewConstraint;
std::shared_ptr<PlaneGCSSolver_PointWrapper> aPoints[2];
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> aLine;
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> aLine;
if (isPointOnOppositeLine[0] || isPointOnOppositeLine[1]) {
// one of points of first line is already on the second line,
aPoints[i] = std::dynamic_pointer_cast<PlaneGCSSolver_PointWrapper>(myPoints[i]);
aConstraintToApply[i] = true;
}
- aLine = std::dynamic_pointer_cast<PlaneGCSSolver_EntityWrapper>(myAttributes.back());
+ aLine = std::dynamic_pointer_cast<PlaneGCSSolver_EdgeWrapper>(myAttributes.back());
} else {
// verify second line and add necessary constraints
for (int i = 0; i < 2; ++i) {
aPoints[i] = std::dynamic_pointer_cast<PlaneGCSSolver_PointWrapper>(myPoints[i + 2]);
aConstraintToApply[i+2] = true;
}
- aLine = std::dynamic_pointer_cast<PlaneGCSSolver_EntityWrapper>(myAttributes.front());
+ aLine = std::dynamic_pointer_cast<PlaneGCSSolver_EdgeWrapper>(myAttributes.front());
}
bool isNew = false;
#ifndef SketchSolver_ConstraintDistance_H_
#define SketchSolver_ConstraintDistance_H_
-#include "SketchSolver.h"
#include <SketchSolver_Constraint.h>
/** \class SketchSolver_ConstraintDistance
#ifndef SketchSolver_ConstraintEqual_H_
#define SketchSolver_ConstraintEqual_H_
-#include "SketchSolver.h"
#include <SketchSolver_Constraint.h>
/** \class SketchSolver_ConstraintEqual
#include <SketchSolver_Error.h>
#include <PlaneGCSSolver_ConstraintWrapper.h>
-#include <PlaneGCSSolver_EntityWrapper.h>
+#include <PlaneGCSSolver_EdgeWrapper.h>
#include <PlaneGCSSolver_PointWrapper.h>
void SketchSolver_ConstraintFixed::fixFeature(EntityWrapperPtr theFeature)
{
- std::shared_ptr<PlaneGCSSolver_EntityWrapper> anEntity =
- std::dynamic_pointer_cast<PlaneGCSSolver_EntityWrapper>(theFeature);
+ std::shared_ptr<PlaneGCSSolver_EdgeWrapper> anEntity =
+ std::dynamic_pointer_cast<PlaneGCSSolver_EdgeWrapper>(theFeature);
GCS::VEC_pD aParameters; // parameters of entity to be fixed
#ifndef SketchSolver_ConstraintFixed_H_
#define SketchSolver_ConstraintFixed_H_
-#include "SketchSolver.h"
#include <SketchSolver_Constraint.h>
/** \class SketchSolver_ConstraintFixed
#ifndef SketchSolver_ConstraintLength_H_
#define SketchSolver_ConstraintLength_H_
-#include "SketchSolver.h"
#include <SketchSolver_Constraint.h>
/** \class SketchSolver_ConstraintLength
#ifndef SketchSolver_ConstraintMirror_H_
#define SketchSolver_ConstraintMirror_H_
-#include "SketchSolver.h"
#include <SketchSolver_Constraint.h>
/** \class SketchSolver_ConstraintMirror
#ifndef SketchSolver_ConstraintMulti_H_
#define SketchSolver_ConstraintMulti_H_
-#include "SketchSolver.h"
#include <SketchSolver_Constraint.h>
#include <vector>
#ifndef SketchSolver_ConstraintMultiRotation_H_
#define SketchSolver_ConstraintMultiRotation_H_
-#include "SketchSolver.h"
#include <SketchSolver_ConstraintMulti.h>
#include "GeomDataAPI_Point2D.h"
#ifndef SketchSolver_ConstraintMultiTranslation_H_
#define SketchSolver_ConstraintMultiTranslation_H_
-#include "SketchSolver.h"
#include <SketchSolver_ConstraintMulti.h>
#include "GeomDataAPI_Point2D.h"
#ifndef SketchSolver_ConstraintTangent_H_
#define SketchSolver_ConstraintTangent_H_
-#include "SketchSolver.h"
#include <SketchSolver_Constraint.h>
/** \class SketchSolver_ConstraintTangent
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: SketchSolver_IConstraintWrapper.h
-// Created: 30 Nov 2015
-// Author: Artem ZHIDKOV
-
-#ifndef SketchSolver_IConstraintWrapper_H_
-#define SketchSolver_IConstraintWrapper_H_
-
-#include <SketchSolver_IEntityWrapper.h>
-
-#include <SketchPlugin_Constraint.h>
-
-#include <list>
-#include <memory>
-
-/// Types of constraints
-enum SketchSolver_ConstraintType {
- CONSTRAINT_UNKNOWN = 0,
- CONSTRAINT_COINCIDENCE, // base coincidence if we don't know exact type yet
- CONSTRAINT_PT_PT_COINCIDENT,
- CONSTRAINT_PT_ON_LINE,
- CONSTRAINT_PT_ON_CIRCLE,
- CONSTRAINT_MIDDLE_POINT,
- CONSTRAINT_DISTANCE, // base distance if we don't know the measured objects yet
- CONSTRAINT_PT_PT_DISTANCE,
- CONSTRAINT_PT_LINE_DISTANCE,
- CONSTRAINT_RADIUS,
- CONSTRAINT_ANGLE,
- CONSTRAINT_FIXED,
- CONSTRAINT_HORIZONTAL,
- CONSTRAINT_VERTICAL,
- CONSTRAINT_PARALLEL,
- CONSTRAINT_PERPENDICULAR,
- CONSTRAINT_SYMMETRIC,
- CONSTRAINT_EQUAL, // base equality if we don't know the measured objects yet
- CONSTRAINT_EQUAL_LINES,
- CONSTRAINT_EQUAL_LINE_ARC,
- CONSTRAINT_EQUAL_RADIUS,
- CONSTRAINT_TANGENT, // base tangency if we don't know the measured objects yet
- CONSTRAINT_TANGENT_CIRCLE_LINE,
- CONSTRAINT_TANGENT_CIRCLE_CIRCLE,
- CONSTRAINT_COLLINEAR,
- CONSTRAINT_MULTI_TRANSLATION,
- CONSTRAINT_MULTI_ROTATION
-};
-
-/**
- * Wrapper providing operations with constraints regardless the solver.
- */
-class SketchSolver_IConstraintWrapper
-{
-public:
- virtual ~SketchSolver_IConstraintWrapper() {}
-
- /// \brief Return ID of current constraint
- const ConstraintID& id() const
- { return myID; }
- /// \brief Change constraint ID
- virtual void setId( const ConstraintID& theID) = 0;
-
- /// \brief Return type of current entity
- virtual SketchSolver_ConstraintType type() const = 0;
-
- /// \brief Assign numeric parameter of constraint
- virtual void setValue(const double& theValue) = 0;
- /// \brief Return numeric parameter of constraint
- virtual double value() const = 0;
-
-protected:
- ConstraintID myID;
-};
-
-typedef std::shared_ptr<SketchSolver_IConstraintWrapper> ConstraintWrapperPtr;
-
-#endif
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: SketchSolver_IEntityWrapper.h
-// Created: 30 Nov 2015
-// Author: Artem ZHIDKOV
-
-#ifndef SketchSolver_IEntityWrapper_H_
-#define SketchSolver_IEntityWrapper_H_
-
-#include <SketchSolver.h>
-
-#include <ModelAPI_Attribute.h>
-#include <ModelAPI_Feature.h>
-
-#include <list>
-#include <memory>
-
-/// Types of entities
-enum SketchSolver_EntityType {
- ENTITY_UNKNOWN = 0,
- ENTITY_SCALAR,
- ENTITY_ANGLE,
- ENTITY_POINT,
- ENTITY_LINE,
- ENTITY_CIRCLE,
- ENTITY_ARC
-};
-
-/**
- * Wrapper providing operations with entities regardless the solver.
- */
-class SketchSolver_IEntityWrapper
-{
-public:
- SketchSolver_IEntityWrapper() : myExternal(false) {}
- virtual ~SketchSolver_IEntityWrapper() {}
-
- /// \brief Return type of current entity
- virtual SketchSolver_EntityType type() const = 0;
-
- /// \brief Change flag indicating the entity cannot be changed in the solver
- void setExternal(bool theExternal) { myExternal = theExternal; }
- /// \brief Return the External flag
- bool isExternal() const { return myExternal; }
-
-private:
- bool myExternal;
-};
-
-typedef std::shared_ptr<SketchSolver_IEntityWrapper> EntityWrapperPtr;
-
-#endif
#ifndef SketchSolver_Manager_H_
#define SketchSolver_Manager_H_
-#include "SketchSolver.h"
#include <SketchSolver_Group.h>
#include <Events_Listener.h>
#ifndef SketchSolver_Storage_H_
#define SketchSolver_Storage_H_
-#include <SketchSolver.h>
-#include <SketchSolver_IConstraintWrapper.h>
-#include <SketchSolver_IEntityWrapper.h>
+#include <PlaneGCSSolver_ConstraintWrapper.h>
+#include <PlaneGCSSolver_EntityWrapper.h>
#include <PlaneGCSSolver_Solver.h>
#include <PlaneGCSSolver_UpdateFeature.h>