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

The following examples show how to use com.esri.core.geometry.ogc.OGCGeometry#makeSimple() . 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
Source Project: geometry-api-java   File: TestOGC.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testPolylineSimplifyIssueGithub52() throws Exception {
	String json = "{\"paths\":[[[2,0],[4,3],[5,1],[3.25,1.875],[1,3]]],\"spatialReference\":{\"wkid\":4326}}";
	{
		OGCGeometry g = OGCGeometry.fromJson(json);
		assertTrue(g.geometryType().equals("LineString"));
		OGCGeometry simpleG = g.makeSimple();//make ogc simple
		assertTrue(simpleG.geometryType().equals("MultiLineString"));			
		assertTrue(simpleG.isSimpleRelaxed());//geodatabase simple
		assertTrue(simpleG.isSimple());//ogc simple
		OGCMultiLineString mls =(OGCMultiLineString)simpleG;
		assertTrue(mls.numGeometries() == 4);
		OGCGeometry baseGeom = OGCGeometry.fromJson("{\"paths\":[[[2,0],[3.25,1.875]],[[3.25,1.875],[4,3],[5,1]],[[5,1],[3.25,1.875]],[[3.25,1.875],[1,3]]],\"spatialReference\":{\"wkid\":4326}}");
		assertTrue(simpleG.equals(baseGeom));
		
	}
}