VISU_ExtractUnstructuredGrid.hxx \
VISU_UsedPointsFilter.hxx \
VISU_CommonCellsFilter.hxx \
- VISUConvertor.hxx
+ VISUConvertor.hxx \
+ VISU_GaussMergeFilter.hxx
dist_libVisuConvertor_la_SOURCES= \
VISU_IDMapper.cxx \
VISU_MergeFilter.cxx \
VISU_MergeFilterUtilities.cxx \
VISU_UsedPointsFilter.cxx \
- VISU_CommonCellsFilter.cxx
+ VISU_CommonCellsFilter.cxx \
+ VISU_GaussMergeFilter.cxx
libVisuConvertor_la_CPPFLAGS= \
-ftemplate-depth-32 \
--- /dev/null
+// SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+// 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 : SALOME
+// $Header$
+
+#include "VISU_GaussMergeFilter.hxx"
+#include "VISU_MergeFilterUtilities.hxx"
+
+#include <vtkObjectFactory.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkPolyData.h>
+#include <vtkCellData.h>
+#include <vtkPointData.h>
+#include <vtkIdList.h>
+#include <vtkCell.h>
+#include <vtkFloatArray.h>
+
+#include <vtkExecutive.h>
+#include <vtkInformation.h>
+#include <vtkInformationVector.h>
+#include <vtkStreamingDemandDrivenPipeline.h>
+
+
+//------------------------------------------------------------------------------
+vtkStandardNewMacro(VISU_GaussMergeFilter);
+
+//------------------------------------------------------------------------------
+VISU_GaussMergeFilter
+::VISU_GaussMergeFilter():
+ myIsMergingInputs(false)
+{
+ this->FieldList = new VISU::TFieldList;
+ this->SetNumberOfInputPorts(6);
+}
+
+//------------------------------------------------------------------------------
+VISU_GaussMergeFilter::~VISU_GaussMergeFilter()
+{
+ delete this->FieldList;
+}
+
+//------------------------------------------------------------------------------
+void VISU_GaussMergeFilter::SetGeometry(vtkDataSet *input)
+{
+ this->Superclass::SetInput(input);
+}
+
+//------------------------------------------------------------------------------
+vtkDataSet *VISU_GaussMergeFilter::GetGeometry()
+{
+ if (this->GetNumberOfInputConnections(0) < 1)
+ {
+ return NULL;
+ }
+ return vtkDataSet::SafeDownCast(
+ this->GetExecutive()->GetInputData(0, 0));
+}
+
+//------------------------------------------------------------------------------
+void VISU_GaussMergeFilter::SetScalars(vtkDataSet *input)
+{
+ this->SetInput(1, input);
+}
+
+//------------------------------------------------------------------------------
+vtkDataSet *VISU_GaussMergeFilter::GetScalars()
+{
+ if (this->GetNumberOfInputConnections(1) < 1)
+ {
+ return NULL;
+ }
+ return vtkDataSet::SafeDownCast(
+ this->GetExecutive()->GetInputData(1, 0));
+}
+
+//------------------------------------------------------------------------------
+void VISU_GaussMergeFilter::SetVectors(vtkDataSet *input)
+{
+ this->SetInput(2, input);
+}
+
+//------------------------------------------------------------------------------
+vtkDataSet *VISU_GaussMergeFilter::GetVectors()
+{
+ if (this->GetNumberOfInputConnections(2) < 1)
+ {
+ return NULL;
+ }
+ return vtkDataSet::SafeDownCast(
+ this->GetExecutive()->GetInputData(2, 0));
+}
+
+//------------------------------------------------------------------------------
+void VISU_GaussMergeFilter::SetNormals(vtkDataSet *input)
+{
+ this->SetInput(3, input);
+}
+
+//------------------------------------------------------------------------------
+vtkDataSet *VISU_GaussMergeFilter::GetNormals()
+{
+ if (this->GetNumberOfInputConnections(3) < 1)
+ {
+ return NULL;
+ }
+ return vtkDataSet::SafeDownCast(
+ this->GetExecutive()->GetInputData(3, 0));
+}
+
+//------------------------------------------------------------------------------
+void VISU_GaussMergeFilter::SetTCoords(vtkDataSet *input)
+{
+ this->SetInput(4, input);
+}
+
+//------------------------------------------------------------------------------
+vtkDataSet *VISU_GaussMergeFilter::GetTCoords()
+{
+ if (this->GetNumberOfInputConnections(4) < 1)
+ {
+ return NULL;
+ }
+ return vtkDataSet::SafeDownCast(
+ this->GetExecutive()->GetInputData(4, 0));
+}
+
+//------------------------------------------------------------------------------
+void VISU_GaussMergeFilter::SetTensors(vtkDataSet *input)
+{
+ this->SetInput(5, input);
+}
+
+//------------------------------------------------------------------------------
+vtkDataSet *VISU_GaussMergeFilter::GetTensors()
+{
+ if (this->GetNumberOfInputConnections(5) < 1)
+ {
+ return NULL;
+ }
+ return vtkDataSet::SafeDownCast(
+ this->GetExecutive()->GetInputData(5, 0));
+}
+
+//------------------------------------------------------------------------------
+void VISU_GaussMergeFilter::AddField(const char* name, vtkDataSet* input)
+{
+ this->FieldList->Add(name, input);
+}
+
+//------------------------------------------------------------------------------
+void VISU_GaussMergeFilter::RemoveFields()
+{
+ delete this->FieldList;
+ this->FieldList = new VISU::TFieldList;
+}
+
+
+//---------------------------------------------------------------
+void
+VISU_GaussMergeFilter
+::SetMergingInputs(bool theIsMergingInputs)
+{
+ if(myIsMergingInputs == theIsMergingInputs)
+ return;
+
+ myIsMergingInputs = theIsMergingInputs;
+ Modified();
+}
+
+
+//---------------------------------------------------------------
+bool
+VISU_GaussMergeFilter
+::IsMergingInputs()
+{
+ return myIsMergingInputs;
+}
+
+
+//---------------------------------------------------------------
+int
+VISU_GaussMergeFilter
+::RequestData(vtkInformation *theRequest,
+ vtkInformationVector **theInputVector,
+ vtkInformationVector *theOutputVector)
+{
+ if(vtkUnstructuredGrid *anInput = dynamic_cast<vtkUnstructuredGrid*>(this->GetInput())){
+ vtkPolyData *anOutput = dynamic_cast<vtkPolyData*>(this->GetOutput());
+ return ExecuteGauss(anInput,
+ anOutput);
+ }
+
+ return Superclass::RequestData(theRequest,
+ theInputVector,
+ theOutputVector);
+}
+
+//----------------------------------------------------------------------------
+// Trick: Abstract data types that may or may not be the same type
+// (structured/unstructured), but the points/cells match up.
+// Output/Geometry may be structured while ScalarInput may be
+// unstructured (but really have same triagulation/topology as geometry).
+// Just request all the input. Always generate all of the output (todo).
+int
+VISU_GaussMergeFilter
+::RequestUpdateExtent(vtkInformation *vtkNotUsed(request),
+ vtkInformationVector **inputVector,
+ vtkInformationVector *vtkNotUsed(outputVector))
+{
+ vtkInformation *inputInfo;
+ int idx;
+
+ for (idx = 0; idx < 6; ++idx)
+ {
+ inputInfo = inputVector[idx]->GetInformationObject(0);
+ if (inputInfo)
+ {
+ inputInfo->Set(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER(),
+ 0);
+ inputInfo->Set(vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_PIECES(),
+ 1);
+ inputInfo->Set(vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_GHOST_LEVELS(),
+ 0);
+ inputInfo->Set(vtkStreamingDemandDrivenPipeline::EXACT_EXTENT(), 1);
+ }
+ }
+ return 1;
+}
+
+
+//----------------------------------------------------------------------------
+int
+VISU_GaussMergeFilter
+::FillInputPortInformation(int port, vtkInformation *info)
+{
+ int retval = this->Superclass::FillInputPortInformation(port, info);
+ if (port > 0)
+ {
+ info->Set(vtkAlgorithm::INPUT_IS_OPTIONAL(), 1);
+ }
+ return retval;
+}
+
+//----------------------------------------------------------------------------
+int
+VISU_GaussMergeFilter
+::FillOutputPortInformation(int port, vtkInformation *info)
+{
+ info->Set(vtkDataObject::DATA_TYPE_NAME(),"vtkPolyData");
+ return 1;
+}
+
+void
+VISU_GaussMergeFilter
+::SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theIDMapper)
+{
+ myGaussPtsIDMapper = theIDMapper;
+}
+
+
+const VISU::PGaussPtsIDMapper&
+VISU_GaussMergeFilter
+::GetGaussPtsIDMapper()
+{
+ return myGaussPtsIDMapper;
+}
+
+bool
+VISU_GaussMergeFilter
+::ExecuteGauss(vtkUnstructuredGrid* theInput,
+ vtkPolyData* theOutput)
+{
+ if(IsMergingInputs()){
+ vtkCellData *aCellData = theInput->GetCellData();
+ if(vtkDataArray *aCellMapper = aCellData->GetArray("VISU_CELLS_MAPPER")){
+ vtkIntArray *aGeometryCellMapper = dynamic_cast<vtkIntArray*>(aCellMapper);
+
+ vtkIntArray* aDataPointMapper = GetIDMapper(FieldList,
+ VISU::TGetPointData(),
+ "VISU_POINTS_MAPPER");
+
+ vtkIntArray* aDataCellIds = vtkIntArray::New();
+
+ int nbPoints = aDataPointMapper->GetNumberOfTuples();
+ aDataCellIds->SetNumberOfComponents(2);
+ aDataCellIds->SetNumberOfTuples(nbPoints);
+ int* aDataCellPointer = aDataCellIds->GetPointer(0);
+ {
+ int nbPoints = aDataPointMapper->GetNumberOfTuples();
+ for(int i=0;i<nbPoints;i++,aDataCellPointer++){
+ VISU::TGaussPointID aGPID = myGaussPtsIDMapper->GetObjID(i);
+ vtkIdType aCellId = aGPID.first;
+ *aDataCellPointer = aCellId;
+ aDataCellPointer++;
+ *aDataCellPointer = 3; // it's a entity CELL
+ }
+ }
+ /*
+ vtkIntArray* anCellArr = GetIDMapper(FieldList,
+ VISU::TGetCellData(),
+ "VISU_CELLS_MAPPER");
+ vtkIntArray* anPMArr = GetIDMapper(FieldList,
+ VISU::TGetPointData(),
+ "VISU_POINTS_MAPPER");
+
+ vtkDataArray* anFArr = GetIDMapper(FieldList,
+ VISU::TGetPointData(),
+ "VISU_FIELD");
+ */
+ if(VISU::IsDifferent(aDataCellIds, aGeometryCellMapper)){
+ VISU::TObjectIdArray anIntersection;
+ VISU::GetIntersection(aDataCellIds,
+ aGeometryCellMapper,
+ anIntersection);
+
+ vtkIdType aNbTuples = anIntersection.size();
+
+ VISU::TObjectId2TupleIdMap aDataCellId2TupleIdMap;
+ VISU::GetObjectId2TupleIdMap(aDataCellIds, aDataCellId2TupleIdMap);
+
+ vtkPointSet* aScalarsDataSet = dynamic_cast<vtkPointSet*>(GetScalars());
+ vtkPoints* aDataPoints = aScalarsDataSet->GetPoints();
+ vtkPoints* anOutputPoints = vtkPoints::New(aDataPoints->GetDataType());
+
+ anOutputPoints->SetNumberOfPoints(aNbTuples);
+ theOutput->SetPoints(anOutputPoints);
+ anOutputPoints->Delete();
+
+ vtkCellData* anInputCellData = aScalarsDataSet->GetCellData();
+ vtkPointData* anInputPointData = aScalarsDataSet->GetPointData();
+
+ theOutput->Allocate(aNbTuples);
+ vtkCellData* anOutputCellData = theOutput->GetCellData();
+ vtkPointData* anOutputPointData = theOutput->GetPointData();
+
+ anOutputCellData->CopyAllocate(anInputCellData,aNbTuples);
+ anOutputPointData->CopyAllocate(anInputPointData,aNbTuples);
+
+ vtkIdList *aCellIds = vtkIdList::New();
+ vtkFloatingPointType aCoords[3];
+ for(int aTupleId=0;aTupleId<aNbTuples;aTupleId++){
+ VISU::TObjectId& anObjectId = anIntersection[aTupleId];
+
+ vtkIdType aCellId = aDataCellId2TupleIdMap[anObjectId];
+ vtkCell *aCell = GetScalars()->GetCell(aCellId);
+
+ aCellIds->Reset();
+ aCellIds->InsertNextId(aTupleId);
+
+ vtkIdType aCellType = GetScalars()->GetCellType(aCellId);
+ vtkIdType aNewCellId = theOutput->InsertNextCell(aCellType, aCellIds);
+
+ anOutputCellData->CopyData(anInputCellData, aCellId, aNewCellId);
+ anOutputPointData->CopyData(anInputPointData, aCellId, aNewCellId);
+
+ aDataPoints->GetPoint(aCellId, aCoords);
+ anOutputPoints->SetPoint(aNewCellId, aCoords);
+ }
+ }
+ }
+ }
+ return true;
+}
--- /dev/null
+// SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+// 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 : SALOME
+// $Header$
+
+#ifndef VISU_GaussMergeFilter_H
+#define VISU_GaussMergeFilter_H
+
+#include "VISU_Convertor.hxx"
+
+//#include <vtkDataSetAlgorithm.h>
+#include <vtkPointSetAlgorithm.h>
+
+namespace VISU
+{
+ class TFieldList;
+}
+
+
+//------------------------------------------------------------------------------
+class VISU_CONVERTOR_EXPORT VISU_GaussMergeFilter : public vtkPointSetAlgorithm
+{
+public:
+ static VISU_GaussMergeFilter *New();
+ vtkTypeMacro(VISU_GaussMergeFilter, vtkPointSetAlgorithm);
+
+ // Description:
+ // Specify object from which to extract geometry information.
+ void SetGeometry(vtkDataSet *input);
+ vtkDataSet *GetGeometry();
+
+ // Description:
+ // Specify object from which to extract scalar information.
+ void SetScalars(vtkDataSet *);
+ vtkDataSet *GetScalars();
+
+ // Description:
+ // Set / get the object from which to extract vector information.
+ void SetVectors(vtkDataSet *);
+ vtkDataSet *GetVectors();
+
+ // Description:
+ // Set / get the object from which to extract normal information.
+ void SetNormals(vtkDataSet *);
+ vtkDataSet *GetNormals();
+
+ // Description:
+ // Set / get the object from which to extract texture coordinates
+ // information.
+ void SetTCoords(vtkDataSet *);
+ vtkDataSet *GetTCoords();
+
+ // Description:
+ // Set / get the object from which to extract tensor data.
+ void SetTensors(vtkDataSet *);
+ vtkDataSet *GetTensors();
+
+ // Description:
+ // Set the object from which to extract a field and the name
+ // of the field
+ void AddField(const char* name, vtkDataSet* input);
+
+ // Description:
+ // Removes all previously added fields
+ void RemoveFields();
+
+ // Description:
+ // Defines whether to perform merging of data with the geometry according to
+ // the ids of the cell or not
+ void
+ SetMergingInputs(bool theIsMergingInputs);
+
+ bool
+ IsMergingInputs();
+
+ void
+ SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theGaussPtsIDMapper);
+
+ const VISU::PGaussPtsIDMapper&
+ GetGaussPtsIDMapper();
+
+protected:
+ VISU_GaussMergeFilter();
+ ~VISU_GaussMergeFilter();
+
+ virtual
+ int
+ RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
+
+ int
+ RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
+
+ int
+ FillInputPortInformation(int port, vtkInformation *info);
+
+ int
+ FillOutputPortInformation(int port, vtkInformation *info);
+
+ VISU::TFieldList* FieldList;
+ bool myIsMergingInputs;
+
+ VISU::PGaussPtsIDMapper myGaussPtsIDMapper;
+
+ bool
+ ExecuteGauss(vtkUnstructuredGrid* theInput,
+ vtkPolyData* theOutput);
+
+private:
+ VISU_GaussMergeFilter(const VISU_GaussMergeFilter&); // Not implemented.
+ void operator=(const VISU_GaussMergeFilter&); // Not implemented.
+};
+
+#endif
+
+
namespace
{
- //---------------------------------------------------------------
- typedef int TCellId;
- typedef int TEntityId;
- typedef std::pair<TCellId, TEntityId> TObjectId;
-
- typedef std::set<TObjectId> TObjectIdSet;
- typedef std::vector<TObjectId> TObjectIdArray;
-
- typedef int TTupleId;
- typedef std::map<TObjectId, TTupleId> TObjectId2TupleIdMap;
-
-
- //---------------------------------------------------------------
- void
- GetObjectIdSet(vtkIntArray *theArray,
- TObjectIdSet& theObjectIdSet)
- {
- theObjectIdSet.clear();
- int aMaxId = theArray->GetMaxId();
- int* aPointer = theArray->GetPointer(0);
- int* anEndPointer = theArray->GetPointer(aMaxId + 1);
- for(; aPointer != anEndPointer; aPointer += 2){
- TCellId aCellId = *aPointer;
- TEntityId anEntityId = *(aPointer + 1);
- TObjectId anObjectId(aCellId, anEntityId);
- theObjectIdSet.insert(anObjectId);
- }
- }
-
-
- //---------------------------------------------------------------
- void
- GetObjectId2TupleIdMap(vtkIntArray *theArray,
- TObjectId2TupleIdMap& theObjectId2TupleIdMap)
- {
- theObjectId2TupleIdMap.clear();
- int* aPointer = theArray->GetPointer(0);
- int aNbTuples = theArray->GetNumberOfTuples();
- for(vtkIdType aTupleId = 0; aTupleId < aNbTuples; aTupleId++, aPointer += 2){
- TCellId aCellId = *aPointer;
- TEntityId anEntityId = *(aPointer + 1);
- TObjectId anObjectId(aCellId, anEntityId);
- theObjectId2TupleIdMap[anObjectId] = aTupleId;
- }
- }
-
-
- //---------------------------------------------------------------
- typedef vtkFieldData* (vtkDataSet::* TGetFieldData)();
-
- //---------------------------------------------------------------
- struct TGetCellData
- {
- vtkFieldData*
- operator()(vtkDataSet* theDataSet)
- {
- return theDataSet->GetCellData();
- }
- };
-
-
- //---------------------------------------------------------------
- struct TGetPointData
- {
- vtkFieldData*
- operator()(vtkDataSet* theDataSet)
- {
- return theDataSet->GetPointData();
- }
- };
-
-
- //---------------------------------------------------------------
- template<class TGetFieldData>
- vtkIntArray*
- GetIDMapper(VISU::TFieldList* theFieldList,
- TGetFieldData theGetFieldData,
- const char* theFieldName)
- {
- VISU::TFieldListIterator anIter(theFieldList);
- for(anIter.Begin(); !anIter.End() ; anIter.Next()){
- const char* aFieldName = anIter.Get()->GetName();
- if(strcmp(aFieldName, theFieldName) == 0){
- vtkDataSet* aDataSet = anIter.Get()->Ptr;
- vtkFieldData *aFieldData = theGetFieldData(aDataSet);
- vtkDataArray *anIDMapper = aFieldData->GetArray(theFieldName);
- return dynamic_cast<vtkIntArray*>(anIDMapper);
- }
- }
- return NULL;
- }
-
-
- //---------------------------------------------------------------
- template<class TGetFieldData>
- vtkIntArray*
- GetIDMapper(vtkDataSet* theIDMapperDataSet,
- TGetFieldData theGetFieldData,
- const char* theFieldName)
- {
- vtkFieldData *aFieldData = theGetFieldData(theIDMapperDataSet);
- vtkDataArray *anIDMapper = aFieldData->GetArray(theFieldName);
- return dynamic_cast<vtkIntArray*>(anIDMapper);
- }
-
-
- //---------------------------------------------------------------
- bool
- IsDifferent(vtkIntArray *theFirstIDMapper,
- vtkIntArray *theSecondIDMapper)
- {
- vtkIdType aFirstNbTuples = theFirstIDMapper->GetNumberOfTuples();
- vtkIdType aSecondNbTuples = theSecondIDMapper->GetNumberOfTuples();
- if(aFirstNbTuples != aSecondNbTuples)
- return true;
-
- int aMaxId = theFirstIDMapper->GetMaxId();
- int* aFirstPointer = theFirstIDMapper->GetPointer(0);
- int* aSecondPointer = theSecondIDMapper->GetPointer(0);
- for(int anId = 0; anId <= aMaxId; anId++){
- if(*aFirstPointer++ != *aSecondPointer++)
- return true;
- }
-
- return false;
- }
-
-
- //---------------------------------------------------------------
- inline
- void
- GetIntersection(vtkIntArray *theFirstIDMapper,
- vtkIntArray *theSecondIDMapper,
- TObjectIdArray& theResult)
- {
- TObjectIdSet aFirstObjectIdSet;
- GetObjectIdSet(theFirstIDMapper, aFirstObjectIdSet);
-
- TObjectIdSet aSecondObjectIdSet;
- GetObjectIdSet(theSecondIDMapper, aSecondObjectIdSet);
-
- size_t aMaxLength = std::max(aFirstObjectIdSet.size(), aSecondObjectIdSet.size());
- theResult.resize(aMaxLength);
- TObjectIdArray::iterator anArrayIter = theResult.begin();
- anArrayIter = std::set_intersection(aFirstObjectIdSet.begin(),
- aFirstObjectIdSet.end(),
- aSecondObjectIdSet.begin(),
- aSecondObjectIdSet.end(),
- anArrayIter);
- theResult.erase(anArrayIter, theResult.end());
- }
-
+ using namespace VISU;
+
//---------------------------------------------------------------
template<class TDataSet>
+
void
CopyDataOnCells(TDataSet *theInput,
vtkIntArray *theGeometryCellMapper,
theOutput->GetPointData()->ShallowCopy(theScalarsDataSet->GetPointData());
}
-
//---------------------------------------------------------------
typedef vtkDataArray* (vtkDataSetAttributes::* TGetAttribute)();
typedef int (vtkDataSetAttributes::* TSetAttribute)(vtkDataArray*);
}
}
-
namespace VISU
{
+ //---------------------------------------------------------------
+ void
+ GetObjectIdSet(vtkIntArray *theArray,
+ TObjectIdSet& theObjectIdSet)
+ {
+ theObjectIdSet.clear();
+ int aMaxId = theArray->GetMaxId();
+ int* aPointer = theArray->GetPointer(0);
+ int* anEndPointer = theArray->GetPointer(aMaxId + 1);
+ for(; aPointer != anEndPointer; aPointer += 2){
+ TCellId aCellId = *aPointer;
+ TEntityId anEntityId = *(aPointer + 1);
+ TObjectId anObjectId(aCellId, anEntityId);
+ theObjectIdSet.insert(anObjectId);
+ }
+ }
+
+
+ //---------------------------------------------------------------
+ void
+ GetObjectId2TupleIdMap(vtkIntArray *theArray,
+ TObjectId2TupleIdMap& theObjectId2TupleIdMap)
+ {
+ theObjectId2TupleIdMap.clear();
+ int* aPointer = theArray->GetPointer(0);
+ int aNbTuples = theArray->GetNumberOfTuples();
+ for(vtkIdType aTupleId = 0; aTupleId < aNbTuples; aTupleId++, aPointer += 2){
+ TCellId aCellId = *aPointer;
+ TEntityId anEntityId = *(aPointer + 1);
+ TObjectId anObjectId(aCellId, anEntityId);
+ theObjectId2TupleIdMap[anObjectId] = aTupleId;
+ }
+ }
+
+
+ //---------------------------------------------------------------
+ template<class TGetFieldData>
+ vtkIntArray*
+ GetIDMapper(VISU::TFieldList* theFieldList,
+ TGetFieldData theGetFieldData,
+ const char* theFieldName)
+ {
+ VISU::TFieldListIterator anIter(theFieldList);
+ for(anIter.Begin(); !anIter.End() ; anIter.Next()){
+ const char* aFieldName = anIter.Get()->GetName();
+ if(strcmp(aFieldName, theFieldName) == 0){
+ vtkDataSet* aDataSet = anIter.Get()->Ptr;
+ vtkFieldData *aFieldData = theGetFieldData(aDataSet);
+ vtkDataArray *anIDMapper = aFieldData->GetArray(theFieldName);
+ return dynamic_cast<vtkIntArray*>(anIDMapper);
+ }
+ }
+ return NULL;
+ }
+
+
+ //---------------------------------------------------------------
+ template<class TGetFieldData>
+ vtkIntArray*
+ GetIDMapper(vtkDataSet* theIDMapperDataSet,
+ TGetFieldData theGetFieldData,
+ const char* theFieldName)
+ {
+ vtkFieldData *aFieldData = theGetFieldData(theIDMapperDataSet);
+ vtkDataArray *anIDMapper = aFieldData->GetArray(theFieldName);
+ return dynamic_cast<vtkIntArray*>(anIDMapper);
+ }
+
+
+ //---------------------------------------------------------------
+ bool
+ IsDifferent(vtkIntArray *theFirstIDMapper,
+ vtkIntArray *theSecondIDMapper)
+ {
+ vtkIdType aFirstNbTuples = theFirstIDMapper->GetNumberOfTuples();
+ vtkIdType aSecondNbTuples = theSecondIDMapper->GetNumberOfTuples();
+ if(aFirstNbTuples != aSecondNbTuples)
+ return true;
+
+ int aMaxId = theFirstIDMapper->GetMaxId();
+ int* aFirstPointer = theFirstIDMapper->GetPointer(0);
+ int* aSecondPointer = theSecondIDMapper->GetPointer(0);
+ for(int anId = 0; anId <= aMaxId; anId++){
+ if(*aFirstPointer++ != *aSecondPointer++)
+ return true;
+ }
+
+ return false;
+ }
+
+
+ //---------------------------------------------------------------
+ void
+ GetIntersection(vtkIntArray *theFirstIDMapper,
+ vtkIntArray *theSecondIDMapper,
+ TObjectIdArray& theResult)
+ {
+ TObjectIdSet aFirstObjectIdSet;
+ GetObjectIdSet(theFirstIDMapper, aFirstObjectIdSet);
+
+ TObjectIdSet aSecondObjectIdSet;
+ GetObjectIdSet(theSecondIDMapper, aSecondObjectIdSet);
+
+ size_t aMaxLength = std::max(aFirstObjectIdSet.size(), aSecondObjectIdSet.size());
+ theResult.resize(aMaxLength);
+ TObjectIdArray::iterator anArrayIter = theResult.begin();
+ anArrayIter = std::set_intersection(aFirstObjectIdSet.begin(),
+ aFirstObjectIdSet.end(),
+ aSecondObjectIdSet.begin(),
+ aSecondObjectIdSet.end(),
+ anArrayIter);
+ theResult.erase(anArrayIter, theResult.end());
+ }
+
//---------------------------------------------------------------
bool
Execute(vtkUnstructuredGrid *theInput,
theIsMergingInputs,
theOutput);
}
-
-
- //---------------------------------------------------------------
}
#define VISU_MergeFilterUtilities_H
#include <string>
+#include <vtkDataSet.h>
class vtkDataSet;
class vtkPolyData;
class vtkUnstructuredGrid;
+class vtkIntArray;
+
+using namespace std;
+#include <set>
+#include <vector>
+#include <map>
namespace VISU
{
class TFieldList;
+ typedef int TCellId;
+ typedef int TEntityId;
+ typedef std::pair<TCellId, TEntityId> TObjectId;
+
+ typedef std::set<TObjectId> TObjectIdSet;
+ typedef std::vector<TObjectId> TObjectIdArray;
+
+ typedef int TTupleId;
+ typedef std::map<TObjectId, TTupleId> TObjectId2TupleIdMap;
+
+ //---------------------------------------------------------------
+ typedef vtkFieldData* (vtkDataSet::* TGetFieldData)();
+
+ //---------------------------------------------------------------
+ struct TGetCellData
+ {
+ vtkFieldData*
+ operator()(vtkDataSet* theDataSet)
+ {
+ return (vtkFieldData*)(theDataSet->GetCellData());
+ }
+ };
+
+
+ //---------------------------------------------------------------
+ struct TGetPointData
+ {
+ vtkFieldData*
+ operator()(vtkDataSet* theDataSet)
+ {
+ return (vtkFieldData*)(theDataSet->GetPointData());
+ }
+ };
+
+ void
+ GetObjectId2TupleIdMap(vtkIntArray *theArray,
+ TObjectId2TupleIdMap& theObjectId2TupleIdMap);
+
+ template<class TGetFieldData>
+ vtkIntArray*
+ GetIDMapper(VISU::TFieldList* theFieldList,
+ TGetFieldData theGetFieldData,
+ const char* theFieldName);
+
+ template<class TGetFieldData>
+ vtkIntArray*
+ GetIDMapper(vtkDataSet* theIDMapperDataSet,
+ TGetFieldData theGetFieldData,
+ const char* theFieldName);
+
+ bool
+ IsDifferent(vtkIntArray *theFirstIDMapper,
+ vtkIntArray *theSecondIDMapper);
+
+ void
+ GetIntersection(vtkIntArray *theFirstIDMapper,
+ vtkIntArray *theSecondIDMapper,
+ TObjectIdArray& theResult);
//---------------------------------------------------------------
bool
TFieldList* theFieldList,
bool theIsMergingInputs);
-
//---------------------------------------------------------------
class TFieldNode
{
SetNbColors(aPipeLine->GetNbColors());
SetScaling(aPipeLine->GetScaling());
SetMapScale(aPipeLine->GetMapScale());
+ if(this != thePipeLine){
+ if(aPipeLine->IsExternalGeometryUsed()){
+ ClearGeometry();
+ int aNbOfGeometry = aPipeLine->GetNumberOfGeometry();
+ for(int aGeomNumber = 0; aGeomNumber < aNbOfGeometry; aGeomNumber++)
+ AddGeometry(aPipeLine->GetGeometry(aGeomNumber));
+ }else
+ SetSourceGeometry();
+ }
}
}
void
SetSourceRange();
+public:
+
+ virtual
+ void
+ SetSourceGeometry()=0;
+
+ virtual
+ int
+ AddGeometry(vtkDataSet* theGeometry)=0;
+
+ virtual
+ vtkDataSet*
+ GetGeometry(int theGeomNumber)=0;
+
+ virtual
+ int
+ GetNumberOfGeometry()=0;
+
+ virtual
+ bool
+ IsExternalGeometryUsed()=0;
+
+ virtual
+ void
+ ClearGeometry()=0;
+
+ virtual
+ vtkPointSet*
+ GetMergedInput()=0;
+
protected:
//----------------------------------------------------------------------------
VISU_ColoredPL();
vtkSmartPointer<VISU_LookupTable> myBarTable;
vtkSmartPointer<VISU_Extractor> myExtractor;
vtkSmartPointer<VISU_FieldTransform> myFieldTransform;
+
};
#endif
#include "VISU_LookupTable.hxx"
#include "VISU_PipeLineUtils.hxx"
+#include "VISU_AppendFilter.hxx"
+#include "VISU_GaussMergeFilter.hxx"
#include <vtkPointSource.h>
#include <vtkElevationFilter.h>
VISU_GaussPointsPL
::VISU_GaussPointsPL():
myScaleFactor(0.0),
- myMagnificationIncrement(2)
+ myMagnificationIncrement(2),
+ myAppendFilter(VISU_AppendFilter::New()),
+ myMergeFilter(VISU_GaussMergeFilter::New())
{
SetIsShrinkable(false);
for(int i = 0; i < 3; i++)
myPassFilter.push_back(vtkPassThroughFilter::New());
-
+
myPrimitiveType = VISU_OpenGLPointSpriteMapper::PointSprite;
+
+ myAppendFilter->SetMergingInputs(true);
+ myAppendFilter->Delete();
+
+ myMergeFilter->SetMergingInputs(true);
+ myMergeFilter->Delete();
}
aTime = std::max(aTime, myWarpVector->GetMTime());
aTime = std::max(aTime, myGlyph->GetMTime());
aTime = std::max(aTime, mySphereSource->GetMTime());
+ aTime = std::max(aTime, myAppendFilter->GetMTime());
+ aTime = std::max(aTime, myMergeFilter->GetMTime());
for(int i = 0; i < 3; i++)
aTime = std::max(aTime, myPassFilter[i]->GetMTime());
{
Superclass::Build();
- // Deformed Shape
- myPassFilter[0]->SetInput(GetFieldTransformFilter()->GetOutput());
+ SetSourceGeometry();
+
+ vtkDataSet* aDataSet = GetFieldTransformFilter()->GetOutput();
+
+ myMergeFilter->SetGeometry(myAppendFilter->GetOutput());
+
+ myMergeFilter->SetScalars(aDataSet);
+ myMergeFilter->SetVectors(aDataSet);
+
+ myMergeFilter->RemoveFields();
+ myMergeFilter->AddField("VISU_FIELD", aDataSet);
+ myMergeFilter->AddField("VISU_POINTS_MAPPER", aDataSet);
+ myMergeFilter->AddField("VISU_INPUTS_MAPPER", aDataSet);
+ myMergeFilter->AddField("VISU_CELLS_MAPPER", aDataSet);
+
+ myMergeFilter->SetGaussPtsIDMapper(GetGaussPtsIDMapper());
+
+ myPassFilter[0]->SetInput(InsertCustomPL());
myPassFilter[1]->SetInput(myPassFilter[0]->GetOutput());
// Geometrical Sphere
myPassFilter[2]->SetInput(myPassFilter[1]->GetOutput());
-
+
GetPointSpriteMapper()->SetInput( myPassFilter[2]->GetPolyDataOutput() );
// Update according the current state
VISU_GaussPointsPL
::Update()
{
+ if(IsExternalGeometryUsed() || GetNumberOfGeometry() > 1 ){
+ myMergeFilter->Update();
+ myPassFilter[0]->SetInput(myMergeFilter->GetOutput());
+ }
+ else{
+ myPassFilter[0]->SetInput(GetFieldTransformFilter()->GetOutput());
+ }
+
SetAverageCellSize( VISU_DeformedShapePL::GetScaleFactor( GetParentMesh() ) );
this->UpdateGlyph();
Superclass::Update();
+
}
myWarpVector->SetScaleFactor( aMapScale );
}
+
+void
+VISU_GaussPointsPL
+::SetSourceGeometry()
+{
+ if(IsExternalGeometryUsed()){
+ ClearGeometry();
+ myAppendFilter->AddInput(GetFieldTransformFilter()->GetOutput());
+ }
+}
+
+vtkDataSet*
+VISU_GaussPointsPL
+::InsertCustomPL()
+{
+ return GetMergedInput();
+}
+
+int
+VISU_GaussPointsPL
+::AddGeometry(vtkDataSet* theGeometry)
+{
+ myAppendFilter->AddInput(theGeometry);
+ return GetNumberOfGeometry();
+}
+
+vtkDataSet*
+VISU_GaussPointsPL
+::GetGeometry(int theGeomNumber)
+{
+ return vtkDataSet::SafeDownCast(myAppendFilter->GetInput(theGeomNumber));
+}
+
+int
+VISU_GaussPointsPL
+::GetNumberOfGeometry()
+{
+ return myAppendFilter->GetNumberOfInputConnections(0);
+}
+
+bool
+VISU_GaussPointsPL
+::IsExternalGeometryUsed()
+{
+ return myAppendFilter->GetInput() != GetFieldTransformFilter()->GetOutput();
+}
+
+void
+VISU_GaussPointsPL
+::ClearGeometry()
+{
+ myAppendFilter->RemoveAllInputs();
+}
+
+vtkPointSet*
+VISU_GaussPointsPL
+::GetMergedInput()
+{
+ if(myMergeFilter->GetInput())
+ myMergeFilter->Update();
+ return myMergeFilter->GetOutput();
+}
class vtkImageData;
class vtkPointSet;
class vtkPassThroughFilter;
+class vtkDataSet;
class vtkWarpVector;
class SALOME_Transform;
+class VISU_AppendFilter;
+class VISU_GaussMergeFilter;
//----------------------------------------------------------------------------
//! Pipeline for the Gauss Points presentation.
void
SetMapScale( vtkFloatingPointType theMapScale = 1.0 );
+public:
+
+ virtual
+ void
+ SetSourceGeometry();
+
+ virtual
+ int
+ AddGeometry(vtkDataSet* theGeometry);
+
+ virtual
+ vtkDataSet*
+ GetGeometry(int theGeomNumber);
+
+ virtual
+ int
+ GetNumberOfGeometry();
+
+ virtual
+ bool
+ IsExternalGeometryUsed();
+
+ virtual
+ void
+ ClearGeometry();
+
+ virtual
+ vtkPointSet*
+ GetMergedInput();
+
protected:
//----------------------------------------------------------------------------
VISU_GaussPointsPL();
void
Build();
+ virtual
+ vtkDataSet*
+ InsertCustomPL();
+
virtual
void
DoShallowCopy(VISU_PipeLine *thePipeLine,
int myPrimitiveType;
+ vtkSmartPointer<VISU_AppendFilter> myAppendFilter;
+ vtkSmartPointer<VISU_GaussMergeFilter> myMergeFilter;
+
private:
VISU_GaussPointsPL(const VISU_GaussPointsPL&); // Not implemented.
void operator=(const VISU_GaussPointsPL&); // Not implemented.
bool theIsCopyInput)
{
Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
- if(this != thePipeLine){
- if(VISU_ScalarMapPL *aPipeLine = dynamic_cast<VISU_ScalarMapPL*>(thePipeLine)){
- if(aPipeLine->IsExternalGeometryUsed()){
- ClearGeometry();
- int aNbOfGeometry = aPipeLine->GetNumberOfGeometry();
- for(int aGeomNumber = 0; aGeomNumber < aNbOfGeometry; aGeomNumber++)
- AddGeometry(aPipeLine->GetGeometry(aGeomNumber));
- }else
- SetSourceGeometry();
- }
- }
}
if(myAllGroups->count() < 1){
myAllGroups->insertItem( tr("NO_GROUPS") );
myUseGroupsGroupBox->setEnabled(false);
- }else if(VISU::ScalarMap_i* aPrs = dynamic_cast<VISU::ScalarMap_i*>(thePrs)){
- const VISU::ScalarMap_i::TGroupNames& aGroupNames = aPrs->GetGroupNames();
- VISU::ScalarMap_i::TGroupNames::const_iterator anIter = aGroupNames.begin();
+ }else{
+ const VISU::ColoredPrs3d_i::TGroupNames& aGroupNames = thePrs->GetGroupNames();
+ VISU::ColoredPrs3d_i::TGroupNames::const_iterator anIter = aGroupNames.begin();
for(; anIter != aGroupNames.end(); anIter++){
const std::string aGroupName = *anIter;
mySelectedGroups->insertItem(QString(aGroupName));
//---------------------------------------------------------------
int VisuGUI_InputPane::storeToPrsObject( VISU::ColoredPrs3d_i* thePrs )
{
- if(VISU::ScalarMap_i* aPrs = dynamic_cast<VISU::ScalarMap_i*>(thePrs)){
- if(myUseGroupsGroupBox->isChecked()){
- aPrs->RemoveAllGeom();
- for(int i = 0; i < mySelectedGroups->count(); i++)
- aPrs->AddMeshOnGroup(mySelectedGroups->text(i) );
- }else
- aPrs->SetSourceGeometry();
- }
-
+
+ if(myUseGroupsGroupBox->isChecked()){
+ thePrs->RemoveAllGeom();
+ for(int i = 0; i < mySelectedGroups->count(); i++)
+ thePrs->AddMeshOnGroup(mySelectedGroups->text(i) );
+ }else
+ thePrs->SetSourceGeometry();
+
thePrs->SetResultObject( myResult );
thePrs->SetMeshName( myMeshName->text().latin1() );
myIsTimeStampFixed = anOrigin->IsTimeStampFixed();
SetHolderEntry( anOrigin->GetHolderEntry() );
+
+ myGroupNames = anOrigin->GetGroupNames();
}
}
myLabelColor[1] = VISU::Storable::FindValue(theMap,"myLabelColor[1]").toFloat();
myLabelColor[2] = VISU::Storable::FindValue(theMap,"myLabelColor[2]").toFloat();
+ bool anIsExists;
+ QString aGeomNames = VISU::Storable::FindValue(theMap, "myGeomNameList", &anIsExists);
+ if(anIsExists){
+ QStringList aGeomNameList = QStringList::split("|", aGeomNames);
+ int aNbOfGroups = aGeomNameList.count();
+ if(aNbOfGroups > 0){
+ RemoveAllGeom();
+ for(int aGroupNum = 0; aGroupNum < aNbOfGroups; aGroupNum++){
+ QString aGroupName = aGeomNameList[aGroupNum];
+ AddMeshOnGroup(aGroupName.latin1());
+ }
+ }
+ }
return this;
}
Storable::DataToStream( theStr, "myLabelColor[0]", myLabelColor[0] );
Storable::DataToStream( theStr, "myLabelColor[1]", myLabelColor[1] );
Storable::DataToStream( theStr, "myLabelColor[2]", myLabelColor[2] );
+
+ std::ostringstream aGeomNameList;
+ std::string aMeshName = GetCMeshName();
+ const TGroupNames& aGroupNames = GetGroupNames();
+ TGroupNames::const_iterator anIter = aGroupNames.begin();
+ for(; anIter != aGroupNames.end(); anIter++){
+ const std::string& aGroupName = *anIter;
+ aGeomNameList<<aGroupName<<"|";
+ }
+ Storable::DataToStream(theStr, "myGeomNameList", aGeomNameList.str());
+}
+
+//----------------------------------------------------------------------------
+const VISU::ColoredPrs3d_i
+::TGroupNames&
+VISU::ColoredPrs3d_i
+::GetGroupNames()
+{
+ return myGroupNames;
+}
+
+//----------------------------------------------------------------------------
+bool
+VISU::ColoredPrs3d_i
+::IsGroupsUsed()
+{
+ return !myGroupNames.empty();
}
#include "VISU_BoostSignals.h"
#include "SALOME_GenericObjPointer.hh"
+#include <set>
+
class VISU_ColoredPL;
namespace VISU
const char*
GetIconName() = 0;
+
+ //----------------------------------------------------------------------------
+ //! Sets initial source geometry
+ virtual
+ void
+ SetSourceGeometry()=0;
+
+ //! Add geometry of mesh as group. \retval the id of added group.
+ virtual
+ void
+ AddMeshOnGroup(const char* theGroupName)=0;
+
+ //! Removes all geometries.
+ virtual
+ void
+ RemoveAllGeom()=0;
+
+ typedef std::string TGroupName;
+ typedef std::set<TGroupName> TGroupNames;
+
+ const TGroupNames&
+ GetGroupNames();
+
+ //! Gets number of geometries
+ bool
+ IsGroupsUsed();
+
//----------------------------------------------------------------------------
public:
/*!
std::string
GetActorEntry();
+ TGroupNames myGroupNames;
+
private:
bool myIsRestored;
Storable::TRestoringMap myRestoringMap;
VISU_ColoredPL* myColoredPL;
bool myIsFixedRange;
+
};
else
theStr<<thePrefix<<theName<<".SetSourceRange()"<<endl;
+ const VISU::ColoredPrs3d_i::TGroupNames aGroupNames = theServant->GetGroupNames();
+ VISU::ColoredPrs3d_i::TGroupNames::const_iterator anIter = aGroupNames.begin();
+ for(; anIter != aGroupNames.end(); anIter++){
+ const std::string& aGroupName = *anIter;
+ theStr<<thePrefix<<theName<<".AddMeshOnGroup('"<<aGroupName<<"')"<<endl;
+ }
+
return thePrefix;
}
}
theStr<<thePrefix<<theName<<".SetScaling("<<aParam<<")"<<endl;
- const VISU::ScalarMap_i::TGroupNames aGroupNames = theServant->GetGroupNames();
- VISU::ScalarMap_i::TGroupNames::const_iterator anIter = aGroupNames.begin();
- for(; anIter != aGroupNames.end(); anIter++){
- const std::string& aGroupName = *anIter;
- theStr<<thePrefix<<theName<<".AddMeshOnGroup('"<<aGroupName<<"')"<<endl;
- }
return thePrefix;
}
return myGaussPointsPL->GetMagnificationIncrement();
}
+//----------------------------------------------------------------------------
+void
+VISU::GaussPoints_i
+::SetSourceGeometry()
+{
+ int aNbGroups = myGroupNames.size();
+ if(aNbGroups != 0){
+ GetSpecificPL()->SetSourceGeometry();
+ myGroupNames.clear();
+ /*UpdateIcon();*/
+ }
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::GaussPoints_i
+::AddMeshOnGroup(const char* theGroupName)
+{
+ VISU::Result_i::PInput anInput = GetCResult()->GetInput();
+ VISU::PUnstructuredGridIDMapper anIDMapper = anInput->GetMeshOnGroup(GetCMeshName(), theGroupName);
+ if(anIDMapper){
+ int aNbGroups = myGroupNames.size();
+ if(myGroupNames.find(theGroupName) == myGroupNames.end()){
+ GetSpecificPL()->AddGeometry(anIDMapper->GetOutput());
+ myGroupNames.insert(theGroupName);
+ /*
+ if(aNbGroups == 0)
+ UpdateIcon();
+ */
+ }
+ }
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::GaussPoints_i
+::RemoveAllGeom()
+{
+ int aNbGroups = myGroupNames.size();
+ GetSpecificPL()->ClearGeometry();
+ myGroupNames.clear();
+ /*
+ if(aNbGroups != 0)
+ UpdateIcon();
+ */
+}
+
//----------------------------------------------------------------------------
void
VISU::GaussPoints_i
{
return myGaussPointsPL;
}
+
+ //----------------------------------------------------------------------------
+ //! Sets initial source geometry
+ virtual
+ void
+ SetSourceGeometry();
+
+ //! Add geometry of mesh as group. \retval the id of added group.
+ virtual
+ void
+ AddMeshOnGroup(const char* theGroupName);
+
+ //! Removes all geometries.
+ virtual
+ void
+ RemoveAllGeom();
protected:
//! Redefines VISU_ColoredPrs3d_i::DoSetInput
SetScaling(anOrigin->GetScaling());
- myGroupNames = anOrigin->GetGroupNames();
-
Update();
}
}
SetScaling(VISU::Scaling(VISU::Storable::FindValue(theMap,"myScaling").toInt()));
- bool anIsExists;
- QString aGeomNames = VISU::Storable::FindValue(theMap, "myGeomNameList", &anIsExists);
- if(anIsExists){
- QStringList aGeomNameList = QStringList::split("|", aGeomNames);
- int aNbOfGroups = aGeomNameList.count();
- if(aNbOfGroups > 0){
- RemoveAllGeom();
- for(int aGroupNum = 0; aGroupNum < aNbOfGroups; aGroupNum++){
- QString aGroupName = aGeomNameList[aGroupNum];
- AddMeshOnGroup(aGroupName.latin1());
- }
- }
- }
-
// Check if the icon needs to be updated, update if necessary
SALOMEDS::Study_var aStudy = theSObject->GetStudy();
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
TSuperClass::ToStream(theStr);
Storable::DataToStream( theStr, "myScaling", GetScaling() );
-
- std::ostringstream aGeomNameList;
- std::string aMeshName = GetCMeshName();
- const TGroupNames& aGroupNames = GetGroupNames();
- TGroupNames::const_iterator anIter = aGroupNames.begin();
- for(; anIter != aGroupNames.end(); anIter++){
- const std::string& aGroupName = *anIter;
- aGeomNameList<<aGroupName<<"|";
- }
- Storable::DataToStream(theStr, "myGeomNameList", aGeomNameList.str());
}
(GetSpecificPL(), &VISU_ColoredPL::SetScaling, theScaling));
}
-//----------------------------------------------------------------------------
-const VISU::ScalarMap_i::TGroupNames&
-VISU::ScalarMap_i
-::GetGroupNames()
-{
- return myGroupNames;
-}
-
-//----------------------------------------------------------------------------
-bool
-VISU::ScalarMap_i
-::IsGroupsUsed()
-{
- return !myGroupNames.empty();
-}
-
//----------------------------------------------------------------------------
void
VISU::ScalarMap_i
void
UpdateActor(VISU_Actor* theActor);
- typedef std::string TGroupName;
- typedef std::set<TGroupName> TGroupNames;
-
- const TGroupNames&
- GetGroupNames();
-
- //! Gets number of geometries
- bool
- IsGroupsUsed();
-
private:
VISU_ScalarMapPL* myScalarMapPL;
- TGroupNames myGroupNames;
};
}