aPlaneInfo.PlaneId = aPlaneId;
aPlaneInfo.ActorList.push_back( aSmeshActor );
aPlaneInfo.ViewManager = vman;
- aPlaneInfoList.push_back( aPlaneInfo );
+
+ // to make the list sorted by plane id
+ anIter = aPlaneInfoList.begin();
+ for( ; anIter != aPlaneInfoList.end(); anIter++ ) {
+ const TPlaneInfo& aPlaneInfoRef = *anIter;
+ if( aPlaneInfoRef.PlaneId > aPlaneId )
+ break;
+ }
+ aPlaneInfoList.insert( anIter, aPlaneInfo );
}
}
}
} // for names/parameters iterator
} // for entries iterator
+ // take into account planes with empty list of actors referred to them
+ QList<SUIT_ViewManager*> aVMList;
+ getApp()->viewManagers(SVTK_Viewer::Type(), aVMList);
+
+ TPlaneDataMap::const_iterator aPlaneDataIter = aPlaneDataMap.begin();
+ for( ; aPlaneDataIter != aPlaneDataMap.end(); aPlaneDataIter++ ) {
+ int aViewId = aPlaneDataIter->first;
+ if( aViewId >= 0 && aViewId < aVMList.count() ) {
+ SUIT_ViewManager* aViewManager = aVMList.at( aViewId );
+
+ const TPlaneDataList& aPlaneDataList = aPlaneDataIter->second;
+
+ TPlaneInfoList& aPlaneInfoList = aPlaneInfoMap[ aViewId ];
+ TPlaneDataList::const_iterator anIter2 = aPlaneDataList.begin();
+ for( ; anIter2 != aPlaneDataList.end(); anIter2++ ) {
+ const TPlaneData& aPlaneData = *anIter2;
+ int aPlaneId = aPlaneData.Id;
+
+ bool anIsFound = false;
+ TPlaneInfoList::const_iterator anIter3 = aPlaneInfoList.begin();
+ for( ; anIter3 != aPlaneInfoList.end(); anIter3++ ) {
+ const TPlaneInfo& aPlaneInfo = *anIter3;
+ if( aPlaneInfo.PlaneId == aPlaneId ) {
+ anIsFound = true;
+ break;
+ }
+ }
+
+ if( !anIsFound ) {
+ TPlaneInfo aPlaneInfo; // ActorList field is empty
+ aPlaneInfo.PlaneId = aPlaneId;
+ aPlaneInfo.ViewManager = aViewManager;
+
+ // to make the list sorted by plane id
+ TPlaneInfoList::iterator anIter4 = aPlaneInfoList.begin();
+ for( ; anIter4 != aPlaneInfoList.end(); anIter4++ ) {
+ const TPlaneInfo& aPlaneInfoRef = *anIter4;
+ if( aPlaneInfoRef.PlaneId > aPlaneId )
+ break;
+ }
+ aPlaneInfoList.insert( anIter4, aPlaneInfo );
+ }
+ }
+ }
+ }
+
// add clipping planes to actors according to the restored parameters
// and update the clipping plane map
TPlaneInfoMap::const_iterator anIter1 = aPlaneInfoMap.begin();
struct TSetVisibility {
TSetVisibility(int theIsVisible): myIsVisible(theIsVisible){}
void operator()(SMESH::TPlaneData& thePlaneData){
- thePlaneData.Plane.GetPointer()->myActor->SetVisibility(myIsVisible);
+ bool anIsEmpty = thePlaneData.ActorList.empty();
+ thePlaneData.Plane.GetPointer()->myActor->SetVisibility(myIsVisible && !anIsEmpty);
}
int myIsVisible;
};
vtkFloatingPointType aBounds[6];
vtkFloatingPointType anOrigin[3];
- bool anIsOk = SMESH::ComputeClippingPlaneParameters( theActorList,
- aNormal,
- theDistance,
- aBounds,
- anOrigin );
+
+ bool anIsOk = false;
+ if( theActorList.empty() ) {
+ // to support planes with empty actor list we should create
+ // a nullified plane that will be initialized later
+ anOrigin[0] = anOrigin[1] = anOrigin[2] = 0;
+ aBounds[0] = aBounds[2] = aBounds[4] = 0;
+ aBounds[1] = aBounds[3] = aBounds[5] = 0;
+ anIsOk = true;
+ }
+ else
+ anIsOk = SMESH::ComputeClippingPlaneParameters( theActorList,
+ aNormal,
+ theDistance,
+ aBounds,
+ anOrigin );
if( !anIsOk )
return NULL;
SMESH::TPlaneData aPlaneData = *anIter2;
SMESH::TPlane aPlane = aPlaneData.Plane;
SMESH::TActorList anActorList = aPlaneData.ActorList;
- if( anActorList.empty() )
- continue;
+
+ // the check is disabled to support planes with empty actor list
+ //if( anActorList.empty() )
+ // continue;
SMESH::OrientedPlane* anOrientedPlane = SMESH::OrientedPlane::New(myViewWindow);
anOrientedPlane->ShallowCopy(aPlane.GetPointer());