From: dmv Date: Mon, 14 Apr 2008 16:17:20 +0000 (+0000) Subject: NPAL 13444 Correct bug with show/hide, Correct DumpPython case, Improve PopupMenu... X-Git-Tag: V4_1_2rc1~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f291ec99e8fcaf7284b69f7e42b2f608c42c024c;p=modules%2Fvisu.git NPAL 13444 Correct bug with show/hide, Correct DumpPython case, Improve PopupMenu Options and behaviuor. --- diff --git a/src/OBJECT/VISU_Actor.cxx b/src/OBJECT/VISU_Actor.cxx index e7200e45..a8f45023 100644 --- a/src/OBJECT/VISU_Actor.cxx +++ b/src/OBJECT/VISU_Actor.cxx @@ -166,43 +166,6 @@ VISU_Actor return myPrs3d; } -//---------------------------------------------------------------------------- -/*VISU::TActorFactory* -VISU_Actor -::GetFactory() -{ - return myActorFactory; -}*/ - -/*void -VISU_Actor -::SetFactory(VISU::TActorFactory* theActorFactory) -{ - using namespace VISU; - - if(myActorFactory == theActorFactory) - return; - - if(theActorFactory) - myDestroySignal.connect(boost::bind(&TActorFactory::RemoveActor, - theActorFactory, - _1)); - - myActorFactory = theActorFactory; -}*/ - -//---------------------------------------------------------------------------- -/*void -VISU_Actor -::UpdateFromFactory() -{ - if(myUpdateFromFactoryTime.GetMTime() < myActorFactory->GetMTime()){ - myUpdateFromFactoryTime.Modified(); - myActorFactory->UpdateActor(this); - Update(); - } -}*/ - void VISU_Actor ::RemoveFromRender() diff --git a/src/OBJECT/VISU_ActorBase.cxx b/src/OBJECT/VISU_ActorBase.cxx index 812f790d..846f8060 100644 --- a/src/OBJECT/VISU_ActorBase.cxx +++ b/src/OBJECT/VISU_ActorBase.cxx @@ -30,11 +30,31 @@ #include "VISU_ActorFactory.h" #include +#include +#include +#include +#include +#include +#include + +#include "utilities.h" + +#include "VTKViewer_ShrinkFilter.h" + + #include VISU_ActorBase -::VISU_ActorBase() +::VISU_ActorBase() : + myIsShrinkable(true), + myIsShrunk(false), + myShrinkFilter(VTKViewer_ShrinkFilter::New()) { + myShrinkFilter->Delete(); + + myStoreMapping = true; + + myShrinkFilter->SetStoreMapping(true); } @@ -80,3 +100,67 @@ VISU_ActorBase } } +//-------------------------------------------------------------------------- + +void +VISU_ActorBase +::SetLineWidth(vtkFloatingPointType theLineWidth) +{ + GetProperty()->SetLineWidth(theLineWidth); +} + +vtkFloatingPointType +VISU_ActorBase +::GetLineWidth() +{ + return GetProperty()->GetLineWidth(); +} + +//-------------------------------------------------------------------------- +void +VISU_ActorBase +::SetRepresentation(int theMode) +{ + Superclass::SetRepresentation(theMode); + if(myRepresentation == VTK_POINTS) + UnShrink(); +} + +//---------------------------------------------------------------------------- +void VISU_ActorBase::SetShrink() +{ + if(!myIsShrinkable) + return; + if(vtkDataSet* aDataSet = myPassFilter[0]->GetOutput()){ + myShrinkFilter->SetInput(aDataSet); + myPassFilter[1]->SetInput(myShrinkFilter->GetOutput()); + myIsShrunk = true; + } +} + +void VISU_ActorBase::UnShrink() +{ + if(!myIsShrunk) + return; + if(vtkDataSet* aDataSet = myPassFilter[0]->GetOutput()){ + myPassFilter[1]->SetInput(aDataSet); + myPassFilter[1]->Modified(); + myIsShrunk = false; + Modified(); + } +} + +bool VISU_ActorBase::IsShrunk() +{ + return myIsShrunk; +} + +void VISU_ActorBase::SetShrinkable(bool theIsShrinkable) +{ + myIsShrinkable = theIsShrinkable; +} + +bool VISU_ActorBase::IsShrunkable() +{ + return myIsShrinkable; +} diff --git a/src/OBJECT/VISU_ActorBase.h b/src/OBJECT/VISU_ActorBase.h index 84909cbe..6904b15f 100644 --- a/src/OBJECT/VISU_ActorBase.h +++ b/src/OBJECT/VISU_ActorBase.h @@ -32,6 +32,8 @@ #include "SALOME_Actor.h" #include "VISU_BoostSignals.h" +class VTKViewer_ShrinkFilter; + #ifdef _WIN32 #define VTKOCC_EXPORT __declspec (dllexport) #else @@ -54,18 +56,26 @@ class VTKOCC_EXPORT VISU_ActorBase: public SALOME_Actor, vtkTypeMacro(VISU_ActorBase, SALOME_Actor); //---------------------------------------------------------------------------- - VISU::TActorFactory* - GetFactory(); - - virtual - void - SetFactory(VISU::TActorFactory* theActorFactory); + VISU::TActorFactory* GetFactory(); + virtual void SetFactory(VISU::TActorFactory* theActorFactory); //---------------------------------------------------------------------------- - virtual - void - UpdateFromFactory(); + virtual void UpdateFromFactory(); + + //---------------------------------------------------------------------------- + + virtual void SetLineWidth(vtkFloatingPointType theLineWidth); + virtual vtkFloatingPointType GetLineWidth(); + + virtual void SetShrink(); + virtual void UnShrink(); + virtual bool IsShrunkable(); + virtual bool IsShrunk(); + virtual void SetShrinkable(bool theIsShrinkable); + + virtual void SetRepresentation(int theMode); + protected: VISU_ActorBase(); virtual ~VISU_ActorBase(); @@ -73,6 +83,11 @@ class VTKOCC_EXPORT VISU_ActorBase: public SALOME_Actor, VISU::TActorFactory* myActorFactory; vtkTimeStamp myUpdateFromFactoryTime; boost::signal1 myDestroySignal; + + vtkSmartPointer myShrinkFilter; + + bool myIsShrinkable; + bool myIsShrunk; }; #endif //VISU_ACTOR_BASE_H diff --git a/src/OBJECT/VISU_PointMap3dActor.cxx b/src/OBJECT/VISU_PointMap3dActor.cxx index 5fc9a53b..ec57b21d 100644 --- a/src/OBJECT/VISU_PointMap3dActor.cxx +++ b/src/OBJECT/VISU_PointMap3dActor.cxx @@ -31,10 +31,16 @@ #include "VISU_ScalarBarActor.hxx" #include "VISU_DeformedGridPL.hxx" +#include "utilities.h" #include #include -//using namespace std; +#ifdef _DEBUG_ +static int MYDEBUG = 0; +#else +static int MYDEBUG = 0; +#endif + vtkStandardNewMacro(VISU_PointMap3dActor); //================================================================== @@ -45,6 +51,7 @@ vtkStandardNewMacro(VISU_PointMap3dActor); VISU_PointMap3dActor ::VISU_PointMap3dActor() { + if(MYDEBUG) MESSAGE("VISU_PointMap3dActor::VISU_PointMap3dActor - this = "<helpFileName = "viewing_3d_presentations_intro_page.html#width_opacity_anchor"; CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1")); CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2")); CursorDlg->SpinBox1->setMinValue(1); CursorDlg->SpinBox1->setMaxValue(10); - float oldlwid = anActor->GetLineWidth(); int intlwid = int(oldlwid); CursorDlg->SpinBox1->setValue(intlwid); - + int ret = CursorDlg->exec(); if (ret == 1) { intlwid = CursorDlg->SpinBox1->value(); float newlwid = intlwid; - anActor->SetLineWidth(newlwid); + if (isPrs3d) + anActor->SetLineWidth(newlwid); + else + anActorBase->SetLineWidth(newlwid); } delete CursorDlg; } @@ -1644,6 +1654,13 @@ VisuGUI aTable->SetName(Name.latin1(), true); break; } + case VISU::TPOINTMAP3D: { // Table object + if(VISU::PointMap3d_i* aTable3d = dynamic_cast(aBase)) { + aTable3d->SetTitle(Name); + aTable3d->UpdateActors(); + } + break; + } case VISU::TCONTAINER: { // Container object if(VISU::Container_i* aContainer = dynamic_cast(aBase)) aContainer->SetName(Name.latin1(), true); @@ -2021,6 +2038,9 @@ VisuGUI VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, anEntry); if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)) aDlg->addPresentation(aPrsObject); + else if (VISU::PointMap3d_i* aPrs = dynamic_cast(anObjectInfo.myBase)) { + aDlg->addPointMapPresentation(aPrs); + } } } if (aDlg->getPrsCount() > 0) @@ -2133,7 +2153,7 @@ VisuGUI tr("MEN_SHOW_TABLE"), "", 0, aParent, false, this, SLOT(OnShowTable())); - createAction( VISU_SHOW_TABLE_PLOT, tr("MEN_EDIT_PRS"), QIconSet(), + createAction( VISU_EDIT_POINTMAP3D, tr("MEN_EDIT_PRS"), QIconSet(), tr("MEN_EDIT_PRS"), "", 0, aParent, false, this, SLOT(OnShowTablePlot())); @@ -2511,6 +2531,7 @@ VisuGUI mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 ); mgr->insert( action( VISU_EDIT_SCALARMAPONDEFORMEDSHAPE ), -1, -1, -1 ); mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 ); + mgr->insert( action( VISU_EDIT_POINTMAP3D ), -1, -1, -1 ); // rename mgr->insert( action( VISU_RENAME ), -1, -1, -1 ); @@ -2522,9 +2543,9 @@ VisuGUI mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 ); // table commands - //mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table - //mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves - //mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table + mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table + mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves + mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table mgr->insert( separator(), -1, -1, -1 ); @@ -2615,17 +2636,17 @@ VisuGUI QString aTableOrCont = "(type='VISU::TTABLE' and nbChildren>0) or type='VISU::TCONTAINER'"; QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)"; QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")"; - QString aPrsVisible = "(($type in {'VISU::TMESH' " + aPrsAll + "}) and isVisible)"; - QString aPrsInvisible = "(($type in {'VISU::TMESH' " + aPrsAll + "})" + andInvisible + ")"; + QString aPrsVisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}) and isVisible)"; + QString aPrsInvisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "})" + andInvisible + ")"; QString aComponent = "( selcount=1 and canBeDisplayed and isVisuComponent )"; QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsVisible + " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveVisible + "))) ) or " + aComponent; QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsInvisible + - " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveInvisible + "))) ) or" + aComponent; + " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveInvisible + "))) ) or " + aComponent; - QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' " + aPrsAll + "})" + QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "})" " or (client='ObjectBrowser' and ((type='VISU::TTABLE' and nbChildren>0) or" " ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'})))) ) or" + aComponent; @@ -2633,7 +2654,7 @@ VisuGUI mgr->setRule( action( VISU_DISPLAY ), aDisplayRule, true ); mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule, true ); - aRule = "selcount>0 and $type in {'VISU::TMESH' " + aPrsAll + "}"; + aRule = "selcount>0 and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}"; mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule, true ); aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}"; @@ -2650,14 +2671,15 @@ VisuGUI mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'VVTK'} and selcount=0", true ); // 3D presentations commands - QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}"; + QString aPrsType = " and $type in {'VISU::TMESH'" + aPrsAll + "}"; + QString aPrsType2 = " and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}"; QString anInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}"; QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}"; QString aSurfType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' " - " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}"; - QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}"; + " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TPOINTMAP3D'}"; + QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TPOINTMAP3D'}"; QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' " - "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' }"; + "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TPOINTMAP3D'}"; aRule = "selcount=1"; mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType, true ); @@ -2670,7 +2692,7 @@ VisuGUI QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}"; mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints, true ); - mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType + aNotWirefr, true ); + mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType2 + aNotWirefr, true ); mgr->setRule( action( VISU_SURFACE ) , aRule + aSurfType + aNotSurfac, true ); mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + anInsideType + aNotInside, true ); mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfFrameType + aNotSurffr, true ); @@ -2688,23 +2710,28 @@ VisuGUI " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) " "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))", true ); mgr->setRule( action( VISU_OPACITY ), aRule + " and hasActor=1", true ); - mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1", true ); // rename command - QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'"; + QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::POINTMAP3D'"; - aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' 'VISU::TMESH' " + aCurveAll + " " + aPrsAll + "})"; + aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' 'VISU::TMESH' 'VISU::TPOINTMAP3D' " + aCurveAll + " " + aPrsAll + "})"; mgr->setRule( action( VISU_RENAME ), aRule, true ); // copy presentation command aRule = "selcount=1 and ($type in {" + aPrsAll + "})"; mgr->setRule( action( VISU_COPY_PRS ), aRule, true ); - // curve commands + // Curve commands aRule = "selcount=1 and type='VISU::TCURVE'"; mgr->setRule( action( VISU_CURVE_PROPS ), aRule, true ); + // Table Commands + aRule = "selcount=1 and ( type='VISU::TPOINTMAP3D' or type='VISU::TTABLE')"; + mgr->setRule( action( VISU_SHOW_TABLE ), aRule, true ); + mgr->setRule( action( VISU_CREATE_CURVES ), aRule, true ); + mgr->setRule( action( VISU_EXPORT_TABLE ), aRule, true ); + // curve container commands aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'"; mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule, true ); @@ -2728,6 +2755,8 @@ VisuGUI "selcount=1 and type='VISU::TSTREAMLINES'", true ); mgr->setRule( action( VISU_EDIT_PLOT3D ), "selcount=1 and type='VISU::TPLOT3D'", true ); + mgr->setRule( action( VISU_EDIT_POINTMAP3D ), + "selcount=1 and type='VISU::TPOINTMAP3D'", true ); aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0"; mgr->setRule( action( VISU_CREATE_TABLE ), aRule, true ); @@ -2901,21 +2930,11 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q action( VISU_SHOW_ANIMATION )->addTo(theMenu); } else if (isOBClient) { if (IsSObjectTable(aSObject)) { - action( VISU_DELETE_OBJS )->removeFrom(theMenu); - if (aType == VISU::TPOINTMAP3D) { - action( VISU_SHOW_TABLE_PLOT )->addTo(theMenu); - theMenu->insertSeparator(); - action( VISU_ERASE )->addTo(theMenu); - action( myEraseAll )->addTo(theMenu); - action( VISU_DISPLAY )->addTo(theMenu); - action( VISU_DISPLAY_ONLY )->addTo(theMenu); - theMenu->insertSeparator(); - } - action( VISU_SHOW_TABLE )->addTo(theMenu); + /* action( VISU_SHOW_TABLE )->addTo(theMenu); action( VISU_CREATE_CURVES )->addTo(theMenu); action( VISU_EXPORT_TABLE )->addTo(theMenu); theMenu->insertSeparator(); - action( VISU_DELETE_OBJS )->addTo(theMenu); + action( VISU_DELETE_OBJS )->addTo(theMenu);*/// dmv - code was moved up } else { if (!CORBA::is_nil(anObject)) { SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject); @@ -2937,17 +2956,6 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q } } } - } else { - if (aType == VISU::TPOINTMAP3D) { - action( myEraseAll )->removeFrom(theMenu); - action( VISU_SHOW_TABLE_PLOT )->addTo(theMenu); - theMenu->insertSeparator(); - action( VISU_ERASE )->addTo(theMenu); - action( myEraseAll )->addTo(theMenu); - action( VISU_DISPLAY )->addTo(theMenu); - action( VISU_DISPLAY_ONLY )->addTo(theMenu); - theMenu->insertSeparator(); - } } } diff --git a/src/VISUGUI/VisuGUI_ActionsDef.h b/src/VISUGUI/VisuGUI_ActionsDef.h index d69d1c46..f1115b74 100644 --- a/src/VISUGUI/VisuGUI_ActionsDef.h +++ b/src/VISUGUI/VisuGUI_ActionsDef.h @@ -45,7 +45,7 @@ #define VISU_DELETE_OBJS 4022 #define VISU_SHOW_TABLE 4023 -#define VISU_SHOW_TABLE_PLOT 4029 +#define VISU_EDIT_POINTMAP3D 4029 #define VISU_CREATE_CURVES 4024 #define VISU_EXPORT_TABLE 4025 diff --git a/src/VISUGUI/VisuGUI_Displayer.cxx b/src/VISUGUI/VisuGUI_Displayer.cxx index e60a7e94..79533348 100644 --- a/src/VISUGUI/VisuGUI_Displayer.cxx +++ b/src/VISUGUI/VisuGUI_Displayer.cxx @@ -92,11 +92,19 @@ SALOME_Prs* VisuGUI_Displayer::buildPresentation( const QString& theEntry, SALOM aPrs3d = dynamic_cast(VISU::GetServant(aColoredPrs3d).in()); }else if (aType == VISU::TPOINTMAP3D) { VISU::PointMap3d_i* aTable3d = dynamic_cast(aBaseServant); - VISU_PointMap3dActor* aPointMap3dActor = aTable3d->CreateActor(); - if (aPointMap3dActor) { - aViewWindow->AddActor(aPointMap3dActor); + VISU_ActorBase* anActorBase = VISU::FindActorBase(aViewWindow, aTable3d); + if (anActorBase) { + anActorBase->SetVisibility(true); aViewWindow->Repaint(); } + else { + VISU_PointMap3dActor* aPointMap3dActor = aTable3d->CreateActor(); + if (aPointMap3dActor) { + aViewWindow->AddActor(aPointMap3dActor); + aPointMap3dActor->SetVisibility(true); + aViewWindow->Repaint(); + } + } } else aPrs3d = dynamic_cast(aBaseServant); @@ -281,6 +289,9 @@ bool VisuGUI_Displayer::canBeDisplayed( const QString& entry, const QString& vie if(aBase->GetType() == VISU::TCOLOREDPRS3DHOLDER) return true; + if(aBase->GetType() == VISU::TPOINTMAP3D) + return dynamic_cast(aBase); + return dynamic_cast(aBase); } else if( viewer_type==SPlot2d_Viewer::Type() ) diff --git a/src/VISUGUI/VisuGUI_OffsetDlg.cxx b/src/VISUGUI/VisuGUI_OffsetDlg.cxx index 5ef2cbfb..4ae427de 100644 --- a/src/VISUGUI/VisuGUI_OffsetDlg.cxx +++ b/src/VISUGUI/VisuGUI_OffsetDlg.cxx @@ -58,6 +58,7 @@ VisuGUI_OffsetDlg::VisuGUI_OffsetDlg (VisuGUI* theModule) myModule(theModule) { myPrsList.setAutoDelete(false); + myPointMapList.setAutoDelete(false); setName("VisuGUI_OffsetDlg"); setCaption(tr("TIT_OFFSETDLG")); @@ -148,6 +149,22 @@ void VisuGUI_OffsetDlg::addPresentation (VISU::Prs3d_i* thePrs) } } +void VisuGUI_OffsetDlg::addPointMapPresentation (VISU::PointMap3d_i* thePrs) +{ + myPointMapList.append(thePrs); + + CORBA::Float anOffset[3]; + thePrs->GetOffset(anOffset[0],anOffset[1],anOffset[2]); + OffsetStruct anOffs(anOffset[0],anOffset[1],anOffset[2]); + myOldPointMapOffsets.append(anOffs); + if (myPointMapList.count() == 1) { + setOffset(anOffs.myOffset); + } else if (myPointMapList.count() == 2) { + OffsetStruct anOffs; + setOffset(anOffs.myOffset); + } +} + void VisuGUI_OffsetDlg::setOffset (const vtkFloatingPointType* theOffset) { myDxEdt->setValue(theOffset[0]); @@ -182,7 +199,7 @@ void VisuGUI_OffsetDlg::updateOffset (VISU::Prs3d_i* thePrs, vtkFloatingPointTyp if (myPrsList.count() == 0) return; - if (isToSave()) + if (isToSave()) thePrs->SetOffset(theOffset[0],theOffset[1],theOffset[2]); ViewManagerList aViewManagerList; @@ -209,6 +226,38 @@ void VisuGUI_OffsetDlg::updateOffset (VISU::Prs3d_i* thePrs, vtkFloatingPointTyp } } +void VisuGUI_OffsetDlg::updatePointMapOffset (VISU::PointMap3d_i* thePrs, vtkFloatingPointType* theOffset) +{ + if (myPointMapList.count() == 0) + return; + + if (isToSave()) + thePrs->SetOffset(theOffset[0],theOffset[1],theOffset[2]); + + ViewManagerList aViewManagerList; + SalomeApp_Application* anApp = myModule->getApp(); + anApp->viewManagers(aViewManagerList); + QPtrListIterator anVMIter (aViewManagerList); + for (; anVMIter.current(); ++anVMIter) { + SUIT_ViewManager* aViewManager = anVMIter.current(); + QPtrVector aViews = aViewManager->getViews(); + for (int i = 0, iEnd = aViews.size(); i < iEnd; i++) { + if (SUIT_ViewWindow* aViewWindow = aViews.at(i)) { + if (SVTK_ViewWindow* vw = dynamic_cast(aViewWindow)) { + vw->onAdjustTrihedron(); + + if (VISU_ActorBase* anActor = VISU::FindActorBase(vw, thePrs)) { + anActor->SetPosition(theOffset); + vw->highlight(thePrs->GetIO(), 1); + vw->getRenderer()->ResetCameraClippingRange(); + vw->Repaint(); + } + } + } + } + } +} + void VisuGUI_OffsetDlg::accept() { vtkFloatingPointType anOffset[3]; @@ -216,6 +265,9 @@ void VisuGUI_OffsetDlg::accept() for (int i = 0; i < myPrsList.count(); i++) { updateOffset(myPrsList.at(i), anOffset); } + for (int i = 0; i < myPointMapList.count(); i++) { + updatePointMapOffset(myPointMapList.at(i), anOffset); + } QDialog::accept(); } @@ -224,6 +276,9 @@ void VisuGUI_OffsetDlg::reject() for (int i = 0; i < myPrsList.count(); i++) { updateOffset(myPrsList.at(i), myOldOffsets[i].myOffset); } + for (int i = 0; i < myPointMapList.count(); i++) { + updatePointMapOffset(myPointMapList.at(i), myOldOffsets[i].myOffset); + } QDialog::reject(); } @@ -234,6 +289,9 @@ void VisuGUI_OffsetDlg::onApply() for (int i = 0; i < myPrsList.count(); i++) { updateOffset(myPrsList.at(i), anOffset); } + for (int i = 0; i < myPointMapList.count(); i++) { + updatePointMapOffset(myPointMapList.at(i), anOffset); + } } void VisuGUI_OffsetDlg::onHelp() diff --git a/src/VISUGUI/VisuGUI_OffsetDlg.h b/src/VISUGUI/VisuGUI_OffsetDlg.h index a1d67a51..901365ca 100644 --- a/src/VISUGUI/VisuGUI_OffsetDlg.h +++ b/src/VISUGUI/VisuGUI_OffsetDlg.h @@ -23,6 +23,7 @@ #include "VTKViewer.h" #include "VISU_Prs3d_i.hh" +#include "VISU_PointMap3d_i.hh" // QT Includes #include @@ -59,7 +60,8 @@ class VisuGUI_OffsetDlg: public QDialog ~VisuGUI_OffsetDlg() {}; void addPresentation (VISU::Prs3d_i* thePrs); - int getPrsCount() const { return myPrsList.count(); } + void addPointMapPresentation (VISU::PointMap3d_i* thePrs); + int getPrsCount() const { return myPrsList.count() + myPointMapList.count(); } void setOffset (const vtkFloatingPointType* theOffset); void getOffset (vtkFloatingPointType* theOffset) const; @@ -79,6 +81,7 @@ class VisuGUI_OffsetDlg: public QDialog private: void updateOffset (VISU::Prs3d_i* thePrs, vtkFloatingPointType* theOffset); + void updatePointMapOffset (VISU::PointMap3d_i* thePrs, vtkFloatingPointType* theOffset); VisuGUI * myModule; @@ -89,6 +92,9 @@ class VisuGUI_OffsetDlg: public QDialog QPtrList myPrsList; QValueList myOldOffsets; + + QPtrList myPointMapList; + QValueList myOldPointMapOffsets; }; #endif // DIALOGBOX_OFFSET_H diff --git a/src/VISUGUI/VisuGUI_PopupTools.cxx b/src/VISUGUI/VisuGUI_PopupTools.cxx index 84a63267..e20cf7c6 100644 --- a/src/VISUGUI/VisuGUI_PopupTools.cxx +++ b/src/VISUGUI/VisuGUI_PopupTools.cxx @@ -118,6 +118,7 @@ QString VisuGUI_Selection::type( const int ind ) const ENUM2STRING( aResStr, VISU::TSTREAMLINES ); ENUM2STRING( aResStr, VISU::TPLOT3D ); ENUM2STRING( aResStr, VISU::TANIMATION ); + ENUM2STRING( aResStr, VISU::TPOINTMAP3D ); } } @@ -382,11 +383,19 @@ struct TViewFunctor { VISU_Actor* anActor = NULL; VISU::Prs3d_i* aPrs3d = NULL; + VISU_ActorBase* anActorBase = NULL; + VISU::PointMap3d_i* aPointMap3d = NULL; SVTK_ViewWindow* aViewWindow = NULL; - if(!GetPrs3dSelectionInfo(theModule, theEntry, aPrs3d, aViewWindow, anActor)) - return QString(); - - return get(aPrs3d, aViewWindow, anActor); + if(GetPrs3dSelectionInfo(theModule, theEntry, aPrs3d, aViewWindow, anActor)) { + return get(aPrs3d, aViewWindow, anActor); + } else { + aViewWindow = GetActiveViewWindow(theModule); + VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule); + VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); + aPointMap3d = dynamic_cast(aSelectionItem.myObjectInfo.myBase); + anActorBase = VISU::FindActorBase(aViewWindow, aPointMap3d); + return getPointMap(aPointMap3d, aViewWindow, anActorBase); + } } QString @@ -397,6 +406,15 @@ struct TViewFunctor { return QString(); } + + QString + virtual + getPointMap(VISU::PointMap3d_i* thePrs3d, + SVTK_ViewWindow* theViewWindow, + VISU_ActorBase* theActor) + { + return QString(); + } }; @@ -419,6 +437,22 @@ struct TGetRepesentationFunctor: TViewFunctor } return aResStr; } + + QString + virtual + getPointMap(VISU::PointMap3d_i* thePrs3d, + SVTK_ViewWindow* theViewWindow, + VISU_ActorBase* theActorBase) + { + QString aResStr = ""; + if (theActorBase) { + switch (theActorBase->GetRepresentation()) { + ENUM2STRING( aResStr, VISU::WIREFRAME ); // = 1 + ENUM2STRING( aResStr, VISU::SHADED ); // = 2 + } + } + return aResStr; + } }; QString VisuGUI_Selection::representation( const int ind ) const @@ -502,6 +536,17 @@ struct TIsShrunkFunctor: TViewFunctor { return theActor->IsShrunk() ? "1" : "0"; } + + QString + virtual + getPointMap(VISU::PointMap3d_i* thePointMap, + SVTK_ViewWindow* theViewWindow, + VISU_ActorBase* theActorBase) + { + if (theActorBase) + return theActorBase->IsShrunk() ? "1" : "0"; + else return "0"; + } }; QString VisuGUI_Selection::isShrunk( const int ind ) const diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index 2156d7dd..ad54eec1 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -534,32 +534,58 @@ namespace VISU if(aSelectionInfo.empty()) return; + VISU::Prs3d_i* aPrs3d; + VISU::PointMap3d_i* aTable; + VISU_Actor* anActor; + VISU_ActorBase* anActorBase; + TSelectionItem aSelectionItem = aSelectionInfo.front(); - VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase); - if(!aPrs3d) - return; + aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase); + if(!aPrs3d) { + aTable = dynamic_cast(aSelectionItem.myObjectInfo.myBase); + if(!aTable) + return; + } SVTK_ViewWindow* aViewWindow = GetActiveViewWindow(theModule); if(!aViewWindow) return; - VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d); - if(!anActor) - return; + if (aPrs3d) { + anActor = FindActor(aViewWindow, aPrs3d); + if(!anActor) + return; + } else { + anActorBase = VISU::FindActorBase(aViewWindow, aTable); + if(!anActorBase) + return; + } switch (theType) { case VISU::SHRINK: + if (aPrs3d) { if (anActor->IsShrunk()) anActor->UnShrink(); else anActor->SetShrink(); + } else if (aTable) { + if (anActorBase->IsShrunk()) + anActorBase->UnShrink(); + else + anActorBase->SetShrink(); + } break; default: - if (VISU::Mesh_i* aMesh = dynamic_cast(aPrs3d)) { - aMesh->SetPresentationType(theType); - RecreateActor(theModule, aMesh); - } else { - anActor->SetRepresentation(theType); + if (aPrs3d) { + if (VISU::Mesh_i* aMesh = dynamic_cast(aPrs3d)) { + aMesh->SetPresentationType(theType); + RecreateActor(theModule, aMesh); + } else { + anActor->SetRepresentation(theType); + } + } + else if (aTable) { + anActorBase->SetRepresentation(theType); } } aViewWindow->Repaint(); @@ -725,6 +751,17 @@ namespace VISU return FindActor(theViewWindow, aPrs3d); } + //------------------------------------------------------------ + VISU_ActorBase* + FindActorBase(const SalomeApp_Study* theStudy, + SVTK_ViewWindow* theViewWindow, + const QString& theEntry) + { + TObjectInfo anObjectInfo = GetObjectByEntry(theStudy, theEntry); + VISU::PointMap3d_i* aTable = dynamic_cast(anObjectInfo.myBase); + return FindActorBase(theViewWindow, aTable); + } + //------------------------------------------------------------ void RecreateActor (const SalomeApp_Module* theModule, diff --git a/src/VISUGUI/VisuGUI_Tools.h b/src/VISUGUI/VisuGUI_Tools.h index aa795d80..c3f7c242 100644 --- a/src/VISUGUI/VisuGUI_Tools.h +++ b/src/VISUGUI/VisuGUI_Tools.h @@ -166,6 +166,9 @@ namespace VISU VISU_Actor* FindActor(const SalomeApp_Study* theStudy, SVTK_ViewWindow* theViewWindow, const QString& theEntry); + VISU_ActorBase* FindActorBase(const SalomeApp_Study* theStudy, + SVTK_ViewWindow* theViewWindow, + const QString& theEntry); void RecreateActor(const SalomeApp_Module* theModule, VISU::Prs3d_i* thePrs); diff --git a/src/VISUGUI/VisuGUI_TransparencyDlg.cxx b/src/VISUGUI/VisuGUI_TransparencyDlg.cxx index ca3d9f27..e8925f5e 100644 --- a/src/VISUGUI/VisuGUI_TransparencyDlg.cxx +++ b/src/VISUGUI/VisuGUI_TransparencyDlg.cxx @@ -220,6 +220,11 @@ void VisuGUI_TransparencyDlg::SetTransparency() VISU_Actor* anActor = VISU::FindActor(VISU::GetAppStudy(myModule), myViewWindow, anIO->getEntry()); if (anActor) anActor->SetOpacity(opacity); + else { + VISU_ActorBase* anActor = VISU::FindActorBase(VISU::GetAppStudy(myModule), myViewWindow, anIO->getEntry()); + if (anActor) + anActor->SetOpacity(opacity); + } } myViewWindow->Repaint(); } diff --git a/src/VISU_I/VISU_PointMap3d_i.cc b/src/VISU_I/VISU_PointMap3d_i.cc index 08a63604..77895bd6 100644 --- a/src/VISU_I/VISU_PointMap3d_i.cc +++ b/src/VISU_I/VISU_PointMap3d_i.cc @@ -21,7 +21,7 @@ // // // File : VISU_PointMap3d_i.cc -// Author : Vadim SANDLER +// Author : Dmitry Matveitchev // Module : VISU #include "VISU_PointMap3d_i.hh" @@ -50,9 +50,9 @@ #include #ifdef _DEBUG_ -static int MYDEBUG = 1; +static int MYDEBUG = 0; #else -static int MYDEBUG = 1; +static int MYDEBUG = 0; #endif //---------------------------------------------------------------- @@ -150,6 +150,17 @@ VISU::PointMap3d_i return anEntry.in(); } +//---------------------------------------------------------------------------- +Handle(SALOME_InteractiveObject) +VISU::PointMap3d_i +::GetIO() +{ + if( myIO.IsNull() ) + myIO = new SALOME_InteractiveObject(GetEntry().c_str(), "VISU", GetName().c_str()); + + return myIO; +} + //---------------------------------------------------------------------------- /*! Creates table3d object @@ -339,6 +350,10 @@ VISU_PointMap3dActor* VISU::PointMap3d_i::CreateActor() anActor->SetPipeLine(myTablePL); anActor->SetFactory(this); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + int aDispMode = aResourceMgr->integerValue("VISU", "point_map_represent", 2); + anActor->SetRepresentation(aDispMode); + Handle (SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(GetEntry().c_str(), "VISU", GetName().c_str()); anActor->setIO(anIO); diff --git a/src/VISU_I/VISU_PointMap3d_i.hh b/src/VISU_I/VISU_PointMap3d_i.hh index 99f55d2b..fdfcda32 100644 --- a/src/VISU_I/VISU_PointMap3d_i.hh +++ b/src/VISU_I/VISU_PointMap3d_i.hh @@ -69,6 +69,8 @@ namespace VISU virtual void Update(); + virtual Handle(SALOME_InteractiveObject) GetIO(); + //----------- override Prs3d methods ----------------------------- //! Move the 3D presentation according to the given offset parameters @@ -218,6 +220,8 @@ namespace VISU vtkTimeStamp myParamsTime; vtkTimeStamp myUpdateTime; + Handle(SALOME_InteractiveObject) myIO; + //Font management bool myIsBoldTitle; diff --git a/src/VISU_I/VISU_Table_i.cc b/src/VISU_I/VISU_Table_i.cc index 74bdb5af..064b7a0a 100644 --- a/src/VISU_I/VISU_Table_i.cc +++ b/src/VISU_I/VISU_Table_i.cc @@ -37,9 +37,9 @@ #include "VISU_ConvertorUtils.hxx" #ifdef _DEBUG_ -static int MYDEBUG = 1; +static int MYDEBUG = 0; #else -static int MYDEBUG = 1; +static int MYDEBUG = 0; #endif //---------------------------------------------------------------- // Table Object