comparison flys-client/src/main/java/de/intevation/flys/client/server/ChartInfoServiceImpl.java @ 1598:ef745bc6bed9

Distinguish between numbers and dates while parsing chart info documents; the MousePosition panel now displays the position on date axes correctly. flys-client/trunk@3931 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 06 Feb 2012 14:43:27 +0000
parents 8bbaa0d173cf
children 8c1f90e380a3
comparison
equal deleted inserted replaced
1597:8bbaa0d173cf 1598:ef745bc6bed9
227 int num = matrix != null ? matrix.getLength() : 0; 227 int num = matrix != null ? matrix.getLength() : 0;
228 228
229 List<Transform2D> transformer = new ArrayList<Transform2D>(num); 229 List<Transform2D> transformer = new ArrayList<Transform2D>(num);
230 230
231 for (int i = 0; i < num; i++) { 231 for (int i = 0; i < num; i++) {
232 Transform2D t = createTransformer(matrix.item(i)); 232 Transform2D t = createTransformer((Element) matrix.item(i));
233 233
234 if (t == null) { 234 if (t == null) {
235 logger.warn("Broken transformation matrix at pos: " + i); 235 logger.warn("Broken transformation matrix at pos: " + i);
236 continue; 236 continue;
237 } 237 }
241 241
242 return (Transform2D[]) transformer.toArray(new Transform2D[num]); 242 return (Transform2D[]) transformer.toArray(new Transform2D[num]);
243 } 243 }
244 244
245 245
246 protected Transform2D createTransformer(Node matrix) { 246 protected Transform2D createTransformer(Element matrix) {
247 String sx = XMLUtils.xpathString( 247 String ns = ArtifactNamespaceContext.NAMESPACE_URI;
248 matrix, "@art:sx", ArtifactNamespaceContext.INSTANCE); 248
249 249 String sx = matrix.getAttributeNS(ns, "sx");
250 String sy = XMLUtils.xpathString( 250 String sy = matrix.getAttributeNS(ns, "sy");
251 matrix, "@art:sy", ArtifactNamespaceContext.INSTANCE); 251 String tx = matrix.getAttributeNS(ns, "tx");
252 252 String ty = matrix.getAttributeNS(ns, "ty");
253 String tx = XMLUtils.xpathString( 253 String xType = matrix.getAttributeNS(ns, "xtype");
254 matrix, "@art:tx", ArtifactNamespaceContext.INSTANCE); 254 String yType = matrix.getAttributeNS(ns, "ytype");
255 255
256 String ty = XMLUtils.xpathString( 256 xType = xType == null || xType.length() == 0 ? "number" : xType;
257 matrix, "@art:ty", ArtifactNamespaceContext.INSTANCE); 257 yType = yType == null || yType.length() == 0 ? "number" : yType;
258 258
259 if (sx != null && sy != null && tx != null && ty != null) { 259 if (sx != null && sy != null && tx != null && ty != null) {
260 try { 260 try {
261 logger.debug("Create new Transform2D with x format: " + xType);
262 logger.debug("Create new Transform2D with y format: " + yType);
263
261 return new Transform2D( 264 return new Transform2D(
262 Double.parseDouble(sx), 265 Double.parseDouble(sx),
263 Double.parseDouble(sy), 266 Double.parseDouble(sy),
264 Double.parseDouble(tx), 267 Double.parseDouble(tx),
265 Double.parseDouble(ty)); 268 Double.parseDouble(ty),
269 xType, yType);
266 } 270 }
267 catch (NumberFormatException nfe) { 271 catch (NumberFormatException nfe) {
268 logger.warn("Error while parsing matrix values."); 272 logger.warn("Error while parsing matrix values.");
269 } 273 }
270 } 274 }

http://dive4elements.wald.intevation.org