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

Function msInchesPerUnit

mapscale.c:113–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113double msInchesPerUnit(int units, double center_lat)
114{
115 double lat_adj = 1.0, ipu = 1.0;
116
117 switch (units) {
118 case(MS_METERS):
119 case(MS_KILOMETERS):
120 case(MS_MILES):
121 case(MS_NAUTICALMILES):
122 case(MS_INCHES):
123 case(MS_FEET):
124 ipu = inchesPerUnit[units];
125 break;
126 case(MS_DD):
127 /* With geographical (DD) coordinates, we adjust the inchesPerUnit
128 * based on the latitude of the center of the view. For this we assume
129 * we have a perfect sphere and just use cos(lat) in our calculation.
130 */
131#ifdef ENABLE_VARIABLE_INCHES_PER_DEGREE
132 if (center_lat != 0.0)
133 {
134 double cos_lat;
135 cos_lat = cos(MS_PI*center_lat/180.0);
136 lat_adj = sqrt(1+cos_lat*cos_lat)/sqrt(2.0);
137 }
138#endif
139 ipu = inchesPerUnit[units]*lat_adj;
140 break;
141 default:
142 break;
143 }
144
145 return ipu;
146}
147
148
149#define X_STEP_SIZE 5

Callers 15

msCalculateScaleFunction · 0.85
msDrawScalebarFunction · 0.85
Pix2LayerGeorefFunction · 0.85
msQueryByRectFunction · 0.85
msQueryByFeaturesFunction · 0.85
msQueryByPointFunction · 0.85
msQueryByShapeFunction · 0.85
msPrepareImageFunction · 0.85
msDrawLegendFunction · 0.85
setExtentFromShapesFunction · 0.85
msRasterQueryByShapeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected