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"));
}
Aggregations