1047{
1048 uint32_t i, j;
1049 int result, in_ring;
1051
1052 POSTGIS_DEBUG(2, "point_in_polygon called.");
1053
1054
1056
1058
1059
1060 result = -1;
1061
1062 for (j = 0; j < mpolygon->
ngeoms; j++ )
1063 {
1064
1066
1067
1068 if ( polygon->
nrings == 0 )
continue;
1069
1071 if ( in_ring == -1)
1072 {
1073 POSTGIS_DEBUG(3, "point_in_polygon: outside exterior ring.");
1074 continue;
1075 }
1076 if ( in_ring == 0 )
1077 {
1078 return 0;
1079 }
1080
1081 result = in_ring;
1082
1083 for (i=1; i<polygon->
nrings; i++)
1084 {
1086 if (in_ring == 1)
1087 {
1088 POSTGIS_DEBUGF(3, "point_in_polygon: within hole %d.", i);
1089 result = -1;
1090 break;
1091 }
1092 if (in_ring == 0)
1093 {
1094 POSTGIS_DEBUGF(3, "point_in_polygon: on edge of hole %d.", i);
1095 return 0;
1096 }
1097 }
1098 if ( result != -1)
1099 {
1100 return result;
1101 }
1102 }
1103 return result;
1104}
int getPoint2d_p(const POINTARRAY *pa, uint32_t n, POINT2D *point)
int lwpoint_is_empty(const LWPOINT *point)
static int point_in_ring(POINTARRAY *pts, const POINT2D *point)