MCPcopy Create free account
hub / github.com/Kitware/VTK / SetupPolyData

Method SetupPolyData

IO/GDAL/vtkGDALVectorReader.cxx:69–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67 }
68
69 void SetupPolyData(vtkPolyData** pd, vtkCellArray** lines, vtkCellArray** verts,
70 std::vector<vtkAbstractArray*>* fields, int numFields, OGRFeatureDefn* fdef)
71 {
72 *pd = vtkPolyData::New();
73
74 vtkAbstractArray* arr;
75 int f;
76 for (f = 0; f < numFields; ++f)
77 {
78 OGRFieldDefn* ffdef = fdef->GetFieldDefn(f);
79 switch (ffdef->GetType())
80 {
81 case OFTInteger:
82 arr = vtkIntArray::New();
83 break;
84 case OFTReal:
85 arr = vtkDoubleArray::New();
86 break;
87 case OFTString:
88 default: // When in doubt, it's a string!
89 arr = vtkStringArray::New();
90 break;
91 }
92 arr->SetName(ffdef->GetNameRef());
93 fields->push_back(arr);
94 (*pd)->GetCellData()->AddArray(arr);
95 arr->FastDelete();
96 }
97 if (this->AddFeatureIds)
98 {
99 vtkNew<vtkIdTypeArray> featIds;
100 featIds->SetName("_vtkPedigreeIds");
101 (*pd)->GetCellData()->SetPedigreeIds(featIds);
102 fields->push_back(featIds);
103 }
104
105 *lines = vtkCellArray::New();
106 *verts = vtkCellArray::New();
107
108 (*pd)->SetLines(*lines);
109 (*pd)->SetVerts(*verts);
110
111 (*lines)->FastDelete();
112 (*verts)->FastDelete();
113 }
114
115 bool ReadLayer(OGRLayer* layer, vtkMultiBlockDataSet* mbds)
116 {

Callers 1

ReadLayerMethod · 0.95

Calls 10

FastDeleteMethod · 0.80
SetPedigreeIdsMethod · 0.80
SetLinesMethod · 0.80
SetVertsMethod · 0.80
NewFunction · 0.50
GetTypeMethod · 0.45
SetNameMethod · 0.45
push_backMethod · 0.45
AddArrayMethod · 0.45
GetCellDataMethod · 0.45

Tested by

no test coverage detected