Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java @ 6905:1b35b2ddfc28
Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 22 Aug 2013 23:31:38 +0200 |
parents | a071f0a80883 |
children | 88b70c788b0f |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -27,7 +27,6 @@ import org.jfree.ui.RectangleAnchor; import org.jfree.ui.RectangleInsets; import org.jfree.ui.TextAnchor; -import org.w3c.dom.Document; import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifactdatabase.state.Facet; @@ -57,8 +56,8 @@ import org.dive4elements.river.jfree.StyledXYSeries; import org.dive4elements.river.model.Gauge; import org.dive4elements.river.model.River; +import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.utils.RiverUtils; -import org.dive4elements.river.utils.ThemeUtil; /** * Generator for WQ fixing charts. @@ -175,7 +174,7 @@ } @Override - public void doOut(ArtifactAndFacet aaf, Document doc, boolean visible) { + public void doOut(ArtifactAndFacet aaf, ThemeDocument doc, boolean visible) { logger.debug("doOut: " + aaf.getFacetName()); if (!prepareChartData(aaf, doc, visible)) { logger.warn("Unknown facet, name " + aaf.getFacetName()); @@ -186,7 +185,7 @@ * Return true if data could be handled, * to be overridden to add more handled data. */ - public boolean prepareChartData(ArtifactAndFacet aaf, Document doc, boolean visible) { + public boolean prepareChartData(ArtifactAndFacet aaf, ThemeDocument doc, boolean visible) { String name = aaf.getFacetName(); this.artifact = (D4EArtifact) aaf.getArtifact(); @@ -257,7 +256,7 @@ /** Add sector average points to chart. */ - protected void doSectorAverageOut(ArtifactAndFacet aaf, Document doc, boolean visible) { + protected void doSectorAverageOut(ArtifactAndFacet aaf, ThemeDocument doc, boolean visible) { logger.debug("doSectorAverageOut"); QWDDateRange qwdd = (QWDDateRange) aaf.getData(context); @@ -272,7 +271,7 @@ } /** Add analysis event points to chart. */ - protected void doAnalysisEventsOut(ArtifactAndFacet aaf, Document doc, boolean visible) { + protected void doAnalysisEventsOut(ArtifactAndFacet aaf, ThemeDocument doc, boolean visible) { logger.debug("doAnalysisEventsOut"); QWD qwd = (QWD)aaf.getData(context); @@ -292,7 +291,7 @@ textAnnos.add(anno); addAxisSeries(series, YAXIS.W.idx, visible); - if(visible && ThemeUtil.parseShowPointLabel(doc)) { + if(visible && doc.parseShowPointLabel()) { RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc); flysAnno.setTextAnnotations(textAnnos); addAnnotations(flysAnno); @@ -305,7 +304,7 @@ /** Add reference event points to chart. */ - protected void doReferenceEventsOut(ArtifactAndFacet aaf, Document doc, boolean visible) { + protected void doReferenceEventsOut(ArtifactAndFacet aaf, ThemeDocument doc, boolean visible) { logger.debug("doReferenceEventsOut"); QWI qwd = (QWI)aaf.getData(context); @@ -329,7 +328,7 @@ textAnnos.add(anno); addAxisSeries(series, YAXIS.W.idx, visible); - if(visible && ThemeUtil.parseShowPointLabel(doc)) { + if(visible && doc.parseShowPointLabel()) { RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc); flysAnno.setTextAnnotations(textAnnos); addAnnotations(flysAnno); @@ -338,9 +337,9 @@ private void addPointFromWQKms(WQKms wqkms, - String title, - Document theme, - boolean visible + String title, + ThemeDocument theme, + boolean visible ) { XYSeries series = new StyledXYSeries(title, theme); Double ckm = (Double) context.getContextValue(CURRENT_KM); @@ -353,7 +352,7 @@ if (Math.abs(kms[i] - ckm) <= EPSILON) { series.add(wqkms.getQ(i), wqkms.getW(i), false); addAxisSeries(series, YAXIS.W.idx, visible); - if(visible && ThemeUtil.parseShowPointLabel(theme)) { + if(visible && theme.parseShowPointLabel()) { List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>(); XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( title, @@ -369,7 +368,7 @@ } } - protected void doEventsOut(ArtifactAndFacet aaf, Document doc, boolean visible) { + protected void doEventsOut(ArtifactAndFacet aaf, ThemeDocument doc, boolean visible) { logger.debug("doEventsOut"); // Find W/Q at km. addPointFromWQKms((WQKms) aaf.getData(context), @@ -377,7 +376,7 @@ } - protected void doWQCurveOut(ArtifactAndFacet aaf, Document doc, boolean visible) { + protected void doWQCurveOut(ArtifactAndFacet aaf, ThemeDocument doc, boolean visible) { logger.debug("doWQCurveOut"); FixWQCurveFacet facet = (FixWQCurveFacet)aaf.getFacet(); @@ -428,7 +427,7 @@ } } - protected void doOutlierOut(ArtifactAndFacet aaf, Document doc, boolean visible) { + protected void doOutlierOut(ArtifactAndFacet aaf, ThemeDocument doc, boolean visible) { logger.debug("doOutlierOut"); QWI[] qws = (QWI[])aaf.getData(context); @@ -437,7 +436,7 @@ /** Add markers for q sectors. */ - protected void doQSectorOut(ArtifactAndFacet aaf, Document theme, boolean visible) { + protected void doQSectorOut(ArtifactAndFacet aaf, ThemeDocument theme, boolean visible) { logger.debug("doQSectorOut"); if (!visible) { return; @@ -465,8 +464,8 @@ Marker m = new ValueMarker(qsector.getValue()); m.setPaint(Color.black); - float[] dashes = ThemeUtil.parseLineStyle(theme); - int size = ThemeUtil.parseLineWidth(theme); + float[] dashes = theme.parseLineStyle(); + int size = theme.parseLineWidth(); BasicStroke stroke; if (dashes.length <= 1) { stroke = new BasicStroke(size); @@ -481,12 +480,12 @@ } m.setStroke(stroke); - if (ThemeUtil.parseShowLineLabel(theme)) { + if (theme.parseShowLineLabel()) { m.setLabel(qsector.getName()); - m.setPaint(ThemeUtil.parseTextColor(theme)); - m.setLabelFont(ThemeUtil.parseTextFont(theme)); + m.setPaint(theme.parseTextColor()); + m.setLabelFont(theme.parseTextFont()); } - Color paint = ThemeUtil.parseLineColorField(theme); + Color paint = theme.parseLineColorField(); if (paint != null) { m.setPaint(paint); } @@ -504,10 +503,10 @@ * @param theme theme to use. */ protected void doWAnnotations( - Object wqkms, + Object wqkms, ArtifactAndFacet aandf, - Document theme, - boolean visible + ThemeDocument theme, + boolean visible ) { Facet facet = aandf.getFacet(); @@ -549,7 +548,7 @@ WINFOArtifact artifact, Object o, String description, - Document theme, + ThemeDocument theme, boolean visible) { WQKms wqkms = (WQKms) o; @@ -583,7 +582,7 @@ protected void doWQOut( Object wqkms, ArtifactAndFacet aaf, - Document theme, + ThemeDocument theme, boolean visible ) { logger.debug("FixWQCurveGenerator: doWQOut"); @@ -609,7 +608,7 @@ protected void addQWSeries( QWI [] qws, ArtifactAndFacet aaf, - Document theme, + ThemeDocument theme, boolean visible ) { if (qws == null) { @@ -638,7 +637,7 @@ } addAxisSeries(series, YAXIS.W.idx, visible); - if (visible && ThemeUtil.parseShowPointLabel(theme)) { + if (visible && theme.parseShowPointLabel()) { RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, theme); flysAnno.setTextAnnotations(textAnnos);