Support entrance ref for search
This commit is contained in:
parent
03ea0b9974
commit
f5ba767ef3
3 changed files with 40 additions and 1 deletions
|
@ -1,6 +1,10 @@
|
|||
package net.osmand.data;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
public class Building extends MapObject {
|
||||
|
@ -10,6 +14,7 @@ public class Building extends MapObject {
|
|||
private BuildingInterpolation interpolationType;
|
||||
private int interpolationInterval;
|
||||
private String name2;
|
||||
private Map<String, LatLon> entrances = null;
|
||||
|
||||
public enum BuildingInterpolation {
|
||||
ALL(-1), EVEN(-2), ODD(-3), ALPHABETIC(-4);
|
||||
|
@ -38,6 +43,20 @@ public class Building extends MapObject {
|
|||
return postcode;
|
||||
}
|
||||
|
||||
public Map<String, LatLon> getEntrances() {
|
||||
if(entrances == null) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
return entrances;
|
||||
}
|
||||
|
||||
public void addEntrance(String ref, LatLon location) {
|
||||
if(entrances == null) {
|
||||
entrances = new LinkedHashMap<>();
|
||||
}
|
||||
entrances.put(ref, location);
|
||||
}
|
||||
|
||||
public int getInterpolationInterval() {
|
||||
return interpolationInterval;
|
||||
}
|
||||
|
@ -147,4 +166,14 @@ public class Building extends MapObject {
|
|||
return loc;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
boolean res = super.equals(o);
|
||||
if (res && o instanceof Building) {
|
||||
return Algorithms.stringsEqual(((MapObject) o).getName(), getName());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public class Street extends MapObject {
|
|||
|
||||
public void addBuildingCheckById(Building building) {
|
||||
for (Building b : buildings) {
|
||||
if (b.getId().longValue() == building.getId().longValue()) {
|
||||
if (b.equals(building)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -201,6 +201,16 @@ public class EntityParser {
|
|||
p = e.getTag(OSMTagKey.POSTAL_CODE.getValue());
|
||||
}
|
||||
b.setPostcode(p);
|
||||
if(e instanceof Way) {
|
||||
List<Node> nodes = ((Way) e).getNodes();
|
||||
for(int i = 0; i < nodes.size(); i++) {
|
||||
Node node = nodes.get(i);
|
||||
if(node != null && "yes".equals(node.getTag(OSMTagKey.ENTRANCE)) &&
|
||||
!Algorithms.isEmpty(node.getTag(OSMTagKey.REF))) {
|
||||
b.addEntrance(node.getTag(OSMTagKey.REF), node.getLatLon());
|
||||
}
|
||||
}
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue