]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for bug NPAL15942 (Creation of vectors on group is incorrect).
authormzn <mzn@opencascade.com>
Fri, 25 May 2007 12:39:22 +0000 (12:39 +0000)
committermzn <mzn@opencascade.com>
Fri, 25 May 2007 12:39:22 +0000 (12:39 +0000)
13 files changed:
src/CONVERTOR/Makefile.in
src/CONVERTOR/VISU_UsedPointsFilter.cxx [new file with mode: 0644]
src/CONVERTOR/VISU_UsedPointsFilter.hxx [new file with mode: 0644]
src/PIPELINE/Makefile.in
src/PIPELINE/VISU_MaskPointsFilter.cxx [new file with mode: 0644]
src/PIPELINE/VISU_MaskPointsFilter.hxx [new file with mode: 0644]
src/PIPELINE/VISU_PipeLineUtils.hxx
src/PIPELINE/VISU_StreamLinesPL.cxx
src/PIPELINE/VISU_StreamLinesPL.hxx
src/PIPELINE/VISU_UsedPointsFilter.cxx [deleted file]
src/PIPELINE/VISU_UsedPointsFilter.hxx [deleted file]
src/PIPELINE/VISU_VectorsPL.cxx
src/PIPELINE/VISU_VectorsPL.hxx

index 66e5700845a84095c9e17316255f8c23a141f5d4..ded3486eeceaf8ac6c87c65e7eb617ac56872301 100644 (file)
@@ -41,7 +41,8 @@ EXPORT_HEADERS = \
        VISU_MergeFilter.hxx \
        VISU_AppendFilter.hxx \
        VISU_ExtractUnstructuredGrid.hxx \
-       VISU_CommonCellsFilter.hxx
+       VISU_CommonCellsFilter.hxx \
+       VISU_UsedPointsFilter.hxx
 
 # Libraries targets
 
@@ -55,7 +56,8 @@ LIB_SRC = \
        VISU_MergeFilter.cxx \
        VISU_AppendFilter.cxx \
        VISU_MedConvertor.cxx \
-       VISU_CommonCellsFilter.cxx
+       VISU_CommonCellsFilter.cxx \
+       VISU_UsedPointsFilter.cxx
 
 # Executables targets
 BIN = VISUConvertor
diff --git a/src/CONVERTOR/VISU_UsedPointsFilter.cxx b/src/CONVERTOR/VISU_UsedPointsFilter.cxx
new file mode 100644 (file)
index 0000000..8392385
--- /dev/null
@@ -0,0 +1,108 @@
+//  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();
+}
+
diff --git a/src/CONVERTOR/VISU_UsedPointsFilter.hxx b/src/CONVERTOR/VISU_UsedPointsFilter.hxx
new file mode 100644 (file)
index 0000000..a6e082f
--- /dev/null
@@ -0,0 +1,46 @@
+//  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
+  
index 690882d6beba76dafb275c290c3a5a2049409b38..ea47ffc3f99506e7cfa324fd1b6779d96324c781 100644 (file)
@@ -47,7 +47,7 @@ EXPORT_HEADERS = \
        VISU_ScalarBarActor.hxx \
        VISU_Extractor.hxx \
        VISU_FieldTransform.hxx \
-       VISU_UsedPointsFilter.hxx \
+       VISU_MaskPointsFilter.hxx \
        VISU_GaussPointsPL.hxx \
        VISU_Plot3DPL.hxx \
        VISU_OpenGLPointSpriteMapper.hxx \
@@ -79,7 +79,7 @@ LIB_SRC = \
        VISU_ScalarBarActor.cxx \
        VISU_Extractor.cxx \
        VISU_FieldTransform.cxx \
-       VISU_UsedPointsFilter.cxx \
+       VISU_MaskPointsFilter.cxx \
        VISU_GaussPointsPL.cxx \
        VISU_Plot3DPL.cxx \
        SALOME_ExtractGeometry.cxx \
diff --git a/src/PIPELINE/VISU_MaskPointsFilter.cxx b/src/PIPELINE/VISU_MaskPointsFilter.cxx
new file mode 100644 (file)
index 0000000..c879e29
--- /dev/null
@@ -0,0 +1,70 @@
+//  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();
+}
diff --git a/src/PIPELINE/VISU_MaskPointsFilter.hxx b/src/PIPELINE/VISU_MaskPointsFilter.hxx
new file mode 100644 (file)
index 0000000..38d8792
--- /dev/null
@@ -0,0 +1,49 @@
+//  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
index 1056358d32ee6f42c62430ae1230ebe4fc465bff..a866171d4879827f5c9f542408ea6451317d70e8 100644 (file)
@@ -81,20 +81,6 @@ namespace VISU
     }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
index 65d48171b143ade37e6e44ad47ff203ed827b70f..42261300bbc51206f2018cc7ac558bb817430aac 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "VISU_StreamLinesPL.hxx"
 #include "VISU_PipeLineUtils.hxx"
-#include "VISU_UsedPointsFilter.hxx"
+#include "VISU_MaskPointsFilter.hxx"
 #include "VTKViewer_GeometryFilter.h"
 
 #include <algo.h>
@@ -55,7 +55,7 @@ VISU_StreamLinesPL::VISU_StreamLinesPL(){
   myStream = vtkStreamLine::New();
   myCenters = vtkCellCenters::New();
   myGeomFilter = VTKViewer_GeometryFilter::New();
-  myPointsFilter = VISU_UsedPointsFilter::New();
+  myPointsFilter = VISU_MaskPointsFilter::New();
   myPercents = 0.3;
   mySource = NULL;
 }
@@ -246,7 +246,7 @@ VISU_StreamLinesPL
 {
   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();
index ed1bf9b28354afef893aef8469c95278501c479f..e5f2220898f318db6adbbd7be7fd68b97e728c74 100644 (file)
@@ -35,7 +35,7 @@ using namespace std;
 class vtkPointSet;
 class vtkCellCenters;
 class VTKViewer_GeometryFilter;
-class VISU_UsedPointsFilter;
+class VISU_MaskPointsFilter;
 
 class VISU_StreamLinesPL : public VISU_DeformedShapePL
 {
@@ -230,7 +230,7 @@ protected:
   vtkPointSet* mySource;
   vtkCellCenters* myCenters;
   VTKViewer_GeometryFilter *myGeomFilter;
-  VISU_UsedPointsFilter *myPointsFilter;
+  VISU_MaskPointsFilter *myPointsFilter;
   vtkFloatingPointType myPercents;
 };
 
diff --git a/src/PIPELINE/VISU_UsedPointsFilter.cxx b/src/PIPELINE/VISU_UsedPointsFilter.cxx
deleted file mode 100644 (file)
index 9c49ea2..0000000
+++ /dev/null
@@ -1,70 +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_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();
-}
diff --git a/src/PIPELINE/VISU_UsedPointsFilter.hxx b/src/PIPELINE/VISU_UsedPointsFilter.hxx
deleted file mode 100644 (file)
index dd20877..0000000
+++ /dev/null
@@ -1,49 +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_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
index d772d9bda48b799d1df2b3b2ea7d3fe4380d0c75..4ba01227aa6d8b0887815f61f9fa8c5998aabae7 100644 (file)
@@ -27,6 +27,7 @@
 
 #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()
 {
@@ -51,6 +69,8 @@ VISU_VectorsPL
   myCenters = vtkCellCenters::New();
   myTransformFilter = VTKViewer_TransformFilter::New();
   myIsShrinkable = false;
+
+  myUsedPointsFilter = VISU_UsedPointsFilter::New();
 }
 
 VISU_VectorsPL
@@ -68,6 +88,8 @@ VISU_VectorsPL
   myLineSource->Delete();
 
   myTransformFilter->Delete();
+  
+  myUsedPointsFilter->Delete();
 }
 
 void
@@ -147,17 +169,19 @@ VISU_VectorsPL
 ::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();
index 5245650fab340de76219d374ea6983c505abfd11..2130b3a34a922f8e8dd2c0e6846834758c665953 100644 (file)
@@ -39,6 +39,8 @@ class vtkLineSource;
 
 class vtkGlyph3D;
 
+class VISU_UsedPointsFilter;
+
 class VISU_VectorsPL : public VISU_DeformedShapePL
 {
 protected:
@@ -143,6 +145,8 @@ protected:
 
   vtkCellCenters* myCenters;
   VTKViewer_TransformFilter *myTransformFilter;
+
+  VISU_UsedPointsFilter* myUsedPointsFilter;
 };