------------------------------------------------------------------------------
| 54 | |
| 55 | //------------------------------------------------------------------------------ |
| 56 | bool vtkGeoJSONFeature::CreatePoint(const Json::Value& coordinates, double point[3]) |
| 57 | { |
| 58 | // Check if Coordinates corresponds to Point |
| 59 | if (!IsPoint(coordinates)) |
| 60 | { |
| 61 | vtkErrorMacro(<< "Wrong data format for a point!"); |
| 62 | return false; |
| 63 | } |
| 64 | |
| 65 | // Do isDouble before asDouble to prevent inconsistency |
| 66 | // Probably check for float/int too |
| 67 | |
| 68 | if (coordinates.size() == 1) |
| 69 | { |
| 70 | // Update the 3D Coordinates using the 1 Value in the array and rest of the 2 as 0 |
| 71 | Json::Value const& x = coordinates[0]; |
| 72 | point[0] = x.asDouble(); |
| 73 | point[1] = 0; |
| 74 | point[2] = 0; |
| 75 | } |
| 76 | else if (coordinates.size() == 2) |
| 77 | { |
| 78 | // Update the 3D Coordinates using the 2 Values in the array and 3rd as 0 |
| 79 | Json::Value const& x = coordinates[0]; |
| 80 | Json::Value const& y = coordinates[1]; |
| 81 | point[0] = x.asDouble(); |
| 82 | point[1] = y.asDouble(); |
| 83 | point[2] = 0; |
| 84 | } |
| 85 | else if (coordinates.size() == 3) |
| 86 | { |
| 87 | // Update the 3D Coordinates using the 3 Values in the array |
| 88 | Json::Value const& x = coordinates[0]; |
| 89 | Json::Value const& y = coordinates[1]; |
| 90 | Json::Value const& z = coordinates[2]; |
| 91 | point[0] = x.asDouble(); |
| 92 | point[1] = y.asDouble(); |
| 93 | point[2] = z.asDouble(); |
| 94 | } |
| 95 | |
| 96 | // Return that we properly created the point |
| 97 | return true; |
| 98 | } |
| 99 | |
| 100 | //------------------------------------------------------------------------------ |
| 101 | vtkPolyData* vtkGeoJSONFeature::ExtractPoint( |
no test coverage detected