Package org.geomajas.puregwt.client.spatial

Examples of org.geomajas.puregwt.client.spatial.Matrix


  // ------------------------------------------------------------------------
  // MapResizedHandler implementation:
  // ------------------------------------------------------------------------

  public void onMapResized(MapResizedEvent event) {
    Matrix translation = viewPort.getTranslationMatrix(RenderSpace.WORLD, RenderSpace.SCREEN);
    int dx = (int) Math.round(translation.getDx());
    int dy = (int) Math.round(translation.getDy());
    htmlContainer.setTop(dy);
    htmlContainer.setLeft(dx);
    vectorContainer.transform(translation);

    for (int i = 0; i < layersModel.getLayerCount(); i++) {
View Full Code Here


  // ------------------------------------------------------------------------
  // ViewPortChangedHandler implementation:
  // ------------------------------------------------------------------------

  public void onViewPortChanged(ViewPortChangedEvent event) {
    Matrix translation = viewPort.getTranslationMatrix(RenderSpace.WORLD, RenderSpace.SCREEN);
    int dx = (int) Math.round(translation.getDx());
    int dy = (int) Math.round(translation.getDy());
    htmlContainer.setTop(dy);
    htmlContainer.setLeft(dx);
    vectorContainer.transform(translation);

    for (int i = 0; i < layersModel.getLayerCount(); i++) {
View Full Code Here

      }
    }
  }

  public void onViewPortScaled(ViewPortScaledEvent event) {
    Matrix translation = viewPort.getTranslationMatrix(RenderSpace.WORLD, RenderSpace.SCREEN);
    int dx = (int) Math.round(translation.getDx());
    int dy = (int) Math.round(translation.getDy());
    htmlContainer.setTop(dy);
    htmlContainer.setLeft(dx);
    vectorContainer.transform(translation);

    for (int i = 0; i < layersModel.getLayerCount(); i++) {
View Full Code Here

      }
    }
  }

  public void onViewPortTranslated(ViewPortTranslatedEvent event) {
    Matrix translation = viewPort.getTranslationMatrix(RenderSpace.WORLD, RenderSpace.SCREEN);
    int dx = (int) Math.round(translation.getDx());
    int dy = (int) Math.round(translation.getDy());
    htmlContainer.setTop(dy);
    htmlContainer.setLeft(dx);
    vectorContainer.transform(translation);

    for (int i = 0; i < layersModel.getLayerCount(); i++) {
View Full Code Here

    viewPort.applyBounds(viewPort.getMaximumBounds());
  }

  @Test
  public void testTranslationMatrix() {
    Matrix matrix = viewPort.getTranslationMatrix(RenderSpace.SCREEN, RenderSpace.SCREEN);
    Assert.assertEquals(Matrix.IDENTITY, matrix);
    matrix = viewPort.getTranslationMatrix(RenderSpace.WORLD, RenderSpace.WORLD);
    Assert.assertEquals(Matrix.IDENTITY, matrix);

    matrix = viewPort.getTranslationMatrix(RenderSpace.WORLD, RenderSpace.SCREEN);
    Assert.assertEquals(1.0, matrix.getXx(), DELTA);
    Assert.assertEquals(1.0, matrix.getYy(), DELTA);
    Assert.assertEquals(0.0, matrix.getXy(), DELTA);
    Assert.assertEquals(0.0, matrix.getYx(), DELTA);
    Assert.assertEquals(MAP_WIDTH / 2, matrix.getDx(), DELTA);
    Assert.assertEquals(MAP_HEIGHT / 2, matrix.getDy(), DELTA);
  }
View Full Code Here

    Assert.assertEquals(MAP_HEIGHT / 2, matrix.getDy(), DELTA);
  }

  @Test
  public void testTransformationMatrix() {
    Matrix matrix = viewPort.getTransformationMatrix(RenderSpace.SCREEN, RenderSpace.SCREEN);
    Assert.assertEquals(Matrix.IDENTITY, matrix);
    matrix = viewPort.getTransformationMatrix(RenderSpace.WORLD, RenderSpace.WORLD);
    Assert.assertEquals(Matrix.IDENTITY, matrix);

    matrix = viewPort.getTransformationMatrix(RenderSpace.WORLD, RenderSpace.SCREEN);
    Assert.assertEquals(viewPort.getScale(), matrix.getXx(), DELTA);
    Assert.assertEquals(-viewPort.getScale(), matrix.getYy(), DELTA);
    Assert.assertEquals(0.0, matrix.getXy(), DELTA);
    Assert.assertEquals(0.0, matrix.getYx(), DELTA);
    Assert.assertEquals(MAP_WIDTH / 2, matrix.getDx(), DELTA);
    Assert.assertEquals(MAP_HEIGHT / 2, matrix.getDy(), DELTA);

    // Now move the map:
    viewPort.applyScale(viewPort.getScale() * 4);
    viewPort.applyPosition(new Coordinate(10, 10));
    matrix = viewPort.getTransformationMatrix(RenderSpace.WORLD, RenderSpace.SCREEN);
    Assert.assertEquals(viewPort.getScale(), matrix.getXx(), DELTA);
    Assert.assertEquals(-viewPort.getScale(), matrix.getYy(), DELTA);
    Assert.assertEquals(0.0, matrix.getXy(), DELTA);
    Assert.assertEquals(0.0, matrix.getYx(), DELTA);
    Assert.assertEquals((MAP_WIDTH / 2) - (viewPort.getScale() * 10), matrix.getDx(), DELTA);
    Assert.assertEquals((MAP_HEIGHT / 2) + (viewPort.getScale() * 10), matrix.getDy(), DELTA);
  }
View Full Code Here

TOP

Related Classes of org.geomajas.puregwt.client.spatial.Matrix

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.