Search in sources :

Example 6 with Polyline

use of com.esri.core.geometry.Polyline in project sis by apache.

the class ReaderTest method verifyRoute.

/**
 * Verifies property values for the given route.
 *
 * @param  f         the route to verify.
 * @param  v11       {@code true} for GPX 1.1, or {@code false} for GPX 1.0.
 * @param  numLinks  expected number of links.
 */
@SuppressWarnings("fallthrough")
private static void verifyRoute(final AbstractFeature f, final boolean v11, final int numLinks) {
    assertEquals("name", "Route name", f.getPropertyValue("name"));
    assertEquals("cmt", "Route comment", f.getPropertyValue("cmt"));
    assertEquals("desc", "Route description", f.getPropertyValue("desc"));
    assertEquals("src", "Route source", f.getPropertyValue("src"));
    assertEquals("type", v11 ? "Route type" : null, f.getPropertyValue("type"));
    assertEquals("number", 7, f.getPropertyValue("number"));
    final List<?> links = (List<?>) f.getPropertyValue("link");
    assertEquals("links.size()", numLinks, links.size());
    switch(numLinks) {
        // Fallthrough everywhere.
        default:
        case 3:
            assertStringEquals("http://route-address3.org", links.get(2));
        case 2:
            assertStringEquals("http://route-address2.org", links.get(1));
        case 1:
            assertStringEquals("http://route-address1.org", links.get(0));
        case 0:
            break;
    }
    final List<?> points = (List<?>) f.getPropertyValue("rtept");
    assertEquals("points.size()", 3, points.size());
    verifyPoint((AbstractFeature) points.get(0), 0, v11);
    verifyPoint((AbstractFeature) points.get(1), 1, v11);
    verifyPoint((AbstractFeature) points.get(2), 2, v11);
    final Polyline p = (Polyline) f.getPropertyValue("sis:geometry");
    assertEquals("pointCount", 3, p.getPointCount());
    assertEquals("point(0)", new Point(15, 10), p.getPoint(0));
    assertEquals("point(1)", new Point(25, 20), p.getPoint(1));
    assertEquals("point(2)", new Point(35, 30), p.getPoint(2));
    assertEnvelopeEquals(15, 35, 10, 30, (Envelope) f.getPropertyValue("sis:envelope"));
}
Also used : Polyline(com.esri.core.geometry.Polyline) List(java.util.List) Point(com.esri.core.geometry.Point)

Aggregations

Point (com.esri.core.geometry.Point)6 Polyline (com.esri.core.geometry.Polyline)6 Line (com.esri.core.geometry.Line)2 MultiPath (com.esri.core.geometry.MultiPath)2 List (java.util.List)2 Polygon (com.esri.core.geometry.Polygon)1 Segment (com.esri.core.geometry.Segment)1 OGCConcreteGeometryCollection (com.esri.core.geometry.ogc.OGCConcreteGeometryCollection)1 OGCGeometry (com.esri.core.geometry.ogc.OGCGeometry)1 OGCGeometryCollection (com.esri.core.geometry.ogc.OGCGeometryCollection)1 OGCLineString (com.esri.core.geometry.ogc.OGCLineString)1 OGCPolygon (com.esri.core.geometry.ogc.OGCPolygon)1 IOException (java.io.IOException)1 Vector (java.util.Vector)1 ExecException (org.apache.pig.backend.executionengine.ExecException)1 DataBag (org.apache.pig.data.DataBag)1 DataByteArray (org.apache.pig.data.DataByteArray)1 Tuple (org.apache.pig.data.Tuple)1 AbstractFeature (org.apache.sis.feature.AbstractFeature)1 Vector (org.apache.sis.math.Vector)1