Revision 596

View differences:

2.1/tags/org.gvsig.view3d-1.0.8/org.gvsig.view3d.app/org.gvsig.view3d.app.lin.x86/buildNumber.properties
1
#Tue Feb 02 13:42:02 CET 2016
2
buildNumber=12
2.1/tags/org.gvsig.view3d-1.0.8/org.gvsig.view3d.app/org.gvsig.view3d.app.lin.x86/src/main/assembly/gvsig-plugin-package.xml
1
<!-- gvSIG. Desktop Geographic Information System. Copyright (C) 2007-2013 
2
	gvSIG Association. This program is free software; you can redistribute it 
3
	and/or modify it under the terms of the GNU General Public License as published 
4
	by the Free Software Foundation; either version 3 of the License, or (at 
5
	your option) any later version. This program is distributed in the hope that 
6
	it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
7
	of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 
8
	Public License for more details. You should have received a copy of the GNU 
9
	General Public License along with this program; if not, write to the Free 
10
	Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 
11
	USA. For any additional information, do not hesitate to contact us at info 
12
	AT gvsig.com, or visit our website www.gvsig.com. -->
13
<assembly>
14
	<id>gvsig-plugin-package</id>
15
	<formats>
16
		<format>zip</format>
17
	</formats>
18
	<baseDirectory>${project.parent.artifactId}</baseDirectory>
19
	<includeBaseDirectory>true</includeBaseDirectory>
20
	<files>
21
		<file>
22
			<source>target/${project.artifactId}-${project.version}.jar</source>
23
			<outputDirectory>lib</outputDirectory>
24
		</file>
25
		<file>
26
			<source>target/package.info</source>
27
		</file>
28
	</files>
29

  
30
	<fileSets>
31
		<fileSet>
32
			<directory>src/main/resources-plugin</directory>
33
			<outputDirectory>.</outputDirectory>
34
		</fileSet>
35
		<fileSet>
36
			<directory>target/org.gvsig.view3d.app.common</directory>
37
			<outputDirectory>.</outputDirectory>
38
			<excludes>
39
				<exclude>package.info</exclude>
40
			</excludes>
41
		</fileSet>
42
	</fileSets>
43

  
44

  
45
	<dependencySets>
46
		<dependencySet>
47
			<useProjectArtifact>false</useProjectArtifact>
48
			<useTransitiveDependencies>false</useTransitiveDependencies>
49
			<outputDirectory>lib</outputDirectory>
50
			<includes>
51
				<include>org.gvsig:org.gvsig.view3d.app.common</include>
52
				<include>org.jogamp.jogl:jogl-all</include>
53
				<include>org.jogamp.gluegen:gluegen-rt</include>
54
			</includes>
55
		</dependencySet>
56
	</dependencySets>
57

  
58
</assembly>
2.1/tags/org.gvsig.view3d-1.0.8/org.gvsig.view3d.app/org.gvsig.view3d.app.lin.x86/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2
  <modelVersion>4.0.0</modelVersion>
3
  <parent>
4
    <groupId>org.gvsig</groupId>
5
    <artifactId>org.gvsig.view3d.app</artifactId>
6
    <version>1.0.8</version>
7
  </parent>
8
  <artifactId>org.gvsig.view3d.app.lin.x86</artifactId>
9
  <name>org.gvsig.view3d.app.lin.x86</name>
10
  
11
   <properties>
12
    <gvsig.package.info.operatingSystem>lin</gvsig.package.info.operatingSystem>
13
    <gvsig.package.info.architecture>x86</gvsig.package.info.architecture>
14
   </properties>
15
  
16
  <dependencyManagement>
17
    <dependencies>
18
        <dependency>
19
            <groupId>org.jogamp.jogl</groupId>
20
            <artifactId>jogl-all</artifactId>
21
            <version>2.2.1</version>
22
            <classifier>natives-linux-i586</classifier>
23
            <scope>runtime</scope>
24
        </dependency>
25
        <dependency>
26
            <groupId>org.jogamp.gluegen</groupId>
27
            <artifactId>gluegen-rt</artifactId>
28
            <version>2.2.1</version>
29
            <classifier>natives-linux-i586</classifier>
30
            <scope>runtime</scope>
31
        </dependency>
32
    </dependencies>
33
  </dependencyManagement>
34
  
35
  <dependencies>
36
    <dependency>
37
        <groupId>org.jogamp.jogl</groupId>
38
        <artifactId>jogl-all</artifactId>
39
        <classifier>natives-linux-i586</classifier>
40
    </dependency>
41
    <dependency>
42
        <groupId>org.jogamp.gluegen</groupId>
43
        <artifactId>gluegen-rt</artifactId>
44
        <classifier>natives-linux-i586</classifier>
45
    </dependency>
46
    <dependency>
47
        <groupId>org.gvsig</groupId>
48
        <artifactId>org.gvsig.view3d.app.common</artifactId>
49
    </dependency>
50
  </dependencies>
51
  
52
  <build>
53
        <plugins>
54
            <plugin>
55
                <groupId>org.apache.maven.plugins</groupId>
56
                <artifactId>maven-dependency-plugin</artifactId>
57
                <executions>
58
                    <execution>
59
                        <id>unpack</id>
60
                        <phase>process-sources</phase>
61
                        <goals>
62
                            <goal>unpack</goal>
63
                        </goals>
64
                        <configuration>
65
                            <artifactItems>
66
                                <artifactItem>
67
                                    <groupId>org.gvsig</groupId>
68
                                    <artifactId>org.gvsig.view3d.app.common</artifactId>
69
                                    <type>zip</type>
70
                                    <overWrite>true</overWrite>
71
                                    <outputDirectory>target</outputDirectory>
72
                                </artifactItem>
73
                            </artifactItems>
74
                        </configuration>
75
                    </execution>
76
                </executions>
77
            </plugin>
78
        </plugins>
79
    </build>
80
  
81
  <!-- 
82
  The profiles only configure the automatic deploy of gvSIG plugin in the gvSIG
83
  configured in HOME/.gvsig-devel.properties
84
  -->
85
  <profiles>
86
  
87
    <profile>
88
      <id>gvsig-plugin-install-view3d-linux-x86</id>
89
      <activation>
90
         <os>
91
             <family>unix</family>
92
             <name>linux</name>
93
             <arch>x86</arch>
94
         </os>
95
      </activation>
96
        <properties>
97
          <gvsig.install.plugin>true</gvsig.install.plugin>
98
        </properties>
99
    </profile>
100

  
101
    <profile>
102
      <id>gvsig-plugin-install-view3d-linux-i586</id>
103
      <activation>
104
         <os>
105
             <family>unix</family>
106
             <name>linux</name>
107
             <arch>i586</arch>
108
         </os>
109
      </activation>
110
      <properties>
111
         <gvsig.install.plugin>true</gvsig.install.plugin>
112
      </properties>
113
    </profile>
114

  
115
  </profiles>
116
</project>
2.1/tags/org.gvsig.view3d-1.0.8/org.gvsig.view3d.app/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2
	<modelVersion>4.0.0</modelVersion>
3
	<parent>
4
		<groupId>org.gvsig</groupId>
5
		<artifactId>org.gvsig.view3d</artifactId>
6
		<version>1.0.8</version>
7
	</parent>
8
	<artifactId>org.gvsig.view3d.app</artifactId>
9
	<packaging>pom</packaging>
10
	<name>org.gvsig.view3d.app</name>
11

  
12
	<properties>
13
    <gvsig.package.info.code>org.gvsig.view3d.app</gvsig.package.info.code>
14
	  <gvsig.install.plugin>false</gvsig.install.plugin>
15
    <gvsig.package.info.state>testing</gvsig.package.info.state>
16
    <gvsig.package.info.official>true</gvsig.package.info.official>
17
    <gvsig.package.info.name>3D View</gvsig.package.info.name>
18
    <gvsig.package.info.categories>3D</gvsig.package.info.categories>
19
    <gvsig.package.info.description>3D View: allows user to create 3D views from 2D views</gvsig.package.info.description>
20
    <gvsig.package.info.dependencies>required: org.gvsig.app.mainplugin -ge 2.2.0</gvsig.package.info.dependencies>
21
    <gvsig.package.info.javaVM>j1_6</gvsig.package.info.javaVM>
22
    <svn.tags.folder>https://devel.gvsig.org/svn/gvsig-3d/2.1/tags/</svn.tags.folder>
23
    <gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-3d/pool/</gvsig.package.info.poolURL>
24
	</properties>
25

  
26
	<modules>
27
		<module>org.gvsig.view3d.app.common</module>
28
		<module>org.gvsig.view3d.app.lin.x86</module>
29
		<module>org.gvsig.view3d.app.lin.x86_64</module>
30
		<module>org.gvsig.view3d.app.win.x86</module>
31
		<module>org.gvsig.view3d.app.win.x86_64</module>
32
	</modules>
33
</project>
2.1/tags/org.gvsig.view3d-1.0.8/org.gvsig.view3d.app/org.gvsig.view3d.app.common/buildNumber.properties
1
#Tue Feb 02 13:42:01 CET 2016
2
buildNumber=12
2.1/tags/org.gvsig.view3d-1.0.8/org.gvsig.view3d.app/org.gvsig.view3d.app.common/src/main/assembly/gvsig-plugin-package.xml
1
<!-- gvSIG. Desktop Geographic Information System. Copyright (C) 2007-2013 
2
	gvSIG Association. This program is free software; you can redistribute it 
3
	and/or modify it under the terms of the GNU General Public License as published 
4
	by the Free Software Foundation; either version 3 of the License, or (at 
5
	your option) any later version. This program is distributed in the hope that 
6
	it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
7
	of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 
8
	Public License for more details. You should have received a copy of the GNU 
9
	General Public License along with this program; if not, write to the Free 
10
	Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 
11
	USA. For any additional information, do not hesitate to contact us at info 
12
	AT gvsig.com, or visit our website www.gvsig.com. -->
13
<assembly>
14
	<id>gvsig-plugin-package</id>
15
	<formats>
16
		<format>zip</format>
17
	</formats>
18
	<baseDirectory>${project.artifactId}</baseDirectory>
19
	<includeBaseDirectory>true</includeBaseDirectory>
20
	<files>
21
		<file>
22
			<source>target/${project.artifactId}-${project.version}.jar</source>
23
			<outputDirectory>lib</outputDirectory>
24
		</file>
25
		<file>
26
			<source>target/package.info</source>
27
		</file>
28
	</files>
29

  
30
	<fileSets>
31
		<fileSet>
32
			<directory>src/main/resources-plugin</directory>
33
			<outputDirectory>.</outputDirectory>
34
		</fileSet>
35
	</fileSets>
36

  
37

  
38
	<dependencySets>
39
		<dependencySet>
40
			<useProjectArtifact>false</useProjectArtifact>
41
			<useTransitiveDependencies>false</useTransitiveDependencies>
42
			<outputDirectory>lib</outputDirectory>
43
			<includes>
44
			    <include>org.gvsig:org.gvsig.view3d.lib.api</include>
45
                <include>org.gvsig:org.gvsig.view3d.lib.impl</include>
46
				<include>org.gvsig:org.gvsig.view3d.swing.api</include>
47
				<include>org.gvsig:org.gvsig.view3d.swing.impl</include>
48
				<include>gov.nasa:worldwind</include>
49
				<include>org.jogamp.gluegen:gluegen-rt</include>
50
				<include>org.jogamp.jogl:jogl-all</include>
51
			</includes>
52
		</dependencySet>
53
	</dependencySets>
54

  
55
</assembly>
56

  
2.1/tags/org.gvsig.view3d-1.0.8/org.gvsig.view3d.app/org.gvsig.view3d.app.common/src/main/java/org/gvsig/view3d/app/properties/General3DPreferencePage.java
1
package org.gvsig.view3d.app.properties;
2

  
3
import java.awt.BorderLayout;
4
import java.io.File;
5

  
6
import javax.swing.ImageIcon;
7
import javax.swing.JPanel;
8

  
9
import org.gvsig.andami.IconThemeHelper;
10
import org.gvsig.andami.PluginServices;
11
import org.gvsig.andami.PluginsLocator;
12
import org.gvsig.andami.PluginsManager;
13
import org.gvsig.andami.preferences.AbstractPreferencePage;
14
import org.gvsig.andami.preferences.StoreException;
15
import org.gvsig.tools.ToolsLocator;
16
import org.gvsig.tools.dynobject.DynObject;
17
import org.gvsig.tools.i18n.I18nManager;
18
import org.gvsig.view3d.swing.api.View3DSwingLocator;
19
import org.gvsig.view3d.swing.api.View3DSwingManager;
20
import org.gvsig.view3d.swing.api.properties.GeneralProperties3D;
21
import org.gvsig.view3d.swing.api.properties.GeneralProperties3DPanel;
22

  
23
public class General3DPreferencePage extends AbstractPreferencePage {
24

  
25
    private static final long serialVersionUID = -3384416698766077019L;
26

  
27
    public static final String ID = General3DPreferencePage.class.getName();
28

  
29
    private GeneralProperties3DPanel propertiesPanel;
30
    private DynObject pluginProperties;
31
    private PluginServices plugin;
32

  
33
    public General3DPreferencePage() {
34
        initComponents();
35
    }
36

  
37
    private void initComponents() {
38
        PluginsManager pluginManager = PluginsLocator.getManager();
39
        this.plugin = pluginManager.getPlugin(this);
40
        this.pluginProperties = this.plugin.getPluginProperties();
41

  
42
        initializeValues();
43

  
44
        View3DSwingManager swingManager = View3DSwingLocator.getManager();
45
        GeneralProperties3D generalProperties3D =
46
            swingManager.getGeneral3DProperties();
47

  
48
        propertiesPanel =
49
            swingManager.createGeneralProperties3DPanel(generalProperties3D);
50

  
51
        this.setLayout(new BorderLayout());
52
        this.add(propertiesPanel.asJComponent(), BorderLayout.NORTH);
53
    }
54

  
55
    public String getID() {
56
        return ID;
57
    }
58

  
59
    public String getTitle() {
60
        I18nManager i18nManager = ToolsLocator.getI18nManager();
61
        return i18nManager.getTranslation("3D");
62
    }
63

  
64
    public JPanel getPanel() {
65
        return this;
66
    }
67

  
68
    public void initializeValues() {
69
        
70
        View3DSwingManager swingManager = View3DSwingLocator.getManager();
71
        GeneralProperties3D generalProperties3D =
72
            swingManager.getGeneral3DProperties();
73

  
74
        int width =
75
            (Integer) this.pluginProperties.getDynValue("defultViewWidth");
76
        int height =
77
            (Integer) this.pluginProperties.getDynValue("defultViewHeight");
78
        boolean atmosphereVisibility =
79
            (Boolean) this.pluginProperties.getDynValue("atmosphereVisibility");
80
        boolean northIndicatorVisibility =
81
            (Boolean) this.pluginProperties
82
                .getDynValue("northIndicatorVisibility");
83
        boolean minimapVisibility =
84
            (Boolean) this.pluginProperties.getDynValue("minimapVisibility");
85
        boolean starsBackgroundVisibility =
86
            (Boolean) this.pluginProperties
87
                .getDynValue("starsBackgroundVisibility");
88
        boolean scaleVisibility =
89
            (Boolean) this.pluginProperties.getDynValue("scaleVisibility");
90
        boolean viewportAnimation =
91
            (Boolean) this.pluginProperties.getDynValue("viewportAnimation");
92
        String cachePath =
93
            (String) this.pluginProperties.getDynValue("cachePath");
94

  
95
        generalProperties3D.setDefaultViewWidth(width);
96
        generalProperties3D.setDefaultViewHeight(height);
97
        generalProperties3D.setAtmosphereVisibility(atmosphereVisibility);
98
        generalProperties3D.setMinimapVisibility(minimapVisibility);
99
        generalProperties3D
100
            .setNorthIndicatorVisibility(northIndicatorVisibility);
101
        generalProperties3D
102
            .setStarsBackgroundVisibility(starsBackgroundVisibility);
103
        generalProperties3D.setScaleVisibility(scaleVisibility);
104
        generalProperties3D.setViewPortAnimation(viewportAnimation);
105
        
106
        if(cachePath != null){
107
            generalProperties3D.setCachePath(new File(cachePath));
108
        }
109

  
110
        swingManager.setGeneral3DProperties(generalProperties3D);
111
        
112
    }
113

  
114
    public void initializeDefaults() {
115
        
116
    }
117

  
118
    @Override
119
    public boolean isResizeable() {
120
        return true;
121
    }
122

  
123
    public ImageIcon getIcon() {
124
        return IconThemeHelper.getImageIcon("general-properties-view-3d");
125
    }
126

  
127
    public boolean isValueChanged() {
128
        
129
        int width = propertiesPanel.getDefaultWidth();
130
        int heigth = propertiesPanel.getDefaultHeight();
131
        boolean atmosphereVisibility = propertiesPanel.getAtmosphereVisibility();
132
        boolean minimapVisibility = propertiesPanel.getMinimapVisibility();
133
        boolean northIndicatorVisibility = propertiesPanel.getNorthIndicatorVisibility();
134
        boolean scaleVisiblity = propertiesPanel.getScaleVisiblity();
135
        boolean starsBackgroundVisiblity = propertiesPanel.getStarsBackgroundVisiblity();
136
        boolean viewPortAnimation = propertiesPanel.getViewPortAnimation();
137
        String cachePath = propertiesPanel.getCachePath();
138
        
139
        View3DSwingManager swingManager = View3DSwingLocator.getManager();
140
        GeneralProperties3D general3dProperties = swingManager.getGeneral3DProperties();
141

  
142
        if (width != general3dProperties.getDefaultViewWidth()
143
            || heigth != general3dProperties.getDefaultViewHeight()
144
            || atmosphereVisibility != general3dProperties
145
                .getAtmosphereVisibility()
146
            || minimapVisibility != general3dProperties.getMinimapVisibility()
147
            || northIndicatorVisibility != general3dProperties
148
                .getNorthIndicatorVisibility()
149
            || scaleVisiblity != general3dProperties.getScaleVisibility()
150
            || starsBackgroundVisiblity != general3dProperties
151
                .getStarsBackgroundVisibility()
152
            || viewPortAnimation != general3dProperties.getViewPortAnimation()
153
            || !cachePath.equals(general3dProperties.getCachePath()
154
                .getAbsolutePath())) {
155
            
156
            return true;
157
        }
158
        return false;
159
    }
160

  
161
    @Override
162
    public void storeValues() throws StoreException {
163

  
164
        this.pluginProperties.setDynValue("defultViewWidth",
165
            propertiesPanel.getDefaultWidth());
166
        this.pluginProperties.setDynValue("defultViewHeight",
167
            propertiesPanel.getDefaultHeight());
168
        this.pluginProperties.setDynValue("atmosphereVisibility",
169
            propertiesPanel.getAtmosphereVisibility());
170
        this.pluginProperties.setDynValue("minimapVisibility",
171
            propertiesPanel.getMinimapVisibility());
172
        this.pluginProperties.setDynValue("northIndicatorVisibility",
173
            propertiesPanel.getNorthIndicatorVisibility());
174
        this.pluginProperties.setDynValue("starsBackgroundVisibility",
175
            propertiesPanel.getStarsBackgroundVisiblity());
176
        this.pluginProperties.setDynValue("scaleVisibility",
177
            propertiesPanel.getScaleVisiblity());
178
        this.pluginProperties.setDynValue("viewportAnimation",
179
            propertiesPanel.getViewPortAnimation());
180
        this.pluginProperties.setDynValue("cachePath",
181
            propertiesPanel.getCachePath());
182

  
183
        this.plugin.savePluginProperties();
184
    }
185

  
186
    @Override
187
    public void setChangesApplied() {
188

  
189
        View3DSwingManager swingManager = View3DSwingLocator.getManager();
190
        GeneralProperties3D generalProperties3D =
191
            swingManager.getGeneral3DProperties();
192

  
193
        generalProperties3D.setDefaultViewWidth(propertiesPanel
194
            .getDefaultWidth());
195
        generalProperties3D.setDefaultViewHeight(propertiesPanel
196
            .getDefaultHeight());
197
        generalProperties3D.setAtmosphereVisibility(propertiesPanel
198
            .getAtmosphereVisibility());
199
        generalProperties3D.setMinimapVisibility(propertiesPanel
200
            .getMinimapVisibility());
201
        generalProperties3D.setNorthIndicatorVisibility(propertiesPanel
202
            .getNorthIndicatorVisibility());
203
        generalProperties3D.setScaleVisibility(propertiesPanel
204
            .getScaleVisiblity());
205
        generalProperties3D.setStarsBackgroundVisibility(propertiesPanel
206
            .getStarsBackgroundVisiblity());
207
        generalProperties3D.setViewPortAnimation(propertiesPanel
208
            .getViewPortAnimation());
209
        generalProperties3D.setCachePath(new File(propertiesPanel
210
            .getCachePath()));
211

  
212
        swingManager.setGeneral3DProperties(generalProperties3D);
213
    }
214

  
215
}
2.1/tags/org.gvsig.view3d-1.0.8/org.gvsig.view3d.app/org.gvsig.view3d.app.common/src/main/java/org/gvsig/view3d/app/properties/RasterLayerProperties3DPanel.java
1
package org.gvsig.view3d.app.properties;
2

  
3
import java.awt.BorderLayout;
4
import java.awt.Dimension;
5

  
6
import org.gvsig.fmap.mapcontext.layers.FLayer;
7
import org.gvsig.gui.beans.panelGroup.panels.AbstractPanel;
8
import org.gvsig.tools.ToolsLocator;
9
import org.gvsig.tools.i18n.I18nManager;
10
import org.gvsig.view3d.lib.api.View3DLocator;
11
import org.gvsig.view3d.lib.api.View3DManager;
12
import org.gvsig.view3d.lib.api.properties.LayerProperties3D;
13
import org.gvsig.view3d.lib.api.properties.VectorialLayerProperties3D;
14
import org.gvsig.view3d.swing.api.View3DSwingLocator;
15
import org.gvsig.view3d.swing.api.View3DSwingManager;
16
import org.gvsig.view3d.swing.api.properties.LayerProperties3DPanel;
17

  
18
public class RasterLayerProperties3DPanel extends AbstractPanel {
19

  
20
    private static final long serialVersionUID = 5429099827670959087L;
21

  
22
    private LayerProperties3DPanel propertiesPanel;
23
    private LayerProperties3D tmpProperties;
24

  
25
    public RasterLayerProperties3DPanel() {
26
        super();
27
        initialize();
28
    }
29

  
30
    public void accept() {
31
        apply();
32

  
33
        View3DManager manager = View3DLocator.getManager();
34
        manager.setLayerProperties(propertiesPanel.getLayer(), tmpProperties);
35
    }
36

  
37
    public void apply() {
38
        I18nManager i18nManager = ToolsLocator.getI18nManager();
39

  
40
        View3DManager manager = View3DLocator.getManager();
41
        LayerProperties3D layerProperties =
42
            manager.getLayerProperties(propertiesPanel.getLayer());
43

  
44
        layerProperties.setMinLevel(propertiesPanel.getMinLevel());
45
        layerProperties.setMaxLevel(propertiesPanel.getMaxLevel());
46
        layerProperties.setLevelZeroResolutionMultiplier(propertiesPanel
47
            .getResolutionMultiplier());
48
        layerProperties.setTileWidth(propertiesPanel.getTileWidth());
49
        layerProperties.setTileHeight(propertiesPanel.getTileHeight());
50

  
51
        if (propertiesPanel.getLoadMode().equalsIgnoreCase(
52
            i18nManager.getTranslation("elevation"))) {
53

  
54
            layerProperties.setElevation(true);
55

  
56
            if (layerProperties instanceof VectorialLayerProperties3D) {
57
                VectorialLayerProperties3D vectorialProperties =
58
                    (VectorialLayerProperties3D) layerProperties;
59
                vectorialProperties.setElevationField(propertiesPanel
60
                    .getElevationField());
61
            }
62

  
63
            layerProperties.setElevationUnits(propertiesPanel
64
                .getElevationUnits());
65
            layerProperties.setNoDataValue(propertiesPanel.getNoDataValue());
66

  
67
        } else {
68
            if (layerProperties instanceof VectorialLayerProperties3D) {
69
                VectorialLayerProperties3D vectorialProperties =
70
                    (VectorialLayerProperties3D) layerProperties;
71
                vectorialProperties.setRasterized(true);
72
            }
73
            layerProperties.setElevation(false);
74
        }
75
        tmpProperties = layerProperties;
76
    }
77

  
78
    public void cancel() {
79
        this.propertiesPanel = null;
80
    }
81

  
82
    @Override
83
    protected void initialize() {
84
        I18nManager i18nManager = ToolsLocator.getI18nManager();
85
        setLabel(i18nManager.getTranslation("3D"));
86

  
87
        this.setLayout(new BorderLayout());
88
        this.setPreferredSize(new Dimension(100, 80));
89
    }
90

  
91
    public void selected() {
92
    }
93

  
94
    public void setReference(Object ref) {
95
        super.setReference(ref);
96

  
97
        if (ref instanceof FLayer) {
98
            FLayer layer = (FLayer) ref;
99
            View3DSwingManager swingManager = View3DSwingLocator.getManager();
100
            this.propertiesPanel =
101
                swingManager.createLayerProperties3DPanel(layer);
102
            this.add(propertiesPanel.asJComponent(), BorderLayout.CENTER);
103
        }
104
    }
105

  
106
}
2.1/tags/org.gvsig.view3d-1.0.8/org.gvsig.view3d.app/org.gvsig.view3d.app.common/src/main/java/org/gvsig/view3d/app/properties/ViewProperties3DPageFactory.java
1
package org.gvsig.view3d.app.properties;
2

  
3
import org.gvsig.app.project.documents.view.ViewDocument;
4
import org.gvsig.propertypage.PropertiesPage;
5
import org.gvsig.propertypage.PropertiesPageFactory;
6

  
7

  
8
public class ViewProperties3DPageFactory implements PropertiesPageFactory {
9

  
10
    public String getGroupID() {
11
        return ViewDocument.VIEW_PROPERTIES_PAGE_GROUP;
12
    }
13

  
14
    public boolean isVisible(Object obj) {
15
        return true;
16
    }
17

  
18
    public PropertiesPage create(Object obj) {
19
        return new ViewProperties3DPage((ViewDocument) obj);
20
    }
21

  
22
}
2.1/tags/org.gvsig.view3d-1.0.8/org.gvsig.view3d.app/org.gvsig.view3d.app.common/src/main/java/org/gvsig/view3d/app/properties/LayerProperties3DThemeManagerPage.java
1
package org.gvsig.view3d.app.properties;
2

  
3
import java.awt.BorderLayout;
4

  
5
import org.gvsig.app.project.documents.view.legend.gui.AbstractThemeManagerPage;
6
import org.gvsig.fmap.mapcontext.layers.FLayer;
7
import org.gvsig.tools.ToolsLocator;
8
import org.gvsig.tools.i18n.I18nManager;
9
import org.gvsig.view3d.lib.api.View3DLocator;
10
import org.gvsig.view3d.lib.api.View3DManager;
11
import org.gvsig.view3d.lib.api.properties.LayerProperties3D;
12
import org.gvsig.view3d.lib.api.properties.VectorialLayerProperties3D;
13
import org.gvsig.view3d.swing.api.View3DSwingLocator;
14
import org.gvsig.view3d.swing.api.View3DSwingManager;
15
import org.gvsig.view3d.swing.api.properties.LayerProperties3DPanel;
16

  
17
public class LayerProperties3DThemeManagerPage extends AbstractThemeManagerPage {
18

  
19
    private static final long serialVersionUID = 6180306542845960820L;
20

  
21
    private LayerProperties3DPanel propertiesPanel;
22

  
23
    public LayerProperties3DThemeManagerPage() {
24
        super();
25
        initialize();
26
    }
27

  
28
    @Override
29
    public void acceptAction() {
30
        applyAction();
31
    }
32

  
33
    @Override
34
    public void applyAction() {
35

  
36
        I18nManager i18nManager = ToolsLocator.getI18nManager();
37

  
38
        View3DManager manager = View3DLocator.getManager();
39
        LayerProperties3D layerProperties =
40
            manager.getLayerProperties(propertiesPanel.getLayer());
41

  
42
        if (layerProperties instanceof VectorialLayerProperties3D) {
43

  
44
            layerProperties.setMinLevel(propertiesPanel.getMinLevel());
45
            layerProperties.setMaxLevel(propertiesPanel.getMaxLevel());
46
            layerProperties.setLevelZeroResolutionMultiplier(propertiesPanel
47
                .getResolutionMultiplier());
48
            layerProperties.setTileWidth(propertiesPanel.getTileWidth());
49
            layerProperties.setTileHeight(propertiesPanel.getTileHeight());
50

  
51
            if (propertiesPanel.getLoadMode().equalsIgnoreCase(
52
                i18nManager.getTranslation("elevation"))) {
53

  
54
                layerProperties.setElevation(true);
55

  
56
                if (layerProperties instanceof VectorialLayerProperties3D) {
57
                    VectorialLayerProperties3D vectorialProperties =
58
                        (VectorialLayerProperties3D) layerProperties;
59
                    vectorialProperties.setElevationField(propertiesPanel
60
                        .getElevationField());
61
                }
62
                layerProperties.setElevationUnits(propertiesPanel
63
                    .getElevationUnits());
64
                layerProperties
65
                    .setNoDataValue(propertiesPanel.getNoDataValue());
66

  
67
            } else {
68
                if (layerProperties instanceof VectorialLayerProperties3D) {
69
                    VectorialLayerProperties3D vectorialProperties =
70
                        (VectorialLayerProperties3D) layerProperties;
71
                    vectorialProperties.setRasterized(true);
72
                }
73
            }
74
        }
75

  
76
        manager.setLayerProperties(propertiesPanel.getLayer(), layerProperties);
77
    }
78

  
79
    @Override
80
    public void cancelAction() {
81
    }
82

  
83
    @Override
84
    public String getName() {
85
        I18nManager i18nManager = ToolsLocator.getI18nManager();
86
        return i18nManager.getTranslation("3D");
87
    }
88

  
89
    @Override
90
    public int getPriority() {
91
        return 10;
92
    }
93

  
94
    private void initialize() {
95
        this.setLayout(new BorderLayout());
96
    }
97

  
98
    @Override
99
    public void setModel(FLayer layer) {
100

  
101
        View3DSwingManager swingManager = View3DSwingLocator.getManager();
102
        this.propertiesPanel = swingManager.createLayerProperties3DPanel(layer);
103
        this.add(propertiesPanel.asJComponent(), BorderLayout.CENTER);
104

  
105
    }
106

  
107
}
2.1/tags/org.gvsig.view3d-1.0.8/org.gvsig.view3d.app/org.gvsig.view3d.app.common/src/main/java/org/gvsig/view3d/app/properties/ViewProperties3DPage.java
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
}
2.1/tags/org.gvsig.view3d-1.0.8/org.gvsig.view3d.app/org.gvsig.view3d.app.common/src/main/java/org/gvsig/view3d/app/mainplugin/FullScreenView3DExtension.java
1
package org.gvsig.view3d.app.mainplugin;
2

  
3
import javax.swing.JComponent;
4

  
5
import org.gvsig.andami.IconThemeHelper;
6
import org.gvsig.andami.plugins.Extension;
7
import org.gvsig.andami.ui.ToolsWindowManager.Window;
8
import org.gvsig.andami.ui.mdiManager.IWindow;
9
import org.gvsig.app.ApplicationLocator;
10
import org.gvsig.app.ApplicationManager;
11
import org.gvsig.app.project.documents.view.ViewDocument;
12
import org.gvsig.app.project.documents.view.gui.IView;
13
import org.gvsig.view3d.swing.api.View3DPanel;
14

  
15

  
16
public class FullScreenView3DExtension extends Extension {
17

  
18
    public void execute(String actionCommand) {
19
        
20
        if ("full-screen-view-3d".equals(actionCommand)) {
21
            View3DPanel view3dPanel = getActiveView3DPanel();
22
            if(view3dPanel != null){
23
                view3dPanel.fullScreen();
24
            }
25
        }
26
    }
27

  
28
    private void registerIcons() {
29
        IconThemeHelper.registerIcon("view3d", "full-screen-view-3d", this);
30
    }
31

  
32
    public void initialize() {
33
        registerIcons();
34

  
35
    }
36

  
37
    public boolean isEnabled() {
38
        
39
        View3DPanel view3DPanel = getActiveView3DPanel();
40
        
41
        if(view3DPanel != null){
42
            return true;
43
        }
44
        
45
        return false;
46
    }
47

  
48
    private View3DPanel getActiveView3DPanel() {
49
        ApplicationManager appManager = ApplicationLocator.getManager();
50
        IWindow activeWindow = appManager.getActiveWindow();
51
        
52
        if(activeWindow instanceof Window){
53
            Window aWindow = (Window) activeWindow;
54
            JComponent contents = aWindow.getContents();
55
            if( contents instanceof View3DPanel){
56
                return (View3DPanel) contents;
57
            }
58
        }
59
        return null;
60
    }
61

  
62
    public boolean isVisible() {
63
        IView view = getActiveView();
64
        if (view != null) {
65
            return true;
66
        }
67
        return false;
68
    }
69
    
70
    private IView getActiveView() {
71
        ApplicationManager application = ApplicationLocator.getManager();
72
        IView view = (IView) application.getActiveComponent(ViewDocument.class);
73
        return view;
74
    }
75

  
76
}
2.1/tags/org.gvsig.view3d-1.0.8/org.gvsig.view3d.app/org.gvsig.view3d.app.common/src/main/java/org/gvsig/view3d/app/mainplugin/SynchronizeView3DExtension.java
1
package org.gvsig.view3d.app.mainplugin;
2

  
3
import java.util.List;
4

  
5
import org.gvsig.andami.IconThemeHelper;
6
import org.gvsig.andami.plugins.Extension;
7
import org.gvsig.app.ApplicationLocator;
8
import org.gvsig.app.ApplicationManager;
9
import org.gvsig.app.project.documents.view.ViewDocument;
10
import org.gvsig.app.project.documents.view.gui.IView;
11
import org.gvsig.fmap.mapcontext.layers.ExtendedPropertiesSupport;
12
import org.gvsig.view3d.swing.api.MapControl3D;
13
import org.gvsig.view3d.swing.api.View3DSwingLocator;
14
import org.gvsig.view3d.swing.api.View3DSwingManager;
15
import org.gvsig.view3d.swing.api.View3DSwingManager.TYPE;
16

  
17
public class SynchronizeView3DExtension extends Extension {
18

  
19
    public void initialize() {
20
        registerIcons();
21
    }
22

  
23
    private void registerIcons() {
24
        IconThemeHelper.registerIcon("view3d", "synchronize-view-3d", this);
25
    }
26

  
27
    public void execute(String actionCommand) {
28

  
29
        if ("synchronize-view-3d".equals(actionCommand)) {
30
            IView view = getActiveView();
31

  
32
            View3DSwingManager manager = View3DSwingLocator.getManager();
33
            MapControl3D mapControl3DFlat =
34
                manager.getMapControl3D(
35
                    (ExtendedPropertiesSupport) view.getViewDocument(),
36
                    TYPE.FLAT);
37
            if (mapControl3DFlat != null) {
38
                mapControl3DFlat.synchronizeLayers();
39
            }
40

  
41
            MapControl3D mapControl3DSphere =
42
                manager.getMapControl3D(
43
                    (ExtendedPropertiesSupport) view.getViewDocument(),
44
                    TYPE.SPHERE);
45
            if (mapControl3DSphere != null) {
46
                mapControl3DSphere.synchronizeLayers();
47
            }
48
        }
49
    }
50

  
51
    public boolean isEnabled() {
52
        IView view = getActiveView();
53
        if (view != null) {
54
            View3DSwingManager manager = View3DSwingLocator.getManager();
55
            List<MapControl3D> mapControls3D =
56
                manager.getMapControl3D((ExtendedPropertiesSupport) view
57
                    .getViewDocument());
58
            if (mapControls3D.size() > 0) {
59
                return true;
60
            }
61
        }
62
        return false;
63
    }
64

  
65
    public boolean isVisible() {
66
        IView view = getActiveView();
67
        if (view != null) {
68
            return true;
69
        }
70
        return false;
71
    }
72

  
73
    private IView getActiveView() {
74
        ApplicationManager application = ApplicationLocator.getManager();
75
        IView view = (IView) application.getActiveComponent(ViewDocument.class);
76
        return view;
77
    }
78

  
79
}
2.1/tags/org.gvsig.view3d-1.0.8/org.gvsig.view3d.app/org.gvsig.view3d.app.common/src/main/java/org/gvsig/view3d/app/mainplugin/View3DExtension.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2015 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.app.mainplugin;
26

  
27
import org.gvsig.andami.IconThemeHelper;
28
import org.gvsig.andami.plugins.Extension;
29
import org.gvsig.app.ApplicationLocator;
30
import org.gvsig.app.ApplicationManager;
31
import org.gvsig.app.project.documents.view.ViewDocument;
32
import org.gvsig.app.project.documents.view.gui.IView;
33
import org.gvsig.app.project.documents.view.legend.gui.ThemeManagerWindow;
34
import org.gvsig.fmap.mapcontext.MapContext;
35
import org.gvsig.fmap.mapcontext.layers.ExtendedPropertiesSupport;
36
import org.gvsig.fmap.mapcontext.layers.FLayers;
37
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
38
import org.gvsig.fmap.mapcontrol.MapControlLocator;
39
import org.gvsig.propertypage.PropertiesPageManager;
40
import org.gvsig.tools.ToolsLocator;
41
import org.gvsig.tools.extensionpoint.ExtensionPoint;
42
import org.gvsig.tools.extensionpoint.ExtensionPointManager;
43
import org.gvsig.tools.i18n.I18nManager;
44
import org.gvsig.tools.observer.Notification;
45
import org.gvsig.tools.observer.Observable;
46
import org.gvsig.tools.observer.Observer;
47
import org.gvsig.view3d.app.properties.General3DPreferencePage;
48
import org.gvsig.view3d.app.properties.LayerProperties3DThemeManagerPage;
49
import org.gvsig.view3d.app.properties.RasterLayerProperties3DPanel;
50
import org.gvsig.view3d.app.properties.ViewProperties3DPageFactory;
51
import org.gvsig.view3d.swing.api.MapControl3D;
52
import org.gvsig.view3d.swing.api.View3DPanel;
53
import org.gvsig.view3d.swing.api.View3DSwingLocator;
54
import org.gvsig.view3d.swing.api.View3DSwingManager;
55
import org.gvsig.view3d.swing.api.View3DSwingManager.TYPE;
56

  
57
/**
58
 * @author <a href="mailto:lmarques@disid.com">Lluis Marques</a>
59
 *
60
 */
61
public class View3DExtension extends Extension implements Observer {
62

  
63
    public void initialize() {
64
        // Register general 3D properties
65
        I18nManager i18nManager = ToolsLocator.getI18nManager();
66
        ExtensionPointManager extensionPoints =ToolsLocator.getExtensionPointManager();
67
        ExtensionPoint ep = extensionPoints.add("AplicationPreferences", "");
68
        ep.append(i18nManager.getTranslation("3D"), "", new General3DPreferencePage());
69
        
70
        // Register vectorial layer 3D properties panel
71
        ThemeManagerWindow.addPage(LayerProperties3DThemeManagerPage.class);
72
        ThemeManagerWindow.setTabEnabledForLayer(
73
            LayerProperties3DThemeManagerPage.class, FLyrVect.class, true);
74
        
75
        // Regsiter raster layer 3D properties panel
76
        ExtensionPoint point = extensionPoints.get("RasterSEPropertiesDialog");
77
        if (point != null) {
78
            point.append("3D", "3D Raster properties panel",
79
                RasterLayerProperties3DPanel.class);
80
        }
81
        
82
        // Regsiter view properties
83
        PropertiesPageManager manager = MapControlLocator.getPropertiesPageManager();
84
        manager.registerFactory(new ViewProperties3DPageFactory());
85
        
86
        registerIcons();
87
    }
88

  
89
    private void registerIcons() {
90
        IconThemeHelper.registerIcon("view3d", "spherical-view-3d", this);
91
        IconThemeHelper.registerIcon("view3d", "flat-view-3d", this);
92
        IconThemeHelper.registerIcon("view3d", "general-properties-view-3d", this);
93
    }
94

  
95
    public void execute(String actionCommand) {
96

  
97
        TYPE type = getType(actionCommand);
98

  
99
        IView view = getActiveView();
100

  
101
        if (view != null && type != null) {
102
            View3DSwingManager manager = View3DSwingLocator.getManager();
103

  
104
            ViewDocument viewDocument = view.getViewDocument();
105
            MapControl3D mapControl3D =
106
                manager.getMapControl3D(
107
                    (ExtendedPropertiesSupport) viewDocument, type);
108
            if (mapControl3D == null || mapControl3D.getType() != type) {
109
                View3DPanel view3DPanel =
110
                    manager.createView3DPanel(view.getMapControl()
111
                        .getMapContext(), viewDocument.getName(), type,
112
                        (ExtendedPropertiesSupport) viewDocument);
113
                view3DPanel.getMapControl3D().addObserver(this);
114
                view3DPanel.show();
115
            }
116
        }
117
    }
118

  
119
    private TYPE getType(String actionCommand) {
120
        if ("spherical-view-3d".equals(actionCommand)) {
121
            return TYPE.SPHERE;
122
        } else if ("flat-view-3d".equals(actionCommand)) {
123
            return TYPE.FLAT;
124
        }
125
        return null;
126
    }
127

  
128
    public boolean isEnabled() {
129
        return true;
130
    }
131

  
132
    public boolean isVisible() {
133
        return true;
134
    }
135

  
136
    @Override
137
    public boolean isEnabled(String actionCommand) {
138

  
139
        IView view = getActiveView();
140
        if (view != null
141
            && ("spherical-view-3d".equals(actionCommand) || "flat-view-3d"
142
                .equals(actionCommand))) {
143

  
144
            View3DSwingManager manager = View3DSwingLocator.getManager();
145
            MapContext mapContext = view.getMapControl().getMapContext();
146
            TYPE type = getType(actionCommand);
147

  
148
            if (type != null) {
149

  
150
                MapControl3D mapControl3D =
151
                    manager.getMapControl3D(
152
                        (ExtendedPropertiesSupport) view.getViewDocument(),
153
                        getType(actionCommand));
154

  
155
                FLayers layers = mapContext.getLayers();
156

  
157
                boolean isEPSG4326 =
158
                    mapContext.getProjection().getAbrev().equals("EPSG:4326");
159

  
160
                if (mapControl3D == null && layers.getLayersCount() > 0
161
                    && isEPSG4326) {
162
                    return true;
163
                }
164
            }
165
        }
166
        return false;
167
    }
168

  
169
    @Override
170
    public boolean isVisible(String actionCommand) {
171
        IView view = getActiveView();
172
        if (view != null) {
173
            return true;
174
        }
175
        return false;
176
    }
177

  
178
    private IView getActiveView() {
179
        ApplicationManager application = ApplicationLocator.getManager();
180
        IView view = (IView) application.getActiveComponent(ViewDocument.class);
181
        return view;
182
    }
183

  
184
    @Override
185
    public boolean canQueryByAction() {
186
        return true;
187
    }
188

  
189
    public void update(Observable observable, Object notification) {
190
        if (observable instanceof MapControl3D
191
            && notification instanceof Notification) {
192

  
193
            Notification n = (Notification) notification;
194
            if (n.getType().equalsIgnoreCase(
195
                MapControl3D.AFTER_DISPOSE_MAPCONTEX3D_NOTIFICATION)) {
196
                ApplicationManager appManager = ApplicationLocator.getManager();
197
                appManager.refreshMenusAndToolBars();
198
            }
199
        }
200

  
201
    }
202
}
2.1/tags/org.gvsig.view3d-1.0.8/org.gvsig.view3d.app/org.gvsig.view3d.app.common/src/main/java/org/gvsig/view3d/app/mainplugin/SynchronizeViewPort3DExtension.java
1
package org.gvsig.view3d.app.mainplugin;
2

  
3
import java.util.List;
4

  
5
import org.gvsig.andami.IconThemeHelper;
6
import org.gvsig.andami.plugins.Extension;
7
import org.gvsig.app.ApplicationLocator;
8
import org.gvsig.app.ApplicationManager;
9
import org.gvsig.app.project.documents.view.ViewDocument;
10
import org.gvsig.app.project.documents.view.gui.IView;
11
import org.gvsig.fmap.mapcontext.layers.ExtendedPropertiesSupport;
12
import org.gvsig.view3d.swing.api.MapControl3D;
13
import org.gvsig.view3d.swing.api.View3DSwingLocator;
14
import org.gvsig.view3d.swing.api.View3DSwingManager;
15
import org.gvsig.view3d.swing.api.View3DSwingManager.TYPE;
16

  
17

  
18
public class SynchronizeViewPort3DExtension extends Extension {
19

  
20
    public void initialize() {
21
        registerIcons();
22
    }
23
    
24
    private void registerIcons() {
25
        IconThemeHelper.registerIcon("view3d", "synchronize-viewport-3d", this);
26
    }
27

  
28
    public void execute(String actionCommand) {
29
        
30
        if ("synchronize-viewport-3d".equals(actionCommand)) {
31
            IView view = getActiveView();
32

  
33
            View3DSwingManager manager = View3DSwingLocator.getManager();
34
            MapControl3D mapControl3DFlat =
35
                manager.getMapControl3D(
36
                    (ExtendedPropertiesSupport) view.getViewDocument(),
37
                    TYPE.FLAT);
38
            if (mapControl3DFlat != null) {
39
                mapControl3DFlat.synchronizeViewPorts();
40
            }
41

  
42
            MapControl3D mapControl3DSphere =
43
                manager.getMapControl3D(
44
                    (ExtendedPropertiesSupport) view.getViewDocument(),
45
                    TYPE.SPHERE);
46
            if (mapControl3DSphere != null) {
47
                mapControl3DSphere.synchronizeViewPorts();
48
            }
49
        }
50
    }
51

  
52
    public boolean isEnabled() {
53
        IView view = getActiveView();
54
        if (view != null) {
55
            View3DSwingManager manager = View3DSwingLocator.getManager();
56
            List<MapControl3D> mapControls3D =
57
                manager.getMapControl3D((ExtendedPropertiesSupport) view
58
                    .getViewDocument());
59
            if (mapControls3D.size() > 0) {
60
                return true;
61
            }
62
        }
63
        return false;
64
    }
65

  
66
    public boolean isVisible() {
67
        IView view = getActiveView();
68
        if (view != null) {
69
            return true;
70
        }
71
        return false;
72
    }
73
    
74
    private IView getActiveView() {
75
        ApplicationManager application = ApplicationLocator.getManager();
76
        IView view = (IView) application.getActiveComponent(ViewDocument.class);
77
        return view;
78
    }
79

  
80
}
2.1/tags/org.gvsig.view3d-1.0.8/org.gvsig.view3d.app/org.gvsig.view3d.app.common/src/main/resources-plugin/plugin-persistence.def
1
<?xml version="1.0"?>
2
<!--
3
Definitions of plugin persistence org.gvsig.geometry.
4
 -->
5
<definitions>
6
  <version>1.0.0</version>
7
  <classes>
8
    <class name="org.gvsig.view3d.app">
9
      <description>Persistence for the view3d plugin</description>
10
      <fields>
11
  
12
        <field name="defultViewWidth" type="Integer" defaultValue="800" classOfValue="" mandatory="true">
13
          <description></description>
14
        </field>
15
      
16
        <field name="defultViewHeight" type="Integer" defaultValue="600" classOfValue="" mandatory="true">
17
          <description></description>
18
        </field>
19
        
20
        <field name="atmosphereVisibility" type="Boolean" defaultValue="true" classOfValue="" mandatory="true">
21
          <description></description>
22
        </field>
23
        
24
        <field name="northIndicatorVisibility" type="Boolean" defaultValue="true" classOfValue="" mandatory="true">
25
          <description></description>
26
        </field>
27
        
28
        <field name="minimapVisibility" type="Boolean" defaultValue="true" classOfValue="" mandatory="true">
29
          <description></description>
30
        </field>
31
        
32
        <field name="starsBackgroundVisibility" type="Boolean" defaultValue="true" classOfValue="" mandatory="true">
33
          <description></description>
34
        </field>
35
        
36
        <field name="scaleVisibility" type="Boolean" defaultValue="true" classOfValue="" mandatory="true">
37
          <description></description>
38
        </field>
39
        
40
        <field name="viewportAnimation" type="Boolean" defaultValue="true" classOfValue="" mandatory="true">
41
          <description></description>
42
        </field>
43
        
44
        <field name="cachePath" type="String" defaultValue="" classOfValue="" mandatory="false">
45
          <description></description>
46
        </field>
47

  
48
      </fields>
49
    </class>
50
  </classes>
51
</definitions>
2.1/tags/org.gvsig.view3d-1.0.8/org.gvsig.view3d.app/org.gvsig.view3d.app.common/src/main/resources-plugin/i18n/text.properties
1
3D = 3D
2
auto_synchronize_layers=Sincronizado autom\u00E1tico de capas
3
auto_synchronize_view_ports=Sincronizado autom\u00E1tico de enfoques
4
are_you_sure_remove_cache_XquestionX= Se eliminar\u00E1n todos los archivos. \u00BFEst\u00E1 usted seguro?
5
components= Componentes
6
elevation= Elevaci\u00F3n
7
elevation_field= Campo elevaci\u00F3n
8
flat_vertical_exaggeration= Exageraci\u00F3n vertical visor plano
9
flat_view_3d= Vista 3D plana
10
full_screen_mode_view_3d= Modo pantalla completa
11
level_details= Niveles de detalle
12
loading_mode= Modo de carga
13
raster_image= Imagen raster
14
rasterized_vectorial= Vectorial rasterizada
15
show_blue_marble_layer= Mostrar capa Blue Marble
16
show_atmosphere= Mostrar atm\u00F3sfera
17
show_default_elevation= Mostrar elevaci\u00F3n por defecto
18
show_minimap= Mostrar minimapa
19
show_nasa_landsat_layer= Mostar capa NASA Landsat
20
show_north_indicator= Mostrar indicador del norte
21
show_scale = Mostrar scala
22
show_stars_background= Mostrar fondo de estrellas
23
synchronize_view_3d= Sincronizar visores
24
synchronize_viewport_3d= Sincronizar encuadres
25
spherical_vertical_exaggeration= Exageraci\u00F3n vertical visor esf\u00E9rico
26
spherical_view_3d=  Vista 3D esf\u00E9rica
27
tile_configuration= Configuraci\u00F3n de tiles
28
view_3d = Visor 3D
29
view_port_animation= Animaci\u00F3n sincronizaci\u00F3n enfoques
30
zero_level_resolution= Resoluci\u00F3n nivel cero
2.1/tags/org.gvsig.view3d-1.0.8/org.gvsig.view3d.app/org.gvsig.view3d.app.common/src/main/resources-plugin/i18n/text_en.properties
1
3D= 3D
2
auto_synchronize_layers= Auto synchronize layers
3
auto_synchronize_view_ports=Auto synchronize viewport
4
are_you_sure_remove_cache_XquestionX= All files will be removed. Are you sure?
5
components= Components
6
elevation= Elevation
7
elevation_field= Elvation field
8
flat_vertical_exaggeration= Flat vertical exaggeration
9
flat_view_3d= Flat 3D view
10
full_screen_mode_view_3d= Full screen mode
11
level_details= Level of details
12
loading_mode= Loading mode
13
raster_image= Raster image
14
rasterized_vectorial= Rasterized vectorial
15
show_atmosphere= Show atmosphere
16
show_blue_marble_layer= Show Blue Marble layer
17
show_default_elevation= Show default elevation
18
show_minimap= Show minimap
19
show_nasa_landsat_layer= Show NASA Landsat
20
show_north_indicator= Show north indicator
21
show_scale = Show scale
22
show_stars_background= Show stars background
23
synchronize_view_3d= Synchronize view
24
synchronize_viewport_3d= Synchronize viewport
25
spherical_vertical_exaggeration= Spherical vertical exaggeration
26
spherical_view_3d= Spherical 3D view 
27
tile_configuration= Tile configuration
28
view_3d= 3D View
29
view_port_animation= View port animation
30
zero_level_resolution= Zero level resolution
2.1/tags/org.gvsig.view3d-1.0.8/org.gvsig.view3d.app/org.gvsig.view3d.app.common/src/main/resources-plugin/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<!-- gvSIG. Desktop Geographic Information System. Copyright (C) 2007-2013 
3
	gvSIG Association. This program is free software; you can redistribute it 
4
	and/or modify it under the terms of the GNU General Public License as published 
5
	by the Free Software Foundation; either version 3 of the License, or (at 
6
	your option) any later version. This program is distributed in the hope that 
7
	it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
8
	of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 
9
	Public License for more details. You should have received a copy of the GNU 
10
	General Public License along with this program; if not, write to the Free 
11
	Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 
12
	USA. For any additional information, do not hesitate to contact us at info 
13
	AT gvsig.com, or visit our website www.gvsig.com. -->
14
<plugin-config>
15
	<depends plugin-name="org.gvsig.app.mainplugin" />
16
  <depends plugin-name="org.gvsig.raster.mainplugin" />
17
  <depends plugin-name="org.gvsig.raster.tools.app.basic" optional="true"/>
18
	<resourceBundle name="text" />
19
	<libraries library-dir="lib" />
20
	<extensions>
21
		<extension
22
			class-name="org.gvsig.view3d.app.mainplugin.View3DExtension"
23
			description="" active="true" priority="1">
24

  
25
			<action name="spherical-view-3d" label="spherical_view_3d"
26
				tooltip="spherical_view_3d" position="650400100" action-command="spherical-view-3d"
27
				icon="spherical-view-3d" accelerator="" />
28
        
29
      <action name="flat-view-3d" label="flat_view_3d"
30
        tooltip="flat_view_3d" position="650400200" action-command="flat-view-3d"
31
        icon="flat-view-3d" accelerator="" />
32

  
33

  
34
      <menu text="View/view_3d/flat_view_3d" name="flat-view-3d" />
35
			<menu text="View/view_3d/spherical_view_3d" name="spherical-view-3d" />
36
			
37
			<tool-bar name="view-3d" position="650400000">
38
				<action-tool name="spherical-view-3d" />
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff