Statistics
| Revision:

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 @ 1712

History | View | Annotate | Download (4.62 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
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
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
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
import org.gvsig.raster.georeferencing.swing.view.IViewRequestManager;
31
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
public class ZoomPanelImpl extends BaseZoomView {
40
        private static final long         serialVersionUID = 1L;
41
        
42
        /**
43
         * Constructor.
44
         * Crea la composici?n de controles de zoom.
45
         */
46
        public ZoomPanelImpl() {
47
                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
        /*public void setMinxMaxyUL(boolean v) {
57
                getCanvas().setMinxMaxyUL(v);
58
        }*/
59
        
60
        /**
61
         * Activa o desactiva el mostrado de informaci?n
62
         * @param showInfo
63
         */
64
        public void setShowInfo(boolean show) {
65
                zoomPixelControl.getCanvas().setShowInfo(show);
66
        }
67
        
68
        /*
69
         * (non-Javadoc)
70
         * @see org.gvsig.rastertools.georeferencing.view.BaseZoomView#addGraphicLayer(org.gvsig.rastertools.georeferencing.ui.zoom.IGraphicLayer)
71
         */
72
        public void addGraphicLayer(IGraphicLayer graphicLayer) {
73
                getControl().setGraphicLayer(graphicLayer);
74
        }
75
        
76
        /**
77
         * Inicializaci?n de los componentes gr?ficos
78
         */
79
        private void init() {
80
                setLayout(new GridBagLayout());
81
                
82
                GridBagConstraints gb = new GridBagConstraints();
83
                gb.insets = new java.awt.Insets(0, 0, 0, 0);
84
                gb.gridy = 0;
85
                gb.gridx = 0;
86
                gb.weightx = 1D; //El espacio sobrante se distribuye horizontalmente
87
                gb.weighty = 1D; //El espacio sobrante se distribuye verticalmente
88
                gb.fill = GridBagConstraints.BOTH; //El componente se hace tan ancho como espacio disponible tiene
89
                gb.anchor = GridBagConstraints.NORTH; //Alineamos las cajas arriba
90
                add(getControl(), gb);
91
        }
92
        
93
        /**
94
         * Registra un objeto IExtensionRequest para que no se aplique un escalado sobre
95
         * el buffer pasado por par?metro. Alternativamente a la aplicaci?n de este escalado
96
         * se ejecutar? el m?todo request del interfaz para que el cliente pueda pasar un 
97
         * nuevo buffer con escala 1:1 y con la extensi?n correspondiente al zoom.
98
         * @param er
99
         */
100
        public void setRequestListener(IViewRequestManager er) {
101
                zoomPixelControl.setExtensionRequest(er);
102
        }
103
        
104
        /**
105
         * Obtiene el panel de control de zoom de coordenadas pixel
106
         * @return
107
         */
108
        public ViewControl getControl() {
109
                if(zoomPixelControl == null) {
110
                        zoomPixelControl = new ViewControl(ViewControl.LEFT_CONTROL);
111
                        zoomPixelControl.hideButton(ViewControl.PREV_ZOOM);
112
                        zoomPixelControl.hideButton(ViewControl.FULL_VIEW);
113
                        zoomPixelControl.hideButton(ViewControl.SELECT_ZOOM_AREA);
114
                        zoomPixelControl.hideButton(ViewControl.ZOOM_INCREASE);
115
                        zoomPixelControl.hideButton(ViewControl.ZOOM_DECREASE);
116
                        zoomPixelControl.hideButton(ViewControl.PAN);
117
                        zoomPixelControl.hideButton(ViewControl.LOCATOR);
118
                }
119
                return zoomPixelControl;
120
        }
121
                        
122
        /**
123
         * Asigna los par?metros de dibujado para el raster
124
         * @param img Buffer con un ?rea de datos
125
         * @param ext Rectangle2D del ?rea de datos dada 
126
         * @param pixelSize Tama?o de pixel
127
         * @param center Punto del ?rea de datos donde se quiere centrar el dibujado del buffer
128
         */
129
        public void setDrawParams(BufferedImage img, Rectangle2D ext, double pixelSize, Point2D center) {
130
                getControl().setDrawParams(img, ext, pixelSize, center) ;
131
        }
132
        
133
        /**
134
         * This call is not possible in the zoom window
135
         */
136
        public Rectangle2D getCursorAdjustedWorldCoordinates(int wWindow, int hWindow) {
137
                return null;
138
        }
139
}