MCPcopy Create free account
hub / github.com/MapServer/MapServer / msSDELayerWhichShapes

Function msSDELayerWhichShapes

mapsde.c:1466–1640  ·  view source on GitHub ↗

-------------------------------------------------------------------- */ msSDELayerWhichShapes */ -------------------------------------------------------------------- */ starts a stream query using spatial filter. Also limits the */ query by the layer's FILTER item as well. */ ------------------------------------------------

Source from the content-addressed store, hash-verified

1464/* query by the layer's FILTER item as well. */
1465/* -------------------------------------------------------------------- */
1466int msSDELayerWhichShapes(layerObj *layer, rectObj rect, int isQuery) {
1467#ifdef USE_SDE
1468 long status;
1469 SE_ENVELOPE envelope;
1470 SE_SHAPE shape=0;
1471 SE_FILTER constraint;
1472 SE_QUERYINFO query_info = NULL;
1473 SE_SQL_CONSTRUCT* sql = NULL;
1474 char* proc_value=NULL;
1475 int query_order=SE_SPATIAL_FIRST;
1476
1477 msSDELayerInfo *sde=NULL;
1478
1479 if(!msSDELayerIsOpen(layer)) {
1480 msSetError( MS_SDEERR,
1481 "SDE layer has not been opened.",
1482 "msSDELayerWhichShapes()");
1483 return(MS_FAILURE);
1484 }
1485
1486 sde = layer->layerinfo;
1487
1488 /* use the cached layer's extent. */
1489 /* there is NO overlap, return MS_DONE */
1490 /* (FIX: use this in ALL which shapes functions) */
1491 if(sde->extent->minx > rect.maxx) return(MS_DONE);
1492 if(sde->extent->maxx < rect.minx) return(MS_DONE);
1493 if(sde->extent->miny > rect.maxy) return(MS_DONE);
1494 if(sde->extent->maxy < rect.miny) return(MS_DONE);
1495
1496 /* set spatial constraint search shape */
1497 /* crop against SDE layer extent *argh* */
1498 envelope.minx = MS_MAX(rect.minx, sde->extent->minx);
1499 envelope.miny = MS_MAX(rect.miny, sde->extent->miny);
1500 envelope.maxx = MS_MIN(rect.maxx, sde->extent->maxx);
1501 envelope.maxy = MS_MIN(rect.maxy, sde->extent->maxy);
1502
1503 if( envelope.minx == envelope.maxx && envelope.miny == envelope.maxy){
1504 /* fudge a rectangle so we have a valid one for generate_rectangle */
1505 /* FIXME: use the real shape for the query and set the filter_type
1506 to be an appropriate type */
1507 envelope.minx = envelope.minx - 0.001;
1508 envelope.maxx = envelope.maxx + 0.001;
1509 envelope.miny = envelope.miny - 0.001;
1510 envelope.maxy = envelope.maxy + 0.001;
1511 }
1512
1513 status = SE_shape_create(sde->coordref, &shape);
1514 if(status != SE_SUCCESS) {
1515 sde_error( status,
1516 "msSDELayerWhichShapes()",
1517 "SE_shape_create()");
1518 return(MS_FAILURE);
1519 }
1520
1521 status = SE_shape_generate_rectangle(&envelope, shape);
1522 if(status != SE_SUCCESS) {
1523 sde_error( status,

Callers

nothing calls this directly

Calls 7

msSDELayerIsOpenFunction · 0.85
msSetErrorFunction · 0.85
sde_errorFunction · 0.85
getSDEQueryInfoFunction · 0.85
getSDESQLConstructInfoFunction · 0.85
msLayerGetProcessingKeyFunction · 0.85
strcasecmpFunction · 0.85

Tested by

no test coverage detected