Example #1
0
 @Override
 public Double getWeightFromLink(Link link, Coord cellCentroid) {
   Cell cellOfLink = links2Cells.get(link);
   if (cellOfLink == null) {
     return 0.0;
   } else {
     Cell receivingCell = grid.getCellForCoordinate(cellCentroid);
     return calcDistanceFactorFromCells(cellOfLink, receivingCell);
   }
 }
Example #2
0
  private Map<Link, Cell> mapLinksToGridCells(Collection<Link> links, SpatialGrid grid) {
    links2Cells = new HashMap<Link, Cell>();

    for (Link link : links) {
      Cell cCell = grid.getCellForCoordinate(link.getCoord());
      if (cCell != null) links2Cells.put(link, cCell);
    }
    System.out.println("Mapped " + links2Cells.size() + " links to grid");
    System.out.println((links.size() - links2Cells.size()) + " links were not mapped.");
    return links2Cells;
  }
Example #3
0
 @Override
 public Double getWeightFromCoord(Coord emittingCoord, Coord receivingCoord) {
   Cell emittingCell = grid.getCellForCoordinate(emittingCoord);
   Cell receivingCell = grid.getCellForCoordinate(receivingCoord);
   return calcDistanceFactorFromCells(emittingCell, receivingCell);
 }