Revision 494
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.app/org.gvsig.view3d.app.common/src/main/java/org/gvsig/view3d/app/mainplugin/View3DExtension.java | ||
---|---|---|
35 | 35 |
import org.gvsig.fmap.mapcontext.layers.ExtendedPropertiesSupport; |
36 | 36 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
37 | 37 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
38 |
import org.gvsig.fmap.mapcontrol.MapControlLocator; |
|
39 |
import org.gvsig.propertypage.PropertiesPageManager; |
|
38 | 40 |
import org.gvsig.tools.ToolsLocator; |
39 | 41 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
40 | 42 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
... | ... | |
43 | 45 |
import org.gvsig.tools.observer.Observer; |
44 | 46 |
import org.gvsig.view3d.app.properties.LayerProperties3DThemeManagerPage; |
45 | 47 |
import org.gvsig.view3d.app.properties.RasterLayerProperties3DPanel; |
48 |
import org.gvsig.view3d.app.properties.ViewProperties3DPageFactory; |
|
46 | 49 |
import org.gvsig.view3d.swing.api.MapControl3D; |
47 | 50 |
import org.gvsig.view3d.swing.api.View3DPanel; |
48 | 51 |
import org.gvsig.view3d.swing.api.View3DSwingLocator; |
... | ... | |
56 | 59 |
public class View3DExtension extends Extension implements Observer { |
57 | 60 |
|
58 | 61 |
public void initialize() { |
59 |
|
|
62 |
// Register vectorial layer 3D properties panel |
|
60 | 63 |
ThemeManagerWindow.addPage(LayerProperties3DThemeManagerPage.class); |
61 | 64 |
ThemeManagerWindow.setTabEnabledForLayer( |
62 | 65 |
LayerProperties3DThemeManagerPage.class, FLyrVect.class, true); |
63 |
|
|
66 |
|
|
67 |
// Regsiter raster layer 3D properties panel |
|
64 | 68 |
ExtensionPointManager extensionPoints = |
65 | 69 |
ToolsLocator.getExtensionPointManager(); |
66 | 70 |
ExtensionPoint point = extensionPoints.get("RasterSEPropertiesDialog"); |
... | ... | |
68 | 72 |
point.append("3D", "3D Raster properties panel", |
69 | 73 |
RasterLayerProperties3DPanel.class); |
70 | 74 |
} |
75 |
|
|
76 |
// Regsiter view properties |
|
77 |
PropertiesPageManager manager = MapControlLocator.getPropertiesPageManager(); |
|
78 |
manager.registerFactory(new ViewProperties3DPageFactory()); |
|
79 |
|
|
71 | 80 |
registerIcons(); |
72 | 81 |
} |
73 | 82 |
|
2.1/trunk/org.gvsig.view3d/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.lib.api.View3DLocator; |
|
13 |
import org.gvsig.view3d.lib.api.View3DManager; |
|
14 |
import org.gvsig.view3d.lib.api.properties.MapControlProperties3D; |
|
15 |
import org.gvsig.view3d.swing.api.View3DSwingLocator; |
|
16 |
import org.gvsig.view3d.swing.api.View3DSwingManager; |
|
17 |
import org.gvsig.view3d.swing.api.properties.ViewProperties3DPanel; |
|
18 |
|
|
19 |
public class ViewProperties3DPage implements PropertiesPage { |
|
20 |
|
|
21 |
private ViewDocument viewDocument; |
|
22 |
private JPanel panel; |
|
23 |
private ViewProperties3DPanel properties3DPanel; |
|
24 |
|
|
25 |
public ViewProperties3DPage(ViewDocument viewDocument) { |
|
26 |
this.viewDocument = viewDocument; |
|
27 |
|
|
28 |
initialize(); |
|
29 |
} |
|
30 |
|
|
31 |
private void initialize() { |
|
32 |
|
|
33 |
View3DManager manager = View3DLocator.getManager(); |
|
34 |
MapControlProperties3D mapControl3DProperties = |
|
35 |
manager.getMapControl3DProperties(viewDocument); |
|
36 |
|
|
37 |
View3DSwingManager swingManager = View3DSwingLocator.getManager(); |
|
38 |
this.properties3DPanel = |
|
39 |
swingManager.createViewProperties3DPanel(mapControl3DProperties); |
|
40 |
|
|
41 |
panel = new JPanel(new BorderLayout()); |
|
42 |
panel.add(properties3DPanel.asJComponent(), BorderLayout.CENTER); |
|
43 |
} |
|
44 |
|
|
45 |
public JComponent asJComponent() { |
|
46 |
return this.panel; |
|
47 |
} |
|
48 |
|
|
49 |
public String getTitle() { |
|
50 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
51 |
return i18nManager.getTranslation("3D"); |
|
52 |
} |
|
53 |
|
|
54 |
public int getPriority() { |
|
55 |
return 10; |
|
56 |
} |
|
57 |
|
|
58 |
public boolean whenAccept() { |
|
59 |
whenApply(); |
|
60 |
return true; |
|
61 |
} |
|
62 |
|
|
63 |
public boolean whenApply() { |
|
64 |
|
|
65 |
double sphereVerticalExaggeration = |
|
66 |
this.properties3DPanel.getSphereVerticalExaggeration(); |
|
67 |
double flatVerticalExaggeration = |
|
68 |
this.properties3DPanel.getFlatVerticalExaggeration(); |
|
69 |
boolean autoLayerSynchronize = |
|
70 |
this.properties3DPanel.getAutoLayerSynchronize(); |
|
71 |
boolean autoViewPortSynchronize = |
|
72 |
this.properties3DPanel.getAutoViewPortSynchronize(); |
|
73 |
boolean showBlueMarble = this.properties3DPanel.getShowBlueMarble(); |
|
74 |
boolean showNasaLandsat = this.properties3DPanel.getShowNasaLandsat(); |
|
75 |
boolean showDefaultElevation = |
|
76 |
this.properties3DPanel.getShowDefaultElevation(); |
|
77 |
|
|
78 |
View3DManager manager = View3DLocator.getManager(); |
|
79 |
MapControlProperties3D mapControl3DProperties = |
|
80 |
manager.getMapControl3DProperties(viewDocument); |
|
81 |
|
|
82 |
mapControl3DProperties |
|
83 |
.setSphereVerticalExaggeration(sphereVerticalExaggeration); |
|
84 |
mapControl3DProperties |
|
85 |
.setFlatVerticalExaggeration(flatVerticalExaggeration); |
|
86 |
mapControl3DProperties.setAutoLayerSynchronize(autoLayerSynchronize); |
|
87 |
mapControl3DProperties.setAutoViewPortSynchronize(autoViewPortSynchronize); |
|
88 |
mapControl3DProperties.setBlueMarbleLayerVisibility(showBlueMarble); |
|
89 |
mapControl3DProperties.setNasaLandsatVisibility(showNasaLandsat); |
|
90 |
mapControl3DProperties |
|
91 |
.setDefaultElevationVisibility(showDefaultElevation); |
|
92 |
|
|
93 |
manager.setMapControlProperties3D(viewDocument, mapControl3DProperties); |
|
94 |
|
|
95 |
return true; |
|
96 |
} |
|
97 |
|
|
98 |
public boolean whenCancel() { |
|
99 |
return true; |
|
100 |
} |
|
101 |
|
|
102 |
} |
2.1/trunk/org.gvsig.view3d/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/trunk/org.gvsig.view3d/org.gvsig.view3d.app/org.gvsig.view3d.app.common/src/main/resources-plugin/i18n/text.properties | ||
---|---|---|
1 | 1 |
3D = 3D |
2 |
auto_synchronize_layers=Sincronizado autom\u00E1tico de capas |
|
3 |
auto_synchronize_view_ports=Sincronizado autom\u00E1tico de enfoques |
|
2 | 4 |
flat_view_3d= Visor 3D plano |
3 | 5 |
elevation= Elevaci\u00F3n |
4 | 6 |
elevation_field= Campo elevaci\u00F3n |
7 |
flat_vertical_exaggeration= Exageraci\u00F3n vertical visor plano |
|
5 | 8 |
level_details= Niveles de detalle |
6 | 9 |
load_mode= Modo de carga |
7 |
tile_configuration= Configuraci\u00F3n de tiles |
|
8 | 10 |
raster_image= Imagen raster |
9 | 11 |
rasterized_vectorial= Vectorial rasterizada |
12 |
show_blue_marbel_layer= Mostrar capa Blue Marbel |
|
13 |
show_nasa_landsat_layer= Mostar capa NASA Landsat |
|
14 |
show_default_elevation= Mostrar elevaci\u00F3n por defecto |
|
10 | 15 |
synchronize_view_3d= Sincronizar visores |
11 |
sphere_view_3d= Visor 3D esf\u00E9rico |
|
16 |
sphere_vertical_exaggeration= Exageraci\u00F3n vertical visor esf\u00E9rico |
|
17 |
sphere_view_3d= Visor 3D esf\u00E9rico |
|
18 |
tile_configuration= Configuraci\u00F3n de tiles |
|
12 | 19 |
view_3d = Visor 3D |
13 | 20 |
zero_level_resolution= Resoluci\u00F3n nivel cero |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.app/org.gvsig.view3d.app.common/src/main/resources-plugin/i18n/text_en.properties | ||
---|---|---|
1 | 1 |
3D= 3D |
2 |
auto_synchronize_layers= Auto synchronize layers |
|
3 |
auto_synchronize_view_ports=Auto synchronize view ports |
|
2 | 4 |
flat_view_3d= Flat 3D viewer |
3 | 5 |
elevation= Elevation |
4 | 6 |
elevation_field= Elvation field |
7 |
flat_vertical_exaggeration= Flat vertical exaggeration |
|
5 | 8 |
level_details= Level of details |
6 | 9 |
load_mode= Load mode |
7 |
tile_configuration= Tile configuration |
|
8 | 10 |
raster_image= Raster image |
9 | 11 |
rasterized_vectorial= Rasterized vectorial |
12 |
show_blue_marbel_layer= Show Blue Marbel layer |
|
13 |
show_nasa_landsat_layer= Show NASA Landsat |
|
14 |
show_default_elevation= Show default elevation |
|
10 | 15 |
synchronize_view_3d= Synchronize view |
16 |
sphere_vertical_exaggeration= Sphere vertical exaggeration |
|
11 | 17 |
sphere_view_3d= Sphere 3D viewer |
18 |
tile_configuration= Tile configuration |
|
12 | 19 |
view_3d= 3D View |
13 | 20 |
zero_level_resolution= Zero level resolution |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.lib/org.gvsig.view3d.lib.api/src/main/java/org/gvsig/view3d/lib/api/View3DManager.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
package org.gvsig.view3d.lib.api; |
26 | 26 |
|
27 |
import org.gvsig.fmap.mapcontext.layers.ExtendedPropertiesSupport; |
|
27 | 28 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
28 | 29 |
import org.gvsig.view3d.lib.api.properties.LayerProperties3D; |
30 |
import org.gvsig.view3d.lib.api.properties.MapControlProperties3D; |
|
29 | 31 |
|
30 | 32 |
|
31 | 33 |
/** |
... | ... | |
37 | 39 |
public LayerProperties3D getLayerProperties(FLayer layer); |
38 | 40 |
|
39 | 41 |
public void setLayerProperties(FLayer layer, LayerProperties3D properties); |
42 |
|
|
43 |
public MapControlProperties3D getMapControl3DProperties( |
|
44 |
ExtendedPropertiesSupport viewProperties); |
|
45 |
|
|
46 |
public void setMapControlProperties3D( |
|
47 |
ExtendedPropertiesSupport viewProperties, |
|
48 |
MapControlProperties3D mapControl3DProperties); |
|
40 | 49 |
|
41 | 50 |
} |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.lib/org.gvsig.view3d.lib.api/src/main/java/org/gvsig/view3d/lib/api/properties/MapControlProperties3D.java | ||
---|---|---|
1 |
package org.gvsig.view3d.lib.api.properties; |
|
2 |
|
|
3 |
import java.beans.PropertyChangeListener; |
|
4 |
|
|
5 |
/** |
|
6 |
* |
|
7 |
* @author <a href="mailto:lmarques@disid.com">Lluis Marques</a> |
|
8 |
* |
|
9 |
*/ |
|
10 |
public interface MapControlProperties3D { |
|
11 |
|
|
12 |
public final String SPHERE_VERTICAL_EXAGGERATION_PROPERTY_NAME = |
|
13 |
"sphereVerticalExaggeration"; |
|
14 |
public final String FLAT_VERTICAL_EXAGGERATION_PROPERTY_NAME = |
|
15 |
"flatVerticalExaggeration"; |
|
16 |
public final String AUTO_LAYER_SYNCHRONIZE_PROPERTY_NAME = |
|
17 |
"autoLayerSynchronize"; |
|
18 |
public final String AUTO_VIEWPORT_SYNCHRONIZE_PROPERTY_NAME = |
|
19 |
"autoViewPortSynchronize"; |
|
20 |
public final String BLUE_MARBEL_VISIBILITY_PROPERTY_NAME = |
|
21 |
"blueMarbelLayerVisibility"; |
|
22 |
public final String NASA_LANDSAT_VISIBILITY_PROPERTY_NAME = |
|
23 |
"nasaLandsatLayerVisibility"; |
|
24 |
public final String DEFAULT_ELEVATION_VISIBILITY_PROPERTY_NAME = |
|
25 |
"defaultElevationVisibility"; |
|
26 |
|
|
27 |
public void addPropertyChangeListener(PropertyChangeListener listener); |
|
28 |
|
|
29 |
public boolean getAutoLayerSynchronize(); |
|
30 |
|
|
31 |
public boolean getAutoViewSynchronize(); |
|
32 |
|
|
33 |
public boolean getBlueMarbleLayerVisibility(); |
|
34 |
|
|
35 |
public boolean getDefaultElevationVisibility(); |
|
36 |
|
|
37 |
public double getFlatVerticalExaggeration(); |
|
38 |
|
|
39 |
public boolean getNasaLandsatLayerVisibility(); |
|
40 |
|
|
41 |
public double getSphereVerticalExaggeration(); |
|
42 |
|
|
43 |
public void removePropertyChangeListener(PropertyChangeListener listener); |
|
44 |
|
|
45 |
public void setAutoLayerSynchronize(boolean flag); |
|
46 |
|
|
47 |
public void setAutoViewPortSynchronize(boolean flag); |
|
48 |
|
|
49 |
public void setBlueMarbleLayerVisibility(boolean visibility); |
|
50 |
|
|
51 |
public void setDefaultElevationVisibility(boolean visibility); |
|
52 |
|
|
53 |
public void setFlatVerticalExaggeration(double value); |
|
54 |
|
|
55 |
public void setNasaLandsatVisibility(boolean visibility); |
|
56 |
|
|
57 |
public void setSphereVerticalExaggeration(double value); |
|
58 |
|
|
59 |
} |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.lib/org.gvsig.view3d.lib.impl/src/main/java/org/gvsig/view3d/lib/impl/DefaultView3DManger.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
package org.gvsig.view3d.lib.impl; |
25 | 25 |
|
26 |
import org.gvsig.fmap.mapcontext.layers.ExtendedPropertiesSupport; |
|
26 | 27 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
27 | 28 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
28 | 29 |
import org.gvsig.view3d.lib.api.View3DManager; |
29 | 30 |
import org.gvsig.view3d.lib.api.properties.LayerProperties3D; |
31 |
import org.gvsig.view3d.lib.api.properties.MapControlProperties3D; |
|
32 |
import org.gvsig.view3d.lib.impl.properties.DefaultMapControlProperties3D; |
|
30 | 33 |
import org.gvsig.view3d.lib.impl.properties.DefaultRasterLayerProperties3D; |
31 | 34 |
import org.gvsig.view3d.lib.impl.properties.DefaultVectorialLayerProperties3D; |
32 | 35 |
|
... | ... | |
40 | 43 |
public LayerProperties3D getLayerProperties(FLayer layer) { |
41 | 44 |
Object properties = layer.getProperty("properties3D"); |
42 | 45 |
if(properties == null){ |
43 |
|
|
46 |
LayerProperties3D layerProperties; |
|
44 | 47 |
if(layer instanceof FLyrVect){ |
45 |
return new DefaultVectorialLayerProperties3D(); |
|
48 |
layerProperties = |
|
49 |
new DefaultVectorialLayerProperties3D(); |
|
46 | 50 |
} else { |
47 |
return new DefaultRasterLayerProperties3D();
|
|
51 |
layerProperties = new DefaultRasterLayerProperties3D();
|
|
48 | 52 |
} |
53 |
setLayerProperties(layer, layerProperties); |
|
54 |
return layerProperties; |
|
49 | 55 |
} |
50 | 56 |
return (LayerProperties3D) properties; |
51 | 57 |
} |
... | ... | |
54 | 60 |
layer.setProperty("properties3D", properties); |
55 | 61 |
} |
56 | 62 |
|
63 |
public MapControlProperties3D getMapControl3DProperties( |
|
64 |
ExtendedPropertiesSupport viewProperties) { |
|
65 |
|
|
66 |
MapControlProperties3D properties = |
|
67 |
(MapControlProperties3D) viewProperties |
|
68 |
.getProperty("mapControl3DProperties"); |
|
69 |
|
|
70 |
if(properties == null){ |
|
71 |
properties = new DefaultMapControlProperties3D(); |
|
72 |
setMapControlProperties3D(viewProperties, properties); |
|
73 |
} |
|
74 |
|
|
75 |
return properties; |
|
76 |
} |
|
77 |
|
|
78 |
public void setMapControlProperties3D( |
|
79 |
ExtendedPropertiesSupport viewProperties, |
|
80 |
MapControlProperties3D mapControl3DProperties) { |
|
81 |
|
|
82 |
viewProperties.setProperty("mapControl3DProperties", |
|
83 |
mapControl3DProperties); |
|
84 |
} |
|
85 |
|
|
57 | 86 |
} |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.lib/org.gvsig.view3d.lib.impl/src/main/java/org/gvsig/view3d/lib/impl/properties/DefaultMapControlProperties3D.java | ||
---|---|---|
1 |
package org.gvsig.view3d.lib.impl.properties; |
|
2 |
|
|
3 |
import java.beans.PropertyChangeListener; |
|
4 |
import java.beans.PropertyChangeSupport; |
|
5 |
|
|
6 |
import org.gvsig.view3d.lib.api.properties.MapControlProperties3D; |
|
7 |
|
|
8 |
public class DefaultMapControlProperties3D implements MapControlProperties3D { |
|
9 |
|
|
10 |
private PropertyChangeSupport propertyChangeSupport; |
|
11 |
|
|
12 |
private double sphereVerticalExaggeration = 1; |
|
13 |
private double flatVerticalExaggeration = 1; |
|
14 |
private boolean autoLayerShynchornize = true; |
|
15 |
private boolean autoViewPortSynchronize = false; |
|
16 |
private boolean showBlueMarbleLayer = true; |
|
17 |
private boolean showNasaLandsatLayer = true; |
|
18 |
private boolean showDefaultElevation = true; |
|
19 |
|
|
20 |
public DefaultMapControlProperties3D() { |
|
21 |
propertyChangeSupport = new PropertyChangeSupport(this); |
|
22 |
} |
|
23 |
|
|
24 |
public boolean getAutoLayerSynchronize() { |
|
25 |
return autoLayerShynchornize; |
|
26 |
} |
|
27 |
|
|
28 |
public boolean getAutoViewSynchronize() { |
|
29 |
return autoViewPortSynchronize; |
|
30 |
} |
|
31 |
|
|
32 |
public boolean getBlueMarbleLayerVisibility() { |
|
33 |
return showBlueMarbleLayer; |
|
34 |
} |
|
35 |
|
|
36 |
public boolean getDefaultElevationVisibility() { |
|
37 |
return showDefaultElevation; |
|
38 |
} |
|
39 |
|
|
40 |
public double getFlatVerticalExaggeration() { |
|
41 |
return flatVerticalExaggeration; |
|
42 |
} |
|
43 |
|
|
44 |
public boolean getNasaLandsatLayerVisibility() { |
|
45 |
return showNasaLandsatLayer; |
|
46 |
} |
|
47 |
|
|
48 |
public double getSphereVerticalExaggeration() { |
|
49 |
return sphereVerticalExaggeration; |
|
50 |
} |
|
51 |
|
|
52 |
public void setAutoLayerSynchronize(boolean flag) { |
|
53 |
this.propertyChangeSupport.firePropertyChange( |
|
54 |
AUTO_LAYER_SYNCHRONIZE_PROPERTY_NAME, autoLayerShynchornize, flag); |
|
55 |
this.autoLayerShynchornize = flag; |
|
56 |
} |
|
57 |
|
|
58 |
public void setAutoViewPortSynchronize(boolean flag) { |
|
59 |
this.propertyChangeSupport.firePropertyChange( |
|
60 |
AUTO_VIEWPORT_SYNCHRONIZE_PROPERTY_NAME, autoViewPortSynchronize, |
|
61 |
flag); |
|
62 |
this.autoViewPortSynchronize = flag; |
|
63 |
} |
|
64 |
|
|
65 |
public void setBlueMarbleLayerVisibility(boolean visibility) { |
|
66 |
this.propertyChangeSupport.firePropertyChange( |
|
67 |
BLUE_MARBEL_VISIBILITY_PROPERTY_NAME, showBlueMarbleLayer, |
|
68 |
visibility); |
|
69 |
this.showBlueMarbleLayer = visibility; |
|
70 |
} |
|
71 |
|
|
72 |
public void setDefaultElevationVisibility(boolean visibility) { |
|
73 |
this.propertyChangeSupport.firePropertyChange( |
|
74 |
DEFAULT_ELEVATION_VISIBILITY_PROPERTY_NAME, showDefaultElevation, |
|
75 |
visibility); |
|
76 |
this.showDefaultElevation = visibility; |
|
77 |
} |
|
78 |
|
|
79 |
public void setFlatVerticalExaggeration(double value) { |
|
80 |
this.propertyChangeSupport.firePropertyChange( |
|
81 |
FLAT_VERTICAL_EXAGGERATION_PROPERTY_NAME, flatVerticalExaggeration, |
|
82 |
value); |
|
83 |
this.flatVerticalExaggeration = value; |
|
84 |
} |
|
85 |
|
|
86 |
public void setNasaLandsatVisibility(boolean visibility) { |
|
87 |
this.propertyChangeSupport.firePropertyChange( |
|
88 |
NASA_LANDSAT_VISIBILITY_PROPERTY_NAME, showNasaLandsatLayer, |
|
89 |
visibility); |
|
90 |
this.showNasaLandsatLayer = visibility; |
|
91 |
} |
|
92 |
|
|
93 |
public void setSphereVerticalExaggeration(double value) { |
|
94 |
this.propertyChangeSupport.firePropertyChange( |
|
95 |
SPHERE_VERTICAL_EXAGGERATION_PROPERTY_NAME, sphereVerticalExaggeration, |
|
96 |
value); |
|
97 |
this.sphereVerticalExaggeration = value; |
|
98 |
} |
|
99 |
|
|
100 |
public void addPropertyChangeListener(PropertyChangeListener listener) { |
|
101 |
this.propertyChangeSupport.addPropertyChangeListener(listener); |
|
102 |
} |
|
103 |
|
|
104 |
public void removePropertyChangeListener(PropertyChangeListener listener) { |
|
105 |
this.propertyChangeSupport.removePropertyChangeListener(listener); |
|
106 |
} |
|
107 |
|
|
108 |
} |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.swing/org.gvsig.view3d.swing.api/src/main/java/org/gvsig/view3d/swing/api/properties/ViewProperties3DPanel.java | ||
---|---|---|
1 | 1 |
package org.gvsig.view3d.swing.api.properties; |
2 | 2 |
|
3 |
import org.gvsig.tools.swing.api.Component; |
|
4 |
|
|
3 | 5 |
/** |
4 | 6 |
* |
5 | 7 |
* @author <a href="mailto:lmarques@disid.com">Lluis Marques</a> |
6 | 8 |
* |
7 | 9 |
*/ |
8 |
public interface ViewProperties3DPanel { |
|
10 |
public interface ViewProperties3DPanel extends Component{
|
|
9 | 11 |
/** |
10 | 12 |
* |
11 | 13 |
* @return |
... | ... | |
40 | 42 |
* |
41 | 43 |
* @return |
42 | 44 |
*/ |
43 |
public double getVerticalExaggeration(); |
|
44 |
|
|
45 |
public double getFlatVerticalExaggeration(); |
|
46 |
|
|
47 |
/** |
|
48 |
* |
|
49 |
* @return |
|
50 |
*/ |
|
51 |
public double getSphereVerticalExaggeration(); |
|
45 | 52 |
} |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.swing/org.gvsig.view3d.swing.api/src/main/java/org/gvsig/view3d/swing/api/View3DSwingManager.java | ||
---|---|---|
29 | 29 |
import org.gvsig.fmap.mapcontext.MapContext; |
30 | 30 |
import org.gvsig.fmap.mapcontext.layers.ExtendedPropertiesSupport; |
31 | 31 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
32 |
import org.gvsig.view3d.lib.api.properties.MapControlProperties3D; |
|
32 | 33 |
import org.gvsig.view3d.swing.api.properties.LayerProperties3DPanel; |
33 | 34 |
import org.gvsig.view3d.swing.api.properties.ViewProperties3DPanel; |
34 | 35 |
|
... | ... | |
114 | 115 |
*/ |
115 | 116 |
public LayerProperties3DPanel createLayerProperties3DPanel(FLayer layer); |
116 | 117 |
|
118 |
/** |
|
119 |
* |
|
120 |
* @return |
|
121 |
*/ |
|
122 |
public ViewProperties3DPanel createViewProperties3DPanel( |
|
123 |
MapControlProperties3D properties); |
|
124 |
|
|
117 | 125 |
// TODO: Add methods to get properties panels. |
118 | 126 |
|
119 | 127 |
} |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.swing/org.gvsig.view3d.swing.api/src/main/java/org/gvsig/view3d/swing/api/MapControl3D.java | ||
---|---|---|
34 | 34 |
import org.gvsig.tools.observer.Observable; |
35 | 35 |
import org.gvsig.tools.swing.api.Component; |
36 | 36 |
import org.gvsig.tools.task.Cancellable; |
37 |
import org.gvsig.view3d.lib.api.properties.MapControlProperties3D; |
|
37 | 38 |
import org.gvsig.view3d.swing.api.View3DSwingManager.TYPE; |
38 | 39 |
|
39 | 40 |
/** |
... | ... | |
125 | 126 |
* |
126 | 127 |
*/ |
127 | 128 |
public TYPE getType(); |
129 |
|
|
130 |
/** |
|
131 |
* |
|
132 |
* @return |
|
133 |
*/ |
|
134 |
public MapControlProperties3D getProperties(); |
|
128 | 135 |
|
129 | 136 |
/** |
130 | 137 |
* Gets vertical exaggeration model of this <code>MapControl3D</code>. |
... | ... | |
211 | 218 |
public void reloadLayers(); |
212 | 219 |
|
213 | 220 |
/** |
214 |
* Sets MapContext and loads new MapContext layers. |
|
215 |
* |
|
216 |
* @see MapControl3D#getMapContext() |
|
217 |
*/ |
|
218 |
public void setMapContext(MapContext theMapContext); |
|
219 |
|
|
220 |
/** |
|
221 |
* Sets vertical exaggeration. |
|
222 |
* |
|
223 |
* @see MapControl3D#getVerticalExaggeration() |
|
224 |
*/ |
|
225 |
public void setVerticalExaggeration(double verticalExaggeration); |
|
226 |
|
|
227 |
/** |
|
228 | 221 |
* Shows Atmosphere layer. |
229 | 222 |
* |
230 | 223 |
* @see MapControl3D#hideAtmosphere() |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.swing/org.gvsig.view3d.swing.api/pom.xml | ||
---|---|---|
38 | 38 |
<groupId>org.gvsig</groupId> |
39 | 39 |
<artifactId>org.gvsig.tools.swing.api</artifactId> |
40 | 40 |
</dependency> |
41 |
<dependency> |
|
42 |
<groupId>org.gvsig</groupId> |
|
43 |
<artifactId>org.gvsig.view3d.lib.api</artifactId> |
|
44 |
</dependency> |
|
41 | 45 |
</dependencies> |
42 | 46 |
</project> |
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 | ||
---|---|---|
30 | 30 |
import org.gvsig.fmap.mapcontext.MapContext; |
31 | 31 |
import org.gvsig.fmap.mapcontext.layers.ExtendedPropertiesSupport; |
32 | 32 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
33 |
import org.gvsig.view3d.lib.api.properties.MapControlProperties3D; |
|
33 | 34 |
import org.gvsig.view3d.swing.api.MapControl3D; |
34 | 35 |
import org.gvsig.view3d.swing.api.View3DPanel; |
35 | 36 |
import org.gvsig.view3d.swing.api.View3DSwingManager; |
36 | 37 |
import org.gvsig.view3d.swing.api.properties.LayerProperties3DPanel; |
38 |
import org.gvsig.view3d.swing.api.properties.ViewProperties3DPanel; |
|
37 | 39 |
import org.gvsig.view3d.swing.impl.properties.DefaultLayerProperties3DPanel; |
40 |
import org.gvsig.view3d.swing.impl.properties.DefaultViewProperties3DPanel; |
|
38 | 41 |
import org.slf4j.Logger; |
39 | 42 |
import org.slf4j.LoggerFactory; |
40 | 43 |
|
... | ... | |
113 | 116 |
} |
114 | 117 |
return null; |
115 | 118 |
} |
119 |
|
|
120 |
public ViewProperties3DPanel createViewProperties3DPanel( |
|
121 |
MapControlProperties3D properties) { |
|
122 |
return new DefaultViewProperties3DPanel(properties); |
|
123 |
} |
|
124 |
|
|
116 | 125 |
} |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.swing/org.gvsig.view3d.swing.impl/src/main/java/org/gvsig/view3d/swing/impl/DefaultMapControl3D.java | ||
---|---|---|
32 | 32 |
import gov.nasa.worldwind.awt.WorldWindowGLJPanel; |
33 | 33 |
import gov.nasa.worldwind.globes.Earth; |
34 | 34 |
import gov.nasa.worldwind.globes.EarthFlat; |
35 |
import gov.nasa.worldwind.globes.ElevationModel; |
|
35 | 36 |
import gov.nasa.worldwind.globes.Globe; |
36 | 37 |
import gov.nasa.worldwind.layers.CompassLayer; |
37 | 38 |
import gov.nasa.worldwind.layers.Layer; |
... | ... | |
43 | 44 |
import gov.nasa.worldwind.layers.ViewControlsLayer; |
44 | 45 |
import gov.nasa.worldwind.layers.ViewControlsSelectListener; |
45 | 46 |
import gov.nasa.worldwind.layers.WorldMapLayer; |
47 |
import gov.nasa.worldwind.terrain.CompoundElevationModel; |
|
46 | 48 |
import gov.nasa.worldwind.util.StatusBar; |
47 | 49 |
import gov.nasa.worldwind.view.orbit.BasicOrbitView; |
48 | 50 |
import gov.nasa.worldwind.view.orbit.FlatOrbitView; |
49 | 51 |
|
50 | 52 |
import java.awt.BorderLayout; |
51 | 53 |
import java.awt.Dimension; |
52 |
import java.lang.reflect.Constructor;
|
|
53 |
import java.lang.reflect.InvocationTargetException;
|
|
54 |
import java.beans.PropertyChangeEvent;
|
|
55 |
import java.beans.PropertyChangeListener;
|
|
54 | 56 |
import java.util.HashMap; |
55 | 57 |
import java.util.List; |
56 | 58 |
import java.util.Map; |
... | ... | |
81 | 83 |
import org.gvsig.view3d.lib.api.View3DLocator; |
82 | 84 |
import org.gvsig.view3d.lib.api.View3DManager; |
83 | 85 |
import org.gvsig.view3d.lib.api.properties.LayerProperties3D; |
86 |
import org.gvsig.view3d.lib.api.properties.MapControlProperties3D; |
|
84 | 87 |
import org.gvsig.view3d.lib.api.properties.RasterLayerProperties3D; |
85 | 88 |
import org.gvsig.view3d.lib.api.properties.VectorialLayerProperties3D; |
86 | 89 |
import org.gvsig.view3d.swing.api.MapControl3D; |
... | ... | |
122 | 125 |
|
123 | 126 |
private MapContext mapContext; |
124 | 127 |
|
128 |
private MapControlProperties3D properties; |
|
129 |
|
|
125 | 130 |
private ExtendedPropertiesSupport viewProperties; |
126 | 131 |
|
127 | 132 |
private WorldWindowGLJPanel wwd; |
... | ... | |
173 | 178 |
LOG.info("Can't add MapControl layers", e); |
174 | 179 |
} |
175 | 180 |
|
176 |
addLayerCollectionListener(); |
|
181 |
addLayerCollectionListener(mapContext.getLayers()); |
|
182 |
|
|
183 |
View3DManager manager = View3DLocator.getManager(); |
|
184 |
this.properties = manager.getMapControl3DProperties(viewProperties); |
|
185 |
addChangePropertyListener(this.properties); |
|
186 |
setMapControl3DProperties(); |
|
177 | 187 |
} |
178 | 188 |
|
179 |
private void addLayerCollectionListener() { |
|
189 |
private void addChangePropertyListener(MapControlProperties3D properties) { |
|
190 |
properties.addPropertyChangeListener(new PropertyChangeListener() { |
|
180 | 191 |
|
181 |
if (this.mapContext == null || this.mapContext.getLayers() == null) { |
|
192 |
public void propertyChange(PropertyChangeEvent evt) { |
|
193 |
|
|
194 |
String propertyName = evt.getPropertyName(); |
|
195 |
|
|
196 |
if (MapControlProperties3D.SPHERE_VERTICAL_EXAGGERATION_PROPERTY_NAME |
|
197 |
.equals(propertyName) && getType() == TYPE.SPHERE) { |
|
198 |
setVerticalExaggeration((Double) evt.getNewValue()); |
|
199 |
|
|
200 |
} else if (MapControlProperties3D.FLAT_VERTICAL_EXAGGERATION_PROPERTY_NAME |
|
201 |
.equals(propertyName) && getType() == TYPE.FLAT) { |
|
202 |
setVerticalExaggeration((Double) evt.getNewValue()); |
|
203 |
|
|
204 |
} else if (MapControlProperties3D.BLUE_MARBEL_VISIBILITY_PROPERTY_NAME |
|
205 |
.equals(propertyName)) { |
|
206 |
boolean visibility = (Boolean) evt.getNewValue(); |
|
207 |
setBlueMarbelLayerVisibility(visibility); |
|
208 |
|
|
209 |
} else if (MapControlProperties3D.NASA_LANDSAT_VISIBILITY_PROPERTY_NAME |
|
210 |
.equals(propertyName)) { |
|
211 |
boolean visibility = (Boolean) evt.getNewValue(); |
|
212 |
setNasaLandsatLayerVisibility(visibility); |
|
213 |
|
|
214 |
} else if (MapControlProperties3D.DEFAULT_ELEVATION_VISIBILITY_PROPERTY_NAME |
|
215 |
.equals(propertyName)) { |
|
216 |
boolean visibility = (Boolean) evt.getNewValue(); |
|
217 |
setDefaultElevationVisibility(visibility); |
|
218 |
} |
|
219 |
} |
|
220 |
}); |
|
221 |
|
|
222 |
} |
|
223 |
|
|
224 |
private void addLayerCollectionListener(FLayers layers) { |
|
225 |
|
|
226 |
if (layers == null) { |
|
182 | 227 |
return; |
183 | 228 |
} |
184 | 229 |
|
185 |
this.mapContext.getLayers().addLayerCollectionListener( |
|
186 |
new LayerCollectionListener() { |
|
230 |
layers.addLayerCollectionListener(new LayerCollectionListener() { |
|
187 | 231 |
|
188 |
public void visibilityChanged(LayerCollectionEvent e)
|
|
189 |
throws CancelationException {
|
|
190 |
}
|
|
232 |
public void visibilityChanged(LayerCollectionEvent e) |
|
233 |
throws CancelationException { |
|
234 |
} |
|
191 | 235 |
|
192 |
public void layerRemoving(LayerCollectionEvent e)
|
|
193 |
throws CancelationException {
|
|
194 |
FLayer layer = e.getAffectedLayer();
|
|
195 |
removeGvSIGLayer(layer);
|
|
196 |
}
|
|
236 |
public void layerRemoving(LayerCollectionEvent e) |
|
237 |
throws CancelationException { |
|
238 |
FLayer layer = e.getAffectedLayer(); |
|
239 |
removeGvSIGLayer(layer); |
|
240 |
} |
|
197 | 241 |
|
198 |
public void layerRemoved(LayerCollectionEvent e) {
|
|
199 |
}
|
|
242 |
public void layerRemoved(LayerCollectionEvent e) { |
|
243 |
} |
|
200 | 244 |
|
201 |
public void layerMoving(LayerPositionEvent e)
|
|
202 |
throws CancelationException {
|
|
203 |
}
|
|
245 |
public void layerMoving(LayerPositionEvent e) |
|
246 |
throws CancelationException { |
|
247 |
} |
|
204 | 248 |
|
205 |
public void layerMoved(LayerPositionEvent e) {
|
|
206 |
int oldPos = e.getOldPos();
|
|
207 |
int newPos = e.getNewPos();
|
|
208 |
FLayer layer = e.getAffectedLayer();
|
|
249 |
public void layerMoved(LayerPositionEvent e) { |
|
250 |
int oldPos = e.getOldPos(); |
|
251 |
int newPos = e.getNewPos(); |
|
252 |
FLayer layer = e.getAffectedLayer(); |
|
209 | 253 |
|
210 |
LayerList layers = getWwd().getModel().getLayers();
|
|
211 |
Layer tileImageLayer = getTileImageLayer(layer);
|
|
212 |
int tiledIndex = layers.indexOf(tileImageLayer);
|
|
254 |
LayerList layers = getWwd().getModel().getLayers(); |
|
255 |
Layer tileImageLayer = getTileImageLayer(layer); |
|
256 |
int tiledIndex = layers.indexOf(tileImageLayer); |
|
213 | 257 |
|
214 |
layers.remove(tiledIndex);
|
|
215 |
layers.add(tiledIndex + (newPos - oldPos), tileImageLayer);
|
|
216 |
}
|
|
258 |
layers.remove(tiledIndex); |
|
259 |
layers.add(tiledIndex + (newPos - oldPos), tileImageLayer); |
|
260 |
} |
|
217 | 261 |
|
218 |
public void layerAdding(LayerCollectionEvent e)
|
|
219 |
throws CancelationException {
|
|
220 |
}
|
|
262 |
public void layerAdding(LayerCollectionEvent e) |
|
263 |
throws CancelationException { |
|
264 |
} |
|
221 | 265 |
|
222 |
public void layerAdded(LayerCollectionEvent e) {
|
|
223 |
FLayer layer = e.getAffectedLayer();
|
|
224 |
try {
|
|
225 |
addGvSIGLayer(layer);
|
|
226 |
} catch (BaseException ex) {
|
|
266 |
public void layerAdded(LayerCollectionEvent e) { |
|
267 |
FLayer layer = e.getAffectedLayer(); |
|
268 |
try { |
|
269 |
addGvSIGLayer(layer); |
|
270 |
} catch (BaseException ex) { |
|
227 | 271 |
LOG.info("Can't add layer {} from {} event", |
228 | 272 |
new Object[] { layer.getName(), e }, ex); |
229 |
} |
|
230 | 273 |
} |
231 |
}); |
|
274 |
} |
|
275 |
}); |
|
232 | 276 |
} |
233 | 277 |
|
234 | 278 |
private void addLayerListener(FLayer layer) { |
... | ... | |
254 | 298 |
} |
255 | 299 |
|
256 | 300 |
public void drawValueChanged(LayerEvent e) { |
257 |
// TODO Make configurable by properties |
|
258 |
FLayer layer = e.getSource(); |
|
259 |
if(layer.isAvailable()){ |
|
260 |
synchronizeLayers(); |
|
301 |
MapControlProperties3D properties = getProperties(); |
|
302 |
if (properties.getAutoLayerSynchronize()) { |
|
303 |
FLayer layer = e.getSource(); |
|
304 |
if (layer.isAvailable()) { |
|
305 |
synchronizeLayers(); |
|
306 |
} |
|
261 | 307 |
} |
262 | 308 |
} |
263 | 309 |
|
... | ... | |
273 | 319 |
} |
274 | 320 |
|
275 | 321 |
private void addGvSIGLayer(FLayer layer, int index) throws DataException { |
276 |
|
|
322 |
addLayerListener(layer); |
|
277 | 323 |
LayerConverter converter = new DefaultLayerConverter(); |
278 | 324 |
|
279 | 325 |
View3DManager manager = View3DLocator.getManager(); |
... | ... | |
281 | 327 |
|
282 | 328 |
if (layerProperties.getElevation() == false) { |
283 | 329 |
|
284 |
if ((layerProperties instanceof VectorialLayerProperties3D && |
|
285 |
((VectorialLayerProperties3D) layerProperties).getRasterized() == true)
|
|
330 |
if ((layerProperties instanceof VectorialLayerProperties3D && ((VectorialLayerProperties3D) layerProperties)
|
|
331 |
.getRasterized() == true) |
|
286 | 332 |
|| layerProperties instanceof RasterLayerProperties3D) { |
287 | 333 |
|
288 | 334 |
Layer rasterTiledLayer = converter.convertToLayer(this, layer); |
... | ... | |
317 | 363 |
} |
318 | 364 |
} |
319 | 365 |
}); |
320 |
|
|
366 |
|
|
321 | 367 |
getWwd().redraw(); |
322 | 368 |
} |
323 | 369 |
|
370 |
protected void setBlueMarbelLayerVisibility(boolean visibility) { |
|
371 |
if (visibility) { |
|
372 |
showWWLayer("Blue Marble May 2004"); |
|
373 |
} else { |
|
374 |
hideWWLayer("Blue Marble May 2004"); |
|
375 |
} |
|
376 |
} |
|
377 |
|
|
378 |
protected void setDefaultElevationVisibility(boolean visibility) { |
|
379 |
|
|
380 |
ElevationModel elevationModel = |
|
381 |
getWwd().getModel().getGlobe().getElevationModel(); |
|
382 |
if (elevationModel instanceof CompoundElevationModel) { |
|
383 |
CompoundElevationModel compoundElevationModel = |
|
384 |
(CompoundElevationModel) elevationModel; |
|
385 |
|
|
386 |
List<ElevationModel> elevationModels = |
|
387 |
compoundElevationModel.getElevationModels(); |
|
388 |
|
|
389 |
for (ElevationModel eModel : elevationModels) { |
|
390 |
if (eModel.getName().equals("USA 10m, World 30m, Ocean 900m")) { |
|
391 |
eModel.setEnabled(visibility); |
|
392 |
} |
|
393 |
} |
|
394 |
|
|
395 |
} else { |
|
396 |
elevationModel.setEnabled(visibility); |
|
397 |
} |
|
398 |
|
|
399 |
} |
|
400 |
|
|
401 |
protected void setNasaLandsatLayerVisibility(boolean visibility) { |
|
402 |
if (visibility) { |
|
403 |
showWWLayer("i-cubed Landsat"); |
|
404 |
} else { |
|
405 |
hideWWLayer("i-cubed Landsat"); |
|
406 |
} |
|
407 |
} |
|
408 |
|
|
324 | 409 |
@SuppressWarnings("rawtypes") |
325 |
private void addWWLayer(Class layerClazz) throws InstantiationException, |
|
326 |
IllegalAccessException, IllegalArgumentException, |
|
327 |
InvocationTargetException { |
|
410 |
private void showWWLayer(Class layerClazz) { |
|
328 | 411 |
LayerList layerList = getWwd().getModel().getLayers(); |
329 | 412 |
|
330 |
if (isAlreadyAdded(layerList, layerClazz)) {
|
|
331 |
return;
|
|
413 |
for (Layer layer : layerList) {
|
|
414 |
layer.setEnabled(true);
|
|
332 | 415 |
} |
416 |
}; |
|
333 | 417 |
|
334 |
Constructor[] constructors = layerClazz.getConstructors(); |
|
335 |
for (int i = 0; i < constructors.length; i++) { |
|
336 |
if (constructors[i].getParameterTypes().length == 0) { |
|
337 |
layerList.add((Layer) constructors[i].newInstance()); |
|
338 |
} |
|
418 |
private void showWWLayer(String layerName) { |
|
419 |
Layer layer = getWwd().getModel().getLayers().getLayerByName(layerName); |
|
420 |
if (layer != null) { |
|
421 |
layer.setEnabled(true); |
|
339 | 422 |
} |
340 |
} |
|
423 |
};
|
|
341 | 424 |
|
342 | 425 |
private void addNavigation() { |
343 | 426 |
|
... | ... | |
471 | 554 |
} |
472 | 555 |
|
473 | 556 |
public void hideAtmosphere() { |
474 |
hideLayer(SkyGradientLayer.class); |
|
557 |
hideWWLayer(SkyGradientLayer.class);
|
|
475 | 558 |
} |
476 | 559 |
|
477 | 560 |
@SuppressWarnings("rawtypes") |
478 |
private void hideLayer(Class layerClazz) { |
|
561 |
private void hideWWLayer(Class layerClazz) {
|
|
479 | 562 |
LayerList layers = getWwd().getModel().getLayers(); |
480 | 563 |
List<Layer> layersByClass = layers.getLayersByClass(layerClazz); |
481 |
layers.removeAll(layersByClass); |
|
564 |
for (Layer layer : layersByClass) { |
|
565 |
layer.setEnabled(false); |
|
566 |
} |
|
482 | 567 |
} |
483 | 568 |
|
569 |
private void hideWWLayer(String layerName) { |
|
570 |
LayerList layers = getWwd().getModel().getLayers(); |
|
571 |
Layer layerByName = layers.getLayerByName(layerName); |
|
572 |
if (layerByName != null) { |
|
573 |
layerByName.setEnabled(false); |
|
574 |
} |
|
575 |
} |
|
576 |
|
|
484 | 577 |
public void hideMiniMap() { |
485 |
hideLayer(WorldMapLayer.class); |
|
578 |
hideWWLayer(WorldMapLayer.class);
|
|
486 | 579 |
} |
487 | 580 |
|
488 | 581 |
public void hideNorthIndicator() { |
489 |
hideLayer(CompassLayer.class); |
|
582 |
hideWWLayer(CompassLayer.class);
|
|
490 | 583 |
} |
491 | 584 |
|
492 | 585 |
public void hideScale() { |
493 |
hideLayer(ScalebarLayer.class); |
|
586 |
hideWWLayer(ScalebarLayer.class);
|
|
494 | 587 |
} |
495 | 588 |
|
496 | 589 |
public void hideStarBackground() { |
497 |
hideLayer(StarsLayer.class); |
|
590 |
hideWWLayer(StarsLayer.class);
|
|
498 | 591 |
} |
499 | 592 |
|
500 | 593 |
private void intializeWWPanel() { |
... | ... | |
512 | 605 |
addNavigation(); |
513 | 606 |
} |
514 | 607 |
|
515 |
private boolean isAlreadyAdded(LayerList layerList, |
|
516 |
@SuppressWarnings("rawtypes") Class clazz) { |
|
517 |
|
|
518 |
List<Layer> layersByClass = layerList.getLayersByClass(clazz); |
|
519 |
|
|
520 |
return layersByClass.size() > 0; |
|
521 |
} |
|
522 |
|
|
523 | 608 |
public void reloadLayers() { |
524 | 609 |
getWwd().getModel().getLayers().removeAll(); |
525 | 610 |
|
... | ... | |
540 | 625 |
FlatOrbitView.class.getName()); |
541 | 626 |
} |
542 | 627 |
|
543 |
public void setMapContext(MapContext theMapContext) { |
|
544 |
this.mapContext = theMapContext; |
|
628 |
private void setMapControl3DProperties() { |
|
629 |
|
|
630 |
double verticalExaggeration = 0; |
|
631 |
if (getType() == TYPE.SPHERE) { |
|
632 |
verticalExaggeration = |
|
633 |
this.properties.getSphereVerticalExaggeration(); |
|
634 |
} else if (getType() == TYPE.FLAT) { |
|
635 |
verticalExaggeration = |
|
636 |
this.properties.getFlatVerticalExaggeration(); |
|
637 |
} |
|
638 |
setVerticalExaggeration(verticalExaggeration); |
|
639 |
|
|
640 |
boolean visibility = this.properties.getBlueMarbleLayerVisibility(); |
|
641 |
setBlueMarbelLayerVisibility(visibility); |
|
642 |
|
|
643 |
visibility = this.properties.getNasaLandsatLayerVisibility(); |
|
644 |
setNasaLandsatLayerVisibility(visibility); |
|
645 |
|
|
646 |
visibility = this.properties.getDefaultElevationVisibility(); |
|
647 |
setDefaultElevationVisibility(visibility); |
|
545 | 648 |
} |
546 | 649 |
|
547 | 650 |
private void setSpherePanelConfiguration() { |
... | ... | |
556 | 659 |
} |
557 | 660 |
|
558 | 661 |
public void showAtmosphere() { |
559 |
try { |
|
560 |
Globe globe = getWwd().getModel().getGlobe(); |
|
561 |
if (globe instanceof Earth) { |
|
562 |
addWWLayer(SkyGradientLayer.class); |
|
563 |
} else if (globe instanceof EarthFlat) { |
|
564 |
addWWLayer(SkyColorLayer.class); |
|
565 |
} |
|
566 |
} catch (Exception e) { |
|
567 |
LOG.warn("Can't add {} or {} to {}", |
|
568 |
new Object[] { SkyGradientLayer.class.getCanonicalName(), |
|
569 |
SkyColorLayer.class.getCanonicalName(), |
|
570 |
getWwd().getModel().toString() }, e); |
|
662 |
Globe globe = getWwd().getModel().getGlobe(); |
|
663 |
if (globe instanceof Earth) { |
|
664 |
showWWLayer(SkyGradientLayer.class); |
|
665 |
} else if (globe instanceof EarthFlat) { |
|
666 |
showWWLayer(SkyColorLayer.class); |
|
571 | 667 |
} |
572 | 668 |
} |
573 | 669 |
|
574 | 670 |
public void showMiniMap() { |
575 |
try { |
|
576 |
addWWLayer(WorldMapLayer.class); |
|
577 |
} catch (Exception e) { |
|
578 |
LOG.warn("Can't add {} to {}", |
|
579 |
new Object[] { WorldMapLayer.class.getCanonicalName(), |
|
580 |
getWwd().getModel().toString() }, e); |
|
581 |
} |
|
671 |
showWWLayer(WorldMapLayer.class); |
|
582 | 672 |
} |
583 | 673 |
|
584 | 674 |
public void showNortIndicator() { |
585 |
try { |
|
586 |
addWWLayer(CompassLayer.class); |
|
587 |
} catch (Exception e) { |
|
588 |
LOG.warn("Can't add {} to {}", |
|
589 |
new Object[] { CompassLayer.class.getCanonicalName(), |
|
590 |
getWwd().getModel().toString() }, e); |
|
591 |
} |
|
675 |
showWWLayer(CompassLayer.class); |
|
592 | 676 |
} |
593 | 677 |
|
594 | 678 |
public void showScale() { |
595 |
try { |
|
596 |
addWWLayer(ScalebarLayer.class); |
|
597 |
} catch (Exception e) { |
|
598 |
LOG.warn("Can't add {} to {}", |
|
599 |
new Object[] { ScalebarLayer.class.getCanonicalName(), |
|
600 |
getWwd().getModel().toString() }, e); |
|
601 |
} |
|
679 |
showWWLayer(ScalebarLayer.class); |
|
602 | 680 |
} |
603 | 681 |
|
604 | 682 |
public void showStarBackgroundLayer() { |
605 |
try { |
|
606 |
addWWLayer(StarsLayer.class); |
|
607 |
} catch (Exception e) { |
|
608 |
LOG.warn("Can't add {} to {}", |
|
609 |
new Object[] { StarsLayer.class.getCanonicalName(), |
|
610 |
getWwd().getModel().toString() }, e); |
|
611 |
} |
|
683 |
showWWLayer(StarsLayer.class); |
|
612 | 684 |
} |
613 | 685 |
|
614 | 686 |
public void synchronizeLayers() { |
615 |
|
|
687 |
|
|
616 | 688 |
for (FLayer layer : drawLayerStatus.keySet()) { |
617 | 689 |
if (layer instanceof FLyrDefault) { |
618 | 690 |
FLyrDefault defaultLayer = (FLyrDefault) layer; |
619 |
|
|
691 |
|
|
620 | 692 |
if (defaultLayer.hasChangedForDrawing(drawLayerStatus |
621 | 693 |
.get(layer))) { |
622 | 694 |
replaceGvSIGLayer(defaultLayer); |
... | ... | |
640 | 712 |
} |
641 | 713 |
|
642 | 714 |
private void replaceGvSIGLayer(FLayer layer) { |
643 |
// Remove layer without update drawLayerStatus map.
|
|
715 |
// Remove layer without update drawLayerStatus map. |
|
644 | 716 |
List<Layer> loadedLayers = getWwd().getModel().getLayers(); |
645 | 717 |
Layer tiledImageLayer = getTileImageLayer(layer); |
646 | 718 |
|
... | ... | |
659 | 731 |
LOG.error("Can't add {} at {}", new Object[] { layer.getName(), |
660 | 732 |
layerIndex }, e); |
661 | 733 |
} |
662 |
}
|
|
734 |
} |
|
663 | 735 |
} |
664 | 736 |
|
665 | 737 |
public void synchronizeViewPorts() { |
... | ... | |
687 | 759 |
} |
688 | 760 |
|
689 | 761 |
public boolean isAtmosphereVisible() { |
690 |
LayerList layerList = getWwd().getModel().getLayers(); |
|
691 |
if (isAlreadyAdded(layerList, SkyGradientLayer.class) |
|
692 |
|| isAlreadyAdded(layerList, SkyColorLayer.class)) { |
|
762 |
if (isWWLayerVisible(SkyGradientLayer.class) |
|
763 |
|| isWWLayerVisible(SkyColorLayer.class)) { |
|
693 | 764 |
return true; |
694 | 765 |
} |
695 | 766 |
return false; |
696 | 767 |
} |
697 | 768 |
|
698 | 769 |
public boolean isMinimapVisible() { |
699 |
LayerList layerList = getWwd().getModel().getLayers(); |
|
700 |
if (isAlreadyAdded(layerList, WorldMapLayer.class)) { |
|
770 |
if (isWWLayerVisible(WorldMapLayer.class)) { |
|
701 | 771 |
return true; |
702 | 772 |
} |
703 | 773 |
return false; |
704 | 774 |
} |
705 | 775 |
|
706 | 776 |
public boolean isNorthIndicatorVisible() { |
707 |
LayerList layerList = getWwd().getModel().getLayers(); |
|
708 |
if (isAlreadyAdded(layerList, CompassLayer.class)) { |
|
777 |
if (isWWLayerVisible(CompassLayer.class)) { |
|
709 | 778 |
return true; |
710 | 779 |
} |
711 | 780 |
return false; |
712 | 781 |
} |
713 | 782 |
|
714 | 783 |
public boolean isStartBackgroundVisible() { |
715 |
LayerList layerList = getWwd().getModel().getLayers(); |
|
716 |
if (isAlreadyAdded(layerList, StarsLayer.class)) { |
|
784 |
if (isWWLayerVisible(StarsLayer.class)) { |
|
717 | 785 |
return true; |
718 | 786 |
} |
719 | 787 |
return false; |
720 | 788 |
} |
721 | 789 |
|
722 | 790 |
public boolean isScaleVisible() { |
723 |
LayerList layerList = getWwd().getModel().getLayers(); |
|
724 |
if (isAlreadyAdded(layerList, ScalebarLayer.class)) { |
|
791 |
if (isWWLayerVisible(ScalebarLayer.class)) { |
|
725 | 792 |
return true; |
726 | 793 |
} |
727 | 794 |
return false; |
728 | 795 |
} |
796 |
|
|
797 |
@SuppressWarnings("rawtypes") |
|
798 |
private boolean isWWLayerVisible(Class clazz) { |
|
799 |
List<Layer> layersByClass = |
|
800 |
getWwd().getModel().getLayers().getLayersByClass(clazz); |
|
801 |
for (Layer layer : layersByClass) { |
|
802 |
return layer.isEnabled(); |
|
803 |
} |
|
804 |
return false; |
|
805 |
} |
|
806 |
|
|
807 |
public MapControlProperties3D getProperties() { |
|
808 |
return properties; |
|
809 |
} |
|
729 | 810 |
} |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.swing/org.gvsig.view3d.swing.impl/src/main/java/org/gvsig/view3d/swing/impl/properties/DefaultViewProperties3DPanel.java | ||
---|---|---|
1 |
package org.gvsig.view3d.swing.impl.properties; |
|
2 |
|
|
3 |
import javax.swing.JComponent; |
|
4 |
|
|
5 |
import org.gvsig.view3d.lib.api.properties.MapControlProperties3D; |
|
6 |
|
|
7 |
public class DefaultViewProperties3DPanel extends AbstractViewProperties3DPanel { |
|
8 |
|
|
9 |
private static final long serialVersionUID = -3563717730935555229L; |
|
10 |
|
|
11 |
private MapControlProperties3D properties; |
|
12 |
|
|
13 |
public DefaultViewProperties3DPanel(MapControlProperties3D theProperties) { |
|
14 |
super(); |
|
15 |
|
|
16 |
this.properties = theProperties; |
|
17 |
|
|
18 |
fillPanel(); |
|
19 |
} |
|
20 |
|
|
21 |
private void fillPanel() { |
|
22 |
|
|
23 |
getSphereVerticalExaggerationField().setText( |
|
24 |
String.valueOf(properties.getSphereVerticalExaggeration())); |
|
25 |
|
|
26 |
getFlatVerticalExaggerationField().setText( |
|
27 |
String.valueOf(properties.getFlatVerticalExaggeration())); |
|
28 |
|
|
29 |
getAutoLayerSynchronizeCheckBox().setSelected( |
|
30 |
properties.getAutoLayerSynchronize()); |
|
31 |
getAutoViewPortSynchronizeCheckBox().setSelected( |
|
32 |
properties.getAutoViewSynchronize()); |
|
33 |
getShowBlueMarbleLayerCheckBox().setSelected( |
|
34 |
properties.getBlueMarbleLayerVisibility()); |
|
35 |
getShowNasaLandsatLayerCheckBox().setSelected( |
|
36 |
properties.getNasaLandsatLayerVisibility()); |
|
37 |
getShowDefaultElevationCheckBox().setSelected( |
|
38 |
properties.getDefaultElevationVisibility()); |
|
39 |
} |
|
40 |
|
|
41 |
public JComponent asJComponent() { |
|
42 |
return this; |
|
43 |
} |
|
44 |
|
|
45 |
public boolean getAutoLayerSynchronize() { |
|
46 |
return getAutoLayerSynchronizeCheckBox().isSelected(); |
|
47 |
} |
|
48 |
|
|
49 |
public boolean getAutoViewPortSynchronize() { |
|
50 |
return getAutoViewPortSynchronizeCheckBox().isSelected(); |
|
51 |
} |
|
52 |
|
|
53 |
public boolean getShowBlueMarble() { |
|
54 |
return getShowBlueMarbleLayerCheckBox().isSelected(); |
|
55 |
} |
|
56 |
|
|
57 |
public boolean getShowDefaultElevation() { |
|
58 |
return getShowDefaultElevationCheckBox().isSelected(); |
|
59 |
} |
|
60 |
|
|
61 |
public boolean getShowNasaLandsat() { |
|
62 |
return getShowNasaLandsatLayerCheckBox().isSelected(); |
|
63 |
} |
|
64 |
|
|
65 |
public double getFlatVerticalExaggeration() { |
|
66 |
return Double.valueOf(getFlatVerticalExaggerationField().getText()); |
|
67 |
} |
|
68 |
|
|
69 |
public double getSphereVerticalExaggeration() { |
|
70 |
return Double.valueOf(getSphereVerticalExaggerationField().getText()); |
|
71 |
} |
|
72 |
|
|
73 |
} |
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 | ||
---|---|---|
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 |
|
|
42 |
public AbstractViewProperties3DPanel() { |
|
43 |
super(new BorderLayout()); |
|
44 |
|
|
45 |
initialize(); |
|
46 |
} |
|
47 |
|
|
48 |
private void initialize() { |
|
49 |
this.add(getCenterPanel(), BorderLayout.NORTH); |
|
50 |
} |
|
51 |
|
|
52 |
private Component getCenterPanel() { |
|
53 |
if (propertiesPanel == null) { |
|
54 |
propertiesPanel = new JPanel(new GridBagLayout()); |
|
55 |
|
|
56 |
GridBagConstraints cons = new GridBagConstraints(); |
|
57 |
cons.gridy = 0; |
|
58 |
cons.gridx = 0; |
|
59 |
cons.weightx = 0; |
|
60 |
cons.anchor = GridBagConstraints.WEST; |
|
61 |
cons.insets = insets; |
|
62 |
|
|
63 |
propertiesPanel.add(getSphereVerticalExaggerationText(), cons); |
|
64 |
|
|
65 |
cons = new GridBagConstraints(); |
|
66 |
cons.gridy = 0; |
|
67 |
cons.gridx = 1; |
|
68 |
cons.weightx = 1; |
|
69 |
cons.fill = GridBagConstraints.HORIZONTAL; |
|
70 |
cons.insets = insets; |
|
71 |
|
|
72 |
propertiesPanel.add(getSphereVerticalExaggerationField(), cons); |
|
73 |
|
|
74 |
cons = new GridBagConstraints(); |
|
75 |
cons.gridy = 1; |
|
76 |
cons.gridx = 0; |
|
77 |
cons.weightx = 0; |
|
78 |
cons.anchor = GridBagConstraints.WEST; |
|
79 |
cons.insets = insets; |
|
80 |
|
|
81 |
propertiesPanel.add(getFlatVerticalExaggerationText(), cons); |
|
82 |
|
|
83 |
cons = new GridBagConstraints(); |
|
84 |
cons.gridy = 1; |
|
85 |
cons.gridx = 1; |
|
86 |
cons.weightx = 1; |
|
87 |
cons.fill = GridBagConstraints.HORIZONTAL; |
|
88 |
cons.insets = insets; |
|
89 |
|
|
90 |
propertiesPanel.add(getFlatVerticalExaggerationField(), cons); |
|
91 |
|
|
92 |
cons = new GridBagConstraints(); |
|
93 |
cons.gridy = 2; |
|
94 |
cons.gridx = 0; |
|
95 |
cons.weightx = 0; |
|
96 |
cons.anchor = GridBagConstraints.WEST; |
|
97 |
cons.insets = insets; |
|
98 |
|
|
99 |
propertiesPanel.add(getAutoLayerSynchronizeText(), cons); |
|
100 |
|
|
101 |
cons = new GridBagConstraints(); |
|
102 |
cons.gridy = 2; |
|
103 |
cons.gridx = 1; |
|
104 |
cons.weightx = 1; |
|
105 |
cons.insets = insets; |
|
106 |
|
|
107 |
propertiesPanel.add(getAutoLayerSynchronizeCheckBox(), cons); |
|
108 |
|
|
109 |
cons = new GridBagConstraints(); |
|
110 |
cons.gridy = 3; |
|
111 |
cons.gridx = 0; |
|
112 |
cons.weightx = 0; |
|
113 |
cons.anchor = GridBagConstraints.WEST; |
|
114 |
cons.insets = insets; |
|
115 |
|
|
116 |
propertiesPanel.add(getAutoViewPortSynchronizeText(), cons); |
|
117 |
|
|
118 |
cons = new GridBagConstraints(); |
|
119 |
cons.gridy = 3; |
|
120 |
cons.gridx = 1; |
|
121 |
cons.weightx = 1; |
|
122 |
cons.insets = insets; |
|
123 |
|
|
124 |
propertiesPanel.add(getAutoViewPortSynchronizeCheckBox(), cons); |
|
125 |
|
|
126 |
cons = new GridBagConstraints(); |
|
127 |
cons.gridy = 4; |
|
128 |
cons.gridx = 0; |
|
129 |
cons.weightx = 0; |
|
130 |
cons.anchor = GridBagConstraints.WEST; |
|
131 |
cons.insets = insets; |
|
132 |
|
|
133 |
propertiesPanel.add(getShowBlueMarbleLayerText(), cons); |
|
134 |
|
|
135 |
cons = new GridBagConstraints(); |
|
136 |
cons.gridy = 4; |
|
137 |
cons.gridx = 1; |
|
138 |
cons.weightx = 1; |
|
139 |
cons.insets = insets; |
|
140 |
|
|
141 |
propertiesPanel.add(getShowBlueMarbleLayerCheckBox(), cons); |
|
142 |
|
|
143 |
cons = new GridBagConstraints(); |
|
144 |
cons.gridy = 5; |
|
145 |
cons.gridx = 0; |
|
146 |
cons.weightx = 0; |
|
147 |
cons.anchor = GridBagConstraints.WEST; |
|
148 |
cons.insets = insets; |
|
149 |
|
|
150 |
propertiesPanel.add(getShowNasaLandsatLayerText(), cons); |
|
151 |
|
|
152 |
cons = new GridBagConstraints(); |
|
153 |
cons.gridy = 5; |
|
154 |
cons.gridx = 1; |
|
155 |
cons.weightx = 1; |
|
156 |
cons.insets = insets; |
|
157 |
|
|
158 |
propertiesPanel.add(getShowNasaLandsatLayerCheckBox(), cons); |
|
159 |
|
|
160 |
cons = new GridBagConstraints(); |
|
161 |
cons.gridy = 6; |
|
162 |
cons.gridx = 0; |
|
163 |
cons.weightx = 0; |
|
164 |
cons.anchor = GridBagConstraints.WEST; |
|
165 |
cons.insets = insets; |
|
166 |
|
|
167 |
propertiesPanel.add(getShowDefaultElevationText(), cons); |
|
168 |
|
|
169 |
cons = new GridBagConstraints(); |
|
170 |
cons.gridx = 6; |
|
171 |
cons.gridx = 1; |
|
172 |
cons.weightx = 1; |
|
173 |
cons.insets = insets; |
|
174 |
|
|
175 |
propertiesPanel.add(getShowDefaultElevationCheckBox(), cons); |
|
176 |
} |
|
177 |
return propertiesPanel; |
|
178 |
} |
|
179 |
|
|
180 |
protected JLabel getFlatVerticalExaggerationText() { |
|
181 |
if (flatVerticalExaggerationText == null) { |
|
182 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
183 |
flatVerticalExaggerationText = |
|
184 |
new JLabel( |
|
185 |
i18nManager.getTranslation("flat_vertical_exaggeration")); |
|
186 |
} |
|
187 |
return flatVerticalExaggerationText; |
|
188 |
} |
|
189 |
|
|
190 |
protected JTextField getFlatVerticalExaggerationField() { |
|
191 |
if (flatVerticalExaggeration == null) { |
|
192 |
flatVerticalExaggeration = new JTextField(); |
|
193 |
} |
|
194 |
return flatVerticalExaggeration; |
|
195 |
} |
|
196 |
|
|
197 |
private JLabel getSphereVerticalExaggerationText() { |
|
198 |
if (sphereVerticalExaggerationText == null) { |
|
199 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
200 |
sphereVerticalExaggerationText = |
|
201 |
new JLabel( |
|
202 |
i18nManager.getTranslation("sphere_vertical_exaggeration")); |
|
203 |
} |
|
204 |
return sphereVerticalExaggerationText; |
|
205 |
} |
|
206 |
|
|
207 |
protected JTextField getSphereVerticalExaggerationField() { |
Also available in: Unified diff