private StreamingRenderer setupMap(SimpleFeatureSource fs, String styleFile) throws IOException { Style style = RendererBaseTest.loadStyle(this, styleFile); return setupMap(fs, style); }
public void testDisplacementSouth() throws Exception { Style style = RendererBaseTest.loadStyle(this, "displacementMode/textDisplacementS.sld"); BufferedImage image = renderLabels(fs, style, "Label South Displacement"); // ImageIO.write(image, "PNG", new // File("./src/test/resources/org/geotools/renderer/lite/test-data/displacementMode/textDisplacementVerticalBoth1.png")); String refPath = "./src/test/resources/org/geotools/renderer/lite/test-data/displacementMode/textDisplacementS.png"; ImageAssert.assertEquals(new File(refPath), image, 800); }
public void testDisplacementSW() throws Exception { Style style = RendererBaseTest.loadStyle(this, "displacementMode/textDisplacementSW.sld"); BufferedImage image = renderLabels(fs, style, "Label SW Displacement"); // ImageIO.write(image, "PNG", new // File("./src/test/resources/org/geotools/renderer/lite/test-data/displacementMode/textDisplacementVerticalBoth1.png")); String refPath = "./src/test/resources/org/geotools/renderer/lite/test-data/displacementMode/textDisplacementSW.png"; ImageAssert.assertEquals(new File(refPath), image, 800); }
public void testDisplacementE_NE() throws Exception { Style style = RendererBaseTest.loadStyle(this, "displacementMode/textDisplacementE_NE.sld"); BufferedImage image = renderLabels(fs, style, "Label E or NE Displacement"); // ImageIO.write(image, "PNG", new // File("./src/test/resources/org/geotools/renderer/lite/test-data/displacementMode/textDisplacementVerticalBoth1.png")); String refPath = "./src/test/resources/org/geotools/renderer/lite/test-data/displacementMode/textDisplacementE_NE.png"; ImageAssert.assertEquals(new File(refPath), image, 800); }
public void testAutoWrap() throws Exception { Style style = RendererBaseTest.loadStyle(this, "textWrapEnabled.sld"); BufferedImage image = renderLabels(fs, style, "Label wrap enabled"); String refPath = "./src/test/resources/org/geotools/renderer/lite/test-data/textWrapEnabled.png"; ImageAssert.assertEquals(new File(refPath), image, 3000); }
public void testDisplacementStandard() throws Exception { Style style = RendererBaseTest.loadStyle(this, "displacementMode/textDisplacementStandard.sld"); BufferedImage image = renderLabels(fs, style, "Label Default Displacement"); // ImageIO.write(image, "PNG", new // File("./src/test/resources/org/geotools/renderer/lite/test-data/displacementMode/textDisplacementStandard1.png")); String refPath = "./src/test/resources/org/geotools/renderer/lite/test-data/displacementMode/textDisplacementStandard.png"; ImageAssert.assertEquals(new File(refPath), image, 800); }
public void testDisplacementWest() throws Exception { Style style = RendererBaseTest.loadStyle(this, "displacementMode/textDisplacementW.sld"); BufferedImage image = renderLabels(fs, style, "Label West Displacement"); // ImageIO.write(image, "PNG", new // File("./src/test/resources/org/geotools/renderer/lite/test-data/displacementMode/textDisplacementVerticalBoth1.png")); String refPath = "./src/test/resources/org/geotools/renderer/lite/test-data/displacementMode/textDisplacementW.png"; ImageAssert.assertEquals(new File(refPath), image, 800); }
public void testDisplacementSE() throws Exception { Style style = RendererBaseTest.loadStyle(this, "displacementMode/textDisplacementSE.sld"); BufferedImage image = renderLabels(fs, style, "Label SE Displacement"); // ImageIO.write(image, "PNG", new // File("./src/test/resources/org/geotools/renderer/lite/test-data/displacementMode/textDisplacementVerticalBoth1.png")); String refPath = "./src/test/resources/org/geotools/renderer/lite/test-data/displacementMode/textDisplacementSE.png"; ImageAssert.assertEquals(new File(refPath), image, 800); }
@Test public void testReprojectedPolygonFromSLD() throws Exception { // same as above, but with the style in SLD form Style style = RendererBaseTest.loadStyle(this, "spatialFilter.sld"); content.addLayer(new FeatureLayer(pointFS, style)); RendererBaseTest.showRender("Reprojected polygon from SLD", renderer, TIME, bounds); assertEquals(1, renderedIds.size()); assertEquals("point.4", renderedIds.iterator().next()); }
private StreamingRenderer setupMap(String styleFile) throws IOException { Style gStyle = RendererBaseTest.loadStyle(this, styleFile); Style lStyle = RendererBaseTest.loadStyle(this, "lineGray.sld"); MapContent mc = new MapContent(); mc.addLayer(new FeatureLayer(lineFS, lStyle)); mc.addLayer(new FeatureLayer(pointFS, gStyle)); StreamingRenderer renderer = new StreamingRenderer(); renderer.setMapContent(mc); renderer.setJava2DHints(new RenderingHints(KEY_ANTIALIASING, VALUE_ANTIALIAS_ON)); return renderer; }
public void testPartialLineLabelTrue() throws Exception { // System.setProperty("java.awt.headless", "false"); Thread.sleep(1000); Style style = RendererBaseTest.loadStyle(this, "partialLineLabelTrue.sld"); DefaultMapContext mc = new DefaultMapContext(DefaultGeographicCRS.WGS84); mc.addLayer(fs_line, style); renderer.setContext(mc); final BufferedImage image = RendererBaseTest.renderImage(renderer, bounds, null); // RenderedImageBrowser.showChain(image); RendererBaseTest.assertPixel(image, 150, 1, Color.BLACK, 30); }
@Test public void testLabelShieldMultiline() throws Exception { Style style = RendererBaseTest.loadStyle(this, "textLabelShield.sld"); MapContent mc = new MapContent(); mc.addLayer(new FeatureLayer(fs_multiline, style)); renderer.setMapContent(mc); BufferedImage image = RendererBaseTest.showRender("Labels and shield", renderer, TIME, bounds); String refPath = "./src/test/resources/org/geotools/renderer/lite/test-data/textLabelShieldMultiline.png"; ImageAssert.assertEquals(new File(refPath), image, 1200); }
@Test public void testDynamicSize() throws Exception { Style style = RendererBaseTest.loadStyle(this, "externalGraphicDynamicSize.sld"); MetaBufferEstimator estimator = new MetaBufferEstimator(); style.accept(estimator); assertFalse(estimator.isEstimateAccurate()); }
@Test public void testStartEnd() throws Exception { Style style = RendererBaseTest.loadStyle(this, "lineStartEnd.sld"); DefaultMapContext mc = new DefaultMapContext(DefaultGeographicCRS.WGS84); mc.addLayer(fs, style); StreamingRenderer renderer = new StreamingRenderer(); renderer.setContext(mc); RendererBaseTest.showRender("lineStartEnd.sld", renderer, TIME, bounds); }
@Test public void testOnlyShield() throws Exception { Style style = RendererBaseTest.loadStyle(this, "textOnlyShield.sld"); MapContent mc = new MapContent(); mc.addLayer(new FeatureLayer(fs, style)); renderer.setMapContent(mc); RendererBaseTest.showRender("Labels and shield, fontsize = 0", renderer, TIME, bounds); } }
@Test public void testLabelShield() throws Exception { Style style = RendererBaseTest.loadStyle(this, "textLabelShield.sld"); MapContent mc = new MapContent(); mc.addLayer(new FeatureLayer(fs, style)); renderer.setMapContent(mc); RendererBaseTest.showRender("Labels and shield", renderer, TIME, bounds); }
@Test public void testGraphicStroke() throws Exception { Style style = RendererBaseTest.loadStyle(this, "lineRailway.sld"); MetaBufferEstimator estimator = new MetaBufferEstimator(); style.accept(estimator); assertTrue(estimator.isEstimateAccurate()); assertEquals(10, estimator.getBuffer()); }
@Test public void testLabelShields() throws Exception { Style style = RendererBaseTest.loadStyle(this, "textLabelShield.sld"); MetaBufferEstimator estimator = new MetaBufferEstimator(); style.accept(estimator); assertTrue(estimator.isEstimateAccurate()); assertEquals(32, estimator.getBuffer()); }
@Test public void testExternalGraphicRectangleResized() throws Exception { Style style = RendererBaseTest.loadStyle(this, "externalGraphicRectImage.sld"); MetaBufferEstimator estimator = new MetaBufferEstimator(); style.accept(estimator); assertTrue(estimator.isEstimateAccurate()); // 32x64 image to size 16x32 should give the max. of width/height assertEquals(32, estimator.getBuffer()); }
@Test public void testInlineContent() throws Exception { Style style = RendererBaseTest.loadStyle(this, "base64.sld"); MetaBufferEstimator estimator = new MetaBufferEstimator(); style.accept(estimator); assertTrue(estimator.isEstimateAccurate()); assertEquals(16, estimator.getBuffer()); }