1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File : VTKViewer_GeometryFilter.cxx
24 // Author : Michael ZORIN
27 #include "VTKViewer_GeometryFilter.h"
28 #include "VTKViewer_ConvexTool.h"
29 #include "VTKViewer_ArcBuilder.h"
31 #include <vtkSmartPointer.h>
32 #include <vtkCellArray.h>
33 #include <vtkCellData.h>
34 #include <vtkGenericCell.h>
35 #include <vtkHexagonalPrism.h>
36 #include <vtkHexahedron.h>
37 #include <vtkInformation.h>
38 #include <vtkInformationVector.h>
39 #include <vtkMergePoints.h>
40 #include <vtkObjectFactory.h>
41 #include <vtkPointData.h>
42 #include <vtkPolyData.h>
43 #include <vtkPolygon.h>
44 #include <vtkPyramid.h>
45 #include <vtkStructuredGrid.h>
47 #include <vtkUnsignedCharArray.h>
48 #include <vtkUnstructuredGrid.h>
51 #include <vtkVersion.h>
59 #include "utilities.h"
67 #define VTK_XVERSION (VTK_MAJOR_VERSION*10000+VTK_MINOR_VERSION*100+VTK_BUILD_VERSION)
70 //#define USE_ROBUST_TRIANGULATION
72 ///////////////////////////////////////////////////////////////////////////////////////////////
73 // VSR 26/10/2012: fix of regression (issue 21924) - increased memory consumption
74 // for displaying of 3d elements, introduced by fix for issue 20314.
76 // The macro SHOW_COINCIDING_3D_PAL20314, when defined, allows correct visualization of
77 // coincident 3d elements but causes substantial increasing of memory consumption, as all 3d
78 // elements are always shown, even if they are totally covered by surrounding faces.
79 // If this macro is not defined (commented), the behaviour is defined by another macro -
80 // SHOW_COINCIDING_3D_PAL21924, as follows:
81 // - If SHOW_COINCIDING_3D_PAL21924 is defined, an alternative solution for computing
82 // visibility of 3d elements is used; this solution allows to fix problem with visibility
83 // of coinciding 3d elements in most cases (though some cases might not work), while not
84 // causing significant increasing of memory consumption.
85 // - If SHOW_COINCIDING_3D_PAL21924 is not defined (commented), coinciding 3d elements are
86 // not shown at all (this corresponds to the state before issue 20314 fixing).
87 ///////////////////////////////////////////////////////////////////////////////////////////////
88 //#define SHOW_COINCIDING_3D_PAL20314
89 #ifndef SHOW_COINCIDING_3D_PAL20314
90 #define SHOW_COINCIDING_3D_PAL21924
92 ///////////////////////////////////////////////////////////////////////////////////////////////
94 vtkStandardNewMacro(VTKViewer_GeometryFilter);
96 VTKViewer_GeometryFilter
97 ::VTKViewer_GeometryFilter():
100 myAppendCoincident3D(0),
101 myIsWireframeMode(0),
107 VTKViewer_GeometryFilter
108 ::~VTKViewer_GeometryFilter()
113 VTKViewer_GeometryFilter
115 vtkInformation *request,
116 vtkInformationVector **inputVector,
117 vtkInformationVector *outputVector)
119 // get the info objects
120 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
121 vtkInformation *outInfo = outputVector->GetInformationObject(0);
123 // get the input and ouptut
124 vtkDataSet *input = vtkDataSet::SafeDownCast(
125 inInfo->Get(vtkDataObject::DATA_OBJECT()));
126 vtkPolyData *output = vtkPolyData::SafeDownCast(
127 outInfo->Get(vtkDataObject::DATA_OBJECT()));
129 vtkIdType numCells=input->GetNumberOfCells();
136 if (input->GetDataObjectType() == VTK_UNSTRUCTURED_GRID){
137 return this->UnstructuredGridExecute(input, output, outInfo);
139 return Superclass::RequestData(request,inputVector,outputVector);
146 VTKViewer_GeometryFilter
147 ::UnstructuredGridExecute(
148 vtkDataSet *dataSetInput,
150 vtkInformation *outInfo)
153 vtkUnstructuredGrid *input= (vtkUnstructuredGrid *)dataSetInput;
154 vtkCellArray *Connectivity = input->GetCells();
156 if ( Connectivity == NULL )
158 vtkDebugMacro(<<"Nothing to extract");
167 vtkPoints *p = input->GetPoints();
168 vtkIdType numCells=input->GetNumberOfCells();
169 vtkPointData *pd = input->GetPointData();
170 vtkCellData *cd = input->GetCellData();
171 vtkPointData *outputPD = output->GetPointData();
173 VTKViewer_OrderedTriangulator anOrderedTriangulator;
174 VTKViewer_DelaunayTriangulator aDelaunayTriangulator;
176 vtkCellData *outputCD = output->GetCellData();
177 vtkGenericCell *cell = vtkGenericCell::New();
179 vtkIdList *cellIds = vtkIdList::New();
180 vtkIdList *faceIds = vtkIdList::New();
181 vtkIdList *cellIdsTmp = vtkIdList::New();
182 vtkIdList *faceIdsTmp = vtkIdList::New();
186 int faceId, *faceVerts, numFacePts;
188 vtkIdType PixelConvert[4];
189 // Change the type from int to vtkIdType in order to avoid compilation errors while using VTK
190 // from ParaView-3.4.0 compiled on 64-bit Debian platform with VTK_USE_64BIT_IDS = ON
191 vtkIdType aNewPts[VTK_CELL_SIZE];
193 unsigned char updateLevel = (unsigned char)(GetUpdateGhostLevel());
194 unsigned char *cellGhostLevels = 0;
201 vtkDebugMacro(<<"Executing geometry filter for unstructured grid input");
203 vtkDataArray* temp = 0;
206 temp = cd->GetArray("vtkGhostLevels");
208 if ( (!temp) || (temp->GetDataType() != VTK_UNSIGNED_CHAR)
209 || (temp->GetNumberOfComponents() != 1))
211 vtkDebugMacro("No appropriate ghost levels field available.");
215 cellGhostLevels = ((vtkUnsignedCharArray*)temp)->GetPointer(0);
218 // Determine nature of what we have to do
219 if ( (!this->CellClipping) && (!this->PointClipping) &&
220 (!this->ExtentClipping) )
228 cellVis = new char[numCells];
231 // Issue 0020115: [CEA 308] Quadratic elements visualization
232 // Fix of remark described in note 0005222 - SIGSEGV
233 vtkPoints* outputPoints = vtkPoints::New();
234 outputPoints->DeepCopy(input->GetPoints());
235 output->SetPoints(outputPoints);
236 outputPoints->Delete();
238 outputPD->PassData(pd);
240 outputCD->CopyAllocate(cd,numCells,numCells/2);
242 output->Allocate(numCells/4+1,numCells);
244 // Loop over the cells determining what's visible
247 for (cellId=0, Connectivity->InitTraversal();
248 Connectivity->GetNextCell(npts,pts);
252 if ( ( this->CellClipping && cellId < this->CellMinimum ) ||
253 cellId > this->CellMaximum )
259 for (i=0; i < npts; i++)
261 x = p->GetPoint(pts[i]);
262 if ( ( ( ( this->PointClipping && (pts[i] < this->PointMinimum ) ) ||
263 pts[i] > this->PointMaximum) ) ||
264 ( this->ExtentClipping &&
265 ( x[0] < this->Extent[0] || x[0] > this->Extent[1] ||
266 x[1] < this->Extent[2] || x[1] > this->Extent[3] ||
267 x[2] < this->Extent[4] || x[2] > this->Extent[5] )) )
271 }//point/extent clipping
273 }//if point clipping needs checking
275 }//if not all visible
277 // Loop over all cells now that visibility is known
278 // (Have to compute visibility first for 3D cell boundarys)
279 int progressInterval = numCells/20 + 1;
280 TMapOfVectorId aDimension2VTK2ObjIds;
282 myVTK2ObjIds.clear();
283 myVTK2ObjIds.reserve(numCells);
285 for (cellId=0, Connectivity->InitTraversal();
286 Connectivity->GetNextCell(npts,pts);
289 //Progress and abort method support
290 if ( !(cellId % progressInterval) )
292 vtkDebugMacro(<<"Process cell #" << cellId);
293 this->UpdateProgress ((float)cellId/numCells);
296 // Handle ghost cells here. Another option was used cellVis array.
297 if (cellGhostLevels && cellGhostLevels[cellId] > updateLevel)
298 { // Do not create surfaces in outer ghost cells.
302 if (allVisible || cellVis[cellId]) //now if visible extract geometry
304 //special code for nonlinear cells - rarely occurs, so right now it
306 vtkIdType aCellType = input->GetCellType(cellId);
313 case VTK_POLY_VERTEX:
314 newCellId = output->InsertNextCell(aCellType,npts,pts);
316 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
318 outputCD->CopyData(cd,cellId,newCellId);
323 newCellId = output->InsertNextCell(aCellType,npts,pts);
325 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
326 outputCD->CopyData(cd,cellId,newCellId);
332 newCellId = output->InsertNextCell(aCellType,npts,pts);
334 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
335 outputCD->CopyData(cd,cellId,newCellId);
338 case VTK_TRIANGLE_STRIP:
339 newCellId = output->InsertNextCell(aCellType,npts,pts);
341 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
342 outputCD->CopyData(cd,cellId,newCellId);
346 newCellId = output->InsertNextCell(aCellType,npts,pts);
348 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
349 outputCD->CopyData(cd,cellId,newCellId);
352 case VTK_CONVEX_POINT_SET: {
353 bool anIsOk = anOrderedTriangulator.Execute(input,
358 GetAppendCoincident3D(),
364 aDimension2VTK2ObjIds,
367 aDelaunayTriangulator.Execute(input,
372 GetAppendCoincident3D(),
378 aDimension2VTK2ObjIds,
384 #ifdef SHOW_COINCIDING_3D_PAL21924
386 for (int ai=0; ai<npts; ai++)
387 faceIdsTmp->InsertNextId(pts[ai]);
388 input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
390 for (faceId = 0; faceId < 4; faceId++)
393 faceVerts = vtkTetra::GetFaceArray(faceId);
394 faceIds->InsertNextId(pts[faceVerts[0]]);
395 faceIds->InsertNextId(pts[faceVerts[1]]);
396 faceIds->InsertNextId(pts[faceVerts[2]]);
397 aCellType = VTK_TRIANGLE;
399 input->GetCellNeighbors(cellId, faceIds, cellIds);
400 #ifdef SHOW_COINCIDING_3D_PAL21924
402 for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
403 if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
405 bool process = nbNeighbors <= 0;
407 bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
409 if ( process || myShowInside ||
410 (!allVisible && !cellVis[cellIds->GetId(0)]) )
412 for ( i=0; i < numFacePts; i++)
413 aNewPts[i] = pts[faceVerts[i]];
414 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
416 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
417 outputCD->CopyData(cd,cellId,newCellId);
423 #ifdef SHOW_COINCIDING_3D_PAL21924
425 for (int ai=0; ai<npts; ai++)
426 faceIdsTmp->InsertNextId(pts[ai]);
427 input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
429 for (faceId = 0; faceId < 6; faceId++)
432 faceVerts = vtkVoxel::GetFaceArray(faceId);
433 faceIds->InsertNextId(pts[faceVerts[0]]);
434 faceIds->InsertNextId(pts[faceVerts[1]]);
435 faceIds->InsertNextId(pts[faceVerts[2]]);
436 faceIds->InsertNextId(pts[faceVerts[3]]);
437 aCellType = VTK_QUAD;
439 input->GetCellNeighbors(cellId, faceIds, cellIds);
440 #ifdef SHOW_COINCIDING_3D_PAL21924
442 for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
443 if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
445 bool process = nbNeighbors <= 0;
447 bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
449 if ( process || myShowInside ||
450 (!allVisible && !cellVis[cellIds->GetId(0)]) )
452 for ( i=0; i < numFacePts; i++)
453 aNewPts[i] = pts[faceVerts[PixelConvert[i]]];
454 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
456 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
457 outputCD->CopyData(cd,cellId,newCellId);
462 case VTK_HEXAHEDRON: {
463 #ifdef SHOW_COINCIDING_3D_PAL21924
465 for (int ai=0; ai<npts; ai++)
466 faceIdsTmp->InsertNextId(pts[ai]);
467 input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
469 for (faceId = 0; faceId < 6; faceId++)
472 faceVerts = vtkHexahedron::GetFaceArray(faceId);
473 faceIds->InsertNextId(pts[faceVerts[0]]);
474 faceIds->InsertNextId(pts[faceVerts[1]]);
475 faceIds->InsertNextId(pts[faceVerts[2]]);
476 faceIds->InsertNextId(pts[faceVerts[3]]);
477 aCellType = VTK_QUAD;
479 input->GetCellNeighbors(cellId, faceIds, cellIds);
480 #ifdef SHOW_COINCIDING_3D_PAL21924
482 for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
483 if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
485 bool process = nbNeighbors <= 0;
487 bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
489 if ( process || myShowInside ||
490 (!allVisible && !cellVis[cellIds->GetId(0)]) )
492 for ( i=0; i < numFacePts; i++)
493 aNewPts[i] = pts[faceVerts[i]];
494 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
496 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
497 outputCD->CopyData(cd,cellId,newCellId);
503 #ifdef SHOW_COINCIDING_3D_PAL21924
505 for (int ai=0; ai<npts; ai++)
506 faceIdsTmp->InsertNextId(pts[ai]);
507 input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
509 for (faceId = 0; faceId < 5; faceId++)
512 faceVerts = vtkWedge::GetFaceArray(faceId);
513 faceIds->InsertNextId(pts[faceVerts[0]]);
514 faceIds->InsertNextId(pts[faceVerts[1]]);
515 faceIds->InsertNextId(pts[faceVerts[2]]);
516 aCellType = VTK_TRIANGLE;
518 if (faceVerts[3] >= 0)
520 faceIds->InsertNextId(pts[faceVerts[3]]);
521 aCellType = VTK_QUAD;
525 input->GetCellNeighbors(cellId, faceIds, cellIds);
526 #ifdef SHOW_COINCIDING_3D_PAL21924
528 for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
529 if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
531 bool process = nbNeighbors <= 0;
533 bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
535 if ( process || myShowInside ||
536 (!allVisible && !cellVis[cellIds->GetId(0)]) )
538 for ( i=0; i < numFacePts; i++)
539 aNewPts[i] = pts[faceVerts[i]];
540 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
542 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
543 outputCD->CopyData(cd,cellId,newCellId);
548 case VTK_HEXAGONAL_PRISM: {
549 #ifdef SHOW_COINCIDING_3D_PAL21924
551 for (int ai=0; ai<npts; ai++)
552 faceIdsTmp->InsertNextId(pts[ai]);
553 input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
555 for (faceId = 0; faceId < 8; faceId++)
557 faceVerts = vtkHexagonalPrism::GetFaceArray(faceId);
559 faceIds->InsertNextId(pts[faceVerts[0]]);
560 faceIds->InsertNextId(pts[faceVerts[1]]);
561 faceIds->InsertNextId(pts[faceVerts[2]]);
562 faceIds->InsertNextId(pts[faceVerts[3]]);
563 aCellType = VTK_QUAD;
565 if (faceVerts[5] >= 0)
567 faceIds->InsertNextId(pts[faceVerts[4]]);
568 faceIds->InsertNextId(pts[faceVerts[5]]);
569 aCellType = VTK_POLYGON;
572 input->GetCellNeighbors(cellId, faceIds, cellIds);
573 #ifdef SHOW_COINCIDING_3D_PAL21924
575 for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
576 if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
578 bool process = nbNeighbors <= 0;
580 bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
582 if ( process || myShowInside ||
583 (!allVisible && !cellVis[cellIds->GetId(0)]) )
585 for ( i=0; i < numFacePts; i++)
586 aNewPts[i] = pts[faceVerts[i]];
587 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
589 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
590 outputCD->CopyData(cd,cellId,newCellId);
596 #ifdef SHOW_COINCIDING_3D_PAL21924
598 for (int ai=0; ai<npts; ai++)
599 faceIdsTmp->InsertNextId(pts[ai]);
600 input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
602 for (faceId = 0; faceId < 5; faceId++)
605 faceVerts = vtkPyramid::GetFaceArray(faceId);
606 faceIds->InsertNextId(pts[faceVerts[0]]);
607 faceIds->InsertNextId(pts[faceVerts[1]]);
608 faceIds->InsertNextId(pts[faceVerts[2]]);
609 aCellType = VTK_TRIANGLE;
611 if (faceVerts[3] >= 0)
613 faceIds->InsertNextId(pts[faceVerts[3]]);
614 aCellType = VTK_QUAD;
617 input->GetCellNeighbors(cellId, faceIds, cellIds);
618 #ifdef SHOW_COINCIDING_3D_PAL21924
620 for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
621 if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
623 bool process = nbNeighbors <= 0;
625 bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
627 if ( process || myShowInside ||
628 (!allVisible && !cellVis[cellIds->GetId(0)]) )
630 for ( i=0; i < numFacePts; i++)
631 aNewPts[i] = pts[faceVerts[i]];
632 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
634 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
635 outputCD->CopyData(cd,cellId,newCellId);
641 #if VTK_XVERSION > 50700
644 //MESSAGE("VTK_POLYHEDRON geometry filter");
645 vtkIdType nFaces = 0;
646 vtkIdType* ptIds = 0;
648 input->GetFaceStream(cellId, nFaces, ptIds);
649 #ifdef SHOW_COINCIDING_3D_PAL21924
651 for (int ai=0; ai<npts; ai++)
652 faceIdsTmp->InsertNextId(pts[ai]);
653 input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
655 for (faceId = 0; faceId < nFaces; faceId++)
658 numFacePts = ptIds[idp];
659 //MESSAGE("numFacePts="<< numFacePts);
661 for (i = 0; i < numFacePts; i++)
663 //MESSAGE("ptIds[" << idp + i << "]=" << ptIds[idp + i]);
664 faceIds->InsertNextId(ptIds[idp + i]);
670 aCellType = VTK_TRIANGLE;
673 aCellType = VTK_QUAD;
676 aCellType = VTK_POLYGON;
679 // TODO understand and fix display of several polyhedrons
680 input->GetCellNeighbors(cellId, faceIds, cellIds);
681 #ifdef SHOW_COINCIDING_3D_PAL21924
683 for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
684 if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
686 bool process = nbNeighbors <= 0;
688 bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
690 if (process || myShowInside
691 || (!allVisible && !cellVis[cellIds->GetId(0)]))
693 for (i = 0; i < numFacePts; i++)
694 aNewPts[i] = ptIds[pt0 + i];
695 newCellId = output->InsertNextCell(aCellType, numFacePts, aNewPts);
697 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
698 outputCD->CopyData(cd, cellId, newCellId);
705 case VTK_QUADRATIC_EDGE:
706 case VTK_QUADRATIC_TRIANGLE:
707 case VTK_BIQUADRATIC_TRIANGLE:
708 case VTK_QUADRATIC_QUAD:
709 case VTK_BIQUADRATIC_QUAD:
710 case VTK_QUADRATIC_TETRA:
711 case VTK_QUADRATIC_HEXAHEDRON:
712 case VTK_TRIQUADRATIC_HEXAHEDRON:
713 case VTK_QUADRATIC_WEDGE:
714 case VTK_QUADRATIC_PYRAMID:
715 if(!myIsWireframeMode) {
716 input->GetCell(cellId,cell);
717 vtkIdList *lpts = vtkIdList::New();
718 vtkPoints *coords = vtkPoints::New();
719 vtkIdList *cellIds = vtkIdList::New();
722 if ( cell->GetCellDimension() == 1 ) {
723 vtkIdType arcResult = -1;
725 arcResult = Build1DArc(cellId, input, output, pts, myMaxArcAngle);
726 newCellId = arcResult;
729 if(!myIsBuildArc || arcResult == -1 ) {
730 aCellType = VTK_LINE;
732 cell->Triangulate(0,lpts,coords);
733 for (i=0; i < lpts->GetNumberOfIds(); i+=2) {
734 aNewPts[0] = lpts->GetId(i);
735 aNewPts[1] = lpts->GetId(i+1);
736 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
738 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
739 outputCD->CopyData(cd,cellId,newCellId);
744 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
745 outputCD->CopyData(cd,cellId,newCellId);
748 else if ( cell->GetCellDimension() == 2 ) {
750 aCellType = VTK_TRIANGLE;
752 cell->Triangulate(0,lpts,coords);
753 for (i=0; i < lpts->GetNumberOfIds(); i+=3) {
754 aNewPts[0] = lpts->GetId(i);
755 aNewPts[1] = lpts->GetId(i+1);
756 aNewPts[2] = lpts->GetId(i+2);
757 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
759 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
760 outputCD->CopyData(cd,cellId,newCellId);
764 BuildArcedPolygon(cellId,input,output,aDimension2VTK2ObjIds,true);
767 else //3D nonlinear cell
769 #ifdef SHOW_COINCIDING_3D_PAL21924
773 case VTK_QUADRATIC_TETRA: npts1 = 4; break;
774 case VTK_QUADRATIC_HEXAHEDRON: npts1 = 8; break;
775 case VTK_TRIQUADRATIC_HEXAHEDRON: npts1 = 8; break;
776 case VTK_QUADRATIC_WEDGE: npts1 = 6; break;
777 case VTK_QUADRATIC_PYRAMID: npts1 = 5; break;
780 for (int ai=0; ai<npts; ai++)
781 faceIdsTmp->InsertNextId(pts[ai]);
782 input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
785 aCellType = VTK_TRIANGLE;
787 for (int j=0; j < cell->GetNumberOfFaces(); j++){
788 vtkCell *face = cell->GetFace(j);
789 input->GetCellNeighbors(cellId, face->PointIds, cellIds);
790 #ifdef SHOW_COINCIDING_3D_PAL21924
792 for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
793 if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
795 bool process = nbNeighbors <= 0;
797 bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
799 if ( process || myShowInside ) {
800 face->Triangulate(0,lpts,coords);
801 for (i=0; i < lpts->GetNumberOfIds(); i+=3) {
802 aNewPts[0] = lpts->GetId(i);
803 aNewPts[1] = lpts->GetId(i+1);
804 aNewPts[2] = lpts->GetId(i+2);
805 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
807 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
808 outputCD->CopyData(cd,cellId,newCellId);
812 } //3d nonlinear cell
817 } else { // wireframe
819 case VTK_QUADRATIC_EDGE: {
820 vtkIdType arcResult =-1;
822 arcResult = Build1DArc(cellId, input, output, pts,myMaxArcAngle);
823 newCellId = arcResult;
825 if(!myIsBuildArc || arcResult == -1) {
826 aCellType = VTK_POLY_LINE;
833 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
837 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
839 outputCD->CopyData(cd,cellId,newCellId);
842 case VTK_QUADRATIC_TRIANGLE:
843 case VTK_BIQUADRATIC_TRIANGLE: {
845 aCellType = VTK_POLYGON;
855 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
857 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
859 outputCD->CopyData(cd,cellId,newCellId);
862 BuildArcedPolygon(cellId,input,output,aDimension2VTK2ObjIds);
865 case VTK_QUADRATIC_QUAD:
866 case VTK_BIQUADRATIC_QUAD: {
868 aCellType = VTK_POLYGON;
880 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
882 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
884 outputCD->CopyData(cd,cellId,newCellId);
887 BuildArcedPolygon(cellId,input,output,aDimension2VTK2ObjIds);
890 case VTK_QUADRATIC_TETRA: {
891 aCellType = VTK_POLYGON;
894 //---------------------------------------------------------------
902 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
904 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
906 outputCD->CopyData(cd,cellId,newCellId);
908 //---------------------------------------------------------------
916 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
918 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
920 outputCD->CopyData(cd,cellId,newCellId);
922 //---------------------------------------------------------------
930 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
932 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
934 outputCD->CopyData(cd,cellId,newCellId);
936 //---------------------------------------------------------------
944 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
946 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
948 outputCD->CopyData(cd,cellId,newCellId);
952 case VTK_QUADRATIC_WEDGE: {
953 aCellType = VTK_POLYGON;
955 //---------------------------------------------------------------
963 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
965 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
966 outputCD->CopyData(cd,cellId,newCellId);
968 //---------------------------------------------------------------
973 aNewPts[3] = pts[10];
975 aNewPts[5] = pts[11];
976 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
978 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
979 outputCD->CopyData(cd,cellId,newCellId);
981 //---------------------------------------------------------------
987 aNewPts[3] = pts[14];
989 aNewPts[5] = pts[11];
991 aNewPts[7] = pts[12];
992 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
994 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
995 outputCD->CopyData(cd,cellId,newCellId);
997 //---------------------------------------------------------------
1000 aNewPts[1] = pts[13];
1001 aNewPts[2] = pts[4];
1002 aNewPts[3] = pts[10];
1003 aNewPts[4] = pts[5];
1004 aNewPts[5] = pts[14];
1005 aNewPts[6] = pts[2];
1006 aNewPts[7] = pts[7];
1007 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1009 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1010 outputCD->CopyData(cd,cellId,newCellId);
1012 //---------------------------------------------------------------
1014 aNewPts[0] = pts[0];
1015 aNewPts[1] = pts[12];
1016 aNewPts[2] = pts[3];
1017 aNewPts[3] = pts[9];
1018 aNewPts[4] = pts[4];
1019 aNewPts[5] = pts[13];
1020 aNewPts[6] = pts[1];
1021 aNewPts[7] = pts[6];
1022 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1024 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1025 outputCD->CopyData(cd,cellId,newCellId);
1028 case VTK_TRIQUADRATIC_HEXAHEDRON:
1029 case VTK_QUADRATIC_HEXAHEDRON: {
1030 aCellType = VTK_POLYGON;
1033 //---------------------------------------------------------------
1034 aNewPts[0] = pts[0];
1035 aNewPts[1] = pts[8];
1036 aNewPts[2] = pts[1];
1037 aNewPts[3] = pts[17];
1038 aNewPts[4] = pts[5];
1039 aNewPts[5] = pts[12];
1040 aNewPts[6] = pts[4];
1041 aNewPts[7] = pts[16];
1043 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1045 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1047 outputCD->CopyData(cd,cellId,newCellId);
1049 //---------------------------------------------------------------
1050 aNewPts[0] = pts[1];
1051 aNewPts[1] = pts[9];
1052 aNewPts[2] = pts[2];
1053 aNewPts[3] = pts[18];
1054 aNewPts[4] = pts[6];
1055 aNewPts[5] = pts[13];
1056 aNewPts[6] = pts[5];
1057 aNewPts[7] = pts[17];
1059 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1061 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1063 outputCD->CopyData(cd,cellId,newCellId);
1065 //---------------------------------------------------------------
1066 aNewPts[0] = pts[2];
1067 aNewPts[1] = pts[10];
1068 aNewPts[2] = pts[3];
1069 aNewPts[3] = pts[19];
1070 aNewPts[4] = pts[7];
1071 aNewPts[5] = pts[14];
1072 aNewPts[6] = pts[6];
1073 aNewPts[7] = pts[18];
1075 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1077 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1079 outputCD->CopyData(cd,cellId,newCellId);
1081 //---------------------------------------------------------------
1082 aNewPts[0] = pts[3];
1083 aNewPts[1] = pts[11];
1084 aNewPts[2] = pts[0];
1085 aNewPts[3] = pts[16];
1086 aNewPts[4] = pts[4];
1087 aNewPts[5] = pts[15];
1088 aNewPts[6] = pts[7];
1089 aNewPts[7] = pts[19];
1091 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1093 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1095 outputCD->CopyData(cd,cellId,newCellId);
1097 //---------------------------------------------------------------
1098 aNewPts[0] = pts[0];
1099 aNewPts[1] = pts[8];
1100 aNewPts[2] = pts[1];
1101 aNewPts[3] = pts[9];
1102 aNewPts[4] = pts[2];
1103 aNewPts[5] = pts[10];
1104 aNewPts[6] = pts[3];
1105 aNewPts[7] = pts[11];
1107 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1109 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1111 outputCD->CopyData(cd,cellId,newCellId);
1113 //---------------------------------------------------------------
1114 aNewPts[0] = pts[4];
1115 aNewPts[1] = pts[12];
1116 aNewPts[2] = pts[5];
1117 aNewPts[3] = pts[13];
1118 aNewPts[4] = pts[6];
1119 aNewPts[5] = pts[14];
1120 aNewPts[6] = pts[7];
1121 aNewPts[7] = pts[15];
1123 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1125 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1127 outputCD->CopyData(cd,cellId,newCellId);
1131 case VTK_QUADRATIC_PYRAMID: {
1132 aCellType = VTK_POLYGON;
1135 //---------------------------------------------------------------
1136 aNewPts[0] = pts[0];
1137 aNewPts[1] = pts[8];
1138 aNewPts[2] = pts[3];
1139 aNewPts[3] = pts[12];
1140 aNewPts[4] = pts[4];
1141 aNewPts[5] = pts[9];
1143 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1145 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1147 outputCD->CopyData(cd,cellId,newCellId);
1149 //---------------------------------------------------------------
1150 aNewPts[0] = pts[0];
1151 aNewPts[1] = pts[9];
1152 aNewPts[2] = pts[4];
1153 aNewPts[3] = pts[10];
1154 aNewPts[4] = pts[1];
1155 aNewPts[5] = pts[5];
1157 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1159 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1161 outputCD->CopyData(cd,cellId,newCellId);
1163 //---------------------------------------------------------------
1164 aNewPts[0] = pts[1];
1165 aNewPts[1] = pts[10];
1166 aNewPts[2] = pts[4];
1167 aNewPts[3] = pts[11];
1168 aNewPts[4] = pts[2];
1169 aNewPts[5] = pts[6];
1171 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1173 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1175 outputCD->CopyData(cd,cellId,newCellId);
1177 //---------------------------------------------------------------
1178 aNewPts[0] = pts[2];
1179 aNewPts[1] = pts[11];
1180 aNewPts[2] = pts[4];
1181 aNewPts[3] = pts[12];
1182 aNewPts[4] = pts[3];
1183 aNewPts[5] = pts[7];
1185 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1187 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1189 outputCD->CopyData(cd,cellId,newCellId);
1191 //---------------------------------------------------------------
1193 aNewPts[0] = pts[0];
1194 aNewPts[1] = pts[5];
1195 aNewPts[2] = pts[1];
1196 aNewPts[3] = pts[6];
1197 aNewPts[4] = pts[2];
1198 aNewPts[5] = pts[7];
1199 aNewPts[6] = pts[3];
1200 aNewPts[7] = pts[8];
1202 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1204 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1206 outputCD->CopyData(cd,cellId,newCellId);
1209 } // case VTK_QUADRATIC_PYRAMID:
1219 vtkDebugMacro(<<"Extracted " << input->GetNumberOfPoints() << " points,"
1220 << output->GetNumberOfCells() << " cells.");
1226 cellIdsTmp->Delete();
1227 faceIdsTmp->Delete();
1234 // to sort myVTK2ObjIds vector by cell dimension (ascending)
1235 if( myStoreMapping && !aDimension2VTK2ObjIds.empty() )
1237 myVTK2ObjIds.clear();
1238 for( vtkIdType aDimension = 0; aDimension <= 2; aDimension++ )
1240 TMapOfVectorId::const_iterator anIter = aDimension2VTK2ObjIds.find( aDimension );
1241 if( anIter != aDimension2VTK2ObjIds.end() )
1243 const TVectorId& aCellIds = anIter->second;
1244 TVectorId::const_iterator anIdIter, anIdIterEnd = aCellIds.end();
1245 for( anIdIter = aCellIds.begin(); anIdIter != anIdIterEnd; anIdIter++ )
1247 const vtkIdType aCellId = *anIdIter;
1248 myVTK2ObjIds.push_back( aCellId );
1258 VTKViewer_GeometryFilter
1259 ::InsertId( const vtkIdType theCellId,
1260 const vtkIdType theCellType,
1261 TVectorId& theVTK2ObjIds,
1262 TMapOfVectorId& theDimension2VTK2ObjIds )
1264 theVTK2ObjIds.push_back( theCellId );
1267 switch( theCellType )
1270 case VTK_POLY_VERTEX:
1278 case VTK_TRIANGLE_STRIP:
1286 TVectorId& aCellIds = theDimension2VTK2ObjIds[ aDimension ];
1287 aCellIds.push_back( theCellId );
1291 VTKViewer_GeometryFilter
1292 ::SetInside(int theShowInside)
1294 if(myShowInside == theShowInside)
1297 myShowInside = theShowInside;
1302 VTKViewer_GeometryFilter
1305 return myShowInside;
1310 VTKViewer_GeometryFilter
1311 ::SetWireframeMode(int theIsWireframeMode)
1313 if(myIsWireframeMode == theIsWireframeMode)
1316 myIsWireframeMode = theIsWireframeMode;
1321 VTKViewer_GeometryFilter
1322 ::GetWireframeMode()
1324 return myIsWireframeMode;
1329 VTKViewer_GeometryFilter
1330 ::SetStoreMapping(int theStoreMapping)
1332 if(myStoreMapping == theStoreMapping)
1335 myStoreMapping = theStoreMapping;
1340 VTKViewer_GeometryFilter
1343 return myStoreMapping;
1347 vtkIdType VTKViewer_GeometryFilter::GetElemObjId( int theVtkID )
1349 if( theVtkID < 0 || theVtkID >= (int)myVTK2ObjIds.size() )
1351 return myVTK2ObjIds[theVtkID];
1355 void VTKViewer_GeometryFilter::BuildArcedPolygon(vtkIdType cellId,
1356 vtkUnstructuredGrid* input,
1357 vtkPolyData *output,
1358 TMapOfVectorId& theDimension2VTK2ObjIds,
1361 vtkIdType aCellType = VTK_POLYGON;
1362 vtkIdType *aNewPoints = NULL;
1363 vtkIdType aNbPoints = 0;
1364 vtkIdType newCellId;
1366 //Input and output cell data
1367 vtkCellData *cd = input->GetCellData();
1368 vtkCellData *outputCD = output->GetCellData();
1370 //Input and output scalars on point data
1371 vtkDataArray* inputScalars = input->GetPointData()->GetScalars();
1372 vtkDataArray* outputScalars = output->GetPointData()->GetScalars();
1374 std::vector< vtkSmartPointer<vtkPoints> > aCollection;
1375 std::vector< std::vector<double> > aScalarCollection;
1377 vtkCell* aCell = input->GetCell(cellId);
1378 switch(aCell->GetCellType()) {
1379 case VTK_QUADRATIC_TRIANGLE:
1380 case VTK_BIQUADRATIC_TRIANGLE:
1382 //Get All points from input cell
1383 Pnt P0 = CreatePnt( aCell, inputScalars, 0 );
1384 Pnt P1 = CreatePnt( aCell, inputScalars, 1 );
1385 Pnt P2 = CreatePnt( aCell, inputScalars, 2 );
1386 Pnt P3 = CreatePnt( aCell, inputScalars, 3 );
1387 Pnt P4 = CreatePnt( aCell, inputScalars, 4 );
1388 Pnt P5 = CreatePnt( aCell, inputScalars, 5 );
1390 VTKViewer_ArcBuilder aBuilder1(P0,P3,P1,myMaxArcAngle); //Build arc using 0, 3 and 1 points
1392 cout << "Quadrangle arc 1 " << ( aBuilder1.GetStatus() == VTKViewer_ArcBuilder::Arc_Done ? "" : "NOT " ) << "done !!!" << endl;
1395 VTKViewer_ArcBuilder aBuilder2(P1,P4,P2,myMaxArcAngle); //Build arc using 1, 4 and 2 points
1397 cout << "Quadrangle arc 2 " << ( aBuilder2.GetStatus() == VTKViewer_ArcBuilder::Arc_Done ? "" : "NOT " ) << "done !!!" << endl;
1400 VTKViewer_ArcBuilder aBuilder3(P2,P5,P0,myMaxArcAngle); //Build arc using 2, 5 and 0 points
1402 cout << "Quadrangle arc 3 " << ( aBuilder3.GetStatus() == VTKViewer_ArcBuilder::Arc_Done ? "" : "NOT " ) << "done !!!" << endl;
1405 aCollection.push_back(aBuilder1.GetPoints());
1406 aCollection.push_back(aBuilder2.GetPoints());
1407 aCollection.push_back(aBuilder3.GetPoints());
1409 aScalarCollection.push_back(aBuilder1.GetScalarValues());
1410 aScalarCollection.push_back(aBuilder2.GetScalarValues());
1411 aScalarCollection.push_back(aBuilder3.GetScalarValues());
1414 case VTK_QUADRATIC_QUAD:
1415 case VTK_BIQUADRATIC_QUAD:
1417 //Get All points from input cell
1418 Pnt P0 = CreatePnt( aCell, inputScalars, 0 );
1419 Pnt P1 = CreatePnt( aCell, inputScalars, 1 );
1420 Pnt P2 = CreatePnt( aCell, inputScalars, 2 );
1421 Pnt P3 = CreatePnt( aCell, inputScalars, 3 );
1422 Pnt P4 = CreatePnt( aCell, inputScalars, 4 );
1423 Pnt P5 = CreatePnt( aCell, inputScalars, 5 );
1424 Pnt P6 = CreatePnt( aCell, inputScalars, 6 );
1425 Pnt P7 = CreatePnt( aCell, inputScalars, 7 );
1427 VTKViewer_ArcBuilder aBuilder1(P0,P4,P1,myMaxArcAngle); //Build arc using 0, 4 and 1 points
1429 cout << "Quadrangle arc 1 " << ( aBuilder1.GetStatus() == VTKViewer_ArcBuilder::Arc_Done ? "" : "NOT " ) << "done !!!" << endl;
1432 VTKViewer_ArcBuilder aBuilder2(P1,P5,P2,myMaxArcAngle); //Build arc using 1, 5 and 2 points
1434 cout << "Quadrangle arc 2 " << ( aBuilder2.GetStatus() == VTKViewer_ArcBuilder::Arc_Done ? "" : "NOT " ) << "done !!!" << endl;
1437 VTKViewer_ArcBuilder aBuilder3(P2,P6,P3,myMaxArcAngle); //Build arc using 2, 6 and 3 points
1439 cout << "Quadrangle arc 3 " << ( aBuilder3.GetStatus() == VTKViewer_ArcBuilder::Arc_Done ? "" : "NOT " ) << "done !!!" << endl;
1442 VTKViewer_ArcBuilder aBuilder4(P3,P7,P0,myMaxArcAngle); //Build arc using 3, 7 and 0 points
1444 cout << "Quadrangle arc 4 " << ( aBuilder4.GetStatus() == VTKViewer_ArcBuilder::Arc_Done ? "" : "NOT " ) << "done !!!" << endl;
1447 aCollection.push_back(aBuilder1.GetPoints());
1448 aCollection.push_back(aBuilder2.GetPoints());
1449 aCollection.push_back(aBuilder3.GetPoints());
1450 aCollection.push_back(aBuilder4.GetPoints());
1452 aScalarCollection.push_back(aBuilder1.GetScalarValues());
1453 aScalarCollection.push_back(aBuilder2.GetScalarValues());
1454 aScalarCollection.push_back(aBuilder3.GetScalarValues());
1455 aScalarCollection.push_back(aBuilder4.GetScalarValues());
1458 default: //Unsupported cell type
1463 const vtkIdType numFacePts = 3;
1464 vtkIdList *pts = vtkIdList::New();
1465 vtkPoints *coords = vtkPoints::New();
1466 aCellType = VTK_TRIANGLE;
1467 vtkIdType aNewPts[numFacePts];
1468 vtkIdType aTriangleId;
1470 vtkPolygon *aPlg = vtkPolygon::New();
1471 std::map<int, double> aPntId2ScalarValue;
1472 aNbPoints = MergevtkPoints(aCollection, aScalarCollection, aPlg->GetPoints(), aPntId2ScalarValue, aNewPoints);
1473 aPlg->GetPointIds()->SetNumberOfIds(aNbPoints);
1475 for(vtkIdType i = 0; i < aNbPoints;i++) {
1476 aPlg->GetPointIds()->SetId(i, aNewPoints[i]);
1479 aPlg->Triangulate(0,pts,coords);
1481 for (vtkIdType i=0; i < pts->GetNumberOfIds(); i+=3) {
1482 aNewPts[0] = output->GetPoints()->InsertNextPoint(coords->GetPoint(i));
1483 aNewPts[1] = output->GetPoints()->InsertNextPoint(coords->GetPoint(i+1));
1484 aNewPts[2] = output->GetPoints()->InsertNextPoint(coords->GetPoint(i+2));
1487 outputScalars->InsertNextTuple1(aPntId2ScalarValue[pts->GetId(i)]);
1488 outputScalars->InsertNextTuple1(aPntId2ScalarValue[pts->GetId(i+1)]);
1489 outputScalars->InsertNextTuple1(aPntId2ScalarValue[pts->GetId(i+2)]);
1492 aTriangleId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1495 InsertId( cellId, aCellType, myVTK2ObjIds, theDimension2VTK2ObjIds );
1496 outputCD->CopyData(cd,cellId,aTriangleId);
1503 std::map<int, double> aPntId2ScalarValue;
1504 aNbPoints = MergevtkPoints(aCollection, aScalarCollection, output->GetPoints(), aPntId2ScalarValue, aNewPoints);
1506 for(vtkIdType i = 0; i < aNbPoints; i++)
1507 outputScalars->InsertNextTuple1(aPntId2ScalarValue[aNewPoints[i]]);
1508 newCellId = output->InsertNextCell(aCellType,aNbPoints,aNewPoints);
1509 outputCD->CopyData(cd,cellId,newCellId);
1512 InsertId( cellId, aCellType, myVTK2ObjIds, theDimension2VTK2ObjIds );
1516 delete [] aNewPoints;
1520 void VTKViewer_GeometryFilter::SetQuadraticArcMode(bool theFlag)
1522 if(myIsBuildArc != theFlag) {
1523 myIsBuildArc = theFlag;
1527 bool VTKViewer_GeometryFilter::GetQuadraticArcMode() const
1529 return myIsBuildArc;
1532 void VTKViewer_GeometryFilter::SetQuadraticArcAngle(double theMaxAngle)
1534 if(myMaxArcAngle != theMaxAngle) {
1535 myMaxArcAngle = theMaxAngle;
1540 double VTKViewer_GeometryFilter:: GetQuadraticArcAngle() const
1542 return myMaxArcAngle;
1545 int VTKViewer_GeometryFilter::GetAppendCoincident3D() const {
1546 // VSR 26/10/2012: see description of SHOW_COINCIDING_3D_PAL20314
1547 // in the top of this file
1548 #ifdef SHOW_COINCIDING_3D_PAL20314
1549 return myAppendCoincident3D;
1555 void VTKViewer_GeometryFilter::SetAppendCoincident3D(int theFlag) {
1556 if(myAppendCoincident3D != theFlag){
1557 myAppendCoincident3D = theFlag;