comparison flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java @ 4434:60c728e557f4

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

http://dive4elements.wald.intevation.org