diff flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java @ 2206:e2124ca11adb

Add manual point handling for many different chart types. flys-artifacts/trunk@3830 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 30 Jan 2012 13:33:18 +0000
parents 7bac5afb9892
children 4cd0eb2ebb3b
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java	Mon Jan 30 13:29:07 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java	Mon Jan 30 13:33:18 2012 +0000
@@ -38,7 +38,7 @@
 import org.json.JSONException;
 
 /**
- * An OutGenerator that generates discharge curves.
+ * An OutGenerator that generates longitudinal section curves.
  *
  * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
@@ -376,10 +376,10 @@
                 visible);
         
         }
-        else if (FacetTypes.MANUALPOINTS.equals(name)) {
+        else if (FacetTypes.IS.MANUALPOINTS(name)) {
             doPoints(artifactAndFacet.getData(context),
                 artifactAndFacet.getFacetDescription(),
-                attr, visible);
+                attr, visible, YAXIS.W.idx);
         }
         else {
             logger.warn("Unknown facet name: " + name);
@@ -624,47 +624,5 @@
         // 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);
-
-        // Add text annotations for single points.
-        List<XYTextAnnotation> xy = new ArrayList<XYTextAnnotation>();
-
-        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);
-                String name = array.getString(2);
-                boolean act = array.getBoolean(3);
-                if (!act) {
-                    continue;
-                }
-                //logger.debug(" x " + x + " y " + y );
-                series.add(x, y, false);
-                xy.add(new CollisionFreeXYTextAnnotation(name, x, y));
-            }
-        }
-        catch(JSONException e){
-            logger.error("Could not decode json.");
-        }
-        
-        FLYSAnnotation annotations = new FLYSAnnotation(null, null, null, theme);
-        annotations.setTextAnnotations(xy);
-
-        doAnnotations(annotations, null, theme, visible);
-        addAxisSeries(series, YAXIS.W.idx, visible);
-    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org