| 824 | } |
| 825 | |
| 826 | shapeObj *msGEOSIntersection(shapeObj *shape1, shapeObj *shape2) |
| 827 | { |
| 828 | #ifdef USE_GEOS |
| 829 | GEOSGeom g1, g2, g3; |
| 830 | |
| 831 | if(!shape1 || !shape2) |
| 832 | return NULL; |
| 833 | |
| 834 | if(!shape1->geometry) /* if no geometry for the shape then build one */ |
| 835 | shape1->geometry = (GEOSGeom) msGEOSShape2Geometry(shape1); |
| 836 | g1 = (GEOSGeom) shape1->geometry; |
| 837 | if(!g1) return NULL; |
| 838 | |
| 839 | if(!shape2->geometry) /* if no geometry for the shape then build one */ |
| 840 | shape2->geometry = (GEOSGeom) msGEOSShape2Geometry(shape2); |
| 841 | g2 = (GEOSGeom) shape2->geometry; |
| 842 | if(!g2) return NULL; |
| 843 | |
| 844 | g3 = GEOSIntersection(g1, g2); |
| 845 | return msGEOSGeometry2Shape(g3); |
| 846 | #else |
| 847 | msSetError(MS_GEOSERR, "GEOS support is not available.", "msGEOSIntersection()"); |
| 848 | return NULL; |
| 849 | #endif |
| 850 | } |
| 851 | |
| 852 | shapeObj *msGEOSDifference(shapeObj *shape1, shapeObj *shape2) |
| 853 | { |
no test coverage detected