]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix issues related to selection of sub-shapes in a Part
authorazv <azv@opencascade.com>
Tue, 28 Aug 2018 04:50:35 +0000 (07:50 +0300)
committerazv <azv@opencascade.com>
Thu, 30 Aug 2018 08:39:28 +0000 (11:39 +0300)
src/ModelGeomAlgo/ModelGeomAlgo_Shape.cpp
src/ModelHighAPI/ModelHighAPI_Dumper.cpp

index 5895daf8e2d14a9863ed2c09c8a058c063eaba2a..a1c4af701c295b4a5dcbd546ff70c62d28676ed4 100644 (file)
@@ -153,7 +153,7 @@ namespace ModelGeomAlgo_Shape
                            const GeomAPI_Shape::ShapeType& theShapeType,
                            std::list<SubshapeOfResult>& 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<GeomAPI_PlanarEdges>(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<ResultPtr>& aSubResults = aSub->results();
           for (std::list<ResultPtr>::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;
             }
           }
index 6c8132447472323082217f3e427a091b81518185..b4df71cc764b4abb3940a8e281651242182428a0 100644 (file)
@@ -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<ModelAPI_ResultPart>(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