Revision 12567

View differences:

trunk/libraries/libRaster/src/org/gvsig/raster/dataset/io/ErmapperWriter.java
30 30
import org.gvsig.raster.dataset.io.features.WriteFileFormatFeatures;
31 31
import org.gvsig.raster.datastruct.Extent;
32 32
import org.gvsig.raster.util.RasterUtilities;
33
import org.gvsig.raster.util.WktUtils;
34 33
import org.gvsig.raster.util.extensionPoints.ExtensionPoints;
35 34
import org.gvsig.raster.util.extensionPoints.ExtensionPointsSingleton;
36 35

  
......
38 37
import es.gva.cit.jecwcompress.JniObject;
39 38
import es.gva.cit.jecwcompress.NCSEcwCompressClient;
40 39
import es.gva.cit.jecwcompress.ReadCallBack;
41
import es.gva.cit.jgdal.GdalException;
42 40
import es.gva.cit.jgdal.GdalRasterBand;
43

  
44

  
45 41
/**
46 42
 * Driver para la compresi?n en formato Ecw.
47 43
 *
......
337 333
			e.printStackTrace();
338 334
		}
339 335
	}
340
	
336

  
341 337
	/*
342 338
	 * (non-Javadoc)
343 339
	 * @see org.gvsig.raster.dataset.GeoRasterWriter#setWkt(java.lang.String)
......
646 642
	public void setWrite(boolean write) {
647 643
		this.write = write;
648 644
	}
649
	
645

  
650 646
}
trunk/libraries/libRaster/src/org/gvsig/raster/dataset/io/EcwDriver.java
45 45
import com.ermapper.ecw.JNCSFileNotOpenException;
46 46
import com.ermapper.ecw.JNCSInvalidSetViewException;
47 47
import com.ermapper.ecw.JNCSProgressiveUpdate;
48

  
49
import es.gva.cit.jgdal.GdalException;
50

  
51

  
52 48
/**
53 49
 * Driver de Ecw
54
 * 
50
 *
55 51
 * @author Nacho Brodin (nachobrodin@gmail.com)
56 52
 */
57 53
public class EcwDriver extends RasterDataset implements JNCSProgressiveUpdate {
58
    
54

  
59 55
	private JNCSFile 				file = null;
60 56
	private int 					currentFullWidth = -1;
61 57
	private int 					currentFullHeight = -1;
......
68 64
	 * Estado de transparencia del raster.
69 65
	 */
70 66
	protected Transparency  		fileTransparency = null;
71
	
67

  
72 68
	/**
73 69
	 * Extent de la ventana seleccionada
74 70
	 */
75
    private Extent					viewRequest = null;
71
		private Extent					viewRequest = null;
76 72
	private boolean 				readCancel = false;
77
    
73

  
78 74
	public static void register() {
79 75
		ExtensionPoints extensionPoints = ExtensionPointsSingleton.getInstance();
80 76
		extensionPoints.add("RasterReader", "ecw", EcwDriver.class);
81 77
		extensionPoints.add("RasterReader", "jp2", EcwDriver.class);
82 78
	}
83
		
79

  
84 80
	class Contour extends Vector {
85 81
		final private static long serialVersionUID = 0;
86 82
		public double minX = Double.MAX_VALUE, minY = Double.MAX_VALUE;
......
96 92
			if (pt.getY() < minY) minY = pt.getY();
97 93
		}
98 94
	}
99
	
95

  
100 96
	/**
101 97
	 * Constructor. Abre el dataset.
102 98
	 * @param proj Proyecci?n
......
106 102
	public EcwDriver(IProjection proj, Object param)throws NotSupportedExtensionException {
107 103
		 super(proj, ((String)param));
108 104
		 setParam(param);
109
	     extent = new Extent();
110
	     try {
105
			 extent = new Extent();
106
			 try {
111 107

  
112
	    	 if (!new File(((String)param)).exists() && !((String)param).startsWith("ecwp:"))
113
	    		 throw new NotSupportedExtensionException("Extension not supported");
108
				 if (!new File(((String)param)).exists() && !((String)param).startsWith("ecwp:"))
109
					 throw new NotSupportedExtensionException("Extension not supported");
114 110

  
115
	    	 file = new JNCSFile(((String)param), false);
116
	    	 load();
117
	    	 //readGeoInfo(fName);
118
	    	 bandCount = file.numBands;
119
	    	 getTransparencyDatasetStatus();
120
	    	 setDataType(IBuffer.TYPE_BYTE);
121
	    	 
122
	    	 super.init();
123
	    	 
124
	    	 try {
125
	    		 loadFromRmf(getRmfBlocksManager());
126
	    	 } catch (ParsingException e) {
127
	    		 //No lee desde rmf
128
	    	 }	
129
	 		
130
	     } catch (Exception e) {
131
	    	 throw new NotSupportedExtensionException("Extension not supported");
132
	     }
133
    }
111
				 file = new JNCSFile(((String)param), false);
112
				 load();
113
				 //readGeoInfo(fName);
114
				 bandCount = file.numBands;
115
				 getTransparencyDatasetStatus();
116
				 setDataType(IBuffer.TYPE_BYTE);
134 117

  
118
				 super.init();
119

  
120
				 try {
121
					 loadFromRmf(getRmfBlocksManager());
122
				 } catch (ParsingException e) {
123
					 //No lee desde rmf
124
				 }
125

  
126
			 } catch (Exception e) {
127
				 throw new NotSupportedExtensionException("Extension not supported");
128
			 }
129
		}
130

  
135 131
	/**
136
     * Carga un ECW.
137
     * @param fname
138
     */
139
    public GeoInfo load() {
140
        double minX;
141
        double minY;
142
        double maxX;
143
        double maxY;
132
		 * Carga un ECW.
133
		 * @param fname
134
		 */
135
		public GeoInfo load() {
136
				double minX;
137
				double minY;
138
				double maxX;
139
				double maxY;
144 140

  
145
        if(file.cellIncrementY > 0)
146
        	file.cellIncrementY = -file.cellIncrementY;
147
        
148
        minX = file.originX;
149
        maxY = file.originY;
150
        maxX = file.originX +
151
               ((double) (file.width) * file.cellIncrementX);
152
        minY = file.originY +
153
               ((double) (file.height) * file.cellIncrementY);
154
        
155
        currentFullWidth = file.width;
156
        currentFullHeight = file.height;
157
        boundingBoxWithoutRotation();
158
        
159
        extent = new Extent(minX, minY, maxX, maxY);
160
        requestExtent = extent;
161
        return this;
162
    }
163
    
164
    /**
141
				if(file.cellIncrementY > 0)
142
					file.cellIncrementY = -file.cellIncrementY;
143

  
144
				minX = file.originX;
145
				maxY = file.originY;
146
				maxX = file.originX +
147
							 ((double) (file.width) * file.cellIncrementX);
148
				minY = file.originY +
149
							 ((double) (file.height) * file.cellIncrementY);
150

  
151
				currentFullWidth = file.width;
152
				currentFullHeight = file.height;
153
				boundingBoxWithoutRotation();
154

  
155
				extent = new Extent(minX, minY, maxX, maxY);
156
				requestExtent = extent;
157
				return this;
158
		}
159

  
160
		/**
165 161
	 * Calcula la bounding box en la que est? metido el raster teniendo en cuenta
166
	 * el tama?o de pixel y la rotaci?n. 
162
	 * el tama?o de pixel y la rotaci?n.
167 163
	 */
168 164
	private void boundingBoxWithoutRotation() {
169 165
		double ox = file.originX;
170 166
		double oy = file.originY;
171 167
		double resx = file.cellIncrementX;
172 168
		double resy = file.cellIncrementY;
173
				
169

  
174 170
		bBoxWithoutRot.add(new Point2D.Double(ox, oy));
175 171
		bBoxWithoutRot.add(new Point2D.Double(ox + resx * (file.width), oy));
176 172
		bBoxWithoutRot.add(new Point2D.Double(ox, oy + resy * (file.height)));
177 173
		bBoxWithoutRot.add(new Point2D.Double(ox + resx * (file.width), oy + resy * (file.height)));
178 174
	}
179 175

  
180
    /**
181
     * Cierra el fichero ECW
182
     */
183
    public void close() {
184
    	if(file != null){
185
    		file.close(true);
186
    		file = null;
187
    	}
188
    }
189
    
190
    /**
176
		/**
177
		 * Cierra el fichero ECW
178
		 */
179
		public void close() {
180
			if(file != null){
181
				file.close(true);
182
				file = null;
183
			}
184
		}
185

  
186
		/**
191 187
	 * Obtiene el objeto que contiene el estado de la transparencia
192 188
	 */
193 189
	public Transparency getTransparencyDatasetStatus() {
......
195 191
			fileTransparency = new Transparency();
196 192
		return fileTransparency;
197 193
	}
198
	
199
    /**
200
     * Devuelve el ancho de la imagen
201
     */
202
    public int getWidth() {
203
        return file.width;
204
    }
205 194

  
206
    /**
207
     * Devuelve el alto de la imagen
208
     */
209
    public int getHeight() {
210
        return file.height;
211
    }
212
    
213
    /**
195
		/**
196
		 * Devuelve el ancho de la imagen
197
		 */
198
		public int getWidth() {
199
				return file.width;
200
		}
201

  
202
		/**
203
		 * Devuelve el alto de la imagen
204
		 */
205
		public int getHeight() {
206
				return file.height;
207
		}
208

  
209
		/**
214 210
	 * Obtiene el extent de la ?ltima ventana seleccionada.
215 211
	 * @return Extent
216 212
	 */
217 213
	public Extent getView() {
218
        return viewRequest;
219
    }
220
	
214
				return viewRequest;
215
		}
216

  
221 217
	/*
222 218
	 * (non-Javadoc)
223 219
	 * @see org.gvsig.fmap.driver.RasterDataset#setView(org.gvsig.fmap.raster.Extent)
......
233 229
				transformTFW.transform(petInit, petInit);
234 230
				transformTFW.transform(petEnd, petEnd);
235 231
			} catch(NoninvertibleTransformException ex) {
236
				
232

  
237 233
			}
238 234
			viewRequest = new Extent(petInit.getX(), petInit.getY(), petEnd.getX(), petEnd.getY());
239 235
		} else
240 236
			viewRequest = new Extent(e);
241
    }
242
	
237
		}
238

  
243 239
	/**
244 240
	 * Cuando se hace una petici?n de carga de buffer la extensi?n pedida puede estar ajustada a la extensi?n del raster
245 241
	 * o no estarlo. En caso de no estarlo los pixeles del buffer que caen fuera de la extensi?n del raster tendr?n valor
......
252 248
	 * @param nWidth Ancho en pixeles del buffer
253 249
	 * @param nHeight Alto en pixeles del buffer
254 250
	 * @return desplazamiento dentro del buffer en X e Y
255
	 */ 
251
	 */
256 252
	private int[] calcStepBuffer(Extent dataExtent, int nWidth, int nHeight, int[] stpBuffer) {
257
    	Extent imageExtent = new Extent(bBoxWithoutRot.minX, bBoxWithoutRot.minY, bBoxWithoutRot.maxX, bBoxWithoutRot.maxY);
258
    	Extent ajustDataExtent = RasterUtilities.calculateAdjustedView(dataExtent, imageExtent);
259
    	if(!RasterUtilities.compareExtents(dataExtent, ajustDataExtent)) {
260
    		Point2D p1 = worldToRaster(new Point2D.Double(ajustDataExtent.minX(), ajustDataExtent.maxY()));
261
    		Point2D p2 = worldToRaster(new Point2D.Double(ajustDataExtent.maxX(), ajustDataExtent.minY()));
262
    		Point2D p3 = worldToRaster(new Point2D.Double(dataExtent.minX(), dataExtent.maxY()));
263
    		Point2D p4 = worldToRaster(new Point2D.Double(dataExtent.maxX(), dataExtent.minY()));
264
    		//Ese es el ancho y alto q tendr?a el buffer en caso de haberse ajustado
265
    		int w = (int)Math.abs(Math.ceil(p2.getX()) - Math.floor(p1.getX())); 
266
    		int h = (int)Math.abs(Math.floor(p1.getY()) - Math.ceil(p2.getY()));
267
    		
268
    		stpBuffer[0] = (int)(p1.getX() + (-p3.getX()));
269
    		stpBuffer[1] = (int)(p1.getY() + (-p3.getY()));
270
    		stpBuffer[2] = stpBuffer[0] + w; 
271
    		stpBuffer[3] = stpBuffer[1] + h;
272
    		return new int[]{w, h};
273
    	}
274
    	return new int[]{nWidth, nHeight};
253
			Extent imageExtent = new Extent(bBoxWithoutRot.minX, bBoxWithoutRot.minY, bBoxWithoutRot.maxX, bBoxWithoutRot.maxY);
254
			Extent ajustDataExtent = RasterUtilities.calculateAdjustedView(dataExtent, imageExtent);
255
			if(!RasterUtilities.compareExtents(dataExtent, ajustDataExtent)) {
256
				Point2D p1 = worldToRaster(new Point2D.Double(ajustDataExtent.minX(), ajustDataExtent.maxY()));
257
				Point2D p2 = worldToRaster(new Point2D.Double(ajustDataExtent.maxX(), ajustDataExtent.minY()));
258
				Point2D p3 = worldToRaster(new Point2D.Double(dataExtent.minX(), dataExtent.maxY()));
259
				Point2D p4 = worldToRaster(new Point2D.Double(dataExtent.maxX(), dataExtent.minY()));
260
				//Ese es el ancho y alto q tendr?a el buffer en caso de haberse ajustado
261
				int w = (int)Math.abs(Math.ceil(p2.getX()) - Math.floor(p1.getX()));
262
				int h = (int)Math.abs(Math.floor(p1.getY()) - Math.ceil(p2.getY()));
263

  
264
				stpBuffer[0] = (int)(p1.getX() + (-p3.getX()));
265
				stpBuffer[1] = (int)(p1.getY() + (-p3.getY()));
266
				stpBuffer[2] = stpBuffer[0] + w;
267
				stpBuffer[3] = stpBuffer[1] + h;
268
				return new int[]{w, h};
269
			}
270
			return new int[]{nWidth, nHeight};
275 271
	}
276
	
272

  
277 273
	/*
278 274
	 * (non-Javadoc)
279 275
	 * @see org.gvsig.fmap.driver.RasterDataset#worldToRaster(java.awt.geom.Point2D)
......
284 280
		Point2D ptRes = new Point2D.Double(x, y);
285 281
		return ptRes;
286 282
	}
287
	
283

  
288 284
	/*
289 285
	 * (non-Javadoc)
290 286
	 * @see org.gvsig.fmap.driver.RasterDataset#rasterToWorld(java.awt.geom.Point2D)
......
295 291
		Point2D ptRes = new Point2D.Double(x, y);
296 292
		return ptRes;
297 293
	}
298
	
294

  
299 295
	/*
300 296
	 * (non-Javadoc)
301 297
	 * @see org.gvsig.fmap.driver.RasterDataset#getWindowRaster(double, double, double, double, org.gvsig.fmap.driver.BandList, org.gvsig.fmap.driver.IBuffer, boolean)
302 298
	 */
303 299
	public IBuffer getWindowRaster(double x, double y, double w, double h, BandList bandList, IBuffer rasterBuf, boolean adjustToExtent) {
304
		
300

  
305 301
		//Si cojemos pixeles completos hemos de calcular las coordenadas reales de esos pixeles completos para hacer la petici?n.
306 302
		//Este el calculo que se hizo en RasterMultiDataset para calcular pixeles completos, convertir a pixel, redondear el primero
307 303
		//por abajo y el ultimo por arriba
......
316 312
		int wPx = rasterBuf.getWidth();
317 313
		int hPx = rasterBuf.getHeight();
318 314
		int[] stpBuffer = new int[]{0, 0 , wPx, hPx};
319
		
315

  
320 316
		//TODO: FUNCIONALIDAD: Implementar adjustToExtent = false
321 317
		/*if(!adjustToExtent){
322
	       	int[] wh = calcStepBuffer(selectedExtent, wPx, hPx, stpBuffer);
323
	       	if(x < 0)
324
	       		x  = 0;
325
	       	if(y < 0)
326
	       		y  = 0;
327
	       	readData(buf, bandList, x, y, wh[0], wh[1], wh[0], wh[1], 0, 0, stpBuffer);
328
	       	return;
329
	    }*/
330
		 
318
					 int[] wh = calcStepBuffer(selectedExtent, wPx, hPx, stpBuffer);
319
					 if(x < 0)
320
						 x  = 0;
321
					 if(y < 0)
322
						 y  = 0;
323
					 readData(buf, bandList, x, y, wh[0], wh[1], wh[0], wh[1], 0, 0, stpBuffer);
324
					 return;
325
			}*/
326

  
331 327
		loadBuffer(viewRequest, wPx, hPx, rasterBuf, bandList, stpBuffer);
332
		
328

  
333 329
		return rasterBuf;
334 330
	}
335 331

  
......
343 339
		Extent selectedExtent = new Extent(init.getX(), init.getY(), end.getX(), end.getY());
344 340
		setView(selectedExtent);
345 341
		int[] stpBuffer = new int[]{0, 0 , w, h};
346
		
342

  
347 343
		loadBuffer(viewRequest, w, h, rasterBuf, bandList, stpBuffer);
348 344
		return rasterBuf;
349 345
	}
350
	
346

  
351 347
	/*
352 348
	 * (non-Javadoc)
353 349
	 * @see org.gvsig.fmap.driver.RasterDataset#getWindowRaster(double, double, double, double, int, int, org.gvsig.fmap.driver.BandList, org.gvsig.fmap.driver.IBuffer, boolean)
......
356 352
		Extent selectedExtent = new Extent(minX, maxY, maxX, minY);
357 353
		setView(selectedExtent);
358 354
		int[] stpBuffer = new int[]{0, 0 , bufWidth, bufHeight};
359
		
355

  
360 356
		//TODO: FUNCIONALIDAD: Implementar adjustToExtent = false
361
		
357

  
362 358
		loadBuffer(viewRequest, bufWidth, bufHeight, rasterBuf, bandList, stpBuffer);
363 359
		return rasterBuf;
364 360
	}
......
373 369
		Extent selectedExtent = new Extent(init.getX(), init.getY(), end.getX(), end.getY());
374 370
		setView(selectedExtent);
375 371
		int[] stpBuffer = new int[]{0, 0 , bufWidth, bufHeight};
376
		
372

  
377 373
		loadBuffer(viewRequest, bufWidth, bufHeight, rasterBuf, bandList, stpBuffer);
378 374
		return rasterBuf;
379 375
	}
......
383 379
	 * y tama?o de buffer. El problema de ecw es que solo podemos leer 3 bandas de una vez ya que solo disponemos
384 380
	 * de una llamada readLineRGBA. Para leer m?s bandas tendremos que hacer multiples llamadas a setView para leer
385 381
	 * 3 cada vez.
386
	 * 
382
	 *
387 383
	 * Si por ejemplo tenemos un ecw de 6 bandas [0, 1, 2, 3, 4, 5] y queremos cargar un buffer con el siguiente orden
388 384
	 * [0, -, 2, -, 4, -] La variable readBandsFromECW har? la llamada a setView con los valores [0, 2, 4, 0, 0, 0]. La
389 385
	 * funci?n drawRGB ser? la encargada de hacer el switch para obtener [0, -, 2, -, 4, -].
390
	 * 
386
	 *
391 387
	 * Bug#1: Si se dispone de un ecw de m?s de tres bandas podemos llamar a setView con readBandsFromECW con el orden
392 388
	 * que queramos, por ejemplo [3, 2, 5, 1, 0] pero para ecw de 3 bandas la llamada con las bandas cambiadas no
393
	 * hace caso. El caso de readBandsFromECW = [2, 0, 1] ser? tomado siempre como [0, 1, 2]. 
394
	 * 
389
	 * hace caso. El caso de readBandsFromECW = [2, 0, 1] ser? tomado siempre como [0, 1, 2].
390
	 *
395 391
	 * @param selectedExtent Extensi?n seleccionada
396 392
	 * @param bufWidth Ancho de buffer
397 393
	 * @param bufHeight Alto de buffer
......
399 395
	 */
400 396
	private void loadBuffer(Extent selectedExtent, int bufWidth, int bufHeight, IBuffer rasterBuf, BandList bandList, int[] stpBuffer){
401 397
		try{
402
			//Leemos el raster desde la librer?a 
403
		
398
			//Leemos el raster desde la librer?a
399

  
404 400
			int[] readBandsFromECW = new int[file.numBands];
405 401
			int[] readBands = new int[file.numBands];
406
			
407
			
402

  
403

  
408 404
			for(int i = 0; i < readBandsFromECW.length; i ++)
409 405
				readBands[i] = -1;
410 406
			int cont = 0;
......
419 415
				}
420 416

  
421 417
			}
422
			
418

  
423 419
			if(readCancel) {
424 420
				readCancel = false;
425 421
				return;
426 422
			}
427
						
423

  
428 424
			file.setView(file.numBands, readBandsFromECW, selectedExtent.minX(), selectedExtent.maxY(), selectedExtent.maxX(), selectedExtent.minY(), bufWidth, bufHeight);
429
			
425

  
430 426
			//Escribimos el raster sobre un IBuffer
431 427
			int[] pRGBArray = new int[bufWidth];
432 428
			drawRGB(rasterBuf, pRGBArray, readBands, bandList);
433
													
429

  
434 430
		}catch(JNCSInvalidSetViewException exc){
435 431
			exc.printStackTrace();
436 432
		}catch (JNCSFileNotOpenException e) {
......
438 434
		}catch (JNCSException ex) {
439 435
			ex.printStackTrace();
440 436
		}
441
		
437

  
442 438
	}
443
	
444
	
439

  
440

  
445 441
	private void drawRGB(IBuffer rasterBuf, int[] pRGBArray, int[] readBands, BandList bandList)throws JNCSException{
446 442
		int bandR = readBands[0];
447 443
		int bandG = (readBands.length > 1) ? readBands[1] : -1;
448 444
		int bandB = (readBands.length > 2) ? readBands[2] : -1;
449
	
445

  
450 446
		//********* caso especial que resuelve Bug#1 **********************
451
		if(file.numBands == 3 && bandList.getDrawableBandsCount() < 3) {  
447
		if(file.numBands == 3 && bandList.getDrawableBandsCount() < 3) {
452 448
			for(int i = 0; i < 3; i ++){
453 449
				int[] b = bandList.getBand(i).getBufferBandListToDraw();
454 450
				if(b != null){
......
462 458
				if(b != null){
463 459
					if(i == 0){
464 460
						for (int line = 0; line < rasterBuf.getHeight(); line++) {
465
				            file.readLineRGBA(pRGBArray);
466
				            for(int col = 0; col < pRGBArray.length; col ++){
467
				            	rasterBuf.setElem(line, col, bandR, (byte)((pRGBArray[col] & 0x00ff0000) >> 16));
468
				            	rasterBuf.setElem(line, col, bandG, (byte)((pRGBArray[col] & 0x00ff0000) >> 16));
469
				            	rasterBuf.setElem(line, col, bandB, (byte)((pRGBArray[col] & 0x00ff0000) >> 16));
470
				            }
471
				        }
461
										file.readLineRGBA(pRGBArray);
462
										for(int col = 0; col < pRGBArray.length; col ++){
463
											rasterBuf.setElem(line, col, bandR, (byte)((pRGBArray[col] & 0x00ff0000) >> 16));
464
											rasterBuf.setElem(line, col, bandG, (byte)((pRGBArray[col] & 0x00ff0000) >> 16));
465
											rasterBuf.setElem(line, col, bandB, (byte)((pRGBArray[col] & 0x00ff0000) >> 16));
466
										}
467
								}
472 468
						return;
473 469
					}
474 470
					if(i == 1) {
475 471
						for (int line = 0; line < rasterBuf.getHeight(); line++) {
476
				            file.readLineRGBA(pRGBArray);
477
				            for(int col = 0; col < pRGBArray.length; col ++){
478
				            	rasterBuf.setElem(line, col, bandR, (byte)((pRGBArray[col] & 0x0000ff00) >> 8));
479
				            	rasterBuf.setElem(line, col, bandG, (byte)((pRGBArray[col] & 0x0000ff00) >> 8));
480
				            	rasterBuf.setElem(line, col, bandB, (byte)((pRGBArray[col] & 0x0000ff00) >> 8));
481
				            }
482
				        }
472
										file.readLineRGBA(pRGBArray);
473
										for(int col = 0; col < pRGBArray.length; col ++){
474
											rasterBuf.setElem(line, col, bandR, (byte)((pRGBArray[col] & 0x0000ff00) >> 8));
475
											rasterBuf.setElem(line, col, bandG, (byte)((pRGBArray[col] & 0x0000ff00) >> 8));
476
											rasterBuf.setElem(line, col, bandB, (byte)((pRGBArray[col] & 0x0000ff00) >> 8));
477
										}
478
								}
483 479
						return;
484 480
					}
485 481
					if(i == 2) {
486 482
						for (int line = 0; line < rasterBuf.getHeight(); line++) {
487
				            file.readLineRGBA(pRGBArray);
488
				            for(int col = 0; col < pRGBArray.length; col ++){
489
				            	rasterBuf.setElem(line, col, bandR, (byte)(pRGBArray[col] & 0x000000ff));
490
				            	rasterBuf.setElem(line, col, bandG, (byte)(pRGBArray[col] & 0x000000ff));
491
				            	rasterBuf.setElem(line, col, bandB, (byte)(pRGBArray[col] & 0x000000ff));
492
				            }
493
				        }
483
										file.readLineRGBA(pRGBArray);
484
										for(int col = 0; col < pRGBArray.length; col ++){
485
											rasterBuf.setElem(line, col, bandR, (byte)(pRGBArray[col] & 0x000000ff));
486
											rasterBuf.setElem(line, col, bandG, (byte)(pRGBArray[col] & 0x000000ff));
487
											rasterBuf.setElem(line, col, bandB, (byte)(pRGBArray[col] & 0x000000ff));
488
										}
489
								}
494 490
						return;
495 491
					}
496 492
				}
......
502 498

  
503 499
		}
504 500
		//********* END caso especial que resuelve Bug#1 **********************
505
		
501

  
506 502
		if(bandR >= 0 && bandG >= 0 && bandB >= 0) {
507 503
			for (int line = 0; line < rasterBuf.getHeight(); line++) {
508
	            file.readLineRGBA(pRGBArray);
509
	            for(int col = 0; col < pRGBArray.length; col ++){
510
	            	rasterBuf.setElem(line, col, bandR, (byte)((pRGBArray[col] & 0x00ff0000) >> 16));
511
	            	rasterBuf.setElem(line, col, bandG, (byte)((pRGBArray[col] & 0x0000ff00) >> 8));
512
	            	rasterBuf.setElem(line, col, bandB, (byte)(pRGBArray[col] & 0x000000ff));
513
	            }
514
	        }
504
							file.readLineRGBA(pRGBArray);
505
							for(int col = 0; col < pRGBArray.length; col ++){
506
								rasterBuf.setElem(line, col, bandR, (byte)((pRGBArray[col] & 0x00ff0000) >> 16));
507
								rasterBuf.setElem(line, col, bandG, (byte)((pRGBArray[col] & 0x0000ff00) >> 8));
508
								rasterBuf.setElem(line, col, bandB, (byte)(pRGBArray[col] & 0x000000ff));
509
							}
510
					}
515 511
			return;
516 512
		}
517
		
513

  
518 514
		if(readCancel) {
519 515
			readCancel = false;
520 516
			return;
521 517
		}
522
		
518

  
523 519
		if(bandR >= 0 && bandG >= 0) {
524 520
			for (int line = 0; line < rasterBuf.getHeight(); line++) {
525
	            file.readLineRGBA(pRGBArray);
526
	            for(int col = 0; col < pRGBArray.length; col ++){
527
	            	rasterBuf.setElem(line, col, bandR, (byte)((pRGBArray[col] & 0x00ff0000) >> 16));
528
	            	rasterBuf.setElem(line, col, bandG, (byte)((pRGBArray[col] & 0x0000ff00) >> 8));
529
	            }
530
	        }
521
							file.readLineRGBA(pRGBArray);
522
							for(int col = 0; col < pRGBArray.length; col ++){
523
								rasterBuf.setElem(line, col, bandR, (byte)((pRGBArray[col] & 0x00ff0000) >> 16));
524
								rasterBuf.setElem(line, col, bandG, (byte)((pRGBArray[col] & 0x0000ff00) >> 8));
525
							}
526
					}
531 527
			return;
532 528
		}
533
		
529

  
534 530
		if(readCancel) {
535 531
			readCancel = false;
536 532
			return;
537 533
		}
538
				
534

  
539 535
		if(bandR >= 0){
540 536
			for (int line = 0; line < rasterBuf.getHeight(); line++) {
541
	            file.readLineRGBA(pRGBArray);
542
	            for(int col = 0; col < pRGBArray.length; col ++)
543
	            	rasterBuf.setElem(line, col, bandR, (byte)((pRGBArray[col] & 0x00ff0000) >> 16));
544
	        }
537
							file.readLineRGBA(pRGBArray);
538
							for(int col = 0; col < pRGBArray.length; col ++)
539
								rasterBuf.setElem(line, col, bandR, (byte)((pRGBArray[col] & 0x00ff0000) >> 16));
540
					}
545 541
			return;
546 542
		}
547
		
543

  
548 544
		if(readCancel) {
549 545
			readCancel = false;
550 546
			return;
551 547
		}
552 548

  
553 549
	}
554
	
550

  
555 551
	public void reProject(ICoordTrans rp) {
556 552
	}
557 553

  
......
562 558
	 * @param originX Origen de la imagen en la coordenada X
563 559
	 * @param originY Origen de la imagen en la coordenada Y
564 560
	 */
565
	public void setExtentTransform(double originX, double originY, double psX, double psY) {		
561
	public void setExtentTransform(double originX, double originY, double psX, double psY) {
566 562
		transformRMF.setToTranslation(originX, originY);
567 563
		transformRMF.scale(psX, psY);
568
		
564

  
569 565
		transformTFW.setToTranslation(file.originX, file.originY);
570 566
		transformTFW.scale(file.cellIncrementX, file.cellIncrementY);
571 567
	}
......
585 581
	public Object readCompleteLine(int line, int band) throws InvalidSetViewException, FileNotOpenException, RasterDriverException {
586 582
		if(line < 0 || line >= file.height || band < 0 || band >= getBandCount())
587 583
			throw new InvalidSetViewException("Request out of grid");
588
		
584

  
589 585
		Point2D begin = rasterToWorld(new Point2D.Double(0, line));
590 586
		Point2D end = rasterToWorld(new Point2D.Double(file.width, line + 1));
591 587
		int[] readBandsFromECW = new int[file.numBands];
......
595 591
		}else {
596 592
			readBandsFromECW[0] = band;
597 593
		}
598
		
594

  
599 595
		Extent e = new Extent(begin.getX(), begin.getY(), end.getX(), end.getY());
600
		
596

  
601 597
		try {
602 598
			int[] value = new int[file.width];
603 599
			file.setView(file.numBands, readBandsFromECW, e.minX(), e.maxY(), e.maxX(), e.minY(), file.width, 1);
604 600
			file.readLineRGBA(value);
605
			
601

  
606 602
			if(file.numBands <= 3) {
607 603
				switch(getDataType()) {
608 604
				case IBuffer.TYPE_BYTE: byte[] b = new byte[file.width];
......
635 631
		} catch (JNCSException e1) {
636 632
			throw new RasterDriverException("Error la lectura de datos ecw");
637 633
		}
638
		
634

  
639 635
		return null;
640 636
	}
641
	
637

  
642 638
	/*
643 639
	 *  (non-Javadoc)
644 640
	 * @see org.gvsig.raster.dataset.RasterDataset#readBlock(int, int, int)
......
646 642
	public Object readBlock(int pos, int blockHeight) throws InvalidSetViewException, FileNotOpenException, RasterDriverException {
647 643
		if(pos < 0)
648 644
			throw new InvalidSetViewException("Request out of grid");
649
		
645

  
650 646
		if((pos + blockHeight) > file.height)
651 647
			blockHeight = Math.abs(file.height - pos);
652
		
648

  
653 649
		Point2D begin = rasterToWorld(new Point2D.Double(0, pos));
654 650
		Point2D end = rasterToWorld(new Point2D.Double(file.width, pos + blockHeight));
655 651
		int[] readBandsFromECW = new int[file.numBands];
656
		
652

  
657 653
		for(int i = 0; i < file.numBands; i++)
658 654
			readBandsFromECW[i] = i;
659
		
655

  
660 656
		byte[][][] buf = new byte[file.numBands][blockHeight][file.width];
661 657
		Extent e = new Extent(begin.getX(), begin.getY(), end.getX(), end.getY());
662 658
		e = RasterUtilities.calculateAdjustedView(getExtent(), e);
663
		
659

  
664 660
		try {
665 661
			int[] value = new int[file.width];
666 662
			file.setView(file.numBands, readBandsFromECW, e.minX(), e.maxY(), e.maxX(), e.minY(), file.width, blockHeight);
667
			
663

  
668 664
			if(file.numBands <= 3) {
669 665
				for (int row = 0; row < blockHeight; row++) {
670 666
					file.readLineRGBA(value);
671 667
					switch(getDataType()) {
672
					case IBuffer.TYPE_BYTE: 
668
					case IBuffer.TYPE_BYTE:
673 669
						for(int col = 0; col < file.width; col ++) {
674 670
							buf[0][row][col] = (byte)(((value[col] & 0x00ff0000) >> 16) & 0xff);
675 671
							buf[1][row][col] = (byte)(((value[col] & 0x0000ff00) >> 8) & 0xff);
......
678 674
						break;
679 675
					}
680 676
				}
681
				
677

  
682 678
				if(readCancel) {
683 679
					readCancel = false;
684 680
					return null;
685 681
				}
686
				
682

  
687 683
			} else {
688 684
				//TODO: FUNCIONALIDAD: file.numBands > 3
689 685
			}
......
696 692
		} catch (JNCSException e1) {
697 693
			throw new RasterDriverException("Error la lectura de datos ecw");
698 694
		}
699
		
695

  
700 696
		return buf;
701 697
	}
702
	
698

  
703 699
	/*
704 700
	 * (non-Javadoc)
705 701
	 * @see org.gvsig.raster.driver.RasterDataset#getData(int, int, int)
......
707 703
	public Object getData(int x, int y, int band)throws InvalidSetViewException, FileNotOpenException, RasterDriverException {
708 704
		if(x < 0 || y < 0 || x >= file.width || y >= file.height)
709 705
			throw new InvalidSetViewException("Request out of grid");
710
		
706

  
711 707
		Point2D begin = rasterToWorld(new Point2D.Double(x, y));
712 708
		Point2D end = rasterToWorld(new Point2D.Double(x + 1, y + 1));
713 709
		int[] readBandsFromECW = new int[file.numBands];
......
717 713
		}else{
718 714
			readBandsFromECW[0] = band;
719 715
		}
720
		
721
		Extent e = new Extent(begin.getX(), begin.getY(), end.getX(), end.getY());		
716

  
717
		Extent e = new Extent(begin.getX(), begin.getY(), end.getX(), end.getY());
722 718
		try {
723 719
			int[] value = new int[1];
724 720
			file.setView(file.numBands, readBandsFromECW, e.minX(), e.maxY(), e.maxX(), e.minY(), 1, 1);
......
739 735
			throw new RasterDriverException("Error reading ecw data");
740 736
		}
741 737
	}
742
	
738

  
743 739
	public void refreshUpdate(int arg0, int arg1, double arg2, double arg3, double arg4, double arg5) {
744 740
	}
745 741

  
746 742
	public void refreshUpdate(int arg0, int arg1, int arg2, int arg3, int arg4, int arg5) {
747 743
	}
748
	
744

  
749 745
	/*
750 746
	 * (non-Javadoc)
751 747
	 * @see org.gvsig.raster.driver.GeoData#getStringProjection()
......
753 749
	public String getStringProjection() throws RasterDriverException{
754 750
		return file.projection;
755 751
	}
756
	
752

  
757 753
	/*
758 754
	 *  (non-Javadoc)
759 755
	 * @see org.gvsig.raster.dataset.RasterDataset#setCanceled(boolean, int)
760 756
	 */
761 757
	public void setCanceled(boolean value, int process) {
762 758
		super.setCanceled(value, process);
763
		
759

  
764 760
		if(process == CANCEL_READ || process == 0)
765 761
			readCancel = value;
766 762
	}
......
775 771
		} else
776 772
			return super.isCanceled(process);
777 773
	}
778
	
774

  
779 775
	/*
780 776
	 * (non-Javadoc)
781 777
	 * @see org.gvsig.raster.driver.GeoData#getStringProjection()
trunk/libraries/libRaster/src/org/gvsig/raster/dataset/GeoRasterWriter.java
35 35
import org.gvsig.raster.util.extensionPoints.ExtensionPoints;
36 36
import org.gvsig.raster.util.extensionPoints.ExtensionPointsSingleton;
37 37

  
38
import es.gva.cit.jgdal.GdalException;
38 39

  
40

  
39 41
/**
40 42
 * Clase abstracta de la que heredan los drivers de escritura. Tiene los
41 43
 * m?todos abstractos que debe implementar cualquier driver de escritura
trunk/libraries/libRaster/src/org/gvsig/raster/grid/render/Rendering.java
547 547
		 */
548 548
	public void setRenderBands(int[] renderBands) {
549 549
		this.renderBands = renderBands;
550
		for (int i = 0; i < filterList.lenght(); i++) 
550
		for (int i = 0; i < filterList.lenght(); i++)
551 551
			((RasterFilter)filterList.get(i)).addParam("renderBands", renderBands);
552 552
	}
553 553

  
......
584 584
		return lastTransparency;
585 585
	}
586 586

  
587
	public void setLastTransparency(GridTransparency lastTransparency) {
588
		this.lastTransparency = lastTransparency;
589
	}
590

  
587 591
	/**
588 592
	 * Obtiene las lista de filtros aplicados en la renderizaci?n
589 593
	 * @return RasterFilterList
trunk/libraries/libRaster/src/org/gvsig/raster/grid/GridPalette.java
24 24
 *
25 25
 * @author Nacho Brodin (nachobrodin@gmail.com)
26 26
 */
27
public class GridPalette extends ColorTable implements Cloneable {
27
public class GridPalette extends ColorTable {
28 28
	/**
29 29
	 * Flag de activaci?n de la paleta cuando se visualiza o exporta.
30 30
	 */
31
	private boolean 		paletteActive = false;
31
	private boolean 		paletteActive = true;
32 32

  
33 33
	/**
34 34
	 * Constructor
35 35
	 * @param fp
36 36
	 */
37
	public GridPalette() {
38
		paletteActive = true;
39
	}
40

  
41
	/**
42
	 * Constructor
43
	 * @param fp
44
	 */
37 45
	public GridPalette(ColorTable fp){
38 46
		if (fp == null)
39 47
			return;
40 48
		this.range = fp.getRange();
49
		this.paletteActive = true;
41 50
		this.transparencyRange = fp.getTransparencyRange();
42 51
		this.paletteByBand = fp.getColorTableByBand();
43 52
		this.nameClass = fp.getNameClass();
44 53
		this.name = fp.getName();
45 54
		this.filePath = fp.getFilePath();
46 55
		this.colorItems = fp.getColorItems();
47
		paletteActive = true;
48 56
	}
49 57

  
50 58
	/**
......
62 70
	public void setPaletteActive(boolean paletteActive) {
63 71
		this.paletteActive = paletteActive;
64 72
	}
65

  
66
	/*
67
	 * (non-Javadoc)
68
	 * @see org.gvsig.raster.shared.ColorTable#clone()
69
	 */
70
	public Object clone() {
71
		return super.clone();
72
	}
73 73
}
trunk/libraries/libRaster/src/org/gvsig/raster/grid/filter/bands/ColorTableFilter.java
21 21
import org.gvsig.raster.buffer.RasterBuffer;
22 22
import org.gvsig.raster.dataset.IBuffer;
23 23
import org.gvsig.raster.dataset.Params;
24
import org.gvsig.raster.datastruct.ColorTable;
25 24
import org.gvsig.raster.grid.GridPalette;
26 25
import org.gvsig.raster.grid.filter.RasterFilter;
27 26
/**
......
40 39
public class ColorTableFilter extends RasterFilter {
41 40
	protected IBuffer      rasterResult = null;
42 41
	public static String[] names        = new String[] { "colortable" };
43
	protected GridPalette  colorTable   = new GridPalette(new ColorTable());
42
	protected GridPalette  colorTable   = new GridPalette();
44 43

  
45 44
	/**
46 45
	 * Constructor
......
96 95
	public Params getUIParams(String nameFilter) {
97 96
		Params params = new Params();
98 97
		params.setParam("colorTable",
99
				(GridPalette) colorTable.clone(),
98
				new GridPalette(colorTable),
100 99
				-1,
101 100
				null);
102 101
		return params;
trunk/libraries/libRaster/src/org/gvsig/raster/grid/filter/bands/ColorTableListManager.java
20 20

  
21 21
import java.util.ArrayList;
22 22

  
23
import org.gvsig.raster.dataset.IBuffer;
24 23
import org.gvsig.raster.dataset.Params;
25 24
import org.gvsig.raster.datastruct.ColorTable;
26 25
import org.gvsig.raster.grid.GridPalette;
trunk/libraries/libRaster/src/org/gvsig/raster/grid/Grid.java
253 253
				transparency = new GridTransparency(transp);
254 254
			this.palette = new GridPalette[ds.getColorTables().length];
255 255
			for(int iPal = 0; iPal < ds.getColorTables().length; iPal++) {
256
				if(ds.getColorTables()[iPal] != null)
256
				if (ds.getColorTables()[iPal] != null)
257 257
					this.palette[iPal] = new GridPalette(ds.getColorTables()[iPal]);
258 258
			}
259 259
		}
trunk/libraries/libRaster/src/org/gvsig/raster/datastruct/ColorItem.java
26 26
 * @version 04/07/2007
27 27
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
28 28
 */
29
public class ColorItem {
29
public class ColorItem implements Cloneable {
30 30
	private double value = 0.0f;
31 31
	private String nameClass = null;
32 32
	private Color color = Color.black;
......
101 101
	public void setNameClass(String nameClass) {
102 102
		this.nameClass = nameClass;
103 103
	}
104

  
105
	/*
106
	 * (non-Javadoc)
107
	 * @see java.lang.Object#clone()
108
	 */
109
	public Object clone() {
110
		ColorItem clone = null;
111
		try {
112
			clone = (ColorItem) super.clone();
113
		} catch (CloneNotSupportedException e) {
114
		}
115

  
116
		if (color != null)
117
			clone.color = new Color(color.getRGB(), (color.getAlpha() != 255));
118

  
119
		if (nameClass != null)
120
			clone.nameClass = new String(nameClass);
121

  
122
		return clone;
123
	}
104 124
}
trunk/libraries/libRaster/src/org/gvsig/raster/datastruct/ColorTable.java
110 110
		return name;
111 111
	}
112 112

  
113
//	static int total = 0;
113 114
	public void createPaletteFromColorItems(ArrayList colorItems, boolean compress) {
114 115
		this.colorItems = colorItems;
115 116

  
116 117
		// Ordena la paleta
117 118
		sortPalette(colorItems);
118

  
119
//		System.out.println(name);
120
//		System.out.println("----- Sin comprimir (" + colorItems.size() + ") -----");
121 119
/*
120
		System.out.println(name);
121
		System.out.println("----- Sin comprimir (" + colorItems.size() + ") -----");
122
*/
123
/*
122 124
		if (name.equals("MDT1")) {
123 125
			for (int i=0; i<colorItems.size(); i++) {
124 126
				ColorItem c1 = ((ColorItem) colorItems.get(i));
......
131 133
		// para poder hacer interpolaciones
132 134
		if (compress)
133 135
			compressPalette(colorItems);
134

  
135
//		System.out.println("------ Comprimido (" + colorItems.size() + ") ------");
136 136
/*
137
		System.out.println("------ Comprimido (" + colorItems.size() + ") ------");
138
		total += colorItems.size();
139
		System.out.println("------ Total (" + total + ")----");
140
*/
141
/*
137 142
		if (name.equals("MDT1")) {
138 143
			for (int i=0; i<colorItems.size(); i++) {
139 144
				ColorItem c1 = ((ColorItem) colorItems.get(i));
......
146 151
		applyPalette(colorItems);
147 152
	}
148 153

  
149
	int error = 8;
154
	private int error = 8;
150 155
	private boolean isEqualColor(Color c1, Color c2) {
151 156
		if (c2.getRed() < (c1.getRed() - error)) return false;
152 157
		if (c2.getGreen() < (c1.getGreen() - error)) return false;
......
193 198
	}
194 199

  
195 200
	private void compressPalette(ArrayList colorItems) {
196
		int init = 0;
197
		int posMax = 2;
198
		while (init < colorItems.size()) {
199
			if ((posMax < colorItems.size()) && canDelete(init, posMax)) {
200
				posMax++;
201
				continue;
201
		int size = -1;
202

  
203
		while (size != colorItems.size()) {
204
			int init = 0;
205
			int posMax = 2;
206

  
207
			size = colorItems.size();
208
			while (init < colorItems.size()) {
209
				if ((posMax < colorItems.size()) && canDelete(init, posMax)) {
210
					posMax++;
211
					continue;
212
				}
213
				if ((init + 2) < posMax) {
214
					if (canDelete(init, posMax - 1))
215
						for (int i = (posMax - 2); i > init; i--)
216
							if (i < colorItems.size())
217
								colorItems.remove(i);
218
				}
219
				init++;
220
				posMax = init + 2;
202 221
			}
203
			if ((init + 2) < posMax) {
204
				if (canDelete(init, posMax - 1))
205
					for (int i = (posMax - 2); i > init; i--)
206
						if (i < colorItems.size())
207
							colorItems.remove(i);
208
			}
209
			init++;
210
			posMax = init + 2;
211 222
		}
212 223
	}
213 224

  
......
337 348
		} catch (CloneNotSupportedException e) {
338 349
		}
339 350

  
351
		if (colorItems != null) {
352
			clone.colorItems = new ArrayList();
353
			for (int i = 0; i < colorItems.size(); i++) {
354
				clone.colorItems.add(((ColorItem) colorItems.get(i)).clone());
355
			}
356
		}
357

  
340 358
		if (filePath != null)
341 359
			clone.filePath = new String(filePath);
342 360

  
......
355 373
				clone.paletteByBand[i] = (byte[]) paletteByBand[i].clone();
356 374
		}
357 375

  
376
		if (range != null)
377
			clone.range = (double[]) range.clone();
378

  
379
		if (transparencyRange != null) {
380
			clone.transparencyRange = new ArrayList();
381
			for (int i = 0; i < transparencyRange.size(); i++) {
382
				clone.transparencyRange.add(((TransparencyRange) transparencyRange.get(i)).clone());
383
			}
384
		}
385

  
358 386
		return clone;
359 387
	}
360 388

  
......
407 435
	}
408 436

  
409 437
	/*
410
	 * TODO: RENDIMIENTO: Incluir una heuristica que dado un valor se compare con el
411
	 * valor de la mitad de la tabla y si es menor se empieza a recorrer desde el principio
412
	 * sino se empieza a recorrer desde la mitad de la tabla hasta abajo. Esto hace
413
	 * que se reduzca la tabla a la mitad de valores haciendo solo una comparaci?n.
438
	 * TODO: RENDIMIENTO: Incluir una heuristica que dado un valor se compare con
439
	 * el valor de la mitad de la tabla y si es menor se empieza a recorrer desde
440
	 * el principio sino se empieza a recorrer desde la mitad de la tabla hasta
441
	 * abajo. Esto hace que se reduzca la tabla a la mitad de valores haciendo
442
	 * solo una comparaci?n.
414 443
	 */
415 444
	/**
416 445
	 * Obtiene el valor RGB para un clave entera pasada por par?metro
......
418 447
	 * @return valor RGB
419 448
	 */
420 449
	public byte[] getRGBByBand(double value) {
421
		int init = 1;
422
		for (int i = init; i <= range.length; i++) {
450
		for (int i = 1; i <= range.length; i++) {
423 451
			if (i < range.length) {
424 452
				if (value < range[i])
425 453
					return paletteByBand[i - 1];
......
430 458
		return new byte[4];
431 459
	}
432 460

  
461
	/*
462
	 * TODO: Usar el m?todo Quicksort para ordenar
463
	 */
433 464
	/**
434 465
	 * Ordena el ColorItems de manera ascendente. De momento se usa el m?todo de
435 466
	 * ordenaci?n por burbuja.
436 467
	 */
437
	// TODO: Usar el m?todo Quicksort para ordenar
438 468
	private void sortPalette(ArrayList colorItems) {
439 469
		for (int i = 0; i < colorItems.size(); i++) {
440 470
			for (int j = i + 1; j < colorItems.size(); j++) {
trunk/libraries/libRaster/src/org/gvsig/raster/datastruct/serializer/ColorTableRmfSerializer.java
22 22
import java.io.Reader;
23 23
import java.io.StringReader;
24 24

  
25
import org.gvsig.raster.dataset.IBuffer;
26 25
import org.gvsig.raster.dataset.io.rmf.ClassSerializer;
27 26
import org.gvsig.raster.dataset.io.rmf.ParsingException;
28 27
import org.gvsig.raster.datastruct.ColorTable;
29 28
import org.kxml2.io.KXmlParser;
30 29
import org.xmlpull.v1.XmlPullParserException;
31

  
32 30
/**
33 31
 * <P>
34 32
 * Clase para convertir a XML una tabla de color y obtener la tabla desde XML.
......
49 47
 *</P>
50 48
 *
51 49

  
52
<ColorTable>
53
	<Color value="0.0">
54
		<Name>Rojo</Name>
55
		<RGB>#FF34FF00</RGB>
56
		<Interpolated>50</Interpolated>
57
	</Color>
58
	<Alpha value="0.0">
59
		<Number>255</Number>
60
		<Interpolated>50</Interpolated>
61
	</Alpha>
50
<ColorTable name="nombre" version="1.1">
51
	<Color value="0.0" name="rojo" rgb="#FF34FF" interpolated="50"/>
52
	<Color value="1.0" name="rojo" rgb="#FF34FF" interpolated="50"/>
53
	<Alpha value="0.0" number="255" interpolated="50"/>
54

  
55
	<NoData rgba="#">
62 56
</ColorTable>
63 57

  
64 58

  

Also available in: Unified diff