MCPcopy Index your code
hub / github.com/MapServer/MapServer / dont_force

Function dont_force

mapmssql2008.c:997–1031  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

995/* otherwise return force_point */
996
997static int dont_force(char *wkb, shapeObj *shape)
998{
999 int offset =0;
1000 int ngeoms;
1001 int type, t;
1002 int best_type;
1003
1004 best_type = MS_SHAPE_NULL; /* nothing in it */
1005
1006 memcpy(&ngeoms, &wkb[5], 4);
1007 offset = 9; /* were the first geometry is */
1008 for(t = 0; t < ngeoms; t++) {
1009 memcpy(&type, &wkb[offset + 1], 4); /* type of this geometry */
1010
1011 if(type == 3) {
1012 best_type = MS_SHAPE_POLYGON;
1013 } else if(type ==2 && best_type != MS_SHAPE_POLYGON) {
1014 best_type = MS_SHAPE_LINE;
1015 } else if(type == 1 && best_type == MS_SHAPE_NULL) {
1016 best_type = MS_SHAPE_POINT;
1017 }
1018 }
1019
1020 if(best_type == MS_SHAPE_POINT) {
1021 return force_to_points(wkb, shape);
1022 }
1023 if(best_type == MS_SHAPE_LINE) {
1024 return force_to_lines(wkb, shape);
1025 }
1026 if(best_type == MS_SHAPE_POLYGON) {
1027 return force_to_polygons(wkb, shape);
1028 }
1029
1030 return MS_FAILURE; /* unknown type */
1031}
1032
1033/* ******************************************************* */
1034/* wkb assumed to be same endian as this machine. */

Callers 1

Calls 3

force_to_pointsFunction · 0.85
force_to_linesFunction · 0.85
force_to_polygonsFunction · 0.85

Tested by

no test coverage detected