Ticket #2443: wfs-multipoint.patch

File wfs-multipoint.patch, 5.1 kB (added by pramsey, 7 months ago)

Tentative fix

  • mappostgis.c

    old new  
    755755    shape->type = MS_SHAPE_NULL;  /* nothing in it */ 
    756756 
    757757    memcpy(&ngeoms, &wkb[5], 4); 
    758     offset = 9;  /* were the first geometry is */ 
     758    offset = 9;  /* where the first geometry is */ 
     759  
    759760    for(t=0; t < ngeoms; t++) { 
    760761        memcpy(&type, &wkb[offset + 1], 4);  /* type of this geometry */ 
    761762 
     
    809810            } 
    810811        } 
    811812    } 
    812  
     813     
    813814    return MS_SUCCESS; 
    814815} 
    815816 
  • HISTORY.TXT

    old new  
    1313Current Version (5.1-dev, SVN trunk): 
    1414------------------------------------- 
    1515 
     16- WFS Multipoint query with PostGIS bug fixed (#2443) 
     17 
    1618- Tiling API (RFC 43) mode=tile, tilemode=spheremerc, tile=x y zoom (#2581) 
    1719 
    1820- Remove C++-style comments and most other warnings thrown by -pedantic (#2598) 
  • mapsearch.c

    old new  
    180180  return(status);   
    181181} 
    182182 
    183 int msIntersectMultipointPolygon(multipointObj *points, shapeObj *poly) { 
    184   int i
     183int msIntersectMultipointPolygon(shapeObj *multipoint, shapeObj *poly) { 
     184  int i,j
    185185   
    186   for(i=0; i<points->numpoints; i++) { 
    187     if(msIntersectPointPolygon(&(points->point[i]), poly) == MS_TRUE) 
    188       return(MS_TRUE); 
     186  for(i=0; i<multipoint->numlines; i++ ) { 
     187    lineObj points = multipoint->line[i]; 
     188    for(j=0; j<points.numpoints; j++) { 
     189          if(msIntersectPointPolygon(&(points.point[j]), poly) == MS_TRUE) 
     190        return(MS_TRUE); 
     191    } 
    189192  } 
    190193     
    191194  return(MS_FALSE); 
  • mapserver.h

    old new  
    15591559MS_DLL_EXPORT double msDistanceShapeToShape(shapeObj *shape1, shapeObj *shape2); 
    15601560MS_DLL_EXPORT int msIntersectSegments(pointObj *a, pointObj *b, pointObj *c, pointObj *d); 
    15611561MS_DLL_EXPORT int msPointInPolygon(pointObj *p, lineObj *c); 
    1562 MS_DLL_EXPORT int msIntersectMultipointPolygon(multipointObj *points, shapeObj *polygon); 
     1562MS_DLL_EXPORT int msIntersectMultipointPolygon(shapeObj *multipoint, shapeObj *polygon); 
    15631563MS_DLL_EXPORT int msIntersectPointPolygon(pointObj *p, shapeObj *polygon); 
    15641564MS_DLL_EXPORT int msIntersectPolylinePolygon(shapeObj *line, shapeObj *poly); 
    15651565MS_DLL_EXPORT int msIntersectPolygons(shapeObj *p1, shapeObj *p2); 
  • mapquery.c

    old new  
    11/****************************************************************************** 
    2  * $Id:
     2 * $Id
    33 * 
    44 * Project:  MapServer 
    55 * Purpose:  layer query support. 
     
    506506 
    507507      shape.classindex = msShapeGetClass(lp, &shape, map->scaledenom, classgroup, nclasses); 
    508508      if(!(lp->template) && ((shape.classindex == -1) || (lp->class[shape.classindex]->status == MS_OFF))) { /* not a valid shape */ 
    509         msFreeShape(&shape); 
    510         continue; 
     509              msFreeShape(&shape); 
     510              continue; 
    511511      } 
    512512 
    513513      if(!(lp->template) && !(lp->class[shape.classindex]->template)) { /* no valid template */ 
    514        msFreeShape(&shape); 
    515         continue; 
     514        msFreeShape(&shape); 
     515              continue; 
    516516      } 
    517517 
    518518#ifdef USE_PROJ 
     
    523523#endif 
    524524 
    525525      if(msRectContained(&shape.bounds, &rect) == MS_TRUE) { /* if the whole shape is in, don't intersect */     
    526         status = MS_TRUE; 
     526              status = MS_TRUE; 
    527527      } else { 
    528528        switch(shape.type) { /* make sure shape actually intersects the rect (ADD FUNCTIONS SPECIFIC TO RECTOBJ) */ 
    529529        case MS_SHAPE_POINT: 
    530           status = msIntersectMultipointPolygon(&shape.line[0], &searchshape); 
     530          status = msIntersectMultipointPolygon(&shape, &searchshape); 
    531531          break; 
    532532        case MS_SHAPE_LINE: 
    533533          status = msIntersectPolylinePolygon(&shape, &searchshape); 
     
    762762          switch(shape.type) { /* make sure shape actually intersects the selectshape */ 
    763763          case MS_SHAPE_POINT: 
    764764            if(tolerance == 0) /* just test for intersection */ 
    765               status = msIntersectMultipointPolygon(&shape.line[0], &selectshape); 
     765              status = msIntersectMultipointPolygon(&shape, &selectshape); 
    766766            else { /* check distance, distance=0 means they intersect */ 
    767767              distance = msDistanceShapeToShape(&selectshape, &shape); 
    768768              if(distance < tolerance) status = MS_TRUE; 
     
    11591159      switch(shape.type) { /* make sure shape actually intersects the shape */ 
    11601160      case MS_SHAPE_POINT: 
    11611161        if(tolerance == 0) /* just test for intersection */ 
    1162           status = msIntersectMultipointPolygon(&shape.line[0], selectshape); 
     1162          status = msIntersectMultipointPolygon(&shape, selectshape); 
    11631163        else { /* check distance, distance=0 means they intersect */ 
    11641164          distance = msDistanceShapeToShape(selectshape, &shape); 
    11651165          if(distance < tolerance) status = MS_TRUE; 
     
    14541454{ 
    14551455  int i, found=0; 
    14561456  rectObj tmpBounds; 
    1457    
     1457 
    14581458  for(i=0; i<map->numlayers; i++) { 
     1459 
    14591460    layerObj *lp; 
    14601461    lp = (GET_LAYER(map, i)); 
    14611462