applied eclipse formatting to all widgets

master
Stefan Dollase 2015-11-16 04:39:14 +01:00
parent eeffc0af93
commit 7b0a80e5c5
9 changed files with 179 additions and 148 deletions

View File

@ -8,13 +8,15 @@ import amidst.map.layer.BiomeLayer;
import amidst.resources.ResourceLoader;
public class BiomeToggleWidget extends PanelWidget {
private static BufferedImage highlighterIcon = ResourceLoader.getImage("highlighter.png");
private static BufferedImage highlighterIcon = ResourceLoader
.getImage("highlighter.png");
public static boolean isBiomeWidgetVisible = false;
public BiomeToggleWidget(MapViewer mapViewer) {
super(mapViewer);
setDimensions(36, 36);
}
@Override
public void draw(Graphics2D g2d, float time) {
super.draw(g2d, time);

View File

@ -7,7 +7,6 @@ import java.awt.Point;
import java.awt.Rectangle;
import java.util.ArrayList;
import amidst.logging.Log;
import amidst.map.MapViewer;
import amidst.map.layer.BiomeLayer;
import amidst.minecraft.Biome;
@ -23,25 +22,28 @@ public class BiomeWidget extends PanelWidget {
private static Color scrollbarColor = new Color(0.6f, 0.6f, 0.6f, 0.8f);
private static Color scrollbarLitColor = new Color(0.6f, 0.6f, 0.8f, 0.8f);
private static Color selectButtonColor = new Color(0.6f, 0.6f, 0.8f, 1.0f);
private ArrayList<Biome> biomes = new ArrayList<Biome>();
private int maxNameWidth = 0;
private Rectangle innerBox = new Rectangle(0, 0, 1, 1);
private int biomeListHeight;
private int biomeListYOffset = 0;
private boolean scrollbarVisible = false;
private boolean scrollbarGrabbed = false;
private int scrollbarHeight = 0, scrollbarWidth = 10, scrollbarY = 0, mouseYOnGrab = 0, scrollbarYOnGrab;
private int scrollbarHeight = 0, scrollbarWidth = 10, scrollbarY = 0,
mouseYOnGrab = 0, scrollbarYOnGrab;
public BiomeWidget(MapViewer mapViewer) {
super(mapViewer);
FontMetrics fontMetrics = mapViewer.getFontMetrics(textFont);
for (int i = 0; i < Biome.biomes.length; i++) {
if (Biome.biomes[i] != null) {
biomes.add(Biome.biomes[i]);
maxNameWidth = Math.max(fontMetrics.stringWidth(Biome.biomes[i].name), maxNameWidth);
maxNameWidth = Math.max(
fontMetrics.stringWidth(Biome.biomes[i].name),
maxNameWidth);
}
}
biomeListHeight = biomes.size() * 16;
@ -57,117 +59,128 @@ public class BiomeWidget extends PanelWidget {
g2d.setColor(textColor);
g2d.setFont(textFont);
g2d.drawString("Highlight Biomes", x + 10, y + 20);
innerBox.x = x + 8;
innerBox.y = y + 30;
innerBox.width = width - 16;
innerBox.height = height - 58;
biomeListYOffset = Math.min(0, Math.max(-biomeListHeight + innerBox.height, biomeListYOffset));
biomeListYOffset = Math.min(0,
Math.max(-biomeListHeight + innerBox.height, biomeListYOffset));
if (biomeListHeight > innerBox.height) {
innerBox.width -= scrollbarWidth;
scrollbarVisible = true;
} else {
scrollbarVisible = false;
}
g2d.setColor(innerBoxBgColor);
g2d.fillRect(innerBox.x, innerBox.y, innerBox.width, innerBox.height);
g2d.setColor(innerBoxBorderColor);
g2d.drawRect(innerBox.x - 1, innerBox.y - 1, innerBox.width + 1 + (scrollbarVisible?scrollbarWidth:0), innerBox.height + 1);
g2d.drawRect(innerBox.x - 1, innerBox.y - 1, innerBox.width + 1
+ (scrollbarVisible ? scrollbarWidth : 0), innerBox.height + 1);
g2d.setClip(innerBox);
for (int i = 0; i < biomes.size(); i++) {
Biome biome = biomes.get(i);
if (BiomeLayer.instance.isBiomeSelected(biome.index))
g2d.setColor(((i % 2) == 1)?biomeLitBgColor1:biomeLitBgColor2);
g2d.setColor(((i % 2) == 1) ? biomeLitBgColor1
: biomeLitBgColor2);
else
g2d.setColor(((i % 2) == 1)?biomeBgColor1:biomeBgColor2);
g2d.fillRect(innerBox.x, innerBox.y + i * 16 + biomeListYOffset,innerBox.width, 16);
g2d.setColor(((i % 2) == 1) ? biomeBgColor1 : biomeBgColor2);
g2d.fillRect(innerBox.x, innerBox.y + i * 16 + biomeListYOffset,
innerBox.width, 16);
g2d.setColor(new Color(biome.color));
g2d.fillRect(innerBox.x, innerBox.y + i*16 + biomeListYOffset, 20, 16);
g2d.fillRect(innerBox.x, innerBox.y + i * 16 + biomeListYOffset,
20, 16);
g2d.setColor(Color.white);
g2d.drawString(biome.name, innerBox.x + 25, innerBox.y + 13 + i*16 + biomeListYOffset);
g2d.drawString(biome.name, innerBox.x + 25, innerBox.y + 13 + i
* 16 + biomeListYOffset);
}
g2d.setClip(null);
if (scrollbarVisible) {
float boxHeight = innerBox.height;
float listHeight = biomeListHeight;
if (scrollbarGrabbed) {
Point mouse = mapViewer.getMousePosition();
if (mouse != null) {
int tempScrollbarY = - scrollbarYOnGrab - (mouse.y - mouseYOnGrab);
biomeListYOffset = (int)((listHeight/boxHeight) * tempScrollbarY);
biomeListYOffset = Math.min(0, Math.max(-biomeListHeight + innerBox.height, biomeListYOffset));
int tempScrollbarY = -scrollbarYOnGrab
- (mouse.y - mouseYOnGrab);
biomeListYOffset = (int) ((listHeight / boxHeight) * tempScrollbarY);
biomeListYOffset = Math.min(0, Math.max(-biomeListHeight
+ innerBox.height, biomeListYOffset));
} else {
scrollbarGrabbed = false;
}
}
float yOffset = -biomeListYOffset;
scrollbarY = (int) ((yOffset/listHeight) * boxHeight);
scrollbarHeight = (int) (Math.ceil(boxHeight * (boxHeight/listHeight)));
g2d.setColor(scrollbarGrabbed?scrollbarLitColor:scrollbarColor);
g2d.fillRect(innerBox.x + innerBox.width, innerBox.y + scrollbarY, scrollbarWidth, scrollbarHeight);
scrollbarY = (int) ((yOffset / listHeight) * boxHeight);
scrollbarHeight = (int) (Math.ceil(boxHeight
* (boxHeight / listHeight)));
g2d.setColor(scrollbarGrabbed ? scrollbarLitColor : scrollbarColor);
g2d.fillRect(innerBox.x + innerBox.width, innerBox.y + scrollbarY,
scrollbarWidth, scrollbarHeight);
}
g2d.setColor(Color.white);
g2d.drawString("Select:", x + 8, y + height - 10);
g2d.setColor(selectButtonColor);
g2d.drawString("All Special None", x + 120, y + height - 10);
}
@Override
public boolean onMouseWheelMoved(int mouseX, int mouseY, int notches) {
if ((mouseX > innerBox.x - x) &&
(mouseX < innerBox.x - x + innerBox.width) &&
(mouseY > innerBox.y - y) &&
(mouseY < innerBox.y - y + innerBox.height)) {
biomeListYOffset = Math.min(0, Math.max(-biomeListHeight + innerBox.height, biomeListYOffset - notches * 35));
if ((mouseX > innerBox.x - x)
&& (mouseX < innerBox.x - x + innerBox.width)
&& (mouseY > innerBox.y - y)
&& (mouseY < innerBox.y - y + innerBox.height)) {
biomeListYOffset = Math.min(0, Math.max(-biomeListHeight
+ innerBox.height, biomeListYOffset - notches * 35));
}
return true;
}
@Override
public void onMouseReleased() {
scrollbarGrabbed = false;
}
@Override
public boolean onMousePressed(int mouseX, int mouseY) {
if (scrollbarVisible) {
if ((mouseX > innerBox.x - x + innerBox.width) &&
(mouseX < innerBox.x - x + innerBox.width + scrollbarWidth) &&
(mouseY > innerBox.y - y + scrollbarY) &&
(mouseY < innerBox.y - y + scrollbarY + scrollbarHeight)) {
if ((mouseX > innerBox.x - x + innerBox.width)
&& (mouseX < innerBox.x - x + innerBox.width
+ scrollbarWidth)
&& (mouseY > innerBox.y - y + scrollbarY)
&& (mouseY < innerBox.y - y + scrollbarY + scrollbarHeight)) {
mouseYOnGrab = mouseY + y;
scrollbarYOnGrab = scrollbarY;
scrollbarGrabbed = true;
}
}
boolean needsRedraw = false;
if ((mouseX > innerBox.x - x) &&
(mouseX < innerBox.x - x + innerBox.width) &&
(mouseY > innerBox.y - y) &&
(mouseY < innerBox.y - y + innerBox.height)) {
if ((mouseX > innerBox.x - x)
&& (mouseX < innerBox.x - x + innerBox.width)
&& (mouseY > innerBox.y - y)
&& (mouseY < innerBox.y - y + innerBox.height)) {
int id = (mouseY - (innerBox.y - y) - biomeListYOffset) / 16;
if (id < biomes.size()) {
BiomeLayer.instance.toggleBiomeSelect(biomes.get(id).index);
needsRedraw = true;
}
}
// TODO: These values are temporarly hard coded for the sake of a fast release
// TODO: These values are temporarly hard coded for the sake of a fast
// release
if ((mouseY > height - 25) && (mouseY < height - 9)) {
if ((mouseX > 117) && (mouseX < 139)) {
BiomeLayer.instance.selectAllBiomes();
@ -192,19 +205,19 @@ public class BiomeWidget extends PanelWidget {
}
return true;
}
@Override
public boolean onVisibilityCheck() {
height = Math.max(200, mapViewer.getHeight() - 200);
return BiomeToggleWidget.isBiomeWidgetVisible & (height > 200);
}
private void setMapViewer(MapViewer mapViewer) {
this.mapViewer = mapViewer;
this.map = mapViewer.getMap();
scrollbarGrabbed = false;
}
public static BiomeWidget get(MapViewer mapViewer) {
if (instance == null)
instance = new BiomeWidget(mapViewer);

View File

@ -7,7 +7,7 @@ import amidst.map.MapViewer;
public class CursorInformationWidget extends PanelWidget {
private String message = "";
public CursorInformationWidget(MapViewer mapViewer) {
super(mapViewer);
setDimensions(20, 30);
@ -20,16 +20,17 @@ public class CursorInformationWidget extends PanelWidget {
if ((mouseLocation = mapViewer.getMousePosition()) != null) {
mouseLocation = map.screenToLocal(mouseLocation);
String biomeName = map.getBiomeAliasAt(mouseLocation);
message = biomeName + " [ " + mouseLocation.x + ", " + mouseLocation.y + " ]";
message = biomeName + " [ " + mouseLocation.x + ", "
+ mouseLocation.y + " ]";
}
int stringWidth = mapViewer.getFontMetrics().stringWidth(message);
setWidth(stringWidth + 20);
super.draw(g2d, time);
g2d.setColor(textColor);
g2d.drawString(message, x + 10, y + 20);
}
@Override
protected boolean onVisibilityCheck() {
return (mapViewer.getMousePosition() != null);

View File

@ -16,34 +16,41 @@ public class DebugWidget extends PanelWidget {
@Override
public void draw(Graphics2D g2d, float time) {
FragmentManager fragmentManager = mapViewer.getFragmentManager();
ArrayList<String> panelText = new ArrayList<String>();
ArrayList<String> panelText = new ArrayList<String>();
panelText.add("Fragment Manager:");
panelText.add("Pool Size: " + fragmentManager.getCacheSize());
panelText.add("Free Queue Size: " + fragmentManager.getFreeFragmentQueueSize());
panelText.add("Request Queue Size: " + fragmentManager.getRequestQueueSize());
panelText.add("Recycle Queue Size: " + fragmentManager.getRecycleQueueSize());
panelText.add("Free Queue Size: "
+ fragmentManager.getFreeFragmentQueueSize());
panelText.add("Request Queue Size: "
+ fragmentManager.getRequestQueueSize());
panelText.add("Recycle Queue Size: "
+ fragmentManager.getRecycleQueueSize());
panelText.add("");
panelText.add("Map Viewer:");
panelText.add("Map Size: " + map.getFragmentsPerRow() + "x" + map.getFragmentsPerColumn() + " [" + (map.getFragmentsPerRow() * map.getFragmentsPerColumn()) + "]");
panelText.add("Map Size: " + map.getFragmentsPerRow() + "x"
+ map.getFragmentsPerColumn() + " ["
+ (map.getFragmentsPerRow() * map.getFragmentsPerColumn())
+ "]");
int width = 0, height;
for (int i = 0; i < panelText.size(); i++) {
int textWidth = mapViewer.getFontMetrics().stringWidth(panelText.get(i));
int textWidth = mapViewer.getFontMetrics().stringWidth(
panelText.get(i));
if (textWidth > width)
width = textWidth;
}
width += 20;
height = panelText.size() * 20 + 10;
setDimensions(width, height);
super.draw(g2d, time);
g2d.setColor(textColor);
for (int i = 0; i < panelText.size(); i++)
g2d.drawString(panelText.get(i), x + 10, y + 20 + i*20);
g2d.drawString(panelText.get(i), x + 10, y + 20 + i * 20);
}
@Override
protected boolean onVisibilityCheck() {
return Options.instance.showDebug.get();

View File

@ -8,23 +8,24 @@ import amidst.utilities.FramerateTimer;
public class FpsWidget extends PanelWidget {
private FramerateTimer fps = new FramerateTimer(2);
public FpsWidget(MapViewer mapViewer) {
super(mapViewer);
setDimensions(20, 30);
forceVisibility(onVisibilityCheck());
}
@Override
@Override
public void draw(Graphics2D g2d, float time) {
String framerate = fps.toString();
setWidth(mapViewer.getFontMetrics().stringWidth(framerate) + 20);
super.draw(g2d, time);
fps.tick();
g2d.setColor(textColor);
g2d.drawString(framerate, x + 10, y + 20);
}
@Override
protected boolean onVisibilityCheck() {
return Options.instance.showFPS.get();

View File

@ -11,76 +11,80 @@ import amidst.map.MapViewer;
import amidst.resources.ResourceLoader;
public class PanelWidget extends Widget {
private static BufferedImage
dropShadowBottomLeft = ResourceLoader.getImage("dropshadow/outer_bottom_left.png"),
dropShadowBottomRight = ResourceLoader.getImage("dropshadow/outer_bottom_right.png"),
dropShadowTopLeft = ResourceLoader.getImage("dropshadow/outer_top_left.png"),
dropShadowTopRight = ResourceLoader.getImage("dropshadow/outer_top_right.png"),
dropShadowBottom = ResourceLoader.getImage("dropshadow/outer_bottom.png"),
dropShadowTop = ResourceLoader.getImage("dropshadow/outer_top.png"),
dropShadowLeft = ResourceLoader.getImage("dropshadow/outer_left.png"),
dropShadowRight = ResourceLoader.getImage("dropshadow/outer_right.png");
private static BufferedImage dropShadowBottomLeft = ResourceLoader
.getImage("dropshadow/outer_bottom_left.png"),
dropShadowBottomRight = ResourceLoader
.getImage("dropshadow/outer_bottom_right.png"),
dropShadowTopLeft = ResourceLoader
.getImage("dropshadow/outer_top_left.png"),
dropShadowTopRight = ResourceLoader
.getImage("dropshadow/outer_top_right.png"),
dropShadowBottom = ResourceLoader
.getImage("dropshadow/outer_bottom.png"),
dropShadowTop = ResourceLoader.getImage("dropshadow/outer_top.png"),
dropShadowLeft = ResourceLoader
.getImage("dropshadow/outer_left.png"),
dropShadowRight = ResourceLoader
.getImage("dropshadow/outer_right.png");
public enum CornerAnchorPoint {
TOP_LEFT,
TOP_RIGHT,
BOTTOM_LEFT,
BOTTOM_RIGHT,
BOTTOM_CENTER,
CENTER,
NONE
TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT, BOTTOM_CENTER, CENTER, NONE
}
protected Color textColor = new Color(1f, 1f, 1f);
protected Color panelColor = new Color(0.15f, 0.15f, 0.15f, 0.8f);
protected Font textFont = new Font("arial", Font.BOLD, 15);
protected Stroke lineStroke1 = new BasicStroke(1);
protected Stroke lineStroke2 = new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER);
protected Stroke lineStroke2 = new BasicStroke(2, BasicStroke.CAP_BUTT,
BasicStroke.JOIN_MITER);
protected CornerAnchorPoint anchor = CornerAnchorPoint.NONE;
protected int xPadding = 10, yPadding = 10;
protected float alpha = 1.0f, targetAlpha = 1.0f;
protected boolean isFading = false;
protected boolean targetVisibility = true;
public PanelWidget(MapViewer mapViewer) {
super(mapViewer);
}
@Override
public void draw(Graphics2D g2d, float time) {
targetAlpha = targetVisibility?1.0f:0.0f;
targetAlpha = targetVisibility ? 1.0f : 0.0f;
if (alpha < targetAlpha)
alpha = Math.min(targetAlpha, alpha + time*4.0f);
alpha = Math.min(targetAlpha, alpha + time * 4.0f);
else if (alpha > targetAlpha)
alpha = Math.max(targetAlpha, alpha - time*4.0f);
alpha = Math.max(targetAlpha, alpha - time * 4.0f);
isFading = (alpha != targetAlpha);
updatePosition();
g2d.setColor(panelColor);
g2d.drawImage(dropShadowTopLeft, x - 10, y - 10, null);
g2d.drawImage(dropShadowTopRight, x + width, y - 10, null);
g2d.drawImage(dropShadowBottomLeft, x - 10, y + height, null);
g2d.drawImage(dropShadowTopLeft, x - 10, y - 10, null);
g2d.drawImage(dropShadowTopRight, x + width, y - 10, null);
g2d.drawImage(dropShadowBottomLeft, x - 10, y + height, null);
g2d.drawImage(dropShadowBottomRight, x + width, y + height, null);
g2d.drawImage(dropShadowTop, x, y - 10, width, 10, null);
g2d.drawImage(dropShadowBottom, x, y + height, width, 10, null);
g2d.drawImage(dropShadowLeft, x - 10, y, 10, height, null);
g2d.drawImage(dropShadowRight, x + width, y, 10, height, null);
g2d.drawImage(dropShadowTop, x, y - 10, width, 10, null);
g2d.drawImage(dropShadowBottom, x, y + height, width, 10, null);
g2d.drawImage(dropShadowLeft, x - 10, y, 10, height, null);
g2d.drawImage(dropShadowRight, x + width, y, 10, height, null);
g2d.fillRect(x, y, width, height);
}
public void setWidth(int width) {
this.width = width;
}
public void setHeight(int height) {
this.height = height;
}
public void setDimensions(int width, int height) {
this.width = width;
this.height = height;
}
protected void updatePosition() {
switch (anchor) {
case TOP_LEFT:
@ -92,7 +96,7 @@ public class PanelWidget extends Widget {
y = mapViewer.getHeight() - (height + yPadding);
break;
case BOTTOM_RIGHT:
x = mapViewer.getWidth() - (width + xPadding);
x = mapViewer.getWidth() - (width + xPadding);
y = mapViewer.getHeight() - (height + yPadding);
break;
case BOTTOM_CENTER:
@ -100,7 +104,7 @@ public class PanelWidget extends Widget {
y = mapViewer.getHeight() - (height + yPadding);
break;
case TOP_RIGHT:
x = mapViewer.getWidth() - (width + xPadding);
x = mapViewer.getWidth() - (width + xPadding);
y = yPadding;
break;
case CENTER:
@ -111,30 +115,30 @@ public class PanelWidget extends Widget {
break;
}
}
@Override
public boolean isVisible() {
boolean value = (visible && targetVisibility) || isFading;
targetVisibility = onVisibilityCheck();
return value;
}
protected boolean onVisibilityCheck() {
return visible;
}
public void forceVisibility(boolean value) {
targetVisibility = value;
isFading = false;
targetAlpha = value?1.0f:0.0f;
alpha = value?1.0f:0.0f;
targetAlpha = value ? 1.0f : 0.0f;
alpha = value ? 1.0f : 0.0f;
}
@Override
public float getAlpha() {
return alpha;
}
public PanelWidget setAnchorPoint(CornerAnchorPoint anchor) {
this.anchor = anchor;
return this;

View File

@ -7,10 +7,10 @@ import amidst.Options;
import amidst.map.MapViewer;
public class ScaleWidget extends PanelWidget {
public static int cScaleLengthMax_px = 200;
public static int cMargin = 8;
public ScaleWidget(MapViewer mapViewer) {
super(mapViewer);
setDimensions(100, 34);
@ -19,49 +19,50 @@ public class ScaleWidget extends PanelWidget {
@Override
public void draw(Graphics2D g2d, float time) {
int scaleBlocks = scaleLength_blocks();
int scaleWidth_px = (int)(scaleBlocks * map.getZoom());
String message = scaleBlocks + " blocks";
int scaleWidth_px = (int) (scaleBlocks * map.getZoom());
String message = scaleBlocks + " blocks";
int stringWidth = mapViewer.getFontMetrics().stringWidth(message);
setWidth(Math.max(scaleWidth_px, stringWidth) + (cMargin * 2));
super.draw(g2d, time);
g2d.setColor(textColor);
g2d.setFont(textFont);
g2d.drawString(message, x + 1 + ((width - stringWidth) >> 1), y + 18);
g2d.setColor(Color.white);
g2d.setStroke(lineStroke2);
g2d.drawLine(x + cMargin, y + 26, x + cMargin + scaleWidth_px, y + 26);
g2d.setStroke(lineStroke1);
g2d.drawLine(x + cMargin, y + 23, x + cMargin, y + 28);
g2d.drawLine(x + cMargin + scaleWidth_px, y + 23, x + cMargin + scaleWidth_px, y + 28);
g2d.drawLine(x + cMargin + scaleWidth_px, y + 23, x + cMargin
+ scaleWidth_px, y + 28);
}
@Override
protected boolean onVisibilityCheck() {
return Options.instance.showScale.get();
}
private int scaleLength_blocks() {
double scale = map.getZoom();
int result = 1000;
if(result * scale > cScaleLengthMax_px) {
if (result * scale > cScaleLengthMax_px) {
result = 500;
if(result * scale > cScaleLengthMax_px) {
if (result * scale > cScaleLengthMax_px) {
result = 200;
if(result * scale > cScaleLengthMax_px) {
if (result * scale > cScaleLengthMax_px) {
result = 100;
}
}
}
return result;
}
}

View File

@ -10,10 +10,11 @@ public class SeedWidget extends PanelWidget {
super(mapViewer);
setDimensions(20, 30);
}
@Override
public void draw(Graphics2D g2d, float time) {
setWidth(mapViewer.getFontMetrics().stringWidth(Options.instance.getSeedMessage()) + 20);
setWidth(mapViewer.getFontMetrics().stringWidth(
Options.instance.getSeedMessage()) + 20);
super.draw(g2d, time);
g2d.setColor(textColor);
g2d.drawString(Options.instance.getSeedMessage(), x + 10, y + 20);

View File

@ -9,19 +9,20 @@ import amidst.map.object.MapObject;
public class SelectedObjectWidget extends PanelWidget {
private String message = "";
private BufferedImage icon;
public SelectedObjectWidget(MapViewer mapViewer) {
super(mapViewer);
yPadding += 40;
setDimensions(20, 35);
forceVisibility(false);
}
@Override
public void draw(Graphics2D g2d, float time) {
if (targetVisibility) {
MapObject selectedObject = mapViewer.getSelectedObject();
message = selectedObject.getName() + " [" + selectedObject.getRx() + ", " + selectedObject.getRy() + "]";
message = selectedObject.getName() + " [" + selectedObject.getRx()
+ ", " + selectedObject.getRy() + "]";
icon = selectedObject.getImage();
}
@ -31,12 +32,12 @@ public class SelectedObjectWidget extends PanelWidget {
g2d.setColor(textColor);
double imgWidth = icon.getWidth();
double imgHeight = icon.getHeight();
double ratio = imgWidth/imgHeight;
g2d.drawImage(icon, x + 5, y + 5, (int)(25.*ratio), 25, null);
double ratio = imgWidth / imgHeight;
g2d.drawImage(icon, x + 5, y + 5, (int) (25. * ratio), 25, null);
g2d.drawString(message, x + 35, y + 23);
}
@Override
protected boolean onVisibilityCheck() {
return (mapViewer.getSelectedObject() != null);