// Loop over all cells now that visibility is known
// (Have to compute visibility first for 3D cell boundarys)
int progressInterval = numCells/20 + 1;
+ TMapOfVectorId aDimension2VTK2ObjIds;
if(myStoreMapping){
myVTK2ObjIds.clear();
myVTK2ObjIds.reserve(numCells);
case VTK_POLY_VERTEX:
newCellId = output->InsertNextCell(aCellType,npts,pts);
if(myStoreMapping){
- myVTK2ObjIds.push_back(cellId); //apo
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
}
outputCD->CopyData(cd,cellId,newCellId);
break;
case VTK_POLY_LINE:
newCellId = output->InsertNextCell(aCellType,npts,pts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
break;
case VTK_POLYGON:
newCellId = output->InsertNextCell(aCellType,npts,pts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
break;
case VTK_TRIANGLE_STRIP:
newCellId = output->InsertNextCell(aCellType,npts,pts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
break;
case VTK_PIXEL:
newCellId = output->InsertNextCell(aCellType,npts,pts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
break;
outputCD,
myStoreMapping,
myVTK2ObjIds,
+ aDimension2VTK2ObjIds,
true);
if(!anIsOk)
aDelaunayTriangulator.Execute(input,
outputCD,
myStoreMapping,
myVTK2ObjIds,
+ aDimension2VTK2ObjIds,
false);
break;
aNewPts[i] = pts[faceVerts[i]];
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
}
}
aNewPts[i] = pts[faceVerts[PixelConvert[i]]];
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
}
}
aNewPts[i] = pts[faceVerts[i]];
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
}
}
aNewPts[i] = pts[faceVerts[i]];
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
}
}
aNewPts[i] = pts[faceVerts[i]];
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
}
}
aNewPts[i] = pts[faceVerts[i]];
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
}
}
aNewPts[i] = ptIds[pt0 + i];
newCellId = output->InsertNextCell(aCellType, numFacePts, aNewPts);
if (myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd, cellId, newCellId);
}
}
aNewPts[1] = lpts->GetId(i+1);
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
}
}
else {
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
}
}
aNewPts[2] = lpts->GetId(i+2);
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
}
}
else{
- BuildArcedPolygon(cellId,input,output,true);
+ BuildArcedPolygon(cellId,input,output,aDimension2VTK2ObjIds,true);
}
}
else //3D nonlinear cell
aNewPts[2] = lpts->GetId(i+2);
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
}
}
}
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
break;
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
}
else
- BuildArcedPolygon(cellId,input,output);
+ BuildArcedPolygon(cellId,input,output,aDimension2VTK2ObjIds);
break;
}
case VTK_BIQUADRATIC_QUAD:
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
}
else
- BuildArcedPolygon(cellId,input,output);
+ BuildArcedPolygon(cellId,input,output,aDimension2VTK2ObjIds);
break;
}
case VTK_QUADRATIC_TETRA: {
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
aNewPts[5] = pts[8];
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
//---------------------------------------------------------------
aNewPts[5] = pts[11];
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
//---------------------------------------------------------------
aNewPts[7] = pts[12];
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
//---------------------------------------------------------------
aNewPts[7] = pts[7];
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
//---------------------------------------------------------------
aNewPts[7] = pts[6];
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
break;
}
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,newCellId);
delete [] cellVis;
}
+ // to sort myVTK2ObjIds vector by cell dimension (ascending)
+ if( myStoreMapping && !aDimension2VTK2ObjIds.empty() )
+ {
+ myVTK2ObjIds.clear();
+ for( vtkIdType aDimension = 0; aDimension <= 2; aDimension++ )
+ {
+ TMapOfVectorId::const_iterator anIter = aDimension2VTK2ObjIds.find( aDimension );
+ if( anIter != aDimension2VTK2ObjIds.end() )
+ {
+ const TVectorId& aCellIds = anIter->second;
+ TVectorId::const_iterator anIdIter, anIdIterEnd = aCellIds.end();
+ for( anIdIter = aCellIds.begin(); anIdIter != anIdIterEnd; anIdIter++ )
+ {
+ const vtkIdType aCellId = *anIdIter;
+ myVTK2ObjIds.push_back( aCellId );
+ }
+ }
+ }
+ }
+
return 1;
}
+void
+VTKViewer_GeometryFilter
+::InsertId( const vtkIdType theCellId,
+ const vtkIdType theCellType,
+ TVectorId& theVTK2ObjIds,
+ TMapOfVectorId& theDimension2VTK2ObjIds )
+{
+ theVTK2ObjIds.push_back( theCellId );
+
+ int aDimension = 0;
+ switch( theCellType )
+ {
+ case VTK_VERTEX:
+ case VTK_POLY_VERTEX:
+ aDimension = 0;
+ break;
+ case VTK_LINE:
+ case VTK_POLY_LINE:
+ aDimension = 1;
+ break;
+ case VTK_TRIANGLE:
+ case VTK_TRIANGLE_STRIP:
+ case VTK_POLYGON:
+ case VTK_PIXEL:
+ case VTK_QUAD:
+ aDimension = 2;
+ break;
+ }
+
+ TVectorId& aCellIds = theDimension2VTK2ObjIds[ aDimension ];
+ aCellIds.push_back( theCellId );
+}
void
VTKViewer_GeometryFilter
}
-void VTKViewer_GeometryFilter::BuildArcedPolygon(vtkIdType cellId, vtkUnstructuredGrid* input, vtkPolyData *output, bool triangulate){
+void VTKViewer_GeometryFilter::BuildArcedPolygon(vtkIdType cellId,
+ vtkUnstructuredGrid* input,
+ vtkPolyData *output,
+ TMapOfVectorId& theDimension2VTK2ObjIds,
+ bool triangulate){
vtkIdType aCellType = VTK_POLYGON;
vtkIdType *aNewPoints = NULL;
vtkIdType aNbPoints = 0;
aTriangleId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, theDimension2VTK2ObjIds );
outputCD->CopyData(cd,cellId,aTriangleId);
}
pts->Delete();
outputCD->CopyData(cd,cellId,newCellId);
if(myStoreMapping)
- myVTK2ObjIds.push_back(cellId);
+ InsertId( cellId, aCellType, myVTK2ObjIds, theDimension2VTK2ObjIds );
}
if (aNewPoints)
myAppendCoincident3D = theFlag;
this->Modified();
}
-}
\ No newline at end of file
+}