changeset 65:8b75d01fa5b5

Insert Chart-Classes from old Repository gnv-artifacts/trunk@48 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Wed, 09 Sep 2009 12:02:09 +0000
parents 5db77e0a8594
children bf883222b675
files gnv-artifacts/src/main/java/de/intevation/gnv/chart/ChartFactory.java gnv-artifacts/src/main/java/de/intevation/gnv/chart/ChartLabels.java gnv-artifacts/src/main/java/de/intevation/gnv/chart/ChartStyle.java gnv-artifacts/src/main/java/de/intevation/gnv/chart/Insets.java
diffstat 4 files changed, 723 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/ChartFactory.java	Wed Sep 09 12:02:09 2009 +0000
@@ -0,0 +1,439 @@
+/**
+ * Title:           ChartFactory, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/chart/ChartFactory.java,v 1.8 2007/12/21 12:31:15 blume Exp $
+ * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/chart/ChartFactory.java,v $
+ * created by:      Stefan Blume (blume)
+ * erstellt am:     06.12.2007
+ * Copyright:       con terra GmbH, 2005
+ *
+ * modified by:     $Author: blume $
+ * modified on:     $Date: 2007/12/21 12:31:15 $
+ * Version:         $Revision: 1.8 $
+ * TAG:             $Name:  $
+ * locked from:     $Locker:  $
+ * CVS State:       $State: Exp $
+ * Project:         $ProjectName$
+ */
+package de.intevation.gnv.chart;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.image.BufferedImage;
+import java.io.BufferedOutputStream;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Date;
+
+import org.apache.log4j.Logger;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.axis.AxisLocation;
+import org.jfree.chart.axis.DateAxis;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.axis.NumberTickUnit;
+import org.jfree.chart.encoders.KeypointPNGEncoderAdapter;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.plot.XYPlot;
+import org.jfree.chart.renderer.xy.StandardXYItemRenderer;
+import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
+import org.jfree.data.time.Minute;
+import org.jfree.data.time.TimeSeries;
+import org.jfree.data.time.TimeSeriesCollection;
+import org.jfree.data.xy.XYDataset;
+import org.jfree.ui.RectangleInsets;
+
+import au.com.bytecode.opencsv.CSVReader;
+import de.conterra.bsh.gdi.gnviewer.data.filter.IdValue;
+import de.conterra.bsh.gdi.gnviewer.data.filter.MeasurementId;
+import de.conterra.bsh.gdi.gnviewer.data.filter.ParameterId;
+import de.conterra.bsh.gdi.gnviewer.datasources.ResultSet;
+import de.conterra.bsh.gdi.gnviewer.datasources.Row;
+import de.conterra.bsh.gdi.gnviewer.exception.TechnicalException;
+import de.conterra.bsh.gdi.gnviewer.renderer.DiagramRenderer;
+import de.conterra.bsh.gdi.gnviewer.util.TempFile;
+import de.conterra.bsh.gdi.gnviewer.util.TemporaryFileDirectory;
+
+/**
+ * The class <code>ChartFactory</code> fulfills the following purposes:
+ * <ol>
+ * <li></li>
+ * </ol>
+ * 
+ * @author blume
+ * @version 1.0
+ * @serial 1.0
+ * @see
+ * @since 06.12.2007 17:25:59
+ */
+public class ChartFactory {
+
+	/**
+	 * Default Logging instance
+	 */
+	private static Logger sLogger = Logger.getLogger(ChartFactory.class);
+	private static boolean sDebug = sLogger.isDebugEnabled();
+	private final TemporaryFileDirectory mTmpImageDir;
+
+	/**
+	 * 
+	 */
+	public ChartFactory(TemporaryFileDirectory pTmpImageDir) {
+		mTmpImageDir = pTmpImageDir;
+	}
+
+	public synchronized TempFile createSimpleTimeSeriesChart(
+			ChartLabels pLabels, ChartStyle pStyle, String pTimeSeriesName,
+			TempFile tempF, IdValue[] pParameterId,
+			IdValue[] pMeasurementId, IdValue[] pFeatureId
+			) throws IOException, TechnicalException {
+		if (sDebug)
+			sLogger.debug("createSimpleTimeSeriesChart()");
+		int lLowerLevel = Integer.MIN_VALUE;
+		int lUpperLevel = Integer.MAX_VALUE;
+		if (pStyle.isUseUpperDataLevel()
+				&& pStyle.getUpperLevel() < Integer.MAX_VALUE) {
+			lUpperLevel = pStyle.getUpperLevel();
+		}
+		if (pStyle.isUseLowerDataLevel()
+				&& pStyle.getLowerLevel() > Integer.MIN_VALUE) {
+			lLowerLevel = pStyle.getLowerLevel();
+		}
+		if (sDebug)
+			sLogger.debug("  vor createDataset()");
+		XYDataset lSet = createDataset(pTimeSeriesName, tempF, lUpperLevel,
+				lLowerLevel,pParameterId,pMeasurementId,pFeatureId);
+		if (sDebug)
+			sLogger.debug("  nach createDataset()");
+		final Color[] color = {Color.black, Color.red, Color.green, Color.blue};
+		DateAxis domain = new DateAxis("Zeit [UTC]");
+        NumberAxis axis;
+        StandardXYItemRenderer renderer = new StandardXYItemRenderer();
+		XYPlot plot = new XYPlot();
+		//Global  settings
+		
+		plot.setOrientation(PlotOrientation.VERTICAL);
+		plot.setBackgroundPaint(Color.lightGray);
+		plot.setDomainGridlinePaint(Color.white);
+		plot.setRangeGridlinePaint(Color.white);
+		plot.setAxisOffset(new RectangleInsets(5.0,5.0,5.0,5.0));
+		//plot.getRangeAxis().setFixedDimension(10.0);
+		plot.setDomainAxis(domain);
+		plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
+		if (pParameterId.length == 1) {
+			axis = new NumberAxis(pParameterId[0].getTitle());
+			if(pParameterId[0].getTitle().contains("richtung")){
+				NumberAxis axis1 = new NumberAxis(
+						((String) pParameterId[0].getTitle()));//,new Range(0.0,360.0));
+			    axis1.setTickUnit(new NumberTickUnit(30.0));
+				axis1.setUpperBound(360.0);
+				axis1.setLowerBound(0.0);
+                //axis1.setDisplayRange(0.0,360.0);				    
+				plot.setRangeAxis( axis1);
+			}else{
+			axis.setFixedDimension(10.0);
+			axis.setAutoRangeIncludesZero(false);
+			plot.setRangeAxis(axis);
+			}
+			axis.configure();
+			plot.setRangeAxisLocation( AxisLocation.BOTTOM_OR_LEFT);
+			plot.setRenderer(renderer);
+			plot.setDataset(lSet);
+		} else {
+			// Individual settings for different parameters
+			for (int i = 0; i < lSet.getSeriesCount(); i++) {
+
+				plot.setDataset(i, getDataset((TimeSeriesCollection) lSet, i));
+				Color mColor=color[i % color.length];  // zyklische Farbvergabe
+				mColor = color[0];
+				// if ( pParameterId.length==1){
+				
+				if(((String) lSet.getSeriesKey(i)).contains("richtung")){
+					NumberAxis axis1 = new NumberAxis(((String) lSet.getSeriesKey(i)));//,new Range(0.0,360.0));
+				    axis1.setTickUnit(new NumberTickUnit(30.0));
+                    //axis1.setDisplayRange(0.0,360.0);				    
+					axis1.setLabelPaint(mColor);
+					axis1.setTickLabelPaint(mColor);
+					axis1.setUpperBound(360.0);
+					axis1.setLowerBound(0.0);
+					plot.setRangeAxis(i, axis1);
+					
+			    
+				}
+				else {
+					axis = new NumberAxis((String) lSet.getSeriesKey(i));
+					axis.setFixedDimension(10.0);
+					axis.setAutoRangeIncludesZero(false);
+					axis.setLabelPaint(mColor);
+					axis.setTickLabelPaint(mColor);
+					plot.setRangeAxis(i, axis);
+					axis.configure();
+				}
+				if (i % 2 != 0)
+					plot.setRangeAxisLocation(i, AxisLocation.BOTTOM_OR_RIGHT);
+				else
+					plot.setRangeAxisLocation(i, AxisLocation.BOTTOM_OR_LEFT);
+				plot.mapDatasetToRangeAxis(i, i);
+				// }
+				renderer = new StandardXYItemRenderer();
+				renderer.setSeriesPaint(i, mColor);
+				// renderer.setSeriesStroke(i,stroke[j]);
+				plot.setRenderer(i, renderer);
+			}
+		}
+		JFreeChart chart = new JFreeChart(
+				pLabels.getTitle(),
+				new Font ("SansSerif",Font.BOLD,24),
+				plot,true);
+		
+
+		setStyle(chart, pStyle);
+		configureRenderingOptions(chart);
+		if (sDebug)
+			sLogger.debug("  vor encodeChart()");
+		
+		return encodeChart(chart, pStyle);
+	}
+    private static XYDataset getDataset(TimeSeriesCollection T, int pIndex){ //throws TechnicalException{
+    	//if (T.getSeriesCount() < pIndex) throw TechnicalException();
+    	TimeSeriesCollection TSC = new TimeSeriesCollection();
+    	TSC.addSeries(T.getSeries(pIndex));
+    	return (XYDataset) TSC;
+    }
+	public synchronized TempFile createScatterPlot(ChartStyle pStyle,
+			ResultSet pResults) throws TechnicalException, IOException {
+		ScatterPlot lPlot = new ScatterPlot("ScatterPlot", pResults);
+		return encodeChart(lPlot.getChart(), pStyle);
+	}
+
+	private void configureRenderingOptions(JFreeChart pJfreechart) {
+		org.jfree.chart.renderer.xy.XYItemRenderer xyitemrenderer = ((XYPlot) pJfreechart
+				.getPlot()).getRenderer();
+		if (xyitemrenderer instanceof XYLineAndShapeRenderer) {
+			XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyitemrenderer;
+			xylineandshaperenderer.setBaseShapesVisible(true);
+			xylineandshaperenderer.setBaseShapesFilled(true);
+		}
+	}
+
+	private void setStyle(JFreeChart pJfreechart, ChartStyle pStyle) {
+		if (sDebug)
+			sLogger.debug("setStyle()");
+		pJfreechart.setBackgroundPaint(pStyle.getCanvasColor());
+		XYPlot xyplot = (XYPlot) pJfreechart.getPlot();
+		xyplot.setBackgroundPaint(pStyle.getPlotBackgroundColor());
+		xyplot.setDomainGridlinePaint(pStyle.getDomainGridlineColor());
+		xyplot.setRangeGridlinePaint(pStyle.getRangeGridlineColor());
+
+		Insets lOffsets = pStyle.getAxisOffset();
+		RectangleInsets lRectangleInsets = new RectangleInsets(lOffsets.mUpper,
+				lOffsets.mLeft, lOffsets.mLower, lOffsets.mRight);
+		xyplot.setAxisOffset(lRectangleInsets);
+		xyplot.setDomainCrosshairVisible(pStyle.isDomainCrosshairVisible());
+		xyplot.setRangeCrosshairVisible(pStyle.isRangeCrosshairVisible());
+
+	}
+	
+	
+	private TimeSeries createTimeSeries(String pTimeSeriesName, TempFile tempF, 
+			int lUpperCut, int lLowerCut,int pStart,int pEnd, Date dStart, Date dEnd) throws TechnicalException{
+		if (sDebug)
+			sLogger.debug("createTimeSeries()");
+		Row lRow0, lRow1, lRowVorEnd;
+		
+		Date lDate=null, lDate0=null;
+        DiagramRenderer mDiagramRenderer = new DiagramRenderer();
+        
+        CSVReader reader = null;
+		TimeSeries lTimeseries = new TimeSeries(pTimeSeriesName,   
+				org.jfree.data.time.Minute.class);
+		try {
+			reader = new CSVReader (new FileReader(tempF.getFile()), ';');
+			
+			
+			
+			long maxGap=0, lDateDiff=0;
+			double lValue=0;
+			String [] lRow = null;
+
+			int i = 0;
+            while ((lRow = reader.readNext()) != null){
+            	
+            	if (i >= pStart+1 && i <= pEnd){
+            		if (i == pStart+1){
+                		lRow0 = new Row(lRow);//
+            			
+            			// Handle Gaps > 0.5% timeserieslength, i.e do not draw here
+            			// +TODO mache maxGap variabel über diagram options
+            			maxGap = (dEnd.getTime() - dStart.getTime()) / 200; // 0,5 prozent der Länge
+            			if (maxGap < 3600000) maxGap=3600010;
+            			if (maxGap <(dEnd.getTime() - dStart.getTime())/(pEnd-pStart))
+            				maxGap = (dEnd.getTime() - dStart.getTime())/(pEnd-pStart) + 1000;
+            			
+            			if (sDebug)
+            				sLogger.debug("MaxGap : "+maxGap/1000+" Länge : "+(dEnd.getTime() - dStart.getTime())/1000+
+            						      "Intervall "+(dEnd.getTime() - dStart.getTime())/(pEnd-pStart)/1000);
+            			lDate = lRow0.getDateValue(0);
+            			lDate0 = lDate;
+            			lValue = lRow0.getDoubleValue(1);
+            			if (lValue > lLowerCut && lValue < lUpperCut){
+            				//lTimeseries.addOrUpdate(new Minute(lDate), lValue);
+            				lTimeseries.add(new Minute(lDate), lValue);
+            			}
+                	}
+				//for (int i = pStart+1; i <= pEnd; i++) {
+					lRow1 = new Row (lRow);
+					lDate = lRow1.getDateValue(0);
+					lValue = lRow1.getDoubleValue(1);
+					lDateDiff = lDate.getTime() - lDate0.getTime();
+					if (lDateDiff > maxGap) {
+						// add 1 minute in millisecs to left hand side Date
+						// and insert Dummy to break line
+						lDate0.setTime((lDate0.getTime() + 60000)); 
+						lTimeseries.addOrUpdate(new Minute(lDate0), null);						 
+						lTimeseries.addOrUpdate(new Minute(lDate), lValue);
+						//lTimeseries.add(new Minute(lDate0), null);
+					} else if (lDateDiff == 0) {
+						if (sDebug)
+								sLogger.debug("Datediff: "+lDateDiff+" bei index : "+i+" Datum : "+lDate+" "+lDate0);
+					}
+					 else if (lValue > lLowerCut && lValue < lUpperCut) {
+						lTimeseries.addOrUpdate(new Minute(lDate), lValue);
+						//lTimeseries.add(new Minute(lDate), lValue);
+					 }
+					lRow0 = lRow1;
+					lDate0 = lDate;
+				}
+				i++;
+            }
+			
+
+		} catch (OutOfMemoryError e) { 
+			sLogger.error(e.getMessage(), e);
+			return lTimeseries;
+		
+		} catch (Exception e) { //TechnicalException
+			sLogger.error(e.getMessage(), e);
+		}
+		finally {
+			try{
+				reader.close();
+			}
+			catch (Exception e){
+				sLogger.error(e.getMessage(), e);
+			}
+		}
+		
+		return lTimeseries;
+	}
+
+	private XYDataset createDataset(String pTimeseriesName, TempFile tempF,
+			int lUpperCut, int lLowerCut,IdValue[] pParameterId,
+			IdValue[] pMeasurementId, IdValue[] pFeatureID) throws TechnicalException {
+		
+		CSVReader reader=null;
+		TimeSeriesCollection lTimeSeriesCollection = new TimeSeriesCollection();
+		try{
+			for (int i=0;i<pMeasurementId.length;i++) System.out.println("Measurement Depth "+
+				            pMeasurementId[i].getTitle() );
+			for (int i=0;i<pParameterId.length;i++) System.out.println("Parameter "+
+		            pParameterId[i].getTitle() );
+			
+			Date dStart = null, dEnd= null;
+			int break1, break2, break3;
+			int mStart = 0;
+			int mEnd = 0;
+			
+			reader = new CSVReader (new FileReader(tempF.getFile()), ';');
+	
+			String [] sArrayStrLine = reader.readNext();
+			
+			Row row = new Row(sArrayStrLine);
+			
+			break1 = new Integer (sArrayStrLine[2]).intValue();
+			break2 = new Integer (sArrayStrLine[3]).intValue();
+			break3 = new Integer (sArrayStrLine[4]).intValue();
+			dStart = row.getDateValue(0);
+			int i = 1;
+			while ((sArrayStrLine = reader.readNext()) != null) {
+				row = new Row(sArrayStrLine);
+				if (break1 != new Integer (sArrayStrLine[2]).intValue()
+						|| break2 != new Integer (sArrayStrLine[3]).intValue()
+					    || break3 != new Integer (sArrayStrLine[4]).intValue()){
+					String mTimeSeriesName = findValueTitle(pParameterId,break1)+" "+
+					                         findValueTitle(pMeasurementId,break2)+"m";
+					
+					lTimeSeriesCollection.addSeries(createTimeSeries(mTimeSeriesName,
+							tempF, lUpperCut, lLowerCut, mStart, mEnd, dStart, dEnd));
+					mStart = i;
+					dStart = row.getDateValue(0);
+					break1 = new Integer (sArrayStrLine[2]).intValue();
+					break2 = new Integer (sArrayStrLine[3]).intValue();
+					break3 = new Integer (sArrayStrLine[4]).intValue();
+	
+				}
+				mEnd = i;
+				//mEnd ++;
+				dEnd = row.getDateValue(0);
+				i = i + 1;
+			}
+			String mTimeSeriesName = findValueTitle(pParameterId,break1)+" "+
+	                                 findValueTitle(pMeasurementId,break2)+"m";
+			lTimeSeriesCollection.addSeries(createTimeSeries(mTimeSeriesName,
+					tempF, lUpperCut, lLowerCut, mStart, mEnd, dStart, dEnd));
+			
+		}
+		catch (Exception e){
+			sLogger.error(e.getMessage(), e);
+		}
+		finally{
+			try{
+			reader.close();
+			}
+			catch (Exception e){
+				sLogger.error(e.getMessage(), e);
+			}
+		}
+		return lTimeSeriesCollection;
+	}
+
+
+
+	private TempFile encodeChart(JFreeChart pChart, ChartStyle pStyle)
+			throws IOException {
+		if (sDebug)
+			sLogger.debug("encodeChart()");
+		KeypointPNGEncoderAdapter lEncoder = new KeypointPNGEncoderAdapter();
+		lEncoder.setEncodingAlpha(true);
+
+		int lWidth = (int) pStyle.getChartSize().getWidth();
+		int lHeight = (int) pStyle.getChartSize().getHeight();
+
+		FileOutputStream lFileOutputStream = null;
+		BufferedOutputStream lBufferedOutputStream = null;
+
+		TempFile lImageFile = mTmpImageDir.createFile(".png");
+
+		BufferedImage lImage = pChart.createBufferedImage(lWidth, lHeight,
+				BufferedImage.BITMASK, null);
+		lFileOutputStream = new FileOutputStream(lImageFile.getFile());
+		lBufferedOutputStream = new BufferedOutputStream(lFileOutputStream);
+		lEncoder.encode(lImage, lBufferedOutputStream);
+		lBufferedOutputStream.close();
+		lFileOutputStream.close();
+
+		return lImageFile;
+
+	}
+
+    private String findValueTitle(IdValue[] pValueId,int pMmtId){
+    	for (int i=0;i<pValueId.length;i++){
+    		if ((long) pMmtId ==pValueId[i].getValue())return pValueId[i].getTitle();
+    	}
+    	return "";
+    }
+    private String findValueTitle(IdValue[] pValueId,long pMmtId){
+    	for (int i=0;i<pValueId.length;i++){
+    		if ( pMmtId ==pValueId[i].getValue())return pValueId[i].getTitle();
+    	}
+    	return "";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/ChartLabels.java	Wed Sep 09 12:02:09 2009 +0000
@@ -0,0 +1,82 @@
+/* Copyright (C) 2007 con terra GmbH (http://www.conterra.de)
+ * All rights reserved
+ *
+ * $Id: ChartLabels.java,v 1.1 2007/12/10 13:57:13 drewnak Exp $
+ *
+ * created by:      drewnak
+ * created at :     10.12.2007
+ * created at :     11:48:39
+ *
+ * modified by:     $Author: drewnak $
+ * modified at:     $Date: 2007/12/10 13:57:13 $
+ */
+package de.intevation.gnv.chart;
+
+/**
+ * @author  drewnak
+ */
+public class ChartLabels {
+    /**
+     * 
+     */
+    private String mTitle;
+    /**
+     * 
+     */
+    private String mTimeAxisLabel;
+    /**
+     * 
+     */
+    private String mValueAxisLabel;
+    /**
+     * 
+     */
+    public ChartLabels(String pTitle, String pTimeAxisLabel, String pValueAxisLabel) {
+        mTitle = pTitle;
+        mTimeAxisLabel = pTimeAxisLabel;
+        mValueAxisLabel = pValueAxisLabel;
+    }
+
+    /**
+     * @return the title
+     */
+    public String getTitle() {
+        return mTitle;
+    }
+
+    /**
+     * @param pTitle the title to set
+     */
+    public void setTitle(String pTitle) {
+        mTitle = pTitle;
+    }
+
+    /**
+     * @return the timeAxisLabel
+     */
+    public String getTimeAxisLabel() {
+        return mTimeAxisLabel;
+    }
+
+    /**
+     * @param pTimeAxisLabel the timeAxisLabel to set
+     */
+    public void setTimeAxisLabel(String pTimeAxisLabel) {
+        mTimeAxisLabel = pTimeAxisLabel;
+    }
+
+    /**
+     * @return the valueAxisLabel
+     */
+    public String getValueAxisLabel() {
+        return mValueAxisLabel;
+    }
+
+    /**
+     * @param pValueAxisLabel the valueAxisLabel to set
+     */
+    public void setValueAxisLabel(String pValueAxisLabel) {
+        mValueAxisLabel = pValueAxisLabel;
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/ChartStyle.java	Wed Sep 09 12:02:09 2009 +0000
@@ -0,0 +1,169 @@
+/* Copyright (C) 2007 con terra GmbH (http://www.conterra.de)
+ * All rights reserved
+ *
+ * $Id: ChartStyle.java,v 1.2 2007/12/21 12:31:15 blume Exp $
+ *
+ * created by:      drewnak
+ * created at :     10.12.2007
+ * created at :     13:07:44
+ *
+ * modified by:     $Author: blume $
+ * modified at:     $Date: 2007/12/21 12:31:15 $
+ */
+package de.intevation.gnv.chart;
+
+import java.awt.Color;
+import java.awt.Dimension;
+
+/**
+ * @author drewnak
+ */
+public class ChartStyle {
+
+    private Color mCanvasColor;
+    private Color mPlotBackgroundColor;
+    private Color mDomainGridlineColor;
+    private Color mRangeGridlineColor;
+    private boolean mDomainCrosshairVisible;
+    private boolean mRangeCrosshairVisible;
+    private Insets mAxisOffset;
+    private boolean mOverrideDefaultChartWidth = false;
+    private Dimension mChartSize;
+
+    private boolean mUseUpperDataLevel = false;
+    private boolean mUseLowerDataLevel = false;
+    private int mUpperLevel;
+    private int mLowerLevel;
+
+    /**
+     * @param pCanvasColor
+     * @param pPlotBackgroundColor
+     * @param pDomainGridlineColor
+     * @param pRangeGridlineColor
+     * @param pDomainCrosshairVisible
+     * @param pRangeCrosshairVisible
+     * @param pAxisOffset
+     */
+    public ChartStyle(Color pCanvasColor, Color pPlotBackgroundColor, Color pDomainGridlineColor,
+                      Color pRangeGridlineColor, boolean pDomainCrosshairVisible, boolean pRangeCrosshairVisible,
+                      Insets pAxisOffset, Dimension pChartSize) {
+        super();
+        mCanvasColor = pCanvasColor;
+        mPlotBackgroundColor = pPlotBackgroundColor;
+        mDomainGridlineColor = pDomainGridlineColor;
+        mRangeGridlineColor = pRangeGridlineColor;
+        mDomainCrosshairVisible = pDomainCrosshairVisible;
+        mRangeCrosshairVisible = pRangeCrosshairVisible;
+        mAxisOffset = pAxisOffset;
+        mChartSize = pChartSize;
+    }
+
+    public Color getCanvasColor() {
+        return mCanvasColor;
+    }
+
+    public void setCanvasColor(Color pCanvasColor) {
+        mCanvasColor = pCanvasColor;
+    }
+
+    public Color getDomainGridlineColor() {
+        return mDomainGridlineColor;
+    }
+
+    public void setDomainGridlineColor(Color pDomainGridlineColor) {
+        mDomainGridlineColor = pDomainGridlineColor;
+    }
+
+    public Color getRangeGridlineColor() {
+        return mRangeGridlineColor;
+    }
+
+    public void setRangeGridlineColor(Color pRangeGridlineColor) {
+        mRangeGridlineColor = pRangeGridlineColor;
+    }
+
+    public boolean isDomainCrosshairVisible() {
+        return mDomainCrosshairVisible;
+    }
+
+    public void setDomainCrosshairVisible(boolean pDomainCrosshairVisible) {
+        mDomainCrosshairVisible = pDomainCrosshairVisible;
+    }
+
+    public boolean isRangeCrosshairVisible() {
+        return mRangeCrosshairVisible;
+    }
+
+    public void setRangeCrosshairVisible(boolean pRangeCrosshairVisible) {
+        mRangeCrosshairVisible = pRangeCrosshairVisible;
+    }
+
+    public Insets getAxisOffset() {
+        return mAxisOffset;
+    }
+
+    public void setAxisOffset(Insets pAxisOffset) {
+        mAxisOffset = pAxisOffset;
+    }
+
+    public Color getPlotBackgroundColor() {
+        return mPlotBackgroundColor;
+    }
+
+    public void setPlotBackgroundColor(Color pPlotBackgroundColor) {
+        mPlotBackgroundColor = pPlotBackgroundColor;
+    }
+
+    public Dimension getChartSize() {
+        return mChartSize;
+    }
+
+    public void setChartSize(Dimension pChartSize) {
+        mChartSize = pChartSize;
+    }
+
+    public boolean isOverrideDefaultChartWidth() {
+        return mOverrideDefaultChartWidth;
+    }
+
+    public void setOverrideDefaultChartWidth(boolean pOverrideDefaultChartWidth) {
+        mOverrideDefaultChartWidth = pOverrideDefaultChartWidth;
+    }
+
+
+    public void setNewChartWidth(int pNewChartWidth) {
+        mChartSize.setSize(pNewChartWidth, mChartSize.getHeight());
+    }
+
+    public boolean isUseUpperDataLevel() {
+        return mUseUpperDataLevel;
+    }
+
+    public void setUseUpperDataLevel(boolean pUseUpperDataLevel) {
+        mUseUpperDataLevel = pUseUpperDataLevel;
+    }
+
+    public boolean isUseLowerDataLevel() {
+        return mUseLowerDataLevel;
+    }
+
+    public void setUseLowerDataLevel(boolean pUseLowerDataLevel) {
+        mUseLowerDataLevel = pUseLowerDataLevel;
+    }
+
+    public int getUpperLevel() {
+        return mUpperLevel;
+    }
+
+    public void setUpperLevel(int pUpperLevel) {
+        mUpperLevel = pUpperLevel;
+    }
+
+    public int getLowerLevel() {
+        return mLowerLevel;
+    }
+
+    public void setLowerLevel(int pLowerLevel) {
+        mLowerLevel = pLowerLevel;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/Insets.java	Wed Sep 09 12:02:09 2009 +0000
@@ -0,0 +1,33 @@
+/* Copyright (C) 2007 con terra GmbH (http://www.conterra.de)
+ * All rights reserved
+ *
+ * $Id: Insets.java,v 1.1 2007/12/10 13:57:13 drewnak Exp $
+ *
+ * created by:      drewnak
+ * created at :     10.12.2007
+ * created at :     13:31:12
+ *
+ * modified by:     $Author: drewnak $
+ * modified at:     $Date: 2007/12/10 13:57:13 $
+ */
+package de.intevation.gnv.chart;
+
+public class Insets {
+    public double mUpper;
+    public double mLower;
+    public double mLeft;
+    public double mRight;
+    /**
+     * @param pUpper
+     * @param pLower
+     * @param pLeft
+     * @param pRight
+     */
+    public Insets(double pUpper, double pLeft, double pLower, double pRight) {
+        super();
+        mUpper = pUpper;
+        mLower = pLower;
+        mLeft = pLeft;
+        mRight = pRight;
+    }
+}
\ No newline at end of file

http://dive4elements.wald.intevation.org