25 | | New OGRwkbGeometryType values are needed - that is a rather complex system due to history. SFSQL 1.2 and ISO SQL/MM Part 3 will be used, i.e., 2D type + 2000 for M and 2D type + 3000 for ZM. (Also types such as Tin and !PolyhedralSurface types can be added for completeness, even if unimplemented currently) |
| 25 | New OGRwkbGeometryType values are needed. SFSQL 1.2 and ISO SQL/MM Part 3 will be used, i.e., 2D type + 2000 for M and 2D type + 3000 for ZM. (Also types such as Tin and !PolyhedralSurface types can be added for completeness, even if unimplemented currently) |
| 26 | |
| 27 | On a more general note, there could be a path to using a clean set of values and have legacy support as an exception. I'm proposing to define aliases for legacy *25D values to have a uniform set of values. Are there any problems with that? |
| 28 | |
| 29 | Abstract types are defined and not part of the enum. |
88 | | Currently hacks such as nCoordDimension == -2 are used to denote empty geometries. This implies many changes to drivers etc. which get or set nCoordinateDimension. |
89 | | |
90 | | !IsEmpty = !(flags & OGR_G_NOT_EMPTY), Is3D = flags & OGR_G_3D, !IsMeasured = flags & OGR_G_MEASURED. |
91 | | |
92 | | The !IsEmpty method is needed only in the base class but the emptiness needs to be managed in all classes through the flags. |
93 | | |
94 | | Keep (with original semantics, i.e., coordinate dimension is 2 or 3), but deprecate. In documentation it says that this may return zero for empty points while in ogrpoint.cpp it says that negative nCoordDimension values are used for empty points and getCoordinateDimension of point returns absolute value of nCoordDimension - thus not zero. |
95 | | {{{ |
96 | | getCoordinateDimension(); |
97 | | setCoordinateDimension(); |
98 | | }}} |
| 92 | Currently a hack to set nCoordDimension negative is used to denote an empty point. This implies many changes to drivers etc. which get or set nCoordinateDimension. |
| 93 | |
| 94 | The tests are |
| 95 | |
| 96 | {{{ |
| 97 | !IsEmpty = !(flags & OGR_G_NOT_EMPTY) |
| 98 | Is3D = flags & OGR_G_3D |
| 99 | !IsMeasured = flags & OGR_G_MEASURED |
| 100 | }}} |
| 101 | |
| 102 | The setters and getters are implemented with |= and &=. |
| 103 | |
| 104 | The !IsEmpty method is needed only in the base class but the emptiness needs to be managed in all classes. It needs to be decided but when any of these flags is set, the corresponding data becomes invalid and may be discarded. |
| 105 | |
| 106 | Keep the following methods with original semantics, i.e., coordinate dimension is 2 or 3, but deprecate. There is some discrepancy in documentation. Their documentation says that they may return zero for empty points while in ogrpoint.cpp it says that negative nCoordDimension values are used for empty points and the getCoordinateDimension method of point returns absolute value of nCoordDimension - thus not zero. |
| 107 | {{{ |
| 108 | int getCoordinateDimension(); |
| 109 | void setCoordinateDimension(int nDimension); |
| 110 | void flattenTo2D() |
| 111 | }}} |
| 112 | |
| 113 | It is proposed to possibly add a new method to replace getCoordinateDimension. set3D and setMeasured would replace setCoordinateDimension and flattenTo2D. See below. |
103 | | int Dimension(); // -1 for empty geometries, 0 for points, 1 for curves, 2 for surfaces, max of components for collections |
| 118 | int Dimension(); // -1 for empty geometries (to denote undefined), 0 for points, 1 for curves, 2 for surfaces, max of components for collections |
| 119 | char *GeometryType(); // calls OGRToOGCGeomType (which needs to be enhanced) |
| 120 | |
| 121 | //Add methods (SF Common Architecture) see above for implementation: |
123 | | Whether set3D and setMeasured should affect the children geometries in a collection is an issue. Currently doc for setCoordinateDimension says "Setting |
124 | | the dimension of a geometry collection will not necessarily affect the children geometries.", which is not very clear. |
125 | | [ Note from E. Rouault --> the comment was wrong and has been fixed in r33184. I strongly believe that set3D and setMeasured should affect all sub-geometries, otherwise inconsistant WKB / WKT can be produced, leading to issues such as #6332 ] |
| 137 | Whether set3D and setMeasured should affect the children geometries in a collection is an issue. Currently doc for setCoordinateDimension says "Setting the dimension of a geometry collection will affect the children geometries.", thus we have already committed to maintaining dimensions of children in collections. It is proposed that set3D and setMeasured either add or strip Z or M values to or from the geometry (including possible children). |