[Schmitzm-commits] r48 - in trunk/src: schmitzm/geotools/gui schmitzm/geotools/gui/resource/icons skrueger/geotools

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Apr 17 14:49:33 CEST 2009


Author: alfonx
Date: 2009-04-17 14:49:33 +0200 (Fri, 17 Apr 2009)
New Revision: 48

Added:
   trunk/src/schmitzm/geotools/gui/SelectableFeatureTablePane.java
   trunk/src/schmitzm/geotools/gui/resource/icons/mActionInvertSelection.png
   trunk/src/schmitzm/geotools/gui/resource/icons/mActionSelectedToTop.png
   trunk/src/schmitzm/geotools/gui/resource/icons/mActionUnselectAttributes.png
   trunk/src/schmitzm/geotools/gui/resource/icons/mActionZoomToSelected.png
Modified:
   trunk/src/skrueger/geotools/MapPaneToolBar.java
   trunk/src/skrueger/geotools/MapView.java
Log:


Added: trunk/src/schmitzm/geotools/gui/SelectableFeatureTablePane.java
===================================================================
--- trunk/src/schmitzm/geotools/gui/SelectableFeatureTablePane.java	2009-04-17 12:28:50 UTC (rev 47)
+++ trunk/src/schmitzm/geotools/gui/SelectableFeatureTablePane.java	2009-04-17 12:49:33 UTC (rev 48)
@@ -0,0 +1,54 @@
+package schmitzm.geotools.gui;
+
+import javax.swing.ImageIcon;
+
+import org.geotools.feature.FeatureCollection;
+
+/**
+ * Extends the {@link FeatureTablePane} with buttons and functionality to select
+ * lines
+ * 
+ * @author stefan
+ * 
+ */
+public class SelectableFeatureTablePane extends FeatureTablePane {
+
+	public static final ImageIcon ICON_SELECTION_INVERT = new ImageIcon(
+			JEditorPane.class
+					.getResource("resource/icons/mActionInvertSelection.png.png"));
+	public static final ImageIcon ICON_SELECTED_TO_TOP = new ImageIcon(
+			JEditorPane.class
+					.getResource("resource/icons/mActionInvertSelectedToTop.png"));
+	public static final ImageIcon ICON_UNSELECT = new ImageIcon(
+			JEditorPane.class
+					.getResource("resource/icons/mActionUnselectAttributes.png"));
+	public static final ImageIcon ICON_ZOMM_To_SELECTED = new ImageIcon(
+			JEditorPane.class
+					.getResource("resource/icons/mActionZoomToSelected.png"));
+
+	public SelectableFeatureTablePane(FeatureCollectionTableModel model,
+			boolean geomPreview) {
+		super(model, geomPreview);
+	}
+
+	@Override
+	protected void initGUI(boolean geomPreview) {
+		super.initGUI(geomPreview);
+		
+	}
+	
+
+	/**
+	 * Zeigt die aktuell in der Tabelle selektierten Features im Preview-Bereich
+	 * an.
+	 */
+	@Override
+	protected void performListSelection() {
+		FeatureCollection subCollection = getSelectedFeatures();
+		// Wenn keine Auswahl getaetigt ist, alle Features anzeigen
+		if (subCollection == null || subCollection.isEmpty())
+			subCollection = getFeatureCollection();
+		showFeaturesInMap(subCollection);
+	}
+
+}


Property changes on: trunk/src/schmitzm/geotools/gui/SelectableFeatureTablePane.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: trunk/src/schmitzm/geotools/gui/resource/icons/mActionInvertSelection.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/schmitzm/geotools/gui/resource/icons/mActionInvertSelection.png
___________________________________________________________________
Name: svn:mime-type
   + image/png

Added: trunk/src/schmitzm/geotools/gui/resource/icons/mActionSelectedToTop.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/schmitzm/geotools/gui/resource/icons/mActionSelectedToTop.png
___________________________________________________________________
Name: svn:mime-type
   + image/png

Added: trunk/src/schmitzm/geotools/gui/resource/icons/mActionUnselectAttributes.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/schmitzm/geotools/gui/resource/icons/mActionUnselectAttributes.png
___________________________________________________________________
Name: svn:mime-type
   + image/png

Added: trunk/src/schmitzm/geotools/gui/resource/icons/mActionZoomToSelected.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/schmitzm/geotools/gui/resource/icons/mActionZoomToSelected.png
___________________________________________________________________
Name: svn:mime-type
   + image/png

Modified: trunk/src/skrueger/geotools/MapPaneToolBar.java
===================================================================
--- trunk/src/skrueger/geotools/MapPaneToolBar.java	2009-04-17 12:28:50 UTC (rev 47)
+++ trunk/src/skrueger/geotools/MapPaneToolBar.java	2009-04-17 12:49:33 UTC (rev 48)
@@ -1,39 +1,26 @@
 package skrueger.geotools;
 
-import java.awt.BorderLayout;
 import java.awt.Dimension;
-import java.awt.Window;
 import java.awt.event.ActionEvent;
 import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.Map;
 import java.util.SortedMap;
 import java.util.TreeMap;
 
 import javax.swing.AbstractAction;
 import javax.swing.AbstractButton;
-import javax.swing.Action;
 import javax.swing.BorderFactory;
 import javax.swing.Icon;
 import javax.swing.ImageIcon;
 import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JSplitPane;
 import javax.swing.JToggleButton;
 import javax.swing.JToolBar;
 
 import org.apache.log4j.Logger;
 
-import schmitzm.geotools.gui.GeoMapPane;
 import schmitzm.geotools.gui.JMapPane;
-import schmitzm.geotools.gui.MapContextControlPane;
-import schmitzm.geotools.gui.MapPaneStatusBar;
 import schmitzm.geotools.map.event.JMapPaneEvent;
 import schmitzm.geotools.map.event.JMapPaneListener;
 import schmitzm.geotools.map.event.MapAreaChangedEvent;
-import schmitzm.geotools.styling.ColorMapManager;
 import schmitzm.swing.ButtonGroup;
 import schmitzm.swing.SwingUtil;
 
@@ -68,6 +55,8 @@
     public static final int ACTION_ZOOM_BACK = 100;
     /** Constant for the action "Zoom forward" (110). */
     public static final int ACTION_ZOOM_FORWARD = 110;
+    /** Constant for the action "Search Labels" (120). */
+    public static final int ACTION_SEARCH = 120;
 
     /** Holds the action buttons of the bar. */
     protected SortedMap<Integer, JButton> actionButtons = null;
@@ -236,6 +225,7 @@
           new ImageIcon(MapView.class.getResource("zoom_forward.png"))
       ), false);
       setButtonEnabled( ACTION_ZOOM_FORWARD, false );
+
     }
     
     /**
@@ -621,7 +611,7 @@
         this.id      = id;
         this.toolBar = toolBar;
       }
-
+      
       /**
        * Calls {@link MapPaneToolBar#performToolButton(int, ActionEvent)}
        * or {@link MapPaneToolBar#performActionButton(int, ActionEvent)}

Modified: trunk/src/skrueger/geotools/MapView.java
===================================================================
--- trunk/src/skrueger/geotools/MapView.java	2009-04-17 12:28:50 UTC (rev 47)
+++ trunk/src/skrueger/geotools/MapView.java	2009-04-17 12:49:33 UTC (rev 48)
@@ -1,23 +1,11 @@
 package skrueger.geotools;
 
 import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Window;
-import java.awt.event.ActionEvent;
-import java.util.ArrayList;
-import java.util.LinkedList;
 
-import javax.swing.AbstractAction;
 import javax.swing.BorderFactory;
-import javax.swing.ButtonGroup;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
 import javax.swing.JComponent;
-import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.JSplitPane;
-import javax.swing.JToggleButton;
-import javax.swing.JToolBar;
 
 import org.apache.log4j.Logger;
 
@@ -25,14 +13,9 @@
 import schmitzm.geotools.gui.JMapPane;
 import schmitzm.geotools.gui.MapContextControlPane;
 import schmitzm.geotools.gui.MapPaneStatusBar;
-import schmitzm.geotools.map.event.JMapPaneEvent;
-import schmitzm.geotools.map.event.JMapPaneListener;
-import schmitzm.geotools.map.event.MapAreaChangedEvent;
 import schmitzm.geotools.styling.ColorMapManager;
 import schmitzm.swing.SwingUtil;
 
-import com.vividsolutions.jts.geom.Envelope;
-
 /**
  * Achtung! Dieser code ist verwuestet
  */
@@ -54,12 +37,6 @@
 	 */
 	protected final GeoMapPane geoMapPane = new GeoMapPane();
 
-//
-//	/** This is the layered Pane that holds the buttons and maybe the flying logo * */
-//	protected JLayeredPane layeredPane;
-
-	protected boolean zoomBackForwardButtonInAction;
-
 	private MapPaneToolBar jToolBar;
 
 	/**
@@ -67,12 +44,12 @@
 	 * {@link GeoMapPane}, a {@link MapContextManagerInterface} on the left,
 	 * and some buttons floating over the {@link JMapPane}
 	 */
-	public MapView(Window owner2, MapPaneToolBar toolBar) {
+	public MapView(MapPaneToolBar toolBar) {
 		super(new BorderLayout());
 		// Call initialize() by yourself afterwards.
 		// Needed because variables for the overwritten methods
 		// are not yet set.
-		getGeoMapPane().getMapPane().setWaitCursorComponent(owner2);
+		getGeoMapPane().getMapPane().setWaitCursorComponent(SwingUtil.getParentWindow(this));
 		if ( toolBar == null )
 		  toolBar = new MapPaneToolBar(getMapPane());
 		jToolBar = toolBar; 
@@ -83,39 +60,10 @@
      * {@link GeoMapPane}, a {@link MapContextManagerInterface} on the left,
      * and some buttons floating over the {@link JMapPane}
      */
-    public MapView(Window owner2) {
-      this(owner2, null);
+    public MapView() {
+      this(null);
     }
 
-    // /**
-	// * Nuetzlich wenn die Componente gedruckt wird. Dann wird der Hintergrund
-	// auf {@link Color#WHITE} gesetzt.zoomoutToggleButton
-	// *
-	// * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
-	// Kr&uuml;ger</a>
-	// */
-	// @Override
-	// public void print(Graphics g) {
-	//		
-	// // SK: Ich habe keine Ahnung mehr, was das soll... Ich habs mal
-	// auskommentiert.
-	//
-	// // wrap in try/finally so that we always restore the state
-	// try {
-	// panToggleButton.setVisible(false);
-	// zoominToggleButton.setVisible(false);
-	// zoomoutToggleButton.setVisible(false);
-	// infoToggleButton.setVisible(false);
-	//
-	// super.print(g);
-	// } finally {
-	// panToggleButton.setVisible(true);
-	// zoominToggleButton.setVisible(true);
-	// zoomoutToggleButton.setVisible(true);
-	// infoToggleButton.setVisible(true);
-	// }
-	// }
-
 	/**
 	 * Calls #getSidePanel() which can be overwritten.
 	 * 
@@ -146,28 +94,6 @@
 		newRight.add(getGeoMapPane(), BorderLayout.CENTER);
 		splitPane.add(newRight);
 
-		// gpSize = new Dimension(40,50);
-		// getGeoMapPane().setSize(gpSize);
-
-		// layeredPane = new JLayeredPane();
-		// layeredPane.add(getGeoMapPane(), JLayeredPane.DEFAULT_LAYER);
-		// createMapButtons(layeredPane);
-
-		// //****************************************************************************
-		// // The JLayeredPane doesn't manage the size of its layers.. we do it
-		// // This listener will actually correct the size of the JLayeredPane
-		// //****************************************************************************
-		// splitPane.addPropertyChangeListener(new PropertyChangeListener() {
-		//
-		// public void propertyChange(final PropertyChangeEvent evt) {
-		// final JSplitPane sp = (JSplitPane) evt.getSource();
-		//
-		// adjustSizeOfGeoMapPane();
-		//
-		// }
-		//
-		// });
-
 		this.add(splitPane, BorderLayout.CENTER);
 	}
 
@@ -186,107 +112,7 @@
 		return this.splitPane;
 	}
 
-	//
-	// /**
-	// * Called by the listerner. Calculates the exact size of the {@link
-	// GeoMapPane} and sets it.
-	// */
-	// private void adjustSizeOfGeoMapPane() {
-	// final int newWidth = (int) (splitPane.getSize().getWidth()
-	// - splitPane.getComponent(1).getSize().getWidth()
-	// - splitPane.getComponent(0).getSize().getWidth())
-	// - 4;
-	// final int newHeight = (int) splitPane.getComponent(1).getSize()
-	// .getHeight();
-	//
-	// if (newWidth <= 20 )
-	// return;
-	//
-	// gpSize.setSize(newWidth, newHeight);
-	//
-	// getGeoMapPane().getMapPane().setWaitCursorDuringNextRepaint(true);
-	//
-	// getGeoMapPane().setSize( gpSize );
-	// // getGeoMapPane().refreshMap(); nicht nötig .. schön
-	//
-	// positionLayeredObjects();
-	// }
-//
-//	/**
-//	 * Adds the floating Map Contol Buttons to the {@link JLayeredPane}, with Z =
-//	 * 10
-//	 * 
-//	 * @param lp
-//	 *            {@link JLayeredPane} that contains the {@link GeoMapPane}
-//	 */
-//	private void createMapButtons(final JLayeredPane lp) {
-//
-//		final Integer zlayer = new Integer(10);
-//
-//		toggleButtonsList = new LinkedList<JToggleButton>();
-//		toggleButtonsList.add(infoToggleButton);
-//		toggleButtonsList.add(panToggleButton);
-//		toggleButtonsList.add(zoominToggleButton);
-//		toggleButtonsList.add(zoomoutToggleButton);
-//
-//
-//		positionLayeredObjects();
-//
-//		final ButtonGroup bg = new ButtonGroup();
-//		for (final JToggleButton b : toggleButtonsList) {
-//			// final FontMetrics fm = b.getFontMetrics( b.getFont() );
-//			// final int w = fm.stringWidth( b.getText() );
-//
-//			// b.setBorder( BorderFactory.createRaisedBevelBorder() );
-//			b.setBorder(BorderFactory.createEmptyBorder());
-//			b.setSize(new Dimension(32, 32));
-//			bg.add(b);
-//			lp.add(b, zlayer);
-//		}
-//
-//		zoomBackButton.setSize(32, 32);
-//		zoomBackButton.setBorder(BorderFactory.createEmptyBorder());
-//		lp.add(zoomBackButton, zlayer);
-//
-//		zoomForwardButton.setSize(32, 32);
-//		zoomForwardButton.setBorder(BorderFactory.createEmptyBorder());
-//		lp.add(zoomForwardButton, zlayer);
-//	}
 
-//	/**
-//	 * This method will update the
-//	 */
-//	public void updateIconsForButtons() {
-//		if (zoomoutToggleButton.isSelected())
-//			zoomoutToggleButton.setIcon(new ImageIcon(MapView.class
-//					.getResource("zoom_out.png")));
-//		else
-//			zoomoutToggleButton.setIcon(new ImageIcon(MapView.class
-//					.getResource("zoom_out.png")));
-//
-//		if (zoominToggleButton.isSelected())
-//			zoominToggleButton.setIcon(new ImageIcon(MapView.class
-//					.getResource("zoom_in.png")));
-//		else
-//			zoominToggleButton.setIcon(new ImageIcon(MapView.class
-//					.getResource("zoom_in.png")));
-//
-//		if (infoToggleButton.isSelected())
-//			infoToggleButton.setIcon(new ImageIcon(MapView.class
-//					.getResource("info.png")));
-//		else
-//			infoToggleButton.setIcon(new ImageIcon(MapView.class
-//					.getResource("info_aus.png")));
-//
-//		if (panToggleButton.isSelected())
-//			panToggleButton.setIcon(new ImageIcon(MapView.class
-//					.getResource("pan.png")));
-//		else
-//			panToggleButton.setIcon(new ImageIcon(MapView.class
-//					.getResource("pan_aus.png")));
-//
-//	}
-
 	/**
 	 * Sets the active tool.
 	 * Simply calls {@link MapPaneToolBar#setSelectedTool(Integer)}.
@@ -329,36 +155,6 @@
 	public boolean isToolEnabled(Integer tool) {
 	  return jToolBar.isButtonEnabled(tool);
 	}
-//
-//	/**
-//	 * Positions the Map Control Buttons on top of the {@link GeoMapPane}
-//	 * 
-//	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons Kr&uuml;ger</a>
-//	 * 
-//	 */
-//	protected void positionLayeredObjects() {
-//
-//		// Abstand zwischen den Buttons und Button zu Rand
-//		final int gap = 10;
-//
-//		// 45 entspicht der breite des Grids/ der Gradanzeige
-//		// TODO den wert aus der geomappane auslesen...
-//		int x = GridPanel.VERT_WIDTH;
-//
-//		for (final JToggleButton b : toggleButtonsList) {
-//			x += gap;
-//			// final FontMetrics fm = b.getFontMetrics( b.getFont() );
-//			b.setLocation(x, 10);
-//
-//			final int w = 32;
-//			x += w;
-//			// y += b.getWidth();
-//		}
-//
-//		// Und noch die zwei ZoomBackup und ZoomForward Buttons
-//		zoomBackButton.setLocation(x + 32 + gap, 10);
-//		zoomForwardButton.setLocation(x + 64 + gap * 2, 10);
-//	}
 
 	/**
 	 * called by initialize() to fill the left of the XULUMapView Supposed to be
@@ -384,17 +180,6 @@
 		return getGeoMapPane().getMapPane();
 	}
 
-	// /**
-	// * Liefert das in einem Layer dargestellte Objekt.
-	// *
-	// * @param layer
-	// * ein Layer
-	// */
-	// public Object getMapObject(final MapLayer layer) {
-	// // return layerObjects.get(layer);
-	// return null;
-	// }
-
 	public GeoMapPane getGeoMapPane() {
 		return geoMapPane;
 	}



More information about the Schmitzm-commits mailing list