X-Git-Url: https://gitweb.fperrin.net/?a=blobdiff_plain;f=src%2Ftim%2Fprune%2Fgui%2Fmap%2FMapPosition.java;h=a70bbf63ba79b86c02114d785c3737d96b6625c5;hb=a94e508b8332721b65e3cc16f71da22cc46109a9;hp=25f05fc1a2a238370d8888ea4b807b7d3f5f8adb;hpb=8b20e3e027058cdf6ff52993ee5576193d08667a;p=GpsPrune.git diff --git a/src/tim/prune/gui/map/MapPosition.java b/src/tim/prune/gui/map/MapPosition.java index 25f05fc..a70bbf6 100644 --- a/src/tim/prune/gui/map/MapPosition.java +++ b/src/tim/prune/gui/map/MapPosition.java @@ -17,6 +17,8 @@ public class MapPosition private int _zoom = 12; /** Factor to zoom by, 2 to the power of zoom */ private int _zoomFactor = 1 << _zoom; + /** Flag to mark if this position has ever been set */ + private boolean _empty = true; /** Maximum zoom level */ private static final int MAX_ZOOM = 21; @@ -51,6 +53,7 @@ public class MapPosition setZoom(requiredZoom); _xPosition = transformToPixels((inMinX + inMaxX) / 2.0); _yPosition = transformToPixels((inMinY + inMaxY) / 2.0); + _empty = false; } /** @@ -61,6 +64,7 @@ public class MapPosition { _zoom = inZoom; _zoomFactor = 1 << _zoom; + _empty = false; } /** @@ -93,6 +97,7 @@ public class MapPosition // Set position _xPosition = (_xPosition - inWidth/2 + (inMinX + inMaxX) / 2) * multFactor; _yPosition = (_yPosition - inHeight/2 + (inMinY + inMaxY) / 2) * multFactor; + _empty = false; } /** @@ -277,4 +282,12 @@ public class MapPosition _xPosition += inDeltaX; _yPosition += inDeltaY; } + + /** + * @return true if this position has never been set + */ + public boolean isEmpty() + { + return _empty; + } }