[Schmitzm-commits] r336 - in branches/1.0-gt2-2.6/src: org/geotools org/geotools/gui/swing org/geotools/renderer/lite/gridcoverage2d schmitzm/geotools schmitzm/geotools/feature schmitzm/geotools/gui schmitzm/geotools/io schmitzm/geotools/map/event schmitzm/geotools/styling schmitzm/jfree/feature/style skrueger/geotools
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Aug 27 11:10:12 CEST 2009
Author: alfonx
Date: 2009-08-27 11:10:10 +0200 (Thu, 27 Aug 2009)
New Revision: 336
Removed:
branches/1.0-gt2-2.6/src/org/geotools/data/
Modified:
branches/1.0-gt2-2.6/src/org/geotools/gui/swing/JMapPane.java
branches/1.0-gt2-2.6/src/org/geotools/renderer/lite/gridcoverage2d/RasterSymbolizerSupport.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/FilterUtil.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureOperationTree.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureTypeTableModel.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureUtil.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureCollectionTableModel.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureLayerFilterDialog.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureTablePane.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JEditorPane.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JEditorToolBar.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JMapPane.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/MapActionControlPane.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/MapContextControlPane.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/io/GeoExportUtil.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/map/event/MapLayerAdapter.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/styling/StylingUtil.java
branches/1.0-gt2-2.6/src/schmitzm/jfree/feature/style/FeatureChartUtil.java
branches/1.0-gt2-2.6/src/skrueger/geotools/MapPaneToolBar.java
branches/1.0-gt2-2.6/src/skrueger/geotools/StyledFS.java
Log:
Migrating to GT2.6... only 100 compile errors left...
Modified: branches/1.0-gt2-2.6/src/org/geotools/gui/swing/JMapPane.java
===================================================================
--- branches/1.0-gt2-2.6/src/org/geotools/gui/swing/JMapPane.java 2009-08-26 18:09:39 UTC (rev 335)
+++ branches/1.0-gt2-2.6/src/org/geotools/gui/swing/JMapPane.java 2009-08-27 09:10:10 UTC (rev 336)
@@ -67,6 +67,7 @@
import org.geotools.map.event.MapLayerListListener;
import org.geotools.referencing.crs.DefaultGeographicCRS;
import org.geotools.renderer.GTRenderer;
+import org.geotools.renderer.label.LabelCacheImpl;
import org.geotools.renderer.lite.LabelCache;
import org.geotools.renderer.lite.LabelCacheDefault;
import org.geotools.renderer.lite.StreamingRenderer;
@@ -91,8 +92,7 @@
import com.vividsolutions.jts.geom.GeometryFactory;
public class JMapPane extends JPanel implements MouseListener,
- MouseMotionListener, HighlightChangeListener, SelectionChangeListener,
- PropertyChangeListener, MapLayerListListener {
+ MouseMotionListener, PropertyChangeListener, MapLayerListListener {
private static Logger LOGGER = Logger.getLogger(JMapPane.class.getName());
private static final long serialVersionUID = -8647971481359690499L;
@@ -158,36 +158,6 @@
// SK: private BufferedImage baseImage, panningImage;
/**
- * image of selection
- */
- private BufferedImage selectImage;
-
- /**
- * style for selected items
- */
- private Style selectionStyle;
-
- /**
- * layer that selection works on
- */
- private MapLayer selectionLayer;
-
- /**
- * layer that highlight works on
- */
- private MapLayer highlightLayer;
-
- /**
- * the object which manages highlighting
- */
- private HighlightManager highlightManager;
-
- /**
- * is highlighting on or off
- */
- private boolean highlight = true;
-
- /**
* a factory for filters
*/
FilterFactory2 ff;
@@ -197,16 +167,6 @@
*/
GeometryFactory gf = new GeometryFactory(); // FactoryFinder.getGeometryFactory(null);
- /**
- * the collections of features to be selected or highlighted
- */
- FeatureCollection selection;
-
- /**
- * the collections of features to be selected or highlighted
- */
- FeatureCollection highlightFeature;
-
private int state = ZoomIn;
/**
@@ -214,21 +174,9 @@
*/
private double zoomFactor = 2.0;
- Style lineHighlightStyle;
-
- Style pointHighlightStyle;
-
- Style polygonHighlightStyle;
-
- Style polygonSelectionStyle;
-
- Style pointSelectionStyle;
-
- Style lineSelectionStyle;
-
boolean changed = true;
- LabelCache labelCache = new LabelCacheDefault();
+ LabelCache labelCache = new LabelCacheImpl();
// xulu.sc
// private boolean reset = false;
@@ -245,7 +193,6 @@
int lastY;
- private SelectionManager selectionManager;
// xulu.sn
private Double maxZoomScale = Double.MIN_VALUE;
private Double minZoomScale = Double.MAX_VALUE;
@@ -301,19 +248,6 @@
this.addMouseListener(this);
this.addMouseMotionListener(this);
- setHighlightManager(new HighlightManager(highlightLayer));
- setSelectionManager(new SelectionManager(selectionLayer));
- lineHighlightStyle = setupStyle(LINE, Color.red);
-
- pointHighlightStyle = setupStyle(POINT, Color.red);
-
- polygonHighlightStyle = setupStyle(POLYGON, Color.red);
-
- polygonSelectionStyle = setupStyle(POLYGON, Color.cyan);
-
- pointSelectionStyle = setupStyle(POINT, Color.cyan);
-
- lineSelectionStyle = setupStyle(LINE, Color.cyan);
setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
}
@@ -405,95 +339,7 @@
this.zoomFactor = zoomFactor;
}
- public MapLayer getSelectionLayer() {
- return selectionLayer;
- }
- public void setSelectionLayer(final MapLayer selectionLayer) {
- this.selectionLayer = selectionLayer;
- if (selectionManager != null) {
- selectionManager.setSelectionLayer(selectionLayer);
- }
- }
-
- public boolean isHighlight() {
- return highlight;
- }
-
- public void setHighlight(final boolean highlight) {
- this.highlight = highlight;
- }
-
- public MapLayer getHighlightLayer() {
- return highlightLayer;
- }
-
- public void setHighlightLayer(final MapLayer highlightLayer) {
- this.highlightLayer = highlightLayer;
-
- if (highlightManager != null) {
- highlightManager.setHighlightLayer(highlightLayer);
- }
- }
-
- public HighlightManager getHighlightManager() {
- return highlightManager;
- }
-
- public void setHighlightManager(final HighlightManager highlightManager) {
- this.highlightManager = highlightManager;
- this.highlightManager.addHighlightChangeListener(this);
- this.addMouseMotionListener(this.highlightManager);
- }
-
- public Style getLineHighlightStyle() {
- return lineHighlightStyle;
- }
-
- public void setLineHighlightStyle(final Style lineHighlightStyle) {
- this.lineHighlightStyle = lineHighlightStyle;
- }
-
- public Style getLineSelectionStyle() {
- return lineSelectionStyle;
- }
-
- public void setLineSelectionStyle(final Style lineSelectionStyle) {
- this.lineSelectionStyle = lineSelectionStyle;
- }
-
- public Style getPointHighlightStyle() {
- return pointHighlightStyle;
- }
-
- public void setPointHighlightStyle(final Style pointHighlightStyle) {
- this.pointHighlightStyle = pointHighlightStyle;
- }
-
- public Style getPointSelectionStyle() {
- return pointSelectionStyle;
- }
-
- public void setPointSelectionStyle(final Style pointSelectionStyle) {
- this.pointSelectionStyle = pointSelectionStyle;
- }
-
- public Style getPolygonHighlightStyle() {
- return polygonHighlightStyle;
- }
-
- public void setPolygonHighlightStyle(final Style polygonHighlightStyle) {
- this.polygonHighlightStyle = polygonHighlightStyle;
- }
-
- public Style getPolygonSelectionStyle() {
- return polygonSelectionStyle;
- }
-
- public void setPolygonSelectionStyle(final Style polygonSelectionStyle) {
- this.polygonSelectionStyle = polygonSelectionStyle;
- }
-
protected void paintComponent(final Graphics g) {
super.paintComponent(g);
@@ -509,8 +355,7 @@
try {
mapArea = context.getLayerBounds();
} catch (final IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.warn("context.getLayerBounds()", e);
}
}
@@ -554,74 +399,6 @@
}
((Graphics2D) g).drawImage(baseImage, 0, 0, this);
-
- if ((selection != null) && (selection.size() > 0)) {
- // paint selection
-
- String type = selectionLayer.getFeatureSource().getSchema()
- .getDefaultGeometry().getType().getName();
- /* String type = selection.getDefaultGeometry().getGeometryType(); */
- /* System.out.println(type); */
- if (type == null)
- type = "polygon";
-
- /* String type = "point"; */
-
- if (type.toLowerCase().endsWith("polygon")) {
- selectionStyle = polygonSelectionStyle;
- } else if (type.toLowerCase().endsWith("point")) {
- selectionStyle = pointSelectionStyle;
- } else if (type.toLowerCase().endsWith("line")) {
- selectionStyle = lineSelectionStyle;
- }
-
- selectionContext = new DefaultMapContext(DefaultGeographicCRS.WGS84);
-
- selectionContext.addLayer(selection, selectionStyle);
- selectionRenderer.setContext(selectionContext);
-
- selectImage = new BufferedImage(dr.width, dr.height,
- BufferedImage.TYPE_INT_ARGB);
-
- final Graphics2D ig = selectImage.createGraphics();
- /* System.out.println("rendering selection"); */
- selectionRenderer.paint((Graphics2D) ig, dr, mapArea);
-
- ((Graphics2D) g).drawImage(selectImage, 0, 0, this);
- }
-
- if (highlight && (highlightFeature != null)
- && (highlightFeature.size() > 0)) {
- /*
- * String type = selection.getDefaultGeometry().getGeometryType();
- * System.out.println(type); if(type==null) type="polygon";
- */
- String type = highlightLayer.getFeatureSource().getSchema()
- .getDefaultGeometry().getType().getName();
- /* String type = selection.getDefaultGeometry().getGeometryType(); */
- // System.out.println(type);
- if (type == null)
- type = "polygon";
-
- /* String type = "point"; */
- Style highlightStyle = null;
- if (type.toLowerCase().endsWith("polygon")) {
- highlightStyle = polygonHighlightStyle;
- } else if (type.toLowerCase().endsWith("point")) {
- highlightStyle = pointHighlightStyle;
- } else if (type.toLowerCase().endsWith("line")) {
- highlightStyle = lineHighlightStyle;
- }
-
- final MapContext highlightContext = new DefaultMapContext(
- DefaultGeographicCRS.WGS84);
-
- highlightContext.addLayer(highlightFeature, highlightStyle);
- highlightRenderer.setContext(highlightContext);
-
- /* System.out.println("rendering highlight"); */
- highlightRenderer.paint((Graphics2D) g, dr, mapArea);
- }
}
private Envelope fixAspectRatio(final Rectangle r, final Envelope mapArea) {
@@ -660,82 +437,82 @@
return new Envelope(ll, ur);
}
- public void doSelection(final double x, final double y, final MapLayer layer) {
+// public void doSelection(final double x, final double y, final MapLayer layer) {
+//
+// final Geometry geometry = gf.createPoint(new Coordinate(x, y));
+//
+// // org.opengis.geometry.Geometry geometry = new Point();
+//
+// findFeature(geometry, layer);
+//
+// }
+//
+// /**
+// * @param geometry
+// * - a geometry to construct the filter with
+// * @param i
+// * - the index of the layer to search
+// * @throws IndexOutOfBoundsException
+// */
+// private void findFeature(final Geometry geometry, final MapLayer layer)
+// throws IndexOutOfBoundsException {
+// org.opengis.filter.spatial.BinarySpatialOperator f = null;
+//
+// if ((context == null) || (layer == null)) {
+// return;
+// }
+//
+// try {
+// String name = layer.getFeatureSource().getSchema()
+// .getDefaultGeometry().getLocalName();
+//
+// if (name == "") {
+// name = "the_geom";
+// }
+//
+// try {
+// f = ff.contains(ff.property(name), ff.literal(geometry));
+// if (selectionManager != null) {
+//// System.out.println("selection changed");
+// selectionManager.selectionChanged(this, f);
+//
+// }
+// } catch (final IllegalFilterException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+//
+// /*
+// * // f.addLeftGeometry(ff.property(name)); //
+// * System.out.println("looking with " + f); FeatureCollection fc =
+// * layer.getFeatureSource().getFeatures(f);
+// *
+// *
+// *
+// * if (fcol == null) { fcol = fc;
+// *
+// * // here we should set the defaultgeom type } else {
+// * fcol.addAll(fc); }
+// */
+//
+// /*
+// * GeometryAttributeType gat =
+// * layer.getFeatureSource().getSchema().getDefaultGeometry();
+// * fcol.setDefaultGeometry((Geometry)gat.createDefaultValue());
+// */
+//
+// /*
+// * Iterator fi = fc.iterator(); while (fi.hasNext()) { SimpleFeature feat
+// * = (SimpleFeature) fi.next(); System.out.println("selected " +
+// * feat.getAttribute("STATE_NAME")); }
+// */
+// } catch (final IllegalFilterException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+// return;
+// }
- final Geometry geometry = gf.createPoint(new Coordinate(x, y));
-
- // org.opengis.geometry.Geometry geometry = new Point();
-
- findFeature(geometry, layer);
-
- }
-
- /**
- * @param geometry
- * - a geometry to construct the filter with
- * @param i
- * - the index of the layer to search
- * @throws IndexOutOfBoundsException
- */
- private void findFeature(final Geometry geometry, final MapLayer layer)
- throws IndexOutOfBoundsException {
- org.opengis.filter.spatial.BinarySpatialOperator f = null;
-
- if ((context == null) || (layer == null)) {
- return;
- }
-
- try {
- String name = layer.getFeatureSource().getSchema()
- .getDefaultGeometry().getLocalName();
-
- if (name == "") {
- name = "the_geom";
- }
-
- try {
- f = ff.contains(ff.property(name), ff.literal(geometry));
- if (selectionManager != null) {
-// System.out.println("selection changed");
- selectionManager.selectionChanged(this, f);
-
- }
- } catch (final IllegalFilterException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- /*
- * // f.addLeftGeometry(ff.property(name)); //
- * System.out.println("looking with " + f); FeatureCollection fc =
- * layer.getFeatureSource().getFeatures(f);
- *
- *
- *
- * if (fcol == null) { fcol = fc;
- *
- * // here we should set the defaultgeom type } else {
- * fcol.addAll(fc); }
- */
-
- /*
- * GeometryAttributeType gat =
- * layer.getFeatureSource().getSchema().getDefaultGeometry();
- * fcol.setDefaultGeometry((Geometry)gat.createDefaultValue());
- */
-
- /*
- * Iterator fi = fc.iterator(); while (fi.hasNext()) { SimpleFeature feat
- * = (SimpleFeature) fi.next(); System.out.println("selected " +
- * feat.getAttribute("STATE_NAME")); }
- */
- } catch (final IllegalFilterException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return;
- }
-
public void mouseClicked(final MouseEvent e) {
if (mapArea == null) return;
// System.out.println("before area "+mapArea+"\nw:"+mapArea.getWidth()+"
@@ -782,12 +559,12 @@
zlevel = 1.0 / zoomFactor;
break;
+//
+// case Select:
+// doSelection(mapX, mapY, selectionLayer);
+//
+// return;
- case Select:
- doSelection(mapX, mapY, selectionLayer);
-
- return;
-
default:
return;
}
@@ -884,51 +661,52 @@
lastX = x;
lastY = y;
drawRectangle(graphics);
- } else if (state == JMapPane.Select && selectionLayer != null) {
+ }
+// else if (state == JMapPane.Select && selectionLayer != null) {
+//
+// // construct a new bbox filter
+// final Rectangle bounds = this.getBounds();
+//
+// final double mapWidth = mapArea.getWidth();
+// final double mapHeight = mapArea.getHeight();
+//
+// final double x1 = ((this.startX * mapWidth) / (double) bounds.width)
+// + mapArea.getMinX();
+// final double y1 = (((bounds.getHeight() - this.startY) * mapHeight) / (double) bounds.height)
+// + mapArea.getMinY();
+// final double x2 = ((x * mapWidth) / (double) bounds.width)
+// + mapArea.getMinX();
+// final double y2 = (((bounds.getHeight() - y) * mapHeight) / (double) bounds.height)
+// + mapArea.getMinY();
+// final double left = Math.min(x1, x2);
+// final double right = Math.max(x1, x2);
+// final double bottom = Math.min(y1, y2);
+// final double top = Math.max(y1, y2);
+//
+// String name = selectionLayer.getFeatureSource().getSchema()
+// .getDefaultGeometry().getName();
+//
+// if (name == "") {
+// name = "the_geom";
+// }
+// final Filter bb = ff.bbox(ff.property(name), left, bottom, right, top,
+// getContext().getCoordinateReferenceSystem().toString());
+// if (selectionManager != null) {
+// selectionManager.selectionChanged(this, bb);
+// }
+//
+// graphics.setXORMode(Color.green);
+//
+// /*
+// * if ((lastX > 0) && (lastY > 0)) { drawRectangle(graphics); }
+// */
+//
+// // draw new box
+// lastX = x;
+// lastY = y;
+// drawRectangle(graphics);
+// }
- // construct a new bbox filter
- final Rectangle bounds = this.getBounds();
-
- final double mapWidth = mapArea.getWidth();
- final double mapHeight = mapArea.getHeight();
-
- final double x1 = ((this.startX * mapWidth) / (double) bounds.width)
- + mapArea.getMinX();
- final double y1 = (((bounds.getHeight() - this.startY) * mapHeight) / (double) bounds.height)
- + mapArea.getMinY();
- final double x2 = ((x * mapWidth) / (double) bounds.width)
- + mapArea.getMinX();
- final double y2 = (((bounds.getHeight() - y) * mapHeight) / (double) bounds.height)
- + mapArea.getMinY();
- final double left = Math.min(x1, x2);
- final double right = Math.max(x1, x2);
- final double bottom = Math.min(y1, y2);
- final double top = Math.max(y1, y2);
-
- String name = selectionLayer.getFeatureSource().getSchema()
- .getDefaultGeometry().getName();
-
- if (name == "") {
- name = "the_geom";
- }
- final Filter bb = ff.bbox(ff.property(name), left, bottom, right, top,
- getContext().getCoordinateReferenceSystem().toString());
- if (selectionManager != null) {
- selectionManager.selectionChanged(this, bb);
- }
-
- graphics.setXORMode(Color.green);
-
- /*
- * if ((lastX > 0) && (lastY > 0)) { drawRectangle(graphics); }
- */
-
- // draw new box
- lastX = x;
- lastY = y;
- drawRectangle(graphics);
- }
-
}
// sk.cs
@@ -1052,31 +830,32 @@
setMapArea(bestAllowedMapArea(new Envelope(ll, ur)));
// xulu.ec
- } else if (state == JMapPane.Select && selectionLayer != null) {
- final double left = Math.min(startX, endX);
- final double right = Math.max(startX, endX);
- final double bottom = Math.min(startY, endY);
- final double top = Math.max(startY, endY);
+ }
+// else if (state == JMapPane.Select && selectionLayer != null) {
+// final double left = Math.min(startX, endX);
+// final double right = Math.max(startX, endX);
+// final double bottom = Math.min(startY, endY);
+// final double top = Math.max(startY, endY);
+//
+// String name = selectionLayer.getFeatureSource().getSchema()
+// .getDefaultGeometry().getLocalName();
+//
+// if (name == "") {
+// name = "the_geom";
+// }
+// final Filter bb = ff.bbox(ff.property(name), left, bottom, right, top,
+// getContext().getCoordinateReferenceSystem().toString());
+// // System.out.println(bb.toString());
+// if (selectionManager != null) {
+// selectionManager.selectionChanged(this, bb);
+// }
+// /*
+// * FeatureCollection fc; selection = null; try { fc =
+// * selectionLayer.getFeatureSource().getFeatures(bb); selection =
+// * fc; } catch (IOException e) { e.printStackTrace(); }
+// */
+// }
- String name = selectionLayer.getFeatureSource().getSchema()
- .getDefaultGeometry().getLocalName();
-
- if (name == "") {
- name = "the_geom";
- }
- final Filter bb = ff.bbox(ff.property(name), left, bottom, right, top,
- getContext().getCoordinateReferenceSystem().toString());
- // System.out.println(bb.toString());
- if (selectionManager != null) {
- selectionManager.selectionChanged(this, bb);
- }
- /*
- * FeatureCollection fc; selection = null; try { fc =
- * selectionLayer.getFeatureSource().getFeatures(bb); selection =
- * fc; } catch (IOException e) { e.printStackTrace(); }
- */
- }
-
// xulu.so
// setMapArea(mapArea);
// xulu.eo
@@ -1124,19 +903,7 @@
return s;
}
- public void highlightChanged(final HighlightChangedEvent e) {
- final org.opengis.filter.Filter f = e.getFilter();
- try {
- highlightFeature = highlightLayer.getFeatureSource().getFeatures(f);
- } catch (final IOException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
-
- repaint();
- }
-
public void propertyChange(final PropertyChangeEvent evt) {
final String prop = evt.getPropertyName();
@@ -1219,43 +986,8 @@
public void mouseMoved(final MouseEvent e) {
}
- public FeatureCollection getSelection() {
- return selection;
- }
- public void setSelection(final FeatureCollection selection) {
- this.selection = selection;
- repaint();
- }
- /*
- * (non-Javadoc)
- *
- * @see
- * org.geotools.gui.swing.event.SelectionChangeListener#selectionChanged
- * (org.geotools.gui.swing.event.SelectionChangedEvent)
- */
- public void selectionChanged(final SelectionChangedEvent e) {
-
- try {
- selection = selectionLayer.getFeatureSource().getFeatures(
- e.getFilter());
- repaint();
- } catch (final IOException e1) {
- e1.printStackTrace();
- }
- }
-
- public SelectionManager getSelectionManager() {
- return selectionManager;
- }
-
- public void setSelectionManager(final SelectionManager selectionManager) {
- this.selectionManager = selectionManager;
- this.selectionManager.addSelectionChangeListener(this);
-
- }
-
// xulu.sn
/**
* Korrigiert den {@link Envelope} aka {@code mapArea} auf die beste
Modified: branches/1.0-gt2-2.6/src/org/geotools/renderer/lite/gridcoverage2d/RasterSymbolizerSupport.java
===================================================================
--- branches/1.0-gt2-2.6/src/org/geotools/renderer/lite/gridcoverage2d/RasterSymbolizerSupport.java 2009-08-26 18:09:39 UTC (rev 335)
+++ branches/1.0-gt2-2.6/src/org/geotools/renderer/lite/gridcoverage2d/RasterSymbolizerSupport.java 2009-08-27 09:10:10 UTC (rev 336)
@@ -25,9 +25,11 @@
import org.apache.log4j.Logger;
import org.geotools.coverage.Category;
+import org.geotools.coverage.CoverageFactoryFinder;
import org.geotools.coverage.GridSampleDimension;
import org.geotools.coverage.grid.GridCoverage2D;
import org.geotools.coverage.grid.GridGeometry2D;
+import org.geotools.factory.FactoryFinder;
import org.geotools.styling.ColorMap;
import org.geotools.styling.ColorMapEntry;
import org.geotools.styling.RasterSymbolizer;
@@ -131,7 +133,7 @@
gridCoverage.getSampleDimension(band), colorMaps);
}
- GridCoverage2D createed = FactoryFinder.getGridCoverageFactory(null).create(
+ GridCoverage2D createed = CoverageFactoryFinder.getGridCoverageFactory(null).create(
gridCoverage.getName(), gridCoverage.getRenderedImage(),
(GridGeometry2D) gridCoverage.getGridGeometry(), targetBands,
new GridCoverage[] { gridCoverage }, null);
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/FilterUtil.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/FilterUtil.java 2009-08-26 18:09:39 UTC (rev 335)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/FilterUtil.java 2009-08-27 09:10:10 UTC (rev 336)
@@ -30,9 +30,10 @@
package schmitzm.geotools;
import org.geotools.factory.CommonFactoryFinder;
-import org.geotools.filter.Filter;
import org.geotools.filter.FilterFactoryFinder;
import org.geotools.filter.FilterFactoryImpl;
+import org.geotools.filter.visitor.DuplicatingFilterVisitor;
+import org.opengis.filter.Filter;
import org.opengis.filter.FilterFactory2;
import com.vividsolutions.jts.geom.GeometryFactory;
@@ -58,9 +59,8 @@
* @param filter ein Filter
*/
public static Filter cloneFilter(Filter filter) {
- DuplicatorFilterVisitor dfv = new DuplicatorFilterVisitor(FILTER_FAC,false);
- dfv.visit( filter );
- Filter newFilter = (Filter)dfv.getCopy();
+ DuplicatingFilterVisitor dfv = new DuplicatingFilterVisitor(FILTER_FAC2);
+ Filter newFilter = (Filter) dfv.visit( filter , (Object)null);
return newFilter;
}
}
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureOperationTree.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureOperationTree.java 2009-08-26 18:09:39 UTC (rev 335)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureOperationTree.java 2009-08-27 09:10:10 UTC (rev 336)
@@ -106,7 +106,7 @@
if ( opTreeNode instanceof AttributeNameReferenceNode ) {
String attrName = ((AttributeNameReferenceNode)opTreeNode).getObject();
Object object = feature.getAttribute( attrName );
- if ( feature.getFeatureType().getAttributeDesc( attrName ) == null )
+ if ( feature.getFeatureType().getDescriptor( attrName ) == null )
throw new UnsupportedOperationException( FeatureUtil.RESOURCE.getString("FeatureOperationTree.err.UnknownAttr",attrName) );
if ( object == null )
throw new UnsupportedOperationException( FeatureUtil.RESOURCE.getString("FeatureOperationTree.err.NullAttr",attrName) );
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureTypeTableModel.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureTypeTableModel.java 2009-08-26 18:09:39 UTC (rev 335)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureTypeTableModel.java 2009-08-27 09:10:10 UTC (rev 336)
@@ -82,7 +82,7 @@
attrTypes.clear();
if ( featureType != null )
for (int i=0; i<featureType.getAttributeCount(); i++) {
- AttributeDescriptor type = featureType.getAttributeType(i);
+ AttributeDescriptor type = featureType.getAttributeDescriptors().get(i);
if ( attrFilter == null || attrFilter.accept( type, i ) )
attrTypes.add( type );
}
@@ -143,7 +143,7 @@
AttributeDescriptor aType = attrTypes.elementAt(rowIndex);
switch ( columnIndex ) {
case 0: return aType.getLocalName();
- case 1: return aType.getBinding().getSimpleName();
+ case 1: return aType.getType().getBinding().getSimpleName();
}
return null;
}
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-08-26 18:09:39 UTC (rev 335)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/feature/FeatureUtil.java 2009-08-27 09:10:10 UTC (rev 336)
@@ -231,11 +231,11 @@
}
/**
- * Determines the kind of geometry of a {@link MapLayer}.
+ * Determines the kind of geometry of a {@link MapLayer}.
* @param layer a map layer
*/
public static GeometryForm getGeometryForm(MapLayer layer) {
- return getGeometryForm(layer.getFeatureSource());
+ return getGeometryForm((SimpleFeatureType) layer.getFeatureSource());
}
/**
@@ -269,7 +269,7 @@
FeatureIterator<SimpleFeature> fi = fc.features();
for (;fi.hasNext();) {
SimpleFeature f = fi.next();
- result.add( f.getDefaultGeometry() );
+ result.add( (Geometry) f.getDefaultGeometry() );
}
return result;
}
@@ -280,8 +280,7 @@
* @param fc FeatureCollection
*/
public static Style createDefaultStyle(FeatureCollection<SimpleFeatureType, SimpleFeature> fc) {
- GeometryAttributeType geometryAttrib = fc.getSchema().getDefaultGeometry();
- return createDefaultStyle( geometryAttrib );
+ return createDefaultStyle( fc.getSchema().getGeometryDescriptor() );
}
/**
@@ -289,16 +288,16 @@
* Und setzt eine default Namen.
* @param geometryAttrib GeometryAttributeType
*/
- public static Style createDefaultStyle(GeometryAttributeType geometryAttrib) {
+ public static Style createDefaultStyle(GeometryDescriptor geometryAttrib) {
Style style = null;
if ( geometryAttrib != null &&
- (com.vividsolutions.jts.geom.Polygon.class.isAssignableFrom(geometryAttrib.getType()) ||
- com.vividsolutions.jts.geom.MultiPolygon.class.isAssignableFrom(geometryAttrib.getType())) )
+ (com.vividsolutions.jts.geom.Polygon.class.isAssignableFrom(geometryAttrib.getType().getBinding()) ||
+ com.vividsolutions.jts.geom.MultiPolygon.class.isAssignableFrom(geometryAttrib.getType().getBinding())) )
style = createPolygonStyle(Color.ORANGE, Color.BLACK, 1);
else if (geometryAttrib != null &&
- (com.vividsolutions.jts.geom.Point.class.isAssignableFrom(geometryAttrib.getType()) ||
- com.vividsolutions.jts.geom.MultiPoint.class.isAssignableFrom(geometryAttrib.getType())) )
+ (com.vividsolutions.jts.geom.Point.class.isAssignableFrom(geometryAttrib.getType().getBinding()) ||
+ com.vividsolutions.jts.geom.MultiPoint.class.isAssignableFrom(geometryAttrib.getType().getBinding())) )
style = createPointStyle(Color.RED);
else
style = createLineStyle(Color.BLUE, 1);
@@ -445,7 +444,7 @@
fTypeName = fType.getTypeName();
FeatureTypeBuilder builder = FeatureTypeBuilder.newInstance(fType.getTypeName());
- for (AttributeDescriptor aType : fType.getAttributeTypes() ) {
+ for (AttributeDescriptor aType : fType.getAttributeDescriptors() ) {
AttributeDescriptor aTypeClone = cloneAttributeType(aType, nillable);
if ( aTypeClone instanceof GeometryAttributeType && builder.getDefaultGeometry() == null )
builder.setDefaultGeometry( (GeometryAttributeType)aTypeClone );
@@ -481,9 +480,9 @@
// Create the clone
return AttributeTypeFactory.newAttributeType(
aType.getLocalName(),
- aType.getBinding(),
+ aType.getType().getBinding(),
nillable,
- aType.getRestriction(),
+ aType.getType().getRestrictions(),
defaultValue,
metaData
);
@@ -521,10 +520,10 @@
} catch (IllegalArgumentException err) {
builder.addType( AttributeTypeFactory.newAttributeType(
aType.getLocalName()+"_2",
- aType.getBinding(),
+ aType.getType().getBinding(),
aType.isNillable(),
aType.getRestriction(),
- aType.createDefaultValue(),
+ aType.getDefaultValue(),
null
));
}
@@ -616,7 +615,7 @@
fi.next().getAttributes(fValues);
// Default-Werte der neuen Attribute in Array schreiben
for ( int i=fType.getAttributeCount(); i<fValues.length; i++)
- fValues[i] = resultType.getAttributeType(i).createDefaultValue();
+ fValues[i] = resultType.getAttributeDescriptors().get(i).getDefaultValue();
// Erweitertes SimpleFeature erzeugen und FeatureCollection fuellen
resultFc.add( resultType.create( fValues ) );
}
@@ -671,15 +670,15 @@
throw new UnsupportedOperationException("JOIN can not be performed. FeatureCollection 1 seems to be empty.");
if ( fType2 == null )
throw new UnsupportedOperationException("JOIN can not be performed. FeatureCollection 2 seems to be empty.");
- if ( fType1.getAttributeType(joinAttr1) == null )
+ if ( fType1.getDescriptor(joinAttr1) == null )
throw new UnsupportedOperationException("JOIN can not be performed. FeatureCollection 1 does not contain the JOIN-Attribute: "+joinAttr1);
- if ( fType2.getAttributeType(joinAttr2) == null )
+ if ( fType2.getDescriptor(joinAttr2) == null )
throw new UnsupportedOperationException("JOIN can not be performed. FeatureCollection 2 does not contain the JOIN-Attribute: "+joinAttr2);
// Wenn keine Projektion, dann alle Attribute von fc1 mit denen
// von fc2 vereinen; sonst neuen SimpleFeatureType aufbauen
if ( !projection )
- resultType = extendFeatureType(fType1, fType2.getAttributeTypes());
+ resultType = extendFeatureType(fType1, fType2.getAttributeDescriptors());
else {
// Leeren SimpleFeature-Type erzeugen
FeatureTypeBuilder builder = FeatureTypeBuilder.newInstance(fType1.getTypeName());
@@ -689,10 +688,10 @@
// von "fValues" der Attributwert aus fc1 in der inneren
// FOR-Schleife ggf. durch den Attributwert von fc2
// ueberschrieben wird!)
- AttributeDescriptor aType = fType2.getAttributeType(attrName);
+ AttributeDescriptor aType = fType2.getDescriptor(attrName);
// zweite Wahl: Attribut von fc1 uebernehmen
if ( aType == null )
- aType = fType1.getAttributeType(attrName);
+ aType = fType1.getDescriptor(attrName);
// Attribut in den SimpleFeatureType einfuegen
if ( aType != null )
builder.addType( aType );
@@ -828,7 +827,7 @@
// Wenn keine Attribute angegeben sind, alle verwenden
for (int i=0; i<attrCount; i++) {
- AttributeDescriptor attrType = attrName.length > 0 ? ft.getAttributeType(attrName[i]) : ft.getAttributeType(i);
+ AttributeDescriptor attrType = attrName.length > 0 ? ft.getDescriptor(attrName[i]) : ft.getDescriptor(i);
// wenn attrType = null, dann gibt es das Attribut im SimpleFeatureType nicht
// -> destArray nicht ueberschreiben
if ( attrType != null )
@@ -855,11 +854,11 @@
public static Object getDefaultAttributeValue(AttributeDescriptor attrType, boolean allowNull) {
// AutoValueGenerator avg = getAutoValueGenerator(attrType);
// Object attrValue = (avg == null) ? attrType.createDefaultValue() : avg.getNextValue();
- Object attrValue = attrType.createDefaultValue();
+ Object attrValue = attrType.getDefaultValue();
if ( attrValue == null && ( !attrType.isNillable() || !allowNull ) ) {
- attrValue = getDefaultAttributeValue( attrType.getBinding() );
+ attrValue = getDefaultAttributeValue( attrType.getType().getBinding() );
if ( attrValue == null )
- LOGGER.warn("Could not create default value for not-null attribute '"+attrType.getLocalName()+"': "+attrType.getBinding().getSimpleName());
+ LOGGER.warn("Could not create default value for not-null attribute '"+attrType.getLocalName()+"': "+attrType.getType().getBinding().getSimpleName());
}
return attrValue;
}
@@ -945,7 +944,7 @@
destMap.put( attrName[i], f.getAttribute(attrName[i]) );
else
for (int i=0; i<f.getAttributeCount(); i++)
- destMap.put( f.getFeatureType().getAttributeType(i).getName(), f.getAttribute(i) );
+ destMap.put( f.getFeatureType().getName().getLocalPart(), f.getAttribute(i) );
return destMap;
}
@@ -1010,9 +1009,9 @@
public static FeatureCollection<SimpleFeatureType, SimpleFeature> joinFeatureCollection(JoinType joinType, FeatureCollection<SimpleFeatureType, SimpleFeature> fc, String fcJoinAttr, AttributeFilter compareOp, ResultSet rs, String rsJoinAttr, String... projAttr) throws SchemaException, IllegalAttributeException, SQLException {
if ( fcJoinAttr == null || fcJoinAttr.trim().equals("") ) {
// Erste Nicht-Geometrie-Spalte suchen
- for (AttributeDescriptor aType : fc.getSchema().getAttributeTypes()) {
- if ( aType != fc.getSchema().getDefaultGeometry() ) {
- fcJoinAttr = aType.getName();
+ for (AttributeDescriptor aType : fc.getSchema().getAttributeDescriptors()) {
+ if ( aType != fc.getSchema().getGeometryDescriptor() ) {
+ fcJoinAttr = aType.getName().getLocalPart();
break;
}
}
@@ -1064,7 +1063,7 @@
FeatureCollection<SimpleFeatureType, SimpleFeature> rsFeatureCollection = DefaultFeatureCollections.newCollection();
for ( ;rs.next(); ) {
for (int i=0; i<rsFeatureType.getAttributeCount(); i++)
- rsFeatureValues[i] = rs.getObject( rsFeatureType.getAttributeType(i).getName() );
+ rsFeatureValues[i] = rs.getObject( rsFeatureType.getDescriptor(i).getName().getLocalPart() );
rsFeatureCollection.add( rsFeatureType.create(rsFeatureValues) );
}
@@ -1245,7 +1244,7 @@
*
* @author SK
*
- * @throws IllegalAttributeException
+ * @throws org.opengis.feature.IllegalAttributeException
*
*/
public static SimpleFeature createSampleFeature(SimpleFeatureType schema) {
@@ -1255,7 +1254,7 @@
try {
sampleFeature = schema.create(attributes);
- } catch (IllegalAttributeException e) {
+ } catch (org.opengis.feature.IllegalAttributeException e) {
// Thrown if the SimpleFeatureType does not validate the attributes
// Not very likely if we just create a sample feature, so we make it
// a runtime exception.
@@ -1268,7 +1267,6 @@
/**
* Erstellt eine {@link FeatureSource} basierend auf einem {@link MemoryDataStore} für eine übergebene {@link FeatureCollection}
* @param features
- * @return
*/
public static FeatureSource<SimpleFeatureType, SimpleFeature> createMemoryFeatureSource(
FeatureCollection<SimpleFeatureType, SimpleFeature> features) {
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureCollectionTableModel.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureCollectionTableModel.java 2009-08-26 18:09:39 UTC (rev 335)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureCollectionTableModel.java 2009-08-27 09:10:10 UTC (rev 336)
@@ -130,7 +130,7 @@
// Pruefen, welche Attribute angezeigt werden
attrTypes.clear();
for (int i=0; i<ft.getAttributeCount(); i++) {
- AttributeDescriptor type = ft.getAttributeType(i);
+ AttributeDescriptor type = ft.getAttributeDescriptors().get(i);
if ( attrFilter == null || attrFilter.accept( type, i ) )
attrTypes.add( type );
}
@@ -139,10 +139,15 @@
colClass = new Class[ attrTypes.size() ];
attrIdxForCol = new int[ attrTypes.size() ];
for (int i=0; i<colNames.length; i++) {
- int idx = ft.find( attrTypes.elementAt(i) );
+ AttributeDescriptor descriptor = ft.getDescriptor( attrTypes.elementAt(i).getName() );
+
+
+ // Not so nice in 26: find the index of an attribute...
+ int idx = ft.getAttributeDescriptors().indexOf(descriptor);
attrIdxForCol[i] = idx;
- colNames[i] = ft.getAttributeType(idx).getLocalName();
- colClass[i] = ft.getAttributeType(idx).getBinding();
+
+ colNames[i] = ft.getAttributeDescriptors().get(idx).getLocalName();
+ colClass[i] = ft.getAttributeDescriptors().get(idx).getType().getBinding();
}
}
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-08-26 18:09:39 UTC (rev 335)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureLayerFilterDialog.java 2009-08-27 09:10:10 UTC (rev 336)
@@ -46,6 +46,8 @@
import org.geotools.filter.Filter;
import org.geotools.map.MapLayer;
import org.geotools.map.event.MapLayerEvent;
+import org.opengis.feature.simple.SimpleFeature;
+import org.opengis.feature.simple.SimpleFeatureType;
import schmitzm.geotools.map.event.FeatureSelectedEvent;
import schmitzm.geotools.map.event.MapLayerAdapter;
@@ -140,7 +142,7 @@
* Initalisiert die GUI.
*/
protected void initGUI() throws IOException {
- filterPanel = new FeatureCollectionFilterPanel( layer.getFeatureSource().getFeatures(), true ) {
+ filterPanel = new FeatureCollectionFilterPanel( (FeatureCollection<SimpleFeatureType, SimpleFeature>) layer.getFeatureSource().getFeatures(), true ) {
@Override
protected void resetComponentsAfterTest(Throwable err) {
super.resetComponentsAfterTest(err);
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureTablePane.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureTablePane.java 2009-08-26 18:09:39 UTC (rev 335)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureTablePane.java 2009-08-27 09:10:10 UTC (rev 336)
@@ -243,7 +243,6 @@
mapPane.setState(JMapPane.RESET);
mapPane.setWindowSelectionState(JMapPane.NONE);
- mapPane.setHighlight(false);
mapPane.setMinimumSize(new Dimension(100, 100));
SwingUtil.setPreferredWidth(mapPane, 200);
mapPane.setBorder(BorderFactory.createLoweredBevelBorder());
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-08-26 18:09:39 UTC (rev 335)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JEditorPane.java 2009-08-27 09:10:10 UTC (rev 336)
@@ -776,7 +776,7 @@
// replace default attribute values with auto generate
// values (for all registered attributes)
for (int i=0; i<attr.length; i++) {
- AttributeDescriptor aType = editorFeatureType.getAttributeType(i);
+ AttributeDescriptor aType = editorFeatureType.getDescriptor(i);
if ( FeatureUtil.getAutoValueGenerator(aType) != null )
attr[i] = FeatureUtil.getNextAutoValue(aType);
}
@@ -787,7 +787,7 @@
createGeometryFromPoints(getGeometryType(editorMode), coord )
);
- if ( feature.getNumberOfAttributes() > 1 ) {
+ if ( feature.getAttributeCount() > 1 ) {
attrInputOption.setValue(feature);
Object[] value = MultipleOptionPane.showMultipleInputDialog(
this,
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JEditorToolBar.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JEditorToolBar.java 2009-08-26 18:09:39 UTC (rev 335)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JEditorToolBar.java 2009-08-27 09:10:10 UTC (rev 336)
@@ -309,7 +309,7 @@
public boolean performIsInputValid() {
if ( super.performIsInputValid() ) {
SimpleFeatureType ft = inpTableModel.createFeatureType();
- if ( ft.getAttributeType( JEditorPane.GEOMETRY_ATTR ) != null )
+ if ( ft.getDescriptor( JEditorPane.GEOMETRY_ATTR ) != null )
throw new UnsupportedOperationException(getResourceString("NewLayer.Err.GeomAttr",JEditorPane.GEOMETRY_ATTR));
}
return true;
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-08-26 18:09:39 UTC (rev 335)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JMapPane.java 2009-08-27 09:10:10 UTC (rev 336)
@@ -552,19 +552,19 @@
};
};
this.addMouseListener(dragWaitCursorListener);
+//
+// // Hightlight immer auf dem obersten sichtbaren Nicht-Raster-Layer
+// // MS-01.sc: Der GT-Highlight-Manager arbeitet zu langsam und ohnehin
+// // nur fuer unprojizierte Layer korrekt
+// // this.setHighlight(true);
+// this.setHighlight(false);
+// // MS-01.ec
- // Hightlight immer auf dem obersten sichtbaren Nicht-Raster-Layer
- // MS-01.sc: Der GT-Highlight-Manager arbeitet zu langsam und ohnehin
- // nur fuer unprojizierte Layer korrekt
- // this.setHighlight(true);
- this.setHighlight(false);
- // MS-01.ec
-
getContext().addMapLayerListListener(
new schmitzm.geotools.map.event.MapLayerListAdapter() {
private void resetHighlightLayer() {
- if (isHighlight())
- setHighlightLayer(getTopVisibleNonGridCoverageLayer());
+// if (isHighlight())
+// setHighlightLayer(getTopVisibleNonGridCoverageLayer());
}
public void layerAdded(org.geotools.map.event.MapLayerListEvent e) {
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/MapActionControlPane.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/MapActionControlPane.java 2009-08-26 18:09:39 UTC (rev 335)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/MapActionControlPane.java 2009-08-27 09:10:10 UTC (rev 336)
@@ -298,7 +298,6 @@
public void actionPerformed(ActionEvent e) {
getMapPane().setWindowSelectionState( JMapPane.NONE );
getMapPane().setState(JMapPane.NONE);
- getMapPane().setHighlight(true);
}
}
@@ -333,7 +332,6 @@
public void actionPerformed(ActionEvent e) {
getMapPane().setWindowSelectionState( JMapPane.ZOOM_IN );
getMapPane().setState(JMapPane.ZOOM_IN);
- getMapPane().setHighlight(false);
}
}
@@ -369,7 +367,6 @@
public void actionPerformed(ActionEvent e) {
getMapPane().setWindowSelectionState( JMapPane.SELECT_TOP );
getMapPane().setState(JMapPane.SELECT_TOP);
- getMapPane().setHighlight(true);
}
}
@@ -404,7 +401,6 @@
public void actionPerformed(ActionEvent e) {
getMapPane().setWindowSelectionState( JMapPane.SELECT_ALL );
getMapPane().setState(JMapPane.SELECT_ALL);
- getMapPane().setHighlight(true);
}
}
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/MapContextControlPane.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/MapContextControlPane.java 2009-08-26 18:09:39 UTC (rev 335)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/MapContextControlPane.java 2009-08-27 09:10:10 UTC (rev 336)
@@ -69,569 +69,789 @@
import schmitzm.swing.event.WindowEventConnector;
import schmitzm.swing.menu.ConnectedPopupMenu;
-
/**
* Diese Komponente ist an ein {@link JMapPane} gekoppelt und stellt die
* dargestellten Layer in Form eine Liste dar.
+ *
* @author Martin Schmitz
* @version 1.0
*/
public class MapContextControlPane extends JPanel {
- protected final Logger LOGGER = LangUtil.createLogger(this);
+ protected final Logger LOGGER = LangUtil.createLogger(this);
- /** Key, um den Menue-Eintrag "Move layer up" in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String MENU_MOVE_LAYER_UP = MapContextControlPane.class.getName()+".Menu.MOVE_UP";
- /** Key, um den Menue-Eintrag "Move layer down" in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String MENU_MOVE_LAYER_DOWN = MapContextControlPane.class.getName()+".Menu.MOVE_DOWN";
- /** Key, um den Menue-Eintrag "Zoom to layer" in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String MENU_ZOOM_TO_LAYER = MapContextControlPane.class.getName()+".Menu.ZOOM_TO";
- /** Key, um den Menue-Eintrag "SimpleFeature-Filter..." in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String MENU_FILTER_LAYER = MapContextControlPane.class.getName()+".Menu.FILTER";
- /** Key, um den Menue-Eintrag "Recolor..." in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String MENU_RECOLOR_LAYER = MapContextControlPane.class.getName()+".Menu.RECOLOR";
- /** Key, um den Menue-Eintrag "Remove layer" in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String MENU_REMOVE_LAYER = MapContextControlPane.class.getName()+".Menu.REMOVE";
- /** Key, um den Menue-Eintrag "Show all layers" in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String MENU_SHOW_ALL_LAYERS = MapContextControlPane.class.getName()+".Menu.SHOWALL";
- /** Key, um den Menue-Eintrag "Hide all layers" in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String MENU_HIDE_ALL_LAYERS = MapContextControlPane.class.getName()+".Menu.HIDEALL";
- /** Key, um den Menue-Eintrag "Invert all layers" in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String MENU_INVERT_ALL_LAYERS = MapContextControlPane.class.getName()+".Menu.INVERTALL";
- /** Key, um den Unter-Menue-Eintrag "Customize color map" in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String MENU_CUSTOMIZE_COLOR = MapContextControlPane.class.getName()+".Menu.CUSTOMIZE";
- /** Key, um den Titel des Farbpaletten-Dialogs in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String CM_DIALOG_TITLE = MapContextControlPane.class.getName()+".ColorMapDialog.TITLE";
- /** Key, um den 1. Tabellenkopf-Eintrag "Quantity" des Farbpaletten-Dialogs in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String CM_DIALOG_TABLEHEADER_QUANTITY = ColorMapTable.TABLEHEADER_QUANTITY;
- /** Key, um den 2. Tabellenkopf-Eintrag "Color" des Farbpaletten-Dialogs in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String CM_DIALOG_TABLEHEADER_COLOR = ColorMapTable.TABLEHEADER_COLOR;
- /** Key, um den 3. Tabellenkopf-Eintrag "Label" des Farbpaletten-Dialogs in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String CM_DIALOG_TABLEHEADER_LABEL = ColorMapTable.TABLEHEADER_LABEL;
- /** Key, um den OK-Button des Farbpaletten-Dialogs in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String CM_DIALOG_OK = MapContextControlPane.class.getName()+".ColorMapDialog.OK";
- /** Key, um den ABBRECHEN-Button des Farbpaletten-Dialogs in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String CM_DIALOG_CANCEL = MapContextControlPane.class.getName()+".ColorMapDialog.CANCEL";
- /** Key, um den SPEICHERN-Button des Farbpaletten-Dialogs in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String CM_DIALOG_SAVE = MapContextControlPane.class.getName()+".ColorMapDialog.SAVE";
- /** Key, um den ÜBERNEHMEN-Button des Farbpaletten-Dialogs in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String CM_DIALOG_APPLY = MapContextControlPane.class.getName()+".ColorMapDialog.APPLY";
- /** Key, um den Titel des Farbpaletten-Speichern-Dialogs in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String CM_SAVE_DIALOG_TITLE = MapContextControlPane.class.getName()+".SaveColorMapDialog.TITLE";
- /** Key, um den Text des Farbpaletten-Speichern-Dialogs in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String CM_SAVE_DIALOG_QUESTION = MapContextControlPane.class.getName()+".SaveColorMapDialog.QUESTION";
- /** Key, um den Titel des FeatureCollection-Filter-Dialogs in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String FF_DIALOG_TITLE = FeatureLayerFilterDialog.DIALOG_TITLE;
- /** Key, um das Attribute-Label des FeatureCollection-Filter-Dialogs in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String FF_DIALOG_ATTRIBUTE = FeatureCollectionFilterPanel.ATTRIBUTE_LABEL;
- /** Key, um das Formel-Label des FeatureCollection-Filter-Dialogs in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String FF_DIALOG_RULE = FeatureCollectionFilterPanel.RULE_LABEL;
- /** Key, um den Formel-Feld-Tooltip des FeatureCollection-Filter-Dialogs in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String FF_DIALOG_RULE_TOOLTIP = FeatureCollectionFilterPanel.RULE_TOOLTIP;
- /** Key, um das Operatoren-Label des FeatureCollection-Filter-Dialogs in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String FF_DIALOG_OPERATORS = FeatureCollectionFilterPanel.OPERATOR_LABEL;
- /** Key, um den Testen-Button des FeatureCollection-Filter-Dialogs in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String FF_DIALOG_TEST = FeatureCollectionFilterPanel.TEST_BUTTON;
- /** Key, um den OK-Button des FeatureCollection-Filter-Dialogs in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String FF_DIALOG_OK = FeatureLayerFilterDialog.OK_BUTTON;
- /** Key, um den ABBRECHEN-Button des FeatureCollection-Filter-Dialogs in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String FF_DIALOG_CANCEL = FeatureLayerFilterDialog.CANCEL_BUTTON;
- /** Key, um den ÜBERNEHMEN-Button des FeatureCollection-Filter-Dialogs in der {@link CaptionsChangeable}-Map anzusprechen. */
- public static final String FF_DIALOG_APPLY = FeatureLayerFilterDialog.APPLY_BUTTON;
+ /**
+ * Key, um den Menue-Eintrag "Move layer up" in der
+ * {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String MENU_MOVE_LAYER_UP = MapContextControlPane.class
+ .getName()
+ + ".Menu.MOVE_UP";
+ /**
+ * Key, um den Menue-Eintrag "Move layer down" in der
+ * {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String MENU_MOVE_LAYER_DOWN = MapContextControlPane.class
+ .getName()
+ + ".Menu.MOVE_DOWN";
+ /**
+ * Key, um den Menue-Eintrag "Zoom to layer" in der
+ * {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String MENU_ZOOM_TO_LAYER = MapContextControlPane.class
+ .getName()
+ + ".Menu.ZOOM_TO";
+ /**
+ * Key, um den Menue-Eintrag "SimpleFeature-Filter..." in der
+ * {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String MENU_FILTER_LAYER = MapContextControlPane.class
+ .getName()
+ + ".Menu.FILTER";
+ /**
+ * Key, um den Menue-Eintrag "Recolor..." in der {@link CaptionsChangeable}
+ * -Map anzusprechen.
+ */
+ public static final String MENU_RECOLOR_LAYER = MapContextControlPane.class
+ .getName()
+ + ".Menu.RECOLOR";
+ /**
+ * Key, um den Menue-Eintrag "Remove layer" in der
+ * {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String MENU_REMOVE_LAYER = MapContextControlPane.class
+ .getName()
+ + ".Menu.REMOVE";
+ /**
+ * Key, um den Menue-Eintrag "Show all layers" in der
+ * {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String MENU_SHOW_ALL_LAYERS = MapContextControlPane.class
+ .getName()
+ + ".Menu.SHOWALL";
+ /**
+ * Key, um den Menue-Eintrag "Hide all layers" in der
+ * {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String MENU_HIDE_ALL_LAYERS = MapContextControlPane.class
+ .getName()
+ + ".Menu.HIDEALL";
+ /**
+ * Key, um den Menue-Eintrag "Invert all layers" in der
+ * {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String MENU_INVERT_ALL_LAYERS = MapContextControlPane.class
+ .getName()
+ + ".Menu.INVERTALL";
+ /**
+ * Key, um den Unter-Menue-Eintrag "Customize color map" in der
+ * {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String MENU_CUSTOMIZE_COLOR = MapContextControlPane.class
+ .getName()
+ + ".Menu.CUSTOMIZE";
+ /**
+ * Key, um den Titel des Farbpaletten-Dialogs in der
+ * {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String CM_DIALOG_TITLE = MapContextControlPane.class
+ .getName()
+ + ".ColorMapDialog.TITLE";
+ /**
+ * Key, um den 1. Tabellenkopf-Eintrag "Quantity" des Farbpaletten-Dialogs
+ * in der {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String CM_DIALOG_TABLEHEADER_QUANTITY = ColorMapTable.TABLEHEADER_QUANTITY;
+ /**
+ * Key, um den 2. Tabellenkopf-Eintrag "Color" des Farbpaletten-Dialogs in
+ * der {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String CM_DIALOG_TABLEHEADER_COLOR = ColorMapTable.TABLEHEADER_COLOR;
+ /**
+ * Key, um den 3. Tabellenkopf-Eintrag "Label" des Farbpaletten-Dialogs in
+ * der {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String CM_DIALOG_TABLEHEADER_LABEL = ColorMapTable.TABLEHEADER_LABEL;
+ /**
+ * Key, um den OK-Button des Farbpaletten-Dialogs in der
+ * {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String CM_DIALOG_OK = MapContextControlPane.class
+ .getName()
+ + ".ColorMapDialog.OK";
+ /**
+ * Key, um den ABBRECHEN-Button des Farbpaletten-Dialogs in der
+ * {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String CM_DIALOG_CANCEL = MapContextControlPane.class
+ .getName()
+ + ".ColorMapDialog.CANCEL";
+ /**
+ * Key, um den SPEICHERN-Button des Farbpaletten-Dialogs in der
+ * {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String CM_DIALOG_SAVE = MapContextControlPane.class
+ .getName()
+ + ".ColorMapDialog.SAVE";
+ /**
+ * Key, um den ÜBERNEHMEN-Button des Farbpaletten-Dialogs in der
+ * {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String CM_DIALOG_APPLY = MapContextControlPane.class
+ .getName()
+ + ".ColorMapDialog.APPLY";
+ /**
+ * Key, um den Titel des Farbpaletten-Speichern-Dialogs in der
+ * {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String CM_SAVE_DIALOG_TITLE = MapContextControlPane.class
+ .getName()
+ + ".SaveColorMapDialog.TITLE";
+ /**
+ * Key, um den Text des Farbpaletten-Speichern-Dialogs in der
+ * {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String CM_SAVE_DIALOG_QUESTION = MapContextControlPane.class
+ .getName()
+ + ".SaveColorMapDialog.QUESTION";
+ /**
+ * Key, um den Titel des FeatureCollection-Filter-Dialogs in der
+ * {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String FF_DIALOG_TITLE = FeatureLayerFilterDialog.DIALOG_TITLE;
+ /**
+ * Key, um das Attribute-Label des FeatureCollection-Filter-Dialogs in der
+ * {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String FF_DIALOG_ATTRIBUTE = FeatureCollectionFilterPanel.ATTRIBUTE_LABEL;
+ /**
+ * Key, um das Formel-Label des FeatureCollection-Filter-Dialogs in der
+ * {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String FF_DIALOG_RULE = FeatureCollectionFilterPanel.RULE_LABEL;
+ /**
+ * Key, um den Formel-Feld-Tooltip des FeatureCollection-Filter-Dialogs in
+ * der {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String FF_DIALOG_RULE_TOOLTIP = FeatureCollectionFilterPanel.RULE_TOOLTIP;
+ /**
+ * Key, um das Operatoren-Label des FeatureCollection-Filter-Dialogs in der
+ * {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String FF_DIALOG_OPERATORS = FeatureCollectionFilterPanel.OPERATOR_LABEL;
+ /**
+ * Key, um den Testen-Button des FeatureCollection-Filter-Dialogs in der
+ * {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String FF_DIALOG_TEST = FeatureCollectionFilterPanel.TEST_BUTTON;
+ /**
+ * Key, um den OK-Button des FeatureCollection-Filter-Dialogs in der
+ * {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String FF_DIALOG_OK = FeatureLayerFilterDialog.OK_BUTTON;
+ /**
+ * Key, um den ABBRECHEN-Button des FeatureCollection-Filter-Dialogs in der
+ * {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String FF_DIALOG_CANCEL = FeatureLayerFilterDialog.CANCEL_BUTTON;
+ /**
+ * Key, um den ÜBERNEHMEN-Button des FeatureCollection-Filter-Dialogs in der
+ * {@link CaptionsChangeable}-Map anzusprechen.
+ */
+ public static final String FF_DIALOG_APPLY = FeatureLayerFilterDialog.APPLY_BUTTON;
- /** Karte, deren Layer kontrolliert werden. */
- protected JMapPane mapPane = null;
- /** Farbpaletten, die durch die Kontrolle zugewiesen werden koennen. */
- private ColorMapManager colorMaps = null;
+ /** Karte, deren Layer kontrolliert werden. */
+ protected JMapPane mapPane = null;
+ /** Farbpaletten, die durch die Kontrolle zugewiesen werden koennen. */
+ private ColorMapManager colorMaps = null;
- /**
- * Erzeugt eine neue Layer-Kontrolle.
- * @param mapPane Karten-Komponente, deren Layer kontrolliert wird
- * @param colorMaps Raster-Farbpaletten, die durch die Kontrolle zugewiesen
- * werden koennen
- */
- public MapContextControlPane(JMapPane mapPane, ColorMapManager colorMaps) {
- super();
-// this.parentFrame = SwingUtil.getParentWindow(this);
- this.mapPane = mapPane;
- this.colorMaps = colorMaps;
+ /**
+ * Erzeugt eine neue Layer-Kontrolle.
+ *
+ * @param mapPane
+ * Karten-Komponente, deren Layer kontrolliert wird
+ * @param colorMaps
+ * Raster-Farbpaletten, die durch die Kontrolle zugewiesen werden
+ * koennen
+ */
+ public MapContextControlPane(JMapPane mapPane, ColorMapManager colorMaps) {
+ super();
+ // this.parentFrame = SwingUtil.getParentWindow(this);
+ this.mapPane = mapPane;
+ this.colorMaps = colorMaps;
- setLayout( new BoxLayout(this,BoxLayout.Y_AXIS) );
- // Auf den MapContext lauschen und Steuerungskomponenten hinzufuegen,
- // loeschen, verschieben
- mapPane.getContext().addMapLayerListListener( new MapLayerListListener() {
- public void layerAdded(MapLayerListEvent e) {
- addLayerControl( getComponentCount()-e.getToIndex(), e.getLayer() );
- }
- public void layerChanged(MapLayerListEvent e) {
- // Bezeichnung der Checkbox aendern
- ((JCheckBox)getComponent( convertIndex(e.getFromIndex()) )).setText( e.getLayer().getTitle() );
- }
- public void layerMoved(MapLayerListEvent e) {
- int from = convertIndex(e.getFromIndex());
- int to = convertIndex(e.getToIndex());
- moveLayerControl( from, to );
- }
- public void layerRemoved(MapLayerListEvent e) {
- int from = convertIndex(e.getFromIndex());
- removeLayerControl( from );
- }
- });
- }
+ setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
+ // Auf den MapContext lauschen und Steuerungskomponenten hinzufuegen,
+ // loeschen, verschieben
+ mapPane.getContext().addMapLayerListListener(
+ new MapLayerListListener() {
+ public void layerAdded(MapLayerListEvent e) {
+ addLayerControl(getComponentCount() - e.getToIndex(), e
+ .getLayer());
+ }
- /**
- * Liefert die Farbpaletten, die durch die Kontroll-Komponente zugewiesen
- * werden koennen.
- */
- public ColorMapManager getColorMapManager() {
- return this.colorMaps;
- }
+ public void layerChanged(MapLayerListEvent e) {
+ // Bezeichnung der Checkbox aendern
+ ((JCheckBox) getComponent(convertIndex(e.getFromIndex())))
+ .setText(e.getLayer().getTitle());
+ }
- /**
- * Konvertiert einen Listen-Index des MapContext zu einem Index der
- * MapContextControlList (oder layerObjects-Liste).
- * Dies ist notwendig, da im MapContext der Index 0 fuer das unterste
- * Layer steht, in der MapContextControlList (und layerObjects-Liste)
- * jedoch fuer das oberste Layer!
- */
- private int convertIndex(int mapContextIdx) {
- return getComponentCount()-1-mapContextIdx;
- }
+ public void layerMoved(MapLayerListEvent e) {
+ int from = convertIndex(e.getFromIndex());
+ int to = convertIndex(e.getToIndex());
+ moveLayerControl(from, to);
+ }
- /**
- * Fuegt eine neue Checkbox in die Liste der Kontroll-Komponenten ein
- * @param idx Stelle an der die Komponente eingefuegt wird (0 ist das oberste Layer)
- * @param layer das neue Layer
- */
- private void addLayerControl(int idx, final MapLayer layer) {
- MapLayerControl control = new MapLayerControl(layer);
- add( control, idx );
- validate();
- }
+ public void layerRemoved(MapLayerListEvent e) {
+ int from = convertIndex(e.getFromIndex());
+ removeLayerControl(from);
+ }
+ });
+ }
- /**
- * Bewegt eine Kontroll-Komponente
- * @param from Index der zu verschiebenden Komponente (0 ist die oberste)
- * @param to Index der Ziel-Position
- */
- private void moveLayerControl(int from, int to) {
- JCheckBox cb = (JCheckBox)getComponent( from );
- remove(cb);
- add( cb, to );
- validate();
- }
+ /**
+ * Liefert die Farbpaletten, die durch die Kontroll-Komponente zugewiesen
+ * werden koennen.
+ */
+ public ColorMapManager getColorMapManager() {
+ return this.colorMaps;
+ }
- /**
- * Entfernt eine Kontroll-Komponente
- * @param idx Index der zu loeschenden Komponente (0 ist die oberste)
- */
- private void removeLayerControl(int idx) {
- remove(idx);
- validate();
- repaint();
- }
+ /**
+ * Konvertiert einen Listen-Index des MapContext zu einem Index der
+ * MapContextControlList (oder layerObjects-Liste). Dies ist notwendig, da
+ * im MapContext der Index 0 fuer das unterste Layer steht, in der
+ * MapContextControlList (und layerObjects-Liste) jedoch fuer das oberste
+ * Layer!
+ */
+ private int convertIndex(int mapContextIdx) {
+ return getComponentCount() - 1 - mapContextIdx;
+ }
- //////////////////////////////////////////////////////////////////////////
- // Kontext-Menue fuer Layer-Aktionen
- //////////////////////////////////////////////////////////////////////////
- private class MapLayerControl extends JCheckBox implements CaptionsChangeable, ActionListener {
- private MapLayer layer = null;
- // Flag, ob bereits ein WindowListener im uebergeordneten Fenster
- // eingetragen wurde (geschieht beim ersten Anzeigen)
- private boolean windowListenerAdded = false;
- // Menu-Items
- private JMenuItem moveLayerUp = null;
- private JMenuItem moveLayerDown = null;
- private JMenuItem zoomToLayer = null;
- private JMenuItem filterLayer = null;
- private ColorMapMenu recolorLayer = null;
- private JMenuItem removeLayer = null;
- private JMenuItem showAllLayers = null;
- private JMenuItem hideAllLayers = null;
- private JMenuItem invertAllLayers = null;
- private FeatureLayerFilterDialog filterDialog = null;
+ /**
+ * Fuegt eine neue Checkbox in die Liste der Kontroll-Komponenten ein
+ *
+ * @param idx
+ * Stelle an der die Komponente eingefuegt wird (0 ist das
+ * oberste Layer)
+ * @param layer
+ * das neue Layer
+ */
+ private void addLayerControl(int idx, final MapLayer layer) {
+ MapLayerControl control = new MapLayerControl(layer);
+ add(control, idx);
+ validate();
+ }
- public MapLayerControl(final MapLayer layer) {
- super( layer.getTitle(), layer.isVisible() );
- this.layer = layer;
- this.addActionListener( this ); // (un)check Checkbox
+ /**
+ * Bewegt eine Kontroll-Komponente
+ *
+ * @param from
+ * Index der zu verschiebenden Komponente (0 ist die oberste)
+ * @param to
+ * Index der Ziel-Position
+ */
+ private void moveLayerControl(int from, int to) {
+ JCheckBox cb = (JCheckBox) getComponent(from);
+ remove(cb);
+ add(cb, to);
+ validate();
+ }
- // Popup-Menue erzeugen, die die Funktionen des Layers steuert
- final ConnectedPopupMenu menu = new ConnectedPopupMenu();
- moveLayerUp = new JMenuItem(GeotoolsGUIUtil.RESOURCE.getString(MENU_MOVE_LAYER_UP));
- moveLayerDown = new JMenuItem(GeotoolsGUIUtil.RESOURCE.getString(MENU_MOVE_LAYER_DOWN));
- zoomToLayer = new JMenuItem(GeotoolsGUIUtil.RESOURCE.getString(MENU_ZOOM_TO_LAYER));
- filterLayer = new JMenuItem(GeotoolsGUIUtil.RESOURCE.getString(MENU_FILTER_LAYER));
- recolorLayer = new ColorMapMenu(GeotoolsGUIUtil.RESOURCE.getString(MENU_RECOLOR_LAYER),layer);
- removeLayer = new JMenuItem(GeotoolsGUIUtil.RESOURCE.getString(MENU_REMOVE_LAYER));
- showAllLayers = new JMenuItem(GeotoolsGUIUtil.RESOURCE.getString(MENU_SHOW_ALL_LAYERS));
- hideAllLayers = new JMenuItem(GeotoolsGUIUtil.RESOURCE.getString(MENU_HIDE_ALL_LAYERS));
- invertAllLayers = new JMenuItem(GeotoolsGUIUtil.RESOURCE.getString(MENU_INVERT_ALL_LAYERS));
- moveLayerDown.addActionListener(this);
- moveLayerUp.addActionListener(this);
- zoomToLayer.addActionListener(this);
- removeLayer.addActionListener(this);
- showAllLayers.addActionListener(this);
- hideAllLayers.addActionListener(this);
- invertAllLayers.addActionListener(this);
- filterLayer.addActionListener(this);
- filterLayer.setEnabled( !JMapPane.isGridCoverageLayer(layer) );
- if ( filterLayer.isEnabled() )
- try {
- filterDialog = new FeatureLayerFilterDialog(null,mapPane,layer);
- filterDialog.setModal( false );
- } catch (Exception err) {
- LangUtil.logDebugError(LOGGER,"Layer "+layer.getTitle()+": FeatureFilterFrame could not be created!",err);
- filterLayer.setEnabled(false);
- }
- menu.add( moveLayerUp );
- menu.add( moveLayerDown );
- menu.add( zoomToLayer );
- menu.add( filterLayer );
- menu.add( recolorLayer );
- menu.addSeparator();
- menu.add( removeLayer );
- menu.addSeparator();
- menu.add( showAllLayers );
- menu.add( hideAllLayers );
- menu.add( invertAllLayers );
+ /**
+ * Entfernt eine Kontroll-Komponente
+ *
+ * @param idx
+ * Index der zu loeschenden Komponente (0 ist die oberste)
+ */
+ private void removeLayerControl(int idx) {
+ remove(idx);
+ validate();
+ repaint();
+ }
- menu.connectTo(this);
+ // ////////////////////////////////////////////////////////////////////////
+ // Kontext-Menue fuer Layer-Aktionen
+ // ////////////////////////////////////////////////////////////////////////
+ private class MapLayerControl extends JCheckBox implements
+ CaptionsChangeable, ActionListener {
+ private MapLayer layer = null;
+ // Flag, ob bereits ein WindowListener im uebergeordneten Fenster
+ // eingetragen wurde (geschieht beim ersten Anzeigen)
+ private boolean windowListenerAdded = false;
+ // Menu-Items
+ private JMenuItem moveLayerUp = null;
+ private JMenuItem moveLayerDown = null;
+ private JMenuItem zoomToLayer = null;
+ private JMenuItem filterLayer = null;
+ private ColorMapMenu recolorLayer = null;
+ private JMenuItem removeLayer = null;
+ private JMenuItem showAllLayers = null;
+ private JMenuItem hideAllLayers = null;
+ private JMenuItem invertAllLayers = null;
+ private FeatureLayerFilterDialog filterDialog = null;
- layer.addMapLayerListener( new MapLayerListener() {
- public void layerChanged(MapLayerEvent e) {
- }
- public void layerHidden(MapLayerEvent e) {
- setSelected( false );
- }
- public void layerShown(MapLayerEvent e) {
- setSelected( true );
- }
- } );
- }
+ public MapLayerControl(final MapLayer layer) {
+ super(layer.getTitle(), layer.isVisible());
+ this.layer = layer;
+ this.addActionListener(this); // (un)check Checkbox
- /**
- * Ruft die {@code super}-Methode auf. Zudem wird (beim ersten Anzeigen)
- * ein {@link WindowEventConnector} in das uebergeordnete Fenster eingetragen,
- * der dessen Aktionen mit denen des SimpleFeature-Filter-Fensters verbindet.
- * @param g Graphics
- */
- public void paint(Graphics g) {
- super.paint(g);
- // Wenn das Fenster geschlossen/minimiert wird, soll auch das
- // SimpleFeature-Filter-Fenster geschlossen/minimiert werden
- if ( !windowListenerAdded && filterDialog != null ) {
- Window parentFrame = SwingUtil.getParentWindow(this);
- if ( parentFrame != null) {
- parentFrame.addWindowListener(new WindowEventConnector(filterDialog));
- windowListenerAdded = true;
- }
- }
- }
+ // Popup-Menue erzeugen, die die Funktionen des Layers steuert
+ final ConnectedPopupMenu menu = new ConnectedPopupMenu();
+ moveLayerUp = new JMenuItem(GeotoolsGUIUtil.RESOURCE
+ .getString(MENU_MOVE_LAYER_UP));
+ moveLayerDown = new JMenuItem(GeotoolsGUIUtil.RESOURCE
+ .getString(MENU_MOVE_LAYER_DOWN));
+ zoomToLayer = new JMenuItem(GeotoolsGUIUtil.RESOURCE
+ .getString(MENU_ZOOM_TO_LAYER));
+ filterLayer = new JMenuItem(GeotoolsGUIUtil.RESOURCE
+ .getString(MENU_FILTER_LAYER));
+ recolorLayer = new ColorMapMenu(GeotoolsGUIUtil.RESOURCE
+ .getString(MENU_RECOLOR_LAYER), layer);
+ removeLayer = new JMenuItem(GeotoolsGUIUtil.RESOURCE
+ .getString(MENU_REMOVE_LAYER));
+ showAllLayers = new JMenuItem(GeotoolsGUIUtil.RESOURCE
+ .getString(MENU_SHOW_ALL_LAYERS));
+ hideAllLayers = new JMenuItem(GeotoolsGUIUtil.RESOURCE
+ .getString(MENU_HIDE_ALL_LAYERS));
+ invertAllLayers = new JMenuItem(GeotoolsGUIUtil.RESOURCE
+ .getString(MENU_INVERT_ALL_LAYERS));
+ moveLayerDown.addActionListener(this);
+ moveLayerUp.addActionListener(this);
+ zoomToLayer.addActionListener(this);
+ removeLayer.addActionListener(this);
+ showAllLayers.addActionListener(this);
+ hideAllLayers.addActionListener(this);
+ invertAllLayers.addActionListener(this);
+ filterLayer.addActionListener(this);
+ filterLayer.setEnabled(!JMapPane.isGridCoverageLayer(layer));
+ if (filterLayer.isEnabled())
+ try {
+ filterDialog = new FeatureLayerFilterDialog(null, mapPane,
+ layer);
+ filterDialog.setModal(false);
+ } catch (Exception err) {
+ LangUtil
+ .logDebugError(
+ LOGGER,
+ "Layer "
+ + layer.getTitle()
+ + ": FeatureFilterFrame could not be created!",
+ err);
+ filterLayer.setEnabled(false);
+ }
+ menu.add(moveLayerUp);
+ menu.add(moveLayerDown);
+ menu.add(zoomToLayer);
+ menu.add(filterLayer);
+ menu.add(recolorLayer);
+ menu.addSeparator();
+ menu.add(removeLayer);
+ menu.addSeparator();
+ menu.add(showAllLayers);
+ menu.add(hideAllLayers);
+ menu.add(invertAllLayers);
- /**
- * Initiiert die Checkbox- und Menu-Aktionen, je nachdem, welche Quelle
- * das ActionEvent hat.
- * @param e ActionEvent
- */
- public void actionPerformed(ActionEvent e) {
- if (e == null)
- return;
- Object source = e.getSource();
- MapContext context = mapPane.getContext();
- int currIdx = context.indexOf(layer);
+ menu.connectTo(this);
- // Checkbox (un)checked -> (in)visible layer
- if ( source == this )
- layer.setVisible( !layer.isVisible() );
- // Menu "Move layer up"
- if ( source == moveLayerUp && currIdx + 1 < context.getLayerCount() )
- context.moveLayer(currIdx, currIdx + 1);
- // Menu "Move layer down"
- if ( source == moveLayerDown && currIdx > 0)
- context.moveLayer(currIdx, currIdx - 1);
- // Menu "Zoom to layer"
- if ( source == zoomToLayer )
- mapPane.zoomToLayer(layer);
- // Menu "Remove layer"
- if ( source == removeLayer )
- context.removeLayer(layer);
- // Menu "Show all layer"
- if ( source == showAllLayers )
- for (MapLayer layer : context.getLayers() )
- layer.setVisible( true );
- // Menu "Hide all layer"
- if ( source == hideAllLayers )
- for (MapLayer layer : context.getLayers() )
- layer.setVisible( false );
- // Menu "Invert all layers"
- if ( source == invertAllLayers )
- for (MapLayer layer : context.getLayers() )
- layer.setVisible( !layer.isVisible() );
- // Menu "Filter layer"
- if ( source == filterLayer ) {
- filterDialog.toFront();
- filterDialog.setVisible( true );
- }
- mapPane.refresh();
- }
+ layer.addMapLayerListener(new MapLayerListener() {
+ @Override
+ public void layerChanged(MapLayerEvent e) {
+ }
- /**
- * Belegt die Bezeichnungen der Menue-Eintraege neu.
- * @param captionMap Map mit neuen Beschriftungen
- */
- public void resetCaptions(Map<String,Object> captionMap) {
- SwingUtil.resetCaption ( moveLayerUp, captionMap.get(MENU_MOVE_LAYER_UP) );
- SwingUtil.resetCaption ( moveLayerDown, captionMap.get(MENU_MOVE_LAYER_DOWN) );
- SwingUtil.resetCaption ( zoomToLayer, captionMap.get(MENU_ZOOM_TO_LAYER) );
- SwingUtil.resetCaption ( recolorLayer, captionMap.get(MENU_RECOLOR_LAYER) );
- SwingUtil.resetCaption ( removeLayer, captionMap.get(MENU_REMOVE_LAYER) );
- SwingUtil.resetCaption ( showAllLayers, captionMap.get(MENU_SHOW_ALL_LAYERS) );
- SwingUtil.resetCaption ( hideAllLayers, captionMap.get(MENU_HIDE_ALL_LAYERS) );
- SwingUtil.resetCaption ( invertAllLayers, captionMap.get(MENU_INVERT_ALL_LAYERS) );
- SwingUtil.resetCaption ( filterLayer, captionMap.get(MENU_FILTER_LAYER) );
- recolorLayer.resetCaptions(captionMap);
- if ( filterDialog != null )
- filterDialog.resetCaptions(captionMap);
- }
- }
+ @Override
+ public void layerHidden(MapLayerEvent e) {
+ setSelected(false);
+ }
- //////////////////////////////////////////////////////////////////////////
- // Menue fuer Farb-Paletten
- //////////////////////////////////////////////////////////////////////////
- private class ColorMapMenu extends JMenu implements CaptionsChangeable {
- private MapLayer layer = null;
- private ButtonGroup menuItemGroup = null;
- // Flag, ob bereits ein WindowListener im uebergeordneten Fenster
- // eingetragen wurde (geschieht beim ersten Anzeigen)
- private boolean windowListenerAdded = false;
- // statischer Menue-Eintrag zum Anpassen der Farbtabelle
- private JMenuItem customizeMenuItem = null;
- // Button fuer Farbtabellen-Dialog (Instanzvariablen, damit
- // Beschriftung geaendert werden kann!!)
- private JButton okButton = null;
- private JButton cancelButton = null;
- private JButton applyButton = null;
- private JButton saveButton = null;
- // Farbtabellen-Dialog
- private ColorMapTable customiseDialogTable = new ColorMapTable();
- private JDialog customiseDialog = null;
- private String cmDialogTitle = GeotoolsGUIUtil.RESOURCE.getString(CM_DIALOG_TITLE);
- private String saveCMDialogTitle = GeotoolsGUIUtil.RESOURCE.getString(CM_SAVE_DIALOG_TITLE);
- private String saveCMDialogQuestion = GeotoolsGUIUtil.RESOURCE.getString(CM_SAVE_DIALOG_QUESTION);
+ @Override
+ public void layerShown(MapLayerEvent e) {
+ setSelected(true);
+ }
- /**
- * Aktion, wenn eine der registrierten Farb-Paletten ausgewaehlt wird.
- */
- private ActionListener colorMapAction = new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- String colMapName = ((JCheckBoxMenuItem)e.getSource()).getText();
- ColorMap colMap = (colMapName!=null) ? StylingUtil.cloneColorMap(colorMaps.get(colMapName)) : null;
- if ( colMap != null ) {
- layer.setStyle(GridUtil.createStyle(colMap, 1.0));
- customiseDialogTable.setColorMap(colMap);
- mapPane.setReset(true);
- mapPane.repaint();
- ((JCheckBoxMenuItem)e.getSource()).setSelected(true);
- }
- }
- };
+ @Override
+ public void layerDeselected(MapLayerEvent event) {
+ // TODO Auto-generated method stub
+ }
- /**
- * Aktion, um die aktuelle Farb-Paletten anzupassen.
- */
- private ActionListener customiseMapAction = new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if ( customiseDialog.isVisible() ) {
- customiseDialog.toFront();
- return;
- }
- customiseDialogTable.setColorMap( StylingUtil.cloneColorMap( StylingUtil.getColorMapFromStyle(layer.getStyle()) ) );
- customiseDialog.setVisible(true);
- }
- };
+ @Override
+ public void layerSelected(MapLayerEvent event) {
+ // TODO Auto-generated method stub
+ }
+ });
+ }
- /**
- * Erzeugt ein neues Menue.
- * @param desc Beschreibung fuer das Menue
- * @param layer Layer, das durch das Menue gesteuert wird
- */
- public ColorMapMenu(String desc, MapLayer layer) {
- super(desc);
- this.layer = layer;
- this.customiseDialog = createColorMapDialog();
- customizeMenuItem = new JMenuItem( GeotoolsGUIUtil.RESOURCE.getString(MENU_CUSTOMIZE_COLOR) );
- customizeMenuItem.addActionListener( customiseMapAction );
- // Initialer Aufbau
- reorganise();
- // Sobald das Menue neu angezeigt wird, muss es neu aufgebaut
- // werden, wenn sich die vorgefertigten ColorMaps geaendert haben
- this.addMenuListener( new MenuListener() {
- private ColorMapManager oldColorMaps = (ColorMapManager)colorMaps.clone();
- public void menuCanceled(MenuEvent e) {}
- public void menuDeselected(MenuEvent e) {}
- public void menuSelected(MenuEvent e) {
- if ( !colorMaps.equals(oldColorMaps) ) {
- reorganise();
- oldColorMaps = (ColorMapManager)colorMaps.clone();
- }
- }
- });
- }
+ /**
+ * Ruft die {@code super}-Methode auf. Zudem wird (beim ersten Anzeigen)
+ * ein {@link WindowEventConnector} in das uebergeordnete Fenster
+ * eingetragen, der dessen Aktionen mit denen des
+ * SimpleFeature-Filter-Fensters verbindet.
+ *
+ * @param g
+ * Graphics
+ */
+ public void paint(Graphics g) {
+ super.paint(g);
+ // Wenn das Fenster geschlossen/minimiert wird, soll auch das
+ // SimpleFeature-Filter-Fenster geschlossen/minimiert werden
+ if (!windowListenerAdded && filterDialog != null) {
+ Window parentFrame = SwingUtil.getParentWindow(this);
+ if (parentFrame != null) {
+ parentFrame.addWindowListener(new WindowEventConnector(
+ filterDialog));
+ windowListenerAdded = true;
+ }
+ }
+ }
- /**
- * Baut das Menue neu auf.
- */
- public void reorganise() {
- // Alle bisherigen Eintraege loeschen
- this.removeAll();
+ /**
+ * Initiiert die Checkbox- und Menu-Aktionen, je nachdem, welche Quelle
+ * das ActionEvent hat.
+ *
+ * @param e
+ * ActionEvent
+ */
+ public void actionPerformed(ActionEvent e) {
+ if (e == null)
+ return;
+ Object source = e.getSource();
+ MapContext context = mapPane.getContext();
+ int currIdx = context.indexOf(layer);
- // nur fuer GridCoverage2D-Objekte kann die Farbe veraendert werden
-// FeatureTypeStyle[] fts = layer.getStyle().getFeatureTypeStyles();
-// if ( !(fts[0].getRules()[0].getSymbolizers()[0] instanceof RasterSymbolizer) ) {
- if ( !JMapPane.isGridCoverageLayer(layer) ) {
- this.setEnabled(false);
- return;
- }
+ // Checkbox (un)checked -> (in)visible layer
+ if (source == this)
+ layer.setVisible(!layer.isVisible());
+ // Menu "Move layer up"
+ if (source == moveLayerUp && currIdx + 1 < context.getLayerCount())
+ context.moveLayer(currIdx, currIdx + 1);
+ // Menu "Move layer down"
+ if (source == moveLayerDown && currIdx > 0)
+ context.moveLayer(currIdx, currIdx - 1);
+ // Menu "Zoom to layer"
+ if (source == zoomToLayer)
+ mapPane.zoomToLayer(layer);
+ // Menu "Remove layer"
+ if (source == removeLayer)
+ context.removeLayer(layer);
+ // Menu "Show all layer"
+ if (source == showAllLayers)
+ for (MapLayer layer : context.getLayers())
+ layer.setVisible(true);
+ // Menu "Hide all layer"
+ if (source == hideAllLayers)
+ for (MapLayer layer : context.getLayers())
+ layer.setVisible(false);
+ // Menu "Invert all layers"
+ if (source == invertAllLayers)
+ for (MapLayer layer : context.getLayers())
+ layer.setVisible(!layer.isVisible());
+ // Menu "Filter layer"
+ if (source == filterLayer) {
+ filterDialog.toFront();
+ filterDialog.setVisible(true);
+ }
+ mapPane.refresh();
+ }
- this.setEnabled(true);
- this.menuItemGroup = new ButtonGroup();
+ /**
+ * Belegt die Bezeichnungen der Menue-Eintraege neu.
+ *
+ * @param captionMap
+ * Map mit neuen Beschriftungen
+ */
+ public void resetCaptions(Map<String, Object> captionMap) {
+ SwingUtil.resetCaption(moveLayerUp, captionMap
+ .get(MENU_MOVE_LAYER_UP));
+ SwingUtil.resetCaption(moveLayerDown, captionMap
+ .get(MENU_MOVE_LAYER_DOWN));
+ SwingUtil.resetCaption(zoomToLayer, captionMap
+ .get(MENU_ZOOM_TO_LAYER));
+ SwingUtil.resetCaption(recolorLayer, captionMap
+ .get(MENU_RECOLOR_LAYER));
+ SwingUtil.resetCaption(removeLayer, captionMap
+ .get(MENU_REMOVE_LAYER));
+ SwingUtil.resetCaption(showAllLayers, captionMap
+ .get(MENU_SHOW_ALL_LAYERS));
+ SwingUtil.resetCaption(hideAllLayers, captionMap
+ .get(MENU_HIDE_ALL_LAYERS));
+ SwingUtil.resetCaption(invertAllLayers, captionMap
+ .get(MENU_INVERT_ALL_LAYERS));
+ SwingUtil.resetCaption(filterLayer, captionMap
+ .get(MENU_FILTER_LAYER));
+ recolorLayer.resetCaptions(captionMap);
+ if (filterDialog != null)
+ filterDialog.resetCaptions(captionMap);
+ }
+ }
- // Einen Menue-Eintrag fuer jede registrierte Farb-Palette
- Iterator<String> keys = colorMaps.keySet().iterator();
- for (int i=0; keys.hasNext(); i++) {
- String colMapName = keys.next();
- JCheckBoxMenuItem item = new JCheckBoxMenuItem(colMapName);
- item.addActionListener( colorMapAction );
- menuItemGroup.add( item );
- // Eintrag selektieren, wenn er vorher selektiert war
- item.setSelected( StylingUtil.colorMapsEqual(
- colorMaps.get(colMapName),
- StylingUtil.getColorMapFromStyle(layer.getStyle())
- ));
- this.add( item );
+ // ////////////////////////////////////////////////////////////////////////
+ // Menue fuer Farb-Paletten
+ // ////////////////////////////////////////////////////////////////////////
+ private class ColorMapMenu extends JMenu implements CaptionsChangeable {
+ private MapLayer layer = null;
+ private ButtonGroup menuItemGroup = null;
+ // Flag, ob bereits ein WindowListener im uebergeordneten Fenster
+ // eingetragen wurde (geschieht beim ersten Anzeigen)
+ private boolean windowListenerAdded = false;
+ // statischer Menue-Eintrag zum Anpassen der Farbtabelle
+ private JMenuItem customizeMenuItem = null;
+ // Button fuer Farbtabellen-Dialog (Instanzvariablen, damit
+ // Beschriftung geaendert werden kann!!)
+ private JButton okButton = null;
+ private JButton cancelButton = null;
+ private JButton applyButton = null;
+ private JButton saveButton = null;
+ // Farbtabellen-Dialog
+ private ColorMapTable customiseDialogTable = new ColorMapTable();
+ private JDialog customiseDialog = null;
+ private String cmDialogTitle = GeotoolsGUIUtil.RESOURCE
+ .getString(CM_DIALOG_TITLE);
+ private String saveCMDialogTitle = GeotoolsGUIUtil.RESOURCE
+ .getString(CM_SAVE_DIALOG_TITLE);
+ private String saveCMDialogQuestion = GeotoolsGUIUtil.RESOURCE
+ .getString(CM_SAVE_DIALOG_QUESTION);
- }
+ /**
+ * Aktion, wenn eine der registrierten Farb-Paletten ausgewaehlt wird.
+ */
+ private ActionListener colorMapAction = new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ String colMapName = ((JCheckBoxMenuItem) e.getSource())
+ .getText();
+ ColorMap colMap = (colMapName != null) ? StylingUtil
+ .cloneColorMap(colorMaps.get(colMapName)) : null;
+ if (colMap != null) {
+ layer.setStyle(GridUtil.createStyle(colMap, 1.0));
+ customiseDialogTable.setColorMap(colMap);
+ mapPane.setReset(true);
+ mapPane.repaint();
+ ((JCheckBoxMenuItem) e.getSource()).setSelected(true);
+ }
+ }
+ };
- // Einen Menue-Eintrag, um die Farb-Palette anzupassen
- if ( this.getItemCount() > 0 )
- this.addSeparator();
- this.add( customizeMenuItem );
- }
+ /**
+ * Aktion, um die aktuelle Farb-Paletten anzupassen.
+ */
+ private ActionListener customiseMapAction = new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if (customiseDialog.isVisible()) {
+ customiseDialog.toFront();
+ return;
+ }
+ customiseDialogTable.setColorMap(StylingUtil
+ .cloneColorMap(StylingUtil.getColorMapFromStyle(layer
+ .getStyle())));
+ customiseDialog.setVisible(true);
+ }
+ };
- public void resetCaptions(Map<String,Object> captionMap) {
- SwingUtil.resetCaption ( customizeMenuItem, captionMap.get(MENU_CUSTOMIZE_COLOR) );
- SwingUtil.resetCaption ( okButton, captionMap.get(CM_DIALOG_OK) );
- SwingUtil.resetCaption ( cancelButton, captionMap.get(CM_DIALOG_CANCEL) );
- SwingUtil.resetCaption ( saveButton, captionMap.get(CM_DIALOG_SAVE) );
- SwingUtil.resetCaption ( applyButton, captionMap.get(CM_DIALOG_APPLY) );
- SwingUtil.resetCaption ( customiseDialog, captionMap.get(CM_DIALOG_TITLE) );
+ /**
+ * Erzeugt ein neues Menue.
+ *
+ * @param desc
+ * Beschreibung fuer das Menue
+ * @param layer
+ * Layer, das durch das Menue gesteuert wird
+ */
+ public ColorMapMenu(String desc, MapLayer layer) {
+ super(desc);
+ this.layer = layer;
+ this.customiseDialog = createColorMapDialog();
+ customizeMenuItem = new JMenuItem(GeotoolsGUIUtil.RESOURCE
+ .getString(MENU_CUSTOMIZE_COLOR));
+ customizeMenuItem.addActionListener(customiseMapAction);
+ // Initialer Aufbau
+ reorganise();
+ // Sobald das Menue neu angezeigt wird, muss es neu aufgebaut
+ // werden, wenn sich die vorgefertigten ColorMaps geaendert haben
+ this.addMenuListener(new MenuListener() {
+ private ColorMapManager oldColorMaps = (ColorMapManager) colorMaps
+ .clone();
- Object caption = captionMap.get( CM_DIALOG_TITLE );
- if ( caption != null ) {
- cmDialogTitle = caption.toString();
- // Damit Layer-Bezeichnung in Titel uebernommen wird, ein MapLayerEvent
- // ausloesen
- layer.setTitle( layer.getTitle() );
- }
- caption = captionMap.get( CM_SAVE_DIALOG_TITLE );
- if ( caption != null )
- saveCMDialogTitle = caption.toString();
- caption = captionMap.get( CM_SAVE_DIALOG_QUESTION );
- if ( caption != null )
- saveCMDialogQuestion = caption.toString();
- }
+ public void menuCanceled(MenuEvent e) {
+ }
- /**
- * Ruft die {@code super}-Methode auf. Zudem wird (beim ersten Anzeigen)
- * ein {@link WindowEventConnector} in das uebergeordnete Fenster eingetragen,
- * der dessen Aktionen mit denen des Farbpaletten-Fensters verbindet.
- * @param g Graphics
- */
- public void paint(Graphics g) {
- super.paint(g);
- // Wenn das Fenster geschlossen/minimiert wird, soll auch das
- // Farbpaletten-Fenster geschlossen/minimiert werden
- if ( !windowListenerAdded ) {
- Window parentFrame = SwingUtil.getParentWindow(this);
- if ( parentFrame != null ) {
- parentFrame.addWindowListener(new WindowEventConnector(customiseDialog));
- windowListenerAdded = true;
- }
- }
- }
- /**
- * Erzeugt einen Dialog, in dem die aktuelle Farb-Palette des (Raster-)
- * Layers angezeigt wird und veraendert werden kann.
- */
- private JDialog createColorMapDialog() {
- // Optionen des Dialogs (ActionListener folgen spaeter)
- okButton = new JButton( SwingUtil.RESOURCE.getString("Ok") );
- cancelButton = new JButton( SwingUtil.RESOURCE.getString("Cancel") );
- applyButton = new JButton( SwingUtil.RESOURCE.getString("Apply") );
- saveButton = new JButton( SwingUtil.RESOURCE.getString("Save") );
- // Dialog aufbauen
- JOptionPane pane = new JOptionPane(
- new JScrollPane( customiseDialogTable ),
- JOptionPane.QUESTION_MESSAGE,
- JOptionPane.DEFAULT_OPTION,
- null,
- new JButton[] { okButton, cancelButton, applyButton, saveButton },
- okButton
- );
- final JDialog dialog = pane.createDialog(SwingUtil.getParentWindow(this), cmDialogTitle + " ["+layer.getTitle()+"]");
- dialog.setResizable(true);
- dialog.setModal(false);
- dialog.setSize(380,200);
+ public void menuDeselected(MenuEvent e) {
+ }
- // Aktionen der Farbpaletten-Fenster-Button
- ActionListener action = new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- // Ok- und Apply-Button > ColorMap uebernehmen
- if ( e.getSource() == okButton || e.getSource() == applyButton ) {
- // Farbe nur uebernehmen, wenn sich die Farb-Palette wirklich
- // geaendert hat
-// if ( !StylingUtil.colorMapsEqual(
-// customiseDialogTable.getColorMap(),
-// StylingUtil.getColorMapFromStyle(layer.getStyle()) ) ) {
- layer.setStyle(GridUtil.createStyle( StylingUtil.cloneColorMap(customiseDialogTable.getColorMap()), 1.0));
- mapPane.setReset(true);
- mapPane.repaint();
- menuItemGroup.setUnselected();
-// }
- }
- // Ok- und Cancel-Button > Dialog schliessen
- if ( e.getSource() == okButton || e.getSource() == cancelButton ) {
- dialog.setVisible( false );
- }
- // Save-Button > Neue vordefinierte Palette erzeugen
- if ( e.getSource() == saveButton ) {
- String name = JOptionPane.showInputDialog(
- MapContextControlPane.this,
- saveCMDialogQuestion,
- saveCMDialogTitle,
- JOptionPane.QUESTION_MESSAGE
- );
- if ( name != null && !name.trim().equals("") ) {
- colorMaps.put(name, StylingUtil.cloneColorMap(customiseDialogTable.getColorMap()));
- }
- }
- }
- };
- okButton.addActionListener( action );
- cancelButton.addActionListener( action );
- applyButton.addActionListener( action );
- saveButton.addActionListener( action );
+ public void menuSelected(MenuEvent e) {
+ if (!colorMaps.equals(oldColorMaps)) {
+ reorganise();
+ oldColorMaps = (ColorMapManager) colorMaps.clone();
+ }
+ }
+ });
+ }
- // Wenn sich die die Bezeichnung des Layers aendert, soll auch der
- // Titel des Farbpaletten-Fensters geaendert werden
- layer.addMapLayerListener( new MapLayerAdapter() {
- public void layerChanged(MapLayerEvent e) {
- // Bezeichnung der Checkbox aendern
- dialog.setTitle(cmDialogTitle + " ["+layer.getTitle()+"]");
- }
- });
+ /**
+ * Baut das Menue neu auf.
+ */
+ public void reorganise() {
+ // Alle bisherigen Eintraege loeschen
+ this.removeAll();
- return dialog;
- }
- }
+ // nur fuer GridCoverage2D-Objekte kann die Farbe veraendert werden
+ // FeatureTypeStyle[] fts = layer.getStyle().getFeatureTypeStyles();
+ // if ( !(fts[0].getRules()[0].getSymbolizers()[0] instanceof
+ // RasterSymbolizer) ) {
+ if (!JMapPane.isGridCoverageLayer(layer)) {
+ this.setEnabled(false);
+ return;
+ }
+
+ this.setEnabled(true);
+ this.menuItemGroup = new ButtonGroup();
+
+ // Einen Menue-Eintrag fuer jede registrierte Farb-Palette
+ Iterator<String> keys = colorMaps.keySet().iterator();
+ for (int i = 0; keys.hasNext(); i++) {
+ String colMapName = keys.next();
+ JCheckBoxMenuItem item = new JCheckBoxMenuItem(colMapName);
+ item.addActionListener(colorMapAction);
+ menuItemGroup.add(item);
+ // Eintrag selektieren, wenn er vorher selektiert war
+ item.setSelected(StylingUtil.colorMapsEqual(colorMaps
+ .get(colMapName), StylingUtil
+ .getColorMapFromStyle(layer.getStyle())));
+ this.add(item);
+
+ }
+
+ // Einen Menue-Eintrag, um die Farb-Palette anzupassen
+ if (this.getItemCount() > 0)
+ this.addSeparator();
+ this.add(customizeMenuItem);
+ }
+
+ public void resetCaptions(Map<String, Object> captionMap) {
+ SwingUtil.resetCaption(customizeMenuItem, captionMap
+ .get(MENU_CUSTOMIZE_COLOR));
+ SwingUtil.resetCaption(okButton, captionMap.get(CM_DIALOG_OK));
+ SwingUtil.resetCaption(cancelButton, captionMap
+ .get(CM_DIALOG_CANCEL));
+ SwingUtil.resetCaption(saveButton, captionMap.get(CM_DIALOG_SAVE));
+ SwingUtil
+ .resetCaption(applyButton, captionMap.get(CM_DIALOG_APPLY));
+ SwingUtil.resetCaption(customiseDialog, captionMap
+ .get(CM_DIALOG_TITLE));
+
+ Object caption = captionMap.get(CM_DIALOG_TITLE);
+ if (caption != null) {
+ cmDialogTitle = caption.toString();
+ // Damit Layer-Bezeichnung in Titel uebernommen wird, ein
+ // MapLayerEvent
+ // ausloesen
+ layer.setTitle(layer.getTitle());
+ }
+ caption = captionMap.get(CM_SAVE_DIALOG_TITLE);
+ if (caption != null)
+ saveCMDialogTitle = caption.toString();
+ caption = captionMap.get(CM_SAVE_DIALOG_QUESTION);
+ if (caption != null)
+ saveCMDialogQuestion = caption.toString();
+ }
+
+ /**
+ * Ruft die {@code super}-Methode auf. Zudem wird (beim ersten Anzeigen)
+ * ein {@link WindowEventConnector} in das uebergeordnete Fenster
+ * eingetragen, der dessen Aktionen mit denen des Farbpaletten-Fensters
+ * verbindet.
+ *
+ * @param g
+ * Graphics
+ */
+ public void paint(Graphics g) {
+ super.paint(g);
+ // Wenn das Fenster geschlossen/minimiert wird, soll auch das
+ // Farbpaletten-Fenster geschlossen/minimiert werden
+ if (!windowListenerAdded) {
+ Window parentFrame = SwingUtil.getParentWindow(this);
+ if (parentFrame != null) {
+ parentFrame.addWindowListener(new WindowEventConnector(
+ customiseDialog));
+ windowListenerAdded = true;
+ }
+ }
+ }
+
+ /**
+ * Erzeugt einen Dialog, in dem die aktuelle Farb-Palette des (Raster-)
+ * Layers angezeigt wird und veraendert werden kann.
+ */
+ private JDialog createColorMapDialog() {
+ // Optionen des Dialogs (ActionListener folgen spaeter)
+ okButton = new JButton(SwingUtil.RESOURCE.getString("Ok"));
+ cancelButton = new JButton(SwingUtil.RESOURCE.getString("Cancel"));
+ applyButton = new JButton(SwingUtil.RESOURCE.getString("Apply"));
+ saveButton = new JButton(SwingUtil.RESOURCE.getString("Save"));
+ // Dialog aufbauen
+ JOptionPane pane = new JOptionPane(new JScrollPane(
+ customiseDialogTable), JOptionPane.QUESTION_MESSAGE,
+ JOptionPane.DEFAULT_OPTION, null, new JButton[] { okButton,
+ cancelButton, applyButton, saveButton }, okButton);
+ final JDialog dialog = pane.createDialog(SwingUtil
+ .getParentWindow(this), cmDialogTitle + " ["
+ + layer.getTitle() + "]");
+ dialog.setResizable(true);
+ dialog.setModal(false);
+ dialog.setSize(380, 200);
+
+ // Aktionen der Farbpaletten-Fenster-Button
+ ActionListener action = new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ // Ok- und Apply-Button > ColorMap uebernehmen
+ if (e.getSource() == okButton
+ || e.getSource() == applyButton) {
+ // Farbe nur uebernehmen, wenn sich die Farb-Palette
+ // wirklich
+ // geaendert hat
+ // if ( !StylingUtil.colorMapsEqual(
+ // customiseDialogTable.getColorMap(),
+ // StylingUtil.getColorMapFromStyle(layer.getStyle()) )
+ // ) {
+ layer.setStyle(GridUtil.createStyle(StylingUtil
+ .cloneColorMap(customiseDialogTable
+ .getColorMap()), 1.0));
+ mapPane.setReset(true);
+ mapPane.repaint();
+ menuItemGroup.setUnselected();
+ // }
+ }
+ // Ok- und Cancel-Button > Dialog schliessen
+ if (e.getSource() == okButton
+ || e.getSource() == cancelButton) {
+ dialog.setVisible(false);
+ }
+ // Save-Button > Neue vordefinierte Palette erzeugen
+ if (e.getSource() == saveButton) {
+ String name = JOptionPane.showInputDialog(
+ MapContextControlPane.this,
+ saveCMDialogQuestion, saveCMDialogTitle,
+ JOptionPane.QUESTION_MESSAGE);
+ if (name != null && !name.trim().equals("")) {
+ colorMaps.put(name, StylingUtil
+ .cloneColorMap(customiseDialogTable
+ .getColorMap()));
+ }
+ }
+ }
+ };
+ okButton.addActionListener(action);
+ cancelButton.addActionListener(action);
+ applyButton.addActionListener(action);
+ saveButton.addActionListener(action);
+
+ // Wenn sich die die Bezeichnung des Layers aendert, soll auch der
+ // Titel des Farbpaletten-Fensters geaendert werden
+ layer.addMapLayerListener(new MapLayerAdapter() {
+ public void layerChanged(MapLayerEvent e) {
+ // Bezeichnung der Checkbox aendern
+ dialog.setTitle(cmDialogTitle + " [" + layer.getTitle()
+ + "]");
+ }
+ });
+
+ return dialog;
+ }
+ }
}
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-08-26 18:09:39 UTC (rev 335)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/io/GeoExportUtil.java 2009-08-27 09:10:10 UTC (rev 336)
@@ -45,6 +45,9 @@
import org.geotools.data.Transaction;
import org.geotools.data.shapefile.ShapefileDataStore;
import org.geotools.feature.FeatureCollection;
+import org.opengis.feature.simple.SimpleFeature;
+import org.opengis.feature.simple.SimpleFeatureType;
+import org.opengis.feature.type.FeatureType;
import org.opengis.metadata.Identifier;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
@@ -78,7 +81,7 @@
* @param outFile Dateiname (Basisname)
* @throws java.lang.Exception bei irgendeinem Fehler
*/
- public static void writeFeaturesToShapeFile(FeatureCollection fc, File outFile) throws Exception {
+ public static void writeFeaturesToShapeFile(FeatureCollection<SimpleFeatureType, SimpleFeature> fc, File outFile) throws Exception {
// FeatureCollectionReader featureReader = new FeatureCollectionReader(fc);
// DataStore fuer Ausgabe-Datei oeffnen
@@ -86,8 +89,13 @@
// shpStore.createSchema(featureReader.getFeatureType());
shpStore.createSchema(fc.getSchema());
// FeatureStore aus dem ShapeFile-DataStore ermitteln
- FeatureSource source = shpStore.getFeatureSource();
- FeatureStore featureStore = (FeatureStore)source;
+ FeatureSource<SimpleFeatureType, SimpleFeature> source = shpStore.getFeatureSource();
+
+ // TODO 26 @Martin?! Du hattest hier gecastet... ob das so noch geht?!
+ // FeatureStore featureStore = (FeatureStore)source;
+ FeatureStore<SimpleFeatureType, SimpleFeature> featureStore = (FeatureStore<SimpleFeatureType, SimpleFeature>)source;
+
+
// Features schreiben
Transaction transaction = featureStore.getTransaction();
featureStore.addFeatures( fc );
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/map/event/MapLayerAdapter.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/map/event/MapLayerAdapter.java 2009-08-26 18:09:39 UTC (rev 335)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/map/event/MapLayerAdapter.java 2009-08-27 09:10:10 UTC (rev 336)
@@ -33,28 +33,46 @@
import org.geotools.map.event.MapLayerListener;
/**
- * Diese Klasse bildet eine Basis-Implementierung von
- * {@link MapLayerListener org.geotools.map.event.MapLayerListener}, deren
- * Methoden nichts machen.
- * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a> (University of Bonn/Germany)
+ * Diese Klasse bildet eine Basis-Implementierung von {@link MapLayerListener
+ * org.geotools.map.event.MapLayerListener}, deren Methoden nichts machen.
+ *
+ * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a>
+ * (University of Bonn/Germany)
* @version 1.0
*/
public class MapLayerAdapter implements MapLayerListener {
- /**
- * Wird aufgerufen, wenn ein Layer verborgen wird. Macht nichts.
- */
- public void layerHidden(MapLayerEvent e) {
- }
+ /**
+ * Wird aufgerufen, wenn ein Layer verborgen wird. Macht nichts.
+ */
+ @Override
+ public void layerHidden(MapLayerEvent e) {
+ }
- /**
- * Wird aufgerufen, wenn sich ein Layer veraendert. Macht nichts.
- */
- public void layerChanged(MapLayerEvent e) {
- }
+ /**
+ * Wird aufgerufen, wenn sich ein Layer veraendert. Macht nichts.
+ */
+ @Override
+ public void layerChanged(MapLayerEvent e) {
+ }
- /**
- * Wird aufgerufen, wenn ein Layer angezeigt wird. Macht nichts.
- */
- public void layerShown(MapLayerEvent e) {
- }
+ /**
+ * Wird aufgerufen, wenn ein Layer angezeigt wird. Macht nichts.
+ */
+ @Override
+ public void layerShown(MapLayerEvent e) {
+ }
+
+ /**
+ * Wird aufgerufen, wenn ein Layer deselectiert wird. Macht nichts.
+ */
+ @Override
+ public void layerDeselected(MapLayerEvent event) {
+ }
+
+ /**
+ * Wird aufgerufen, wenn ein Layer selectiert wird. Macht nichts.
+ */
+ @Override
+ public void layerSelected(MapLayerEvent event) {
+ }
}
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-08-26 18:09:39 UTC (rev 335)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/styling/StylingUtil.java 2009-08-27 09:10:10 UTC (rev 336)
@@ -270,15 +270,13 @@
if (object instanceof FeatureCollection)
style = FeatureUtil.createDefaultStyle((FeatureCollection) object);
- // SK.cb
if (object instanceof GeometryAttributeType)
style = FeatureUtil
.createDefaultStyle((GeometryAttributeType) object);
if (object instanceof FeatureSource)
style = FeatureUtil.createDefaultStyle(((FeatureSource) object)
- .getSchema().getDefaultGeometry());
- // SK.ce
+ .getSchema().getGeometryDescriptor());
return style;
}
@@ -1038,12 +1036,12 @@
* Krüger</a>
*/
public static MemoryFeatureCollection filterSLDVisibleOnly(
- final FeatureCollection fc, final Style style,
+ final FeatureCollection<SimpleFeatureType, SimpleFeature> fc, final Style style,
final Double scaleDenominator) {
// Eine im Speicher gehaltene FeatureCollection der sichtbaren
final MemoryFeatureCollection fcVisible = new MemoryFeatureCollection(
- fc.getFeatureType());
+ fc.getSchema());
// Prüfen aller Features in der Collection
final Iterator<SimpleFeature> fcIt = fc.iterator();
@@ -1053,7 +1051,7 @@
while (fcIt.hasNext()) {
final SimpleFeature feature = fcIt.next();
- for (final FeatureTypeStyle fts : style.getFeatureTypeStyles()) {
+ for (final FeatureTypeStyle fts : style.featureTypeStyles()) {
final List<Rule> rules = fts.rules();
for (final Rule rule : rules) {
@@ -1084,7 +1082,9 @@
// gibt einen LineSymbolizer für ein PointLayer an.
boolean passt = false;
for (final Symbolizer symb : rule.getSymbolizers()) {
- final Geometry geom = feature.getDefaultGeometry();
+
+ final Geometry geom = (Geometry) feature.getDefaultGeometry();
+
if ((geom instanceof MultiPoint)
|| (geom instanceof com.vividsolutions.jts.geom.Point)) {
if (symb instanceof PointSymbolizer) {
Modified: branches/1.0-gt2-2.6/src/schmitzm/jfree/feature/style/FeatureChartUtil.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/jfree/feature/style/FeatureChartUtil.java 2009-08-26 18:09:39 UTC (rev 335)
+++ branches/1.0-gt2-2.6/src/schmitzm/jfree/feature/style/FeatureChartUtil.java 2009-08-27 09:10:10 UTC (rev 336)
@@ -151,19 +151,19 @@
* feature attribute(s) used for the Y-value (at least one; for
* each a series is created in the dataset)
*/
- public static Dataset createDataset(FeatureCollection fc,
+ public static Dataset createDataset(FeatureCollection<SimpleFeatureType, SimpleFeature> fc,
FeatureChartStyle style) {
String xAttr = style.getAttributeName(0);
// Check the X attribute to differ between XY- and CategoryDataset
- AttributeDescriptor xType = fc.getSchema().getAttributeType(xAttr);
- if (xType == null)
+ AttributeDescriptor xDesc = fc.getSchema().getDescriptor(xAttr);
+ if (xDesc == null)
throw new UnsupportedOperationException("Unknown attribute: "
+ xAttr);
// If domain attribute is numeric (and category not forced) create
// a XYDataset
if (!style.isForceCategories()
- && Number.class.isAssignableFrom(xType.getBinding()))
+ && Number.class.isAssignableFrom(xDesc.getType().getBinding()))
return createXYDataset(fc, style);
else
return createCategoryDataset(fc, style);
@@ -183,8 +183,8 @@
*/
private static void checkAttributeType(SimpleFeatureType fType, String aName,
Class typeToCheck, String... errDesc) {
- AttributeDescriptor aType = fType.getAttributeType(aName);
- if (aType == null)
+ AttributeDescriptor aDesc = fType.getDescriptor(aName);
+ if (aDesc == null)
throw new UnsupportedOperationException("Unknown attribute: "
+ aName);
@@ -192,7 +192,7 @@
String datasetDesc = errDesc.length > 1 ? errDesc[1] : "Dataset";
if (typeToCheck != null
- && !typeToCheck.isAssignableFrom(aType.getBinding()))
+ && !typeToCheck.isAssignableFrom(aDesc.getType().getBinding()))
throw new UnsupportedOperationException(attrDesc + " must be "
+ typeToCheck.getSimpleName() + " for " + datasetDesc
+ ": " + aName);
Modified: branches/1.0-gt2-2.6/src/skrueger/geotools/MapPaneToolBar.java
===================================================================
--- branches/1.0-gt2-2.6/src/skrueger/geotools/MapPaneToolBar.java 2009-08-26 18:09:39 UTC (rev 335)
+++ branches/1.0-gt2-2.6/src/skrueger/geotools/MapPaneToolBar.java 2009-08-27 09:10:10 UTC (rev 336)
@@ -359,7 +359,6 @@
// Set the mouse tool to "Panning"
mapPane.setWindowSelectionState(JMapPane.NONE);
mapPane.setState(JMapPane.PAN);
- mapPane.setHighlight(false);
mapPane.setNormalCursor(SwingUtil.PAN_CURSOR);
break;
case TOOL_INFO:
@@ -367,7 +366,6 @@
mapPane.setWindowSelectionState(JMapPane.NONE);
mapPane.setState(JMapPane.SELECT_TOP); // Why not:
// JMapPane.SELECT_TOP_ONEONLY
- mapPane.setHighlight(false);// SK: Was true, but since it not works
// properly removed it to save
// performance
mapPane.setNormalCursor(SwingUtil.CROSSHAIR_CURSOR);
@@ -376,21 +374,18 @@
// Set the mouse tool to "Zoom in"
mapPane.setWindowSelectionState(JMapPane.ZOOM_IN);
mapPane.setState(JMapPane.ZOOM_IN);
- mapPane.setHighlight(false);
mapPane.setNormalCursor(SwingUtil.ZOOMIN_CURSOR);
break;
case TOOL_ZOOMOUT:
// Set the mouse tool to "Zoom out"
mapPane.setWindowSelectionState(JMapPane.NONE);
mapPane.setState(JMapPane.ZOOM_OUT);
- mapPane.setHighlight(false);
mapPane.setNormalCursor(SwingUtil.ZOOMOUT_CURSOR);
break;
default:
// Set map actions to default
mapPane.setWindowSelectionState(JMapPane.NONE);
mapPane.setState(JMapPane.NONE);
- mapPane.setHighlight(false);
mapPane.setNormalCursor(null);
break;
}
Modified: branches/1.0-gt2-2.6/src/skrueger/geotools/StyledFS.java
===================================================================
--- branches/1.0-gt2-2.6/src/skrueger/geotools/StyledFS.java 2009-08-26 18:09:39 UTC (rev 335)
+++ branches/1.0-gt2-2.6/src/skrueger/geotools/StyledFS.java 2009-08-27 09:10:10 UTC (rev 336)
@@ -45,6 +45,8 @@
import org.geotools.data.FeatureSource;
import org.geotools.feature.FeatureCollection;
import org.geotools.styling.Style;
+import org.opengis.feature.simple.SimpleFeature;
+import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.feature.type.AttributeDescriptor;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
@@ -63,7 +65,7 @@
public class StyledFS implements StyledFeatureSourceInterface {
private static final Logger LOGGER = Logger.getLogger(StyledFS.class);
- private final FeatureSource fs;
+ private final FeatureSource<SimpleFeatureType, SimpleFeature> fs;
/**
* A unique ID which identifies the Layer in the Atlas. It's more important
@@ -92,7 +94,7 @@
* may be <code>null</code>. Otherwise the SLD {@link File} to
* import and associate with this {@link StyledFS}
*/
- public StyledFS(FeatureSource fs, File sldFile) {
+ public StyledFS(FeatureSource<SimpleFeatureType, SimpleFeature> fs, File sldFile) {
this.fs = fs;
id = StyledFS.class.getSimpleName()
@@ -100,7 +102,7 @@
this.sldFile = sldFile;
- if ((sldFile != null) && (sldFile.exists())) {
+ if (sldFile != null && sldFile.exists()) {
try {
style = StylingUtil.loadSLD(sldFile)[0];
} catch (FileNotFoundException e) {
@@ -121,10 +123,10 @@
}
/**
- * Returnes human readable {@link String} of the CRS natively used by this
+ * Returns human readable {@link String} of the CRS natively used by this
* {@link DpLayer}
*
- * If crs == null, it will call {@link #getGeoObject()}
+ * If CRS == null, it will call {@link #getGeoObject()}
*
*/
public String getCRSString() {
@@ -135,7 +137,7 @@
}
public CoordinateReferenceSystem getCrs() {
- return fs.getSchema().getDefaultGeometry().getCoordinateSystem();
+ return fs.getSchema().getCoordinateReferenceSystem();
}
public Translation getDesc() {
@@ -151,7 +153,7 @@
}
}
- public FeatureSource getGeoObject() {
+ public FeatureSource<SimpleFeatureType, SimpleFeature> getGeoObject() {
return fs;
}
@@ -231,7 +233,7 @@
// Leaving out the first one, it will be the_geom
for (int i = 1; i < fs.getSchema().getAttributeCount(); i++) {
- AttributeDescriptor att = fs.getSchema().getAttributeType(i);
+ AttributeDescriptor att = fs.getSchema().getDescriptor(i);
AttributeMetaData attMetaData = new AttributeMetaData(i, att
.getLocalName());
More information about the Schmitzm-commits
mailing list