Revision 4234 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/StatusLayerRaster.java
StatusLayerRaster.java | ||
---|---|---|
45 | 45 |
import org.cresques.io.GeoRasterFile; |
46 | 46 |
import org.cresques.io.raster.RasterFilterStackManager; |
47 | 47 |
|
48 |
import com.iver.cit.gvsig.fmap.MapControl; |
|
48 | 49 |
import com.iver.utiles.XMLEntity; |
49 | 50 |
|
50 | 51 |
/** |
... | ... | |
58 | 59 |
*/ |
59 | 60 |
public class StatusLayerRaster implements StatusRasterInterface{ |
60 | 61 |
|
61 |
public String clase = "com.iver.cit.gvsig.fmap.layers.StatusLayerRaster";
|
|
62 |
public static String defaultClass = "com.iver.cit.gvsig.fmap.layers.StatusLayerRaster";
|
|
62 | 63 |
|
63 | 64 |
//Valor de opacidad global de la imagen |
64 | 65 |
public int transparency = 0; |
... | ... | |
74 | 75 |
//Filtros para poder montar una nueva pila |
75 | 76 |
public ArrayList filters = new ArrayList(); |
76 | 77 |
|
78 |
private boolean isPansharpInStack = false; |
|
79 |
|
|
77 | 80 |
/* (non-Javadoc) |
78 | 81 |
* @see com.iver.cit.gvsig.fmap.layers.StatusRasterInterface#setXMLEntity(com.iver.utiles.XMLEntity) |
79 | 82 |
*/ |
80 | 83 |
public void setXMLEntity(XMLEntity xml, RasterOperations layer)throws XMLException { |
84 |
|
|
85 |
//Recuperamos las propiedades de los filtros |
|
86 |
for(int i=0;i<xml.getPropertyCount();i++){ |
|
87 |
if(xml.getPropertyName(i).startsWith("filter.")){ |
|
88 |
if(xml.getPropertyName(i).startsWith("filter.pansharpening")) |
|
89 |
isPansharpInStack = true; |
|
90 |
filters.add(xml.getPropertyName(i)+"="+xml.getPropertyValue(i)); |
|
91 |
} |
|
92 |
} |
|
93 |
|
|
81 | 94 |
if (xml.contains("raster.opacityLevel")) { |
82 | 95 |
transparency = xml.getIntProperty("raster.opacityLevel"); |
83 | 96 |
} |
... | ... | |
99 | 112 |
}else |
100 | 113 |
break; |
101 | 114 |
} |
102 |
|
|
103 |
//Recuperamos las propiedades de los filtros |
|
104 |
for(int i=0;i<xml.getPropertyCount();i++){ |
|
105 |
if(xml.getPropertyName(i).startsWith("filter.")){ |
|
106 |
filters.add(xml.getPropertyName(i)+"="+xml.getPropertyValue(i)); |
|
107 |
} |
|
108 |
} |
|
109 |
|
|
110 | 115 |
} |
111 | 116 |
|
112 | 117 |
|
... | ... | |
116 | 121 |
public void getXMLEntity(XMLEntity xml, boolean loadClass, RasterOperations layer) throws XMLException { |
117 | 122 |
|
118 | 123 |
if(loadClass) |
119 |
xml.putProperty("raster.class", clase);
|
|
124 |
xml.putProperty("raster.class", StatusLayerRaster.defaultClass);
|
|
120 | 125 |
|
121 | 126 |
if(transparency!=255) |
122 | 127 |
xml.putProperty("raster.opacityLevel", ""+transparency); |
... | ... | |
148 | 153 |
l = filters; |
149 | 154 |
|
150 | 155 |
|
151 |
for(int i=0;i<l.size();i++){
|
|
156 |
for(int i=0;i<l.size();i++) |
|
152 | 157 |
xml.putProperty(getElem((String)l.get(i)), getValue((String)l.get(i))); |
153 |
//System.out.println("==>"+getElem((String)l.get(i))+" "+getValue((String)l.get(i))); |
|
154 |
} |
|
155 | 158 |
} |
156 | 159 |
|
157 | 160 |
/** |
... | ... | |
189 | 192 |
* @see com.iver.cit.gvsig.fmap.layers.StatusRasterInterface#applyStatus(com.iver.cit.gvsig.fmap.layers.RasterFileAdapter) |
190 | 193 |
*/ |
191 | 194 |
public void applyStatus(RasterOperations layer){ |
192 |
|
|
193 |
//Crea la pila de filtros a partir de las propiedades recuperadas desde el XML |
|
194 |
|
|
195 |
if(layer.getFilterStack() != null){ |
|
196 |
RasterFilterStackManager stackManager |
|
197 |
= new RasterFilterStackManager(layer.getFilterStack()); |
|
198 |
|
|
199 |
stackManager.createStackFromStrings(this.filters); |
|
200 |
} |
|
201 |
|
|
195 |
|
|
202 | 196 |
//Eliminamos el fichero inicial y cargamos las bandas si hay para que se carguen |
203 | 197 |
//en el orden correcto |
204 | 198 |
if(layer instanceof FLyrRaster){ |
... | ... | |
221 | 215 |
|
222 | 216 |
if(transparency!=255) |
223 | 217 |
layer.setTransparency(transparency); |
218 |
|
|
219 |
//Crea la pila de filtros a partir de las propiedades recuperadas desde el XML |
|
220 |
if(layer.getFilterStack() != null){ |
|
221 |
RasterFilterStackManager stackManager = new RasterFilterStackManager(layer.getFilterStack()); |
|
222 |
if(this.isPansharpInStack) |
|
223 |
stackManager.createStackFromStrings(this.filters, ((FLyrRaster)layer).getSource().getFiles()); |
|
224 |
else |
|
225 |
stackManager.createStackFromStrings(this.filters); |
|
226 |
} |
|
224 | 227 |
|
225 |
|
|
226 | 228 |
} |
227 | 229 |
} |
Also available in: Unified diff