Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/map/PrintMap.java @ 5362:6d80318e8858
merge
author | Bettina Gruenbauer <bettina@intevation.de> |
---|---|
date | Thu, 21 Mar 2013 16:29:54 +0100 |
parents | 4a76da133144 |
children |
rev | line source |
---|---|
2328
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.map; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.awt.Color; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 import java.awt.Rectangle; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import java.io.File; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import java.io.IOException; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import java.awt.Graphics2D; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import java.awt.image.BufferedImage; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import java.util.List; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import java.net.URL; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import java.net.MalformedURLException; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 import javax.imageio.ImageIO; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 import org.geotools.data.ows.Layer; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 import org.geotools.data.ows.WMSCapabilities; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 import org.geotools.data.wms.WebMapServer; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 import org.geotools.geometry.jts.ReferencedEnvelope; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 import org.geotools.map.MapContext; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 import org.geotools.map.WMSMapLayer; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 import org.geotools.ows.ServiceException; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 import org.geotools.renderer.lite.StreamingRenderer; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 import org.geotools.renderer.GTRenderer; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 public class PrintMap { |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 public static final String DEFAULT_WMS = "http://map1.naturschutz.rlp.de/service_lanis/mod_wms/wms_getmap.php?mapfile=group_gdide&REQUEST=GetCapabilities&SERVICE=WMS"; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 public static final String DEFAULT_OUTFILE = "~/map.jpeg"; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 public static final String MAPSERVER = System.getProperty("wms", DEFAULT_WMS); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 public static final String MAP_IMAGE = System.getProperty("outfile", DEFAULT_OUTFILE); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 public static void main(String[] args) { |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 System.out.println("-> start PrintMap"); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 System.out.println(" -> Print layers of WMS: " + MAPSERVER); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 try { |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 WebMapServer server = getMapserver(); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 WMSMapLayer[] wmsLayer = getWMSLayers(server); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 MapContext mapcontent = new MapContext( wmsLayer ); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 mapcontent.setTitle(" NEW MAP CONTENT TITLE "); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 printMap(mapcontent); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 } |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 catch (Exception e) { |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 e.printStackTrace(); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 } |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 System.out.println("-> finished PrintMap"); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 } |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 public static void printMap(MapContext map) throws Exception { |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 int imageWidth = 600; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 GTRenderer renderer = new StreamingRenderer(); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 renderer.setContext(map); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 Rectangle imageBounds = null; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 ReferencedEnvelope mapBounds = null; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 try { |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 mapBounds = map.getLayerBounds(); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 double heightToWidth = mapBounds.getSpan(1) / mapBounds.getSpan(0); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 imageBounds = new Rectangle( |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 0, 0, |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 imageWidth, |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 (int) Math.round(imageWidth * heightToWidth)); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 } |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 catch (Exception e) { |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 // failed to access map layers |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 throw new RuntimeException(e); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 } |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 BufferedImage image = new BufferedImage(imageBounds.width, imageBounds.height, BufferedImage.TYPE_INT_RGB); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 Graphics2D gr = image.createGraphics(); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 gr.setPaint(Color.WHITE); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 gr.fill(imageBounds); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 try { |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 renderer.paint(gr, imageBounds, mapBounds); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 File fileToSave = new File(MAP_IMAGE); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 ImageIO.write(image, "jpeg", fileToSave); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 } |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 catch (IOException e) { |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 throw new RuntimeException(e); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 } |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 } |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 public static WebMapServer getMapserver() throws MalformedURLException, IOException, ServiceException { |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 return new WebMapServer(getServerUrl()); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 } |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 public static URL getServerUrl() throws MalformedURLException { |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 return new URL(MAPSERVER); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 } |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 public static WMSMapLayer[] getWMSLayers(WebMapServer server) { |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 if (server == null) { |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 System.out.println("WebMapServer == null"); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 throw new RuntimeException("WebMapServer == null"); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 } |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 WMSCapabilities capabilities = server.getCapabilities(); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 List<Layer> layers = capabilities.getLayerList(); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 WMSMapLayer[] wmslayers = new WMSMapLayer[layers.size()]; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 |
3087
4a76da133144
Removed repeated x.size() calls from for loops.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3083
diff
changeset
|
121 for (int i = 0, L = layers.size(); i < L; i++) { |
2328
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 Layer l = layers.get(i); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 System.out.println(" -> add layer: " + l); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 wmslayers[i] = new WMSMapLayer(server, l); |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 } |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 return wmslayers; |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 } |
0cc0e232fa35
Added standalone demo application that prints all layers of a WMS to file.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 } |
3083
4bd3d8bbb60c
Added missing vim lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2328
diff
changeset
|
131 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |