From 91ed3f98d38ce16a8d796b5af27dd6053d2e6479 Mon Sep 17 00:00:00 2001 From: Wiehann Matthysen Date: Thu, 19 Jan 2017 09:43:11 +0200 Subject: [PATCH] Scalebar vertically centered placement. Modified the ScalebarLayer so that it can be vertically centered. Thus, added logic to check if the position is either North or South to vertically center the scalebar either at the top or bottom of the window respectively. --- src/gov/nasa/worldwind/layers/ScalebarLayer.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gov/nasa/worldwind/layers/ScalebarLayer.java b/src/gov/nasa/worldwind/layers/ScalebarLayer.java index ace39555ce..ec7f125460 100644 --- a/src/gov/nasa/worldwind/layers/ScalebarLayer.java +++ b/src/gov/nasa/worldwind/layers/ScalebarLayer.java @@ -586,6 +586,11 @@ private Vec4 computeLocation(java.awt.Rectangle viewport, double scale) x = this.locationCenter.x - scaledWidth / 2; y = this.locationCenter.y - scaledHeight / 2; } + else if (this.position.equals(AVKey.NORTH)) + { + x = (viewport.getWidth() - scaledWidth) / 2; + y = viewport.getHeight() - scaledHeight - this.borderWidth; + } else if (this.position.equals(AVKey.NORTHEAST)) { x = viewport.getWidth() - scaledWidth - this.borderWidth; @@ -596,6 +601,11 @@ else if (this.position.equals(AVKey.SOUTHEAST)) x = viewport.getWidth() - scaledWidth - this.borderWidth; y = 0d + this.borderWidth; } + else if (this.position.equals(AVKey.SOUTH)) + { + x = (viewport.getWidth() - scaledWidth) / 2; + y = 0d + this.borderWidth; + } else if (this.position.equals(AVKey.NORTHWEST)) { x = 0d + this.borderWidth;