Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java @ 2997:60f13d966ee3
Doc and TODOs added.
flys-artifacts/trunk@4552 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 29 May 2012 08:38:39 +0000 |
parents | 55f91fae8a7b |
children | 4b6fb6d91192 |
comparison
equal
deleted
inserted
replaced
2996:55f91fae8a7b | 2997:60f13d966ee3 |
---|---|
711 logger.debug("Unknown zone type found."); | 711 logger.debug("Unknown zone type found."); |
712 return new Color(255, 0, 0); | 712 return new Color(255, 0, 0); |
713 } | 713 } |
714 } | 714 } |
715 | 715 |
716 | |
717 /** | |
718 * Create annotation that sticks to "ground" (X) axis. | |
719 * @param area helper to calculate coordinates | |
720 * @param pos one-dimensional position (distance from axis) | |
721 * @param lineStyle the line style to use for the line. | |
722 */ | |
716 protected static XYLineAnnotation createGroundStickAnnotation( | 723 protected static XYLineAnnotation createGroundStickAnnotation( |
717 Area area, float pos, ThemeAccess.LineStyle lineStyle | 724 Area area, float pos, ThemeAccess.LineStyle lineStyle |
718 ) { | 725 ) { |
719 // Style the line. | 726 // Style the line. |
720 if (lineStyle != null) { | 727 if (lineStyle != null) { |
729 pos, area.ofGround(ANNOTATIONS_AXIS_OFFSET)); | 736 pos, area.ofGround(ANNOTATIONS_AXIS_OFFSET)); |
730 } | 737 } |
731 } | 738 } |
732 | 739 |
733 | 740 |
741 /** | |
742 * Create annotation that sticks to the second Y axis ("right"). | |
743 * @param area helper to calculate coordinates | |
744 * @param pos one-dimensional position (distance from axis) | |
745 * @param lineStyle the line style to use for the line. | |
746 */ | |
734 protected static XYLineAnnotation createRightStickAnnotation( | 747 protected static XYLineAnnotation createRightStickAnnotation( |
735 Area area, float pos, ThemeAccess.LineStyle lineStyle | 748 Area area, float pos, ThemeAccess.LineStyle lineStyle |
736 ) { | 749 ) { |
737 // Style the line. | 750 // Style the line. |
738 if (lineStyle != null) { | 751 if (lineStyle != null) { |
747 area.ofRight(ANNOTATIONS_AXIS_OFFSET), pos); | 760 area.ofRight(ANNOTATIONS_AXIS_OFFSET), pos); |
748 } | 761 } |
749 } | 762 } |
750 | 763 |
751 | 764 |
765 /** | |
766 * Create annotation that sticks to the second Y axis ("right"). | |
767 * @param area helper to calculate coordinates | |
768 * @param pos one-dimensional position (distance from axis) | |
769 * @param lineStyle the line style to use for the line. | |
770 */ | |
752 protected static XYLineAnnotation createLeftStickAnnotation( | 771 protected static XYLineAnnotation createLeftStickAnnotation( |
753 Area area, float pos, ThemeAccess.LineStyle lineStyle | 772 Area area, float pos, ThemeAccess.LineStyle lineStyle |
754 ) { | 773 ) { |
755 // Style the line. | 774 // Style the line. |
756 if (lineStyle != null) { | 775 if (lineStyle != null) { |
763 return new XYLineAnnotation( | 782 return new XYLineAnnotation( |
764 area.atLeft(), pos, | 783 area.atLeft(), pos, |
765 area.ofLeft(ANNOTATIONS_AXIS_OFFSET), pos); | 784 area.ofLeft(ANNOTATIONS_AXIS_OFFSET), pos); |
766 } | 785 } |
767 } | 786 } |
787 | |
768 | 788 |
769 /** | 789 /** |
770 * Add a text and a line annotation. | 790 * Add a text and a line annotation. |
771 * @param area convenience to determine positions in plot. | 791 * @param area convenience to determine positions in plot. |
772 * @param theme (optional) theme document | 792 * @param theme (optional) theme document |
828 // TODO line to curve | 848 // TODO line to curve |
829 if (!Float.isNaN(annotation.getHitPoint()) && theme != null) { | 849 if (!Float.isNaN(annotation.getHitPoint()) && theme != null) { |
830 // New line annotation to hit curve. | 850 // New line annotation to hit curve. |
831 // TODO include more style information | 851 // TODO include more style information |
832 if (ThemeUtil.parseShowVerticalLine(theme)) { | 852 if (ThemeUtil.parseShowVerticalLine(theme)) { |
853 // createRightStickAnnotaiton .... | |
833 XYLineAnnotation hitLineAnnotation = new XYLineAnnotation( | 854 XYLineAnnotation hitLineAnnotation = new XYLineAnnotation( |
834 area2.atRight(), annotation.getPos(), | 855 area2.atRight(), annotation.getPos(), |
835 annotation.getHitPoint(), annotation.getPos()); | 856 annotation.getHitPoint(), annotation.getPos()); |
836 plot.getRenderer(rendererIndex).addAnnotation(hitLineAnnotation, | 857 plot.getRenderer(rendererIndex).addAnnotation(hitLineAnnotation, |
837 org.jfree.ui.Layer.BACKGROUND); | 858 org.jfree.ui.Layer.BACKGROUND); |
838 } | 859 } |
839 if (ThemeUtil.parseShowHorizontalLine(theme)) { | 860 if (ThemeUtil.parseShowHorizontalLine(theme)) { |
861 // createGroundStickAnnotation | |
840 XYLineAnnotation lineBackAnnotation = new XYLineAnnotation( | 862 XYLineAnnotation lineBackAnnotation = new XYLineAnnotation( |
841 annotation.getHitPoint(), annotation.getPos(), | 863 annotation.getHitPoint(), annotation.getPos(), |
842 annotation.getHitPoint(), area2.atGround()); | 864 annotation.getHitPoint(), area2.atGround()); |
843 plot.getRenderer(rendererIndex).addAnnotation(lineBackAnnotation, | 865 plot.getRenderer(rendererIndex).addAnnotation(lineBackAnnotation, |
844 org.jfree.ui.Layer.BACKGROUND); | 866 org.jfree.ui.Layer.BACKGROUND); |
853 lineAnnotation = createLeftStickAnnotation(area, annotation.getPos(), lineStyle); | 875 lineAnnotation = createLeftStickAnnotation(area, annotation.getPos(), lineStyle); |
854 if (!Float.isNaN(annotation.getHitPoint()) && theme != null) { | 876 if (!Float.isNaN(annotation.getHitPoint()) && theme != null) { |
855 // TODO include more style information | 877 // TODO include more style information |
856 // New line annotation to hit curve. | 878 // New line annotation to hit curve. |
857 if (ThemeUtil.parseShowHorizontalLine(theme)) { | 879 if (ThemeUtil.parseShowHorizontalLine(theme)) { |
880 // createLeftStickAnnotaiton | |
858 XYLineAnnotation hitLineAnnotation = new XYLineAnnotation(area.atLeft(), | 881 XYLineAnnotation hitLineAnnotation = new XYLineAnnotation(area.atLeft(), |
859 annotation.getPos(), annotation.getHitPoint(), annotation.getPos()); | 882 annotation.getPos(), annotation.getHitPoint(), annotation.getPos()); |
860 plot.getRenderer(rendererIndex).addAnnotation(hitLineAnnotation, | 883 plot.getRenderer(rendererIndex).addAnnotation(hitLineAnnotation, |
861 org.jfree.ui.Layer.BACKGROUND); | 884 org.jfree.ui.Layer.BACKGROUND); |
862 } | 885 } |
863 if (ThemeUtil.parseShowVerticalLine(theme)) { | 886 if (ThemeUtil.parseShowVerticalLine(theme)) { |
887 // createGroundStickAnnotation | |
864 XYLineAnnotation lineBackAnnotation = new XYLineAnnotation( | 888 XYLineAnnotation lineBackAnnotation = new XYLineAnnotation( |
865 annotation.getHitPoint(), annotation.getPos(), | 889 annotation.getHitPoint(), annotation.getPos(), |
866 annotation.getHitPoint(), area.atGround()); | 890 annotation.getHitPoint(), area.atGround()); |
867 plot.getRenderer(rendererIndex).addAnnotation(lineBackAnnotation, | 891 plot.getRenderer(rendererIndex).addAnnotation(lineBackAnnotation, |
868 org.jfree.ui.Layer.BACKGROUND); | 892 org.jfree.ui.Layer.BACKGROUND); |