Statistics
| Revision:

gvsig-3d / 2.1 / branches / org.gvsig.view3d_vector_and_extrusion_2.3 / org.gvsig.view3d / org.gvsig.view3d / org.gvsig.view3d.swing / org.gvsig.view3d.swing.impl / src / main / java / org / gvsig / view3d / swing / impl / properties / AbstractViewProperties3DPanel.java @ 708

History | View | Annotate | Download (10.5 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright © 2007-2016 gvSIG Association
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24

    
25
package org.gvsig.view3d.swing.impl.properties;
26

    
27
import java.awt.BorderLayout;
28
import java.awt.Component;
29
import java.awt.GridBagConstraints;
30
import java.awt.GridBagLayout;
31
import java.awt.Insets;
32

    
33
import javax.swing.JCheckBox;
34
import javax.swing.JLabel;
35
import javax.swing.JPanel;
36
import javax.swing.JTextField;
37

    
38
import org.gvsig.tools.ToolsLocator;
39
import org.gvsig.tools.i18n.I18nManager;
40
import org.gvsig.view3d.swing.api.properties.ViewProperties3DPanel;
41

    
42
/**
43
 * Abstract panel for the view properties, i.e. the ones found in the
44
 * gvSIG project manager if a view is selected and the properties button is
45
 * pushed.
46
 */
47
public abstract class AbstractViewProperties3DPanel extends JPanel
48
    implements ViewProperties3DPanel {
49

    
50
    private static final long serialVersionUID = -1167740272556253366L;
51

    
52
    private Insets insets = new Insets(5, 5, 5, 5);
53

    
54
    private JPanel propertiesPanel;
55

    
56
    private JLabel sphereVerticalExaggerationText;
57
    private JTextField sphereVerticalExaggeration;
58
    private JLabel flatVerticalExaggerationText;
59
    private JTextField flatVerticalExaggeration;
60
    private JLabel autoSynchronizeViewPortsText;
61
    private JCheckBox autoSynchronizeViewPorts;
62
    private JLabel autoSynchronizeLayersText;
63
    private JCheckBox autoSynchronizeLayers;
64
    private JLabel showBlueMarbleLayerText;
65
    private JCheckBox showBlueMarbleLayer;
66
    private JCheckBox showNasaLandsatLayer;
67
    private JLabel showNasaLandsatLayerText;
68
    private JLabel showDefaultElevationText;
69
    private JCheckBox showDefaultElevation;
70

    
71
    public AbstractViewProperties3DPanel() {
72
        super(new BorderLayout());
73

    
74
        initialize();
75
    }
76

    
77
    private void initialize() {
78
        this.add(getCenterPanel(), BorderLayout.NORTH);
79
    }
80

    
81
    private Component getCenterPanel() {
82
        if (propertiesPanel == null) {
83
            propertiesPanel = new JPanel(new GridBagLayout());
84

    
85
            GridBagConstraints cons = new GridBagConstraints();
86
            cons.gridy = 0;
87
            cons.gridx = 0;
88
            cons.weightx = 0;
89
            cons.anchor = GridBagConstraints.WEST;
90
            cons.insets = insets;
91

    
92
            propertiesPanel.add(getSphereVerticalExaggerationText(), cons);
93

    
94
            cons = new GridBagConstraints();
95
            cons.gridy = 0;
96
            cons.gridx = 1;
97
            cons.weightx = 1;
98
            cons.fill = GridBagConstraints.HORIZONTAL;
99
            cons.insets = insets;
100

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

    
103
            cons = new GridBagConstraints();
104
            cons.gridy = 1;
105
            cons.gridx = 0;
106
            cons.weightx = 0;
107
            cons.anchor = GridBagConstraints.WEST;
108
            cons.insets = insets;
109

    
110
            propertiesPanel.add(getFlatVerticalExaggerationText(), cons);
111

    
112
            cons = new GridBagConstraints();
113
            cons.gridy = 1;
114
            cons.gridx = 1;
115
            cons.weightx = 1;
116
            cons.fill = GridBagConstraints.HORIZONTAL;
117
            cons.insets = insets;
118

    
119
            propertiesPanel.add(getFlatVerticalExaggerationField(), cons);
120

    
121
            cons = new GridBagConstraints();
122
            cons.gridy = 2;
123
            cons.gridx = 0;
124
            cons.weightx = 0;
125
            cons.anchor = GridBagConstraints.WEST;
126
            cons.insets = insets;
127

    
128
            propertiesPanel.add(getAutoLayerSynchronizeText(), cons);
129

    
130
            cons = new GridBagConstraints();
131
            cons.gridy = 2;
132
            cons.gridx = 1;
133
            cons.weightx = 1;
134
            cons.insets = insets;
135

    
136
            propertiesPanel.add(getAutoLayerSynchronizeCheckBox(), cons);
137

    
138
            cons = new GridBagConstraints();
139
            cons.gridy = 3;
140
            cons.gridx = 0;
141
            cons.weightx = 0;
142
            cons.anchor = GridBagConstraints.WEST;
143
            cons.insets = insets;
144

    
145
            propertiesPanel.add(getAutoViewPortSynchronizeText(), cons);
146

    
147
            cons = new GridBagConstraints();
148
            cons.gridy = 3;
149
            cons.gridx = 1;
150
            cons.weightx = 1;
151
            cons.insets = insets;
152

    
153
            propertiesPanel.add(getAutoViewPortSynchronizeCheckBox(), cons);
154

    
155
            cons = new GridBagConstraints();
156
            cons.gridy = 4;
157
            cons.gridx = 0;
158
            cons.weightx = 0;
159
            cons.anchor = GridBagConstraints.WEST;
160
            cons.insets = insets;
161

    
162
            propertiesPanel.add(getShowBlueMarbleLayerText(), cons);
163

    
164
            cons = new GridBagConstraints();
165
            cons.gridy = 4;
166
            cons.gridx = 1;
167
            cons.weightx = 1;
168
            cons.insets = insets;
169

    
170
            propertiesPanel.add(getShowBlueMarbleLayerCheckBox(), cons);
171

    
172
            cons = new GridBagConstraints();
173
            cons.gridy = 5;
174
            cons.gridx = 0;
175
            cons.weightx = 0;
176
            cons.anchor = GridBagConstraints.WEST;
177
            cons.insets = insets;
178

    
179
            propertiesPanel.add(getShowNasaLandsatLayerText(), cons);
180

    
181
            cons = new GridBagConstraints();
182
            cons.gridy = 5;
183
            cons.gridx = 1;
184
            cons.weightx = 1;
185
            cons.insets = insets;
186

    
187
            propertiesPanel.add(getShowNasaLandsatLayerCheckBox(), cons);
188

    
189
            cons = new GridBagConstraints();
190
            cons.gridy = 6;
191
            cons.gridx = 0;
192
            cons.weightx = 0;
193
            cons.anchor = GridBagConstraints.WEST;
194
            cons.insets = insets;
195

    
196
            propertiesPanel.add(getShowDefaultElevationText(), cons);
197

    
198
            cons = new GridBagConstraints();
199
            cons.gridx = 6;
200
            cons.gridx = 1;
201
            cons.weightx = 1;
202
            cons.insets = insets;
203

    
204
            propertiesPanel.add(getShowDefaultElevationCheckBox(), cons);
205
        }
206
        return propertiesPanel;
207
    }
208

    
209
    protected JLabel getFlatVerticalExaggerationText() {
210
        if (flatVerticalExaggerationText == null) {
211
            I18nManager i18nManager = ToolsLocator.getI18nManager();
212
            flatVerticalExaggerationText = new JLabel(
213
                i18nManager.getTranslation("flat_vertical_exaggeration"));
214
        }
215
        return flatVerticalExaggerationText;
216
    }
217

    
218
    protected JTextField getFlatVerticalExaggerationField() {
219
        if (flatVerticalExaggeration == null) {
220
            flatVerticalExaggeration = new JTextField();
221
        }
222
        return flatVerticalExaggeration;
223
    }
224

    
225
    private JLabel getSphereVerticalExaggerationText() {
226
        if (sphereVerticalExaggerationText == null) {
227
            I18nManager i18nManager = ToolsLocator.getI18nManager();
228
            sphereVerticalExaggerationText = new JLabel(
229
                i18nManager.getTranslation("spherical_vertical_exaggeration"));
230
        }
231
        return sphereVerticalExaggerationText;
232
    }
233

    
234
    protected JTextField getSphereVerticalExaggerationField() {
235
        if (sphereVerticalExaggeration == null) {
236
            sphereVerticalExaggeration = new JTextField();
237
        }
238
        return sphereVerticalExaggeration;
239
    }
240

    
241
    private JLabel getAutoViewPortSynchronizeText() {
242
        if (autoSynchronizeViewPortsText == null) {
243
            I18nManager i18nManager = ToolsLocator.getI18nManager();
244
            autoSynchronizeViewPortsText = new JLabel(
245
                i18nManager.getTranslation("auto_synchronize_view_ports"));
246
        }
247
        return autoSynchronizeViewPortsText;
248
    }
249

    
250
    protected JCheckBox getAutoViewPortSynchronizeCheckBox() {
251
        if (autoSynchronizeViewPorts == null) {
252
            autoSynchronizeViewPorts = new JCheckBox();
253
        }
254
        return autoSynchronizeViewPorts;
255
    }
256

    
257
    private JLabel getAutoLayerSynchronizeText() {
258
        if (autoSynchronizeLayersText == null) {
259
            I18nManager i18nManager = ToolsLocator.getI18nManager();
260
            autoSynchronizeLayersText = new JLabel(
261
                i18nManager.getTranslation("auto_synchronize_layers"));
262
        }
263
        return autoSynchronizeLayersText;
264
    }
265

    
266
    protected JCheckBox getAutoLayerSynchronizeCheckBox() {
267
        if (autoSynchronizeLayers == null) {
268
            autoSynchronizeLayers = new JCheckBox();
269
        }
270
        return autoSynchronizeLayers;
271
    }
272

    
273
    private JLabel getShowBlueMarbleLayerText() {
274
        if (showBlueMarbleLayerText == null) {
275
            I18nManager i18nManager = ToolsLocator.getI18nManager();
276
            showBlueMarbleLayerText = new JLabel(
277
                i18nManager.getTranslation("show_blue_marble_layer"));
278
        }
279
        return showBlueMarbleLayerText;
280
    }
281

    
282
    protected JCheckBox getShowBlueMarbleLayerCheckBox() {
283
        if (showBlueMarbleLayer == null) {
284
            showBlueMarbleLayer = new JCheckBox();
285
        }
286
        return showBlueMarbleLayer;
287
    }
288

    
289
    private JLabel getShowNasaLandsatLayerText() {
290
        if (showNasaLandsatLayerText == null) {
291
            I18nManager i18nManager = ToolsLocator.getI18nManager();
292
            showNasaLandsatLayerText = new JLabel(
293
                i18nManager.getTranslation("show_nasa_landsat_layer"));
294
        }
295
        return showNasaLandsatLayerText;
296
    }
297

    
298
    protected JCheckBox getShowNasaLandsatLayerCheckBox() {
299
        if (showNasaLandsatLayer == null) {
300
            showNasaLandsatLayer = new JCheckBox();
301
        }
302
        return showNasaLandsatLayer;
303
    }
304

    
305
    private JLabel getShowDefaultElevationText() {
306
        if (showDefaultElevationText == null) {
307
            I18nManager i18nManager = ToolsLocator.getI18nManager();
308
            showDefaultElevationText = new JLabel(
309
                i18nManager.getTranslation("show_default_elevation"));
310
        }
311
        return showDefaultElevationText;
312
    }
313

    
314
    protected JCheckBox getShowDefaultElevationCheckBox() {
315
        if (showDefaultElevation == null) {
316
            showDefaultElevation = new JCheckBox();
317
        }
318
        return showDefaultElevation;
319
    }
320
}