Skip to content

Commit

Permalink
Merge branch 'openmaptiles:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ofalvai authored May 1, 2023
2 parents bf54d11 + 6317d82 commit bf376eb
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,18 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M9</version>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M9</version>
<version>3.0.0</version>
</plugin>

<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.33.0</version>
<version>2.36.0</version>
<configuration>
<java>
<importOrder/>
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/org/openmaptiles/layers/Transportation.java
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ public void process(Tables.OsmHighwayLinestring element, FeatureCollector featur
}
int minzoom = getMinzoom(element, highwayClass);

if (minzoom > config.maxzoom()) {
return;
}

boolean highwayRamp = isLink(highway);
Integer rampAboveZ12 = (highwayRamp || element.isRamp()) ? 1 : null;
Integer rampBelowZ12 = highwayRamp ? 1 : null;
Expand Down Expand Up @@ -409,7 +413,7 @@ int getMinzoom(Tables.OsmHighwayLinestring element, String highwayClass) {
case FieldValues.CLASS_SERVICE -> isDrivewayOrParkingAisle(service(element.service())) ? 14 : 13;
case FieldValues.CLASS_TRACK, FieldValues.CLASS_PATH -> routeRank == 1 ? 12 :
(z13Paths || !nullOrEmpty(element.name()) || routeRank <= 2 || !nullOrEmpty(element.sacScale())) ? 13 : 14;
default -> MINZOOMS.get(baseClass);
default -> MINZOOMS.getOrDefault(baseClass, Integer.MAX_VALUE);
};
}

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/openmaptiles/layers/TransportationName.java
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ public void process(Tables.OsmHighwayLinestring element, FeatureCollector featur

// inherit min zoom threshold from visible road, and ensure we never show a label on a road that's not visible yet.
minzoom = Math.max(minzoom, transportation.getMinzoom(element, highwayClass));
if (minzoom > config.maxzoom()) {
return;
}

FeatureCollector.Feature feature = features.line(LAYER_NAME)
.setBufferPixels(BUFFER_SIZE)
Expand Down
35 changes: 35 additions & 0 deletions src/test/java/org/openmaptiles/layers/TransportationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1280,4 +1280,39 @@ void testTransportationNameLayerRequiresTransportationLayer() {
"class", "path"
)), collector);
}

@Test
void testIssue86() {
assertFeatures(14, List.of(Map.of(
"_layer", "transportation",
"class", "bridge",
"_minzoom", 13,
"_type", "polygon"
)), process(closedWayFeature(Map.of(
"layer", "1",
"man_made", "bridge",
"service", "driveway"
))));
assertFeatures(14, List.of(Map.of(
"_layer", "transportation",
"class", "bridge",
"_minzoom", 13,
"_type", "polygon"
)), process(closedWayFeature(Map.of(
"layer", "1",
"man_made", "bridge",
"service", "driveway",
"name", "name"
))));
assertFeatures(14, List.of(Map.of(
"_layer", "transportation",
"class", "pier",
"_minzoom", 13,
"_type", "polygon"
)), process(closedWayFeature(Map.of(
"layer", "1",
"man_made", "pier",
"service", "driveway"
))));
}
}

0 comments on commit bf376eb

Please sign in to comment.