]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #532: validator is added to xml; new type "plane" is treated
authorasl <asl@opencascade.com>
Mon, 17 Aug 2015 09:28:15 +0000 (12:28 +0300)
committerasl <asl@opencascade.com>
Mon, 17 Aug 2015 09:28:35 +0000 (12:28 +0300)
src/FeaturesPlugin/partition_widget.xml
src/GeomValidators/GeomValidators_ShapeType.cpp
src/GeomValidators/GeomValidators_ShapeType.h

index 10671d60dbe54b29bcb0c0814bc511d811fe6b1d..e461210483a8a732649681e0e36fcf40f0d701bf 100755 (executable)
@@ -18,5 +18,6 @@
     type_choice="Faces"
     concealment="true" >
     <validator id="PartSet_DifferentObjects"/>
+    <validator id="GeomValidators_ShapeType" parameters="empty,solid,plane"/>
   </multi_selector>
 </source>
index cefd7a592548388b114db60ebe376b574065cf18..97ad580284a106f53a75e7574af2160c560b610f 100644 (file)
@@ -8,6 +8,7 @@
 #include <GeomDataAPI_Point2D.h>
 
 #include <ModelAPI_Result.h>
+#include <ModelAPI_ResultConstruction.h>
 #include <ModelAPI_AttributeRefAttr.h>
 #include <ModelAPI_AttributeSelectionList.h>
 #include <ModelAPI_AttributeReference.h>
@@ -32,6 +33,7 @@ GeomValidators_ShapeType::TypeOfShape GeomValidators_ShapeType::shapeType(const
     MyShapeTypes["circle"] = Circle;
     MyShapeTypes["face"]   = Face;
     MyShapeTypes["solid"]  = Solid;
+    MyShapeTypes["plane"]  = Plane;
   }
   std::string aType = std::string(theType.c_str());
   if (MyShapeTypes.find(aType) != MyShapeTypes.end())
@@ -123,6 +125,13 @@ bool GeomValidators_ShapeType::isValidObject(const ObjectPtr& theObject,
   if (theObject.get() != NULL) {
     FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
     ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+    if( theShapeType==Plane )
+    {
+      ResultConstructionPtr aResultConstruction = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theObject);
+      const std::string& aKind = aFeature->getKind();
+      return aResult.get() != NULL && aKind == "Plane";
+    }
+
     if (aResult.get() != NULL) {
       GeomShapePtr aShape = aResult->shape();
       aValid = isValidShape(aShape, theShapeType);
index daefb1e22b98a4fde54075f1364de9b34c602e8d..5d30779b107c5c88a3906bb53683fcc5e380ee82 100644 (file)
@@ -34,6 +34,7 @@ class GeomValidators_ShapeType : public ModelAPI_AttributeValidator
     Face,
     Solid,
     Compound,
+    Plane,
     AnyShape
   };