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

Method ExtractMultiPoint

IO/GeoJSON/vtkGeoJSONFeature.cxx:132–169  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

130
131//------------------------------------------------------------------------------
132vtkPolyData* vtkGeoJSONFeature::ExtractMultiPoint(
133 const Json::Value& coordinates, vtkPolyData* outputData)
134{
135 // Check if Coordinates corresponds to Multi Points
136 if (!IsMultiPoint(coordinates))
137 {
138 vtkErrorMacro(<< "Wrong data format for a Multi Point!");
139 return nullptr;
140 }
141
142 if (coordinates.isArray())
143 {
144 vtkPoints* points = outputData->GetPoints(); // Contain the locations of the points
145 vtkCellArray* verts =
146 outputData->GetVerts(); // Contain the indices corresponding to the position of the vertices
147
148 vtkAbstractArray* array = outputData->GetCellData()->GetAbstractArray("feature-id");
149 vtkStringArray* ids = vtkArrayDownCast<vtkStringArray>(array);
150
151 const int PID_SIZE = coordinates.size();
152 vtkIdType* pids = new vtkIdType[PID_SIZE];
153 double point[3];
154 for (int i = 0; i < PID_SIZE; i++)
155 {
156 // Parse point from Json object to double array and add it to the points array
157 CreatePoint(coordinates, point);
158 pids[i] = points->InsertNextPoint(point);
159 }
160
161 // Update polyData vertices to store multiple points
162 verts->InsertNextCell(PID_SIZE, pids);
163 ids->InsertNextValue(this->FeatureId);
164
165 delete[] pids;
166 }
167
168 return outputData;
169}
170
171//------------------------------------------------------------------------------
172vtkPolyData* vtkGeoJSONFeature::ExtractLineString(

Callers 1

Calls 9

isArrayMethod · 0.80
GetVertsMethod · 0.80
GetAbstractArrayMethod · 0.80
GetPointsMethod · 0.45
GetCellDataMethod · 0.45
sizeMethod · 0.45
InsertNextPointMethod · 0.45
InsertNextCellMethod · 0.45
InsertNextValueMethod · 0.45

Tested by

no test coverage detected