]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Create coincidence constraint command
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 26 Mar 2015 08:42:37 +0000 (11:42 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 26 Mar 2015 08:42:37 +0000 (11:42 +0300)
src/PartSet/PartSet_SketcherMgr.cpp
src/PartSet/PartSet_icons.qrc
src/PartSet/icons/coincedence.png [new file with mode: 0644]
src/SketchPlugin/plugin-Sketch.xml
src/SketcherPrs/SketcherPrs_Tools.cpp

index a6ae7a8a5bcb4f656210a239a4d08275dbb4878f..2747c40040ff28e34ea3fe1b693fc19cef2f02fb 100644 (file)
@@ -52,6 +52,7 @@
 #include <SketchPlugin_ConstraintVertical.h>
 #include <SketchPlugin_ConstraintEqual.h>
 #include <SketchPlugin_ConstraintTangent.h>
+#include <SketchPlugin_ConstraintCoincidence.h>
 
 #include <SelectMgr_IndexedMapOfOwner.hxx>
 #include <StdSelect_BRepOwner.hxx>
@@ -586,6 +587,7 @@ QStringList PartSet_SketcherMgr::sketchOperationIdList()
     aIds << SketchPlugin_ConstraintVertical::ID().c_str();
     aIds << SketchPlugin_ConstraintEqual::ID().c_str();
     aIds << SketchPlugin_ConstraintTangent::ID().c_str();
+    aIds << SketchPlugin_ConstraintCoincidence::ID().c_str();
   }
   return aIds;
 }
index 8c546fdb80073fbc7d9929ca6392fa02240db55d..62cefad4869b312719b4c8aa186014b9af079174 100644 (file)
@@ -35,5 +35,6 @@
      <file>icons/equal.png</file>
      <file>icons/tangent.png</file>
      <file>icons/fillet.png</file>
+     <file>icons/coincedence.png</file>
  </qresource>
  </RCC>
diff --git a/src/PartSet/icons/coincedence.png b/src/PartSet/icons/coincedence.png
new file mode 100644 (file)
index 0000000..9e0670d
Binary files /dev/null and b/src/PartSet/icons/coincedence.png differ
index f1bc36d9b27c41994d0a79f142c99c07659b778b..0f62a2932ddebc219dfe967efb3cdb5f73f08522 100644 (file)
@@ -5,7 +5,7 @@
     <group id="Basic">
       <feature
         id="Sketch"
-        nested="SketchPoint SketchLine SketchCircle SketchArc SketchConstraintLength SketchConstraintRadius SketchConstraintDistance SketchConstraintParallel SketchConstraintPerpendicular SketchConstraintRigid SketchConstraintHorizontal SketchConstraintVertical SketchConstraintEqual SketchConstraintTangent SketchConstraintFillet"
+        nested="SketchPoint SketchLine SketchCircle SketchArc SketchConstraintLength SketchConstraintRadius SketchConstraintDistance SketchConstraintParallel SketchConstraintPerpendicular SketchConstraintRigid SketchConstraintHorizontal SketchConstraintVertical SketchConstraintEqual SketchConstraintTangent SketchConstraintFillet SketchConstraintCoincidence"
         when_nested="accept abort"
         title="Sketch"
         tooltip="Create a new sketch"
     </group>
       
     <group id="Constraints">
-      <feature
-        id="SketchConstraintCoincidence"
-        title="Coincident"
-        tooltip="Create constraint for the coincidence of two points"
-        internal="1" />
     <!--  SketchConstraintDistance  -->
       <feature
         id="SketchConstraintDistance"
@@ -79,6 +74,7 @@
         
         <validator id="PartSet_DistanceValidator"/>
       </feature>
+      
     <!--  SketchConstraintLength  -->      
       <feature id="SketchConstraintLength" title="Length" tooltip="Set fixed length of a line segment" icon=":icons/length.png">
         <label title="Select a line on which to calculate length" tooltip="Select a line on which to calculate length"/>
@@ -92,6 +88,7 @@
         </doublevalue_editor>
         <validator id="PartSet_LengthValidator"/>
       </feature>
+      
     <!--  SketchConstraintRadius  -->
       <feature id="SketchConstraintRadius" title="Radius" tooltip="Set fixed radius of a circle or an arc" icon=":icons/radius_constr.png">
         <label title="Select a circle or an arc on which to calculate radius" tooltip="Select a circle or an arc on which to calculate radius"/>
         <doublevalue_editor label="Value" tooltip="Radius" id="ConstraintValue" default="computed"/>
         <validator id="PartSet_RadiusValidator"/>
       </feature>
+      
     <!--  SketchConstraintParallel  -->
       <feature id="SketchConstraintParallel" title="Parallel" tooltip="Create constraint defining two parallel lines" icon=":icons/parallel.png">
         <sketch_constraint_shape_selector id="ConstraintEntityA" 
         
         <validator id="PartSet_ParallelValidator"/>
       </feature>
+      
     <!--  SketchConstraintPerpendicular  -->
       <feature id="SketchConstraintPerpendicular" title="Perpendicular" tooltip="Create constraint defining two perpendicular lines" icon=":icons/perpendicular.png">
         <sketch_constraint_shape_selector id="ConstraintEntityA" 
         </sketch_constraint_shape_selector>
         <validator id="PartSet_PerpendicularValidator"/>
       </feature>
-    <!--  SketchConstraintRigid  -->
+
+      <!--  SketchConstraintCoincedence  -->
+      <feature id="SketchConstraintCoincidence" title="Coincident" tooltip="Create constraint for the coincidence of two points" icon=":icons/coincedence.png">
+        <sketch_shape_selector id="ConstraintEntityA" label="First point" tooltip="Select a first point" shape_types="vertex"/>
+        <sketch_shape_selector id="ConstraintEntityB" label="Second point" tooltip="Select a second point" shape_types="vertex">
+          <validator id="PartSet_DifferentObjects"/>
+        </sketch_shape_selector>
+      </feature>
+
+      <!--  SketchConstraintRigid  -->
       <feature id="SketchConstraintRigid" title="Fixed" tooltip="Fix an object" icon=":icons/fixed.png">
         <shape_selector id="ConstraintEntityA" label="Object" tooltip="Select an object" 
             shape_types="edge vertex">
         </shape_selector>
         <validator id="PartSet_RigidValidator"/>
       </feature>
+      
     <!--  SketchConstraintHorizontal  -->
       <feature id="SketchConstraintHorizontal" title="Horizontal" tooltip="Create constraint defining horizontal line" icon=":icons/horisontal.png">
         <sketch_constraint_shape_selector id="ConstraintEntityA" 
             <validator id="GeomValidators_Edge" parameters="line"/>
         </sketch_constraint_shape_selector>
       </feature>
+      
     <!--  SketchConstraintVertical  -->
       <feature id="SketchConstraintVertical" title="Vertical" tooltip="Create constraint defining vertical line" icon=":icons/vertical.png">
         <sketch_constraint_shape_selector id="ConstraintEntityA" 
             <validator id="GeomValidators_Edge" parameters="line"/>
         </sketch_constraint_shape_selector>
       </feature>
+      
     <!--  SketchConstraintEqual  -->
       <feature id="SketchConstraintEqual" title="Equal" tooltip="Create constraint defining equality of two objects" icon=":icons/equal.png">
         <sketch_constraint_shape_selector id="ConstraintEntityA" 
             label="Last object" tooltip="Select line, circle or arc" shape_types="edge">
         </sketch_constraint_shape_selector>
       </feature>
+      
     <!--  SketchConstraintTangent  -->
       <feature id="SketchConstraintTangent" title="Tangent" tooltip="Create constraint defining tangency of two objects" icon=":icons/tangent.png">
         <sketch_constraint_shape_selector id="ConstraintEntityA" 
             label="Last object" tooltip="Select line or arc" shape_types="edge">
         </sketch_constraint_shape_selector>
       </feature>
+      
     <!--  SketchConstraintMirror  -->
       <feature
         id="SketchConstraintMirror"
         tooltip="Create constraint mirroring group of objects"
         internal="1" />
     </group>
+    
     <group id="Edit">
       <!--  SketchConstraintFillet  -->
       <feature id="SketchConstraintFillet" title="Fillet" tooltip="Create constraint defining fillet between two objects" icon=":icons/fillet.png">
index 9f845f57fc0d2ff8b160fb1174206ca0bf5662c0..2c575e1a3261fbd5a26c1b8415b896e70ea40731 100644 (file)
@@ -62,7 +62,9 @@ std::shared_ptr<GeomAPI_Pnt2d> getPoint(SketchPlugin_Constraint* theFeature,
   else if (anAttr->attr()) {
     aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAttr->attr());
   }
-  return aPointAttr->pnt();
+  if (aPointAttr.get() != NULL)
+    return aPointAttr->pnt();
+  return std::shared_ptr<GeomAPI_Pnt2d>();
 }