Skip to content

Commit 03752fa

Browse files
committed
Geometry expand envelope method
1 parent 7762305 commit 03752fa

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Adheres to [Semantic Versioning](http://semver.org/).
77
## 2.0.5 (TBD)
88

99
* GeometryEnvelope range, point check, centroid, and build geometry utilities
10+
* Geometry expand envelope method
1011
* Centroid geometry utility for geometries in degrees
1112
* Java 11
1213

src/main/java/mil/nga/sf/Geometry.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,17 @@ public GeometryEnvelope getEnvelope() {
142142
return GeometryEnvelopeBuilder.buildEnvelope(this);
143143
}
144144

145+
/**
146+
* Expand the envelope with the minimum bounding box for this Geometry
147+
*
148+
* @param envelope
149+
* geometry envelope to expand
150+
* @since 2.0.5
151+
*/
152+
public void expandEnvelope(GeometryEnvelope envelope) {
153+
GeometryEnvelopeBuilder.buildEnvelope(this, envelope);
154+
}
155+
145156
/**
146157
* Get the inherent dimension (0, 1, or 2) for this Geometry
147158
*

src/test/java/mil/nga/sf/GeometryUtilsTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import org.junit.Test;
1010

1111
import junit.framework.TestCase;
12-
import mil.nga.sf.util.GeometryEnvelopeBuilder;
1312
import mil.nga.sf.util.GeometryUtils;
1413

1514
/**
@@ -173,8 +172,7 @@ private Point geometryCentroidTester(Geometry geometry) throws IOException {
173172
Point point = GeometryUtils.getCentroid(geometry);
174173
TestCase.assertEquals(point, geometry.getCentroid());
175174

176-
GeometryEnvelope envelope = GeometryEnvelopeBuilder
177-
.buildEnvelope(geometry);
175+
GeometryEnvelope envelope = geometry.getEnvelope();
178176

179177
if (geometry.getGeometryType() == GeometryType.POINT) {
180178
TestCase.assertEquals(envelope.getMinX(), point.getX());

0 commit comments

Comments
 (0)