Package org.onebusaway.gtfs.model

Examples of org.onebusaway.gtfs.model.ShapePoint


     * which we do not want.
     */
    private List<ShapePoint> getUniqueShapePointsForShapeId(AgencyAndId shapeId) {
        List<ShapePoint> points = _dao.getShapePointsForShapeId(shapeId);
        ArrayList<ShapePoint> filtered = new ArrayList<ShapePoint>(points.size());
        ShapePoint last = null;
        for (ShapePoint sp : points) {
            if (last == null || last.getSequence() != sp.getSequence()) {
                if (last != null &&
                    last.getLat() == sp.getLat() &&
                    last.getLon() == sp.getLon()) {
                    LOG.trace("pair of identical shape points (skipping): {} {}", last, sp);
                } else {
                    filtered.add(sp);
                }
            }
View Full Code Here


    return shapePoints;
  }

  public static ShapePoint shapePoint(String id, int sequence, double lat,
      double lon) {
    ShapePoint point = new ShapePoint();
    point.setId(sequence);
    point.setSequence(sequence);
    point.setLat(lat);
    point.setLon(lon);
    point.setShapeId(aid(id));
    return point;
  }
View Full Code Here

    GtfsRelationalDao gtfsDao = Mockito.mock(GtfsRelationalDao.class);
    helper.setGtfsRelationalDao(gtfsDao);

    AgencyAndId shapeId = new AgencyAndId("1", "shapeA");

    ShapePoint p1 = point(47.652300128129454, -122.30622018270873);
    ShapePoint p2 = point(47.653181844549394, -122.30523312979125);
    ShapePoint p3 = point(47.654265901710744, -122.30511511259459);
    List<ShapePoint> points = Arrays.asList(p1, p2, p3);

    Mockito.when(gtfsDao.getShapePointsForShapeId(shapeId)).thenReturn(points);

    ShapePoints shapePoints = helper.getShapePointsForShapeId(shapeId);
View Full Code Here

    // The second call should be cached
    Mockito.verify(gtfsDao, Mockito.times(1)).getShapePointsForShapeId(shapeId);
  }

  private ShapePoint point(double lat, double lon) {
    ShapePoint point = new ShapePoint();
    point.setLat(lat);
    point.setLon(lon);
    return point;
  }
View Full Code Here

  }

  private List<ShapePoint> deduplicateShapePoints(List<ShapePoint> shapePoints) {

    List<ShapePoint> deduplicated = new ArrayList<ShapePoint>();
    ShapePoint prev = null;

    for (ShapePoint shapePoint : shapePoints) {
      if (prev == null
          || !(prev.getLat() == shapePoint.getLat() && prev.getLon() == shapePoint.getLon())) {
        deduplicated.add(shapePoint);
      }
      prev = shapePoint;
    }
View Full Code Here

TOP

Related Classes of org.onebusaway.gtfs.model.ShapePoint

Copyright © 2018 www.massapicom. 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.