01: package org.geotiff.epsg;
02:
03: /**
04: * Represents the base class of the EPSG
05: * horizontal coordinate systems. It is also
06: * contains the factory method for constructing
07: * these things.
08: *
09: * @author: Niles D. Ritter
10: */
11:
12: public abstract class HorizontalCS {
13:
14: // registered EPGS codes
15: public static int WGS84 = 4326;
16:
17: private int code;
18:
19: protected HorizontalCS(int code) {
20: setCode(code);
21: }
22:
23: protected void setCode(int aCode) {
24: code = aCode;
25: }
26:
27: public int getCode() {
28: return code;
29: }
30:
31: /**
32: * This method must be implemented by the extendend
33: * class to return the undelying geographic coordinate
34: * system.
35: */
36: public abstract HorizontalCS getGeographicCS();
37:
38: /**
39: * Factory method for coordinate systems.
40: */
41: public static HorizontalCS create(int code)
42: throws InvalidCodeException {
43: if (code < 0)
44: throw new InvalidCodeException("whatever");
45:
46: if (code < 5000)
47: return new GeographicCS(code);
48: else
49: return new ProjectedCS(code);
50: }
51: }
|