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

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26