svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.projection / org.gvsig.projection.cresques / org.gvsig.projection.cresques.impl / src / main / java / org / cresques / impl / geo / Calc.java @ 40559
History | View | Annotate | Download (2.6 KB)
1 | 40559 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | 40455 | jjdelcerro | *
|
4 | 40559 | jjdelcerro | * Copyright (C) 2007-2013 gvSIG Association.
|
5 | 40455 | jjdelcerro | *
|
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 | 40559 | jjdelcerro | * as published by the Free Software Foundation; either version 3
|
9 | 40455 | jjdelcerro | * 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 | 40559 | jjdelcerro | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 | * MA 02110-1301, USA.
|
||
20 | 40455 | jjdelcerro | *
|
21 | 40559 | jjdelcerro | * For any additional information, do not hesitate to contact us
|
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | 40455 | jjdelcerro | */
|
24 | package org.cresques.impl.geo; |
||
25 | |||
26 | import geojava.EGeoUtmCom; |
||
27 | |||
28 | import java.awt.Frame; |
||
29 | import java.awt.geom.Point2D; |
||
30 | |||
31 | |||
32 | public class Calc { |
||
33 | static int CATALA = 1; |
||
34 | static int CASTELLANO = 2; |
||
35 | static int ENGLISH = 3; |
||
36 | |||
37 | public static void ICCCalculator() { |
||
38 | Frame frame = new Frame("EGeoUtmCom"); |
||
39 | int idioma = CASTELLANO;
|
||
40 | EGeoUtmCom calcula = new EGeoUtmCom(false, idioma); |
||
41 | frame.add("Center", calcula);
|
||
42 | frame.pack(); |
||
43 | frame.show(); |
||
44 | } |
||
45 | |||
46 | public static void prbUtmToGeo() { |
||
47 | UtmZone utmZone = UtmZone.getProjection(Ellipsoid.hayford, 30,
|
||
48 | UtmZone.NORTH); |
||
49 | |||
50 | // UtmPoint uPt = new UtmPoint(utmZone, 739027.0, 4468771.0); // 593 tl
|
||
51 | UtmPoint uPt = new UtmPoint(utmZone, 773177.0, 4303195.0); // 823 tl |
||
52 | GeoPoint gPt = (GeoPoint) ((Projection) uPt.proj).toGeo(uPt); |
||
53 | GeoPoint.decimales = 1;
|
||
54 | System.out.println("UTM to Geo : " + uPt.toString() + " == [" + |
||
55 | gPt.toString() + "] (" + gPt.getX() + "," + |
||
56 | gPt.getY() + ")");
|
||
57 | |||
58 | UtmPoint uPt2 = utmZone.fromGeo(gPt, new UtmPoint(utmZone),
|
||
59 | UtmZone.getProjection(Ellipsoid.hayford, |
||
60 | 29, UtmZone.NORTH));
|
||
61 | System.out.println("Geo to Utm : " + uPt2.toString() + " == [" + |
||
62 | gPt.toString() + "] (" + gPt.getX() + "," + |
||
63 | gPt.getY() + ")");
|
||
64 | } |
||
65 | |||
66 | public Point2D pointFactory(Projection proj, double x, double y) { |
||
67 | Point2D.Double pt = new Point2D.Double(x, y); |
||
68 | |||
69 | return pt;
|
||
70 | } |
||
71 | } |