VISU_MergeFilter.hxx \
VISU_AppendFilter.hxx \
VISU_ExtractUnstructuredGrid.hxx \
- VISU_CommonCellsFilter.hxx
+ VISU_CommonCellsFilter.hxx \
+ VISU_UsedPointsFilter.hxx
# Libraries targets
VISU_MergeFilter.cxx \
VISU_AppendFilter.cxx \
VISU_MedConvertor.cxx \
- VISU_CommonCellsFilter.cxx
+ VISU_CommonCellsFilter.cxx \
+ VISU_UsedPointsFilter.cxx
# Executables targets
BIN = VISUConvertor
--- /dev/null
+// VISU CONVERTOR :
+//
+// 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_UsedPointsFilter.cxx
+// Author :
+// Module : VISU
+
+
+#include "VISU_UsedPointsFilter.hxx"
+
+#include <vtkObjectFactory.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkPointData.h>
+#include <vtkCellData.h>
+#include <vtkCell.h>
+#include <vtkIdList.h>
+
+#include <map>
+
+vtkStandardNewMacro(VISU_UsedPointsFilter);
+
+
+VISU_UsedPointsFilter::VISU_UsedPointsFilter()
+{
+}
+
+VISU_UsedPointsFilter::~VISU_UsedPointsFilter()
+{
+}
+
+void VISU_UsedPointsFilter::Execute(){
+ vtkDataSet *anInput = this->GetInput();
+ vtkUnstructuredGrid *anOutput = this->GetOutput();
+
+ typedef std::map<vtkIdType, vtkIdType> TId2IdMap;
+ TId2IdMap aId2IdMap;
+
+ vtkPointData *aPointData = anOutput->GetPointData();
+ aPointData->CopyAllocate(anInput->GetPointData());
+
+ vtkPoints* aUsedPoints = vtkPoints::New();
+ vtkIdList *anIdList = vtkIdList::New();
+ vtkIdType iEnd = anInput->GetNumberOfPoints();
+ for(vtkIdType aPointId = 0; aPointId < iEnd; aPointId++){
+ anInput->GetPointCells(aPointId,anIdList);
+ if(anIdList->GetNumberOfIds() > 0){
+ vtkIdType aNewPointId = aUsedPoints->InsertNextPoint(anInput->GetPoint(aPointId));
+ aPointData->CopyData(anInput->GetPointData(), aPointId, aNewPointId);
+ aId2IdMap[aPointId] = aNewPointId;
+ }
+ }
+ aPointData->Squeeze();
+ anOutput->SetPoints(aUsedPoints);
+ aUsedPoints->Delete();
+ anIdList->Delete();
+
+ vtkCellData *aCellData = anOutput->GetCellData();
+ aCellData->CopyAllocate(anInput->GetCellData());
+
+ anOutput->Allocate(anInput->GetNumberOfCells());
+ vtkIdList *anOldPointsIds = vtkIdList::New();
+ vtkIdList *aNewPointsIds = vtkIdList::New();
+ aNewPointsIds->Allocate(VTK_CELL_SIZE);
+ iEnd = anInput->GetNumberOfCells();
+ for(vtkIdType aCellId = 0; aCellId < iEnd; aCellId++){
+ anInput->GetCellPoints(aCellId, anOldPointsIds);
+ vtkIdType aNbPointsInCell = anOldPointsIds->GetNumberOfIds();
+ aNewPointsIds->Reset();
+ for(vtkIdType i = 0; i < aNbPointsInCell; i++){
+ vtkIdType anOldId = anOldPointsIds->GetId(i);
+ TId2IdMap::iterator anIter = aId2IdMap.find(anOldId);
+ if(anIter == aId2IdMap.end())
+ goto NEXT_CELL;
+ vtkIdType aNewId = anIter->second;
+ aNewPointsIds->InsertNextId(aNewId);
+ }
+ {
+ vtkIdType aNewCellId = anOutput->InsertNextCell(anInput->GetCellType(aCellId), aNewPointsIds);
+ aCellData->CopyData(anInput->GetCellData(), aCellId, aNewCellId);
+ }
+ NEXT_CELL:
+ continue;
+ }
+ aCellData->Squeeze();
+ anOldPointsIds->Delete();
+ aNewPointsIds->Delete();
+ anOutput->Squeeze();
+}
+
--- /dev/null
+// VISU CONVERTOR :
+//
+// 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_UsedPointsFilter.hxx
+// Author :
+// Module : VISU
+
+#ifndef VISU_UsedPointsFilter_HeaderFile
+#define VISU_UsedPointsFilter_HeaderFile
+
+#include <vtkDataSetToUnstructuredGridFilter.h>
+
+class VISU_UsedPointsFilter : public vtkDataSetToUnstructuredGridFilter
+{
+public:
+ vtkTypeMacro(VISU_UsedPointsFilter,vtkDataSetToUnstructuredGridFilter);
+ static VISU_UsedPointsFilter *New();
+
+protected:
+ VISU_UsedPointsFilter();
+ ~VISU_UsedPointsFilter();
+
+ virtual void Execute();
+};
+
+#endif
+
VISU_ScalarBarActor.hxx \
VISU_Extractor.hxx \
VISU_FieldTransform.hxx \
- VISU_UsedPointsFilter.hxx \
+ VISU_MaskPointsFilter.hxx \
VISU_GaussPointsPL.hxx \
VISU_Plot3DPL.hxx \
VISU_OpenGLPointSpriteMapper.hxx \
VISU_ScalarBarActor.cxx \
VISU_Extractor.cxx \
VISU_FieldTransform.cxx \
- VISU_UsedPointsFilter.cxx \
+ VISU_MaskPointsFilter.cxx \
VISU_GaussPointsPL.cxx \
VISU_Plot3DPL.cxx \
SALOME_ExtractGeometry.cxx \
--- /dev/null
+// 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_StreamLinesPL.cxx
+// Author: Alexey PETROV
+// Module : VISU
+
+
+#include "VISU_MaskPointsFilter.hxx"
+
+#include <vtkObjectFactory.h>
+#include <vtkPointSet.h>
+#include <vtkPointData.h>
+#include <vtkCellData.h>
+#include <vtkPoints.h>
+#include <vtkIdList.h>
+
+vtkStandardNewMacro(VISU_MaskPointsFilter);
+
+VISU_MaskPointsFilter::VISU_MaskPointsFilter(){
+ PercentsOfUsedPoints = 1.0;
+}
+
+VISU_MaskPointsFilter::~VISU_MaskPointsFilter(){}
+
+void VISU_MaskPointsFilter::Execute(){
+ vtkPointSet *anInput = this->GetInput(), *anOutput = this->GetOutput();
+ anOutput->GetPointData()->CopyAllOff();
+ anOutput->GetCellData()->CopyAllOff();
+ anOutput->CopyStructure(anInput);
+
+ vtkPoints* aPoints = vtkPoints::New();
+ vtkIdList *anIdList = vtkIdList::New();
+ vtkIdType iEnd = anInput->GetNumberOfPoints();
+ for(vtkIdType i = 0; i < iEnd; i++){
+ anInput->GetPointCells(i,anIdList);
+ if(anIdList->GetNumberOfIds() > 0)
+ aPoints->InsertNextPoint(anInput->GetPoint(i));
+ }
+ vtkPoints* aNewPoints = vtkPoints::New();
+ iEnd = aPoints->GetNumberOfPoints();
+ if (PercentsOfUsedPoints > 0){
+ vtkIdType anOffset = vtkIdType(1.0/PercentsOfUsedPoints);
+ if(anOffset < 1) anOffset = 1;
+ for(vtkIdType i = 0; i < iEnd; i += anOffset)
+ aNewPoints->InsertNextPoint(aPoints->GetPoint(i));
+ }
+ anOutput->SetPoints(aNewPoints);
+ aNewPoints->Delete();
+ aPoints->Delete();
+}
--- /dev/null
+// 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_MaskPointsFilter.hxx
+// Author: Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_MaskPointsFilter_HeaderFile
+#define VISU_MaskPointsFilter_HeaderFile
+
+#include <vtkPointSetToPointSetFilter.h>
+
+class VISU_MaskPointsFilter : public vtkPointSetToPointSetFilter{
+protected:
+ VISU_MaskPointsFilter();
+ VISU_MaskPointsFilter(const VISU_MaskPointsFilter&);
+
+ virtual void Execute();
+ float PercentsOfUsedPoints;
+
+public:
+ vtkTypeMacro(VISU_MaskPointsFilter,vtkPointSetToPointSetFilter);
+ static VISU_MaskPointsFilter* New();
+ virtual ~VISU_MaskPointsFilter();
+
+ vtkSetMacro(PercentsOfUsedPoints,float);
+ vtkGetMacro(PercentsOfUsedPoints,float);
+};
+
+#endif
}else
theOutputFilter->SetInput(theDataSet);
}
-
- template<class TOutputFilter>
- void
- ToCellCenters(TOutputFilter* theOutputFilter,
- vtkCellCenters *theCellCenters,
- vtkPointSet* theDataSet)
- {
- if(VISU::IsDataOnCells(theDataSet)){
- theCellCenters->SetInput(theDataSet);
- theCellCenters->VertexCellsOn();
- theOutputFilter->SetInput(theCellCenters->GetOutput());
- }else
- theOutputFilter->SetInput(theDataSet);
- }
}
#endif
#include "VISU_StreamLinesPL.hxx"
#include "VISU_PipeLineUtils.hxx"
-#include "VISU_UsedPointsFilter.hxx"
+#include "VISU_MaskPointsFilter.hxx"
#include "VTKViewer_GeometryFilter.h"
#include <algo.h>
myStream = vtkStreamLine::New();
myCenters = vtkCellCenters::New();
myGeomFilter = VTKViewer_GeometryFilter::New();
- myPointsFilter = VISU_UsedPointsFilter::New();
+ myPointsFilter = VISU_MaskPointsFilter::New();
myPercents = 0.3;
mySource = NULL;
}
{
vtkFloatingPointType aStepLength = GetBaseStepLength(theDataSet);
vtkFloatingPointType aBasePropTime = GetBasePropagationTime(theDataSet);
- VISU_UsedPointsFilter *aPointsFilter = VISU_UsedPointsFilter::New();
+ VISU_MaskPointsFilter *aPointsFilter = VISU_MaskPointsFilter::New();
aPointsFilter->SetInput(theDataSet);
vtkPointSet* aDataSet = aPointsFilter->GetOutput();
aDataSet->Update();
class vtkPointSet;
class vtkCellCenters;
class VTKViewer_GeometryFilter;
-class VISU_UsedPointsFilter;
+class VISU_MaskPointsFilter;
class VISU_StreamLinesPL : public VISU_DeformedShapePL
{
vtkPointSet* mySource;
vtkCellCenters* myCenters;
VTKViewer_GeometryFilter *myGeomFilter;
- VISU_UsedPointsFilter *myPointsFilter;
+ VISU_MaskPointsFilter *myPointsFilter;
vtkFloatingPointType myPercents;
};
+++ /dev/null
-// 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_StreamLinesPL.cxx
-// Author: Alexey PETROV
-// Module : VISU
-
-
-#include "VISU_UsedPointsFilter.hxx"
-
-#include <vtkObjectFactory.h>
-#include <vtkPointSet.h>
-#include <vtkPointData.h>
-#include <vtkCellData.h>
-#include <vtkPoints.h>
-#include <vtkIdList.h>
-
-vtkStandardNewMacro(VISU_UsedPointsFilter);
-
-VISU_UsedPointsFilter::VISU_UsedPointsFilter(){
- PercentsOfUsedPoints = 1.0;
-}
-
-VISU_UsedPointsFilter::~VISU_UsedPointsFilter(){}
-
-void VISU_UsedPointsFilter::Execute(){
- vtkPointSet *anInput = this->GetInput(), *anOutput = this->GetOutput();
- anOutput->GetPointData()->CopyAllOff();
- anOutput->GetCellData()->CopyAllOff();
- anOutput->CopyStructure(anInput);
-
- vtkPoints* aPoints = vtkPoints::New();
- vtkIdList *anIdList = vtkIdList::New();
- vtkIdType iEnd = anInput->GetNumberOfPoints();
- for(vtkIdType i = 0; i < iEnd; i++){
- anInput->GetPointCells(i,anIdList);
- if(anIdList->GetNumberOfIds() > 0)
- aPoints->InsertNextPoint(anInput->GetPoint(i));
- }
- vtkPoints* aNewPoints = vtkPoints::New();
- iEnd = aPoints->GetNumberOfPoints();
- if (PercentsOfUsedPoints > 0){
- vtkIdType anOffset = vtkIdType(1.0/PercentsOfUsedPoints);
- if(anOffset < 1) anOffset = 1;
- for(vtkIdType i = 0; i < iEnd; i += anOffset)
- aNewPoints->InsertNextPoint(aPoints->GetPoint(i));
- }
- anOutput->SetPoints(aNewPoints);
- aNewPoints->Delete();
- aPoints->Delete();
-}
+++ /dev/null
-// 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_UsedPointsFilter.hxx
-// Author: Alexey PETROV
-// Module : VISU
-
-#ifndef VISU_UsedPointsFilter_HeaderFile
-#define VISU_UsedPointsFilter_HeaderFile
-
-#include <vtkPointSetToPointSetFilter.h>
-
-class VISU_UsedPointsFilter : public vtkPointSetToPointSetFilter{
-protected:
- VISU_UsedPointsFilter();
- VISU_UsedPointsFilter(const VISU_UsedPointsFilter&);
-
- virtual void Execute();
- float PercentsOfUsedPoints;
-
-public:
- vtkTypeMacro(VISU_UsedPointsFilter,vtkPointSetToPointSetFilter);
- static VISU_UsedPointsFilter* New();
- virtual ~VISU_UsedPointsFilter();
-
- vtkSetMacro(PercentsOfUsedPoints,float);
- vtkGetMacro(PercentsOfUsedPoints,float);
-};
-
-#endif
#include "VISU_VectorsPL.hxx"
#include "VISU_PipeLineUtils.hxx"
+#include "VISU_UsedPointsFilter.hxx"
#include "VTKViewer_TransformFilter.h"
#include "VTKViewer_Transform.h"
vtkStandardNewMacro(VISU_VectorsPL);
+template<class TOutputFilter>
+void ToCellCenters(TOutputFilter *theOutputFilter,
+ vtkCellCenters *theCellCenters,
+ vtkPointSet* theDataSet,
+ VISU_UsedPointsFilter* theUsedPointsFilter)
+{
+ if(VISU::IsDataOnCells(theDataSet)){
+ theCellCenters->SetInput(theDataSet);
+ theCellCenters->VertexCellsOn();
+ theOutputFilter->SetInput(theCellCenters->GetOutput());
+ }else {
+ theUsedPointsFilter->SetInput(theDataSet);
+ theOutputFilter->SetInput(theUsedPointsFilter->GetOutput());
+ }
+}
+
+
VISU_VectorsPL
::VISU_VectorsPL()
{
myCenters = vtkCellCenters::New();
myTransformFilter = VTKViewer_TransformFilter::New();
myIsShrinkable = false;
+
+ myUsedPointsFilter = VISU_UsedPointsFilter::New();
}
VISU_VectorsPL
myLineSource->Delete();
myTransformFilter->Delete();
+
+ myUsedPointsFilter->Delete();
}
void
::Build()
{
Superclass::Build();
-
- VISU::ToCellCenters(myBaseGlyph,
- myCenters,
- GetMergedInput());
+
+ ToCellCenters(myBaseGlyph,
+ myCenters,
+ GetMergedInput(),
+ myUsedPointsFilter);
myBaseGlyph->SetVectorModeToUseVector();
myBaseGlyph->SetScaleModeToScaleByVector();
myBaseGlyph->SetColorModeToColorByScalar();
- VISU::ToCellCenters(myTransformFilter,
- myCenters,
- GetMergedInput());
+ ToCellCenters(myTransformFilter,
+ myCenters,
+ GetMergedInput(),
+ myUsedPointsFilter);
myTransformedGlyph->SetInput(myTransformFilter->GetOutput());
myTransformedGlyph->SetVectorModeToUseVector();
myTransformedGlyph->SetScaleModeToScaleByVector();
class vtkGlyph3D;
+class VISU_UsedPointsFilter;
+
class VISU_VectorsPL : public VISU_DeformedShapePL
{
protected:
vtkCellCenters* myCenters;
VTKViewer_TransformFilter *myTransformFilter;
+
+ VISU_UsedPointsFilter* myUsedPointsFilter;
};