# HG changeset patch # User Felix Wolfsteller # Date 1327583539 0 # Node ID 3f90f4d37c8d2bb5b2150c0abc28d15f804e547f # Parent 98f7397d8f02cae43aabc78d0797d6decbc15a84 Render manual points in longitudinal sections. flys-artifacts/trunk@3770 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 98f7397d8f02 -r 3f90f4d37c8d flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Thu Jan 26 12:56:57 2012 +0000 +++ b/flys-artifacts/ChangeLog Thu Jan 26 13:12:19 2012 +0000 @@ -1,3 +1,21 @@ +2012-01-26 Felix Wolfsteller + + Renderer 'manual' points in LongitudinalSectionGenerator. + + * pom.xml: New dependency to org.json/json. + + * src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java: + (doOut): Handle manual points. + (doPoints): Add point- series. + + * src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java: + Added MANUALPOINTS Facet Type. + + * doc/conf/themes.xml: Added Default Theme for Manual Points. + + * doc/conf/artifacts/winfo.xml: Added manual point facet to + compatibility list of longitudinal section diagram. + 2012-01-26 Felix Wolfsteller Cosmetics. diff -r 98f7397d8f02 -r 3f90f4d37c8d flys-artifacts/doc/conf/artifacts/winfo.xml --- a/flys-artifacts/doc/conf/artifacts/winfo.xml Thu Jan 26 12:56:57 2012 +0000 +++ b/flys-artifacts/doc/conf/artifacts/winfo.xml Thu Jan 26 13:12:19 2012 +0000 @@ -274,6 +274,7 @@ + diff -r 98f7397d8f02 -r 3f90f4d37c8d flys-artifacts/doc/conf/themes.xml --- a/flys-artifacts/doc/conf/themes.xml Thu Jan 26 12:56:57 2012 +0000 +++ b/flys-artifacts/doc/conf/themes.xml Thu Jan 26 13:12:19 2012 +0000 @@ -942,5 +942,6 @@ + diff -r 98f7397d8f02 -r 3f90f4d37c8d flys-artifacts/pom.xml --- a/flys-artifacts/pom.xml Thu Jan 26 12:56:57 2012 +0000 +++ b/flys-artifacts/pom.xml Thu Jan 26 13:12:19 2012 +0000 @@ -120,6 +120,11 @@ gt-geojson 2.7.2 + + org.json + json + 20090211 + org.apache.velocity velocity diff -r 98f7397d8f02 -r 3f90f4d37c8d flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java Thu Jan 26 12:56:57 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java Thu Jan 26 13:12:19 2012 +0000 @@ -78,6 +78,8 @@ String DURATION_Q = "duration_curve.q"; String DURATION_MAINVALUES_Q = "duration_curve.mainvalues.q"; + String MANUALPOINTS = "manualpoints"; + String STATIC_WQ = "other.wq"; String STATIC_WQ_ANNOTATIONS = "other.wq.annotations"; String STATIC_WKMS = "other.wkms"; diff -r 98f7397d8f02 -r 3f90f4d37c8d flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Thu Jan 26 12:56:57 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Thu Jan 26 13:12:19 2012 +0000 @@ -29,6 +29,8 @@ import de.intevation.flys.utils.FLYSUtils; import de.intevation.flys.utils.DataUtil; +import org.json.JSONArray; +import org.json.JSONException; /** * An OutGenerator that generates discharge curves. @@ -369,6 +371,11 @@ visible); } + else if (FacetTypes.MANUALPOINTS.equals(name)) { + doPoints(artifactAndFacet.getData(context), + artifactAndFacet.getFacetDescription(), + attr, visible); + } else { logger.warn("Unknown facet name: " + name); return; @@ -532,6 +539,7 @@ } } + /** * Do Area out. */ @@ -611,5 +619,34 @@ // Add area to the respective axis. addAreaSeries(area, axisIdxForFacet(data.getRootFacetName()), visible); } + + + /** + * Do Points out. + */ + protected void doPoints( + Object o, + String seriesName, + Document theme, + boolean visible + ) { + XYSeries series = new StyledXYSeries(seriesName, theme); + + try { + JSONArray points = new JSONArray((String) o); + for (int i = 0; i < points.length(); i++) { + JSONArray array = points.getJSONArray(i); + double x = array.getDouble(0); + double y = array.getDouble(1); + //logger.debug(" x " + x + " y " + y ); + series.add(x, y, false); + } + } + catch(JSONException e){ + logger.error("Could not decode json."); + } + + addAxisSeries(series, YAXIS.W.idx, visible); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :