Tabnine Logo
org.geomajas.layer.tile
Code IndexAdd Tabnine to your IDE (free)

How to use org.geomajas.layer.tile

Best Java code snippets using org.geomajas.layer.tile (Showing top 20 results out of 315)

origin: org.geomajas/geomajas-api

/**
 * Convert to readable string.
 *
 * @return readable string
 */
public String toString() {
  if (code == null) {
    return "[bounds=" + bounds + ",url=" + url + "]";
  }
  return "[z=" + code.getTileLevel() + ",x=" + code.getX() + ",y=" + code.getY() + ",bounds=" + bounds + ",url="
      + url + "]";
}
origin: org.geomajas/geomajas-api

/**
 * Create a clone from this object.
 *
 * @return cloned tile code
 */
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "CN_IDIOM_NO_SUPER_CALL",
    justification = "needed for GWT")
public TileCode clone() { // NOSONAR super.clone() not supported by GWT
  return new TileCode(tileLevel, x, y);
}
origin: org.geomajas/geomajas-gwt-client-impl

public VectorTilePresenter getTile(TileCode tileCode) {
  return tiles.get(tileCode.toString());
}
origin: org.geomajas.plugin/geomajas-plugin-wmsclient

private RasterTile createTile(TileCode tileCode) {
  Bbox worldBounds = tileService.getWorldBoundsForTile(layer.getViewPort(), layer.getTileConfig(), tileCode);
  RasterTile tile = new RasterTile(getScreenBounds(worldBounds), tileCode.toString());
  tile.setCode(tileCode);
  tile.setUrl(wmsService.getMapUrl(layer.getConfig(), layer.getCrs(), worldBounds, layer.getTileConfig()
      .getTileWidth(), layer.getTileConfig().getTileHeight()));
  return tile;
}
origin: org.geomajas.plugin/geomajas-client-gwt2-plugin-print-tilebasedlayer

private RasterTile toRasterTile(Tile tile) {
  RasterTile rTile = new RasterTile(tile.getBounds(), tile.getCode().toString());
  rTile.setCode(new TileCode(tile.getCode().getTileLevel(), tile.getCode().getX(), tile.getCode().getY()));
  rTile.setUrl(tile.getUrl());
  return rTile;
}
origin: org.geomajas.plugin/geomajas-layer-tms

  /**
   * @param relativeUrl just the part with level/x/y.extension
   * @return
   */
  public static TileCode parseTileCode(String relativeUrl) {
    TileCode tc = new TileCode();
    StringTokenizer tokenizer = new StringTokenizer(relativeUrl, "/");
    tc.setTileLevel(Integer.parseInt(tokenizer.nextToken()));
    tc.setX(Integer.parseInt(tokenizer.nextToken()));
    tc.setY(Integer.parseInt(tokenizer.nextToken().split("\\.")[0]));
    return tc;
  }
}
origin: org.geomajas.plugin/geomajas-plugin-printing

private boolean isYIndexUp(List<RasterTile> tiles) {
  RasterTile first = tiles.iterator().next();
  for (RasterTile tile : tiles) {
    if (tile.getCode().getY() > first.getCode().getY()) {
      return tile.getBounds().getY() > first.getBounds().getY();
    } else if (tile.getCode().getY() < first.getCode().getY()) {
      return tile.getBounds().getY() < first.getBounds().getY();
    }
  }
  return false;
}
origin: org.geomajas.plugin/geomajas-plugin-printing

private Bbox getPixelBounds(List<RasterTile> tiles) {
  Bbox bounds = null;
  int imageWidth = configurationService.getRasterLayerInfo(getLayerId()).getTileWidth();
  int imageHeight = configurationService.getRasterLayerInfo(getLayerId()).getTileHeight();
  for (RasterTile tile : tiles) {
    Bbox tileBounds = new Bbox(tile.getCode().getX() * imageWidth, tile.getCode().getY() * imageHeight,
        imageWidth, imageHeight);
    if (bounds == null) {
      bounds = new Bbox(tileBounds.getX(), tileBounds.getY(), tileBounds.getWidth(), tileBounds.getHeight());
    } else {
      double minx = Math.min(tileBounds.getX(), bounds.getX());
      double maxx = Math.max(tileBounds.getMaxX(), bounds.getMaxX());
      double miny = Math.min(tileBounds.getY(), bounds.getY());
      double maxy = Math.max(tileBounds.getMaxY(), bounds.getMaxY());
      bounds = new Bbox(minx, miny, maxx - minx, maxy - miny);
    }
  }
  return bounds;
}
origin: org.geomajas/geomajas-gwt-client-impl

protected void renderTile(RasterTile tile, Callback<String, String> callback) {
  HtmlImage image = htmlImageFactory.create(tile.getUrl(), tile.getBounds(), callback);
  container.add(image);
}
origin: org.geomajas.plugin/geomajas-plugin-printing

public RasterImageDownloadCallable(int retries, RasterTile rasterImage) {
  this.result = new ImageResult(rasterImage);
  this.retries = retries;
  String externalUrl = rasterImage.getUrl();
  url = dispatcherUrlService.localize(externalUrl);
}
origin: org.geomajas.plugin/geomajas-plugin-wmsclient

@Override
public List<RasterTile> getTiles(Bbox worldBounds) {
  List<RasterTile> result = new ArrayList<RasterTile>();
  for (RasterTile rasterTile : tiles.values()) {
    Bbox screenBounds = getScreenBounds(worldBounds);
    if (BboxService.intersects(screenBounds, rasterTile.getBounds())) {
      result.add(rasterTile);
    }
  }
  return result;
}
origin: org.geomajas/geomajas-gwt-client-impl

protected void addTiles(List<org.geomajas.layer.tile.RasterTile> rasterTiles) {
  nrLoadingTiles = 0;
  for (RasterTile tile : rasterTiles) {
    TileCode code = tile.getCode().clone();
    // Add only new tiles to the list:
    if (!tiles.containsKey(code)) {
      nrLoadingTiles++;
      // Add the tile to the list and render it:
      tiles.put(code, tile);
      renderTile(tile, new ImageCounter());
    }
  }
  deferred = null;
  renderingImages = true;
}
origin: org.geomajas/geomajas-gwt-client-impl

public VectorTilePresenter addTile(TileCode tileCode) {
  VectorTilePresenter tilePresenter = tiles.get(tileCode.toString());
  if (tilePresenter == null) {
    tilePresenter = new VectorTilePresenter(commandService, this, tileCode.clone(), scale, crs,
        new TileLoadCallback());
    nrLoadingTiles++;
    tiles.put(tileCode.toString(), tilePresenter);
  }
  return tilePresenter;
}
origin: org.geomajas.plugin/geomajas-plugin-wmsclient

@Override
public List<RasterTile> getTiles(double scale, Bbox worldBounds) {
  List<TileCode> codes = tileService.getTileCodesForBounds(getViewPort(), tileConfig, worldBounds, scale);
  List<RasterTile> tiles = new ArrayList<RasterTile>();
  if (!codes.isEmpty()) {
    double actualScale = viewPort.getZoomStrategy().getZoomStepScale(codes.get(0).getTileLevel());
    for (TileCode code : codes) {
      Bbox bounds = tileService.getWorldBoundsForTile(getViewPort(), tileConfig, code);
      RasterTile tile = new RasterTile(getScreenBounds(actualScale, bounds), code.toString());
      tile.setCode(code);
      tile.setUrl(wmsService.getMapUrl(getConfig(), getCrs(), bounds, tileConfig.getTileWidth(),
          tileConfig.getTileHeight()));
      tiles.add(tile);
    }
  }
  return tiles;
}
origin: org.geomajas.plugin/geomajas-layer-tms

@Override
public String buildUrl(TileCode tileCode, String baseTmsUrl) {
  StringBuilder builder = new StringBuilder(baseTmsUrl);
  if (!baseTmsUrl.endsWith("/")) {
    builder.append("/");
  }
  builder.append(tileCode.getTileLevel());
  builder.append("/");
  builder.append(tileCode.getX());
  builder.append("/");
  builder.append(tileCode.getY());
  builder.append(extension);
  return builder.toString();
}

origin: org.geomajas.plugin/geomajas-plugin-wmsclient

  @Override
  public TileCode getTileCodeForLocation(ViewPort viewPort, WmsTileConfiguration tileConfig, Coordinate location,
      double scale) {
    double actualScale = viewPort.getZoomStrategy().checkScale(scale, ZoomOption.LEVEL_CLOSEST);
    int tileLevel = viewPort.getZoomStrategy().getZoomStepIndex(actualScale);
    double resolution = 1 / actualScale;
    double worldTileWidth = tileConfig.getTileWidth() * resolution;
    double worldTileHeight = tileConfig.getTileHeight() * resolution;

    Coordinate tileOrigin = tileConfig.getTileOrigin();
    int x = (int) Math.floor((location.getX() - tileOrigin.getX()) / worldTileWidth);
    int y = (int) Math.floor((location.getY() - tileOrigin.getY()) / worldTileHeight);

    return new TileCode(tileLevel, x, y);
  }
}
origin: org.geomajas.plugin/geomajas-plugin-wmsclient

protected void renderTile(RasterTile tile, Callback<String, String> callback) {
  HtmlImage image = htmlImageFactory.create(tile.getUrl(), tile.getBounds(), callback);
  container.add(image);
}
origin: org.geomajas.plugin/geomajas-plugin-printing

private Bbox getWorldBounds(List<RasterTile> tiles) {
  Bbox bounds = null;
  for (RasterTile tile : tiles) {
    Bbox tileBounds = new Bbox(tile.getBounds().getX(), tile.getBounds().getY(), tile.getBounds().getWidth(),
        tile.getBounds().getHeight());
    if (bounds == null) {
      bounds = new Bbox(tileBounds.getX(), tileBounds.getY(), tileBounds.getWidth(), tileBounds.getHeight());
    } else {
      double minx = Math.min(tileBounds.getX(), bounds.getX());
      double maxx = Math.max(tileBounds.getMaxX(), bounds.getMaxX());
      double miny = Math.min(tileBounds.getY(), bounds.getY());
      double maxy = Math.max(tileBounds.getMaxY(), bounds.getMaxY());
      bounds = new Bbox(minx, miny, maxx - minx, maxy - miny);
    }
  }
  return bounds;
}
origin: org.geomajas.plugin/geomajas-plugin-wmsclient

public void render(Bbox bounds) {
  if (layer.isShowing()) {
    List<TileCode> tilesForBounds = tileService.getTileCodesForBounds(layer.getViewPort(),
        layer.getTileConfig(), bounds, scale);
    for (TileCode tileCode : tilesForBounds) {
      if (!tiles.containsKey(tileCode.toString())) {
        RasterTile tile = createTile(tileCode);
        // Add the tile to the list and render it:
        tiles.put(tileCode.toString(), tile);
        nrLoadingTiles++;
        renderTile(tile, new ImageCounter());
      }
    }
  }
}
origin: org.geomajas.plugin/geomajas-plugin-wmsclient

@Override
public Bbox getWorldBoundsForTile(ViewPort viewPort, WmsTileConfiguration tileConfig, TileCode tileCode) {
  double resolution = 1 / viewPort.getZoomStrategy().getZoomStepScale(tileCode.getTileLevel());
  double worldTileWidth = tileConfig.getTileWidth() * resolution;
  double worldTileHeight = tileConfig.getTileHeight() * resolution;
  double x = tileConfig.getTileOrigin().getX() + tileCode.getX() * worldTileWidth;
  double y = tileConfig.getTileOrigin().getY() + tileCode.getY() * worldTileHeight;
  return new Bbox(x, y, worldTileWidth, worldTileHeight);
}
org.geomajas.layer.tile

Most used classes

  • TileCode
    A unique spatial code determining the location of a tile. It implements the Serializable interface
  • RasterTile
    A raster image represents all the meta-data needed to put an image on a screen. The bounds in the m
  • VectorTile
    DTO version of an InternalTile. This object can be sent to the client.
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now