Examples of calculateBestFit()


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

  @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());

    sb.calculateBestFit(0.003779527559055119); // 1:1000000 (96 dpi)
    Assert.assertTrue("should be same units", 25000 == sb.getWidthInUnits());
View Full Code Here

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

    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());

    sb.calculateBestFit(0.003779527559055119); // 1:1000000 (96 dpi)
    Assert.assertTrue("should be same units", 25000 == sb.getWidthInUnits());
    Assert.assertTrue("should be same units", 94 == sb.getWidthInPixels());
  }

  @Test
View Full Code Here

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

  @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());

    sb.calculateBestFit(0.003779527559055119); // 1:1000000 (96 dpi)
View Full Code Here

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

    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());

    sb.calculateBestFit(0.003779527559055119); // 1:1000000 (96 dpi)
    Assert.assertTrue("Should be yards", sb.getWidthInUnitsIsMiles());
    Assert.assertTrue("should be same units", 10 == sb.getWidthInUnits());
    Assert.assertTrue("should be same pixels", 61 == sb.getWidthInPixels());
  }
View Full Code Here

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

  @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.