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

Function find_bounds

mapmssql2008.c:1207–1238  ·  view source on GitHub ↗

if there is any polygon in wkb, return force_polygon */ if there is any line in wkb, return force_line */ otherwise return force_point */ static int dont_force(char *wkb, shapeObj *shape) { int offset =0; int ngeoms = 1; int type; int best_type; int u; int nrings, npoints; best_type = MS_SHAPE_NULL; /* nothing in it */ do { ngeoms--; memcpy(&type, &wkb[offset + 1], 4);

Source from the content-addressed store, hash-verified

1205//
1206/* find the bounds of the shape */
1207static void find_bounds(shapeObj *shape)
1208{
1209 int t, u;
1210 int first_one = 1;
1211
1212 for(t = 0; t < shape->numlines; t++) {
1213 for(u = 0; u < shape->line[t].numpoints; u++) {
1214 if(first_one) {
1215 shape->bounds.minx = shape->line[t].point[u].x;
1216 shape->bounds.maxx = shape->line[t].point[u].x;
1217
1218 shape->bounds.miny = shape->line[t].point[u].y;
1219 shape->bounds.maxy = shape->line[t].point[u].y;
1220 first_one = 0;
1221 } else {
1222 if(shape->line[t].point[u].x < shape->bounds.minx) {
1223 shape->bounds.minx = shape->line[t].point[u].x;
1224 }
1225 if(shape->line[t].point[u].x > shape->bounds.maxx) {
1226 shape->bounds.maxx = shape->line[t].point[u].x;
1227 }
1228
1229 if(shape->line[t].point[u].y < shape->bounds.miny) {
1230 shape->bounds.miny = shape->line[t].point[u].y;
1231 }
1232 if(shape->line[t].point[u].y > shape->bounds.maxy) {
1233 shape->bounds.maxy = shape->line[t].point[u].y;
1234 }
1235 }
1236 }
1237 }
1238}
1239
1240/* Used by NextShape() to access a shape in the query set */
1241int msMSSQL2008LayerGetShapeRandom(layerObj *layer, shapeObj *shape, long *record)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected