From: ouv Date: Mon, 25 Dec 2006 09:49:04 +0000 (+0000) Subject: vtkDataSetMapper moved to VISU_DataSetActor X-Git-Tag: WP1_2_3_29-12-2006_MED_to_VTK_data_passing~11 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=550066f45d147ef625cf1f8e0fc01cde83bdd6e9;p=modules%2Fvisu.git vtkDataSetMapper moved to VISU_DataSetActor VISU_GaussPtsAct has its own vtkPolyDataMapper now --- diff --git a/src/OBJECT/Makefile.in b/src/OBJECT/Makefile.in index 92c9b014..60cddef1 100644 --- a/src/OBJECT/Makefile.in +++ b/src/OBJECT/Makefile.in @@ -39,6 +39,7 @@ EXPORT_HEADERS = \ VISU_GaussPtsActorFactory.h \ VISU_Event.h \ VISU_Actor.h \ + VISU_DataSetActor.h \ VISU_MeshAct.h \ VISU_ScalarMapAct.h \ VISU_GaussPtsAct.h \ @@ -49,6 +50,7 @@ EXPORT_HEADERS = \ LIB = libVisuObject.la LIB_SRC = \ VISU_Actor.cxx \ + VISU_DataSetActor.cxx \ VISU_MeshAct.cxx \ VISU_ScalarMapAct.cxx \ VISU_GaussPtsDeviceActor.cxx \ diff --git a/src/OBJECT/VISU_Actor.cxx b/src/OBJECT/VISU_Actor.cxx index 242d4fbb..85197aa3 100644 --- a/src/OBJECT/VISU_Actor.cxx +++ b/src/OBJECT/VISU_Actor.cxx @@ -54,7 +54,6 @@ #include #include -#include #include #include @@ -77,7 +76,7 @@ static int MYDEBUG = 0; //#define ENABLE_ANNOTATION //---------------------------------------------------------------------------- -vtkStandardNewMacro(VISU_Actor); +//vtkStandardNewMacro(VISU_Actor); //---------------------------------------------------------------------------- VISU_Actor @@ -85,7 +84,6 @@ VISU_Actor myIsVTKMapping(false), myPrs3d(NULL), myActorFactory(NULL), - myMapper(vtkDataSetMapper::New()), myIsShrunk(false), myIsShrinkable(false), myShrinkFilter(VTKViewer_ShrinkFilter::New()), @@ -94,7 +92,6 @@ VISU_Actor { if(MYDEBUG) MESSAGE("VISU_Actor::VISU_Actor - this = "<Delete(); myShrinkFilter->Delete(); myStoreMapping = true; @@ -133,10 +130,6 @@ VISU_Actor ::ShallowCopyPL(VISU_PipeLine* thePipeLine) { myPipeLine->ShallowCopy(thePipeLine, true); - vtkDataSetMapper* aTarget = GetDataSetMapper(); - vtkDataSetMapper* aSource = thePipeLine->GetDataSetMapper(); - VISU::CopyDataSetMapper(aTarget, aSource, true); - aTarget->SetLookupTable(aSource->GetLookupTable()); } //---------------------------------------------------------------------------- @@ -217,14 +210,6 @@ VISU_Actor } //---------------------------------------------------------------------------- -void -VISU_Actor -::SetMapperInput(vtkDataSet* theDataSet) -{ - myMapper->SetInput(theDataSet); - SetMapper(myMapper.GetPointer()); -} - void VISU_Actor ::SetPipeLine(VISU_PipeLine* thePipeLine) @@ -412,14 +397,6 @@ VISU_Actor return GetCurrentPL()->GetOutput(); } -//---------------------------------------------------------------------------- -vtkDataSetMapper* -VISU_Actor -::GetDataSetMapper() -{ - return myMapper.GetPointer(); -} - //---------------------------------------------------------------------------- unsigned long int VISU_Actor diff --git a/src/OBJECT/VISU_Actor.h b/src/OBJECT/VISU_Actor.h index 8d60bf54..d26cea31 100644 --- a/src/OBJECT/VISU_Actor.h +++ b/src/OBJECT/VISU_Actor.h @@ -39,7 +39,6 @@ class vtkProp; class vtkProperty; -class vtkDataSetMapper; class vtkTextMapper; class vtkTextActor; class vtkInteractorStyle; @@ -65,9 +64,9 @@ class VTKOCC_EXPORT VISU_Actor : public: vtkTypeMacro(VISU_Actor,SALOME_Actor); - static - VISU_Actor* - New(); + //static + //VISU_Actor* + //New(); //! Copies all properties from the given actor virtual @@ -196,10 +195,6 @@ class VTKOCC_EXPORT VISU_Actor : vtkDataSet* GetInput(); - virtual - vtkDataSetMapper* - GetDataSetMapper(); - //! Gets memory size used by the instance (bytes). virtual unsigned long int @@ -239,7 +234,7 @@ class VTKOCC_EXPORT VISU_Actor : virtual void - SetMapperInput(vtkDataSet* theDataSet); + SetMapperInput(vtkDataSet* theDataSet) = 0; virtual VISU_PipeLine* @@ -249,7 +244,6 @@ class VTKOCC_EXPORT VISU_Actor : bool myIsVTKMapping; VISU::Prs3d_i* myPrs3d; vtkSmartPointer myPipeLine; - vtkSmartPointer myMapper; VISU::TActorFactory* myActorFactory; vtkTimeStamp myUpdateFromFactoryTime; diff --git a/src/OBJECT/VISU_DataSetActor.cxx b/src/OBJECT/VISU_DataSetActor.cxx new file mode 100644 index 00000000..e24b8a99 --- /dev/null +++ b/src/OBJECT/VISU_DataSetActor.cxx @@ -0,0 +1,93 @@ +// VISU OBJECT : interactive object for VISU entities implementation +// +// Copyright (C) 2003 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 +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// 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 +// +// +// +// File : +// Author : +// Module : VISU + +#include "VISU_DataSetActor.h" +#include "VISU_PipeLine.hxx" +#include "VISU_PipeLineUtils.hxx" + +#include +#include + +#include + +using namespace std; + +#ifdef _DEBUG_ +static int MYDEBUG = 0; +#else +static int MYDEBUG = 0; +#endif + +//---------------------------------------------------------------------------- +vtkStandardNewMacro(VISU_DataSetActor); + +//---------------------------------------------------------------------------- +VISU_DataSetActor +::VISU_DataSetActor(): + myMapper(vtkDataSetMapper::New()) +{ + if(MYDEBUG) MESSAGE("VISU_DataSetActor::VISU_DataSetActor - this = "<Delete(); +} + +//---------------------------------------------------------------------------- +VISU_DataSetActor +::~VISU_DataSetActor() +{ + if(MYDEBUG) MESSAGE("~VISU_DataSetActor() - this = "<GetDataSetMapper(); + VISU::CopyDataSetMapper(aTarget, aSource, true); + aTarget->SetLookupTable(aSource->GetLookupTable()); +} + +//---------------------------------------------------------------------------- +void +VISU_DataSetActor +::SetMapperInput(vtkDataSet* theDataSet) +{ + myMapper->SetInput(theDataSet); + SetMapper(myMapper.GetPointer()); +} + +//---------------------------------------------------------------------------- +vtkDataSetMapper* +VISU_DataSetActor +::GetDataSetMapper() +{ + return myMapper.GetPointer(); +} diff --git a/src/OBJECT/VISU_DataSetActor.h b/src/OBJECT/VISU_DataSetActor.h new file mode 100644 index 00000000..9e7ef457 --- /dev/null +++ b/src/OBJECT/VISU_DataSetActor.h @@ -0,0 +1,74 @@ +// VISU OBJECT : interactive object for VISU entities implementation +// +// Copyright (C) 2003 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 +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// 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 +// +// +// +// File : +// Author : +// Module : VISU + +#ifndef VISU_DATASETACTOR_H +#define VISU_DATASETACTOR_H + +#include "VISU_Actor.h" + +class vtkDataSetMapper; + +#ifdef _WIN_32 +#define VTKOCC_EXPORT __declspec (dllexport) +#else +#define VTKOCC_EXPORT VTK_EXPORT +#endif + +//---------------------------------------------------------------------------- +class VTKOCC_EXPORT VISU_DataSetActor : public VISU_Actor +{ + public: + vtkTypeMacro(VISU_DataSetActor,VISU_Actor); + + static + VISU_DataSetActor* + New(); + + virtual + void + ShallowCopyPL(VISU_PipeLine* thePipeLine); + + virtual + vtkDataSetMapper* + GetDataSetMapper(); + + //---------------------------------------------------------------------------- + protected: + VISU_DataSetActor(); + + virtual + ~VISU_DataSetActor(); + + virtual + void + SetMapperInput(vtkDataSet* theDataSet); + + //---------------------------------------------------------------------------- + vtkSmartPointer myMapper; +}; + +#endif //VISU_DATASETACTOR_H diff --git a/src/OBJECT/VISU_GaussPtsAct.cxx b/src/OBJECT/VISU_GaussPtsAct.cxx index a7a9d09c..564cda16 100644 --- a/src/OBJECT/VISU_GaussPtsAct.cxx +++ b/src/OBJECT/VISU_GaussPtsAct.cxx @@ -70,7 +70,7 @@ #include #include -#include +#include #include #include #include @@ -112,7 +112,8 @@ VISU_GaussPtsAct myBarVisibility(true), myPickingSettings(NULL), myInsideCursorSettings(NULL), - myCurrentPL(NULL) + myCurrentPL(NULL), + myMapper(vtkPolyDataMapper::New()) { if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::VISU_GaussPtsAct - this = "<GetProperty()->SetDiffuse(0.0); myScalarBarCtrl->Delete(); + + myMapper->Delete(); } VISU_GaussPtsAct @@ -211,12 +214,16 @@ VISU_GaussPtsAct //---------------------------------------------------------------------------- + vtkMapper* VISU_GaussPtsAct ::GetMapper() { + //vtkMapper* aMapper = myCurrentPL->GetPSMapper(); + //aMapper->Update(); + //return aMapper; myMapper->Update(); - return Superclass::GetMapper(); + return myMapper.GetPointer(); } vtkFloatingPointType* @@ -392,6 +399,8 @@ VISU_GaussPtsAct myDeviceActor->SetPipeLine(GetGaussPointsPL()); myCurrentPL = myDeviceActor->GetPipeLine(); + //SetMapper(myCurrentPL->GetPSMapper()); + myMapper->SetInput(myCurrentPL->GetPickableDataSet()); SetMapper(myMapper.GetPointer()); } @@ -1111,14 +1120,6 @@ VISU_GaussPtsAct Update(); } -//---------------------------------------------------------------------------- -void -VISU_GaussPtsAct -::UpdateFromFactory() -{ - Superclass::UpdateFromFactory(); -} - //---------------------------------------------------------------------------- unsigned long int VISU_GaussPtsAct diff --git a/src/OBJECT/VISU_GaussPtsAct.h b/src/OBJECT/VISU_GaussPtsAct.h index 35583a76..7396f591 100644 --- a/src/OBJECT/VISU_GaussPtsAct.h +++ b/src/OBJECT/VISU_GaussPtsAct.h @@ -53,7 +53,7 @@ class VISU_CursorPyramid; class VISU_FramedTextActor; class vtkUnstructuredGrid; -class vtkDataSetMapper; +class vtkPolyDataMapper; class vtkDataArray; class vtkInteractorObserver; @@ -248,10 +248,6 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor GetPickable(); //---------------------------------------------------------------------------- - virtual - void - UpdateFromFactory(); - virtual unsigned long int GetMTime(); @@ -318,6 +314,8 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor VISU_GaussPointsPL* myCurrentPL; vtkSmartPointer myGaussPointsPL; + vtkSmartPointer myMapper; + vtkIdType myLastObjPointID; vtkSmartPointer myTextActor; diff --git a/src/OBJECT/VISU_MeshAct.h b/src/OBJECT/VISU_MeshAct.h index 65fd0bb8..3ca1e471 100644 --- a/src/OBJECT/VISU_MeshAct.h +++ b/src/OBJECT/VISU_MeshAct.h @@ -29,7 +29,7 @@ #ifndef VISU_MeshAct_HeaderFile #define VISU_MeshAct_HeaderFile -#include "VISU_Actor.h" +#include "VISU_DataSetActor.h" #include "SVTK_DeviceActor.h" namespace SVTK @@ -40,10 +40,10 @@ namespace SVTK } } -class VTKOCC_EXPORT VISU_MeshAct : public VISU_Actor +class VTKOCC_EXPORT VISU_MeshAct : public VISU_DataSetActor { public: - vtkTypeMacro(VISU_MeshAct,VISU_Actor); + vtkTypeMacro(VISU_MeshAct,VISU_DataSetActor); static VISU_MeshAct* New(); diff --git a/src/OBJECT/VISU_ScalarMapAct.h b/src/OBJECT/VISU_ScalarMapAct.h index 78d04005..9145403f 100644 --- a/src/OBJECT/VISU_ScalarMapAct.h +++ b/src/OBJECT/VISU_ScalarMapAct.h @@ -29,14 +29,14 @@ #ifndef VISU_ScalarMapAct_HeaderFile #define VISU_ScalarMapAct_HeaderFile -#include "VISU_Actor.h" +#include "VISU_DataSetActor.h" class VISU_ScalarBarActor; -class VTKOCC_EXPORT VISU_ScalarMapAct : public VISU_Actor +class VTKOCC_EXPORT VISU_ScalarMapAct : public VISU_DataSetActor { public: - vtkTypeMacro(VISU_ScalarMapAct,VISU_Actor); + vtkTypeMacro(VISU_ScalarMapAct,VISU_DataSetActor); static VISU_ScalarMapAct* diff --git a/src/PIPELINE/VISU_GaussPointsPL.cxx b/src/PIPELINE/VISU_GaussPointsPL.cxx index 12c36f84..02f002c2 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.cxx +++ b/src/PIPELINE/VISU_GaussPointsPL.cxx @@ -211,7 +211,7 @@ VISU_GaussPointsPL return myPSMapper; } -vtkDataSet* +vtkPolyData* VISU_GaussPointsPL ::GetPickableDataSet() { diff --git a/src/PIPELINE/VISU_GaussPointsPL.hxx b/src/PIPELINE/VISU_GaussPointsPL.hxx index d17b732c..a30f3866 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.hxx +++ b/src/PIPELINE/VISU_GaussPointsPL.hxx @@ -74,7 +74,7 @@ public: GetPSMapper(); //! Get an intermediate dataset that can be picked - vtkDataSet* + vtkPolyData* GetPickableDataSet(); //! Redefined method for initialization of the pipeline. diff --git a/src/VISUGUI/VisuGUI_FieldFilter.cxx b/src/VISUGUI/VisuGUI_FieldFilter.cxx index 3dd45bb1..fdbc579b 100644 --- a/src/VISUGUI/VisuGUI_FieldFilter.cxx +++ b/src/VISUGUI/VisuGUI_FieldFilter.cxx @@ -63,6 +63,9 @@ bool VisuGUI_FieldFilter::isOk( const SUIT_DataOwner* theDataOwner ) const if( anOwner && anAppStudy ) { + cout << "Prs3d - " << myPrs3dEntry.latin1() << endl; + cout << "Owner - " << anOwner->entry().latin1() << endl; + if(myPrs3dEntry == anOwner->entry()) return true; diff --git a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc index 3cbde11a..3947b4b6 100644 --- a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc @@ -73,7 +73,7 @@ namespace //---------------------------------------------------------------------------- - VISU::TPrs3dPtr + VISU::ColoredPrs3d_i* FindSameFieldPrs(const VISU::TColoredPrs3dHolderMap& theHolderMap, const VISU::ColoredPrs3dHolder::BasicInput& theInput, VISU::VISUType theType) @@ -90,7 +90,7 @@ namespace break; VISU::ColoredPrs3dHolder::BasicInput_var anInput = aPrs3d->GetBasicInput(); if(IsSameField(theInput, anInput)) - return aPrs3d; + return aPrs3d.get(); } } return VISU::TPrs3dPtr(); @@ -104,7 +104,7 @@ namespace VISU::VISUType theType, const size_t theRawEstimatedMemorySize) { - VISU::TPrs3dPtr aPrs3d = FindSameFieldPrs(theHolderMap, theInput, theType); + VISU::ColoredPrs3d_i* aPrs3d = FindSameFieldPrs(theHolderMap, theInput, theType); if(aPrs3d) return aPrs3d->GetMemorySize(); return CORBA::Float(theRawEstimatedMemorySize/(1024.0*1024.0)); // convert to Mb diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index 789ca81f..0f98f149 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -461,6 +461,8 @@ VISU::ColoredPrs3d_i UseFixedRange( anOrigin->IsRangeFixed() ); myIsTimeStampFixed = anOrigin->IsTimeStampFixed(); + + SetHolderEntry( anOrigin->GetHolderEntry() ); } }