- double maxValue = getMaximumHoriz() > getMaximumVert() ?
- getMaximumHoriz():getMaximumVert();
- // calculate boundaries in degrees
- double minLong = getUnscaledLongitude(-maxValue);
- double maxLong = getUnscaledLongitude(maxValue);
- double minLat = getUnscaledLatitude(-maxValue);
- double maxLat = getUnscaledLatitude(maxValue);
- // work out what line separation to use to give at least two lines
- int sepIndex = -1;
- double separation;
- int numLatLines = 0, numLonLines = 0;
- do
- {
- sepIndex++;
- separation = COORD_SEPARATIONS[sepIndex];
- numLatLines = getNumLinesBetween(minLat, maxLat, separation);
- numLonLines = getNumLinesBetween(minLong, maxLong, separation);
- }
- while ((numLonLines <= 1 || numLatLines <= 1) && sepIndex < MAX_COORD_SEPARATION_INDEX);
- // create lines based on this separation
- _latLinesDegs = getLines(minLat, maxLat, separation, numLatLines);
- _lonLinesDegs = getLines(minLong, maxLong, separation, numLonLines);
- // scale lines also
- _latLinesScaled = new double[numLatLines];
- for (int i=0; i<numLatLines; i++) _latLinesScaled[i] = getScaledLatitude(_latLinesDegs[i]);
- _lonLinesScaled = new double[numLonLines];
- for (int i=0; i<numLonLines; i++) _lonLinesScaled[i] = getScaledLongitude(_lonLinesDegs[i]);