OsmAnd/OsmAnd-java/src/main/java/net/osmand/data/TransportStop.java

81 lines
1.8 KiB
Java
Raw Normal View History

package net.osmand.data;
import net.osmand.util.MapUtils;
2018-12-19 08:46:47 +01:00
import java.util.ArrayList;
import java.util.Collections;
2018-12-28 10:30:11 +01:00
import java.util.HashMap;
2018-12-19 08:46:47 +01:00
import java.util.List;
2018-12-28 10:30:11 +01:00
import java.util.Map;
2018-12-19 08:46:47 +01:00
public class TransportStop extends MapObject {
private int[] referencesToRoutes = null;
2018-06-08 16:13:24 +02:00
private Amenity amenity;
public int distance;
public int x31;
public int y31;
2018-12-19 08:46:47 +01:00
private List<TransportStopExit> exits;
2018-12-28 10:30:11 +01:00
private HashMap<String,String> names;
public TransportStop(){
}
public int[] getReferencesToRoutes() {
return referencesToRoutes;
}
public void setReferencesToRoutes(int[] referencesToRoutes) {
this.referencesToRoutes = referencesToRoutes;
}
2018-06-08 16:13:24 +02:00
public Amenity getAmenity() {
return amenity;
}
public void setAmenity(Amenity amenity) {
this.amenity = amenity;
}
@Override
public void setLocation(double latitude, double longitude) {
super.setLocation(latitude, longitude);
}
public void setLocation(int zoom, int dx, int dy) {
x31 = dx << (31 - zoom);
y31 = dy << (31 - zoom);
setLocation(MapUtils.getLatitudeFromTile(zoom, dy), MapUtils.getLongitudeFromTile(zoom, dx));
}
2018-12-19 08:46:47 +01:00
public void addExit(TransportStopExit transportStopExit) {
if (exits == null) {
exits = new ArrayList<>();
}
exits.add(transportStopExit);
}
public List<TransportStopExit> getExits () {
if (exits == null) {
return Collections.emptyList();
}
return this.exits;
}
public String getExitsString () {
String exitsString = "";
2018-12-19 13:56:38 +01:00
String refString = "";
2018-12-19 08:46:47 +01:00
if (this.exits != null) {
int i = 1;
exitsString = exitsString + " Exits: [";
2018-12-19 13:56:38 +01:00
for (TransportStopExit e : this.exits ) {
if (e.getRef() != null) {
refString = " [ref:" + e.getRef() + "] ";
2018-12-19 08:46:47 +01:00
}
2018-12-19 13:56:38 +01:00
exitsString = exitsString + " " + i + ")" + refString + e.getName() + " " + e.getLocation() + " ]";
i++;
2018-12-19 08:46:47 +01:00
}
}
return exitsString;
}
}