Package org.geomajas.gwt.client.map.event

Examples of org.geomajas.gwt.client.map.event.MapViewChangedEvent


    mapView.addMapViewChangedHandler(this);
  }

  public void onMapViewChanged(MapViewChangedEvent event) {
    if (active) {
      MapViewChangedEvent peek = previous.peek();
      if ((null != peek && sameEvent(event, peek)) || event.isPanDragging()) {
        return;
      }
      previous.addFirst(event);
      while (previous.size() > MAX_STACK_SIZE) {
View Full Code Here


  public void zoomNext() {
    if (hasNext()) {
      if (zoomPrevious != null && zoomPrevious.isDisabled()) {
        zoomPrevious.setDisabled(false);
      }
      MapViewChangedEvent data = next.remove();
      previous.addFirst(data);
      active = false;
      mapView.applyBounds(data.getBounds(), MapView.ZoomOption.LEVEL_CLOSEST);
      if (zoomNext != null && !hasNext()) {
        zoomNext.setDisabled(true);
      }
    }
  }
View Full Code Here

    if (hasPrevious()) {
      if (zoomNext != null && zoomNext.isDisabled()) {
        zoomNext.setDisabled(false);
      }
      next.addFirst(previous.remove());
      MapViewChangedEvent data = previous.peek();
      active = false;
      mapView.applyBounds(data.getBounds(), MapView.ZoomOption.LEVEL_CLOSEST);
      if (zoomPrevious != null && !hasPrevious()) {
        zoomPrevious.setDisabled(true);
      }
    }
  }
View Full Code Here

  /** Fire an event. */
  private void fireEvent(boolean resized, ZoomOption option) {
    // keep old semantics of sameScaleLevel for api compatibility !
    boolean sameScale = lastViewState != null && viewState.isPannableFrom(lastViewState);
    handlerManager.fireEvent(new MapViewChangedEvent(getBounds(), getCurrentScale(), sameScale, viewState
        .isPanDragging(), resized, option));
  }
View Full Code Here

    public void onMapViewChanged(MapViewChangedEvent event) {
      actualEvents.add(event);
    }

    public void expect(Bbox bounds, double scale, boolean panning) {
      MapViewChangedEvent event = new MapViewChangedEvent(bounds, scale, panning, false, false, null);
      expectedEvents.add(event);
    }
View Full Code Here

    }

    public void validate() {
      for (MapViewChangedEvent expected : expectedEvents) {
        Assert.assertFalse("Expected event " + expected + " but got nothing", actualEvents.isEmpty());
        MapViewChangedEvent actual = actualEvents.remove(0);
        Assert.assertEquals(expected.getScale(), actual.getScale(), delta);
        Assert.assertTrue("Expected " + expected.getBounds() + " but was " + actual.getBounds()
            + " for precision " + (delta), expected.getBounds().equals(actual.getBounds(), delta));
        Assert.assertEquals(expected.isSameScaleLevel(), actual.isSameScaleLevel());
      }
      Assert.assertTrue(actualEvents.size() + " unexpected events", actualEvents.isEmpty());
    }
View Full Code Here

TOP

Related Classes of org.geomajas.gwt.client.map.event.MapViewChangedEvent

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.