[Schmitzm-commits] r949 - in trunk/src_junit/schmitzm/jfree/feature/style: . testLineChartShape

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Jul 28 12:36:05 CEST 2010


Author: alfonx
Date: 2010-07-28 12:36:05 +0200 (Wed, 28 Jul 2010)
New Revision: 949

Modified:
   trunk/src_junit/schmitzm/jfree/feature/style/FeatureChartStyleTest.java
   trunk/src_junit/schmitzm/jfree/feature/style/testLineChartShape/testKreiseLineChart.dbf
   trunk/src_junit/schmitzm/jfree/feature/style/testLineChartShape/testKreiseLineChart.prj
   trunk/src_junit/schmitzm/jfree/feature/style/testLineChartShape/testKreiseLineChart.shp
   trunk/src_junit/schmitzm/jfree/feature/style/testLineChartShape/testKreiseLineChart.shx
Log:
Testcase f?\195?\188r zwei Achsen 

Modified: trunk/src_junit/schmitzm/jfree/feature/style/FeatureChartStyleTest.java
===================================================================
--- trunk/src_junit/schmitzm/jfree/feature/style/FeatureChartStyleTest.java	2010-07-28 09:45:11 UTC (rev 948)
+++ trunk/src_junit/schmitzm/jfree/feature/style/FeatureChartStyleTest.java	2010-07-28 10:36:05 UTC (rev 949)
@@ -45,7 +45,124 @@
 	private static Logger log = Logger.getLogger(FeatureChartStyleTest.class);
 
 	FeatureChartStyleXMLFactory xmlFactory = new FeatureChartStyleXMLFactory();
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	@Test
+	public void testLineChartDualAxis() throws IOException, CQLException,
+			InterruptedException {
 
+		FeatureCollection<SimpleFeatureType, SimpleFeature> testFeatures = TestingUtil2
+				.getTestFeatures();
+
+		// Daten auf korrektheit überprüfen
+		String groupAttribName = "code"; // KreisZahl
+		SimpleFeatureType testDatenSchema = testFeatures.getSchema();
+		assertNotNull(testDatenSchema.getDescriptor(groupAttribName));
+		String variablenAttribName = "dm_u3"; // Deutsche "Männer" unter 3 Jahren
+		assertNotNull(testDatenSchema.getDescriptor(variablenAttribName));
+		String labelAttribName = "title"; // Attribute mit Label für Series
+		assertNotNull(testDatenSchema.getDescriptor(labelAttribName));
+		String domainAttribName = "jahr"; // Diese Variable soll auf der X-Achse
+		assertNotNull(testDatenSchema.getDescriptor(domainAttribName));
+		String variablenAttribName2 = "w_bev"; // Frauen Bevölkerung 
+		assertNotNull(testDatenSchema.getDescriptor(variablenAttribName2));
+
+		ChartAxisStyle domainAxisStyle = new ChartAxisStyle("jahreszahlen",
+				Color.red, 0., 0.);
+
+		ChartAxisStyle rangeAxisStyle = new ChartAxisStyle("deut. maenner",
+				Color.green, 0., 0.);
+		
+		ChartAxisStyle rangeAxisStyle2 = new ChartAxisStyle("Weibl. Bevölkerung",
+				Color.blue, 0., 0.);
+
+		FeatureBasicChartStyle lineChartStyle = new FeatureBasicChartStyle(
+				"testDoubleLineChart", ChartType.LINE);
+		lineChartStyle.setAxisStyle(0, domainAxisStyle);
+		lineChartStyle.setAxisStyle(1, rangeAxisStyle);
+		lineChartStyle.setAxisStyle(2, rangeAxisStyle2);
+
+		lineChartStyle.setAttributeName(0, domainAttribName);
+		lineChartStyle.setAttributeName(1, variablenAttribName);
+		lineChartStyle.setAttributeName(2, variablenAttribName2);
+
+		lineChartStyle.setSeriesAttributeName(groupAttribName);
+		
+		lineChartStyle.setSeriesLegendTitleAttributeName(labelAttribName);
+
+		assertNull("Wenn nicht explizit gesetzt wird null geliefert",
+				lineChartStyle.getRendererStyle(0));
+
+		ChartRendererStyle chartRendererStyle = new ChartRendererStyle();
+
+		chartRendererStyle.setDefaultPaint(Color.blue);
+
+		chartRendererStyle.setSeriesPaint(0, Color.green);
+		chartRendererStyle.setSeriesPaint(1, Color.red);
+		chartRendererStyle.setSeriesPaint(2, Color.GRAY);
+		lineChartStyle.setRendererStyle(0, chartRendererStyle);
+
+		assertEquals(3, chartRendererStyle.getSeriesCount());
+
+		JFreeChart lineChart = lineChartStyle
+				.applyToFeatureCollection(testFeatures);
+		assertNotNull("applyToFeatureCollection lieferte null!", lineChart);
+
+		if (INTERACTIVE) {
+			ChartFrame chartFrame = new ChartFrame(
+					"Sechs Linien (3x2), Zwei Achsen",
+					lineChart);
+			chartFrame.pack();
+			chartFrame.setVisible(true);
+			while (chartFrame.isVisible()) {
+				Thread.sleep(100);
+			}
+		}
+
+		File testFile = File.createTempFile("testDoubleLineChart", ".xml");
+		xmlFactory.writeStyleToFile(lineChartStyle, "testDoubleLineChart", testFile);
+
+		assertTrue(testFile.getAbsolutePath() + " wurde nicht geschrieben!",
+				testFile.exists());
+
+		String writtenXML = IOUtil.readFileAsString(testFile);
+
+		// XML wieder einlesen
+		FeatureChartStyle lineChartAUsXMLgelesen = xmlFactory
+				.readStyleFromFile(testFile);
+
+		// Nochmal in XML schreiben
+		File testFile2 = File.createTempFile("testDoubleLineChart", ".xml");
+		xmlFactory.writeStyleToFile(lineChartAUsXMLgelesen, "testDoubleLineChart",
+				testFile2);
+		assertEquals(
+				"Nachdem das Style geschrieben, gelesen und wieder geschrieben wurde ist das XML nicht gleich!",
+				writtenXML, IOUtil.readFileAsString(testFile2));
+	}
+
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+
 	/**
 	 * If tests are run on a system with head, we may theoretically open dialgs,
 	 * frames etc.
@@ -484,5 +601,10 @@
 				"Nachdem das Style geschrieben, gelesen und wieder geschrieben wurde ist das XML nicht gleich!",
 				writtenXML, IOUtil.readFileAsString(testFile2));
 	}
+	
+	
+	
+	
 
+
 }

Modified: trunk/src_junit/schmitzm/jfree/feature/style/testLineChartShape/testKreiseLineChart.dbf
===================================================================
(Binary files differ)

Modified: trunk/src_junit/schmitzm/jfree/feature/style/testLineChartShape/testKreiseLineChart.prj
===================================================================
--- trunk/src_junit/schmitzm/jfree/feature/style/testLineChartShape/testKreiseLineChart.prj	2010-07-28 09:45:11 UTC (rev 948)
+++ trunk/src_junit/schmitzm/jfree/feature/style/testLineChartShape/testKreiseLineChart.prj	2010-07-28 10:36:05 UTC (rev 949)
@@ -0,0 +1 @@
+PROJCS["WGS84 / Google Mercator", GEOGCS["WGS 84", DATUM["World Geodetic System 1984", SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], UNIT["degree", 0.017453292519943295], AXIS["Longitude", EAST], AXIS["Latitude", NORTH], AUTHORITY["EPSG","4326"]], PROJECTION["Mercator_1SP"], PARAMETER["semi_minor", 6378137.0], PARAMETER["latitude_of_origin", 0.0], PARAMETER["central_meridian", 0.0], PARAMETER["scale_factor", 1.0], PARAMETER["false_easting", 0.0], PARAMETER["false_northing", 0.0], UNIT["m", 1.0], AXIS["x", EAST], AXIS["y", NORTH], AUTHORITY["EPSG","900913"]]
\ No newline at end of file

Modified: trunk/src_junit/schmitzm/jfree/feature/style/testLineChartShape/testKreiseLineChart.shp
===================================================================
(Binary files differ)

Modified: trunk/src_junit/schmitzm/jfree/feature/style/testLineChartShape/testKreiseLineChart.shx
===================================================================
(Binary files differ)



More information about the Schmitzm-commits mailing list