svn-gvsig-desktop / tags / v1_0_2_Build_892 / extensions / extGeoreferencing / src / org / gvsig / georeferencing / gui / panels / AdjustGeorefPanel.java @ 10278
History | View | Annotate | Download (7.48 KB)
1 | 5791 | nacho | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|---|---|
2 | *
|
||
3 | * Copyright (C) 2006 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 | 5217 | nacho | package org.gvsig.georeferencing.gui.panels; |
20 | |||
21 | import java.awt.FlowLayout; |
||
22 | import java.awt.GridBagConstraints; |
||
23 | import java.awt.GridBagLayout; |
||
24 | |||
25 | import javax.swing.JLabel; |
||
26 | import javax.swing.JPanel; |
||
27 | |||
28 | 5818 | nacho | import org.gvsig.georeferencing.gui.dialog.GeoreferencingDialog; |
29 | 5217 | nacho | |
30 | import com.iver.andami.PluginServices; |
||
31 | import com.iver.cit.gvsig.fmap.ViewPort; |
||
32 | |||
33 | public class AdjustGeorefPanel extends JPanel{ |
||
34 | |||
35 | //**********************Vars**********************************
|
||
36 | 7091 | nacho | private int widthAdjustPanel = 380; |
37 | private int heightAdjustPanel = 172; |
||
38 | 5217 | nacho | private JPanel pDetailImage = null; |
39 | private ZoomControlPanel pixelZoom = null; |
||
40 | private ZoomControlPanel mapZoom = null; |
||
41 | private JPanel zoomx = null; |
||
42 | private GeoreferencingDialog grd = null; |
||
43 | private OptionsPanel optionsPanel = null; |
||
44 | private JPanel pZoomxRight = null; |
||
45 | private JPanel pZoomxLeft = null; |
||
46 | private JLabel lzoom1 = null; |
||
47 | private JLabel lzoom2 = null; |
||
48 | private JLabel lzoomx1 = null; |
||
49 | private JLabel lzoomx2 = null; |
||
50 | //**********************Methods**************************************
|
||
51 | /**
|
||
52 | * This is the default constructor
|
||
53 | */
|
||
54 | public AdjustGeorefPanel(GeoreferencingDialog grd) {
|
||
55 | super();
|
||
56 | this.grd = grd;
|
||
57 | initialize(); |
||
58 | } |
||
59 | |||
60 | /**
|
||
61 | * This method initializes this
|
||
62 | *
|
||
63 | * @return void
|
||
64 | */
|
||
65 | private void initialize() { |
||
66 | GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); |
||
67 | gridBagConstraints11.gridx = 0;
|
||
68 | gridBagConstraints11.gridy = 1;
|
||
69 | GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
||
70 | gridBagConstraints.gridx = 0;
|
||
71 | gridBagConstraints.gridy = 0;
|
||
72 | this.setLayout(new GridBagLayout()); |
||
73 | 7091 | nacho | this.setPreferredSize(new java.awt.Dimension(widthAdjustPanel, heightAdjustPanel)); |
74 | this.setSize(new java.awt.Dimension(widthAdjustPanel, heightAdjustPanel)); |
||
75 | 5217 | nacho | this.setLocation(new java.awt.Point(0,0)); |
76 | |||
77 | this.add(getPDetailImage(), gridBagConstraints);
|
||
78 | this.add(getPZoomx(), gridBagConstraints11);
|
||
79 | } |
||
80 | |||
81 | /**
|
||
82 | * This method initializes jPanel
|
||
83 | *
|
||
84 | * @return javax.swing.JPanel
|
||
85 | */
|
||
86 | private JPanel getPDetailImage() { |
||
87 | if (pDetailImage == null) { |
||
88 | GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
||
89 | 7091 | nacho | gridBagConstraints1.insets = new java.awt.Insets(10,0,0,0); |
90 | 5217 | nacho | gridBagConstraints1.gridy = 0;
|
91 | gridBagConstraints1.gridx = 0;
|
||
92 | GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); |
||
93 | 7091 | nacho | gridBagConstraints2.insets = new java.awt.Insets(10,0,0,0); |
94 | 5217 | nacho | gridBagConstraints2.gridy = 0;
|
95 | gridBagConstraints2.gridx = 1;
|
||
96 | pDetailImage = new JPanel(); |
||
97 | pDetailImage.setLayout(new GridBagLayout()); |
||
98 | 7091 | nacho | pDetailImage.setPreferredSize(new java.awt.Dimension(widthAdjustPanel, 152)); |
99 | 5217 | nacho | pDetailImage.add(getZoomLeft(), gridBagConstraints1); |
100 | pDetailImage.add(getZoomRight(), gridBagConstraints2); |
||
101 | } |
||
102 | return pDetailImage;
|
||
103 | } |
||
104 | |||
105 | /**
|
||
106 | * This method initializes ZoomControlPanel
|
||
107 | *
|
||
108 | * @return javax.swing.JButton
|
||
109 | */
|
||
110 | public ZoomControlPanel getZoomLeft() {
|
||
111 | if (pixelZoom == null) { |
||
112 | pixelZoom = new ZoomControlPanel(true, grd); |
||
113 | } |
||
114 | return pixelZoom;
|
||
115 | } |
||
116 | |||
117 | /**
|
||
118 | * This method initializes jButton
|
||
119 | *
|
||
120 | * @return javax.swing.JButton
|
||
121 | */
|
||
122 | public ZoomControlPanel getZoomRight() {
|
||
123 | if (mapZoom == null) { |
||
124 | mapZoom = new ZoomControlPanel(false, grd); |
||
125 | } |
||
126 | return mapZoom;
|
||
127 | } |
||
128 | |||
129 | /**
|
||
130 | * This method initializes jPanel
|
||
131 | *
|
||
132 | * @return javax.swing.JPanel
|
||
133 | */
|
||
134 | public JPanel getPZoomx() { |
||
135 | if (zoomx == null) { |
||
136 | GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); |
||
137 | gridBagConstraints4.insets = new java.awt.Insets(0,0,0,0); |
||
138 | gridBagConstraints4.gridy = 0;
|
||
139 | gridBagConstraints4.gridx = 1;
|
||
140 | GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); |
||
141 | gridBagConstraints3.gridx = 0;
|
||
142 | gridBagConstraints3.ipadx = 0;
|
||
143 | gridBagConstraints3.gridy = 0;
|
||
144 | zoomx = new JPanel(); |
||
145 | zoomx.setLayout(new GridBagLayout()); |
||
146 | 7091 | nacho | zoomx.setPreferredSize(new java.awt.Dimension(widthAdjustPanel, 20)); |
147 | 5217 | nacho | zoomx.add(getPZoomxRight(), gridBagConstraints3); |
148 | zoomx.add(getPZoomxLeft(), gridBagConstraints4); |
||
149 | } |
||
150 | return zoomx;
|
||
151 | } |
||
152 | |||
153 | /**
|
||
154 | * Asigna los viewPort a los canvas para el dibujado de la minimagen
|
||
155 | * @param vp ViewPort asignado.
|
||
156 | */
|
||
157 | 5550 | nacho | public void setViewPort(ViewPort vp, double zoom){ |
158 | this.getZoomLeft().setViewPort(vp, zoom);
|
||
159 | this.getZoomRight().setViewPort(vp, zoom);
|
||
160 | 5217 | nacho | } |
161 | |||
162 | /**
|
||
163 | * Realiza el dibujado de la minimagen de los cavas con el viewport actual
|
||
164 | */
|
||
165 | public void draw(){ |
||
166 | this.getZoomLeft().draw();
|
||
167 | this.getZoomRight().draw();
|
||
168 | } |
||
169 | |||
170 | /**
|
||
171 | * @return Returns the optionsPanel.
|
||
172 | */
|
||
173 | public OptionsPanel getOptionsPanel() {
|
||
174 | return optionsPanel;
|
||
175 | } |
||
176 | |||
177 | /**
|
||
178 | * Activa o desactiva este panel y todos los que lo componen
|
||
179 | * @param enabled variable booleana para la activaci?n y/o desactivaci?n
|
||
180 | */
|
||
181 | public void setEnabled(boolean enabled){ |
||
182 | if(pixelZoom != null) |
||
183 | pixelZoom.setEnabled(enabled); |
||
184 | if(mapZoom != null) |
||
185 | mapZoom.setEnabled(enabled); |
||
186 | } |
||
187 | //**********************End Methods**********************************
|
||
188 | |||
189 | /**
|
||
190 | * This method initializes jPanel
|
||
191 | *
|
||
192 | * @return javax.swing.JPanel
|
||
193 | */
|
||
194 | private JPanel getPZoomxRight() { |
||
195 | if (pZoomxRight == null) { |
||
196 | FlowLayout flowLayout = new FlowLayout(); |
||
197 | flowLayout.setHgap(2);
|
||
198 | flowLayout.setAlignment(java.awt.FlowLayout.LEFT); |
||
199 | flowLayout.setVgap(2);
|
||
200 | lzoomx1 = new JLabel(); |
||
201 | lzoomx1.setText("1:");
|
||
202 | lzoom1 = new JLabel(); |
||
203 | lzoom1.setText(PluginServices.getText(this, "escala") + ": "); |
||
204 | pZoomxRight = new JPanel(); |
||
205 | pZoomxRight.setLayout(flowLayout); |
||
206 | pZoomxRight.setPreferredSize(new java.awt.Dimension(210,20)); |
||
207 | pZoomxRight.add(lzoom1, null);
|
||
208 | pZoomxRight.add(lzoomx1, null);
|
||
209 | } |
||
210 | return pZoomxRight;
|
||
211 | } |
||
212 | |||
213 | /**
|
||
214 | * This method initializes jPanel1
|
||
215 | *
|
||
216 | * @return javax.swing.JPanel
|
||
217 | */
|
||
218 | private JPanel getPZoomxLeft() { |
||
219 | if (pZoomxLeft == null) { |
||
220 | FlowLayout flowLayout1 = new FlowLayout(); |
||
221 | flowLayout1.setAlignment(java.awt.FlowLayout.LEFT); |
||
222 | flowLayout1.setVgap(2);
|
||
223 | flowLayout1.setHgap(2);
|
||
224 | lzoomx2 = new JLabel(); |
||
225 | lzoomx2.setText("1:");
|
||
226 | lzoom2 = new JLabel(); |
||
227 | lzoom2.setText(PluginServices.getText(this, "escala") + ": "); |
||
228 | pZoomxLeft = new JPanel(); |
||
229 | pZoomxLeft.setLayout(flowLayout1); |
||
230 | pZoomxLeft.setPreferredSize(new java.awt.Dimension(170,20)); |
||
231 | pZoomxLeft.add(lzoom2, null);
|
||
232 | pZoomxLeft.add(lzoomx2, null);
|
||
233 | } |
||
234 | return pZoomxLeft;
|
||
235 | } |
||
236 | |||
237 | /**
|
||
238 | * Asigna el zoom de la miniimagen con los controles a la derecha
|
||
239 | * @param txt
|
||
240 | */
|
||
241 | public void setLZoomRight(String txt){ |
||
242 | if(lzoomx1 != null) |
||
243 | lzoomx1.setText(txt); |
||
244 | } |
||
245 | |||
246 | /**
|
||
247 | * Asigna el zoom de la miniimagen con los controles a la izquierda
|
||
248 | * @param txt
|
||
249 | */
|
||
250 | public void setLZoomLeft(String txt){ |
||
251 | if(lzoomx2 != null) |
||
252 | lzoomx2.setText(txt); |
||
253 | } |
||
254 | |||
255 | } |