bike route overlay

pull/1/head
Mike Barry 2021-06-07 08:27:31 -04:00
rodzic 0000a655fe
commit ffbc911799
6 zmienionych plików z 23 dodań i 12 usunięć

1
.gitignore vendored
Wyświetl plik

@ -6,6 +6,7 @@ target/
.idea/*
*.iml
!.idea/codeStyles
!.idea/vcs.xml
TODO

Wyświetl plik

@ -584,4 +584,4 @@
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>
</component>

6
.idea/vcs.xml 100644
Wyświetl plik

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

Wyświetl plik

@ -90,7 +90,7 @@ public interface Stats extends AutoCloseable {
@Override
public Counter.Readable longCounter(String name) {
return Counter.noop();
return Counter.newSingleThreadCounter();
}
@Override

Wyświetl plik

@ -1,6 +1,7 @@
package com.onthegomap.flatmap.monitoring;
import static io.prometheus.client.Collector.NANOSECONDS_PER_SECOND;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.DynamicTest.dynamicTest;
@ -124,7 +125,9 @@ public class PrometheusStatsTest {
"value1", counterAt(1),
"value2", counterAt(2)
));
stats.longCounter("long").incBy(100);
var longCounter = stats.longCounter("long");
longCounter.incBy(100);
assertEquals(100, longCounter.get());
stats.nanoCounter("nanos").incBy((long) (NANOSECONDS_PER_SECOND / 2));
assertContainsStat("^flatmap_counter1_total 1", stats);
assertContainsStat("^flatmap_counter2_total\\{.*label=\"value1\".* 1", stats);

Wyświetl plik

@ -39,7 +39,13 @@ public class BikeRouteOverlay implements Profile {
relation.getTag("name"),
relation.getTag("ref"),
type,
relation.getTag("network", "")
switch (relation.getTag("network", "")) {
case "icn" -> "international";
case "ncn" -> "national";
case "rcn" -> "regional";
case "lcn" -> "local";
default -> "other";
}
));
}
}
@ -50,15 +56,10 @@ public class BikeRouteOverlay implements Profile {
public void processFeature(SourceFeature sourceFeature, FeatureCollector features) {
if (sourceFeature.canBeLine()) {
for (RouteRelationInfo routeInfo : sourceFeature.relationInfo(RouteRelationInfo.class)) {
int minzoom = switch (routeInfo.network) {
case "icn", "ncn" -> 0;
case "rcn" -> 10;
default -> 12;
};
features.line("bikeroutes-" + routeInfo.route + "-" + routeInfo.network)
features.line(routeInfo.route + "-route-" + routeInfo.network)
.setAttr("name", routeInfo.name)
.setAttr("ref", routeInfo.ref)
.setZoomRange(minzoom, 14)
.setZoomRange(0, 14)
.setMinPixelSize(0);
}
}
@ -67,7 +68,7 @@ public class BikeRouteOverlay implements Profile {
@Override
public List<VectorTileEncoder.Feature> postProcessLayerFeatures(String layer, int zoom,
List<VectorTileEncoder.Feature> items) throws GeometryException {
return FeatureMerge.mergeLineStrings(items, 0.1, 0.1, 4);
return FeatureMerge.mergeLineStrings(items, 0.5, 0.1, 4);
}
@Override