Examples of OGCPolygon


Examples of com.esri.core.geometry.ogc.OGCPolygon

        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();
        OGCPolygon ogcPolygon = new OGCPolygon(p, null);
        String result = ogcPolygon.asGeoJson();
        assertEquals("{\"type\":\"Polygon\",\"coordinates\":[[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]]]}", result);
    }
View Full Code Here

Examples of com.esri.core.geometry.ogc.OGCPolygon

        p.lineTo(100.8, 0.2);
        p.lineTo(100.8, 0.8);
        p.lineTo(100.2, 0.8);
        p.closePathWithLine();

        OGCPolygon ogcPolygon = new OGCPolygon(p, null);
        String result = ogcPolygon.asGeoJson();
        assertEquals("{\"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);
    }
View Full Code Here

Examples of com.esri.core.geometry.ogc.OGCPolygon

    assertTrue(p.Y() == 2);
    assertTrue(g.equals(OGCGeometry.fromText("POINT(1 2)")));
    assertTrue(!g.equals(OGCGeometry.fromText("POINT(1 3)")));
    OGCGeometry buf = g.buffer(10);
    assertTrue(buf.geometryType().equals("Polygon"));
    OGCPolygon poly = (OGCPolygon) buf.envelope();
    double a = poly.area();
    assertTrue(Math.abs(a - 400) < 1e-1);
  }
View Full Code Here

Examples of com.esri.core.geometry.ogc.OGCPolygon

  @Test
  public void testPolygon() {
    OGCGeometry g = OGCGeometry
        .fromText("POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10), (-5 -5, -5 5, 5 5, 5 -5, -5 -5))");
    assertTrue(g.geometryType().equals("Polygon"));
    OGCPolygon p = (OGCPolygon) g;
    assertTrue(p.numInteriorRing() == 1);
    OGCLineString ls = p.exteriorRing();
    // assertTrue(ls.pointN(1).equals(OGCGeometry.fromText("POINT(10 -10)")));
    boolean b = ls
        .equals(OGCGeometry
            .fromText("LINESTRING(-10 -10, 10 -10, 10 10, -10 10, -10 -10)"));
    assertTrue(b);
    OGCLineString lsi = p.interiorRingN(0);
    b = lsi.equals(OGCGeometry
        .fromText("LINESTRING(-5 -5, -5 5, 5 5, 5 -5, -5 -5)"));
    assertTrue(b);
    assertTrue(!lsi.equals(ls));
    OGCMultiCurve boundary = p.boundary();
    String s = boundary.asText();
    assertTrue(s.equals("MULTILINESTRING ((-10 -10, 10 -10, 10 10, -10 10, -10 -10), (-5 -5, -5 5, 5 5, 5 -5, -5 -5))"));
  }
View Full Code Here

Examples of com.esri.core.geometry.ogc.OGCPolygon

  @Test
  public void testFirstPointOfPolygon() {
    OGCGeometry g = OGCGeometry
        .fromText("POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10), (-5 -5, -5 5, 5 5, 5 -5, -5 -5))");
    assertTrue(g.geometryType().equals("Polygon"));
    OGCPolygon p = (OGCPolygon) g;
    assertTrue(p.numInteriorRing() == 1);
    OGCLineString ls = p.exteriorRing();
    OGCPoint p1 = ls.pointN(1);
    assertTrue(ls.pointN(1).equals(OGCGeometry.fromText("POINT(10 -10)")));
    OGCPoint p2 = ls.pointN(3);
    assertTrue(ls.pointN(3).equals(OGCGeometry.fromText("POINT(-10 10)")));
    OGCPoint p0 = ls.pointN(0);
View Full Code Here

Examples of com.esri.core.geometry.ogc.OGCPolygon

        OGCGeometry simpleG = g.makeSimple();
        assertTrue(simpleG.geometryType().equals("MultiPolygon"));
        assertTrue(simpleG.isSimple());
        OGCMultiPolygon mp = (OGCMultiPolygon)simpleG;
        assertTrue(mp.numGeometries() == 2);
        OGCPolygon g1 = (OGCPolygon)mp.geometryN(0);
        OGCPolygon g2 = (OGCPolygon)mp.geometryN(1);
        assertTrue((g1.numInteriorRing() == 0 && g1.numInteriorRing() == 2) ||
            (g1.numInteriorRing() == 2 && g2.numInteriorRing() == 0));
       
        OGCGeometry oldOutput = OGCGeometry.fromJson("{\"rings\":[[[-3,-3],[-3,4],[6,4],[6,-3],[-3,-3]],[[0,0],[2,0],[4,0],[4,2],[3,3],[2,2],[1,3],[0,2],[2,2],[0,0]],[[2,0],[2,2],[4,2],[2,0]]],\"spatialReference\":{\"wkid\":4326}}");
        assertTrue(oldOutput.isSimpleRelaxed());
        assertFalse(oldOutput.isSimple());
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.