/[schmitzm]/trunk/src/skrueger/geotools/CrsLabel.java
ViewVC logotype

Contents of /trunk/src/skrueger/geotools/CrsLabel.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1221 - (show annotations)
Wed Nov 3 13:29:17 2010 UTC (14 years, 3 months ago) by alfonx
File MIME type: text/plain
File size: 967 byte(s)
Added a Lable to show the CRS to MpaView
1 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
19 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 setText("CRS:"
33 + mapPane.getMapContext().getCoordinateReferenceSystem()
34 .getName().toString());
35 } catch (Exception e) {
36 setText("CRS:" + "NONE");
37 }
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