Revision 12035

View differences:

trunk/libraries/libRaster/src/org/gvsig/raster/dataset/io/GdalDriver.java
78 78
		extensionPoints.add("RasterReader", "asc", GdalDriver.class);
79 79
		extensionPoints.add("RasterReader", "pgm", GdalDriver.class); //Ficheros PNM en escala de grises
80 80
		extensionPoints.add("RasterReader", "ppm", GdalDriver.class); //Ficheros PNM en RGB
81
		extensionPoints.add("RasterReader", "rst", GdalDriver.class); //IDRISIS
82
		extensionPoints.add("RasterReader", "rmf", GdalDriver.class); //Raster Matrix Format
83
		extensionPoints.add("RasterReader", "nos", GdalDriver.class);
84
		extensionPoints.add("RasterReader", "kap", GdalDriver.class); 
81 85
	}
82 86
	
83 87
	public GdalDriver(IProjection proj, Object param)throws NotSupportedExtensionException {
......
88 92
			if(param instanceof String) {
89 93
				file = new GdalNative(((String)param));
90 94
				load();
91
				readGeoInfo(((String)param));
95
				//readGeoInfo(((String)param));
92 96
			}else {
93 97
				//TODO: FUNCIONALIDAD: Formatos gestionados por gdal que no tienen extensi?n. Estos tendr?n un objeto IRegistrableRasterFormat Por ej: Grass
94 98
			}
trunk/libraries/libRaster/src/org/gvsig/raster/dataset/io/GdalWriter.java
31 31
import org.gvsig.raster.dataset.io.features.BMPFeatures;
32 32
import org.gvsig.raster.dataset.io.features.GTiffFeatures;
33 33
import org.gvsig.raster.dataset.io.features.HFAFeatures;
34
import org.gvsig.raster.dataset.io.features.IDRISIFeatures;
34 35
import org.gvsig.raster.dataset.io.features.ILWIS_MprFeatures;
36
import org.gvsig.raster.dataset.io.features.PAuxFeatures;
35 37
import org.gvsig.raster.dataset.io.features.PNM_PgmFeatures;
36 38
import org.gvsig.raster.dataset.io.features.PNM_PpmFeatures;
39
import org.gvsig.raster.dataset.io.features.RMFFeatures;
37 40
import org.gvsig.raster.dataset.io.features.WriteFileFormatFeatures;
38 41
import org.gvsig.raster.shared.Extent;
39 42
import org.gvsig.raster.util.RasterUtilities;
......
85 88
		
86 89
		extensionPoints.add("RasterWriter", "mpl", GdalWriter.class);
87 90
		fileFeature.put("mpl", new ILWIS_MprFeatures());
91
		
92
		extensionPoints.add("RasterWriter", "rst", GdalWriter.class);
93
		fileFeature.put("rst", new IDRISIFeatures());
94
		
95
		extensionPoints.add("RasterWriter", "rmf", GdalWriter.class);
96
		fileFeature.put("rmf", new RMFFeatures());
97
		
98
		//No salva datos. Siempre sale negra la imagen
99
		//extensionPoints.add("RasterWriter", "aux", GdalWriter.class);
100
		//fileFeature.put("aux", new PAuxFeatures());
88 101
	}
89 102
    
90 103
    private es.gva.cit.jgdal.GdalDriver		drv;
......
260 273
    	Param rrd = (Param)p.getParamById("rrd");
261 274
    	if(rrd != null)
262 275
    		paramList.add("HFA_USE_RRD=" + rrd.defaultValue);
276
    	Param mtw = (Param)p.getParamById("Mtw");
277
    	if(mtw != null)
278
    		paramList.add("MTW=" + mtw.defaultValue);
279
    	Param tw = (Param)p.getParamById("Tile Width");
280
    	if(tw != null)
281
    		paramList.add("BLOCKXSIZE=" + tw.defaultValue);
282
    	Param th = (Param)p.getParamById("Tile Height");
283
    	if(th != null)
284
    		paramList.add("BLOCKYSIZE=" + th.defaultValue);
263 285

  
264 286
    	if(paramList.size() == 0)
265 287
    		return null;
trunk/libraries/libRaster/src/org/gvsig/raster/dataset/io/features/PAuxFeatures.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.dataset.io.features;
20

  
21
import org.gvsig.raster.dataset.io.GdalWriter;
22

  
23
/**
24
 * Caracteristicas del formato PAux para escritura.
25
 * Soporta tipo de datos enteros de 8 y 16 bits y reales de 32 bits.
26
 * La georreferenciaci?n y la proyecci?n son ignoradas.
27
 * 
28
 * @version 04/06/2007
29
 * @author Nacho Brodin (nachobrodin@gmail.com)
30
 *
31
 */
32
public class PAuxFeatures extends WriteFileFormatFeatures {
33
	
34
	public PAuxFeatures() {
35
		super("PAux", "aux", 3, null, GdalWriter.class);
36
	}
37
	
38
	/**
39
     * Carga los par?metros de este driver.
40
     */
41
    public void loadParams() {
42
    	super.loadParams();
43
    }
44
}
0 45

  
trunk/libraries/libRaster/src/org/gvsig/raster/dataset/io/features/IDRISIFeatures.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.dataset.io.features;
20

  
21
import org.gvsig.raster.dataset.io.GdalWriter;
22

  
23
/**
24
 * Caracteristicas del formato RST de IDRISI para escritura.
25
 * Soporta tipos de datos enteros en 8, 16 y 32 bits y coma flotante en 32 bits
26
 * Genera un fichero RDC con la descripci?n de la imagen
27
 * 
28
 * @version 04/06/2007
29
 * @author Nacho Brodin (nachobrodin@gmail.com)
30
 *
31
 */
32
public class IDRISIFeatures extends WriteFileFormatFeatures {
33
	
34
	public IDRISIFeatures() {
35
		super("RST", "rst", -1, new int[]{0, 1, 2, 3, 4}, GdalWriter.class);
36
	}
37
	
38
	/**
39
     * Carga los par?metros de este driver.
40
     */
41
    public void loadParams() {
42
    	super.loadParams();
43
    }
44
}
0 45

  
trunk/libraries/libRaster/src/org/gvsig/raster/dataset/io/features/RMFFeatures.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.dataset.io.features;
20

  
21
import org.gvsig.raster.dataset.Params;
22
import org.gvsig.raster.dataset.io.GdalWriter;
23

  
24
/**
25
 * Caracteristicas del formato Raster Matrix Format 
26
 * Soporta tipos de datos enteros en 16 bits y coma flotante en 64 bits.
27
 * ?Ojo! en la documentaci?n de gdal pone 32 bits en flotante pero no se lo traga.
28
 * 
29
 * @version 04/06/2007
30
 * @author Nacho Brodin (nachobrodin@gmail.com)
31
 *
32
 */
33
public class RMFFeatures extends WriteFileFormatFeatures {
34
	
35
	public RMFFeatures() {
36
		super("RMF", "rmf", -1, new int[]{0, 1, 3, 5}, GdalWriter.class);
37
	}
38
	
39
	/**
40
     * Carga los par?metros de este driver.
41
     */
42
    public void loadParams() {
43
    	super.loadParams();
44
    	
45
    	driverParams.setParam(	"Mtw", 
46
				"OFF", 
47
				Params.CHOICE, 
48
				new String[]{"ON", "OFF"});
49
    	driverParams.setParam(	"Tile Width", 
50
				"256", 
51
				Params.CHOICE, 
52
				new String[]{"32", "64", "128", "256", "512"});
53
    	driverParams.setParam(	"Tile Height", 
54
				"256", 
55
				Params.CHOICE, 
56
				new String[]{"32", "64", "128", "256", "512"});
57

  
58
    }
59
}
0 60

  
trunk/libraries/libRaster/src/org/gvsig/raster/grid/render/Rendering.java
590 590
	public void setFilterList(RasterFilterList filterList) {
591 591
		this.filterList = filterList;
592 592
	}
593
	
594
	/**
595
	 * Informa de si el raster tiene tabla de color asociada o no.
596
	 * @return true si tiene tabla de color y false si no la tiene.
597
	 */
598
	public boolean existColorTable() {		
599
			return (grid.getPalettes() != null && grid.getPalettes()[0] != null);
600
	}
593 601

  
594 602
}
trunk/libraries/libRaster/src/org/gvsig/raster/grid/render/ImageDrawer.java
189 189
				for(int col = 0; col < width; col ++) {
190 190
					try{
191 191
						rasterBuf.getElemByte(r[row], c[col], data);
192
						value = transparency.processRGB(0xff000000 + ((data[0] & 0xff) << 16) + ((data[1] & 0xff) << 8) + (data[2] & 0xff), row, col);
192
						if(palette != null) {
193
							value = palette.getRGB(data[0] & 0xff);
194
							value = transparency.processRGB(value, row, col);
195
						} else 
196
							value = transparency.processRGB(0xff000000 + ((data[0] & 0xff) << 16) + ((data[1] & 0xff) << 8) + (data[2] & 0xff), row, col);
197
						/*value = transparency.processRGB(0xff000000 + ((data[0] & 0xff) << 16) + ((data[1] & 0xff) << 8) + (data[2] & 0xff), row, col);
193 198
						if(palette != null)
194
							value = palette.getRGB(value);
199
							value = palette.getRGB(value);*/
195 200
						image.setRGB(col, row, value);
196 201
					} catch(ArrayIndexOutOfBoundsException e){}
197 202
				}
......
200 205
			for(int row = 0; row < rasterBuf.getHeight(); row ++) {
201 206
				for(int col = 0; col < rasterBuf.getWidth(); col ++) {
202 207
					rasterBuf.getElemByte(row, col, data);
203
					value = transparency.processRGB(0xff000000 + ((data[0] & 0xff) << 16) + ((data[1] & 0xff) << 8) + (data[2] & 0xff), row, col);
204
					if(palette != null)
205
						value = palette.getRGB(value);
208
					if(palette != null) {
209
						value = palette.getRGB(data[0] & 0xff);
210
						value = transparency.processRGB(value, row, col);
211
					} else 
212
						value = transparency.processRGB(0xff000000 + ((data[0] & 0xff) << 16) + ((data[1] & 0xff) << 8) + (data[2] & 0xff), row, col);
206 213
					image.setRGB(col, row, value);
207 214
				}
208 215
			}
trunk/libraries/libRaster/src/org/gvsig/raster/shared/IRasterRendering.java
29 29
	 */
30 30
	public RasterFilterList getRenderFilterList();
31 31
	
32
	/**
33
	 * Informa de si el raster tiene tabla de color asociada o no.
34
	 * @return true si tiene tabla de color y false si no la tiene.
35
	 */
36
	public boolean existColorTable();
37
	
32 38
}
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/properties/panels/BandSetupFileList.java
258 258
        return jPanel2;
259 259
    }
260 260
    
261
	/**
262
	 * Activa y desactiva el control
263
	 * @param enabled true para activar y false para desactivar
264
	 */
265
    public void setEnabled(boolean enabled) {
266
    	getJComboBox().setEnabled(enabled);
267
    	getJButtonAdd().setEnabled(enabled);
268
    	getJButtonRemove().setEnabled(enabled);
269
    }
270
    
261 271
    public void setResize (int nWidth, int nHeight){
262 272
    	this.jScrollPane.setSize(this.jScrollPane.getSize().width + 1, this.jScrollPane.getSize().height + 1);
263 273
    	this.jList.setSize(this.jList.getSize().width + 1, this.jList.getSize().height + 1);
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/properties/panels/BandSetupListener.java
59 59
	private FLayer		 			fLayer = null;
60 60
	private IRasterDataset			dataset = null;
61 61
	private IRasterProperties		prop = null;
62
	private boolean 				enabled = true;
62 63
	
63 64
	/**
64 65
     * N?mero de bandas.
......
274 275
	 * Acciones a ejecutar cuando se acepta
275 276
	 */
276 277
	public void accept(){
277
		setNewBandsPositionInRendering();
278
		if(enabled)
279
			setNewBandsPositionInRendering();
278 280
	}
279 281
	
280 282
	/**
281 283
	 * Acciones a ejecutar cuando se aplica
282 284
	 */
283 285
	public void apply(){
284
		setNewBandsPositionInRendering();
286
		if(enabled)
287
			setNewBandsPositionInRendering();
285 288
	}
286 289
	
287 290
	/**
......
306 309
			fLayer.getMapContext().invalidate();
307 310
		}
308 311
	}
312
	
313
	/**
314
	 * Activa o desactiva la acci?n del panel
315
	 * @param enabled true para activa y false para desactivar.
316
	 */
317
	public void setEnabledPanelAction(boolean enabled) {
318
		this.enabled = enabled;
319
	}
309 320
}
trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/properties/panels/BandSetupPanel.java
47 47
import org.gvsig.raster.dataset.RasterDataset;
48 48
import org.gvsig.raster.shared.IRasterDataset;
49 49
import org.gvsig.raster.shared.IRasterProperties;
50
import org.gvsig.raster.shared.IRasterRendering;
50 51
import org.gvsig.rastertools.properties.dialog.IRegistrablePanel;
51 52

  
52 53
import com.iver.andami.PluginServices;
......
87 88
     */
88 89
    public static final int BLUE_BAND = RasterDataset.BLUE_BAND;
89 90
    private final static String[] 	columnNames = { "R", "G", "B", "Band" };
90

  
91
    
91 92
    /**
92 93
     * Nombre del panel
93 94
     */
......
626 627
		clear();
627 628
		getFileList().clear();
628 629
		
630
		if(lyr instanceof IRasterRendering) {
631
			if(((IRasterRendering)lyr).existColorTable()) {
632
				panelListener = new BandSetupListener(this, null, null, lyr);
633
				this.setEnabled(false);
634
				return;
635
			}
636
		}
637
		
638
		this.setEnabled(true);
639
		
629 640
		if(lyr instanceof IRasterProperties)
630 641
			prop = (IRasterProperties)lyr;
631 642
			
......
635 646
		}
636 647
		
637 648
    	panelListener = new BandSetupListener(this, dataset, prop, lyr);
649
    	
638 650
	}
639 651

  
640 652
	/**
......
687 699
		return id;
688 700
	}
689 701

  
702
	/**
703
	 * Activa y desactiva el control
704
	 * @param enabled true para activar y false para desactivar
705
	 */
706
	public void setEnabled(boolean enabled) {
707
		if(panelListener != null)
708
			panelListener.setEnabledPanelAction(enabled);
709
		this.getRGBTable().setEnabled(enabled);
710
		this.getRGBBandAssignPane().setEnabled(enabled);
711
		getFileList().setEnabled(enabled);
712
	}
713
	
690 714
	/*
691 715
	 * (non-Javadoc)
692 716
	 * @see org.gvsig.rastertools.properties.dialog.IRegistrablePanel#selectTab(java.lang.String)
trunk/extensions/extRasterTools-SE/src/org/gvsig/fmap/layers/FLyrRasterSE.java
1013 1013
		return RasterDataset.fileIsSupported(file.getName());
1014 1014
	}
1015 1015

  
1016
	/*
1017
	 * (non-Javadoc)
1018
	 * @see org.gvsig.raster.shared.IRasterRendering#existColorTable()
1019
	 */
1020
	public boolean existColorTable() {
1021
		return this.getRender().existColorTable();
1022
	}
1023

  
1016 1024
}

Also available in: Unified diff