Statistics
| Revision:

root / trunk / libraries / libCq_CMS_praster / src / org / cresques / geo / ProjPoint.java @ 8026

History | View | Annotate | Download (2.34 KB)

1
/*
2
 * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
3
 *
4
 * Copyright (C) 2004-5.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 * cresques@gmail.com
23
 */
24
package org.cresques.geo;
25

    
26
import org.cresques.cts.ICoordTrans;
27
import org.cresques.cts.IProjection;
28

    
29
import java.awt.geom.Point2D;
30

    
31

    
32
/**
33
 *
34
 * @author "Luis W. Sevilla" <sevilla_lui@gva.es>*
35
 */
36
public class ProjPoint extends Point2D implements Projected {
37
    IProjection proj = Mercator.getProjection(Ellipsoid.ed50);
38
    public double X;
39
    public double Y;
40

    
41
    public ProjPoint() {
42
        setLocation(0.0, 0.0);
43
    }
44

    
45
    public ProjPoint(Projection proj) {
46
        setLocation(0.0, 0.0);
47
        this.proj = proj;
48
    }
49

    
50
    public ProjPoint(double x, double y) {
51
        setLocation(x, y);
52
    }
53

    
54
    public ProjPoint(Projection proj, double x, double y) {
55
        setLocation(x, y);
56
        this.proj = proj;
57
    }
58

    
59
    public ProjPoint(Point2D pt) {
60
        setLocation(pt.getX(), pt.getY());
61
    }
62

    
63
    public ProjPoint(Projection proj, Point2D pt) {
64
        setLocation(pt.getX(), pt.getY());
65
        this.proj = proj;
66
    }
67

    
68
    public IProjection getProjection() {
69
        return proj;
70
    }
71

    
72
    public void reProject(ICoordTrans rp) {
73
        // TODO metodo reProject pendiente de implementar
74
    }
75

    
76
    public double getX() {
77
        return X;
78
    }
79

    
80
    public double getY() {
81
        return Y;
82
    }
83

    
84
    public void setLocation(double x, double y) {
85
        X = x;
86
        Y = y;
87
    }
88

    
89
    public String toString() {
90
        return "(" + proj + ": " + getX() + "," + getY() + ")";
91
    }
92

    
93
    public Point2D toGeo() {
94
        return ((Projection) proj).toGeo(this);
95
    }
96
}