1 |
alfonx |
139 |
package skrueger.geotools.labelsearch; |
2 |
|
|
|
3 |
|
|
import javax.swing.SwingUtilities; |
4 |
|
|
|
5 |
|
|
import org.apache.log4j.Logger; |
6 |
|
|
import org.geotools.feature.Feature; |
7 |
|
|
|
8 |
|
|
|
9 |
|
|
public class SearchResultFeature implements SearchResult { |
10 |
|
|
final static private Logger LOGGER = Logger.getLogger(SearchResultFeature.class); |
11 |
|
|
|
12 |
|
|
private final Feature feature; |
13 |
|
|
private final String title; |
14 |
|
|
private final schmitzm.geotools.gui.JMapPane mapPane; |
15 |
|
|
private final String inTitle; |
16 |
|
|
|
17 |
|
|
public SearchResultFeature(Feature feature, String title, String inTitle, schmitzm.geotools.gui.JMapPane mapPane) { |
18 |
|
|
this.feature = feature; |
19 |
|
|
this.title = title; |
20 |
|
|
this.inTitle = inTitle; |
21 |
|
|
this.mapPane = mapPane; |
22 |
|
|
} |
23 |
|
|
|
24 |
|
|
@Override |
25 |
|
|
public String toString() { |
26 |
|
|
return feature.toString(); |
27 |
|
|
} |
28 |
|
|
|
29 |
|
|
public Feature getFeature() { |
30 |
|
|
return feature; |
31 |
|
|
} |
32 |
|
|
|
33 |
|
|
@Override |
34 |
|
|
public String getTitle() { |
35 |
|
|
return title; |
36 |
|
|
} |
37 |
|
|
|
38 |
|
|
@Override |
39 |
|
|
public void open() { |
40 |
|
|
|
41 |
|
|
// GuiAndTools.checkThatWeAreOnEDT(); |
42 |
|
|
if (!SwingUtilities.isEventDispatchThread()) { |
43 |
|
|
LOGGER.error("Not on EDT"); |
44 |
|
|
throw new RuntimeException("Not on EDT!"); |
45 |
|
|
} |
46 |
|
|
|
47 |
|
|
|
48 |
|
|
mapPane.zoomTo(feature); |
49 |
|
|
mapPane.refresh(); |
50 |
|
|
} |
51 |
|
|
|
52 |
|
|
@Override |
53 |
|
|
public String getInTitle() { |
54 |
|
|
return inTitle; |
55 |
|
|
} |
56 |
|
|
|
57 |
|
|
} |