[Schmitzm-commits] r417 - in branches/1.0-gt2-2.6/src: schmitzm/geotools/gui schmitzm/geotools/styling skrueger/geotools skrueger/geotools/labelsearch

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Sep 25 18:34:12 CEST 2009


Author: alfonx
Date: 2009-09-25 18:34:10 +0200 (Fri, 25 Sep 2009)
New Revision: 417

Modified:
   branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/GeoMapPane.java
   branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/GridPanel.java
   branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/ScalePane.java
   branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/ScalePanel.java
   branches/1.0-gt2-2.6/src/schmitzm/geotools/styling/StylingUtil.java
   branches/1.0-gt2-2.6/src/skrueger/geotools/MapPaneToolBar.java
   branches/1.0-gt2-2.6/src/skrueger/geotools/MapView.java
   branches/1.0-gt2-2.6/src/skrueger/geotools/labelsearch/LabelSearch.java
Log:
* AV-Feature: Search button only appears if there are labels to search in the map
* AV-Feature: "Beautified" the AtlasMapView a bit.. less lines.. smoother text rendering..


Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/GeoMapPane.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/GeoMapPane.java	2009-09-25 13:58:55 UTC (rev 416)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/GeoMapPane.java	2009-09-25 16:34:10 UTC (rev 417)
@@ -53,13 +53,12 @@
 /**
  * Das {@code GeoMapPane} erweitert das {@link JMapPane} um einen
  * Massstab-Balken, sowie ein horizontales und vertikales Koordinaten-Raster
- * (Grid), in dem die Geo-Referenz des angezeigten Karten-Bereichs in
- * Welt-Koordinaten (Grad, Minuten) dargestellt ist.
+ * (Grid), in dem die Geo-Referenz des angezeigten Karten-Bereichs angezeigt wird. 
  * 
  * @see ScalePane
  * @see GridPanel
- * @author Martin Schmitz
- * @version 1.0
+ * @author Martin Schmitz, SK
+ * @version 1.1
  */
 public class GeoMapPane extends JPanel {
 
@@ -116,6 +115,8 @@
 	 * use of this {@link GeoMapPane} is undefined.
 	 */
 	private boolean disposed = false;
+	
+	
 	private HashMap<Object, Object> defaultRendererHints;
 
 	/**
@@ -147,7 +148,7 @@
 	 */
 	public GeoMapPane(JMapPane mapPane, GridPanel vGrid, GridPanel hGrid,
 			ScalePane scalePane, GTRenderer renderer) {
-		super();
+		this.scalePane = scalePane;
 
 		if (vGrid != null && !vGrid.isVertical())
 			throw new IllegalArgumentException(
@@ -157,14 +158,14 @@
 					"GridPanel for horizontal grid must be of type GridPanel.HORIZONTAL!!");
 
 		// Karte
-		this.mapPane = (mapPane != null) ? mapPane : new JMapPane(null,null,renderer, null, getDefaultRendererHints());
+		this.mapPane = (mapPane != null) ? mapPane : new JMapPane(null,null,renderer, null, getDefaultGTRendererHints());
 		// Koordinaten-Leisten
 		this.setVertGrid((vGrid != null) ? vGrid : new GridPanel(
 				GridPanel.VERTICAL, this.mapPane));
 		this.setHorGrid((hGrid != null) ? hGrid : new GridPanel(
 				GridPanel.HORIZONTAL, this.mapPane));
+		
 		// Massstab-Balken
-		this.setScalePane((scalePane != null) ? scalePane : new ScalePane());
 
 		// Standard-Werte fuer GUI-Anordnung setzen
 		layoutConstraints.put(DLC_MAP, new GridBagConstraints(1, 0, 1, 1, 1.0,
@@ -293,6 +294,9 @@
 	public void dispose() {
 		if (isDisposed())
 			return;
+		scalePane=null;
+		horGrid=null;
+		vertGrid=null;
 		mapPane.dispose();
 		removeAll();
 		disposed = true;
@@ -320,7 +324,7 @@
 	/**
 	 * @return
 	 */
-	public HashMap<Object, Object> getDefaultRendererHints() {
+	public HashMap<Object, Object> getDefaultGTRendererHints() {
 		if (defaultRendererHints == null){
 			defaultRendererHints = new HashMap<Object, Object>();
 			
@@ -361,6 +365,9 @@
 	}
 
 	public ScalePane getScalePane() {
+		if (scalePane == null) {
+			scalePane = new ScalePane();
+		}
 		return scalePane;
 	}
 

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-09-25 13:58:55 UTC (rev 416)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/GridPanel.java	2009-09-25 16:34:10 UTC (rev 417)
@@ -34,20 +34,15 @@
 import java.awt.Graphics2D;
 import java.awt.RenderingHints;
 import java.awt.geom.AffineTransform;
-import java.util.Locale;
 
-import javax.measure.unit.Unit;
-
 import org.apache.log4j.Logger;
 import org.geotools.referencing.CRS;
 import org.geotools.referencing.operation.projection.PointOutsideEnvelopeException;
-import org.geotools.resources.CRSUtilities;
 import org.opengis.referencing.FactoryException;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.opengis.referencing.operation.MathTransform;
 
 import schmitzm.lang.LangUtil;
-import schmitzm.lang.ResourceProvider;
 import schmitzm.swing.JPanel;
 import schmitzm.swing.SwingUtil;
 
@@ -212,7 +207,6 @@
     super.paint(g);
     
     Graphics2D g2 = (Graphics2D)g;
-    g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
     g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
     
     
@@ -315,11 +309,14 @@
 
    // Passende Grid-Unterteilung in Grad
    double gridDist = formatter.determineGridDistance(this, mapMin,mapMax,maxSize);
-   // Leiste zeichnen
-   if ( isHorizontal() )
-     g2.drawLine(0,0,maxSize,0);
-   else
-     g2.drawLine(formatter.getWidthForVertical(this)-1,0,formatter.getWidthForVertical(this)-1,maxSize);
+   
+//    SK: 25. Sep 2009: Asgeschaltet auf Grund ästetischer Agumente ;-)
+//   // Leiste zeichnen
+//   if ( isHorizontal() )
+//     g2.drawLine(0,0,maxSize,0);
+//   else
+//     g2.drawLine(formatter.getWidthForVertical(this)-1,0,formatter.getWidthForVertical(this)-1,maxSize);
+//   
 
    // Abschnitte zeichnen
    double   firstGrid = Math.ceil(mapMin/gridDist)*gridDist; // 1. Abschnitt in Lat bzw. Lon

Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/ScalePane.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/ScalePane.java	2009-09-25 13:58:55 UTC (rev 416)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/ScalePane.java	2009-09-25 16:34:10 UTC (rev 417)
@@ -29,13 +29,13 @@
  ******************************************************************************/
 package schmitzm.geotools.gui;
 
-import java.awt.Color;
 import java.awt.Graphics;
 import java.awt.GridBagConstraints;
 import java.awt.GridBagLayout;
 import java.awt.Insets;
 import java.text.DecimalFormat;
 
+import javax.swing.BorderFactory;
 import javax.swing.JLabel;
 
 import schmitzm.swing.JPanel;
@@ -50,35 +50,34 @@
   private static final DecimalFormat numFormat = new DecimalFormat("###,###,##0.00");
 
   /** Massstab-Balken */
-  protected ScalePanel scalePanel  = null;
+  private ScalePanel scalePanel  =  new ScalePanel();
   /** Label in dem die Aufloesung in Meter pro Pixel angezeigt wird. */
-  protected JLabel     scaleLabel  = new JLabel("");
+  private JLabel     scaleLabel  = new JLabel("");
 
   /**
    * Erzeugt eine Mass-Stab.
    */
   public ScalePane() {
-    super();
-    this.scalePanel = new ScalePanel();
+	  setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
     setScale(1.0);
     this.setLayout( new GridBagLayout() );
-    this.scaleLabel.setHorizontalAlignment(JLabel.LEFT);
-    this.add( scalePanel, new GridBagConstraints(0,0,2,1,1.0,1.0,GridBagConstraints.CENTER,GridBagConstraints.BOTH,new Insets(0,0,0,0),0,0) );
-    this.add( scaleLabel, new GridBagConstraints(0,1,1,1,0.5,0.0,GridBagConstraints.NORTHWEST,GridBagConstraints.NONE,new Insets(0,0,0,0),0,0) );
+    this.add( getScalePanel(), new GridBagConstraints(0,0,2,1,1.0,1.0,GridBagConstraints.CENTER,GridBagConstraints.BOTH,new Insets(0,0,0,0),0,0) );
+   	this.getScaleLabel().setHorizontalAlignment(JLabel.LEFT);
+   	this.add( getScaleLabel(), new GridBagConstraints(0,1,1,1,0.5,0.0,GridBagConstraints.NORTHWEST,GridBagConstraints.NONE,new Insets(0,0,0,0),0,0) );
   }
 
   /**
    * Liefert die dargestellte Aufloesung in Pixel pro Meter.
    */
   public double getScaleInPixels() {
-    return scalePanel.getScaleInPixels();
+    return getScalePanel().getScaleInPixels();
   }
 
   /**
    * Liefert die dargestellte Aufloesung in Metern pro Pixel.
    */
   public double getScaleInMeters() {
-    return scalePanel.getScaleInMeters();
+    return getScalePanel().getScaleInMeters();
   }
 
   /**
@@ -87,8 +86,10 @@
    * @param meters Meter, die durch einen Bildschirm-Pixel repraesentiert werden
    */
   public void setScale(double meters) {
-    scalePanel.setScale(meters);
-    scaleLabel.setText("1 pixel = "+numFormat.format(meters)+"m");
+    getScalePanel().setScale(meters);
+    
+    // TODO i8n
+    getScaleLabel().setText("1 pixel = "+numFormat.format(meters)+"m");
     repaint();
   }
 
@@ -99,32 +100,50 @@
    * @exception Ill
    */
   public void setScale(long pixels) {
-    scalePanel.setScale(pixels);
-    scaleLabel.setText(pixels+" pixel = 1m");
+    getScalePanel().setScale(pixels);
+    
+    // TODO i8n
+    getScaleLabel().setText(pixels+" pixel = 1m");
     repaint();
   }
   
   /**
-   * Nuetzlich wenn die Componente gedruckt (z.B. wenn ein Screenshot gemacht wird) wird. Dann werden wird der
-   * Hintergrund auf WEISS gesetzt.
+   * Nuetzlich wenn die Componente gedruckt (z.B. wenn ein Screenshot gemacht wird) wird. Diese Angabe macht kaum sinn wenn gedruckt wird, oder?! 
    *
    * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
    *         Kr&uuml;ger</a>
    */
   @Override
   public void print(Graphics g) {
-      final Color orig = getBackground();
-      setBackground(Color.WHITE);
-      // remove the informatil   xxx pixel = 1m
-      final String backupPixelText = scaleLabel.getText();
-      scaleLabel.setText("");
-      // wrap in try/finally so that we always restore the state
-      try {
-          super.print(g);
-      } finally {
-          setBackground(orig);
-          scaleLabel.setText(backupPixelText);
-      }
+	  return;
+//      final Color orig = getBackground();
+//      setBackground(Color.WHITE);
+//      // remove the informatil   xxx pixel = 1m
+//      final String backupPixelText = scaleLabel.getText();
+//      scaleLabel.setText("");
+//      // wrap in try/finally so that we always restore the state
+//      try {
+//          super.print(g);
+//      } finally {
+//          setBackground(orig);
+//          scaleLabel.setText(backupPixelText);
+//      }
   }
 
+public void setScaleLabel(JLabel scaleLabel) {
+	this.scaleLabel = scaleLabel;
 }
+
+public JLabel getScaleLabel() {
+	return scaleLabel;
+}
+
+public void setScalePanel(ScalePanel scalePanel) {
+	this.scalePanel = scalePanel;
+}
+
+public ScalePanel getScalePanel() {
+	return scalePanel;
+}
+
+}

Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/ScalePanel.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/ScalePanel.java	2009-09-25 13:58:55 UTC (rev 416)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/ScalePanel.java	2009-09-25 16:34:10 UTC (rev 417)
@@ -31,6 +31,8 @@
 
 import java.awt.Color;
 import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
 import java.text.DecimalFormat;
 
 import javax.swing.JLabel;
@@ -48,6 +50,7 @@
  */
 public class ScalePanel extends JPanel {
   private static final DecimalFormat numFormat = new DecimalFormat("###,###,##0");
+  public final static Color[] barColor  = new Color[] { Color.BLACK, Color.WHITE };
 
   /** Beinhaltet die aktuell dargestellte Aufloesung. Der Wert entspricht den
    *  Metern, die durch einen Bildschirm-Pixel dargestellt werden.*/
@@ -80,7 +83,7 @@
    * Komponente.
    * @param meters Meter, die durch einen Bildschirm-Pixel repraesentiert werden
    */
-  public void setScale(double meters) {
+  public void setScale(final double meters) {
     if ( meters <= 0 )
       throw new IllegalArgumentException("Meters must be greater zero!");
     this.scale = meters;
@@ -93,7 +96,7 @@
    * @param pixels Anzahl an Pixeln, die einen Meter repraesentieren werden
    * @exception Ill
    */
-  public void setScale(long pixels) {
+  public void setScale(final long pixels) {
     if ( pixels <= 0 )
       throw new IllegalArgumentException("Count of pixels must be greater zero!");
     setScale(1.0/pixels);
@@ -103,38 +106,46 @@
    * Zeichnet den Massstab-Balken.
    * @param g Graphics
    */
-  public void paint(Graphics g) {
+  public void paint(final Graphics g) {
     if (getParent() == null )
       return;
-    super.paint(g);
+    
+    final Graphics2D g2 = (Graphics2D)g;
+    g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+    g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+    
+    super.paint(g2);
 
     // maximale Breite fuer Skala (abzgl. 25 Pixel fuer Meter-Angabe)
-    int    maxW_pixel    = getParent().getWidth() - 30;
-    double maxW_meter    = maxW_pixel * getScaleInMeters();
+    final int    maxW_pixel    = getParent().getWidth() - 30;
+    final double maxW_meter    = maxW_pixel * getScaleInMeters();
     // Ausmasse der Skala (stellt immer volle 10/100/1000/... Meter dar)
-    long   scaleW_meter = (long)Math.pow(10, (long)Math.log10(maxW_meter));
-    int    scaleW_pixel = (int)Math.round( scaleW_meter * getScaleInPixels() );
-    int    scaleH_pixel = getHeight()-1;
+    final long   scaleW_meter = (long)Math.pow(10, (long)Math.log10(maxW_meter));
+    final int    scaleW_pixel = (int)Math.round( scaleW_meter * getScaleInPixels() );
+    final int    scaleH_pixel = getHeight()-1;
 
     // Aufteilung in der Skala Teil-Balken
-    int     tileScaleCount  = 4;
-    int     tileScaleWidth  = scaleW_pixel/tileScaleCount;
-    int     tileScaleHeight = scaleH_pixel;
-    Color[] barColor  = new Color[] { Color.BLACK, Color.WHITE };
+    final int     tileScaleCount  = 4;
+    final int     tileScaleWidth  = scaleW_pixel/tileScaleCount;
+    final int     tileScaleHeight = scaleH_pixel;
+    
     int     nextColorIdx = 0;
 
     // Teilbalken malen
     for (int i = 0; i < tileScaleCount; i++) {
-      g.setColor(barColor[nextColorIdx]);
-      g.fillRect(i * tileScaleWidth, 0, tileScaleWidth, tileScaleHeight);
+      g2.setColor(barColor[nextColorIdx]);
+      g2.fillRect(i * tileScaleWidth, 0, tileScaleWidth, tileScaleHeight);
       nextColorIdx = 1 - nextColorIdx;
     }
     // Rahmen um alle Balken
-    g.setColor(Color.BLACK);
-    g.drawRect(0, 0, tileScaleWidth*tileScaleCount, tileScaleHeight);
+    g2.setColor(Color.BLACK);
+    g2.drawRect(0, 0, tileScaleWidth*tileScaleCount, tileScaleHeight);
     // Laengen-Angabe
-    g.setFont( new JLabel().getFont() );
-    String scaleString = scaleW_meter >= 1000 ? numFormat.format(scaleW_meter/1000)+"km" : numFormat.format(scaleW_meter)+"m";
-    g.drawString(scaleString,scaleW_pixel+3,tileScaleHeight);
+    g2.setFont( new JLabel().getFont() );
+    
+    //TODO This should be switchable from km to miles
+    final String scaleString = scaleW_meter >= 1000 ? numFormat.format(scaleW_meter/1000)+"km" : numFormat.format(scaleW_meter)+"m";
+    
+    g2.drawString(scaleString,scaleW_pixel+3,tileScaleHeight);
   }
 }

Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/styling/StylingUtil.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/styling/StylingUtil.java	2009-09-25 13:58:55 UTC (rev 416)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/styling/StylingUtil.java	2009-09-25 16:34:10 UTC (rev 417)
@@ -102,9 +102,11 @@
 import org.opengis.coverage.grid.GridCoverage;
 import org.opengis.feature.simple.SimpleFeature;
 import org.opengis.feature.simple.SimpleFeatureType;
+import org.opengis.filter.And;
 import org.opengis.filter.Filter;
 import org.opengis.filter.FilterFactory;
 import org.opengis.filter.FilterFactory2;
+import org.opengis.filter.PropertyIsEqualTo;
 import org.opengis.filter.expression.Expression;
 import org.opengis.filter.expression.Literal;
 
@@ -1297,8 +1299,8 @@
 		try {
 			if (style != null) {
 
-				for (final FeatureTypeStyle fts : style.getFeatureTypeStyles()) {
-					for (final Rule r : fts.getRules()) {
+				for (final FeatureTypeStyle fts : style.featureTypeStyles()) {
+					for (final Rule r : fts.rules()) {
 
 						final Filter filter = r.getFilter();
 						//
@@ -1339,6 +1341,78 @@
 	 * @return {@link List} or all {@link TextSymbolizer}s found in the
 	 *         {@link Style}.
 	 */
+	public static List<TextSymbolizer> getVisibleTextSymbolizers(final Style style) {
+		List<TextSymbolizer> results = new ArrayList<TextSymbolizer>();
+		try {
+			if (style != null) {
+
+				for (final FeatureTypeStyle fts : style.featureTypeStyles()) {
+					for (final Rule r : fts.rules()) {
+
+						if (r.getFilter() != null) {
+
+							/*
+							 * We are comparing it to AsUtil.alwaysfalsefilter
+							 * 
+							 * public static final PropertyIsEqualTo
+							 * allwaysFalseFilter = ff2.equals(ff2
+							 * .literal("1"), ff2.literal("2"));
+							 */
+							try {
+								
+							Filter f = r.getFilter();
+							if (f instanceof And) {
+								And and = (And) f;
+								if (and.getChildren() != null) {
+									Filter candidateF = and.getChildren()
+											.get(0);
+									if (candidateF instanceof PropertyIsEqualTo) {
+										final PropertyIsEqualTo compare = (PropertyIsEqualTo) candidateF;
+										if (compare.getExpression1() instanceof Literal && compare.getExpression2() instanceof Literal) {
+											Literal test1 = (Literal)compare.getExpression1();
+											Literal test2 = (Literal)compare.getExpression2();
+											if (   test1.toString().equals("1") && test2.toString().equals("2")){
+												// This TextSymbolizer is disabled using ASUtil.allwaysFalseFilter
+												LOGGER.debug("Ignoring Rule "+ r +" because the filter is "+f);
+												continue;
+											}
+										}
+									}
+								}
+							}
+							}catch (Exception e) {
+								LOGGER.debug("Checking for textSymbolizer allwaysFalseFilter",e);
+							}
+						}
+
+						results.addAll(getTextSymbolizers(r.getSymbolizers()));
+					}
+				}
+
+			}
+
+		} catch (final Exception e) {
+			LOGGER.error("error - filter API stuff?", e);
+			return results;
+		}
+		return results;
+	}
+
+	
+	
+	
+
+	/**
+	 * @param style
+	 *            A {@link Style} to search for all {@link TextSymbolizer}s . No
+	 *            guarantee, that any one of them will ever be used for any
+	 *            feature (think about filters).
+	 * 
+	 * @author Stefan A. Krüger
+	 * 
+	 * @return {@link List} or all {@link TextSymbolizer}s found in the
+	 *         {@link Style}.
+	 */
 	public static List<TextSymbolizer> getTextSymbolizers(final Style style) {
 		List<TextSymbolizer> results = new ArrayList<TextSymbolizer>();
 		try {
@@ -1359,6 +1433,10 @@
 		return results;
 	}
 
+	
+	
+	
+	
 	/**
 	 * @param symbolizers
 	 *            List of Symbolizers to search for all {@link TextSymbolizer}s
@@ -1565,7 +1643,6 @@
 
 		Symbolizer[] symbolizers = new Symbolizer[0];
 
-		
 		switch (geometryForm) {
 
 		case POINT:
@@ -1582,27 +1659,25 @@
 			symbolizers = LangUtil.extendArray(symbolizers, ps3);
 
 			break;
-		case POLYGON:
-			{ // Black
-				Stroke outline = STYLE_BUILDER.createStroke(
-						Color.red, 3);
-				Mark dots = STYLE_BUILDER.createMark("shape://backslash");
-				dots.setStroke(STYLE_BUILDER.createStroke(Color.red, 3.));
-				Graphic fillGraphic = STYLE_BUILDER.createGraphic(null, dots,
-						null);
-				fillGraphic.setSize(FILTER_FACTORY.literal(9.));
-				Fill fill = STYLE_BUILDER.createFill();
-				fill.setGraphicFill(fillGraphic);
-				PolygonSymbolizer polS0 = STYLE_BUILDER
-				.createPolygonSymbolizer(outline, fill);
-				symbolizers = LangUtil.extendArray(symbolizers, polS0);
-			}
+		case POLYGON: { // Black
+			Stroke outline = STYLE_BUILDER.createStroke(Color.red, 3);
+			Mark dots = STYLE_BUILDER.createMark("shape://backslash");
+			dots.setStroke(STYLE_BUILDER.createStroke(Color.red, 3.));
+			Graphic fillGraphic = STYLE_BUILDER.createGraphic(null, dots, null);
+			fillGraphic.setSize(FILTER_FACTORY.literal(9.));
+			Fill fill = STYLE_BUILDER.createFill();
+			fill.setGraphicFill(fillGraphic);
+			PolygonSymbolizer polS0 = STYLE_BUILDER.createPolygonSymbolizer(
+					outline, fill);
+			symbolizers = LangUtil.extendArray(symbolizers, polS0);
+		}
 
 			{ // White
-				Stroke outline = STYLE_BUILDER.createStroke(
-						Color.yellow.brighter(), 1);
+				Stroke outline = STYLE_BUILDER.createStroke(Color.yellow
+						.brighter(), 1);
 				Mark dots = STYLE_BUILDER.createMark("shape://backslash");
-				dots.setStroke(STYLE_BUILDER.createStroke(Color.yellow.brighter(), 1.));
+				dots.setStroke(STYLE_BUILDER.createStroke(Color.yellow
+						.brighter(), 1.));
 				Graphic fillGraphic = STYLE_BUILDER.createGraphic(null, dots,
 						null);
 				fillGraphic.setSize(FILTER_FACTORY.literal(9.));
@@ -1612,8 +1687,9 @@
 						.createPolygonSymbolizer(outline, fill);
 				symbolizers = LangUtil.extendArray(symbolizers, polS0);
 			}
-//				PolygonSymbolizer polS0 = STYLE_BUILDER.createPolygonSymbolizer(Color.RED);
-//				symbolizers = LangUtil.extendArray(symbolizers, polS0);
+			// PolygonSymbolizer polS0 =
+			// STYLE_BUILDER.createPolygonSymbolizer(Color.RED);
+			// symbolizers = LangUtil.extendArray(symbolizers, polS0);
 
 			break;
 

Modified: branches/1.0-gt2-2.6/src/skrueger/geotools/MapPaneToolBar.java
===================================================================
--- branches/1.0-gt2-2.6/src/skrueger/geotools/MapPaneToolBar.java	2009-09-25 13:58:55 UTC (rev 416)
+++ branches/1.0-gt2-2.6/src/skrueger/geotools/MapPaneToolBar.java	2009-09-25 16:34:10 UTC (rev 417)
@@ -30,7 +30,6 @@
 package skrueger.geotools;
 
 import java.awt.Color;
-import java.awt.Dimension;
 import java.awt.Graphics;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
@@ -198,6 +197,11 @@
 	 */
 	public MapPaneToolBar(JMapPane mapPane) {
 		super("Control the map", JToolBar.HORIZONTAL);
+		
+		// I want to see nothing on the background 
+		setOpaque(false);
+		setBorder(null);
+		
 		this.toolButtonGroup = new ButtonGroup();
 		
 		// Create a Listener to listen to the zooms on the JMapPane
@@ -272,6 +276,7 @@
 	 * puts all tool buttons and all actions buttons to the tool bar.
 	 */
 	protected void init() {
+		
 		initToolsAndActions();
 
 		addSeparator(SEPERATOR0, new JToolBar.Separator());
@@ -321,18 +326,29 @@
 		setSelectedTool(selectedTool);
 
 	}
+	
+	@Override
+	public void paint(Graphics g) {
+		super.paint(g);
+	}
 
 	/**
 	 * Clears the GUI of all components and adds all tool and action buttons to
 	 * the tool bar.
 	 */
 	public void initToolBar() {
-		setAlignmentY(1f);
+//		setOpaque(true);
+//		
+//		setAlignmentY(1f);
+//		setAlignmentX(0.5f);
 		removeAll();
-		// Separator to the left of the tool actions to start
-		// the tool buttons with the map (not with the coordinate grid)
-		Dimension dimension = new Dimension(49, 10);
-		addSeparator(dimension);
+		
+//		// Separator to the left of the tool actions to start
+//		// the tool buttons with the map (not with the coordinate grid)
+//		Dimension dimension = new Dimension(49, 10);
+//		addSeparator(dimension);
+		
+		
 		// Tool buttons
 		for (Integer bKey : toolAndActionButtons.keySet()) {
 			

Modified: branches/1.0-gt2-2.6/src/skrueger/geotools/MapView.java
===================================================================
--- branches/1.0-gt2-2.6/src/skrueger/geotools/MapView.java	2009-09-25 13:58:55 UTC (rev 416)
+++ branches/1.0-gt2-2.6/src/skrueger/geotools/MapView.java	2009-09-25 16:34:10 UTC (rev 417)
@@ -37,6 +37,8 @@
 import javax.swing.JPanel;
 import javax.swing.JSplitPane;
 
+import net.miginfocom.swing.MigLayout;
+
 import org.apache.log4j.Logger;
 
 import schmitzm.geotools.gui.GeoMapPane;
@@ -123,9 +125,9 @@
 		 * To the right side we now add a JPanel that consists of a toolbar and
 		 * a gmp
 		 */
-		JPanel newRight = new JPanel(new BorderLayout());
-		newRight.add(getToolBar(), BorderLayout.NORTH);
-		newRight.add(getGeoMapPane(), BorderLayout.CENTER);
+		JPanel newRight = new JPanel(new MigLayout("center, wrap 1","[grow]","[][grow]"));
+		newRight.add(getToolBar());
+		newRight.add(getGeoMapPane(),"growx, growy");
 		getSplitPane().add(newRight);
 
 		this.add(getSplitPane(), BorderLayout.CENTER);

Modified: branches/1.0-gt2-2.6/src/skrueger/geotools/labelsearch/LabelSearch.java
===================================================================
--- branches/1.0-gt2-2.6/src/skrueger/geotools/labelsearch/LabelSearch.java	2009-09-25 13:58:55 UTC (rev 416)
+++ branches/1.0-gt2-2.6/src/skrueger/geotools/labelsearch/LabelSearch.java	2009-09-25 16:34:10 UTC (rev 417)
@@ -118,15 +118,14 @@
 				if (!ml.isVisible())
 					continue;
 
-				final List<TextSymbolizer> allTS = StylingUtil.getTextSymbolizers(ml
+				final List<TextSymbolizer> allTS = StylingUtil.getVisibleTextSymbolizers(ml
 						.getStyle());
 				if (allTS.size() == 0) {
 					// A layer without any TextSymbolizer doesn't have to be
 					// searched any more.
 					continue;
 				}
-
-				// 26 CAST!
+				
 				final FeatureSource<SimpleFeatureType, SimpleFeature> featureSource = (FeatureSource<SimpleFeatureType, SimpleFeature>) ml.getFeatureSource();
 				
 				final String typeName = featureSource.getSchema()
@@ -158,6 +157,7 @@
 					if (ts == null)
 						continue;
 
+					// TODO Evaluate the Rule that belongs to the TextSymbolizer against the feature... 
 					final AttributeDescriptor labelAttribute = getLabelAttribute(ts, featureSource.getSchema());
 
 					if (labelAttribute == null) {



More information about the Schmitzm-commits mailing list