Esempio n. 1
0
        public virtual void TestOGCPolygonWithHole()
        {
            com.epl.geometry.Polygon p = new com.epl.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.epl.geometry.ogc.OGCPolygon ogcPolygon = new com.epl.geometry.ogc.OGCPolygon(p, null);
            string result = ogcPolygon.AsGeoJson();

            NUnit.Framework.Assert.AreEqual("{\"type\":\"Polygon\",\"coordinates\":[[[100,0],[101,0],[101,1],[100,1],[100,0]],[[100.2,0.2],[100.2,0.8],[100.8,0.8],[100.8,0.2],[100.2,0.2]]],\"crs\":null}", result);
        }
Esempio n. 2
0
        public virtual void TestPolygonWithHoleGeometryEngine()
        {
            com.epl.geometry.Polygon p = new com.epl.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.epl.geometry.GeometryEngine.GeometryToGeoJson(p);

            NUnit.Framework.Assert.AreEqual("{\"type\":\"Polygon\",\"coordinates\":[[[100,0],[101,0],[101,1],[100,1],[100,0]],[[100.2,0.2],[100.2,0.8],[100.8,0.8],[100.8,0.2],[100.2,0.2]]]}", result);
        }
Esempio n. 3
0
        public virtual void TestPolygonWithHole()
        {
            com.epl.geometry.Polygon p = new com.epl.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.epl.geometry.OperatorExportToGeoJson exporter = (com.epl.geometry.OperatorExportToGeoJson)factory.GetOperator(com.epl.geometry.Operator.Type.ExportToGeoJson);
            string result = exporter.Execute(p);

            NUnit.Framework.Assert.AreEqual("{\"type\":\"Polygon\",\"coordinates\":[[[100,0],[101,0],[101,1],[100,1],[100,0]],[[100.2,0.2],[100.2,0.8],[100.8,0.8],[100.8,0.2],[100.2,0.2]]]}", result);
        }
Esempio n. 4
0
        public virtual void TestPolygonGeometryEngine()
        {
            com.epl.geometry.Polygon p = new com.epl.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.epl.geometry.GeometryEngine.GeometryToGeoJson(p);

            NUnit.Framework.Assert.AreEqual("{\"type\":\"Polygon\",\"coordinates\":[[[100,0],[100,1],[101,1],[101,0],[100,0]]]}", result);
        }
Esempio n. 5
0
        public virtual void TestPolygon()
        {
            com.epl.geometry.Polygon p = new com.epl.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.epl.geometry.OperatorExportToGeoJson exporter = (com.epl.geometry.OperatorExportToGeoJson)factory.GetOperator(com.epl.geometry.Operator.Type.ExportToGeoJson);
            string result = exporter.Execute(p);

            NUnit.Framework.Assert.AreEqual("{\"type\":\"Polygon\",\"coordinates\":[[[100,0],[100,1],[101,1],[101,0],[100,0]]]}", result);
        }