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

Function msAdjustExtent

maputil.c:666–684  ·  view source on GitHub ↗

** Make sure extent fits image window to be created. Returns cellsize of output image. */

Source from the content-addressed store, hash-verified

664** Make sure extent fits image window to be created. Returns cellsize of output image.
665*/
666double msAdjustExtent(rectObj *rect, int width, int height)
667{
668 double cellsize, ox, oy;
669
670 cellsize = MS_MAX(MS_CELLSIZE(rect->minx, rect->maxx, width), MS_CELLSIZE(rect->miny, rect->maxy, height));
671
672 if(cellsize <= 0) /* avoid division by zero errors */
673 return(0);
674
675 ox = MS_MAX(((width-1) - (rect->maxx - rect->minx)/cellsize)/2,0); /* these were width-1 and height-1 */
676 oy = MS_MAX(((height-1) - (rect->maxy - rect->miny)/cellsize)/2,0);
677
678 rect->minx = rect->minx - ox*cellsize;
679 rect->miny = rect->miny - oy*cellsize;
680 rect->maxx = rect->maxx + ox*cellsize;
681 rect->maxy = rect->maxy + oy*cellsize;
682
683 return(cellsize);
684}
685
686/*
687** Rect must always contain a portion of bounds. If not, rect is

Callers 15

msDrawScalebarFunction · 0.85
msQueryByRectFunction · 0.85
msQueryByFeaturesFunction · 0.85
msQueryByShapeFunction · 0.85
msPrepareImageFunction · 0.85
msLegendCalcSizeFunction · 0.85
msDrawLegendFunction · 0.85
mainFunction · 0.85
msRasterQueryByShapeFunction · 0.85
msRasterQueryByPointFunction · 0.85
checkWebScaleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected