[Schmitzm-commits] r492 - in branches/1.0-gt2-2.6/src: schmitzm/geotools/gui skrueger/geotools/selection
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Oct 23 15:49:50 CEST 2009
Author: alfonx
Date: 2009-10-23 15:49:49 +0200 (Fri, 23 Oct 2009)
New Revision: 492
Modified:
branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JMapPane.java
branches/1.0-gt2-2.6/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java
branches/1.0-gt2-2.6/src/skrueger/geotools/selection/StyledLayerSelectionModelSynchronizer.java
Log:
EIn x/y dreher in der BBOX wenn man in die karte clickte
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-10-23 12:57:15 UTC (rev 491)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JMapPane.java 2009-10-23 13:49:49 UTC (rev 492)
@@ -708,9 +708,9 @@
try {
mapAreaNew = layer.getFeatureSource().getBounds();
} catch (java.lang.IllegalArgumentException e) {
- LOGGER.error("Can't calc layers bounds...",e);
+ LOGGER.error("Can't calc layers bounds...", e);
mapAreaNew = null;
-
+
/**
*
23.10.2009 11:20:50
@@ -1055,8 +1055,10 @@
return;
// keine wirkliche Selektion, sondern nur ein Klick
- if (ox == px || oy == py)
+ if (ox == px || oy == py) {
+ // TODO perform dist withing filter
return;
+ }
// Fenster-Koordinaten in Map-Koordinaten umwandeln
Envelope env = tranformWindowToGeo(ox, oy, px, py);
@@ -1103,8 +1105,9 @@
// Fenster-Koordinaten zu Karten-Koordinaten transformieren
final AffineTransform transform2 = getTransform();
- if (transform2 == null){
- LOGGER.warn("No transform can be created! Skipping MouseWheel performAction.");
+ if (transform2 == null) {
+ LOGGER
+ .warn("No transform can be created! Skipping MouseWheel performAction.");
return;
}
Point2D mapCoord = transform2.transform(e.getPoint(), null);
@@ -1326,7 +1329,7 @@
// state, envelope);
final Envelope smallBox = new Envelope(geoCoord.getX() - dist,
- geoCoord.getY() - dist, geoCoord.getX() + dist,
+ geoCoord.getX() - dist, geoCoord.getY() + dist,
geoCoord.getY() + dist);
Hashtable<MapLayer, FeatureCollection<SimpleFeatureType, SimpleFeature>> result = findVisibleFeatures(
@@ -1354,30 +1357,36 @@
Double nearestDist = 0.0;
Iterator<SimpleFeature> fcIt = fc.iterator();
- while (fcIt.hasNext()) {
- SimpleFeature f = fcIt.next();
- Object obj = f.getAttribute(0);
+ try {
- if (obj instanceof Geometry) {
- // Bei Punkten ja noch ganz einfach:
- Geometry featureGeometry = (Geometry) obj;
- double distance = featureGeometry
- .distance(mousePoint);
+ while (fcIt.hasNext()) {
+ SimpleFeature f = fcIt.next();
+ Object obj = f.getAttribute(0);
- if ((nearestFeature == null)
- || (distance < nearestDist)) {
- nearestFeature = f;
- nearestDist = distance;
+ if (obj instanceof Geometry) {
+ // Bei Punkten ja noch ganz einfach:
+ Geometry featureGeometry = (Geometry) obj;
+ double distance = featureGeometry
+ .distance(mousePoint);
+
+ if ((nearestFeature == null)
+ || (distance < nearestDist)) {
+ nearestFeature = f;
+ nearestDist = distance;
+ }
+ } else {
+ LOGGER
+ .info("!obj instanceof Geometry obj = "
+ + obj
+ .getClass()
+ .getSimpleName());
}
- } else {
- LOGGER
- .info("!obj instanceof Geometry obj = "
- + obj.getClass()
- .getSimpleName());
+
}
-
+
+ } finally {
+ fc.close(fcIt);
}
- fc.close(fcIt);
fcOne = new MemoryFeatureCollection(fc.getSchema());
fc.clear();
@@ -1635,8 +1644,9 @@
MapLayer layer = layerList[i];
if (!layer.isVisible())
continue;
-
- // This should never happen, because the check should be performed earlier already
+
+ // 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!");
@@ -1677,7 +1687,7 @@
Filter filter = distancefilter;
if (layer.getQuery() != null) {
final Filter layerFilter = layer.getQuery().getFilter();
- if (layerFilter != null) {
+ if (layerFilter != null && !layerFilter.equals(Filter.INCLUDE)) {
filter = distancefilter.and(layerFilter);
}
}
@@ -1856,7 +1866,7 @@
for (final Enumeration<MapLayer> e = result.keys(); e.hasMoreElements();) {
final MapLayer layer = e.nextElement();
-
+
final FeatureCollection<SimpleFeatureType, SimpleFeature> fc = result
.get(layer);
if (fc != null && !fc.isEmpty())
Modified: branches/1.0-gt2-2.6/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java
===================================================================
--- branches/1.0-gt2-2.6/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java 2009-10-23 12:57:15 UTC (rev 491)
+++ branches/1.0-gt2-2.6/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java 2009-10-23 13:49:49 UTC (rev 492)
@@ -381,12 +381,12 @@
if (e.getSourceObject() != this.mapPane)
return;
- FeatureSelectedEvent fse = (FeatureSelectedEvent) e;
/**
* Checking, that the FeatureSelectedEvent actually contains features
* from this layer
*/
+ FeatureSelectedEvent fse = (FeatureSelectedEvent) e;
final String sourceID = fse.getSourceLayer().getTitle();
final String syncForID = mapLayer.getTitle();
if (sourceID != null && syncForID != null
Modified: branches/1.0-gt2-2.6/src/skrueger/geotools/selection/StyledLayerSelectionModelSynchronizer.java
===================================================================
--- branches/1.0-gt2-2.6/src/skrueger/geotools/selection/StyledLayerSelectionModelSynchronizer.java 2009-10-23 12:57:15 UTC (rev 491)
+++ branches/1.0-gt2-2.6/src/skrueger/geotools/selection/StyledLayerSelectionModelSynchronizer.java 2009-10-23 13:49:49 UTC (rev 492)
@@ -62,7 +62,7 @@
/**
* Allows to enable/disable the Synchronizer's functionality it.
*/
- private boolean enabled = true;
+ private volatile boolean enabled = true;
/**
* Creates a new synchronizer
@@ -83,6 +83,11 @@
* <code>true</code> or <code>false</code>
*/
public void setEnabled(boolean enabled) {
+ if (enabled == false && this.enabled==true) {
+ LOGGER.debug("disabling the synchronizer map -> ");
+ } else if (enabled == true && this.enabled==false) {
+ LOGGER.debug("enable the synchronizer map -> ");
+ }
this.enabled = enabled;
}
More information about the Schmitzm-commits
mailing list