/[schmitzm]/branches/2.2.x/src/skrueger/geotools/labelsearch/SearchResultFeature.java
ViewVC logotype

Diff of /branches/2.2.x/src/skrueger/geotools/labelsearch/SearchResultFeature.java

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

trunk/src/skrueger/geotools/labelsearch/SearchResultFeature.java revision 139 by alfonx, Thu Jun 11 12:52:58 2009 UTC branches/1.0-gt2-2.6/src/skrueger/geotools/labelsearch/SearchResultFeature.java revision 325 by mojays, Wed Aug 26 15:32:54 2009 UTC
# Line 1  Line 1 
1    /*******************************************************************************
2     * Copyright (c) 2009 Martin O. J. Schmitz.
3     *
4     * This file is part of the SCHMITZM library - a collection of utility
5     * classes based on Java 1.6, focusing (not only) on Java Swing
6     * and the Geotools library.
7     *
8     * The SCHMITZM project is hosted at:
9     * http://wald.intevation.org/projects/schmitzm/
10     *
11     * This program is free software; you can redistribute it and/or
12     * modify it under the terms of the GNU Lesser General Public License
13     * as published by the Free Software Foundation; either version 3
14     * of the License, or (at your option) any later version.
15     *
16     * This program is distributed in the hope that it will be useful,
17     * but WITHOUT ANY WARRANTY; without even the implied warranty of
18     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19     * GNU General Public License for more details.
20     *
21     * You should have received a copy of the GNU Lesser General Public License (license.txt)
22     * along with this program; if not, write to the Free Software
23     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
24     * or try this link: http://www.gnu.org/licenses/lgpl.html
25     *
26     * Contributors:
27     *     Martin O. J. Schmitz - initial API and implementation
28     *     Stefan A. Krüger - additional utility classes
29     ******************************************************************************/
30  package skrueger.geotools.labelsearch;  package skrueger.geotools.labelsearch;
31    
32  import javax.swing.SwingUtilities;  import javax.swing.SwingUtilities;
33    
34  import org.apache.log4j.Logger;  import org.apache.log4j.Logger;
35  import org.geotools.feature.Feature;  import org.geotools.map.MapLayer;
36    import org.opengis.feature.simple.SimpleFeature;
37    
38  public class SearchResultFeature implements SearchResult {  public class SearchResultFeature implements SearchResult {
39          final static private Logger LOGGER = Logger.getLogger(SearchResultFeature.class);          final static private Logger LOGGER = Logger
40                                    .getLogger(SearchResultFeature.class);
41          private final Feature feature;  
42            private final SimpleFeature feature;
43          private final String title;          private final String title;
44          private final schmitzm.geotools.gui.JMapPane mapPane;          private final schmitzm.geotools.gui.JMapPane mapPane;
45          private final String inTitle;          private final String inTitle;
46    
47          public SearchResultFeature(Feature feature, String title, String inTitle, schmitzm.geotools.gui.JMapPane mapPane) {          private final MapLayer mapLayer;
48    
49            public SearchResultFeature(SimpleFeature feature, String title, String inTitle,
50                            schmitzm.geotools.gui.JMapPane mapPane, MapLayer mapLayer) {
51                  this.feature = feature;                  this.feature = feature;
52                  this.title = title;                  this.title = title;
53                  this.inTitle = inTitle;                  this.inTitle = inTitle;
54                  this.mapPane = mapPane;                  this.mapPane = mapPane;
55                    this.mapLayer = mapLayer;
56          }          }
57            
58          @Override          @Override
59          public String toString() {          public String toString() {
60                  return feature.toString();                  return feature.toString();
61          }          }
62    
63          public Feature getFeature() {          public SimpleFeature getFeature() {
64                  return feature;                  return feature;
65          }          }
66    
# Line 37  public class SearchResultFeature impleme Line 71  public class SearchResultFeature impleme
71    
72          @Override          @Override
73          public void open() {          public void open() {
74                    
75                  // GuiAndTools.checkThatWeAreOnEDT();                  // GuiAndTools.checkThatWeAreOnEDT();
76                  if (!SwingUtilities.isEventDispatchThread()) {                  if (!SwingUtilities.isEventDispatchThread()) {
77                          LOGGER.error("Not on EDT");                          LOGGER.error("Not on EDT");
78                          throw new RuntimeException("Not on EDT!");                          throw new RuntimeException("Not on EDT!");
79                  }                  }
                   
80    
81                  mapPane.zoomTo(feature);                  mapPane.zoomTo(feature);
82                  mapPane.refresh();                  mapPane.refresh();
83    
84                    // TODO
85                    // Mark the selected SimpleFeature using a spacial style.. similar to the
86                    // selection stuff.
87                    // mapLayer.getStyle().addFeatureTypeStyle( new FeatureTypeStyle());
88    
89          }          }
90    
91          @Override          @Override

Legend:
Removed from v.139  
changed lines
  Added in v.325

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26