Revision 20866 trunk/libraries/libRaster/src/org/gvsig/raster/datastruct/serializer/NoDataRmfSerializer.java
NoDataRmfSerializer.java | ||
---|---|---|
23 | 23 |
import java.io.StringReader; |
24 | 24 |
|
25 | 25 |
import org.gvsig.raster.RasterLibrary; |
26 |
import org.gvsig.raster.dataset.IBuffer; |
|
26 | 27 |
import org.gvsig.raster.dataset.io.rmf.ClassSerializer; |
27 | 28 |
import org.gvsig.raster.dataset.io.rmf.ParsingException; |
28 | 29 |
import org.kxml2.io.KXmlParser; |
... | ... | |
79 | 80 |
|
80 | 81 |
/** |
81 | 82 |
* Constructor. Asigna el valor NoData a serializar |
82 |
* @param Double valor NoData |
|
83 |
* @param noData Valor NoData |
|
84 |
* @param type Tipo de NoData |
|
85 |
* @param dataType Tipo de datos de la capa |
|
83 | 86 |
*/ |
87 |
public NoDataRmfSerializer(double noData, int type, int dataType) { |
|
88 |
switch (dataType) { |
|
89 |
case IBuffer.TYPE_BYTE: |
|
90 |
this.noData.setValue((byte) noData); |
|
91 |
this.noData.setType(RasterLibrary.NODATATYPE_USER); |
|
92 |
break; |
|
93 |
case IBuffer.TYPE_FLOAT: |
|
94 |
this.noData.setValue((float) noData); |
|
95 |
this.noData.setType(RasterLibrary.NODATATYPE_USER); |
|
96 |
break; |
|
97 |
case IBuffer.TYPE_USHORT: |
|
98 |
case IBuffer.TYPE_INT: |
|
99 |
this.noData.setValue((int) noData); |
|
100 |
this.noData.setType(RasterLibrary.NODATATYPE_USER); |
|
101 |
break; |
|
102 |
case IBuffer.TYPE_SHORT: |
|
103 |
this.noData.setValue((short) noData); |
|
104 |
this.noData.setType(RasterLibrary.NODATATYPE_USER); |
|
105 |
break; |
|
106 |
default: |
|
107 |
this.noData.setValue(noData); |
|
108 |
this.noData.setType(type); |
|
109 |
break; |
|
110 |
} |
|
111 |
} |
|
112 |
|
|
113 |
/** |
|
114 |
* Constructor. Asigna el valor NoData a serializar |
|
115 |
* @param noData Valor NoData |
|
116 |
* @param type Tipo de NoData |
|
117 |
*/ |
|
84 | 118 |
public NoDataRmfSerializer(double noData, int type) { |
85 |
this.noData.setType(type); |
|
86 |
this.noData.setValue(noData); |
|
119 |
this(noData, type, IBuffer.TYPE_DOUBLE); |
|
87 | 120 |
} |
88 | 121 |
|
89 | 122 |
/** |
... | ... | |
139 | 172 |
if (parser.getAttributeName(i).equals("value")) { |
140 | 173 |
noData.setValue(Double.parseDouble((String) parser.getAttributeValue(i))); |
141 | 174 |
} |
142 |
if (parser.getAttributeName(i).equals("enabled")) {
|
|
175 |
if (parser.getAttributeName(i).equals("type")) {
|
|
143 | 176 |
noData.setType(Integer.parseInt((String) parser.getAttributeValue(i))); |
144 | 177 |
} |
145 | 178 |
} |
Also available in: Unified diff