Revision 13396 trunk/libraries/libRaster/src/org/gvsig/raster/datastruct/serializer/ColorTableRmfSerializer.java

View differences:

ColorTableRmfSerializer.java
94 94
	 */
95 95
	public void read(String xml) throws ParsingException {
96 96
		String paletteName = "";
97
		boolean interpolated = true;
97 98

  
98 99
		KXmlParser parser = new KXmlParser();
99 100
		Reader reader = new StringReader(xml);
......
112 113

  
113 114
			if ( parser.getEventType() != KXmlParser.END_DOCUMENT ) {
114 115
				parser.require(KXmlParser.START_TAG, null, MAIN_TAG);
116
				
117
				for (int i = 0; i < parser.getAttributeCount(); i++) {
118
					if (parser.getAttributeName(i).equals("name"))
119
						paletteName = parser.getAttributeValue(i);
120
					if (parser.getAttributeName(i).equals("interpolated"))
121
						interpolated = parser.getAttributeValue(i).equals("1");
122
				}
123

  
115 124
				while (tag != KXmlParser.END_DOCUMENT) {
116 125
					switch (tag) {
117 126
						case KXmlParser.START_TAG:
......
182 191

  
183 192
			colorTable = new ColorTable();
184 193
			colorTable.setName(paletteName);
185
			colorTable.createPaletteFromColorItems(items, true);
186
			colorTable.setInterpolated(false);
194
			colorTable.createPaletteFromColorItems(items, false);
195
			colorTable.setInterpolated(interpolated);
187 196

  
188 197
		} catch (XmlPullParserException e) {
189 198
			throw new ParsingException(xml);
......
200 209

  
201 210
		StringBuffer b = new StringBuffer();
202 211

  
203
		b.append("<" + MAIN_TAG + " name=\"" + colorTable.getName() + "\" version=\"1.1\">\n");
212
		b.append("<" + MAIN_TAG + " name=\"" + colorTable.getName() + "\" interpolated=\"" + (colorTable.isInterpolated()?"1":"0") + "\" version=\"1.1\">\n");
204 213

  
205 214
		for (int i = 0; i < colorTable.getColorItems().size(); i++) {
206 215
			b.append("\t<Color");

Also available in: Unified diff