public virtual void testOGCPolygonWithHole() { com.esri.core.geometry.Polygon p = new com.esri.core.geometry.Polygon(); p.startPath(100.0, 0.0); p.lineTo(100.0, 1.0); p.lineTo(101.0, 1.0); p.lineTo(101.0, 0.0); p.closePathWithLine(); p.startPath(100.2, 0.2); p.lineTo(100.8, 0.2); p.lineTo(100.8, 0.8); p.lineTo(100.2, 0.8); p.closePathWithLine(); com.esri.core.geometry.ogc.OGCPolygon ogcPolygon = new com.esri.core.geometry.ogc.OGCPolygon (p, null); string result = ogcPolygon.asGeoJson(); NUnit.Framework.Assert.AreEqual("{\"type\":\"Polygon\",\"coordinates\":[[[100.0,0.0],[100.0,1.0],[101.0,1.0],[101.0,0.0],[100.0,0.0]],[[100.2,0.2],[100.8,0.2],[100.8,0.8],[100.2,0.8],[100.2,0.2]]]}" , result); }
public virtual void testPolygonWithHoleGeometryEngine() { com.esri.core.geometry.Polygon p = new com.esri.core.geometry.Polygon(); p.startPath(100.0, 0.0); //clockwise exterior p.lineTo(100.0, 1.0); p.lineTo(101.0, 1.0); p.lineTo(101.0, 0.0); p.closePathWithLine(); p.startPath(100.2, 0.2); //counterclockwise hole p.lineTo(100.8, 0.2); p.lineTo(100.8, 0.8); p.lineTo(100.2, 0.8); p.closePathWithLine(); string result = com.esri.core.geometry.GeometryEngine.geometryToGeoJson(p); NUnit.Framework.Assert.AreEqual("{\"type\":\"Polygon\",\"coordinates\":[[[100.0,0.0],[100.0,1.0],[101.0,1.0],[101.0,0.0],[100.0,0.0]],[[100.2,0.2],[100.8,0.2],[100.8,0.8],[100.2,0.8],[100.2,0.2]]]}" , result); }
public virtual void testPolygonWithHole() { com.esri.core.geometry.Polygon p = new com.esri.core.geometry.Polygon(); //exterior ring - has to be clockwise for Esri p.startPath(100.0, 0.0); p.lineTo(100.0, 1.0); p.lineTo(101.0, 1.0); p.lineTo(101.0, 0.0); p.closePathWithLine(); //hole - counterclockwise for Esri p.startPath(100.2, 0.2); p.lineTo(100.8, 0.2); p.lineTo(100.8, 0.8); p.lineTo(100.2, 0.8); p.closePathWithLine(); com.esri.core.geometry.OperatorExportToGeoJson exporter = (com.esri.core.geometry.OperatorExportToGeoJson )factory.getOperator(com.esri.core.geometry.Operator.Type.ExportToGeoJson); string result = exporter.execute(p); NUnit.Framework.Assert.AreEqual("{\"type\":\"Polygon\",\"coordinates\":[[[100.0,0.0],[100.0,1.0],[101.0,1.0],[101.0,0.0],[100.0,0.0]],[[100.2,0.2],[100.8,0.2],[100.8,0.8],[100.2,0.8],[100.2,0.2]]]}" , result); }
public virtual void testPolygonGeometryEngine() { com.esri.core.geometry.Polygon p = new com.esri.core.geometry.Polygon(); p.startPath(100.0, 0.0); p.lineTo(101.0, 0.0); p.lineTo(101.0, 1.0); p.lineTo(100.0, 1.0); p.closePathWithLine(); string result = com.esri.core.geometry.GeometryEngine.geometryToGeoJson(p); NUnit.Framework.Assert.AreEqual("{\"type\":\"Polygon\",\"coordinates\":[[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]]]}" , result); }
public virtual void testPolygon() { com.esri.core.geometry.Polygon p = new com.esri.core.geometry.Polygon(); p.startPath(100.0, 0.0); p.lineTo(101.0, 0.0); p.lineTo(101.0, 1.0); p.lineTo(100.0, 1.0); p.closePathWithLine(); com.esri.core.geometry.OperatorExportToGeoJson exporter = (com.esri.core.geometry.OperatorExportToGeoJson )factory.getOperator(com.esri.core.geometry.Operator.Type.ExportToGeoJson); string result = exporter.execute(p); NUnit.Framework.Assert.AreEqual("{\"type\":\"Polygon\",\"coordinates\":[[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]]]}" , result); }