protected void scaleMap(){
  final double calcXScaleFactor=(double)getWidth() / mapWidth;
  final double calcYScaleFactor=(double)getHeight() / mapHeight;
  if ((Double.isInfinite(calcXScaleFactor) && Double.isInfinite(calcYScaleFactor)) || (Double.isNaN(calcXScaleFactor) && Double.isNaN(calcYScaleFactor))) {
    minScaleFactor=1.0d;
  }
 else   if (calcXScaleFactor >= calcYScaleFactor || Double.isNaN(calcXScaleFactor)) {
    minScaleFactor=calcYScaleFactor - 0.0010d;
  }
 else {
    minScaleFactor=calcXScaleFactor - 0.0005d;
  }
  realScaleFactor=jSliderZoom.getValue() == 1 ? minScaleFactor : jSliderZoom.getValue() / 10 + 1;
  double realMapWidth=mapWidth * realScaleFactor;
  double realMapHeight=mapHeight * realScaleFactor;
  scrollListener.setNotify(false);
  if (realMapWidth <= getWidth()) {
    horizontalScroll.setEnabled(false);
    horizontalScroll.setValues(0,0,0,0);
  }
 else {
    realMapWidth*=1.2d;
    horizontalScroll.setValues((int)(horizontalScrollValue + getWidth() > realMapWidth ? realMapWidth - getWidth() : horizontalScrollValue),getWidth(),0,(int)realMapWidth);
    if (!horizontalScroll.isEnabled())     horizontalScroll.setEnabled(true);
  }
  if (realMapHeight <= getHeight()) {
    verticalScroll.setEnabled(false);
    verticalScroll.setValues(0,0,0,0);
  }
 else {
    realMapHeight*=1.2d;
    verticalScroll.setValues((int)(verticalScrollValue + getHeight() > realMapHeight ? realMapHeight - getHeight() : verticalScrollValue),getHeight(),0,(int)realMapHeight);
    if (!verticalScroll.isEnabled())     verticalScroll.setEnabled(true);
  }
  scrollListener.setNotify(true);
  repaint();
}

protected void scaleMap ( ) { final double calcXScaleFactor = ( double ) getWidth ( ) / mapWidth ; final double calcYScaleFactor = ( double ) getHeight ( ) / mapHeight ; if ( ( Double . isInfinite ( calcXScaleFactor ) && Double . isInfinite ( calcYScaleFactor ) ) || ( Double . isNaN ( calcXScaleFactor ) && Double . isNaN ( calcYScaleFactor ) ) ) { minScaleFactor = 1.0d ; } else if ( calcXScaleFactor >= calcYScaleFactor || Double . isNaN ( calcXScaleFactor ) ) { minScaleFactor = calcYScaleFactor - 0.0010d ; } else { minScaleFactor = calcXScaleFactor - 0.0005d ; } realScaleFactor = jSliderZoom . getValue ( ) == 1 ? minScaleFactor : jSliderZoom . getValue ( ) / 10 + 1 ; double realMapWidth = mapWidth * realScaleFactor ; double realMapHeight = mapHeight * realScaleFactor ; scrollListener . setNotify ( false ) ; if ( realMapWidth <= getWidth ( ) ) { horizontalScroll . setEnabled ( false ) ; horizontalScroll . setValues ( 0 , 0 , 0 , 0 ) ; } else { realMapWidth *= 1.2d ; horizontalScroll . setValues ( ( int ) ( horizontalScrollValue + getWidth ( ) > realMapWidth ? realMapWidth - getWidth ( ) : horizontalScrollValue ) , getWidth ( ) , 0 , ( int ) realMapWidth ) ; if ( ! horizontalScroll . isEnabled ( ) ) horizontalScroll . setEnabled ( true ) ; } if ( realMapHeight <= getHeight ( ) ) { verticalScroll . setEnabled ( false ) ; verticalScroll . setValues ( 0 , 0 , 0 , 0 ) ; } else { realMapHeight *= 1.2d ; verticalScroll . setValues ( ( int ) ( verticalScrollValue + getHeight ( ) > realMapHeight ? realMapHeight - getHeight ( ) : verticalScrollValue ) , getHeight ( ) , 0 , ( int ) realMapHeight ) ; if ( ! verticalScroll . isEnabled ( ) ) verticalScroll . setEnabled ( true ) ; } scrollListener . setNotify ( true ) ; repaint ( ) ; }
this method calculates the scale factors to scale the map by .
