/ double GetDeltaExtentsUsingScale(double scale, int units, */ double centerLat, int width, */ double resolution) */ / Utility function to return the maximum extent using the */ scale and the width of the image. */ / Base on the function msCalculateScale (mapscale.c) */ /
| 468 | /* Base on the function msCalculateScale (mapscale.c) */ |
| 469 | /************************************************************************/ |
| 470 | double GetDeltaExtentsUsingScale(double scale, int units, double centerLat, int width, double resolution) |
| 471 | { |
| 472 | double md = 0.0; |
| 473 | double dfDelta = -1.0; |
| 474 | |
| 475 | if (scale <= 0 || width <=0) |
| 476 | return -1; |
| 477 | |
| 478 | switch (units) |
| 479 | { |
| 480 | case(MS_DD): |
| 481 | case(MS_METERS): |
| 482 | case(MS_KILOMETERS): |
| 483 | case(MS_MILES): |
| 484 | case(MS_NAUTICALMILES): |
| 485 | case(MS_INCHES): |
| 486 | case(MS_FEET): |
| 487 | /* remember, we use a pixel-center to pixel-center extent, hence the width-1 */ |
| 488 | md = (width-1)/(resolution*msInchesPerUnit(units,centerLat)); |
| 489 | dfDelta = md * scale; |
| 490 | break; |
| 491 | |
| 492 | default: |
| 493 | break; |
| 494 | } |
| 495 | |
| 496 | return dfDelta; |
| 497 | } |
| 498 | |
| 499 | /************************************************************************/ |
| 500 | /* static double Pix2Georef(int nPixPos, int nPixMin, double nPixMax,*/ |