Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extGeoreferencing / src / com / iver / cit / gvsig / gui / panels / AdjustGeorefPanel.java @ 4734

History | View | Annotate | Download (7.04 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

    
15
public class AdjustGeorefPanel extends JPanel{
16

    
17
        //**********************Vars**********************************
18
        private JPanel                                         pDetailImage = null;
19
        private ZoomControlPanel                 pixelZoom = null;
20
        private ZoomControlPanel                 mapZoom = null;
21
        private JPanel                                         zoomx = null;
22
        private GeoreferencingDialog         grd = null;
23
        private OptionsPanel                         optionsPanel = null;
24
        private JPanel                                         pZoomxRight = null;
25
        private JPanel                                         pZoomxLeft = null;
26
        private JLabel                                         lzoom1 = null;
27
        private JLabel                                         lzoom2 = null;
28
        private JLabel                                         lzoomx1 = null;
29
        private JLabel                                         lzoomx2 = null;
30
        //**********************Methods**************************************
31
        /**
32
         * This is the default constructor
33
         */
34
        public AdjustGeorefPanel(GeoreferencingDialog grd) {
35
                super();
36
                this.grd = grd;
37
                initialize();
38
        }
39

    
40
        /**
41
         * This method initializes this
42
         * 
43
         * @return void
44
         */
45
        private void initialize() {
46
        GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
47
        gridBagConstraints11.gridx = 0;
48
        gridBagConstraints11.gridy = 1;
49
        GridBagConstraints gridBagConstraints = new GridBagConstraints();
50
        gridBagConstraints.gridx = 0;
51
        gridBagConstraints.gridy = 0;
52
        this.setLayout(new GridBagLayout());
53
        this.setPreferredSize(new java.awt.Dimension(380,162));
54
        this.setSize(new java.awt.Dimension(380,162));
55
        this.setLocation(new java.awt.Point(0,0));
56
        
57
                this.add(getPDetailImage(), gridBagConstraints);                
58
                this.add(getPZoomx(), gridBagConstraints11);
59
        }
60

    
61
        /**
62
         * This method initializes jPanel        
63
         *         
64
         * @return javax.swing.JPanel        
65
         */
66
        private JPanel getPDetailImage() {
67
                if (pDetailImage == null) {
68
                        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
69
                        gridBagConstraints1.insets = new java.awt.Insets(0,0,0,0);
70
                        gridBagConstraints1.gridy = 0;
71
                        gridBagConstraints1.gridx = 0;
72
                        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
73
                        gridBagConstraints2.insets = new java.awt.Insets(0,0,0,0);
74
                        gridBagConstraints2.gridy = 0;
75
                        gridBagConstraints2.gridx = 1;
76
                        pDetailImage = new JPanel();
77
                        pDetailImage.setLayout(new GridBagLayout());
78
                        pDetailImage.setPreferredSize(new java.awt.Dimension(380,142));
79
                        pDetailImage.add(getZoomLeft(), gridBagConstraints1);
80
                        pDetailImage.add(getZoomRight(), gridBagConstraints2);        
81
                }
82
                return pDetailImage;
83
        }
84

    
85
        /**
86
         * This method initializes ZoomControlPanel        
87
         *         
88
         * @return javax.swing.JButton        
89
         */
90
        public ZoomControlPanel getZoomLeft() {
91
                if (pixelZoom == null) {
92
                        pixelZoom = new ZoomControlPanel(true, grd);
93
                }
94
                return pixelZoom;
95
        }
96
        
97
        /**
98
         * This method initializes jButton        
99
         *         
100
         * @return javax.swing.JButton        
101
         */
102
        public ZoomControlPanel getZoomRight() {
103
                if (mapZoom == null) {
104
                        mapZoom = new ZoomControlPanel(false, grd);
105
                }
106
                return mapZoom;
107
        }
108

    
109
        /**
110
         * This method initializes jPanel        
111
         *         
112
         * @return javax.swing.JPanel        
113
         */
114
        public JPanel getPZoomx() {
115
                if (zoomx == null) {
116
                        GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
117
                        gridBagConstraints4.insets = new java.awt.Insets(0,0,0,0);
118
                        gridBagConstraints4.gridy = 0;
119
                        gridBagConstraints4.gridx = 1;
120
                        GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
121
                        gridBagConstraints3.gridx = 0;
122
                        gridBagConstraints3.ipadx = 0;
123
                        gridBagConstraints3.gridy = 0;
124
                        zoomx = new JPanel();
125
                        zoomx.setLayout(new GridBagLayout());
126
                        zoomx.setPreferredSize(new java.awt.Dimension(380,20));
127
                        zoomx.add(getPZoomxRight(), gridBagConstraints3);
128
                        zoomx.add(getPZoomxLeft(), gridBagConstraints4);
129
                }
130
                return zoomx;
131
        }
132
        
133
        /**
134
         * Asigna los viewPort a los canvas para el dibujado de la minimagen 
135
         * @param vp ViewPort asignado.
136
         */
137
        public void setViewPort(ViewPort vp){
138
                this.getZoomLeft().setViewPort(vp);
139
                this.getZoomRight().setViewPort(vp);
140
        }
141
        
142
        /**
143
         * Realiza el dibujado de la minimagen de los cavas con el viewport actual 
144
         */
145
        public void draw(){
146
                this.getZoomLeft().draw();
147
                this.getZoomRight().draw();
148
        }
149

    
150
        /**
151
         * @return Returns the optionsPanel.
152
         */
153
        public OptionsPanel getOptionsPanel() {
154
                return optionsPanel;
155
        }
156

    
157
    /**
158
     * Activa o desactiva este panel y todos los que lo componen
159
     * @param enabled variable booleana para la activaci?n y/o desactivaci?n
160
     */
161
    public void setEnabled(boolean enabled){
162
            if(pixelZoom != null)
163
                    pixelZoom.setEnabled(enabled);
164
            if(mapZoom != null)
165
                    mapZoom.setEnabled(enabled);
166
    }
167
        //**********************End Methods**********************************        
168

    
169
        /**
170
         * This method initializes jPanel        
171
         *         
172
         * @return javax.swing.JPanel        
173
         */
174
        private JPanel getPZoomxRight() {
175
                if (pZoomxRight == null) {
176
                        GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
177
                        gridBagConstraints6.insets = new java.awt.Insets(2,3,3,100);
178
                        gridBagConstraints6.gridy = 0;
179
                        gridBagConstraints6.gridx = 1;
180
                        GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
181
                        gridBagConstraints5.insets = new java.awt.Insets(2,18,3,2);
182
                        gridBagConstraints5.gridy = 0;
183
                        gridBagConstraints5.gridx = 0;
184
                        lzoomx1 = new JLabel();
185
                        lzoomx1.setText("1:");
186
                        lzoom1 = new JLabel();
187
                        lzoom1.setText(PluginServices.getText(this, "escala") + ": ");
188
                        pZoomxRight = new JPanel();
189
                        pZoomxRight.setLayout(new GridBagLayout());
190
                        pZoomxRight.setPreferredSize(new java.awt.Dimension(190,20));
191
                        pZoomxRight.add(lzoom1, gridBagConstraints5);
192
                        pZoomxRight.add(lzoomx1, gridBagConstraints6);
193
                }
194
                return pZoomxRight;
195
        }
196

    
197
        /**
198
         * This method initializes jPanel1        
199
         *         
200
         * @return javax.swing.JPanel        
201
         */
202
        private JPanel getPZoomxLeft() {
203
                if (pZoomxLeft == null) {
204
                        GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
205
                        gridBagConstraints6.insets = new java.awt.Insets(2,3,3,100);
206
                        gridBagConstraints6.gridy = 0;
207
                        gridBagConstraints6.gridx = 1;
208
                        GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
209
                        gridBagConstraints5.insets = new java.awt.Insets(2,50,3,2);
210
                        gridBagConstraints5.gridy = 0;
211
                        gridBagConstraints5.gridx = 0;
212
                        lzoomx2 = new JLabel();
213
                        lzoomx2.setText("1:");
214
                        lzoom2 = new JLabel();
215
                        lzoom2.setText(PluginServices.getText(this, "escala") + ": ");
216
                        pZoomxLeft = new JPanel();
217
                        pZoomxLeft.setLayout(new GridBagLayout());
218
                        pZoomxLeft.setPreferredSize(new java.awt.Dimension(190,20));
219
                        pZoomxLeft.add(lzoom2, gridBagConstraints5);
220
                        pZoomxLeft.add(lzoomx2, gridBagConstraints6);
221
                }
222
                return pZoomxLeft;
223
        }
224
        
225
        /**
226
         * Asigna el zoom de la miniimagen con los controles a la derecha
227
         * @param txt
228
         */
229
        public void setLZoomRight(String txt){
230
                if(lzoomx1 != null)
231
                        lzoomx1.setText(txt);
232
        }
233
        
234
        /**
235
         * Asigna el zoom de la miniimagen con los controles a la izquierda
236
         * @param txt
237
         */
238
        public void setLZoomLeft(String txt){
239
                if(lzoomx2 != null)
240
                        lzoomx2.setText(txt);
241
        }
242

    
243
}