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 );
-
- extractContainers( aSel, aList );
+ mgr->selectedObjects(aSel);
+ 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);
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();
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(),
#include "VisuGUI.h"
#include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
#include "VISU_Prs3d_i.hh"
#include "VISU_Result_i.hh"
{
// no need to delete child widgets, Qt does it all for us
std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false));
- VISU::RenderViewWindow(VISU::GetViewWindow(myVisuGUI));
+ VISU::RenderViewWindow(VISU::GetActiveViewWindow<SVTK_ViewWindow>(myVisuGUI));
}
//=================================================================================
if (!myPrs3d)
return;
- if (SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myVisuGUI)) {
+ if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myVisuGUI)) {
SUIT_OverrideCursor wc;
// Save clipping planes, currently applied to the presentation
//=================================================================================
void VisuGUI_ClippingDlg::onSelectionChanged()
{
- if (SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myVisuGUI)) {
+ if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myVisuGUI)) {
Handle(SALOME_InteractiveObject) anIO;
CORBA::Object_var anObject = VISU::GetSelectedObj(myVisuGUI, &anIO);
myIO = anIO;
if (!myPrs3d)
return;
- if (SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myVisuGUI)) {
+ if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myVisuGUI)) {
OrientedPlane* aPlane = OrientedPlane::New(aViewWindow);
VISU::TVTKPlane aTVTKPlane(aPlane);
myPlanes.push_back(aTVTKPlane);
ClickOnApply();
Sinchronize();
- if (SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myVisuGUI))
+ if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myVisuGUI))
VISU::RenderViewWindow(aViewWindow);
}
if (AutoApplyCheckBox->isChecked())
ClickOnApply();
- if (SVTK_ViewWindow* vw = VISU::GetViewWindow(myVisuGUI))
+ if (SVTK_ViewWindow* vw = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myVisuGUI))
VISU::RenderViewWindow(vw);
}
void VisuGUI_ClippingDlg::OnPreviewToggle (bool theIsToggled)
{
std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(theIsToggled));
- if (SVTK_ViewWindow* vw = VISU::GetViewWindow(myVisuGUI))
+ if (SVTK_ViewWindow* vw = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myVisuGUI))
VISU::RenderViewWindow(vw);
}
#include "VisuGUI.h"
#include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
#include "VISU_Gen_i.hh"
#include "VISU_CutLines_i.hh"
QHBox* aPosBox = new QHBox (aPlanePane);
aPosBox->setSpacing(5);
- QLabel* aPosLbl = new QLabel (tr("LBL_POS"), aPosBox);
+ new QLabel (tr("LBL_POS"), aPosBox);
myPosSpn = new QtxDblSpinBox (0, 1, 0.1, aPosBox);
myPosSpn->setValue(0.5);
aPlaneLayout->addWidget(aPosBox);
QHBox* aNbBox = new QHBox(aLinesPane);
aNbBox->setSpacing(5);
- QLabel* aNbLbl = new QLabel( tr( "LBL_NB_PLANS" ), aNbBox );
+ new QLabel( tr( "LBL_NB_PLANS" ), aNbBox );
myNbSpn = new QtxDblSpinBox( 1, 100, 1, aNbBox );
myNbSpn->setValue( 10 );
QHBox* aPosBox2 = new QHBox(aLinesPane);
aPosBox2->setSpacing(5);
- QLabel* aPosLbl2 = new QLabel( tr( "LBL_POS" ), aPosBox2 );
+ new QLabel( tr( "LBL_POS" ), aPosBox2 );
myPosSpn2 = new QtxDblSpinBox( 0, 1, 0.1, aPosBox2 );
myPosSpn2->setValue( 0.5 );
aLinesLayout->addWidget( aPosBox2 );
deletePlanes();
if (myCutLines) //delete myCutLines;
myCutLines->Destroy();
- if (SVTK_ViewWindow* vf = VISU::GetViewWindow())
+ if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>())
vf->Repaint();
}
//------------------------------------------------------------------------------
void VisuGUI_CutLinesDlg::createPlanes()
{
- SVTK_ViewWindow* aView = VISU::GetViewWindow();
+ SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
if (aView == NULL) return;
if (myCutLines == NULL) return;
if (myPreviewActor != 0) return;
void VisuGUI_CutLinesDlg::deletePlanes()
{
if (myPreviewActor == 0) return;
- if (SVTK_ViewWindow* aView = VISU::GetViewWindow()){
+ if (SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>()){
aView->RemoveActor(myPreviewActor);
aView->RemoveActor(myPreviewActorGlyphs);
}
myRotXLbl2->setText( tr("LBL_ROT_Z"));
myRotYLbl2->setText( tr("LBL_ROT_X"));
}
- SVTK_ViewWindow* aView = VISU::GetViewWindow();
+ SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
if (aView) {
if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
/*myCutLines->SetOrientation2(getOrientaion(false),
/* float aPos = myCutLines->GetBasePlanePosition();
myBasePlanePos->setText( QString::number(aPos) );
myBasePlanePos->setEnabled(false);*/
- SVTK_ViewWindow* aView = VISU::GetViewWindow();
+ SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
if (aView) {
if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
//myCutLines->SetBasePlanePosition(aPos);
vh->setLabel( i, str.arg(i+1) );
}
// Update preview
- SVTK_ViewWindow* aView = VISU::GetViewWindow();
+ SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
if (aView) {
if (myPreviewCheck->isChecked()) {
// myCutLines->GetPL()->Update();
source->Delete();
aPlaneMapper->Delete();
- if (SVTK_ViewWindow* vf = VISU::GetViewWindow())
+ if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>())
if (update)
vf->Repaint();
}
QString aTxt = myPosTable->text(theRow, 0);
bool isChanged = !aTxt.isEmpty();
((QCheckTableItem*)myPosTable->item(theRow, 1))->setChecked(!isChanged);
- SVTK_ViewWindow* aView = VISU::GetViewWindow();
+ SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
if (aView) {
if (myPreviewCheck->isChecked()) {
//Update Preview
if (isDefault) {
//myCutLines->SetDefaultPosition(theRow);
// myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow)));
- SVTK_ViewWindow* aView = VISU::GetViewWindow();
+ SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
if (aView) {
if (myPreviewCheck->isChecked()) {
//Update Preview
void VisuGUI_CutLinesDlg::onPreviewCheck (bool thePreview)
{
- if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
+ if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
if (thePreview) {
//storeToPrsObject(myCutLines);
// myCutLines->GetPL()->Update();
void VisuGUI_CutLinesDlg::onRotation (double theValue)
{
if (myCutLines == NULL) return;
- SVTK_ViewWindow* aView = VISU::GetViewWindow();
+ SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
if (aView) {
if (myPreviewCheck->isChecked()) {
void VisuGUI_CutLinesDlg::onPlanePos (const QString& theValue)
{
if (myCutLines == NULL) return;
- SVTK_ViewWindow* aView = VISU::GetViewWindow();
+ SVTK_ViewWindow* aView = VISU::GetActiveViewWindow<SVTK_ViewWindow>();
if (aView) {
if (myPreviewCheck->isChecked()) {
//myCutLines->SetBasePlanePosition(theValue.toDouble());
#include "VisuGUI.h"
#include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
#include "VISU_CutPlanes_i.hh"
#include "VISU_CutPlanesPL.hxx"
VisuGUI_CutPlanesPane::~VisuGUI_CutPlanesPane()
{
- cout<<"### VisuGUI_CutPlanesPane::~VisuGUI_CutPlanesPane"<<endl;
deletePlanes();
if (myCutPlanes)
myCutPlanes->Destroy();
- if (SVTK_ViewWindow* vf = VISU::GetViewWindow())
+ if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>())
vf->Repaint();
}
void VisuGUI_CutPlanesPane::createPlanes()
{
- if (VISU::GetViewWindow() == NULL) return;
+ if (VISU::GetActiveViewWindow<SVTK_ViewWindow>() == NULL) return;
if (myCutPlanes == NULL) return;
if (myPreviewActor != 0) return;
myPreviewActor->PickableOff();
myPreviewActor->SetMapper(aPlaneMapper);
aPlaneMapper->Delete();
- VISU::GetViewWindow()->AddActor(myPreviewActor);
+ VISU::GetActiveViewWindow<SVTK_ViewWindow>()->AddActor(myPreviewActor);
}
int VisuGUI_CutPlanesPane::storeToPrsObject (VISU::CutPlanes_i* thePrs)
// Update preview
if (myPreviewCheck->isChecked()) {
- if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
+ if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
myCutPlanes->GetPL()->Update();
deletePlanes();
createPlanes();
if (myPreviewCheck->isChecked()) {
//Update Preview
- if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
+ if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
myCutPlanes->SetPlanePosition( theRow, aTxt.toDouble());
myCutPlanes->GetPL()->Update();
deletePlanes();
myPosTable->setText(theRow, 0, QString::number(myCutPlanes->GetPlanePosition(theRow)));
if (myPreviewCheck->isChecked()) {
- if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
+ if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
//Update Preview
myCutPlanes->GetPL()->Update();
deletePlanes();
void VisuGUI_CutPlanesPane::deletePlanes()
{
if (myPreviewActor == 0) return;
- if (SVTK_ViewWindow* vf = VISU::GetViewWindow())
+ if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>())
vf->RemoveActor(myPreviewActor);
myPreviewActor->Delete();
myPreviewActor = 0;
{
if (myCutPlanes == NULL) return;
if (myPreviewCheck->isChecked()) {
- if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
+ if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
myCutPlanes->GetPL()->Update();
deletePlanes();
void VisuGUI_CutPlanesPane::onPreviewCheck (bool thePreview)
{
- if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
+ if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
if (thePreview) {
storeToPrsObject(myCutPlanes);
myCutPlanes->GetPL()->Update();
// $Header: /home/server/cvs/VISU/VISU_SRC/src/VISUGUI/VisuGUI_Displayer.cxx
#include "VisuGUI_Displayer.h"
-#include "VVTK_ViewModel.h"
+
#include "VisuGUI_Tools.h"
+#include "VISU_ViewManager_i.hh"
#include "VISU_Actor.h"
+#include "VVTK_ViewModel.h"
+
#include <SVTK_ViewModel.h>
#include <SVTK_ViewWindow.h>
#include <SalomeApp_Application.h>
#include <SalomeApp_Study.h>
-#include "VISU_ViewManager_i.hh"
+#include <SUIT_MessageBox.h>
VisuGUI_Displayer::VisuGUI_Displayer( SalomeApp_Application* app )
: LightApp_Displayer(),
if( CORBA::is_nil( anObj ) )
return 0;
- SVTK_Viewer* vtk_viewer = dynamic_cast<SVTK_Viewer*>( aViewFrame );
+ SVTK_Viewer* vtk_viewer = dynamic_cast<VVTK_Viewer*>( aViewFrame );
+ if (!vtk_viewer)
+ vtk_viewer = dynamic_cast<SVTK_Viewer*>( aViewFrame );
if( vtk_viewer )
{
SVTK_ViewWindow* wnd =
void VisuGUI_Displayer::buildPrs3d( SVTK_ViewWindow* wnd, VISU::Prs3d_i* thePrs ) const
{
- VISU_Actor* newAct = VISU::FindActor( wnd, thePrs );
- if( !newAct )
- {
- newAct = thePrs->CreateActor();
+ VISU_Actor* newAct = VISU::FindActor(wnd, thePrs);
+ if (!newAct) {
+ try {
+ newAct = thePrs->CreateActor();
+ } catch (std::runtime_error& exc) {
+ thePrs->RemoveActors();
+
+ INFOS(exc.what());
+ SUIT_MessageBox::warn1
+ (myApp->desktop(), QObject::tr("WRN_VISU"),
+ QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": " + QObject::tr(exc.what()),
+ QObject::tr("BUT_OK"));
+ }
}
- if( newAct )
- {
- wnd->AddActor( newAct );
+ if (newAct) {
+ wnd->AddActor(newAct);
wnd->Repaint();
}
}
-
+// VISU VISUGUI : GUI of VISU component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
}
//---------------------------------------------------------------
-VisuGUI_Module
-::VisuGUI_Module() :
+VisuGUI_Module::
+VisuGUI_Module() :
VisuGUI()
{
}
//---------------------------------------------------------------
-VisuGUI_Module
-::~VisuGUI_Module()
+VisuGUI_Module::
+~VisuGUI_Module()
{
}
//---------------------------------------------------------------
void
-VisuGUI_Module
-::initialize( CAM_Application* theApp )
+VisuGUI_Module::
+initialize( CAM_Application* theApp )
{
VisuGUI::initialize( theApp );
accel->setActionKey( SVTK::PlusSpeedIncrementEvent, Key_Plus, aViewerType );
accel->setActionKey( SVTK::MinusSpeedIncrementEvent, Key_Minus, aViewerType );
- connect( getApp(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ), this, SLOT( OnViewManagerAdded (SUIT_ViewManager*) ) );
+ connect( getApp(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ),
+ this, SLOT( OnViewManagerAdded (SUIT_ViewManager*) ) );
// Prepare popup menus
QtxPopupMgr* mgr = popupMgr();
this, SLOT(OnErasePrs()));
mgr->insert( action( GAUSS_ERASE_PRS ), -1, -1, -1 ); // erase
mgr->setRule( action( GAUSS_ERASE_PRS ),
- aRule + " and (isVisible=true)", true );
+ aRule + " and ({true} in $canBeDisplayed) and (isVisible=true)", true );
createAction( GAUSS_DISPLAY_PRS, VisuGUI::tr("MEN_DISPLAY"), QIconSet(),
VisuGUI::tr("MEN_DISPLAY"), "", 0, this, false,
this, SLOT(OnDisplayPrs()));
mgr->insert( action( GAUSS_DISPLAY_PRS ), -1, -1, -1 ); // display
mgr->setRule( action( GAUSS_DISPLAY_PRS ),
- aRule + " and (isVisible=false)", true );
+ aRule + " and ({true} in $canBeDisplayed) and (isVisible=false)", true );
createAction( GAUSS_DISPLAY_ONLY_PRS, VisuGUI::tr("MEN_DISPLAY_ONLY"), QIconSet(),
VisuGUI::tr("MEN_DISPLAY_ONLY"), "", 0, this, false,
this, SLOT(OnDisplayOnlyPrs()));
mgr->insert( action( GAUSS_DISPLAY_ONLY_PRS ), -1, -1, -1 ); // display only
mgr->setRule( action( GAUSS_DISPLAY_ONLY_PRS ),
- aRule, true );
+ aRule + " and ({true} in $canBeDisplayed)", true );
createAction( GAUSS_RENAME_CONFIGURATION, VisuGUI::tr("MEN_RENAME"), QIconSet(),
VisuGUI::tr("MEN_RENAME"), "", 0, this, false,
tr("MEN_SAVE_CONFIGURATION"), "", 0, this, false,
this, SLOT(OnSaveConfiguration()));
mgr->insert( action( GAUSS_SAVE_CONFIGURATION ), -1, -1, -1 );
- mgr->setRule( action( GAUSS_SAVE_CONFIGURATION ), "selcount>=0 and client='VVTK' and activeView='VVTK'", true );
+ mgr->setRule( action( GAUSS_SAVE_CONFIGURATION ),
+ "selcount>=0 and client='VVTK' and activeView='VVTK'", true );
createAction( GAUSS_OVERWRITE_CONFIGURATION, tr("MEN_OVERWRITE_CONFIGURATION"), QIconSet(),
tr("MEN_OVERWRITE_CONFIGURATION"), "", 0, this, false,
//---------------------------------------------------------------
bool
-VisuGUI_Module
-::activateModule( SUIT_Study* theStudy )
+VisuGUI_Module::
+activateModule( SUIT_Study* theStudy )
{
VisuGUI::activateModule( theStudy );
//---------------------------------------------------------------
bool
-VisuGUI_Module
-::deactivateModule( SUIT_Study* theStudy )
+VisuGUI_Module::
+deactivateModule( SUIT_Study* theStudy )
{
VisuGUI::deactivateModule( theStudy );
//---------------------------------------------------------------
SUIT_ViewManager*
-VisuGUI_Module
-::onCreateViewManager()
+VisuGUI_Module::
+onCreateViewManager()
{
Viewer* aViewer = new Viewer( this, myViewerMap );
return aViewer->getViewManager();
//---------------------------------------------------------------
void
-VisuGUI_Module
-::onLastViewClosed(SUIT_ViewManager* theViewManager)
+VisuGUI_Module::
+onLastViewClosed(SUIT_ViewManager* theViewManager)
{
myViewerMap.erase(theViewManager);
}
//---------------------------------------------------------------
void
-VisuGUI_Module
-::createPreferences()
+VisuGUI_Module::
+createPreferences()
{
VisuGUI::createPreferences();
//---------------------------------------------------------------
void
-VisuGUI_Module
-::createGaussPointsPreferences()
+VisuGUI_Module::
+createGaussPointsPreferences()
{
int gaussTab = addPreference( tr( "VISU_GAUSS_PREF_TAB_TTL" ) );
int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), gaussTab );
setPreferenceProperty( primitiveGr, "columns", 1 );
int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr,
- LightApp_Preferences::Selector, "VISU", "point_sprite_primitive_type" );
+ LightApp_Preferences::Selector, "VISU",
+ "point_sprite_primitive_type" );
QStringList values;
values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) );
LightApp_Preferences::File, "VISU", "point_sprite_alpha_texture" );
int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
- LightApp_Preferences::DblSpin, "VISU", "point_sprite_alpha_threshold" );
+ LightApp_Preferences::DblSpin, "VISU",
+ "point_sprite_alpha_threshold" );
setPreferenceProperty( alphaThresholdPref, "min", 0.0 );
setPreferenceProperty( alphaThresholdPref, "max", 1.0 );
setPreferenceProperty( alphaThresholdPref, "step", 0.1 );
setPreferenceProperty( maxSizePref, "max", 100 );
int magnificationPref = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION" ), sizeGr,
- LightApp_Preferences::IntSpin, "VISU", "point_sprite_magnification" );
+ LightApp_Preferences::IntSpin, "VISU",
+ "point_sprite_magnification" );
setPreferenceProperty( magnificationPref, "min", 10 );
setPreferenceProperty( magnificationPref, "max", 1000 );
//---------------------------------------------------------------
void
-VisuGUI_Module
-::createInsideCursorPreferences()
+VisuGUI_Module::
+createInsideCursorPreferences()
{
int insideCursorTab = addPreference( tr( "VISU_GAUSS_INSIDE_CURSOR_PREF_TAB_TTL" ) );
setPreferenceProperty( primitiveGr, "columns", 1 );
int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr,
- LightApp_Preferences::Selector, "VISU", "inside_point_sprite_primitive_type" );
+ LightApp_Preferences::Selector, "VISU",
+ "inside_point_sprite_primitive_type" );
QStringList values;
values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) );
LightApp_Preferences::File, "VISU", "inside_point_sprite_alpha_texture" );
int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
- LightApp_Preferences::DblSpin, "VISU", "inside_point_sprite_alpha_threshold" );
+ LightApp_Preferences::DblSpin, "VISU",
+ "inside_point_sprite_alpha_threshold" );
setPreferenceProperty( alphaThresholdPref, "min", 0.0 );
setPreferenceProperty( alphaThresholdPref, "max", 1.0 );
setPreferenceProperty( alphaThresholdPref, "step", 0.1 );
int resolutionPref = addPreference( tr( "VISU_GAUSS_PREF_RESOLUTION" ), primitiveGr,
- LightApp_Preferences::IntSpin, "VISU", "inside_geom_sphere_resolution" );
+ LightApp_Preferences::IntSpin, "VISU",
+ "inside_geom_sphere_resolution" );
setPreferenceProperty( resolutionPref, "min", 3 );
setPreferenceProperty( resolutionPref, "max", 100 );
int faceLimitPref = addPreference( tr( "VISU_GAUSS_PREF_FACE_LIMIT" ), primitiveGr,
- LightApp_Preferences::IntSpin, "VISU", "inside_geom_sphere_face_limit" );
+ LightApp_Preferences::IntSpin, "VISU",
+ "inside_geom_sphere_face_limit" );
setPreferenceProperty( faceLimitPref, "min", 10 );
setPreferenceProperty( faceLimitPref, "max", 1000000 );
setPreferenceProperty( sizeGr, "columns", 2 );
int minSizePref = addPreference( tr( "VISU_GAUSS_PREF_MIN_SIZE" ), sizeGr,
- LightApp_Preferences::IntSpin, "VISU", "inside_point_sprite_min_size" );
+ LightApp_Preferences::IntSpin, "VISU",
+ "inside_point_sprite_min_size" );
setPreferenceProperty( minSizePref, "min", 1 );
setPreferenceProperty( minSizePref, "max", 100 );
int maxSizePref = addPreference( tr( "VISU_GAUSS_PREF_MAX_SIZE" ), sizeGr,
- LightApp_Preferences::IntSpin, "VISU", "inside_point_sprite_max_size" );
+ LightApp_Preferences::IntSpin, "VISU",
+ "inside_point_sprite_max_size" );
setPreferenceProperty( maxSizePref, "min", 1 );
setPreferenceProperty( maxSizePref, "max", 100 );
setPreferenceProperty( magnificationGr, "columns", 2 );
int magnificationPref = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION" ), magnificationGr,
- LightApp_Preferences::IntSpin, "VISU", "inside_point_sprite_magnification" );
+ LightApp_Preferences::IntSpin, "VISU",
+ "inside_point_sprite_magnification" );
setPreferenceProperty( magnificationPref, "min", 10 );
setPreferenceProperty( magnificationPref, "max", 1000 );
int incrementPref = addPreference( tr( "VISU_GAUSS_PREF_INCREMENT" ), magnificationGr,
- LightApp_Preferences::DblSpin, "VISU", "inside_point_sprite_increment" );
+ LightApp_Preferences::DblSpin, "VISU",
+ "inside_point_sprite_increment" );
setPreferenceProperty( incrementPref, "min", 0.01 );
setPreferenceProperty( incrementPref, "max", 10 );
setPreferenceProperty( incrementPref, "step", 0.1 );
-
}
//---------------------------------------------------------------
void
-VisuGUI_Module
-::createOutsideCursorPreferences()
+VisuGUI_Module::
+createOutsideCursorPreferences()
{
int outsideCursorTab = addPreference( tr( "VISU_GAUSS_OUTSIDE_CURSOR_PREF_TAB_TTL" ) );
setPreferenceProperty( primitiveGr, "columns", 1 );
int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr,
- LightApp_Preferences::Selector, "VISU", "outside_point_sprite_primitive_type" );
+ LightApp_Preferences::Selector, "VISU",
+ "outside_point_sprite_primitive_type" );
QStringList values;
values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) );
LightApp_Preferences::File, "VISU", "outside_point_sprite_alpha_texture" );
int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
- LightApp_Preferences::DblSpin, "VISU", "outside_point_sprite_alpha_threshold" );
+ LightApp_Preferences::DblSpin, "VISU",
+ "outside_point_sprite_alpha_threshold" );
setPreferenceProperty( alphaThresholdPref, "min", 0.0 );
setPreferenceProperty( alphaThresholdPref, "max", 1.0 );
setPreferenceProperty( alphaThresholdPref, "step", 0.1 );
int resolutionPref = addPreference( tr( "VISU_GAUSS_PREF_RESOLUTION" ), primitiveGr,
- LightApp_Preferences::IntSpin, "VISU", "outside_geom_sphere_resolution" );
+ LightApp_Preferences::IntSpin, "VISU",
+ "outside_geom_sphere_resolution" );
setPreferenceProperty( resolutionPref, "min", 3 );
setPreferenceProperty( resolutionPref, "max", 100 );
int faceLimitPref = addPreference( tr( "VISU_GAUSS_PREF_FACE_LIMIT" ), primitiveGr,
- LightApp_Preferences::IntSpin, "VISU", "outside_geom_sphere_face_limit" );
+ LightApp_Preferences::IntSpin, "VISU",
+ "outside_geom_sphere_face_limit" );
setPreferenceProperty( faceLimitPref, "min", 10 );
setPreferenceProperty( faceLimitPref, "max", 1000000 );
//---------------------------------------------------------------
void
-VisuGUI_Module
-::createPickingPreferences()
+VisuGUI_Module::
+createPickingPreferences()
{
int pickingTab = addPreference( tr( "VISU_PICKING_PREF_TAB_TTL" ) );
setPreferenceProperty( cursorGr, "columns", 1 );
int cursorSizePref = addPreference( tr( "VISU_PICKING_PREF_CURSOR_SIZE" ), cursorGr,
- LightApp_Preferences::DblSpin, "VISU", "picking_cursor_size" );
+ LightApp_Preferences::DblSpin, "VISU", "picking_cursor_size" );
setPreferenceProperty( cursorSizePref, "min", 0 );
setPreferenceProperty( cursorSizePref, "max", 1.0 );
setPreferenceProperty( cursorSizePref, "step", 0.1 );
setPreferenceProperty( pyramidHeightPref, "min", 1 );
setPreferenceProperty( pyramidHeightPref, "max", 100 );
- int selectionColorPref = addPreference( tr( "VISU_PICKING_PREF_SELECTION_COLOR" ), cursorGr,
- LightApp_Preferences::Color, "VISU", "picking_selection_color" );
+ /*int selectionColorPref = */
+ addPreference( tr( "VISU_PICKING_PREF_SELECTION_COLOR" ), cursorGr,
+ LightApp_Preferences::Color, "VISU", "picking_selection_color" );
// Tolerance
int toleranceGr = addPreference( tr( "VISU_PICKING_PREF_TOLERANCE_GROUP_TTL" ), pickingTab );
int pointTolerancePref = addPreference( tr( "VISU_PICKING_PREF_POINT_SELECTION_TOLERANCE" ), toleranceGr,
- LightApp_Preferences::DblSpin, "VISU", "picking_point_tolerance" );
+ LightApp_Preferences::DblSpin, "VISU", "picking_point_tolerance" );
setPreferenceProperty( pointTolerancePref, "min", 0.001 );
setPreferenceProperty( pointTolerancePref, "max", 10 );
setPreferenceProperty( pointTolerancePref, "step", 0.01 );
//---------------------------------------------------------------
void
-VisuGUI_Module
-::createSpaceMousePreferences()
+VisuGUI_Module::
+createSpaceMousePreferences()
{
int mouseTab = addPreference( tr( "VISU_MOUSE_PREF_TAB_TLT" ) );
int mouseGr = addPreference( tr( "VISU_MOUSE_PREF_GROUP_TLT" ), mouseTab );
- int mousePref = addPreference( tr( "VISU_MOUSE_PREF" ), mouseGr, LightApp_Preferences::Selector, "VISU", "mouse_behaviour" );
+ int mousePref = addPreference( tr( "VISU_MOUSE_PREF" ), mouseGr,
+ LightApp_Preferences::Selector, "VISU", "mouse_behaviour" );
QStringList values;
values.append( tr( "VISU_MOUSE_PREF_STANDARD" ) );
values.append( tr( "VISU_MOUSE_PREF_KEYBOARD_FREE" ) );
setPreferenceProperty( mousePref, "indexes", indices );
int keybrdGr = addPreference( tr( "VISU_KEYBOARD_PREF_GROUP_TTL" ), mouseTab );
- int keybrdPref = addPreference( tr( "VISU_KEYBOARD_PREF" ), keybrdGr, LightApp_Preferences::IntSpin, "VISU", "speed_increment" );
+ int keybrdPref = addPreference( tr( "VISU_KEYBOARD_PREF" ), keybrdGr,
+ LightApp_Preferences::IntSpin, "VISU", "speed_increment" );
setPreferenceProperty( keybrdPref, "max", 1000 );
int spacemouseGr = addPreference( tr( "VISU_SPACEMOUSE_PREF" ), mouseTab );
setPreferenceProperty( spacemouseGr, "columns", 1 );
- int spacemousePref1 = addPreference( tr( "VISU_SPACEMOUSE_PREF_1" ), spacemouseGr, LightApp_Preferences::Selector, "VISU", "spacemouse_func1_btn" ); //decrease_speed_increment
- int spacemousePref2 = addPreference( tr( "VISU_SPACEMOUSE_PREF_2" ), spacemouseGr, LightApp_Preferences::Selector, "VISU", "spacemouse_func2_btn" ); //increase_speed_increment
- int spacemousePref3 = addPreference( tr( "VISU_SPACEMOUSE_PREF_3" ), spacemouseGr, LightApp_Preferences::Selector, "VISU", "spacemouse_func3_btn" ); //decrease_gauss_point_magnification
- int spacemousePref4 = addPreference( tr( "VISU_SPACEMOUSE_PREF_4" ), spacemouseGr, LightApp_Preferences::Selector, "VISU", "spacemouse_func4_btn" ); //increase_gauss_point_magnification
- int spacemousePref5 = addPreference( tr( "VISU_SPACEMOUSE_PREF_5" ), spacemouseGr, LightApp_Preferences::Selector, "VISU", "spacemouse_func5_btn" ); //dominant_combined_switch
+ int spacemousePref1 = addPreference( tr( "VISU_SPACEMOUSE_PREF_1" ), spacemouseGr,
+ LightApp_Preferences::Selector, "VISU",
+ "spacemouse_func1_btn" ); //decrease_speed_increment
+ int spacemousePref2 = addPreference( tr( "VISU_SPACEMOUSE_PREF_2" ), spacemouseGr,
+ LightApp_Preferences::Selector, "VISU",
+ "spacemouse_func2_btn" ); //increase_speed_increment
+ int spacemousePref3 = addPreference( tr( "VISU_SPACEMOUSE_PREF_3" ), spacemouseGr,
+ LightApp_Preferences::Selector, "VISU",
+ "spacemouse_func3_btn" ); //decrease_gauss_point_magnification
+ int spacemousePref4 = addPreference( tr( "VISU_SPACEMOUSE_PREF_4" ), spacemouseGr,
+ LightApp_Preferences::Selector, "VISU",
+ "spacemouse_func4_btn" ); //increase_gauss_point_magnification
+ int spacemousePref5 = addPreference( tr( "VISU_SPACEMOUSE_PREF_5" ), spacemouseGr,
+ LightApp_Preferences::Selector, "VISU",
+ "spacemouse_func5_btn" ); //dominant_combined_switch
values.clear();
values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_1" ) );
values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_2" ) );
//---------------------------------------------------------------
void
-VisuGUI_Module
-::createRecorderPreferences()
+VisuGUI_Module::
+createRecorderPreferences()
{
int recorderTab = addPreference( tr( "VISU_RECORDER_PREF_TAB_TTL" ) );
//---------------------------------------------------------------
void
-VisuGUI_Module
-::OnCreateGaussPoints()
+VisuGUI_Module::
+OnCreateGaussPoints()
{
double initialTime = vtkTimerLog::GetCPUTime();
- CreatePrs3d<VISU::GaussPoints_i,VVTK_Viewer,VisuGUI_GaussPointsDlg,1>(this,true);
+ CreatePrs3d<VISU::GaussPoints_i, VVTK_Viewer, VisuGUI_GaussPointsDlg, 1>(this);
INFOS( "VisuGUI_Module::OnCreateGaussPoints() : Gauss Points created in " <<
vtkTimerLog::GetCPUTime() - initialTime << " seconds" );
}
void
-VisuGUI_Module
-::OnViewManagerAdded(SUIT_ViewManager* viewMgr)
+VisuGUI_Module::
+OnViewManagerAdded(SUIT_ViewManager* viewMgr)
{
QString type = viewMgr->getViewModel()->getType();
if ( type == VVTK_Viewer::Type() )
- connect( viewMgr, SIGNAL( viewCreated( SUIT_ViewWindow* ) ), this, SLOT( OnViewCreated( SUIT_ViewWindow* ) ) );
+ connect( viewMgr, SIGNAL( viewCreated( SUIT_ViewWindow* ) ),
+ this, SLOT( OnViewCreated( SUIT_ViewWindow* ) ) );
}
void
-VisuGUI_Module
-::OnViewCreated(SUIT_ViewWindow* view)
+VisuGUI_Module::
+OnViewCreated(SUIT_ViewWindow* view)
{
SVTK_ViewWindow* viewWindow = dynamic_cast<SVTK_ViewWindow*>( view );
if ( viewWindow ) {
}
void
-VisuGUI_Module
-::setProperty( SVTK_ViewWindow* viewWindow, const QString& pref )
+VisuGUI_Module::
+setProperty( SVTK_ViewWindow* viewWindow, const QString& pref )
{
if ( !viewWindow )
return;
}
void
-VisuGUI_Module
-::setProperty( SVTK_ViewManager* vm, const QString& prop )
+VisuGUI_Module::
+setProperty( SVTK_ViewManager* vm, const QString& prop )
{
if ( !vm )
return;
}
void
-VisuGUI_Module
-::preferencesChanged( const QString& group, const QString& pref )
+VisuGUI_Module::
+preferencesChanged( const QString& group, const QString& pref )
{
VisuGUI::preferencesChanged(group,pref);
//---------------------------------------------------------------
SUIT_ViewManager*
-VisuGUI_Module
-::getViewManager(const QString& theType,
- const bool theIsCreate)
+VisuGUI_Module::
+getViewManager(const QString& theType,
+ const bool theIsCreate)
{
- if(SUIT_ViewManager* aViewManager = VisuGUI::getViewManager(theType,theIsCreate))
+ if (SUIT_ViewManager* aViewManager = VisuGUI::getViewManager(theType,theIsCreate))
return aViewManager;
- if(theIsCreate && VVTK_Viewer::Type() == theType)
+ if (theIsCreate && theType == VVTK_Viewer::Type())
return onCreateViewManager();
return NULL;
//---------------------------------------------------------------
void
-VisuGUI_Module
-::OnEditGaussPoints()
+VisuGUI_Module::
+OnEditGaussPoints()
{
Handle(SALOME_InteractiveObject) anIO;
- if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
- EditPrs3d<VISU::GaussPoints_i,VisuGUI_GaussPointsDlg,1>(this, aPrs3d);
- if(SVTK_ViewWindow* aViewWindow = GetViewWindow<VVTK_Viewer>(this,true)){
- aViewWindow->highlight(anIO,1);
- }
- }
-}
-
-
-//---------------------------------------------------------------
-void
-VisuGUI_Module
-::OnDisplayPrs()
-{
- if(MYDEBUG) MESSAGE("VisuGUI_Module::OnDisplayPrs");
-
- QApplication::setOverrideCursor(Qt::waitCursor);
-
- if(LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this)){
- SALOME_ListIO aSel, aList;
- aSelectionMgr->selectedObjects(aSel);
- 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() );
-
- // is it a Prs3d object ?
- if(!CORBA::is_nil(anObject)){
- if(VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in())){
- if(MYDEBUG) MESSAGE("VisuGUI_Module::OnDisplayPrs : Prs3d object");
- if(aPrs3d->GetType() == VISU::TGAUSSPOINTS)
- VISU::UpdateViewer<VVTK_Viewer>(this,aPrs3d,false,true,true);
- else if(SUIT_ViewManager* aViewManager = getApp()->activeViewManager()){
- QString aType = aViewManager->getType();
- if(aType == SVTK_Viewer::Type())
- VISU::UpdateViewer<SVTK_Viewer>(this,aPrs3d,false,true,true);
- else if(aType == VVTK_Viewer::Type())
- VISU::UpdateViewer<VVTK_Viewer>(this,aPrs3d,false,true,true);
- }
- continue;
- }
- }
-
- // is it Curve ?
- if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in())){
- if(MYDEBUG) MESSAGE("VisuGUI_Module::OnDisplayPrs : Curve object");
- PlotCurve( this, aCurve, VISU::eDisplay );
- continue;
- }
-
- // is it Container ?
- if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in())){
- if(MYDEBUG) MESSAGE("VisuGUI_Module::DisplayPrs : Container object");
- PlotContainer( this, aContainer, VISU::eDisplay );
- continue;
- }
-
- // is it Table ?
- if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in())){
- if(MYDEBUG) MESSAGE("VisuGUI_Module::DisplayPrs : Table object");
- PlotTable( this, aTable, VISU::eDisplay );
- continue;
- }
+ if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO)) {
+ // Create VVTK_ViewWindow, if it does not exist
+ if (VVTK_ViewWindow* aViewWindow = GetViewWindow<VVTK_Viewer>(this)) {
+ EditPrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, anIO, aPrs3d, aViewWindow);
}
}
-
- QApplication::restoreOverrideCursor();
-}
-
-
-//---------------------------------------------------------------
-void
-VisuGUI_Module
-::OnEraseAll()
-{
- if(SUIT_ViewManager* aViewManager = getApp()->activeViewManager()){
- QString aType = aViewManager->getType();
- if(aType == SVTK_Viewer::Type())
- VISU::OnEraseAll<SVTK_Viewer>(this);
- else if(aType == VVTK_Viewer::Type())
- VISU::OnEraseAll<VVTK_Viewer>(this);
- else if(aType == SPlot2d_Viewer::Type())
- VISU::OnEraseAll<SPlot2d_Viewer>(this);
- }
-}
-
-
-//---------------------------------------------------------------
-void
-VisuGUI_Module
-::OnDisplayOnlyPrs()
-{
- OnEraseAll();
- OnDisplayPrs();
-}
-
-
-//---------------------------------------------------------------
-void
-VisuGUI_Module
-::OnErasePrs()
-{
- QApplication::setOverrideCursor(Qt::waitCursor);
-
- LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
- SALOME_ListIO aSel, aList;
- aSelectionMgr->selectedObjects(aSel);
- 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());
- if(!CORBA::is_nil(anObject)){
- VISU::Base_var aBase = VISU::Base::_narrow(anObject);
- if(!CORBA::is_nil(aBase))
- VISU::ErasePrs(this,aBase,true);
- }
- }
-
- QApplication::restoreOverrideCursor();
}
PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
if(VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in())){
// To set visiblity
- VISU::UpdateViewer<VVTK_Viewer>(theModule,aPrs3d,anIsFirst,false,false);
+ VISU::UpdateViewer(theModule, aPrs3d, /*disp_only = */anIsFirst, /*highlight = */false);
anIsFirst = false;
// To update selection
// File : VisuGUI_Module.h
// Author :
// Module : VISU
-// $Header$
#ifndef VisuGUI_Module_HeaderFile
#define VisuGUI_Module_HeaderFile
void
OnEditGaussPoints();
- //! Reimplemented method of the Gauss Points displaying.
- virtual
- void
- OnDisplayPrs();
-
- //! Reimplemented method of the Gauss Points displaying only.
- virtual
- void
- OnDisplayOnlyPrs();
-
- //! Reimplemented method of the Gauss Points full erasing.
- virtual
- void
- OnEraseAll();
-
- //! Reimplemented method of the Gauss Points erasing.
- virtual
- void
- OnErasePrs();
-
//! Virtual method of saving configuration.
virtual
void
#include "VisuGUI.h"
#include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
#include "VISU_ViewManager_i.hh"
#include "VISU_Plot3DPL.hxx"
-#include "SALOME_Actor.h"
#include "SVTK_ViewWindow.h"
+
+#include "SALOME_Actor.h"
#include "SUIT_Desktop.h"
#include <qlayout.h>
//=======================================================================
VisuGUI_Plot3DPane::VisuGUI_Plot3DPane (QWidget* parent)
: QVBox(parent), myInitFromPrs(false), myPreviewActor(NULL),
- myViewWindow(VISU::GetViewWindow()), myPrs(NULL), myPipeCopy(NULL)
+ myViewWindow(VISU::GetActiveViewWindow<SVTK_ViewWindow>()), myPrs(NULL), myPipeCopy(NULL)
{
layout()->setAlignment(Qt::AlignTop);
setSpacing(6);
// Module : VISU
#include "VisuGUI_PopupTools.h"
+
#include "VisuGUI_ViewTools.h"
#include "VisuGUI_Tools.h"
-#include "SalomeApp_Study.h"
-#include "LightApp_Study.h"
+
+#include "VISU_Result_i.hh"
#include "VISU_Actor.h"
#include "VISU_ScalarMapAct.h"
-#include "VISU_Result_i.hh"
+
#include "SalomeApp_Study.h"
+#include "LightApp_Study.h"
using namespace VISU;
{
QString aResStr;
- if ( SVTK_ViewWindow* aView = GetViewWindow( myModule ) ){
- if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) ){
+ if (SVTK_ViewWindow* aView = GetActiveViewWindow<SVTK_ViewWindow>(myModule)) {
+ if (VISU_Actor* anVISUActor = FindActor(aView, entry(ind).latin1())) {
int aRepresent = anVISUActor->GetRepresentation();
- switch ( aRepresent ){
+ switch (aRepresent) {
ENUM2STRING( aResStr, VISU::POINT );
ENUM2STRING( aResStr, VISU::WIREFRAME );
ENUM2STRING( aResStr, VISU::SHADED );
const QString& theEntry)
{
typedef typename TViewer::TViewWindow TViewWindow;
- if(TViewWindow* aViewWindow = GetViewWindow<TViewer>(theModule))
- if(VISU_Actor* anActor = FindActor(aViewWindow,theEntry.latin1()))
+ if (TViewWindow* aViewWindow = GetActiveViewWindow<TViewWindow>(theModule))
+ if (VISU_Actor* anActor = FindActor(aViewWindow,theEntry.latin1()))
return anActor->GetVisibility() ? "true" : "false";
return QString();
{
QString aResStr;
- if ( SVTK_ViewWindow* aView = GetViewWindow( myModule ) )
+ if ( SVTK_ViewWindow* aView = GetActiveViewWindow<SVTK_ViewWindow>(myModule) )
if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) )
if ( anVISUActor->IsShrunkable() )
aResStr = anVISUActor->IsShrunk() ? "1" : "0";
{
QString aResStr;
- if ( SVTK_ViewWindow* aView = GetViewWindow( myModule ) )
+ if ( SVTK_ViewWindow* aView = GetActiveViewWindow<SVTK_ViewWindow>(myModule) )
if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) )
if ( VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(anVISUActor) )
aResStr = anActor->IsShading() ? "1" : "0";
{
QString aResStr;
- if ( SVTK_ViewWindow* aView = GetViewWindow( myModule ) )
+ if ( SVTK_ViewWindow* aView = GetActiveViewWindow<SVTK_ViewWindow>(myModule) )
if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) )
- {
- VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(anVISUActor);
- aResStr = anActor ? "1" : "0";
- }
-
+ {
+ VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(anVISUActor);
+ aResStr = anActor ? "1" : "0";
+ }
+
return aResStr;
}
// File : VisuGUI_Module.h
// Author :
// Module : VISU
-// $Header$
#ifndef VisuGUI_Prs3dTools_HeaderFile
#define VisuGUI_Prs3dTools_HeaderFile
template<class TPrs3d_i, class TViewer, class TDlg, int TIsDlgModal>
void
EditPrs3d(VisuGUI* theModule,
- VISU::Prs3d_i* thePrs3d)
+ VISU::Prs3d_i* thePrs3d,
+ SVTK_ViewWindow* theViewWindow)
{
- if(TPrs3d_i* aPrs3d = dynamic_cast<TPrs3d_i*>(thePrs3d)){
+ if (TPrs3d_i* aPrs3d = dynamic_cast<TPrs3d_i*>(thePrs3d)) {
TDlg* aDlg = new TDlg (theModule);
aDlg->initFromPrsObject(aPrs3d);
if (runAndWait(aDlg,TIsDlgModal)) {
try {
aPrs3d->UpdateActors();
} catch (std::runtime_error& exc) {
+ aPrs3d->RemoveActors();
+
INFOS(exc.what());
SUIT_MessageBox::warn1
(GetDesktop(theModule), QObject::tr("WRN_VISU"),
QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": " + QObject::tr(exc.what()),
QObject::tr("BUT_OK"));
-
- aPrs3d->RemoveActors();
}
- typedef typename TViewer::TViewWindow TViewWindow;
- if(TViewWindow* aViewWindow = GetViewWindow<TViewer>(theModule)){
- aViewWindow->getRenderer()->ResetCameraClippingRange();
- aViewWindow->Repaint();
+ if (theViewWindow) {
+ theViewWindow->getRenderer()->ResetCameraClippingRange();
+ theViewWindow->Repaint();
}
// Optionally, create table and curves for cut lines
QApplication::setOverrideCursor(Qt::waitCursor);
template<class TPrs3d_i, class TDlg, int TIsDlgModal>
inline
void
- EditPrs3d(VisuGUI* theModule,
- VISU::Prs3d_i* thePrs3d)
+ EditPrs3d(VisuGUI* theModule,
+ Handle(SALOME_InteractiveObject)& theIO,
+ VISU::Prs3d_i* thePrs3d,
+ SVTK_ViewWindow* theViewWindow = NULL)
{
- EditPrs3d<TPrs3d_i,SVTK_Viewer,TDlg,TIsDlgModal>(theModule,thePrs3d);
+ SVTK_ViewWindow* aViewWindow = theViewWindow;
+ if (!aViewWindow)
+ // Create SVTK_ViewWindow, if it does not exist
+ aViewWindow = GetViewWindow<SVTK_Viewer>(theModule);
+ if (aViewWindow) {
+ EditPrs3d<TPrs3d_i,SVTK_Viewer,TDlg,TIsDlgModal>(theModule, thePrs3d, aViewWindow);
+ aViewWindow->highlight(theIO, 1);
+ }
}
//---------------------------------------------------------------
bool
CreatePrs3d(VisuGUI* theModule,
_PTR(SObject) theTimeStamp,
- const Handle(SALOME_InteractiveObject)& theIO,
- const bool theIsCreateView = false)
+ const Handle(SALOME_InteractiveObject)& theIO)
{
Storable::TRestoringMap aMap = getMapOfValue(theTimeStamp);
bool isExist;
QString aType = Storable::FindValue(aMap,"myType",&isExist);
- if(!isExist || aType.toInt() != TTIMESTAMP )
+ if (!isExist || aType.toInt() != TTIMESTAMP )
return false;
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 = GetFreePositionOfDefaultScalarBar(theModule);
- GetResourceMgr()->setValue("VISU","scalar_bar_position_num",aPos);
- //
+
+ // Create new TViewWindow instance, if it does not exist.
+ typedef typename TViewer::TViewWindow TViewWindow;
+ TViewWindow* aViewWindow = GetViewWindow<TViewer>(theModule);
+
+ // Define free position for scalar bar.
+ int aPos = GetFreePositionOfDefaultScalarBar(theModule, aViewWindow);
+ GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
+
QApplication::setOverrideCursor(Qt::waitCursor);
-
+
TPrs3d_i* aPrs3d =
CreatePrs3d<TPrs3d_i>(theModule,
theTimeStamp,
(Entity)anEntity.toInt(),
aFieldName.latin1(),
aTimeStampId.toInt());
-
+
QApplication::restoreOverrideCursor();
- if(aPrs3d){
+ if (aPrs3d) {
SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
- if(!aValue){
- if(TDlg* aDlg = new TDlg(theModule)){ // dialog box in creation mode
+ if (!aValue) {
+ if (TDlg* aDlg = new TDlg(theModule)) { // dialog box in creation mode
aDlg->initFromPrsObject(aPrs3d);
- if(runAndWait(aDlg,IsDlgModal) && (aDlg->storeToPrsObject(aPrs3d))) {
+ if (runAndWait(aDlg,IsDlgModal) && (aDlg->storeToPrsObject(aPrs3d))) {
// Optionally, create table and curves for cut lines
QApplication::setOverrideCursor(Qt::waitCursor);
CreateCurves( theModule,
}
}
}
- PublishInView<TViewer>(theModule,aPrs3d,true,theIsCreateView);
- AddScalarBarPosition(theModule,aPrs3d,aPos);
+ // Display created presentation.
+ if (aViewWindow) {
+ PublishInView(theModule, aPrs3d, aViewWindow, /*highlight = */true);
+ aViewWindow->onFitAll();
+
+ AddScalarBarPosition(theModule, aViewWindow, aPrs3d, aPos);
+ }
return true;
}
return false;
}
-
+
//---------------------------------------------------------------
template<class TPrs3d_i, class TViewer, class TDlg, int IsDlgModal>
inline
void
- CreatePrs3d(VisuGUI* theModule,
- const bool theIsCreateView = true)
+ CreatePrs3d(VisuGUI* theModule)
{
if (CheckLock(GetCStudy(GetAppStudy(theModule)),GetDesktop(theModule)))
return;
-
+
_PTR(SObject) aTimeStampSObj;
Handle(SALOME_InteractiveObject) anIO;
- if(!CheckTimeStamp(theModule,aTimeStampSObj,&anIO))
+ if (!CheckTimeStamp(theModule,aTimeStampSObj,&anIO))
return;
-
- if(!CreatePrs3d<TPrs3d_i,TViewer,TDlg,IsDlgModal>(theModule,aTimeStampSObj,anIO,theIsCreateView))
+
+ // Create new TViewWindow instance, if it does not exist.
+ typedef typename TViewer::TViewWindow TViewWindow;
+ if (!GetViewWindow<TViewer>(theModule))
return;
-
+
+ if (!CreatePrs3d<TPrs3d_i,TViewer,TDlg,IsDlgModal>(theModule,aTimeStampSObj,anIO))
+ return;
+
theModule->application()->putInfo(QObject::tr("INF_DONE"));
-
- typedef typename TViewer::TViewWindow TView;
- if(TView* aView = GetViewWindow<TViewer>(theModule,theIsCreateView))
- aView->onFitAll();
}
template<class TPrs3d_i, class TDlg, int IsDlgModal>
inline
void
- CreatePrs3d(VisuGUI* theModule,
- const bool theIsCreateView = true)
+ CreatePrs3d(VisuGUI* theModule)
{
- if(SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()){
+ if (SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()) {
QString aType = aViewManager->getType();
- if(aType == SVTK_Viewer::Type())
- CreatePrs3d<TPrs3d_i,SVTK_Viewer,TDlg,IsDlgModal>(theModule,theIsCreateView);
- else if(aType == VVTK_Viewer::Type())
- CreatePrs3d<TPrs3d_i,VVTK_Viewer,TDlg,IsDlgModal>(theModule,theIsCreateView);
+ if (aType == VVTK_Viewer::Type())
+ CreatePrs3d<TPrs3d_i,VVTK_Viewer,TDlg,IsDlgModal>(theModule);
+ else
+ CreatePrs3d<TPrs3d_i,SVTK_Viewer,TDlg,IsDlgModal>(theModule);
}
}
-
}
#endif
#include "VisuGUI.h"
#include "VisuGUI_Tools.h"
-
-#include "SVTK_FontWidget.h"
-
-#include "SVTK_ViewWindow.h"
+#include "VisuGUI_ViewTools.h"
#include "SVTK_ViewWindow.h"
+#include "SVTK_FontWidget.h"
#include "VISUConfig.hh"
#include "VISU_Convertor.hxx"
void VisuGUI_ScalarBarPane::updatePreview()
{
if (myPreviewCheck->isChecked()) {
- if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
+ if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
deleteScalarBar();
createScalarBar();
vf->Repaint();
*/
void VisuGUI_ScalarBarPane::createScalarBar()
{
- if (VISU::GetViewWindow() == NULL) return;
+ if (VISU::GetActiveViewWindow<SVTK_ViewWindow>() == NULL) return;
if (myPreviewActor != 0) return;
if (myScalarMap == NULL) return;
- if(!check()) return;
+ if (!check()) return;
if ( myBusy ) return;
aScalarBarActor->Modified();
- VISU::GetViewWindow()->AddActor(myPreviewActor);
+ VISU::GetActiveViewWindow<SVTK_ViewWindow>()->AddActor(myPreviewActor);
myBusy = false;
}
if ( myBusy ) return;
if (myPreviewActor == 0) return;
- if (SVTK_ViewWindow* vf = VISU::GetViewWindow()){
+ if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()){
vf->RemoveActor(myPreviewActor);
myPreviewActor->GetScalarBar()->VisibilityOff();
}
void VisuGUI_ScalarBarPane::onPreviewCheck (bool thePreview)
{
- if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
+ if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()) {
if (thePreview) {
createScalarBar();
} else {
#include "VisuGUI.h"
#include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
#include "VISU_Actor.h"
#include "VISU_PrsObject_i.hh"
#include "SALOME_ListIteratorOfListIO.hxx"
#include "SVTK_ViewWindow.h"
-#include "SVTK_ViewModel.h"
#include "SVTK_Selector.h"
#include "utilities.h"
// Activate Points pane
myWidgetStack->raiseWidget(myPointsPane);
- if(SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule))
+ if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule))
aViewWindow->SetSelectionMode(NodeSelection);
onSelectionEvent();
void VisuGUI_SelectionDlg::onSelectionChange (int theId)
{
- SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule);
+ SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule);
if (!aViewWindow) return;
switch (theId) {
void VisuGUI_SelectionDlg::closeEvent (QCloseEvent* theEvent)
{
- if( mySelectionDlg )
- {
+ if (mySelectionDlg) {
mySelectionDlg = NULL;
disconnect(mySelectionMgr,0,0,0);
- if(SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule)){
+ if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule)) {
switch(aViewWindow->SelectionMode()){
case NodeSelection:
case CellSelection:
#define ABS(a) (a>=0)?a:-a
void VisuGUI_SelectionDlg::onSelectionEvent() {
- SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule);
+ SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule);
if (!aViewWindow) return;
- switch(aViewWindow->SelectionMode()){
+ switch (aViewWindow->SelectionMode()) {
case NodeSelection:
case CellSelection:
case ActorSelection:
QLabel* theFieldName)
{
SalomeApp_Application* anApp = theModule->getApp();
- SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(theModule);
+ SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(theModule);
if (!aViewWindow) return false;
SVTK_Selector* aSelector = aViewWindow->GetSelector();
#include "VisuGUI.h"
#include "VisuGUI_Tools.h"
+#include "VisuGUI_ViewTools.h"
#include "VisuGUI_DeformedShapeDlg.h"
#include "VisuGUI_CutPlanesDlg.h"
#include "VisuGUI_CutLinesDlg.h"
#define MAXVAL 1e10
ArrangeDlg::ArrangeDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator)
- : QDialog(theParent, "ArrangeDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
- myAnimator(theAnimator), myViewWindow(theAnimator->getViewer())
+ : QDialog(theParent, "ArrangeDlg", true,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
+ myAnimator(theAnimator),
+ myViewWindow(theAnimator->getViewer())
{
myCurrent = 0;
init();
myAnimator = new VISU_TimeAnimation (theStudy);
myAnimator->setSpeed(1);
- myAnimator->setViewer(VISU::GetViewWindow(theModule));
+ myAnimator->setViewer(VISU::GetActiveViewWindow<SVTK_ViewWindow>(theModule));
connect(myAnimator, SIGNAL(frameChanged(long, double)), this, SLOT(onExecution(long, double)));
connect(myAnimator, SIGNAL(stopped()), this, SLOT(onStop()));
#include "VisuGUI_Tools.h"
+#include "VisuGUI.h"
+#include "VisuGUI_ViewTools.h"
+
#include "VISU_Gen_i.hh"
#include "VISU_Prs3d_i.hh"
#include "VISU_Result_i.hh"
#include "SalomeApp_Study.h"
#include "SalomeApp_Application.h"
-#include "OB_Browser.h"
#include "LightApp_DataObject.h"
#include "LightApp_SelectionMgr.h"
+#include "OB_Browser.h"
+
#include "SALOME_ListIO.hxx"
#include "SALOME_ListIteratorOfListIO.hxx"
#include "SVTK_ViewWindow.h"
-#include "SVTK_ViewModel.h"
#include "SVTK_Functor.h"
#include "VTKViewer_Algorithm.h"
#include "SUIT_Session.h"
#include "SUIT_MessageBox.h"
-#include "VisuGUI.h"
-
#include <vtkRenderer.h>
#include <vtkActorCollection.h>
return true;
}
- // Display/Erase
-
- void
- ErasePrs (const SalomeApp_Module* theModule,
- CORBA::Object_ptr theObject, bool theUpdate)
- {
- if (!CORBA::is_nil(theObject)) {
- VISU::Base_var aBase = VISU::Base::_narrow(theObject);
- if (CORBA::is_nil(aBase)) return;
- VISU::VISUType aType = aBase->GetType();
- switch (aType) {
- case VISU::TCURVE:
- {
- if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aBase).in()))
- PlotCurve(theModule, aCurve, VISU::eErase );
- break;
- }
- case VISU::TCONTAINER:
- {
- if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aBase).in()))
- PlotContainer(theModule, aContainer, VISU::eErase );
- break;
- }
- case VISU::TTABLE:
- {
- if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aBase).in()))
- PlotTable(theModule, aTable, VISU::eErase );
- break;
- }
- default:
- {
- if (VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aBase).in())) {
- ErasePrs3d(theModule, aPrsObject);
- if (theUpdate) {
- if (SVTK_ViewWindow* vw = GetViewWindow(theModule))
- vw->Repaint();
- }
- }
- }
- } // switch (aType)
- }
- }
-
void
DeleteSObject(VisuGUI* theModule,
_PTR(Study) theStudy,
_PTR(ChildIterator) aChildIter = theStudy->NewChildIterator(theSObject);
for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
_PTR(SObject) aChildSObject = aChildIter->Value();
-
CORBA::Object_var aChildObj = VISU::ClientSObjectToObject(aChildSObject);
- RemoveScalarBarPosition(theModule,aChildObj);
- ErasePrs(theModule, aChildObj);
+ ErasePrs(theModule, aChildObj, /*repaint_view_window = */false);
}
CORBA::Object_var anObj = VISU::ClientSObjectToObject(theSObject);
if (!CORBA::is_nil(anObj)) {
- RemoveScalarBarPosition(theModule,anObj);
- ErasePrs(theModule, anObj);
+ ErasePrs(theModule, anObj, /*repaint_view_window = */true);
VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(anObj);
if (!CORBA::is_nil(aRemovableObject)) {
if (CheckLock(GetCStudy(GetAppStudy(theModule)),GetDesktop(theModule)))
return;
- RemoveScalarBarPosition(theModule,thePrs);
- thePrs->RemoveFromStudy();
- }
+ SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
+ RemoveScalarBarPosition(theModule, vw, thePrs);
- void
- ErasePrs3d(const SalomeApp_Module* theModule,
- VISU::Prs3d_i* thePrs)
- {
- if ( SVTK_ViewWindow* vw = GetViewWindow( theModule ) ){
- if (VISU_Actor* anVISUActor = FindActor( vw, thePrs )) {
- anVISUActor->VisibilityOff();
- }
- }
+ thePrs->RemoveFromStudy();
}
// Presentation management
ChangeRepresentation (const SalomeApp_Module* theModule,
VISU::PresentationType theType)
{
- SVTK_ViewWindow* vw = GetViewWindow( theModule, false );
- if( !vw )
+ SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
+ if (!vw)
return;
Handle(SALOME_InteractiveObject) anIO;
}
}
}
-
+
void
SetShading ( const SalomeApp_Module* theModule,
bool theOn )
{
- SUIT_ViewWindow* aView = GetActiveView(theModule, SVTK_Viewer::Type());
- if (!aView) return;
- SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>( aView );
- if( !vw )
+ SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
+ if (!vw)
return;
-
+
Handle(SALOME_InteractiveObject) anIO;
CORBA::Object_var anObject = GetSelectedObj(theModule, &anIO);
if (CORBA::is_nil(anObject)) return;
return dynamic_cast<VISU::Result_i*>(VISU::GetServant(anObject).in());
}
- // Views
-
- SUIT_ViewWindow* GetActiveView(const SalomeApp_Module* theModule, QString theType)
- {
- if(SalomeApp_Application* anApp = theModule->getApp()){
- if(SUIT_ViewManager* aViewManager = anApp->activeViewManager()){
- if (!theType.isNull()) {
- if (aViewManager->getType() != theType)
- return 0;
- }
- return aViewManager->getActiveView();
- }
- }
- return 0;
- }
-
// VTK View
- TViewWindows
- GetViews(const SalomeApp_Module* theModule)
- {
- TViewWindows aViewWindows;
- if(SalomeApp_Application* anApp = theModule->getApp()){
- ViewManagerList aViewManagerList;
- anApp->viewManagers(SVTK_Viewer::Type(),aViewManagerList);
- QPtrListIterator<SUIT_ViewManager> anIter(aViewManagerList);
- while(SUIT_ViewManager* aViewManager = anIter.current()){
- QPtrVector<SUIT_ViewWindow> aViews = aViewManager->getViews();
- for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
- if(SUIT_ViewWindow* aViewWindow = aViews.at(i))
- if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewWindow))
- aViewWindows.push_back(aView);
- }
- ++anIter;
- }
- }
- return aViewWindows;
- }
-
- SVTK_ViewWindow*
- GetViewWindow( const SalomeApp_Module* theModule, const bool theCreate )
- {
- if (SalomeApp_Application* anApp = theModule->getApp())
- {
- SVTK_ViewWindow* wnd = dynamic_cast<SVTK_ViewWindow*>(anApp->desktop()->activeWindow());
- if( wnd )
- return wnd;
- else
- {
- SUIT_ViewManager* aViewManager = anApp->getViewManager( SVTK_Viewer::Type(), theCreate );
- return aViewManager ? dynamic_cast<SVTK_ViewWindow*>( aViewManager->getActiveView() ) : 0;
- }
- }
- return NULL;
- }
-
- /*SVTK_ViewWindow*
- GetViewWindow(const SalomeApp_Module* theModule, const bool theCreate )
- {
- if (SalomeApp_Application* anApp = theModule->getApp())
- {
- SVTK_ViewWindow* wnd = dynamic_cast<SVTK_ViewWindow*>(anApp->desktop()->activeWindow());
- if( wnd )
- return wnd;
- else
- {
- if(SUIT_ViewManager* aViewManager = anApp->getViewManager( SVTK_Viewer::Type(), theCreate ))
- return dynamic_cast<SVTK_ViewWindow*>( aViewManager->getActiveView() );
- }
- }
- return NULL;
- }*/
-
-
- SVTK_ViewWindow*
- GetViewWindow()
- {
- SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
- (SUIT_Session::session()->activeApplication());
- if (anApp) {
- if (SUIT_ViewManager* aViewManager = anApp->activeViewManager()) {
- if (aViewManager->getType() == SVTK_Viewer::Type()) {
- if (SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()) {
- return dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
- }
- }
- }
- }
- return NULL;
- }
-
VISU_Actor*
- PublishInView(const SalomeApp_Module* theModule,
- VISU::Prs3d_i* thePrs)
+ PublishMeshInView(const SalomeApp_Module* theModule,
+ VISU::Prs3d_i* thePrs,
+ SVTK_ViewWindow* theViewWindow)
{
VISU_Actor* aActor = NULL;
- if(!thePrs)
+ if (!thePrs || !theViewWindow)
return aActor;
- if(SVTK_ViewWindow* aView = GetViewWindow(theModule)){
- QApplication::setOverrideCursor( Qt::waitCursor );
- try{
- if(aActor = thePrs->CreateActor())
- aView->AddActor(aActor);
- }catch(std::exception& exc){
- SUIT_MessageBox::warn1
- (GetDesktop(theModule), QObject::tr("WRN_VISU"),
- QObject::tr("ERR_CANT_CREATE_ACTOR") + ": " + QObject::tr(exc.what()),
- QObject::tr("BUT_OK"));
- }
- QApplication::restoreOverrideCursor();
- }
- return aActor;
- }
- VISU_Actor*
- UpdateViewer(const SalomeApp_Module* theModule,
- VISU::Prs3d_i* thePrs,
- bool theDispOnly)
- {
- SVTK_ViewWindow* vw = GetViewWindow( theModule );
- if (!vw) return NULL;
-
- vtkRenderer *aRen = vw->getRenderer();
- vtkActorCollection *anActColl = aRen->GetActors();
- anActColl->InitTraversal();
-
- vtkActor *anActor;
- VISU_Actor* anVISUActor = NULL;
- VISU_Actor* aResActor = NULL;
- while(vtkActor *anActor = anActColl->GetNextActor()){
- anVISUActor = VISU_Actor::SafeDownCast(anActor);
- if(anVISUActor){
- VISU::Prs3d_i* aPrs = anVISUActor->GetPrs3d();
- if(aPrs == NULL) continue;
- if (thePrs == aPrs) {
- try {
- aResActor = anVISUActor;
- thePrs->UpdateActor(aResActor);
- aResActor->VisibilityOn();
- } catch (std::runtime_error& exc) {
- aResActor->VisibilityOff();
- INFOS(exc.what());
- SUIT_MessageBox::warn1
- (GetDesktop(theModule), QObject::tr("WRN_VISU"),
- QObject::tr("ERR_CANT_CREATE_ACTOR") + ": " + QObject::tr(exc.what()),
- QObject::tr("BUT_OK"));
- }
- } else if (theDispOnly) {
- anVISUActor->VisibilityOff();
- } else {
- }
- } else if (theDispOnly && anActor->GetVisibility()) {
- anActor->VisibilityOff();
- } else {
- }
+ QApplication::setOverrideCursor( Qt::waitCursor );
+ try {
+ if (aActor = thePrs->CreateActor())
+ theViewWindow->AddActor(aActor);
+ } catch(std::exception& exc) {
+ SUIT_MessageBox::warn1
+ (GetDesktop(theModule), QObject::tr("WRN_VISU"),
+ QObject::tr("ERR_CANT_CREATE_ACTOR") + ": " + QObject::tr(exc.what()),
+ QObject::tr("BUT_OK"));
}
- if (aResActor)
- return aResActor;
+ QApplication::restoreOverrideCursor();
- //anVISUActor = PublishInView( theModule, thePrs );
- return anVISUActor;
+ return aActor;
}
void
// Others
void CreateMesh (const SalomeApp_Module* theModule,
- const Handle(SALOME_InteractiveObject)& theIO)
+ const Handle(SALOME_InteractiveObject)& theIO,
+ SVTK_ViewWindow* theViewWindow)
{
_PTR(Study) aStudy = GetCStudy(GetAppStudy(theModule));
//if (CheckLock(aStudy))
timer.Show();
#endif
- QApplication::restoreOverrideCursor();
+ //QApplication::restoreOverrideCursor();
VISU::Mesh_i* pPresent = NULL;
if (!CORBA::is_nil(aMesh))
pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
return;
}
- if (SVTK_ViewWindow* aView = GetViewWindow(theModule)) {
+ if (theViewWindow) {
try {
#ifdef CHECKTIME
Utils_Timer timer;
timer.Start();
#endif
- PublishInView(theModule, pPresent);
- //aView->onFitAll();
- SetFitAll(aView);
+ PublishMeshInView(theModule, pPresent, theViewWindow);
+ SetFitAll(theViewWindow);
#ifdef CHECKTIME
timer.Stop();
MESSAGE("VisuGUI::CreateMesh() - DISPLAY MESH");
timer.Show();
#endif
- theModule->application()->putInfo(QObject::tr("INF_DONE"));
- // Make "Save" button active
- theModule->getApp()->updateActions();
} catch (std::runtime_error& exc) {
INFOS(exc.what());
SUIT_MessageBox::warn1
QObject::tr("BUT_OK"));
}
}
+
+ theModule->application()->putInfo(QObject::tr("INF_DONE"));
+ // Make "Save" button active
+ theModule->getApp()->updateActions();
}
// ========================================================================================
}
return aList;
}
-
- int GetFreePositionOfDefaultScalarBar(VisuGUI* theModule){
+
+ int GetFreePositionOfDefaultScalarBar(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow)
+ {
int minIndx = 1;
std::set<int> aIndexes;
- SVTK_ViewWindow* vw = GetViewWindow(theModule);
TViewToPrs3d aMap = theModule->getScalarBarsMap();
- TViewToPrs3d::const_iterator aViewToPrsIter = aMap.find(vw);
- if (aViewToPrsIter != aMap.end()){
+ TViewToPrs3d::const_iterator aViewToPrsIter = aMap.find(theViewWindow);
+ if (aViewToPrsIter != aMap.end()) {
TSetPrs3d::const_iterator aPrsIter = (aViewToPrsIter->second).begin();
- for(;aPrsIter!=(aViewToPrsIter->second).end();aPrsIter++){
+ for (; aPrsIter != (aViewToPrsIter->second).end(); aPrsIter++) {
aIndexes.insert((*aPrsIter).second);
}
}
std::set<int>::const_iterator aIter = aIndexes.begin();
- for (int i=1,length=aIndexes.size(); i <= length; i++){
+ for (int i = 1,length = aIndexes.size(); i <= length; i++) {
std::set<int>::const_iterator aIter = aIndexes.find(i);
- if(aIter==aIndexes.end()){minIndx = i;break;}
+ if (aIter == aIndexes.end()) { minIndx = i; break; }
else minIndx = i + 1;
-
}
return minIndx;
}
-
- void AddScalarBarPosition(VisuGUI* theModule,VISU::Prs3d_i* thePrs3d, int pos){
- SVTK_ViewWindow* vw = GetViewWindow(theModule);
+
+ void AddScalarBarPosition (VisuGUI* theModule, SVTK_ViewWindow* theViewWindow,
+ VISU::Prs3d_i* thePrs3d, int pos)
+ {
TViewToPrs3d& aMap = theModule->myScalarBarsMap;
- TPrs3dToInd aPair; aPair.first=thePrs3d; aPair.second=pos;
- aMap[vw].insert(aPair);
+ TPrs3dToInd aPair; aPair.first = thePrs3d; aPair.second = pos;
+ aMap[theViewWindow].insert(aPair);
}
-
- void RemoveScalarBarPosition(VisuGUI* theModule,SVTK_ViewWindow* vw,VISU::Prs3d_i* thePrs3d){
+
+ void RemoveScalarBarPosition(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow,
+ VISU::Prs3d_i* thePrs3d)
+ {
TViewToPrs3d& aMap = theModule->myScalarBarsMap;
- TSetPrs3d::iterator aIter = aMap[vw].begin();
- for(;aIter!=aMap[vw].end();aIter++)
- if((*aIter).first == thePrs3d){
- aMap[vw].erase(*aIter);
+ TSetPrs3d::iterator aIter = aMap[theViewWindow].begin();
+ for (; aIter != aMap[theViewWindow].end(); aIter++)
+ if ((*aIter).first == thePrs3d) {
+ aMap[theViewWindow].erase(*aIter);
return;
}
}
-
- void RemoveScalarBarPosition(VisuGUI* theModule,VISU::Prs3d_i* thePrs3d){
- SVTK_ViewWindow* vw = GetViewWindow(theModule);
- RemoveScalarBarPosition(theModule,vw,thePrs3d);
- }
-
- void RemoveScalarBarPosition(VisuGUI* theModule,CORBA::Object_ptr theObject){
- if (!CORBA::is_nil(theObject)) {
- Base_var aBase = Base::_narrow(theObject);
- if (CORBA::is_nil(aBase)) return;
- if (VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aBase).in())){
- RemoveScalarBarPosition(theModule,aPrsObject);
- }
- }
- }
}
bool IsRemovableSelected(const SalomeApp_Module* theModule);
- // Display/Erase
- void ErasePrs(const SalomeApp_Module* theModule,
- CORBA::Object_ptr theObject,
- bool theUpdate = true);
void DeleteSObject(VisuGUI* theModule,
_PTR(Study) theStudy,
_PTR(SObject) theSObject);
void DeletePrs3d(VisuGUI* theModule,
VISU::Prs3d_i* thePrs,
const Handle(SALOME_InteractiveObject)& theIO);
- void ErasePrs3d(const SalomeApp_Module* theModule,
- VISU::Prs3d_i* thePrs);
// Presentation management
void ChangeRepresentation (const SalomeApp_Module* theModule,
VISU::Result_var& theResult);
bool IsSObjectTable(_PTR(SObject) theSObject);
- // Views
- SUIT_ViewWindow* GetActiveView(const SalomeApp_Module* theModule,
- QString theType = QString::null);
-
- // VTK View
- TViewWindows GetViews(const SalomeApp_Module* theModule);
- SVTK_ViewWindow* GetViewWindow(const SalomeApp_Module* theModule,
- const bool theCreate = false );
- SVTK_ViewWindow* GetViewWindow();
-
- VISU_Actor* PublishInView(const SalomeApp_Module* theModule,
- VISU::Prs3d_i* thePrs);
- VISU_Actor* UpdateViewer(const SalomeApp_Module* theModule,
- VISU::Prs3d_i* thePrs,
- bool theDispOnly = false);
+ /*! Display mesh presentation in given VTK view window
+ */
+ VISU_Actor* PublishMeshInView(const SalomeApp_Module* theModule,
+ VISU::Prs3d_i* thePrs,
+ SVTK_ViewWindow* theViewWindow);
/*!
* \brief Repaint all SVTK view windows, where the given object is displayed.
void CreatePlot( SalomeApp_Module* theModule,
_PTR(SObject) theSobj );
+ /*! Display/Erase/Update a curve presentation.
+ * Parameter \a frame may be NULL, in this case there is only update without display/erase
+ */
void UpdateCurve( VISU::Curve_i*,
Plot2d_ViewFrame* frame,
SPlot2d_Curve*,
int theDisplaying );
- //parameter frame may be 0, in this case there is only update without display/erase
- // Others
+ /*! Create mesh presentation and display it in \a theViewWindow.
+ * If \a theViewWindow is NULL, no displaying will be done.
+ */
void CreateMesh (const SalomeApp_Module* theModule,
- const Handle(SALOME_InteractiveObject)& theIO);
+ const Handle(SALOME_InteractiveObject)& theIO,
+ SVTK_ViewWindow* theViewWindow = NULL);
+ // Others
std::vector<VISU::Prs3d_i*> GetPrs3dList (const SalomeApp_Module* theModule,
const Handle(SALOME_InteractiveObject)& theIO);
std::vector<VISU::Prs3d_i*> GetPrs3dList (const SalomeApp_Module* theModule,
_PTR(SObject) theObject);
- int GetFreePositionOfDefaultScalarBar(VisuGUI* theModule);
- void AddScalarBarPosition(VisuGUI* theModule,VISU::Prs3d_i* thePrs3d, int pos);
- void RemoveScalarBarPosition(VisuGUI* theModule,VISU::Prs3d_i* thePrs3d);
- void RemoveScalarBarPosition(VisuGUI* theModule,SVTK_ViewWindow* vw,VISU::Prs3d_i* thePrs3d);
- void RemoveScalarBarPosition(VisuGUI* theModule,CORBA::Object_ptr theObject);
+ int GetFreePositionOfDefaultScalarBar(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow);
+ void AddScalarBarPosition(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow,
+ VISU::Prs3d_i* thePrs3d, int pos);
+ void RemoveScalarBarPosition(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow,
+ VISU::Prs3d_i* thePrs3d);
}
#endif
: QDialog( VISU::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
WStyle_Title | WStyle_SysMenu | WDestructiveClose ),
mySelectionMgr( VISU::GetSelectionMgr( theModule ) ),
- myViewWindow( VISU::GetViewWindow( theModule ) )
+ myViewWindow( VISU::GetActiveViewWindow<SVTK_ViewWindow>(theModule) )
{
if (!name)
setName("VisuGUI_TransparencyDlg");
{
void
ErasePrs(VisuGUI* theModule,
- VISU::Base_ptr theBase,
- bool thIsUpdate)
+ CORBA::Object_ptr theObject,
+ bool theDoRepaintVW)
{
- VISU::VISUType aType = theBase->GetType();
+ if (CORBA::is_nil(theObject)) return;
+ VISU::Base_var aBase = VISU::Base::_narrow(theObject);
+ if (CORBA::is_nil(aBase)) return;
+
+ VISU::VISUType aType = aBase->GetType();
switch (aType) {
case VISU::TCURVE: {
- if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(theBase).in()))
+ if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aBase).in()))
PlotCurve(theModule, aCurve, VISU::eErase );
break;
}
case VISU::TCONTAINER: {
- if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(theBase).in()))
+ if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aBase).in()))
PlotContainer(theModule, aContainer, VISU::eErase );
break;
}
case VISU::TTABLE: {
- if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(theBase).in()))
+ if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aBase).in()))
PlotTable(theModule, aTable, VISU::eErase );
break;
}
default: {
- if(VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(theBase).in())){
- if(aType == VISU::TGAUSSPOINTS)
- ErasePrs3d<VVTK_Viewer>(theModule,aPrsObject,thIsUpdate);
- else if(SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()){
- QString aType = aViewManager->getType();
- if(aType == SVTK_Viewer::Type())
- ErasePrs3d<SVTK_Viewer>(theModule,aPrsObject,thIsUpdate);
- else if(aType == VVTK_Viewer::Type())
- ErasePrs3d<VVTK_Viewer>(theModule,aPrsObject,thIsUpdate);
- }
+ if (VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aBase).in())) {
+ SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
+ RemoveScalarBarPosition(theModule, vw, aPrsObject);
+ ErasePrs3d(theModule, aPrsObject, theDoRepaintVW);
}
}} // switch (aType)
}
#include "VisuGUI.h"
-#include "SUIT_MessageBox.h"
-#include "SUIT_ViewManager.h"
-#include "SUIT_ViewWindow.h"
+#include "VisuGUI_Tools.h"
+
+#include "VISU_Prs3d_i.hh"
+#include "VISU_Table_i.hh"
+#include "VISU_ViewManager_i.hh"
+
+#include "VISU_Actor.h"
#include "SalomeApp_Module.h"
#include "SalomeApp_Application.h"
-#include "VISU_Prs3d_i.hh"
-
#include "VVTK_ViewModel.h"
#include "VVTK_ViewWindow.h"
+#include "SVTK_Functor.h"
#include "SVTK_ViewModel.h"
#include "SVTK_ViewWindow.h"
-#include "VisuGUI_Tools.h"
+#include "SPlot2d_ViewModel.h"
+
#include "VTKViewer_Algorithm.h"
-#include "SVTK_Functor.h"
-#include "VISU_Table_i.hh"
-#include "VISU_ViewManager_i.hh"
+#include "SUIT_Session.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_ViewManager.h"
+#include "SUIT_ViewWindow.h"
+
#include "SALOME_ListIO.hxx"
#include "SALOME_ListIteratorOfListIO.hxx"
-#include "SPlot2d_ViewModel.h"
-
-#include "VISU_Actor.h"
-
#include <vtkActorCollection.h>
#include <vtkRenderer.h>
namespace VISU
{
- //---------------------------------------------------------------
+ /*! Return active view window, if it instantiates TViewer::TViewWindow class,
+ * overwise find or create corresponding view window, make it active and return it.
+ * \note Active VVTK_ViewWindow can be returned by request GetViewWindow<SVTK_Viewer>(),
+ * because VVTK_ViewWindow inherits SVTK_ViewWindow.
+ */
template<class TViewer>
inline
typename TViewer::TViewWindow*
- GetViewWindow(VisuGUI* theModule,
- const bool theIsViewCreate = false)
+ GetViewWindow(VisuGUI* theModule)
{
- typedef typename TViewer::TViewWindow TView;
- if(SUIT_ViewManager* aViewManager = theModule->getViewManager(TViewer::Type(),theIsViewCreate)){
- if(SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()){
- if(TView* aView = dynamic_cast<TView*>(aViewWindow)){
+ typedef typename TViewer::TViewWindow TViewWindow;
+ if (SalomeApp_Application* anApp = theModule->getApp()) {
+ if (TViewWindow* aView = dynamic_cast<TViewWindow*>(anApp->desktop()->activeWindow()))
+ return aView;
+ }
+ SUIT_ViewManager* aViewManager =
+ theModule->getViewManager(TViewer::Type(), /*create = */true);
+ if (aViewManager) {
+ if (SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()) {
+ if (TViewWindow* aView = dynamic_cast<TViewWindow*>(aViewWindow)) {
aViewWindow->raise();
aViewWindow->setFocus();
return aView;
return NULL;
}
+ /*! Return active view window, if it instantiates TViewWindow class, overwise return NULL.
+ * \note Active VVTK_ViewWindow can be returned by request GetActiveViewWindow<SVTK_ViewWindow>(),
+ * because VVTK_ViewWindow inherits SVTK_ViewWindow.
+ */
+ template<class TViewWindow>
+ inline
+ TViewWindow*
+ GetActiveViewWindow(const SalomeApp_Module* theModule = NULL)
+ {
+ SalomeApp_Application* anApp = NULL;
+ if (theModule)
+ anApp = theModule->getApp();
+ else
+ anApp = dynamic_cast<SalomeApp_Application*>
+ (SUIT_Session::session()->activeApplication());
+
+ if (anApp)
+ if (SUIT_ViewManager* aViewManager = anApp->activeViewManager())
+ if (SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView())
+ return dynamic_cast<TViewWindow*>(aViewWindow);
+
+ return NULL;
+ }
+
//---------------------------------------------------------------
- template<class TViewer>
inline
VISU_Actor*
PublishInView(VisuGUI* theModule,
Prs3d_i* thePrs,
- const bool theIsHighlight = false,
- const bool theIsCreateView = false)
+ SVTK_ViewWindow* theViewWindow,
+ const bool theIsHighlight = false)
{
- typedef typename TViewer::TViewWindow TView;
- if(TView* aView = GetViewWindow<TViewer>(theModule,theIsCreateView)){
+ if (theViewWindow) {
QApplication::setOverrideCursor( Qt::waitCursor );
try {
- if(VISU_Actor* anActor = thePrs->CreateActor()){
- aView->AddActor(anActor);
- if(theIsHighlight)
- aView->highlight(anActor->getIO(),true);
- aView->getRenderer()->ResetCameraClippingRange();
- aView->Repaint();
+ if (VISU_Actor* anActor = thePrs->CreateActor()) {
+ theViewWindow->AddActor(anActor);
+ if (theIsHighlight)
+ theViewWindow->highlight(anActor->getIO(),true);
+ theViewWindow->getRenderer()->ResetCameraClippingRange();
+ theViewWindow->Repaint();
QApplication::restoreOverrideCursor();
return anActor;
}
} catch(std::exception& exc) {
+ thePrs->RemoveActors();
+
QApplication::restoreOverrideCursor();
INFOS(exc.what());
SUIT_MessageBox::warn1
//---------------------------------------------------------------
- template<class TViewer>
inline
VISU_Actor*
UpdateViewer(VisuGUI* theModule,
VISU::Prs3d_i* thePrs,
bool theDispOnly = false,
- const bool theIsHighlight = false,
- const bool theIsViewCreate = false)
+ const bool theIsHighlight = false)
{
- typedef typename TViewer::TViewWindow TView;
- if(TView* aView = GetViewWindow<TViewer>(theModule,theIsViewCreate)){
- vtkRenderer *aRen = aView->getRenderer();
+ if (SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule)) {
+ vtkRenderer *aRen = aViewWindow->getRenderer();
vtkActorCollection *anActColl = aRen->GetActors();
anActColl->InitTraversal();
VISU_Actor* aResActor = NULL;
- while(vtkActor *anAct = anActColl->GetNextActor()){
- if(VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(anAct)){
- if(VISU::Prs3d_i* aPrs3d = anActor->GetPrs3d()){
- if(thePrs == aPrs3d){
+ bool isOk = true;
+ while (vtkActor *anAct = anActColl->GetNextActor()) {
+ if (VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(anAct)) {
+ if (VISU::Prs3d_i* aPrs3d = anActor->GetPrs3d()) {
+ if (thePrs == aPrs3d) {
try {
+ aResActor = anActor;
thePrs->UpdateActors();
+ aResActor->VisibilityOn();
} catch (std::runtime_error& exc) {
+ thePrs->RemoveActors();
+ isOk = false;
+
INFOS(exc.what());
- QApplication::restoreOverrideCursor();
SUIT_MessageBox::warn1
(GetDesktop(theModule), QObject::tr("WRN_VISU"),
QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": " + QObject::tr(exc.what()),
QObject::tr("BUT_OK"));
-
- thePrs->RemoveActors();
- return NULL;
}
- aResActor = anActor;
- aResActor->VisibilityOn();
- }else if(theDispOnly){
+ } else if (theDispOnly) {
anActor->VisibilityOff();
}
- }else if(theDispOnly && anActor->GetVisibility()){
+ } else if (theDispOnly && anActor->GetVisibility()) {
anActor->VisibilityOff();
}
}
}
- if(aResActor){
- if(theIsHighlight)
- aView->highlight(aResActor->getIO(),true);
- aView->getRenderer()->ResetCameraClippingRange();
- aView->Repaint();
+ if (aResActor) {
+ if (theIsHighlight && isOk)
+ aViewWindow->highlight(aResActor->getIO(), true);
+ aViewWindow->getRenderer()->ResetCameraClippingRange();
+ aViewWindow->Repaint();
return aResActor;
}
- return PublishInView<TViewer>(theModule,thePrs,theIsHighlight,theIsViewCreate);
+ return PublishInView(theModule, thePrs, aViewWindow, theIsHighlight);
}
return NULL;
}
OnEraseAll(VisuGUI* theModule)
{
typedef typename TViewer::TViewWindow TViewWindow;
- if(TViewWindow* aViewWindow = GetViewWindow<TViewer>(theModule)){
+ if (TViewWindow* aViewWindow = GetActiveViewWindow<TViewWindow>(theModule)) {
aViewWindow->unHighlightAll();
- if(vtkRenderer *aRen = aViewWindow->getRenderer()){
+ if (vtkRenderer *aRen = aViewWindow->getRenderer()) {
vtkActorCollection *aCollection = aRen->GetActors();
aCollection->InitTraversal();
- while(vtkActor *anAct = aCollection->GetNextActor()){
- if(anAct->GetVisibility() > 0)
- if(SALOME_Actor* anActor = dynamic_cast<SALOME_Actor*>(anAct)){
+ while (vtkActor *anAct = aCollection->GetNextActor()) {
+ if (anAct->GetVisibility() > 0)
+ if (SALOME_Actor* anActor = dynamic_cast<SALOME_Actor*>(anAct)) {
anActor->VisibilityOff();
}
}
}
}
}
-
+
template<>
inline
void
OnEraseAll<SPlot2d_Viewer>(VisuGUI* theModule)
{
- if(SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(theModule,false))
+ if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(theModule, false))
aPlot2d->EraseAll();
}
//---------------------------------------------------------------
- template<class TVieweWindow>
- inline
- VISU_Actor*
- FindActor(TVieweWindow* theViewWindow,
- const char* theEntry)
- {
- using namespace SVTK;
- if(vtkRenderer* aRenderer = theViewWindow->getRenderer()){
- if(vtkActorCollection* aCollection = aRenderer->GetActors()){
- if(VISU_Actor* anActor = Find<VISU_Actor>(aCollection,TIsSameEntry<VISU_Actor>(theEntry))){
- return anActor;
- }
- }
- }
- return NULL;
- }
-
- template<class TViewer>
inline
void
ErasePrs3d(VisuGUI* theModule,
VISU::Prs3d_i* thePrs,
- const bool thIsUpdate = true)
+ const bool theDoRepaintVW = true)
{
- typedef typename TViewer::TViewWindow TViewWindow;
- if(TViewWindow* aViewWindow = GetViewWindow<TViewer>(theModule)){
- if(VISU_Actor* anActor = FindActor(aViewWindow,thePrs)){
+ if (SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule)) {
+ if (VISU_Actor* anActor = FindActor(aViewWindow, thePrs)) {
anActor->VisibilityOff();
- if(thIsUpdate)
+ if (theDoRepaintVW)
aViewWindow->Repaint();
}
}
}
-
void
ErasePrs(VisuGUI* theModule,
- VISU::Base_ptr theBase,
- bool thIsUpdate);
+ CORBA::Object_ptr theObject,
+ bool theDoRepaintVW);
}
#endif
}catch(std::bad_alloc& ex){
throw std::runtime_error("CreateActor >> No enough memory");
throw ex;
- } catch(std::exception& ex){
- throw ex;
+ } catch(std::exception&){
+ throw;
}catch(...) {
throw std::runtime_error("CreateActor >> unexpected exception was caught!!!");
}
if (!CORBA::is_nil(theView3D)) {
VISU::View3D_i* pView = dynamic_cast<VISU::View3D_i*>(GetServant(theView3D).in());
SUIT_ViewWindow* aVW = pView->GetViewWindow();
- myView = VISU::GetViewWindow(aVW);
+ myView = dynamic_cast<SVTK_ViewWindow*>(aVW);
connect( myView, SIGNAL( destroyed() ), this, SLOT( onViewDeleted() ) );
}
//===========================================================================
// VISU namespace functions
//===========================================================================
- SVTK_ViewWindow* GetViewWindow (SUIT_ViewWindow* theStudyFrame)
+ vtkRenderer* GetRenderer (SUIT_ViewWindow* theViewWindow)
{
- return dynamic_cast<SVTK_ViewWindow*>(theStudyFrame);
- }
-
- vtkRenderer* GetRenderer (SUIT_ViewWindow* theStudyFrame)
- {
- return GetViewWindow(theStudyFrame)->getRenderer();
+ if (SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(theViewWindow))
+ return vw->getRenderer();
+ return NULL;
}
- vtkCamera* GetCamera (SUIT_ViewWindow* theStudyFrame)
+ vtkCamera* GetCamera (SUIT_ViewWindow* theViewWindow)
{
- return GetRenderer(theStudyFrame)->GetActiveCamera();
+ return GetRenderer(theViewWindow)->GetActiveCamera();
}
void RepaintView (SUIT_ViewWindow* theViewWindow)
{
- SVTK_ViewWindow* vf = GetViewWindow(theViewWindow);
- vf->getRenderer()->ResetCameraClippingRange();
- vf->getRenderWindow()->Render();
+ if (SVTK_ViewWindow* vf = dynamic_cast<SVTK_ViewWindow*>(theViewWindow)) {
+ vf->getRenderer()->ResetCameraClippingRange();
+ vf->getRenderWindow()->Render();
+ }
}
- VISU_Actor* UpdateViewer (SUIT_ViewWindow* theStudyFrame, int theDisplaing, Prs3d_i* thePrs)
+ VISU_Actor* UpdateViewer (SUIT_ViewWindow* theViewWindow, int theDisplaing, Prs3d_i* thePrs)
{
- SVTK_ViewWindow* vf = GetViewWindow(theStudyFrame);
+ SVTK_ViewWindow* vf = dynamic_cast<SVTK_ViewWindow*>(theViewWindow);
if (!vf) return NULL;
if(MYDEBUG) MESSAGE("UpdateViewer - theDisplaing = "<<theDisplaing<<"; thePrs = "<<thePrs);
vtkRenderer *aRen = vf->getRenderer();
}
}
if (aResActor) {
- RepaintView(theStudyFrame);
+ RepaintView(theViewWindow);
return aResActor;
}
if(thePrs != NULL && theDisplaing < eErase){
return NULL;
}
}
- RepaintView(theStudyFrame);
+ RepaintView(theViewWindow);
return anVISUActor;
}
SalomeApp_Application *myApplication;
};
- SVTK_ViewWindow* GetViewWindow (SUIT_ViewWindow* theStudyFrame);
- vtkRenderer* GetRenderer (SUIT_ViewWindow* theStudyFrame);
- vtkCamera* GetCamera (SUIT_ViewWindow* theStudyFrame);
+ vtkRenderer* GetRenderer (SUIT_ViewWindow* theViewWindow);
+ vtkCamera* GetCamera (SUIT_ViewWindow* theViewWindow);
- void RepaintView (SUIT_ViewWindow* theStudyFrame);
+ void RepaintView (SUIT_ViewWindow* theViewWindow);
enum Displaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll};
- VISU_Actor* UpdateViewer (SUIT_ViewWindow* theStudyFrame, int theDisplaing, Prs3d_i* thePrs = NULL);
+ VISU_Actor* UpdateViewer (SUIT_ViewWindow* theViewWindow, int theDisplaing, Prs3d_i* thePrs = NULL);
void UpdatePlot2d (Plot2d_ViewFrame *theView, int theDisplaying, Curve_i* theCurve);
VISU_Actor* GetActor (VISU::Prs3d_i* thePrs, SVTK_ViewWindow* theViewWindow);
{}
virtual void Execute()
{
- SVTK_ViewWindow* vf = VISU::GetViewWindow(myVW);
+ SVTK_ViewWindow* vf = dynamic_cast<SVTK_ViewWindow*>(myVW);
vtkRenderer* Renderer = vf->getRenderer();
vtkActorCollection* theActors = Renderer->GetActors();
theActors->InitTraversal();
Storable::DataToStream(theStr,"myParallelScale",GetParallelScale(theViewWindow));
double aScaleFactor[3];
- VISU::GetViewWindow(theViewWindow)->GetScale(aScaleFactor);
+ (dynamic_cast<SVTK_ViewWindow*>(theViewWindow))->GetScale(aScaleFactor);
Storable::DataToStream(theStr,"myScaleFactor[0]",aScaleFactor[0]);
Storable::DataToStream(theStr,"myScaleFactor[1]",aScaleFactor[1]);
Storable::DataToStream(theStr,"myScaleFactor[2]",aScaleFactor[2]);
aColor[1] = int(255.0*theColor.G);
aColor[2] = int(255.0*theColor.B);
QColor aNewColor (aColor[0],aColor[1],aColor[2]);
- VISU::GetViewWindow(theViewWindow)->setBackgroundColor(aNewColor);
+ (dynamic_cast<SVTK_ViewWindow*>(theViewWindow))->setBackgroundColor(aNewColor);
}
SALOMEDS::Color View3D_i::GetBackground (SUIT_ViewWindow* theViewWindow)
SUIT_ViewWindow* aVW = GetViewWindow();
if (aVW) {
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (VISU::GetViewWindow(aVW), &SVTK_ViewWindow::onFitAll));
+ (dynamic_cast<SVTK_ViewWindow*>(aVW), &SVTK_ViewWindow::onFitAll));
Update();
}
}
switch (theType) {
case VISU::View3D::FRONT :
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (VISU::GetViewWindow(aVW), &SVTK_ViewWindow::onFrontView));
+ (dynamic_cast<SVTK_ViewWindow*>(aVW), &SVTK_ViewWindow::onFrontView));
break;
case VISU::View3D::BACK :
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (VISU::GetViewWindow(aVW), &SVTK_ViewWindow::onBackView));
+ (dynamic_cast<SVTK_ViewWindow*>(aVW), &SVTK_ViewWindow::onBackView));
break;
case VISU::View3D::LEFT :
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onLeftView));
+ (dynamic_cast<SVTK_ViewWindow*>(aVW),&SVTK_ViewWindow::onLeftView));
break;
case VISU::View3D::RIGHT :
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onRightView));
+ (dynamic_cast<SVTK_ViewWindow*>(aVW),&SVTK_ViewWindow::onRightView));
break;
case VISU::View3D::TOP :
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onTopView));
+ (dynamic_cast<SVTK_ViewWindow*>(aVW),&SVTK_ViewWindow::onTopView));
break;
case VISU::View3D::BOTTOM :
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onBottomView));
+ (dynamic_cast<SVTK_ViewWindow*>(aVW),&SVTK_ViewWindow::onBottomView));
break;
}
Update();
void View3D_i::ScaleView (SUIT_ViewWindow* theViewWindow,
VISU::View3D::Axis theAxis, CORBA::Double theParam)
{
- SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(theViewWindow);
+ SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(theViewWindow);
double aScaleFactor[3];
aViewWindow->GetScale(aScaleFactor);
aScaleFactor[theAxis] = theParam;
void SetScaleView (SUIT_ViewWindow* theViewWindow, const CORBA::Double theScale[3])
{
double aScale[3] = {theScale[0], theScale[1], theScale[2]};
- VISU::GetViewWindow(theViewWindow)->SetScale(aScale);
+ (dynamic_cast<SVTK_ViewWindow*>(theViewWindow))->SetScale(aScale);
}
void View3D_i::ScaleView(VISU::View3D::Axis theAxis, CORBA::Double theParam)
SUIT_ViewWindow* aVW = GetViewWindow();
if (aVW) {
double aScale[3];
- VISU::GetViewWindow(aVW)->GetScale(aScale);
+ (dynamic_cast<SVTK_ViewWindow*>(aVW))->GetScale(aScale);
aScale[theAxis] = theParam;
ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,aVW,aScale));
}
-#include <qpopupmenu.h>
-#include <qcolordialog.h>
-
#include "VVTK_ViewModel.h"
-#include "VVTK_ViewWindow.h"
-
-#include "SVTK_View.h"
-#include "SVTK_MainWindow.h"
-#include "SVTK_RenderWindowInteractor.h"
-#include "VTKViewer_ViewModel.h"
+#include "VVTK_ViewWindow.h"
-//==========================================================
-VVTK_Viewer
-::VVTK_Viewer()
+VVTK_Viewer::
+VVTK_Viewer()
{
- myTrihedronSize = 105;
}
-VVTK_Viewer
-::~VVTK_Viewer()
-{}
-
-
-//==========================================================
-void
-VVTK_Viewer
-::setViewManager(SUIT_ViewManager* theViewManager)
+VVTK_Viewer::
+~VVTK_Viewer()
{
- SUIT_ViewModel::setViewManager(theViewManager);
-
- if ( !theViewManager )
- return;
-
- connect(theViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)),
- this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*)));
-
- connect(theViewManager, SIGNAL(mouseMove(SUIT_ViewWindow*, QMouseEvent*)),
- this, SLOT(onMouseMove(SUIT_ViewWindow*, QMouseEvent*)));
-
- connect(theViewManager, SIGNAL(mouseRelease(SUIT_ViewWindow*, QMouseEvent*)),
- this, SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*)));
}
-
//==========================================================
-SUIT_ViewWindow*
-VVTK_Viewer
-::createView( SUIT_Desktop* theDesktop )
+SUIT_ViewWindow*
+VVTK_Viewer::
+createView( SUIT_Desktop* theDesktop )
{
- TViewWindow* aViewWindow = new TViewWindow(theDesktop);
+ TViewWindow* aViewWindow = new TViewWindow (theDesktop);
aViewWindow->Initialize(this);
-
+
aViewWindow->setBackgroundColor( backgroundColor() );
aViewWindow->SetTrihedronSize( trihedronSize() );
return aViewWindow;
}
-
-
-//==========================================================
-void
-VVTK_Viewer
-::contextMenuPopup( QPopupMenu* thePopup )
-{
- thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) );
- thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_CHANGE_BACKGROUD" ), this, SLOT( onChangeBgColor() ) );
-
- thePopup->insertSeparator();
-
- if(TViewWindow* aView = dynamic_cast<TViewWindow*>(myViewManager->getActiveView())){
- if ( !aView->getMainWindow()->getToolBar()->isVisible() ){
- thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) );
- }
- }
-}
-
-
-//==========================================================
-void
-VVTK_Viewer
-::Repaint()
-{
- QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
- for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
- if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at(i))){
- aView->getMainWindow()->Repaint();
- }
- }
-}
-
-
-//==========================================================
-bool
-VVTK_Viewer
-::isVisible( const Handle(SALOME_InteractiveObject)& io )
-{
- QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
- for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)
- if(SUIT_ViewWindow* aViewWindow = aViews.at(i))
- if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViewWindow))
- if(!aView->getView()->isVisible( io ))
- return false;
-
- return true;
-}
-
-
-//==========================================================
-void
-VVTK_Viewer
-::onMousePress(SUIT_ViewWindow* vw, QMouseEvent* event)
-{}
-
-void
-VVTK_Viewer
-::onMouseMove(SUIT_ViewWindow* vw, QMouseEvent* event)
-{}
-
-void
-VVTK_Viewer
-::onMouseRelease(SUIT_ViewWindow* vw, QMouseEvent* event)
-{}
-
-
-//==========================================================
-QColor
-VVTK_Viewer
-::backgroundColor() const
-{
- return myBgColor;
-}
-
-void
-VVTK_Viewer
-::setBackgroundColor( const QColor& theColor )
-{
- if ( !theColor.isValid() )
- return;
-
- QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
- for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
- if(SUIT_ViewWindow* aViewWindow = aViews.at(i)){
- if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViewWindow)){
- aView->setBackgroundColor(theColor);
- }
- }
- }
-
- myBgColor = theColor;
-}
-
-//==========================================================
-int
-VVTK_Viewer
-::trihedronSize() const
-{
- return myTrihedronSize;
-}
-
-void
-VVTK_Viewer
-::setTrihedronSize( const int theSize )
-{
- myTrihedronSize = theSize;
- if(SUIT_ViewManager* aViewManager = getViewManager()){
- QPtrVector<SUIT_ViewWindow> aViews = aViewManager->getViews();
- for ( int i = 0; i < aViews.count(); i++ ){
- if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i ))){
- aView->getMainWindow()->SetTrihedronSize( theSize );
- }
- }
- }
-}
-
-//==========================================================
-void
-VVTK_Viewer
-::onDumpView()
-{
- if(SUIT_ViewWindow* aView = myViewManager->getActiveView())
- aView->onDumpView();
-}
-
-//==========================================================
-void
-VVTK_Viewer
-::onChangeBgColor()
-{
- if(SUIT_ViewWindow* aView = myViewManager->getActiveView()){
- QColor aColor = QColorDialog::getColor( backgroundColor(), aView);
- setBackgroundColor(aColor);
- }
-}
-
-//==========================================================
-void
-VVTK_Viewer
-::onShowToolbar()
-{
- QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
- for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
- if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at(i))){
- aView->getMainWindow()->getToolBar()->show();
- }
- }
-}
-
#include <qcolor.h>
#include "VVTK.h"
-#include "SVTK_ViewModelBase.h"
-
-#include "SALOME_Prs.h"
-#include "SALOME_InteractiveObject.hxx"
+#include "SVTK_ViewModel.h"
class VVTK_ViewWindow;
-//! Extends two interfaces #SVTK_ViewModelBase and #SALOME_View
-class VVTK_EXPORT VVTK_Viewer : public SVTK_ViewModelBase, public SALOME_View
+//! VVTK View Model
+class VVTK_EXPORT VVTK_Viewer : public SVTK_Viewer
{
Q_OBJECT;
VVTK_Viewer();
virtual ~VVTK_Viewer();
- //! Redefine SUIT_ViewModel::createView
+ //! See #SUIT_ViewModel::createView
virtual SUIT_ViewWindow* createView(SUIT_Desktop*);
- //! Redefine SUIT_ViewModel::setViewManager
- virtual void setViewManager(SUIT_ViewManager* theViewManager);
- //! Redefine SUIT_ViewModel::contextMenuPopup
- virtual void contextMenuPopup( QPopupMenu* );
//! See SUIT_ViewModel::getType
virtual QString getType() const { return Type(); }
-
- //! Redefine SALOME_View::Repaint
- virtual void Repaint();
-
- //! Redefine SALOME_View::isVisible
- virtual bool isVisible( const Handle(SALOME_InteractiveObject)& );
-
- //! Get background color of the viewer
- QColor backgroundColor() const;
-
- //! Set background color to the viewer
- void setBackgroundColor( const QColor& );
-
- //! Get size of trihedron of the viewer (see SVTK_Renderer::SetTrihedronSize)
- int trihedronSize() const;
-
- //! Set size of trihedron of the viewer (see SVTK_Renderer::SetTrihedronSize)
- void setTrihedronSize( const int );
-
-protected slots:
- void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
- void onMouseMove(SUIT_ViewWindow*, QMouseEvent*);
- void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
-
- void onDumpView();
- void onShowToolbar();
- void onChangeBgColor();
-
-private:
- QColor myBgColor;
- int myTrihedronSize;
- bool mySelectionEnabled;
- bool myMultiSelectionEnabled;
};
#endif