Example #1
0
 static float computeZoomLevel(ImagePlot plot, ZoomChoice zoomChoice) {
   int width = plot.getImageDataWidth();
   int height = plot.getImageDataHeight();
   float retval = zoomChoice.getZoomLevel();
   if (zoomChoice.isSmartZoom()) {
     retval = computeSmartZoom(width, height, zoomChoice.getZoomType());
   } else if (zoomChoice.getZoomType() == ZoomType.TO_WIDTH) {
     retval = (float) zoomChoice.getWidth() / (float) width;
     if (zoomChoice.hasMaxZoomLevel()) {
       if (retval > zoomChoice.getMaxZoomLevel()) retval = zoomChoice.getMaxZoomLevel();
     }
   } else if (zoomChoice.getZoomType() == ZoomType.FULL_SCREEN) {
     retval =
         VisUtil.getEstimatedFullZoomFactor(
             VisUtil.FullType.WIDTH_HEIGHT,
             width,
             height,
             zoomChoice.getWidth(),
             zoomChoice.getHeight());
     if (zoomChoice.hasMaxZoomLevel()) {
       if (retval > zoomChoice.getMaxZoomLevel()) retval = zoomChoice.getMaxZoomLevel();
     }
   } else if (zoomChoice.getZoomType() == ZoomType.ARCSEC_PER_SCREEN_PIX) {
     retval = (float) plot.getPixelScale() / zoomChoice.getArcsecPerScreenPix();
   }
   return retval;
 }