svn-gvsig-desktop / branches / v02_desarrollo / libraries / libCq CMS for java.old / src / org / cresques / geo / GeoPoint.java @ 1731
History | View | Annotate | Download (2.17 KB)
1 |
package org.cresques.geo; |
---|---|
2 |
|
3 |
import java.awt.geom.Point2D; |
4 |
|
5 |
import org.cresques.cts.ICoordTrans; |
6 |
import org.cresques.cts.IProjection; |
7 |
|
8 |
import geojava.SexaAngle; |
9 |
import geojava.Mutil; |
10 |
|
11 |
public class GeoPoint extends Point2D implements Projected { |
12 |
IProjection proj = null;
|
13 |
public static int decimales=4; |
14 |
public SexaAngle Longitude;
|
15 |
public SexaAngle Latitude;
|
16 |
public double h; |
17 |
|
18 |
public GeoPoint(SexaAngle sexaangle, SexaAngle sexaangle1, double d) { |
19 |
Longitude = sexaangle; |
20 |
Latitude = sexaangle1; |
21 |
h = d; |
22 |
} |
23 |
|
24 |
public GeoPoint()
|
25 |
{ |
26 |
Longitude = new SexaAngle();
|
27 |
Latitude = new SexaAngle();
|
28 |
h = 0.0D;
|
29 |
} |
30 |
|
31 |
public GeoPoint(double x, double y) { |
32 |
setLocation(x, y); |
33 |
h = 0.0D; }
|
34 |
|
35 |
public GeoPoint(Projection proj, double x, double y) { |
36 |
setLocation(x, y); |
37 |
h = 0.0D; ;
|
38 |
this.proj = proj;}
|
39 |
|
40 |
public GeoPoint(Point2D pt) { |
41 |
setLocation(pt.getX(), pt.getY()); |
42 |
h = 0.0D; }
|
43 |
|
44 |
public GeoPoint(Projection proj, Point2D pt) { |
45 |
setLocation(pt.getX(), pt.getY()); |
46 |
h = 0.0D; ;
|
47 |
this.proj = proj;}
|
48 |
|
49 |
public IProjection getProjection() { return proj; } |
50 |
public void reProject(ICoordTrans rp) { |
51 |
// TODO metodo reProject pendiente de implementar
|
52 |
} |
53 |
|
54 |
public double getX() { return Longitude.ToDecimal(); } |
55 |
public double getY() { return Latitude.ToDecimal(); } |
56 |
public void setLocation(double x, double y) { |
57 |
Longitude = SexaAngle.fromDecimal(x); |
58 |
Latitude = SexaAngle.fromDecimal(y); |
59 |
} |
60 |
public String toString() { |
61 |
String str = ""; |
62 |
String s = String.valueOf(Longitude.Deg); |
63 |
String s1 = String.valueOf(Longitude.Min); |
64 |
String s2 = String.valueOf(Mutil.double2String(Longitude.Sec, decimales)); |
65 |
SexaAngle sexaangle = new SexaAngle(s, s1, s2);
|
66 |
sexaangle.Normalize(); |
67 |
str += String.valueOf(sexaangle.Deg)+"?"; |
68 |
str += String.valueOf(sexaangle.Min)+"'"; |
69 |
str += Mutil.double2String(sexaangle.Sec, decimales)+"\"";
|
70 |
str += " ";
|
71 |
s = String.valueOf(Latitude.Deg);
|
72 |
s1 = String.valueOf(Latitude.Min);
|
73 |
s2 = String.valueOf(Mutil.double2String(Latitude.Sec, decimales));
|
74 |
sexaangle = new SexaAngle(s, s1, s2);
|
75 |
sexaangle.Normalize(); |
76 |
str += String.valueOf(sexaangle.Deg)+"?"; |
77 |
str += String.valueOf(sexaangle.Min)+"'"; |
78 |
str += Mutil.double2String(sexaangle.Sec, decimales)+"\"";
|
79 |
return str;
|
80 |
} |
81 |
} |