Mercurial > mxd2map
annotate src/java/de/intevation/mxd/reader/CompositeGraphicsLayerReader.java @ 315:1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
to simple TextElements and the base layer.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 17 Sep 2012 17:08:15 +0200 |
parents | |
children | 5ea3abee729d |
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; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
26 import com.esri.arcgis.carto.CompositeGraphicsLayer; |
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.AnnotateLayerPropertiesCollection; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
28 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
|
29 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
|
30 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
|
31 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
|
32 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
|
33 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
|
34 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
|
35 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
|
36 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
|
37 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
|
38 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
|
39 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
|
40 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
|
41 |
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.display.ITextSymbol; |
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.display.TextSymbol; |
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 org.w3c.dom.Element; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
46 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
47 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
|
48 import java.io.IOException; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
49 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
|
50 /** |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
51 * Reads Layer information. |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
52 * |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
53 * @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
|
54 */ |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
55 public class CompositeGraphicsLayerReader |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
56 implements ILayerReader { |
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 /** |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
59 * The logger. |
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 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
|
62 Logger.getLogger(CompositeGraphicsLayerReader.class); |
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 /** |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
65 * Privte member. |
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 private CompositeGraphicsLayer layer; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
68 private MapToXMLUtils util; |
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 /** |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
71 * Constructor with layer. |
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 * @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
|
74 */ |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
75 public CompositeGraphicsLayerReader(IGraphicsLayer layer) |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
76 throws Exception { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
77 if(layer instanceof CompositeGraphicsLayer) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
78 this.layer = (CompositeGraphicsLayer)layer; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
79 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
80 else { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
81 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
|
82 layer.getClass().toString()); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
83 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
84 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
85 |
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 * 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
|
88 * |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
89 * @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
|
90 */ |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
91 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
|
92 this.util = util; |
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 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
95 /** |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
96 * Reads the Layer content. |
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 * @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
|
99 */ |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
100 public Element read() |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
101 throws IOException{ |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
102 logger.debug("read()"); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
103 Element layerElement = null; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
104 try { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
105 layerElement = util.addLayer(); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
106 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
107 catch(Exception e) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
108 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
|
109 return null; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
110 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
111 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
112 // Name |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
113 try { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
114 layerElement.setAttribute("name", layer.getName()); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
115 logger.debug("Adding composite graphics layer: " + layer.getName()); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
116 logger.debug("Sublayers: " + layer.getCount()); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
117 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
118 catch(Exception e) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
119 logger.warn( |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
120 "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
|
121 " Stopped reading layer."); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
122 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
|
123 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
124 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
125 // Scale |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
126 try { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
127 layerElement.setAttribute("min_scale", |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
128 String.valueOf(layer.getMinimumScale())); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
129 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
130 catch(IOException ioe) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
131 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
|
132 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
133 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
134 try { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
135 layerElement.setAttribute("max_scale", |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
136 String.valueOf(layer.getMaximumScale())); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
137 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
138 catch(Exception e) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
139 logger.warn( |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
140 "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
|
141 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
142 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
143 // Status |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
144 try { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
145 if(layer.isVisible()) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
146 layerElement.setAttribute("status", "on"); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
147 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
148 else { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
149 layerElement.setAttribute("status", "off"); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
150 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
151 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
152 catch(Exception e) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
153 logger.warn( |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
154 "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
|
155 " 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
|
156 layerElement.setAttribute("status", "on"); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
157 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
158 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
159 // Extent |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
160 try { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
161 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
|
162 layerElement.setAttribute( |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
163 "extent_min_x", |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
164 String.valueOf(rect.getXMin ())); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
165 layerElement.setAttribute( |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
166 "extent_max_x", |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
167 String.valueOf(rect.getXMax())); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
168 layerElement.setAttribute( |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
169 "extent_min_y", |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
170 String.valueOf(rect.getYMin())); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
171 layerElement.setAttribute( |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
172 "extent_max_y", |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
173 String.valueOf(rect.getYMax())); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
174 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
175 catch(Exception e) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
176 logger.warn( |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
177 "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
|
178 + layer.getName() + "."); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
179 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
180 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
181 // Read the elements |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
182 try { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
183 int count = 0; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
184 IElement actElement = null; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
185 IElement prevElement = null; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
186 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
|
187 actElement = layer.next(); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
188 while (actElement != prevElement) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
189 prevElement = actElement; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
190 if (actElement instanceof TextElement) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
191 TextElement te = (TextElement)actElement; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
192 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
|
193 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
|
194 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
195 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
|
196 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
|
197 xmlTextElement.setAttribute("Y", String.valueOf(poi.getY())); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
198 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
199 logger.debug("Text: " + te.getText()); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
200 logger.debug(" X,Y: " + poi.getX() + ", " + poi.getY()); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
201 try { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
202 ITextSymbol sym = te.getSymbol(); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
203 if(sym instanceof TextSymbol) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
204 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
|
205 tsr.setParent(xmlTextElement); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
206 tsr.setUtil(util); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
207 tsr.read(); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
208 } else { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
209 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
|
210 sym.getClass().toString()); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
211 } |
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 catch(Exception e) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
214 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
|
215 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
216 } else { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
217 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
|
218 actElement.getClass().toString() + |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
219 " in conversion of layer: " + |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
220 layer.getName()); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
221 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
222 count++; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
223 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
224 logger.debug("Read " + count + " Elements"); |
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 catch(Exception e) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
227 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
|
228 logger.debug(e); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
229 } |
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 //Read the projection. |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
233 try { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
234 ISpatialReference sr = layer.getSpatialReference(); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
235 int projection = 0; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
236 if(sr instanceof ProjectedCoordinateSystem) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
237 ProjectedCoordinateSystem pcs = (ProjectedCoordinateSystem)sr; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
238 projection = pcs.getFactoryCode(); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
239 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
240 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
|
241 GeographicCoordinateSystem gcs = (GeographicCoordinateSystem)sr; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
242 projection = gcs.getFactoryCode(); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
243 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
244 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
|
245 UnknownCoordinateSystem ucs = (UnknownCoordinateSystem)sr; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
246 projection = 0; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
247 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
248 else{ |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
249 logger.debug( |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
250 "Unknown SpatialReference: " + |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
251 sr.getClass().toString()); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
252 } |
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 if(projection == 0) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
255 logger.warn( |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
256 "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
|
257 " 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
|
258 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
259 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
|
260 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
261 catch(Exception e) { |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
262 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
|
263 logger.debug(e); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
264 } |
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 // Static values for this layer |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
267 layerElement.setAttribute("type", "point"); |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
268 |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
269 return layerElement; |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
270 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
271 } |
1d77ea6a915d
Add basic support for Graphics Layers. For now this is restricted
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
272 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |