]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
New constraint "Rigid" was added
authorazv <azv@opencascade.com>
Mon, 13 Oct 2014 06:44:57 +0000 (10:44 +0400)
committerazv <azv@opencascade.com>
Mon, 13 Oct 2014 06:44:57 +0000 (10:44 +0400)
13 files changed:
src/PartSet/PartSet_OperationFeatureCreate.cpp
src/PartSet/PartSet_Tools.cpp
src/SketchPlugin/CMakeLists.txt
src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h
src/SketchPlugin/SketchPlugin_ConstraintDistance.h
src/SketchPlugin/SketchPlugin_ConstraintLength.h
src/SketchPlugin/SketchPlugin_ConstraintParallel.h
src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.h
src/SketchPlugin/SketchPlugin_ConstraintRadius.h
src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp [new file with mode: 0644]
src/SketchPlugin/SketchPlugin_ConstraintRigid.h [new file with mode: 0644]
src/SketchPlugin/SketchPlugin_Plugin.cpp
src/SketchPlugin/plugin-Sketch.xml

index 2be41c48376eb721122e947e789c666bac755d30..8f4a6930a1ef1a20a48c8bb2bf6ba775e1283e17 100644 (file)
@@ -18,6 +18,7 @@
 #include <SketchPlugin_ConstraintParallel.h>
 #include <SketchPlugin_ConstraintPerpendicular.h>
 #include <SketchPlugin_ConstraintCoincidence.h>
+#include <SketchPlugin_ConstraintRigid.h>
 
 #include <GeomAPI_Pnt2d.h>
 
@@ -63,7 +64,8 @@ bool PartSet_OperationFeatureCreate::canProcessKind(const std::string& theId)
       || theId == SketchPlugin_ConstraintRadius::ID()
       || theId == SketchPlugin_ConstraintParallel::ID()
       || theId == SketchPlugin_ConstraintPerpendicular::ID()
-      || theId == SketchPlugin_ConstraintCoincidence::ID();
+      || theId == SketchPlugin_ConstraintCoincidence::ID()
+      || theId == SketchPlugin_ConstraintRigid::ID();
 }
 
 bool PartSet_OperationFeatureCreate::canBeCommitted() const
index a52a43453679dade0c073386a9fe9516cf8948bc..ea47cde213c1babfc395b031cc5628f7c1b7c03b 100644 (file)
@@ -25,6 +25,7 @@
 #include <SketchPlugin_ConstraintDistance.h>
 #include <SketchPlugin_ConstraintLength.h>
 #include <SketchPlugin_ConstraintRadius.h>
+#include <SketchPlugin_ConstraintRigid.h>
 #include <SketchPlugin_Constraint.h>
 
 #include <ModuleBase_ViewerPrs.h>
@@ -341,5 +342,6 @@ bool PartSet_Tools::isConstraintFeature(const std::string& theKind)
 {
   return theKind == SketchPlugin_ConstraintDistance::ID()
       || theKind == SketchPlugin_ConstraintLength::ID()
-      || theKind == SketchPlugin_ConstraintRadius::ID();
+      || theKind == SketchPlugin_ConstraintRadius::ID()
+      || theKind == SketchPlugin_ConstraintRigid::ID();
 }
index d9b7328c2ea0732ddc0ad08055fe11ea30961433..4d4097d12ecef3780d3fab78a8ab6c7b8355c1b6 100644 (file)
@@ -18,6 +18,7 @@ SET(PROJECT_HEADERS
     SketchPlugin_ConstraintParallel.h
     SketchPlugin_ConstraintPerpendicular.h
     SketchPlugin_ConstraintRadius.h
+    SketchPlugin_ConstraintRigid.h
     SketchPlugin_Validators.h
     SketchPlugin_ResultValidators.h 
 )
@@ -37,6 +38,7 @@ SET(PROJECT_SOURCES
     SketchPlugin_ConstraintParallel.cpp
     SketchPlugin_ConstraintPerpendicular.cpp
     SketchPlugin_ConstraintRadius.cpp
+    SketchPlugin_ConstraintRigid.cpp
     SketchPlugin_Validators.cpp
     SketchPlugin_ResultValidators.cpp
 )
index 78c580426a95c0db16fc7b301f30e6b2e86e4859..d14a4b6de371cc9b0c2e8b19926611f04b748828 100644 (file)
@@ -14,7 +14,7 @@
  *  \ingroup DataModel
  *  \brief Feature for creation of a new constraint which defines equivalence of two points
  *
- *  These constraint has two attributes:
+ *  This constraint has two attributes:
  *  SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B()
  */
 class SketchPlugin_ConstraintCoincidence : public SketchPlugin_ConstraintBase
index 69ff19762c8b16f380234c60c0f83f3ccd1fa93d..4f4fedc627765bc8c1c770cf9ba519e72ae6f84f 100644 (file)
@@ -22,7 +22,7 @@ class GeomDataAPI_Point2D;
  *  \brief Feature for creation of a new constraint which defines a distance
  *         between a point and another feature (point, line, plane or face)
  *
- *  These constraint has three attributes:
+ *  This constraint has three attributes:
  *  SketchPlugin_Constraint::VALUE(), SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B()
  */
 class SketchPlugin_ConstraintDistance : public SketchPlugin_ConstraintBase
index 456c0c27c15efc694225e514a52dfbfc79bd3b9c..5f3ae9aae121173e9897dbf8268c5bd2f178c845 100644 (file)
@@ -16,7 +16,7 @@
  *  \ingroup DataModel
  *  \brief Feature for creation of a new constraint which defines a length of a line segment
  *
- *  These constraint has two attributes:
+ *  This constraint has two attributes:
  *  SketchPlugin_Constraint::VALUE() (length) and SketchPlugin_Constraint::ENTITY_A() (segment),
  *  SketchPlugin_Constraint::FLYOUT_VALUE_PNT() (distance of a constraints handle)
  */
index 053fe5f36568d74d52bb78178e255de5b02f1a97..370ff6336997667535bae337433045080bb0af13 100644 (file)
@@ -15,7 +15,7 @@
  *  \ingroup DataModel
  *  \brief Feature for creation of a new constraint parallelism of two lines
  *
- *  These constraint has two attributes:
+ *  This constraint has two attributes:
  *  SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B()
  */
 class SketchPlugin_ConstraintParallel : public SketchPlugin_ConstraintBase
index 9b304c8d4ab813c75ac39122f92eb34e6db51402..7847bf4d64856fa284cab7d2b6faa48194476154 100644 (file)
@@ -15,7 +15,7 @@
  *  \ingroup DataModel
  *  \brief Feature for creation of a new constraint for perpendicularity of two lines
  *
- *  These constraint has two attributes:
+ *  This constraint has two attributes:
  *  SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B()
  */
 class SketchPlugin_ConstraintPerpendicular : public SketchPlugin_ConstraintBase
index eb96ef93d3eb485cb9f890f482e730c2eb9ee7d9..96e295e1b50f0227b3e4764061ff29d8fc441d29 100644 (file)
@@ -16,7 +16,7 @@
  *  \brief Feature for creation of a new constraint which defines 
  *         a radius of a circle or an arc of circle
  *
- *  These constraint has two attributes:
+ *  This constraint has two attributes:
  *  SketchPlugin_Constraint::VALUE() (radius), SketchPlugin_Constraint::ENTITY_A() (a circle)
  */
 class SketchPlugin_ConstraintRadius : public SketchPlugin_ConstraintBase
diff --git a/src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp b/src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp
new file mode 100644 (file)
index 0000000..b1cd170
--- /dev/null
@@ -0,0 +1,18 @@
+// File:    SketchPlugin_ConstraintRigid.cpp
+// Created: 13 Oct 2014
+// Author:  Artem ZHIDKOV
+
+#include "SketchPlugin_ConstraintRigid.h"
+
+SketchPlugin_ConstraintRigid::SketchPlugin_ConstraintRigid()
+{
+}
+
+void SketchPlugin_ConstraintRigid::initAttributes()
+{
+  data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::type());
+}
+
+void SketchPlugin_ConstraintRigid::execute()
+{
+}
diff --git a/src/SketchPlugin/SketchPlugin_ConstraintRigid.h b/src/SketchPlugin/SketchPlugin_ConstraintRigid.h
new file mode 100644 (file)
index 0000000..dd66a6f
--- /dev/null
@@ -0,0 +1,46 @@
+// File:    SketchPlugin_ConstraintRigid.h
+// Created: 13 Oct 2014
+// Author:  Artem ZHIDKOV
+
+#ifndef SketchPlugin_ConstraintRigid_H_
+#define SketchPlugin_ConstraintRigid_H_
+
+#include "SketchPlugin.h"
+#include "SketchPlugin_ConstraintBase.h"
+#include <SketchPlugin_Sketch.h>
+#include <list>
+
+/** \class SketchPlugin_ConstraintRigid
+ *  \ingroup DataModel
+ *  \brief Feature for creation of a new constraint which defines immovable object
+ *
+ *  This constraint has one attribute:
+ *  SketchPlugin_Constraint::ENTITY_A() (any object, i.e. point, line, circle, arc)
+ */
+class SketchPlugin_ConstraintRigid : public SketchPlugin_ConstraintBase
+{
+ public:
+  /// Length constraint kind
+  inline static const std::string& ID()
+  {
+    static const std::string MY_CONSTRAINT_RIGID_ID("SketchConstraintRigid");
+    return MY_CONSTRAINT_RIGID_ID;
+  }
+  /// \brief Returns the kind of a feature
+  SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = SketchPlugin_ConstraintRigid::ID();
+    return MY_KIND;
+  }
+
+  /// \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 Use plugin manager for features creation
+  SketchPlugin_ConstraintRigid();
+};
+
+#endif
index ba178fe6526935a58b93fa4a102ff5afdc7e398e..e3a324300e78211516b20ba246356ec6b1c692f9 100644 (file)
@@ -10,6 +10,7 @@
 #include "SketchPlugin_ConstraintParallel.h"
 #include "SketchPlugin_ConstraintPerpendicular.h"
 #include "SketchPlugin_ConstraintRadius.h"
+#include "SketchPlugin_ConstraintRigid.h"
 #include "SketchPlugin_Validators.h"
 #include "SketchPlugin_ResultValidators.h"
 #include <ModelAPI_Session.h>
@@ -83,6 +84,8 @@ FeaturePtr SketchPlugin_Plugin::createFeature(string theFeatureID)
     return FeaturePtr(new SketchPlugin_ConstraintPerpendicular);
   } else if (theFeatureID == SketchPlugin_ConstraintRadius::ID()) {
     return FeaturePtr(new SketchPlugin_ConstraintRadius);
+  } else if (theFeatureID == SketchPlugin_ConstraintRigid::ID()) {
+    return FeaturePtr(new SketchPlugin_ConstraintRigid);
   }
   // feature of such kind is not found
   return FeaturePtr();
index e002f01088da13a68163c8ba9917de0370453c4f..9bcc261fda21d6bf68b8adb8fc9024938d390f6c 100644 (file)
@@ -1,7 +1,7 @@
 <plugin>
   <workbench id="Sketch">
     <group id="Basic">
-      <feature id="Sketch" nested="SketchPoint SketchLine SketchCircle SketchArc SketchConstraintLength SketchConstraintRadius SketchConstraintDistance SketchConstraintParallel SketchConstraintPerpendicular" title="Sketch" tooltip="Create a new sketch or edit an existing sketch" icon=":icons/sketch.png">
+      <feature id="Sketch" nested="SketchPoint SketchLine SketchCircle SketchArc SketchConstraintLength SketchConstraintRadius SketchConstraintDistance SketchConstraintParallel SketchConstraintPerpendicular SketchConstraintRigid" title="Sketch" tooltip="Create a new sketch or edit an existing sketch" icon=":icons/sketch.png">
         <sketch-start-label title="Select a plane on which to create a sketch" tooltip="Select a plane on which to create a sketch"/> 
       <!--icon=":pictures/x_point.png"-->
       </feature>
         </feature_selector>
         <validator id="PartSet_PerpendicularValidator"/>
       </feature>
+
+      <feature id="SketchConstraintRigid" title="Rigid" tooltip="Create constraint defining fixed object" icon="">
+        <feature_selector id="ConstraintEntityA" label="Object" tooltip="Select any object in the viewer">
+          <validator id="SketchPlugin_ResultPoint"/>
+          <validator id="SketchPlugin_ResultLine"/>
+          <validator id="SketchPlugin_ResultArc"/>
+        </feature_selector>
+      </feature>
     </group>
   </workbench>
 </plugin>