932{
933 int i, p,
r, in_ring;
935 int result = -1;
936
937 POSTGIS_DEBUGF(2, "point_in_multipolygon_rtree called for %p %d %p.", root, polyCount, point);
938
939
941
943
944
945 i = 0;
946
947
948 for ( p = 0; p < polyCount; p++ )
949 {
950
951 if( ringCounts[p] == 0 ) continue;
952
954 POSTGIS_DEBUGF(4, "point_in_multipolygon_rtree: exterior ring (%d), point_in_ring returned %d", p, in_ring);
955 if ( in_ring == -1 )
956 {
957 POSTGIS_DEBUG(3, "point_in_multipolygon_rtree: outside exterior ring.");
958 }
959 else if ( in_ring == 0 )
960 {
961 POSTGIS_DEBUGF(3, "point_in_multipolygon_rtree: on edge of exterior ring %d", p);
962 return 0;
963 } else {
964 result = in_ring;
965
966 for(
r=1;
r<ringCounts[p];
r++)
967 {
969 POSTGIS_DEBUGF(4,
"point_in_multipolygon_rtree: interior ring (%d), point_in_ring returned %d",
r, in_ring);
970 if (in_ring == 1)
971 {
972 POSTGIS_DEBUGF(3,
"point_in_multipolygon_rtree: within hole %d of exterior ring %d",
r, p);
973 result = -1;
974 break;
975 }
976 if (in_ring == 0)
977 {
978 POSTGIS_DEBUGF(3,
"point_in_multipolygon_rtree: on edge of hole %d of exterior ring %d",
r, p);
979 return 0;
980 }
981 }
982
983 if ( result != -1)
984 {
985 return result;
986 }
987 }
988
989
990 i += ringCounts[p];
991 }
992
993 return result;
994
995}
int getPoint2d_p(const POINTARRAY *pa, uint32_t n, POINT2D *point)
int lwpoint_is_empty(const LWPOINT *point)
static int point_in_ring_rtree(RTREE_NODE *root, const POINT2D *point)