Revision 541
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.swing/org.gvsig.view3d.swing.api/src/main/java/org/gvsig/view3d/swing/api/properties/GeneralProperties3D.java | ||
---|---|---|
11 | 11 |
*/ |
12 | 12 |
public interface GeneralProperties3D { |
13 | 13 |
|
14 |
public final static String DEFAULT_VIEW_HEIGHT_PROPERTY_NAME = |
|
15 |
"defaultViewHeight"; |
|
16 |
public final static String DEFAULT_VIEW_WIDTH_PROPERTY_NAME = |
|
17 |
"defaultViewWidth"; |
|
18 |
|
|
19 |
public final static String ATMOSPHERE_VISIBILITY_PROPERTY_NAME = |
|
20 |
"atmosphereVisibility"; |
|
21 |
public final static String MINIMAP_VISIBILITY_PROPERTY_NAME = |
|
22 |
"minimapVisibility"; |
|
23 |
public final static String NORTH_INDICATOR_VISIBILITY_PROPERTY_NAME = |
|
24 |
"northIndicatorVisibility"; |
|
25 |
public final static String STARS_BACKGROUND_VISIBILITY_PROPERTY_NAME = |
|
26 |
"starsBackgroundVisibility"; |
|
27 |
public final static String SCALE_VISIBILITY_PROPERTY_NAME = |
|
28 |
"scaleVisibility"; |
|
29 |
|
|
30 |
public final static String VIEWPORT_ANIMATION_PROPERTY_NAME = |
|
31 |
"viewPortAnimation"; |
|
32 |
|
|
33 |
public final static String CACHE_PATH_PROPERTY_NAME = "cachePath"; |
|
34 |
|
|
14 | 35 |
/** |
15 | 36 |
* Adds {@link PropertyChangeListener} that will listen properties changes. |
16 | 37 |
* |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.swing/org.gvsig.view3d.swing.impl/src/main/resources/config/view3d.worldwind.xml | ||
---|---|---|
55 | 55 |
value="www.nasa.gov, worldwind.arc.nasa.gov, google.com, microsoft.com, yahoo.com"/> |
56 | 56 |
<Property name="gov.nasa.worldwind.avkey.TaskServiceClassName" value="gov.nasa.worldwind.util.ThreadedTaskService"/> |
57 | 57 |
<Property name="gov.nasa.worldwind.avkey.DataFileStoreClassName" |
58 |
value="gov.nasa.worldwind.cache.BasicDataFileStore"/>
|
|
58 |
value="org.gvsig.view3d.swing.impl.data.DefaultConfigurableDataFileStore"/>
|
|
59 | 59 |
<Property name="gov.nasa.worldwind.avkey.DataRasterReaderFactoryClassName" |
60 | 60 |
value="org.gvsig.view3d.swing.impl.data.DefaultDataRasterReaderFactory"/> |
61 | 61 |
<Property name="gov.nasa.worldwind.avkey.DataFileStoreConfigurationFileName" value="config/DataFileStore.xml"/> |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.swing/org.gvsig.view3d.swing.impl/src/main/java/org/gvsig/view3d/swing/impl/properties/DefaultGeneralProperties3D.java | ||
---|---|---|
8 | 8 |
|
9 | 9 |
public class DefaultGeneralProperties3D implements GeneralProperties3D { |
10 | 10 |
|
11 |
private String DEFAULT_VIEW_HEIGHT_PROPERTY_NAME = "defaultViewHeight";
|
|
12 |
private String DEFAULT_VIEW_WIDTH_PROPERTY_NAME = "defaultViewWidth";
|
|
11 |
private int defaultViewHeight;
|
|
12 |
private int defaultViewWidth;
|
|
13 | 13 |
|
14 |
private String ATMOSPHERE_VISIBILITY_PROPERTY_NAME = "atmosphereVisibility"; |
|
15 |
private String MINIMAP_VISIBILITY_PROPERTY_NAME = "minimapVisibility"; |
|
16 |
private String NORTH_INDICATOR_VISIBILITY_PROPERTY_NAME = |
|
17 |
"northIndicatorVisibility"; |
|
18 |
private String STARS_BACKGROUND_VISIBILITY_PROPERTY_NAME = |
|
19 |
"starsBackgroundVisibility"; |
|
20 |
private String SCALE_VISIBILITY_PROPERTY_NAME = "scaleVisibility"; |
|
14 |
private boolean atmosphereVisibility; |
|
15 |
private boolean northIndicatorVisibility; |
|
16 |
private boolean minimapVisibility; |
|
17 |
private boolean starsBackgroundVisibility; |
|
18 |
private boolean scaleVisibility; |
|
21 | 19 |
|
22 |
private String VIEWPORT_ANIMATION_PROPERTY_NAME = "viewPortAnimation";
|
|
20 |
private boolean viewPortAnimation;
|
|
23 | 21 |
|
24 |
private String CACHE_PATH_PROPERTY_NAME = "cachePath";
|
|
22 |
private File cachePath;
|
|
25 | 23 |
|
26 |
private int defaultViewHeight = 600; |
|
27 |
private int defaultViewWidth = 800; |
|
28 |
|
|
29 |
private boolean atmosphereVisibility = true; |
|
30 |
private boolean northIndicatorVisibility = true; |
|
31 |
private boolean minimapVisibility = true; |
|
32 |
private boolean starsBackgroundVisibility = true; |
|
33 |
private boolean scaleVisibility = true; |
|
34 |
|
|
35 |
private boolean viewPortAnimation = true; |
|
36 |
|
|
37 |
private File cachePath = new File(System.getProperty("user.home") + File.separator + "gvSIG" + File.separator + "WorldWind"); |
|
38 |
|
|
39 | 24 |
private PropertyChangeSupport support; |
40 | 25 |
|
41 | 26 |
public DefaultGeneralProperties3D() { |
42 | 27 |
support = new PropertyChangeSupport(this); |
28 |
|
|
29 |
setDefaultValues(); |
|
43 | 30 |
} |
44 | 31 |
|
32 |
private void setDefaultValues() { |
|
33 |
|
|
34 |
setDefaultViewHeight(600); |
|
35 |
setDefaultViewWidth(800); |
|
36 |
setAtmosphereVisibility(true); |
|
37 |
setNorthIndicatorVisibility(true); |
|
38 |
setMinimapVisibility(true); |
|
39 |
setStarsBackgroundVisibility(true); |
|
40 |
setScaleVisibility(true); |
|
41 |
setViewPortAnimation(true); |
|
42 |
|
|
43 |
setCachePath(new File(System.getProperty("user.home") + File.separator |
|
44 |
+ "gvSIG" + File.separator + "WorldWind")); |
|
45 |
} |
|
46 |
|
|
45 | 47 |
public boolean getAtmosphereVisibility() { |
46 | 48 |
return atmosphereVisibility; |
47 | 49 |
} |
... | ... | |
93 | 95 |
|
94 | 96 |
public void setDefaultViewWidth(int width) { |
95 | 97 |
support.firePropertyChange(DEFAULT_VIEW_WIDTH_PROPERTY_NAME, |
96 |
defaultViewHeight, width);
|
|
98 |
defaultViewWidth, width);
|
|
97 | 99 |
this.defaultViewWidth = width; |
98 | 100 |
|
99 | 101 |
} |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.swing/org.gvsig.view3d.swing.impl/src/main/java/org/gvsig/view3d/swing/impl/DefaultView3DSwingManager.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
package org.gvsig.view3d.swing.impl; |
26 | 26 |
|
27 |
import gov.nasa.worldwind.WorldWind; |
|
28 |
import gov.nasa.worldwind.cache.FileStore; |
|
29 |
|
|
30 |
import java.beans.PropertyChangeEvent; |
|
31 |
import java.beans.PropertyChangeListener; |
|
32 |
import java.io.File; |
|
27 | 33 |
import java.util.ArrayList; |
28 | 34 |
import java.util.List; |
29 | 35 |
|
... | ... | |
38 | 44 |
import org.gvsig.view3d.swing.api.properties.LayerProperties3DPanel; |
39 | 45 |
import org.gvsig.view3d.swing.api.properties.MapControlProperties3D; |
40 | 46 |
import org.gvsig.view3d.swing.api.properties.ViewProperties3DPanel; |
47 |
import org.gvsig.view3d.swing.impl.data.ConfigurableFileStore; |
|
41 | 48 |
import org.gvsig.view3d.swing.impl.properties.DefaultGeneralProperties3D; |
42 | 49 |
import org.gvsig.view3d.swing.impl.properties.DefaultGeneralProperties3DPanel; |
43 | 50 |
import org.gvsig.view3d.swing.impl.properties.DefaultLayerProperties3DPanel; |
... | ... | |
170 | 177 |
public GeneralProperties3D getGeneral3DProperties() { |
171 | 178 |
if(generalProperties == null){ |
172 | 179 |
generalProperties = new DefaultGeneralProperties3D(); |
180 |
generalProperties.addPropertyChangeListener(getCachePathPropertyListener()); |
|
173 | 181 |
} |
174 | 182 |
return generalProperties; |
175 | 183 |
} |
... | ... | |
177 | 185 |
public void setGeneral3DProperties(GeneralProperties3D properties) { |
178 | 186 |
if(properties != null){ |
179 | 187 |
this.generalProperties = properties; |
188 |
this.generalProperties |
|
189 |
.addPropertyChangeListener(getCachePathPropertyListener()); |
|
180 | 190 |
} |
181 | 191 |
|
182 | 192 |
} |
193 |
|
|
194 |
private PropertyChangeListener getCachePathPropertyListener(){ |
|
195 |
return new PropertyChangeListener() { |
|
196 |
|
|
197 |
public void propertyChange(PropertyChangeEvent evt) { |
|
198 |
if (evt.getPropertyName().equals( |
|
199 |
GeneralProperties3D.CACHE_PATH_PROPERTY_NAME)) { |
|
200 |
|
|
201 |
FileStore dataFileStore = WorldWind.getDataFileStore(); |
|
202 |
|
|
203 |
if(dataFileStore instanceof ConfigurableFileStore){ |
|
204 |
ConfigurableFileStore confDataStore = |
|
205 |
(ConfigurableFileStore) dataFileStore; |
|
206 |
|
|
207 |
confDataStore.setWriteLocation((File) evt.getNewValue()); |
|
208 |
LOG.info("Changed cache path to {}", evt.getNewValue()); |
|
209 |
} |
|
210 |
} |
|
211 |
} |
|
212 |
}; |
|
213 |
} |
|
183 | 214 |
} |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.swing/org.gvsig.view3d.swing.impl/src/main/java/org/gvsig/view3d/swing/impl/data/DefaultConfigurableDataFileStore.java | ||
---|---|---|
1 |
package org.gvsig.view3d.swing.impl.data; |
|
2 |
|
|
3 |
import gov.nasa.worldwind.cache.BasicDataFileStore; |
|
4 |
|
|
5 |
import java.io.File; |
|
6 |
|
|
7 |
import org.gvsig.view3d.swing.api.View3DSwingLocator; |
|
8 |
import org.gvsig.view3d.swing.api.View3DSwingManager; |
|
9 |
import org.gvsig.view3d.swing.api.properties.GeneralProperties3D; |
|
10 |
|
|
11 |
public class DefaultConfigurableDataFileStore extends BasicDataFileStore |
|
12 |
implements ConfigurableFileStore { |
|
13 |
|
|
14 |
|
|
15 |
public DefaultConfigurableDataFileStore() { |
|
16 |
super(); |
|
17 |
|
|
18 |
setDefaultCachePath(); |
|
19 |
} |
|
20 |
|
|
21 |
public DefaultConfigurableDataFileStore(File directoryPath ){ |
|
22 |
super(directoryPath); |
|
23 |
|
|
24 |
setDefaultCachePath(); |
|
25 |
} |
|
26 |
|
|
27 |
private void setDefaultCachePath() { |
|
28 |
|
|
29 |
View3DSwingManager swingManager = View3DSwingLocator.getManager(); |
|
30 |
GeneralProperties3D general3dProperties = swingManager.getGeneral3DProperties(); |
|
31 |
|
|
32 |
setWriteLocation(general3dProperties.getCachePath()); |
|
33 |
} |
|
34 |
|
|
35 |
public void setWriteLocation(File writeLocation) { |
|
36 |
|
|
37 |
if(!writeLocation.exists()){ |
|
38 |
writeLocation.mkdirs(); |
|
39 |
} |
|
40 |
|
|
41 |
if (writeLocation.isDirectory() && writeLocation.canWrite() |
|
42 |
&& writeLocation.canRead()) { |
|
43 |
|
|
44 |
// Remove the writable location from search path if it already |
|
45 |
// exists. |
|
46 |
StoreLocation oldLocation = |
|
47 |
this.storeLocationFor(this.writeLocation.getFile().getAbsolutePath()); |
|
48 |
if (oldLocation != null) |
|
49 |
this.readLocations.remove(oldLocation); |
|
50 |
|
|
51 |
this.writeLocation = new StoreLocation(writeLocation); |
|
52 |
|
|
53 |
// Writable location is always first in search path. |
|
54 |
this.readLocations.add(0, this.writeLocation); |
|
55 |
} |
|
56 |
} |
|
57 |
} |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.swing/org.gvsig.view3d.swing.impl/src/main/java/org/gvsig/view3d/swing/impl/data/DefaultElevationModel.java | ||
---|---|---|
1 | 1 |
package org.gvsig.view3d.swing.impl.data; |
2 | 2 |
|
3 |
import gov.nasa.worldwind.WorldWind; |
|
3 | 4 |
import gov.nasa.worldwind.avlist.AVKey; |
4 | 5 |
import gov.nasa.worldwind.avlist.AVList; |
5 | 6 |
import gov.nasa.worldwind.cache.FileStore; |
... | ... | |
57 | 58 |
} |
58 | 59 |
|
59 | 60 |
if (params.getValue(AVKey.FILE_STORE) == null) { |
60 |
LOG.error("Can not create raster server, file store is null"); |
|
61 |
throw new IllegalArgumentException(); |
|
61 |
setDataFileStore(WorldWind.getDataFileStore()); |
|
62 | 62 |
} |
63 | 63 |
|
64 |
setDataFileStore((FileStore) params.getValue(AVKey.FILE_STORE)); |
|
65 |
|
|
66 | 64 |
String datasetName = params.getStringValue(AVKey.DATASET_NAME); |
67 | 65 |
if (WWUtil.isEmpty(datasetName)) { |
68 | 66 |
LOG.error( |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.swing/org.gvsig.view3d.swing.impl/src/main/java/org/gvsig/view3d/swing/impl/data/ConfigurableFileStore.java | ||
---|---|---|
1 |
package org.gvsig.view3d.swing.impl.data; |
|
2 |
|
|
3 |
import gov.nasa.worldwind.cache.FileStore; |
|
4 |
|
|
5 |
import java.io.File; |
|
6 |
|
|
7 |
/** |
|
8 |
* This class represents the configurable {@link FileStore} |
|
9 |
* |
|
10 |
* @author <a href="mailto:lmarques@disid.com">Lluis Marques</a> |
|
11 |
* |
|
12 |
*/ |
|
13 |
public interface ConfigurableFileStore extends FileStore{ |
|
14 |
|
|
15 |
/** |
|
16 |
* Set new write location to file store |
|
17 |
* |
|
18 |
* @param writeLocation |
|
19 |
*/ |
|
20 |
public void setWriteLocation(File writeLocation); |
|
21 |
|
|
22 |
} |
|
23 |
|
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.swing/org.gvsig.view3d.swing.impl/src/main/java/org/gvsig/view3d/swing/impl/data/DefaultTiledImageLayer.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
package org.gvsig.view3d.swing.impl.data; |
26 | 26 |
|
27 |
import gov.nasa.worldwind.WorldWind; |
|
27 | 28 |
import gov.nasa.worldwind.avlist.AVKey; |
28 | 29 |
import gov.nasa.worldwind.avlist.AVList; |
29 | 30 |
import gov.nasa.worldwind.cache.FileStore; |
... | ... | |
103 | 104 |
} |
104 | 105 |
|
105 | 106 |
if (params.getValue(AVKey.FILE_STORE) == null) { |
106 |
LOG.error("Can not create raster server, file store is null"); |
|
107 |
throw new IllegalArgumentException(); |
|
107 |
setDataFileStore(WorldWind.getDataFileStore()); |
|
108 | 108 |
} |
109 |
|
|
110 |
setDataFileStore((FileStore) params.getValue(AVKey.FILE_STORE)); |
|
111 | 109 |
|
112 | 110 |
String datasetName = params.getStringValue(AVKey.DATASET_NAME); |
113 | 111 |
if (WWUtil.isEmpty(datasetName)) { |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.swing/org.gvsig.view3d.swing.impl/src/main/java/org/gvsig/view3d/swing/impl/data/DefaultLayerConverter.java | ||
---|---|---|
27 | 27 |
import gov.nasa.worldwind.avlist.AVKey; |
28 | 28 |
import gov.nasa.worldwind.avlist.AVList; |
29 | 29 |
import gov.nasa.worldwind.avlist.AVListImpl; |
30 |
import gov.nasa.worldwind.cache.BasicDataFileStore; |
|
31 | 30 |
import gov.nasa.worldwind.geom.Angle; |
32 | 31 |
import gov.nasa.worldwind.geom.LatLon; |
33 | 32 |
import gov.nasa.worldwind.geom.Sector; |
... | ... | |
37 | 36 |
import gov.nasa.worldwind.util.WWMath; |
38 | 37 |
|
39 | 38 |
import java.awt.geom.Point2D; |
40 |
import java.io.File; |
|
41 | 39 |
import java.security.MessageDigest; |
42 | 40 |
import java.security.NoSuchAlgorithmException; |
43 | 41 |
|
... | ... | |
56 | 54 |
import org.gvsig.view3d.lib.api.View3DManager; |
57 | 55 |
import org.gvsig.view3d.lib.api.properties.LayerProperties3D; |
58 | 56 |
import org.gvsig.view3d.swing.api.MapControl3D; |
59 |
import org.gvsig.view3d.swing.api.View3DSwingLocator; |
|
60 | 57 |
import org.gvsig.view3d.swing.impl.DefaultMapControl3D; |
61 | 58 |
import org.slf4j.Logger; |
62 | 59 |
import org.slf4j.LoggerFactory; |
... | ... | |
375 | 372 |
params.setValue(AVKey.DATASET_NAME, layer.getName()); |
376 | 373 |
params.setValue(AVKey.DATA_CACHE_NAME, getUniqueCacheId(layer)); |
377 | 374 |
params.setValue(AVKey.DISPLAY_NAME, layer.getName()); |
378 |
params.setValue(AVKey.SERVICE_NAME, "Offline"); |
|
379 |
|
|
380 |
File cachePath = |
|
381 |
View3DSwingLocator.getManager().getGeneral3DProperties().getCachePath(); |
|
382 |
params.setValue(AVKey.FILE_STORE, new BasicDataFileStore(cachePath)); |
|
375 |
params.setValue(AVKey.SERVICE_NAME, "Offline"); |
|
383 | 376 |
} |
384 | 377 |
|
385 | 378 |
private Sector getSector(FLayer layer, IProjection projection) |
Also available in: Unified diff