Package org.geomajas.gwt.client.spatial

Examples of org.geomajas.gwt.client.spatial.Bbox


      addClickHandler(this);
      setWidth(150);
    }

    public void onClick(ClickEvent event) {
      Bbox bounds = getFeature().getGeometry().getBounds();
      mapModel.getMapView().applyBounds(bounds, ZoomOption.LEVEL_FIT);
    }
View Full Code Here


   *            The model of layers and features behind a map. This layer will be a part of this model.
   * @param layerInfo client layer descriptor
   */
  public VectorLayer(MapModel mapModel, ClientVectorLayerInfo layerInfo) {
    super(mapModel, layerInfo);
    Bbox maxExtent = new Bbox(layerInfo.getMaxExtent());
    cache = new TileCache(this, maxExtent);
  }
View Full Code Here

   *            After zooming, this point will still be on the same position in the view as before.
   */
  public void setCurrentScale(final double newScale, final ZoomOption option, final Coordinate rescalePoint) {
    saveState();
    // calculate theoretical new bounds
    Bbox newBbox = new Bbox(0, 0, getWidth() / newScale, getHeight() / newScale);

    double factor = newScale / getCurrentScale();

    // Calculate translate vector to assure rescalePoint is on the same
    // position as before.
    double dX = (rescalePoint.getX() - viewState.getX()) * (1 - 1 / factor);
    double dY = (rescalePoint.getY() - viewState.getY()) * (1 - 1 / factor);

    newBbox.setCenterPoint(new Coordinate(viewState.getX(), viewState.getY()));
    newBbox.translate(dX, dY);
    // and apply...
    doApplyBounds(newBbox, option);
  }
View Full Code Here

   * @param newHeight
   *            The map's height.
   */
  public void setSize(int newWidth, int newHeight) {
    saveState();
    Bbox oldbbox = getBounds();
    this.width = newWidth;
    this.height = newHeight;
    if (viewState.getScale() < getMinimumScale()) {
      // The new scale is too low, re-apply old values:
      double scale = getBestScale(oldbbox);
      doSetScale(snapToResolution(scale, ZoomOption.LEVEL_FIT), ZoomOption.LEVEL_FIT);
      doSetOrigin(oldbbox.getCenterPoint());
      fireEvent(true, null);
    } else {
      // Use the same center point for the new bounds, but don't zoom in or out.
      doSetOrigin(oldbbox.getCenterPoint());
      fireEvent(true, null);
    }
  }
View Full Code Here

  public Bbox getBounds() {
    double w = getViewSpaceWidth();
    double h = getViewSpaceHeight();
    double x = viewState.getX() - w / 2;
    double y = viewState.getY() - h / 2;
    return new Bbox(x, y, w, h);
  }
View Full Code Here

  }

  public Image(RasterTile raster) {
    super(raster.getId());
    href = raster.getUrl();
    original = new Bbox(raster.getBounds());
    style = new PictureStyle(1);
  }
View Full Code Here

      // replace layers by new layers
      removeAllLayers();
      for (ClientLayerInfo layerInfo : mapInfo.getLayers()) {
        addLayer(layerInfo);
      }
      Bbox maxBounds = new Bbox(mapInfo.getMaxBounds());
      Bbox initialBounds = new Bbox(mapInfo.getInitialBounds());
      // if the max bounds was not configured, take the union of initial and layer bounds
      if (maxBounds.isAll()) {
        for (ClientLayerInfo layerInfo : mapInfo.getLayers()) {
          maxBounds = (Bbox) initialBounds.clone();
          maxBounds = maxBounds.union(new Bbox(layerInfo.getMaxExtent()));
        }
      }
      mapView.setMaxBounds(maxBounds);
      mapView.applyBounds(initialBounds, MapView.ZoomOption.LEVEL_CLOSEST);
    }
View Full Code Here

    double tileHeight = Math.ceil((scale * layerBounds.getHeight()) / div) / scale;

    // Now calculate indexes, and return bbox:
    double x = layerBounds.getX() + tileCode.getX() * tileWidth;
    double y = layerBounds.getY() + tileCode.getY() * tileHeight;
    return new Bbox(x, y, tileWidth, tileHeight);
  }
View Full Code Here

    if (tileWidth == 0 || tileHeight == 0) {
      return codes;
    }

    // Calculate bounds relative to extents:
    Bbox clippedBounds = bounds.intersection(layerBounds);
    if (clippedBounds == null) {
      // TODO throw error? If this is null, then the server configuration is incorrect.
      GWT.log("Map bounds outside of layer extents, check the server configuration");
      return codes;
    }
    double relativeBoundX = Math.abs(clippedBounds.getX() - layerBounds.getX());
    double relativeBoundY = Math.abs(clippedBounds.getY() - layerBounds.getY());
    currentMinX = (int) Math.floor(relativeBoundX / tileWidth);
    currentMinY = (int) Math.floor(relativeBoundY / tileHeight);
    currentMaxX = (int) Math.ceil((relativeBoundX + clippedBounds.getWidth()) / tileWidth) - 1;
    currentMaxY = (int) Math.ceil((relativeBoundY + clippedBounds.getHeight()) / tileHeight) - 1;

    // Now fill the list with the correct codes:
    for (int x = currentMinX; x <= currentMaxX; x++) {
      for (int y = currentMinY; y <= currentMaxY; y++) {
        codes.add(new TileCode(currentTileLevel, x, y));
View Full Code Here

    mapWidget.setContextMenu(menu);

    if (maxBoundsDisplayed) {
      VectorLayer layer = getFeatureTransaction().getLayer();
      GeometryFactory factory = mapWidget.getMapModel().getGeometryFactory();
      LinearRing hole = factory.createLinearRing(new Bbox(layer.getLayerInfo().getMaxExtent()));
      LinearRing shell = factory.createLinearRing(mapWidget.getMapModel().getMapView().getMaxBounds());
      Polygon polygon = factory.createPolygon(shell, new LinearRing[] { hole });

      maxExtent = new GfxGeometry("maxExtent");
      maxExtent.setGeometry(polygon);
View Full Code Here

TOP

Related Classes of org.geomajas.gwt.client.spatial.Bbox

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.