createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIconSet(),
tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
this, SLOT(OnShowAnimation()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
+ createAction( VISU_PLOT3D_FROM_CUTPLANE, tr("MEN_PLOT3D_FROM_CUTPLANE"), QIconSet(aPixmap),
+ tr("MEN_PLOT3D_FROM_CUTPLANE"), "", 0, aParent, false,
+ this, SLOT(OnPlot3dFromCutPlane()));
}
void
}
}
}
-
if (nbPrs > 1) {
theMenu->insertSeparator();
action( VISU_MERGE_SCALAR_BARS )->addTo(theMenu);
action( VISU_FREE_SCALAR_BARS )->addTo(theMenu);
}
- theMenu->insertSeparator();
-
- // Check if some (nb > 0) removable objects selected
- if (isOBClient && IsRemovableSelected(this)) {
- action( VISU_DELETE_OBJS )->addTo(theMenu);
- }
-
// Check if some curves selected (for bug PAL10611)
bool isCurves = false;
+ bool isOneCutPlane = false;
SALOME_ListIteratorOfListIO It1 (aListIO);
for (; It1.More() && !isCurves; It1.Next()) {
Handle(SALOME_InteractiveObject)& anIO = It1.Value();
VISU::Storable::StrToMap(strIn, pMap);
bool isExist;
VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt();
- if (isExist && aType == VISU::TCURVE) {
+ if (isExist && aType == VISU::TCURVE) {
isCurves = true;
- }
+ } else {
+ CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry());
+ if (!CORBA::is_nil(anObject)) {
+ VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
+ if (aPrsObject->GetType() == VISU::TCUTPLANES) {
+ VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
+ if (aCutPrs) {
+ isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
+ }
+ }
+ }
+ }
}
}
}
+
+ if (isOneCutPlane)
+ action( VISU_PLOT3D_FROM_CUTPLANE )->addTo(theMenu);
+
+ theMenu->insertSeparator();
+
+ // Check if some (nb > 0) removable objects selected
+ if (isOBClient && IsRemovableSelected(this)) {
+ action( VISU_DELETE_OBJS )->addTo(theMenu);
+ }
if (isCurves) {
action( myDisplay )->removeFrom(theMenu);
action( myErase )->removeFrom(theMenu);
return myDisplayer;
}
+
+
+void VisuGUI::OnPlot3dFromCutPlane()
+{
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy, GetDesktop(this)))
+ return;
+
+ LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+
+ if (aListIO.Extent() < 1) return;
+
+
+ VISU::CutPlanes_i* aCutPrs = 0;
+ Handle(SALOME_InteractiveObject) anIO;
+ _PTR(SObject) aSObject;
+ SALOME_ListIteratorOfListIO It (aListIO);
+ for (; It.More(); It.Next()) {
+ anIO = It.Value();
+
+ if (!anIO.IsNull() && anIO->hasEntry()) {
+ aSObject = aCStudy->FindObjectID(anIO->getEntry());
+ if ( !aSObject )
+ continue;
+ CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry());
+ if (!CORBA::is_nil(anObject)) {
+ VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
+ if (aPrsObject->GetType() == VISU::TCUTPLANES) {
+ aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
+ if (aCutPrs)
+ break;
+ }
+ }
+ }
+ }
+
+ if (aCutPrs) {
+ _PTR(SObject) aTimeStampSObj = aSObject->GetFather();
+ if (SUIT_ViewManager* aViewManager = getApp()->activeViewManager()) {
+ QString aType = aViewManager->getType();
+ bool isVVTK = aType == VVTK_Viewer::Type();
+
+ Storable::TRestoringMap aMap = getMapOfValue(aTimeStampSObj);
+ bool isExist;
+ aType = Storable::FindValue(aMap,"myType",&isExist);
+ if (!isExist || aType.toInt() != TTIMESTAMP )
+ return;
+
+ QString aMeshName = Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
+ QString anEntity = Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
+ QString aFieldName = Storable::FindValue(aMap,"myFieldName",&isExist).latin1();
+ QString aTimeStampId = Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1();
+
+ int aPos;
+ SUIT_ViewWindow* aViewWindow = 0;
+ if (isVVTK) {
+ aViewWindow = GetViewWindow<VVTK_Viewer>(this);
+ aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
+ } else {
+ aViewWindow = GetViewWindow<SVTK_Viewer>(this);
+ aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<SVTK_ViewWindow*>(GetViewWindow<SVTK_Viewer>(this)));
+ }
+ GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
+
+ VISU::Plot3D_i* aPrs3d = CreatePrs3d<VISU::Plot3D_i>(this, aTimeStampSObj, aMeshName.latin1(), (Entity)anEntity.toInt(),
+ aFieldName.latin1(), aTimeStampId.toInt());
+ if (aPrs3d) {
+ SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
+ int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
+ if (!aValue) {
+ VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(this);
+ aDlg->initFromPrsObject(aPrs3d);
+ int aOrient = aCutPrs->GetOrientationType(); // Plot3d has the same orientation type
+ double aRotX = aCutPrs->GetRotateX();
+ double aRotY = aCutPrs->GetRotateY();
+ double aPlanePos = aCutPrs->GetPlanePosition(0);
+ aDlg->setPlane(aOrient, aRotX, aRotY, aPlanePos);
+
+ if (!(runAndWait(aDlg, 0) && (aDlg->storeToPrsObject(aPrs3d)))) {
+ DeletePrs3d(this, aPrs3d, anIO);
+ delete aDlg;
+ return;
+ }
+ delete aDlg;
+ UpdateObjBrowser(this, true, aTimeStampSObj);
+ }
+ SVTK_ViewWindow* aSVtkWindow = dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
+ if ( aSVtkWindow ) {
+ PublishInView(this, aPrs3d, aSVtkWindow, /*highlight = */true);
+ aSVtkWindow->onFitAll();
+
+ AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos);
+ }
+ }
+ }
+ application()->putInfo(QObject::tr("INF_DONE"));
+ }
+}