From 3aab8bfd4128d3462ee73e4895d88ae06c06e9d2 Mon Sep 17 00:00:00 2001 From: admin Date: Wed, 25 Apr 2007 09:22:27 +0000 Subject: [PATCH] This commit was generated by cvs2git to create tag 'before_mergefrom_BR_mergefrom_BR_Dev_For_4_0'. Sprout from BR_Dev_For_4_0 2007-04-25 09:22:23 UTC abd 'Fix global links to local for correct work on any station' Delete: src/PIPELINE/VISU_PrsMergerPL.cxx src/PIPELINE/VISU_PrsMergerPL.hxx src/VISU_I/VISU_PrsMerger_i.cc src/VISU_I/VISU_PrsMerger_i.hh --- src/PIPELINE/VISU_PrsMergerPL.cxx | 357 ------------------ src/PIPELINE/VISU_PrsMergerPL.hxx | 194 ---------- src/VISU_I/VISU_PrsMerger_i.cc | 580 ------------------------------ src/VISU_I/VISU_PrsMerger_i.hh | 221 ------------ 4 files changed, 1352 deletions(-) delete mode 100644 src/PIPELINE/VISU_PrsMergerPL.cxx delete mode 100644 src/PIPELINE/VISU_PrsMergerPL.hxx delete mode 100644 src/VISU_I/VISU_PrsMerger_i.cc delete mode 100644 src/VISU_I/VISU_PrsMerger_i.hh diff --git a/src/PIPELINE/VISU_PrsMergerPL.cxx b/src/PIPELINE/VISU_PrsMergerPL.cxx deleted file mode 100644 index c5c6ccd4..00000000 --- a/src/PIPELINE/VISU_PrsMergerPL.cxx +++ /dev/null @@ -1,357 +0,0 @@ -// 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: VISU_PrsMergerPL.cxx -// Author: Eugeny Nikolaev -// Module : VISU - -#include "VISU_PrsMergerPL.hxx" -#include "VISU_MeshPL.hxx" -#include "VISU_ScalarMapPL.hxx" -#include "VISU_IDMapper.hxx" -#include "VTKViewer_AppendFilter.h" - -#include "VISU_AppendFilter.hxx" -#include "VISU_MergeFilter.hxx" - -#include "VISU_PipeLineUtils.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#ifdef _DEBUG_ -static int MYDEBUG = 0; -#else -static int MYDEBUG = 0; -#endif - - -using namespace std; - -vtkStandardNewMacro(VISU_PrsMergerPL); - -VISU_PrsMergerPL -::VISU_PrsMergerPL(): - myAppendFilter(VISU_AppendFilter::New()), - myMergeFilter(VISU_MergeFilter::New()), - myScalars(NULL) -{ - myAppendFilter->SetMergingInputs(true); - myAppendFilter->Delete(); - - myMergeFilter->SetMergingInputs(true); - myMergeFilter->Delete(); -} - -VISU_PrsMergerPL -::~VISU_PrsMergerPL() -{} - -void -VISU_PrsMergerPL -::RemoveAllGeom() -{ - myMeshGeometryList.clear(); - this->Execute(); -} - -void -VISU_PrsMergerPL -::ShallowCopy(VISU_PipeLine *thePipeLine) -{ - if (MYDEBUG) MESSAGE("ShallowCopy"); - VISU_PrsMergerPL* aPipeLine = dynamic_cast(thePipeLine); - if(this == aPipeLine){ - TSupperClass::ShallowCopy(thePipeLine); - return; - } - if(aPipeLine){ - int aNbGeoms = aPipeLine->GetNbGeometry(); - if (MYDEBUG) MESSAGE("aNbGeoms="<GetGeometry(i),false); - } - SetScalars(aPipeLine->GetScalars(),true); - } - TSupperClass::ShallowCopy(thePipeLine); -} - -bool -VISU_PrsMergerPL -::SetGeometry(VISU_PipeLine* theGeometry,bool theUpdate) -{ - if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::SetGeometry()"); - myMeshGeometryList.clear(); - - if(this->checkGeometry(theGeometry)){ - myMeshGeometryList.push_back(theGeometry); - if (MYDEBUG) MESSAGE("this->GetGeometry(0)->GetIDMapper()="<GetGeometry(0)->GetIDMapper()); - - if(theUpdate) - this->Execute(); - - return true; - } else - return false; - -} - -int -VISU_PrsMergerPL -::AddBackGeometry(VISU_PipeLine* theGeometry,bool theUpdate) -{ - if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::AddBackGeometry() "<GetGeometryNumber(theGeometry); - if(aGeomNum == -1){ - bool aCheckGeom = this->checkGeometry(theGeometry); - if(aCheckGeom){ - myMeshGeometryList.push_back(theGeometry); - - if(theUpdate) - this->Execute(); - - return (myMeshGeometryList.size()-1); - } else { - return -1; - } - } else { - return aGeomNum; - } -} - -int -VISU_PrsMergerPL -::GetGeometryNumber(VISU_PipeLine* theGeometry) -{ - TPipeLine aPipeLine = theGeometry; - TPipeLines::const_iterator aIter = myMeshGeometryList.begin(); - for(int i=0;aIter != myMeshGeometryList.end();aIter++,i++){ - if( theGeometry == (*aIter).GetPointer() ) - return i; - } - - return -1; -} - -void -VISU_PrsMergerPL -::RemoveGeometryById(int theId) -{ - if(theId >=0 && theId < myMeshGeometryList.size()){ - TPipeLines::iterator aIter = myMeshGeometryList.begin(); - for(;aIter != myMeshGeometryList.end();aIter++){ - if( myMeshGeometryList[theId] == (*aIter)){ - myMeshGeometryList.erase(aIter); - this->Execute(); - break; - } - } - } -} - -VISU_PipeLine* -VISU_PrsMergerPL -::GetGeometry(int theId) -{ - if(theId >=0 && theId < myMeshGeometryList.size()){ - return myMeshGeometryList[theId].GetPointer(); - } - else - return NULL; -} - -VISU_PipeLine* -VISU_PrsMergerPL -::GetScalars() -{ - return myScalars.GetPointer(); -} - -int -VISU_PrsMergerPL -::GetNbGeometry() -{ - return myMeshGeometryList.size(); -} - -bool -VISU_PrsMergerPL -::SetScalars(VISU_PipeLine* theInput,bool theUpdate) -{ - if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::SetScalars()"); - if ( this->checkScalars( theInput ) ){ - myScalars = theInput; - VISU_ScalarMapPL* aScalarMap = dynamic_cast(this->GetScalars()); - myScalarRanges = aScalarMap->GetScalarRange(); - if(theUpdate) - this->Execute(); - return true; - } else - return false; -} - -void -VISU_PrsMergerPL -::Init() -{ - Superclass::Init(); - if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::Init() this="<Execute(); -} - -void -VISU_PrsMergerPL -::Update() -{ - if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::Update()"); - Superclass::Update(); - Execute(); -} - -void -VISU_PrsMergerPL -::Build() -{ - if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::Build()"); - TSupperClass::Build(); // call DoHook method -} - -void -VISU_PrsMergerPL -::SetInitialRange() -{ - myMapper->UseLookupTableScalarRangeOff(); -} - -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; -// } - if(aNbPoints < 1) - 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; -// } - if(aNbPoints < 1) - return false; - return true; -} - -void -VISU_PrsMergerPL -::Execute(){ - /* Where are next situations: - * 1. Timestamp on entity=NODE - * 1.1 Group Cell - OK - * 1.2 Group Cell + Point - ERR (remove points groups) - * 1.3 Group Node - ERR (remove points groups) - * 2. Timesatamp on entity=CELL - * 2.1 Group Cell - OK - * 2.2 Group Point - ERR (remove points groups) - */ - if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::Execute()"); - - myAppendFilter->RemoveAllInputs(); - if(!myMeshGeometryList.empty()){ - const VISU::PIDMapper& aScalarsIDMapper = myScalars->GetIDMapper(); - VISU::TVTKOutput* aScalarsOutput = aScalarsIDMapper->GetVTKOutput(); - - // copy points to output from input first geometry - - VISU::TVTKOutput* aGeomOutput = NULL; - vtkIdType aNbGeoms = this->GetNbGeometry(); - for(vtkIdType aGeomId = 0; aGeomId < aNbGeoms; aGeomId++){ - VISU_PipeLine* aGeomPipeLine = this->GetGeometry(aGeomId); - const VISU::PIDMapper& aGeomIDMapper = aGeomPipeLine->GetIDMapper(); - aGeomOutput = aGeomIDMapper->GetVTKOutput(); - vtkIdType aNbCells = aGeomOutput->GetNumberOfCells(); -// if(aNbCells > 0) -// if(aGeomOutput->GetCell(0)->GetCellType() == VTK_VERTEX ) -// continue; - - myAppendFilter->AddInput(aGeomOutput); - } - - myAppendFilter->SetSharedPointsDataSet(aGeomOutput); - myAppendFilter->Update(); - - vtkUnstructuredGrid* aGeomDataSet = myAppendFilter->GetOutput(); - myMergeFilter->SetGeometry(aGeomDataSet); - - //copy array values - myMergeFilter->SetScalars(aScalarsOutput); - myMergeFilter->SetVectors(aScalarsOutput); - - myMergeFilter->RemoveFields(); - myMergeFilter->AddField("VISU_FIELD", aScalarsOutput); - myMergeFilter->AddField("VISU_CELLS_MAPPER", aScalarsOutput); - myMergeFilter->AddField("VISU_POINTS_MAPPER", aScalarsOutput); - - myMergeFilter->Update(); - SetInput(myMergeFilter->GetOutput()); - }else{ - if(myScalars != NULL){ - if(VISU_ScalarMapPL* aScalarMap = dynamic_cast(this->GetScalars())) - SetInput(aScalarMap->GetInput()); - } - } -} diff --git a/src/PIPELINE/VISU_PrsMergerPL.hxx b/src/PIPELINE/VISU_PrsMergerPL.hxx deleted file mode 100644 index 7dc0dac8..00000000 --- a/src/PIPELINE/VISU_PrsMergerPL.hxx +++ /dev/null @@ -1,194 +0,0 @@ -// 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: VISU_PrsMergerPL.hxx -// Author: Eugeny Nikolaev -// Module : VISU - -#ifndef VISU_PrsMergerPL_HeaderFile -#define VISU_PrsMergerPL_HeaderFile - -#include "VISUPipeline.hxx" - -#include "VISU_ScalarMapPL.hxx" - -class VISU_AppendFilter; -class VISU_MergeFilter; - - -class VISU_PIPELINE_EXPORT VISU_PrsMergerPL : public VISU_ScalarMapPL -{ - typedef VISU_ScalarMapPL TSupperClass; - -protected: - VISU_PrsMergerPL(); - VISU_PrsMergerPL(const VISU_PrsMergerPL&); - - virtual - ~VISU_PrsMergerPL(); - -public: - - typedef TVTKSmartPtr TPipeLine; - typedef std::vector TPipeLines; - - vtkTypeMacro(VISU_PrsMergerPL,TSupperClass); - - static - VISU_PrsMergerPL* - New(); - - virtual - void - ShallowCopy(VISU_PipeLine *thePipeLine); - - /*! - * Add geometry of presentation to myMeshGeometryList. - * \params theGeometry - visu pipeline with geometry. - * \params theUpdate - update pipeline if true. - * \retval TRUE - if geometry and scalars on the common mesh, esle FALSE. - */ - virtual - bool - SetGeometry(VISU_PipeLine* theGeometry,bool theUpdate=true); - - /*! - * Add geometry to back of myMeshGeometryList. - * \params theInput - visu pipeline with geometry. - * \params theUpdate - update pipeline if true. - * \retval index of added geometry. (must be >= 0) - * \retval -1, if geometry not added. - */ - virtual - int - AddBackGeometry(VISU_PipeLine* theGeometry,bool theUpdate=true); - - /*! - * Get geometry id of myMeshGeometryList. - * \retval index of geometry. (must be >= 0) - * \retval -1 - if geometry not exists. - */ - virtual - int - GetGeometryNumber(VISU_PipeLine* theGeometry); - - /*! - * Remove geometry with id = theId from myMeshGeometryList. - * the id in [0,...] - */ - virtual - void - RemoveGeometryById(int theId); - - /*! Removes all geometries. - */ - virtual - void - RemoveAllGeom(); - - /*! - * Gets geometry of presentation by id. - * \retval VISU_MeshPL - pointer - * the id in [0,...] - */ - virtual - VISU_PipeLine* - GetGeometry(int theId=0); - - /*! - * Gets number of geometrys - * \retval int - number - */ - virtual - int - GetNbGeometry(); - - /*! - * Sets scalar values and ids by VISU_ScalarMapPL object. - * \params theInput - visu pipeline with scalar values - * \params theUpdate - update pipeline if true. - * \retval TRUE - if scalars and geometry on the common mesh, esle FALSE. - */ - virtual - bool - SetScalars(VISU_PipeLine* theInput,bool theUpdate=false); - - /*! - * Gets input VISU_ScalarMapPL, which contain scalar values and ids. - */ - virtual - VISU_PipeLine* - GetScalars(); - - virtual - void - Init(); - - virtual - void - Build(); - - /*! - * Calculate presentation, by merging of Geometry and Scalar Values. - */ - virtual - void - Update(); - - /*! - * Set ranges of scalar values by input myScalars ranges. - */ - void SetInitialRange(); - -protected: - TPipeLines myMeshGeometryList; - vtkSmartPointer myAppendFilter; - vtkSmartPointer myMergeFilter; - - vtkFloatingPointType* myScalarRanges; - TPipeLine myScalars; - -private: - - /*! - * Check if thePipeLine and "first element of list myMeshGeometryList" or - * "myScalars", has - * common DataPoints (simple check number of points). - * \retval TRUE - if has common points, esle FALSE. - */ - bool - checkGeometry(const VISU_PipeLine* thePipeLine); - - - /*! - * Check if thePipeLine and first element of list myMeshGeometryList, has - * common DataPoints (simple check number of points). - * \retval TRUE - if has common points, esle FALSE. - */ - bool - checkScalars(const VISU_PipeLine* thePipeLine); - - void - Execute(); -}; - -#endif diff --git a/src/VISU_I/VISU_PrsMerger_i.cc b/src/VISU_I/VISU_PrsMerger_i.cc deleted file mode 100644 index c021c9d3..00000000 --- a/src/VISU_I/VISU_PrsMerger_i.cc +++ /dev/null @@ -1,580 +0,0 @@ -// 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 : VISU_PrsMerger_i.cc -// Author : Eugeny Nikolaev -// Module : VISU - -#include "VISU_PrsMerger_i.hh" -#include "VISU_PrsMergerPL.hxx" -#include "VISU_MeshPL.hxx" -#include "VISU_ScalarMapPL.hxx" -#include "VISU_Convertor.hxx" - -#include "VISU_Result_i.hh" -#include "VISU_ScalarMapAct.h" -#include "VISU_ScalarMap_i.hh" -#include "SUIT_ResourceMgr.h" - -#include "SUIT_Session.h" -#include "SALOME_Event.hxx" -#include "SalomeApp_Study.h" -#include "SalomeApp_Application.h" - -#include -#include -#include -#include - -using namespace VISU; -using namespace std; - -#ifdef _DEBUG_ -static int MYDEBUG = 0; -#else -static int MYDEBUG = 0; -#endif - -static int INCMEMORY = 4; - -int VISU::PrsMerger_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration, int isMemoryCheck) -{ - try{ - float aSize = INCMEMORY* - theResult->GetInput()->GetTimeStampSize(theMeshName,(VISU::TEntity)theEntity,theFieldName,theIteration); - bool aResult = true; - if(isMemoryCheck){ - aResult = VISU_PipeLine::CheckAvailableMemory(aSize); - MESSAGE("PrsMerger_i::IsPossible - CheckAvailableMemory = "<GetStudyDocument()), - Prs3d_i(theResult,theAddToStudy), - ColoredPrs3d_i(theResult,theAddToStudy), - ScalarMap_i(theResult,theAddToStudy), - myPrsMergerPL(NULL), - myScalarsPL(VISU_ScalarMapPL::New()) -{ -} - -VISU::PrsMerger_i:: -PrsMerger_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject): - PrsObject_i(theResult->GetStudyDocument()), - Prs3d_i(theResult,theSObject), - ColoredPrs3d_i(theResult,theSObject), - ScalarMap_i(theResult,theSObject), - myPrsMergerPL(NULL), - myScalarsPL(VISU_ScalarMapPL::New()) -{ -} - -VISU::Storable* VISU::PrsMerger_i::Create(const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration) -{ - if (MYDEBUG) MESSAGE("PrsMerger_i::Create"); - myIsColored = true; - myColor.R = myColor.G = myColor.B = 0.5; - VISU::Storable* aRes = TSuperClass::Create(theMeshName,theEntity,theFieldName,theIteration); - this->SetScalarMap(theMeshName,theEntity,theFieldName,theIteration); - - return aRes; -} - -VISU::Storable* VISU::PrsMerger_i::Restore(const Storable::TRestoringMap& theMap) -{ - if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::Restore"); - - TSuperClass::Restore(theMap); - - SetScalarMap(myMeshName.c_str(), - VISU::Entity(myEntity), - myFieldName.c_str(), - myIteration); - // myMeshName = VISU::Storable::FindValue(theMap,"myMeshName").latin1(); - QStringList aStrSubMeshName = QStringList::split("|",VISU::Storable::FindValue(theMap,"myGeomNameList") ); - QStringList aStrEntity = QStringList::split("|",VISU::Storable::FindValue(theMap,"myGeomEntityList") ); - int aC1 = aStrSubMeshName.count(); - int aC2 = aStrEntity.count(); - if(aC1 != aC2){ - // warning situation - return this; - } - if(aC1 == 1) - if(aStrSubMeshName[0] == QString("NULL")) - return this; - - for(int i=0;i < aC2;i++){ - std::string aSubMeshName = aStrSubMeshName[i]; - int aEntity = aStrEntity[i].toInt(); - if(aEntity == -1){ - // add group - AddMeshOnGroup(myMeshName.c_str(), - aSubMeshName.c_str()); - } else if (aEntity >= 0){ - // entity and family - if(aSubMeshName == ""){ - // entity - SetMeshOnEntity(myMeshName.c_str(), - VISU::Entity(aEntity)); - } else { - // family - SetFamilyOnEntity(myMeshName.c_str(), - VISU::Entity(aEntity), - aSubMeshName.c_str()); - } - - } - } - - return this; -} - -void -VISU::PrsMerger_i -::SetMapScale(double theMapScale) -{ - myPrsMergerPL->SetMapScale(theMapScale); -} - -void VISU::PrsMerger_i::ToStream(std::ostringstream& theStr) -{ - if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::ToStream:"); - TSuperClass::ToStream(theStr); - - QString aStrSubMeshName,aStrEntity; - TNameAndEntityList::iterator aIter = myGeomNameEntityList.begin(); - for(;aIter!=myGeomNameEntityList.end();aIter++){ - std::string aStr = aIter->first + "|"; - aStrSubMeshName.append(aStr.c_str()); - aStrEntity.append(QString::number(aIter->second) + "|"); - } - - Storable::DataToStream( theStr, "myMeshName", myMeshName.c_str() ); - Storable::DataToStream( theStr, "myGeomNameList", aStrSubMeshName.latin1()); - Storable::DataToStream( theStr, "myGeomEntityList", aStrEntity.latin1()); - -} - -void VISU::PrsMerger_i::clearMeshList() -{ - VISU_PrsMergerPL::TPipeLines::const_iterator aIter = myMeshPLList.begin(); - for(int i=0;aIter != myMeshPLList.end();aIter++,i++){ - ((*aIter).GetPointer())->Delete(); - } - myMeshPLList.clear(); - myGeomNameEntityList.clear(); -} - -void VISU::PrsMerger_i::RemoveAllGeom() -{ - clearMeshList(); - myPrsMergerPL->RemoveAllGeom(); - - UpdateIcon(); -} - - -VISU::PrsMerger_i::~PrsMerger_i(){ - if(MYDEBUG) if (MYDEBUG) MESSAGE("PrsMerger_i::~PrsMerger_i()"); - this->clearMeshList(); -} - -void -VISU::PrsMerger_i -::SameAs(const Prs3d_i* theOrigin) -{ - if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::SameAs: this="<(theOrigin)){ - PrsMerger_i* anOrigin = const_cast(aPrs3d); - if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::SameAs: theOrigin="<SetScalarMap(myMeshName.c_str(),VISU::Entity(myEntity),myFieldName.c_str(),myIteration); - string_array_var aGroupNames = anOrigin->getGroupNames(); - RemoveAllGeom(); - for(int i=0;ilength();i++){ - this->AddMeshOnGroup(myMeshName.c_str(),aGroupNames[i]); - } - Update(); - } -} - -void VISU::PrsMerger_i::Update() -{ - TSuperClass::Update(); -} - -VISU_Actor* -VISU::PrsMerger_i -::CreateActor(const Handle(SALOME_InteractiveObject)& theIO, bool toSupressShrinking) -{ - if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::CreateActor this="<GetInput()->GetMeshOnGroup(theMeshName,theGroupName); - - VISU_MeshPL* aTmpMesh = VISU_MeshPL::New(); - aTmpMesh->SetIDMapper(anIDMapper); - - if(myPrsMergerPL->SetGeometry(aTmpMesh)){ - this->clearMeshList(); - myMeshPLList.push_back(aTmpMesh); - TPairStringAndInt aPair((std::string)theGroupName,-1); - myGeomNameEntityList.push_back(aPair); - } - else - aTmpMesh->Delete(); - - UpdateIcon(); -} - -CORBA::Long -VISU::PrsMerger_i:: -AddMeshOnGroup(const char* theMeshName, - const char* theGroupName) -{ - if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::AddMeshOnGroup |"<< theGroupName <<"| this="<GetInput()->GetMeshOnGroup(theMeshName,theGroupName); - if(!anIDMapper) - MESSAGE("Warning: There are no mesh with group=|"<Delete(); -} - -void -VISU::PrsMerger_i:: -SetScalarMap(const char* theMeshName, - const VISU::Entity theEntity, - const char* theFieldName, - CORBA::Long theStampsNum) -{ - if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::SetScalarMap this="<GetInput()->GetTimeStampOnMesh(theMeshName,(VISU::TEntity)theEntity,theFieldName,int(theStampsNum)); - - myEntity = (VISU::TEntity)theEntity; - myFieldName = theFieldName; - myIteration = theStampsNum; - - myScalarsPL->SetIDMapper(anIDMapper); - myPrsMergerPL->SetScalars(myScalarsPL); -} - -void -VISU::PrsMerger_i:: -SetScalarMap(VISU_PipeLine* thePipeLine) -{ - if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::SetScalarMap"); - VISU_ScalarMapPL* aInputScalars = dynamic_cast(thePipeLine); - VISU::PIDMapper anIDMapper = aInputScalars->GetIDMapper(); - myScalarsPL->SetIDMapper(anIDMapper); - if(aInputScalars) - myPrsMergerPL->SetScalars(myScalarsPL); -} - -void -VISU::PrsMerger_i:: -RemoveGeometryByName(const char* theName) -{ - // not implemented yet. -} - -void -VISU::PrsMerger_i:: -RemoveGeometryById(CORBA::Long theId) -{ - if(myGeomNameEntityList.size() != myMeshPLList.size()){ - // warning situation. Some information lost - // check myGeomNameEntityList and myMeshPLList - } - - if(theId >=0 && (int)theId < myMeshPLList.size()){ - VISU_PrsMergerPL::TPipeLines::iterator aIter = myMeshPLList.begin(); - for(;aIter != myMeshPLList.end();aIter++){ - if( myMeshPLList[theId] == (*aIter)){ - myMeshPLList.erase(aIter); - break; - } - } - } - if(theId >=0 && (int)theId < myGeomNameEntityList.size()){ - TNameAndEntityList::iterator aIter = myGeomNameEntityList.begin(); - for(;aIter != myGeomNameEntityList.end();aIter++){ - if( myGeomNameEntityList[theId] == (*aIter) ){ - myGeomNameEntityList.erase(aIter); - break; - } - } - } - myPrsMergerPL->RemoveGeometryById((int)theId); -} - -void -VISU::PrsMerger_i -::DoHook(){ - if(!myPipeLine) myPipeLine = VISU_PrsMergerPL::New(); - myPrsMergerPL = dynamic_cast(myPipeLine); - myPipeLine->GetMapper()->SetScalarVisibility(IsColored()); - TSuperClass::DoHook(); -} - -const char* -VISU::PrsMerger_i -::GetIconName() -{ - if (!GetNumberOfGeom()) - return "ICON_TREE_SCALAR_MAP"; - else - return "ICON_TREE_SCALAR_MAP_GROUPS"; -} - -void VISU::PrsMerger_i -::UpdateIcon() -{ - if (mySObject->_is_nil()) - return; - - SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); - - // Check if the icon needs to be updated, update if necessary - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributePixMap_var aPixmap; - - anAttr = aStudyBuilder->FindOrCreateAttribute( mySObject, "AttributePixMap" ); - aPixmap = SALOMEDS::AttributePixMap::_narrow( anAttr ); - - if ( aPixmap->GetPixMap() != (std::string)GetIconName() ) - aPixmap->SetPixMap(GetIconName()); - - // Update Object Browser - SUIT_Session* aSession = SUIT_Session::session(); - QPtrList anApplications = aSession->applications(); - QPtrListIterator anIter (anApplications); - while (SUIT_Application* aSApp = anIter.current()) { - SalomeApp_Application* anApp = dynamic_cast(aSApp); - if (!anApp) return; - SalomeApp_Study* aStudy = dynamic_cast(anApp->activeStudy()); - if (!aStudy) return; - if (_PTR(Study) aCStudy = aStudy->studyDS()) { - if (myStudy->StudyId() == aCStudy->StudyId()) { - anApp->updateObjectBrowser(); - break; - } - } - ++anIter; - } -} - -CORBA::Long -VISU::PrsMerger_i -::GetNumberOfGeom() -{ - if(myPrsMergerPL) - return myPrsMergerPL->GetNbGeometry(); - else - return 0; -} - -string_array* -VISU::PrsMerger_i -::getGroupNames() -{ - string_array_var myseq = new string_array; - if(myPrsMergerPL){ - vector aGroupNames; - TNameAndEntityList::const_iterator aIter = myGeomNameEntityList.begin(); - for(;aIter!=myGeomNameEntityList.end();aIter++){ - TPairStringAndInt aPair = (*aIter); - if(aPair.second == -1) - aGroupNames.push_back(aPair.first); - } - myseq->length(aGroupNames.size()); - vector::const_iterator aNamesIter = aGroupNames.begin(); - for(int i=0;aNamesIter!=aGroupNames.end();i++,aNamesIter++){ - myseq[i] = CORBA::string_dup((*aNamesIter).c_str()); - } - } - return myseq._retn(); -} - -bool -VISU::PrsMerger_i -::CheckGroup(const char* theGroupName) -{ - if (MYDEBUG) MESSAGE("PrsMerger_i::CheckGroup :|"<GetInput()->GetMeshOnGroup(aMeshName,theGroupName); - if (MYDEBUG) MESSAGE("anIDMapper="<GetVTKOutput()->GetNumberOfCells(); - if(aNbCellsInGeom>0){ - int aVtkCellType = anIDMapper->GetVTKOutput()->GetCellType(0); - if (MYDEBUG) MESSAGE("CellType="< TPairStringAndInt; - typedef std::vector TNameAndEntityList; - - explicit - PrsMerger_i(Result_i* theResult, - bool theAddToStudy); - explicit - PrsMerger_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject); - virtual void SameAs(const Prs3d_i* theOrigin); - virtual ~PrsMerger_i(); - - virtual VISU::VISUType GetType() { return VISU::TPRSMERGER;}; - - virtual CORBA::Boolean IsColored() { return myIsColored; } - virtual void ShowColored(CORBA::Boolean theColored) { myIsColored = theColored; } - - virtual SALOMEDS::Color GetColor() { return myColor;} - virtual void SetColor(const SALOMEDS::Color& theColor) { myColor = theColor;} - - VISU_PrsMergerPL* GetPrsMergerPL(){ return myPrsMergerPL;} - - virtual void Update(); - - protected: - virtual void DoHook(); - virtual const char* GetIconName(); - void UpdateIcon(); - void clearMeshList(); - - VISU_PrsMergerPL* myPrsMergerPL; - VISU_PrsMergerPL::TPipeLines myMeshPLList; - VISU_ScalarMapPL* myScalarsPL; - - SALOMEDS::Color myColor; - bool myIsColored; - - /*! Warning! This variable must be maked as list, if - * you we will need in different mesh entities (ENTITY,FAMILY,GROUP) as geometries. - */ - TNameAndEntityList myGeomNameEntityList; - - public: - static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration, int isMemoryCheck = true); - - virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration); - - virtual void ToStream(std::ostringstream& theStr); - - virtual Storable* Restore(const Storable::TRestoringMap& theMap); - - virtual - void - SetMapScale(double theMapScale = 1.0); - - static const std::string myComment; - virtual const char* GetComment() const; - virtual QString GenerateName(); - - virtual - VISU_Actor* - CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); - - virtual - VISU_Actor* - CreateActor(const Handle(SALOME_InteractiveObject)& theIO, bool toSupressShrinking); - - virtual void UpdateActor(VISU_Actor* theActor) ; - - /*! - * Sets geometry of mesh as group - */ - virtual void SetMeshOnGroup(const char* theMeshName, - const char* theGroupName); - - /*! - * Add geometry of mesh as group - * \retval the id of added group. - */ - virtual CORBA::Long AddMeshOnGroup(const char* theMeshName, - const char* theGroupName); - - /*! - * Remove geometry from list by Name - */ - virtual void RemoveGeometryByName(const char* theName); - - /*! - * Removes geometry from list by id - * Note: theId number in [0,...] - * - * Waring: if you delete not 0 element, others indexes will be increased. - * Example: - * 0,1,2,3,4 - indexes - * remove 2 index - * new sequence: - * 0,1,2,3,4 , where are 0 = 0, 1 = 1, 3 = 2, 4 = 3. - */ - virtual void RemoveGeometryById(CORBA::Long theId); - - - /*! - * Sets geometry of mesh as family on entity - */ - virtual void SetFamilyOnEntity(const char* theMeshName, - const VISU::Entity theEntity, - const char* theFamilyName); - - /*! - * Sets geometry of mesh as mesh on entity - */ - virtual void SetMeshOnEntity(const char* theMeshName, - const VISU::Entity theEntity); - - - /*! - * Sets scalars as scalar map - */ - virtual void SetScalarMap(const char* theMeshName, - VISU::Entity theEntity, - const char* theFieldName, - CORBA::Long theStampsNum); - - /*! - * Get number of geometries. - */ - CORBA::Long GetNumberOfGeom(); - - - /*! - * Get group names. - */ - string_array* getGroupNames(); - - /*! - * Sets scalars as scalar map - */ - void SetScalarMap(VISU_PipeLine* thePipeLine); - - /*! - * Removes all geometries. - */ - virtual void RemoveAllGeom(); - - - /*! Warning! - * see \a myGeomNameEntityList - */ - virtual CORBA::Long GetMeshGeometryPlace(CORBA::Long theId){return CORBA::Long(1);};// must bee filled - - /*! - * Return true, if group is good, esle false. - * May be used, if SetScalarMap(...) olready . - */ - bool CheckGroup(const char* theGroupName); - - }; - -} - -#endif -- 2.39.2