Salome HOME
Fix compilation errors (part 2)
[modules/shaper.git] / src / GeomValidators / GeomValidators_IntersectionSelection.cpp
index ec2a886e0e8b687b69469f670c1e4c664580b55c..7ecbf5f3876d67e136e604caf4076174cedeb992 100644 (file)
@@ -21,7 +21,8 @@ bool GeomValidators_IntersectionSelection::isValid(const AttributePtr& theAttrib
     return false;
   }
   FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
-  AttributeSelectionListPtr anAttrSelectionList = std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
+  AttributeSelectionListPtr anAttrSelectionList =
+    std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
   for(int anIndex = 0; anIndex < anAttrSelectionList->size(); ++anIndex) {
     AttributeSelectionPtr anAttrSelection = anAttrSelectionList->value(anIndex);
     if(!anAttrSelection.get()) {
@@ -47,13 +48,19 @@ bool GeomValidators_IntersectionSelection::isValid(const AttributePtr& theAttrib
       return false;
     }
     std::shared_ptr<GeomAPI_Shape> aShape = anAttrSelection->value();
+    GeomShapePtr aContextShape = aContext->shape();
     if(!aShape.get()) {
-      aShape = aContext->shape();
+      aShape = aContextShape;
     }
     if(!aShape.get()) {
       theError = "Error: empty shape.";
       return false;
     }
+    if(!aShape->isEqual(aContextShape)) {
+      theError = "Error: Local selection not allowed.";
+      return false;
+    }
+
     int aShapeType = aShape->shapeType();
     // Allow to select edges, faces and solids.
     if(aShapeType != GeomAPI_Shape::EDGE &&