1 package org.simantics.maps;
3 import java.awt.geom.AffineTransform;
5 public class MapScalingTransform {
7 private MapScalingTransform() {
9 public static final double scale = 256.0d / 360.0d;
10 public static final AffineTransform INSTANCE = AffineTransform.getScaleInstance(scale, scale);
11 public static final AffineTransform INVERSE = AffineTransform.getScaleInstance(1/scale, 1/scale);
13 public static double getScaleX() {
14 return INSTANCE.getScaleX();
17 public static double getScaleY() {
18 return INSTANCE.getScaleY();
21 public static int zoomLevel(AffineTransform current) {
22 double org = INSTANCE.getScaleX();
23 double cur = current.getScaleX();
25 double zoomLevel = Math.log10(f) / Math.log10(2);
29 return (int) zoomLevel;