public void updateUsableScales() {
		Bbox bgBounds = backgroundPart.getBounds();
		/*
		 * First move background a little bit to right based on difference in width with the sliderUnit.
		 */
		int internalHorMargin = (int) (sliderUnit.getBounds().getWidth() - backgroundPart.getBounds().getWidth()) / 2;
		bgBounds.setX(internalHorMargin);
		
		int backgroundPartHeight = (int) bgBounds.getHeight();
		int sliderAreaHeight = 0;
		/*
		 * Needed for aligning the sliderUnit's y with currentScale's y.
		 */
		int currentUnitY = sliderAreaHeight;
		double currentScale = mapWidget.getMapModel().getMapView().getCurrentScale();
		
		List<Bbox> partBounds = new ArrayList<Bbox>();
		List<ScaleInfo> zoomLevels = mapWidget.getMapModel().getMapInfo().getScaleConfiguration().getZoomLevels();
		int size = zoomLevels.size();
		currentScaleList.clear();
		boolean scaleFound = false;
		for (int i = size - 1 ; i >= 0 ; i--) {
			double scale = zoomLevels.get(i).getPixelPerUnit();
			if (mapWidget.getMapModel().getMapView().isResolutionAvailable(1.0 / scale)) {
				Bbox bounds = (Bbox) bgBounds.clone();
				bounds.setY(sliderAreaHeight);
				partBounds.add(bounds);
				currentScaleList.add(scale);
				if (scale <= currentScale && !scaleFound) {
					scaleFound = true;
					currentUnitY = sliderAreaHeight;
				}
				sliderAreaHeight += backgroundPartHeight;
			}
		}
		/*
		 * Align zoom slider unit with current zoom
		 */
		Bbox bounds = sliderUnit.getBounds();
		bounds.setY(currentUnitY);

		/*
		 * Zoom slider area 
		 */
		sliderArea = new SliderArea(SLIDER_AREA, (int) sliderUnit.getBounds().getWidth(), 
				sliderAreaHeight, sliderUnit, backgroundPart, partBounds,
				mapWidget, new ZoomSliderController(this));
		sliderArea.setHorizontalMargin((int) -bgBounds.getX());
		sliderArea.setVerticalMargin((int) backgroundPart.getBounds().getWidth());
		
		/*
		 * Zoom out button internal margin.
		 */
		zoomOut.getBackground().getBounds().setY(sliderArea.getVerticalMargin() + sliderAreaHeight);
		zoomOut.getIcon().getBounds().setY(sliderArea.getVerticalMargin() + sliderAreaHeight);
	}
public void updateUsableScales ( ) { Bbox bgBounds = backgroundPart . getBounds ( ) ; int internalHorMargin = ( int ) ( sliderUnit . getBounds ( ) . getWidth ( ) - backgroundPart . getBounds ( ) . getWidth ( ) ) / 2 ; bgBounds . setX ( internalHorMargin ) ; int backgroundPartHeight = ( int ) bgBounds . getHeight ( ) ; int sliderAreaHeight = 0 ; int currentUnitY = sliderAreaHeight ; double currentScale = mapWidget . getMapModel ( ) . getMapView ( ) . getCurrentScale ( ) ; List < Bbox > partBounds = new ArrayList < Bbox > ( ) ; List < ScaleInfo > zoomLevels = mapWidget . getMapModel ( ) . getMapInfo ( ) . getScaleConfiguration ( ) . getZoomLevels ( ) ; int size = zoomLevels . size ( ) ; currentScaleList . clear ( ) ; boolean scaleFound = false ; for ( int i = size - 1 ; i >= 0 ; i -- ) { double scale = zoomLevels . get ( i ) . getPixelPerUnit ( ) ; if ( mapWidget . getMapModel ( ) . getMapView ( ) . isResolutionAvailable ( 1.0 / scale ) ) { Bbox bounds = ( Bbox ) bgBounds . clone ( ) ; bounds . setY ( sliderAreaHeight ) ; partBounds . add ( bounds ) ; currentScaleList . add ( scale ) ; if ( scale <= currentScale && ! scaleFound ) { scaleFound = true ; currentUnitY = sliderAreaHeight ; } sliderAreaHeight += backgroundPartHeight ; } } Bbox bounds = sliderUnit . getBounds ( ) ; bounds . setY ( currentUnitY ) ; sliderArea = new SliderArea ( SLIDER_AREA , ( int ) sliderUnit . getBounds ( ) . getWidth ( ) , sliderAreaHeight , sliderUnit , backgroundPart , partBounds , mapWidget , new ZoomSliderController ( this ) ) ; sliderArea . setHorizontalMargin ( ( int ) - bgBounds . getX ( ) ) ; sliderArea . setVerticalMargin ( ( int ) backgroundPart . getBounds ( ) . getWidth ( ) ) ; zoomOut . getBackground ( ) . getBounds ( ) . setY ( sliderArea . getVerticalMargin ( ) + sliderAreaHeight ) ; zoomOut . getIcon ( ) . getBounds ( ) . setY ( sliderArea . getVerticalMargin ( ) + sliderAreaHeight ) ; }
Update the list of scales to include only the list of usable scales (from all possible scales).