Mercurial > dive4elements > river
changeset 1125:65d8b3340397
Cleanups of CrossSection*.
flys-artifacts/trunk@2635 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 01 Sep 2011 13:00:36 +0000 |
parents | 28a595b32980 |
children | da4d8631fc46 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java flys-artifacts/src/main/resources/messages.properties flys-artifacts/src/main/resources/messages_de.properties flys-artifacts/src/main/resources/messages_de_DE.properties flys-artifacts/src/main/resources/messages_en.properties |
diffstat | 7 files changed, 75 insertions(+), 66 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Thu Sep 01 12:47:01 2011 +0000 +++ b/flys-artifacts/ChangeLog Thu Sep 01 13:00:36 2011 +0000 @@ -1,3 +1,20 @@ +2011-09-01 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + Cleanups of CrossSection*. + + * src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java: + New methods to retrieve name of utilized CrossSection. + + * src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java: + Cleanup, get rid of copied unused method, documentation and more sensible + translations. + + * src/main/resources/messages_de_DE.properties, + src/main/resources/messages_de.properties, + src/main/resources/messages_en.properties, + src/main/resources/messages.properties: + Added cross_section* translations, also cleanups. + 2011-09-01 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java: @@ -9,7 +26,7 @@ Set the Z values of line and polygon barrier geometries. Both barrier shapefiles will contain 3D geometries now. -2011-08-31 Felix Wolfsteller <felix.wolfsteller@intevation.de> +2011-09-01 Felix Wolfsteller <felix.wolfsteller@intevation.de> Get real data to display in CrossSection (although ignorant of parameterization), making use of the showcase code of the CrossSectionApp-
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java Thu Sep 01 12:47:01 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java Thu Sep 01 13:00:36 2011 +0000 @@ -673,6 +673,14 @@ /** + * Get name of cross section. + */ + public String getCrossSectionName() { + return getCrossSections().get(0).getDescription(); + } + + + /** * Get points of CrossSection Line. */ protected double [][] getCrossSectionProfile(CrossSectionLine csl) {
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java Thu Sep 01 12:47:01 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java Thu Sep 01 13:00:36 2011 +0000 @@ -45,12 +45,9 @@ public static final String I18N_YAXIS_LABEL = "chart.cross_section.yaxis.label"; - public static final String I18N_CHART_TITLE_DEFAULT = "Querschnittt"; - public static final String I18N_XAXIS_LABEL_DEFAULT = "m"; - public static final String I18N_YAXIS_LABEL_DEFAULT = "W [NN + m]"; - - - protected boolean inverted; + public static final String I18N_CHART_TITLE_DEFAULT = "Querprofildiagramm"; + public static final String I18N_XAXIS_LABEL_DEFAULT = "Abstand [m]"; + public static final String I18N_YAXIS_LABEL_DEFAULT = "W [NN + m]"; /** Trivial Constructor. */ @@ -59,21 +56,21 @@ } + /** + * Get localized chart title. + */ protected String getChartTitle() { + // TODO get river etc for localized heading return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT); } - public boolean isInverted() { - return inverted; - } - public void setInverted(boolean inverted) { - this.inverted = inverted; - } - + /** + * Add localized subtitle to chart. + */ @Override protected void addSubtitles(JFreeChart chart) { - double[] dist = getRange(); + double[] dist = getRange(); Object[] args = new Object[] { getRiverName(), @@ -81,25 +78,22 @@ dist[1] }; - //String subtitle = msg(I18N_CHART_SUBTITLE, "", args); - String subtitle = "bogus"; + String subtitle = msg(I18N_CHART_SUBTITLE, "", args); chart.addSubtitle(new TextTitle(subtitle)); } - @Override - public JFreeChart generateChart() { - JFreeChart c = super.generateChart(); - XYPlot p = (XYPlot) c.getPlot(); - return c; - } - - + /** + * Get localized X Axis label. + */ protected String getXAxisLabel() { return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT); } + /** + * Get localized Y Axis label. + */ protected String getYAxisLabel() { return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT); } @@ -112,14 +106,11 @@ msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT)); plot.setRangeAxis(1, qAxis); - - invertXAxis(plot.getDomainAxis()); } /** - * This method overrides the XYChartGenerators zoomY method to include the 0 - * value on the Q axis. + * Overrides XYChartGenerators.zoomY() to include the 0 value on the Q axis. */ @Override protected boolean zoomY(XYPlot plot, ValueAxis axis, Range range, Range x) { @@ -133,22 +124,6 @@ /** - * This method inverts the x-axis based on the kilometer information of the - * selected river. If the head of the river is at kilometer 0, the axis is - * not inverted, otherwise it is. - * - * @param xaxis The domain axis. - */ - protected void invertXAxis(ValueAxis xaxis) { - - if (inverted) { - logger.debug("Invert X-Axis."); - xaxis.setInverted(true); - } - } - - - /** * Let one facet do its job. */ public void doOut(Artifact artifact, Facet facet, Document attr) { @@ -188,7 +163,8 @@ */ protected void doCrossSectionWaterLineOut(Object o, Document theme) { logger.debug("CrossSectionGenerator.doCrossSectionWaterLineOut"); - XYSeries series = new StyledXYSeries("water", theme); + // TODO Series should get name like "Q=22.0" + XYSeries series = new StyledXYSeries("Q= ... ", theme); double[][] a = (double [][]) o; double [] pxs = a[0]; @@ -207,6 +183,9 @@ protected void doCrossSectionOut(Object o, Document theme) { logger.debug("CrossSectionGenerator.doCrossSectionOut"); + // TODO Series should get name of selected cross-section (e.g. + // "0-93.1(1990-2002).PRF") (exposed as getCrossSectionName in + // WINFOArtifact) XYSeries series = new StyledXYSeries("aliquide", theme); double[][] a = (double [][]) o; @@ -216,20 +195,5 @@ } addFirstAxisSeries(series); } - - - /** - * Get name of series (displayed in legend). - * @return name of the series. - */ - protected String getSeriesName(WQKms wqkms, String mode) { - String name = wqkms.getName(); - String prefix = name != null && name.indexOf(mode) >= 0 ? null : mode; - - return prefix != null && prefix.length() > 0 - ? prefix + "(" + name +")" - : name; - } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : -
--- a/flys-artifacts/src/main/resources/messages.properties Thu Sep 01 12:47:01 2011 +0000 +++ b/flys-artifacts/src/main/resources/messages.properties Thu Sep 01 13:00:36 2011 +0000 @@ -19,7 +19,6 @@ cross_section = Cross Section - scenario.current = Current scenario.potentiel = Potentiel scenario.scenario = Scenario @@ -35,6 +34,12 @@ chart.longitudinal.section.yaxis.label = W [NN + m] chart.longitudinal.section.yaxis.second.label = Q [m\u00b3/s] chart.longitudinal.annotations.label = {0}.km + +chart.cross_section.title = Cross Section for river {0} +chart.cross_section.subtitle = {0}-km: {1,number,#.###} +chart.cross_section.xaxis.label = Distance [m] +chart.cross_section.yaxis.label = W [NN + m] + chart.discharge.curve.title = Discharge Curve chart.discharge.curve.xaxis.label = Q [m\u00b3/s] chart.discharge.curve.yaxis.label = W [cm]
--- a/flys-artifacts/src/main/resources/messages_de.properties Thu Sep 01 12:47:01 2011 +0000 +++ b/flys-artifacts/src/main/resources/messages_de.properties Thu Sep 01 13:00:36 2011 +0000 @@ -11,11 +11,11 @@ state.winfo.uesk.differences = Differenzen zwischen Wasserspiegellage und Gel\u00e4nde state.winfo.uesk.scenario = \u00dcberschwemmungsfl\u00e4che / Szenario -calc.surface.curve = wasserstand/wasserspiegellage +calc.surface.curve = Wasserstand/Wasserspiegellage calc.flood.map = \u00dcberschwemmungsfl\u00e4che -calc.discharge.curve = abflusskurve/abflusstafel +calc.discharge.curve = Abflusskurve/abflusstafel calc.duration.curve = Dauerlinie -calc.discharge.longitudinal.section = w bei ungleichwertigem Abflussl\u00e4ngsschnitt +calc.discharge.longitudinal.section = W bei ungleichwertigem Abflussl\u00e4ngsschnitt cross_section = Querprofil @@ -29,6 +29,11 @@ calculation_mode = Berechnungsart ld_locations = Ort(e) +chart.cross_section.title = Querprofildiagram für Gew\u00e4sser {0} +chart.cross_section.subtitle = {0}-km: {1,number,#.###} +chart.cross_section.xaxis.label = Abstand [m] +chart.cross_section.yaxis.label = W [NN + m] + chart.longitudinal.section.title = W-L\u00e4ngsschnitt chart.longitudinal.section.subtitle = Bereich: {0}-km {1,number,#.###} - {2,number,#.###} chart.longitudinal.section.xaxis.label = km @@ -51,7 +56,7 @@ chart.duration.curve.curve.w = Wasserstandsdauerline f\u00fcr {0} chart.duration.curve.curve.q = Abflussdauerline f\u00fcr {0} -facet.longitudinal_section.annotations = streckenfavoriten +facet.longitudinal_section.annotations = Streckenfavoriten facet.discharge_curves.mainvalues.q = Q (Haupt- und Extremwerte) facet.discharge_curves.mainvalues.w = W (Haupt- und Extremwerte)
--- a/flys-artifacts/src/main/resources/messages_de_DE.properties Thu Sep 01 12:47:01 2011 +0000 +++ b/flys-artifacts/src/main/resources/messages_de_DE.properties Thu Sep 01 13:00:36 2011 +0000 @@ -29,6 +29,11 @@ calculation_mode = Berechnungsart ld_locations = Ort(e) +chart.cross_section.title = Querprofildiagramm für Gew\u00e4sser {0} +chart.cross_section.subtitle = {0}-km: {1,number,#.###} +chart.cross_section.xaxis.label = Abstand [m] +chart.cross_section.yaxis.label = W [NN + m] + chart.longitudinal.section.title = W-L\u00e4ngsschnitt chart.longitudinal.section.subtitle = Bereich: {0}-km {1,number,#.###} - {2,number,#.###} chart.longitudinal.section.xaxis.label = km
--- a/flys-artifacts/src/main/resources/messages_en.properties Thu Sep 01 12:47:01 2011 +0000 +++ b/flys-artifacts/src/main/resources/messages_en.properties Thu Sep 01 13:00:36 2011 +0000 @@ -29,6 +29,11 @@ calculation_mode = Calculation Mode ld_locations = Location(s) +chart.cross_section.title = Cross Section for river {0} +chart.cross_section.subtitle = {0}-km: {1,number,#.###} +chart.cross_section.xaxis.label = Distance [m] +chart.cross_section.yaxis.label = W [NN + m] + chart.longitudinal.section.title = W-Longitudinal Section chart.longitudinal.section.subtitle = Range: {0}-km {1,number,#.###} - {2,number,#.###} chart.longitudinal.section.xaxis.label = km