use of eu.esdihumboldt.hale.ui.views.styledmap.painter.TransformedInstancePainter in project hale by halestudio.
the class InstanceMapTip method getTipText.
/**
* @see de.fhg.igd.mapviewer.tip.HoverMapTip#getTipText(int, int,
* org.jdesktop.swingx.mapviewer.PixelConverter, int)
*/
@Override
protected String getTipText(int x, int y, PixelConverter converter, int zoom) {
Point point = new Point(x, y);
String sourceName = null;
List<SourceInstancePainter> sourcePainters = mapKit.getTilePainters(SourceInstancePainter.class);
if (!sourcePainters.isEmpty()) {
InstanceWaypoint wp = sourcePainters.get(0).findWaypoint(point);
if (wp != null) {
sourceName = wp.getName();
}
}
String transformedName = null;
List<TransformedInstancePainter> transformedPainters = mapKit.getTilePainters(TransformedInstancePainter.class);
if (!transformedPainters.isEmpty()) {
InstanceWaypoint wp = transformedPainters.get(0).findWaypoint(point);
if (wp != null) {
transformedName = wp.getName();
}
}
if (sourceName != null && sourceName.equals(transformedName)) {
// if both are equal, return one name only
return sourceName;
}
if (sourceName != null) {
sourceName += " (source)";
}
if (transformedName != null) {
transformedName += " (transformed)";
}
if (sourceName != null && transformedName != null) {
return sourceName + "; " + transformedName;
} else if (sourceName != null) {
return sourceName;
} else if (transformedName != null) {
return transformedName;
}
return null;
}
Aggregations