root / trunk / libraries / libCq CMS for java.old / src / org / cresques / cts / gt2 / CoordSys.java @ 95
History | View | Annotate | Download (2.8 KB)
1 |
/*
|
---|---|
2 |
* Creado el 05-ago-2004
|
3 |
*/
|
4 |
package org.cresques.cts.gt2; |
5 |
|
6 |
import java.awt.Color; |
7 |
import java.awt.Graphics2D; |
8 |
import java.awt.geom.Point2D; |
9 |
|
10 |
import org.cresques.cts.IDatum; |
11 |
import org.cresques.cts.IProjection; |
12 |
import org.cresques.geo.GeoPoint; |
13 |
import org.cresques.geo.ViewPortData; |
14 |
import org.geotools.cs.CoordinateSystem; |
15 |
import org.geotools.cs.CoordinateSystemFactory; |
16 |
import org.geotools.cs.GeographicCoordinateSystem; |
17 |
import org.geotools.cs.ProjectedCoordinateSystem; |
18 |
|
19 |
/**
|
20 |
* Sistema de Coordenadas (Proyecci?n).
|
21 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es>
|
22 |
*/
|
23 |
public class CoordSys implements IProjection { |
24 |
protected CoordinateSystemFactory csFactory = CoordinateSystemFactory.getDefault();
|
25 |
|
26 |
protected CSDatum datum = null; |
27 |
protected GeographicCoordinateSystem geogCS = null; |
28 |
protected ProjectedCoordinateSystem projCS = null; |
29 |
protected String abrev = ""; |
30 |
|
31 |
private static final Color basicGridColor = new Color(64,64,64,128); |
32 |
Color gridColor = basicGridColor;
|
33 |
|
34 |
public CoordSys(CSDatum datum) {
|
35 |
this.datum = datum;
|
36 |
} |
37 |
|
38 |
/**
|
39 |
* Crea un nuevo CoordSys geogr?fico a partir de uno proyectado.
|
40 |
* Si el actual es geogr?fico retorna el mismo.
|
41 |
* @return
|
42 |
*/
|
43 |
|
44 |
public CoordSys toGeo() {
|
45 |
CoordSys coordSys = new CoordSys((CSDatum)getDatum());
|
46 |
if (geogCS != null) |
47 |
coordSys.geogCS = this.geogCS;
|
48 |
else
|
49 |
coordSys.geogCS = projCS.getGeographicCoordinateSystem(); |
50 |
|
51 |
return coordSys;
|
52 |
} |
53 |
|
54 |
public IDatum getDatum() {
|
55 |
return datum;
|
56 |
} |
57 |
|
58 |
public CoordinateSystem getCS() {
|
59 |
if (projCS != null) return projCS; |
60 |
return geogCS;
|
61 |
} |
62 |
|
63 |
public CoordinateSystem getGeogCS() {
|
64 |
if (geogCS != null) return geogCS; |
65 |
return projCS.getGeographicCoordinateSystem();
|
66 |
} |
67 |
|
68 |
/* (no Javadoc)
|
69 |
* @see org.cresques.cts.IProjection#createPoint(double, double)
|
70 |
*/
|
71 |
public Point2D createPoint(double x, double y) { |
72 |
return new Point2D.Double(x,y); |
73 |
} |
74 |
|
75 |
|
76 |
public String toString() { |
77 |
if (projCS != null) return projCS.toString(); |
78 |
return geogCS.toString();
|
79 |
} |
80 |
|
81 |
public void setAbrev(String abrev) { this.abrev = abrev; } |
82 |
public String getAbrev() { return abrev; } |
83 |
|
84 |
/* (no Javadoc)
|
85 |
* @see org.cresques.cts.IProjection#drawGrid(java.awt.Graphics2D, org.cresques.geo.ViewPortData)
|
86 |
*/
|
87 |
public void drawGrid(Graphics2D g, ViewPortData vp) { |
88 |
// TODO Ap?ndice de m?todo generado autom?ticamente
|
89 |
|
90 |
} |
91 |
|
92 |
public void setGridColor(Color c) { gridColor = c;} |
93 |
public Color getGridColor() { return gridColor; } |
94 |
|
95 |
/* (no Javadoc)
|
96 |
* @see org.cresques.cts.IProjection#toGeo(java.awt.geom.Point2D)
|
97 |
*/
|
98 |
public GeoPoint toGeo(Point2D pt) { |
99 |
// TODO Ap?ndice de m?todo generado autom?ticamente
|
100 |
return null; |
101 |
} |
102 |
|
103 |
/* (no Javadoc)
|
104 |
* @see org.cresques.cts.IProjection#fromGeo(java.awt.geom.Point2D, java.awt.geom.Point2D)
|
105 |
*/
|
106 |
public Point2D fromGeo(Point2D gPt, Point2D mPt) { |
107 |
// TODO Ap?ndice de m?todo generado autom?ticamente
|
108 |
return null; |
109 |
} |
110 |
|
111 |
|
112 |
} |