From: enk Date: Tue, 24 Oct 2006 11:42:58 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: mergeto_V3_2_0_maintainance_30Nov06~15 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ee4ab416450f642e6dc6d42583f31bddfd2cc5bb;p=modules%2Fvisu.git *** empty log message *** --- diff --git a/src/PIPELINE/VISU_PrsMergerPL.cxx b/src/PIPELINE/VISU_PrsMergerPL.cxx index 1c4ac825..f91d1865 100644 --- a/src/PIPELINE/VISU_PrsMergerPL.cxx +++ b/src/PIPELINE/VISU_PrsMergerPL.cxx @@ -116,6 +116,9 @@ VISU_PrsMergerPL myMeshGeometryList.push_back(theGeometry); if (MYDEBUG) MESSAGE("this->GetGeometry(0)->GetIDMapper()="<GetGeometry(0)->GetIDMapper()); myIsModified = true; + + this->Execute(); + return true; } else return false; @@ -132,6 +135,9 @@ VISU_PrsMergerPL if(this->checkGeometry(theGeometry)){ myMeshGeometryList.push_back(theGeometry); myIsModified = true; + + this->Execute(); + return (myMeshGeometryList.size()-1); } else { return -1; @@ -164,6 +170,7 @@ VISU_PrsMergerPL for(;aIter != myMeshGeometryList.end();aIter++){ if( myMeshGeometryList[theId] == (*aIter)){ myMeshGeometryList.erase(aIter); + this->Execute(); break; } } @@ -199,29 +206,40 @@ bool VISU_PrsMergerPL ::SetScalars(VISU_PipeLine* theInput) { + if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::SetScalars()"); if ( this->checkScalars( theInput ) ){ myScalars = theInput; VISU_ScalarMapPL* aScalarMap = dynamic_cast(this->GetScalars()); - aScalarMap->Build(); - aScalarMap->Init(); - aScalarMap->Update(); - myIsModified = true; - //SetInput(theInput->GetInput()); + myScalarRanges = aScalarMap->GetScalarRange(); return true; } else return false; } +void +VISU_PrsMergerPL +::Init() +{ + Superclass::Init(); + if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::Init() this="<Execute(); +} + void VISU_PrsMergerPL ::Update() { - VISU_ScalarMapPL* aScalarMap = dynamic_cast(this->GetScalars()); - VISU_PrsMergerPL* aPrsMerger = dynamic_cast(this->GetScalars()); - if(aScalarMap != NULL && aPrsMerger == NULL){ - SetInput(myScalars->GetInput()); - Superclass::Update(); - } + if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::Update()"); + Superclass::Update(); +} + +void +VISU_PrsMergerPL +::Build() +{ + if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::Build()"); + //this->Execute(); + TSupperClass::Build(); // call DoHook method } void @@ -229,21 +247,57 @@ VISU_PrsMergerPL ::SetInitialRange() { myMapper->UseLookupTableScalarRangeOff(); - VISU_ScalarMapPL* aScalarMap = dynamic_cast(this->GetScalars()); - if(aScalarMap != NULL){ - myScalarRanges = aScalarMap->GetScalarRange(); +} + +// VISU_ScalarMapPL::THook* +// VISU_PrsMergerPL +// ::DoHook() +// { +// if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::DoHook()"); +// Execute(); +// return myOutput; +// } + +bool +VISU_PrsMergerPL +::checkGeometry(const VISU_PipeLine* thePipeLine) +{ + const VISU::PIDMapper& aMapper = thePipeLine->GetIDMapper(); + int aNbPoints = aMapper->GetVTKOutput()->GetNumberOfPoints(); + if (this->GetNbGeometry() > 0){ + const VISU::PIDMapper& aMapper2 = this->GetGeometry(0)->GetIDMapper(); + int aNbPoints2 = aMapper2->GetVTKOutput()->GetNumberOfPoints(); + if(aNbPoints2 != aNbPoints) + return false; + } else if (this->GetScalars()) { + const VISU::PIDMapper& aMapper2 = this->GetScalars()->GetIDMapper(); + int aNbPoints2 = aMapper2->GetVTKOutput()->GetNumberOfPoints(); + if(aNbPoints2 != aNbPoints) + return false; } + return true; } -VISU_ScalarMapPL::THook* +bool VISU_PrsMergerPL -::DoHook() +::checkScalars(const VISU_PipeLine* thePipeLine) { - if(!myIsModified) return myOutput; + const VISU::PIDMapper& aMapper = thePipeLine->GetIDMapper(); + int aNbPoints = aMapper->GetVTKOutput()->GetNumberOfPoints(); + if (this->GetNbGeometry() > 0){ + const VISU::PIDMapper& aMapper2 = this->GetGeometry(0)->GetIDMapper(); + int aNbPoints2 = aMapper2->GetVTKOutput()->GetNumberOfPoints(); + if(aNbPoints2 != aNbPoints) + return false; + } + return true; +} + +void +VISU_PrsMergerPL +::Execute(){ + if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::Execute()"); - myOutput = NULL; - myIsModified = false; - if(myMeshGeometryList.size() != 0) { // Build mesh @@ -252,14 +306,18 @@ VISU_PrsMergerPL TVec aObjIds;// object ids from geometries int anbGeoms; int aGeomNbCells,aAllGeomNbCells,aScalarNbCells; - int aScalarNodeTuplesNum,aScalarCellTuplesNum; + int aScalarNodeTuplesNum,aScalarCellTuplesNum,aScalarCellComponentNum; vtkFloatArray* aOutputCellScalars; VTKViewer_AppendFilter* aMergeGeoms; aAllGeomNbCells = 0; + myMergeFilter->RemoveAllInputs(); + aMergeGeoms = VTKViewer_AppendFilter::New(); + myMergeFilter->SetGeometry(aMergeGeoms->GetOutput()); + VISU_ScalarMapPL* aScalarMap = dynamic_cast(this->GetScalars()); VISU_PrsMergerPL* aPrsMergerPL = dynamic_cast(this->GetScalars()); if (aPrsMergerPL) { @@ -267,7 +325,7 @@ VISU_PrsMergerPL if (MYDEBUG) MESSAGE("\t this=" << this << " aPrsMergerPL=" << aPrsMergerPL); } if(aScalarMap != NULL){ - myMergeFilter->SetScalars(aScalarMap->GetOutput()); + myMergeFilter->GetOutput()->GetPointData()->SetScalars(aScalarMap->GetOutput()->GetPointData()->GetScalars()); } anbGeoms = this->GetNbGeometry(); @@ -278,6 +336,7 @@ VISU_PrsMergerPL aCurrGeometry->Update(); const VISU::PIDMapper& aGM = aCurrGeometry->GetIDMapper(); int aNbCells = aGM->GetVTKOutput()->GetNumberOfCells(); + if(MYDEBUG) MESSAGE("Geom["<GetElemVTKID(anObjID); float* aTuple = aScalarMapper->GetVTKOutput()->GetCellData()->GetTuple(aVTKID); - if(MYDEBUG) - cout <<"\t\t" << anObjID << ";"<SetTuple(i,aTuple); i++; } @@ -354,6 +423,10 @@ VISU_PrsMergerPL if (MYDEBUG) cout << "\tmyMergeFilter->GetUnstructuredGridOutput()=" <GetUnstructuredGridOutput()<GetOutput()=" @@ -362,7 +435,6 @@ VISU_PrsMergerPL aMergeGeoms->Delete(); myOutput = myMergeFilter->GetOutput(); - return myOutput; } else { @@ -372,56 +444,14 @@ VISU_PrsMergerPL VISU_PrsMergerPL* aPrsMerger = dynamic_cast(this->GetScalars()); if(aPrsMerger != NULL){ myOutput = NULL; - return myOutput; } if(aScalarMap != NULL){ SetInput(aScalarMap->GetInput()); vtkDataSet* aOut = aScalarMap->GetOutput(); myOutput = aOut; - return myOutput; } - return myOutput; } - else - return myOutput; } - - return myOutput; -} - -bool -VISU_PrsMergerPL -::checkGeometry(const VISU_PipeLine* thePipeLine) -{ - const VISU::PIDMapper& aMapper = thePipeLine->GetIDMapper(); - int aNbPoints = aMapper->GetVTKOutput()->GetNumberOfPoints(); - if (this->GetNbGeometry() > 0){ - const VISU::PIDMapper& aMapper2 = this->GetGeometry(0)->GetIDMapper(); - int aNbPoints2 = aMapper2->GetVTKOutput()->GetNumberOfPoints(); - if(aNbPoints2 != aNbPoints) - return false; - } else if (this->GetScalars()) { - const VISU::PIDMapper& aMapper2 = this->GetScalars()->GetIDMapper(); - int aNbPoints2 = aMapper2->GetVTKOutput()->GetNumberOfPoints(); - if(aNbPoints2 != aNbPoints) - return false; - } - return true; -} - -bool -VISU_PrsMergerPL -::checkScalars(const VISU_PipeLine* thePipeLine) -{ - const VISU::PIDMapper& aMapper = thePipeLine->GetIDMapper(); - int aNbPoints = aMapper->GetVTKOutput()->GetNumberOfPoints(); - if (this->GetNbGeometry() > 0){ - const VISU::PIDMapper& aMapper2 = this->GetGeometry(0)->GetIDMapper(); - int aNbPoints2 = aMapper2->GetVTKOutput()->GetNumberOfPoints(); - if(aNbPoints2 != aNbPoints) - return false; - } - return true; } diff --git a/src/PIPELINE/VISU_PrsMergerPL.hxx b/src/PIPELINE/VISU_PrsMergerPL.hxx index 75f3427c..7c09daea 100644 --- a/src/PIPELINE/VISU_PrsMergerPL.hxx +++ b/src/PIPELINE/VISU_PrsMergerPL.hxx @@ -129,6 +129,14 @@ public: VISU_PipeLine* GetScalars(); + virtual + void + Init(); + + virtual + void + Build(); + /*! * Calculate presentation, by merging of Geometry and Scalar Values. */ @@ -142,11 +150,11 @@ public: void SetInitialRange(); protected: - virtual - THook* - DoHook(); +// virtual +// THook* +// DoHook(); - TPipeLines myMeshGeometryList; + TPipeLines myMeshGeometryList; TPipeLine myScalars; @@ -154,6 +162,8 @@ protected: vtkFloatingPointType* myScalarRanges; + VISU_ScalarMapPL::THook* myOutput; + private: /*! @@ -174,9 +184,11 @@ private: bool checkScalars(const VISU_PipeLine* thePipeLine); + void + Execute(); + bool myIsModified; - VISU_ScalarMapPL::THook* myOutput; - + }; #endif