Vector tile feature ID method (#960)

pull/972/head
Michael Barry 2024-07-31 05:28:21 -04:00 zatwierdzone przez GitHub
rodzic 1d0b639141
commit 2b65295559
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
3 zmienionych plików z 14 dodań i 6 usunięć

Wyświetl plik

@ -235,4 +235,13 @@ public interface OsmElement extends WithTags {
record Info(long changeset, long timestamp, int userId, int version, String user) {
private static final int COST = 2;
}
static long vectorTileFeatureId(int multiplier, long id, Type type) {
return (id * multiplier) + switch (type) {
case OTHER -> 0;
case NODE -> 1;
case WAY -> 2;
case RELATION -> 3;
};
}
}

Wyświetl plik

@ -646,12 +646,7 @@ public class OsmReader implements Closeable, MemoryEstimator.HasEstimate {
@Override
public long vectorTileFeatureId(int multiplier) {
return (id() * multiplier) + switch (originalElement.type()) {
case OTHER -> 0;
case NODE -> 1;
case WAY -> 2;
case RELATION -> 3;
};
return OsmElement.vectorTileFeatureId(multiplier, id(), originalElement.type());
}
@Override

Wyświetl plik

@ -15,4 +15,8 @@ public interface OsmRelationInfo extends MemoryEstimator.HasEstimate {
default long estimateMemoryUsageBytes() {
return 0;
}
default long vectorTileFeatureId(int multiplier) {
return OsmElement.vectorTileFeatureId(multiplier, id(), OsmElement.Type.RELATION);
}
}