示例#1
0
    /**
     * Asks the MapQuest API to generate the map-image url.
     *
     * @return
     */
    public URL getTileUrl() {
      try {
        int scale = (int) MQSource.scaleList[zoomLevel.getZoomLevel()];

        // the map is generated by the center coordinate
        double lon = getCenterLon(scale);
        double lat = getCenterLat(scale);

        MQAPIWrapper apiWrapper = mqSource.getApiWrapper();

        String mapImageUrl =
            apiWrapper.getUrl(scale, lon, lat, MQSource.TILESIZE_WIDTH, MQSource.TILESIZE_HEIGHT);

        return new URL(null, mapImageUrl, CorePlugin.RELAXED_HANDLER);

      } catch (Exception e) {
        WMTPlugin.log(
            "[MQTile] Could not create the url for tile (Zoom: "
                + zoomLevel.getZoomLevel()
                + //$NON-NLS-1$
                ", X: "
                + getX()
                + ", "
                + getY(),
            e); //$NON-NLS-1$ //$NON-NLS-2$
      }

      return null;
    }
示例#2
0
 public MQTileName getLowerNeighbour() {
   return new MQTileName(
       getX(),
       WMTTileName.arithmeticMod((getY() - 1), zoomLevel.getMaxTilePerColNumber()),
       zoomLevel,
       mqSource);
 }
示例#3
0
 public MQTileName getRightNeighbour() {
   return new MQTileName(
       WMTTileName.arithmeticMod((getX() + 1), zoomLevel.getMaxTilePerRowNumber()),
       getY(),
       zoomLevel,
       mqSource);
 }
示例#4
0
    @Override
    public boolean equals(Object obj) {
      if (!(obj instanceof MQTileName)) return false;

      MQTileName other = (MQTileName) obj;

      return (getX() == other.getX())
          && (getY() == other.getY())
          && zoomLevel.equals(other.zoomLevel);
    }
示例#5
0
 public String toString() {
   return zoomLevel.getZoomLevel() + "/" + getX() + "/" + getY(); // $NON-NLS-1$ //$NON-NLS-2$
 }