Package org.geomajas.gwt.client.gfx.paintable.mapaddon

Examples of org.geomajas.gwt.client.gfx.paintable.mapaddon.ScaleBar.initialize()


    if (scaleBarEnabled) {
      ScaleBar scalebar = new ScaleBar("scalebar", this);
      scalebar.setVerticalAlignment(VerticalAlignment.BOTTOM);
      scalebar.setHorizontalMargin(2);
      scalebar.setVerticalMargin(2);
      scalebar.initialize(getMapModel().getMapInfo().getDisplayUnitType(), unitLength, new Coordinate(20,
          graphics.getHeight() - 25));
      scalebar.adjustScale(mapModel.getMapView().getCurrentScale());
      registerMapAddon(scalebar);
    } else {
      unregisterMapAddon(addons.get(scaleBarId));
View Full Code Here


public class ScaleBarTest {

  @Test
  public void testGetBestFitMetric() throws Exception {
    ScaleBar sb = new ScaleBar("scaleBar", null);
    sb.initialize(UnitType.METRIC, 1.0d, null);

    sb.calculateBestFit(3.779527559055119); // 1:1000 (96 dpi), best fit is 25 meters for 125 pixels
    Assert.assertTrue("should be same units", 25 == sb.getWidthInUnits());
    Assert.assertTrue("should be same units", 94 == sb.getWidthInPixels());
View Full Code Here

  }

  @Test
  public void testGetBestFitEnglish() throws Exception {
    ScaleBar sb = new ScaleBar("scaleBar", null);
    sb.initialize(UnitType.ENGLISH, 1.0d, null);

    sb.calculateBestFit(3.779527559055119); // 1:1000 (96 dpi), best fit is 25 meters for 125 pixels
    Assert.assertFalse("Should be yards", sb.getWidthInUnitsIsMiles());
    Assert.assertTrue("should be same units", 25 == sb.getWidthInUnits());
    Assert.assertTrue("should be same pixels", 86 == sb.getWidthInPixels());
View Full Code Here

  // gwt formatter doesn't work for unittesting (not initialized)
  @Ignore
  @Test
  public void testformatUnitsMetric() throws Exception {
    ScaleBar sb = new ScaleBar("scaleBar", null);
    sb.initialize(UnitType.METRIC, 1.0d, null);
    sb.calculateBestFit(3.779527559055119);

    Assert.assertEquals("should be same", "25 m", sb.formatUnits(25));
    Assert.assertEquals("should be same", "25.1 km", sb.formatUnits(25100));
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.