/** * Effectively zoom to the bounds that the user drew on the map. * * @param worldBounds * The result of the user's dragging on the map, expressed in world space. */ public void execute(Bbox worldBounds) { mapPresenter.getViewPort().applyBounds(worldBounds); } }
public AnnotationContainer(MapPresenter mapPresenter, EventBus eventBus) { super(eventBus); this.mapPresenter = mapPresenter; mapPresenter.getEventBus().addViewPortChangedHandler(this); }
/** * Apply a new scale level on the map. In case the are fixed resolutions defined on this MapView, it will * automatically snap to the nearest resolution. In case the maximum extents are exceeded, it will pan to avoid * this. * * @param scale * The preferred new scale. */ public void applyScale(final double scale) { mapView.setCurrentScale(scale, zoomOption); }
public void onClick(ClickEvent event) { int index = viewPort.getZoomStrategy().getZoomStepIndex(viewPort.getScale()); try { viewPort.applyScale(viewPort.getZoomStrategy().getZoomStepScale(index - 1)); } catch (IllegalArgumentException e) { } event.stopPropagation(); } }, ClickEvent.getType());
@Override public Coordinate transform(Coordinate coordinate, Space from, Space to) { return mapPresenter.getViewPort().transform(coordinate, convert(from), convert(to)); }
private void zoomTo(double scale, boolean isGestureEnded) { if (midPoint != null) { if (isGestureEnded) { mapPresenter.getViewPort().applyScale(scale * lastScale, midPoint); } else { mapPresenter.getViewPort().dragToScale(scale * lastScale, midPoint); } } else { if (isGestureEnded) { mapPresenter.getViewPort().applyScale(scale * lastScale); } else { mapPresenter.getViewPort().dragToScale(scale * lastScale); } } }
/** * Return the current scale on the map. */ public double getScale() { return mapView.getCurrentScale(); }
public void onGeometryEditStart(GeometryEditStartEvent event) { // Store the current controller: previousController = mapPresenter.getMapController(); mapPresenter.setMapController(baseController); }
@Override public void setSize(int width, int height) { display.setPixelSize(width, height); if (viewPort != null) { viewPort.setMapSize(width, height); } eventBus.fireEvent(new MapResizedEvent(width, height)); }
@Override public void onActivate(MapPresenter mapPresenter) { this.mapPresenter = mapPresenter; eventParser = mapPresenter.getMapEventParser(); }
private void cleanup() { if (container != null) { mapPresenter.removeVectorContainer(container); container = null; } }
private VectorContainer getContainer() { if (container == null) { container = mapPresenter.addScreenContainer(); } return container; } }
@Override public void dragToPosition(Coordinate coordinate) { position = checkPosition(coordinate, scale); if (eventBus != null) { eventBus.fireEvent(new ViewPortTranslatingEvent(this)); } }
@Override public boolean bringToFront(VectorContainer container) { return display.bringToFront(container); }
@Override public void dragToScale(double newScale, Coordinate rescalePoint) { applyScale(newScale, rescalePoint, true); }
public double checkScale(double scale, ZoomOption option) { double minimumScale = getMinimumScale(); if (scale < minimumScale) { return minimumScale; } else if (scale > maximumScale) { return maximumScale; } else { return scale; } }
public int getZoomStepCount() { int count = 0; double tempScale = getTheoreticalMinimumScale(); while (tempScale <= maximumScale) { tempScale *= ZOOM_DELTA; count++; } return count; }
public void onClick(ClickEvent event) { int index = viewPort.getZoomStrategy().getZoomStepIndex(viewPort.getScale()); try { viewPort.applyScale(viewPort.getZoomStrategy().getZoomStepScale(index + 1)); } catch (IllegalArgumentException e) { } event.stopPropagation(); } }, ClickEvent.getType());
@Override public void onActivate(MapPresenter mapPresenter) { this.mapPresenter = mapPresenter; this.eventParser = mapPresenter.getMapEventParser(); }
public void onClick(ClickEvent event) { int index = viewPort.getZoomStrategy().getZoomStepIndex(viewPort.getScale()); try { viewPort.applyScale(viewPort.getZoomStrategy().getZoomStepScale(index - 1)); } catch (IllegalArgumentException e) { } event.stopPropagation(); } }, ClickEvent.getType());