]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
The class for the points coincidence was renamed
authorazv <azv@opencascade.com>
Tue, 13 May 2014 08:42:42 +0000 (12:42 +0400)
committerazv <azv@opencascade.com>
Tue, 13 May 2014 08:42:42 +0000 (12:42 +0400)
src/SketchPlugin/CMakeLists.txt
src/SketchPlugin/SketchPlugin_Constraint.h
src/SketchPlugin/SketchPlugin_ConstraintCoincidence.cpp [new file with mode: 0644]
src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h [new file with mode: 0644]
src/SketchPlugin/SketchPlugin_ConstraintPointsCoincident.cpp [deleted file]
src/SketchPlugin/SketchPlugin_ConstraintPointsCoincident.h [deleted file]
src/SketchSolver/SketchSolver_ConstraintManager.cpp

index 33cce53922f8d32f5c3d446f130c48f5cd3133de..eb5956ec2a58ba921311c12eb593b55d1c8ecd84 100644 (file)
@@ -8,7 +8,7 @@ SET(PROJECT_HEADERS
     SketchPlugin_Line.h
     SketchPlugin_Point.h
     SketchPlugin_Constraint.h
-    SketchPlugin_ConstraintPointsCoincident.h
+    SketchPlugin_ConstraintCoincidence.h
 )
 
 SET(PROJECT_SOURCES
@@ -17,7 +17,7 @@ SET(PROJECT_SOURCES
     SketchPlugin_Sketch.cpp
     SketchPlugin_Line.cpp
     SketchPlugin_Point.cpp
-    SketchPlugin_ConstraintPointsCoincident.cpp
+    SketchPlugin_ConstraintCoincidence.cpp
 )
 
 SET(PROJECT_LIBRARIES
index 8c5e6dadb750844a0afe18f7429bf42fe850ad7b..e69a316cc46a6b0fa4867fe09ccceda9a0553901 100644 (file)
  *    The "entityA" and "entityB" represents any other object (and a point too).
  *    And the "valA" represents a real value.
  *
- *    The attributes below are named corresponding to the SolveSpace, 
- *    some of them may be unused. The list of used attributes is defined 
- *    inside the certain constraint.
+ *    The attributes below are named independent of the SolveSpace.
+ *    Some of them may be unused. 
+ *
+ *    Also the list of possible attributes is provided to simplify assignment.
  */
 /// The value parameter for the constraint
-const std::string CONSTRAINT_ATTR_VALUE("ConstraintValueA");
-/// First point for the constraint
-const std::string CONSTRAINT_ATTR_POINT_A("ConstraintPointA");
-/// Second point for the constraint
-const std::string CONSTRAINT_ATTR_POINT_B("ConstraintPointB");
+const std::string CONSTRAINT_ATTR_VALUE("ConstraintValue");
 /// First entity for the constraint
 const std::string CONSTRAINT_ATTR_ENTITY_A("ConstraintEntityA");
 /// Second entity for the constraint
 const std::string CONSTRAINT_ATTR_ENTITY_B("ConstraintEntityB");
+/// Third entity for the constraint
+const std::string CONSTRAINT_ATTR_ENTITY_C("ConstraintEntityC");
+/// Fourth entity for the constraint
+const std::string CONSTRAINT_ATTR_ENTITY_D("ConstraintEntityD");
+/// List of constraint attributes
+const std::string CONSTRAINT_ATTRIBUTES[4] = 
+                      {CONSTRAINT_ATTR_ENTITY_A, CONSTRAINT_ATTR_ENTITY_B, 
+                       CONSTRAINT_ATTR_ENTITY_C, CONSTRAINT_ATTR_ENTITY_D};
 
 
 /** \class SketchPlugin_Constraint
diff --git a/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.cpp b/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.cpp
new file mode 100644 (file)
index 0000000..6cd5c1b
--- /dev/null
@@ -0,0 +1,30 @@
+// File:    SketchPlugin_ConstraintCoincidence.cpp
+// Created: 08 May 2014
+// Author:  Artem ZHIDKOV
+
+#include "SketchPlugin_ConstraintCoincidence.h"
+
+#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_Data.h>
+#include <SketchPlugin_Point.h>
+
+SketchPlugin_ConstraintCoincidence::SketchPlugin_ConstraintCoincidence()
+{
+}
+
+void SketchPlugin_ConstraintCoincidence::initAttributes()
+{
+  data()->addAttribute(CONSTRAINT_ATTR_ENTITY_A, ModelAPI_AttributeRefAttr::type());
+  data()->addAttribute(CONSTRAINT_ATTR_ENTITY_B, ModelAPI_AttributeRefAttr::type());
+}
+
+void SketchPlugin_ConstraintCoincidence::execute()
+{
+}
+
+const boost::shared_ptr<GeomAPI_Shape>&  SketchPlugin_ConstraintCoincidence::preview()
+{
+  /// \todo Preview for point coincidence
+  return getPreview();
+}
+
diff --git a/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h b/src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h
new file mode 100644 (file)
index 0000000..fe75115
--- /dev/null
@@ -0,0 +1,43 @@
+// File:    SketchPlugin_ConstraintCoincidence.h
+// Created: 08 May 2014
+// Author:  Artem ZHIDKOV
+
+#ifndef SketchPlugin_ConstraintCoincidence_HeaderFile
+#define SketchPlugin_ConstraintCoincidence_HeaderFile
+
+#include "SketchPlugin.h"
+#include "SketchPlugin_Constraint.h"
+#include <list>
+
+
+/** \class SketchPlugin_ConstraintCoincidence
+ *  \ingroup DataModel
+ *  \brief Feature for creation of a new constraint which defines equvalence of two points
+ *
+ *  These constraint has two attributes: CONSTRAINT_ATTR_POINT_A and CONSTRAINT_ATTR_POINT_B
+ */
+class SketchPlugin_ConstraintCoincidence: public SketchPlugin_Constraint
+{
+public:
+  /// \brief Returns the kind of a feature
+  SKETCHPLUGIN_EXPORT virtual const std::string& getKind() 
+  {static std::string MY_KIND = "SketchConstraintCoincidence"; return MY_KIND;}
+
+  /// \brief Returns to which group in the document must be added feature
+  SKETCHPLUGIN_EXPORT virtual const std::string& getGroup() 
+  {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
+
+  /// \brief Creates a new part document if needed
+  SKETCHPLUGIN_EXPORT virtual void execute();
+
+  /// \brief Request for initialization of data model of the feature: adding all attributes
+  SKETCHPLUGIN_EXPORT virtual void initAttributes();
+
+  /// \brief Returns the sketch preview
+  SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr<GeomAPI_Shape>& preview();
+
+  /// \brief Use plugin manager for features creation
+  SketchPlugin_ConstraintCoincidence();
+};
+
+#endif
diff --git a/src/SketchPlugin/SketchPlugin_ConstraintPointsCoincident.cpp b/src/SketchPlugin/SketchPlugin_ConstraintPointsCoincident.cpp
deleted file mode 100644 (file)
index ebbb763..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-// File:    SketchPlugin_ConstraintPointsCoincident.cpp
-// Created: 08 May 2014
-// Author:  Artem ZHIDKOV
-
-#include "SketchPlugin_ConstraintPointsCoincident.h"
-
-#include <ModelAPI_AttributeDouble.h>
-#include <ModelAPI_Data.h>
-#include <SketchPlugin_Point.h>
-
-SketchPlugin_ConstraintPointsCoincident::SketchPlugin_ConstraintPointsCoincident()
-{
-}
-
-void SketchPlugin_ConstraintPointsCoincident::initAttributes()
-{
-  data()->addAttribute(CONSTRAINT_ATTR_POINT_A, ModelAPI_AttributeRefAttr::type());
-  data()->addAttribute(CONSTRAINT_ATTR_POINT_B, ModelAPI_AttributeRefAttr::type());
-}
-
-void SketchPlugin_ConstraintPointsCoincident::execute()
-{
-}
-
-const boost::shared_ptr<GeomAPI_Shape>&  SketchPlugin_ConstraintPointsCoincident::preview()
-{
-  /// \todo Preview for point coincidence
-  return getPreview();
-}
-
diff --git a/src/SketchPlugin/SketchPlugin_ConstraintPointsCoincident.h b/src/SketchPlugin/SketchPlugin_ConstraintPointsCoincident.h
deleted file mode 100644 (file)
index 8130a43..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-// File:    SketchPlugin_ConstraintPointsCoincident.h
-// Created: 08 May 2014
-// Author:  Artem ZHIDKOV
-
-#ifndef SketchPlugin_ConstraintPointsCoincident_HeaderFile
-#define SketchPlugin_ConstraintPointsCoincident_HeaderFile
-
-#include "SketchPlugin.h"
-#include "SketchPlugin_Constraint.h"
-#include <list>
-
-
-/** \class SketchPlugin_ConstraintPointsCoincident
- *  \ingroup DataModel
- *  \brief Feature for creation of a new constraint which defines equvalence of two points
- *
- *  These constraint has two attributes: CONSTRAINT_ATTR_POINT_A and CONSTRAINT_ATTR_POINT_B
- */
-class SketchPlugin_ConstraintPointsCoincident: public SketchPlugin_Constraint
-{
-public:
-  /// \brief Returns the kind of a feature
-  SKETCHPLUGIN_EXPORT virtual const std::string& getKind() 
-  {static std::string MY_KIND = "SketchConstraintPointsCoincident"; return MY_KIND;}
-
-  /// \brief Returns to which group in the document must be added feature
-  SKETCHPLUGIN_EXPORT virtual const std::string& getGroup() 
-  {static std::string MY_GROUP = "Sketch"; return MY_GROUP;}
-
-  /// \brief Creates a new part document if needed
-  SKETCHPLUGIN_EXPORT virtual void execute();
-
-  /// \brief Request for initialization of data model of the feature: adding all attributes
-  SKETCHPLUGIN_EXPORT virtual void initAttributes();
-
-  /// \brief Returns the sketch preview
-  SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr<GeomAPI_Shape>& preview();
-
-  /// \brief Use plugin manager for features creation
-  SketchPlugin_ConstraintPointsCoincident();
-};
-
-#endif
index 6872c82f657c08539f2fd794a6a60c174be02498..7984b031cf8d44cc6c06117439860cf8c72b11ea 100644 (file)
@@ -7,7 +7,7 @@
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_Data.h>
 #include <SketchPlugin_Constraint.h>
-#include <SketchPlugin_ConstraintPointsCoincident.h>
+#include <SketchPlugin_ConstraintCoincidence.h>
 #include <SketchPlugin_Line.h>
 
 
@@ -106,17 +106,18 @@ bool SketchSolver_ConstraintManager::SketchSolver_ConstraintGroup::addConstraint
   if (aDistAttr.get())
     aDistance = aDistAttr->value();
 
+  /// \todo Specify the entities
   Slvs_hEntity aPtA, aPtB, aEntityA, aEntityB; // parameters of the constraint
-  boost::shared_ptr<ModelAPI_Attribute> aEntAttr = theConstraint->data()->attribute(CONSTRAINT_ATTR_POINT_A);
+  boost::shared_ptr<ModelAPI_Attribute> aEntAttr = theConstraint->data()->attribute(CONSTRAINT_ATTR_ENTITY_A);
   aPtA = addEntity(aEntAttr);
   if (aPtA == 0) return false;
-  aEntAttr = theConstraint->data()->attribute(CONSTRAINT_ATTR_POINT_B);
+  aEntAttr = theConstraint->data()->attribute(CONSTRAINT_ATTR_ENTITY_B);
   aPtB = addEntity(aEntAttr);
   if (aPtB == 0) return false;
-  aEntAttr = theConstraint->data()->attribute(CONSTRAINT_ATTR_ENTITY_A);
+  aEntAttr = theConstraint->data()->attribute(CONSTRAINT_ATTR_ENTITY_C);
   aEntityA = addEntity(aEntAttr);
   if (aEntityA == 0) return false;
-  aEntAttr = theConstraint->data()->attribute(CONSTRAINT_ATTR_ENTITY_B);
+  aEntAttr = theConstraint->data()->attribute(CONSTRAINT_ATTR_ENTITY_D);
   aEntityB = addEntity(aEntAttr);
   if (aEntityB == 0) return false;