Salome HOME
Issue #1343 Fixes
authordbv <dbv@opencascade.com>
Tue, 5 Apr 2016 14:13:40 +0000 (17:13 +0300)
committerdbv <dbv@opencascade.com>
Wed, 6 Apr 2016 10:25:52 +0000 (13:25 +0300)
src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp
src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp
src/GeomValidators/GeomValidators_ShapeType.cpp
src/GeomValidators/GeomValidators_ShapeType.h

index 8c5f797caa9e1e3ab2b2533c965a02acd9bb2bae..17f3158ddc9d88b631d7ebc654b4e016987f45ea 100644 (file)
@@ -171,8 +171,14 @@ void FeaturesPlugin_CompositeSketch::getBaseShapes(ListOfShape& theBaseShapesLis
     }
     GeomShapePtr aBaseShape = aBaseObjectSelection->value();
     if(aBaseShape.get() && !aBaseShape->isNull()) {
-      aBaseShape->shapeType() == GeomAPI_Shape::FACE ? aBaseFacesList.push_back(aBaseShape) :
-                                                       theBaseShapesList.push_back(aBaseShape);
+      GeomAPI_Shape::ShapeType aST = aBaseShape->shapeType();
+      if(aST != GeomAPI_Shape::VERTEX && aST != GeomAPI_Shape::EDGE && aST != GeomAPI_Shape::WIRE &&
+         aST != GeomAPI_Shape::FACE && aST != GeomAPI_Shape::SHELL) {
+        setError("Error: Selected shapes has unsupported type.");
+        return;
+      }
+      aST == GeomAPI_Shape::FACE ? aBaseFacesList.push_back(aBaseShape) :
+                                   theBaseShapesList.push_back(aBaseShape);
     } else {
       // This may be the whole sketch result selected, check and get faces.
       ResultConstructionPtr aConstruction =
@@ -186,8 +192,14 @@ void FeaturesPlugin_CompositeSketch::getBaseShapes(ListOfShape& theBaseShapesLis
         // Probably it can be construction.
         aBaseShape = aConstruction->shape();
         if(aBaseShape.get() && !aBaseShape->isNull()) {
-          aBaseShape->shapeType() == GeomAPI_Shape::FACE ? aBaseFacesList.push_back(aBaseShape) :
-                                                           theBaseShapesList.push_back(aBaseShape);
+          GeomAPI_Shape::ShapeType aST = aBaseShape->shapeType();
+          if(aST != GeomAPI_Shape::VERTEX && aST != GeomAPI_Shape::EDGE && aST != GeomAPI_Shape::WIRE &&
+             aST != GeomAPI_Shape::FACE && aST != GeomAPI_Shape::SHELL) {
+            setError("Error: Selected shapes has unsupported type.");
+            return;
+          }
+          aST == GeomAPI_Shape::FACE ? aBaseFacesList.push_back(aBaseShape) :
+                                       theBaseShapesList.push_back(aBaseShape);
         }
       } else {
         for(int aFaceIndex = 0; aFaceIndex < aFacesNum; aFaceIndex++) {
index 33a77beb33846957f7f6f969cf3cb9aa8cf85895..9796927429fdc006b8c2e0b3ed5e051a3cf60b26 100644 (file)
@@ -100,6 +100,8 @@ void GeomAlgoAPI_Prism::build(const GeomShapePtr&                theBaseShape,
     case TopAbs_SHELL:
       aShapeTypeToExp = TopAbs_FACE;
       break;
+    default:
+      return;
   }
 
   // Getting direction.
index e6a96f355bb490644c195c0154242df37bcd2b9c..141839ed1213ac7bd43e073405fc51bed4466a06 100644 (file)
@@ -32,14 +32,14 @@ GeomValidators_ShapeType::TypeOfShape GeomValidators_ShapeType::shapeType(const
     MyShapeTypes["circle"] = Circle;
     MyShapeTypes["wire"]   = Wire;
     MyShapeTypes["face"]   = Face;
-    MyShapeTypes["solid"]  = Solid;
     MyShapeTypes["plane"]  = Plane;
     MyShapeTypes["shell"]  = Shell;
+    MyShapeTypes["solid"]  = Solid;
   }
   std::string aType = std::string(theType.c_str());
   if (MyShapeTypes.find(aType) != MyShapeTypes.end())
     return MyShapeTypes[aType];
-  
+
   Events_Error::send("Shape type defined in XML is not implemented!");
   return AnyShape;
 }
@@ -217,12 +217,13 @@ bool GeomValidators_ShapeType::isValidShape(const GeomShapePtr theShape,
     case Face:
       aValid = theShape->isFace();
       break;
+    case Shell:
+      aValid = theShape->shapeType() == GeomAPI_Shape::SHELL;
+      break;
     case Solid:
       aValid = theShape->isSolid() || theShape->isCompSolid() ||
                theShape->isCompoundOfSolids();
       break;
-    case Shell:
-      aValid = theShape->shapeType() == GeomAPI_Shape::SHELL;
     case Compound:
       aValid = theShape->isCompound();
       break;
index 93349a5e54881852d48324e63fcd2fcf0b6481dc..297b3fb25400c7fa558a39360b326d65b8e27252 100644 (file)
@@ -34,8 +34,8 @@ class GeomValidators_ShapeType : public ModelAPI_AttributeValidator
     Wire,
     Face,
     Plane,
-    Solid,
     Shell,
+    Solid,
     Compound,
     AnyShape
   };