01: package com.vividsolutions.jump.workbench.ui.plugin.wms;
02:
03: import com.vividsolutions.jump.coordsys.CoordinateSystem;
04: import com.vividsolutions.jump.coordsys.impl.PredefinedCoordinateSystems;
05:
06: public class SRSUtils {
07:
08: //
09: // If the coordinate system string has the form "EPSG:someNumber" then see
10: // if we can get that number and create a more human readable string.
11: //
12: public static String getName(String srsCode) {
13: final String epsg = "EPSG:";
14: String stringToShow = srsCode;
15:
16: if (srsCode.startsWith(epsg)) {
17: String intPart = srsCode.substring(5, srsCode.length());
18:
19: try {
20: int epsgCode = Integer.parseInt(intPart);
21: CoordinateSystem cs = PredefinedCoordinateSystems
22: .getCoordinateSystem(epsgCode);
23:
24: if (cs != null) {
25: stringToShow = cs.getName();
26: }
27: } catch (Exception ignored) {
28: // do nothing
29: }
30: }
31:
32: return stringToShow;
33: }
34: }
|