Mercurial > mxd2map
annotate src/java/de/intevation/mxd/reader/GroupLayerReader.java @ 310:be441fa4bed0
Throw an exception in case reading Raster layer fails
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 14 Sep 2012 11:50:40 +0200 |
parents | 2cb2f26d0d54 |
children |
rev | line source |
---|---|
243
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
1 /* |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
2 * Copyright (c) 2011 by Intevation GmbH, Germany <info@intevation.de> |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
3 * |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
4 * This file is part of MXD2map. |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
5 * |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
6 * This program is free software under the LGPL (>=v2.1) |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
7 * Read the file LICENCE.txt coming with the software for details |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
8 * or visit http://www.gnu.org/licenses/ if it does not exist. |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
9 * |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
10 * MXD2map has been developed on behalf of the |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
11 * Bundesamt fuer Seeschifffahrt und Hydrographie (BSH) in Hamburg |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
12 * by Intevation GmbH. |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
13 * |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
14 * Authors: |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
15 * Raimund Renkert <raimund.renkert@intevation.de> |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
16 * Bjoern Schilberg <bjoern.schilberg@intevation.de> |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
17 * Stephan Holl <stephan.holl@intevation.de> |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
18 */ |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
19 |
148
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
20 package de.intevation.mxd.reader; |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
21 |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
22 import java.io.IOException; |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
23 |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
24 import org.apache.log4j.Logger; |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
25 |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
26 import com.esri.arcgis.carto.ILayer; |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
27 import com.esri.arcgis.carto.FeatureLayer; |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
28 import com.esri.arcgis.carto.GdbRasterCatalogLayer; |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
29 import com.esri.arcgis.carto.IFeatureRenderer; |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
30 import com.esri.arcgis.carto.SimpleRenderer; |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
31 import com.esri.arcgis.carto.ClassBreaksRenderer; |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
32 import com.esri.arcgis.carto.UniqueValueRenderer; |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
33 import com.esri.arcgis.carto.GroupLayer; |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
34 |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
35 import org.w3c.dom.Element; |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
36 |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
37 import de.intevation.mxd.utils.MapToXMLUtils; |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
38 |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
39 |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
40 /** |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
41 * Reads Layer information. |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
42 * |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
43 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
44 */ |
244
276f63c86f1c
Refactored group layer handling and "wms_title" metadata.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
45 public class GroupLayerReader { |
148
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
46 |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
47 /** |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
48 * The logger. |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
49 */ |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
50 private static final Logger logger = |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
51 Logger.getLogger(FeatureLayerReader.class); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
52 |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
53 /** |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
54 * Privte member. |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
55 */ |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
56 private GroupLayer layer; |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
57 private MapToXMLUtils util; |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
58 private int invalidLayerCount; |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
59 |
181 | 60 /** |
61 * Constructor with layer. | |
62 * | |
63 * @param layer The ArcGIS layer object. | |
64 */ | |
148
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
65 public GroupLayerReader(ILayer layer) |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
66 throws Exception { |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
67 if(layer instanceof GroupLayer) { |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
68 this.layer = (GroupLayer)layer; |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
69 invalidLayerCount = 0; |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
70 } |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
71 else { |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
72 throw new Exception("Not an instance of GroupLayer: " + |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
73 layer.getClass().toString()); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
74 } |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
75 } |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
76 |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
77 /** |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
78 * Setter for XML document helper. |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
79 * |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
80 * @param util The helper for storing map information. |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
81 */ |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
82 public void setUtil(MapToXMLUtils util) { |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
83 this.util = util; |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
84 } |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
85 |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
86 /** |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
87 * Reads the Layer content. |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
88 * |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
89 * @return The layer XML element. |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
90 */ |
244
276f63c86f1c
Refactored group layer handling and "wms_title" metadata.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
91 public Element read(String group) |
148
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
92 throws IOException{ |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
93 logger.debug("read()"); |
180
f4eb506499f5
Done some code styling and removed TODOs.
Raimund Renkert <rrenkert@intevation.de>
parents:
148
diff
changeset
|
94 Element layerElement = null; |
148
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
95 for(int i = 0; i < layer.getCount();i++) { |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
96 ILayer lay = layer.getLayer(i); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
97 try { |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
98 if (lay instanceof FeatureLayer) { |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
99 FeatureLayerReader lr = new FeatureLayerReader(lay); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
100 lr.setUtil(util); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
101 layerElement = lr.read(); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
102 if (layerElement == null) { |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
103 continue; |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
104 } |
244
276f63c86f1c
Refactored group layer handling and "wms_title" metadata.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
105 layerElement.setAttribute("group", group + "/" + layer.getName()); |
148
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
106 IFeatureRenderer renderer = |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
107 ((FeatureLayer)lay).getRenderer(); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
108 IRendererReader rreader; |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
109 if(renderer instanceof SimpleRenderer) { |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
110 rreader = new SimpleRendererReader(renderer); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
111 rreader.setParent(layerElement); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
112 rreader.setUtil(util); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
113 rreader.read(); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
114 } |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
115 else if(renderer instanceof ClassBreaksRenderer) { |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
116 rreader = new ClassBreakRendererReader(renderer); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
117 rreader.setParent(layerElement); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
118 rreader.setUtil(util); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
119 rreader.read(); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
120 } |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
121 else if(renderer instanceof UniqueValueRenderer) { |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
122 rreader = new UniqueValueRendererReader(renderer); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
123 rreader.setParent(layerElement); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
124 rreader.setUtil(util); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
125 rreader.read(); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
126 } |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
127 else{ |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
128 logger.debug("Not a known renderer type " + |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
129 renderer.getClass().toString()); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
130 } |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
131 } |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
132 else if(lay instanceof GdbRasterCatalogLayer) { |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
133 GdbRasterCatalogLayerReader gclr = |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
134 new GdbRasterCatalogLayerReader(lay); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
135 gclr.setUtil(util); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
136 layerElement = gclr.read(); |
180
f4eb506499f5
Done some code styling and removed TODOs.
Raimund Renkert <rrenkert@intevation.de>
parents:
148
diff
changeset
|
137 layerElement.setAttribute("group", layer.getName()); |
148
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
138 IFeatureRenderer renderer = |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
139 ((GdbRasterCatalogLayer)lay).getRenderer(); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
140 IRendererReader rreader; |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
141 if(renderer instanceof SimpleRenderer) { |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
142 rreader = new SimpleRendererReader(renderer); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
143 rreader.setParent(layerElement); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
144 rreader.setUtil(util); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
145 rreader.read(); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
146 } |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
147 else if(renderer instanceof ClassBreaksRenderer) { |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
148 rreader = new ClassBreakRendererReader(renderer); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
149 rreader.setParent(layerElement); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
150 rreader.setUtil(util); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
151 rreader.read(); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
152 } |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
153 else if(renderer instanceof UniqueValueRenderer) { |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
154 rreader = new UniqueValueRendererReader(renderer); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
155 rreader.setParent(layerElement); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
156 rreader.setUtil(util); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
157 rreader.read(); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
158 } |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
159 else { |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
160 logger.debug("Not a known renderer type " + |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
161 renderer.getClass().toString()); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
162 } |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
163 } |
244
276f63c86f1c
Refactored group layer handling and "wms_title" metadata.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
164 else if(lay instanceof GroupLayer) { |
276f63c86f1c
Refactored group layer handling and "wms_title" metadata.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
165 GroupLayerReader glr = new GroupLayerReader (lay); |
276f63c86f1c
Refactored group layer handling and "wms_title" metadata.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
166 glr.setUtil(this.util); |
276f63c86f1c
Refactored group layer handling and "wms_title" metadata.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
167 layerElement = glr.read("/" + layer.getName()); |
276f63c86f1c
Refactored group layer handling and "wms_title" metadata.
raimund renkert <raimund.renkert@intevation.de>
parents:
243
diff
changeset
|
168 } |
180
f4eb506499f5
Done some code styling and removed TODOs.
Raimund Renkert <rrenkert@intevation.de>
parents:
148
diff
changeset
|
169 } |
f4eb506499f5
Done some code styling and removed TODOs.
Raimund Renkert <rrenkert@intevation.de>
parents:
148
diff
changeset
|
170 catch(Exception e) { |
f4eb506499f5
Done some code styling and removed TODOs.
Raimund Renkert <rrenkert@intevation.de>
parents:
148
diff
changeset
|
171 invalidLayerCount++; |
148
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
172 if(i == 0 && (i + 1) == layer.getCount() || |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
173 invalidLayerCount == layer.getCount()) { |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
174 throw new IOException( |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
175 "No valid layer in MXD file." + |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
176 " Aborting."); |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
177 } |
180
f4eb506499f5
Done some code styling and removed TODOs.
Raimund Renkert <rrenkert@intevation.de>
parents:
148
diff
changeset
|
178 } |
f4eb506499f5
Done some code styling and removed TODOs.
Raimund Renkert <rrenkert@intevation.de>
parents:
148
diff
changeset
|
179 } |
f4eb506499f5
Done some code styling and removed TODOs.
Raimund Renkert <rrenkert@intevation.de>
parents:
148
diff
changeset
|
180 return layerElement; |
148
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
181 } |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
182 } |
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
diff
changeset
|
183 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |