/[schmitzm]/branches/2.3.x/src/skrueger/geotools/CrsLabel.java
ViewVC logotype

Annotation of /branches/2.3.x/src/skrueger/geotools/CrsLabel.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1221 - (hide annotations)
Wed Nov 3 13:29:17 2010 UTC (14 years, 3 months ago) by alfonx
Original Path: trunk/src/skrueger/geotools/CrsLabel.java
File MIME type: text/plain
File size: 967 byte(s)
Added a Lable to show the CRS to MpaView
1 alfonx 1220 package skrueger.geotools;
2    
3     import javax.swing.JLabel;
4    
5     import schmitzm.geotools.gui.SelectableXMapPane;
6     import schmitzm.geotools.gui.XMapPaneEvent;
7     import schmitzm.geotools.map.event.JMapPaneListener;
8    
9     public class CrsLabel extends JLabel {
10    
11     private JMapPaneListener listenForCrsChange = new JMapPaneListener() {
12    
13     @Override
14     public void performMapPaneEvent(XMapPaneEvent e) {
15     updateCrs();
16     }
17     };
18 alfonx 1221
19 alfonx 1220 private final SelectableXMapPane mapPane;
20    
21     CrsLabel(SelectableXMapPane mapPane) {
22     super();
23     this.mapPane = mapPane;
24    
25     mapPane.addMapPaneListener(listenForCrsChange);
26    
27     updateCrs();
28     }
29    
30     public void updateCrs() {
31     try {
32 alfonx 1221 setText("CRS:"
33     + mapPane.getMapContext().getCoordinateReferenceSystem()
34     .getName().toString());
35 alfonx 1220 } catch (Exception e) {
36 alfonx 1221 setText("CRS:" + "NONE");
37 alfonx 1220 }
38     }
39    
40     @Override
41     protected void finalize() throws Throwable {
42     super.finalize();
43     if (mapPane != null)
44     mapPane.removeMapPaneListener(listenForCrsChange);
45     }
46    
47     }

Properties

Name Value
svn:eol-style native
svn:keywords Id URL
svn:mime-type text/plain

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26