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()
#include "VISU_ActorFactory.h"
#include <vtkObjectFactory.h>
+#include <vtkProperty.h>
+#include <vtkPassThroughFilter.h>
+#include <vtkShrinkFilter.h>
+#include <vtkDataSet.h>
+#include <vtkShrinkPolyData.h>
+#include <vtkUnstructuredGrid.h>
+
+#include "utilities.h"
+
+#include "VTKViewer_ShrinkFilter.h"
+
+
#include <boost/bind.hpp>
VISU_ActorBase
-::VISU_ActorBase()
+::VISU_ActorBase() :
+ myIsShrinkable(true),
+ myIsShrunk(false),
+ myShrinkFilter(VTKViewer_ShrinkFilter::New())
{
+ myShrinkFilter->Delete();
+
+ myStoreMapping = true;
+
+ myShrinkFilter->SetStoreMapping(true);
}
}
}
+//--------------------------------------------------------------------------
+
+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;
+}
#include "SALOME_Actor.h"
#include "VISU_BoostSignals.h"
+class VTKViewer_ShrinkFilter;
+
#ifdef _WIN32
#define VTKOCC_EXPORT __declspec (dllexport)
#else
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();
VISU::TActorFactory* myActorFactory;
vtkTimeStamp myUpdateFromFactoryTime;
boost::signal1<void,VISU_ActorBase*> myDestroySignal;
+
+ vtkSmartPointer<VTKViewer_ShrinkFilter> myShrinkFilter;
+
+ bool myIsShrinkable;
+ bool myIsShrunk;
};
#endif //VISU_ACTOR_BASE_H
#include "VISU_ScalarBarActor.hxx"
#include "VISU_DeformedGridPL.hxx"
+#include "utilities.h"
#include <vtkRenderer.h>
#include <vtkObjectFactory.h>
-//using namespace std;
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
vtkStandardNewMacro(VISU_PointMap3dActor);
//==================================================================
VISU_PointMap3dActor
::VISU_PointMap3dActor()
{
+ if(MYDEBUG) MESSAGE("VISU_PointMap3dActor::VISU_PointMap3dActor - this = "<<this);
myScalarBar = VISU_ScalarBarActor::New();
}
VISU_PointMap3dActor
::~VISU_PointMap3dActor()
{
+ if(MYDEBUG) MESSAGE("VISU_PointMap3dActor::~VISU_PointMap3dActor - this = "<<this);
myScalarBar->Delete();
}
VISU::Base_i* aBase = anObjectInfo.myBase;
if(!aBase)
continue;
-
+
VISU::VISUType aType = aBase->GetType();
switch (aType) {
case VISU::TCURVE:
case VISU::TTABLE:
displayer()->Display(anIO->getEntry());
break;
- case VISU::TPOINTMAP3D:
+ case VISU::TPOINTMAP3D:
if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
displayer()->Display(anIO->getEntry());
aViewWindow->highlight(anIO, 1);
aViewWindow->getRenderer()->ResetCameraClippingRange();
aViewWindow->Repaint();
}
- }}
+ }
+ }
}
}
VisuGUI
::OnChangeOpacity()
{
- VISU_Actor* anActor = NULL;
- VISU::Prs3d_i* aPrs3d = NULL;
- SVTK_ViewWindow* aViewWindow = NULL;
- if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
- return;
-
VisuGUI_TransparencyDlg* aDialog = new VisuGUI_TransparencyDlg( this );
aDialog->show();
}
::OnChangeLines()
{
VISU_Actor* anActor = NULL;
+ VISU_ActorBase* anActorBase = NULL;
VISU::Prs3d_i* aPrs3d = NULL;
SVTK_ViewWindow* aViewWindow = NULL;
- if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
- return;
-
+ float oldlwid;
+ bool isPrs3d = false;
+
+ if (GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor)) {
+ isPrs3d = true;
+ }
+ else {
+ aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+ VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+ VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
+ anActorBase = VISU::FindActorBase(aViewWindow, aTable);
+ oldlwid = anActorBase->GetLineWidth();
+ }
+
VisuGUI_CursorDlg* CursorDlg =
new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_LINEWIDTH_TITLE"), TRUE);
-
+
CursorDlg->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;
}
aTable->SetName(Name.latin1(), true);
break;
}
+ case VISU::TPOINTMAP3D: { // Table object
+ if(VISU::PointMap3d_i* aTable3d = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
+ aTable3d->SetTitle(Name);
+ aTable3d->UpdateActors();
+ }
+ break;
+ }
case VISU::TCONTAINER: { // Container object
if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase))
aContainer->SetName(Name.latin1(), true);
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<VISU::PointMap3d_i*>(anObjectInfo.myBase)) {
+ aDlg->addPointMapPresentation(aPrs);
+ }
}
}
if (aDlg->getPrsCount() > 0)
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()));
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 );
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 );
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;
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 + "}";
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 );
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 );
" 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 );
"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 );
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);
}
}
}
- } 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();
- }
}
}
#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
aPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aColoredPrs3d).in());
}else if (aType == VISU::TPOINTMAP3D) {
VISU::PointMap3d_i* aTable3d = dynamic_cast<VISU::PointMap3d_i*>(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<VISU::Prs3d_i*>(aBaseServant);
if(aBase->GetType() == VISU::TCOLOREDPRS3DHOLDER)
return true;
+ if(aBase->GetType() == VISU::TPOINTMAP3D)
+ return dynamic_cast<VISU::PointMap3d_i*>(aBase);
+
return dynamic_cast<VISU::Prs3d_i*>(aBase);
}
else if( viewer_type==SPlot2d_Viewer::Type() )
myModule(theModule)
{
myPrsList.setAutoDelete(false);
+ myPointMapList.setAutoDelete(false);
setName("VisuGUI_OffsetDlg");
setCaption(tr("TIT_OFFSETDLG"));
}
}
+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]);
if (myPrsList.count() == 0)
return;
- if (isToSave())
+ if (isToSave())
thePrs->SetOffset(theOffset[0],theOffset[1],theOffset[2]);
ViewManagerList aViewManagerList;
}
}
+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<SUIT_ViewManager> anVMIter (aViewManagerList);
+ for (; anVMIter.current(); ++anVMIter) {
+ SUIT_ViewManager* aViewManager = anVMIter.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* vw = dynamic_cast<SVTK_ViewWindow*>(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];
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();
}
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();
}
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()
#include "VTKViewer.h"
#include "VISU_Prs3d_i.hh"
+#include "VISU_PointMap3d_i.hh"
// QT Includes
#include <qdialog.h>
~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;
private:
void updateOffset (VISU::Prs3d_i* thePrs, vtkFloatingPointType* theOffset);
+ void updatePointMapOffset (VISU::PointMap3d_i* thePrs, vtkFloatingPointType* theOffset);
VisuGUI * myModule;
QPtrList<VISU::Prs3d_i> myPrsList;
QValueList<OffsetStruct> myOldOffsets;
+
+ QPtrList<VISU::PointMap3d_i> myPointMapList;
+ QValueList<OffsetStruct> myOldPointMapOffsets;
};
#endif // DIALOGBOX_OFFSET_H
ENUM2STRING( aResStr, VISU::TSTREAMLINES );
ENUM2STRING( aResStr, VISU::TPLOT3D );
ENUM2STRING( aResStr, VISU::TANIMATION );
+ ENUM2STRING( aResStr, VISU::TPOINTMAP3D );
}
}
{
VISU_Actor* anActor = NULL;
VISU::Prs3d_i* aPrs3d = NULL;
+ VISU_ActorBase* anActorBase = NULL;
+ VISU::PointMap3d_i* aPointMap3d = NULL;
SVTK_ViewWindow* aViewWindow = NULL;
- if(!GetPrs3dSelectionInfo<TViewer>(theModule, theEntry, aPrs3d, aViewWindow, anActor))
- return QString();
-
- return get(aPrs3d, aViewWindow, anActor);
+ if(GetPrs3dSelectionInfo<TViewer>(theModule, theEntry, aPrs3d, aViewWindow, anActor)) {
+ return get(aPrs3d, aViewWindow, anActor);
+ } else {
+ aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule);
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
+ VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+ aPointMap3d = dynamic_cast<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
+ anActorBase = VISU::FindActorBase(aViewWindow, aPointMap3d);
+ return getPointMap(aPointMap3d, aViewWindow, anActorBase);
+ }
}
QString
{
return QString();
}
+
+ QString
+ virtual
+ getPointMap(VISU::PointMap3d_i* thePrs3d,
+ SVTK_ViewWindow* theViewWindow,
+ VISU_ActorBase* theActor)
+ {
+ return QString();
+ }
};
}
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
{
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
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<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
+ if(!aTable)
+ return;
+ }
SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(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<VISU::Mesh_i*>(aPrs3d)) {
- aMesh->SetPresentationType(theType);
- RecreateActor(theModule, aMesh);
- } else {
- anActor->SetRepresentation(theType);
+ if (aPrs3d) {
+ if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
+ aMesh->SetPresentationType(theType);
+ RecreateActor(theModule, aMesh);
+ } else {
+ anActor->SetRepresentation(theType);
+ }
+ }
+ else if (aTable) {
+ anActorBase->SetRepresentation(theType);
}
}
aViewWindow->Repaint();
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<VISU::PointMap3d_i*>(anObjectInfo.myBase);
+ return FindActorBase(theViewWindow, aTable);
+ }
+
//------------------------------------------------------------
void
RecreateActor (const SalomeApp_Module* theModule,
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);
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();
}
//
//
// File : VISU_PointMap3d_i.cc
-// Author : Vadim SANDLER
+// Author : Dmitry Matveitchev
// Module : VISU
#include "VISU_PointMap3d_i.hh"
#include <boost/bind.hpp>
#ifdef _DEBUG_
-static int MYDEBUG = 1;
+static int MYDEBUG = 0;
#else
-static int MYDEBUG = 1;
+static int MYDEBUG = 0;
#endif
//----------------------------------------------------------------
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
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);
virtual void Update();
+ virtual Handle(SALOME_InteractiveObject) GetIO();
+
//----------- override Prs3d methods -----------------------------
//! Move the 3D presentation according to the given offset parameters
vtkTimeStamp myParamsTime;
vtkTimeStamp myUpdateTime;
+ Handle(SALOME_InteractiveObject) myIO;
+
//Font management
bool myIsBoldTitle;
#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