------------------------------------------------------------------------------
| 130 | |
| 131 | //------------------------------------------------------------------------------ |
| 132 | vtkPolyData* 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 | //------------------------------------------------------------------------------ |
| 172 | vtkPolyData* vtkGeoJSONFeature::ExtractLineString( |
no test coverage detected