]> gerrit.simantics Code Review - simantics/district.git/blobdiff - org.simantics.district.maps/src/org/simantics/maps/sg/MapScaleNode.java
Add location & zoom node for network diagram - also OSM attribution
[simantics/district.git] / org.simantics.district.maps / src / org / simantics / maps / sg / MapScaleNode.java
index 793550b6087b05b92694b36e0291ab85ae6ce30c..dc6b393d5a4ea2e8daf334d1095e3f7b46f0cb98 100644 (file)
@@ -58,9 +58,9 @@ public class MapScaleNode extends G2DNode {
 
         double previousText = -100;
         
-        double minY = bounds.getMaxY() - 30;
+        double minY = bounds.getMaxY() - 40;
         
-        double scaleRight = bounds.getMaxX() - 30;
+        double scaleRight = bounds.getMaxX() - 20;
         
         double meterPerPixel = getMeterPerPixel(scaleRight - offsetX, minY - offsetY, scaleX, scaleY);
         
@@ -77,7 +77,7 @@ public class MapScaleNode extends G2DNode {
         
         double newScaleLeft = scaleRight - pixels;
         g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f));
-        Rectangle2D vertical = new Rectangle2D.Double(newScaleLeft, bounds.getMaxY() - 30, pixels, 20);
+        Rectangle2D vertical = new Rectangle2D.Double(newScaleLeft, bounds.getMaxY() - 40, pixels, 20);
         g.fill(vertical);
         
         g.setColor(GRAY);
@@ -101,9 +101,9 @@ public class MapScaleNode extends G2DNode {
         
         // Horizontal ruler
         double label = 0;
+        FontMetrics fm = g.getFontMetrics();
         for(double x = newScaleLeft; x < scaleRight; x += stepX) {
             String str = formatValue(label * meterPerPixel);
-            FontMetrics fm = g.getFontMetrics();
             Rectangle2D r = fm.getStringBounds(str, g);
             if((x - r.getWidth() / 2) > previousText) {
                 g.setColor(Color.BLACK);