28
28
import org .locationtech .jts .geom .Point ;
29
29
import org .locationtech .jts .geom .Polygon ;
30
30
import org .locationtech .jts .geom .Polygonal ;
31
- import org .locationtech .jts .geom .impl .PackedCoordinateSequence ;
32
31
import org .locationtech .jts .geom .util .AffineTransformation ;
33
32
import org .slf4j .Logger ;
34
33
import org .slf4j .LoggerFactory ;
39
38
*/
40
39
public class FeatureRenderer implements Consumer <FeatureCollector .Feature >, Closeable {
41
40
private static final Logger LOGGER = LoggerFactory .getLogger (FeatureRenderer .class );
42
- private static final VectorTile .VectorGeometry FILL = VectorTile .encodeGeometry (GeoUtils .JTS_FACTORY
43
- .createPolygon (GeoUtils .JTS_FACTORY .createLinearRing (new PackedCoordinateSequence .Double (new double []{
44
- -5 , -5 ,
45
- 261 , -5 ,
46
- 261 , 261 ,
47
- -5 , 261 ,
48
- -5 , -5
49
- }, 2 , 0 ))));
50
41
private final PlanetilerConfig config ;
51
42
private final Consumer <RenderedFeature > consumer ;
52
43
private final Stats stats ;
@@ -282,13 +273,13 @@ private void writeTileFeatures(int zoom, long id, FeatureCollector.Feature featu
282
273
// polygons that span multiple tiles contain detail about the outer edges separate from the filled tiles, so emit
283
274
// filled tiles now
284
275
if (feature .isPolygon ()) {
285
- emitted += emitFilledTiles (id , feature , sliced );
276
+ emitted += emitFilledTiles (zoom , id , feature , sliced );
286
277
}
287
278
288
279
stats .emittedFeatures (zoom , feature .getLayer (), emitted );
289
280
}
290
281
291
- private int emitFilledTiles (long id , FeatureCollector .Feature feature , TiledGeometry sliced ) {
282
+ private int emitFilledTiles (int zoom , long id , FeatureCollector .Feature feature , TiledGeometry sliced ) {
292
283
Optional <RenderedFeature .Group > groupInfo = Optional .empty ();
293
284
/*
294
285
* Optimization: large input polygons that generate many filled interior tiles (i.e. the ocean), the encoder avoids
@@ -298,7 +289,7 @@ private int emitFilledTiles(long id, FeatureCollector.Feature feature, TiledGeom
298
289
VectorTile .Feature vectorTileFeature = new VectorTile .Feature (
299
290
feature .getLayer (),
300
291
id ,
301
- FILL ,
292
+ VectorTile . encodeFill ( feature . getBufferPixelsAtZoom ( zoom )) ,
302
293
feature .getAttrsAtZoom (sliced .zoomLevel ())
303
294
);
304
295
0 commit comments