]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'Dev_1.2.0' of newgeom:newgeom into Dev_1.2.0
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 21 May 2015 14:25:53 +0000 (17:25 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 21 May 2015 14:25:53 +0000 (17:25 +0300)
1  2 
src/Model/Model_Document.cpp

index b1477e5c8f727c8d723ef6319533a0d2e7986a04,2521227190e4dc4115c5660cf479cd50b8b71a2b..82ae16d6520b8e50cb5634d48785e26b7f9f8bc7
@@@ -324,6 -324,7 +324,6 @@@ bool Model_Document::finishOperation(
    aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED));
    aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
    aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
 -  aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_TOHIDE));
    aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED));
    // this must be here just after everything is finished but before real transaction stop
    // to avoid messages about modifications outside of the transaction
@@@ -569,8 -570,10 +569,10 @@@ void Model_Document::removeFeature(Feat
    if (theFeature == currentFeature(false)) {
      int aCurrentIndex = index(theFeature);
      if (aCurrentIndex != -1) {
-       setCurrentFeature(std::dynamic_pointer_cast<ModelAPI_Feature>(
-         object(ModelAPI_Feature::group(), aCurrentIndex - 1)), false);
+       ObjectPtr aPrevObj;
+       if (aCurrentIndex != 0)
+         aPrevObj = object(ModelAPI_Feature::group(), aCurrentIndex - 1);
+       setCurrentFeature(std::dynamic_pointer_cast<ModelAPI_Feature>(aPrevObj), false);
      }
    }
    myObjs->removeFeature(theFeature);
@@@ -654,6 -657,7 +656,7 @@@ void Model_Document::setCurrentFeature(
    const bool theVisible)
  {
    TDF_Label aRefLab = generalLabel().FindChild(TAG_CURRENT_FEATURE);
+   CompositeFeaturePtr aMain; // main feature that may nest the new current
    if (theCurrent.get()) {
      /*
      if (theVisible) { // make features below which are not in history also enabled: sketch subs
        CompositeFeaturePtr aComposite = 
          std::dynamic_pointer_cast<ModelAPI_CompositeFeature>((*aRefToMe)->owner());
        if (aComposite.get() && aComposite->isSub(theCurrent)) {
-         theCurrent = aComposite;
+         aMain = aComposite;
+         break;
        }
      }
  
    static Events_Loop* aLoop = Events_Loop::loop();
    static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
  
-   // if the current feature is composite features, all sub-features also must be enabled
-   CompositeFeaturePtr aCurComp = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(theCurrent);
    bool aPassed = false; // flag that the current object is already passed in cycle
    FeaturePtr anIter = myObjs->lastFeature();
    for(; anIter.get(); anIter = myObjs->nextFeature(anIter, true)) {
      if (anIter == theCurrent) aPassed = true;
  
      bool aDisabledFlag = !aPassed;
-     if (aCurComp.get() && aCurComp->isSub(anIter))
+     if (aMain.get() && aMain->isSub(anIter))
        aDisabledFlag = false;
      if (anIter->setDisabled(aDisabledFlag)) {
        // state of feature is changed => so feature become updated