Revision 18277
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/georeferencing/view/ZoomMapDialog.java | ||
---|---|---|
24 | 24 |
import java.awt.geom.Rectangle2D; |
25 | 25 |
import java.awt.image.BufferedImage; |
26 | 26 |
|
27 |
import org.gvsig.rastertools.georeferencing.ui.zoom.IExtensionRequest; |
|
27 | 28 |
import org.gvsig.rastertools.georeferencing.ui.zoom.ViewControl; |
28 | 29 |
import org.gvsig.rastertools.georeferencing.ui.zoom.layers.CenterPointGraphicLayer; |
29 | 30 |
import org.gvsig.rastertools.georeferencing.ui.zoom.layers.GPGraphic; |
... | ... | |
96 | 97 |
} |
97 | 98 |
|
98 | 99 |
/** |
100 |
* Registra un objeto IExtensionRequest para que no se aplique un escalado sobre |
|
101 |
* el buffer pasado por par?metro. Alternativamente a la aplicaci?n de este escalado |
|
102 |
* se ejecutar? el m?todo request del interfaz para que el cliente pueda pasar un |
|
103 |
* nuevo buffer con escala 1:1 y con la extensi?n correspondiente al zoom. |
|
104 |
* @param er |
|
105 |
*/ |
|
106 |
public void setExtensionRequest(IExtensionRequest er) { |
|
107 |
zoomPixelControl.setExtensionRequest(er); |
|
108 |
} |
|
109 |
|
|
110 |
/** |
|
99 | 111 |
* Obtiene el panel de control de zoom de coordenadas de mapa |
100 | 112 |
* @return |
101 | 113 |
*/ |
... | ... | |
105 | 117 |
zoomPixelControl.hideButton(ViewControl.PREV_ZOOM); |
106 | 118 |
zoomPixelControl.hideButton(ViewControl.FULL_VIEW); |
107 | 119 |
zoomPixelControl.hideButton(ViewControl.SELECT_ZOOM_AREA); |
120 |
zoomPixelControl.hideButton(ViewControl.ZOOM_INCREASE); |
|
121 |
zoomPixelControl.hideButton(ViewControl.ZOOM_DECREASE); |
|
122 |
zoomPixelControl.getCanvas().setShowInfo(true); |
|
108 | 123 |
} |
109 | 124 |
return zoomPixelControl; |
110 | 125 |
} |
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/georeferencing/ui/launcher/GeorefLauncherDialog.java | ||
---|---|---|
99 | 99 |
public void windowClosed() { |
100 | 100 |
} |
101 | 101 |
|
102 |
//-------Consulta de propiedades seleccionadas--------- |
|
103 |
|
|
102 | 104 |
/** |
103 | 105 |
* Obtiene la capa que ha sido abierta por el usuario |
104 | 106 |
* @return Obtiene la capa que ha sido abierta por el usuario o null si no |
... | ... | |
107 | 109 |
public FLyrRasterSE getLayer() { |
108 | 110 |
return geoLauncherPanel.getFileSelectionPanel().getLayer(); |
109 | 111 |
} |
112 |
|
|
113 |
/** |
|
114 |
* Obtiene la vista seleccionada |
|
115 |
* @return |
|
116 |
*/ |
|
117 |
public String getSelectedView() { |
|
118 |
return geoLauncherPanel.getTypeSelectionPanel().getSelectedView(); |
|
119 |
} |
|
110 | 120 |
} |
111 | 121 |
|
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/georeferencing/ui/zoom/ViewMapRequestManager.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2007 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
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 org.gvsig.rastertools.georeferencing.ui.zoom; |
|
20 |
|
|
21 |
import java.awt.Dimension; |
|
22 |
import java.awt.Graphics2D; |
|
23 |
import java.awt.geom.Point2D; |
|
24 |
import java.awt.geom.Rectangle2D; |
|
25 |
import java.awt.image.BufferedImage; |
|
26 |
|
|
27 |
import org.gvsig.raster.dataset.InvalidSetViewException; |
|
28 |
import org.gvsig.raster.datastruct.Extent; |
|
29 |
import org.gvsig.raster.util.RasterUtilities; |
|
30 |
import org.gvsig.rastertools.georeferencing.view.BaseZoomView; |
|
31 |
|
|
32 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
33 |
import com.iver.cit.gvsig.fmap.MapControl; |
|
34 |
import com.iver.cit.gvsig.fmap.ViewPort; |
|
35 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
|
36 |
import com.iver.utiles.swing.threads.Cancellable; |
|
37 |
|
|
38 |
/** |
|
39 |
* Gestor de peticiones de zoom sobre el panel con el raster a georreferenciar. |
|
40 |
* Implementa el interfaz IExtensionRequest para que este comunique la peticiones |
|
41 |
* de zoom y ViewRasterRequestManager pueda hacer las peticiones de datos a la capa. |
|
42 |
* |
|
43 |
* 30/12/2007 |
|
44 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
45 |
*/ |
|
46 |
public class ViewMapRequestManager implements IExtensionRequest { |
|
47 |
private FLayers lyrs = null; |
|
48 |
private BaseZoomView view = null; |
|
49 |
private MapControl mapControl = null; |
|
50 |
|
|
51 |
/** |
|
52 |
* Asigna la capa a georreferenciar de donde se obtienen los datos. |
|
53 |
* @param lyr |
|
54 |
*/ |
|
55 |
public ViewMapRequestManager(BaseZoomView view, MapControl mapControl) { |
|
56 |
this.mapControl = mapControl; |
|
57 |
this.lyrs = mapControl.getMapContext().getLayers(); |
|
58 |
this.view = view; |
|
59 |
} |
|
60 |
|
|
61 |
/** |
|
62 |
* Calcula la extensi?n que contendr? la vista a partir del extent |
|
63 |
* m?ximo de la capa/s que contienen . Tienen en cuenta las distintan proporciones |
|
64 |
* entre vista y petici?n |
|
65 |
* @param Rectangle2D |
|
66 |
*/ |
|
67 |
public Rectangle2D initRequest(Rectangle2D extent) throws InvalidRequestException { |
|
68 |
double x = extent.getX(); |
|
69 |
double y = extent.getY(); |
|
70 |
double w = extent.getWidth(); |
|
71 |
double h = extent.getHeight(); |
|
72 |
//Calculamos la extensi?n de la vista para el extent m?ximo que va a contener |
|
73 |
//teniendo en cuenta las proporciones de ambos. |
|
74 |
if(extent.getWidth() < extent.getHeight()) { |
|
75 |
if(((double)view.getCanvasWidth() / (double)view.getCanvasHeight()) <= (extent.getWidth() / extent.getHeight())) { |
|
76 |
h = (view.getCanvasHeight() * w) / view.getCanvasWidth(); |
|
77 |
y = extent.getCenterY() - (h / 2); |
|
78 |
} else { //p1 < p2 |
|
79 |
w = (view.getCanvasWidth() * h) / view.getCanvasHeight(); |
|
80 |
x = extent.getCenterX() - (w / 2); |
|
81 |
} |
|
82 |
} else { |
|
83 |
if(((double)view.getCanvasWidth() / (double)view.getCanvasHeight()) >= (extent.getWidth() / extent.getHeight())) { |
|
84 |
w = (view.getCanvasWidth() * h) / view.getCanvasHeight(); |
|
85 |
x = extent.getCenterX() - (w / 2); |
|
86 |
} else { //p1 < p2 |
|
87 |
h = (view.getCanvasHeight() * w) / view.getCanvasWidth(); |
|
88 |
y = extent.getCenterY() - (h / 2); |
|
89 |
} |
|
90 |
} |
|
91 |
Rectangle2D r = new Rectangle2D.Double(x, y, w, h); |
|
92 |
setDrawParams(null, r); |
|
93 |
request(r); |
|
94 |
return r; |
|
95 |
} |
|
96 |
|
|
97 |
/* |
|
98 |
* (non-Javadoc) |
|
99 |
* @see org.gvsig.rastertools.georeferencing.ui.zoom.IExtensionRequest#request(java.awt.geom.Rectangle2D) |
|
100 |
*/ |
|
101 |
public Rectangle2D request(Rectangle2D extent) throws InvalidRequestException { |
|
102 |
if(extent == null) |
|
103 |
return lyrs.getFullExtent(); |
|
104 |
|
|
105 |
//Ajustamos el extent al del raster |
|
106 |
Extent ext = new Extent(extent); |
|
107 |
Extent extSelection = RasterUtilities.calculateAdjustedView(ext, new Extent(lyrs.getFullExtent())); |
|
108 |
|
|
109 |
//Obtenemos el viewport y calculamos la matriz de transformaci?n |
|
110 |
ViewPort vp = new ViewPort(null); |
|
111 |
vp.setImageSize(new Dimension(view.getCanvasWidth(), view.getCanvasHeight())); |
|
112 |
vp.setExtent(extent); |
|
113 |
|
|
114 |
//Calculamos el punto del canvas de la vista donde se empieza a dibujar el buffer de la imagen |
|
115 |
Point2D pt = new Point2D.Double(extSelection.getULX(), extSelection.getLRY()); |
|
116 |
vp.getAffineTransform().transform(pt, pt); |
|
117 |
|
|
118 |
try { |
|
119 |
//Dibujamos a trav?s del render de la capa en un graphics como el de la vista |
|
120 |
BufferedImage initImg = new BufferedImage(view.getCanvasWidth(), view.getCanvasHeight(), BufferedImage.TYPE_INT_RGB); |
|
121 |
lyrs.draw(initImg, (Graphics2D)initImg.getGraphics(), vp, new CancellableClass(), mapControl.getMapContext().getScaleView()); |
|
122 |
|
|
123 |
//BufferedImage buf = new BufferedImage(view.getCanvasWidth(), view.getCanvasHeight(), BufferedImage.TYPE_INT_RGB); |
|
124 |
//((Graphics2D)buf.getGraphics()).drawImage(initImg, (int) Math.round(pt.getX()), (int) Math.round(pt.getY()), null); |
|
125 |
|
|
126 |
setDrawParams(initImg, extent); |
|
127 |
|
|
128 |
} catch (Exception e) { |
|
129 |
throw new InvalidRequestException("Error en al acceso al fichero"); |
|
130 |
} |
|
131 |
return extent; |
|
132 |
} |
|
133 |
|
|
134 |
/* |
|
135 |
* (non-Javadoc) |
|
136 |
* @see org.gvsig.rastertools.georeferencing.ui.zoom.IExtensionRequest#fullExtent(java.awt.Dimension) |
|
137 |
*/ |
|
138 |
public void fullExtent() throws InvalidRequestException { |
|
139 |
this.initRequest(lyrs.getFullExtent()); |
|
140 |
} |
|
141 |
|
|
142 |
/** |
|
143 |
* Asigna los par?metros para el control de zoom del mapa |
|
144 |
* @param img BufferedImage |
|
145 |
* @param vp ViewPort |
|
146 |
*/ |
|
147 |
public void setDrawParams(BufferedImage img, Rectangle2D extBuf) { |
|
148 |
if(view != null && lyrs != null) { |
|
149 |
if(img != null) |
|
150 |
view.setDrawParams(img, extBuf, extBuf.getWidth()/img.getWidth(), new Point2D.Double(extBuf.getCenterX(), extBuf.getCenterY())); |
|
151 |
} |
|
152 |
} |
|
153 |
|
|
154 |
class CancellableClass implements Cancellable{ |
|
155 |
private boolean cancel = false; |
|
156 |
public void setCanceled(boolean canceled) { |
|
157 |
this.cancel = canceled; |
|
158 |
} |
|
159 |
|
|
160 |
public boolean isCanceled() { |
|
161 |
return this.cancel; |
|
162 |
} |
|
163 |
} |
|
164 |
} |
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/georeferencing/ui/zoom/ViewRasterRequestManager.java | ||
---|---|---|
60 | 60 |
* @param Rectangle2D |
61 | 61 |
*/ |
62 | 62 |
public Rectangle2D initRequest(Rectangle2D extent) throws InvalidRequestException { |
63 |
double x, y, w, h; |
|
63 |
double x = extent.getX(); |
|
64 |
double y = extent.getY(); |
|
65 |
double w = extent.getWidth(); |
|
66 |
double h = extent.getHeight(); |
|
64 | 67 |
//Calculamos la extensi?n de la vista para el extent m?ximo que va a contener |
65 | 68 |
//teniendo en cuenta las proporciones de ambos. |
66 |
if(extent.getHeight() > extent.getWidth()) { |
|
67 |
y = extent.getY(); |
|
68 |
h = extent.getHeight(); |
|
69 |
w = (view.getCanvasWidth() * h) / view.getCanvasHeight(); |
|
70 |
x = extent.getCenterX() - (w / 2); |
|
69 |
if(extent.getWidth() < extent.getHeight()) { |
|
70 |
if(((double)view.getCanvasWidth() / (double)view.getCanvasHeight()) <= (extent.getWidth() / extent.getHeight())) { |
|
71 |
h = (view.getCanvasHeight() * w) / view.getCanvasWidth(); |
|
72 |
y = extent.getCenterY() - (h / 2); |
|
73 |
} else { //p1 < p2 |
|
74 |
w = (view.getCanvasWidth() * h) / view.getCanvasHeight(); |
|
75 |
x = extent.getCenterX() - (w / 2); |
|
76 |
} |
|
71 | 77 |
} else { |
72 |
x = extent.getX(); |
|
73 |
w = extent.getWidth(); |
|
74 |
h = (view.getCanvasHeight() * w) / view.getCanvasWidth(); |
|
75 |
y = extent.getCenterY() - (h / 2); |
|
78 |
if(((double)view.getCanvasWidth() / (double)view.getCanvasHeight()) >= (extent.getWidth() / extent.getHeight())) { |
|
79 |
w = (view.getCanvasWidth() * h) / view.getCanvasHeight(); |
|
80 |
x = extent.getCenterX() - (w / 2); |
|
81 |
} else { //p1 < p2 |
|
82 |
h = (view.getCanvasHeight() * w) / view.getCanvasWidth(); |
|
83 |
y = extent.getCenterY() - (h / 2); |
|
84 |
} |
|
76 | 85 |
} |
77 | 86 |
Rectangle2D r = new Rectangle2D.Double(x, y, w, h); |
78 |
view.getCanvas().setCanvasExtent(new Rectangle2D.Double(x, y + h , w, h));
|
|
87 |
setDrawParams(null, new Rectangle2D.Double(x, y , w, h));
|
|
79 | 88 |
request(r); |
80 | 89 |
return r; |
81 | 90 |
} |
... | ... | |
105 | 114 |
BufferedImage initImg = new BufferedImage(view.getCanvasWidth(), view.getCanvasHeight(), BufferedImage.TYPE_INT_RGB); |
106 | 115 |
BufferedImage drawedImg = (BufferedImage)lyr.getRender().draw((Graphics2D)initImg.getGraphics(), vp); |
107 | 116 |
((Graphics2D)initImg.getGraphics()).drawImage(drawedImg, (int) Math.round(pt.getX()), (int) Math.round(pt.getY()), null); |
117 |
|
|
118 |
setDrawParams(initImg, extent); |
|
108 | 119 |
|
109 |
//Asignamos el buffer a dibujar al canvas |
|
110 |
if(initImg != null) |
|
111 |
setDrawParams(initImg, extent); |
|
112 |
else |
|
113 |
throw new InvalidSetViewException("Buffer de dibujado vacio"); |
|
114 | 120 |
} catch (RasterDriverException e) { |
115 | 121 |
throw new InvalidRequestException("Error en al acceso al fichero"); |
116 | 122 |
} catch (InvalidSetViewException e) { |
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/georeferencing/ui/zoom/CanvasZone.java | ||
---|---|---|
101 | 101 |
public Point2D viewCoordsToWorld(Point2D p) { |
102 | 102 |
int w = getVisibleRect().width; |
103 | 103 |
int h = getVisibleRect().height; |
104 |
double cx = lastExtent.getX() + ((p.getX() * lastExtent.getWidth()) / w); |
|
105 |
double cy = lastExtent.getY() - (p.getY() * lastExtent.getHeight()) / h; |
|
104 |
Rectangle2D ex = lastExtent; |
|
105 |
if(lastExtent == null) |
|
106 |
ex = extent; |
|
107 |
double cx = ex.getX() + ((p.getX() * ex.getWidth()) / w); |
|
108 |
double cy = ex.getY() - (p.getY() * ex.getHeight()) / h; |
|
106 | 109 |
return new Point2D.Double(cx, cy); |
107 | 110 |
} |
108 | 111 |
|
... | ... | |
114 | 117 |
public Point2D viewCoordsFromWorld(Point2D p) { |
115 | 118 |
int w = getVisibleRect().width; |
116 | 119 |
int h = getVisibleRect().height; |
117 |
double cx = ((p.getX() - lastExtent.getMinX()) * w) / lastExtent.getWidth(); |
|
118 |
double cy = ((Math.abs(p.getY() - lastExtent.getMinY()) * h) / lastExtent.getHeight()); |
|
120 |
Rectangle2D ex = lastExtent; |
|
121 |
if(lastExtent == null) |
|
122 |
ex = extent; |
|
123 |
double cx = ((p.getX() - ex.getMinX()) * w) / ex.getWidth(); |
|
124 |
double cy = ((Math.abs(p.getY() - ex.getMinY()) * h) / ex.getHeight()); |
|
119 | 125 |
return new Point2D.Double(cx, cy); |
120 | 126 |
} |
121 | 127 |
|
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/georeferencing/Georeferencing.java | ||
---|---|---|
18 | 18 |
*/ |
19 | 19 |
package org.gvsig.rastertools.georeferencing; |
20 | 20 |
|
21 |
import java.awt.geom.Point2D; |
|
22 | 21 |
import java.awt.geom.Rectangle2D; |
23 | 22 |
import java.awt.image.BufferedImage; |
24 | 23 |
import java.util.ArrayList; |
... | ... | |
31 | 30 |
import org.gvsig.rastertools.georeferencing.ui.launcher.GeorefLauncherDialog; |
32 | 31 |
import org.gvsig.rastertools.georeferencing.ui.table.GCPTablePanel; |
33 | 32 |
import org.gvsig.rastertools.georeferencing.ui.zoom.InvalidRequestException; |
33 |
import org.gvsig.rastertools.georeferencing.ui.zoom.ViewMapRequestManager; |
|
34 | 34 |
import org.gvsig.rastertools.georeferencing.ui.zoom.ViewRasterRequestManager; |
35 | 35 |
import org.gvsig.rastertools.georeferencing.ui.zoom.layers.ZoomCursorGraphicLayer; |
36 | 36 |
import org.gvsig.rastertools.georeferencing.ui.zoom.tools.ToolEvent; |
... | ... | |
44 | 44 |
import com.iver.andami.ui.mdiManager.IWindow; |
45 | 45 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
46 | 46 |
import com.iver.cit.gvsig.ProjectExtension; |
47 |
import com.iver.cit.gvsig.fmap.MapControl; |
|
47 | 48 |
import com.iver.cit.gvsig.fmap.ViewPort; |
48 | 49 |
import com.iver.cit.gvsig.project.Project; |
49 | 50 |
import com.iver.cit.gvsig.project.documents.view.ProjectView; |
... | ... | |
76 | 77 |
|
77 | 78 |
private GeorefLauncherDialog initDialog = null; |
78 | 79 |
private FLyrRasterSE lyrToGeoref = null; |
80 |
private String selectedView = null; |
|
79 | 81 |
private static GCPTablePanel table = null; |
80 |
private static ZoomMapDialog zoomMap = null; |
|
81 |
private static ZoomRasterDialog zoomPixel = null; |
|
82 |
private static ViewDialog view = null; |
|
82 |
|
|
83 | 83 |
private static final int smallWindowsHeight = 100; |
84 | 84 |
private static final double smallWindowsWidthPercent = 0.5; |
85 |
private ViewRasterRequestManager viewRequestManager = null; |
|
86 |
private ViewRasterRequestManager viewRequestManagerZoomPixel = null; |
|
87 | 85 |
|
86 |
private static ViewDialog viewRaster = null; |
|
87 |
private static ViewDialog viewMap = null; |
|
88 |
|
|
89 |
private static ZoomMapDialog zoomMap = null; |
|
90 |
private static ZoomRasterDialog zoomPixel = null; |
|
91 |
|
|
92 |
private ViewRasterRequestManager viewRasterRequestManager = null; |
|
93 |
private ViewMapRequestManager viewMapRequestManager = null; |
|
94 |
|
|
95 |
private ViewRasterRequestManager zoomRasterRequestManager = null; |
|
96 |
private ViewMapRequestManager zoomMapRequestManager = null; |
|
97 |
|
|
88 | 98 |
public Georeferencing() { |
89 | 99 |
|
90 | 100 |
} |
... | ... | |
104 | 114 |
int smallWindowsWidth = (int)(p.getWidth() * (smallWindowsWidthPercent * 0.5)); |
105 | 115 |
int tableWidth = (int)(p.getWidth() * (1 - smallWindowsWidthPercent)); |
106 | 116 |
|
117 |
//Si hay ventanas de georreferenciaci?n abiertas las cerramos |
|
118 |
if(zoomMap != null) |
|
119 |
PluginServices.getMDIManager().closeWindow(zoomMap); |
|
120 |
if(zoomPixel != null) |
|
121 |
PluginServices.getMDIManager().closeWindow(zoomPixel); |
|
122 |
if(viewRaster != null) |
|
123 |
PluginServices.getMDIManager().closeWindow(viewRaster); |
|
124 |
if(viewRaster != null) |
|
125 |
PluginServices.getMDIManager().closeWindow(viewMap); |
|
126 |
if(table != null) |
|
127 |
PluginServices.getMDIManager().closeWindow(table); |
|
128 |
|
|
129 |
MapControl mapControl = null; |
|
107 | 130 |
IWindow[] windowList = PluginServices.getMDIManager().getAllWindows(); |
108 | 131 |
BufferedImage imgView = null; |
109 | 132 |
ViewPort vp = null; |
110 | 133 |
for (int i = 0; i < windowList.length; i++) { |
111 |
if(windowList[i] instanceof IView) { |
|
134 |
if(windowList[i] instanceof IView && windowList[i].getWindowInfo().getTitle().endsWith(": " + selectedView)) {
|
|
112 | 135 |
WindowInfo info = windowList[i].getWindowInfo(); |
136 |
|
|
113 | 137 |
info.setX(0); |
114 | 138 |
info.setY(0); |
115 | 139 |
info.setWidth(wViews); |
116 | 140 |
info.setHeight(posYViews); |
117 | 141 |
|
142 |
mapControl = ((IView)windowList[i]).getMapControl(); |
|
118 | 143 |
imgView = ((IView)windowList[i]).getMapControl().getImage(); |
119 | 144 |
vp = ((IView)windowList[i]).getMapControl().getViewPort(); |
120 | 145 |
} |
121 | 146 |
} |
122 |
if(zoomMap != null) |
|
123 |
PluginServices.getMDIManager().closeWindow(zoomMap); |
|
124 |
if(zoomPixel != null) |
|
125 |
PluginServices.getMDIManager().closeWindow(zoomPixel); |
|
126 |
if(view != null) |
|
127 |
PluginServices.getMDIManager().closeWindow(view); |
|
128 |
if(table != null) |
|
129 |
PluginServices.getMDIManager().closeWindow(table); |
|
130 | 147 |
|
131 | 148 |
table = new GCPTablePanel(smallWindowsWidth, posYViews, tableWidth, smallWindowsHeight); |
132 | 149 |
|
150 |
//Inicializaci?n de la vista mapa |
|
151 |
viewMap = new ViewDialog(0, 0, wViews, hViews, this); |
|
152 |
viewMap.setShowInfo(true); |
|
153 |
viewMapRequestManager = new ViewMapRequestManager(viewMap, mapControl); |
|
154 |
viewMap.setExtensionRequest(viewMapRequestManager); |
|
155 |
|
|
133 | 156 |
//Inicializaci?n de la vista raster |
134 |
view = new ViewDialog(wViews, 0, wViews, hViews, this); |
|
135 |
view.setShowInfo(true); |
|
136 |
viewRequestManager = new ViewRasterRequestManager(view, lyrToGeoref);
|
|
137 |
view.setExtensionRequest(viewRequestManager);
|
|
157 |
viewRaster = new ViewDialog(wViews, 0, wViews, hViews, this);
|
|
158 |
viewRaster.setShowInfo(true);
|
|
159 |
viewRasterRequestManager = new ViewRasterRequestManager(viewRaster, lyrToGeoref);
|
|
160 |
viewRaster.setExtensionRequest(viewRasterRequestManager);
|
|
138 | 161 |
|
139 | 162 |
//Inicializaci?n del zoom de la vista raster |
140 | 163 |
zoomPixel = new ZoomRasterDialog(smallWindowsWidth + tableWidth, posYViews, smallWindowsWidth, smallWindowsHeight); |
141 |
viewRequestManagerZoomPixel = new ViewRasterRequestManager(zoomPixel, lyrToGeoref);
|
|
142 |
zoomPixel.setExtensionRequest(viewRequestManagerZoomPixel);
|
|
164 |
zoomRasterRequestManager = new ViewRasterRequestManager(zoomPixel, lyrToGeoref);
|
|
165 |
zoomPixel.setExtensionRequest(zoomRasterRequestManager);
|
|
143 | 166 |
|
144 | 167 |
//Inicializaci?n del zoom de la vista de referencia |
145 | 168 |
zoomMap = new ZoomMapDialog(0, posYViews, smallWindowsWidth, smallWindowsHeight); |
169 |
zoomMapRequestManager = new ViewMapRequestManager(zoomMap, mapControl); |
|
170 |
zoomMap.setExtensionRequest(zoomMapRequestManager); |
|
146 | 171 |
|
147 | 172 |
/*GeoPoint gp = new GeoPoint(new Point2D.Double(100, 100), null); |
148 | 173 |
GPGraphic gpg = new GPGraphic(GPGraphic.PIXEL, gp); |
149 |
view.getPixelGraphicLayer().addGeoPoint(gpg);*/ |
|
174 |
view.getPixelGraphicLayer().addGeoPoint(gpg); |
|
175 |
*/ |
|
150 | 176 |
|
151 |
/*BufferedImage imgRasterToGeoref = viewRequestManager.drawRasterLayer(new Dimension(wViews, hViews)); |
|
152 |
if(imgView != null) |
|
153 |
setMapParams(imgView, vp); |
|
154 |
if(imgRasterToGeoref != null) |
|
155 |
setPixelParams(imgRasterToGeoref, lyrToGeoref); |
|
156 |
*/ |
|
157 | 177 |
//A?adimos las ventanas a gvSIG |
158 |
PluginServices.getMDIManager().addWindow(view); |
|
178 |
PluginServices.getMDIManager().addWindow(viewRaster); |
|
179 |
PluginServices.getMDIManager().addWindow(viewMap); |
|
159 | 180 |
PluginServices.getMDIManager().addWindow(table); |
160 | 181 |
PluginServices.getMDIManager().addWindow(zoomMap); |
161 | 182 |
PluginServices.getMDIManager().addWindow(zoomPixel); |
162 | 183 |
|
163 |
//Inicializamos la extensi?n del componente y dibujamos |
|
164 | 184 |
try { |
165 |
viewRequestManager.initRequest(lyrToGeoref.getFullExtent());/*new Rectangle2D.Double( lyrToGeoref.getFullRasterExtent().getULX(), |
|
166 |
lyrToGeoref.getFullRasterExtent().getULY(), |
|
167 |
lyrToGeoref.getFullRasterExtent().width(), |
|
168 |
lyrToGeoref.getFullRasterExtent().height()));*/ |
|
169 |
view.setZoomCursorSize(zoomPixel.getCanvasWidth() / 3, zoomPixel.getCanvasHeight() / 3); |
|
185 |
//Inicializamos la vista de mapa |
|
186 |
viewMapRequestManager.initRequest(mapControl.getMapContext().getLayers().getFullExtent()); |
|
187 |
viewMap.setZoomCursorSize(zoomMap.getCanvasWidth() / 3, zoomMap.getCanvasHeight() / 3); |
|
188 |
|
|
189 |
//Inicializamos la vista de raster |
|
190 |
viewRasterRequestManager.initRequest(lyrToGeoref.getFullExtent()); |
|
191 |
viewRaster.setZoomCursorSize(zoomPixel.getCanvasWidth() / 3, zoomPixel.getCanvasHeight() / 3); |
|
170 | 192 |
|
171 |
Rectangle2D ext = view.getCursorAdjustedWorldCoordinates(zoomPixel.getCanvasWidth(), zoomPixel.getCanvasHeight()); |
|
172 |
viewRequestManagerZoomPixel.initRequest(lyrToGeoref.getFullExtent()); |
|
173 |
//viewRequestManagerZoomPixel.setDrawParams(null, new Rectangle2D.Double(ext.getX(), ext.getY() - ext.getHeight(), ext.getWidth(), ext.getHeight())); |
|
174 |
viewRequestManagerZoomPixel.request(ext); |
|
193 |
//Inicializamos el zoom de mapa |
|
194 |
Rectangle2D mapExtent = mapControl.getMapContext().getFullExtent(); |
|
195 |
Rectangle2D ext = viewMap.getCursorAdjustedWorldCoordinates(zoomMap.getCanvasWidth(), zoomMap.getCanvasHeight()); |
|
196 |
zoomMapRequestManager.initRequest(mapControl.getMapContext().getFullExtent()); |
|
197 |
zoomMapRequestManager.request(new Rectangle2D.Double(ext.getX(), mapExtent.getMaxY() - (mapExtent.getMinY() - ext.getY()), ext.getWidth(), ext.getHeight())); |
|
198 |
|
|
199 |
//Inicializamos el zoom de raster |
|
200 |
ext = viewRaster.getCursorAdjustedWorldCoordinates(zoomPixel.getCanvasWidth(), zoomPixel.getCanvasHeight()); |
|
201 |
zoomRasterRequestManager.initRequest(lyrToGeoref.getFullExtent()); |
|
202 |
zoomRasterRequestManager.request(new Rectangle2D.Double(ext.getX(), lyrToGeoref.getFullRasterExtent().maxY() - (lyrToGeoref.getFullRasterExtent().minY() - ext.getY()), ext.getWidth(), ext.getHeight())); |
|
175 | 203 |
} catch (InvalidRequestException e1) { |
176 | 204 |
RasterToolsUtil.messageBoxError("error_setview_preview", this); |
205 |
}catch (Exception e1) { |
|
206 |
RasterToolsUtil.messageBoxError("error_setview_preview", this); |
|
177 | 207 |
} |
178 | 208 |
|
179 | 209 |
} |
180 | 210 |
|
181 | 211 |
/** |
182 |
* Obtiene y asigna los par?metros para el control de zoom del mapa |
|
183 |
* @param img BufferedImage |
|
184 |
* @param vp ViewPort |
|
185 |
*/ |
|
186 |
public void setMapParams(BufferedImage img, ViewPort vp) { |
|
187 |
if(zoomMap != null && img != null) { |
|
188 |
Rectangle2D r = vp.getAdjustedExtent(); |
|
189 |
int w = vp.getImageWidth(); |
|
190 |
zoomMap.setDrawParams(img, r, r.getWidth() / w, new Point2D.Double(r.getCenterX(), r.getCenterY())); |
|
191 |
zoomMap.getMapGraphicLayer(); |
|
192 |
} |
|
193 |
} |
|
194 |
|
|
195 |
/** |
|
196 |
* Obtiene y asigna los par?metros para el control de zoom del mapa |
|
197 |
* @param img BufferedImage |
|
198 |
* @param vp ViewPort |
|
199 |
*/ |
|
200 |
public void setPixelParams(BufferedImage img, FLyrRasterSE lyr) { |
|
201 |
if(view != null && zoomPixel != null && img != null && lyr != null) { |
|
202 |
Rectangle2D extBuf; |
|
203 |
try { |
|
204 |
extBuf = viewRequestManager.request(null); |
|
205 |
viewRequestManager.setDrawParams(img, extBuf); |
|
206 |
zoomPixel.setDrawParams(img, extBuf, extBuf.getHeight()/img.getHeight(), new Point2D.Double(extBuf.getCenterX(), extBuf.getCenterY())); |
|
207 |
zoomPixel.getPixelGraphicLayer(); |
|
208 |
} catch (InvalidRequestException e1) { |
|
209 |
RasterToolsUtil.messageBoxError("error_setview_preview", this); |
|
210 |
} |
|
211 |
} |
|
212 |
} |
|
213 |
|
|
214 |
/** |
|
215 | 212 |
* Lanzador del cuadro de inicializaci?n de propiedades de georreferenciaci?n. |
216 | 213 |
*/ |
217 | 214 |
private void launcher() { |
... | ... | |
232 | 229 |
// Bot?n de Aceptar |
233 | 230 |
if (e.getButton() == ButtonsPanel.BUTTON_ACCEPT) { |
234 | 231 |
if(initDialog != null) { |
232 |
selectedView = initDialog.getSelectedView(); |
|
235 | 233 |
lyrToGeoref = initDialog.getLayer(); |
236 | 234 |
if(lyrToGeoref == null) |
237 | 235 |
RasterToolsUtil.messageBoxError("layer_not_loaded", this); |
... | ... | |
255 | 253 |
public void endAction(ToolEvent ev) { |
256 | 254 |
if(ev.getSource() instanceof ZoomCursorGraphicLayer) { |
257 | 255 |
try { |
258 |
Rectangle2D ext = view.getCursorAdjustedWorldCoordinates(zoomPixel.getCanvasWidth(), zoomPixel.getCanvasHeight()); |
|
259 |
viewRequestManagerZoomPixel.request(ext); |
|
256 |
Rectangle2D ext = viewRaster.getCursorAdjustedWorldCoordinates(zoomPixel.getCanvasWidth(), zoomPixel.getCanvasHeight()); |
|
257 |
zoomRasterRequestManager.request(ext); |
|
258 |
ext = viewMap.getCursorAdjustedWorldCoordinates(zoomMap.getCanvasWidth(), zoomMap.getCanvasHeight()); |
|
259 |
zoomMapRequestManager.request(ext); |
|
260 | 260 |
} catch (InvalidRequestException e1) { |
261 | 261 |
RasterToolsUtil.messageBoxError("error_setview_preview", this); |
262 | 262 |
} |
Also available in: Unified diff