[Schmitzm-commits] r1201 - trunk/src/schmitzm/geotools/gui
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Nov 2 21:26:43 CET 2010
Author: alfonx
Date: 2010-11-02 21:26:42 +0100 (Tue, 02 Nov 2010)
New Revision: 1201
Modified:
trunk/src/schmitzm/geotools/gui/RasterPositionLabel.java
trunk/src/schmitzm/geotools/gui/SelectableXMapPane.java
trunk/src/schmitzm/geotools/gui/XMapPaneAction_Select.java
Log:
Raster layers can be set to clickable or unlickable, just like vector layers can.
Modified: trunk/src/schmitzm/geotools/gui/RasterPositionLabel.java
===================================================================
--- trunk/src/schmitzm/geotools/gui/RasterPositionLabel.java 2010-11-02 20:08:46 UTC (rev 1200)
+++ trunk/src/schmitzm/geotools/gui/RasterPositionLabel.java 2010-11-02 20:26:42 UTC (rev 1201)
@@ -162,12 +162,6 @@
// Objekt aus Layer herausholen
final Object layerObj = FeatureUtil.getLayerSourceObject(layer);
- // We checked that it's a GridLayer.. so have no fear...
- // if ((layerObj == null)
- // || (!(layerObj instanceof GridCoverage2D) && !(layerObj instanceof
- // org.geotools.coverage.grid.io.AbstractGridCoverage2DReader)))
- // return;
-
final StringBuffer valueStr = new StringBuffer();
if (layerObj instanceof GridCoverage2D) {
final GridCoverage2D gc = (GridCoverage2D) layerObj;
@@ -228,9 +222,8 @@
}
}
- // CHANGE SK 9.8.2008 START
-
- else if (layerObj instanceof org.geotools.coverage.grid.io.AbstractGridCoverage2DReader) {
+ // Support for GridCoverage2DReader
+ else if (layerObj instanceof AbstractGridCoverage2DReader) {
final GeneralDirectPosition actPos_GridCRS = new GeneralDirectPosition(
2);
try {
@@ -259,9 +252,9 @@
}
} catch (final Exception err) {
// Position out of Raster data
+ System.err.println(err);
}
- // CHANGE SK 9.8.2008 END
}
// Text im Label anzeigen
Modified: trunk/src/schmitzm/geotools/gui/SelectableXMapPane.java
===================================================================
--- trunk/src/schmitzm/geotools/gui/SelectableXMapPane.java 2010-11-02 20:08:46 UTC (rev 1200)
+++ trunk/src/schmitzm/geotools/gui/SelectableXMapPane.java 2010-11-02 20:26:42 UTC (rev 1201)
@@ -298,6 +298,7 @@
// Events ausloesen fuer jedes Layer
for (Enumeration<MapLayer> e = result.keys(); e.hasMoreElements();) {
MapLayer layer = e.nextElement();
+
double[] values = result.get(layer);
fireMapPaneEvent(new GridCoverageValueSelectedEvent(this, layer,
point, values));
@@ -494,24 +495,31 @@
MapLayer[] layerList = context.getLayers();
for (int i = layerList.length - 1; i >= 0; i--) {
MapLayer layer = layerList[i];
+
if (!layer.isVisible())
continue;
+
+ if (!isMapLayerSelectable(layer)) {
+// LOGGER.debug("Ignoring layer " + layer.getTitle()
+// + " because it is not declared as selectable!");
+ continue;
+ }
+
Object layerObj = FeatureUtil
.getWrappedGeoObject((FeatureSource<SimpleFeatureType, SimpleFeature>) layer
.getFeatureSource());
- // Bei einem Nicht-Raster-Layer, das den Punkt beinhaltet,
- // abbrechen, wenn nur im
- // obersten (sichtbaren) Layer gesucht wird.
+ // Plan: Bei einem Nicht-Raster-Layer, das den Punkt beinhaltet,
+ // abbrechen, wenn nur imobersten (sichtbaren) Layer gesucht wird.
// Ansonsten Nicht-Raster-Layer einfach uebergehen.
// SK 29.9.07: Ein AbstractGridCoverage2DReader ist auch ein Raster
if (!(layerObj instanceof GridCoverage2D || layerObj instanceof AbstractGridCoverage2DReader)) {
- final Envelope pointAsEnvelope = new Envelope(point.getX(),
- point.getX(), point.getY(), point.getY());
- if ((mode == SELECT_TOP || mode == SELECT_ONE_FROM_TOP)
- && featureLayerIntersectsEnvelope(layer,
- pointAsEnvelope)) {
- }
+ // final Envelope pointAsEnvelope = new Envelope(point.getX(),
+ // point.getX(), point.getY(), point.getY());
+ // if ((mode == SELECT_TOP || mode == SELECT_ONE_FROM_TOP)
+ // && featureLayerIntersectsEnvelope(layer,
+ // pointAsEnvelope)) {
+ // }
continue;
}
@@ -571,8 +579,11 @@
}
result.put(layer, values);
- // Beim Modus "oberstes Layer selektieren" die Schleife beenden
- if (mode == SELECT_TOP || mode == SELECT_ONE_FROM_TOP)
+ // Beim Modus "oberstes Layer selektieren" die Schleife beenden,
+ // ober beim Modul "Das oberste" die Schleife beenden wenn etwas
+ // gefunden wurde.
+ if (mode == SELECT_TOP || mode == SELECT_ONE_FROM_TOP
+ && values.length > 0)
break;
}
return result;
@@ -649,7 +660,7 @@
final MapLayer layer = e.nextElement();
- System.out.println("cheing in " + layer.getTitle());
+ // System.out.println("checking in " + layer.getTitle());
final FeatureCollection<SimpleFeatureType, SimpleFeature> fc = result
.get(layer);
@@ -777,17 +788,15 @@
MapLayer[] layerList = context.getLayers();
for (int i = layerList.length - 1; i >= 0; i--) {
MapLayer layer = layerList[i];
- System.out.println("searching in " + layer.getTitle());
+ LOGGER.debug("searching for features in " + layer.getTitle());
if (!layer.isVisible()) {
- System.out.println(" not visible!");
+ LOGGER.debug(" not visible!");
continue;
}
- // This should never happen, because the check should be performed
- // earlier already
if (!isMapLayerSelectable(layer)) {
- // LOGGER.debug("Ignoring layer " + layer.getTitle()
- // + " because it is not declared as selectable!");
+// LOGGER.debug("Ignoring layer " + layer.getTitle()
+// + " because it is not declared as selectable!");
continue;
}
Modified: trunk/src/schmitzm/geotools/gui/XMapPaneAction_Select.java
===================================================================
--- trunk/src/schmitzm/geotools/gui/XMapPaneAction_Select.java 2010-11-02 20:08:46 UTC (rev 1200)
+++ trunk/src/schmitzm/geotools/gui/XMapPaneAction_Select.java 2010-11-02 20:26:42 UTC (rev 1201)
@@ -25,16 +25,6 @@
import com.vividsolutions.jts.geom.Geometry;
public abstract class XMapPaneAction_Select implements XMapPaneAction {
- //
- // /**
- // * Flag fuer Modus "SimpleFeature-Auswahl auf allen (sichtbaren) Layern".
- // *
- // * @see #setState(int)
- // * @see #setState(int)
- // */
- // public static enum SelMode {
- // SELECT_ALL
- // }
public void performClick(XMapPane xMapPane, MouseEvent ev,
DirectPosition geoCoord) {
@@ -144,13 +134,6 @@
*/
public static final double DEFAULT_DISTANCE_FRACTION = 0.01d;
- // @Override
- // public void performClick(XMapPane xMapPane, MouseEvent ev,
- // DirectPosition geoCoord) {
- //
- // performSelectionClick(xMapPane, ev, geoCoord, XMapPane.SELECT_ALL);
- // }
-
@Override
public void performDragged(XMapPane mapPane, MouseEvent ev,
Point dragStartPos, Point dragLastPos, DirectPosition startCoord,
More information about the Schmitzm-commits
mailing list