@Test @Ignore("Depends on karttamoottori.maanmittauslaitos.fi, doesn't test anything") public void testPNG() throws ServiceException, IOException, NoSuchAuthorityCodeException, FactoryException { PrintRequest request = new PrintRequest(); request.setFormat(PrintFormat.PNG); request.setEast(500000); request.setNorth(6750000); request.setSrsName("EPSG:3067"); request.setWidth(512); request.setHeight(512); request.setResolution(2); request.setUser(new User()); OskariLayer ortokuva_vaaravari = new OskariLayer(); ortokuva_vaaravari.setId(1); ortokuva_vaaravari.setName("ortokuva_vaaravari"); ortokuva_vaaravari.setType(OskariLayer.TYPE_WMTS); ortokuva_vaaravari.setVersion("1.0.0"); ortokuva_vaaravari.setUrl("https: ortokuva_vaaravari.setStyle("default"); OskariLayer kiinteistotunnukset = new OskariLayer(); kiinteistotunnukset.setId(2); kiinteistotunnukset.setName("kiinteistotunnukset"); kiinteistotunnukset.setType(OskariLayer.TYPE_WMTS); kiinteistotunnukset.setVersion("1.0.0"); kiinteistotunnukset.setUrl("https: kiinteistotunnukset.setStyle("default"); PrintLayer bg = new PrintLayer(0); bg.setOskariLayer(ortokuva_vaaravari); bg.setOpacity(100); PrintLayer fg = new PrintLayer(1); fg.setOskariLayer(kiinteistotunnukset); fg.setOpacity(100); OskariLayer rakennus = new OskariLayer(); rakennus.setId(3); rakennus.setName("rakennus"); rakennus.setType(OskariLayer.TYPE_WFS); rakennus.setVersion("3.0.0"); rakennus.setUrl("http: PrintLayer fg2 = new PrintLayer(2); fg2.setOskariLayer(rakennus); fg2.setOpacity(80); fg2.setStyle("default"); request.setLayers(Arrays.asList(bg, fg, fg2)); String dataBg = CapabilitiesCacheService.getFromService(bg.getUrl(), bg.getType(), bg.getVersion(), bg.getUsername(), bg.getPassword()); OskariLayerCapabilities answerBg = new OskariLayerCapabilities(1L, bg.getUrl(), bg.getType(), bg.getVersion(), dataBg, null, null); String dataFg = CapabilitiesCacheService.getFromService(fg.getUrl(), fg.getType(), fg.getVersion(), fg.getUsername(), fg.getPassword()); OskariLayerCapabilities answerFg = new OskariLayerCapabilities(1L, fg.getUrl(), fg.getType(), fg.getVersion(), dataFg, null, null); CapabilitiesCacheService mock = Mockito.mock(CapabilitiesCacheService.class); Mockito.when(mock.getCapabilities(bg.getUrl(), bg.getType(), bg.getVersion(), bg.getUsername(), bg.getPassword())).thenReturn(answerBg); Mockito.when(mock.getCapabilities(fg.getUrl(), fg.getType(), fg.getVersion(), fg.getUsername(), fg.getPassword())).thenReturn(answerFg); WMTSCapabilitiesCache cache = new WMTSCapabilitiesCache(mock); PrintService service = new PrintService(cache); BufferedImage img = service.getPNG(request); File file = File.createTempFile("print-test", ".png"); ImageIO.write(img, "png", file); Desktop.getDesktop().open(file); }
public BufferedImage getPNG(PrintRequest request) throws ServiceException { return PNG.getBufferedImage(request, wmtsCapsCache, featureClient); }
PrintService { public BufferedImage getPNG(PrintRequest request) throws ServiceException { return PNG.getBufferedImage(request, wmtsCapsCache, featureClient); } }
PrintService { public BufferedImage getPNG(PrintRequest request) throws ServiceException { return PNG.getBufferedImage(request, wmtsCapsCache, featureClient); } PrintService();  PrintService(OskariFeatureClient featureClient);  PrintService(WMTSCapabilitiesCache wmtsCapsCache);  PrintService(WMTSCapabilitiesCache wmtsCapsCache, OskariFeatureClient featureClient); }
PrintService { public BufferedImage getPNG(PrintRequest request) throws ServiceException { return PNG.getBufferedImage(request, wmtsCapsCache, featureClient); } PrintService();  PrintService(OskariFeatureClient featureClient);  PrintService(WMTSCapabilitiesCache wmtsCapsCache);  PrintService(WMTSCapabilitiesCache wmtsCapsCache, OskariFeatureClient featureClient); BufferedImage getPNG(PrintRequest request); void getPDF(PrintRequest request, PDDocument doc); }
PrintService { public BufferedImage getPNG(PrintRequest request) throws ServiceException { return PNG.getBufferedImage(request, wmtsCapsCache, featureClient); } PrintService();  PrintService(OskariFeatureClient featureClient);  PrintService(WMTSCapabilitiesCache wmtsCapsCache);  PrintService(WMTSCapabilitiesCache wmtsCapsCache, OskariFeatureClient featureClient); BufferedImage getPNG(PrintRequest request); void getPDF(PrintRequest request, PDDocument doc);  }