kopia lustrzana https://github.com/onthegomap/planetiler
tweak
rodzic
c5fb5e30bf
commit
e2e8b1adfa
|
@ -81,7 +81,7 @@ public class VectorTile {
|
||||||
private static final int EXTENT = 4096;
|
private static final int EXTENT = 4096;
|
||||||
private static final double SIZE = 256d;
|
private static final double SIZE = 256d;
|
||||||
private final Map<String, Layer> layers = new LinkedHashMap<>();
|
private final Map<String, Layer> layers = new LinkedHashMap<>();
|
||||||
private LayerAttrStats.Updater.ForZoom layerStatsTracker = LayerAttrStats.Updater.ForZoom.NO_OP;
|
private LayerAttrStats.Updater.ForZoom layerStatsTracker = LayerAttrStats.Updater.ForZoom.NOOP;
|
||||||
|
|
||||||
private static int[] getCommands(Geometry input, int scale) {
|
private static int[] getCommands(Geometry input, int scale) {
|
||||||
var encoder = new CommandEncoder(scale);
|
var encoder = new CommandEncoder(scale);
|
||||||
|
@ -599,6 +599,11 @@ public class VectorTile {
|
||||||
return layers.values().stream().allMatch(v -> v.encodedFeatures.isEmpty()) || containsOnlyFillsOrEdges();
|
return layers.values().stream().allMatch(v -> v.encodedFeatures.isEmpty()) || containsOnlyFillsOrEdges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call back to {@code layerStats} as vector tile features are being encoded in
|
||||||
|
* {@link #addLayerFeatures(String, List)} to track attribute types present on features in each layer, for example to
|
||||||
|
* emit in tilejson metadata stats.
|
||||||
|
*/
|
||||||
public void trackLayerStats(LayerAttrStats.Updater.ForZoom layerStats) {
|
public void trackLayerStats(LayerAttrStats.Updater.ForZoom layerStats) {
|
||||||
this.layerStatsTracker = layerStats;
|
this.layerStatsTracker = layerStats;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,7 @@ public class LayerAttrStats {
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Shortcut for tests */
|
||||||
void accept(String layer, int zoom, String key, Object value) {
|
void accept(String layer, int zoom, String key, Object value) {
|
||||||
handlerForThread().forZoom(zoom).forLayer(layer).accept(key, value);
|
handlerForThread().forZoom(zoom).forLayer(layer).accept(key, value);
|
||||||
}
|
}
|
||||||
|
@ -160,7 +161,7 @@ public class LayerAttrStats {
|
||||||
|
|
||||||
interface ForZoom {
|
interface ForZoom {
|
||||||
|
|
||||||
ForZoom NO_OP = layer -> (key, value) -> {
|
ForZoom NOOP = layer -> (key, value) -> {
|
||||||
};
|
};
|
||||||
|
|
||||||
ForLayer forLayer(String layer);
|
ForLayer forLayer(String layer);
|
||||||
|
@ -171,7 +172,7 @@ public class LayerAttrStats {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class StatsForLayer {
|
private static class StatsForLayer {
|
||||||
|
|
||||||
private final String layer;
|
private final String layer;
|
||||||
private final Map<String, FieldType> fields = new HashMap<>();
|
private final Map<String, FieldType> fields = new HashMap<>();
|
||||||
|
|
Ładowanie…
Reference in New Issue