comparison flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java @ 4432:e8a4d2fd25cc

Merged.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 07 Nov 2012 09:47:44 +0100
parents 3c8964855270
children 5b8919ef601d
comparison
equal deleted inserted replaced
4431:83fe6eeba83a 4432:e8a4d2fd25cc
198 XYTextAnnotation textAnnotation = null; 198 XYTextAnnotation textAnnotation = null;
199 199
200 int rendererIndex = 0; 200 int rendererIndex = 0;
201 201
202 if (annotation.atX()) { 202 if (annotation.atX()) {
203 logger.debug("ChartGenerator: Sticky at X.");
203 textAnnotation = new CollisionFreeXYTextAnnotation( 204 textAnnotation = new CollisionFreeXYTextAnnotation(
204 annotation.getText(), annotation.getPos(), area.ofGround(TEXT_OFF)); 205 annotation.getText(), annotation.getPos(), area.ofGround(TEXT_OFF));
205 // OPTIMIZE externalize the calculation involving PI. 206 // OPTIMIZE externalize the calculation involving PI.
206 //textAnnotation.setRotationAngle(270f*Math.PI/180f); 207 //textAnnotation.setRotationAngle(270f*Math.PI/180f);
207 lineAnnotation = createGroundStickAnnotation( 208 lineAnnotation = createGroundStickAnnotation(
212 else { 213 else {
213 // Do the more complicated case where we stick to the Y-Axis. 214 // Do the more complicated case where we stick to the Y-Axis.
214 // There is one nasty case (duration curves, where annotations 215 // There is one nasty case (duration curves, where annotations
215 // might stick to the second y-axis). 216 // might stick to the second y-axis).
216 // FIXME: Remove dependency to XYChartGenerator here 217 // FIXME: Remove dependency to XYChartGenerator here
218 logger.debug("ChartGenerator: Sticky at no-X.");
217 AxisDataset dataset = getAxisDataset( 219 AxisDataset dataset = getAxisDataset(
218 new Integer(annotation.getAxisSymbol())); 220 new Integer(annotation.getAxisSymbol()));
219 if (dataset == null) { 221 if (dataset == null) {
220 logger.warn("Annotation should stick to unfindable y-axis: " 222 logger.warn("Annotation should stick to unfindable y-axis: "
221 + annotation.getAxisSymbol()); 223 + annotation.getAxisSymbol());
432 if (annotations == null || annotations.isEmpty()) { 434 if (annotations == null || annotations.isEmpty()) {
433 logger.debug("addAnnotationsToRenderer: no annotations."); 435 logger.debug("addAnnotationsToRenderer: no annotations.");
434 return; 436 return;
435 } 437 }
436 438
439 logger.debug("addAnnotationsToRenderer: " + annotations.size());
440
437 // OPTMIMIZE: Pre-calculate positions 441 // OPTMIMIZE: Pre-calculate positions
438 ChartArea area = new ChartArea( 442 ChartArea area = new ChartArea(
439 plot.getDomainAxis(0).getRange(), 443 plot.getDomainAxis(0).getRange(),
440 plot.getRangeAxis().getRange()); 444 plot.getRangeAxis().getRange());
441 445
442 // Walk over all Annotation sets. 446 // Walk over all Annotation sets.
443 for (FLYSAnnotation fa: annotations) { 447 for (FLYSAnnotation fa: annotations) {
444 448
445 // Access text styling, if any. 449 // Access text styling, if any.
446 Document theme = fa.getTheme(); 450 Document theme = fa.getTheme();
447 TextStyle textStyle = null; 451 TextStyle textStyle = null;
448 LineStyle lineStyle = null; 452 LineStyle lineStyle = null;
449 453
1504 request, 1508 request,
1505 XPATH_CHART_Y_RANGE, 1509 XPATH_CHART_Y_RANGE,
1506 XPathConstants.NODE, 1510 XPathConstants.NODE,
1507 ArtifactNamespaceContext.INSTANCE); 1511 ArtifactNamespaceContext.INSTANCE);
1508 1512
1513 // unter -aft liegt eine XML java mit toString
1514 System.err.println(XMLUtils.toString(request));
1509 if (yrange == null) { 1515 if (yrange == null) {
1510 return null; 1516 return null;
1511 } 1517 }
1512
1513 1518
1514 String uri = ArtifactNamespaceContext.NAMESPACE_URI; 1519 String uri = ArtifactNamespaceContext.NAMESPACE_URI;
1515 1520
1516 String lower = yrange.getAttributeNS(uri, "from"); 1521 String lower = yrange.getAttributeNS(uri, "from");
1517 String upper = yrange.getAttributeNS(uri, "to"); 1522 String upper = yrange.getAttributeNS(uri, "to");

http://dive4elements.wald.intevation.org