------------------------------------------------------------------------------
| 170 | |
| 171 | //------------------------------------------------------------------------------ |
| 172 | vtkPolyData* 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 | //------------------------------------------------------------------------------ |
| 202 | vtkPolyData* vtkGeoJSONFeature::ExtractMultiLineString( |
no test coverage detected