svn-gvsig-desktop / tags / v1_1_Build_1008 / extensions / extGeoreferencing / src / com / iver / cit / gvsig / fmap / layers / GeoPoint.java @ 12520
History | View | Annotate | Download (3.51 KB)
1 | 5241 | nacho | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|---|---|
2 | *
|
||
3 | 5791 | nacho | * Copyright (C) 2006 IVER T.I. and Generalitat Valenciana.
|
4 | 5241 | nacho | *
|
5 | * This program is free software; you can redistribute it and/or
|
||
6 | * modify it under the terms of the GNU General Public License
|
||
7 | * as published by the Free Software Foundation; either version 2
|
||
8 | * of the License, or (at your option) any later version.
|
||
9 | *
|
||
10 | * This program is distributed in the hope that it will be useful,
|
||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
13 | * GNU General Public License for more details.
|
||
14 | *
|
||
15 | * You should have received a copy of the GNU General Public License
|
||
16 | * along with this program; if not, write to the Free Software
|
||
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
18 | */
|
||
19 | package com.iver.cit.gvsig.fmap.layers; |
||
20 | |||
21 | import java.awt.Dimension; |
||
22 | import java.awt.geom.Point2D; |
||
23 | import java.awt.geom.Rectangle2D; |
||
24 | |||
25 | import com.iver.cit.gvsig.fmap.ViewPort; |
||
26 | |||
27 | /**
|
||
28 | * Punto de la capa que representa una coordenada en pixeles de la imagen a
|
||
29 | * georreferenciar, una coordenada de la vista, el viewPort de las mini imagenes
|
||
30 | 6641 | caballero | * ,el centro de estas y el flag activo que dice si el punto tiene que ser tomado en
|
31 | * cuenta o no.
|
||
32 | 5241 | nacho | * @author Nacho Brodin (brodin_ign@gva.es)
|
33 | *
|
||
34 | */
|
||
35 | public class GeoPoint{ |
||
36 | public Point2D pixelPoint = null; |
||
37 | public Point2D mapPoint = null; |
||
38 | public ViewPort leftViewPort = null, rightViewPort = null; |
||
39 | public Point2D leftCenterPoint = null, rightCenterPoint = null; |
||
40 | 5550 | nacho | public double zoomLeft = 1, zoomRight = 1; |
41 | 5241 | nacho | public boolean active = true; |
42 | 6641 | caballero | |
43 | 5241 | nacho | /**
|
44 | * Constructor
|
||
45 | */
|
||
46 | public GeoPoint(){}
|
||
47 | 6641 | caballero | |
48 | 5241 | nacho | /**
|
49 | 6641 | caballero | * Constructor
|
50 | 5241 | nacho | * @param p pixelPoint
|
51 | * @param m mapPoint
|
||
52 | */
|
||
53 | public GeoPoint(Point2D p, Point2D m){ |
||
54 | this.pixelPoint = p;
|
||
55 | this.mapPoint = m;
|
||
56 | } |
||
57 | 6641 | caballero | |
58 | 5241 | nacho | /**
|
59 | * Hace una copia de la instancia del punto.
|
||
60 | * @return GeoPoint
|
||
61 | */
|
||
62 | public GeoPoint cloneGeoPoint(){
|
||
63 | Point2D pixel = null; |
||
64 | Point2D map = null; |
||
65 | if(pixelPoint != null) |
||
66 | pixel = (Point2D)pixelPoint.clone();
|
||
67 | 6641 | caballero | |
68 | 5241 | nacho | if(mapPoint != null) |
69 | map = (Point2D)mapPoint.clone();
|
||
70 | 6641 | caballero | |
71 | 5241 | nacho | GeoPoint gp = new GeoPoint(pixel, map);
|
72 | 6641 | caballero | |
73 | 5241 | nacho | if(leftViewPort != null){ |
74 | gp.leftViewPort = new ViewPort(leftViewPort.getProjection());
|
||
75 | gp.leftViewPort.setExtent((Rectangle2D)leftViewPort.getExtent().clone());
|
||
76 | gp.leftViewPort.setImageSize((Dimension)leftViewPort.getImageSize().clone());
|
||
77 | 6641 | caballero | gp.leftViewPort.refreshExtent(); |
78 | 5241 | nacho | } |
79 | 6641 | caballero | |
80 | 5241 | nacho | if(rightViewPort != null){ |
81 | gp.rightViewPort = new ViewPort(rightViewPort.getProjection());
|
||
82 | gp.rightViewPort.setExtent((Rectangle2D)rightViewPort.getExtent().clone());
|
||
83 | gp.rightViewPort.setImageSize((Dimension)rightViewPort.getImageSize().clone());
|
||
84 | 6641 | caballero | gp.rightViewPort.refreshExtent(); |
85 | 5241 | nacho | } |
86 | 6641 | caballero | |
87 | 5241 | nacho | if(leftCenterPoint != null) |
88 | gp.leftCenterPoint = (Point2D)this.leftCenterPoint.clone(); |
||
89 | if(rightCenterPoint != null) |
||
90 | gp.rightCenterPoint = (Point2D)this.rightCenterPoint.clone(); |
||
91 | gp.active = this.active;
|
||
92 | 5674 | nacho | gp.zoomLeft = this.zoomLeft;
|
93 | gp.zoomRight = this.zoomRight;
|
||
94 | 5241 | nacho | return gp;
|
95 | } |
||
96 | |||
97 | /**
|
||
98 | * Muestra por consola algunos valores de un geopunto
|
||
99 | */
|
||
100 | public void show(){ |
||
101 | System.out.println("********GeoPoint**********"); |
||
102 | System.out.println("Pixel: "+pixelPoint); |
||
103 | System.out.println("Map: "+mapPoint); |
||
104 | System.out.println("Left Zoom Center: "+leftCenterPoint); |
||
105 | System.out.println("Right Zoom Center: "+rightCenterPoint); |
||
106 | System.out.println("Active: "+active); |
||
107 | 5550 | nacho | System.out.println("ZoomLeft: "+zoomLeft); |
108 | System.out.println("ZoomRight: "+zoomRight); |
||
109 | 5241 | nacho | System.out.println("******End GeoPoint********"); |
110 | } |
||
111 | } |