From: azv Date: Tue, 28 Aug 2018 04:50:35 +0000 (+0300) Subject: Fix issues related to selection of sub-shapes in a Part X-Git-Tag: V9_2_0a1~81 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a0df9dc60bb2d36a9b422754a24467dc2b078133;p=modules%2Fshaper.git Fix issues related to selection of sub-shapes in a Part --- diff --git a/src/ModelGeomAlgo/ModelGeomAlgo_Shape.cpp b/src/ModelGeomAlgo/ModelGeomAlgo_Shape.cpp index 5895daf8e..a1c4af701 100644 --- a/src/ModelGeomAlgo/ModelGeomAlgo_Shape.cpp +++ b/src/ModelGeomAlgo/ModelGeomAlgo_Shape.cpp @@ -153,7 +153,7 @@ namespace ModelGeomAlgo_Shape const GeomAPI_Shape::ShapeType& theShapeType, std::list& theSelected) { - static const double TOLERANCE = 1.e-7; + static const double TOLERANCE = 1.e-6; theSelected.clear(); @@ -224,7 +224,7 @@ namespace ModelGeomAlgo_Shape // next special case: the full sketch is selected // the selection type is a COMPOUND - if (aSketchEdges && + if (aSketchEdges && theShapeType == GeomAPI_Shape::COMPOUND && aSketchEdges->middlePoint()->distance(thePoint) < TOLERANCE) { // select whole result appendSubshapeOfResult(theSelected, *aResIt, GeomShapePtr()); @@ -253,9 +253,8 @@ namespace ModelGeomAlgo_Shape std::dynamic_pointer_cast(aResults.front()->shape()); if (aSketchEdges && aCF) { - bool isContinue = true; int aNbSubs = aCF->numberOfSubs(); - for (int aSubInd = 0; aSubInd < aNbSubs && isContinue; ++aSubInd) { + for (int aSubInd = 0; aSubInd < aNbSubs; ++aSubInd) { FeaturePtr aSub = aCF->subFeature(aSubInd); const std::list& aSubResults = aSub->results(); for (std::list::const_iterator aSRIt = aSubResults.begin(); @@ -265,7 +264,6 @@ namespace ModelGeomAlgo_Shape findSubShape(aCurShape, theShapeType, thePoint, TOLERANCE); if (!aSubshapes.empty()) { appendSubshapeOfResult(theSelected, aResults.front(), aSubshapes); - isContinue = false; break; } } diff --git a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp index 6c8132447..b4df71cc7 100644 --- a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp @@ -1033,11 +1033,13 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( FeaturePtr aSelectedFeature; if (isDumpByGeom) { ResultPtr aRes = theAttrSelect->context(); - if (aRes) { + if (aRes) aSelectedFeature = ModelAPI_Feature::feature(aRes->data()->owner()); - if (aSelectedFeature) - isDumpByGeom = aSelectedFeature->isInHistory(); - } + else + aSelectedFeature = theAttrSelect->contextFeature(); + + if (aSelectedFeature) + isDumpByGeom = aSelectedFeature->isInHistory(); } myDumpBuffer << "\"" << aShape->shapeTypeStr(); @@ -1047,7 +1049,7 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<( // for correct calculation of the middle point ResultPartPtr aResPart = std::dynamic_pointer_cast(theAttrSelect->context()); - if (aResPart) + if (aResPart && aShape->shapeType() == GeomAPI_Shape::COMPOUND) aShape = aResPart->shape(); GeomPointPtr aMiddlePoint = aShape->middlePoint(); // calculate number of features, which could be selected by the same point