setCaption(tr("DLG_TITLE"));
setSizeGripEnabled(TRUE);
myModule = theModule;
+ isApplyed = false;
QVBoxLayout* TopLayout = new QVBoxLayout (this);
TopLayout->setSpacing(6);
return anIsOk;
}
+void VisuGUI_DeformedShapeDlg::updatePrsCopy()
+{
+ SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
+ VisuGUI* aVisuGUI = dynamic_cast <VisuGUI*>(myModule);
+ if ( myPrsCopy->GetNumberOfActors() == 0 ) {
+ PublishInView(aVisuGUI, myPrsCopy, aViewWindow);
+ aViewWindow->onFitAll();
+ int aPos = VISU::GetFreePositionOfDefaultScalarBar(aVisuGUI, aViewWindow);
+ VISU::AddScalarBarPosition(aVisuGUI, aViewWindow, myPrsCopy, aPos);
+ } else {
+ try {
+ myPrsCopy->UpdateActors();
+ } catch (std::runtime_error& exc) {
+ myPrsCopy->RemoveActors();
+
+ INFOS(exc.what());
+ SUIT_MessageBox::warn1
+ (VISU::GetDesktop(myModule), QObject::tr("WRN_VISU"),
+ QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": " + QObject::tr(exc.what()),
+ QObject::tr("BUT_OK"));
+ }
+ aViewWindow->Repaint();
+ }
+}
+
void VisuGUI_DeformedShapeDlg::accept()
{
VisuGUI_ScalarBarBaseDlg::done( isValid() );
void VisuGUI_DeformedShapeDlg::reject()
{
- if ( myPrsCopy->GetNumberOfActors() != 0 )
- VisuGUI_ScalarBarBaseDlg::done( 1 );
+ if (isApplyed) {
+ if ( myPrsCopy->GetNumberOfActors() != 0 )
+ VisuGUI_ScalarBarBaseDlg::done( 1 );
+ else
+ VisuGUI_ScalarBarBaseDlg::reject();
+ }
else
VisuGUI_ScalarBarBaseDlg::reject();
}
{
if ( storeToPrsObject( myPrsCopy ) )
{
- if ( myPrsCopy->GetNumberOfActors() == 0 ) {
- SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
- VisuGUI* aVisuGUI = dynamic_cast <VisuGUI*>(myModule);
- PublishInView(aVisuGUI, myPrsCopy, aViewWindow);
- aViewWindow->onFitAll();
- int aPos = VISU::GetFreePositionOfDefaultScalarBar(aVisuGUI, aViewWindow);
- VISU::AddScalarBarPosition(aVisuGUI, aViewWindow, myPrsCopy, aPos);
- } else {
- try {
- myPrsCopy->UpdateActors();
- } catch (std::runtime_error& exc) {
- myPrsCopy->RemoveActors();
-
- INFOS(exc.what());
- SUIT_MessageBox::warn1
- (VISU::GetDesktop(myModule), QObject::tr("WRN_VISU"),
- QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": " + QObject::tr(exc.what()),
- QObject::tr("BUT_OK"));
- }
- }
+ updatePrsCopy();
+ isApplyed = true;
return true;
}
return false;
VisuGUI_DeformedShapeDlg* aDlg = new VisuGUI_DeformedShapeDlg (theModule);
aDlg->initFromPrsObject(aPrs3d, true);
+ aDlg->UseMagn->setChecked(true);
VisuGUI_DialogRunner r(aDlg);
int dlgResult = r.run( false );
void VisuGUI_DeformedShapeDlg::EditPrs3d(VisuGUI* theModule, VISU::Prs3d_i* thePrs3d, Handle(SALOME_InteractiveObject)& theIO)
{
typedef VISU::DeformedShape_i TPrs3d_i;
-
+
if (TPrs3d_i* aPrs3d = dynamic_cast<TPrs3d_i*>(thePrs3d)) {
VisuGUI_DeformedShapeDlg* aDlg = new VisuGUI_DeformedShapeDlg (theModule);
aDlg->initFromPrsObject(aPrs3d, true);
+ aDlg->updatePrsCopy();
+
+ //Hide thePrs3d from Viewer
+ SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(theModule);
+ if (VISU_Actor* anActor = FindActor(aViewWindow, thePrs3d))
+ if (anActor->GetVisibility())
+ anActor->VisibilityOff();
+
VisuGUI_DialogRunner r(aDlg);
int dlgResult = r.run( false );
-
+
if ( dlgResult != 0 )
aDlg->storeToPrsObject( aPrs3d );
-
+
try {
- aPrs3d->UpdateActors();
+ thePrs3d->UpdateActors();
}
catch (std::runtime_error& exc) {
- aPrs3d->RemoveActors();
+ thePrs3d->RemoveActors();
INFOS(exc.what());
SUIT_MessageBox::warn1
QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": " + QObject::tr(exc.what()),
QObject::tr("BUT_OK"));
}
- delete aDlg;
+
+ if (VISU_Actor* anActor = FindActor(aViewWindow, thePrs3d))
+ if (!anActor->GetVisibility())
+ anActor->VisibilityOn();
+
+ delete aDlg;
}
}