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

Function roundInterval

mapscale.c:45–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43double inchesPerUnit[9]={1, 12, 63360.0, 39.3701, 39370.1, 4374754, 1, 1, 72913.3858 };
44
45static double roundInterval(double d)
46{
47 if(d<.001)
48 return(MS_NINT(d*10000)/10000.0);
49 if(d<.01)
50 return(MS_NINT(d*1000)/1000.0);
51 if(d<.1)
52 return(MS_NINT(d*100)/100.0);
53 if(d<1)
54 return(MS_NINT(d*10)/10.0);
55 if(d<100)
56 return(MS_NINT(d));
57 if(d<1000)
58 return(MS_NINT(d/10) * 10);
59 if(d<10000)
60 return(MS_NINT(d/100) * 100);
61 if(d<100000)
62 return(MS_NINT(d/1000) * 1000);
63 if(d<1000000)
64 return(MS_NINT(d/10000) * 10000);
65 if(d<10000000)
66 return(MS_NINT(d/100000) * 100000);
67 if(d<100000000)
68 return(MS_NINT(d/1000000) * 1000000);
69
70 return(-1);
71}
72
73/*
74** Calculate the approximate scale based on a few parameters. Note that this assumes the scale is

Callers 1

msDrawScalebarFunction · 0.85

Calls 1

MS_NINTFunction · 0.85

Tested by

no test coverage detected