]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Make construction elements correctly selected: points, axes, planes
authormpv <mikhail.ponikarov@opencascade.com>
Wed, 17 Dec 2014 12:11:36 +0000 (15:11 +0300)
committermpv <mikhail.ponikarov@opencascade.com>
Wed, 17 Dec 2014 12:11:36 +0000 (15:11 +0300)
src/Model/Model_AttributeSelection.cpp

index 79b87dc2d30563f12a644d908491b74431faf4ff..d708eecd4a06eb545e61afdc6e19958aea0b1c1b 100644 (file)
@@ -76,6 +76,12 @@ std::shared_ptr<GeomAPI_Shape> Model_AttributeSelection::value()
       TopoDS_Shape aSelShape = aSelection->Get();
       aResult = std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape);
       aResult->setImpl(new TopoDS_Shape(aSelShape));
+    } else { // for simple construction element: just shape of this construction element
+      ResultConstructionPtr aConstr = 
+        std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(context());
+      if (aConstr) {
+        return aConstr->shape();
+      }
     }
   }
   return aResult;
@@ -115,7 +121,7 @@ bool Model_AttributeSelection::update()
     std::shared_ptr<GeomAPI_PlanarEdges> aWirePtr = 
       std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(
       std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aContext)->shape());
-    if (aWirePtr && aWirePtr->hasPlane()) {
+    if (aWirePtr && aWirePtr->hasPlane()) { // sketch sub-element
       TDF_Label aLab = myRef.myRef->Label();
       // getting a type of selected shape
       Handle(TDataStd_Integer) aTypeAttr;
@@ -266,6 +272,9 @@ bool Model_AttributeSelection::update()
           }
         }
       }
+    } else { // simple construction element: the selected is that needed
+      owner()->data()->sendAttributeUpdated(this);
+      return true;
     }
   }
   return false; // unknown case