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