From: dbv Date: Tue, 5 Apr 2016 14:13:40 +0000 (+0300) Subject: Issue #1343 Fixes X-Git-Tag: V_2.3.0~298 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9769c7fe0f8bfd206645e7a45cf79714924710c0;p=modules%2Fshaper.git Issue #1343 Fixes --- diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp index 8c5f797ca..17f3158dd 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp @@ -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++) { diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp index 33a77beb3..979692742 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp @@ -100,6 +100,8 @@ void GeomAlgoAPI_Prism::build(const GeomShapePtr& theBaseShape, case TopAbs_SHELL: aShapeTypeToExp = TopAbs_FACE; break; + default: + return; } // Getting direction. diff --git a/src/GeomValidators/GeomValidators_ShapeType.cpp b/src/GeomValidators/GeomValidators_ShapeType.cpp index e6a96f355..141839ed1 100644 --- a/src/GeomValidators/GeomValidators_ShapeType.cpp +++ b/src/GeomValidators/GeomValidators_ShapeType.cpp @@ -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; diff --git a/src/GeomValidators/GeomValidators_ShapeType.h b/src/GeomValidators/GeomValidators_ShapeType.h index 93349a5e5..297b3fb25 100644 --- a/src/GeomValidators/GeomValidators_ShapeType.h +++ b/src/GeomValidators/GeomValidators_ShapeType.h @@ -34,8 +34,8 @@ class GeomValidators_ShapeType : public ModelAPI_AttributeValidator Wire, Face, Plane, - Solid, Shell, + Solid, Compound, AnyShape };