mirror of
https://github.com/cfpwastaken/planetiler-openmaptiles.git
synced 2026-02-04 04:21:08 +00:00
Synchronize less in transportation_name layer (#180)
This commit is contained in:
@@ -42,6 +42,8 @@ import static com.onthegomap.planetiler.basemap.util.Utils.*;
|
|||||||
|
|
||||||
import com.carrotsearch.hppc.LongArrayList;
|
import com.carrotsearch.hppc.LongArrayList;
|
||||||
import com.carrotsearch.hppc.LongByteMap;
|
import com.carrotsearch.hppc.LongByteMap;
|
||||||
|
import com.carrotsearch.hppc.LongHashSet;
|
||||||
|
import com.carrotsearch.hppc.LongSet;
|
||||||
import com.onthegomap.planetiler.FeatureCollector;
|
import com.onthegomap.planetiler.FeatureCollector;
|
||||||
import com.onthegomap.planetiler.FeatureMerge;
|
import com.onthegomap.planetiler.FeatureMerge;
|
||||||
import com.onthegomap.planetiler.ForwardingProfile;
|
import com.onthegomap.planetiler.ForwardingProfile;
|
||||||
@@ -124,6 +126,7 @@ public class TransportationName implements
|
|||||||
private final boolean minorRefs;
|
private final boolean minorRefs;
|
||||||
private Transportation transportation;
|
private Transportation transportation;
|
||||||
private final LongByteMap motorwayJunctionHighwayClasses = Hppc.newLongByteHashMap();
|
private final LongByteMap motorwayJunctionHighwayClasses = Hppc.newLongByteHashMap();
|
||||||
|
private final LongSet motorwayJunctionNodes = new LongHashSet();
|
||||||
|
|
||||||
public TransportationName(Translations translations, PlanetilerConfig config, Stats stats) {
|
public TransportationName(Translations translations, PlanetilerConfig config, Stats stats) {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
@@ -157,8 +160,8 @@ public class TransportationName implements
|
|||||||
@Override
|
@Override
|
||||||
public void preprocessOsmNode(OsmElement.Node node) {
|
public void preprocessOsmNode(OsmElement.Node node) {
|
||||||
if (node.hasTag("highway", "motorway_junction")) {
|
if (node.hasTag("highway", "motorway_junction")) {
|
||||||
synchronized (motorwayJunctionHighwayClasses) {
|
synchronized (motorwayJunctionNodes) {
|
||||||
motorwayJunctionHighwayClasses.put(node.id(), HighwayClass.UNKNOWN.value);
|
motorwayJunctionNodes.add(node.id());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -170,11 +173,11 @@ public class TransportationName implements
|
|||||||
HighwayClass cls = HighwayClass.from(highway);
|
HighwayClass cls = HighwayClass.from(highway);
|
||||||
if (cls != HighwayClass.UNKNOWN) {
|
if (cls != HighwayClass.UNKNOWN) {
|
||||||
LongArrayList nodes = way.nodes();
|
LongArrayList nodes = way.nodes();
|
||||||
synchronized (motorwayJunctionHighwayClasses) {
|
|
||||||
for (int i = 0; i < nodes.size(); i++) {
|
for (int i = 0; i < nodes.size(); i++) {
|
||||||
long node = nodes.get(i);
|
long node = nodes.get(i);
|
||||||
if (motorwayJunctionHighwayClasses.containsKey(node)) {
|
if (motorwayJunctionNodes.contains(node)) {
|
||||||
byte oldValue = motorwayJunctionHighwayClasses.get(node);
|
synchronized (motorwayJunctionHighwayClasses) {
|
||||||
|
byte oldValue = motorwayJunctionHighwayClasses.getOrDefault(node, HighwayClass.UNKNOWN.value);
|
||||||
byte newValue = cls.value;
|
byte newValue = cls.value;
|
||||||
if (newValue > oldValue) {
|
if (newValue > oldValue) {
|
||||||
motorwayJunctionHighwayClasses.put(node, newValue);
|
motorwayJunctionHighwayClasses.put(node, newValue);
|
||||||
|
|||||||
Reference in New Issue
Block a user