[mapserver-commits] r7559 - branches/branch-5-0/mapserver

svn at osgeo.org svn at osgeo.org
Mon May 5 10:46:11 EDT 2008


Author: pramsey
Date: 2008-05-05 10:46:11 -0400 (Mon, 05 May 2008)
New Revision: 7559

Modified:
   branches/branch-5-0/mapserver/HISTORY.TXT
   branches/branch-5-0/mapserver/mappostgis.c
   branches/branch-5-0/mapserver/mapquery.c
   branches/branch-5-0/mapserver/mapsearch.c
   branches/branch-5-0/mapserver/mapserver.h
Log:
WFS Multipoint query with PostGIS bug fixed (#2443)


Modified: branches/branch-5-0/mapserver/HISTORY.TXT
===================================================================
--- branches/branch-5-0/mapserver/HISTORY.TXT	2008-05-05 14:41:50 UTC (rev 7558)
+++ branches/branch-5-0/mapserver/HISTORY.TXT	2008-05-05 14:46:11 UTC (rev 7559)
@@ -13,6 +13,8 @@
 Current Version (future 5.0.3, svn branch-5-0)
 ----------------------------------------------
 
+- WFS Multipoint query with PostGIS bug fixed (#2443)
+
 - mappostgis.c: Fixed overlapping transactions causing core
   dump in fcgi (#2497)
 

Modified: branches/branch-5-0/mapserver/mappostgis.c
===================================================================
--- branches/branch-5-0/mapserver/mappostgis.c	2008-05-05 14:41:50 UTC (rev 7558)
+++ branches/branch-5-0/mapserver/mappostgis.c	2008-05-05 14:46:11 UTC (rev 7559)
@@ -754,7 +754,8 @@
     shape->type = MS_SHAPE_NULL;  /* nothing in it */
 
     memcpy(&ngeoms, &wkb[5], 4);
-    offset = 9;  /* were the first geometry is */
+    offset = 9;  /* where the first geometry is */
+ 
     for(t=0; t < ngeoms; t++) {
         memcpy(&type, &wkb[offset + 1], 4);  /* type of this geometry */
 
@@ -808,7 +809,7 @@
             }
         }
     }
-
+    
     return MS_SUCCESS;
 }
 

Modified: branches/branch-5-0/mapserver/mapquery.c
===================================================================
--- branches/branch-5-0/mapserver/mapquery.c	2008-05-05 14:41:50 UTC (rev 7558)
+++ branches/branch-5-0/mapserver/mapquery.c	2008-05-05 14:46:11 UTC (rev 7559)
@@ -486,13 +486,13 @@
 
       shape.classindex = msShapeGetClass(lp, &shape, map->scaledenom);
       if(!(lp->template) && ((shape.classindex == -1) || (lp->class[shape.classindex]->status == MS_OFF))) { /* not a valid shape */
-	msFreeShape(&shape);
-	continue;
+	      msFreeShape(&shape);
+	      continue;
       }
 
       if(!(lp->template) && !(lp->class[shape.classindex]->template)) { /* no valid template */
-	msFreeShape(&shape);
-	continue;
+        msFreeShape(&shape);
+	      continue;
       }
 
 #ifdef USE_PROJ
@@ -503,11 +503,11 @@
 #endif
 
       if(msRectContained(&shape.bounds, &rect) == MS_TRUE) { /* if the whole shape is in, don't intersect */	
-	status = MS_TRUE;
+	      status = MS_TRUE;
       } else {
 	switch(shape.type) { /* make sure shape actually intersects the rect (ADD FUNCTIONS SPECIFIC TO RECTOBJ) */
 	case MS_SHAPE_POINT:
-	  status = msIntersectMultipointPolygon(&shape.line[0], &searchshape);
+	  status = msIntersectMultipointPolygon(&shape, &searchshape);
 	  break;
 	case MS_SHAPE_LINE:
 	  status = msIntersectPolylinePolygon(&shape, &searchshape);
@@ -732,7 +732,7 @@
 	  switch(shape.type) { /* make sure shape actually intersects the selectshape */
 	  case MS_SHAPE_POINT:
 	    if(tolerance == 0) /* just test for intersection */
-	      status = msIntersectMultipointPolygon(&shape.line[0], &selectshape);
+	      status = msIntersectMultipointPolygon(&shape, &selectshape);
 	    else { /* check distance, distance=0 means they intersect */
 	      distance = msDistanceShapeToShape(&selectshape, &shape);
 	      if(distance < tolerance) status = MS_TRUE;
@@ -1088,7 +1088,7 @@
       switch(shape.type) { /* make sure shape actually intersects the shape */
       case MS_SHAPE_POINT:
         if(tolerance == 0) /* just test for intersection */
-	  status = msIntersectMultipointPolygon(&shape.line[0], selectshape);
+	  status = msIntersectMultipointPolygon(&shape, selectshape);
 	else { /* check distance, distance=0 means they intersect */
 	  distance = msDistanceShapeToShape(selectshape, &shape);
 	  if(distance < tolerance) status = MS_TRUE;
@@ -1376,8 +1376,9 @@
 {
   int i, found=0;
   rectObj tmpBounds;
-  
+
   for(i=0; i<map->numlayers; i++) {
+
     layerObj *lp;
     lp = (GET_LAYER(map, i));
 

Modified: branches/branch-5-0/mapserver/mapsearch.c
===================================================================
--- branches/branch-5-0/mapserver/mapsearch.c	2008-05-05 14:41:50 UTC (rev 7558)
+++ branches/branch-5-0/mapserver/mapsearch.c	2008-05-05 14:46:11 UTC (rev 7559)
@@ -179,12 +179,15 @@
   return(status);  
 }
 
-int msIntersectMultipointPolygon(multipointObj *points, shapeObj *poly) {
-  int i;
+int msIntersectMultipointPolygon(shapeObj *multipoint, shapeObj *poly) {
+  int i,j;
   
-  for(i=0; i<points->numpoints; i++) {
-    if(msIntersectPointPolygon(&(points->point[i]), poly) == MS_TRUE)
-      return(MS_TRUE);
+  for(i=0; i<multipoint->numlines; i++ ) {
+    lineObj points = multipoint->line[i];
+    for(j=0; j<points.numpoints; j++) {
+          if(msIntersectPointPolygon(&(points.point[j]), poly) == MS_TRUE)
+        return(MS_TRUE);
+    }
   }
     
   return(MS_FALSE);

Modified: branches/branch-5-0/mapserver/mapserver.h
===================================================================
--- branches/branch-5-0/mapserver/mapserver.h	2008-05-05 14:41:50 UTC (rev 7558)
+++ branches/branch-5-0/mapserver/mapserver.h	2008-05-05 14:46:11 UTC (rev 7559)
@@ -1419,7 +1419,7 @@
 MS_DLL_EXPORT double msDistanceShapeToShape(shapeObj *shape1, shapeObj *shape2);
 MS_DLL_EXPORT int msIntersectSegments(pointObj *a, pointObj *b, pointObj *c, pointObj *d);
 MS_DLL_EXPORT int msPointInPolygon(pointObj *p, lineObj *c);
-MS_DLL_EXPORT int msIntersectMultipointPolygon(multipointObj *points, shapeObj *polygon);
+MS_DLL_EXPORT int msIntersectMultipointPolygon(shapeObj *multipoint, shapeObj *polygon);
 MS_DLL_EXPORT int msIntersectPointPolygon(pointObj *p, shapeObj *polygon);
 MS_DLL_EXPORT int msIntersectPolylinePolygon(shapeObj *line, shapeObj *poly);
 MS_DLL_EXPORT int msIntersectPolygons(shapeObj *p1, shapeObj *p2);



More information about the mapserver-commits mailing list