org.jxmapviewer.demos.DemoMapLocation Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of swingset3-demos Show documentation
Show all versions of swingset3-demos Show documentation
Demonstrating the abilities of the Swing UI Toolkit swingset2 and swingx aka swingset3
The newest version!
package org.jxmapviewer.demos;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import org.jxmapviewer.viewer.GeoPosition;
public class DemoMapLocation {
private String name;
private GeoPosition addressLocation;
private int zoom;
private List routePainter;
// getter:
GeoPosition getAddressLocation() { return addressLocation; }
int getZoom() { return zoom; }
List getRoutePainter() { return routePainter; }
DemoMapLocation(String name, GeoPosition geoPosition, int zoom) {
this(name, geoPosition, zoom, null);
}
DemoMapLocation(String name, GeoPosition geoPosition, int zoom, RoutePainter routePainter) {
this.name = name;
this.addressLocation = geoPosition;
this.zoom = zoom;
this.routePainter = new ArrayList();
addRoutePainter(routePainter);
}
DemoMapLocation(String name, GPXFile gpxf, int zoom) {
this.name = name;
this.zoom = zoom;
int size = gpxf.getTracksSize();
this.routePainter = new ArrayList();
for(int i=0; i track = new ArrayList();
gpxf.getTrackWaypoints(i).forEach(wp -> {
track.add(new GeoPosition(wp.getLatitude(), wp.getLongitude()));
});
addRoutePainter(new RoutePainter(Color.RED, track));
if(addressLocation==null) addressLocation = track.get(0);
}
}
public void addRoutePainter(RoutePainter rp) {
if(rp!=null) routePainter.add(rp);
}
public String toString() {
return this.name;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy