Search in sources :

Example 1 with CachedExternal

use of org.geotoolkit.display2d.style.CachedExternal in project geotoolkit by Geomatys.

the class StyleCacheTest method externalCacheTest.

@Test
public void externalCacheTest() throws Exception {
    final ExternalGraphic ext = SF.externalGraphic("/org/geotoolkit/display2d/sample.svg", "image/svg");
    CachedExternal cached = CachedExternal.cache(ext);
    assertFalse(cached.isStatic());
    assertEquals(VisibilityState.VISIBLE, cached.isStaticVisible());
    assertTrue(cached.isVisible(null));
    BufferedImage buffer = cached.getImage(Float.NaN, 1, null);
    assertNotNull(buffer);
    assertEquals(buffer.getWidth(), 12);
    assertEquals(buffer.getHeight(), 12);
    buffer = cached.getImage(null, 1, null);
    assertEquals(buffer.getWidth(), 12);
    assertEquals(buffer.getHeight(), 12);
    buffer = cached.getImage(24f, 1, null);
    assertEquals(buffer.getWidth(), 24);
    assertEquals(buffer.getHeight(), 24);
}
Also used : CachedExternal(org.geotoolkit.display2d.style.CachedExternal) ExternalGraphic(org.opengis.style.ExternalGraphic) BufferedImage(java.awt.image.BufferedImage) Test(org.junit.Test)

Aggregations

BufferedImage (java.awt.image.BufferedImage)1 CachedExternal (org.geotoolkit.display2d.style.CachedExternal)1 Test (org.junit.Test)1 ExternalGraphic (org.opengis.style.ExternalGraphic)1