/[schmitzm]/trunk/src/skrueger/geotools/XMapPane.java
ViewVC logotype

Diff of /trunk/src/skrueger/geotools/XMapPane.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 127 by mojays, Sat May 30 14:29:58 2009 UTC revision 144 by alfonx, Mon Jun 15 18:29:49 2009 UTC
# Line 43  import java.awt.Graphics; Line 43  import java.awt.Graphics;
43  import java.awt.Graphics2D;  import java.awt.Graphics2D;
44  import java.awt.LayoutManager;  import java.awt.LayoutManager;
45  import java.awt.Rectangle;  import java.awt.Rectangle;
46    import java.awt.RenderingHints;
47  import java.awt.event.InputEvent;  import java.awt.event.InputEvent;
48  import java.awt.event.MouseEvent;  import java.awt.event.MouseEvent;
49  import java.awt.event.MouseListener;  import java.awt.event.MouseListener;
# Line 94  import com.vividsolutions.jts.geom.Geome Line 95  import com.vividsolutions.jts.geom.Geome
95  import com.vividsolutions.jts.geom.GeometryFactory;  import com.vividsolutions.jts.geom.GeometryFactory;
96    
97  public class JMapPane extends JPanel implements MouseListener,  public class JMapPane extends JPanel implements MouseListener,
98          MouseMotionListener, HighlightChangeListener,SelectionChangeListener, PropertyChangeListener,                  MouseMotionListener, HighlightChangeListener, SelectionChangeListener,
99          MapLayerListListener {                  PropertyChangeListener, MapLayerListListener {
100      private static Logger LOGGER = Logger.getLogger( JMapPane.class.getName() );          private static Logger LOGGER = Logger.getLogger(JMapPane.class.getName());
101     /**          /**
102       *       *
103       */       */
104      private static final long serialVersionUID = -8647971481359690499L;          private static final long serialVersionUID = -8647971481359690499L;
105    
106      public static final int Reset = 0;          public static final int Reset = 0;
107    
108      public static final int ZoomIn = 1;          public static final int ZoomIn = 1;
109    
110      public static final int ZoomOut = 2;          public static final int ZoomOut = 2;
111    
112      public static final int Pan = 3;          public static final int Pan = 3;
113    
114      public static final int Select = 4;          public static final int Select = 4;
115    
116      private static final int POLYGON = 0;          private static final int POLYGON = 0;
117    
118      private static final int LINE = 1;          private static final int LINE = 1;
119    
120      private static final int POINT = 2;          private static final int POINT = 2;
121    
122      /**          /**
123       * what renders the map           * what renders the map
124       */           */
125      GTRenderer renderer;          GTRenderer renderer;
126    
127      private GTRenderer highlightRenderer, selectionRenderer;          private GTRenderer highlightRenderer, selectionRenderer;
128    
129      /**          /**
130       * the map context to render           * the map context to render
131       */           */
132      MapContext context;          MapContext context;
133    
134      private MapContext selectionContext;          private MapContext selectionContext;
135    
136      /**          /**
137       * the area of the map to draw           * the area of the map to draw
138       */           */
139  //xulu.sc          // xulu.sc
140  //    Envelope mapArea;          // Envelope mapArea;
141      protected Envelope mapArea;          protected Envelope mapArea;
142  //xulu.ec          // xulu.ec
143    
144      /**          /**
145       * the size of the pane last time we drew           * the size of the pane last time we drew
146       */           */
147  //xulu.sc          // xulu.sc
148  //    private Rectangle oldRect = null;          // private Rectangle oldRect = null;
149      protected Rectangle oldRect = null;          protected Rectangle oldRect = null;
150  //xulu.ec          // xulu.ec
151    
152      /**          /**
153       * the last map area drawn.           * the last map area drawn.
154       */           */
155  //xulu.sc          // xulu.sc
156  //    private Envelope oldMapArea = null;          // private Envelope oldMapArea = null;
157      protected Envelope oldMapArea = null;          protected Envelope oldMapArea = null;
158  //xulu.ec          // xulu.ec
159    
160      /**          /**
161       * the base image of the map           * the base image of the map
162       */           */
163      protected  BufferedImage baseImage, panningImage;          protected BufferedImage baseImage, panningImage;
164      // SK: private BufferedImage baseImage, panningImage;          // SK: private BufferedImage baseImage, panningImage;
165    
166      /**          /**
167       * image of selection           * image of selection
168       */           */
169      private BufferedImage selectImage;          private BufferedImage selectImage;
170    
171      /**          /**
172       * style for selected items           * style for selected items
173       */           */
174      private Style selectionStyle;          private Style selectionStyle;
175    
176      /**          /**
177       * layer that selection works on           * layer that selection works on
178       */           */
179      private MapLayer selectionLayer;          private MapLayer selectionLayer;
180    
181      /**          /**
182       * layer that highlight works on           * layer that highlight works on
183       */           */
184      private MapLayer highlightLayer;          private MapLayer highlightLayer;
185    
186      /**          /**
187       * the object which manages highlighting           * the object which manages highlighting
188       */           */
189      private HighlightManager highlightManager;          private HighlightManager highlightManager;
190    
191      /**          /**
192       * is highlighting on or off           * is highlighting on or off
193       */           */
194      private boolean highlight = true;          private boolean highlight = true;
195    
196      /**          /**
197       * a factory for filters           * a factory for filters
198       */           */
199      FilterFactory2 ff;          FilterFactory2 ff;
200    
201      /**          /**
202       * a factory for geometries           * a factory for geometries
203       */           */
204      GeometryFactory gf = new GeometryFactory(); // FactoryFinder.getGeometryFactory(null);          GeometryFactory gf = new GeometryFactory(); // FactoryFinder.getGeometryFactory(null);
205    
206      /**          /**
207       * the collections of features to be selected or highlighted           * the collections of features to be selected or highlighted
208       */           */
209      FeatureCollection selection;          FeatureCollection selection;
210    
211      /**          /**
212       * the collections of features to be selected or highlighted           * the collections of features to be selected or highlighted
213       */           */
214      FeatureCollection highlightFeature;          FeatureCollection highlightFeature;
215    
216      private int state = ZoomIn;          private int state = ZoomIn;
217    
218      /**          /**
219       * how far to zoom in or out           * how far to zoom in or out
220       */           */
221      private double zoomFactor = 2.0;          private double zoomFactor = 2.0;
222    
223      Style lineHighlightStyle;          Style lineHighlightStyle;
224    
225      Style pointHighlightStyle;          Style pointHighlightStyle;
226    
227      Style polygonHighlightStyle;          Style polygonHighlightStyle;
228    
229      Style polygonSelectionStyle;          Style polygonSelectionStyle;
230    
231      Style pointSelectionStyle;          Style pointSelectionStyle;
232    
233      Style lineSelectionStyle;          Style lineSelectionStyle;
234    
235      boolean changed = true;          boolean changed = true;
236    
237      LabelCache labelCache = new LabelCacheDefault();          LabelCache labelCache = new LabelCacheDefault();
238    
239  //xulu.sc          // xulu.sc
240  //    private boolean reset = false;          // private boolean reset = false;
241      protected boolean reset = false;          protected boolean reset = false;
242  //xulu.ec          // xulu.ec
243    
244      int startX;          int startX;
245    
246      int startY;          int startY;
247    
248      private boolean clickable;          private boolean clickable;
249    
250      int lastX;          int lastX;
251    
252      int lastY;          int lastY;
253    
254      private SelectionManager selectionManager;          private SelectionManager selectionManager;
255  //xulu.sn          // xulu.sn
256      private Double maxZoomScale = Double.MIN_VALUE;          private Double maxZoomScale = Double.MIN_VALUE;
257      private Double minZoomScale = Double.MAX_VALUE;          private Double minZoomScale = Double.MAX_VALUE;
258  //xulu.en          // xulu.en
259    
260  // sk.sn              // sk.sn
261      /**          /**
262       * Wenn true, dann wurde PANNING via mouseDraged-Events begonnen. Dieses Flag wird benutzt um nur einmal den passenden Cursor nur einmal zu setzen.           * Wenn true, dann wurde PANNING via mouseDraged-Events begonnen. Dieses
263       */           * Flag wird benutzt um nur einmal den passenden Cursor nur einmal zu
264             * setzen.
265             */
266          private boolean panning_started = false;          private boolean panning_started = false;
 // sk.en          
267    
268      public JMapPane() {          // sk.en
         this(null, true, null, null);  
     }  
269    
270      /**          public JMapPane() {
271       * create a basic JMapPane                  this(null, true, null, null);
272       *          }
      * @param render -  
      *            how to draw the map  
      * @param context -  
      *            the map context to display  
      */  
     public JMapPane(GTRenderer render, MapContext context) {  
         this(null, true, render, context);  
     }  
273    
274      /**          /**
275       * full constructor extending JPanel           * create a basic JMapPane
276       *           *
277       * @param layout -           * @param render
278       *            layout (probably shouldn't be set)           *            - how to draw the map
279       * @param isDoubleBuffered -           * @param context
280       *            a Swing thing I don't really understand           *            - the map context to display
281       * @param render -           */
282       *            what to draw the map with          public JMapPane(GTRenderer render, MapContext context) {
283       * @param context -                  this(null, true, render, context);
284       *            what to draw          }
      */  
     public JMapPane(LayoutManager layout, boolean isDoubleBuffered,  
             GTRenderer render, MapContext context) {  
         super(layout, isDoubleBuffered);  
285    
286          ff = (FilterFactory2) org.geotools.factory.CommonFactoryFinder          /**
287                  .getFilterFactory(null);           * full constructor extending JPanel
288          setRenderer(render);           *
289             * @param layout
290             *            - layout (probably shouldn't be set)
291             * @param isDoubleBuffered
292             *            - a Swing thing I don't really understand
293             * @param render
294             *            - what to draw the map with
295             * @param context
296             *            - what to draw
297             */
298            public JMapPane(LayoutManager layout, boolean isDoubleBuffered,
299                            GTRenderer render, MapContext context) {
300                    super(layout, isDoubleBuffered);
301    
302          setContext(context);                  ff = (FilterFactory2) org.geotools.factory.CommonFactoryFinder
303                                    .getFilterFactory(null);
304                    setRenderer(render);
305    
306          this.addMouseListener(this);                  setContext(context);
         this.addMouseMotionListener(this);  
         setHighlightManager(new HighlightManager(highlightLayer));  
         setSelectionManager(new SelectionManager(selectionLayer));  
         lineHighlightStyle = setupStyle(LINE, Color.red);  
307    
308          pointHighlightStyle = setupStyle(POINT, Color.red);                  this.addMouseListener(this);
309                    this.addMouseMotionListener(this);
310                    setHighlightManager(new HighlightManager(highlightLayer));
311                    setSelectionManager(new SelectionManager(selectionLayer));
312                    lineHighlightStyle = setupStyle(LINE, Color.red);
313    
314          polygonHighlightStyle = setupStyle(POLYGON, Color.red);                  pointHighlightStyle = setupStyle(POINT, Color.red);
315    
316          polygonSelectionStyle = setupStyle(POLYGON, Color.cyan);                  polygonHighlightStyle = setupStyle(POLYGON, Color.red);
317    
318          pointSelectionStyle = setupStyle(POINT, Color.cyan);                  polygonSelectionStyle = setupStyle(POLYGON, Color.cyan);
319    
320          lineSelectionStyle = setupStyle(LINE, Color.cyan);                  pointSelectionStyle = setupStyle(POINT, Color.cyan);
         setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));  
     }  
321    
322      /**                  lineSelectionStyle = setupStyle(LINE, Color.cyan);
323       * get the renderer                  setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
324       */          }
325      public GTRenderer getRenderer() {  
326          return renderer;          /**
327      }           * get the renderer
328             */
329      public void setRenderer(GTRenderer renderer) {          public GTRenderer getRenderer() {
330          Map hints = new HashMap();                  return renderer;
331          if (renderer instanceof StreamingRenderer) {          }
332              hints = renderer.getRendererHints();  
333              if (hints == null) {          public void setRenderer(GTRenderer renderer) {
334                  hints = new HashMap();                  Map hints = new HashMap();
335              }                  if (renderer instanceof StreamingRenderer) {
336              if (hints.containsKey(StreamingRenderer.LABEL_CACHE_KEY)) {                          hints = renderer.getRendererHints();
337                  labelCache = (LabelCache) hints                          if (hints == null) {
338                          .get(StreamingRenderer.LABEL_CACHE_KEY);                                  hints = new HashMap();
339              } else {                          }
340                  hints.put(StreamingRenderer.LABEL_CACHE_KEY, labelCache);                          if (hints.containsKey(StreamingRenderer.LABEL_CACHE_KEY)) {
341              }                                  labelCache = (LabelCache) hints
342              renderer.setRendererHints(hints);                                                  .get(StreamingRenderer.LABEL_CACHE_KEY);
343          }                          } else {
344                                    hints.put(StreamingRenderer.LABEL_CACHE_KEY, labelCache);
345          this.renderer = renderer;                          }
346          this.highlightRenderer = new StreamingRenderer();                          renderer.setRendererHints(hints);
347          this.selectionRenderer = new StreamingRenderer();                  }
348    
349          hints.put("memoryPreloadingEnabled", Boolean.FALSE);                  this.renderer = renderer;
350          highlightRenderer.setRendererHints(hints);                  this.highlightRenderer = new StreamingRenderer();
351          selectionRenderer.setRendererHints(hints);                  this.selectionRenderer = new StreamingRenderer();
352    
353          if (this.context != null) {                  hints.put("memoryPreloadingEnabled", Boolean.FALSE);
354              this.renderer.setContext(this.context);                  highlightRenderer.setRendererHints(hints);
355          }                  selectionRenderer.setRendererHints(hints);
356      }  
357                    if (this.context != null) {
358      public MapContext getContext() {                          this.renderer.setContext(this.context);
359          return context;                  }
360      }          }
361    
362      public void setContext(MapContext context) {          public MapContext getContext() {
363          if (this.context != null) {                  return context;
364              this.context.removeMapLayerListListener(this);          }
365          }  
366            public void setContext(MapContext context) {
367          this.context = context;                  if (this.context != null) {
368                            this.context.removeMapLayerListListener(this);
369          if (context != null) {                  }
370              this.context.addMapLayerListListener(this);  
371          }                  this.context = context;
372    
373          if (renderer != null) {                  if (context != null) {
374              renderer.setContext(this.context);                          this.context.addMapLayerListListener(this);
375          }                  }
376      }  
377                    if (renderer != null) {
378      public Envelope getMapArea() {                          renderer.setContext(this.context);
379          return mapArea;                  }
380      }          }
381    
382      public void setMapArea(Envelope mapArea) {          public Envelope getMapArea() {
383          this.mapArea = mapArea;                  return mapArea;
384      }          }
385    
386      public int getState() {          public void setMapArea(Envelope mapArea) {
387          return state;                  this.mapArea = mapArea;
388      }          }
389    
390      public void setState(int state) {          public int getState() {
391          this.state = state;                  return state;
392            }
393          // System.out.println("State: " + state);  
394      }          public void setState(int state) {
395                    this.state = state;
396      public double getZoomFactor() {  
397          return zoomFactor;                  // System.out.println("State: " + state);
398      }          }
399    
400      public void setZoomFactor(double zoomFactor) {          public double getZoomFactor() {
401          this.zoomFactor = zoomFactor;                  return zoomFactor;
402      }          }
403    
404      public MapLayer getSelectionLayer() {          public void setZoomFactor(double zoomFactor) {
405          return selectionLayer;                  this.zoomFactor = zoomFactor;
406      }          }
407    
408      public void setSelectionLayer(MapLayer selectionLayer) {          public MapLayer getSelectionLayer() {
409          this.selectionLayer = selectionLayer;                  return selectionLayer;
410          if(selectionManager!=null) {          }
411              selectionManager.setSelectionLayer(selectionLayer);  
412          }          public void setSelectionLayer(MapLayer selectionLayer) {
413      }                  this.selectionLayer = selectionLayer;
414                    if (selectionManager != null) {
415      public boolean isHighlight() {                          selectionManager.setSelectionLayer(selectionLayer);
416          return highlight;                  }
417      }          }
418    
419      public void setHighlight(boolean highlight) {          public boolean isHighlight() {
420          this.highlight = highlight;                  return highlight;
421      }          }
422    
423      public MapLayer getHighlightLayer() {          public void setHighlight(boolean highlight) {
424          return highlightLayer;                  this.highlight = highlight;
425      }          }
426    
427      public void setHighlightLayer(MapLayer highlightLayer) {          public MapLayer getHighlightLayer() {
428          this.highlightLayer = highlightLayer;                  return highlightLayer;
429            }
430          if (highlightManager != null) {  
431              highlightManager.setHighlightLayer(highlightLayer);          public void setHighlightLayer(MapLayer highlightLayer) {
432          }                  this.highlightLayer = highlightLayer;
433      }  
434                    if (highlightManager != null) {
435      public HighlightManager getHighlightManager() {                          highlightManager.setHighlightLayer(highlightLayer);
436          return highlightManager;                  }
437      }          }
438    
439      public void setHighlightManager(HighlightManager highlightManager) {          public HighlightManager getHighlightManager() {
440          this.highlightManager = highlightManager;                  return highlightManager;
441          this.highlightManager.addHighlightChangeListener(this);          }
442          this.addMouseMotionListener(this.highlightManager);  
443      }          public void setHighlightManager(HighlightManager highlightManager) {
444                    this.highlightManager = highlightManager;
445      public Style getLineHighlightStyle() {                  this.highlightManager.addHighlightChangeListener(this);
446          return lineHighlightStyle;                  this.addMouseMotionListener(this.highlightManager);
447      }          }
448    
449      public void setLineHighlightStyle(Style lineHighlightStyle) {          public Style getLineHighlightStyle() {
450          this.lineHighlightStyle = lineHighlightStyle;                  return lineHighlightStyle;
451      }          }
452    
453      public Style getLineSelectionStyle() {          public void setLineHighlightStyle(Style lineHighlightStyle) {
454          return lineSelectionStyle;                  this.lineHighlightStyle = lineHighlightStyle;
455      }          }
456    
457      public void setLineSelectionStyle(Style lineSelectionStyle) {          public Style getLineSelectionStyle() {
458          this.lineSelectionStyle = lineSelectionStyle;                  return lineSelectionStyle;
459      }          }
460    
461      public Style getPointHighlightStyle() {          public void setLineSelectionStyle(Style lineSelectionStyle) {
462          return pointHighlightStyle;                  this.lineSelectionStyle = lineSelectionStyle;
463      }          }
464    
465      public void setPointHighlightStyle(Style pointHighlightStyle) {          public Style getPointHighlightStyle() {
466          this.pointHighlightStyle = pointHighlightStyle;                  return pointHighlightStyle;
467      }          }
468    
469      public Style getPointSelectionStyle() {          public void setPointHighlightStyle(Style pointHighlightStyle) {
470          return pointSelectionStyle;                  this.pointHighlightStyle = pointHighlightStyle;
471      }          }
472    
473      public void setPointSelectionStyle(Style pointSelectionStyle) {          public Style getPointSelectionStyle() {
474          this.pointSelectionStyle = pointSelectionStyle;                  return pointSelectionStyle;
475      }          }
476    
477      public Style getPolygonHighlightStyle() {          public void setPointSelectionStyle(Style pointSelectionStyle) {
478          return polygonHighlightStyle;                  this.pointSelectionStyle = pointSelectionStyle;
479      }          }
480    
481      public void setPolygonHighlightStyle(Style polygonHighlightStyle) {          public Style getPolygonHighlightStyle() {
482          this.polygonHighlightStyle = polygonHighlightStyle;                  return polygonHighlightStyle;
483      }          }
484    
485      public Style getPolygonSelectionStyle() {          public void setPolygonHighlightStyle(Style polygonHighlightStyle) {
486          return polygonSelectionStyle;                  this.polygonHighlightStyle = polygonHighlightStyle;
487      }          }
488    
489      public void setPolygonSelectionStyle(Style polygonSelectionStyle) {          public Style getPolygonSelectionStyle() {
490          this.polygonSelectionStyle = polygonSelectionStyle;                  return polygonSelectionStyle;
491      }          }
492    
493      protected void paintComponent(Graphics g) {          public void setPolygonSelectionStyle(Style polygonSelectionStyle) {
494          super.paintComponent(g);                  this.polygonSelectionStyle = polygonSelectionStyle;
495            }
496          if ((renderer == null) || (mapArea == null)  ) {  
497              return;          protected void paintComponent(Graphics g) {
498          }                  super.paintComponent(g);
499    
500          Rectangle r = getBounds();                  if ((renderer == null) || (mapArea == null)) {
501          Rectangle dr = new Rectangle(r.width, r.height);                          return;
502                    }
503          if (!r.equals(oldRect) || reset) {  
504                  if(!r.equals(oldRect) && (mapArea == null)) {                  Rectangle r = getBounds();
505                          try {                  Rectangle dr = new Rectangle(r.width, r.height);
506                                          mapArea=context.getLayerBounds();  
507                                  } catch (IOException e) {                  if (!r.equals(oldRect) || reset) {
508                                          // TODO Auto-generated catch block                          if (!r.equals(oldRect) && (mapArea == null)) {
509                                          e.printStackTrace();                                  try {
510                                  }                                          mapArea = context.getLayerBounds();
511                  }                                  } catch (IOException e) {
512                                                            // TODO Auto-generated catch block
513                  if (mapArea != null){                                          e.printStackTrace();
514                          /* either the viewer size has changed or we've done a reset */                                  }
515                          changed = true; /* note we need to redraw */                          }
516                          reset = false; /* forget about the reset */  
517                          oldRect = r; /* store what the current size is */                          if (mapArea != null) {
518                                                            /* either the viewer size has changed or we've done a reset */
519                          mapArea = fixAspectRatio(r, mapArea);                                  changed = true; /* note we need to redraw */
520                  }                                  reset = false; /* forget about the reset */
521          }                                  oldRect = r; /* store what the current size is */
522    
523          if (!mapArea.equals(oldMapArea)) { /* did the map extent change? */                                  mapArea = fixAspectRatio(r, mapArea);
524              changed = true;                          }
525              oldMapArea = mapArea;                  }
526  //          when we tell the context that the bounds have changed WMSLayers  
527              // can refresh them selves                  if (!mapArea.equals(oldMapArea)) { /* did the map extent change? */
528              context.setAreaOfInterest(mapArea, context                          changed = true;
529                      .getCoordinateReferenceSystem());                          oldMapArea = mapArea;
530          }                          // when we tell the context that the bounds have changed WMSLayers
531                            // can refresh them selves
532          if (changed) { /* if the map changed then redraw */                          context.setAreaOfInterest(mapArea, context
533              changed = false;                                          .getCoordinateReferenceSystem());
534              baseImage = new BufferedImage(dr.width, dr.height,                  }
535                      BufferedImage.TYPE_INT_ARGB);  
536                    if (changed) { /* if the map changed then redraw */
537              Graphics2D ig = baseImage.createGraphics();                          changed = false;
538              /* System.out.println("rendering"); */                          baseImage = new BufferedImage(dr.width, dr.height,
539              renderer.setContext(context);                                          BufferedImage.TYPE_INT_ARGB);
540              labelCache.clear(); // work around anoying labelcache bug  
541                            Graphics2D ig = baseImage.createGraphics();
542                            /* System.out.println("rendering"); */
543              // draw the map                          renderer.setContext(context);
544              renderer.paint((Graphics2D) ig, dr, mapArea);                          labelCache.clear(); // work around anoying labelcache bug
545    
546              // TODO , nur machen, wenn panning beginnt                          // draw the map
547              panningImage = new BufferedImage(dr.width, dr.height,                          renderer.paint((Graphics2D) ig, dr, mapArea);
548                          BufferedImage.TYPE_INT_RGB);  
549                                        // TODO , nur machen, wenn panning beginnt
550          }                          panningImage = new BufferedImage(dr.width, dr.height,
551                                            BufferedImage.TYPE_INT_RGB);
552          ((Graphics2D) g).drawImage(baseImage, 0, 0, this);  
553                    }
554          if ((selection != null) && (selection.size() > 0)) {  
555              // paint selection                  ((Graphics2D) g).drawImage(baseImage, 0, 0, this);
556    
557              String type = selectionLayer.getFeatureSource().getSchema()                  if ((selection != null) && (selection.size() > 0)) {
558              .getDefaultGeometry().getType().getName();                          // paint selection
559              /*String type = selection.getDefaultGeometry().getGeometryType();*/  
560              /*System.out.println(type);*/                          String type = selectionLayer.getFeatureSource().getSchema()
561              if (type == null)                                          .getDefaultGeometry().getType().getName();
562                  type = "polygon";                          /* String type = selection.getDefaultGeometry().getGeometryType(); */
563                            /* System.out.println(type); */
564              /* String type = "point"; */                          if (type == null)
565                                    type = "polygon";
566              if (type.toLowerCase().endsWith("polygon")) {  
567                  selectionStyle = polygonSelectionStyle;                          /* String type = "point"; */
568              } else if (type.toLowerCase().endsWith("point")) {  
569                  selectionStyle = pointSelectionStyle;                          if (type.toLowerCase().endsWith("polygon")) {
570              } else if (type.toLowerCase().endsWith("line")) {                                  selectionStyle = polygonSelectionStyle;
571                  selectionStyle = lineSelectionStyle;                          } else if (type.toLowerCase().endsWith("point")) {
572              }                                  selectionStyle = pointSelectionStyle;
573                            } else if (type.toLowerCase().endsWith("line")) {
574              selectionContext = new DefaultMapContext(DefaultGeographicCRS.WGS84);                                  selectionStyle = lineSelectionStyle;
575                            }
576              selectionContext.addLayer(selection, selectionStyle);  
577              selectionRenderer.setContext(selectionContext);                          selectionContext = new DefaultMapContext(DefaultGeographicCRS.WGS84);
578    
579              selectImage = new BufferedImage(dr.width, dr.height,                          selectionContext.addLayer(selection, selectionStyle);
580                      BufferedImage.TYPE_INT_ARGB);                          selectionRenderer.setContext(selectionContext);
581    
582              Graphics2D ig = selectImage.createGraphics();                          selectImage = new BufferedImage(dr.width, dr.height,
583              /* System.out.println("rendering selection"); */                                          BufferedImage.TYPE_INT_ARGB);
584              selectionRenderer.paint((Graphics2D) ig, dr, mapArea);  
585                            Graphics2D ig = selectImage.createGraphics();
586              ((Graphics2D) g).drawImage(selectImage, 0, 0, this);                          /* System.out.println("rendering selection"); */
587          }                          selectionRenderer.paint((Graphics2D) ig, dr, mapArea);
588    
589          if (highlight && (highlightFeature != null)                          ((Graphics2D) g).drawImage(selectImage, 0, 0, this);
590                  && (highlightFeature.size() > 0)) {                  }
591              /*  
592               * String type = selection.getDefaultGeometry().getGeometryType();                  if (highlight && (highlightFeature != null)
593               * System.out.println(type); if(type==null) type="polygon";                                  && (highlightFeature.size() > 0)) {
594               */                          /*
595              String type = highlightLayer.getFeatureSource().getSchema()                           * String type = selection.getDefaultGeometry().getGeometryType();
596              .getDefaultGeometry().getType().getName();                           * System.out.println(type); if(type==null) type="polygon";
597              /*String type = selection.getDefaultGeometry().getGeometryType();*/                           */
598              //System.out.println(type);                          String type = highlightLayer.getFeatureSource().getSchema()
599              if (type == null)                                          .getDefaultGeometry().getType().getName();
600                  type = "polygon";                          /* String type = selection.getDefaultGeometry().getGeometryType(); */
601                            // System.out.println(type);
602              /* String type = "point"; */                          if (type == null)
603              Style highlightStyle = null;                                  type = "polygon";
604              if (type.toLowerCase().endsWith("polygon")) {  
605                  highlightStyle = polygonHighlightStyle;                          /* String type = "point"; */
606              } else if (type.toLowerCase().endsWith("point")) {                          Style highlightStyle = null;
607                  highlightStyle = pointHighlightStyle;                          if (type.toLowerCase().endsWith("polygon")) {
608              } else if (type.toLowerCase().endsWith("line")) {                                  highlightStyle = polygonHighlightStyle;
609                  highlightStyle = lineHighlightStyle;                          } else if (type.toLowerCase().endsWith("point")) {
610              }                                  highlightStyle = pointHighlightStyle;
611                            } else if (type.toLowerCase().endsWith("line")) {
612                                    highlightStyle = lineHighlightStyle;
613                            }
614    
615              MapContext highlightContext = new DefaultMapContext(                          MapContext highlightContext = new DefaultMapContext(
616                      DefaultGeographicCRS.WGS84);                                          DefaultGeographicCRS.WGS84);
617    
618              highlightContext.addLayer(highlightFeature, highlightStyle);                          highlightContext.addLayer(highlightFeature, highlightStyle);
619              highlightRenderer.setContext(highlightContext);                          highlightRenderer.setContext(highlightContext);
620    
621              /* System.out.println("rendering highlight"); */                          /* System.out.println("rendering highlight"); */
622              highlightRenderer.paint((Graphics2D) g, dr, mapArea);                          highlightRenderer.paint((Graphics2D) g, dr, mapArea);
623          }                  }
624      }          }
625    
626      private Envelope fixAspectRatio(Rectangle r, Envelope mapArea) {          private Envelope fixAspectRatio(Rectangle r, Envelope mapArea) {
627            
628          double mapWidth = mapArea.getWidth(); /* get the extent of the map */                  double mapWidth = mapArea.getWidth(); /* get the extent of the map */
629          double mapHeight = mapArea.getHeight();                  double mapHeight = mapArea.getHeight();
630          double scaleX = r.getWidth() / mapArea.getWidth(); /*                  double scaleX = r.getWidth() / mapArea.getWidth(); /*
631                                                               * calculate the new                                                                                                                           * calculate the new
632                                                               * scale                                                                                                                           * scale
633                                                               */                                                                                                                           */
634    
635          double scaleY = r.getHeight() / mapArea.getHeight();                  double scaleY = r.getHeight() / mapArea.getHeight();
636          double scale = 1.0; // stupid compiler!                  double scale = 1.0; // stupid compiler!
637    
638          if (scaleX < scaleY) { /* pick the smaller scale */                  if (scaleX < scaleY) { /* pick the smaller scale */
639              scale = scaleX;                          scale = scaleX;
640          } else {                  } else {
641              scale = scaleY;                          scale = scaleY;
642          }                  }
643    
644          /* calculate the difference in width and height of the new extent */                  /* calculate the difference in width and height of the new extent */
645          double deltaX = /* Math.abs */((r.getWidth() / scale) - mapWidth);                  double deltaX = /* Math.abs */((r.getWidth() / scale) - mapWidth);
646          double deltaY = /* Math.abs */((r.getHeight() / scale) - mapHeight);                  double deltaY = /* Math.abs */((r.getHeight() / scale) - mapHeight);
647    
648          /*                  /*
649           * System.out.println("delta x " + deltaX); System.out.println("delta y " +                   * System.out.println("delta x " + deltaX);
650           * deltaY);                   * System.out.println("delta y " + deltaY);
651           */                   */
652    
653          /* create the new extent */                  /* create the new extent */
654          Coordinate ll = new Coordinate(mapArea.getMinX() - (deltaX / 2.0),                  Coordinate ll = new Coordinate(mapArea.getMinX() - (deltaX / 2.0),
655                  mapArea.getMinY() - (deltaY / 2.0));                                  mapArea.getMinY() - (deltaY / 2.0));
656          Coordinate ur = new Coordinate(mapArea.getMaxX() + (deltaX / 2.0),                  Coordinate ur = new Coordinate(mapArea.getMaxX() + (deltaX / 2.0),
657                  mapArea.getMaxY() + (deltaY / 2.0));                                  mapArea.getMaxY() + (deltaY / 2.0));
658    
659          return new Envelope(ll, ur);                  return new Envelope(ll, ur);
660      }          }
661    
662      public void doSelection(double x, double y, MapLayer layer) {          public void doSelection(double x, double y, MapLayer layer) {
663    
664          Geometry geometry = gf.createPoint(new Coordinate(x, y));                  Geometry geometry = gf.createPoint(new Coordinate(x, y));
665    
666          // org.opengis.geometry.Geometry geometry = new Point();                  // org.opengis.geometry.Geometry geometry = new Point();
667    
668              findFeature(geometry, layer);                  findFeature(geometry, layer);
669    
670      }          }
671    
672      /**          /**
673       * @param geometry -           * @param geometry
674       *            a geometry to construct the filter with           *            - a geometry to construct the filter with
675       * @param i -           * @param i
676       *            the index of the layer to search           *            - the index of the layer to search
677       * @throws IndexOutOfBoundsException           * @throws IndexOutOfBoundsException
678       */           */
679      private void findFeature(Geometry geometry, MapLayer layer)          private void findFeature(Geometry geometry, MapLayer layer)
680              throws IndexOutOfBoundsException {                          throws IndexOutOfBoundsException {
681          org.opengis.filter.spatial.BinarySpatialOperator f = null;                  org.opengis.filter.spatial.BinarySpatialOperator f = null;
682    
683                    if ((context == null) || (layer == null)) {
684          if ((context == null) || (layer==null)) {                          return;
685              return ;                  }
686          }  
687                    try {
688                            String name = layer.getFeatureSource().getSchema()
689                                            .getDefaultGeometry().getName();
690          try {  
691              String name = layer.getFeatureSource().getSchema()                          if (name == "") {
692                      .getDefaultGeometry().getName();                                  name = "the_geom";
693                            }
694              if (name == "") {  
695                  name = "the_geom";                          try {
696              }                                  f = ff.contains(ff.property(name), ff.literal(geometry));
697                                    if (selectionManager != null) {
698              try {                                          System.out.println("selection changed");
699                  f = ff.contains(ff.property(name), ff.literal(geometry));                                          selectionManager.selectionChanged(this, f);
700                  if(selectionManager!=null) {  
701                      System.out.println("selection changed");                                  }
702                      selectionManager.selectionChanged(this, f);                          } catch (IllegalFilterException e) {
703                                    // TODO Auto-generated catch block
704                  }                                  e.printStackTrace();
705              } catch (IllegalFilterException e) {                          }
706                  // TODO Auto-generated catch block  
707                  e.printStackTrace();                          /*
708              }                           * // f.addLeftGeometry(ff.property(name)); //
709                             * System.out.println("looking with " + f); FeatureCollection fc =
710              /*// f.addLeftGeometry(ff.property(name));                           * layer.getFeatureSource().getFeatures(f);
711              // System.out.println("looking with " + f);                           *
712              FeatureCollection fc = layer.getFeatureSource().getFeatures(f);                           *
713                             *
714                             * if (fcol == null) { fcol = fc;
715                             *
716              if (fcol == null) {                           * // here we should set the defaultgeom type } else {
717                  fcol = fc;                           * fcol.addAll(fc); }
718                             */
719                  // here we should set the defaultgeom type  
720              } else {                          /*
721                  fcol.addAll(fc);                           * GeometryAttributeType gat =
722              }*/                           * layer.getFeatureSource().getSchema().getDefaultGeometry();
723                             * fcol.setDefaultGeometry((Geometry)gat.createDefaultValue());
724              /*                           */
725               * GeometryAttributeType gat =  
726               * layer.getFeatureSource().getSchema().getDefaultGeometry();                          /*
727               * fcol.setDefaultGeometry((Geometry)gat.createDefaultValue());                           * Iterator fi = fc.iterator(); while (fi.hasNext()) { Feature feat
728               */                           * = (Feature) fi.next(); System.out.println("selected " +
729                             * feat.getAttribute("STATE_NAME")); }
730              /*                           */
731               * Iterator fi = fc.iterator(); while (fi.hasNext()) { Feature feat =                  } catch (IllegalFilterException e) {
732               * (Feature) fi.next(); System.out.println("selected " +                          // TODO Auto-generated catch block
733               * feat.getAttribute("STATE_NAME")); }                          e.printStackTrace();
734               */                  }
735          } catch (IllegalFilterException e) {                  return;
736              // TODO Auto-generated catch block          }
737              e.printStackTrace();  
738          }          public void mouseClicked(MouseEvent e) {
739          return ;                  // System.out.println("before area "+mapArea+"\nw:"+mapArea.getWidth()+"
740      }                  // h:"+mapArea.getHeight());
741                    Rectangle bounds = this.getBounds();
742      public void mouseClicked(MouseEvent e) {                  double x = (double) (e.getX());
743          // System.out.println("before area "+mapArea+"\nw:"+mapArea.getWidth()+"                  double y = (double) (e.getY());
744          // h:"+mapArea.getHeight());                  double width = mapArea.getWidth();
745          Rectangle bounds = this.getBounds();                  double height = mapArea.getHeight();
746          double x = (double) (e.getX());                  // xulu.sc
747          double y = (double) (e.getY());                  // double width2 = mapArea.getWidth() / 2.0;
748          double width = mapArea.getWidth();                  // double height2 = mapArea.getHeight() / 2.0;
749          double height = mapArea.getHeight();                  double width2 = width / 2.0;
750  //xulu.sc                  double height2 = height / 2.0;
751  //        double width2 = mapArea.getWidth() / 2.0;                  // xulu.ec
752  //        double height2 = mapArea.getHeight() / 2.0;                  double mapX = ((x * width) / (double) bounds.width) + mapArea.getMinX();
753          double width2 = width / 2.0;                  double mapY = (((bounds.getHeight() - y) * height) / (double) bounds.height)
754          double height2 = height / 2.0;                                  + mapArea.getMinY();
755  //xulu.ec  
756          double mapX = ((x * width) / (double) bounds.width) + mapArea.getMinX();                  /*
757          double mapY = (((bounds.getHeight() - y) * height) / (double) bounds.height)                   * System.out.println(""+x+"->"+mapX);
758                  + mapArea.getMinY();                   * System.out.println(""+y+"->"+mapY);
759                     */
760          /*  
761           * System.out.println(""+x+"->"+mapX);                  /*
762           * System.out.println(""+y+"->"+mapY);                   * Coordinate ll = new Coordinate(mapArea.getMinX(), mapArea.getMinY());
763           */                   * Coordinate ur = new Coordinate(mapArea.getMaxX(), mapArea.getMaxY());
764                     */
765          /*                  double zlevel = 1.0;
766           * Coordinate ll = new Coordinate(mapArea.getMinX(), mapArea.getMinY());  
767           * Coordinate ur = new Coordinate(mapArea.getMaxX(), mapArea.getMaxY());                  switch (state) {
768           */                  case Pan:
769          double zlevel = 1.0;                          zlevel = 1.0;
770                            // xulu.sc SK: return here.. a mouselistener is managing the PANNING
771          switch (state) {                          // break;
772          case Pan:                          return;
773              zlevel = 1.0;                          // xulu.ec
774  //xulu.sc SK: return here.. a mouselistener is maanaging the PANNING                  case ZoomIn:
775  //            break;                          zlevel = zoomFactor;
776              return;  
777  //xulu.ec                          break;
778          case ZoomIn:  
779              zlevel = zoomFactor;                  case ZoomOut:
780                            zlevel = 1.0 / zoomFactor;
781              break;  
782                            break;
783          case ZoomOut:  
784              zlevel = 1.0 / zoomFactor;                  case Select:
785                            doSelection(mapX, mapY, selectionLayer);
786              break;  
787                            return;
788          case Select:  
789              doSelection(mapX, mapY, selectionLayer);                  default:
790                            return;
791                    }
792              return;  
793                    Coordinate ll = new Coordinate(mapX - (width2 / zlevel), mapY
794          default:                                  - (height2 / zlevel));
795              return;                  Coordinate ur = new Coordinate(mapX + (width2 / zlevel), mapY
796          }                                  + (height2 / zlevel));
797                    // xulu.sc SK: Check for min/max scale
798          Coordinate ll = new Coordinate(mapX - (width2 / zlevel), mapY                  // mapArea = new Envelope(ll, ur);
799                  - (height2 / zlevel));                  final Envelope newMapArea = new Envelope(ll, ur);
800          Coordinate ur = new Coordinate(mapX + (width2 / zlevel), mapY                  setMapArea(bestAllowedMapArea(newMapArea));
801                  + (height2 / zlevel));                  // xulu.ec
802  //xulu.sc SK: Check for min/max scale  
803  //        mapArea = new Envelope(ll, ur);                  // sk.ec
804          final Envelope newMapArea = new Envelope(ll, ur);  
805          setMapArea( bestAllowedMapArea( newMapArea ) );                  // System.out.println("after area "+mapArea+"\nw:"+mapArea.getWidth()+"
806  //xulu.ec                  // h:"+mapArea.getHeight());
807                    repaint();
808          // System.out.println("after area "+mapArea+"\nw:"+mapArea.getWidth()+"          }
809          // h:"+mapArea.getHeight());  
810          repaint();          public void mouseEntered(MouseEvent e) {
811      }          }
812    
813      public void mouseEntered(MouseEvent e) {          public void mouseExited(MouseEvent e) {
814      }          }
815    
816      public void mouseExited(MouseEvent e) {          public void mousePressed(MouseEvent e) {
817      }                  startX = e.getX();
818                    startY = e.getY();
819      public void mousePressed(MouseEvent e) {                  lastX = 0;
820          startX = e.getX();                  lastY = 0;
821          startY = e.getY();          }
822          lastX = 0;  
823          lastY = 0;          public void mouseReleased(MouseEvent e) {
824      }                  int endX = e.getX();
825                        int endY = e.getY();
826      public void mouseReleased(MouseEvent e) {  
827          int endX = e.getX();                  processDrag(startX, startY, endX, endY, e);
828          int endY = e.getY();                  lastX = 0;
829                            lastY = 0;
830          processDrag(startX, startY, endX, endY, e);  
831          lastX = 0;                  /**
832          lastY = 0;                   * Es wird nicht (mehr) gepannt!
833                             */
834          /**                  panning_started = false;
835           * Es wird nicht (mehr) gepannt!          }
836           */  
837          panning_started = false;          public void mouseDragged(MouseEvent e) {
838      }                  Graphics graphics = this.getGraphics();
839                    int x = e.getX();
840      public void mouseDragged(MouseEvent e) {                  int y = e.getY();
841          Graphics graphics = this.getGraphics();  
842          int x = e.getX();                  if ((state == JMapPane.Pan)
843          int y = e.getY();                                  || ((e.getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) != 0)) {
844                                    /**
845                             * SK: Der Cursor wird auf PANNING gesetzt.
846          if ( (state == JMapPane.Pan) || ((e.getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) != 0))  {                           */
847              /**                          if (panning_started == false) {
848               * SK:                                  panning_started = true;
849               * Der Cursor wird auf PANNING gesetzt.                                  setCursor(SwingUtil.PANNING_CURSOR);
850               */                          }
851                  if (panning_started == false){  
852                          panning_started = true;                          // move the image with the mouse
853                          setCursor( SwingUtil.PANNING_CURSOR );                          if ((lastX > 0) && (lastY > 0)) {
854                  }                                  int dx = lastX - startX;
855                                                    int dy = lastY - startY;
856                                                    // System.out.println("translate "+dx+","+dy);
857              // move the image with the mouse                                  final Graphics2D g2 = panningImage.createGraphics();
858              if ((lastX > 0) && (lastY > 0)) {                                  g2.setBackground(new Color(240, 240, 240)); // TODO richtige
859                  int dx = lastX - startX;                                                                                                                          // farbe? am besten
860                  int dy = lastY - startY;                                                                                                                          // vom L&F die
861                  // System.out.println("translate "+dx+","+dy);                                                                                                                          // hintergrundfarbe
862                  final Graphics2D g2 = panningImage.createGraphics();                                                                                                                          // auslesen...
                 g2.setBackground( new Color(240,240,240) ); //TODO richtige farbe? am besten vom L&F die hintergrundfarbe auslesen...  
863                                  g2.clearRect(0, 0, this.getWidth(), this.getHeight());                                  g2.clearRect(0, 0, this.getWidth(), this.getHeight());
864                                  g2.drawImage(baseImage, dx, dy, this);                                  g2.drawImage(baseImage, dx, dy, this);
865                  graphics.drawImage(panningImage, 0, 0, this);                                  graphics.drawImage(panningImage, 0, 0, this);
866              }                          }
867    
868              lastX = x;                          lastX = x;
869              lastY = y;                          lastY = y;
870          } else                  } else
871                    
872          if ((state == JMapPane.ZoomIn) || (state == JMapPane.ZoomOut)) {                  if ((state == JMapPane.ZoomIn) || (state == JMapPane.ZoomOut)) {
873            
874                                    graphics.setXORMode(Color.WHITE);
875              graphics.setXORMode(Color.WHITE);  
876                            if ((lastX > 0) && (lastY > 0)) {
877              if ((lastX > 0) && (lastY > 0)) {                                  drawRectangle(graphics);
878                  drawRectangle(graphics);                          }
879              }  
880                            // draw new box
881              // draw new box                          lastX = x;
882              lastX = x;                          lastY = y;
883              lastY = y;                          drawRectangle(graphics);
884              drawRectangle(graphics);                  } else if (state == JMapPane.Select && selectionLayer != null) {
885          } else if (state == JMapPane.Select && selectionLayer != null) {  
886                            // construct a new bbox filter
887              // construct a new bbox filter                          Rectangle bounds = this.getBounds();
888              Rectangle bounds = this.getBounds();  
889                            double mapWidth = mapArea.getWidth();
890              double mapWidth = mapArea.getWidth();                          double mapHeight = mapArea.getHeight();
891              double mapHeight = mapArea.getHeight();  
892                            double x1 = ((this.startX * mapWidth) / (double) bounds.width)
893              double x1 = ((this.startX * mapWidth) / (double) bounds.width)                                          + mapArea.getMinX();
894                      + mapArea.getMinX();                          double y1 = (((bounds.getHeight() - this.startY) * mapHeight) / (double) bounds.height)
895              double y1 = (((bounds.getHeight() - this.startY) * mapHeight) / (double) bounds.height)                                          + mapArea.getMinY();
896                      + mapArea.getMinY();                          double x2 = ((x * mapWidth) / (double) bounds.width)
897              double x2 = ((x * mapWidth) / (double) bounds.width)                                          + mapArea.getMinX();
898                      + mapArea.getMinX();                          double y2 = (((bounds.getHeight() - y) * mapHeight) / (double) bounds.height)
899              double y2 = (((bounds.getHeight() - y) * mapHeight) / (double) bounds.height)                                          + mapArea.getMinY();
900                      + mapArea.getMinY();                          double left = Math.min(x1, x2);
901              double left = Math.min(x1, x2);                          double right = Math.max(x1, x2);
902              double right = Math.max(x1, x2);                          double bottom = Math.min(y1, y2);
903              double bottom = Math.min(y1, y2);                          double top = Math.max(y1, y2);
904              double top = Math.max(y1, y2);  
905                            String name = selectionLayer.getFeatureSource().getSchema()
906                                            .getDefaultGeometry().getName();
907              String name = selectionLayer.getFeatureSource().getSchema()  
908                      .getDefaultGeometry().getName();                          if (name == "") {
909                                    name = "the_geom";
910              if (name == "") {                          }
911                  name = "the_geom";                          Filter bb = ff.bbox(ff.property(name), left, bottom, right, top,
912              }                                          getContext().getCoordinateReferenceSystem().toString());
913              Filter bb = ff.bbox(ff.property(name), left, bottom, right, top,                          if (selectionManager != null) {
914                      getContext().getCoordinateReferenceSystem().toString());                                  selectionManager.selectionChanged(this, bb);
915              if(selectionManager!=null) {                          }
916                  selectionManager.selectionChanged(this, bb);  
917              }                          graphics.setXORMode(Color.green);
918    
919              graphics.setXORMode(Color.green);                          /*
920                             * if ((lastX > 0) && (lastY > 0)) { drawRectangle(graphics); }
921              /*                           */
922               * if ((lastX > 0) && (lastY > 0)) { drawRectangle(graphics); }  
923               */                          // draw new box
924                            lastX = x;
925              // draw new box                          lastY = y;
926              lastX = x;                          drawRectangle(graphics);
927              lastY = y;                  }
             drawRectangle(graphics);  
        }  
       
     }  
   
     // sk.cs  
 //    private void processDrag(int x1, int y1, int x2, int y2) {  
     // sk.ce  
     protected void processDrag(int x1, int y1, int x2, int y2, MouseEvent e) {  
           
         /****  
          * If no layer is availabe we dont want a NullPointerException  
          */  
         if (mapArea == null) return;  
           
         // System.out.println("processing drag from " + x1 + "," + y1 + " -> "  
         // + x2 + "," + y2);  
         if ((x1 == x2) && (y1 == y2)) {  
             if (isClickable()) {  
                 mouseClicked(new MouseEvent(this, 0, new Date().getTime(), 0,  
                         x1, y1, y2, false));  
             }  
   
             return;  
         }  
           
         Rectangle bounds = this.getBounds();  
   
         double mapWidth = mapArea.getWidth();  
         double mapHeight = mapArea.getHeight();  
   
         double startX = ((x1 * mapWidth) / (double) bounds.width)  
                 + mapArea.getMinX();  
         double startY = (((bounds.getHeight() - y1) * mapHeight) / (double) bounds.height)  
                 + mapArea.getMinY();  
         double endX = ((x2 * mapWidth) / (double) bounds.width)  
                 + mapArea.getMinX();  
         double endY = (((bounds.getHeight() - y2) * mapHeight) / (double) bounds.height)  
                 + mapArea.getMinY();  
   
         if (  (state == JMapPane.Pan) || (e.getButton()== MouseEvent.BUTTON3)) {  
             // move the image with the mouse  
             // calculate X offsets from start point to the end Point  
             double deltaX1 = endX - startX;  
   
             // System.out.println("deltaX " + deltaX1);  
             // new edges  
             double left = mapArea.getMinX() - deltaX1;  
             double right = mapArea.getMaxX() - deltaX1;  
   
             // now for Y  
             double deltaY1 = endY - startY;  
   
             // System.out.println("deltaY " + deltaY1);  
             double bottom = mapArea.getMinY() - deltaY1;  
             double top = mapArea.getMaxY() - deltaY1;  
             Coordinate ll = new Coordinate(left, bottom);  
             Coordinate ur = new Coordinate(right, top);  
 //xulu.sc  
 //            mapArea = fixAspectRatio(this.getBounds(), new Envelope(ll, ur));  
             setMapArea( fixAspectRatio(this.getBounds(), new Envelope(ll, ur)) );  
 //xulu.ec  
         } else if (state == JMapPane.ZoomIn) {  
                   
   
                 // Zu kleine Flächen sollen nicht gezoomt werden.  
                 //sk.bc  
                 if ( (Math.abs(x1-x2) * Math.abs(y2-y1) )<100 ) return;  
                 // sk.ec  
                   
                 drawRectangle(this.getGraphics());  
             // make the dragged rectangle (in map coords) the new BBOX  
             double left = Math.min(startX, endX);  
             double right = Math.max(startX, endX);  
             double bottom = Math.min(startY, endY);  
             double top = Math.max(startY, endY);  
             Coordinate ll = new Coordinate(left, bottom);  
             Coordinate ur = new Coordinate(right, top);  
 //xulu.sc  
 //            mapArea = fixAspectRatio(this.getBounds(), new Envelope(ll, ur));  
             setMapArea( fixAspectRatio(this.getBounds(), new Envelope(ll, ur)) );  
 //xulu.ec  
         } else if (state == JMapPane.ZoomOut) {  
                 drawRectangle(this.getGraphics());  
                   
                 // make the dragged rectangle in screen coords the new map size?  
             double left = Math.min(startX, endX);  
             double right = Math.max(startX, endX);  
             double bottom = Math.min(startY, endY);  
             double top = Math.max(startY, endY);  
             double nWidth = (mapWidth * mapWidth) / (right - left);  
             double nHeight = (mapHeight * mapHeight) / (top - bottom);  
             double deltaX1 = left - mapArea.getMinX();  
             double nDeltaX1 = (deltaX1 * nWidth) / mapWidth;  
             double deltaY1 = bottom - mapArea.getMinY();  
             double nDeltaY1 = (deltaY1 * nHeight) / mapHeight;  
             Coordinate ll = new Coordinate(mapArea.getMinX() - nDeltaX1,  
                     mapArea.getMinY() - nDeltaY1);  
             double deltaX2 = mapArea.getMaxX() - right;  
             double nDeltaX2 = (deltaX2 * nWidth) / mapWidth;  
             double deltaY2 = mapArea.getMaxY() - top;  
             double nDeltaY2 = (deltaY2 * nHeight) / mapHeight;  
             Coordinate ur = new Coordinate(mapArea.getMaxX() + nDeltaX2,  
                     mapArea.getMaxY() + nDeltaY2);  
 //xulu.sc              
 //            mapArea = fixAspectRatio(this.getBounds(), new Envelope(ll, ur));  
             setMapArea( fixAspectRatio(this.getBounds(), new Envelope(ll, ur)) );  
 //xulu.ec  
         } else if (state == JMapPane.Select && selectionLayer !=null) {  
             double left = Math.min(startX, endX);  
             double right = Math.max(startX, endX);  
             double bottom = Math.min(startY, endY);  
             double top = Math.max(startY, endY);  
   
   
             String name = selectionLayer.getFeatureSource().getSchema()  
                     .getDefaultGeometry().getLocalName();  
   
             if (name == "") {  
                 name = "the_geom";  
             }  
             Filter bb = ff.bbox(ff.property(name), left, bottom, right, top,  
                     getContext().getCoordinateReferenceSystem().toString());  
             //System.out.println(bb.toString());  
             if(selectionManager!=null) {  
                 selectionManager.selectionChanged(this, bb);  
             }  
             /*FeatureCollection fc;  
             selection = null;  
             try {  
                 fc = selectionLayer.getFeatureSource().getFeatures(bb);  
                 selection = fc;  
             } catch (IOException e) {  
                 e.printStackTrace();  
             }  
 */  
         }  
   
 //xulu.so  
 //        setMapArea(mapArea);  
 //xulu.eo  
         repaint();  
     }  
   
     private boolean isClickable() {  
         return clickable;  
     }  
   
     private org.geotools.styling.Style setupStyle(int type, Color color) {  
         StyleFactory sf = org.geotools.factory.CommonFactoryFinder  
                 .getStyleFactory(null);  
         StyleBuilder sb = new StyleBuilder();  
   
         org.geotools.styling.Style s = sf.createStyle();  
         s.setTitle("selection");  
   
         // TODO parameterise the color  
         PolygonSymbolizer ps = sb.createPolygonSymbolizer(color);  
         ps.setStroke(sb.createStroke(color));  
   
         LineSymbolizer ls = sb.createLineSymbolizer(color);  
         Graphic h = sb.createGraphic();  
         h.setMarks(new Mark[] { sb.createMark("square", color) });  
   
         PointSymbolizer pts = sb.createPointSymbolizer(h);  
   
         // Rule r = sb.createRule(new Symbolizer[]{ps,ls,pts});  
         switch (type) {  
         case POLYGON:  
             s = sb.createStyle(ps);  
   
             break;  
   
         case POINT:  
             s = sb.createStyle(pts);  
   
             break;  
   
         case LINE:  
             s = sb.createStyle(ls);  
         }  
   
         return s;  
     }  
   
     public void highlightChanged(HighlightChangedEvent e) {  
         org.opengis.filter.Filter f = e.getFilter();  
   
         try {  
             highlightFeature = highlightLayer.getFeatureSource().getFeatures(f);  
         } catch (IOException e1) {  
             // TODO Auto-generated catch block  
             e1.printStackTrace();  
         }  
   
         repaint();  
     }  
   
     public void propertyChange(PropertyChangeEvent evt) {  
         String prop = evt.getPropertyName();  
   
         if (prop.equalsIgnoreCase("crs")) {  
             context.setAreaOfInterest(context.getAreaOfInterest(),  
                     (CoordinateReferenceSystem) evt.getNewValue());  
         }  
     }  
   
     public boolean isReset() {  
         return reset;  
     }  
   
     public void setReset(boolean reset) {  
         this.reset = reset;  
     }  
   
     public void layerAdded(MapLayerListEvent event) {  
         changed = true;  
   
         if (context.getLayers().length == 1) { // the first one  
   
             try {  
 //xulu.sc      
 //            mapArea = context.getLayerBounds();  
               mapArea = context.getAreaOfInterest();  
               if ( mapArea == null )  
                 mapArea = context.getLayerBounds();  
 //xulu.ec  
             } catch (IOException e) {  
                 // TODO Auto-generated catch block  
                 e.printStackTrace();  
             }  
   
             reset = true;  
         }  
   
         repaint();  
     }  
   
     public void layerRemoved(MapLayerListEvent event) {  
         changed = true;  
         repaint();  
     }  
   
     public void layerChanged(MapLayerListEvent event) {  
         changed = true;  
         // System.out.println("layer changed - repaint");  
         repaint();  
     }  
   
     public void layerMoved(MapLayerListEvent event) {  
         changed = true;  
         repaint();  
     }  
   
     protected void drawRectangle(Graphics graphics) {  
         // undraw last box/draw new box  
         int left = Math.min(startX, lastX);  
         int right = Math.max(startX, lastX);  
         int top = Math.max(startY, lastY);  
         int bottom = Math.min(startY, lastY);  
         int width = right - left;  
         int height = top - bottom;  
         // System.out.println("drawing rect("+left+","+bottom+","+ width+","+  
         // height+")");  
         graphics.drawRect(left, bottom, width, height);  
     }  
   
     /**  
      * if clickable is set to true then a single click on the map pane will zoom  
      * or pan the map.  
      *  
      * @param clickable  
      */  
     public void setClickable(boolean clickable) {  
         this.clickable = clickable;  
     }  
   
     public void mouseMoved(MouseEvent e) {  
     }  
   
     public FeatureCollection getSelection() {  
         return selection;  
     }  
   
     public void setSelection(FeatureCollection selection) {  
         this.selection = selection;  
         repaint();  
     }  
928    
929      /* (non-Javadoc)          }
930       * @see org.geotools.gui.swing.event.SelectionChangeListener#selectionChanged(org.geotools.gui.swing.event.SelectionChangedEvent)  
931       */          // sk.cs
932      public void selectionChanged(SelectionChangedEvent e) {          // private void processDrag(int x1, int y1, int x2, int y2) {
933            // sk.ce
934            protected void processDrag(final int x1, final int y1, final int x2,
935                            final int y2, MouseEvent e) {
936    
937                    /****
938                     * If no layer is availabe we dont want a NullPointerException
939                     */
940                    if (mapArea == null)
941                            return;
942    
943                    // System.out.println("processing drag from " + x1 + "," + y1 + " -> "
944                    // + x2 + "," + y2);
945                    if ((x1 == x2) && (y1 == y2)) {
946                            if (isClickable()) {
947                                    mouseClicked(new MouseEvent(this, 0, new Date().getTime(), 0,
948                                                    x1, y1, y2, false));
949                            }
950    
951                            return;
952                    }
953    
954                    Rectangle bounds = this.getBounds();
955    
956                    double mapWidth = mapArea.getWidth();
957                    double mapHeight = mapArea.getHeight();
958    
959                    double startX = ((x1 * mapWidth) / (double) bounds.width)
960                                    + mapArea.getMinX();
961                    double startY = (((bounds.getHeight() - y1) * mapHeight) / (double) bounds.height)
962                                    + mapArea.getMinY();
963                    double endX = ((x2 * mapWidth) / (double) bounds.width)
964                                    + mapArea.getMinX();
965                    double endY = (((bounds.getHeight() - y2) * mapHeight) / (double) bounds.height)
966                                    + mapArea.getMinY();
967    
968                    if ((state == JMapPane.Pan) || (e.getButton() == MouseEvent.BUTTON3)) {
969                            // move the image with the mouse
970                            // calculate X offsets from start point to the end Point
971                            double deltaX1 = endX - startX;
972    
973                            // System.out.println("deltaX " + deltaX1);
974                            // new edges
975                            double left = mapArea.getMinX() - deltaX1;
976                            double right = mapArea.getMaxX() - deltaX1;
977    
978                            // now for Y
979                            double deltaY1 = endY - startY;
980    
981                            // System.out.println("deltaY " + deltaY1);
982                            double bottom = mapArea.getMinY() - deltaY1;
983                            double top = mapArea.getMaxY() - deltaY1;
984                            Coordinate ll = new Coordinate(left, bottom);
985                            Coordinate ur = new Coordinate(right, top);
986                            // xulu.sc
987                            // mapArea = fixAspectRatio(this.getBounds(), new Envelope(ll, ur));
988                            setMapArea(fixAspectRatio(this.getBounds(), new Envelope(ll, ur)));
989                            // xulu.ec
990                    } else if (state == JMapPane.ZoomIn) {
991    
992                            // Zu kleine Flächen sollen nicht gezoomt werden.
993                            // sk.bc
994                            if ((Math.abs(x1 - x2) * Math.abs(y2 - y1)) < 150)
995                                    return;
996                            // sk.ec
997    
998                            drawRectangle(this.getGraphics());
999                            // make the dragged rectangle (in map coords) the new BBOX
1000                            double left = Math.min(startX, endX);
1001                            double right = Math.max(startX, endX);
1002                            double bottom = Math.min(startY, endY);
1003                            double top = Math.max(startY, endY);
1004                            Coordinate ll = new Coordinate(left, bottom);
1005                            Coordinate ur = new Coordinate(right, top);
1006                            // xulu.sc
1007    
1008                            // mapArea = fixAspectRatio(this.getBounds(), new Envelope(ll, ur));
1009                            setMapArea(bestAllowedMapArea(new Envelope(ll, ur)));
1010    
1011                            // sk.sc
1012    //                      {
1013    //                      // SK tries to paint a preview of the zoom ;-9 aha.... well
1014    //                      Graphics2D graphics = (Graphics2D) JMapPane.this.getGraphics();
1015    //                      graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
1016    //                                      RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
1017    //                      graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
1018    //                                      RenderingHints.VALUE_ANTIALIAS_OFF);
1019    //                      graphics.setRenderingHint(RenderingHints.KEY_RENDERING,
1020    //                                      RenderingHints.VALUE_RENDER_SPEED);
1021    //                      graphics.drawImage(baseImage, 0, 0, JMapPane.this.getWidth(),
1022    //                                      JMapPane.this.getHeight(), x1, y1, x2, y2, null);
1023    //                      }
1024                            // xulu.ec
1025                    } else if (state == JMapPane.ZoomOut) {
1026                            drawRectangle(this.getGraphics());
1027    
1028                            // make the dragged rectangle in screen coords the new map size?
1029                            double left = Math.min(startX, endX);
1030                            double right = Math.max(startX, endX);
1031                            double bottom = Math.min(startY, endY);
1032                            double top = Math.max(startY, endY);
1033                            double nWidth = (mapWidth * mapWidth) / (right - left);
1034                            double nHeight = (mapHeight * mapHeight) / (top - bottom);
1035                            double deltaX1 = left - mapArea.getMinX();
1036                            double nDeltaX1 = (deltaX1 * nWidth) / mapWidth;
1037                            double deltaY1 = bottom - mapArea.getMinY();
1038                            double nDeltaY1 = (deltaY1 * nHeight) / mapHeight;
1039                            Coordinate ll = new Coordinate(mapArea.getMinX() - nDeltaX1,
1040                                            mapArea.getMinY() - nDeltaY1);
1041                            double deltaX2 = mapArea.getMaxX() - right;
1042                            double nDeltaX2 = (deltaX2 * nWidth) / mapWidth;
1043                            double deltaY2 = mapArea.getMaxY() - top;
1044                            double nDeltaY2 = (deltaY2 * nHeight) / mapHeight;
1045                            Coordinate ur = new Coordinate(mapArea.getMaxX() + nDeltaX2,
1046                                            mapArea.getMaxY() + nDeltaY2);
1047                            // xulu.sc
1048                            // mapArea = fixAspectRatio(this.getBounds(), new Envelope(ll, ur));
1049                            setMapArea(bestAllowedMapArea(new Envelope(ll, ur)));
1050    
1051                            // xulu.ec
1052                    } else if (state == JMapPane.Select && selectionLayer != null) {
1053                            double left = Math.min(startX, endX);
1054                            double right = Math.max(startX, endX);
1055                            double bottom = Math.min(startY, endY);
1056                            double top = Math.max(startY, endY);
1057    
1058                            String name = selectionLayer.getFeatureSource().getSchema()
1059                                            .getDefaultGeometry().getLocalName();
1060    
1061                            if (name == "") {
1062                                    name = "the_geom";
1063                            }
1064                            Filter bb = ff.bbox(ff.property(name), left, bottom, right, top,
1065                                            getContext().getCoordinateReferenceSystem().toString());
1066                            // System.out.println(bb.toString());
1067                            if (selectionManager != null) {
1068                                    selectionManager.selectionChanged(this, bb);
1069                            }
1070                            /*
1071                             * FeatureCollection fc; selection = null; try { fc =
1072                             * selectionLayer.getFeatureSource().getFeatures(bb); selection =
1073                             * fc; } catch (IOException e) { e.printStackTrace(); }
1074                             */
1075                    }
1076    
1077                    // xulu.so
1078                    // setMapArea(mapArea);
1079                    // xulu.eo
1080                    repaint();
1081            }
1082    
1083            private boolean isClickable() {
1084                    return clickable;
1085            }
1086    
1087            private org.geotools.styling.Style setupStyle(int type, Color color) {
1088                    StyleFactory sf = org.geotools.factory.CommonFactoryFinder
1089                                    .getStyleFactory(null);
1090                    StyleBuilder sb = new StyleBuilder();
1091    
1092                    org.geotools.styling.Style s = sf.createStyle();
1093                    s.setTitle("selection");
1094    
1095          try {                  // TODO parameterise the color
1096              selection = selectionLayer.getFeatureSource().getFeatures(e.getFilter());                  PolygonSymbolizer ps = sb.createPolygonSymbolizer(color);
1097              repaint();                  ps.setStroke(sb.createStroke(color));
         } catch (IOException e1) {  
             e1.printStackTrace();  
         }  
     }  
1098    
1099      public SelectionManager getSelectionManager() {                  LineSymbolizer ls = sb.createLineSymbolizer(color);
1100          return selectionManager;                  Graphic h = sb.createGraphic();
1101      }                  h.setMarks(new Mark[] { sb.createMark("square", color) });
1102    
1103      public void setSelectionManager(SelectionManager selectionManager) {                  PointSymbolizer pts = sb.createPointSymbolizer(h);
         this.selectionManager = selectionManager;  
         this.selectionManager.addSelectionChangeListener(this);  
1104    
1105      }                  // Rule r = sb.createRule(new Symbolizer[]{ps,ls,pts});
1106                    switch (type) {
1107                    case POLYGON:
1108                            s = sb.createStyle(ps);
1109    
1110                            break;
1111    
1112  //xulu.sn                  case POINT:
1113                            s = sb.createStyle(pts);
1114    
1115                            break;
1116    
1117                    case LINE:
1118                            s = sb.createStyle(ls);
1119                    }
1120    
1121                    return s;
1122            }
1123    
1124            public void highlightChanged(HighlightChangedEvent e) {
1125                    org.opengis.filter.Filter f = e.getFilter();
1126    
1127                    try {
1128                            highlightFeature = highlightLayer.getFeatureSource().getFeatures(f);
1129                    } catch (IOException e1) {
1130                            // TODO Auto-generated catch block
1131                            e1.printStackTrace();
1132                    }
1133    
1134                    repaint();
1135            }
1136    
1137            public void propertyChange(PropertyChangeEvent evt) {
1138                    String prop = evt.getPropertyName();
1139    
1140                    if (prop.equalsIgnoreCase("crs")) {
1141                            context.setAreaOfInterest(context.getAreaOfInterest(),
1142                                            (CoordinateReferenceSystem) evt.getNewValue());
1143                    }
1144            }
1145    
1146            public boolean isReset() {
1147                    return reset;
1148            }
1149    
1150            public void setReset(boolean reset) {
1151                    this.reset = reset;
1152            }
1153    
1154            public void layerAdded(MapLayerListEvent event) {
1155                    changed = true;
1156    
1157                    if (context.getLayers().length == 1) { // the first one
1158    
1159                            try {
1160                                    // xulu.sc
1161                                    // mapArea = context.getLayerBounds();
1162                                    mapArea = context.getAreaOfInterest();
1163                                    if (mapArea == null)
1164                                            mapArea = context.getLayerBounds();
1165                                    // xulu.ec
1166                            } catch (IOException e) {
1167                                    // TODO Auto-generated catch block
1168                                    e.printStackTrace();
1169                            }
1170    
1171                            reset = true;
1172                    }
1173    
1174                    repaint();
1175            }
1176    
1177            public void layerRemoved(MapLayerListEvent event) {
1178                    changed = true;
1179                    repaint();
1180            }
1181    
1182            public void layerChanged(MapLayerListEvent event) {
1183                    changed = true;
1184                    // System.out.println("layer changed - repaint");
1185                    repaint();
1186            }
1187    
1188            public void layerMoved(MapLayerListEvent event) {
1189                    changed = true;
1190                    repaint();
1191            }
1192    
1193            protected void drawRectangle(Graphics graphics) {
1194                    // undraw last box/draw new box
1195                    int left = Math.min(startX, lastX);
1196                    int right = Math.max(startX, lastX);
1197                    int top = Math.max(startY, lastY);
1198                    int bottom = Math.min(startY, lastY);
1199                    int width = right - left;
1200                    int height = top - bottom;
1201                    // System.out.println("drawing rect("+left+","+bottom+","+ width+","+
1202                    // height+")");
1203                    graphics.drawRect(left, bottom, width, height);
1204            }
1205    
1206            /**
1207             * if clickable is set to true then a single click on the map pane will zoom
1208             * or pan the map.
1209             *
1210             * @param clickable
1211             */
1212            public void setClickable(boolean clickable) {
1213                    this.clickable = clickable;
1214            }
1215    
1216            public void mouseMoved(MouseEvent e) {
1217            }
1218    
1219            public FeatureCollection getSelection() {
1220                    return selection;
1221            }
1222    
1223            public void setSelection(FeatureCollection selection) {
1224                    this.selection = selection;
1225                    repaint();
1226            }
1227    
1228            /*
1229             * (non-Javadoc)
1230             *
1231             * @see
1232             * org.geotools.gui.swing.event.SelectionChangeListener#selectionChanged
1233             * (org.geotools.gui.swing.event.SelectionChangedEvent)
1234             */
1235            public void selectionChanged(SelectionChangedEvent e) {
1236    
1237                    try {
1238                            selection = selectionLayer.getFeatureSource().getFeatures(
1239                                            e.getFilter());
1240                            repaint();
1241                    } catch (IOException e1) {
1242                            e1.printStackTrace();
1243                    }
1244            }
1245    
1246            public SelectionManager getSelectionManager() {
1247                    return selectionManager;
1248            }
1249    
1250            public void setSelectionManager(SelectionManager selectionManager) {
1251                    this.selectionManager = selectionManager;
1252                    this.selectionManager.addSelectionChangeListener(this);
1253    
1254            }
1255    
1256            // xulu.sn
1257          /**          /**
1258           * Korrigiert den {@link Envelope} aka {@code mapArea} auf die beste           * Korrigiert den {@link Envelope} aka {@code mapArea} auf die beste
1259           * erlaubte Flaeche damit die Massstabsbeschaenkungen noch eingehalten           * erlaubte Flaeche damit die Massstabsbeschaenkungen noch eingehalten
# Line 1258  public class JMapPane extends JPanel imp Line 1272  public class JMapPane extends JPanel imp
1272                          return env;                          return env;
1273    
1274                  /**                  /**
1275                   * Correct the aspect Ratio before we check the rest. Otherwise we might easily fail.                   * Correct the aspect Ratio before we check the rest. Otherwise we might
1276                     * easily fail.
1277                   */                   */
1278                  env = fixAspectRatio(this.getBounds(), env);                  env = fixAspectRatio(this.getBounds(), env);
1279    
# Line 1294  public class JMapPane extends JPanel imp Line 1309  public class JMapPane extends JPanel imp
1309                  return new Envelope(ll, ur);                  return new Envelope(ll, ur);
1310          }          }
1311    
1312    /**          /**
1313     * Retuns the minimum allowed zoom scale. This is the bigger number value of the two.           * Retuns the minimum allowed zoom scale. This is the bigger number value of
1314     * Defaults to {@link Double}.MAX_VALUE           * the two. Defaults to {@link Double}.MAX_VALUE
1315     *           *
1316     * @author <a href="mailto:[email protected]">Stefan Alfons Kr&uuml;ger</a>           * @author <a href="mailto:[email protected]">Stefan Alfons
1317     */           *         Kr&uuml;ger</a>
1318    public Double getMinZoomScale() {           */
1319      return minZoomScale;          public Double getMinZoomScale() {
1320    }                  return minZoomScale;
1321            }
   /**  
    * Retuns the maximum allowed zoom scale. This is the smaller number value of the two.  
    * Defaults to {@link Double}.MIN_VALUE  
    *  
    * @author <a href="mailto:[email protected]">Stefan Alfons Kr&uuml;ger</a>  
    */  
   public Double getMaxZoomScale() {  
     return maxZoomScale;  
   }  
   
   /**  
    * Set the maximum allowed zoom scale. This is the smaller number value of the two.  
    *  
    * @author <a href="mailto:[email protected]">Stefan Alfons Kr&uuml;ger</a>  
    */  
   public void setMaxZoomScale(Double maxZoomScale) {  
     // System.out.println("setting max scale to "+maxZoomScale);  
     this.maxZoomScale = maxZoomScale;  
   }  
   
   /**  
    * Set the minimum (nearest) allowed zoom scale. This is the bigger number value of the two.  
    *  
    * @author <a href="mailto:[email protected]">Stefan Alfons Kr&uuml;ger</a>  
    */  
   public void setMinZoomScale(Double minZoomScale) {  
     this.minZoomScale = minZoomScale;  
   }  
 //xulu.en  
1322    
1323            /**
1324             * Retuns the maximum allowed zoom scale. This is the smaller number value
1325             * of the two. Defaults to {@link Double}.MIN_VALUE
1326             *
1327             * @author <a href="mailto:[email protected]">Stefan Alfons
1328             *         Kr&uuml;ger</a>
1329             */
1330            public Double getMaxZoomScale() {
1331                    return maxZoomScale;
1332            }
1333    
1334            /**
1335             * Set the maximum allowed zoom scale. This is the smaller number value of
1336             * the two.
1337             *
1338             * @author <a href="mailto:[email protected]">Stefan Alfons
1339             *         Kr&uuml;ger</a>
1340             */
1341            public void setMaxZoomScale(Double maxZoomScale) {
1342                    // System.out.println("setting max scale to "+maxZoomScale);
1343                    this.maxZoomScale = maxZoomScale;
1344            }
1345    
1346            /**
1347             * Set the minimum (nearest) allowed zoom scale. This is the bigger number
1348             * value of the two.
1349             *
1350             * @author <a href="mailto:[email protected]">Stefan Alfons
1351             *         Kr&uuml;ger</a>
1352             */
1353            public void setMinZoomScale(Double minZoomScale) {
1354                    this.minZoomScale = minZoomScale;
1355            }
1356            // xulu.en
1357    
1358  }  }

Legend:
Removed from v.127  
changed lines
  Added in v.144

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26