[Schmitzm-commits] r437 - branches/1.0-gt2-2.6/src/schmitzm/geotools

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Oct 5 14:48:15 CEST 2009


Author: mojays
Date: 2009-10-05 14:48:14 +0200 (Mon, 05 Oct 2009)
New Revision: 437

Modified:
   branches/1.0-gt2-2.6/src/schmitzm/geotools/GTUtil.java
Log:
new method GTUtil.createGTRenderer(..)

Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/GTUtil.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/GTUtil.java	2009-10-05 11:54:12 UTC (rev 436)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/GTUtil.java	2009-10-05 12:48:14 UTC (rev 437)
@@ -38,7 +38,10 @@
 import org.apache.log4j.Logger;
 import org.geotools.geometry.Envelope2D;
 import org.geotools.geometry.jts.JTS;
+import org.geotools.map.MapContext;
 import org.geotools.referencing.CRS;
+import org.geotools.renderer.GTRenderer;
+import org.geotools.renderer.shape.ShapefileRenderer;
 import org.opengis.geometry.Envelope;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 
@@ -182,4 +185,17 @@
     // Subset nur bzgl. des Bereichs in dem auch das Raster liegt
     return JTS.getEnvelope2D(intersetionEnvJTS,crs);
   }
+
+  /**
+   * Creates a {@link GTRenderer}. This method can be used all over
+   * a project, so the renderer can be switched easily.
+   * @param mapContext a {@link MapContext} (can be {@code null})
+   */
+  public static GTRenderer createGTRenderer(MapContext mapContext) {
+    GTRenderer renderer = new ShapefileRenderer();
+
+    if ( mapContext != null )
+      renderer.setContext(mapContext);
+    return renderer;
+  }
 }



More information about the Schmitzm-commits mailing list