-// SALOME VTKViewer : build VTK viewer into Salome desktop
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 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.
//
-// 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
+// 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
//
+// SALOME VTKViewer : build VTK viewer into Salome desktop
// File :
// Author :
// Module : SALOME
// $Header$
-
+//
#include "VISU_GaussMergeFilter.hxx"
#include "VISU_MergeFilterUtilities.hxx"
VISU::GetIntersection(aDataCellIds,
aGeometryCellMapper,
anIntersection);
-
- vtkIdType aNbTuples = anIntersection.size();
-
- VISU::TObjectId2TupleIdMap aDataCellId2TupleIdMap;
- VISU::GetObjectId2TupleIdMap(aDataCellIds, aDataCellId2TupleIdMap);
+
+ VISU::TObjectId2TupleGaussIdMap aDataCellId2TupleGaussIdMap;
+ VISU::GetObjectId2TupleGaussIdArray(aDataCellIds, aDataCellId2TupleGaussIdMap);
+
+ vtkIdType aNbTuples = 0;
+ for(vtkIdType i = 0;i < anIntersection.size();i++)
+ aNbTuples += aDataCellId2TupleGaussIdMap[anIntersection[i].first].size();
vtkPointSet* aScalarsDataSet = dynamic_cast<vtkPointSet*>(GetScalars());
vtkPoints* aDataPoints = aScalarsDataSet->GetPoints();
vtkIdList *aCellIds = vtkIdList::New();
vtkFloatingPointType aCoords[3];
- for(int aTupleId=0;aTupleId<aNbTuples;aTupleId++){
+ for(int aTupleId=0, aNewTupleId=0; aTupleId<anIntersection.size(); aTupleId++){
VISU::TObjectId& anObjectId = anIntersection[aTupleId];
+ VISU::TCellIdArray aCellIdArray = aDataCellId2TupleGaussIdMap[anObjectId.first];
+
+ for(vtkIdType i = 0; i < aCellIdArray.size();i++) {
+ vtkIdType aCellId = aCellIdArray[i];
+ vtkCell *aCell = GetScalars()->GetCell(aCellId);
+
+ aCellIds->Reset();
+ aCellIds->InsertNextId(aNewTupleId);
+ aNewTupleId++;
- 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);
+ vtkIdType aCellType = GetScalars()->GetCellType(aCellId);
+ vtkIdType aNewCellId = theOutput->InsertNextCell(aCellType, aCellIds);
- anOutputCellData->CopyData(anInputCellData, aCellId, aNewCellId);
- anOutputPointData->CopyData(anInputPointData, aCellId, aNewCellId);
+ anOutputCellData->CopyData(anInputCellData, aCellId, aNewCellId);
+ anOutputPointData->CopyData(anInputPointData, aCellId, aNewCellId);
- aDataPoints->GetPoint(aCellId, aCoords);
- anOutputPoints->SetPoint(aNewCellId, aCoords);
+ aDataPoints->GetPoint(aCellId, aCoords);
+ anOutputPoints->SetPoint(aNewCellId, aCoords);
+ }
}
}
}