Mercurial > mxd2map
annotate src/java/de/intevation/mxd/reader/MXDReader.java @ 355:5fd9effbfe24
Remove more instances of outdated repository URL
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Mon, 04 Jan 2021 15:45:14 +0100 |
parents | 1b8572f22ac6 |
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 |
33
c51376f8e24c
Separated converter components into packages.
Raimund Renkert <rrenkert@intevation.de>
parents:
31
diff
changeset
|
20 package de.intevation.mxd.reader; |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
21 |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
22 import java.io.IOException; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
23 |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
24 import org.apache.log4j.Logger; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
25 |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
26 import com.esri.arcgis.carto.ILayer; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
27 import com.esri.arcgis.carto.IMap; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
28 import com.esri.arcgis.carto.MapDocument; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
29 import com.esri.arcgis.carto.FeatureLayer; |
315
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
313
diff
changeset
|
30 import com.esri.arcgis.carto.CompositeGraphicsLayer; |
36
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
34
diff
changeset
|
31 import com.esri.arcgis.carto.GdbRasterCatalogLayer; |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
32 import com.esri.arcgis.carto.IFeatureRenderer; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
33 import com.esri.arcgis.carto.SimpleRenderer; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
34 import com.esri.arcgis.carto.ClassBreaksRenderer; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 import com.esri.arcgis.carto.UniqueValueRenderer; |
148
2bf35f0babd0
Implemented new group layer functionality.
vc11884admin@VC11884.win.bsh.de
parents:
133
diff
changeset
|
36 import com.esri.arcgis.carto.GroupLayer; |
301
2cb2d8eb56ed
Add WMS Support in the Reader classes and
Andre Heinecke <aheinecke@intevation.de>
parents:
244
diff
changeset
|
37 import com.esri.arcgis.carto.WMSMapLayer; |
2cb2d8eb56ed
Add WMS Support in the Reader classes and
Andre Heinecke <aheinecke@intevation.de>
parents:
244
diff
changeset
|
38 import com.esri.arcgis.carto.WMSGroupLayer; |
2cb2d8eb56ed
Add WMS Support in the Reader classes and
Andre Heinecke <aheinecke@intevation.de>
parents:
244
diff
changeset
|
39 import com.esri.arcgis.carto.WMSLayer; |
303
a9684178cb29
Add RasterLayer Reader
Andre Heinecke <aheinecke@intevation.de>
parents:
301
diff
changeset
|
40 import com.esri.arcgis.carto.RasterLayer; |
315
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
313
diff
changeset
|
41 import com.esri.arcgis.carto.IGraphicsLayerProxy; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
313
diff
changeset
|
42 import com.esri.arcgis.carto.IGraphicsLayer; |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
43 |
27
e5fdc37f8f94
Added XMLUtils to store map information.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
44 import org.w3c.dom.Document; |
e5fdc37f8f94
Added XMLUtils to store map information.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
45 import org.w3c.dom.Element; |
e5fdc37f8f94
Added XMLUtils to store map information.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
46 |
33
c51376f8e24c
Separated converter components into packages.
Raimund Renkert <rrenkert@intevation.de>
parents:
31
diff
changeset
|
47 import de.intevation.mxd.ArcGISInitializer; |
c51376f8e24c
Separated converter components into packages.
Raimund Renkert <rrenkert@intevation.de>
parents:
31
diff
changeset
|
48 import de.intevation.mxd.utils.MapToXMLUtils; |
c51376f8e24c
Separated converter components into packages.
Raimund Renkert <rrenkert@intevation.de>
parents:
31
diff
changeset
|
49 |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
50 /** |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
51 * The MXD file reader. |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
52 * |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
53 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
54 */ |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
55 public class MXDReader |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
56 implements IReader { |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
57 /** |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
58 * The Logger. |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
59 */ |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
60 private static final Logger logger = Logger.getLogger(MXDReader.class); |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
61 |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
62 /** |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
63 * Private member. |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
64 */ |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
65 private String filename = ""; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
66 private ArcGISInitializer initializer = null; |
40
a1bc7220efe7
Updated the mxd reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
36
diff
changeset
|
67 private MapToXMLUtils util; |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
68 private IMap map; |
118
39957898c694
Improved top level exception handling and logging.
Raimund Renkert <rrenkert@intevation.de>
parents:
103
diff
changeset
|
69 private int invalidLayerCount; |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
70 |
181 | 71 /** |
72 * Default constructor. | |
73 */ | |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
74 public MXDReader() |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
75 throws IOException { |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
76 logger.debug("constructor()"); |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
77 initializer = new ArcGISInitializer(); |
40
a1bc7220efe7
Updated the mxd reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
36
diff
changeset
|
78 util = new MapToXMLUtils(); |
118
39957898c694
Improved top level exception handling and logging.
Raimund Renkert <rrenkert@intevation.de>
parents:
103
diff
changeset
|
79 invalidLayerCount = 0; |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
80 } |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
81 |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
82 |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
83 /** |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
84 * Initialize the ArcGIS Objects. |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
85 */ |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
86 public boolean init() |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
87 throws IOException { |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
88 logger.debug("init()"); |
103
163d474165b0
Added check for ArcGISDesktop environment.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
89 if(!initializer.initArcGIS()) { |
163d474165b0
Added check for ArcGISDesktop environment.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
90 return false; |
163d474165b0
Added check for ArcGISDesktop environment.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
91 } |
163d474165b0
Added check for ArcGISDesktop environment.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
92 if(!initializer.initArcGISLicenses()) { |
163d474165b0
Added check for ArcGISDesktop environment.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
93 return false; |
163d474165b0
Added check for ArcGISDesktop environment.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
94 } |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
95 return true; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
96 } |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
97 |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
98 /** |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
99 * Shutdown the ArcGIS Objects. |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
100 */ |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
101 public boolean shutdown() |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
102 throws IOException { |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
103 logger.debug("shutdown()"); |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
104 if(initializer == null) { |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
105 throw new IOException("Faild to shutdown!"); |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
106 } |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
107 else { |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
108 initializer.shutdownArcGIS(); |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
109 return true; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
110 } |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
111 } |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
112 |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
113 /** |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
114 * Set the path and filename to the MXD-File. |
181 | 115 * |
116 * @param name The MXD filename. | |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
117 */ |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
118 public void setFilename(String name) { |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
119 logger.debug("setFilename()"); |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
120 filename = name; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
121 } |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
122 |
181 | 123 /** |
124 * Get the map document from MXD. | |
125 */ | |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
126 private void openMapDocument() |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
127 throws IOException { |
27
e5fdc37f8f94
Added XMLUtils to store map information.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
128 MapDocument m = new MapDocument(); |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
129 if(!m.isMapDocument(filename)) { |
27
e5fdc37f8f94
Added XMLUtils to store map information.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
130 throw new IOException(filename + " is not a map!"); |
e5fdc37f8f94
Added XMLUtils to store map information.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
131 } |
e5fdc37f8f94
Added XMLUtils to store map information.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
132 m.open(filename, null); |
e5fdc37f8f94
Added XMLUtils to store map information.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
133 map = m.getMap(0); |
e5fdc37f8f94
Added XMLUtils to store map information.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
134 } |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
135 |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
136 /** |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
137 * Read the MXD file content. |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
138 */ |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
139 public boolean read() |
121
9f74f4d36822
Set default values and improved logging and exception handling for map reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
118
diff
changeset
|
140 throws Exception { |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
141 logger.debug("read()"); |
312
503d3a453a04
Check for isEmpty instead of comparing with ""
Andre Heinecke <aheinecke@intevation.de>
parents:
310
diff
changeset
|
142 if(filename.isEmpty()) { |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
143 throw new IOException("Please set filename!"); |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
144 } |
313
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
145 util.addFilename(filename); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
146 openMapDocument(); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
147 MapReader mreader; |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
148 try { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
149 mreader = new MapReader (map); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
150 mreader.setUtil(util); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
151 mreader.read(); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
152 |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
153 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
154 catch(Exception e) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
155 throw e; |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
156 } |
315
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
313
diff
changeset
|
157 try { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
313
diff
changeset
|
158 IGraphicsLayer grLayer = (IGraphicsLayer) map.getActiveGraphicsLayer(); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
313
diff
changeset
|
159 if (map.getActiveGraphicsLayer() instanceof CompositeGraphicsLayer) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
313
diff
changeset
|
160 CompositeGraphicsLayerReader lr = new CompositeGraphicsLayerReader(grLayer); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
313
diff
changeset
|
161 lr.setUtil(util); |
318
1b8572f22ac6
Remove unused variable
Andre Heinecke <aheinecke@intevation.de>
parents:
315
diff
changeset
|
162 lr.read(); |
315
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
313
diff
changeset
|
163 } else { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
313
diff
changeset
|
164 logger.debug("Not a known graphics layer type: " + |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
313
diff
changeset
|
165 grLayer.getClass().toString()); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
313
diff
changeset
|
166 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
313
diff
changeset
|
167 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
313
diff
changeset
|
168 catch(Exception e) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
313
diff
changeset
|
169 logger.debug("Error reading graphics layer"); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
313
diff
changeset
|
170 logger.debug(e); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
313
diff
changeset
|
171 } |
313
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
172 |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
173 for(int i = 0; i < map.getLayerCount();i++) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
174 ILayer layer = map.getLayer(i); |
40
a1bc7220efe7
Updated the mxd reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
36
diff
changeset
|
175 try { |
313
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
176 if (layer instanceof FeatureLayer) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
177 FeatureLayerReader lr = new FeatureLayerReader(layer); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
178 lr.setUtil(util); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
179 Element layerElement = lr.read(); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
180 if (layerElement == null) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
181 continue; |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
182 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
183 IFeatureRenderer renderer = |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
184 ((FeatureLayer)layer).getRenderer(); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
185 IRendererReader rreader; |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
186 if(renderer instanceof SimpleRenderer) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
187 rreader = new SimpleRendererReader(renderer); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
188 rreader.setParent(layerElement); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
189 rreader.setUtil(util); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
190 rreader.read(); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
191 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
192 else if(renderer instanceof ClassBreaksRenderer) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
193 rreader = new ClassBreakRendererReader(renderer); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
194 rreader.setParent(layerElement); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
195 rreader.setUtil(util); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
196 rreader.read(); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
197 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
198 else if(renderer instanceof UniqueValueRenderer) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
199 rreader = new UniqueValueRendererReader(renderer); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
200 rreader.setParent(layerElement); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
201 rreader.setUtil(util); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
202 rreader.read(); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
203 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
204 else{ |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
205 logger.debug("Not a known renderer type " + |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
206 renderer.getClass().toString()); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
207 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
208 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
209 else if(layer instanceof GdbRasterCatalogLayer) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
210 GdbRasterCatalogLayerReader gclr = |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
211 new GdbRasterCatalogLayerReader(layer); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
212 gclr.setUtil(util); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
213 Element layerElement = gclr.read(); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
214 IFeatureRenderer renderer = |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
215 ((GdbRasterCatalogLayer)layer).getRenderer(); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
216 IRendererReader rreader; |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
217 if(renderer instanceof SimpleRenderer) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
218 rreader = new SimpleRendererReader(renderer); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
219 rreader.setParent(layerElement); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
220 rreader.setUtil(util); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
221 rreader.read(); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
222 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
223 else if(renderer instanceof ClassBreaksRenderer) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
224 rreader = new ClassBreakRendererReader(renderer); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
225 rreader.setParent(layerElement); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
226 rreader.setUtil(util); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
227 rreader.read(); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
228 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
229 else if(renderer instanceof UniqueValueRenderer) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
230 rreader = new UniqueValueRendererReader(renderer); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
231 rreader.setParent(layerElement); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
232 rreader.setUtil(util); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
233 rreader.read(); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
234 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
235 else { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
236 logger.debug("Not a known renderer type " + |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
237 renderer.getClass().toString()); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
238 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
239 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
240 else if(layer instanceof GroupLayer) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
241 GroupLayerReader gl = new GroupLayerReader(layer); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
242 gl.setUtil(util); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
243 Element layerElement = gl.read(""); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
244 if(layerElement == null) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
245 throw new IOException ("Error reading grouplayer."); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
246 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
247 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
248 else if(layer instanceof WMSMapLayer) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
249 WMSMapLayerReader lr = new WMSMapLayerReader(layer); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
250 lr.setUtil(util); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
251 Element layerElement = lr.read(""); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
252 if(layerElement == null) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
253 throw new IOException ("Error reading WMSMapLayer."); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
254 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
255 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
256 else if(layer instanceof WMSGroupLayer) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
257 WMSGroupLayerReader lr = new WMSGroupLayerReader(layer); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
258 lr.setUtil(util); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
259 Element layerElement = lr.read(""); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
260 if(layerElement == null) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
261 throw new IOException ("Error reading WMSGrouplayer."); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
262 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
263 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
264 else if(layer instanceof WMSLayer) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
265 WMSLayerReader lr = new WMSLayerReader(layer); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
266 lr.setUtil(util); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
267 Element layerElement = lr.read(); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
268 if(layerElement == null) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
269 throw new IOException ("Error reading WMSlayer."); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
270 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
271 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
272 else if(layer instanceof RasterLayer) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
273 RasterLayerReader lr = |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
274 new RasterLayerReader(layer); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
275 lr.setUtil(util); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
276 Element layerElement = lr.read(); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
277 if(layerElement == null) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
278 throw new IOException ("Error reading RasterLayer."); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
279 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
280 /* TODO implement support for classes in Raster Layers |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
281 IRasterRenderer renderer = |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
282 ((RasterLayer)layer).getRenderer(); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
283 IRendererReader rreader; |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
284 if(renderer instanceof SimpleRenderer) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
285 rreader = new SimpleRendererReader(renderer); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
286 rreader.setParent(layerElement); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
287 rreader.setUtil(util); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
288 rreader.read(); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
289 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
290 else if(renderer instanceof ClassBreaksRenderer) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
291 rreader = new ClassBreakRendererReader(renderer); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
292 rreader.setParent(layerElement); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
293 rreader.setUtil(util); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
294 rreader.read(); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
295 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
296 else if(renderer instanceof UniqueValueRenderer) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
297 rreader = new UniqueValueRendererReader(renderer); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
298 rreader.setParent(layerElement); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
299 rreader.setUtil(util); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
300 rreader.read(); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
301 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
302 else { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
303 logger.debug("Not a known renderer type " + |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
304 renderer.getClass().toString()); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
305 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
306 */ |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
307 } |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
308 else { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
309 logger.info( |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
310 "Layertype not known: " + |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
311 layer.getClass().toString()); |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
312 } |
40
a1bc7220efe7
Updated the mxd reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
36
diff
changeset
|
313 } |
a1bc7220efe7
Updated the mxd reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
36
diff
changeset
|
314 catch(Exception e) { |
313
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
315 invalidLayerCount++; |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
316 if(i == 0 && (i + 1) == map.getLayerCount() || |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
317 invalidLayerCount == map.getLayerCount()) { |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
318 throw new IOException( |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
319 "No valid layer in MXD file." + |
9bb629743d2c
Remove uneccessary else and indention
Andre Heinecke <aheinecke@intevation.de>
parents:
312
diff
changeset
|
320 " Aborting."); |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
321 } |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
322 } |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
323 } |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
324 return true; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
325 } |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
326 |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
327 /** |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
328 * Get the root DOM document. |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
329 */ |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
40
diff
changeset
|
330 public Document getMapDocument() { |
27
e5fdc37f8f94
Added XMLUtils to store map information.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
331 logger.debug("getMapDocument()"); |
40
a1bc7220efe7
Updated the mxd reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
36
diff
changeset
|
332 return util.getDocument(); |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
333 } |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
334 } |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
335 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |