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

History | View | Annotate | Download (4.69 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
        public boolean getMinxMaxyUL() {
61
                return getCanvas().getMinxMaxyUL();
62
        }
63
        
64
        /**
65
         * Activa o desactiva el mostrado de informaci?n
66
         * @param showInfo
67
         */
68
        public void setShowInfo(boolean show) {
69
                zoomPixelControl.getCanvas().setShowInfo(show);
70
        }
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
        public void setRequestListener(IViewRequestManager er) {
105
                zoomPixelControl.setExtensionRequest(er);
106
        }
107
        
108
        /**
109
         * Obtiene el panel de control de zoom de coordenadas pixel
110
         * @return
111
         */
112
        public ViewControl getControl() {
113
                if(zoomPixelControl == null) {
114
                        zoomPixelControl = new ViewControl(ViewControl.LEFT_CONTROL);
115
                        zoomPixelControl.hideButton(ViewControl.PREV_ZOOM);
116
                        zoomPixelControl.hideButton(ViewControl.FULL_VIEW);
117
                        zoomPixelControl.hideButton(ViewControl.SELECT_ZOOM_AREA);
118
                        zoomPixelControl.hideButton(ViewControl.ZOOM_INCREASE);
119
                        zoomPixelControl.hideButton(ViewControl.ZOOM_DECREASE);
120
                        zoomPixelControl.hideButton(ViewControl.PAN);
121
                        zoomPixelControl.hideButton(ViewControl.LOCATOR);
122
                }
123
                return zoomPixelControl;
124
        }
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
        
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
}