Revision 501 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

View differences:

DefaultMapControlProperties3D.java
3 3
import java.beans.PropertyChangeListener;
4 4
import java.beans.PropertyChangeSupport;
5 5

  
6
import org.gvsig.tools.ToolsLocator;
7
import org.gvsig.tools.dynobject.DynStruct;
8
import org.gvsig.tools.persistence.PersistenceManager;
9
import org.gvsig.tools.persistence.PersistentState;
10
import org.gvsig.tools.persistence.exception.PersistenceException;
6 11
import org.gvsig.view3d.lib.api.properties.MapControlProperties3D;
7 12

  
8 13
public class DefaultMapControlProperties3D implements MapControlProperties3D {
......
104 109
    public void removePropertyChangeListener(PropertyChangeListener listener) {
105 110
        this.propertyChangeSupport.removePropertyChangeListener(listener);
106 111
    }
112
    
113
    public static void registerPersistence(){
114
        // MapControl 3D properties register
115
        PersistenceManager manager = ToolsLocator.getPersistenceManager();
107 116

  
117
        DynStruct definition =
118
            manager
119
                .addDefinition(DefaultMapControlProperties3D.class,
120
                    MapControlProperties3D.PERSISTENCE_NAME,
121
                    "MapControl 3D properties persistence definition", null,
122
                    null);
123

  
124
        definition
125
            .addDynFieldBoolean(MapControlProperties3D.AUTO_LAYER_SYNCHRONIZE_PROPERTY_NAME);
126
        definition
127
            .addDynFieldBoolean(MapControlProperties3D.AUTO_VIEWPORT_SYNCHRONIZE_PROPERTY_NAME);
128
        definition
129
            .addDynFieldDouble(MapControlProperties3D.SPHERE_VERTICAL_EXAGGERATION_PROPERTY_NAME);
130
        definition
131
            .addDynFieldDouble(MapControlProperties3D.FLAT_VERTICAL_EXAGGERATION_PROPERTY_NAME);
132
        definition
133
            .addDynFieldBoolean(MapControlProperties3D.BLUE_MARBEL_VISIBILITY_PROPERTY_NAME);
134
        definition
135
            .addDynFieldBoolean(MapControlProperties3D.NASA_LANDSAT_VISIBILITY_PROPERTY_NAME);
136
        definition
137
            .addDynFieldBoolean(MapControlProperties3D.DEFAULT_ELEVATION_VISIBILITY_PROPERTY_NAME);
138
    }
139

  
140
    public void saveToState(PersistentState state) throws PersistenceException {
141
        
142
        state.set(AUTO_LAYER_SYNCHRONIZE_PROPERTY_NAME,
143
            getAutoLayerSynchronize());
144
        state.set(AUTO_VIEWPORT_SYNCHRONIZE_PROPERTY_NAME,
145
            getAutoViewSynchronize());
146
        state.set(FLAT_VERTICAL_EXAGGERATION_PROPERTY_NAME,
147
            getFlatVerticalExaggeration());
148
        state.set(SPHERE_VERTICAL_EXAGGERATION_PROPERTY_NAME,
149
            getSphereVerticalExaggeration());
150
        state.set(BLUE_MARBEL_VISIBILITY_PROPERTY_NAME,
151
            getBlueMarbleLayerVisibility());
152
        state.set(NASA_LANDSAT_VISIBILITY_PROPERTY_NAME,
153
            getNasaLandsatLayerVisibility());
154
        state.set(DEFAULT_ELEVATION_VISIBILITY_PROPERTY_NAME,
155
            getDefaultElevationVisibility());
156
    }
157

  
158
    public void loadFromState(PersistentState state)
159
        throws PersistenceException {
160
        
161
        setAutoLayerSynchronize(state
162
            .getBoolean(AUTO_LAYER_SYNCHRONIZE_PROPERTY_NAME));
163
        setAutoViewPortSynchronize(state
164
            .getBoolean(AUTO_VIEWPORT_SYNCHRONIZE_PROPERTY_NAME));
165
        setSphereVerticalExaggeration(state
166
            .getDouble(SPHERE_VERTICAL_EXAGGERATION_PROPERTY_NAME));
167
        setFlatVerticalExaggeration(state
168
            .getDouble(FLAT_VERTICAL_EXAGGERATION_PROPERTY_NAME));
169
        setBlueMarbleLayerVisibility(state
170
            .getBoolean(BLUE_MARBEL_VISIBILITY_PROPERTY_NAME));
171
        setNasaLandsatVisibility(state
172
            .getBoolean(NASA_LANDSAT_VISIBILITY_PROPERTY_NAME));
173
        setDefaultElevationVisibility(state
174
            .getBoolean(DEFAULT_ELEVATION_VISIBILITY_PROPERTY_NAME));
175
        
176
    }
177

  
108 178
}

Also available in: Unified diff