comparison src/java/de/intevation/mxd/reader/CompositeGraphicsLayerReader.java @ 321:b6c0fbae16dc

Expand Graphics Layer Support
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 20 Sep 2012 17:58:29 +0200
parents 5ea3abee729d
children
comparison
equal deleted inserted replaced
320:9289b7c1b4ce 321:b6c0fbae16dc
21 package de.intevation.mxd.reader; 21 package de.intevation.mxd.reader;
22 22
23 import org.apache.log4j.Logger; 23 import org.apache.log4j.Logger;
24 24
25 import com.esri.arcgis.carto.IGraphicsLayer; 25 import com.esri.arcgis.carto.IGraphicsLayer;
26 import com.esri.arcgis.carto.ILayer;
26 import com.esri.arcgis.carto.CompositeGraphicsLayer; 27 import com.esri.arcgis.carto.CompositeGraphicsLayer;
28 import com.esri.arcgis.carto.GraphicsSubLayer;
29
27 import com.esri.arcgis.carto.AnnotateLayerPropertiesCollection; 30 import com.esri.arcgis.carto.AnnotateLayerPropertiesCollection;
28 import com.esri.arcgis.carto.IAnnotateLayerProperties; 31 import com.esri.arcgis.carto.IAnnotateLayerProperties;
29 import com.esri.arcgis.carto.LabelEngineLayerProperties; 32 import com.esri.arcgis.carto.LabelEngineLayerProperties;
30 import com.esri.arcgis.carto.IElement; 33 import com.esri.arcgis.carto.IElement;
31 import com.esri.arcgis.carto.TextElement; 34 import com.esri.arcgis.carto.TextElement;
192 xmlTextElement.setAttribute("text", te.getText()); 195 xmlTextElement.setAttribute("text", te.getText());
193 196
194 IPoint poi = te.getGeometry().getEnvelope().getLowerLeft(); 197 IPoint poi = te.getGeometry().getEnvelope().getLowerLeft();
195 xmlTextElement.setAttribute("X", String.valueOf(poi.getX())); 198 xmlTextElement.setAttribute("X", String.valueOf(poi.getX()));
196 xmlTextElement.setAttribute("Y", String.valueOf(poi.getY())); 199 xmlTextElement.setAttribute("Y", String.valueOf(poi.getY()));
197 200 xmlTextElement.setAttribute("classId", String.valueOf(count));
198 logger.debug("Text: " + te.getText()); 201
199 logger.debug(" X,Y: " + poi.getX() + ", " + poi.getY());
200 try { 202 try {
201 ITextSymbol sym = te.getSymbol(); 203 ITextSymbol sym = te.getSymbol();
202 if(sym instanceof TextSymbol) { 204 if(sym instanceof TextSymbol) {
203 TextSymbolReader tsr = new TextSymbolReader(sym); 205 TextSymbolReader tsr = new TextSymbolReader(sym);
204 tsr.setParent(xmlTextElement); 206 tsr.setParent(xmlTextElement);
217 actElement.getClass().toString() + 219 actElement.getClass().toString() +
218 " in conversion of layer: " + 220 " in conversion of layer: " +
219 layer.getName()); 221 layer.getName());
220 } 222 }
221 count++; 223 count++;
222 } 224 actElement = layer.next();
223 logger.debug("Read " + count + " Elements"); 225 }
224 } 226 }
225 catch(Exception e) { 227 catch(Exception e) {
226 logger.warn("Could not read layer elements."); 228 logger.warn("Could not read layer elements.");
227 logger.debug(e); 229 logger.debug(e);
228 } 230 }
261 logger.warn("Could not read layer projection."); 263 logger.warn("Could not read layer projection.");
262 logger.debug(e); 264 logger.debug(e);
263 } 265 }
264 266
265 // Static values for this layer 267 // Static values for this layer
266 layerElement.setAttribute("type", "point"); 268 layerElement.setAttribute("type", "annotation");
267 269
270 // Read Sublayers
271 for (int i = 0; i < layer.getCount(); i++) {
272 ILayer pLyr = layer.getLayer(i);
273 GraphicsSubLayer subbie = new GraphicsSubLayer((Object)pLyr);
274 if (subbie != null) {
275 GraphicsSubLayerReader lr = new GraphicsSubLayerReader(subbie);
276 lr.setUtil(util);
277 lr.read();
278 } else {
279 logger.warn("Could not convert sublayer to GraphicsSubLayer");
280 }
281 }
268 return layerElement; 282 return layerElement;
269 } 283 }
270 } 284 }
271 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 285 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)