[Schmitzm-commits] r372 - in branches/1.0-gt2-2.6/src: gtmig/org/geotools/gce/arcgrid junit/skrueger/i8n org/geotools/feature/collection org/geotools/styling schmitzm/geotools/feature schmitzm/geotools/gui schmitzm/geotools/io schmitzm/geotools/styling schmitzm/io skrueger/geotools skrueger/geotools/io
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Sep 3 20:41:52 CEST 2009
Author: alfonx
Date: 2009-09-03 20:41:50 +0200 (Thu, 03 Sep 2009)
New Revision: 372
Added:
branches/1.0-gt2-2.6/src/org/geotools/styling/sStyleFactoryImpl.java
Removed:
branches/1.0-gt2-2.6/src/org/geotools/styling/StyleFactoryImpl.java
Modified:
branches/1.0-gt2-2.6/src/gtmig/org/geotools/gce/arcgrid/ArcGridRaster.java
branches/1.0-gt2-2.6/src/junit/skrueger/i8n/SwitchLanguageDialogTest.java
branches/1.0-gt2-2.6/src/org/geotools/feature/collection/SubFeatureCollection.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureOperationTreeParser.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureTypeBuilderTableModel.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureUtil.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureLayerFilterDialog.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/GeoMapPane.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JEditorPane.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JMapPane.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/io/GeoExportUtil.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/io/GeoImportUtil.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/styling/StylingUtil.java
branches/1.0-gt2-2.6/src/schmitzm/io/IOUtil.java
branches/1.0-gt2-2.6/src/skrueger/geotools/LegendIconFeatureRenderer.java
branches/1.0-gt2-2.6/src/skrueger/geotools/io/GeoImportUtilURL.java
Log:
* Renamed the folder with the GT JARs from 'gt-2.6' to 'gt'
* Extended the build.xml to write the correct version into the .jnlp files
* Many many small adaptations to GT2.6 .. AtlasStyler is working again.
* Changed all the clone?() methods in StylingUtil to use the DuplicatingStyleVisitor
Modified: branches/1.0-gt2-2.6/src/gtmig/org/geotools/gce/arcgrid/ArcGridRaster.java
===================================================================
--- branches/1.0-gt2-2.6/src/gtmig/org/geotools/gce/arcgrid/ArcGridRaster.java 2009-09-03 18:24:41 UTC (rev 371)
+++ branches/1.0-gt2-2.6/src/gtmig/org/geotools/gce/arcgrid/ArcGridRaster.java 2009-09-03 18:41:50 UTC (rev 372)
@@ -16,10 +16,6 @@
*/
package gtmig.org.geotools.gce.arcgrid;
-import org.geotools.resources.NIOUtilities;
-
-import it.geosolutions.imageio.plugins.arcgrid.AsciiGridsImageMetadata;
-
import java.awt.image.Raster;
import java.awt.image.WritableRaster;
import java.io.File;
@@ -36,8 +32,12 @@
import java.nio.channels.FileChannel;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
+
import javax.media.jai.RasterFactory;
+import org.geotools.gce.arcgrid.ArcGridFormat;
+import org.geotools.resources.NIOUtilities;
+
/**
* <b>Martin Schmitz (2009-09-02):<br>
* This class is taken 1:1 from {@code gt2-2.3.0-M0} because of the following reasons:</b>
Modified: branches/1.0-gt2-2.6/src/junit/skrueger/i8n/SwitchLanguageDialogTest.java
===================================================================
--- branches/1.0-gt2-2.6/src/junit/skrueger/i8n/SwitchLanguageDialogTest.java 2009-09-03 18:24:41 UTC (rev 371)
+++ branches/1.0-gt2-2.6/src/junit/skrueger/i8n/SwitchLanguageDialogTest.java 2009-09-03 18:41:50 UTC (rev 372)
@@ -31,10 +31,10 @@
import java.util.ArrayList;
+import junit.framework.TestCase;
+
import org.junit.Test;
-import junit.framework.TestCase;
-
import skrueger.i8n.SwitchLanguageDialog;
public class SwitchLanguageDialogTest extends TestCase {
Modified: branches/1.0-gt2-2.6/src/org/geotools/feature/collection/SubFeatureCollection.java
===================================================================
--- branches/1.0-gt2-2.6/src/org/geotools/feature/collection/SubFeatureCollection.java 2009-09-03 18:24:41 UTC (rev 371)
+++ branches/1.0-gt2-2.6/src/org/geotools/feature/collection/SubFeatureCollection.java 2009-09-03 18:41:50 UTC (rev 372)
@@ -24,22 +24,16 @@
*******************/
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
import java.util.Iterator;
import java.util.List;
-import java.util.Set;
import org.geotools.data.DataUtilities;
import org.geotools.data.FeatureReader;
import org.geotools.data.collection.DelegateFeatureReader;
import org.geotools.factory.CommonFactoryFinder;
-import org.geotools.feature.CollectionListener;
import org.geotools.feature.FeatureCollection;
import org.geotools.feature.FeatureIterator;
-import org.geotools.feature.visitor.FeatureVisitor;
import org.geotools.geometry.jts.ReferencedEnvelope;
-import org.geotools.util.ProgressListener;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.filter.Filter;
Deleted: branches/1.0-gt2-2.6/src/org/geotools/styling/StyleFactoryImpl.java
===================================================================
--- branches/1.0-gt2-2.6/src/org/geotools/styling/StyleFactoryImpl.java 2009-09-03 18:24:41 UTC (rev 371)
+++ branches/1.0-gt2-2.6/src/org/geotools/styling/StyleFactoryImpl.java 2009-09-03 18:41:50 UTC (rev 372)
@@ -1,788 +0,0 @@
-/*
- * GeoTools - OpenSource mapping toolkit
- * http://geotools.org
- * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * Created on 14 October 2002, 15:50
- */
-package org.geotools.styling;
-
-import org.geotools.factory.CommonFactoryFinder;
-import org.geotools.factory.GeoTools;
-import org.opengis.filter.Filter;
-import org.opengis.filter.FilterFactory;
-import org.opengis.filter.expression.Expression;
-
-
-/**
- * Factory for creating Styles. All style elements are returned as Interfaces
- * from org.geotools.core as opposed to Implementations from
- * org.geotools.defaultcore.
- *
- * @author iant
- * @source $URL: http://svn.geotools.org/tags/2.4.5/modules/library/main/src/main/java/org/geotools/styling/StyleFactoryImpl.java $
- * @version $Id: StyleFactoryImpl.java 30556 2008-06-06 15:57:45Z aaime $
- */
-public class StyleFactoryImpl extends AbstractStyleFactory
- implements StyleFactory2 {
-
- private FilterFactory filterFactory;
-
- public StyleFactoryImpl() {
- this( CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints()));
- }
-
- protected StyleFactoryImpl(FilterFactory factory) {
- filterFactory = factory;
- }
-
- public Style createStyle() {
- return new StyleImpl();
- }
-
- public NamedStyle createNamedStyle() {
- return new NamedStyleImpl();
- }
-
- public PointSymbolizer createPointSymbolizer() {
- return new PointSymbolizerImpl();
- }
-
- public PointSymbolizer createPointSymbolizer(Graphic graphic,
- String geometryPropertyName) {
- PointSymbolizer pSymb = new PointSymbolizerImpl();
- pSymb.setGeometryPropertyName(geometryPropertyName);
- pSymb.setGraphic(graphic);
-
- return pSymb;
- }
-
- public PolygonSymbolizer createPolygonSymbolizer() {
- return new PolygonSymbolizerImpl();
- }
-
- public PolygonSymbolizer createPolygonSymbolizer(Stroke stroke, Fill fill,
- String geometryPropertyName) {
- PolygonSymbolizer pSymb = new PolygonSymbolizerImpl();
- pSymb.setGeometryPropertyName(geometryPropertyName);
- pSymb.setStroke(stroke);
- pSymb.setFill(fill);
-
- return pSymb;
- }
-
- public LineSymbolizer createLineSymbolizer() {
- return new LineSymbolizerImpl();
- }
-
- public LineSymbolizer createLineSymbolizer(Stroke stroke,
- String geometryPropertyName) {
- LineSymbolizer lSymb = new LineSymbolizerImpl();
- lSymb.setGeometryPropertyName(geometryPropertyName);
- lSymb.setStroke(stroke);
-
- return lSymb;
- }
-
- public TextSymbolizer createTextSymbolizer() {
- return new TextSymbolizerImpl();
- }
-
- public TextSymbolizer createTextSymbolizer(Fill fill, Font[] fonts,
- Halo halo, Expression label, LabelPlacement labelPlacement,
- String geometryPropertyName) {
- TextSymbolizer tSymb = new TextSymbolizerImpl();
- tSymb.setFill(fill);
- tSymb.setFonts(fonts);
- tSymb.setGeometryPropertyName(geometryPropertyName);
-
- tSymb.setHalo(halo);
- tSymb.setLabel(label);
- tSymb.setPlacement(labelPlacement);
-
- return tSymb;
- }
-
- public TextSymbolizer2 createTextSymbolizer(Fill fill, Font[] fonts,
- Halo halo, Expression label, LabelPlacement labelPlacement,
- String geometryPropertyName, Graphic graphic) {
- TextSymbolizer2 tSymb = new TextSymbolizerImpl();
- tSymb.setFill(fill);
- tSymb.setFonts(fonts);
- tSymb.setGeometryPropertyName(geometryPropertyName);
-
- tSymb.setHalo(halo);
- tSymb.setLabel(label);
- tSymb.setPlacement(labelPlacement);
- tSymb.setGraphic(graphic);
-
- return tSymb;
- }
-
- public Extent createExtent(String name, String value) {
- Extent extent = new ExtentImpl();
- extent.setName(name);
- extent.setValue(value);
-
- return extent;
- }
-
- public FeatureTypeConstraint createFeatureTypeConstraint(
- String featureTypeName, Filter filter, Extent[] extents) {
- FeatureTypeConstraint constraint = new FeatureTypeConstraintImpl();
- constraint.setFeatureTypeName(featureTypeName);
- constraint.setFilter(filter);
- constraint.setExtents(extents);
-
- return constraint;
- }
-
- public LayerFeatureConstraints createLayerFeatureConstraints(FeatureTypeConstraint[] featureTypeConstraints) {
- LayerFeatureConstraints constraints = new LayerFeatureConstraintsImpl();
- constraints.setFeatureTypeConstraints(featureTypeConstraints);
-
- return constraints;
- }
-
- public FeatureTypeStyle createFeatureTypeStyle() {
- return new FeatureTypeStyleImpl();
- }
-
- public FeatureTypeStyle createFeatureTypeStyle(Rule[] rules) {
- return new FeatureTypeStyleImpl(rules);
- }
-
- public Rule createRule() {
- return new RuleImpl();
- }
-
- public ImageOutline createImageOutline(Symbolizer symbolizer) {
- ImageOutline outline = new ImageOutlineImpl();
- outline.setSymbolizer(symbolizer);
-
- return outline;
- }
-
- /**
- * A convienice method to make a simple stroke
- *
- * @param color the color of the line
- * @param width the width of the line
- *
- * @return the stroke object
- *
- * @see org.geotools.stroke
- */
- public Stroke createStroke(Expression color, Expression width) {
- return createStroke(color, width,
- filterFactory.literal(1.0));
- }
-
- /**
- * A convienice method to make a simple stroke
- *
- * @param color the color of the line
- * @param width The width of the line
- * @param opacity The opacity of the line
- *
- * @return The stroke
- *
- * @see org.geotools.stroke
- */
- public Stroke createStroke(Expression color, Expression width,
- Expression opacity) {
- return createStroke(color, width, opacity,
- filterFactory.literal("miter"),
- filterFactory.literal("butt"), null,
- filterFactory.literal(0.0), null, null);
- }
-
- /**
- * creates a stroke
- *
- * @param color The color of the line
- * @param width The width of the line
- * @param opacity The opacity of the line
- * @param lineJoin - the type of Line joint
- * @param lineCap - the type of line cap
- * @param dashArray - an array of floats describing the dashes in the line
- * @param dashOffset - where in the dash array to start drawing from
- * @param graphicFill - a graphic object to fill the line with
- * @param graphicStroke - a graphic object to draw the line with
- *
- * @return The completed stroke.
- *
- * @throws IllegalArgumentException DOCUMENT ME!
- *
- * @see org.geotools.stroke
- */
- public Stroke createStroke(Expression color, Expression width,
- Expression opacity, Expression lineJoin, Expression lineCap,
- float[] dashArray, Expression dashOffset, Graphic graphicFill,
- Graphic graphicStroke) {
- Stroke stroke = new StrokeImpl();
-
- if (color == null) {
- //use default
- color = Stroke.DEFAULT.getColor();
- }
- stroke.setColor(color);
-
- if (width == null) {
- //use default
- width = Stroke.DEFAULT.getWidth();
- }
- stroke.setWidth(width);
-
- if (opacity == null) {
- opacity = Stroke.DEFAULT.getOpacity();;
- }
- stroke.setOpacity(opacity);
-
- if (lineJoin == null) {
- lineJoin = Stroke.DEFAULT.getLineJoin();
- }
- stroke.setLineJoin(lineJoin);
-
- if (lineCap == null) {
- lineCap = Stroke.DEFAULT.getLineCap();
- }
-
- stroke.setLineCap(lineCap);
- stroke.setDashArray(dashArray);
- stroke.setDashOffset(dashOffset);
- stroke.setGraphicFill(graphicFill);
- stroke.setGraphicStroke(graphicStroke);
-
- return stroke;
- }
-
- public Fill createFill(Expression color, Expression backgroundColor,
- Expression opacity, Graphic graphicFill) {
- Fill fill = new FillImpl();
-
- if (color == null) {
- color = Fill.DEFAULT.getColor();
- }
- fill.setColor(color);
- if (backgroundColor == null) {
- backgroundColor = Fill.DEFAULT.getBackgroundColor();
- }
- fill.setBackgroundColor(backgroundColor);
-
- if (opacity == null) {
- opacity = Fill.DEFAULT.getOpacity();
- }
-
- // would be nice to check if this was within bounds but we have to wait until use since it may depend on an attribute
- fill.setOpacity(opacity);
- fill.setGraphicFill(graphicFill);
-
- return fill;
- }
-
- public Fill createFill(Expression color, Expression opacity) {
- return createFill(color, null, opacity, null);
- }
-
- public Fill createFill(Expression color) {
- return createFill(color, null,
- filterFactory.literal(1.0), null);
- }
-
- public Mark createMark(Expression wellKnownName, Stroke stroke, Fill fill,
- Expression size, Expression rotation) {
- Mark mark = new MarkImpl();
-
- if (wellKnownName == null) {
- throw new IllegalArgumentException(
- "WellKnownName can not be null in mark");
- }
-
- mark.setWellKnownName(wellKnownName);
- mark.setStroke(stroke);
- mark.setFill(fill);
-
- if (size == null) {
- throw new IllegalArgumentException("Size can not be null in mark");
- }
-
- mark.setSize(size);
-
- if (rotation == null) {
- throw new IllegalArgumentException(
- "Rotation can not be null in mark");
- }
-
- mark.setRotation(rotation);
-
- return mark;
- }
-
- public Mark getSquareMark() {
- Mark mark = createMark(filterFactory.literal("Square"),
- getDefaultStroke(), getDefaultFill(),
- filterFactory.literal(6),
- filterFactory.literal(0));
-
- return mark;
- }
-
- public Mark getCircleMark() {
- Mark mark = getDefaultMark();
- mark.setWellKnownName(filterFactory.literal("Circle"));
-
- return mark;
- }
-
- public Mark getCrossMark() {
- Mark mark = getDefaultMark();
- mark.setWellKnownName(filterFactory.literal("Cross"));
-
- return mark;
- }
-
- public Mark getXMark() {
- Mark mark = getDefaultMark();
- mark.setWellKnownName(filterFactory.literal("X"));
-
- return mark;
- }
-
- public Mark getTriangleMark() {
- Mark mark = getDefaultMark();
- mark.setWellKnownName(filterFactory.literal("Triangle"));
-
- return mark;
- }
-
- public Mark getStarMark() {
- Mark mark = getDefaultMark();
- mark.setWellKnownName(filterFactory.literal("Star"));
-
- return mark;
- }
-
- public Mark createMark() {
- Mark mark = new MarkImpl();
-
- return mark;
- }
-
- public Graphic createGraphic(ExternalGraphic[] externalGraphics,
- Mark[] marks, Symbol[] symbols, Expression opacity, Expression size,
- Expression rotation) {
- Graphic graphic = new GraphicImpl();
-
- symbols = symbols != null ? symbols : new Symbol[0];
- graphic.setSymbols(symbols);
-
- externalGraphics = externalGraphics != null ? externalGraphics : new ExternalGraphic[0];
- graphic.setExternalGraphics(externalGraphics);
-
- marks = marks != null ? marks : new Mark[0];
- graphic.setMarks(marks);
-
- if (opacity == null) {
- opacity = Graphic.DEFAULT.getOpacity();
- }
- graphic.setOpacity(opacity);
-
- if (size == null) {
- size = Graphic.DEFAULT.getSize();
- }
- graphic.setSize(size);
-
- if (rotation == null) {
- rotation = Graphic.DEFAULT.getRotation();
- }
-
- graphic.setRotation(rotation);
-
- return graphic;
- }
-
- public ExternalGraphic createExternalGraphic(String uri, String format) {
- ExternalGraphic extg = new ExternalGraphicImpl();
- extg.setURI(uri);
- extg.setFormat(format);
-
- return extg;
- }
-
- public ExternalGraphic createExternalGraphic(java.net.URL url, String format) {
- ExternalGraphic extg = new ExternalGraphicImpl();
- extg.setLocation(url);
- extg.setFormat(format);
-
- return extg;
- }
-
- public Font createFont(Expression fontFamily, Expression fontStyle,
- Expression fontWeight, Expression fontSize) {
- Font font = new FontImpl();
-
- if (fontFamily == null) {
- throw new IllegalArgumentException("Null font family specified");
- }
- font.setFontFamily(fontFamily);
-
- if (fontSize == null) {
- throw new IllegalArgumentException("Null font size specified");
- }
-
- font.setFontSize(fontSize);
-
- if (fontStyle == null) {
- throw new IllegalArgumentException("Null font Style specified");
- }
-
- font.setFontStyle(fontStyle);
-
- if (fontWeight == null) {
- throw new IllegalArgumentException("Null font weight specified");
- }
-
- font.setFontWeight(fontWeight);
-
- return font;
- }
-
- // public LinePlacement createLinePlacement(){
- // return new LinePlacementImpl();
- // }
- public LinePlacement createLinePlacement(Expression offset) {
- LinePlacement linep = new LinePlacementImpl();
- linep.setPerpendicularOffset(offset);
-
- return linep;
- }
-
- // public PointPlacement createPointPlacement(){
- // return new PointPlacementImpl();
- // }
- public PointPlacement createPointPlacement(AnchorPoint anchorPoint,
- Displacement displacement, Expression rotation) {
- PointPlacement pointp = new PointPlacementImpl();
- pointp.setAnchorPoint(anchorPoint);
- pointp.setDisplacement(displacement);
- pointp.setRotation(rotation);
-
- return pointp;
- }
-
- public AnchorPoint createAnchorPoint(Expression x, Expression y) {
- AnchorPoint anchorPoint = new AnchorPointImpl();
- anchorPoint.setAnchorPointX(x);
- anchorPoint.setAnchorPointY(y);
-
- return anchorPoint;
- }
-
- public Displacement createDisplacement(Expression x, Expression y) {
- Displacement displacement = new DisplacementImpl();
- displacement.setDisplacementX(x);
- displacement.setDisplacementY(y);
-
- return displacement;
- }
-
- public Halo createHalo(Fill fill, Expression radius) {
- Halo halo = new HaloImpl();
- halo.setFill(fill);
- halo.setRadius(radius);
-
- return halo;
- }
-
- public Fill getDefaultFill() {
- Fill fill = new FillImpl();
-
- try {
- fill.setColor(filterFactory.literal("#808080"));
- fill.setOpacity(filterFactory.literal(
- new Double(1.0)));
- } catch (org.geotools.filter.IllegalFilterException ife) {
- throw new RuntimeException("Error creating fill", ife);
- }
-
- return fill;
- }
-
- public LineSymbolizer getDefaultLineSymbolizer() {
- return createLineSymbolizer(getDefaultStroke(), null);
- }
-
- public Mark getDefaultMark() {
- return getSquareMark();
- }
-
- public PointSymbolizer getDefaultPointSymbolizer() {
- return createPointSymbolizer(createDefaultGraphic(), null);
- }
-
- public PolygonSymbolizer getDefaultPolygonSymbolizer() {
- return createPolygonSymbolizer(getDefaultStroke(), getDefaultFill(),
- null);
- }
-
- public Stroke getDefaultStroke() {
- try {
- Stroke stroke = createStroke(filterFactory.literal(
- "#000000"),
- filterFactory.literal(new Integer(1)));
-
- stroke.setDashOffset(filterFactory.literal(
- new Integer(0)));
- stroke.setLineCap(filterFactory.literal("butt"));
- stroke.setLineJoin(filterFactory.literal("miter"));
- stroke.setOpacity(filterFactory.literal(
- new Integer(1)));
-
- return stroke;
- } catch (org.geotools.filter.IllegalFilterException ife) {
- //we should never be in here
- throw new RuntimeException("Error creating stroke", ife);
- }
- }
-
- public Style getDefaultStyle() {
- Style style = createStyle();
-
- return style;
- }
-
- /**
- * Creates a default Text Symbolizer, using the defaultFill, defaultFont
- * and defaultPointPlacement, Sets the geometry attribute name to be
- * geometry:text. No Halo is set. <b>The label is not set</b>
- *
- * @return A default TextSymbolizer
- */
- public TextSymbolizer getDefaultTextSymbolizer() {
- return createTextSymbolizer(getDefaultFill(),
- new Font[] { getDefaultFont() }, null, null,
- getDefaultPointPlacement(), "geometry:text");
- }
-
- /**
- * Creates a defaultFont which is valid on all machines. The font is of
- * size 10, Style and Weight normal and uses a serif font.
- *
- * @return the default Font
- *
- * @throws RuntimeException DOCUMENT ME!
- */
- public Font getDefaultFont() {
- Font font = new FontImpl();
-
- try {
- font.setFontSize(filterFactory.literal(
- new Integer(10)));
- font.setFontStyle(filterFactory.literal("normal"));
- font.setFontWeight(filterFactory.literal("normal"));
- font.setFontFamily(filterFactory.literal("Serif"));
- } catch (org.geotools.filter.IllegalFilterException ife) {
- throw new RuntimeException("Error creating font", ife);
- }
-
- return font;
- }
-
- public Graphic createDefaultGraphic() {
- Graphic graphic = new GraphicImpl();
-
-// graphic.setSize(Expression.NIL);
-
-
-
-
-
-
-
-
-
-
- // That was so EVIL!!!! TODO TODO We can remove the whole class when we are at 2.6
-// graphic.setSize(Expression.NIL);
- graphic.setSize(filterFactory.literal(12));
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- graphic.setOpacity(filterFactory.literal(1.0));
- graphic.setRotation(filterFactory.literal(0.0));
-
- return graphic;
- }
-
- public Graphic getDefaultGraphic() {
- return createDefaultGraphic();
- }
-
- /**
- * returns a default PointPlacement with a 0,0 anchorPoint and a
- * displacement of 0,0 and a rotation of 0
- *
- * @return a default PointPlacement.
- */
- public PointPlacement getDefaultPointPlacement() {
- return this.createPointPlacement(this.createAnchorPoint(
- filterFactory.literal(0),
- filterFactory.literal(0.5)),
- this.createDisplacement(filterFactory.literal(0),
- filterFactory.literal(0)),
- filterFactory.literal(0));
- }
-
- public RasterSymbolizer createRasterSymbolizer() {
- return new RasterSymbolizerImpl();
- }
-
- public RasterSymbolizer createRasterSymbolizer(
- String geometryPropertyName, Expression opacity,
- ChannelSelection channel, Expression overlap, ColorMap colorMap,
- ContrastEnhancement cenhancement, ShadedRelief relief,
- Symbolizer outline) {
- RasterSymbolizer rastersym = new RasterSymbolizerImpl();
-
- if (geometryPropertyName != null) {
- rastersym.setGeometryPropertyName(geometryPropertyName);
- }
-
- if (opacity != null) {
- rastersym.setOpacity(opacity);
- }
-
- if (channel != null) {
- rastersym.setChannelSelection(channel);
- }
-
- if (overlap != null) {
- rastersym.setOverlap(overlap);
- }
-
- if (colorMap != null) {
- rastersym.setColorMap(colorMap);
- }
-
- if (cenhancement != null) {
- rastersym.setContrastEnhancement(cenhancement);
- }
-
- if (relief != null) {
- rastersym.setShadedRelief(relief);
- }
-
- if (outline != null) {
- rastersym.setImageOutline(outline);
- }
-
- return rastersym;
- }
-
- public RasterSymbolizer getDefaultRasterSymbolizer() {
- return createRasterSymbolizer("geom",
- filterFactory.literal(1.0), null, null, null, null,
- null, null);
- }
-
- public ChannelSelection createChannelSelection(
- SelectedChannelType[] channels) {
- ChannelSelection channelSel = new ChannelSelectionImpl();
-
- if ((channels != null) && (channels.length > 0)) {
- channelSel.setSelectedChannels(channels);
- }
-
- return channelSel;
- }
-
- public ColorMap createColorMap() {
- return new ColorMapImpl();
- }
-
- public ColorMapEntry createColorMapEntry() {
- return new ColorMapEntryImpl();
- }
-
- public ContrastEnhancement createContrastEnhancement() {
- return new ContrastEnhancementImpl();
- }
-
- public ContrastEnhancement createContrastEnhancement(Expression gammaValue) {
- ContrastEnhancement ce = new ContrastEnhancementImpl();
- ce.setGammaValue(gammaValue);
-
- return ce;
- }
-
- public SelectedChannelType createSelectedChannelType(String name,
- ContrastEnhancement enhancement) {
- SelectedChannelType sct = new SelectedChannelTypeImpl();
- sct.setChannelName(name);
- sct.setContrastEnhancement(enhancement);
-
- return sct;
- }
-
- public SelectedChannelType createSelectedChannelType(String name,
- Expression gammaValue) {
- SelectedChannelType sct = new SelectedChannelTypeImpl();
- sct.setChannelName(name);
- sct.setContrastEnhancement(createContrastEnhancement(gammaValue));
-
- return sct;
- }
-
- public StyledLayerDescriptor createStyledLayerDescriptor() {
- return new StyledLayerDescriptorImpl();
- }
-
- public UserLayer createUserLayer() {
- return new UserLayerImpl();
- }
-
- public NamedLayer createNamedLayer() {
- return new NamedLayerImpl();
- }
-
- public RemoteOWS createRemoteOWS(String service, String onlineResource) {
- RemoteOWSImpl remoteOWS = new RemoteOWSImpl();
- remoteOWS.setService(service);
- remoteOWS.setOnlineResource(onlineResource);
-
- return remoteOWS;
- }
-
- public ShadedRelief createShadedRelief(Expression reliefFactor) {
- ShadedRelief relief = new ShadedReliefImpl();
- relief.setReliefFactor(reliefFactor);
-
- return relief;
- }
-}
Copied: branches/1.0-gt2-2.6/src/org/geotools/styling/sStyleFactoryImpl.java (from rev 368, branches/1.0-gt2-2.6/src/org/geotools/styling/StyleFactoryImpl.java)
===================================================================
--- branches/1.0-gt2-2.6/src/org/geotools/styling/StyleFactoryImpl.java 2009-09-03 10:09:31 UTC (rev 368)
+++ branches/1.0-gt2-2.6/src/org/geotools/styling/sStyleFactoryImpl.java 2009-09-03 18:41:50 UTC (rev 372)
@@ -0,0 +1,789 @@
+//package org.geotools.styling;
+///*
+// * GeoTools - OpenSource mapping toolkit
+// * http://geotools.org
+// * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
+// *
+// * This library is free software; you can redistribute it and/or
+// * modify it under the terms of the GNU Lesser General Public
+// * License as published by the Free Software Foundation;
+// * version 2.1 of the License.
+// *
+// * This library is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// * Lesser General Public License for more details.
+// *
+// * Created on 14 October 2002, 15:50
+// */
+//package org.geotools.styling;
+//
+//import org.geotools.factory.CommonFactoryFinder;
+//import org.geotools.factory.GeoTools;
+//import org.opengis.filter.Filter;
+//import org.opengis.filter.FilterFactory;
+//import org.opengis.filter.expression.Expression;
+//
+//
+///**
+// * Factory for creating Styles. All style elements are returned as Interfaces
+// * from org.geotools.core as opposed to Implementations from
+// * org.geotools.defaultcore.
+// *
+// * @author iant
+// * @source $URL: http://svn.geotools.org/tags/2.4.5/modules/library/main/src/main/java/org/geotools/styling/StyleFactoryImpl.java $
+// * @version $Id: StyleFactoryImpl.java 30556 2008-06-06 15:57:45Z aaime $
+// */
+//public class StyleFactoryImpl extends AbstractStyleFactory
+// implements StyleFactory2 {
+//
+// private FilterFactory filterFactory;
+//
+// public StyleFactoryImpl() {
+// this( CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints()));
+// }
+//
+// protected StyleFactoryImpl(FilterFactory factory) {
+// filterFactory = factory;
+// }
+//
+// public Style createStyle() {
+// return new StyleImpl();
+// }
+//
+// public NamedStyle createNamedStyle() {
+// return new NamedStyleImpl();
+// }
+//
+// public PointSymbolizer createPointSymbolizer() {
+// return new PointSymbolizerImpl();
+// }
+//
+// public PointSymbolizer createPointSymbolizer(Graphic graphic,
+// String geometryPropertyName) {
+// PointSymbolizer pSymb = new PointSymbolizerImpl();
+// pSymb.setGeometryPropertyName(geometryPropertyName);
+// pSymb.setGraphic(graphic);
+//
+// return pSymb;
+// }
+//
+// public PolygonSymbolizer createPolygonSymbolizer() {
+// return new PolygonSymbolizerImpl();
+// }
+//
+// public PolygonSymbolizer createPolygonSymbolizer(Stroke stroke, Fill fill,
+// String geometryPropertyName) {
+// PolygonSymbolizer pSymb = new PolygonSymbolizerImpl();
+// pSymb.setGeometryPropertyName(geometryPropertyName);
+// pSymb.setStroke(stroke);
+// pSymb.setFill(fill);
+//
+// return pSymb;
+// }
+//
+// public LineSymbolizer createLineSymbolizer() {
+// return new LineSymbolizerImpl();
+// }
+//
+// public LineSymbolizer createLineSymbolizer(Stroke stroke,
+// String geometryPropertyName) {
+// LineSymbolizer lSymb = new LineSymbolizerImpl();
+// lSymb.setGeometryPropertyName(geometryPropertyName);
+// lSymb.setStroke(stroke);
+//
+// return lSymb;
+// }
+//
+// public TextSymbolizer createTextSymbolizer() {
+// return new TextSymbolizerImpl();
+// }
+//
+// public TextSymbolizer createTextSymbolizer(Fill fill, Font[] fonts,
+// Halo halo, Expression label, LabelPlacement labelPlacement,
+// String geometryPropertyName) {
+// TextSymbolizer tSymb = new TextSymbolizerImpl();
+// tSymb.setFill(fill);
+// tSymb.setFonts(fonts);
+// tSymb.setGeometryPropertyName(geometryPropertyName);
+//
+// tSymb.setHalo(halo);
+// tSymb.setLabel(label);
+// tSymb.setPlacement(labelPlacement);
+//
+// return tSymb;
+// }
+//
+// public TextSymbolizer2 createTextSymbolizer(Fill fill, Font[] fonts,
+// Halo halo, Expression label, LabelPlacement labelPlacement,
+// String geometryPropertyName, Graphic graphic) {
+// TextSymbolizer2 tSymb = new TextSymbolizerImpl();
+// tSymb.setFill(fill);
+// tSymb.setFonts(fonts);
+// tSymb.setGeometryPropertyName(geometryPropertyName);
+//
+// tSymb.setHalo(halo);
+// tSymb.setLabel(label);
+// tSymb.setPlacement(labelPlacement);
+// tSymb.setGraphic(graphic);
+//
+// return tSymb;
+// }
+//
+// public Extent createExtent(String name, String value) {
+// Extent extent = new ExtentImpl();
+// extent.setName(name);
+// extent.setValue(value);
+//
+// return extent;
+// }
+//
+// public FeatureTypeConstraint createFeatureTypeConstraint(
+// String featureTypeName, Filter filter, Extent[] extents) {
+// FeatureTypeConstraint constraint = new FeatureTypeConstraintImpl();
+// constraint.setFeatureTypeName(featureTypeName);
+// constraint.setFilter(filter);
+// constraint.setExtents(extents);
+//
+// return constraint;
+// }
+//
+// public LayerFeatureConstraints createLayerFeatureConstraints(FeatureTypeConstraint[] featureTypeConstraints) {
+// LayerFeatureConstraints constraints = new LayerFeatureConstraintsImpl();
+// constraints.setFeatureTypeConstraints(featureTypeConstraints);
+//
+// return constraints;
+// }
+//
+// public FeatureTypeStyle createFeatureTypeStyle() {
+// return new FeatureTypeStyleImpl();
+// }
+//
+// public FeatureTypeStyle createFeatureTypeStyle(Rule[] rules) {
+// return new FeatureTypeStyleImpl(rules);
+// }
+//
+// public Rule createRule() {
+// return new RuleImpl();
+// }
+//
+// public ImageOutline createImageOutline(Symbolizer symbolizer) {
+// ImageOutline outline = new ImageOutlineImpl();
+// outline.setSymbolizer(symbolizer);
+//
+// return outline;
+// }
+//
+// /**
+// * A convienice method to make a simple stroke
+// *
+// * @param color the color of the line
+// * @param width the width of the line
+// *
+// * @return the stroke object
+// *
+// * @see org.geotools.stroke
+// */
+// public Stroke createStroke(Expression color, Expression width) {
+// return createStroke(color, width,
+// filterFactory.literal(1.0));
+// }
+//
+// /**
+// * A convienice method to make a simple stroke
+// *
+// * @param color the color of the line
+// * @param width The width of the line
+// * @param opacity The opacity of the line
+// *
+// * @return The stroke
+// *
+// * @see org.geotools.stroke
+// */
+// public Stroke createStroke(Expression color, Expression width,
+// Expression opacity) {
+// return createStroke(color, width, opacity,
+// filterFactory.literal("miter"),
+// filterFactory.literal("butt"), null,
+// filterFactory.literal(0.0), null, null);
+// }
+//
+// /**
+// * creates a stroke
+// *
+// * @param color The color of the line
+// * @param width The width of the line
+// * @param opacity The opacity of the line
+// * @param lineJoin - the type of Line joint
+// * @param lineCap - the type of line cap
+// * @param dashArray - an array of floats describing the dashes in the line
+// * @param dashOffset - where in the dash array to start drawing from
+// * @param graphicFill - a graphic object to fill the line with
+// * @param graphicStroke - a graphic object to draw the line with
+// *
+// * @return The completed stroke.
+// *
+// * @throws IllegalArgumentException DOCUMENT ME!
+// *
+// * @see org.geotools.stroke
+// */
+// public Stroke createStroke(Expression color, Expression width,
+// Expression opacity, Expression lineJoin, Expression lineCap,
+// float[] dashArray, Expression dashOffset, Graphic graphicFill,
+// Graphic graphicStroke) {
+// Stroke stroke = new StrokeImpl();
+//
+// if (color == null) {
+// //use default
+// color = Stroke.DEFAULT.getColor();
+// }
+// stroke.setColor(color);
+//
+// if (width == null) {
+// //use default
+// width = Stroke.DEFAULT.getWidth();
+// }
+// stroke.setWidth(width);
+//
+// if (opacity == null) {
+// opacity = Stroke.DEFAULT.getOpacity();;
+// }
+// stroke.setOpacity(opacity);
+//
+// if (lineJoin == null) {
+// lineJoin = Stroke.DEFAULT.getLineJoin();
+// }
+// stroke.setLineJoin(lineJoin);
+//
+// if (lineCap == null) {
+// lineCap = Stroke.DEFAULT.getLineCap();
+// }
+//
+// stroke.setLineCap(lineCap);
+// stroke.setDashArray(dashArray);
+// stroke.setDashOffset(dashOffset);
+// stroke.setGraphicFill(graphicFill);
+// stroke.setGraphicStroke(graphicStroke);
+//
+// return stroke;
+// }
+//
+// public Fill createFill(Expression color, Expression backgroundColor,
+// Expression opacity, Graphic graphicFill) {
+// Fill fill = new FillImpl();
+//
+// if (color == null) {
+// color = Fill.DEFAULT.getColor();
+// }
+// fill.setColor(color);
+// if (backgroundColor == null) {
+// backgroundColor = Fill.DEFAULT.getBackgroundColor();
+// }
+// fill.setBackgroundColor(backgroundColor);
+//
+// if (opacity == null) {
+// opacity = Fill.DEFAULT.getOpacity();
+// }
+//
+// // would be nice to check if this was within bounds but we have to wait until use since it may depend on an attribute
+// fill.setOpacity(opacity);
+// fill.setGraphicFill(graphicFill);
+//
+// return fill;
+// }
+//
+// public Fill createFill(Expression color, Expression opacity) {
+// return createFill(color, null, opacity, null);
+// }
+//
+// public Fill createFill(Expression color) {
+// return createFill(color, null,
+// filterFactory.literal(1.0), null);
+// }
+//
+// public Mark createMark(Expression wellKnownName, Stroke stroke, Fill fill,
+// Expression size, Expression rotation) {
+// Mark mark = new MarkImpl();
+//
+// if (wellKnownName == null) {
+// throw new IllegalArgumentException(
+// "WellKnownName can not be null in mark");
+// }
+//
+// mark.setWellKnownName(wellKnownName);
+// mark.setStroke(stroke);
+// mark.setFill(fill);
+//
+// if (size == null) {
+// throw new IllegalArgumentException("Size can not be null in mark");
+// }
+//
+// mark.setSize(size);
+//
+// if (rotation == null) {
+// throw new IllegalArgumentException(
+// "Rotation can not be null in mark");
+// }
+//
+// mark.setRotation(rotation);
+//
+// return mark;
+// }
+//
+// public Mark getSquareMark() {
+// Mark mark = createMark(filterFactory.literal("Square"),
+// getDefaultStroke(), getDefaultFill(),
+// filterFactory.literal(6),
+// filterFactory.literal(0));
+//
+// return mark;
+// }
+//
+// public Mark getCircleMark() {
+// Mark mark = getDefaultMark();
+// mark.setWellKnownName(filterFactory.literal("Circle"));
+//
+// return mark;
+// }
+//
+// public Mark getCrossMark() {
+// Mark mark = getDefaultMark();
+// mark.setWellKnownName(filterFactory.literal("Cross"));
+//
+// return mark;
+// }
+//
+// public Mark getXMark() {
+// Mark mark = getDefaultMark();
+// mark.setWellKnownName(filterFactory.literal("X"));
+//
+// return mark;
+// }
+//
+// public Mark getTriangleMark() {
+// Mark mark = getDefaultMark();
+// mark.setWellKnownName(filterFactory.literal("Triangle"));
+//
+// return mark;
+// }
+//
+// public Mark getStarMark() {
+// Mark mark = getDefaultMark();
+// mark.setWellKnownName(filterFactory.literal("Star"));
+//
+// return mark;
+// }
+//
+// public Mark createMark() {
+// Mark mark = new MarkImpl();
+//
+// return mark;
+// }
+//
+// public Graphic createGraphic(ExternalGraphic[] externalGraphics,
+// Mark[] marks, Symbol[] symbols, Expression opacity, Expression size,
+// Expression rotation) {
+// Graphic graphic = new GraphicImpl();
+//
+// symbols = symbols != null ? symbols : new Symbol[0];
+// graphic.setSymbols(symbols);
+//
+// externalGraphics = externalGraphics != null ? externalGraphics : new ExternalGraphic[0];
+// graphic.setExternalGraphics(externalGraphics);
+//
+// marks = marks != null ? marks : new Mark[0];
+// graphic.setMarks(marks);
+//
+// if (opacity == null) {
+// opacity = Graphic.DEFAULT.getOpacity();
+// }
+// graphic.setOpacity(opacity);
+//
+// if (size == null) {
+// size = Graphic.DEFAULT.getSize();
+// }
+// graphic.setSize(size);
+//
+// if (rotation == null) {
+// rotation = Graphic.DEFAULT.getRotation();
+// }
+//
+// graphic.setRotation(rotation);
+//
+// return graphic;
+// }
+//
+// public ExternalGraphic createExternalGraphic(String uri, String format) {
+// ExternalGraphic extg = new ExternalGraphicImpl();
+// extg.setURI(uri);
+// extg.setFormat(format);
+//
+// return extg;
+// }
+//
+// public ExternalGraphic createExternalGraphic(java.net.URL url, String format) {
+// ExternalGraphic extg = new ExternalGraphicImpl();
+// extg.setLocation(url);
+// extg.setFormat(format);
+//
+// return extg;
+// }
+//
+// public Font createFont(Expression fontFamily, Expression fontStyle,
+// Expression fontWeight, Expression fontSize) {
+// Font font = new FontImpl();
+//
+// if (fontFamily == null) {
+// throw new IllegalArgumentException("Null font family specified");
+// }
+// font.setFontFamily(fontFamily);
+//
+// if (fontSize == null) {
+// throw new IllegalArgumentException("Null font size specified");
+// }
+//
+// font.setFontSize(fontSize);
+//
+// if (fontStyle == null) {
+// throw new IllegalArgumentException("Null font Style specified");
+// }
+//
+// font.setFontStyle(fontStyle);
+//
+// if (fontWeight == null) {
+// throw new IllegalArgumentException("Null font weight specified");
+// }
+//
+// font.setFontWeight(fontWeight);
+//
+// return font;
+// }
+//
+// // public LinePlacement createLinePlacement(){
+// // return new LinePlacementImpl();
+// // }
+// public LinePlacement createLinePlacement(Expression offset) {
+// LinePlacement linep = new LinePlacementImpl();
+// linep.setPerpendicularOffset(offset);
+//
+// return linep;
+// }
+//
+// // public PointPlacement createPointPlacement(){
+// // return new PointPlacementImpl();
+// // }
+// public PointPlacement createPointPlacement(AnchorPoint anchorPoint,
+// Displacement displacement, Expression rotation) {
+// PointPlacement pointp = new PointPlacementImpl();
+// pointp.setAnchorPoint(anchorPoint);
+// pointp.setDisplacement(displacement);
+// pointp.setRotation(rotation);
+//
+// return pointp;
+// }
+//
+// public AnchorPoint createAnchorPoint(Expression x, Expression y) {
+// AnchorPoint anchorPoint = new AnchorPointImpl();
+// anchorPoint.setAnchorPointX(x);
+// anchorPoint.setAnchorPointY(y);
+//
+// return anchorPoint;
+// }
+//
+// public Displacement createDisplacement(Expression x, Expression y) {
+// Displacement displacement = new DisplacementImpl();
+// displacement.setDisplacementX(x);
+// displacement.setDisplacementY(y);
+//
+// return displacement;
+// }
+//
+// public Halo createHalo(Fill fill, Expression radius) {
+// Halo halo = new HaloImpl();
+// halo.setFill(fill);
+// halo.setRadius(radius);
+//
+// return halo;
+// }
+//
+// public Fill getDefaultFill() {
+// Fill fill = new FillImpl();
+//
+// try {
+// fill.setColor(filterFactory.literal("#808080"));
+// fill.setOpacity(filterFactory.literal(
+// new Double(1.0)));
+// } catch (org.geotools.filter.IllegalFilterException ife) {
+// throw new RuntimeException("Error creating fill", ife);
+// }
+//
+// return fill;
+// }
+//
+// public LineSymbolizer getDefaultLineSymbolizer() {
+// return createLineSymbolizer(getDefaultStroke(), null);
+// }
+//
+// public Mark getDefaultMark() {
+// return getSquareMark();
+// }
+//
+// public PointSymbolizer getDefaultPointSymbolizer() {
+// return createPointSymbolizer(createDefaultGraphic(), null);
+// }
+//
+// public PolygonSymbolizer getDefaultPolygonSymbolizer() {
+// return createPolygonSymbolizer(getDefaultStroke(), getDefaultFill(),
+// null);
+// }
+//
+// public Stroke getDefaultStroke() {
+// try {
+// Stroke stroke = createStroke(filterFactory.literal(
+// "#000000"),
+// filterFactory.literal(new Integer(1)));
+//
+// stroke.setDashOffset(filterFactory.literal(
+// new Integer(0)));
+// stroke.setLineCap(filterFactory.literal("butt"));
+// stroke.setLineJoin(filterFactory.literal("miter"));
+// stroke.setOpacity(filterFactory.literal(
+// new Integer(1)));
+//
+// return stroke;
+// } catch (org.geotools.filter.IllegalFilterException ife) {
+// //we should never be in here
+// throw new RuntimeException("Error creating stroke", ife);
+// }
+// }
+//
+// public Style getDefaultStyle() {
+// Style style = createStyle();
+//
+// return style;
+// }
+//
+// /**
+// * Creates a default Text Symbolizer, using the defaultFill, defaultFont
+// * and defaultPointPlacement, Sets the geometry attribute name to be
+// * geometry:text. No Halo is set. <b>The label is not set</b>
+// *
+// * @return A default TextSymbolizer
+// */
+// public TextSymbolizer getDefaultTextSymbolizer() {
+// return createTextSymbolizer(getDefaultFill(),
+// new Font[] { getDefaultFont() }, null, null,
+// getDefaultPointPlacement(), "geometry:text");
+// }
+//
+// /**
+// * Creates a defaultFont which is valid on all machines. The font is of
+// * size 10, Style and Weight normal and uses a serif font.
+// *
+// * @return the default Font
+// *
+// * @throws RuntimeException DOCUMENT ME!
+// */
+// public Font getDefaultFont() {
+// Font font = new FontImpl();
+//
+// try {
+// font.setFontSize(filterFactory.literal(
+// new Integer(10)));
+// font.setFontStyle(filterFactory.literal("normal"));
+// font.setFontWeight(filterFactory.literal("normal"));
+// font.setFontFamily(filterFactory.literal("Serif"));
+// } catch (org.geotools.filter.IllegalFilterException ife) {
+// throw new RuntimeException("Error creating font", ife);
+// }
+//
+// return font;
+// }
+//
+// public Graphic createDefaultGraphic() {
+// Graphic graphic = new GraphicImpl();
+//
+//// graphic.setSize(Expression.NIL);
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+// // That was so EVIL!!!! TODO TODO We can remove the whole class when we are at 2.6
+//// graphic.setSize(Expression.NIL);
+// graphic.setSize(filterFactory.literal(12));
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+// graphic.setOpacity(filterFactory.literal(1.0));
+// graphic.setRotation(filterFactory.literal(0.0));
+//
+// return graphic;
+// }
+//
+// public Graphic getDefaultGraphic() {
+// return createDefaultGraphic();
+// }
+//
+// /**
+// * returns a default PointPlacement with a 0,0 anchorPoint and a
+// * displacement of 0,0 and a rotation of 0
+// *
+// * @return a default PointPlacement.
+// */
+// public PointPlacement getDefaultPointPlacement() {
+// return this.createPointPlacement(this.createAnchorPoint(
+// filterFactory.literal(0),
+// filterFactory.literal(0.5)),
+// this.createDisplacement(filterFactory.literal(0),
+// filterFactory.literal(0)),
+// filterFactory.literal(0));
+// }
+//
+// public RasterSymbolizer createRasterSymbolizer() {
+// return new RasterSymbolizerImpl();
+// }
+//
+// public RasterSymbolizer createRasterSymbolizer(
+// String geometryPropertyName, Expression opacity,
+// ChannelSelection channel, Expression overlap, ColorMap colorMap,
+// ContrastEnhancement cenhancement, ShadedRelief relief,
+// Symbolizer outline) {
+// RasterSymbolizer rastersym = new RasterSymbolizerImpl();
+//
+// if (geometryPropertyName != null) {
+// rastersym.setGeometryPropertyName(geometryPropertyName);
+// }
+//
+// if (opacity != null) {
+// rastersym.setOpacity(opacity);
+// }
+//
+// if (channel != null) {
+// rastersym.setChannelSelection(channel);
+// }
+//
+// if (overlap != null) {
+// rastersym.setOverlap(overlap);
+// }
+//
+// if (colorMap != null) {
+// rastersym.setColorMap(colorMap);
+// }
+//
+// if (cenhancement != null) {
+// rastersym.setContrastEnhancement(cenhancement);
+// }
+//
+// if (relief != null) {
+// rastersym.setShadedRelief(relief);
+// }
+//
+// if (outline != null) {
+// rastersym.setImageOutline(outline);
+// }
+//
+// return rastersym;
+// }
+//
+// public RasterSymbolizer getDefaultRasterSymbolizer() {
+// return createRasterSymbolizer("geom",
+// filterFactory.literal(1.0), null, null, null, null,
+// null, null);
+// }
+//
+// public ChannelSelection createChannelSelection(
+// SelectedChannelType[] channels) {
+// ChannelSelection channelSel = new ChannelSelectionImpl();
+//
+// if ((channels != null) && (channels.length > 0)) {
+// channelSel.setSelectedChannels(channels);
+// }
+//
+// return channelSel;
+// }
+//
+// public ColorMap createColorMap() {
+// return new ColorMapImpl();
+// }
+//
+// public ColorMapEntry createColorMapEntry() {
+// return new ColorMapEntryImpl();
+// }
+//
+// public ContrastEnhancement createContrastEnhancement() {
+// return new ContrastEnhancementImpl();
+// }
+//
+// public ContrastEnhancement createContrastEnhancement(Expression gammaValue) {
+// ContrastEnhancement ce = new ContrastEnhancementImpl();
+// ce.setGammaValue(gammaValue);
+//
+// return ce;
+// }
+//
+// public SelectedChannelType createSelectedChannelType(String name,
+// ContrastEnhancement enhancement) {
+// SelectedChannelType sct = new SelectedChannelTypeImpl();
+// sct.setChannelName(name);
+// sct.setContrastEnhancement(enhancement);
+//
+// return sct;
+// }
+//
+// public SelectedChannelType createSelectedChannelType(String name,
+// Expression gammaValue) {
+// SelectedChannelType sct = new SelectedChannelTypeImpl();
+// sct.setChannelName(name);
+// sct.setContrastEnhancement(createContrastEnhancement(gammaValue));
+//
+// return sct;
+// }
+//
+// public StyledLayerDescriptor createStyledLayerDescriptor() {
+// return new StyledLayerDescriptorImpl();
+// }
+//
+// public UserLayer createUserLayer() {
+// return new UserLayerImpl();
+// }
+//
+// public NamedLayer createNamedLayer() {
+// return new NamedLayerImpl();
+// }
+//
+// public RemoteOWS createRemoteOWS(String service, String onlineResource) {
+// RemoteOWSImpl remoteOWS = new RemoteOWSImpl();
+// remoteOWS.setService(service);
+// remoteOWS.setOnlineResource(onlineResource);
+//
+// return remoteOWS;
+// }
+//
+// public ShadedRelief createShadedRelief(Expression reliefFactor) {
+// ShadedRelief relief = new ShadedReliefImpl();
+// relief.setReliefFactor(reliefFactor);
+//
+// return relief;
+// }
+//}
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureOperationTreeParser.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureOperationTreeParser.java 2009-09-03 18:24:41 UTC (rev 371)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureOperationTreeParser.java 2009-09-03 18:41:50 UTC (rev 372)
@@ -29,8 +29,6 @@
******************************************************************************/
package schmitzm.geotools.feature;
-import org.geotools.filter.text.cql2.CQL;
-import org.geotools.filter.text.cql2.CQLException;
import org.opengis.filter.Filter;
import schmitzm.lang.tree.BinaryTreeNode;
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureTypeBuilderTableModel.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureTypeBuilderTableModel.java 2009-09-03 18:24:41 UTC (rev 371)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureTypeBuilderTableModel.java 2009-09-03 18:41:50 UTC (rev 372)
@@ -43,8 +43,8 @@
import org.geotools.feature.AttributeTypeFactory;
import org.geotools.feature.DefaultAttributeType;
+import org.geotools.feature.FeatureTypeBuilder;
import org.geotools.feature.GeometryAttributeType;
-import org.geotools.feature.SchemaException;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
import org.geotools.feature.type.GeometricAttributeType;
import org.opengis.feature.simple.SimpleFeatureType;
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureUtil.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureUtil.java 2009-09-03 18:24:41 UTC (rev 371)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureUtil.java 2009-09-03 18:41:50 UTC (rev 372)
@@ -60,12 +60,10 @@
import org.geotools.feature.DefaultFeatureCollections;
import org.geotools.feature.FeatureCollection;
import org.geotools.feature.FeatureIterator;
-import org.geotools.feature.FeatureTypeBuilder;
import org.geotools.feature.GeometryAttributeType;
import org.geotools.feature.SchemaException;
import org.geotools.feature.simple.SimpleFeatureBuilder;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
-import org.geotools.feature.type.GeometricAttributeType;
import org.geotools.filter.FilterFactory;
import org.geotools.map.MapLayer;
import org.geotools.styling.Graphic;
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureLayerFilterDialog.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureLayerFilterDialog.java 2009-09-03 18:24:41 UTC (rev 371)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureLayerFilterDialog.java 2009-09-03 18:41:50 UTC (rev 372)
@@ -183,7 +183,7 @@
if ( e.getSource() == okButton || e.getSource() == applyButton ) {
// FeatureCollection filtern
try {
- FeatureCollection fc = filterPanel.filterFeatureCollection();
+ FeatureCollection<SimpleFeatureType, SimpleFeature> fc = filterPanel.filterFeatureCollection();
FeatureSelectedEvent fse = new FeatureSelectedEvent(getMapPane() , layer, fc.getBounds(), fc, FeatureLayerFilterDialog.this);
getMapPane().fireMapPaneEvent( fse );
} catch ( Exception err ) {
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/GeoMapPane.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/GeoMapPane.java 2009-09-03 18:24:41 UTC (rev 371)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/GeoMapPane.java 2009-09-03 18:41:50 UTC (rev 372)
@@ -116,6 +116,7 @@
* use of this {@link GeoMapPane} is undefined.
*/
private boolean disposed = false;
+ private HashMap<Object, Object> defaultRendererHints;
/**
* Erzeugt ein neues {@code GeoMapPane}.
@@ -156,7 +157,7 @@
"GridPanel for horizontal grid must be of type GridPanel.HORIZONTAL!!");
// Karte
- this.mapPane = (mapPane != null) ? mapPane : new JMapPane(null,null,renderer, null);
+ this.mapPane = (mapPane != null) ? mapPane : new JMapPane(null,null,renderer, null, getDefaultRendererHints());
// Koordinaten-Leisten
this.vertGrid = (vGrid != null) ? vGrid : new GridPanel(
GridPanel.VERTICAL, this.mapPane);
@@ -316,32 +317,28 @@
}
}
- // /**
- // * Trying to reproduce a bug #37
- // *
- // * for explanation and screenshots see the xulu trac
- // *
- // * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
- // Krüger</a>
- // */
- // public static void main(String[] args) throws Exception {
- // JFrame f = new JFrame();
- // f.pack();
- // f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
- // GeoMapPane gmp = new GeoMapPane();
- // // FeatureCollection shape = GeoImportUtil.readFeaturesFromShapeFile( new
- // File("/home/stefan/Desktop/AtlasData/benin_karte_UTM31/admin_boundary_benin_utm.shp")
- // );
- // FeatureCollection shape = GeoImportUtil.readFeaturesFromShapeFile( new
- // File("F:\\Arbeit\\Impetus - ZFL\\Daten\\Neuer Ordner\\admin_boundary_benin_utm.shp")
- // );
- // gmp.getMapContext().addLayer( shape,
- // FeatureUtil.createDefaultStyle(shape) );
- // f.add( gmp);
- // gmp.getMapPane().setPreferredSize( new Dimension(400,400));
- // gmp.refreshMap();
- // f.pack();
- // f.setVisible(true);
- // }
+ /**
+ * @return
+ */
+ public HashMap<Object, Object> getDefaultRendererHints() {
+ if (defaultRendererHints == null){
+ defaultRendererHints = new HashMap<Object, Object>();
+
+ /**
+ * This hint avoids "Bursa Wolf Parameters missing" exceptions while
+ * zooming which slow down the rendering process. The exceptions
+ * appeared for example in maps that consisted only of layers of DHDN2
+ * CRS.
+ */
+ defaultRendererHints.put(
+ StreamingRenderer.SCALE_COMPUTATION_METHOD_KEY,
+ StreamingRenderer.SCALE_OGC);
+
+
+
+ }
+ return defaultRendererHints;
+ }
+
}
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JEditorPane.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JEditorPane.java 2009-09-03 18:24:41 UTC (rev 371)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JEditorPane.java 2009-09-03 18:41:50 UTC (rev 372)
@@ -44,11 +44,8 @@
import org.geotools.feature.DefaultFeatureCollection;
import org.geotools.feature.DefaultFeatureCollections;
import org.geotools.feature.FeatureCollection;
-import org.geotools.feature.FeatureTypeBuilder;
import org.geotools.feature.GeometryAttributeType;
-import org.geotools.feature.SchemaException;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
-import org.geotools.feature.type.GeometricAttributeType;
import org.geotools.map.DefaultMapContext;
import org.geotools.map.DefaultMapLayer;
import org.geotools.map.MapContext;
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JMapPane.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JMapPane.java 2009-09-03 18:24:41 UTC (rev 371)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JMapPane.java 2009-09-03 18:41:50 UTC (rev 372)
@@ -80,7 +80,6 @@
import org.geotools.map.MapLayer;
import org.geotools.parameter.Parameter;
import org.geotools.referencing.CRS;
-import org.geotools.referencing.crs.DefaultGeographicCRS;
import org.geotools.renderer.GTRenderer;
import org.geotools.renderer.lite.RendererUtilities;
import org.geotools.renderer.lite.StreamingRenderer;
@@ -102,7 +101,6 @@
import org.opengis.referencing.operation.TransformException;
import schmitzm.geotools.FilterUtil;
-import schmitzm.geotools.GTUtil;
import schmitzm.geotools.JTSUtil;
import schmitzm.geotools.grid.GridUtil;
import schmitzm.geotools.io.GeoImportUtil;
@@ -405,7 +403,6 @@
};
private static final FilterFactory ff = FilterUtil.FILTER_FAC;
- private static final GeometryFactory gf = FilterUtil.GEOMETRY_FAC;
/**
* A flag indicating if dispose() was already called. If true, then further
@@ -469,7 +466,7 @@
* ).
*/
public JMapPane() {
- this(null, true, null, null);
+ this(null, true, null, null, null);
}
/**
@@ -490,9 +487,10 @@
* @param context
* Verwaltung der einzelnen Layer (z.B. {@link DefaultMapContext}
* ).
+ * @param rendererHints A {@link Map} with hints for the renderer. May be <code>null</code>.
*/
public JMapPane(LayoutManager layout, Boolean isDoubleBuffered,
- GTRenderer renderer, MapContext context) {
+ GTRenderer renderer, MapContext context, Map<Object, Object> rendererHints) {
super(layout != null ? layout : new BorderLayout(),
isDoubleBuffered != null ? isDoubleBuffered : true,
renderer != null ? renderer : new ShapefileRenderer(context),
@@ -504,21 +502,14 @@
// Ueber die Methode enableAntiAliasing(boolean) kann das
// rechenintensive AntiAliasing fuer Text un Vectoren eingeschaltet
// werden
- RenderingHints hints = ImageUtilities.NN_INTERPOLATION_HINT;
+ RenderingHints hintsJava2d = ImageUtilities.NN_INTERPOLATION_HINT;
+ getRenderer().setJava2DHints(hintsJava2d);
+
+ if (rendererHints != null) {
+ getRenderer().getRendererHints().putAll(rendererHints);
+ }
- getRenderer().setJava2DHints(hints);
- /**
- * This hint avoids "Bursa Wolf Parameters missing" exceptions while
- * zooming which slow down the rendering process. The exceptions
- * appeared for example in maps that consisted only of layers of DHDN2
- * CRS.
- */
- getRenderer().getRendererHints().put(
- StreamingRenderer.SCALE_COMPUTATION_METHOD_KEY,
- StreamingRenderer.SCALE_OGC);
-
-
// hints.add( new RenderingHints(RenderingHints.KEY_ANTIALIASING,
// RenderingHints.VALUE_ANTIALIAS_OFF ) );
// hints.add( new RenderingHints(RenderingHints.KEY_INTERPOLATION,
@@ -662,6 +653,11 @@
});
}
+ public JMapPane(LayoutManager layout, boolean isDoubleBuffered,
+ GTRenderer renderer, MapContext context) {
+ this(layout, isDoubleBuffered, renderer, context, null);
+ }
+
/**
* Get the BufferedImage to use as a flaoting icon in the lower right
* corner.
@@ -1711,7 +1707,7 @@
FeatureCollection<SimpleFeatureType, SimpleFeature> fc = featureSource
.getFeatures(filter);
- LOGGER.info("Crazy finsvisible features position reached");
+// LOGGER.info("Crazy finsvisible features position reached");
// Liefert eine FeatureCollection zurück, in welcher nur
// Features enthalten sind, welche bei der aktuellen
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/io/GeoExportUtil.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/io/GeoExportUtil.java 2009-09-03 18:24:41 UTC (rev 371)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/io/GeoExportUtil.java 2009-09-03 18:41:50 UTC (rev 372)
@@ -53,7 +53,6 @@
import schmitzm.data.WritableGridRaster;
import schmitzm.geotools.feature.FeatureCollectionReader;
import schmitzm.geotools.grid.GridUtil;
-import schmitzm.geotools.grid.WritableGridCoverage;
import schmitzm.io.IOUtil;
/**
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/io/GeoImportUtil.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/io/GeoImportUtil.java 2009-09-03 18:24:41 UTC (rev 371)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/io/GeoImportUtil.java 2009-09-03 18:41:50 UTC (rev 372)
@@ -42,7 +42,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
-import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
@@ -53,11 +52,8 @@
import javax.imageio.ImageIO;
import org.apache.log4j.Logger;
-import org.geotools.coverage.CoverageFactoryFinder;
-import org.geotools.coverage.GridSampleDimension;
import org.geotools.coverage.grid.GridCoverage2D;
import org.geotools.coverage.grid.GridCoverageFactory;
-import org.geotools.coverage.grid.GridGeometry2D;
import org.geotools.coverage.grid.io.AbstractGridCoverage2DReader;
import org.geotools.data.DataStore;
import org.geotools.data.shapefile.ShapefileDataStore;
@@ -74,10 +70,8 @@
import org.geotools.geometry.Envelope2D;
import org.geotools.referencing.CRS;
import org.geotools.referencing.crs.DefaultGeographicCRS;
-import org.opengis.coverage.grid.GridCoverage;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
-import org.opengis.parameter.GeneralParameterValue;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import schmitzm.data.WritableGridRaster;
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/styling/StylingUtil.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/styling/StylingUtil.java 2009-09-03 18:24:41 UTC (rev 371)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/styling/StylingUtil.java 2009-09-03 18:41:50 UTC (rev 372)
@@ -71,14 +71,12 @@
import org.geotools.feature.FeatureCollection;
import org.geotools.feature.GeometryAttributeType;
import org.geotools.filter.ConstantExpression;
-import org.geotools.gui.swing.ExceptionMonitor;
import org.geotools.renderer.lite.RendererUtilities;
import org.geotools.resources.i18n.Vocabulary;
import org.geotools.resources.i18n.VocabularyKeys;
import org.geotools.styling.ColorMap;
import org.geotools.styling.ColorMapEntry;
import org.geotools.styling.ColorMapEntryImpl;
-import org.geotools.styling.ColorMapImpl;
import org.geotools.styling.ExternalGraphic;
import org.geotools.styling.FeatureTypeStyle;
import org.geotools.styling.FeatureTypeStyleImpl;
@@ -100,8 +98,8 @@
import org.geotools.styling.StyleFactory;
import org.geotools.styling.Symbolizer;
import org.geotools.styling.TextSymbolizer;
+import org.geotools.styling.visitor.DuplicatingStyleVisitor;
import org.geotools.util.NumberRange;
-import org.hsqldb.lib.StringInputStream;
import org.jdom.Element;
import org.jdom.output.XMLOutputter;
import org.opengis.coverage.grid.Grid;
@@ -112,9 +110,7 @@
import org.opengis.filter.FilterFactory2;
import org.opengis.filter.expression.Expression;
import org.opengis.filter.expression.Literal;
-import org.opengis.filter.expression.NilExpression;
-import schmitzm.geotools.FilterUtil;
import schmitzm.geotools.feature.FeatureUtil;
import schmitzm.geotools.feature.FeatureUtil.GeometryForm;
import schmitzm.geotools.grid.GridUtil;
@@ -448,15 +444,21 @@
* ist
*/
public static ColorMap cloneColorMap(ColorMap colorMap) {
- if (colorMap == null)
- return null;
- ColorMapEntry[] entry = colorMap.getColorMapEntries();
- ColorMap newColorMap = new ColorMapImpl();
- newColorMap.setType(colorMap.getType()); // Hat noch keinen Effekt in
- // 2.3.2, aber dennoch, SK
- for (int i = 0; i < entry.length; i++)
- newColorMap.addColorMapEntry(cloneColorMapEntry(entry[i]));
- return newColorMap;
+ DuplicatingStyleVisitor duplicatingStyleVisitor = new DuplicatingStyleVisitor();
+ colorMap.accept(duplicatingStyleVisitor);
+ return (ColorMap)duplicatingStyleVisitor.getCopy();
+
+//
+//
+// if (colorMap == null)
+// return null;
+// ColorMapEntry[] entry = colorMap.getColorMapEntries();
+// ColorMap newColorMap = new ColorMapImpl();
+// newColorMap.setType(colorMap.getType()); // Hat noch keinen Effekt in
+// // 2.3.2, aber dennoch, SK
+// for (int i = 0; i < entry.length; i++)
+// newColorMap.addColorMapEntry(cloneColorMapEntry(entry[i]));
+// return newColorMap;
}
/**
@@ -558,14 +560,18 @@
* @return <code>null</code> wenn der uebergebene ColorMapEntry
* <code>null</code> ist
*/
- public static ColorMapEntry cloneColorMapEntry(ColorMapEntry colorMapEntry) {
- if (colorMapEntry == null)
- return null;
-
- return createColorMapEntry(colorMapEntry.getLabel(),
- getQuantityFromColorMapEntry(colorMapEntry),
- getColorFromColorMapEntry(colorMapEntry),
- getOpacityFromColorMapEntry(colorMapEntry));
+ public static ColorMapEntry ColorMapEntry(ColorMapEntry colorMapEntry) {
+ DuplicatingStyleVisitor duplicatingStyleVisitor = new DuplicatingStyleVisitor();
+ colorMapEntry.accept(duplicatingStyleVisitor);
+ return (ColorMapEntry)duplicatingStyleVisitor.getCopy();
+
+// if (colorMapEntry == null)
+// return null;
+//
+// return createColorMapEntry(colorMapEntry.getLabel(),
+// getQuantityFromColorMapEntry(colorMapEntry),
+// getColorFromColorMapEntry(colorMapEntry),
+// getOpacityFromColorMapEntry(colorMapEntry));
}
/**
@@ -1335,75 +1341,63 @@
* the {@link Style} to be copied.
*/
public static Style clone(Style style) {
-
- String xml;
- try {
- xml = SLDTRANSFORMER.transform(style);
-
- SLDParser stylereader;
- stylereader = new SLDParser(StylingUtil.STYLE_FACTORY,
- new StringInputStream(xml));
- Style[] styles = stylereader.readXML();
-
- return styles[0];
- } catch (TransformerException e) {
- ExceptionMonitor.show(null, e);
- return null;
- }
+ DuplicatingStyleVisitor duplicatingStyleVisitor = new DuplicatingStyleVisitor();
+ style.accept(duplicatingStyleVisitor);
+ return (Style)duplicatingStyleVisitor.getCopy();
+
+//
+// String xml;
+// try {
+// xml = SLDTRANSFORMER.transform(style);
+//
+// SLDParser stylereader;
+// stylereader = new SLDParser(StylingUtil.STYLE_FACTORY,
+// new StringInputStream(xml));
+// Style[] styles = stylereader.readXML();
+//
+// return styles[0];
+// } catch (TransformerException e) {
+// ExceptionMonitor.show(null, e);
+// return null;
+// }
}
+
+ /**
+ * Clones a {@link Symbolizer} using the {@link DuplicatingStyleVisitor}.
+ */
public static Symbolizer clone(Symbolizer sym) {
- if (sym == null) {
- throw new RuntimeException("cant clone null");
- }
+ DuplicatingStyleVisitor duplicatingStyleVisitor = new DuplicatingStyleVisitor();
+ sym.accept(duplicatingStyleVisitor);
+ return (Symbolizer)duplicatingStyleVisitor.getCopy();
- /**
- * Doing some corrections. Otherwise the Symbolizer can not be converted
- * to XML
- */
- if (sym instanceof PointSymbolizer) {
- PointSymbolizer ps = (PointSymbolizer) sym;
- Graphic graphic = ps.getGraphic();
+// Style style = STYLE_BUILDER.createStyle(sym); // TODO Mag ich das?
+//
+// Filter allwaysTrueFilter = FilterUtil.FILTER_FAC2.equals(
+// FilterUtil.FILTER_FAC2.literal("1"), FilterUtil.FILTER_FAC2
+// .literal("1"));
+//
+// style.getFeatureTypeStyles()[0].getRules()[0]
+// .setFilter(allwaysTrueFilter);
+//
+// String xml;
+// try {
+// xml = SLDTRANSFORMER.transform(style);
+//
+// SLDParser stylereader;
+// stylereader = new SLDParser(StylingUtil.STYLE_FACTORY,
+// new StringInputStream(xml));
+// Style[] styles = stylereader.readXML();
+//
+// return (Symbolizer) styles[0].getFeatureTypeStyles()[0].getRules()[0]
+// .getSymbolizers()[0];
+// } catch (TransformerException e) {
+// ExceptionMonitor.show(null, e);
+// return STYLE_FACTORY.createPointSymbolizer(); // TODO Abhängig vom
+// // sym geometry type
+// }
+
- // That bugfix was needed in 2.4.5 before we patched the
- // StyleFactoryImpl
- if (graphic.getSize() instanceof NilExpression) {
- graphic.setSize(FilterUtil.FILTER_FAC.literal(10.));
- }
-
- try {
- SLDTRANSFORMER.transform(graphic);
- } catch (TransformerException e) {
- LOGGER.error("gr", e);
- }
- }
-
- Style style = STYLE_BUILDER.createStyle(sym); // TODO Mag ich das?
-
- Filter allwaysTrueFilter = FilterUtil.FILTER_FAC2.equals(
- FilterUtil.FILTER_FAC2.literal("1"), FilterUtil.FILTER_FAC2
- .literal("1"));
-
- style.getFeatureTypeStyles()[0].getRules()[0]
- .setFilter(allwaysTrueFilter);
-
- String xml;
- try {
- xml = SLDTRANSFORMER.transform(style);
-
- SLDParser stylereader;
- stylereader = new SLDParser(StylingUtil.STYLE_FACTORY,
- new StringInputStream(xml));
- Style[] styles = stylereader.readXML();
-
- return (Symbolizer) styles[0].getFeatureTypeStyles()[0].getRules()[0]
- .getSymbolizers()[0];
- } catch (TransformerException e) {
- ExceptionMonitor.show(null, e);
- return STYLE_FACTORY.createPointSymbolizer(); // TODO Abhängig vom
- // sym geometry type
- }
-
}
/**
@@ -1415,30 +1409,35 @@
* Krüger</a>
*/
public static Graphic clone(Graphic graphic) {
- try {
- PointSymbolizer ps = STYLE_FACTORY.createPointSymbolizer(graphic,
- "ACHTUNG");
-
- Style style = STYLE_BUILDER.createStyle(ps);
-
- final String xml = SLDTRANSFORMER.transform(style);
-
- SLDParser stylereader;
- stylereader = new SLDParser(StylingUtil.STYLE_FACTORY,
- new StringInputStream(xml));
- Style[] styles = stylereader.readXML();
-
- PointSymbolizer clonedPs = (PointSymbolizer) styles[0]
- .getFeatureTypeStyles()[0].getRules()[0].getSymbolizers()[0];
-
- Graphic clonedG = clonedPs.getGraphic();
-
- return clonedG;
-
- } catch (TransformerException e) {
- LOGGER.error("Cloning a Graphic", e);
- }
- return null;
+ DuplicatingStyleVisitor duplicatingStyleVisitor = new DuplicatingStyleVisitor();
+ graphic.accept(duplicatingStyleVisitor);
+ return (Graphic)duplicatingStyleVisitor.getCopy();
+
+
+// try {
+// PointSymbolizer ps = STYLE_FACTORY.createPointSymbolizer(graphic,
+// "ACHTUNG");
+//
+// Style style = STYLE_BUILDER.createStyle(ps);
+//
+// final String xml = SLDTRANSFORMER.transform(style);
+//
+// SLDParser stylereader;
+// stylereader = new SLDParser(StylingUtil.STYLE_FACTORY,
+// new StringInputStream(xml));
+// Style[] styles = stylereader.readXML();
+//
+// PointSymbolizer clonedPs = (PointSymbolizer) styles[0]
+// .getFeatureTypeStyles()[0].getRules()[0].getSymbolizers()[0];
+//
+// Graphic clonedG = clonedPs.getGraphic();
+//
+// return clonedG;
+//
+// } catch (TransformerException e) {
+// LOGGER.error("Cloning a Graphic", e);
+// }
+// return null;
}
/**
Modified: branches/1.0-gt2-2.6/src/schmitzm/io/IOUtil.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/io/IOUtil.java 2009-09-03 18:24:41 UTC (rev 371)
+++ branches/1.0-gt2-2.6/src/schmitzm/io/IOUtil.java 2009-09-03 18:41:50 UTC (rev 372)
@@ -480,7 +480,6 @@
} catch (Exception err) {
message.append( file.getAbsolutePath() );
}
- System.out.println(message);
}
}
// Wenn rekusiv geloescht werden soll, alle Verzeichnisse im Verzeichnis
@@ -539,7 +538,6 @@
File currDir = new File(".");
FileFilter filter = createSimpleFileFilter(arg[1],FilterMode.DIR_ONLY);
int delCount = deleteFiles(currDir, filter, true, true);
- System.out.println(delCount+ " files deleted.");
}
else {
LOGGER.error("Unknown function: "+func);
Modified: branches/1.0-gt2-2.6/src/skrueger/geotools/LegendIconFeatureRenderer.java
===================================================================
--- branches/1.0-gt2-2.6/src/skrueger/geotools/LegendIconFeatureRenderer.java 2009-09-03 18:24:41 UTC (rev 371)
+++ branches/1.0-gt2-2.6/src/skrueger/geotools/LegendIconFeatureRenderer.java 2009-09-03 18:41:50 UTC (rev 372)
@@ -45,14 +45,10 @@
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Dimension;
-import java.awt.FontMetrics;
-import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
-import java.util.ArrayList;
-import java.util.List;
import javax.swing.tree.DefaultTreeCellRenderer;
Modified: branches/1.0-gt2-2.6/src/skrueger/geotools/io/GeoImportUtilURL.java
===================================================================
--- branches/1.0-gt2-2.6/src/skrueger/geotools/io/GeoImportUtilURL.java 2009-09-03 18:24:41 UTC (rev 371)
+++ branches/1.0-gt2-2.6/src/skrueger/geotools/io/GeoImportUtilURL.java 2009-09-03 18:41:50 UTC (rev 372)
@@ -31,7 +31,6 @@
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
-import java.io.File;
import java.io.IOException;
import java.net.URL;
@@ -42,7 +41,6 @@
import org.geotools.coverage.grid.GridCoverage2D;
import org.geotools.coverage.grid.GridCoverageFactory;
import org.geotools.factory.Hints;
-import org.geotools.gce.arcgrid.ArcGridReader;
import org.geotools.gce.geotiff.GeoTiffReader;
import org.geotools.geometry.Envelope2D;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
More information about the Schmitzm-commits
mailing list