gvsig-raster / org.gvsig.raster.georeferencing / trunk / org.gvsig.raster.georeferencing / org.gvsig.raster.georeferencing.swing / org.gvsig.raster.georeferencing.swing.impl / src / main / java / org / gvsig / raster / georeferencing / swing / impl / view / ZoomPanelImpl.java @ 1752
History | View | Annotate | Download (4.64 KB)
1 | 1479 | nbrodin | /* gvSIG. Geographic Information System of the Valencian Government
|
---|---|---|---|
2 | 1477 | nbrodin | *
|
3 | 1479 | nbrodin | * Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 | * of the Valencian Government (CIT)
|
||
5 | 1477 | nbrodin | *
|
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 | * as published by the Free Software Foundation; either version 2
|
||
9 | * 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 | 1479 | nbrodin | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 | * MA 02110-1301, USA.
|
||
20 | *
|
||
21 | 1477 | nbrodin | */
|
22 | package org.gvsig.raster.georeferencing.swing.impl.view; |
||
23 | |||
24 | import java.awt.GridBagConstraints; |
||
25 | import java.awt.GridBagLayout; |
||
26 | import java.awt.geom.Point2D; |
||
27 | import java.awt.geom.Rectangle2D; |
||
28 | import java.awt.image.BufferedImage; |
||
29 | |||
30 | 1712 | nbrodin | import org.gvsig.raster.georeferencing.swing.view.IViewRequestManager; |
31 | 1477 | nbrodin | import org.gvsig.raster.georeferencing.swing.view.IGraphicLayer; |
32 | |||
33 | /**
|
||
34 | * Panel que contiene el control de zoom para el raster a georreferenciar.
|
||
35 | *
|
||
36 | * 22/12/2007
|
||
37 | * @author Nacho Brodin (nachobrodin@gmail.com)
|
||
38 | */
|
||
39 | 1728 | nbrodin | public class ZoomPanelImpl extends BaseViewPanel { |
40 | 1477 | nbrodin | private static final long serialVersionUID = 1L; |
41 | |||
42 | /**
|
||
43 | * Constructor.
|
||
44 | * Crea la composici?n de controles de zoom.
|
||
45 | */
|
||
46 | 1495 | nbrodin | public ZoomPanelImpl() {
|
47 | 1477 | nbrodin | init(); |
48 | } |
||
49 | |||
50 | /**
|
||
51 | * Asigna el valor para el flag minxMaxyUL. Este flag informa de que la esquina
|
||
52 | * superior izquierda corresponde con el valor de m?nimo X y m?ximo Y. En caso
|
||
53 | * de ser false esta esquina ser?a de m?nimo X y m?nimo Y.
|
||
54 | * @param v
|
||
55 | */
|
||
56 | 1717 | nbrodin | public void setMinxMaxyUL(boolean v) { |
57 | 1477 | nbrodin | getCanvas().setMinxMaxyUL(v); |
58 | 1717 | nbrodin | } |
59 | 1477 | nbrodin | |
60 | 1717 | nbrodin | public boolean getMinxMaxyUL() { |
61 | return getCanvas().getMinxMaxyUL();
|
||
62 | } |
||
63 | |||
64 | 1477 | nbrodin | /**
|
65 | * Activa o desactiva el mostrado de informaci?n
|
||
66 | * @param showInfo
|
||
67 | */
|
||
68 | public void setShowInfo(boolean show) { |
||
69 | 1728 | nbrodin | viewControl.getCanvas().setShowInfo(show); |
70 | 1477 | nbrodin | } |
71 | |||
72 | /*
|
||
73 | * (non-Javadoc)
|
||
74 | * @see org.gvsig.rastertools.georeferencing.view.BaseZoomView#addGraphicLayer(org.gvsig.rastertools.georeferencing.ui.zoom.IGraphicLayer)
|
||
75 | */
|
||
76 | public void addGraphicLayer(IGraphicLayer graphicLayer) { |
||
77 | getControl().setGraphicLayer(graphicLayer); |
||
78 | } |
||
79 | |||
80 | /**
|
||
81 | * Inicializaci?n de los componentes gr?ficos
|
||
82 | */
|
||
83 | private void init() { |
||
84 | setLayout(new GridBagLayout()); |
||
85 | |||
86 | GridBagConstraints gb = new GridBagConstraints(); |
||
87 | gb.insets = new java.awt.Insets(0, 0, 0, 0); |
||
88 | gb.gridy = 0;
|
||
89 | gb.gridx = 0;
|
||
90 | gb.weightx = 1D; //El espacio sobrante se distribuye horizontalmente |
||
91 | gb.weighty = 1D; //El espacio sobrante se distribuye verticalmente |
||
92 | gb.fill = GridBagConstraints.BOTH; //El componente se hace tan ancho como espacio disponible tiene |
||
93 | gb.anchor = GridBagConstraints.NORTH; //Alineamos las cajas arriba |
||
94 | add(getControl(), gb); |
||
95 | } |
||
96 | |||
97 | /**
|
||
98 | * Registra un objeto IExtensionRequest para que no se aplique un escalado sobre
|
||
99 | * el buffer pasado por par?metro. Alternativamente a la aplicaci?n de este escalado
|
||
100 | * se ejecutar? el m?todo request del interfaz para que el cliente pueda pasar un
|
||
101 | * nuevo buffer con escala 1:1 y con la extensi?n correspondiente al zoom.
|
||
102 | * @param er
|
||
103 | */
|
||
104 | 1712 | nbrodin | public void setRequestListener(IViewRequestManager er) { |
105 | 1728 | nbrodin | viewControl.setExtensionRequest(er); |
106 | 1477 | nbrodin | } |
107 | |||
108 | /**
|
||
109 | * Obtiene el panel de control de zoom de coordenadas pixel
|
||
110 | * @return
|
||
111 | */
|
||
112 | public ViewControl getControl() {
|
||
113 | 1728 | nbrodin | if(viewControl == null) { |
114 | viewControl = new ViewControl(ViewControl.LEFT_CONTROL, this); |
||
115 | viewControl.hideButton(ViewControl.PREV_ZOOM); |
||
116 | viewControl.hideButton(ViewControl.FULL_VIEW); |
||
117 | viewControl.hideButton(ViewControl.SELECT_ZOOM_AREA); |
||
118 | viewControl.hideButton(ViewControl.ZOOM_INCREASE); |
||
119 | viewControl.hideButton(ViewControl.ZOOM_DECREASE); |
||
120 | viewControl.hideButton(ViewControl.PAN); |
||
121 | viewControl.hideButton(ViewControl.LOCATOR); |
||
122 | 1477 | nbrodin | } |
123 | 1728 | nbrodin | return viewControl;
|
124 | 1477 | nbrodin | } |
125 | |||
126 | /**
|
||
127 | * Asigna los par?metros de dibujado para el raster
|
||
128 | * @param img Buffer con un ?rea de datos
|
||
129 | * @param ext Rectangle2D del ?rea de datos dada
|
||
130 | * @param pixelSize Tama?o de pixel
|
||
131 | * @param center Punto del ?rea de datos donde se quiere centrar el dibujado del buffer
|
||
132 | */
|
||
133 | public void setDrawParams(BufferedImage img, Rectangle2D ext, double pixelSize, Point2D center) { |
||
134 | getControl().setDrawParams(img, ext, pixelSize, center) ; |
||
135 | } |
||
136 | 1703 | nbrodin | |
137 | /**
|
||
138 | * This call is not possible in the zoom window
|
||
139 | */
|
||
140 | public Rectangle2D getCursorAdjustedWorldCoordinates(int wWindow, int hWindow) { |
||
141 | return null; |
||
142 | } |
||
143 | 1477 | nbrodin | } |