Statistics
| Revision:

gvsig-3d / 2.1 / trunk / org.gvsig.view3d / org.gvsig.view3d.swing / org.gvsig.view3d.swing.impl / src / main / java / org / gvsig / view3d / swing / impl / properties / AbstractViewProperties3DPanel.java @ 693

History | View | Annotate | Download (10.6 KB)

1
package org.gvsig.view3d.swing.impl.properties;
2

    
3
import java.awt.BorderLayout;
4
import java.awt.Component;
5
import java.awt.GridBagConstraints;
6
import java.awt.GridBagLayout;
7
import java.awt.Insets;
8

    
9
import javax.swing.JCheckBox;
10
import javax.swing.JLabel;
11
import javax.swing.JPanel;
12
import javax.swing.JTextField;
13

    
14
import org.gvsig.tools.ToolsLocator;
15
import org.gvsig.tools.i18n.I18nManager;
16
import org.gvsig.view3d.swing.api.properties.ViewProperties3DPanel;
17

    
18
public abstract class AbstractViewProperties3DPanel extends JPanel implements
19
    ViewProperties3DPanel {
20

    
21
    private static final long serialVersionUID = -1167740272556253366L;
22

    
23
    private Insets insets = new Insets(5, 5, 5, 5);
24

    
25
    private JPanel propertiesPanel;
26

    
27
    private JLabel sphereVerticalExaggerationText;
28
    private JTextField sphereVerticalExaggeration;
29
    private JLabel flatVerticalExaggerationText;
30
    private JTextField flatVerticalExaggeration;
31
    private JLabel autoSynchronizeViewPortsText;
32
    private JCheckBox autoSynchronizeViewPorts;
33
    private JLabel autoSynchronizeLayersText;
34
    private JCheckBox autoSynchronizeLayers;
35
    private JLabel showBlueMarbleLayerText;
36
    private JCheckBox showBlueMarbleLayer;
37
    private JCheckBox showNasaLandsatLayer;
38
    private JLabel showNasaLandsatLayerText;
39
    private JLabel showDefaultElevationText;
40
    private JCheckBox showDefaultElevation;
41
    private JLabel anaglyphModeText;
42
    private JCheckBox anaglyphMode;
43

    
44
    public AbstractViewProperties3DPanel() {
45
        super(new BorderLayout());
46

    
47
        initialize();
48
    }
49

    
50
    private void initialize() {
51
        this.add(getCenterPanel(), BorderLayout.NORTH);
52
    }
53

    
54
    private Component getCenterPanel() {
55
        if (propertiesPanel == null) {
56
            propertiesPanel = new JPanel(new GridBagLayout());
57

    
58
            GridBagConstraints cons = new GridBagConstraints();
59
            cons.gridy = 0;
60
            cons.gridx = 0;
61
            cons.weightx = 0;
62
            cons.anchor = GridBagConstraints.WEST;
63
            cons.insets = insets;
64

    
65
            propertiesPanel.add(getSphereVerticalExaggerationText(), cons);
66

    
67
            cons = new GridBagConstraints();
68
            cons.gridy = 0;
69
            cons.gridx = 1;
70
            cons.weightx = 1;
71
            cons.fill = GridBagConstraints.HORIZONTAL;
72
            cons.insets = insets;
73

    
74
            propertiesPanel.add(getSphereVerticalExaggerationField(), cons);
75

    
76
            cons = new GridBagConstraints();
77
            cons.gridy = 1;
78
            cons.gridx = 0;
79
            cons.weightx = 0;
80
            cons.anchor = GridBagConstraints.WEST;
81
            cons.insets = insets;
82

    
83
            propertiesPanel.add(getFlatVerticalExaggerationText(), cons);
84

    
85
            cons = new GridBagConstraints();
86
            cons.gridy = 1;
87
            cons.gridx = 1;
88
            cons.weightx = 1;
89
            cons.fill = GridBagConstraints.HORIZONTAL;
90
            cons.insets = insets;
91

    
92
            propertiesPanel.add(getFlatVerticalExaggerationField(), cons);
93
            
94
            cons = new GridBagConstraints();
95
            cons.gridy = 2;
96
            cons.gridx = 0;
97
            cons.weightx = 0;
98
            cons.anchor = GridBagConstraints.WEST;
99
            cons.insets = insets;
100

    
101
            propertiesPanel.add(getAutoLayerSynchronizeText(), cons);
102

    
103
            cons = new GridBagConstraints();
104
            cons.gridy = 2;
105
            cons.gridx = 1;
106
            cons.weightx = 1;
107
            cons.insets = insets;
108

    
109
            propertiesPanel.add(getAutoLayerSynchronizeCheckBox(), cons);
110
            
111
            cons = new GridBagConstraints();
112
            cons.gridy = 3;
113
            cons.gridx = 0;
114
            cons.weightx = 0;
115
            cons.anchor = GridBagConstraints.WEST;
116
            cons.insets = insets;
117

    
118
            propertiesPanel.add(getAutoViewPortSynchronizeText(), cons);
119

    
120
            cons = new GridBagConstraints();
121
            cons.gridy = 3;
122
            cons.gridx = 1;
123
            cons.weightx = 1;
124
            cons.insets = insets;
125

    
126
            propertiesPanel.add(getAutoViewPortSynchronizeCheckBox(), cons);
127
            
128
            cons = new GridBagConstraints();
129
            cons.gridy = 4;
130
            cons.gridx = 0;
131
            cons.weightx = 0;
132
            cons.anchor = GridBagConstraints.WEST;
133
            cons.insets = insets;
134

    
135
            propertiesPanel.add(getShowBlueMarbleLayerText(), cons);
136

    
137
            cons = new GridBagConstraints();
138
            cons.gridy = 4;
139
            cons.gridx = 1;
140
            cons.weightx = 1;
141
            cons.insets = insets;
142

    
143
            propertiesPanel.add(getShowBlueMarbleLayerCheckBox(), cons);
144
            
145
            cons = new GridBagConstraints();
146
            cons.gridy = 5;
147
            cons.gridx = 0;
148
            cons.weightx = 0;
149
            cons.anchor = GridBagConstraints.WEST;
150
            cons.insets = insets;
151

    
152
            propertiesPanel.add(getShowNasaLandsatLayerText(), cons);
153

    
154
            cons = new GridBagConstraints();
155
            cons.gridy = 5;
156
            cons.gridx = 1;
157
            cons.weightx = 1;
158
            cons.insets = insets;
159

    
160
            propertiesPanel.add(getShowNasaLandsatLayerCheckBox(), cons);
161
            
162
            cons = new GridBagConstraints();
163
            cons.gridy = 6;
164
            cons.gridx = 0;
165
            cons.weightx = 0;
166
            cons.anchor = GridBagConstraints.WEST;
167
            cons.insets = insets;
168

    
169
            propertiesPanel.add(getShowDefaultElevationText(), cons);
170

    
171
            cons = new GridBagConstraints();
172
            cons.gridx = 6;
173
            cons.gridx = 1;
174
            cons.weightx = 1;
175
            cons.insets = insets;
176

    
177
            propertiesPanel.add(getShowDefaultElevationCheckBox(), cons);
178
            
179
            cons = new GridBagConstraints();
180
            cons.gridy = 7;
181
            cons.gridx = 0;
182
            cons.weightx = 0;
183
            cons.anchor = GridBagConstraints.WEST;
184
            cons.insets = insets;
185

    
186
            propertiesPanel.add(getAnaglyphModeText(), cons);
187

    
188
            cons = new GridBagConstraints();
189
            cons.gridx = 7;
190
            cons.gridx = 1;
191
            cons.weightx = 1;
192
            cons.insets = insets;
193

    
194
            propertiesPanel.add(getAnaglyphModeCheckBox(), cons);
195
        }
196
        return propertiesPanel;
197
    }
198

    
199
    protected JLabel getFlatVerticalExaggerationText() {
200
        if (flatVerticalExaggerationText == null) {
201
            I18nManager i18nManager = ToolsLocator.getI18nManager();
202
            flatVerticalExaggerationText =
203
                new JLabel(
204
                    i18nManager.getTranslation("flat_vertical_exaggeration"));
205
        }
206
        return flatVerticalExaggerationText;
207
    }
208

    
209
    protected JTextField getFlatVerticalExaggerationField() {
210
        if (flatVerticalExaggeration == null) {
211
            flatVerticalExaggeration = new JTextField();
212
        }
213
        return flatVerticalExaggeration;
214
    }
215

    
216
    private JLabel getSphereVerticalExaggerationText() {
217
        if (sphereVerticalExaggerationText == null) {
218
            I18nManager i18nManager = ToolsLocator.getI18nManager();
219
            sphereVerticalExaggerationText =
220
                new JLabel(
221
                    i18nManager.getTranslation("spherical_vertical_exaggeration"));
222
        }
223
        return sphereVerticalExaggerationText;
224
    }
225

    
226
    protected JTextField getSphereVerticalExaggerationField() {
227
        if (sphereVerticalExaggeration == null) {
228
            sphereVerticalExaggeration = new JTextField();
229
        }
230
        return sphereVerticalExaggeration;
231
    }
232

    
233
    private JLabel getAutoViewPortSynchronizeText() {
234
        if (autoSynchronizeViewPortsText == null) {
235
            I18nManager i18nManager = ToolsLocator.getI18nManager();
236
            autoSynchronizeViewPortsText =
237
                new JLabel(
238
                    i18nManager.getTranslation("auto_synchronize_view_ports"));
239
        }
240
        return autoSynchronizeViewPortsText;
241
    }
242

    
243
    protected JCheckBox getAutoViewPortSynchronizeCheckBox() {
244
        if (autoSynchronizeViewPorts == null) {
245
            autoSynchronizeViewPorts = new JCheckBox();
246
        }
247
        return autoSynchronizeViewPorts;
248
    }
249

    
250
    private JLabel getAutoLayerSynchronizeText() {
251
        if (autoSynchronizeLayersText == null) {
252
            I18nManager i18nManager = ToolsLocator.getI18nManager();
253
            autoSynchronizeLayersText =
254
                new JLabel(
255
                    i18nManager.getTranslation("auto_synchronize_layers"));
256
        }
257
        return autoSynchronizeLayersText;
258
    }
259

    
260
    protected JCheckBox getAutoLayerSynchronizeCheckBox() {
261
        if (autoSynchronizeLayers == null) {
262
            autoSynchronizeLayers = new JCheckBox();
263
        }
264
        return autoSynchronizeLayers;
265
    }
266

    
267
    private JLabel getShowBlueMarbleLayerText() {
268
        if (showBlueMarbleLayerText == null) {
269
            I18nManager i18nManager = ToolsLocator.getI18nManager();
270
            showBlueMarbleLayerText =
271
                new JLabel(i18nManager.getTranslation("show_blue_marble_layer"));
272
        }
273
        return showBlueMarbleLayerText;
274
    }
275

    
276
    protected JCheckBox getShowBlueMarbleLayerCheckBox() {
277
        if (showBlueMarbleLayer == null) {
278
            showBlueMarbleLayer = new JCheckBox();
279
        }
280
        return showBlueMarbleLayer;
281
    }
282

    
283
    private JLabel getShowNasaLandsatLayerText() {
284
        if (showNasaLandsatLayerText == null) {
285
            I18nManager i18nManager = ToolsLocator.getI18nManager();
286
            showNasaLandsatLayerText =
287
                new JLabel(
288
                    i18nManager.getTranslation("show_nasa_landsat_layer"));
289
        }
290
        return showNasaLandsatLayerText;
291
    }
292

    
293
    protected JCheckBox getShowNasaLandsatLayerCheckBox() {
294
        if (showNasaLandsatLayer == null) {
295
            showNasaLandsatLayer = new JCheckBox();
296
        }
297
        return showNasaLandsatLayer;
298
    }
299

    
300
    private JLabel getShowDefaultElevationText() {
301
        if (showDefaultElevationText == null) {
302
            I18nManager i18nManager = ToolsLocator.getI18nManager();
303
            showDefaultElevationText =
304
                new JLabel(i18nManager.getTranslation("show_default_elevation"));
305
        }
306
        return showDefaultElevationText;
307
    }
308

    
309
    protected JCheckBox getShowDefaultElevationCheckBox() {
310
        if (showDefaultElevation == null) {
311
            showDefaultElevation = new JCheckBox();
312
        }
313
        return showDefaultElevation;
314
    }
315
    
316
    protected JLabel getAnaglyphModeText() {
317
        if (anaglyphModeText == null) {
318
            I18nManager i18nManager = ToolsLocator.getI18nManager();
319
            anaglyphModeText = new JLabel(i18nManager.getTranslation("anaglyph_mode"));
320
        }
321
        return anaglyphModeText;
322
    }
323

    
324
    protected JCheckBox getAnaglyphModeCheckBox() {
325
        if (anaglyphMode == null) {
326
            anaglyphMode = new JCheckBox();
327
        }
328
        return anaglyphMode;
329
    }
330
}