Ejemplo n.º 1
0
  public void runAccessibilityComputation() {

    final Network network = (Network) this.scenario.getNetwork();

    ProgressBar bar = new ProgressBar(this.measuringPoints.getZones().size());

    for (Zone<Id<Zone>> measurePoint : this.measuringPoints.getZones()) {

      bar.update();

      Coord coord = MGC.point2Coord(measurePoint.getGeometry().getCentroid());
      Point p = measurePoint.getGeometry().getCentroid();
      final Coord coord1 = coord;

      Link nearestLink = NetworkUtils.getNearestLinkExactly(network, coord1);
      final Coord coord2 = coord;
      Node nearestNode = NetworkUtils.getNearestNode(network, coord2);

      Distances distance =
          NetworkUtil.getDistances2NodeViaGivenLink(coord, nearestLink, nearestNode);
      double distanceMeasuringPoint2Road_meter = distance.getDistancePoint2Intersection();

      double walkTravelTime_h =
          distanceMeasuringPoint2Road_meter
              / this.walkSpeedMeterPerHour; // travel time from coord to network (node or link)

      if (boundary.contains(p)) this.freeSpeedGrid.setValue(walkTravelTime_h, p);
    }
  }
Ejemplo n.º 2
0
 private Coord findClosestBuildingFromCoord(Coord coord) {
   Coord closest = coord;
   Coord ii = coord;
   double closestDistance = Double.MAX_VALUE;
   for (String key : this.buildingsMap.keySet()) {
     ii = MGC.point2Coord(this.buildingsMap.get(key).getCentroid());
     double distance = CoordUtils.calcDistance(ii, coord);
     if (distance < closestDistance) {
       closestDistance = distance;
       closest = ii;
     }
   }
   return closest;
 }