| 185 | == Addendum, Aug. 9, 2010 == |
| 186 | |
| 187 | This RFC provides some utility methods to check polygon vertex order and fix polygon vertex order errors. However, what action should be taken when copying a polygon from one feature source to another feature source isn't addressed in this RFC. The following enum and method will be introduced to address it. |
| 188 | |
| 189 | {{{ |
| 190 | /// \brief |
| 191 | /// FdoFixPolygonVertexOrderAction is an enumeration of the action taken |
| 192 | /// when copying polygon from a source provider to a target provider. |
| 193 | /// |
| 194 | enum FdoPolygonVertexOrderAction |
| 195 | { |
| 196 | /// No processing. |
| 197 | FdoFixPolygonVertexOrderAction_None = 0, |
| 198 | |
| 199 | /// Reverse polygon vertex. |
| 200 | FdoFixPolygonVertexOrderAction_Reverse = 1, |
| 201 | |
| 202 | /// Check polygon vertex order and reverse it if necessary. |
| 203 | FdoFixPolygonVertexOrderAction_CheckAndReverse = 2 |
| 204 | }; |
| 205 | |
| 206 | |
| 207 | /// \brief |
| 208 | /// Spatial utility class |
| 209 | /// |
| 210 | class FdoSpatialUtility |
| 211 | { |
| 212 | public: |
| 213 | /// \brief |
| 214 | /// Given the vertex order and strictness rule of the source and the target, |
| 215 | /// get the action taken when copying polygon from a source provider to |
| 216 | /// a target provider. |
| 217 | /// |
| 218 | /// \param sourceVertexOrderRule |
| 219 | /// Input the vertex order rule of the source. |
| 220 | /// \param sourceStrictnessRule |
| 221 | /// Input the vertex order strictness rule of the source. |
| 222 | /// \param targetVertexOrderRule |
| 223 | /// Input the vertex order rule of the target. |
| 224 | /// \param targetStrictnessRule |
| 225 | /// Input the vertex order strictness rule of the target. |
| 226 | /// |
| 227 | /// \return |
| 228 | /// Returns the action taken to taken when copying polygon from a source |
| 229 | /// provider to a target provider. |
| 230 | /// |
| 231 | FDO_SPATIAL_API static FdoPolygonVertexOrderAction GetFixPolygonVertexOrderAction( |
| 232 | FdoPolygonVertexOrderRule sourceVertexOrderRule, |
| 233 | FdoBoolean sourceStrictnessRule, |
| 234 | FdoPolygonVertexOrderRule targetVertexOrderRule, |
| 235 | FdoBoolean targetStrictnessRule); |
| 236 | }; |
| 237 | }}} |
| 238 | |
| 239 | Method !GetPolygonVertexOrderAction is used to get what action should be taken when copying a polygon from one feature source to another feature source. The following table is defined in this method. |
| 240 | |
| 241 | {{{ |
| 242 | static FdoFixPolygonVertexOrderAction table1[36] = { |
| 243 | // From Order From Strict To Order To Strict NonSense |
| 244 | FdoFixPolygonVertexOrderAction_CheckAndFix, // CCW Enforced CCW Enforced |
| 245 | FdoFixPolygonVertexOrderAction_None, // CCW Enforced CCW Not enforced |
| 246 | FdoFixPolygonVertexOrderAction_CheckAndFix, // CCW Enforced CW Enforced |
| 247 | FdoFixPolygonVertexOrderAction_Reverse, // CCW Enforced CW Not enforced |
| 248 | FdoFixPolygonVertexOrderAction_None, // CCW Enforced None Enforced True |
| 249 | FdoFixPolygonVertexOrderAction_None, // CCW Enforced None Not enforced |
| 250 | |
| 251 | FdoFixPolygonVertexOrderAction_CheckAndFix, // CCW Not enforced CCW Enforce |
| 252 | FdoFixPolygonVertexOrderAction_None, // CCW Not enforced CCW Not enforced |
| 253 | FdoFixPolygonVertexOrderAction_CheckAndFix, // CCW Not enforced CW Enforced |
| 254 | FdoFixPolygonVertexOrderAction_Reverse, // CCW Not enforced CW Not enforced |
| 255 | FdoFixPolygonVertexOrderAction_None, // CCW Not enforced None Enforced True |
| 256 | FdoFixPolygonVertexOrderAction_None, // CCW Not enforced None Not enforced |
| 257 | |
| 258 | FdoFixPolygonVertexOrderAction_CheckAndFix, // CW Enforced CCW Enforced |
| 259 | FdoFixPolygonVertexOrderAction_Reverse, // CW Enforced CCW Not enforced |
| 260 | FdoFixPolygonVertexOrderAction_CheckAndFix, // CW Enforced CW Enforced |
| 261 | FdoFixPolygonVertexOrderAction_None, // CW Enforced CW Not enforced |
| 262 | FdoFixPolygonVertexOrderAction_None, // CW Enforced None Enforced True |
| 263 | FdoFixPolygonVertexOrderAction_None, // CW Enforced None Not enforced |
| 264 | |
| 265 | FdoFixPolygonVertexOrderAction_CheckAndFix, // CW Not enforced CCW Enforced |
| 266 | FdoFixPolygonVertexOrderAction_Reverse, // CW Not enforced CCW Not enforced |
| 267 | FdoFixPolygonVertexOrderAction_CheckAndFix, // CW Not enforced CW Enforced |
| 268 | FdoFixPolygonVertexOrderAction_None, // CW Not enforced CW Not enforced |
| 269 | FdoFixPolygonVertexOrderAction_None, // CW Not enforced None Enforced True |
| 270 | FdoFixPolygonVertexOrderAction_None, // CW Not enforced None Not enforced |
| 271 | |
| 272 | FdoFixPolygonVertexOrderAction_CheckAndFix, // None Enforced CCW Enforced True |
| 273 | FdoFixPolygonVertexOrderAction_None, // None Enforced CCW Not enforced True |
| 274 | FdoFixPolygonVertexOrderAction_CheckAndFix, // None Enforced CW Enforced True |
| 275 | FdoFixPolygonVertexOrderAction_None, // None Enforced CW Not enforced True |
| 276 | FdoFixPolygonVertexOrderAction_None, // None Enforced None Enforced True |
| 277 | FdoFixPolygonVertexOrderAction_None, // None Enforced None Not enforced True |
| 278 | |
| 279 | FdoFixPolygonVertexOrderAction_CheckAndFix, // None Not enforced CCW Enforced |
| 280 | FdoFixPolygonVertexOrderAction_None, // None Not enforced CCW Not enforced |
| 281 | FdoFixPolygonVertexOrderAction_CheckAndFix, // None Not enforced CW Enforced |
| 282 | FdoFixPolygonVertexOrderAction_None, // None Not enforced CW Not enforced |
| 283 | FdoFixPolygonVertexOrderAction_None, // None Not enforced None Enforced True |
| 284 | FdoFixPolygonVertexOrderAction_None // None Not enforced None Not enforced |
| 285 | }; |
| 286 | |
| 287 | }}} |
| 288 | |
| 289 | Actions defined in the table above will guarantee that polygons in the target will have the correct vertex order if the target is enforced when copying a polygon from one feature source to another feature source. |