#include "SalomeApp_Application.h"
#include "SalomeApp_DataModel.h"
#include "SalomeApp_Study.h"
+#include "SalomeApp_CheckFileDlg.h"
#include "LightApp_SelectionMgr.h"
#include "LightApp_Selection.h"
#include "LightApp_Preferences.h"
#include "VisuGUI_PopupTools.h"
#include "VisuGUI_NameDlg.h"
-#include "VisuGUI_FileDlg.h"
#include "VisuGUI_CursorDlg.h"
#include "VisuGUI_Selection.h"
#include "VisuGUI_TimeAnimation.h"
#include "VisuGUI_Timer.h"
+#include "VVTK_ViewModel.h"
+
using namespace VISU;
#ifdef _DEBUG_
if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
return;
+
+ SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
- VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
- aBuildProgressDlg->setGenerator( GetVisuGen(this) );
- aBuildProgressDlg->show();
-}
-
-
-void
-VisuGUI::
-OnExploreMEDFile()
-{
- if(MYDEBUG) MESSAGE("VisuGUI::OnExploreMEDFile()");
- _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
- if ( CheckLock(aStudy,GetDesktop(this)) )
- return;
-
- SALOME_MED::MED_Gen_var aGen = GetMEDEngine();
-
+ // Get file name
QStringList aFilter;
- aFilter.append( tr("FLT_MED_FILES") );
- aFilter.append( tr("FLT_ALL_FILES") );
-
- QFileInfo aFileInfo =
- SUIT_FileDlg::getFileName(GetDesktop(this),
- "",
- aFilter,
- tr("MEN_EXPLORE_MED_FILE"),
- true);
- if(aFileInfo.exists()){
- application()->putInfo( tr("MEN_EXPLORE_MED_FILE") + " " + aFileInfo.filePath() + "..." );
- std::string aStudyName = aStudy->Name();
- try
+ aFilter.append( tr( "FLT_MED_FILES" ) );
+ aFilter.append( tr( "FLT_ALL_FILES" ) );
+
+ bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false);
+
+ SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
+ fd->setCaption( tr( "IMPORT_FROM_FILE" ) );
+ fd->setFilters( aFilter );
+ fd->SetChecked( toUseBuildProgress );
+ fd->exec();
+ QFileInfo aFileInfo( fd->selectedFile() );
+ toUseBuildProgress = fd->IsChecked();
+ delete fd;
+
+ // Check the file name
+ if ( !aFileInfo.exists() )
+ return;
+
+ if ( !toUseBuildProgress )
{
- aGen->readStructFileWithFieldType(aFileInfo.filePath(),aStudyName.c_str());
+ bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
+ bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
+ bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
+ bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
+ bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
+
+ QString anInfo("Importing From File " + aFileInfo.filePath() + "..." );
+ application()->putInfo( anInfo );
+
+ QApplication::setOverrideCursor(Qt::waitCursor);
+ VISU::Result_var aResult = GetVisuGen(this)->CreateResult( aFileInfo.filePath() );
+
+ if (CORBA::is_nil(aResult.in())) {
+ SUIT_MessageBox::warn1(GetDesktop(this),
+ tr("WRN_VISU"),
+ VisuGUI_BuildProgressDlg::tr("ERR_ERROR_IN_THE_FILE"),
+ tr("BUT_OK"));
+ QApplication::restoreOverrideCursor();
+ }else{
+ aResult->SetBuildFields( toBuildFields, toBuildMinMax );
+ aResult->SetBuildGroups( toBuildGroups );
+ aResult->Build( toBuildAll, toBuildAtOnce );
+
+ UpdateObjBrowser(this);
+ application()->putInfo( anInfo + tr("INF_DONE"));
+ QApplication::restoreOverrideCursor();
+ }
}
- catch(...)
+ else
{
- SUIT_MessageBox::warn1(GetDesktop(this),
- tr("WRN_VISU"),
- tr("ERR_ERROR_IN_THE_FILE"),
- tr("BUT_OK"));
+ VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
+ aBuildProgressDlg->setFileName( aFileInfo.filePath() );
+ aBuildProgressDlg->setGenerator( GetVisuGen(this) );
+ aBuildProgressDlg->show();
}
- application()->putInfo(aFileInfo.filePath()+tr("INF_DONE"));
- getApp()->updateObjectBrowser(true); // as need to update MED tree
- getApp()->updateActions();
- }
}
-
void
VisuGUI::
OnImportTableFromFile()
return;
// create a VTK view window if it does not exist
- GetViewWindow( this, /*create=*/true );
+ SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
- CreateMesh(this, anIO);
+ // create mesh presentation and display it in aViewWindow
+ CreateMesh(this, anIO, aViewWindow);
}
void
return;
// create a VTK view window if it does not exist
- GetViewWindow( this, /*create=*/true );
+ SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
// Get selected SObject
LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
if (anIO.IsNull() || !anIO->hasEntry())
return;
- CreateMesh(this, anIO);
+ // create mesh presentation and display it in aViewWindow
+ CreateMesh(this, anIO, aViewWindow);
}
}
{
if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
+ LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
+ if (!mgr) return;
+
QApplication::setOverrideCursor(Qt::waitCursor);
+
+ SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
+
SALOME_ListIO aSel, aList;
- LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
- mgr->selectedObjects( aSel );
+ mgr->selectedObjects(aSel);
+ extractContainers(aSel, aList);
- extractContainers( aSel, aList );
+ for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
+ Handle(SALOME_InteractiveObject) anIO = it.Value();
+ CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry());
- Handle(SALOME_InteractiveObject) anIO;
- for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
- anIO = it.Value();
- CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
- if ( !CORBA::is_nil( anObject ) ) {
+ if (!CORBA::is_nil(anObject)) {
// is it Prs3d object ?
VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
- if(aPrsObject){
+ if (aPrsObject) {
if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Prs3d object");
//UpdateViewer( this, aPrsObject );
- SVTK_ViewWindow* vw = GetViewWindow( this, /*create=*/true );
- if ( vw )
- {
- displayer()->Display( anIO->getEntry() );
+ if (vw) {
+ displayer()->Display(anIO->getEntry());
vw->highlight(anIO, 1);
}
continue;
}
// is it Curve ?
VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
- if(aCurve){
+ if (aCurve) {
if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Curve object");
//PlotCurve( this, aCurve, VISU::eDisplay );
- displayer()->Display( anIO->getEntry() );
+ displayer()->Display(anIO->getEntry());
continue;
}
// is it Container ?
VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
- if(aContainer){
+ if (aContainer) {
if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Container object");
//PlotContainer( this, aContainer, VISU::eDisplay );
- displayer()->Display( anIO->getEntry() );
+ displayer()->Display(anIO->getEntry());
continue;
}
// is it Table ?
VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
- if(aTable){
+ if (aTable) {
if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Table object");
//PlotTable( this, aTable, VISU::eDisplay );
- displayer()->Display( anIO->getEntry() );
+ displayer()->Display(anIO->getEntry());
continue;
}
}
}
- SVTK_ViewWindow* vw = GetViewWindow( this );
- if ( vw ) {
+
+ if (vw) {
vw->getRenderer()->ResetCameraClippingRange();
vw->Repaint();
}
+
QApplication::restoreOverrideCursor();
}
QApplication::setOverrideCursor(Qt::waitCursor);
- SVTK_ViewWindow* vw = GetViewWindow( this );
- if (vw)
- vw->unHighlightAll();
+ //SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
+ //if (vw)
+ // vw->unHighlightAll();
SALOME_ListIO aList, aSel;
LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
- mgr->selectedObjects( aSel );
+ mgr->selectedObjects(aSel);
+ extractContainers(aSel, aList);
- extractContainers( aSel, aList );
-
- Handle(SALOME_InteractiveObject) anIO;
- for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
- anIO = it.Value();
- CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
- if (!CORBA::is_nil(anObject))
- RemoveScalarBarPosition(this,anObject);
- ErasePrs( this, anObject, false );
+ for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
+ Handle(SALOME_InteractiveObject) anIO = it.Value();
+ CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry());
+ //ErasePrs(this, anObject, /*repaint_view_window = */false);
+ ErasePrs(this, anObject, /*repaint_view_window = */true);
}
- if (vw)
- vw->Repaint();
+ //if (vw)
+ // vw->Repaint();
QApplication::restoreOverrideCursor();
}
OnEraseAll()
{
startOperation( myEraseAll );
- if (SVTK_ViewWindow* vw = GetViewWindow(this)) {
+ if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
vw->unHighlightAll();
if (vtkRenderer *aRen = vw->getRenderer()) {
vtkActor *anActor;
for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
if (anActor->GetVisibility() > 0)
if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
- RemoveScalarBarPosition(this,anVISUActor->GetPrs3d());
+ RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d());
anVISUActor->VisibilityOff();
}
}
OnEditScalarMap()
{
Handle(SALOME_InteractiveObject) anIO;
- if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
- EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg,1>(this, aPrs3d);
- if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
- aViewWindow->highlight(anIO, 1);
- }
- }
+ if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+ EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg, 1>(this, anIO, aPrs3d);
}
-
void
VisuGUI::
OnEditDeformedShape()
{
Handle(SALOME_InteractiveObject) anIO;
- if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
- EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg,1>(this, aPrs3d);
- if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
- aViewWindow->highlight(anIO, 1);
- }
- }
+ if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+ EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg, 1>(this, anIO, aPrs3d);
}
void
OnEditScalarMapOnDeformedShape()
{
Handle(SALOME_InteractiveObject) anIO;
- if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
- EditPrs3d<VISU::ScalarMapOnDeformedShape_i, VisuGUI_ScalarMapOnDeformedShapeDlg,1>(this, aPrs3d);
- if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){
- aViewWindow->highlight(anIO, 1);
- }
- }
+ if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+ EditPrs3d<VISU::ScalarMapOnDeformedShape_i, VisuGUI_ScalarMapOnDeformedShapeDlg, 1>(this, anIO, aPrs3d);
}
void
OnEditCutPlanes()
{
Handle(SALOME_InteractiveObject) anIO;
- if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
- EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg,0>(this, aPrs3d);
- if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
- aViewWindow->highlight(anIO, 1);
- }
- }
+ if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+ EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg, 0>(this, anIO, aPrs3d);
}
-
void
VisuGUI::
OnEditCutLines()
{
Handle(SALOME_InteractiveObject) anIO;
- if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
- EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg,0>(this, aPrs3d);
- if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
- aViewWindow->highlight(anIO, 1);
- }
- }
+ if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+ EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg, 0>(this, anIO, aPrs3d);
}
-
void
VisuGUI::
OnEditIsoSurfaces()
{
Handle(SALOME_InteractiveObject) anIO;
- if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
- EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg,1>(this, aPrs3d);
- if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
- aViewWindow->highlight(anIO, 1);
- }
- }
+ if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+ EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg, 1>(this, anIO, aPrs3d);
}
-
void
VisuGUI::
OnEditVectors()
{
Handle(SALOME_InteractiveObject) anIO;
- if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
- EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg,1>(this, aPrs3d);
- if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
- aViewWindow->highlight(anIO, 1);
- }
- }
+ if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+ EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg, 1>(this, anIO, aPrs3d);
}
-
void
VisuGUI::
OnEditStreamLines()
{
Handle(SALOME_InteractiveObject) anIO;
- if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
- EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg,1>(this, aPrs3d);
- if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
- aViewWindow->highlight(anIO, 1);
- }
- }
+ if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+ EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg, 1>(this, anIO, aPrs3d);
}
-
void
VisuGUI::
OnEditPlot3D()
{
Handle(SALOME_InteractiveObject) anIO;
- if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
- EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg,0>(this, aPrs3d);
- if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){
- aViewWindow->highlight(anIO, 1);
- }
- }
+ if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO))
+ EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg, 0>(this, anIO, aPrs3d);
}
VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
if (!aPrs3d) return;
- SVTK_ViewWindow* vw = GetViewWindow(this);
+ SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
if (!vw) return;
VISU_Actor* anActor = GetActor(aPrs3d, vw);
VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
if (!aPrs3d) return;
- SVTK_ViewWindow* vw = GetViewWindow(this);
+ SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
if (!vw) return;
VISU_Actor* anActor = GetActor(aPrs3d, vw);
VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
if (!aPrsObject) return;
- SVTK_ViewWindow* vw = GetViewWindow(this);
+ SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
if (!vw) return;
VISU_Actor* anActor = GetActor(aPrsObject, vw);
VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
if (!aPrsObject) return;
- SVTK_ViewWindow* vw = GetViewWindow(this);
+ SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
if (!vw) return;
VISU_Actor* anActor = GetActor(aPrsObject, vw);
//jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
_PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
_PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
- VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
+ if ( aSObj )
+ VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
}
void
VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aServant.in());
if (!aPrsObject) return;
- SVTK_ViewWindow* vw = GetViewWindow(this);
+ SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
if (!vw) return;
VISU_Actor* aActor = GetActor(aPrsObject, vw);
VisuGUI::
OnTimeAnimation()
{
- if(!VISU::GetViewWindow(this))
+ if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
return;
_PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
VisuGUI::
OnShowAnimation()
{
- if(!VISU::GetViewWindow(this))
+ if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
return;
LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
VISU::Mesh_i* aMeshPrs = dynamic_cast<VISU::Mesh_i*>(aPrsObject);
VISU::Mesh_i* aSameMesh = new VISU::Mesh_i(aMeshPrs->GetResult());
aSameMesh->SameAs(aMeshPrs);
- UpdateViewer(this, aSameMesh);
}
break;
case VISU::TSCALARMAP:
VISU::ScalarMap_i* aScalarPrs = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetResult(),true);
aSameScalar->SameAs(aScalarPrs);
- UpdateViewer(this, aSameScalar);
}
break;
case VISU::TDEFORMEDSHAPE:
VISU::DeformedShape_i* aDefPrs = dynamic_cast<VISU::DeformedShape_i*>(aPrsObject);
VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetResult(),true);
aSameDeformed->SameAs(aDefPrs);
- UpdateViewer(this, aSameDeformed);
}
break;
case VISU::TSCALARMAPONDEFORMEDSHAPE:
{
- VISU::ScalarMapOnDeformedShape_i* aDefPrs = dynamic_cast<VISU::ScalarMapOnDeformedShape_i*>(aPrsObject);
- VISU::ScalarMapOnDeformedShape_i* aSameScalarMapOnDeformed = new VISU::ScalarMapOnDeformedShape_i(aDefPrs->GetResult(),true);
+ VISU::ScalarMapOnDeformedShape_i* aDefPrs =
+ dynamic_cast<VISU::ScalarMapOnDeformedShape_i*>(aPrsObject);
+ VISU::ScalarMapOnDeformedShape_i* aSameScalarMapOnDeformed =
+ new VISU::ScalarMapOnDeformedShape_i(aDefPrs->GetResult(),true);
aSameScalarMapOnDeformed->SameAs(aDefPrs);
- UpdateViewer(this, aSameScalarMapOnDeformed);
}
break;
case VISU::TCUTPLANES:
VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetResult(),true);
aSameCut->SameAs(aCutPrs);
- UpdateViewer(this, aSameCut);
}
break;
case VISU::TCUTLINES:
VISU::CutLines_i* aCutPrs = dynamic_cast<VISU::CutLines_i*>(aPrsObject);
VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetResult(),true);
aSameCut->SameAs(aCutPrs);
- UpdateViewer(this, aSameCut);
}
break;
case VISU::TISOSURFACE:
VISU::IsoSurfaces_i* aIsoPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aPrsObject);
VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetResult(),true);
aSameIso->SameAs(aIsoPrs);
- UpdateViewer(this, aSameIso);
}
break;
case VISU::TSTREAMLINES:
VISU::StreamLines_i* aLinesPrs = dynamic_cast<VISU::StreamLines_i*>(aPrsObject);
VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetResult(),true);
aSameLines->SameAs(aLinesPrs);
- UpdateViewer(this, aSameLines);
}
break;
case VISU::TVECTORS:
VISU::Vectors_i* aVectorsPrs = dynamic_cast<VISU::Vectors_i*>(aPrsObject);
VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetResult(),true);
aSameVectors->SameAs(aVectorsPrs);
- UpdateViewer(this, aSameVectors);
}
break;
case VISU::TPLOT3D:
VISU::Plot3D_i* aPlot3DPrs = dynamic_cast<VISU::Plot3D_i*>(aPrsObject);
VISU::Plot3D_i* aSamePlot3D = new VISU::Plot3D_i(aPlot3DPrs->GetResult());
aSamePlot3D->SameAs(aPlot3DPrs);
- UpdateViewer(this, aSamePlot3D);
}
break;
}
VisuGUI::
OnSelectionInfo()
{
- if (GetViewWindow(this))
+ if (GetActiveViewWindow<SVTK_ViewWindow>(this))
(new VisuGUI_SelectionDlg(this))->show();
else
SUIT_MessageBox::warn1(GetDesktop(this),
}
}
if (update) {
- if (SVTK_ViewWindow* vw = GetViewWindow(this)) {
-//if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
- vw->getRenderer()->ResetCameraClippingRange();
- vw->Repaint();
-//}
+ if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
+ vw->getRenderer()->ResetCameraClippingRange();
+ vw->Repaint();
}
}
}
}
}
if (update) {
- if (SVTK_ViewWindow* vw = GetViewWindow(this)) {
-//if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
- vw->getRenderer()->ResetCameraClippingRange();
- vw->Repaint();
-//}
+ if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
+ vw->getRenderer()->ResetCameraClippingRange();
+ vw->Repaint();
}
}
}
VisuGUI::
OnArrangeActors()
{
- SVTK_ViewWindow* vw = GetViewWindow(this);
+ SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this);
if (vw) {
ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), vw);
aDlg->exec();
tr("MEN_IMPORT_FROM_FILE"), "", (CTRL + Key_I), aParent, false,
this, SLOT(OnImportFromFile()));
- createAction( VISU_EXPLORE_MED, "", QIconSet(),
- tr("MEN_EXPLORE_MED_FILE"), "", (CTRL + Key_M), aParent, false,
- this, SLOT(OnExploreMEDFile()));
-
createAction( VISU_IMPORT_TABLE, "", QIconSet(),
tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
this, SLOT(OnImportTableFromFile()));
aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GLOBAL_SELECTION"));
createAction( VISU_GLOBAL_SELECTION, tr("MEN_GLOBAL_SELECTION"), QIconSet(aPixmap),
tr("MEN_GLOBAL_SELECTION"), "", 0, aParent, false,
- //this, SLOT(OnEraseAll()));
this);
aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PARTIAL_SELECTION"));
createAction( VISU_PARTIAL_SELECTION, tr("MEN_PARTIAL_SELECTION"), QIconSet(aPixmap),
tr("MEN_PARTIAL_SELECTION"), "", 0, aParent, false,
- //this, SLOT(OnEraseAll()));
this);
createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIconSet(),
int aMenuId;
aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
createMenu( separator(), aMenuId, -1, 10 );
- createMenu( VISU_IMPORT_FROM_FILE, aMenuId, 10 ); // import from file
- createMenu( VISU_EXPLORE_MED, aMenuId, 10 ); // explore MED file
- createMenu( VISU_IMPORT_TABLE, aMenuId, 10 ); // import table
+
+ int anImportId = createMenu( tr( "MEN_IMPORT" ), aMenuId, -1, 10 );
+ createMenu( VISU_IMPORT_FROM_FILE, anImportId ); // import from file
+ createMenu( VISU_IMPORT_TABLE, anImportId ); // import table
aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
if (!anIO.IsNull() && anIO->hasEntry()) {
_PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
+ if ( !aSObject )
+ continue;
CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
if (CORBA::is_nil(aCORBAObject)) {
_PTR(GenericAttribute) anAttr;
if (!anIO.IsNull() && anIO->hasEntry()) {
_PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
+ if ( !aSObject )
+ continue;
_PTR(GenericAttribute) anAttr;
if (aSObject->FindAttribute(anAttr, "AttributeComment")) {
_PTR(AttributeComment) aComment (anAttr);
CORBA::Object_var anObject = GetSelectedObj( this, &anIO, &aMap);
_PTR(SObject) SO = aCStudy->FindObjectID(anIO->getEntry());
+ if ( !SO )
+ return;
bool isExist;
VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
viewManagers( QStringList& theList ) const
{
theList.clear();
- theList.append( SVTK_Viewer::Type() );
+ // append SVTK viewer only if there is neither SVTK nor VVTK is open
+ QPtrList<SUIT_ViewManager> lst;
+ getApp()->viewManagers( SVTK_Viewer::Type(), lst );
+ if ( !lst.count() ) {
+ lst.clear();
+ getApp()->viewManagers( VVTK_Viewer::Type(), lst );
+ if ( !lst.count() )
+ theList.append( SVTK_Viewer::Type() );
+ }
}
// group: "MED files import"
int importGr = addPreference( tr( "MED files import" ), srangeTab );
setPreferenceProperty( importGr, "columns", 1 );
+ addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" );
addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
if (b == QString("scalar_bar_orientation")) return;
SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
float sbX1,sbY1,sbW,sbH;
+ float aTol = 1.00000009999999;
std::string aWarning;
if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){
sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", sbX1);
sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", sbW);
- if(sbX1+sbW > 1.0){
+ if(sbX1+sbW > aTol){
aWarning = "Origin and Size Vertical: X+Width > 1\n";
sbX1=0.01;
sbW=0.05;
else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){
sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", sbY1);
sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",sbH);
- if(sbY1+sbH > 1.0){
+ if(sbY1+sbH > aTol){
aWarning = "Origin and Size Vertical: Y+Height > 1\n";
sbY1=0.01;
sbH=0.5;
else if(b == QString("scalar_bar_horizontal_x") || b == QString("scalar_bar_horizontal_width")){
sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", sbX1);
sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", sbW);
- if(sbX1+sbW > 1.0){
+ if(sbX1+sbW > aTol){
aWarning = "Origin and Size Horizontal: X+Width > 1\n";
sbX1=0.2;
sbW=0.6;
else if(b == QString("scalar_bar_horizontal_y") || b == QString("scalar_bar_horizontal_height")){
sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", sbY1);
sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",sbH);
- if(sbY1+sbH > 1.0){
+ if(sbY1+sbH > aTol){
aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
sbY1=0.01;
sbH=0.12;