X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FVISU_I%2FVISU_View_i.cc;h=d80850e79a849f5cf9f1cfc9a0927115c42cbaa2;hb=ba9e93f27d47a0ac9eaa884a753b5676da4e7168;hp=c25f276cce809eb36801d4754f736738ea40b2b1;hpb=716894d52739e56d77c5085e02b4cdfdbef60136;p=modules%2Fvisu.git diff --git a/src/VISU_I/VISU_View_i.cc b/src/VISU_I/VISU_View_i.cc index c25f276c..d80850e7 100644 --- a/src/VISU_I/VISU_View_i.cc +++ b/src/VISU_I/VISU_View_i.cc @@ -1,6 +1,6 @@ -// VISU OBJECT : interactive object for VISU entities implementation +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // // This library is free software; you can redistribute it and/or @@ -17,27 +17,31 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + +// VISU OBJECT : interactive object for VISU entities implementation // File : VISU_View_i.cc // Author : Alexey PETROV // Module : VISU - +// #include "VISU_View_i.hh" +#include "VISU_Tools.h" #include "VISU_Gen_i.hh" #include "VISU_Prs3d_i.hh" #include "VISU_Table_i.hh" +#include "VISU_PointMap3d_i.hh" #include "VISU_ScalarMap_i.hh" #include "VISU_ViewManager_i.hh" - -#include "VisuGUI_TableDlg.h" +#include "VISU_TableDlg.h" #include "VISU_Actor.h" #include "VISU_ScalarMapAct.h" +#include "VISU_PointMap3dActor.h" +#include "VISU_DeformedGridPL.hxx" -#include "SALOME_Event.hxx" +#include "SALOME_Event.h" #include "SUIT_ViewWindow.h" #include "SUIT_ViewManager.h" @@ -48,6 +52,7 @@ #include "SVTK_ViewWindow.h" #include "SVTK_ViewModel.h" +#include "VTKViewer_Algorithm.h" #include "SPlot2d_ViewModel.h" #include "Plot2d_ViewFrame.h" @@ -56,12 +61,14 @@ #include "SalomeApp_Study.h" #include +#include -#include -#include +#include +#include #include #include +#include using namespace std; @@ -147,20 +154,21 @@ namespace VISU { { switch(myViewRepresentation){ case VISU::View::OBJECTBROWSER: - myApplication->setWindowShown(SalomeApp_Application::WT_ObjectBrowser,myState); + myApplication->getWindow( SalomeApp_Application::WT_ObjectBrowser )->setVisible( myState ); break; case VISU::View::PYTHON: - myApplication->setWindowShown(SalomeApp_Application::WT_PyConsole,myState); + myApplication->getWindow( SalomeApp_Application::WT_PyConsole )->setVisible( myState ); break; case VISU::View::MESSAGES: - myApplication->setWindowShown(SalomeApp_Application::WT_LogWindow,myState); + myApplication->getWindow( SalomeApp_Application::WT_LogWindow )->setVisible( myState ); break; - case VISU::View::VIEWER:{ + case VISU::View::VIEWER: + { ViewManagerList mgrs = myApplication->viewManagers(); ViewManagerList::const_iterator anIt = mgrs.begin(), aLast = mgrs.end(); for( ; anIt!=aLast; anIt++ ) { - const QPtrVector& views = (*anIt)->getViews(); + const QVector& views = (*anIt)->getViews(); for( int i=0; isetShown( myState ); } @@ -191,22 +199,22 @@ namespace VISU { { switch(myViewRepresentation){ case VISU::View::OBJECTBROWSER: - myResult = myApplication->isWindowVisible(SalomeApp_Application::WT_ObjectBrowser); + myResult = myApplication->dockWindow( SalomeApp_Application::WT_ObjectBrowser )->isVisible(); break; case VISU::View::PYTHON: - myResult = myApplication->isWindowVisible(SalomeApp_Application::WT_PyConsole); + myResult = myApplication->dockWindow( SalomeApp_Application::WT_PyConsole )->isVisible(); break; case VISU::View::MESSAGES: - myResult = myApplication->isWindowVisible(SalomeApp_Application::WT_LogWindow); + myResult = myApplication->dockWindow( SalomeApp_Application::WT_LogWindow )->isVisible(); break; case VISU::View::VIEWER:{ ViewManagerList aViewManagerList = myApplication->viewManagers(); ViewManagerList::const_iterator anIt = aViewManagerList.begin(); for( ; anIt != aViewManagerList.end(); anIt++ ) { - const QPtrVector& views = (*anIt)->getViews(); + const QVector& views = (*anIt)->getViews(); for( int i=0; iisShown(); + myResult = views[i]->isVisible(); return; } } @@ -262,7 +270,7 @@ namespace VISU { SUIT_ViewWindow* aVW = GetViewWindow(); if (aVW) ProcessVoidEvent(new TSplitEvent(myApplication, aVW, - Qt::Horizontal, QtxWorkstack::SPLIT_MOVE)); + Qt::Horizontal, QtxWorkstack::SplitMove)); } void @@ -272,7 +280,7 @@ namespace VISU { SUIT_ViewWindow* aVW = GetViewWindow(); if (aVW) ProcessVoidEvent(new TSplitEvent(myApplication, aVW, - Qt::Horizontal, QtxWorkstack::SPLIT_STAY)); + Qt::Horizontal, QtxWorkstack::SplitStay)); } void @@ -282,7 +290,7 @@ namespace VISU { SUIT_ViewWindow* aVW = GetViewWindow(); if (aVW) ProcessVoidEvent(new TSplitEvent(myApplication, aVW, - Qt::Vertical, QtxWorkstack::SPLIT_MOVE)); + Qt::Vertical, QtxWorkstack::SplitMove)); } void @@ -292,7 +300,7 @@ namespace VISU { SUIT_ViewWindow* aVW = GetViewWindow(); if (aVW) ProcessVoidEvent(new TSplitEvent(myApplication, aVW, - Qt::Vertical, QtxWorkstack::SPLIT_STAY)); + Qt::Vertical, QtxWorkstack::SplitStay)); } void @@ -557,7 +565,7 @@ namespace VISU { void Execute() { - if (QWidget* aParent = myVW->parentWidget(true)) { + if (QWidget* aParent = myVW->parentWidget()) { QRect aQRect = aParent->frameGeometry(); (aQRect.*myAction)(mySize); aParent->setGeometry(aQRect); @@ -601,7 +609,7 @@ namespace VISU { void Execute() { - if(QWidget* aParent = myVW->parentWidget(true)){ + if(QWidget* aParent = myVW->parentWidget()){ QRect aQRect = aParent->frameGeometry(); myResult = (aQRect.*myAction)(); } @@ -642,12 +650,12 @@ namespace VISU { class TAlignEvent: public TWorkspaceEvent { protected: - Qt::AlignmentFlags myAligment; + Qt::AlignmentFlag myAligment; public: TAlignEvent(QWidget* theViewWindow, QWidget* theWorkspace, - Qt::AlignmentFlags theAligment): + Qt::AlignmentFlag theAligment): TWorkspaceEvent(theViewWindow,theWorkspace), myAligment(theAligment) {} @@ -656,7 +664,7 @@ namespace VISU { void Execute() { - if(QWidget* aParent = myVW->parentWidget(true)) + if(QWidget* aParent = myVW->parentWidget()) SUIT_Tools::alignWidget(aParent,myWorkspace,myAligment); } }; @@ -737,7 +745,7 @@ namespace VISU { void Execute() { - if(QWidget* aParent = myVW->parentWidget(true)) + if(QWidget* aParent = myVW->parentWidget()) aParent->move(int(myX*myWorkspace->width()),int(myY*myWorkspace->height())); } }; @@ -764,7 +772,7 @@ namespace VISU { void Execute() { - if(QWidget* aParent = myVW->parentWidget(true)) + if(QWidget* aParent = myVW->parentWidget()) aParent->setGeometry(aParent->x(), aParent->y(), int(myX*myWorkspace->width()), @@ -783,12 +791,12 @@ namespace VISU { { struct TEvent: public SALOME_Event { - QWidget* myWidget; + SVTK_ViewWindow* myVW; SALOMEDS::Color myColor; public: - TEvent(QWidget* theWidget, + TEvent(SVTK_ViewWindow* theViewWindow, const SALOMEDS::Color& theColor): - myWidget(theWidget), + myVW(theViewWindow), myColor(theColor) {} virtual void Execute(){ @@ -796,11 +804,12 @@ namespace VISU { aColor[0] = int(255.0*myColor.R); aColor[1] = int(255.0*myColor.G); aColor[2] = int(255.0*myColor.B); - myWidget->setBackgroundColor(QColor(aColor[0],aColor[1],aColor[2])); + QColor aNewColor (aColor[0],aColor[1],aColor[2]); + myVW->setBackgroundColor(aNewColor); } }; - - SUIT_ViewWindow* aVW = GetViewWindow(); + + SVTK_ViewWindow* aVW = dynamic_cast(GetViewWindow()); if (aVW) ProcessVoidEvent(new TEvent(aVW, theColor)); } @@ -808,22 +817,23 @@ namespace VISU { struct TBackgroundEvent: public SALOME_Event { - QWidget* myWidget; + SVTK_ViewWindow* myVW; typedef SALOMEDS::Color TResult; TResult myResult; - TBackgroundEvent(QWidget* theWidget): - myWidget(theWidget) + TBackgroundEvent(SVTK_ViewWindow* theViewWindow): + myVW(theViewWindow) {} virtual void Execute() { - const QColor& aColor = myWidget->backgroundColor(); - myResult.R = aColor.red()/255.0; - myResult.G = aColor.green()/255.0; - myResult.B = aColor.blue()/255.0; + vtkFloatingPointType backint[3]; + GetRenderer(myVW)->GetBackground(backint); + myResult.R = backint[0]; + myResult.G = backint[1]; + myResult.B = backint[2]; } }; @@ -831,7 +841,7 @@ namespace VISU { View_i:: GetBackground() { - SUIT_ViewWindow* aVW = GetViewWindow(); + SVTK_ViewWindow* aVW = dynamic_cast(GetViewWindow()); if (aVW) return ProcessEvent(new TBackgroundEvent(aVW)); @@ -920,11 +930,11 @@ namespace VISU { if (!img.isNull()) { QString fileName (myFileName); if (!fileName.isEmpty()) { - QString fmt = SUIT_Tools::extension(fileName).upper(); + QString fmt = SUIT_Tools::extension(fileName).toUpper(); if (fmt.isEmpty()) fmt = QString("BMP"); // default format if (fmt == "JPG" ) fmt = "JPEG"; //QApplication::setOverrideCursor(Qt::waitCursor); - img.save(fileName, fmt.latin1()); + img.save(fileName, fmt.toLatin1().data()); myResult = true; //QApplication::restoreOverrideCursor(); } @@ -954,8 +964,8 @@ namespace VISU { SUIT_ViewWindow* View_i::GetViewWindow() { if (myViewWindow) { - QPtrVector aViews = myViewManager->getViews(); - int aPos = aViews.find(myViewWindow); + QVector aViews = myViewManager->getViews(); + int aPos = aViews.indexOf(myViewWindow); if (aPos < 0) myViewWindow = NULL; } @@ -1043,16 +1053,23 @@ namespace VISU { ProcessVoidEvent(new TVoidMemFunEvent(myView,&Plot2d_ViewFrame::Repaint)); } + struct TCloseViewEvent: public SALOME_Event + { + SUIT_ViewWindow* myView; + TCloseViewEvent (SUIT_ViewWindow* theView): + myView(theView) + {} + + virtual void Execute() + { + if ( myView ) myView->close(); + } + }; + void XYPlot_i::Close() { - //jfa: may be need to be enclosed in SALOME_Event? - SUIT_ViewWindow* aVW = GetViewWindow(); - if (aVW) - aVW->close(); - //QPtrVector aViews = myViewManager->getViews(); - //int aPos = aViews.find(myViewWindow); - //if (aPos >= 0) - // myViewWindow->close(); + ProcessVoidEvent(new TCloseViewEvent(GetViewWindow())); + QApplication::sendPostedEvents(); } XYPlot_i::~XYPlot_i() { @@ -1064,13 +1081,13 @@ namespace VISU { SUIT_ViewWindow* aVW = GetViewWindow(); if (aVW) ProcessVoidEvent(new TVoidMemFun1ArgEvent - (aVW, &SUIT_ViewWindow::setCaption, QString(theTitle))); + (aVW, &SUIT_ViewWindow::setWindowTitle, QString(theTitle))); } char* XYPlot_i::GetTitle() { SUIT_ViewWindow* aVW = GetViewWindow(); if (aVW) - return CORBA::string_dup(aVW->caption().latin1()); + return CORBA::string_dup( aVW->windowTitle().toLatin1().data()); return CORBA::string_dup(""); } @@ -1084,7 +1101,7 @@ namespace VISU { char* XYPlot_i::GetSubTitle() { if (GetViewWindow()) - return CORBA::string_dup(myView->getTitle()); + return CORBA::string_dup(myView->getTitle().toLatin1().data()); return CORBA::string_dup(""); } @@ -1274,7 +1291,7 @@ namespace VISU { char* XYPlot_i::GetXTitle() { if (GetViewWindow()) - return CORBA::string_dup(myView->getTitle(Plot2d_ViewFrame::XTitle)); + return CORBA::string_dup(myView->getTitle(Plot2d_ViewFrame::XTitle).toLatin1().data()); return CORBA::string_dup(""); } @@ -1286,7 +1303,7 @@ namespace VISU { char* XYPlot_i::GetYTitle() { if (GetViewWindow()) - return CORBA::string_dup(myView->getTitle(Plot2d_ViewFrame::YTitle)); + return CORBA::string_dup(myView->getTitle(Plot2d_ViewFrame::YTitle).toLatin1().data()); return CORBA::string_dup(""); } @@ -1318,17 +1335,23 @@ namespace VISU { virtual void Execute() { + Qtx::VisibilityState state = (myDisplaing == eDisplay ||myDisplaing == eDisplayOnly) ? + Qtx::ShownState : Qtx::HiddenState; // is it Curve ? if (Curve_i* aCurve = dynamic_cast(VISU::GetServant(myPrsObj).in())) { - UpdatePlot2d(myView,myDisplaing,aCurve); + UpdatePlot2d(aCurve,myDisplaing,myView); + VISU::SetVisibilityState(aCurve->GetEntry(),state); + VISU::CurveVisibilityChanged(aCurve, myDisplaing , false, true, true); } // is it Container ? if (Container_i* aContainer = dynamic_cast(VISU::GetServant(myPrsObj).in())) { + VISU::SetVisibilityState(aContainer->GetEntry(),state); int nbCurves = aContainer->GetNbCurves(); for ( int i = 1; i <= nbCurves; i++ ) { VISU::Curve_i* aCurve = aContainer->GetCurve( i ); if ( aCurve && aCurve->IsValid() ) { - UpdatePlot2d(myView,myDisplaing,aCurve); + UpdatePlot2d(aCurve,myDisplaing,myView); + VISU::CurveVisibilityChanged(aCurve, myDisplaing , true, true, true); } } myView->Repaint(); @@ -1349,12 +1372,15 @@ namespace VISU { CORBA::Object_var childObject = VISU::ClientSObjectToObject(Iter->Value()); if (!CORBA::is_nil(childObject)) { CORBA::Object_ptr aCurve = VISU::Curve::_narrow(childObject); - if (!CORBA::is_nil(aCurve)) - UpdatePlot2d(myView, myDisplaing, - dynamic_cast(VISU::GetServant(aCurve).in())); + if (!CORBA::is_nil(aCurve)) { + Curve_i* crv = dynamic_cast(VISU::GetServant(aCurve).in()); + UpdatePlot2d(crv, myDisplaing, myView); + VISU::CurveVisibilityChanged(crv, myDisplaing , true, false, true); + } } } myView->Repaint(); + VISU::SetVisibilityState(aTable->GetEntry(),state); } } } @@ -1455,7 +1481,7 @@ namespace VISU { SalomeApp_Application* myApplication; VISU::Table_i* myTable; - typedef VisuGUI_TableDlg* TResult; + typedef VISU_TableDlg* TResult; TResult myResult; TCreateTableViewEvent (SalomeApp_Application* theApplication, @@ -1473,15 +1499,13 @@ namespace VISU { if (SUIT_Study* aSStudy = myApplication->activeStudy()) { if (SalomeApp_Study* aStudy = dynamic_cast(aSStudy)) { if (_PTR(Study) aCStudy = aStudy->studyDS()) { - _PTR(SObject) aSObject = aCStudy->FindObjectID(myTable->GetObjectEntry()); - if (aSObject) { - myResult = new VisuGUI_TableDlg (myApplication->desktop(), - aSObject, - false, - VisuGUI_TableDlg::ttAuto, - Qt::Vertical); - myResult->show(); - } + myResult = new VISU_TableDlg (myApplication->desktop(), + aCStudy, + myTable, + false, + VISU_TableDlg::ttAuto, + Qt::Vertical); + myResult->show(); } } } @@ -1512,14 +1536,14 @@ namespace VISU { void TableView_i::SetTitle (const char* theTitle) { - ProcessVoidEvent(new TVoidMemFun1ArgEvent - (myView, &VisuGUI_TableDlg::setCaption, QString(theTitle))); + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (myView, &VISU_TableDlg::setWindowTitle, QString(theTitle))); } char* TableView_i::GetTitle() { //jfa: may be need to be enclosed in SALOME_Event? - return CORBA::string_dup(myView->caption().latin1()); + return CORBA::string_dup(myView->windowTitle().toLatin1().data()); } void TableView_i::Close() @@ -1622,10 +1646,11 @@ namespace VISU { { SVTK_ViewWindow* aViewWindow = dynamic_cast(myViewWindow); vtkRenderer* aRenderer = aViewWindow->getRenderer(); - vtkActorCollection* anActors = aRenderer->GetActors(); + VTK::ActorCollectionCopy aCopy(aRenderer->GetActors()); + vtkActorCollection* anActors = aCopy.GetActors(); anActors->InitTraversal(); while (vtkActor *anAct = anActors->GetNextActor()) { - if (VISU_Actor* anActor = dynamic_cast(anAct)) { + if (VISU_ActorBase* anActor = dynamic_cast(anAct)) { if (anActor->GetVisibility()) anActor->UpdateFromFactory(); } @@ -1729,7 +1754,7 @@ namespace VISU { string anEntry = anObj->GetID(); if (MYDEBUG) MESSAGE("View3D_i::RestoreViewPoint - anEntry = " << anEntry); Storable::TRestoringMap aMap = Storable::GetStorableMap(anObj); - if (Storable::FindValue(aMap, "myComment") == View3D_i::myComment) { + if (Storable::FindValue(aMap, "myComment") == View3D_i::myComment.c_str()) { Restore(theViewManager->getActiveView(), aMap); return true; } @@ -1856,16 +1881,10 @@ namespace VISU { void View3D_i::Close() { - //jfa: may be need to be enclosed in SALOME_Event? - SUIT_ViewWindow* aVW = GetViewWindow(); - if (aVW) - aVW->close(); - //QPtrVector aViews = myViewManager->getViews(); - //int aPos = aViews.find(myViewWindow); - //if (aPos >= 0) - // myViewWindow->close(); + ProcessVoidEvent(new TCloseViewEvent(GetViewWindow())); + QApplication::sendPostedEvents(); } - + View3D_i::~View3D_i() { if(MYDEBUG) MESSAGE("View3D_i::~View3D_i"); @@ -1876,14 +1895,14 @@ namespace VISU { SUIT_ViewWindow* aVW = GetViewWindow(); if (aVW) ProcessVoidEvent(new TVoidMemFun1ArgEvent - (aVW,&SUIT_ViewWindow::setCaption,QString(theTitle))); + (aVW,&SUIT_ViewWindow::setWindowTitle,QString(theTitle))); } char* View3D_i::GetTitle() { SUIT_ViewWindow* aVW = GetViewWindow(); if (aVW) - return CORBA::string_dup(aVW->caption().latin1()); + return CORBA::string_dup(aVW->windowTitle().toLatin1().data()); return CORBA::string_dup(""); } @@ -1926,6 +1945,27 @@ namespace VISU { } }; + class TDisplayTableEvent: public SALOME_Event + { + SUIT_ViewWindow* myVW; + PointMap3d_i* myTable; + int myDisplaying; + public: + TDisplayTableEvent( SUIT_ViewWindow* theView, + PointMap3d_i* theTable, + int theDisplaying ) : + myVW (theView), + myTable (theTable), + myDisplaying (theDisplaying) + {} + virtual void Execute() { + SVTK_ViewWindow* aViewWindow = dynamic_cast(myVW); + VISU_PointMap3dActor* anActor = myTable->CreateActor(); + myTable->UpdateActor( anActor ); + aViewWindow->AddActor( anActor ); + } + }; + void View3D_i::EraseAll() { if(MYDEBUG) MESSAGE("View3D_i::EraseAll"); @@ -1957,9 +1997,14 @@ namespace VISU { if(MYDEBUG) MESSAGE("View3D_i::Display"); SUIT_ViewWindow* aVW = GetViewWindow(); CORBA::Object_ptr anObj = thePrsObj; - Prs3d_i* aPrs = dynamic_cast(VISU::GetServant(anObj).in()); + Prs3d_i* aPrs = dynamic_cast(VISU::GetServant(anObj).in()); if (aVW && aPrs) ProcessVoidEvent(new TUpdateViewerEvent(aVW,aPrs,eDisplay)); + else if (aVW && !aPrs) { + PointMap3d_i* aTable = dynamic_cast(VISU::GetServant(anObj).in()); + if (aTable) + ProcessVoidEvent(new TDisplayTableEvent(aVW, aTable, eDisplay)); + } } void View3D_i::DisplayOnly (PrsObject_ptr thePrsObj) @@ -1970,6 +2015,11 @@ namespace VISU { Prs3d_i* aPrs = dynamic_cast(VISU::GetServant(anObj).in()); if (aVW && aPrs) ProcessVoidEvent(new TUpdateViewerEvent(aVW,aPrs,eDisplayOnly)); + else if (aVW && !aPrs) { + PointMap3d_i* aTable = dynamic_cast(VISU::GetServant(anObj).in()); + if (aTable) + ProcessVoidEvent(new TDisplayTableEvent(aVW, aTable, eDisplayOnly)); + } } void View3D_i::FitAll() @@ -2337,21 +2387,33 @@ namespace VISU { myResult("Unknown error occured") {} virtual void Execute() { + VISU::VISUType aType = myPrs->GetType(); switch (myPrsType) { case VISU::INSIDEFRAME: { - VISU::VISUType aType = myPrs->GetType(); if (aType != VISU::TSCALARMAP && aType != VISU::TDEFORMEDSHAPE && - aType != VISU::TSCALARMAPONDEFORMEDSHAPE) { + aType != VISU::TSCALARMAPONDEFORMEDSHAPE && + aType != VISU::TDEFORMEDSHAPEANDSCALARMAP) { myResult = "Insideframe representation is not available for this type of presentations."; return; } } break; case VISU::SURFACEFRAME: - myResult = "Surfaceframe representation is available only for mesh presentation."; - return; + { + if (aType != VISU::TSCALARMAP && + aType != VISU::TDEFORMEDSHAPE && + aType != VISU::TSCALARMAPONDEFORMEDSHAPE && + aType != VISU::TDEFORMEDSHAPEANDSCALARMAP && + aType != VISU::TCUTPLANES && + aType != VISU::TISOSURFACES && + aType != VISU::TPLOT3D) { + myResult = "Surfaceframe representation is not available for this type of presentations."; + return; + } + } + break; case VISU::SHRINK: myResult = "Use SetShrinked() method to shrink/unshrink presentation."; return; @@ -2481,6 +2543,59 @@ namespace VISU { } }; + class TSetQuadratic2DPresentationTypeEvent: public TPrsManageEvent { + private: + Quadratic2DPresentationType myPrsType; + public: + typedef string TResult; + TResult myResult; + TSetQuadratic2DPresentationTypeEvent(View3D_i* theView3D, + ScalarMap_ptr thePrs, + Quadratic2DPresentationType theType): + TPrsManageEvent(theView3D, thePrs), myPrsType(theType), + myResult("Unknown error occured") + {} + virtual void Execute() + { + VISU::VISUType aType = myPrs->GetType(); + if (aType != VISU::TSCALARMAP && + aType != VISU::TDEFORMEDSHAPE && + aType != VISU::TSCALARMAPONDEFORMEDSHAPE && + aType != VISU::TDEFORMEDSHAPEANDSCALARMAP) { + myResult = "2D Quadratic element representation is not available for this type of presentations."; + return; + } + if (VISU_Actor* anActor = GetMyActor()) { + if(myPrsType == VISU::LINES) + anActor->SetQuadratic2DRepresentation(VISU_Actor::eLines); + else if(myPrsType == VISU::ARCS) + anActor->SetQuadratic2DRepresentation(VISU_Actor::eArcs); + + SVTK_ViewWindow* vw = dynamic_cast(myView3D->GetViewWindow()); + vw->Repaint(); + myResult = ""; + } else { + myResult = myError; + } + } + }; + + class TGetQuadratic2DPresentationTypeEvent: public TPrsManageEvent { + public: + typedef VISU::Quadratic2DPresentationType TResult; + TResult myResult; + TGetQuadratic2DPresentationTypeEvent(View3D_i* theView3D, ScalarMap_ptr thePrs): + TPrsManageEvent(theView3D, thePrs), myResult(VISU::LINES) {} + virtual void Execute() { + if (VISU_Actor* anActor = GetMyActor()) { + if(anActor->GetQuadratic2DRepresentation() == VISU_Actor::eLines) + myResult = VISU::LINES; + else if(anActor->GetQuadratic2DRepresentation() == VISU_Actor::eArcs) + myResult = VISU::ARCS; + } + } + }; + PresentationType View3D_i::GetPresentationType(ScalarMap_ptr thePrs) { return ProcessEvent(new TGetPrsTypeEvent(this,thePrs)); @@ -2502,6 +2617,11 @@ namespace VISU { return ProcessEvent(new TGetLineWidthEvent(this,thePrs)); } + Quadratic2DPresentationType View3D_i::GetQuadratic2DPresentationType(ScalarMap_ptr thePrs) + { + return ProcessEvent(new TGetQuadratic2DPresentationTypeEvent(this,thePrs)); + } + char* View3D_i::SetPresentationType(ScalarMap_ptr thePrs, PresentationType thePrsType) { string aRet = ProcessEvent(new TSetPrsTypeEvent(this,thePrs,thePrsType)); @@ -2527,4 +2647,12 @@ namespace VISU { string aRet = ProcessEvent(new TSetLineWidthEvent(this,thePrs,theLineWidth)); return CORBA::string_dup(aRet.c_str()); } + + char* View3D_i::SetQuadratic2DPresentationType(ScalarMap_ptr thePrs, Quadratic2DPresentationType theType) + { + string aRet = ProcessEvent(new TSetQuadratic2DPresentationTypeEvent(this,thePrs,theType)); + return CORBA::string_dup(aRet.c_str()); + } } + +