Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extGeoreferencing / src / org / gvsig / georeferencing / gui / panels / AdjustGeorefPanel.java @ 5217

History | View | Annotate | Download (6.46 KB)

1
package org.gvsig.georeferencing.gui.panels;
2

    
3
import java.awt.FlowLayout;
4
import java.awt.GridBagConstraints;
5
import java.awt.GridBagLayout;
6

    
7
import javax.swing.JLabel;
8
import javax.swing.JPanel;
9

    
10
import org.gvsig.georeferencing.gui.dialogs.GeoreferencingDialog;
11

    
12
import com.iver.andami.PluginServices;
13
import com.iver.cit.gvsig.fmap.ViewPort;
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
                        FlowLayout flowLayout = new FlowLayout();
177
                        flowLayout.setHgap(2);
178
                        flowLayout.setAlignment(java.awt.FlowLayout.LEFT);
179
                        flowLayout.setVgap(2);
180
                        lzoomx1 = new JLabel();
181
                        lzoomx1.setText("1:");
182
                        lzoom1 = new JLabel();
183
                        lzoom1.setText(PluginServices.getText(this, "escala") + ": ");
184
                        pZoomxRight = new JPanel();
185
                        pZoomxRight.setLayout(flowLayout);
186
                        pZoomxRight.setPreferredSize(new java.awt.Dimension(210,20));
187
                        pZoomxRight.add(lzoom1, null);
188
                        pZoomxRight.add(lzoomx1, null);
189
                }
190
                return pZoomxRight;
191
        }
192

    
193
        /**
194
         * This method initializes jPanel1        
195
         *         
196
         * @return javax.swing.JPanel        
197
         */
198
        private JPanel getPZoomxLeft() {
199
                if (pZoomxLeft == null) {
200
                        FlowLayout flowLayout1 = new FlowLayout();
201
                        flowLayout1.setAlignment(java.awt.FlowLayout.LEFT);
202
                        flowLayout1.setVgap(2);
203
                        flowLayout1.setHgap(2);
204
                        lzoomx2 = new JLabel();
205
                        lzoomx2.setText("1:");
206
                        lzoom2 = new JLabel();
207
                        lzoom2.setText(PluginServices.getText(this, "escala") + ": ");
208
                        pZoomxLeft = new JPanel();
209
                        pZoomxLeft.setLayout(flowLayout1);
210
                        pZoomxLeft.setPreferredSize(new java.awt.Dimension(170,20));
211
                        pZoomxLeft.add(lzoom2, null);
212
                        pZoomxLeft.add(lzoomx2, null);
213
                }
214
                return pZoomxLeft;
215
        }
216
        
217
        /**
218
         * Asigna el zoom de la miniimagen con los controles a la derecha
219
         * @param txt
220
         */
221
        public void setLZoomRight(String txt){
222
                if(lzoomx1 != null)
223
                        lzoomx1.setText(txt);
224
        }
225
        
226
        /**
227
         * Asigna el zoom de la miniimagen con los controles a la izquierda
228
         * @param txt
229
         */
230
        public void setLZoomLeft(String txt){
231
                if(lzoomx2 != null)
232
                        lzoomx2.setText(txt);
233
        }
234

    
235
}