From: dbv Date: Fri, 1 Dec 2017 15:06:45 +0000 (+0300) Subject: Issue #2305: 1.1.2.2 To complete the operator FILL X-Git-Tag: V_2.10.0RC~122 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=40b6d5d411955fd6a95132d1e2fec1d7ce408a80;p=modules%2Fshaper.git Issue #2305: 1.1.2.2 To complete the operator FILL Fill now allows to select shapes with any kind of type. --- diff --git a/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp index 08af88445..37cecf7af 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp @@ -118,10 +118,14 @@ void FeaturesPlugin_Boolean::execute() aCompSolidsObjects[aContextShape].push_back(anObject); } } else { - if(anObject->shapeType() == GeomAPI_Shape::EDGE || - anObject->shapeType() == GeomAPI_Shape::FACE) { + if(aType != BOOL_FILL + && (anObject->shapeType() == GeomAPI_Shape::EDGE + || anObject->shapeType() == GeomAPI_Shape::FACE)) + { anEdgesAndFaces.push_back(anObject); - } else { + } + else + { anObjects.push_back(anObject); } } @@ -136,8 +140,11 @@ void FeaturesPlugin_Boolean::execute() // It could be a construction plane. ResultPtr aContext = aToolAttr->context(); aPlanes.push_back(aToolAttr->context()->shape()); - } else if(aTool->shapeType() == GeomAPI_Shape::EDGE || - aTool->shapeType() == GeomAPI_Shape::FACE) { + } + else if(aType != BOOL_FILL + && (aTool->shapeType() == GeomAPI_Shape::EDGE + || aTool->shapeType() == GeomAPI_Shape::FACE)) + { anEdgesAndFaces.push_back(aTool); } else { aTools.push_back(aTool); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp b/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp index 853037100..5ec81daa0 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp @@ -629,33 +629,35 @@ bool FeaturesPlugin_ValidatorBooleanSelection::isValid(const AttributePtr& theAt return false; } - int aShapeType = aShape->shapeType(); + GeomAPI_Shape::ShapeType aShapeType = aShape->shapeType(); + std::set anAllowedTypes; if(anOperationType == FeaturesPlugin_Boolean::BOOL_FUSE) { - // Fuse operation. Allow to select edges, faces and solids. - if(aShapeType != GeomAPI_Shape::EDGE && - aShapeType != GeomAPI_Shape::FACE && - aShapeType != GeomAPI_Shape::SOLID && - aShapeType != GeomAPI_Shape::COMPSOLID && - aShapeType != GeomAPI_Shape::COMPOUND) { - theError = "Error: Selected shape has the wrong type."; - return false; - } + anAllowedTypes.insert(GeomAPI_Shape::EDGE); + anAllowedTypes.insert(GeomAPI_Shape::FACE); + anAllowedTypes.insert(GeomAPI_Shape::SOLID); + anAllowedTypes.insert(GeomAPI_Shape::COMPSOLID); + anAllowedTypes.insert(GeomAPI_Shape::COMPOUND); } else if (anOperationType == FeaturesPlugin_Boolean::BOOL_FILL) { - if(aShapeType != GeomAPI_Shape::FACE && - aShapeType != GeomAPI_Shape::SOLID && - aShapeType != GeomAPI_Shape::COMPSOLID && - aShapeType != GeomAPI_Shape::COMPOUND) { - theError = "Error: Selected shape has the wrong type."; - return false; - } + anAllowedTypes.insert(GeomAPI_Shape::VERTEX); + anAllowedTypes.insert(GeomAPI_Shape::EDGE); + anAllowedTypes.insert(GeomAPI_Shape::WIRE); + anAllowedTypes.insert(GeomAPI_Shape::FACE); + anAllowedTypes.insert(GeomAPI_Shape::SHELL); + anAllowedTypes.insert(GeomAPI_Shape::SOLID); + anAllowedTypes.insert(GeomAPI_Shape::COMPSOLID); + anAllowedTypes.insert(GeomAPI_Shape::COMPOUND); } else { - if(aShapeType != GeomAPI_Shape::SOLID && - aShapeType != GeomAPI_Shape::COMPSOLID && - aShapeType != GeomAPI_Shape::COMPOUND) { - theError = "Error: Selected shape has the wrong type."; - return false; - } + anAllowedTypes.insert(GeomAPI_Shape::SOLID); + anAllowedTypes.insert(GeomAPI_Shape::COMPSOLID); + anAllowedTypes.insert(GeomAPI_Shape::COMPOUND); } + + if(anAllowedTypes.find(aShapeType) == anAllowedTypes.end() + || (aResultConstruction.get() && aShapeType != GeomAPI_Shape::FACE)) { + theError = "Error: Selected shape has the wrong type."; + return false; + } + } return true; diff --git a/src/FeaturesPlugin/boolean_widget.xml b/src/FeaturesPlugin/boolean_widget.xml index a5c4e9195..015c1d0e5 100644 --- a/src/FeaturesPlugin/boolean_widget.xml +++ b/src/FeaturesPlugin/boolean_widget.xml @@ -34,7 +34,7 @@ email : webmaster.salome@opencascade.com @@ -44,7 +44,7 @@ email : webmaster.salome@opencascade.com