Java Code Examples for com.esri.core.geometry.ogc.OGCGeometry#centroid()

The following examples show how to use com.esri.core.geometry.ogc.OGCGeometry#centroid() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
private static void assertCentroid(String wkt, Point expectedCentroid) {
	OGCGeometry geometry = OGCGeometry.fromText(wkt);
	OGCGeometry centroid = geometry.centroid();
	Assert.assertEquals(((OGCPoint)centroid).X(), expectedCentroid.getX(), 1e-13);
	Assert.assertEquals(((OGCPoint)centroid).Y(), expectedCentroid.getY(), 1e-13);
}
 
Example 2
private static void assertEmptyCentroid(String wkt) {
	OGCGeometry geometry = OGCGeometry.fromText(wkt);
	OGCGeometry centroid = geometry.centroid();
	Assert.assertEquals(centroid, new OGCPoint(new Point(), geometry.getEsriSpatialReference()));
}