/[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 332 by alfonx, Wed Aug 26 17:15:49 2009 UTC revision 336 by alfonx, Thu Aug 27 09:10:10 2009 UTC
# Line 67  import org.geotools.map.event.MapLayerLi Line 67  import org.geotools.map.event.MapLayerLi
67  import org.geotools.map.event.MapLayerListListener;  import org.geotools.map.event.MapLayerListListener;
68  import org.geotools.referencing.crs.DefaultGeographicCRS;  import org.geotools.referencing.crs.DefaultGeographicCRS;
69  import org.geotools.renderer.GTRenderer;  import org.geotools.renderer.GTRenderer;
70    import org.geotools.renderer.label.LabelCacheImpl;
71  import org.geotools.renderer.lite.LabelCache;  import org.geotools.renderer.lite.LabelCache;
72  import org.geotools.renderer.lite.LabelCacheDefault;  import org.geotools.renderer.lite.LabelCacheDefault;
73  import org.geotools.renderer.lite.StreamingRenderer;  import org.geotools.renderer.lite.StreamingRenderer;
# Line 91  import com.vividsolutions.jts.geom.Geome Line 92  import com.vividsolutions.jts.geom.Geome
92  import com.vividsolutions.jts.geom.GeometryFactory;  import com.vividsolutions.jts.geom.GeometryFactory;
93    
94  public class JMapPane extends JPanel implements MouseListener,  public class JMapPane extends JPanel implements MouseListener,
95                  MouseMotionListener, HighlightChangeListener, SelectionChangeListener,                  MouseMotionListener, PropertyChangeListener, MapLayerListListener {
                 PropertyChangeListener, MapLayerListListener {  
96          private static Logger LOGGER = Logger.getLogger(JMapPane.class.getName());          private static Logger LOGGER = Logger.getLogger(JMapPane.class.getName());
97    
98          private static final long serialVersionUID = -8647971481359690499L;          private static final long serialVersionUID = -8647971481359690499L;
# Line 158  public class JMapPane extends JPanel imp Line 158  public class JMapPane extends JPanel imp
158          // SK: private BufferedImage baseImage, panningImage;          // SK: private BufferedImage baseImage, panningImage;
159    
160          /**          /**
          * image of selection  
          */  
         private BufferedImage selectImage;  
   
         /**  
          * style for selected items  
          */  
         private Style selectionStyle;  
   
         /**  
          * layer that selection works on  
          */  
         private MapLayer selectionLayer;  
   
         /**  
          * layer that highlight works on  
          */  
         private MapLayer highlightLayer;  
   
         /**  
          * the object which manages highlighting  
          */  
         private HighlightManager highlightManager;  
   
         /**  
          * is highlighting on or off  
          */  
         private boolean highlight = true;  
   
         /**  
161           * a factory for filters           * a factory for filters
162           */           */
163          FilterFactory2 ff;          FilterFactory2 ff;
# Line 197  public class JMapPane extends JPanel imp Line 167  public class JMapPane extends JPanel imp
167           */           */
168          GeometryFactory gf = new GeometryFactory(); // FactoryFinder.getGeometryFactory(null);          GeometryFactory gf = new GeometryFactory(); // FactoryFinder.getGeometryFactory(null);
169    
         /**  
          * the collections of features to be selected or highlighted  
          */  
         FeatureCollection selection;  
   
         /**  
          * the collections of features to be selected or highlighted  
          */  
         FeatureCollection highlightFeature;  
   
170          private int state = ZoomIn;          private int state = ZoomIn;
171    
172          /**          /**
# Line 214  public class JMapPane extends JPanel imp Line 174  public class JMapPane extends JPanel imp
174           */           */
175          private double zoomFactor = 2.0;          private double zoomFactor = 2.0;
176    
         Style lineHighlightStyle;  
   
         Style pointHighlightStyle;  
   
         Style polygonHighlightStyle;  
   
         Style polygonSelectionStyle;  
   
         Style pointSelectionStyle;  
   
         Style lineSelectionStyle;  
   
177          boolean changed = true;          boolean changed = true;
178    
179          LabelCache labelCache = new LabelCacheDefault();          LabelCache labelCache = new LabelCacheImpl();
180    
181          // xulu.sc          // xulu.sc
182          // private boolean reset = false;          // private boolean reset = false;
# Line 245  public class JMapPane extends JPanel imp Line 193  public class JMapPane extends JPanel imp
193    
194          int lastY;          int lastY;
195    
         private SelectionManager selectionManager;  
196          // xulu.sn          // xulu.sn
197          private Double maxZoomScale = Double.MIN_VALUE;          private Double maxZoomScale = Double.MIN_VALUE;
198          private Double minZoomScale = Double.MAX_VALUE;          private Double minZoomScale = Double.MAX_VALUE;
# Line 301  public class JMapPane extends JPanel imp Line 248  public class JMapPane extends JPanel imp
248    
249                  this.addMouseListener(this);                  this.addMouseListener(this);
250                  this.addMouseMotionListener(this);                  this.addMouseMotionListener(this);
                 setHighlightManager(new HighlightManager(highlightLayer));  
                 setSelectionManager(new SelectionManager(selectionLayer));  
                 lineHighlightStyle = setupStyle(LINE, Color.red);  
   
                 pointHighlightStyle = setupStyle(POINT, Color.red);  
   
                 polygonHighlightStyle = setupStyle(POLYGON, Color.red);  
   
                 polygonSelectionStyle = setupStyle(POLYGON, Color.cyan);  
   
                 pointSelectionStyle = setupStyle(POINT, Color.cyan);  
   
                 lineSelectionStyle = setupStyle(LINE, Color.cyan);  
251                  setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));                  setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
252          }          }
253    
# Line 405  public class JMapPane extends JPanel imp Line 339  public class JMapPane extends JPanel imp
339                  this.zoomFactor = zoomFactor;                  this.zoomFactor = zoomFactor;
340          }          }
341    
         public MapLayer getSelectionLayer() {  
                 return selectionLayer;  
         }  
   
         public void setSelectionLayer(final MapLayer selectionLayer) {  
                 this.selectionLayer = selectionLayer;  
                 if (selectionManager != null) {  
                         selectionManager.setSelectionLayer(selectionLayer);  
                 }  
         }  
   
         public boolean isHighlight() {  
                 return highlight;  
         }  
   
         public void setHighlight(final boolean highlight) {  
                 this.highlight = highlight;  
         }  
   
         public MapLayer getHighlightLayer() {  
                 return highlightLayer;  
         }  
   
         public void setHighlightLayer(final MapLayer highlightLayer) {  
                 this.highlightLayer = highlightLayer;  
   
                 if (highlightManager != null) {  
                         highlightManager.setHighlightLayer(highlightLayer);  
                 }  
         }  
   
         public HighlightManager getHighlightManager() {  
                 return highlightManager;  
         }  
   
         public void setHighlightManager(final HighlightManager highlightManager) {  
                 this.highlightManager = highlightManager;  
                 this.highlightManager.addHighlightChangeListener(this);  
                 this.addMouseMotionListener(this.highlightManager);  
         }  
   
         public Style getLineHighlightStyle() {  
                 return lineHighlightStyle;  
         }  
   
         public void setLineHighlightStyle(final Style lineHighlightStyle) {  
                 this.lineHighlightStyle = lineHighlightStyle;  
         }  
   
         public Style getLineSelectionStyle() {  
                 return lineSelectionStyle;  
         }  
   
         public void setLineSelectionStyle(final Style lineSelectionStyle) {  
                 this.lineSelectionStyle = lineSelectionStyle;  
         }  
   
         public Style getPointHighlightStyle() {  
                 return pointHighlightStyle;  
         }  
   
         public void setPointHighlightStyle(final Style pointHighlightStyle) {  
                 this.pointHighlightStyle = pointHighlightStyle;  
         }  
   
         public Style getPointSelectionStyle() {  
                 return pointSelectionStyle;  
         }  
   
         public void setPointSelectionStyle(final Style pointSelectionStyle) {  
                 this.pointSelectionStyle = pointSelectionStyle;  
         }  
   
         public Style getPolygonHighlightStyle() {  
                 return polygonHighlightStyle;  
         }  
   
         public void setPolygonHighlightStyle(final Style polygonHighlightStyle) {  
                 this.polygonHighlightStyle = polygonHighlightStyle;  
         }  
   
         public Style getPolygonSelectionStyle() {  
                 return polygonSelectionStyle;  
         }  
   
         public void setPolygonSelectionStyle(final Style polygonSelectionStyle) {  
                 this.polygonSelectionStyle = polygonSelectionStyle;  
         }  
342    
343          protected void paintComponent(final Graphics g) {          protected void paintComponent(final Graphics g) {
344                  super.paintComponent(g);                  super.paintComponent(g);
# Line 509  public class JMapPane extends JPanel imp Line 355  public class JMapPane extends JPanel imp
355                                  try {                                  try {
356                                          mapArea = context.getLayerBounds();                                          mapArea = context.getLayerBounds();
357                                  } catch (final IOException e) {                                  } catch (final IOException e) {
358                                          // TODO Auto-generated catch block                                          LOGGER.warn("context.getLayerBounds()", e);
                                         e.printStackTrace();  
359                                  }                                  }
360                          }                          }
361    
# Line 554  public class JMapPane extends JPanel imp Line 399  public class JMapPane extends JPanel imp
399                  }                  }
400    
401                  ((Graphics2D) g).drawImage(baseImage, 0, 0, this);                  ((Graphics2D) g).drawImage(baseImage, 0, 0, this);
   
                 if ((selection != null) && (selection.size() > 0)) {  
                         // paint selection  
   
                         String type = selectionLayer.getFeatureSource().getSchema()  
                                         .getDefaultGeometry().getType().getName();  
                         /* String type = selection.getDefaultGeometry().getGeometryType(); */  
                         /* System.out.println(type); */  
                         if (type == null)  
                                 type = "polygon";  
   
                         /* String type = "point"; */  
   
                         if (type.toLowerCase().endsWith("polygon")) {  
                                 selectionStyle = polygonSelectionStyle;  
                         } else if (type.toLowerCase().endsWith("point")) {  
                                 selectionStyle = pointSelectionStyle;  
                         } else if (type.toLowerCase().endsWith("line")) {  
                                 selectionStyle = lineSelectionStyle;  
                         }  
   
                         selectionContext = new DefaultMapContext(DefaultGeographicCRS.WGS84);  
   
                         selectionContext.addLayer(selection, selectionStyle);  
                         selectionRenderer.setContext(selectionContext);  
   
                         selectImage = new BufferedImage(dr.width, dr.height,  
                                         BufferedImage.TYPE_INT_ARGB);  
   
                         final Graphics2D ig = selectImage.createGraphics();  
                         /* System.out.println("rendering selection"); */  
                         selectionRenderer.paint((Graphics2D) ig, dr, mapArea);  
   
                         ((Graphics2D) g).drawImage(selectImage, 0, 0, this);  
                 }  
   
                 if (highlight && (highlightFeature != null)  
                                 && (highlightFeature.size() > 0)) {  
                         /*  
                          * String type = selection.getDefaultGeometry().getGeometryType();  
                          * System.out.println(type); if(type==null) type="polygon";  
                          */  
                         String type = highlightLayer.getFeatureSource().getSchema()  
                                         .getDefaultGeometry().getType().getName();  
                         /* String type = selection.getDefaultGeometry().getGeometryType(); */  
                         // System.out.println(type);  
                         if (type == null)  
                                 type = "polygon";  
   
                         /* String type = "point"; */  
                         Style highlightStyle = null;  
                         if (type.toLowerCase().endsWith("polygon")) {  
                                 highlightStyle = polygonHighlightStyle;  
                         } else if (type.toLowerCase().endsWith("point")) {  
                                 highlightStyle = pointHighlightStyle;  
                         } else if (type.toLowerCase().endsWith("line")) {  
                                 highlightStyle = lineHighlightStyle;  
                         }  
   
                         final MapContext highlightContext = new DefaultMapContext(  
                                         DefaultGeographicCRS.WGS84);  
   
                         highlightContext.addLayer(highlightFeature, highlightStyle);  
                         highlightRenderer.setContext(highlightContext);  
   
                         /* System.out.println("rendering highlight"); */  
                         highlightRenderer.paint((Graphics2D) g, dr, mapArea);  
                 }  
402          }          }
403    
404          private Envelope fixAspectRatio(final Rectangle r, final Envelope mapArea) {          private Envelope fixAspectRatio(final Rectangle r, final Envelope mapArea) {
# Line 660  public class JMapPane extends JPanel imp Line 437  public class JMapPane extends JPanel imp
437                  return new Envelope(ll, ur);                  return new Envelope(ll, ur);
438          }          }
439    
440          public void doSelection(final double x, final double y, final MapLayer layer) {  //      public void doSelection(final double x, final double y, final MapLayer layer) {
441    //
442                  final Geometry geometry = gf.createPoint(new Coordinate(x, y));  //              final Geometry geometry = gf.createPoint(new Coordinate(x, y));
443    //
444                  // org.opengis.geometry.Geometry geometry = new Point();  //              // org.opengis.geometry.Geometry geometry = new Point();
445    //
446                  findFeature(geometry, layer);  //              findFeature(geometry, layer);
447    //
448          }  //      }
449    //
450          /**  //      /**
451           * @param geometry  //       * @param geometry
452           *            - a geometry to construct the filter with  //       *            - a geometry to construct the filter with
453           * @param i  //       * @param i
454           *            - the index of the layer to search  //       *            - the index of the layer to search
455           * @throws IndexOutOfBoundsException  //       * @throws IndexOutOfBoundsException
456           */  //       */
457          private void findFeature(final Geometry geometry, final MapLayer layer)  //      private void findFeature(final Geometry geometry, final MapLayer layer)
458                          throws IndexOutOfBoundsException {  //                      throws IndexOutOfBoundsException {
459                  org.opengis.filter.spatial.BinarySpatialOperator f = null;  //              org.opengis.filter.spatial.BinarySpatialOperator f = null;
460    //
461                  if ((context == null) || (layer == null)) {  //              if ((context == null) || (layer == null)) {
462                          return;  //                      return;
463                  }  //              }
464    //
465                  try {  //              try {
466                          String name = layer.getFeatureSource().getSchema()  //                      String name = layer.getFeatureSource().getSchema()
467                                          .getDefaultGeometry().getLocalName();  //                                      .getDefaultGeometry().getLocalName();
468    //
469                          if (name == "") {  //                      if (name == "") {
470                                  name = "the_geom";  //                              name = "the_geom";
471                          }  //                      }
472    //
473                          try {  //                      try {
474                                  f = ff.contains(ff.property(name), ff.literal(geometry));  //                              f = ff.contains(ff.property(name), ff.literal(geometry));
475                                  if (selectionManager != null) {  //                              if (selectionManager != null) {
476  //                                      System.out.println("selection changed");  ////                                    System.out.println("selection changed");
477                                          selectionManager.selectionChanged(this, f);  //                                      selectionManager.selectionChanged(this, f);
478    //
479                                  }  //                              }
480                          } catch (final IllegalFilterException e) {  //                      } catch (final IllegalFilterException e) {
481                                  // TODO Auto-generated catch block  //                              // TODO Auto-generated catch block
482                                  e.printStackTrace();  //                              e.printStackTrace();
483                          }  //                      }
484    //
485                          /*  //                      /*
486                           * // f.addLeftGeometry(ff.property(name)); //  //                       * // f.addLeftGeometry(ff.property(name)); //
487                           * System.out.println("looking with " + f); FeatureCollection fc =  //                       * System.out.println("looking with " + f); FeatureCollection fc =
488                           * layer.getFeatureSource().getFeatures(f);  //                       * layer.getFeatureSource().getFeatures(f);
489                           *  //                       *
490                           *  //                       *
491                           *  //                       *
492                           * if (fcol == null) { fcol = fc;  //                       * if (fcol == null) { fcol = fc;
493                           *  //                       *
494                           * // here we should set the defaultgeom type } else {  //                       * // here we should set the defaultgeom type } else {
495                           * fcol.addAll(fc); }  //                       * fcol.addAll(fc); }
496                           */  //                       */
497    //
498                          /*  //                      /*
499                           * GeometryAttributeType gat =  //                       * GeometryAttributeType gat =
500                           * layer.getFeatureSource().getSchema().getDefaultGeometry();  //                       * layer.getFeatureSource().getSchema().getDefaultGeometry();
501                           * fcol.setDefaultGeometry((Geometry)gat.createDefaultValue());  //                       * fcol.setDefaultGeometry((Geometry)gat.createDefaultValue());
502                           */  //                       */
503    //
504                          /*  //                      /*
505                           * Iterator fi = fc.iterator(); while (fi.hasNext()) { SimpleFeature feat  //                       * Iterator fi = fc.iterator(); while (fi.hasNext()) { SimpleFeature feat
506                           * = (SimpleFeature) fi.next(); System.out.println("selected " +  //                       * = (SimpleFeature) fi.next(); System.out.println("selected " +
507                           * feat.getAttribute("STATE_NAME")); }  //                       * feat.getAttribute("STATE_NAME")); }
508                           */  //                       */
509                  } catch (final IllegalFilterException e) {  //              } catch (final IllegalFilterException e) {
510                          // TODO Auto-generated catch block  //                      // TODO Auto-generated catch block
511                          e.printStackTrace();  //                      e.printStackTrace();
512                  }  //              }
513                  return;  //              return;
514          }  //      }
515    
516          public void mouseClicked(final MouseEvent e) {          public void mouseClicked(final MouseEvent e) {
517                  if (mapArea == null) return;                  if (mapArea == null) return;
# Line 782  public class JMapPane extends JPanel imp Line 559  public class JMapPane extends JPanel imp
559                          zlevel = 1.0 / zoomFactor;                          zlevel = 1.0 / zoomFactor;
560    
561                          break;                          break;
562    //
563                  case Select:  //              case Select:
564                          doSelection(mapX, mapY, selectionLayer);  //                      doSelection(mapX, mapY, selectionLayer);
565    //
566                          return;  //                      return;
567    
568                  default:                  default:
569                          return;                          return;
# Line 884  public class JMapPane extends JPanel imp Line 661  public class JMapPane extends JPanel imp
661                          lastX = x;                          lastX = x;
662                          lastY = y;                          lastY = y;
663                          drawRectangle(graphics);                          drawRectangle(graphics);
664                  } else if (state == JMapPane.Select && selectionLayer != null) {                  }
665    //              else if (state == JMapPane.Select && selectionLayer != null) {
666                          // construct a new bbox filter  //
667                          final Rectangle bounds = this.getBounds();  //                      // construct a new bbox filter
668    //                      final Rectangle bounds = this.getBounds();
669                          final double mapWidth = mapArea.getWidth();  //
670                          final double mapHeight = mapArea.getHeight();  //                      final double mapWidth = mapArea.getWidth();
671    //                      final double mapHeight = mapArea.getHeight();
672                          final double x1 = ((this.startX * mapWidth) / (double) bounds.width)  //
673                                          + mapArea.getMinX();  //                      final double x1 = ((this.startX * mapWidth) / (double) bounds.width)
674                          final double y1 = (((bounds.getHeight() - this.startY) * mapHeight) / (double) bounds.height)  //                                      + mapArea.getMinX();
675                                          + mapArea.getMinY();  //                      final double y1 = (((bounds.getHeight() - this.startY) * mapHeight) / (double) bounds.height)
676                          final double x2 = ((x * mapWidth) / (double) bounds.width)  //                                      + mapArea.getMinY();
677                                          + mapArea.getMinX();  //                      final double x2 = ((x * mapWidth) / (double) bounds.width)
678                          final double y2 = (((bounds.getHeight() - y) * mapHeight) / (double) bounds.height)  //                                      + mapArea.getMinX();
679                                          + mapArea.getMinY();  //                      final double y2 = (((bounds.getHeight() - y) * mapHeight) / (double) bounds.height)
680                          final double left = Math.min(x1, x2);  //                                      + mapArea.getMinY();
681                          final double right = Math.max(x1, x2);  //                      final double left = Math.min(x1, x2);
682                          final double bottom = Math.min(y1, y2);  //                      final double right = Math.max(x1, x2);
683                          final double top = Math.max(y1, y2);  //                      final double bottom = Math.min(y1, y2);
684    //                      final double top = Math.max(y1, y2);
685                          String name = selectionLayer.getFeatureSource().getSchema()  //
686                                          .getDefaultGeometry().getName();  //                      String name = selectionLayer.getFeatureSource().getSchema()
687    //                                      .getDefaultGeometry().getName();
688                          if (name == "") {  //
689                                  name = "the_geom";  //                      if (name == "") {
690                          }  //                              name = "the_geom";
691                          final Filter bb = ff.bbox(ff.property(name), left, bottom, right, top,  //                      }
692                                          getContext().getCoordinateReferenceSystem().toString());  //                      final Filter bb = ff.bbox(ff.property(name), left, bottom, right, top,
693                          if (selectionManager != null) {  //                                      getContext().getCoordinateReferenceSystem().toString());
694                                  selectionManager.selectionChanged(this, bb);  //                      if (selectionManager != null) {
695                          }  //                              selectionManager.selectionChanged(this, bb);
696    //                      }
697                          graphics.setXORMode(Color.green);  //
698    //                      graphics.setXORMode(Color.green);
699                          /*  //
700                           * if ((lastX > 0) && (lastY > 0)) { drawRectangle(graphics); }  //                      /*
701                           */  //                       * if ((lastX > 0) && (lastY > 0)) { drawRectangle(graphics); }
702    //                       */
703                          // draw new box  //
704                          lastX = x;  //                      // draw new box
705                          lastY = y;  //                      lastX = x;
706                          drawRectangle(graphics);  //                      lastY = y;
707                  }  //                      drawRectangle(graphics);
708    //              }
709    
710          }          }
711    
# Line 1052  public class JMapPane extends JPanel imp Line 830  public class JMapPane extends JPanel imp
830                          setMapArea(bestAllowedMapArea(new Envelope(ll, ur)));                          setMapArea(bestAllowedMapArea(new Envelope(ll, ur)));
831    
832                          // xulu.ec                          // xulu.ec
833                  } else if (state == JMapPane.Select && selectionLayer != null) {                  }
834                          final double left = Math.min(startX, endX);  //              else if (state == JMapPane.Select && selectionLayer != null) {
835                          final double right = Math.max(startX, endX);  //                      final double left = Math.min(startX, endX);
836                          final double bottom = Math.min(startY, endY);  //                      final double right = Math.max(startX, endX);
837                          final double top = Math.max(startY, endY);  //                      final double bottom = Math.min(startY, endY);
838    //                      final double top = Math.max(startY, endY);
839                          String name = selectionLayer.getFeatureSource().getSchema()  //
840                                          .getDefaultGeometry().getLocalName();  //                      String name = selectionLayer.getFeatureSource().getSchema()
841    //                                      .getDefaultGeometry().getLocalName();
842                          if (name == "") {  //
843                                  name = "the_geom";  //                      if (name == "") {
844                          }  //                              name = "the_geom";
845                          final Filter bb = ff.bbox(ff.property(name), left, bottom, right, top,  //                      }
846                                          getContext().getCoordinateReferenceSystem().toString());  //                      final Filter bb = ff.bbox(ff.property(name), left, bottom, right, top,
847                          // System.out.println(bb.toString());  //                                      getContext().getCoordinateReferenceSystem().toString());
848                          if (selectionManager != null) {  //                      // System.out.println(bb.toString());
849                                  selectionManager.selectionChanged(this, bb);  //                      if (selectionManager != null) {
850                          }  //                              selectionManager.selectionChanged(this, bb);
851                          /*  //                      }
852                           * FeatureCollection fc; selection = null; try { fc =  //                      /*
853                           * selectionLayer.getFeatureSource().getFeatures(bb); selection =  //                       * FeatureCollection fc; selection = null; try { fc =
854                           * fc; } catch (IOException e) { e.printStackTrace(); }  //                       * selectionLayer.getFeatureSource().getFeatures(bb); selection =
855                           */  //                       * fc; } catch (IOException e) { e.printStackTrace(); }
856                  }  //                       */
857    //              }
858    
859                  // xulu.so                  // xulu.so
860                  // setMapArea(mapArea);                  // setMapArea(mapArea);
# Line 1124  public class JMapPane extends JPanel imp Line 903  public class JMapPane extends JPanel imp
903                  return s;                  return s;
904          }          }
905    
         public void highlightChanged(final HighlightChangedEvent e) {  
                 final org.opengis.filter.Filter f = e.getFilter();  
   
                 try {  
                         highlightFeature = highlightLayer.getFeatureSource().getFeatures(f);  
                 } catch (final IOException e1) {  
                         // TODO Auto-generated catch block  
                         e1.printStackTrace();  
                 }  
   
                 repaint();  
         }  
906    
907          public void propertyChange(final PropertyChangeEvent evt) {          public void propertyChange(final PropertyChangeEvent evt) {
908                  final String prop = evt.getPropertyName();                  final String prop = evt.getPropertyName();
# Line 1219  public class JMapPane extends JPanel imp Line 986  public class JMapPane extends JPanel imp
986          public void mouseMoved(final MouseEvent e) {          public void mouseMoved(final MouseEvent e) {
987          }          }
988    
         public FeatureCollection getSelection() {  
                 return selection;  
         }  
   
         public void setSelection(final 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(final SelectionChangedEvent e) {  
989    
                 try {  
                         selection = selectionLayer.getFeatureSource().getFeatures(  
                                         e.getFilter());  
                         repaint();  
                 } catch (final IOException e1) {  
                         e1.printStackTrace();  
                 }  
         }  
   
         public SelectionManager getSelectionManager() {  
                 return selectionManager;  
         }  
   
         public void setSelectionManager(final SelectionManager selectionManager) {  
                 this.selectionManager = selectionManager;  
                 this.selectionManager.addSelectionChangeListener(this);  
   
         }  
990    
991          // xulu.sn          // xulu.sn
992          /**          /**

Legend:
Removed from v.332  
changed lines
  Added in v.336

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26