| | 1139 | |
|---|
| | 1140 | /************************************************************************/ |
|---|
| | 1141 | /* IsValid() */ |
|---|
| | 1142 | /************************************************************************/ |
|---|
| | 1143 | |
|---|
| | 1144 | /** |
|---|
| | 1145 | * Test if the geometry is valid |
|---|
| | 1146 | * |
|---|
| | 1147 | * This method is the same as the C function OGR_G_IsValid(). |
|---|
| | 1148 | * |
|---|
| | 1149 | * This method is built on the GEOS library, check it for the definition |
|---|
| | 1150 | * of the geometry operation. |
|---|
| | 1151 | * If OGR is built without the GEOS library, this method will always return |
|---|
| | 1152 | * FALSE. |
|---|
| | 1153 | * |
|---|
| | 1154 | * |
|---|
| | 1155 | * @return TRUE if the geometry has no points, otherwise FALSE. |
|---|
| | 1156 | */ |
|---|
| | 1157 | |
|---|
| | 1158 | OGRBoolean |
|---|
| | 1159 | OGRGeometry::IsValid( ) const |
|---|
| | 1160 | |
|---|
| | 1161 | { |
|---|
| | 1162 | #ifndef HAVE_GEOS |
|---|
| | 1163 | |
|---|
| | 1164 | return FALSE; |
|---|
| | 1165 | |
|---|
| | 1166 | #else |
|---|
| | 1167 | |
|---|
| | 1168 | OGRBoolean bResult = FALSE; |
|---|
| | 1169 | GEOSGeom hThisGeosGeom = NULL; |
|---|
| | 1170 | |
|---|
| | 1171 | hThisGeosGeom = exportToGEOS(); |
|---|
| | 1172 | |
|---|
| | 1173 | if( hThisGeosGeom != NULL ) |
|---|
| | 1174 | { |
|---|
| | 1175 | bResult = GEOSisValid( hThisGeosGeom ); |
|---|
| | 1176 | GEOSGeom_destroy( hThisGeosGeom ); |
|---|
| | 1177 | } |
|---|
| | 1178 | |
|---|
| | 1179 | return bResult; |
|---|
| | 1180 | |
|---|
| | 1181 | #endif /* HAVE_GEOS */ |
|---|
| | 1182 | } |
|---|
| | 1183 | |
|---|
| | 1184 | int OGR_G_IsValid( OGRGeometryH hGeom ) |
|---|
| | 1185 | |
|---|
| | 1186 | { |
|---|
| | 1187 | return ((OGRGeometry *) hGeom)->IsValid(); |
|---|
| | 1188 | } |
|---|
| | 1189 | |
|---|
| | 1190 | /************************************************************************/ |
|---|
| | 1191 | /* IsSimple() */ |
|---|
| | 1192 | /************************************************************************/ |
|---|
| | 1193 | |
|---|
| | 1194 | /** |
|---|
| | 1195 | * Test if the geometry is simple |
|---|
| | 1196 | * |
|---|
| | 1197 | * This method is the same as the C function OGR_G_IsSimple(). |
|---|
| | 1198 | * |
|---|
| | 1199 | * This method is built on the GEOS library, check it for the definition |
|---|
| | 1200 | * of the geometry operation. |
|---|
| | 1201 | * If OGR is built without the GEOS library, this method will always return |
|---|
| | 1202 | * FALSE. |
|---|
| | 1203 | * |
|---|
| | 1204 | * |
|---|
| | 1205 | * @return TRUE if the geometry has no points, otherwise FALSE. |
|---|
| | 1206 | */ |
|---|
| | 1207 | |
|---|
| | 1208 | OGRBoolean |
|---|
| | 1209 | OGRGeometry::IsSimple( ) const |
|---|
| | 1210 | |
|---|
| | 1211 | { |
|---|
| | 1212 | #ifndef HAVE_GEOS |
|---|
| | 1213 | |
|---|
| | 1214 | return FALSE; |
|---|
| | 1215 | |
|---|
| | 1216 | #else |
|---|
| | 1217 | |
|---|
| | 1218 | OGRBoolean bResult = FALSE; |
|---|
| | 1219 | GEOSGeom hThisGeosGeom = NULL; |
|---|
| | 1220 | |
|---|
| | 1221 | hThisGeosGeom = exportToGEOS(); |
|---|
| | 1222 | |
|---|
| | 1223 | if( hThisGeosGeom != NULL ) |
|---|
| | 1224 | { |
|---|
| | 1225 | bResult = GEOSisSimple( hThisGeosGeom ); |
|---|
| | 1226 | GEOSGeom_destroy( hThisGeosGeom ); |
|---|
| | 1227 | } |
|---|
| | 1228 | |
|---|
| | 1229 | return bResult; |
|---|
| | 1230 | |
|---|
| | 1231 | #endif /* HAVE_GEOS */ |
|---|
| | 1232 | } |
|---|
| | 1233 | |
|---|
| | 1234 | int OGR_G_IsSimple( OGRGeometryH hGeom ) |
|---|
| | 1235 | |
|---|
| | 1236 | { |
|---|
| | 1237 | return ((OGRGeometry *) hGeom)->IsSimple(); |
|---|
| | 1238 | } |
|---|
| | 1239 | |
|---|
| | 1240 | /************************************************************************/ |
|---|
| | 1241 | /* IsRing() */ |
|---|
| | 1242 | /************************************************************************/ |
|---|
| | 1243 | |
|---|
| | 1244 | /** |
|---|
| | 1245 | * Test if the geometry is a ring |
|---|
| | 1246 | * |
|---|
| | 1247 | * This method is the same as the C function OGR_G_IsRing(). |
|---|
| | 1248 | * |
|---|
| | 1249 | * This method is built on the GEOS library, check it for the definition |
|---|
| | 1250 | * of the geometry operation. |
|---|
| | 1251 | * If OGR is built without the GEOS library, this method will always return |
|---|
| | 1252 | * FALSE. |
|---|
| | 1253 | * |
|---|
| | 1254 | * |
|---|
| | 1255 | * @return TRUE if the geometry has no points, otherwise FALSE. |
|---|
| | 1256 | */ |
|---|
| | 1257 | |
|---|
| | 1258 | OGRBoolean |
|---|
| | 1259 | OGRGeometry::IsRing( ) const |
|---|
| | 1260 | |
|---|
| | 1261 | { |
|---|
| | 1262 | #ifndef HAVE_GEOS |
|---|
| | 1263 | |
|---|
| | 1264 | return FALSE; |
|---|
| | 1265 | |
|---|
| | 1266 | #else |
|---|
| | 1267 | |
|---|
| | 1268 | OGRBoolean bResult = FALSE; |
|---|
| | 1269 | GEOSGeom hThisGeosGeom = NULL; |
|---|
| | 1270 | |
|---|
| | 1271 | hThisGeosGeom = exportToGEOS(); |
|---|
| | 1272 | |
|---|
| | 1273 | if( hThisGeosGeom != NULL ) |
|---|
| | 1274 | { |
|---|
| | 1275 | bResult = GEOSisRing( hThisGeosGeom ); |
|---|
| | 1276 | GEOSGeom_destroy( hThisGeosGeom ); |
|---|
| | 1277 | } |
|---|
| | 1278 | |
|---|
| | 1279 | return bResult; |
|---|
| | 1280 | |
|---|
| | 1281 | #endif /* HAVE_GEOS */ |
|---|
| | 1282 | } |
|---|
| | 1283 | |
|---|
| | 1284 | int OGR_G_IsRing( OGRGeometryH hGeom ) |
|---|
| | 1285 | |
|---|
| | 1286 | { |
|---|
| | 1287 | return ((OGRGeometry *) hGeom)->IsRing(); |
|---|
| | 1288 | } |
|---|
| | 1289 | |
|---|