Statistics
| Revision:

svn-gvsig-desktop / branches / Mobile_Compatible_Hito_1 / libProjectionDummy / src / org / gvsig / projection / dummy / CoordTrans.java @ 21822

History | View | Annotate | Download (1.57 KB)

1
package org.gvsig.projection.dummy;
2

    
3
import java.awt.geom.Point2D;
4
import java.awt.geom.Rectangle2D;
5

    
6
/*
7
 * To change this template, choose Tools | Templates
8
 * and open the template in the editor.
9
 */
10

    
11
import org.gvsig.projection.cts.ICoordTrans;
12
import org.gvsig.projection.cts.IProjection;
13
import org.gvsig.projection.dummy.cts.CoordSys;
14

    
15
/**
16
 * @author csanchez
17
 */
18
public class CoordTrans implements ICoordTrans{
19
        
20
        private ICoordTrans invertedCT = null;
21
        private CoordSys from = null;
22
    private CoordSys to = null;
23
        
24
    public CoordTrans(CoordSys from, CoordSys to) {
25
                // TODO Auto-generated constructor stub
26
        this.from = from;
27
        this.to = to;
28
        System.currentTimeMillis();
29
        }
30

    
31
        public IProjection getPOrig() {
32
        return from;
33
    }
34

    
35
    public IProjection getPDest() {
36
            return to;
37
    }
38

    
39
    public Point2D convert(Point2D ptOrig, Point2D ptDest) {
40
             ptDest = (Point2D) ptOrig.clone();
41
         return ptDest;
42
    }
43

    
44
    public String getName() {
45
            return "FROM "+getPOrig().getAbrev()+" TO "+getPDest().getAbrev();
46
    }
47

    
48
    public Rectangle2D convert(Rectangle2D rect) {
49
            Point2D pt1 = new Point2D.Double(rect.getMinX(), rect.getMinY());
50
        Point2D pt2 = new Point2D.Double(rect.getMaxX(), rect.getMaxY());
51
        pt1 = convert(pt1, null);
52
        pt2 = convert(pt2, null);
53
        rect = new Rectangle2D.Double();
54
        rect.setFrameFromDiagonal(pt1, pt2);
55

    
56
        return rect;
57
    }
58

    
59
    public ICoordTrans getInverted() {
60
            if (invertedCT == null)
61
            invertedCT = new CoordTrans(to, from);
62
        return invertedCT;
63
    }
64

    
65
}