Revision 2669 branches/CqCMSDvp/libraries/libCq CMS for java.old/src/org/cresques/geo/ProjPoint.java

View differences:

ProjPoint.java
1 1
/*
2 2
 * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
3
 * 
4
 * Copyright (C) 2004-5. 
5 3
 *
4
 * Copyright (C) 2004-5.
5
 *
6 6
 * This program is free software; you can redistribute it and/or
7 7
 * modify it under the terms of the GNU General Public License
8 8
 * as published by the Free Software Foundation; either version 2
......
18 18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19 19
 *
20 20
 * For more information, contact:
21
 * 
21
 *
22 22
 * cresques@gmail.com
23 23
 */
24 24
package org.cresques.geo;
25 25

  
26
import java.awt.geom.Point2D;
27

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

  
29
import java.awt.geom.Point2D;
30

  
31

  
31 32
/**
32
 * 
33
 *
33 34
 * @author "Luis W. Sevilla" <sevilla_lui@gva.es>*
34 35
 */
35 36
public class ProjPoint extends Point2D implements Projected {
36
	IProjection proj = Mercator.getProjection(Ellipsoid.ed50);
37
	public double X;
38
	public double Y;
39
	
40
	public ProjPoint() {
41
		setLocation(0.0,0.0); }
42
	public ProjPoint(Projection proj) {
43
		setLocation(0.0,0.0); this. proj = proj;}
44
	public ProjPoint(double x, double y) {
45
		setLocation(x,y); }
46
	public ProjPoint(Projection proj, double x, double y) {
47
		setLocation(x,y); this.proj = proj;}
48
	
49
	public ProjPoint(Point2D pt) {
50
		setLocation(pt.getX(), pt.getY()); }
51
	public ProjPoint(Projection proj, Point2D pt) {
52
		setLocation(pt.getX(), pt.getY());
53
		this.proj = proj;}
54
	
55
	public IProjection getProjection() { return proj; }
56
	public void reProject(ICoordTrans rp) {
57
		// TODO metodo reProject pendiente de implementar
58
	}
37
    IProjection proj = Mercator.getProjection(Ellipsoid.ed50);
38
    public double X;
39
    public double Y;
59 40

  
60
	public double getX() { return X; }
61
	public double getY() { return Y; }
62
	public void setLocation(double x, double y) {X=x; Y=y; }
63
	
64
	
65
	public String toString() {
66
		return "("+proj+": "+getX()+","+getY()+")";
67
	}
68
	
69
	public Point2D toGeo() {
70
		return ((Projection) proj).toGeo(this); }
41
    public ProjPoint() {
42
        setLocation(0.0, 0.0);
43
    }
71 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
    }
72 96
}

Also available in: Unified diff