protected void onScaleChanged() { if (mapBackground != null && currentPoint != null) { final double latitude = DataProvider.LATITUDE.getValue(currentPoint) + panLatitude; final double longitude = DataProvider.LONGITUDE.getValue(currentPoint) + panLong; super.onScaleChanged( mapBackground.getScaleX(), mapBackground.getScaleY(latitude), longitude, latitude); } else { super.onScaleChanged(); } final double widthInMeter = Utils.distance( getYAxis().minValue, getXAxis().maxValue, getYAxis().maxValue, getXAxis().maxValue); if (widthInMeter < 1) { scaleSizeInPixel = 0; return; } final double availableLengthInMeter = widthInMeter * 0.9; scaleConfiguration = Preferences.getInstance().getUnitsConverter().getScaleDistance(availableLengthInMeter); scaleSizeInPixel = (int) ((scaleConfiguration.lengthInSourceUnits / widthInMeter) * width); }
protected void doPaintBackground(final Graphics g) { if (mapBackground != null) { mapBackground.paint( g, DataProvider.LONGITUDE.getValue(currentPoint) + panLong, DataProvider.LATITUDE.getValue(currentPoint) + panLatitude, (width - getMarginLeft() - getMarginRight()) / 2 + getMarginLeft(), (height - getMarginTop() - getMarginBottom()) / 2 + getMarginTop()); } }