comparison src/java/de/intevation/mxd/writer/MapScriptWriter.java @ 120:11d63bf00326

Changed exception handling and logging in writer classes.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 16 Jun 2011 14:49:45 +0200
parents 3ca2ec55fb3b
children 0f5819732288
comparison
equal deleted inserted replaced
119:84f202b6aa65 120:11d63bf00326
54 * Write the mapfile. 54 * Write the mapfile.
55 * @param doc The root document containin the map attributes. 55 * @param doc The root document containin the map attributes.
56 * 56 *
57 * @return Currently always true. 57 * @return Currently always true.
58 */ 58 */
59 public boolean write(Document doc) 59 public boolean write(Document doc) {
60 throws Exception {
61 logger.debug("write()"); 60 logger.debug("write()");
62 this.root = doc; 61 this.root = doc;
63 62
64 //Get the filename. 63 //Get the filename.
65 Element fileNode = (Element)XMLUtils.xpath( 64 Element fileNode = (Element)XMLUtils.xpath(
71 //Write the layers. 70 //Write the layers.
72 writeLayer(); 71 writeLayer();
73 //Save the map. 72 //Save the map.
74 mapObj cloneMap = map.cloneMap(); 73 mapObj cloneMap = map.cloneMap();
75 cloneMap.save(mapFilename); 74 cloneMap.save(mapFilename);
75 logger.info("Mapfile successfully created.");
76 return true; 76 return true;
77 } 77 }
78 78
79 /** 79 /**
80 * Create the map object and set the attributes. 80 * Create the map object and set the attributes.
131 } 131 }
132 132
133 /** 133 /**
134 * Create layer objects and set the attributes. 134 * Create layer objects and set the attributes.
135 */ 135 */
136 private void writeLayer() 136 private void writeLayer() {
137 throws Exception {
138 logger.debug("writeLayer()"); 137 logger.debug("writeLayer()");
139 Element mapNode = (Element)XMLUtils.xpath( 138 Element mapNode = (Element)XMLUtils.xpath(
140 root, 139 root,
141 "/mxd/map", 140 "/mxd/map",
142 XPathConstants.NODE); 141 XPathConstants.NODE);
196 /** 195 /**
197 * Adds the classes to the layer. 196 * Adds the classes to the layer.
198 * @param layer Mapscript layer object. 197 * @param layer Mapscript layer object.
199 * @param layerElement Dom element containing the class attributes. 198 * @param layerElement Dom element containing the class attributes.
200 */ 199 */
201 private void writeClass(layerObj layer, Element layerElement) 200 private void writeClass(layerObj layer, Element layerElement) {
202 throws Exception {
203 logger.debug("writeClass(layerObj, Element)"); 201 logger.debug("writeClass(layerObj, Element)");
204 //Get all renderer elements (renderer in arcgis equals class in the 202 //Get all renderer elements (renderer in arcgis equals class in the
205 //mapfile.) 203 //mapfile.)
206 NodeList list = layerElement.getElementsByTagName("renderer"); 204 NodeList list = layerElement.getElementsByTagName("renderer");
207 205
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)