| 111 | } |
| 112 | |
| 113 | double 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 |
no outgoing calls
no test coverage detected