Revision 2315 org.gvsig.raster/branches/org.gvsig.raster_dataaccess_refactoring/org.gvsig.raster.lib/org.gvsig.raster.lib.impl/src/main/java/org/gvsig/raster/impl/store/properties/DataStoreColorInterpretation.java
DataStoreColorInterpretation.java | ||
---|---|---|
22 | 22 |
package org.gvsig.raster.impl.store.properties; |
23 | 23 |
|
24 | 24 |
import java.util.ArrayList; |
25 |
import java.util.Arrays; |
|
25 | 26 |
import java.util.List; |
26 | 27 |
|
27 | 28 |
import org.gvsig.fmap.dal.coverage.store.props.ColorInterpretation; |
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; |
|
28 | 34 |
/** |
29 | 35 |
* Clase que contiene la interpretaci?n de color por banda. Inicialmente |
30 | 36 |
* es inicializada con los valores contenidos en el raster si los tiene. Despu?s |
... | ... | |
33 | 39 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
34 | 40 |
*/ |
35 | 41 |
public class DataStoreColorInterpretation implements ColorInterpretation { |
42 |
public static final String PERSISTENCE_NAME = "Color_Interpretation_Persistent"; |
|
36 | 43 |
|
37 | 44 |
/** |
38 | 45 |
* Interpretaci?n de color para cada banda |
... | ... | |
340 | 347 |
ci.colorInterpretation = l; |
341 | 348 |
return ci; |
342 | 349 |
} |
350 |
|
|
351 |
public static void registerPersistence() { |
|
352 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
353 |
DynStruct definition = manager.addDefinition( |
|
354 |
DataStoreColorInterpretation.class, |
|
355 |
PERSISTENCE_NAME, |
|
356 |
"Color interpretation Persistent definition (FIXME)", |
|
357 |
null, |
|
358 |
null |
|
359 |
); |
|
360 |
definition.addDynFieldList("colorinterpretation").setClassOfItems(String.class).setMandatory(false); |
|
361 |
} |
|
362 |
|
|
363 |
public void saveToState(PersistentState state) throws PersistenceException { |
|
364 |
if(colorInterpretation != null && colorInterpretation.length > 0) |
|
365 |
state.set("colorinterpretation", Arrays.asList(colorInterpretation)); |
|
366 |
} |
|
367 |
|
|
368 |
@SuppressWarnings("unchecked") |
|
369 |
public void loadFromState(PersistentState state) |
|
370 |
throws PersistenceException { |
|
371 |
List<String> descriptions = (List<String>) state.get("colorinterpretation"); |
|
372 |
setValues(descriptions.toArray(new String[descriptions.size()])); |
|
373 |
} |
|
343 | 374 |
} |
Also available in: Unified diff