767 double minx, miny, maxx, maxy;
768 double latmax, latmin, lonmax, lonmin;
769 double lonwidth, latwidth;
770 double latmaxadjust, lonmaxadjust, latminadjust, lonminadjust;
779 if ( minx == maxx && miny == maxy )
795 lonwidth = lonmax - lonmin;
796 latwidth = latmax - latmin;
797 latmaxadjust = lonmaxadjust = latminadjust = lonminadjust = 0.0;
799 if ( minx > lonmin + lonwidth / 2.0 )
801 lonminadjust = lonwidth / 2.0;
803 else if ( maxx < lonmax - lonwidth / 2.0 )
805 lonmaxadjust = -1 * lonwidth / 2.0;
807 if ( lonminadjust || lonmaxadjust )
809 lonmin += lonminadjust;
810 lonmax += lonmaxadjust;
820 if ( miny > latmin + latwidth / 2.0 )
822 latminadjust = latwidth / 2.0;
824 else if (maxy < latmax - latwidth / 2.0 )
826 latmaxadjust = -1 * latwidth / 2.0;
829 if ( latminadjust || latmaxadjust )
831 latmin += latminadjust;
832 latmax += latmaxadjust;
844 bounds->
xmin = lonmin;
845 bounds->
xmax = lonmax;
846 bounds->
ymin = latmin;
847 bounds->
ymax = latmax;