Revision 525
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.lib/org.gvsig.view3d.lib.impl/src/main/java/org/gvsig/view3d/lib/impl/DefaultView3DLibrary.java | ||
---|---|---|
25 | 25 |
package org.gvsig.view3d.lib.impl; |
26 | 26 |
|
27 | 27 |
import org.gvsig.fmap.dal.DALLibrary; |
28 |
import org.gvsig.tools.ToolsLocator; |
|
28 | 29 |
import org.gvsig.tools.library.AbstractLibrary; |
29 | 30 |
import org.gvsig.tools.library.LibraryException; |
31 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
30 | 32 |
import org.gvsig.view3d.lib.api.View3DLibrary; |
31 | 33 |
import org.gvsig.view3d.lib.api.View3DLocator; |
32 |
import org.gvsig.view3d.lib.impl.properties.BasicLayerProperties3D;
|
|
33 |
import org.gvsig.view3d.lib.impl.properties.DefaultRasterLayerProperties3D;
|
|
34 |
import org.gvsig.view3d.lib.impl.properties.DefaultVectorialLayerProperties3D;
|
|
34 |
import org.gvsig.view3d.lib.impl.properties.LayerProperties3DPersistenceFactory;
|
|
35 |
import org.gvsig.view3d.lib.impl.properties.RasterLayerProperties3DPersistenceFactory;
|
|
36 |
import org.gvsig.view3d.lib.impl.properties.VectorialLayerProperties3DPersistenceFactory;
|
|
35 | 37 |
|
36 | 38 |
/** |
37 | 39 |
* @author <a href="mailto:lmarques@disid.com">Lluis Marques</a> |
... | ... | |
54 | 56 |
} |
55 | 57 |
|
56 | 58 |
private void registerPersistence() { |
57 |
BasicLayerProperties3D.registerPersistence(); |
|
58 |
DefaultVectorialLayerProperties3D.registerPersistence(); |
|
59 |
DefaultRasterLayerProperties3D.registerPersistence(); |
|
59 |
PersistenceManager persistenceManager = |
|
60 |
ToolsLocator.getPersistenceManager(); |
|
61 |
persistenceManager |
|
62 |
.registerFactory(new LayerProperties3DPersistenceFactory()); |
|
63 |
persistenceManager |
|
64 |
.registerFactory(new VectorialLayerProperties3DPersistenceFactory()); |
|
65 |
persistenceManager |
|
66 |
.registerFactory(new RasterLayerProperties3DPersistenceFactory()); |
|
60 | 67 |
} |
61 | 68 |
|
62 | 69 |
@Override |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.lib/org.gvsig.view3d.lib.impl/src/main/java/org/gvsig/view3d/lib/impl/properties/BasicLayerProperties3D.java | ||
---|---|---|
4 | 4 |
import org.gvsig.fmap.mapcontext.layers.FLyrDefault; |
5 | 5 |
import org.gvsig.fmap.mapcontext.layers.LayerEvent; |
6 | 6 |
import org.gvsig.fmap.mapcontext.layers.LayerListener; |
7 |
import org.gvsig.tools.ToolsLocator; |
|
8 |
import org.gvsig.tools.dynobject.DynStruct; |
|
9 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
10 |
import org.gvsig.tools.persistence.PersistentState; |
|
11 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
12 | 7 |
import org.gvsig.view3d.lib.api.properties.LayerProperties3D; |
13 | 8 |
|
14 | 9 |
|
... | ... | |
102 | 97 |
fireDrawValueChangedEvent("tileWidth"); |
103 | 98 |
} |
104 | 99 |
|
105 |
public static void registerPersistence(){ |
|
106 |
// Basic layer 3D properties |
|
107 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
108 |
DynStruct definition = |
|
109 |
manager.addDefinition(BasicLayerProperties3D.class, |
|
110 |
LayerProperties3D.PERSISTENCE_NAME, |
|
111 |
"Basic layer 3D properties persistence definition", null, null); |
|
112 |
|
|
113 |
definition.addDynFieldBoolean("elevation"); |
|
114 |
definition.addDynFieldString("elevationUnits"); |
|
115 |
definition.addDynFieldDouble("lezelZeroResolutionMultiPlier"); |
|
116 |
definition.addDynFieldInt("maxLevel"); |
|
117 |
definition.addDynFieldInt("minLevel"); |
|
118 |
definition.addDynFieldDouble("noDataValue"); |
|
119 |
definition.addDynFieldInt("tileHeight"); |
|
120 |
definition.addDynFieldInt("tileWidth"); |
|
121 |
} |
|
122 |
|
|
123 |
public void saveToState(PersistentState state) throws PersistenceException { |
|
124 |
|
|
125 |
state.set("elevation", getElevation()); |
|
126 |
state.set("elevationUnits", getElevationUnits()); |
|
127 |
state.set("lezelZeroResolutionMultiPlier",getLevelZeroResolutionMultiplier()); |
|
128 |
state.set("maxLevel",getMaxLevel()); |
|
129 |
state.set("minLevel",getMinLevel()); |
|
130 |
state.set("noDataValue",getNoDataValue()); |
|
131 |
state.set("tileHeight",getTileHeight()); |
|
132 |
state.set("tileWidth",getTileWidth()); |
|
133 |
|
|
134 |
} |
|
135 |
|
|
136 |
public void loadFromState(PersistentState state) |
|
137 |
throws PersistenceException { |
|
138 |
|
|
139 |
setElevation(state.getBoolean("elevation")); |
|
140 |
setElevationUnits(state.getString("elevationUnits")); |
|
141 |
setLevelZeroResolutionMultiplier(state.getDouble("lezelZeroResolutionMultiPlier")); |
|
142 |
setMaxLevel(state.getInt("maxLevel")); |
|
143 |
setMinLevel(state.getInt("minLevel")); |
|
144 |
setNoDataValue(state.getDouble("noDataValue")); |
|
145 |
setTileHeight(state.getInt("tileHeight")); |
|
146 |
setTileWidth(state.getInt("tileWidth")); |
|
147 |
} |
|
148 |
|
|
149 | 100 |
protected void fireDrawValueChangedEvent(String property) { |
150 | 101 |
LayerListener[] layerListeners = this.layer.getLayerListeners(); |
151 | 102 |
for (int i = 0; i < layerListeners.length; i++) { |
... | ... | |
154 | 105 |
property)); |
155 | 106 |
} |
156 | 107 |
} |
108 |
|
|
109 |
public FLayer getLayer() { |
|
110 |
return this.layer; |
|
111 |
} |
|
112 |
|
|
113 |
public void setLayer(FLayer theLayer) { |
|
114 |
this.layer = theLayer; |
|
115 |
} |
|
157 | 116 |
} |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.lib/org.gvsig.view3d.lib.impl/src/main/java/org/gvsig/view3d/lib/impl/properties/DefaultRasterLayerProperties3D.java | ||
---|---|---|
1 | 1 |
package org.gvsig.view3d.lib.impl.properties; |
2 | 2 |
|
3 | 3 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
4 |
import org.gvsig.tools.ToolsLocator; |
|
5 |
import org.gvsig.tools.dynobject.DynStruct; |
|
6 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
7 |
import org.gvsig.view3d.lib.api.properties.LayerProperties3D; |
|
8 | 4 |
import org.gvsig.view3d.lib.api.properties.RasterLayerProperties3D; |
9 | 5 |
|
10 | 6 |
public class DefaultRasterLayerProperties3D extends BasicLayerProperties3D |
... | ... | |
13 | 9 |
public DefaultRasterLayerProperties3D(FLayer theLayer) { |
14 | 10 |
super(theLayer); |
15 | 11 |
} |
16 |
|
|
17 |
public static void registerPersistence(){ |
|
18 |
// Raster layer 3D properties |
|
19 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
20 |
|
|
21 |
DynStruct definition = |
|
22 |
manager |
|
23 |
.addDefinition(DefaultRasterLayerProperties3D.class, |
|
24 |
RasterLayerProperties3D.PERSISTENCE_NAME, |
|
25 |
"Raster layer 3D properties persistence definition", null, |
|
26 |
null); |
|
27 |
|
|
28 |
definition.extend(manager |
|
29 |
.getDefinition(LayerProperties3D.PERSISTENCE_NAME)); |
|
30 |
} |
|
31 | 12 |
} |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.lib/org.gvsig.view3d.lib.impl/src/main/java/org/gvsig/view3d/lib/impl/properties/VectorialLayerProperties3DPersistenceFactory.java | ||
---|---|---|
1 |
package org.gvsig.view3d.lib.impl.properties; |
|
2 |
|
|
3 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
4 |
import org.gvsig.tools.ToolsLocator; |
|
5 |
import org.gvsig.tools.dynobject.DynStruct; |
|
6 |
import org.gvsig.tools.persistence.AbstractSinglePersistenceFactory; |
|
7 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
8 |
import org.gvsig.tools.persistence.PersistentState; |
|
9 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
10 |
import org.gvsig.view3d.lib.api.properties.LayerProperties3D; |
|
11 |
import org.gvsig.view3d.lib.api.properties.VectorialLayerProperties3D; |
|
12 |
|
|
13 |
public class VectorialLayerProperties3DPersistenceFactory extends |
|
14 |
AbstractSinglePersistenceFactory { |
|
15 |
|
|
16 |
private static final String DYNCLASS_NAME = "Vectorial3DProperties"; |
|
17 |
private static final String DYNCLASS_DESCRIPTION = |
|
18 |
"Vectorial layer 3D properties persistence definition"; |
|
19 |
|
|
20 |
protected static final String FIELD_ELEVATION_FIELD = "elevationField"; |
|
21 |
protected static final String FIELD_RASTERIZED = "rasterized"; |
|
22 |
|
|
23 |
public VectorialLayerProperties3DPersistenceFactory() { |
|
24 |
super(VectorialLayerProperties3D.class, DYNCLASS_NAME, |
|
25 |
DYNCLASS_DESCRIPTION, null, null); |
|
26 |
|
|
27 |
DynStruct definition = this.getDefinition(); |
|
28 |
|
|
29 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
30 |
definition.extend(manager.getDefinition(LayerProperties3D.class)); |
|
31 |
|
|
32 |
definition.addDynFieldString(FIELD_ELEVATION_FIELD); |
|
33 |
definition.addDynFieldBoolean(FIELD_RASTERIZED); |
|
34 |
} |
|
35 |
|
|
36 |
public Object createFromState(PersistentState state) |
|
37 |
throws PersistenceException { |
|
38 |
|
|
39 |
FLayer layer = |
|
40 |
(FLayer) state.get(LayerProperties3DPersistenceFactory.FIELD_LAYER); |
|
41 |
VectorialLayerProperties3D properties = |
|
42 |
new DefaultVectorialLayerProperties3D(layer); |
|
43 |
|
|
44 |
properties.setElevation(state |
|
45 |
.getBoolean(LayerProperties3DPersistenceFactory.FIELD_ELEVATION)); |
|
46 |
properties |
|
47 |
.setElevationUnits(state |
|
48 |
.getString(LayerProperties3DPersistenceFactory.FIELD_ELEVATION_UNITS)); |
|
49 |
properties |
|
50 |
.setLevelZeroResolutionMultiplier(state |
|
51 |
.getDouble(LayerProperties3DPersistenceFactory.FIELD_LEVEL_ZERO_RESOLUTION_MULTIPLIER)); |
|
52 |
properties.setMaxLevel(state |
|
53 |
.getInt(LayerProperties3DPersistenceFactory.FIELD_MAXLEVEL)); |
|
54 |
properties.setMinLevel(state |
|
55 |
.getInt(LayerProperties3DPersistenceFactory.FIELD_MINLEVEL)); |
|
56 |
properties.setNoDataValue(state |
|
57 |
.getDouble(LayerProperties3DPersistenceFactory.FIELD_NODATA_VALUE)); |
|
58 |
properties.setTileHeight(state |
|
59 |
.getInt(LayerProperties3DPersistenceFactory.FIELD_TILE_HEIGHT)); |
|
60 |
properties.setTileWidth(state |
|
61 |
.getInt(LayerProperties3DPersistenceFactory.FIELD_TILE_WIDTH)); |
|
62 |
properties.setElevationField(state.getString(FIELD_ELEVATION_FIELD)); |
|
63 |
properties.setRasterized(state.getBoolean(FIELD_RASTERIZED)); |
|
64 |
|
|
65 |
return properties; |
|
66 |
} |
|
67 |
|
|
68 |
public void saveToState(PersistentState state, Object obj) |
|
69 |
throws PersistenceException { |
|
70 |
|
|
71 |
VectorialLayerProperties3D properties = |
|
72 |
(VectorialLayerProperties3D) obj; |
|
73 |
|
|
74 |
state.set(LayerProperties3DPersistenceFactory.FIELD_ELEVATION, |
|
75 |
properties.getElevation()); |
|
76 |
state.set(LayerProperties3DPersistenceFactory.FIELD_ELEVATION_UNITS, |
|
77 |
properties.getElevationUnits()); |
|
78 |
state |
|
79 |
.set( |
|
80 |
LayerProperties3DPersistenceFactory.FIELD_LEVEL_ZERO_RESOLUTION_MULTIPLIER, |
|
81 |
properties.getLevelZeroResolutionMultiplier()); |
|
82 |
state.set(LayerProperties3DPersistenceFactory.FIELD_MAXLEVEL, |
|
83 |
properties.getMaxLevel()); |
|
84 |
state.set(LayerProperties3DPersistenceFactory.FIELD_MINLEVEL, |
|
85 |
properties.getMinLevel()); |
|
86 |
state.set(LayerProperties3DPersistenceFactory.FIELD_NODATA_VALUE, |
|
87 |
properties.getNoDataValue()); |
|
88 |
state.set(LayerProperties3DPersistenceFactory.FIELD_TILE_HEIGHT, |
|
89 |
properties.getTileHeight()); |
|
90 |
state.set(LayerProperties3DPersistenceFactory.FIELD_TILE_WIDTH, |
|
91 |
properties.getTileWidth()); |
|
92 |
state.set(LayerProperties3DPersistenceFactory.FIELD_LAYER, |
|
93 |
properties.getLayer()); |
|
94 |
state.set(FIELD_ELEVATION_FIELD, properties.getElevationField()); |
|
95 |
state.set(FIELD_RASTERIZED, properties.getRasterized()); |
|
96 |
} |
|
97 |
|
|
98 |
} |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.lib/org.gvsig.view3d.lib.impl/src/main/java/org/gvsig/view3d/lib/impl/properties/LayerProperties3DPersistenceFactory.java | ||
---|---|---|
1 |
package org.gvsig.view3d.lib.impl.properties; |
|
2 |
|
|
3 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
4 |
import org.gvsig.tools.dynobject.DynStruct; |
|
5 |
import org.gvsig.tools.persistence.AbstractSinglePersistenceFactory; |
|
6 |
import org.gvsig.tools.persistence.PersistentState; |
|
7 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
8 |
import org.gvsig.view3d.lib.api.properties.LayerProperties3D; |
|
9 |
|
|
10 |
|
|
11 |
public class LayerProperties3DPersistenceFactory extends |
|
12 |
AbstractSinglePersistenceFactory { |
|
13 |
|
|
14 |
private static final String DYNCLASS_NAME = "Layer3DProperties"; |
|
15 |
private static final String DYNCLASS_DESCRIPTION = |
|
16 |
"Basic layer 3D properties persistence definition"; |
|
17 |
|
|
18 |
protected static final String FIELD_ELEVATION = "elevation"; |
|
19 |
protected static final String FIELD_ELEVATION_UNITS = "elevationUnits"; |
|
20 |
protected static final String FIELD_LEVEL_ZERO_RESOLUTION_MULTIPLIER = "lezelZeroResolutionMultiPlier"; |
|
21 |
protected static final String FIELD_MAXLEVEL = "maxLevel"; |
|
22 |
protected static final String FIELD_MINLEVEL = "minLevel"; |
|
23 |
protected static final String FIELD_NODATA_VALUE= "noDataValue"; |
|
24 |
protected static final String FIELD_TILE_HEIGHT = "tileHeight"; |
|
25 |
protected static final String FIELD_TILE_WIDTH = "tileWidth"; |
|
26 |
protected static final String FIELD_LAYER = "layer"; |
|
27 |
|
|
28 |
public LayerProperties3DPersistenceFactory() { |
|
29 |
super(LayerProperties3D.class, DYNCLASS_NAME, DYNCLASS_DESCRIPTION, |
|
30 |
null, null); |
|
31 |
|
|
32 |
DynStruct definition = this.getDefinition(); |
|
33 |
definition.addDynFieldBoolean(FIELD_ELEVATION); |
|
34 |
definition.addDynFieldString(FIELD_ELEVATION_UNITS); |
|
35 |
definition.addDynFieldDouble(FIELD_LEVEL_ZERO_RESOLUTION_MULTIPLIER); |
|
36 |
definition.addDynFieldInt(FIELD_MAXLEVEL); |
|
37 |
definition.addDynFieldInt(FIELD_MINLEVEL); |
|
38 |
definition.addDynFieldDouble(FIELD_NODATA_VALUE); |
|
39 |
definition.addDynFieldInt(FIELD_TILE_HEIGHT); |
|
40 |
definition.addDynFieldInt(FIELD_TILE_WIDTH); |
|
41 |
definition.addDynFieldObject(FIELD_LAYER); |
|
42 |
} |
|
43 |
|
|
44 |
public Object createFromState(PersistentState state) |
|
45 |
throws PersistenceException { |
|
46 |
|
|
47 |
FLayer layer = (FLayer) state.get(FIELD_LAYER); |
|
48 |
|
|
49 |
LayerProperties3D properties = new DefaultVectorialLayerProperties3D(layer); |
|
50 |
|
|
51 |
properties.setElevation(state.getBoolean(FIELD_ELEVATION)); |
|
52 |
properties.setElevationUnits(state.getString(FIELD_ELEVATION_UNITS)); |
|
53 |
properties.setLevelZeroResolutionMultiplier(state |
|
54 |
.getDouble(FIELD_LEVEL_ZERO_RESOLUTION_MULTIPLIER)); |
|
55 |
properties.setMaxLevel(state.getInt(FIELD_MAXLEVEL)); |
|
56 |
properties.setMinLevel(state.getInt(FIELD_MINLEVEL)); |
|
57 |
properties.setNoDataValue(state.getDouble(FIELD_NODATA_VALUE)); |
|
58 |
properties.setTileHeight(state.getInt(FIELD_TILE_HEIGHT)); |
|
59 |
properties.setTileWidth(state.getInt(FIELD_TILE_WIDTH)); |
|
60 |
|
|
61 |
return properties; |
|
62 |
} |
|
63 |
|
|
64 |
public void saveToState(PersistentState state, Object obj) |
|
65 |
throws PersistenceException { |
|
66 |
|
|
67 |
LayerProperties3D properties = (LayerProperties3D) obj; |
|
68 |
|
|
69 |
state.set(FIELD_ELEVATION, properties.getElevation()); |
|
70 |
state.set(FIELD_ELEVATION_UNITS, properties.getElevationUnits()); |
|
71 |
state.set(FIELD_LEVEL_ZERO_RESOLUTION_MULTIPLIER, |
|
72 |
properties.getLevelZeroResolutionMultiplier()); |
|
73 |
state.set(FIELD_MAXLEVEL, properties.getMaxLevel()); |
|
74 |
state.set(FIELD_MINLEVEL, properties.getMinLevel()); |
|
75 |
state.set(FIELD_NODATA_VALUE, properties.getNoDataValue()); |
|
76 |
state.set(FIELD_TILE_HEIGHT, properties.getTileHeight()); |
|
77 |
state.set(FIELD_TILE_WIDTH, properties.getTileWidth()); |
|
78 |
state.set(FIELD_LAYER, properties.getLayer()); |
|
79 |
} |
|
80 |
|
|
81 |
} |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.lib/org.gvsig.view3d.lib.impl/src/main/java/org/gvsig/view3d/lib/impl/properties/DefaultVectorialLayerProperties3D.java | ||
---|---|---|
1 | 1 |
package org.gvsig.view3d.lib.impl.properties; |
2 | 2 |
|
3 | 3 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
4 |
import org.gvsig.tools.ToolsLocator; |
|
5 |
import org.gvsig.tools.dynobject.DynStruct; |
|
6 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
7 |
import org.gvsig.tools.persistence.PersistentState; |
|
8 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
9 |
import org.gvsig.view3d.lib.api.properties.LayerProperties3D; |
|
10 | 4 |
import org.gvsig.view3d.lib.api.properties.VectorialLayerProperties3D; |
11 | 5 |
|
12 | 6 |
public class DefaultVectorialLayerProperties3D extends BasicLayerProperties3D |
... | ... | |
36 | 30 |
this.rasterized = rasterized; |
37 | 31 |
fireDrawValueChangedEvent("rasterized"); |
38 | 32 |
} |
39 |
|
|
40 |
public static void registerPersistence() { |
|
41 |
// Vectorial layer 3D properties |
|
42 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
43 |
DynStruct definition = |
|
44 |
manager.addDefinition(DefaultVectorialLayerProperties3D.class, |
|
45 |
VectorialLayerProperties3D.PERSISTENCE_NAME, |
|
46 |
"Vectorial layer 3D properties persistence definition", null, |
|
47 |
null); |
|
48 |
|
|
49 |
definition.extend(manager |
|
50 |
.getDefinition(LayerProperties3D.PERSISTENCE_NAME)); |
|
51 |
definition.addDynFieldString("elevationField"); |
|
52 |
definition.addDynFieldBoolean("rasterized"); |
|
53 |
} |
|
54 |
|
|
55 |
@Override |
|
56 |
public void loadFromState(PersistentState state) |
|
57 |
throws PersistenceException { |
|
58 |
super.loadFromState(state); |
|
59 |
|
|
60 |
setElevationField(state.getString("elevationField")); |
|
61 |
setRasterized(state.getBoolean("rasterized")); |
|
62 |
} |
|
63 |
|
|
64 |
@Override |
|
65 |
public void saveToState(PersistentState state) throws PersistenceException { |
|
66 |
super.saveToState(state); |
|
67 |
|
|
68 |
state.set("elevationField", getElevationField()); |
|
69 |
state.set("rasterized", getRasterized()); |
|
70 |
} |
|
71 | 33 |
} |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.lib/org.gvsig.view3d.lib.impl/src/main/java/org/gvsig/view3d/lib/impl/properties/RasterLayerProperties3DPersistenceFactory.java | ||
---|---|---|
1 |
package org.gvsig.view3d.lib.impl.properties; |
|
2 |
|
|
3 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
4 |
import org.gvsig.tools.ToolsLocator; |
|
5 |
import org.gvsig.tools.dynobject.DynStruct; |
|
6 |
import org.gvsig.tools.persistence.AbstractSinglePersistenceFactory; |
|
7 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
8 |
import org.gvsig.tools.persistence.PersistentState; |
|
9 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
10 |
import org.gvsig.view3d.lib.api.properties.LayerProperties3D; |
|
11 |
import org.gvsig.view3d.lib.api.properties.RasterLayerProperties3D; |
|
12 |
|
|
13 |
public class RasterLayerProperties3DPersistenceFactory extends |
|
14 |
AbstractSinglePersistenceFactory { |
|
15 |
|
|
16 |
private static final String DYNCLASS_NAME = "Raster3DProperties"; |
|
17 |
private static final String DYNCLASS_DESCRIPTION = |
|
18 |
"Raster layer 3D properties persistence definition"; |
|
19 |
|
|
20 |
public RasterLayerProperties3DPersistenceFactory() { |
|
21 |
super(RasterLayerProperties3D.class, DYNCLASS_NAME, |
|
22 |
DYNCLASS_DESCRIPTION, null, null); |
|
23 |
|
|
24 |
DynStruct definition = this.getDefinition(); |
|
25 |
|
|
26 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
27 |
definition.extend(manager.getDefinition(LayerProperties3D.class)); |
|
28 |
} |
|
29 |
|
|
30 |
public Object createFromState(PersistentState state) |
|
31 |
throws PersistenceException { |
|
32 |
|
|
33 |
FLayer layer = |
|
34 |
(FLayer) state.get(LayerProperties3DPersistenceFactory.FIELD_LAYER); |
|
35 |
RasterLayerProperties3D properties = |
|
36 |
new DefaultRasterLayerProperties3D(layer); |
|
37 |
|
|
38 |
properties.setElevation(state |
|
39 |
.getBoolean(LayerProperties3DPersistenceFactory.FIELD_ELEVATION)); |
|
40 |
properties |
|
41 |
.setElevationUnits(state |
|
42 |
.getString(LayerProperties3DPersistenceFactory.FIELD_ELEVATION_UNITS)); |
|
43 |
properties |
|
44 |
.setLevelZeroResolutionMultiplier(state |
|
45 |
.getDouble(LayerProperties3DPersistenceFactory.FIELD_LEVEL_ZERO_RESOLUTION_MULTIPLIER)); |
|
46 |
properties.setMaxLevel(state |
|
47 |
.getInt(LayerProperties3DPersistenceFactory.FIELD_MAXLEVEL)); |
|
48 |
properties.setMinLevel(state |
|
49 |
.getInt(LayerProperties3DPersistenceFactory.FIELD_MINLEVEL)); |
|
50 |
properties.setNoDataValue(state |
|
51 |
.getDouble(LayerProperties3DPersistenceFactory.FIELD_NODATA_VALUE)); |
|
52 |
properties.setTileHeight(state |
|
53 |
.getInt(LayerProperties3DPersistenceFactory.FIELD_TILE_HEIGHT)); |
|
54 |
properties.setTileWidth(state |
|
55 |
.getInt(LayerProperties3DPersistenceFactory.FIELD_TILE_WIDTH)); |
|
56 |
|
|
57 |
return properties; |
|
58 |
} |
|
59 |
|
|
60 |
public void saveToState(PersistentState state, Object obj) |
|
61 |
throws PersistenceException { |
|
62 |
|
|
63 |
RasterLayerProperties3D properties = (RasterLayerProperties3D) obj; |
|
64 |
|
|
65 |
state.set(LayerProperties3DPersistenceFactory.FIELD_ELEVATION, |
|
66 |
properties.getElevation()); |
|
67 |
state.set(LayerProperties3DPersistenceFactory.FIELD_ELEVATION_UNITS, |
|
68 |
properties.getElevationUnits()); |
|
69 |
state |
|
70 |
.set( |
|
71 |
LayerProperties3DPersistenceFactory.FIELD_LEVEL_ZERO_RESOLUTION_MULTIPLIER, |
|
72 |
properties.getLevelZeroResolutionMultiplier()); |
|
73 |
state.set(LayerProperties3DPersistenceFactory.FIELD_MAXLEVEL, |
|
74 |
properties.getMaxLevel()); |
|
75 |
state.set(LayerProperties3DPersistenceFactory.FIELD_MINLEVEL, |
|
76 |
properties.getMinLevel()); |
|
77 |
state.set(LayerProperties3DPersistenceFactory.FIELD_NODATA_VALUE, |
|
78 |
properties.getNoDataValue()); |
|
79 |
state.set(LayerProperties3DPersistenceFactory.FIELD_TILE_HEIGHT, |
|
80 |
properties.getTileHeight()); |
|
81 |
state.set(LayerProperties3DPersistenceFactory.FIELD_TILE_WIDTH, |
|
82 |
properties.getTileWidth()); |
|
83 |
state.set(LayerProperties3DPersistenceFactory.FIELD_LAYER, |
|
84 |
properties.getLayer()); |
|
85 |
} |
|
86 |
|
|
87 |
} |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.lib/org.gvsig.view3d.lib.api/src/main/java/org/gvsig/view3d/lib/api/properties/LayerProperties3D.java | ||
---|---|---|
1 | 1 |
package org.gvsig.view3d.lib.api.properties; |
2 | 2 |
|
3 |
import org.gvsig.tools.persistence.Persistent;
|
|
3 |
import org.gvsig.fmap.mapcontext.layers.FLayer;
|
|
4 | 4 |
|
5 | 5 |
/** |
6 | 6 |
* |
7 | 7 |
* @author <a href="mailto:lmarques@disid.com">Lluis Marques</a> |
8 | 8 |
* |
9 | 9 |
*/ |
10 |
public interface LayerProperties3D extends Persistent{
|
|
10 |
public interface LayerProperties3D{ |
|
11 | 11 |
|
12 |
public static final String PERSISTENCE_NAME = "Layer3DProperties"; |
|
13 |
|
|
14 | 12 |
/** |
15 | 13 |
* |
16 | 14 |
* @return |
... | ... | |
27 | 25 |
* |
28 | 26 |
* @return |
29 | 27 |
*/ |
28 |
public FLayer getLayer(); |
|
29 |
|
|
30 |
/** |
|
31 |
* |
|
32 |
* @return |
|
33 |
*/ |
|
30 | 34 |
public double getLevelZeroResolutionMultiplier(); |
31 | 35 |
|
32 | 36 |
/** |
... | ... | |
73 | 77 |
|
74 | 78 |
/** |
75 | 79 |
* |
80 |
* @param layer |
|
81 |
*/ |
|
82 |
public void setLayer(FLayer layer); |
|
83 |
|
|
84 |
/** |
|
85 |
* |
|
76 | 86 |
* @param multiplier |
77 | 87 |
*/ |
78 | 88 |
public void setLevelZeroResolutionMultiplier(double multiplier); |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.lib/org.gvsig.view3d.lib.api/src/main/java/org/gvsig/view3d/lib/api/properties/RasterLayerProperties3D.java | ||
---|---|---|
7 | 7 |
*/ |
8 | 8 |
public interface RasterLayerProperties3D extends LayerProperties3D { |
9 | 9 |
|
10 |
public static final String PERSISTENCE_NAME = "Raster3DProperties"; |
|
11 |
|
|
12 | 10 |
} |
2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.lib/org.gvsig.view3d.lib.api/src/main/java/org/gvsig/view3d/lib/api/properties/VectorialLayerProperties3D.java | ||
---|---|---|
7 | 7 |
*/ |
8 | 8 |
public interface VectorialLayerProperties3D extends LayerProperties3D { |
9 | 9 |
|
10 |
public static final String PERSISTENCE_NAME = "Vectorial3DProperties"; |
|
11 |
|
|
12 | 10 |
/** |
13 | 11 |
* |
14 | 12 |
* @return |
Also available in: Unified diff