Revision 369 2.0/trunk/org.gvsig.gvsig3d/org.gvsig.gvsig3d.lib/org.gvsig.gvsig3d.lib.impl/src/main/java/org/gvsig/gvsig3d/impl/legend3d/ExtrusionLegend.java

View differences:

ExtrusionLegend.java
1 1
package org.gvsig.gvsig3d.impl.legend3d;
2 2

  
3 3
import java.awt.Color;
4
import java.util.ArrayList;
5
import java.util.List;
6
import java.util.Map;
4 7

  
5 8
import org.gvsig.fmap.dal.feature.Feature;
6 9
import org.gvsig.fmap.mapcontext.MapContextException;
......
12 15
import org.gvsig.gvsig3d.impl.symbology3d.line.impl.SimpleLine3DSymbol;
13 16
import org.gvsig.gvsig3d.impl.symbology3d.marker.impl.SimpleMarker3DSymbol;
14 17
import org.gvsig.osgvp.terrain.Terrain;
18
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractClassifiedVectorLegend;
19
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractLegend;
20
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractVectorialLegend;
15 21
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.VectorialUniqueValueLegend;
16 22
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.IFillSymbol;
17 23
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.SimpleFillSymbol;
24
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractSymbol;
18 25
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.ILineSymbol;
19 26
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.impl.SimpleLineSymbol;
20 27
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.IMarkerSymbol;
21 28
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.impl.SimpleMarkerSymbol;
29
import org.gvsig.tools.ToolsLocator;
30
import org.gvsig.tools.dynobject.DynStruct;
31
import org.gvsig.tools.persistence.PersistenceManager;
32
import org.gvsig.tools.persistence.PersistentState;
33
import org.gvsig.tools.persistence.exception.PersistenceException;
34
import org.gvsig.tools.util.Callable;
35
import org.gvsig.tools.util.Caller;
36
import org.gvsig.tools.util.impl.DefaultCaller;
22 37

  
23 38
import ucar.nc2.constants._Coordinate;
24 39

  
......
29 44
 */
30 45
public class ExtrusionLegend extends VectorialUniqueValueLegend {
31 46

  
47
	public static final String EXTRUSION_LEGEND_PERSISTENCE_DEFINITION_NAME = "ExtrusionLegend";
48

  
32 49
	private ExtrusionPolygonSymbol defaultSymbolEx;
33 50
	private double extrusionFactor = 1.0;
34 51
	int shapeType = 0;
35 52
	int coordType = Terrain.CoordinateSystemType.PROJECTED;
36 53

  
54
	public ExtrusionLegend(){
55
		super(9);
56
		this.shapeType = 9;			
57
	}
58
	
59
	
37 60
	public ExtrusionLegend(int shapeType) {
38 61
		super(shapeType);
39 62
		this.shapeType = shapeType;
......
98 121

  
99 122
	}
100 123

  
124
	@SuppressWarnings({ "unchecked", "rawtypes" })
125
	public void loadFromState(PersistentState state)
126
			throws PersistenceException {
127
		// Set parent properties
128
		super.loadFromState(state);
129
		// // Set own properties
130
		// keys = new ArrayList<Object>((List) state.get(FIELD_KEYS));
131
		// nullValueSymbol = (ISymbol) state.get(FIELD_NULL_VALUE_SYMBOL);
132
		// selectedColors =
133
		// (Color[]) state.getArray(FIELD_SELECTED_COLORS, Color.class);
134
		// Map persistedSymbolMap = (Map) state.get(FIELD_SYMBOLS);
135
		// if (persistedSymbolMap != null) {
136
		// symbols.putAll(persistedSymbolMap);
137
		// }
138
		// useDefaultSymbol(state.getBoolean(FIELD_USE_DEFAULT_SYMBOL));
139
	}
140

  
141
	public void saveToState(PersistentState state) throws PersistenceException {
142
		// Save parent properties
143
		super.saveToState(state);
144
		// Save own properties
145
		// state.set(FIELD_KEYS, keys);
146
		// state.set(FIELD_NULL_VALUE_SYMBOL, nullValueSymbol);
147
		// state.set(FIELD_SELECTED_COLORS, selectedColors);
148
		// state.set(FIELD_USE_DEFAULT_SYMBOL, isUseDefaultSymbol());
149
		// state.set(FIELD_SYMBOLS, symbols);
150
	}
151

  
152
	public static class RegisterPersistence implements Callable {
153

  
154
		public Object call() throws Exception {
155
			PersistenceManager manager = ToolsLocator.getPersistenceManager();
156

  
157
			if (manager.getDefinition("Legend") == null) {
158
				Caller caller = new DefaultCaller();
159
				caller.add(new AbstractLegend.RegisterPersistence());
160
				caller.call();
161
			}
162
			
163
			if (manager.getDefinition("VectorialLegend") == null) {
164
				Caller caller = new DefaultCaller();
165
				caller.add(new AbstractVectorialLegend.RegisterPersistence());
166
				caller.call();
167
			}		
168
			
169
			
170
			if (manager.getDefinition("ClassifiedVectorLegend") == null) {
171
				Caller caller = new DefaultCaller();
172
				caller.add(new AbstractClassifiedVectorLegend.RegisterPersistence());
173
				caller.call();
174
			}
175
			
176
			if (manager.getDefinition("VectorialUniqueValueLegend") == null) {
177
				Caller caller = new DefaultCaller();
178
				caller.add(new VectorialUniqueValueLegend.RegisterPersistence());
179
				caller.call();
180
			}
181

  
182
			if (manager
183
					.getDefinition(EXTRUSION_LEGEND_PERSISTENCE_DEFINITION_NAME) == null) {
184
				DynStruct definition = manager.addDefinition(
185
						ExtrusionLegend.class,
186
						EXTRUSION_LEGEND_PERSISTENCE_DEFINITION_NAME,
187
						EXTRUSION_LEGEND_PERSISTENCE_DEFINITION_NAME
188
								+ " Persistence definition", null, null);
189
				// Extend the Classified Vector Legend base definition
190
				definition
191
						.extend(manager
192
								.getDefinition(VECTORIAL_UNIQUE_VALUE_LEGEND_PERSISTENCE_DEFINITION_NAME));
193

  
194
				// // Keys
195
				// definition.addDynFieldList(FIELD_KEYS).setClassOfItems(Object.class);
196
				// // Null interval symbol
197
				// definition.addDynFieldObject(FIELD_NULL_VALUE_SYMBOL).setClassOfValue(ISymbol.class);
198
				// // Selected colors
199
				// definition.addDynFieldList(FIELD_SELECTED_COLORS).setClassOfItems(Color.class);
200
				// // Symbols
201
				// definition.addDynFieldMap(FIELD_SYMBOLS).setClassOfItems(ISymbol.class);
202
				// // Use default symbol?
203
				// definition.addDynFieldBoolean(FIELD_USE_DEFAULT_SYMBOL);
204
			}
205
			return Boolean.TRUE;
206
		}
207

  
208
	}
209

  
101 210
}

Also available in: Unified diff