Package org.onebusaway.transit_data_federation.model

Examples of org.onebusaway.transit_data_federation.model.ShapePoints


    AgencyAndId shapeId = activeTrip.getShapeId();

    if (shapeId == null)
      return null;

    ShapePoints shapePoints = _shapePointService.getShapePointsForShapeId(shapeId);

    if (shapePoints == null || shapePoints.isEmpty())
      return null;

    /**
     * We allow callers of this method to specify an arbitrarily high
     * shapePointIndexTo, knowing we'll bound it by the max number of points
     */
    shapePointIndexFrom = Math.min(shapePointIndexFrom, shapePoints.getSize());
    shapePointIndexTo = Math.min(shapePointIndexTo, shapePoints.getSize());

    double distanceAlongTrip = distanceAlongBlock
        - activeBlockTrip.getDistanceAlongBlock();

    ShapePointIndex shapePointIndexMethod = new DistanceTraveledShapePointIndex(
View Full Code Here


    // A trip without stop times is a trip we don't care about
    if (stopTimes.isEmpty())
      return null;

    ShapePoints shapePoints = null;

    if (trip.getShapeId() != null)
      shapePoints = _shapePointsHelper.getShapePointsForShapeId(trip.getShapeId());

    Agency agency = trip.getRoute().getAgency();
    TimeZone tz = TimeZone.getTimeZone(agency.getTimezone());
    LocalizedServiceId lsid = new LocalizedServiceId(trip.getServiceId(), tz);

    TripEntryImpl tripEntry = new TripEntryImpl();

    tripEntry.setId(trip.getId());
    tripEntry.setDirectionId(unique(trip.getDirectionId()));
    tripEntry.setServiceId(unique(lsid));

    // Only set the shape id for a trip if there are actually shape points to
    // back it up
    if (!(shapePoints == null || shapePoints.isEmpty()))
      tripEntry.setShapeId(unique(trip.getShapeId()));

    List<StopTimeEntryImpl> stopTimesForTrip = _stopTimeEntriesFactory.processStopTimes(
        graph, stopTimes, tripEntry, shapePoints);
View Full Code Here

    Set<AgencyAndId> allShapeIds = getAllShapeIds();

    for (AgencyAndId shapeId : allShapeIds) {

      ShapePoints shapePoints = _shapePointHelper.getShapePointsForShapeId(shapeId);

      for (int i = 0; i < shapePoints.getSize(); i++) {

        double lat = shapePoints.getLatForIndex(i);
        double lon = shapePoints.getLonForIndex(i);

        addGridCellForShapePoint(shapeIdsByGridCellCorner, lat, lon, latStep,
            lonStep, shapeId);

        /**
         * If there is a particularly long stretch between shape points, we want
         * to fill in grid cells in-between
         */
        if (i > 0) {
          double prevLat = shapePoints.getLatForIndex(i - 1);
          double prevLon = shapePoints.getLonForIndex(i - 1);
          double totalDistance = SphericalGeometryLibrary.distance(prevLat,
              prevLon, lat, lon);
          for (double d = _gridSize; d < totalDistance; d += _gridSize) {
            double r = d / totalDistance;
            double latPart = (lat - prevLat) * r + prevLat;
View Full Code Here

    for (AgencyAndId shapeId : shapeIds) {
      if (index % 10 == 0)
        _log.info("shapes=" + index);
      index++;
      ShapePoints shapePoints = _shapePointsHelper.getShapePointsForShapeId(shapeId);
      provider.setShapePointsForId(shapeId, shapePoints);
    }
  }
View Full Code Here

        AgencyAndId shapeId = trip.getShapeId();

        if (shapeId == null)
          continue;

        ShapePoints shapePoints = provider.getShapePointsForId(shapeId);

        if (shapePoints == null)
          continue;

        int shapePointIndex = stopTime.getShapePointIndex();

        if (shapePointIndex == -1)
          continue;

        ShapeIdAndDistance key = new ShapeIdAndDistance(shapeId,
            stopTime.getShapeDistTraveled());

        PointAndOrientation orientation = orientationsByKey.get(key);

        if (orientation == null) {

          int indexFrom = Math.max(0, shapePointIndex - 5);
          int indexTo = Math.min(shapePoints.getSize(), shapePointIndex + 5);

          ShapePointIndex shapePointIndexMethod = new DistanceTraveledShapePointIndex(
              stopTime.getShapeDistTraveled(), indexFrom, indexTo);

          orientation = shapePointIndexMethod.getPointAndOrientation(shapePoints);
View Full Code Here

    _gtfsDao = gtfsDao;
  }

  public ShapePoints getShapePointsForShapeId(AgencyAndId shapeId) {

    ShapePoints shapePoints = _cache.get(shapeId);
    if (shapePoints == null) {
      shapePoints = getShapePointsForShapeIdNonCached(shapeId);
      _cache.put(shapeId, shapePoints);
    }
    return shapePoints;
View Full Code Here

      lat[i] = shapePoint.getLat();
      lon[i] = shapePoint.getLon();
      i++;
    }

    ShapePoints result = new ShapePoints();
    result.setShapeId(shapeId);
    result.setLats(lat);
    result.setLons(lon);
    result.setDistTraveled(distTraveled);

    result.ensureDistTraveled();

    return result;
  }
View Full Code Here

  }

  public void run(String shapeFile, String stopsFile) throws IOException,
      DistanceAlongShapeException {

    ShapePoints shapePoints = readShapePoints(shapeFile);
    List<StopTimeEntryImpl> stopTimes = readStopTimes(stopsFile);

    DistanceAlongShapeLibrary library = new DistanceAlongShapeLibrary();
    PointAndIndex[] points = library.getDistancesAlongShape(shapePoints,
        stopTimes);
View Full Code Here

TOP

Related Classes of org.onebusaway.transit_data_federation.model.ShapePoints

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.