kopia lustrzana https://github.com/onthegomap/planetiler
tweak
rodzic
916f7e81b9
commit
8d80ba3398
|
@ -50,6 +50,9 @@ public class FeatureMerge {
|
|||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(FeatureMerge.class);
|
||||
private static final BufferParameters bufferOps = new BufferParameters();
|
||||
// this is slightly faster than Comparator.comparingInt
|
||||
private static final Comparator<WithIndex<?>> BY_HILBERT_INDEX =
|
||||
(o1, o2) -> Integer.compare(o1.hilbert, o2.hilbert);
|
||||
|
||||
static {
|
||||
bufferOps.setJoinStyle(BufferParameters.JOIN_MITRE);
|
||||
|
@ -114,11 +117,6 @@ public class FeatureMerge {
|
|||
return mergeGeometries(features, GeometryType.LINE);
|
||||
}
|
||||
|
||||
private static final Comparator<WithIndex<?>> BY_HILBERT_INDEX =
|
||||
(o1, o2) -> Integer.compare(o1.hilbert(), o2.hilbert());
|
||||
|
||||
private record WithIndex<T> (T feature, int hilbert) {}
|
||||
|
||||
private static List<VectorTile.Feature> mergeGeometries(
|
||||
List<VectorTile.Feature> features,
|
||||
GeometryType geometryType
|
||||
|
@ -188,7 +186,7 @@ public class FeatureMerge {
|
|||
if (simplified instanceof LineString simpleLineString) {
|
||||
line = simpleLineString;
|
||||
} else {
|
||||
LOGGER.warn("line string merge simplify emitted " + simplified.getGeometryType());
|
||||
LOGGER.warn("line string merge simplify emitted {}", simplified.getGeometryType());
|
||||
}
|
||||
}
|
||||
if (buffer >= 0) {
|
||||
|
@ -573,4 +571,6 @@ public class FeatureMerge {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private record WithIndex<T> (T feature, int hilbert) {}
|
||||
}
|
||||
|
|
|
@ -425,7 +425,7 @@ public class VectorTile {
|
|||
* Returns the hilbert index of the zig-zag-encoded first point of {@code geometry}.
|
||||
* <p>
|
||||
* This can be useful for sorting geometries to minimize encoded vector tile geometry command size since smaller
|
||||
* values take fewer bytes using protobuf varint encoding.
|
||||
* offsets take fewer bytes using protobuf varint encoding.
|
||||
*/
|
||||
public static int hilbertIndex(Geometry geometry) {
|
||||
Coordinate coord = geometry.getCoordinate();
|
||||
|
@ -961,6 +961,12 @@ public class VectorTile {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the hilbert index of the zig-zag-encoded first point of this feature.
|
||||
* <p>
|
||||
* This can be useful for sorting geometries to minimize encoded vector tile geometry command size since smaller
|
||||
* offsets take fewer bytes using protobuf varint encoding.
|
||||
*/
|
||||
public int hilbertIndex() {
|
||||
if (commands.length < 3) {
|
||||
return 0;
|
||||
|
|
Ładowanie…
Reference in New Issue