Mercurial > mxd2map
annotate src/java/de/intevation/mxd/reader/CompositeGraphicsLayerReader.java @ 324:5e7e6d99f997
Make mapserver install location version independent
* src/java/de/intevation/mxd/writer/MapScriptWriter.java,
mxd/connections/SDE/sde_areas.txt,
contrib/installer/bin/ms_6.1-dev/Readme.txt,
contrib/installer/bin/MXD2map-Shell.bat,
INSTALL.txt HowTo-Release.txt: Make mapserver install location
version independent s/ms-6.1-dev/mapserver/g
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 15 Oct 2012 09:02:01 +0000 |
parents | b6c0fbae16dc |
children |
rev | line source |
---|---|
315
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
1 /* |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
2 * Copyright (c) 2012 by Intevation GmbH, Germany <info@intevation.de> |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
3 * |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
4 * This file is part of MXD2map. |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
5 * |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
6 * This program is free software under the LGPL (>=v2.1) |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
7 * Read the file LICENCE.txt coming with the software for details |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
8 * or visit http://www.gnu.org/licenses/ if it does not exist. |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
9 * |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
10 * MXD2map has been developed on behalf of the |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
11 * Bundesamt fuer Seeschifffahrt und Hydrographie (BSH) in Hamburg |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
12 * by Intevation GmbH. |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
13 * |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
14 * Authors: |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
15 * Raimund Renkert <raimund.renkert@intevation.de> |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
16 * Bjoern Schilberg <bjoern.schilberg@intevation.de> |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
17 * Stephan Holl <stephan.holl@intevation.de> |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
18 * Andre Heinecke <aheinecke@intevation.de> |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
19 */ |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
20 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
21 package de.intevation.mxd.reader; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
22 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
23 import org.apache.log4j.Logger; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
24 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
25 import com.esri.arcgis.carto.IGraphicsLayer; |
321
b6c0fbae16dc
Expand Graphics Layer Support
Andre Heinecke <aheinecke@intevation.de>
parents:
319
diff
changeset
|
26 import com.esri.arcgis.carto.ILayer; |
315
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
27 import com.esri.arcgis.carto.CompositeGraphicsLayer; |
321
b6c0fbae16dc
Expand Graphics Layer Support
Andre Heinecke <aheinecke@intevation.de>
parents:
319
diff
changeset
|
28 import com.esri.arcgis.carto.GraphicsSubLayer; |
b6c0fbae16dc
Expand Graphics Layer Support
Andre Heinecke <aheinecke@intevation.de>
parents:
319
diff
changeset
|
29 |
315
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
30 import com.esri.arcgis.carto.AnnotateLayerPropertiesCollection; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
31 import com.esri.arcgis.carto.IAnnotateLayerProperties; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
32 import com.esri.arcgis.carto.LabelEngineLayerProperties; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
33 import com.esri.arcgis.carto.IElement; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
34 import com.esri.arcgis.carto.TextElement; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
35 import com.esri.arcgis.system.IName; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
36 import com.esri.arcgis.system.IPropertySet; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
37 import com.esri.arcgis.geometry.Envelope; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
38 import com.esri.arcgis.geometry.ISpatialReference; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
39 import com.esri.arcgis.geometry.ProjectedCoordinateSystem; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
40 import com.esri.arcgis.geometry.GeographicCoordinateSystem; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
41 import com.esri.arcgis.geometry.UnknownCoordinateSystem; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
42 import com.esri.arcgis.geometry.Projection; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
43 import com.esri.arcgis.geometry.IPoint; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
44 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
45 import com.esri.arcgis.display.ITextSymbol; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
46 import com.esri.arcgis.display.TextSymbol; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
47 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
48 import org.w3c.dom.Element; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
49 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
50 import de.intevation.mxd.utils.MapToXMLUtils; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
51 import java.io.IOException; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
52 import com.esri.arcgis.interop.AutomationException; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
53 /** |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
54 * Reads Layer information. |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
55 * |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
56 * @author <a href="mailto:aheinecke@intevation.de">Andre Heinecke</a> |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
57 */ |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
58 public class CompositeGraphicsLayerReader |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
59 implements ILayerReader { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
60 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
61 /** |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
62 * The logger. |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
63 */ |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
64 private static final Logger logger = |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
65 Logger.getLogger(CompositeGraphicsLayerReader.class); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
66 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
67 /** |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
68 * Privte member. |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
69 */ |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
70 private CompositeGraphicsLayer layer; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
71 private MapToXMLUtils util; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
72 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
73 /** |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
74 * Constructor with layer. |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
75 * |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
76 * @param layer The ArcGIS layer object. |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
77 */ |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
78 public CompositeGraphicsLayerReader(IGraphicsLayer layer) |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
79 throws Exception { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
80 if(layer instanceof CompositeGraphicsLayer) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
81 this.layer = (CompositeGraphicsLayer)layer; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
82 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
83 else { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
84 throw new Exception("Not an instance of CompositeGraphicsLayer: " + |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
85 layer.getClass().toString()); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
86 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
87 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
88 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
89 /** |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
90 * Setter for XML document helper. |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
91 * |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
92 * @param util The helper for storing map information. |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
93 */ |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
94 public void setUtil(MapToXMLUtils util) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
95 this.util = util; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
96 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
97 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
98 /** |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
99 * Reads the Layer content. |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
100 * |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
101 * @return The layer XML element. |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
102 */ |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
103 public Element read() |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
104 throws IOException{ |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
105 logger.debug("read()"); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
106 Element layerElement = null; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
107 try { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
108 layerElement = util.addLayer(); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
109 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
110 catch(Exception e) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
111 logger.error("Failed to create DOM-Element for Layer."); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
112 return null; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
113 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
114 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
115 // Name |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
116 try { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
117 layerElement.setAttribute("name", layer.getName()); |
319
5ea3abee729d
Remove unecessary debug output
Andre Heinecke <aheinecke@intevation.de>
parents:
315
diff
changeset
|
118 |
315
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
119 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
120 catch(Exception e) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
121 logger.warn( |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
122 "Could not read layer name." + |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
123 " Stopped reading layer."); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
124 throw new IOException("Error reading layer name."); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
125 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
126 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
127 // Scale |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
128 try { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
129 layerElement.setAttribute("min_scale", |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
130 String.valueOf(layer.getMinimumScale())); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
131 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
132 catch(IOException ioe) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
133 logger.warn("Could not read minimum scale."); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
134 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
135 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
136 try { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
137 layerElement.setAttribute("max_scale", |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
138 String.valueOf(layer.getMaximumScale())); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
139 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
140 catch(Exception e) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
141 logger.warn( |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
142 "Could not read maximum scale."); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
143 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
144 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
145 // Status |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
146 try { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
147 if(layer.isVisible()) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
148 layerElement.setAttribute("status", "on"); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
149 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
150 else { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
151 layerElement.setAttribute("status", "off"); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
152 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
153 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
154 catch(Exception e) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
155 logger.warn( |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
156 "Could not read layer status." + |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
157 " Setting layer status to \"on\"."); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
158 layerElement.setAttribute("status", "on"); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
159 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
160 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
161 // Extent |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
162 try { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
163 Envelope rect = (Envelope)layer.getExtent(); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
164 layerElement.setAttribute( |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
165 "extent_min_x", |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
166 String.valueOf(rect.getXMin ())); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
167 layerElement.setAttribute( |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
168 "extent_max_x", |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
169 String.valueOf(rect.getXMax())); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
170 layerElement.setAttribute( |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
171 "extent_min_y", |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
172 String.valueOf(rect.getYMin())); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
173 layerElement.setAttribute( |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
174 "extent_max_y", |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
175 String.valueOf(rect.getYMax())); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
176 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
177 catch(Exception e) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
178 logger.warn( |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
179 "Could not read extent from layer " |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
180 + layer.getName() + "."); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
181 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
182 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
183 // Read the elements |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
184 try { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
185 int count = 0; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
186 IElement actElement = null; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
187 IElement prevElement = null; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
188 layer.reset(); // Reset the element container |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
189 actElement = layer.next(); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
190 while (actElement != prevElement) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
191 prevElement = actElement; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
192 if (actElement instanceof TextElement) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
193 TextElement te = (TextElement)actElement; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
194 Element xmlTextElement = util.addFeature(layerElement); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
195 xmlTextElement.setAttribute("text", te.getText()); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
196 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
197 IPoint poi = te.getGeometry().getEnvelope().getLowerLeft(); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
198 xmlTextElement.setAttribute("X", String.valueOf(poi.getX())); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
199 xmlTextElement.setAttribute("Y", String.valueOf(poi.getY())); |
321
b6c0fbae16dc
Expand Graphics Layer Support
Andre Heinecke <aheinecke@intevation.de>
parents:
319
diff
changeset
|
200 xmlTextElement.setAttribute("classId", String.valueOf(count)); |
315
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
201 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
202 try { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
203 ITextSymbol sym = te.getSymbol(); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
204 if(sym instanceof TextSymbol) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
205 TextSymbolReader tsr = new TextSymbolReader(sym); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
206 tsr.setParent(xmlTextElement); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
207 tsr.setUtil(util); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
208 tsr.read(); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
209 } else { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
210 logger.warn("Unknwon Symbol of class: " + |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
211 sym.getClass().toString()); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
212 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
213 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
214 catch(Exception e) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
215 logger.warn("Could not read element text symbol."); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
216 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
217 } else { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
218 logger.warn("Unhandled Element of class: " + |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
219 actElement.getClass().toString() + |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
220 " in conversion of layer: " + |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
221 layer.getName()); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
222 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
223 count++; |
321
b6c0fbae16dc
Expand Graphics Layer Support
Andre Heinecke <aheinecke@intevation.de>
parents:
319
diff
changeset
|
224 actElement = layer.next(); |
315
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
225 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
226 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
227 catch(Exception e) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
228 logger.warn("Could not read layer elements."); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
229 logger.debug(e); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
230 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
231 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
232 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
233 //Read the projection. |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
234 try { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
235 ISpatialReference sr = layer.getSpatialReference(); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
236 int projection = 0; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
237 if(sr instanceof ProjectedCoordinateSystem) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
238 ProjectedCoordinateSystem pcs = (ProjectedCoordinateSystem)sr; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
239 projection = pcs.getFactoryCode(); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
240 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
241 else if(sr instanceof GeographicCoordinateSystem) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
242 GeographicCoordinateSystem gcs = (GeographicCoordinateSystem)sr; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
243 projection = gcs.getFactoryCode(); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
244 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
245 else if(sr instanceof UnknownCoordinateSystem) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
246 UnknownCoordinateSystem ucs = (UnknownCoordinateSystem)sr; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
247 projection = 0; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
248 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
249 else{ |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
250 logger.debug( |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
251 "Unknown SpatialReference: " + |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
252 sr.getClass().toString()); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
253 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
254 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
255 if(projection == 0) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
256 logger.warn( |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
257 "Unknown projection for Layer:" + layer.getName() + |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
258 " Please edit projection in resulting mapfile."); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
259 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
260 layerElement.setAttribute("projection", String.valueOf(projection)); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
261 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
262 catch(Exception e) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
263 logger.warn("Could not read layer projection."); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
264 logger.debug(e); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
265 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
266 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
267 // Static values for this layer |
321
b6c0fbae16dc
Expand Graphics Layer Support
Andre Heinecke <aheinecke@intevation.de>
parents:
319
diff
changeset
|
268 layerElement.setAttribute("type", "annotation"); |
315
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
269 |
321
b6c0fbae16dc
Expand Graphics Layer Support
Andre Heinecke <aheinecke@intevation.de>
parents:
319
diff
changeset
|
270 // Read Sublayers |
b6c0fbae16dc
Expand Graphics Layer Support
Andre Heinecke <aheinecke@intevation.de>
parents:
319
diff
changeset
|
271 for (int i = 0; i < layer.getCount(); i++) { |
b6c0fbae16dc
Expand Graphics Layer Support
Andre Heinecke <aheinecke@intevation.de>
parents:
319
diff
changeset
|
272 ILayer pLyr = layer.getLayer(i); |
b6c0fbae16dc
Expand Graphics Layer Support
Andre Heinecke <aheinecke@intevation.de>
parents:
319
diff
changeset
|
273 GraphicsSubLayer subbie = new GraphicsSubLayer((Object)pLyr); |
b6c0fbae16dc
Expand Graphics Layer Support
Andre Heinecke <aheinecke@intevation.de>
parents:
319
diff
changeset
|
274 if (subbie != null) { |
b6c0fbae16dc
Expand Graphics Layer Support
Andre Heinecke <aheinecke@intevation.de>
parents:
319
diff
changeset
|
275 GraphicsSubLayerReader lr = new GraphicsSubLayerReader(subbie); |
b6c0fbae16dc
Expand Graphics Layer Support
Andre Heinecke <aheinecke@intevation.de>
parents:
319
diff
changeset
|
276 lr.setUtil(util); |
b6c0fbae16dc
Expand Graphics Layer Support
Andre Heinecke <aheinecke@intevation.de>
parents:
319
diff
changeset
|
277 lr.read(); |
b6c0fbae16dc
Expand Graphics Layer Support
Andre Heinecke <aheinecke@intevation.de>
parents:
319
diff
changeset
|
278 } else { |
b6c0fbae16dc
Expand Graphics Layer Support
Andre Heinecke <aheinecke@intevation.de>
parents:
319
diff
changeset
|
279 logger.warn("Could not convert sublayer to GraphicsSubLayer"); |
b6c0fbae16dc
Expand Graphics Layer Support
Andre Heinecke <aheinecke@intevation.de>
parents:
319
diff
changeset
|
280 } |
b6c0fbae16dc
Expand Graphics Layer Support
Andre Heinecke <aheinecke@intevation.de>
parents:
319
diff
changeset
|
281 } |
315
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
282 return layerElement; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
283 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
284 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
285 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |