comparison src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java @ 74:7eba97e8201b

Catch all exceptions in the MXDReader.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 26 May 2011 18:11:29 +0200
parents acbe36fb45e0
children 59e06c405a9a
comparison
equal deleted inserted replaced
73:acbe36fb45e0 74:7eba97e8201b
67 * Reads the renderer attributes. 67 * Reads the renderer attributes.
68 * 68 *
69 * @return The parent XML node. 69 * @return The parent XML node.
70 */ 70 */
71 public Element read() 71 public Element read()
72 throws IOException { 72 throws Exception {
73 logger.debug("read()"); 73 logger.debug("read()");
74 for(int i = 0; i < renderer.getClassCount() - 1; i++) { 74 for(int i = 0; i < renderer.getClassCount() - 1; i++) {
75 Element rendererElement; 75 Element rendererElement = util.addRenderer(layer);
76 try {
77 rendererElement = util.addRenderer(layer);
78 76
79 String value = renderer.getValue(i); 77 String value = renderer.getValue(i);
80 rendererElement.setAttribute("name", renderer.esri_getClass(i)); 78 rendererElement.setAttribute("name", renderer.esri_getClass(i));
81 rendererElement.setAttribute("description", 79 rendererElement.setAttribute("description",
82 renderer.getDescription(value)); 80 renderer.getDescription(value));
83 rendererElement.setAttribute("value", value); 81 rendererElement.setAttribute("value", value);
84 rendererElement.setAttribute("label", renderer.getLabel(value)); 82 rendererElement.setAttribute("label", renderer.getLabel(value));
83 rendererElement.setAttribute(
84 "field_count",
85 String.valueOf(renderer.getFieldCount()));
86 for(int j = 0; j < renderer.getFieldCount(); j++) {
85 rendererElement.setAttribute( 87 rendererElement.setAttribute(
86 "field_count", 88 "expression_field_" + j,
87 String.valueOf(renderer.getFieldCount())); 89 renderer.getField(j));
88 for(int j = 0; j < renderer.getFieldCount(); j++) { 90 }
89 rendererElement.setAttribute( 91 rendererElement.setAttribute("expression_operator", "=");
90 "expression_field_" + j,
91 renderer.getField(j));
92 }
93 rendererElement.setAttribute("expression_operator", "=");
94 92
95 ISymbol sym = renderer.getSymbol(value); 93 ISymbol sym = renderer.getSymbol(value);
96 MarkerSymbolReader markerReader = new MarkerSymbolReader(); 94 MarkerSymbolReader markerReader = new MarkerSymbolReader();
97 LineSymbolReader lineReader = new LineSymbolReader(); 95 LineSymbolReader lineReader = new LineSymbolReader();
98 FillSymbolReader fillReader = new FillSymbolReader(); 96 FillSymbolReader fillReader = new FillSymbolReader();
99 if(markerReader.canRead(sym)) { 97 if(markerReader.canRead(sym)) {
100 markerReader.setSymbol(sym); 98 markerReader.setSymbol(sym);
101 markerReader.setUtil(util); 99 markerReader.setUtil(util);
102 markerReader.setParent(rendererElement); 100 markerReader.setParent(rendererElement);
103 markerReader.read(); 101 markerReader.read();
104 }
105 else if(lineReader.canRead(sym)) {
106 lineReader.setSymbol(sym);
107 lineReader.setUtil(util);
108 lineReader.setParent(rendererElement);
109 lineReader.read();
110 }
111 else if(fillReader.canRead(sym)) {
112 fillReader.setSymbol(sym);
113 fillReader.setUtil(util);
114 fillReader.setParent(rendererElement);
115 fillReader.read();
116 }
117 else {
118 logger.debug("Not a known symbol type: " +
119 sym.getClass().toString());
120 }
121 } 102 }
122 catch(Exception e) { 103 else if(lineReader.canRead(sym)) {
123 e.printStackTrace(); 104 lineReader.setSymbol(sym);
124 return null; 105 lineReader.setUtil(util);
106 lineReader.setParent(rendererElement);
107 lineReader.read();
108 }
109 else if(fillReader.canRead(sym)) {
110 fillReader.setSymbol(sym);
111 fillReader.setUtil(util);
112 fillReader.setParent(rendererElement);
113 fillReader.read();
114 }
115 else {
116 logger.debug("Not a known symbol type: " +
117 sym.getClass().toString());
125 } 118 }
126 } 119 }
127 return layer; 120 return layer;
128 } 121 }
129 } 122 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)