Statistics
| Revision:

gvsig-3d / 2.1 / branches / extrusion / org.gvsig.view3d.app / org.gvsig.view3d.app.common / src / main / java / org / gvsig / view3d / app / properties / ViewProperties3DPage.java @ 657

History | View | Annotate | Download (3.39 KB)

1
package org.gvsig.view3d.app.properties;
2

    
3
import java.awt.BorderLayout;
4

    
5
import javax.swing.JComponent;
6
import javax.swing.JPanel;
7

    
8
import org.gvsig.app.project.documents.view.ViewDocument;
9
import org.gvsig.propertypage.PropertiesPage;
10
import org.gvsig.tools.ToolsLocator;
11
import org.gvsig.tools.i18n.I18nManager;
12
import org.gvsig.view3d.swing.api.View3DSwingLocator;
13
import org.gvsig.view3d.swing.api.View3DSwingManager;
14
import org.gvsig.view3d.swing.api.properties.MapControlProperties3D;
15
import org.gvsig.view3d.swing.api.properties.ViewProperties3DPanel;
16

    
17
public class ViewProperties3DPage implements PropertiesPage {
18

    
19
    private ViewDocument viewDocument;
20
    private JPanel panel;
21
    private ViewProperties3DPanel properties3DPanel;
22

    
23
    public ViewProperties3DPage(ViewDocument viewDocument) {
24
        this.viewDocument = viewDocument;
25

    
26
        initialize();
27
    }
28

    
29
    private void initialize() {
30

    
31
        View3DSwingManager swingManager = View3DSwingLocator.getManager();
32
        MapControlProperties3D mapControl3DProperties =
33
            swingManager.getMapControl3DProperties(viewDocument);
34

    
35
        this.properties3DPanel =
36
            swingManager.createViewProperties3DPanel(mapControl3DProperties);
37
        
38
        panel = new JPanel(new BorderLayout());
39
        panel.add(properties3DPanel.asJComponent(), BorderLayout.CENTER);
40
    }
41

    
42
    public JComponent asJComponent() {
43
        return this.panel;
44
    }
45

    
46
    public String getTitle() {
47
        I18nManager i18nManager = ToolsLocator.getI18nManager();
48
        return i18nManager.getTranslation("3D");
49
    }
50

    
51
    public int getPriority() {
52
        return 10;
53
    }
54

    
55
    public boolean whenAccept() {
56
        whenApply();
57
        return true;
58
    }
59

    
60
    public boolean whenApply() {
61
        
62
        double sphereVerticalExaggeration =
63
            this.properties3DPanel.getSphereVerticalExaggeration();
64
        double flatVerticalExaggeration =
65
            this.properties3DPanel.getFlatVerticalExaggeration();
66
        boolean autoLayerSynchronize =
67
            this.properties3DPanel.getAutoLayerSynchronize();
68
        boolean autoViewPortSynchronize =
69
            this.properties3DPanel.getAutoViewPortSynchronize();
70
        boolean showBlueMarble = this.properties3DPanel.getShowBlueMarble();
71
        boolean showNasaLandsat = this.properties3DPanel.getShowNasaLandsat();
72
        boolean showDefaultElevation =
73
            this.properties3DPanel.getShowDefaultElevation();
74
        
75
        View3DSwingManager swingManager = View3DSwingLocator.getManager();
76
        MapControlProperties3D mapControl3DProperties =
77
            swingManager.getMapControl3DProperties(viewDocument);
78
        
79
        mapControl3DProperties
80
            .setSphereVerticalExaggeration(sphereVerticalExaggeration);
81
        mapControl3DProperties
82
            .setFlatVerticalExaggeration(flatVerticalExaggeration);
83
        mapControl3DProperties.setAutoLayerSynchronize(autoLayerSynchronize);
84
        mapControl3DProperties.setAutoViewPortSynchronize(autoViewPortSynchronize);
85
        mapControl3DProperties.setBlueMarbleLayerVisibility(showBlueMarble);
86
        mapControl3DProperties.setNasaLandsatVisibility(showNasaLandsat);
87
        mapControl3DProperties
88
            .setDefaultElevationVisibility(showDefaultElevation);
89
        
90
        swingManager.setMapControlProperties3D(viewDocument, mapControl3DProperties);
91
        
92
        return true;
93
    }
94

    
95
    public boolean whenCancel() {
96
        return true;
97
    }
98

    
99
}