[Schmitzm-commits] r472 - in branches/1.0-gt2-2.6/src: schmitzm/geotools schmitzm/geotools/gui skrueger
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Oct 15 00:48:51 CEST 2009
Author: alfonx
Date: 2009-10-15 00:48:50 +0200 (Thu, 15 Oct 2009)
New Revision: 472
Modified:
branches/1.0-gt2-2.6/src/schmitzm/geotools/JTSUtil.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/GridPanel.java
branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JMapPane.java
branches/1.0-gt2-2.6/src/skrueger/AttributeMetadata.java
Log:
* AS-Feature: Added Double-Labeling to AtlasStyler
* AV-BugFix: Clicking points didn't work in GT2.6 and JMapPane because the dWithin filter broke?!
// This is a tweak. The NearPointFilterGenerator doesn't work
// any more in GT2.6... So we use a small BBOX.
// Well, it's not the
// NearPointFilterGenerator, but GeoTools that fails. I already
// invested 3h in this... I guess the bug is in
// ExtractBoundsFilterVisitor.visit(ProperyName) retuning null.
// It should return the BBOX of value the named property.
// Hashtable<MapLayer, FeatureCollection<SimpleFeatureType,
// SimpleFeature>> result = findVisibleFeatures(
// new NearPointFilterGenerator(geoCoord, dist,
// getContext().getCoordinateReferenceSystem()),
// state, envelope);
final Envelope smallBox = new Envelope(geoCoord.getX() - dist,
geoCoord.getY() -dist, geoCoord.getX()+dist, geoCoord.getY()+dist);
Hashtable<MapLayer, FeatureCollection<SimpleFeatureType, SimpleFeature>> result = findVisibleFeatures(
new BoundingBoxFilterGenerator(smallBox, getContext()
.getCoordinateReferenceSystem()), state,
envelope);
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/JTSUtil.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/JTSUtil.java 2009-10-14 16:44:02 UTC (rev 471)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/JTSUtil.java 2009-10-14 22:48:50 UTC (rev 472)
@@ -115,7 +115,7 @@
Coordinate destCoord = null;
MathTransform transform;
try {
- transform = CRS.findMathTransform(sourceCRS, destCRS);
+ transform = CRS.findMathTransform(sourceCRS, destCRS, true);
destCoord = JTS.transform(sourceCoord,null,transform);
} catch (FactoryException e) {
LOGGER.warn("CRS tranformation for JTS coordinate not successful",e);
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/GridPanel.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/GridPanel.java 2009-10-14 16:44:02 UTC (rev 471)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/GridPanel.java 2009-10-14 22:48:50 UTC (rev 472)
@@ -255,8 +255,8 @@
// Der Effizienz halber, die Transformation nur neu ermitteln
// wenn sich das Karten-CRS geaendert hat
if ( mapToGrid == null || gridToMap == null || transformedMapCRS == null || !transformedMapCRS.equals(mapCRS) ) {
- mapToGrid = CRS.findMathTransform(mapCRS, gridCRS);
- gridToMap = CRS.findMathTransform(gridCRS, mapCRS);
+ mapToGrid = CRS.findMathTransform(mapCRS, gridCRS, true);
+ gridToMap = CRS.findMathTransform(gridCRS, mapCRS, true);
// CRS merken, fuer das Transformation erstellt wurde
transformedMapCRS = mapCRS;
}
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-14 16:44:02 UTC (rev 471)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JMapPane.java 2009-10-14 22:48:50 UTC (rev 472)
@@ -308,7 +308,7 @@
}
};
- private static final FilterFactory ff = FilterUtil.FILTER_FAC;
+ private static final FilterFactory ff = FilterUtil.FILTER_FAC2;
/**
* A flag indicating if dispose() was already called. If true, then further
@@ -1258,15 +1258,33 @@
final Point2D geoCoordAtDistance = getTransform().transform(
pAtDistance, null);
final Double dist = Math.abs(geoCoordAtDistance.getX()
- - geoCoord.getX());
+ - geoCoord.getX()) / 2;
final Envelope envelope = new Envelope(geoCoord.getX(),
- geoCoord.getX(), geoCoord.getY(), geoCoord.getY());
+ geoCoord.getY(), geoCoord.getX(), geoCoord.getY());
+ //
+ // This is a tweak. The NearPointFilterGenerator doesn't work
+ // any more in GT2.6... So we use a small BBOX.
+ // Well, it's not the
+ // NearPointFilterGenerator, but GeoTools that fails. I already
+ // invested 3h in this... I guess the bug is in
+ // ExtractBoundsFilterVisitor.visit(ProperyName) retuning null.
+ // It should return the BBOX of value the named property.
+
+ // Hashtable<MapLayer, FeatureCollection<SimpleFeatureType,
+ // SimpleFeature>> result = findVisibleFeatures(
+ // new NearPointFilterGenerator(geoCoord, dist,
+ // getContext().getCoordinateReferenceSystem()),
+ // state, envelope);
+
+ final Envelope smallBox = new Envelope(geoCoord.getX() - dist,
+ geoCoord.getY() -dist, geoCoord.getX()+dist, geoCoord.getY()+dist);
+
Hashtable<MapLayer, FeatureCollection<SimpleFeatureType, SimpleFeature>> result = findVisibleFeatures(
- new NearPointFilterGenerator(geoCoord, dist,
- getContext().getCoordinateReferenceSystem()),
- state, envelope);
+ new BoundingBoxFilterGenerator(smallBox, getContext()
+ .getCoordinateReferenceSystem()), state,
+ envelope);
boolean featuresFound = false;
// Events ausloesen fuer jedes Layer
@@ -2674,11 +2692,11 @@
final Geometry geometry = FilterUtil.GEOMETRY_FAC
.createPoint(nearPoint);
- final DWithinImpl dwithinFilter = (DWithinImpl) FilterUtil.FILTER_FAC
- .createGeometryDistanceFilter(DWithinImpl.GEOMETRY_DWITHIN);
+ final DWithinImpl dwithinFilter = new DWithinImpl(
+ FilterUtil.FILTER_FAC2, null, null);
dwithinFilter.setDistance(nearDist);
- dwithinFilter.setExpression2(FilterUtil.FILTER_FAC
- .createLiteralExpression(geometry));
+ dwithinFilter.setExpression2(FilterUtil.FILTER_FAC2
+ .literal(geometry));
return dwithinFilter;
}
Modified: branches/1.0-gt2-2.6/src/skrueger/AttributeMetadata.java
===================================================================
--- branches/1.0-gt2-2.6/src/skrueger/AttributeMetadata.java 2009-10-14 16:44:02 UTC (rev 471)
+++ branches/1.0-gt2-2.6/src/skrueger/AttributeMetadata.java 2009-10-14 22:48:50 UTC (rev 472)
@@ -77,10 +77,13 @@
this.setName(name);
this.title = title;
this.desc = desc;
-
+
// The THE_GEOM and shall never be visible!
- if (name.getLocalPart().equalsIgnoreCase("the_geom")) this.visible = false;
-
+ if (name.getLocalPart().equalsIgnoreCase("the_geom"))
+ this.visible = false;
+ else
+ this.visible = visible;
+
this.unit = unit;
}
@@ -147,12 +150,13 @@
public void setVisible(final Boolean visible) {
this.visible = visible;
}
-//
-// /** @return the index of this attribute in the underlying table/dbf **/
-// public int getColIdx() {
-// return colIdx;
-// }
+ //
+ // /** @return the index of this attribute in the underlying table/dbf **/
+ // public int getColIdx() {
+ // return colIdx;
+ // }
+
public Translation getTitle() {
return title;
}
@@ -183,14 +187,15 @@
getDesc().copyTo(amd.getDesc());
amd.setUnit(getUnit());
amd.setVisible(isVisible());
- amd.setName(new NameImpl(getName().getNamespaceURI(), getName().getLocalPart()));
+ amd.setName(new NameImpl(getName().getNamespaceURI(), getName()
+ .getLocalPart()));
return amd;
}
@Override
public AttributeMetadata copy() {
- return copyTo( new AttributeMetadata());
+ return copyTo(new AttributeMetadata());
}
/**
More information about the Schmitzm-commits
mailing list