[Schmitzm-commits] r153 - in trunk/src: junit/skrueger/i8n org/geotools/gui/swing schmitzm/geotools/feature schmitzm/geotools/gui schmitzm/geotools/styling schmitzm/jfree/chart schmitzm/jfree/chart/renderer schmitzm/jfree/chart/selection schmitzm/jfree/feature schmitzm/swing skrueger/geotools skrueger/geotools/labelsearch
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Sat Jun 20 14:48:26 CEST 2009
Author: alfonx
Date: 2009-06-20 14:48:24 +0200 (Sat, 20 Jun 2009)
New Revision: 153
Modified:
trunk/src/junit/skrueger/i8n/SwitchLanguageDialogTest.java
trunk/src/org/geotools/gui/swing/JMapPane.java
trunk/src/schmitzm/geotools/feature/FeatureUtil.java
trunk/src/schmitzm/geotools/gui/JMapPane.java
trunk/src/schmitzm/geotools/styling/StylingUtil.java
trunk/src/schmitzm/jfree/chart/SelectableChartPanel.java
trunk/src/schmitzm/jfree/chart/renderer/SelectionRenderer.java
trunk/src/schmitzm/jfree/chart/selection/AbstractDatasetSelectionModel.java
trunk/src/schmitzm/jfree/chart/selection/DatasetSelectionModel.java
trunk/src/schmitzm/jfree/feature/Feature2SeriesDatasetMapping.java
trunk/src/schmitzm/swing/SwingUtil.java
trunk/src/skrueger/geotools/MapView.java
trunk/src/skrueger/geotools/labelsearch/LabelSearch.java
trunk/src/skrueger/geotools/labelsearch/SearchMapDialog.java
trunk/src/skrueger/geotools/labelsearch/SearchResultFeature.java
trunk/src/skrueger/geotools/labelsearch/SearchResultTableModel.java
Log:
* Organized Imports
* Fixed a BuG in AS, PolygonSymbolEditGUI (Had to be Float instead of Double)
* Renamed DesignLayerPanel to DesginMapLegend etc...
* Bugfixed ManageLayerSytlesForMapDialog to trigger a preview of the new legend.
Modified: trunk/src/junit/skrueger/i8n/SwitchLanguageDialogTest.java
===================================================================
--- trunk/src/junit/skrueger/i8n/SwitchLanguageDialogTest.java 2009-06-19 18:13:35 UTC (rev 152)
+++ trunk/src/junit/skrueger/i8n/SwitchLanguageDialogTest.java 2009-06-20 12:48:24 UTC (rev 153)
@@ -2,10 +2,11 @@
import java.util.ArrayList;
+import junit.framework.TestCase;
+
import org.junit.Test;
import skrueger.i8n.SwitchLanguageDialog;
-import junit.framework.TestCase;
public class SwitchLanguageDialogTest extends TestCase {
@Test
Modified: trunk/src/org/geotools/gui/swing/JMapPane.java
===================================================================
--- trunk/src/org/geotools/gui/swing/JMapPane.java 2009-06-19 18:13:35 UTC (rev 152)
+++ trunk/src/org/geotools/gui/swing/JMapPane.java 2009-06-20 12:48:24 UTC (rev 153)
@@ -43,7 +43,6 @@
import java.awt.Graphics2D;
import java.awt.LayoutManager;
import java.awt.Rectangle;
-import java.awt.RenderingHints;
import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
@@ -57,7 +56,6 @@
import java.util.Map;
import javax.swing.JPanel;
-import javax.swing.LookAndFeel;
import org.apache.log4j.Logger;
import org.geotools.feature.FeatureCollection;
@@ -99,9 +97,7 @@
MouseMotionListener, HighlightChangeListener, SelectionChangeListener,
PropertyChangeListener, MapLayerListListener {
private static Logger LOGGER = Logger.getLogger(JMapPane.class.getName());
- /**
- *
- */
+
private static final long serialVersionUID = -8647971481359690499L;
public static final int Reset = 0;
@@ -687,7 +683,7 @@
try {
String name = layer.getFeatureSource().getSchema()
- .getDefaultGeometry().getName();
+ .getDefaultGeometry().getLocalName();
if (name == "") {
name = "the_geom";
@@ -696,7 +692,7 @@
try {
f = ff.contains(ff.property(name), ff.literal(geometry));
if (selectionManager != null) {
- System.out.println("selection changed");
+// System.out.println("selection changed");
selectionManager.selectionChanged(this, f);
}
Modified: trunk/src/schmitzm/geotools/feature/FeatureUtil.java
===================================================================
--- trunk/src/schmitzm/geotools/feature/FeatureUtil.java 2009-06-19 18:13:35 UTC (rev 152)
+++ trunk/src/schmitzm/geotools/feature/FeatureUtil.java 2009-06-20 12:48:24 UTC (rev 153)
@@ -44,7 +44,6 @@
import org.geotools.feature.SchemaException;
import org.geotools.feature.type.GeometricAttributeType;
import org.geotools.filter.FilterFactory;
-import org.geotools.filter.FilterFactoryImpl;
import org.geotools.map.MapLayer;
import org.geotools.styling.Graphic;
import org.geotools.styling.Mark;
Modified: trunk/src/schmitzm/geotools/gui/JMapPane.java
===================================================================
--- trunk/src/schmitzm/geotools/gui/JMapPane.java 2009-06-19 18:13:35 UTC (rev 152)
+++ trunk/src/schmitzm/geotools/gui/JMapPane.java 2009-06-20 12:48:24 UTC (rev 153)
@@ -662,7 +662,9 @@
* Krüger</a>
*/
public void zoomToLayer(int index) {
- zoomToLayer(getContext().getLayer(index));
+ final MapContext context = getContext();
+ if (context != null)
+ zoomToLayer(context.getLayer(index));
}
/**
@@ -1534,12 +1536,15 @@
if (!fc.isEmpty()) {
fc = filterSLDVisibleOnly(fc, layer.getStyle());
+
+ if (!fc.isEmpty()) {
+ result.put(layer, fc);
+ // Beim Modus "oberstes Layer selektieren" die Schleife
+ // beenden
+ if (mode == SELECT_TOP || mode == SELECT_ONE_FROM_TOP)
+ break;
+ }
- result.put(layer, fc);
- // Beim Modus "oberstes Layer selektieren" die Schleife
- // beenden
- if (mode == SELECT_TOP || mode == SELECT_ONE_FROM_TOP)
- break;
}
} catch (IOException err) {
err.printStackTrace();
@@ -1621,12 +1626,13 @@
if (!fc.isEmpty()) {
result.put(layer, fc);
// Beim Modus "oberstes Layer selektieren" die Schleife
- // beenden
+ // jetzt beenden, da wir sichtbare Features gefunden haben.
if (mode == SELECT_TOP || mode == SELECT_ONE_FROM_TOP)
break;
}
} catch (Exception err) {
err.printStackTrace();
+ LOGGER.error(err);
}
// for ( FeatureCollection fc1 : result.values() )
Modified: trunk/src/schmitzm/geotools/styling/StylingUtil.java
===================================================================
--- trunk/src/schmitzm/geotools/styling/StylingUtil.java 2009-06-19 18:13:35 UTC (rev 152)
+++ trunk/src/schmitzm/geotools/styling/StylingUtil.java 2009-06-20 12:48:24 UTC (rev 153)
@@ -24,7 +24,6 @@
import java.net.URL;
import java.nio.charset.Charset;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.SortedMap;
@@ -979,7 +978,11 @@
*
* Kommentar: "Sichtbarkeit" bezieht es nicht darauf, ob die Elemente auf
* dem Kartenausschnitt sichtbar sind, sondern um die SLD Regeln, welche das
- * Feature evt. nur Scalenabhängig zeichnen.
+ * Feature evt. nur Scalenabhängig zeichnen.<br/>
+ * SK 19.6.2009:Bei einem {@link PolygonSymbolizer} zählt nicht der Rand,
+ * sondern nur ob eine Füllung vorhanden ist! Man kann dann zwar leider
+ * nicht auf ein Rand eines Polygons ohne Fill klicken, aber dafür kann man
+ * durch die ungefüllte Fläche klicken.
*
* @param fc
* Die zu filternde FeatureCollection. Diese wird nicht
@@ -1008,24 +1011,24 @@
final Double scaleDenominator) {
// Eine im Speicher gehaltene FeatureCollection der sichtbaren
- MemoryFeatureCollection fcVisible = new MemoryFeatureCollection(fc
- .getFeatureType());
+ final MemoryFeatureCollection fcVisible = new MemoryFeatureCollection(
+ fc.getFeatureType());
// Prüfen aller Features in der Collection
- Iterator<Feature> fcIt = fc.iterator();
+ final Iterator<Feature> fcIt = fc.iterator();
try {
while (fcIt.hasNext()) {
- Feature feature = fcIt.next();
+ final Feature feature = fcIt.next();
- for (FeatureTypeStyle fts : style.getFeatureTypeStyles()) {
- List<Rule> rules = fts.rules();
+ for (final FeatureTypeStyle fts : style.getFeatureTypeStyles()) {
+ final List<Rule> rules = fts.rules();
- for (Rule rule : rules) {
- double maxScaleDenominator = rule
+ for (final Rule rule : rules) {
+ final double maxScaleDenominator = rule
.getMaxScaleDenominator();
- double minScaleDenominator = rule
+ final double minScaleDenominator = rule
.getMinScaleDenominator();
// 1. Check: Trifft die Rule auf den aktuellen Scale der
@@ -1038,7 +1041,7 @@
// 2. Check: Eine Rule ist gülrig, aber trifft der
// Filter
// für dieses Feature?
- Filter rFilter = rule.getFilter();
+ final Filter rFilter = rule.getFilter();
if ((rFilter != null) && (!rFilter.evaluate(feature)))
continue;
@@ -1049,26 +1052,33 @@
// Hansel
// gibt einen LineSymbolizer für ein PointLayer an.
boolean passt = false;
- for (Symbolizer symb : rule.getSymbolizers()) {
- Geometry geom = feature.getDefaultGeometry();
+ for (final Symbolizer symb : rule.getSymbolizers()) {
+ final Geometry geom = feature.getDefaultGeometry();
if ((geom instanceof MultiPoint)
|| (geom instanceof com.vividsolutions.jts.geom.Point)) {
if (symb instanceof PointSymbolizer) {
- passt = true;
+ if (((PointSymbolizer) symb).getGraphic() != null)
+ passt = true;
break;
}
} else if ((geom instanceof MultiLineString)
|| (geom instanceof LineString)) {
if (symb instanceof LineSymbolizer) {
- passt = true;
+ if (((LineSymbolizer) symb).getStroke() != null)
+ passt = true;
break;
}
} else if ((geom instanceof MultiPolygon)
|| (geom instanceof Polygon)) {
if (symb instanceof PolygonSymbolizer) {
- passt = true;
+ if (((PolygonSymbolizer) symb).getFill() != null)
+ passt = true;
break;
}
+ } else {
+ LOGGER
+ .warn("Unbekannter geom Typ! Gehe von sichbar aus!");
+ passt = true;
}
}
if (!passt)
@@ -1079,7 +1089,7 @@
}
}
}
- } catch (java.lang.IllegalStateException e) {
+ } catch (final java.lang.IllegalStateException e) {
LOGGER.error(e);
/**
* SK: 14.Apri 2009. It happened a few time to that fcIt.hasNext
Modified: trunk/src/schmitzm/jfree/chart/SelectableChartPanel.java
===================================================================
--- trunk/src/schmitzm/jfree/chart/SelectableChartPanel.java 2009-06-19 18:13:35 UTC (rev 152)
+++ trunk/src/schmitzm/jfree/chart/SelectableChartPanel.java 2009-06-20 12:48:24 UTC (rev 153)
@@ -15,7 +15,6 @@
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
-import java.util.Vector;
import org.apache.log4j.Logger;
import org.jfree.chart.JFreeChart;
Modified: trunk/src/schmitzm/jfree/chart/renderer/SelectionRenderer.java
===================================================================
--- trunk/src/schmitzm/jfree/chart/renderer/SelectionRenderer.java 2009-06-19 18:13:35 UTC (rev 152)
+++ trunk/src/schmitzm/jfree/chart/renderer/SelectionRenderer.java 2009-06-20 12:48:24 UTC (rev 153)
@@ -12,7 +12,6 @@
import java.awt.Paint;
-import schmitzm.jfree.chart.selection.AbstractDatasetSelectionModel;
import schmitzm.jfree.chart.selection.DatasetSelectionModel;
import schmitzm.jfree.chart.selection.DatasetSelectionModelProvider;
Modified: trunk/src/schmitzm/jfree/chart/selection/AbstractDatasetSelectionModel.java
===================================================================
--- trunk/src/schmitzm/jfree/chart/selection/AbstractDatasetSelectionModel.java 2009-06-19 18:13:35 UTC (rev 152)
+++ trunk/src/schmitzm/jfree/chart/selection/AbstractDatasetSelectionModel.java 2009-06-20 12:48:24 UTC (rev 153)
@@ -12,14 +12,11 @@
import java.util.Vector;
-import javax.swing.event.EventListenerList;
-
import org.apache.log4j.Logger;
import org.jfree.data.general.Dataset;
import org.jfree.data.general.DatasetChangeListener;
import org.jfree.data.general.SeriesDataset;
-import schmitzm.jfree.JFreeChartUtil;
import schmitzm.lang.LangUtil;
/**
Modified: trunk/src/schmitzm/jfree/chart/selection/DatasetSelectionModel.java
===================================================================
--- trunk/src/schmitzm/jfree/chart/selection/DatasetSelectionModel.java 2009-06-19 18:13:35 UTC (rev 152)
+++ trunk/src/schmitzm/jfree/chart/selection/DatasetSelectionModel.java 2009-06-20 12:48:24 UTC (rev 153)
@@ -10,14 +10,9 @@
**/
package schmitzm.jfree.chart.selection;
-import org.apache.log4j.Logger;
import org.jfree.data.general.Dataset;
import org.jfree.data.general.DatasetChangeListener;
-import org.jfree.data.general.SeriesDataset;
-import schmitzm.jfree.JFreeChartUtil;
-import skrueger.geotools.selection.StyledLayerSelectionEvent;
-
/**
* This selection model maintains whether items of a {@link Dataset} are selected
* in a chart or not. The model connects to the {@link Dataset} as {@link DatasetChangeListener}
Modified: trunk/src/schmitzm/jfree/feature/Feature2SeriesDatasetMapping.java
===================================================================
--- trunk/src/schmitzm/jfree/feature/Feature2SeriesDatasetMapping.java 2009-06-19 18:13:35 UTC (rev 152)
+++ trunk/src/schmitzm/jfree/feature/Feature2SeriesDatasetMapping.java 2009-06-20 12:48:24 UTC (rev 153)
@@ -17,7 +17,6 @@
import org.geotools.feature.Feature;
import org.geotools.feature.FeatureCollection;
import org.jfree.data.general.SeriesDataset;
-import org.jfree.data.xy.XYSeriesCollection;
/**
* This class implements the mapping between {@link SeriesDataset} items (points in chart)
Modified: trunk/src/schmitzm/swing/SwingUtil.java
===================================================================
--- trunk/src/schmitzm/swing/SwingUtil.java 2009-06-19 18:13:35 UTC (rev 152)
+++ trunk/src/schmitzm/swing/SwingUtil.java 2009-06-20 12:48:24 UTC (rev 153)
@@ -73,7 +73,7 @@
* resources.
*
* @param key
- * the key for the AtlasCreatorTranslation.properties file
+ * the key for the Geopublisher.properties file
* @param values
* optional values
*/
Modified: trunk/src/skrueger/geotools/MapView.java
===================================================================
--- trunk/src/skrueger/geotools/MapView.java 2009-06-19 18:13:35 UTC (rev 152)
+++ trunk/src/skrueger/geotools/MapView.java 2009-06-20 12:48:24 UTC (rev 153)
@@ -18,9 +18,6 @@
/**
* Achtung! Dieser code ist verwuestet
- */
-
-/**
* TODO DOKU und initialize schöner machen. SK
*/
public class MapView extends JPanel {
@@ -71,20 +68,19 @@
*/
public void initialize() {
// horizontales SplitPane initialisieren
+// SK 19.6.09: Removed because we are not using it. Probably a test.
+// // Status-Zeile
+// statusBar = new MapPaneStatusBar(getGeoMapPane()
+// .getMapPane());
+// statusBar.setBorder(BorderFactory.createCompoundBorder(BorderFactory
+// .createLoweredBevelBorder(), BorderFactory.createEmptyBorder(2,
+// 5, 2, 5)));
+// this.add(statusBar, BorderLayout.SOUTH);
- // Status-Zeile
- statusBar = new MapPaneStatusBar(getGeoMapPane()
- .getMapPane());
- statusBar.setBorder(BorderFactory.createCompoundBorder(BorderFactory
- .createLoweredBevelBorder(), BorderFactory.createEmptyBorder(2,
- 5, 2, 5)));
- this.add(statusBar, BorderLayout.SOUTH);
-
splitPane.setDividerLocation(-1);
splitPane.setDividerSize(5);
splitPane.setResizeWeight(0.0);
-
splitPane.add(getSidePane());
/***********************************************************************
@@ -95,8 +91,6 @@
newRight.add(getToolBar(), BorderLayout.NORTH);
newRight.add(getGeoMapPane(), BorderLayout.CENTER);
splitPane.add(newRight);
-
-
this.add(splitPane, BorderLayout.CENTER);
}
Modified: trunk/src/skrueger/geotools/labelsearch/LabelSearch.java
===================================================================
--- trunk/src/skrueger/geotools/labelsearch/LabelSearch.java 2009-06-19 18:13:35 UTC (rev 152)
+++ trunk/src/skrueger/geotools/labelsearch/LabelSearch.java 2009-06-20 12:48:24 UTC (rev 153)
@@ -149,13 +149,13 @@
final String labelString = value.toString().toLowerCase();
if (labelString.startsWith(searchMe)) {
hits.add(createSearchResult(f, value.toString(), ml
- .getTitle()));
+ .getTitle(),ml));
} else {
final String[] parts = labelString.trim().split(" ");
for (final String part : parts) {
if (part.startsWith(searchMe)) {
hits.add(createSearchResult(f, value.toString(), ml
- .getTitle()));
+ .getTitle(), ml));
break;
}
}
@@ -176,8 +176,8 @@
}
protected SearchResult createSearchResult(final Feature f, final String title,
- final String inTitle) {
- return new SearchResultFeature(f, title, inTitle, mapPane);
+ final String inTitle, MapLayer ml) {
+ return new SearchResultFeature(f, title, inTitle, mapPane, ml);
}
}
Modified: trunk/src/skrueger/geotools/labelsearch/SearchMapDialog.java
===================================================================
--- trunk/src/skrueger/geotools/labelsearch/SearchMapDialog.java 2009-06-19 18:13:35 UTC (rev 152)
+++ trunk/src/skrueger/geotools/labelsearch/SearchMapDialog.java 2009-06-20 12:48:24 UTC (rev 153)
@@ -32,8 +32,6 @@
import schmitzm.swing.SortableJTable;
import schmitzm.swing.SwingUtil;
-import skrueger.geotools.labelsearch.LabelSearch;
-import skrueger.geotools.labelsearch.SearchResult;
/**
* @author Stefan A. Krueger
Modified: trunk/src/skrueger/geotools/labelsearch/SearchResultFeature.java
===================================================================
--- trunk/src/skrueger/geotools/labelsearch/SearchResultFeature.java 2009-06-19 18:13:35 UTC (rev 152)
+++ trunk/src/skrueger/geotools/labelsearch/SearchResultFeature.java 2009-06-20 12:48:24 UTC (rev 153)
@@ -4,23 +4,28 @@
import org.apache.log4j.Logger;
import org.geotools.feature.Feature;
+import org.geotools.map.MapLayer;
+public class SearchResultFeature implements SearchResult {
+ final static private Logger LOGGER = Logger
+ .getLogger(SearchResultFeature.class);
-public class SearchResultFeature implements SearchResult {
- final static private Logger LOGGER = Logger.getLogger(SearchResultFeature.class);
-
private final Feature feature;
private final String title;
private final schmitzm.geotools.gui.JMapPane mapPane;
private final String inTitle;
- public SearchResultFeature(Feature feature, String title, String inTitle, schmitzm.geotools.gui.JMapPane mapPane) {
+ private final MapLayer mapLayer;
+
+ public SearchResultFeature(Feature feature, String title, String inTitle,
+ schmitzm.geotools.gui.JMapPane mapPane, MapLayer mapLayer) {
this.feature = feature;
this.title = title;
this.inTitle = inTitle;
this.mapPane = mapPane;
+ this.mapLayer = mapLayer;
}
-
+
@Override
public String toString() {
return feature.toString();
@@ -37,16 +42,21 @@
@Override
public void open() {
-
+
// GuiAndTools.checkThatWeAreOnEDT();
if (!SwingUtilities.isEventDispatchThread()) {
LOGGER.error("Not on EDT");
throw new RuntimeException("Not on EDT!");
}
-
mapPane.zoomTo(feature);
mapPane.refresh();
+
+ // TODO
+ // Mark the selected Feature using a spacial style.. similar to the
+ // selection stuff.
+ // mapLayer.getStyle().addFeatureTypeStyle( new FeatureTypeStyle());
+
}
@Override
Modified: trunk/src/skrueger/geotools/labelsearch/SearchResultTableModel.java
===================================================================
--- trunk/src/skrueger/geotools/labelsearch/SearchResultTableModel.java 2009-06-19 18:13:35 UTC (rev 152)
+++ trunk/src/skrueger/geotools/labelsearch/SearchResultTableModel.java 2009-06-20 12:48:24 UTC (rev 153)
@@ -5,8 +5,6 @@
import javax.swing.table.TableModel;
import schmitzm.swing.table.AbstractTableModel;
-import skrueger.geotools.labelsearch.SearchResult;
-import skrueger.geotools.labelsearch.SearchResultFeature;
/**
* A {@link TableModel} which presents a {@link List} of {@link SearchResult}s.
More information about the Schmitzm-commits
mailing list