@@ -39,11 +39,13 @@ public class Polygon implements Shape {
3939 public final PreparedGeometry prepPolygon ;
4040 public final boolean rectangle ;
4141 public final Envelope envelope ;
42+ public final BBox bbox ;
4243
4344 public Polygon (PreparedPolygon prepPolygon ) {
4445 this .prepPolygon = prepPolygon ;
4546 this .rectangle = prepPolygon .getGeometry ().isRectangle ();
4647 this .envelope = prepPolygon .getGeometry ().getEnvelopeInternal ();
48+ this .bbox = BBox .fromEnvelope (envelope );
4749 }
4850
4951 public Polygon (double [] lats , double [] lons ) {
@@ -61,6 +63,7 @@ public Polygon(double[] lats, double[] lons) {
6163 this .prepPolygon = new PreparedPolygon (factory .createPolygon (new PackedCoordinateSequence .Double (coordinates , 2 )));
6264 this .rectangle = prepPolygon .getGeometry ().isRectangle ();
6365 this .envelope = prepPolygon .getGeometry ().getEnvelopeInternal ();
66+ this .bbox = BBox .fromEnvelope (envelope );
6467 }
6568
6669 public static Polygon create (org .locationtech .jts .geom .Polygon polygon ) {
@@ -84,7 +87,7 @@ public boolean contains(double lat, double lon) {
8487
8588 @ Override
8689 public BBox getBounds () {
87- return new BBox ( envelope . getMinX (), envelope . getMaxX (), envelope . getMinY (), envelope . getMaxY ()) ;
90+ return bbox ;
8891 }
8992
9093 public double getMinLat () {
0 commit comments