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

Method ExtractLineString

IO/GeoJSON/vtkGeoJSONFeature.cxx:172–199  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

170
171//------------------------------------------------------------------------------
172vtkPolyData* vtkGeoJSONFeature::ExtractLineString(
173 const Json::Value& coordinates, vtkPolyData* outputData)
174{
175 // Check if Coordinates corresponds to Line String
176 if (!IsLineString(coordinates))
177 {
178 vtkErrorMacro(<< "Wrong data format for a Line String!");
179 return nullptr;
180 }
181
182 vtkPoints* points = outputData->GetPoints();
183 vtkNew<vtkPolyLine> polyLine;
184 double xyz[3];
185 vtkIdList* pointIdList = polyLine->GetPointIds();
186 vtkIdType pointId;
187 for (Json::Value::ArrayIndex i = 0; i < coordinates.size(); i++)
188 {
189 this->CreatePoint(coordinates[i], xyz);
190 pointId = points->InsertNextPoint(xyz);
191 pointIdList->InsertNextId(pointId);
192 }
193 outputData->GetLines()->InsertNextCell(polyLine);
194 vtkAbstractArray* array = outputData->GetCellData()->GetAbstractArray("feature-id");
195 vtkStringArray* ids = vtkArrayDownCast<vtkStringArray>(array);
196 ids->InsertNextValue(this->FeatureId);
197
198 return outputData;
199}
200
201//------------------------------------------------------------------------------
202vtkPolyData* vtkGeoJSONFeature::ExtractMultiLineString(

Callers 2

Calls 11

CreatePointMethod · 0.95
InsertNextIdMethod · 0.80
GetAbstractArrayMethod · 0.80
GetPointsMethod · 0.45
GetPointIdsMethod · 0.45
sizeMethod · 0.45
InsertNextPointMethod · 0.45
InsertNextCellMethod · 0.45
GetLinesMethod · 0.45
GetCellDataMethod · 0.45
InsertNextValueMethod · 0.45

Tested by

no test coverage detected