Package org.geomajas.gwt.client.spatial

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


  // @extract-end

  // @extract-start DefaultSelectLocation, Default implementation for SelectLocationHandler
  public void onSelectLocation(SelectLocationEvent event) {
    org.geomajas.geometry.Bbox bbox = event.getBbox();
    map.getMapModel().getMapView().applyBounds(new Bbox(bbox), MapView.ZoomOption.LEVEL_FIT);
    geocoderWidget.setValue(event.getCanonicalLocation());
  }
View Full Code Here


              LineString line = mapModel.getGeometryFactory().createLineString(coordinates);
              graphics.drawLine(parentGroup, "style" + lineCount, line, style);
            } else if (vLayer.getLayerInfo().getLayerType() == LayerType.POLYGON
                || vLayer.getLayerInfo().getLayerType() == LayerType.MULTIPOLYGON) {
              // Polygons: draw a rectangle:
              Bbox rect = new Bbox(10, y, 16, 16);
              graphics.drawRectangle(parentGroup, "style" + lineCount, rect, style);
            } else if (vLayer.getLayerInfo().getLayerType() == LayerType.POINT
                || vLayer.getLayerInfo().getLayerType() == LayerType.MULTIPOINT) {
              // Points: draw a symbol:
              graphics.drawSymbol(parentGroup, "style" + lineCount, new Coordinate(18, y + 8), style,
                  styleInfo.getStyleId());
            }

            // After the style, draw the style's name:
            Coordinate textPosition = new Coordinate(30, y - 2);
            graphics.drawText(parentGroup, "text" + lineCount, styleInfo.getName(), textPosition,
                fontStyle);
            y += 21;
          }
        } else if (layer instanceof RasterLayer) {
          // For raster layers; show a nice symbol:
          lineCount++;

          graphics.drawImage(parentGroup, "style" + lineCount, Geomajas.getIsomorphicDir()
              + "geomajas/osgeo/layer-raster.png", new Bbox(10, y, 16, 16), new PictureStyle(1));
          Coordinate textPosition = new Coordinate(30, y - 2);
          graphics.drawText(parentGroup, "text" + lineCount, layer.getLabel(), textPosition, fontStyle);
          y += 20;
        }
      }
View Full Code Here

    double dy = Math.round((tile.getCache().getLayerBounds().getY() - panOrigin.getY()) * scale) / scale;
    // this gives the difference between integer positions and floating positions
    dx = dx  - (tile.getCache().getLayerBounds().getX() - panOrigin.getX());
    dy = dy  - (tile.getCache().getLayerBounds().getY() - panOrigin.getY());
    // now apply to our bounds
    Bbox  worldBounds = new Bbox(tile.getBounds());
    worldBounds.translate(-dx, -dy);
    // transform to pan space and round
    Bbox panBounds = mapView.getWorldViewTransformer().worldToPan(worldBounds);
    return new Bbox(Math.round(panBounds.getX()), Math.round(panBounds.getY()), Math.round(panBounds.getWidth()),
        Math.round(panBounds.getHeight()));
  }
View Full Code Here

  @Override
  public void onMouseUp(MouseUpEvent event) {

    if (NativeEvent.BUTTON_LEFT == event.getNativeButton()) {
      Bbox currView = mapWidget.getMapModel().getMapView().getBounds();
      double w = currView.getWidth() / 3;
      double h = currView.getHeight() / 3;

      mapWidget.getMapModel().getMapView().translate(direction.getX() * w, direction.getY() * h);
      event.stopPropagation();
    }
  }
 
View Full Code Here

      // no point trying to select when there is no active layer
      dragging = true;
      leftWidget = false;
      timestamp = new Date().getTime();
      begin = getScreenPosition(event);
      bounds = new Bbox(begin.getX(), begin.getY(), 0.0, 0.0);
      shift = event.isShiftKeyDown();
      rectangle = new Rectangle("selectionRectangle");
      rectangle.setStyle(rectangleStyle);
      rectangle.setBounds(bounds);
      mapWidget.render(rectangle, RenderGroup.SCREEN, RenderStatus.UPDATE);
View Full Code Here

    dragging = false;
    shift |= event.isShiftKeyDown(); // shift is used when depressed either at beginning or end
    updateRectangle(event);

    WorldViewTransformer transformer = new WorldViewTransformer(mapWidget.getMapModel().getMapView());
    Bbox worldBounds = transformer.viewToWorld(bounds);
    selectRectangle(worldBounds);

    mapWidget.render(rectangle, RenderGroup.SCREEN, RenderStatus.DELETE);
  }
View Full Code Here

  public void setCoordinate(Coordinate coordinate) {
    if (coordinate == null) {
      throw new IllegalArgumentException("Can't snap to a null coordinate.");
    }
    this.coordinate = coordinate;
    bounds = new Bbox(coordinate.getX() - rule.getDistance(), coordinate.getY() - rule.getDistance(), rule
        .getDistance() * 2, rule.getDistance() * 2);
    distance = Double.MAX_VALUE;
    snappedCoordinate = coordinate;
  }
View Full Code Here

      VectorLayerStore featureStore = ((VectorLayer) selectedLayer).getFeatureStore();
      featureStore.getFeatures(GeomajasConstant.FEATURE_INCLUDE_GEOMETRY, new LazyLoadCallback() {

        public void execute(List<Feature> features) {
          boolean success = false;
          Bbox selectionBounds = new Bbox(0, 0, 0, 0);
          for (Feature feature : features) {
            // if the feature is selected union the bounding box
            if (feature.isSelected()) {
              selectionBounds = selectionBounds.union(feature.getGeometry().getBounds());
              success = true;
            }
          }

          // only zoom when their where really some items selected
View Full Code Here

      VectorLayerStore featureStore = ((VectorLayer) selectedLayer).getFeatureStore();
      featureStore.getFeatures(GeomajasConstant.FEATURE_INCLUDE_GEOMETRY, new LazyLoadCallback() {

        public void execute(List<Feature> response) {
          boolean success = false;
          Bbox selectionBounds = new Bbox(0, 0, 0, 0);
          for (Feature feature : response) {
            // if the feature is selected union the bounding box
            if (feature.isSelected()) {
              selectionBounds = selectionBounds.union(feature.getGeometry().getBounds());
              success = true;
            }
          }

          // only pan when their where really some items selected
          if (success) {
            mapWidget.getMapModel().getMapView().setCenterPosition(selectionBounds.getCenterPoint());
          }
        }
      });
    }
  }
View Full Code Here

  /**
   * Zoom in to the double-clicked position.
   */
  public void onDoubleClick(DoubleClickEvent event) {
    // Zoom in on the event location.
    Bbox bounds = mapWidget.getMapModel().getMapView().getBounds();
    double x = lastClickPosition.getX() - (bounds.getWidth() / 4);
    double y = lastClickPosition.getY() - (bounds.getHeight() / 4);
    Bbox newBounds = new Bbox(x, y, bounds.getWidth() / 2, bounds.getHeight() / 2);
    mapWidget.getMapModel().getMapView().applyBounds(newBounds, ZoomOption.LEVEL_CHANGE);
  }
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.