Revision 2308

View differences:

org.gvsig.raster.lizardtech/branches/org.gvsig.raster.lizardtech_dataaccess_refactoring/org.gvsig.raster.lizardtech.io/src/main/java/org/gvsig/raster/lizardtech/io/LizardTechProvider.java
457 457

  
458 458
	public DataStoreTransparency getTransparency() {
459 459
		if (fileTransparency == null)
460
			fileTransparency = new DataStoreTransparency();
460
			fileTransparency = new DataStoreTransparency(getColorInterpretation());
461 461
		return fileTransparency;
462 462
	}
463 463

  
464 464
	public DataStoreColorInterpretation getColorInterpretation() {
465
		if (colorInterpr == null) {
465
		if(colorInterpr == null) {
466 466
			colorInterpr = new DataStoreColorInterpretation();
467 467
			colorInterpr.initColorInterpretation(getBandCount());
468
			if (getBandCount() == 1)
469
				colorInterpr.setColorInterpValue(0, DataStoreColorInterpretation.GRAY_BAND);
470
			if (getBandCount() >= 3) {
471
				colorInterpr.setColorInterpValue(0, DataStoreColorInterpretation.RED_BAND);
472
				colorInterpr.setColorInterpValue(1, DataStoreColorInterpretation.GREEN_BAND);
473
				colorInterpr.setColorInterpValue(2, DataStoreColorInterpretation.BLUE_BAND);
468
			if(getBandCount() == 1)
469
				colorInterpr = DataStoreColorInterpretation.createGrayInterpretation();
470
			if(getBandCount() == 3) {
471
				colorInterpr =  DataStoreColorInterpretation.createRGBInterpretation();
474 472
			}
473
			if(getBandCount() >= 4) {
474
				colorInterpr = DataStoreColorInterpretation.createARGBInterpretation();
475
			}
475 476
		}
476 477
		return colorInterpr;
477 478
	}
org.gvsig.raster.wmts/branches/org.gvsig.raster.wmts_dataaccess_refactoring/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/WMTSProvider.java
380 380
	 */
381 381
	public ColorInterpretation getColorInterpretation() {
382 382
		if(super.getColorInterpretation() == null) {
383
			ColorInterpretation colorInterpretation = new DataStoreColorInterpretation();
384
			colorInterpretation.initColorInterpretation(getBandCount());
385
			if(getBandCount() >= 3) {
386
				colorInterpretation.setColorInterpValue(0, DataStoreColorInterpretation.RED_BAND);
387
				colorInterpretation.setColorInterpValue(1, DataStoreColorInterpretation.GREEN_BAND);
388
				colorInterpretation.setColorInterpValue(2, DataStoreColorInterpretation.BLUE_BAND);
389
			}
383
			ColorInterpretation colorInterpretation = new DataStoreColorInterpretation(getBandCount());
384
			
385
			if(getBandCount() == 1) 
386
				colorInterpretation = DataStoreColorInterpretation.createGrayInterpretation();
387
			
388
			if(getBandCount() == 3) 
389
				colorInterpretation = DataStoreColorInterpretation.createRGBInterpretation();
390
			
390 391
			if(getBandCount() == 4)
391
				colorInterpretation.setColorInterpValue(3, DataStoreColorInterpretation.ALPHA_BAND);
392
			if(getBandCount() > 4 || getBandCount() < 3) {
392
				colorInterpretation = DataStoreColorInterpretation.createARGBInterpretation();
393
			
394
			if(getBandCount() > 4 || getBandCount() == 2) {
393 395
				for (int i = 0; i < getBandCount(); i++) {
394 396
					colorInterpretation.setColorInterpValue(i, DataStoreColorInterpretation.UNDEF_BAND);
395 397
				}
......
560 562
	
561 563
	public Transparency getTransparency() {
562 564
		if(lastFileTransparency == null) {
563
			lastFileTransparency = new DataStoreTransparency();
565
			lastFileTransparency = new DataStoreTransparency(getColorInterpretation());
564 566
			lastFileTransparency.setTransparencyBand(3);
565 567
		}
566 568
		return lastFileTransparency;
org.gvsig.raster.multifile/branches/org.gvsig.raster.multifile_dataaccess_refactoring/org.gvsig.raster.multifile.io/src/main/java/org/gvsig/raster/multifile/io/MultiFileProvider.java
698 698

  
699 699
	public DataStoreTransparency getTransparency() {
700 700
		if(fileTransparency == null)
701
			fileTransparency = new DataStoreTransparency();
701
			fileTransparency = new DataStoreTransparency(getColorInterpretation());
702 702
		return fileTransparency;
703 703
	}
704 704

  
org.gvsig.raster.multifile/branches/org.gvsig.raster.multifile_dataaccess_refactoring/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorPanel.java
542 542
	public void readDrawedBands() {
543 543
		if (fLayer.getRender() != null) {
544 544
			int[] renderBands = fLayer.getRender().getRenderBands();
545
			Transparency transp = fLayer.getRender().getLastTransparency();
545
			Transparency transp = fLayer.getRender().getRenderingTransparency();
546 546
			if(transp != null && transp.getAlphaBandNumber() != -1)
547 547
				this.assignBand(transp.getAlphaBandNumber(), RasterDataStore.ALPHA_BAND);
548 548
			for (int i = 0; i < renderBands.length; i++) {
......
616 616
		ArrayList aux = (ArrayList) getPanelGroup().getProperties().get("renderBands");
617 617
		Integer alphaBand = (Integer) getPanelGroup().getProperties().get("alphaBand");
618 618
		
619
		int[] renderBands = new int[aux.size()];
619
		int[] renderBands = new int[aux.size() + 1];
620 620
		for (int i = 0; i < aux.size(); i++)
621 621
			renderBands[i] = ((Integer) aux.get(i)).intValue();
622
		renderBands[aux.size()] = alphaBand.intValue();
622 623

  
623 624
		if(fLayer.getRender() != null) {
624 625
			fLayer.getRender().setRenderBands(renderBands);
625 626
			if(alphaBand != null) {
626 627
				// Ultima transparencia aplicada en el renderizador
627
				Transparency gt = fLayer.getRender().getLastTransparency();
628
				Transparency gt = fLayer.getRender().getRenderingTransparency();
628 629
				if(gt != null) 
629 630
					gt.setTransparencyBand(alphaBand.intValue());
630 631
			}
org.gvsig.raster.multifile/branches/org.gvsig.raster.multifile_dataaccess_refactoring/org.gvsig.raster.multifile.app.multifileclient/src/main/java/org/gvsig/raster/multifile/app/panel/BandSelectorPropertiesListener.java
305 305
		if (fLayer != null && fLayer.getRender() != null) {
306 306
			fLayer.getRender().setRenderBands(new int[]{bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.RED_BAND),
307 307
					bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.GREEN_BAND),
308
					bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.BLUE_BAND)});
308
					bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.BLUE_BAND),
309
					bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.ALPHA_BAND)});
309 310
			int alphaBand = bandSetupPanel.getColorInterpretationByColorBandBand(RasterDataStore.ALPHA_BAND);
310
			Transparency gt = fLayer.getRender().getLastTransparency();
311
			Transparency gt = fLayer.getRender().getRenderingTransparency();
311 312
			if(gt != null)
312 313
				gt.setTransparencyBand(alphaBand);
313 314
			fLayer.getMapContext().invalidate();
org.gvsig.raster.wcs/branches/org.gvsig.raster.wcs_dataaccess_refactoring/org.gvsig.raster.wcs.io/src/main/java/org/gvsig/raster/wcs/io/WCSProvider.java
176 176
			ColorInterpretation colorInterpretation = new DataStoreColorInterpretation();
177 177
			colorInterpretation.initColorInterpretation(getBandCount());
178 178
			if(getBandCount() == 3) {
179
				colorInterpretation.setColorInterpValue(0, DataStoreColorInterpretation.RED_BAND);
180
				colorInterpretation.setColorInterpValue(1, DataStoreColorInterpretation.GREEN_BAND);
181
				colorInterpretation.setColorInterpValue(2, DataStoreColorInterpretation.BLUE_BAND);
179
				colorInterpretation = DataStoreColorInterpretation.createRGBInterpretation();
182 180
			} else {
183 181
				for (int i = 0; i < getBandCount(); i++) {
184 182
					colorInterpretation.setColorInterpValue(i, DataStoreColorInterpretation.GRAY_BAND);
......
249 247
	
250 248
	public Transparency getTransparency() {
251 249
		if(fileTransparency == null)
252
			fileTransparency = new DataStoreTransparency();
250
			fileTransparency = new DataStoreTransparency(getColorInterpretation());
253 251
		return fileTransparency;
254 252
	}
255 253

  
org.gvsig.raster.wcs/branches/org.gvsig.raster.wcs_dataaccess_refactoring/org.gvsig.raster.wcs.app.wcsclient/src/main/java/org/gvsig/raster/wcs/app/wcsclient/layer/FLyrWCS.java
494 494
    }
495 495

  
496 496
    public Transparency getRenderTransparency() {
497
        return getRender().getLastTransparency();
497
        return getRender().getRenderingTransparency();
498 498
    }
499 499

  
500 500
    public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale, PrintRequestAttributeSet properties) throws ReadException {
org.gvsig.raster.reproject/branches/org.gvsig.raster.reproject_dataaccess_refactoring/org.gvsig.raster.reproject.algorithm/src/main/java/org/gvsig/raster/reproject/algorithm/ReprojectProcess.java
22 22
package org.gvsig.raster.reproject.algorithm;
23 23

  
24 24
import org.cresques.cts.IProjection;
25
import org.gvsig.fmap.dal.coverage.exception.CloneException;
26 25
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException;
27 26
import org.gvsig.fmap.dal.coverage.store.RasterDataStore;
28 27
import org.gvsig.i18n.Messages;
......
89 88
	public void process() throws ProcessInterruptedException {
90 89
		insertLineLog(Messages.getText("reprojecting"));
91 90
		
92
		try {
93
			store = store.cloneDataStore();
94
		} catch (CloneException e1) {
95
			messageBoxError("error_reprojecting", this, e1);
96
		}
91
		store = store.newNotTiledDataStore();
97 92
		
98 93
		reproject = new Reproject(store, filename, interpolation, this);
99 94
		try {
org.gvsig.raster.reproject/branches/org.gvsig.raster.reproject_dataaccess_refactoring/org.gvsig.raster.reproject.algorithm/src/main/java/org/gvsig/raster/reproject/algorithm/Reproject.java
31 31
import org.gvsig.fmap.dal.coverage.dataset.BufferParam;
32 32
import org.gvsig.fmap.dal.coverage.datastruct.Extent;
33 33
import org.gvsig.fmap.dal.coverage.datastruct.NoData;
34
import org.gvsig.fmap.dal.coverage.exception.InvalidSetViewException;
35 34
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException;
36
import org.gvsig.fmap.dal.coverage.exception.RasterDriverException;
35
import org.gvsig.fmap.dal.coverage.exception.QueryException;
37 36
import org.gvsig.fmap.dal.coverage.store.RasterDataStore;
38 37
import org.gvsig.fmap.dal.coverage.store.RasterQuery;
39 38
import org.gvsig.raster.algorithm.process.DataProcess;
......
137 136
			}
138 137
			
139 138
			process.exportRaster(pathDest, buf, cellSize, newBbox.getULX(), newBbox.getULY());
140
		} catch (RasterDriverException e) {
141
			new ReprojectException("", e);
142 139
		} catch (ProcessInterruptedException e) {
143
		} catch (InvalidSetViewException e) {
140
		} catch (QueryException e) {
144 141
			new ReprojectException("", e);
145 142
		}
146 143
		
org.gvsig.raster.reproject/branches/org.gvsig.raster.reproject_dataaccess_refactoring/org.gvsig.raster.reproject.algorithm/pom.xml
8 8
	<parent>
9 9
		<groupId>org.gvsig</groupId>
10 10
		<artifactId>org.gvsig.raster.reproject</artifactId>
11
		<version>2.1.0-SNAPSHOT</version>
11
		<version>2.2.0-SNAPSHOT</version>
12 12
	</parent>
13 13
	
14 14
    <dependencies>
org.gvsig.raster.reproject/branches/org.gvsig.raster.reproject_dataaccess_refactoring/org.gvsig.raster.reproject.app.reprojectclient/pom.xml
10 10
    <parent>
11 11
        <groupId>org.gvsig</groupId>
12 12
        <artifactId>org.gvsig.raster.reproject</artifactId>
13
        <version>2.1.0-SNAPSHOT</version>
13
        <version>2.2.0-SNAPSHOT</version>
14 14
    </parent>
15 15
    
16 16
    <dependencies>
org.gvsig.raster.reproject/branches/org.gvsig.raster.reproject_dataaccess_refactoring/pom.xml
3 3
	<modelVersion>4.0.0</modelVersion>
4 4
	<artifactId>org.gvsig.raster.reproject</artifactId>
5 5
	<packaging>pom</packaging>
6
	<version>2.1.0-SNAPSHOT</version>
6
	<version>2.2.0-SNAPSHOT</version>
7 7
	<name>Raster reprojection support for gvSIG</name>
8 8
	<description>Raster reprojection support for gvSIG</description>
9 9
	<inceptionYear>2013</inceptionYear>
......
33 33
    	    <dependency>
34 34
            	<groupId>org.gvsig</groupId>
35 35
            	<artifactId>org.gvsig.raster.mainplugin</artifactId>
36
            	<version>2.1.0-SNAPSHOT</version>
36
            	<version>2.2.0-SNAPSHOT</version>
37 37
        	</dependency>
38 38
	        <dependency>
39 39
				<groupId>org.gvsig</groupId>
40 40
				<artifactId>org.gvsig.raster.algorithm</artifactId>
41
				<version>2.1.0-SNAPSHOT</version>
41
				<version>2.2.0-SNAPSHOT</version>
42 42
			</dependency>
43 43
			<dependency>
44 44
				<groupId>org.gvsig</groupId>
45 45
				<artifactId>org.gvsig.raster.lib.api</artifactId>
46
				<version>2.1.0-SNAPSHOT</version>
46
				<version>2.2.0-SNAPSHOT</version>
47 47
			</dependency>
48 48
	        <dependency>
49 49
	            <groupId>org.gvsig</groupId>
50 50
	            <artifactId>org.gvsig.raster.lib.impl</artifactId>
51
	            <version>2.1.0-SNAPSHOT</version>
51
	            <version>2.2.0-SNAPSHOT</version>
52 52
	        </dependency>
53 53
	        <dependency>
54 54
				<groupId>org.gvsig</groupId>
55 55
				<artifactId>org.gvsig.raster.swing.api</artifactId>
56
				<version>2.1.0-SNAPSHOT</version>
56
				<version>2.2.0-SNAPSHOT</version>
57 57
			</dependency>
58 58
	        <dependency>
59 59
	            <groupId>org.gvsig</groupId>
60 60
	            <artifactId>org.gvsig.raster.swing.impl</artifactId>
61
	            <version>2.1.0-SNAPSHOT</version>
61
	            <version>2.2.0-SNAPSHOT</version>
62 62
	        </dependency>
63 63
	        <dependency>
64 64
				<groupId>org.gvsig</groupId>
65 65
				<artifactId>org.gvsig.raster.fmap</artifactId>
66
				<version>2.1.0-SNAPSHOT</version>
66
				<version>2.2.0-SNAPSHOT</version>
67 67
			</dependency>
68 68
		    <dependency>
69 69
				<groupId>org.gvsig</groupId>
70 70
				<artifactId>org.gvsig.raster.reproject.algorithm</artifactId>
71
				<version>2.1.0-SNAPSHOT</version>
71
				<version>2.2.0-SNAPSHOT</version>
72 72
			</dependency>
73 73
    	</dependencies>
74 74
    </dependencyManagement>
org.gvsig.raster.tools/branches/org.gvsig.raster.tools_dataaccess_refactoring/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/filter/regionalpha/RegionAlphaFloatFilter.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.raster.tools.app.basic.tool.filter.regionalpha;
23

  
24
import java.awt.image.DataBuffer;
25

  
26
/**
27
 * Clase vacia para que sepa que se puede instanciar este tipo de datos
28
 * @version 17/01/2008
29
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
30
 */
31
public class RegionAlphaFloatFilter extends RegionAlphaFilter {
32
	public int getInRasterDataType() {return DataBuffer.TYPE_FLOAT;}
33
	public int getOutRasterDataType() { return DataBuffer.TYPE_FLOAT;}
34
}
org.gvsig.raster.tools/branches/org.gvsig.raster.tools_dataaccess_refactoring/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/filter/regionalpha/RegionAlphaDoubleFilter.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.raster.tools.app.basic.tool.filter.regionalpha;
23

  
24
import java.awt.image.DataBuffer;
25

  
26
/**
27
 * Clase vacia para que sepa que se puede instanciar este tipo de datos
28
 * @version 17/01/2008
29
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
30
 */
31
public class RegionAlphaDoubleFilter extends RegionAlphaFilter {
32
	public int getInRasterDataType() {return DataBuffer.TYPE_DOUBLE;}
33
	public int getOutRasterDataType() { return DataBuffer.TYPE_DOUBLE;}
34
}
org.gvsig.raster.tools/branches/org.gvsig.raster.tools_dataaccess_refactoring/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/filter/regionalpha/RegionAlphaIntegerFilter.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.raster.tools.app.basic.tool.filter.regionalpha;
23

  
24
import java.awt.image.DataBuffer;
25

  
26
/**
27
 * Clase vacia para que sepa que se puede instanciar este tipo de datos
28
 * @version 17/01/2008
29
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
30
 */
31
public class RegionAlphaIntegerFilter extends RegionAlphaFilter {
32
	public int getInRasterDataType() {return DataBuffer.TYPE_INT;}
33
	public int getOutRasterDataType() { return DataBuffer.TYPE_INT;}
34
}
org.gvsig.raster.tools/branches/org.gvsig.raster.tools_dataaccess_refactoring/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/filter/regionalpha/RegionAlphaShortFilter.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.raster.tools.app.basic.tool.filter.regionalpha;
23

  
24
import java.awt.image.DataBuffer;
25

  
26
/**
27
 * Clase vacia para que sepa que se puede instanciar este tipo de datos
28
 * @version 17/01/2008
29
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
30
 */
31
public class RegionAlphaShortFilter extends RegionAlphaFilter {
32
	public int getInRasterDataType() {return DataBuffer.TYPE_SHORT;}
33
	public int getOutRasterDataType() { return DataBuffer.TYPE_SHORT;}
34
}
org.gvsig.raster.tools/branches/org.gvsig.raster.tools_dataaccess_refactoring/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/filter/regionalpha/RegionAlphaByteFilter.java
21 21
 */
22 22
package org.gvsig.raster.tools.app.basic.tool.filter.regionalpha;
23 23

  
24
import java.awt.image.DataBuffer;
24
import org.gvsig.raster.roi.ROI;
25 25

  
26 26
/**
27
 * Clase vacia para que sepa que se puede instanciar este tipo de datos
28
 * @version 17/01/2008
29
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
27
 * Writes the alpha band filtering with the ROI
28
 * @author Nacho Brodin (nachobrodin@gmail.com)
30 29
 */
31 30
public class RegionAlphaByteFilter extends RegionAlphaFilter {
32
	public int getInRasterDataType() {return DataBuffer.TYPE_BYTE;}
33
	public int getOutRasterDataType() { return DataBuffer.TYPE_BYTE;}
31
	public void process(int x, int y) {
32
		if(bufferExtent == null) {
33
			for (int j = 0; j < raster.getBandCount(); j++) 
34
				rasterResult.setElem(y, x, j, raster.getElemByte(y, x, j));
35
			return;
36
		}
37
		
38
		double wcX = bufferExtent.minX() + ((((double) x) * bufferExtent.width()) / ((double) raster.getWidth()));
39
		double wcY = bufferExtent.minY() + ((((double) (raster.getHeight() - (y))) * bufferExtent.height()) / ((double) raster.getHeight()));
40
		
41
		for (int iBand = 0; iBand < numberOfBandsToProcess(); iBand++) {
42
			rasterResult.setElem(y, x, iBand, raster.getElemByte(y, x, iBand));
43
		}
44
		
45
		for (int i = 0; i < rois.size(); i++) {
46
			if (((ROI) rois.get(i)).isInside(wcX, wcY, cellsize, cellsize)) {
47
				if (inverse) {
48
					if(hasInputTransparency())
49
						rasterResult.setElem(y, x, rasterResult.getBandCount() - 1, raster.getElemByte(y, x, transparency.getAlphaBandNumber()));
50
					else
51
						rasterResult.setElem(y, x, rasterResult.getBandCount() - 1, (byte) 255);
52
				} else {
53
					rasterResult.setElem(y, x, rasterResult.getBandCount() - 1, (byte) (255 - alpha));
54
				}
55
				return;
56
			}
57
		}
58
		
59
		if (inverse) {
60
			rasterResult.setElem(y, x, rasterResult.getBandCount() - 1, (byte) (255 - alpha));
61
		} else {
62
			if(hasInputTransparency())
63
				rasterResult.setElem(y, x, rasterResult.getBandCount() - 1, raster.getElemByte(y, x, transparency.getAlphaBandNumber()));
64
			else
65
				rasterResult.setElem(y, x, rasterResult.getBandCount() - 1, (byte) 255);
66
		}
67
	}
34 68
}
org.gvsig.raster.tools/branches/org.gvsig.raster.tools_dataaccess_refactoring/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/filter/regionalpha/RegionAlphaUI.java
52 52
 * En el se muestra una tabla con las posibles Rois a seleccionar y tambi?n
53 53
 * un Checkbox para definir si la seleccion es normal o invertida.
54 54
 * 
55
 * @version 17/01/2008
56 55
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
57 56
 */
58 57
public class RegionAlphaUI extends JPanel implements RegistrableFilterListener, TableModelListener, ChangeListener {
......
231 230
		return params;
232 231
	}
233 232

  
234
	/*
235
	 * (non-Javadoc)
236
	 * @see javax.swing.event.TableModelListener#tableChanged(javax.swing.event.TableModelEvent)
237
	 */
238 233
	public void tableChanged(TableModelEvent e) {
239 234
		callStateChanged();
240 235
	}
......
252 247
		}
253 248
	}
254 249
	
255
	
256
	/*
257
	 * (non-Javadoc)
258
	 * @see org.gvsig.fmap.dal.coverage.grid.RegistrableFilterListener#addFilterUIListener(org.gvsig.fmap.dal.coverage.grid.FilterUIListener)
259
	 */
260 250
	public void addFilterUIListener(FilterUIListener listener) {
261 251
		if (!actionCommandListeners.contains(listener))
262 252
			actionCommandListeners.add(listener);
263 253
	}
264 254

  
265
	/*
266
	 * (non-Javadoc)
267
	 * @see org.gvsig.fmap.dal.coverage.grid.RegistrableFilterListener#callStateChanged()
268
	 */
269 255
	public void callStateChanged() {
270 256
		Iterator<FilterUIListener> acIterator = actionCommandListeners.iterator();
271 257
		while (acIterator.hasNext()) {
......
274 260
		}
275 261
	}
276 262

  
277
	/*
278
	 * (non-Javadoc)
279
	 * @see org.gvsig.fmap.dal.coverage.grid.RegistrableFilterListener#removeStateChangedListener(org.gvsig.fmap.dal.coverage.grid.FilterUIListener)
280
	 */
281 263
	public void removeStateChangedListener(FilterUIListener listener) {
282 264
		actionCommandListeners.remove(listener);
283 265
	}
org.gvsig.raster.tools/branches/org.gvsig.raster.tools_dataaccess_refactoring/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/filter/regionalpha/RegionAlphaFilter.java
25 25

  
26 26
import org.gvsig.fmap.dal.coverage.RasterLocator;
27 27
import org.gvsig.fmap.dal.coverage.dataset.Buffer;
28
import org.gvsig.fmap.dal.coverage.datastruct.GridExtent;
28
import org.gvsig.fmap.dal.coverage.datastruct.Extent;
29 29
import org.gvsig.fmap.dal.coverage.datastruct.Params;
30
import org.gvsig.fmap.dal.coverage.exception.FilterAddException;
30 31
import org.gvsig.fmap.dal.coverage.grid.filter.BaseRasterFilter;
31
import org.gvsig.fmap.dal.coverage.store.RasterDataStore;
32
import org.gvsig.fmap.dal.coverage.store.props.ColorInterpretation;
32 33
import org.gvsig.fmap.mapcontext.layers.FLayer;
33 34
import org.gvsig.raster.fmap.layers.FLyrRaster;
34 35
import org.gvsig.raster.roi.ROI;
35 36

  
36 37
/**
37 38
 * 
38
 * @version 15/01/2008
39
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
39
 * @author BorSanZa - Borja S?nchez Zamorano 
40 40
 */
41 41
public class RegionAlphaFilter extends BaseRasterFilter {
42 42
	public static String[]     names           = new String[] { "regionalpha" };
43 43
	private RegionAlphaUI      regionAlphaUI   = null;
44
	private ArrayList<ROI>     rois            = null;
45
	private Buffer             rasterAlpha     = null;
46
	private int                alpha           = 255;
44
	protected ArrayList<ROI>   rois            = null;
45
	protected int              alpha           = 255;
47 46
	protected boolean          inverse         = false;
48 47

  
49 48
	/* Variables que hacen falta en el process */
50
	private GridExtent         gridExtent      = null;
51
	private GridExtent         windowExtent    = null;
52
	private RasterDataStore    dataset         = null;
53
	private double             cellsize        = 0D;
49
	protected double           cellsize        = 0D;
50
	protected Extent           bufferExtent     = null;
54 51
	
55 52
	/**
56 53
	 * Constructor
......
60 57
		setName(names[0]);
61 58
	}
62 59

  
63
	/*
64
	 * (non-Javadoc)
65
	 * @see org.gvsig.raster.grid.filter.RasterFilter#getGroup()
66
	 */
67 60
	public String getGroup() {
68 61
		return "mascaras";
69 62
	}
70 63

  
71
	/*
72
	 * (non-Javadoc)
73
	 * @see org.gvsig.raster.grid.filter.RasterFilter#getNames()
74
	 */
75 64
	public String[] getNames() {
76 65
		return names;
77 66
	}
78 67

  
79
	/*
80
	 * (non-Javadoc)
81
	 * @see org.gvsig.raster.grid.filter.RasterFilter#getResult(java.lang.String)
82
	 */
83
	public Object getResult(String name) {
84
		if (name.equals("alphaBand"))
85
			if(rois == null || rois.size() == 0)
86
				return null;
87
			else
88
				return rasterAlpha;
89
		
90
		if (!name.equals("raster"))
91
			return null;
92

  
93
		if (!exec)
94
			return (Object) this.raster;
95

  
96
		return (Object) this.rasterResult;
97
	}
98

  
99
	/*
100
	 * (non-Javadoc)
101
	 * @see org.gvsig.raster.grid.filter.RasterFilter#getUIParams(java.lang.String)
102
	 */
103 68
	public Params getUIParams(String nameFilter) {
104 69
		Params params = RasterLocator.getManager().createParams(
105 70
				"Panel", getRegionAlphaUI(), -1, null);
......
123 88
		return regionAlphaUI;
124 89
	}
125 90

  
126
	/*
127
	 * (non-Javadoc)
128
	 * @see org.gvsig.raster.grid.filter.RasterFilter#pre()
129
	 */
130 91
	@SuppressWarnings("unchecked")
131
	public void pre() {
132
		exec = true;
133
		raster = rasterResult;
134
		raster = (Buffer) params.get("raster");
92
	public void pre() throws FilterAddException {
93
		super.pre();
135 94
		
136 95
		Boolean inverseBoolean = (Boolean) params.get("inverse");
137 96
		if (inverseBoolean != null)
138 97
			inverse = inverseBoolean.booleanValue();
139 98
		
140 99
		rois = (ArrayList<ROI>) params.get("rois");
141
		if (rois == null)
142
			rois = new ArrayList<ROI>();
143
		height = raster.getHeight();
144
		width = raster.getWidth();
145 100
		
146 101
		alpha = ((Integer) params.get("alpha")).intValue();
147 102
		
148
		gridExtent = (GridExtent) environment.get("GridExtent");
149
		windowExtent = (GridExtent) environment.get("WindowExtent");
150
		dataset = (RasterDataStore) environment.get("MultiRasterDataset");
151
		rasterAlpha = RasterLocator.getManager().createBuffer(Buffer.TYPE_BYTE, raster.getWidth(), raster.getHeight(), 1, true);
152
		cellsize = dataset.getCellSize();
103
		if(raster.getDataExtent() == null)
104
			throw new FilterAddException("Buffer extension cannot be null");
105
		
106
		bufferExtent = RasterLocator.getManager().getDataStructFactory().createExtent(raster.getDataExtent());
107
		cellsize = raster.getDataExtent().getWidth() / raster.getWidth();
108
		
109
		if(hasInputTransparency())
110
			createBufferResult(raster.getDataType(), raster.getBandCount());
111
		else
112
			createBufferResult(raster.getDataType(), raster.getBandCount() + 1);
153 113
	}
154

  
155
	/*
156
	 * (non-Javadoc)
157
	 * @see org.gvsig.raster.grid.filter.RasterFilter#post()
114
	
115
	/**
116
	 * Gets the result of this filter
158 117
	 */
118
	public Object getResult(String name) {
119
		if (name.equals(RESULT_TRANSPARENCY)) {
120
			ColorInterpretation ci = null;
121
			if(renderBands != null)
122
				ci = RasterLocator.getManager().getDataStructFactory().createColorInterpretation(renderBands);
123
			else {
124
				String[] values = new String[rasterResult.getBandCount()];
125
				for (int i = 0; i < values.length; i++) {
126
					values[i] = ColorInterpretation.UNDEF_BAND;
127
				}
128
				ci = RasterLocator.getManager().getDataStructFactory().createColorInterpretation(values);
129
			}
130
			ci.setColorInterpValue(rasterResult.getBandCount() - 1, ColorInterpretation.ALPHA_BAND);
131
			transparency.setColorInterpretation(ci);
132
			transparency.activeTransparency();
133
			return transparency;
134
		}
135
		
136
		return super.getResult(name);
137
	}
138

  
159 139
	public void post() {
160 140
	}
161 141

  
162
	/*
163
	 * (non-Javadoc)
164
	 * @see org.gvsig.raster.grid.filter.RasterFilter#process(int, int)
165
	 */
166 142
	public void process(int x, int y) {
167
		if ((windowExtent == null) || (gridExtent == null))
168
			return;
169
		double wcX = windowExtent.minX() + ((((double) x) * windowExtent.width()) / ((double) raster.getWidth()));
170
		double wcY = windowExtent.minY() + ((((double) (raster.getHeight() - (y))) * windowExtent.height()) / ((double) raster.getHeight()));
171
		
172
		for (int i = 0; i < rois.size(); i++) {
173
			if (((ROI) rois.get(i)).isInside(wcX, wcY, cellsize, cellsize)) {
174
				if (inverse)
175
					rasterAlpha.setElem(y, x, 0, (byte) 255);
176
				else
177
					rasterAlpha.setElem(y, x, 0, (byte) (255 - alpha));
178
				return;
179
			}
180
		}
181
		if (inverse)
182
			rasterAlpha.setElem(y, x, 0, (byte) (255 - alpha));
183
		else
184
			rasterAlpha.setElem(y, x, 0, (byte) 255);
185 143
	}
186

  
187
	public int getInRasterDataType() {return 0;}
188
	public int getOutRasterDataType() {return 0;}
144
	
145
	public int getInRasterDataType() {
146
		return Buffer.TYPE_BYTE;
147
	}
148
	
149
	public int getOutRasterDataType() {
150
		return Buffer.TYPE_BYTE;
151
	}
189 152
}
org.gvsig.raster.tools/branches/org.gvsig.raster.tools_dataaccess_refactoring/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/filter/regionalpha/RegionAlphaListManager.java
104 104
		addFilter(RegionAlphaFilter.class, params);
105 105
	}
106 106

  
107
	/*
108
	 * (non-Javadoc)
109
	 * @see org.gvsig.raster.grid.filter.IRasterFilterListManager#addFilter(java.lang.Class, org.gvsig.raster.dataset.Params)
110
	 */
111 107
	@SuppressWarnings("unchecked")
112
	public void addFilter(Class classFilter, Params params) throws FilterTypeException {
108
	public void addFilter(Class<?> classFilter, Params params) throws FilterTypeException {
113 109
		if (classFilter.equals(RegionAlphaFilter.class)) {
114 110
			ArrayList<ROI> rois = new ArrayList<ROI>();
115 111
			Boolean inverse = new Boolean(false);
org.gvsig.raster.tools/branches/org.gvsig.raster.tools_dataaccess_refactoring/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/filter/grayscale/GrayScaleFilter.java
24 24
import org.gvsig.fmap.dal.coverage.RasterLocator;
25 25
import org.gvsig.fmap.dal.coverage.dataset.Buffer;
26 26
import org.gvsig.fmap.dal.coverage.datastruct.Params;
27
import org.gvsig.fmap.dal.coverage.exception.FilterAddException;
27 28
import org.gvsig.fmap.dal.coverage.grid.filter.BaseRasterFilter;
28 29
/**
29 30
 * <P>
30 31
 * Clase base para los filtros de conversi?n a escala de gris
31 32
 * </P>
32 33
 *
33
 * @version 30/11/2007
34 34
 * @author Nacho Brodin (nachobrodin@gmail.com)
35 35
 */
36 36
public class GrayScaleFilter extends BaseRasterFilter {
......
51 51
		setName(names[0]);
52 52
	}
53 53

  
54
	/*
55
	 * (non-Javadoc)
56
	 * @see org.gvsig.raster.grid.filter.RasterFilter#pre()
57
	 */
58
	public void pre() {
59
		exec = true;
60
		raster = (Buffer) params.get("raster");
54
	public void pre() throws FilterAddException {
55
		super.pre();
56
		
61 57
		type = ((Integer)params.get("typeBand")).intValue();
62 58
		
63 59
		if(type == RGB && raster.getBandCount() < 3)
64 60
			type = R;
65 61
		
66
		height = raster.getHeight();
67
		width = raster.getWidth();
68
		
69
		rasterResult = RasterLocator.getManager().createBuffer(raster.getDataType(), raster.getWidth(), raster.getHeight(), raster.getBandCount(), true);
62
		createARGBBufferResult();
70 63
	}
71 64
	
72
	/*
73
	 * (non-Javadoc)
74
	 * @see org.gvsig.raster.grid.filter.RasterFilter#getGroup()
75
	 */
76 65
	public String getGroup() {
77 66
		return "colores";
78 67
	}
79 68

  
80
	/*
81
	 * (non-Javadoc)
82
	 * @see org.gvsig.raster.grid.filter.RasterFilter#getNames()
83
	 */
84 69
	public String[] getNames() {
85 70
		return names;
86 71
	}
87 72

  
88
	/*
89
	 * (non-Javadoc)
90
	 * @see org.gvsig.raster.grid.filter.RasterFilter#getResult(java.lang.String)
91
	 */
92
	public Object getResult(String name) {
93
		if (name.equals("raster"))
94
			return (Object) this.rasterResult;
95
		return null;
96
	}
97

  
98
	/*
99
	 * (non-Javadoc)
100
	 * @see org.gvsig.raster.grid.filter.RasterFilter#getUIParams(java.lang.String)
101
	 */
102 73
	public Params getUIParams(String nameFilter) {
103 74
		if(type == UNDEFINED) {
104 75
			if(this.params != null) {
......
110 81
		
111 82
		Params params = RasterLocator.getManager().createParams(
112 83
				"typeBand", 
113
				new Integer(type), 
84
				new Integer(R), 
114 85
				Params.CHOICE, 
115 86
				new String[]{ "R", "G", "B", "RGB", "GRAY"});
116 87

  
......
123 94
	public void process(int x, int y) {
124 95
	}
125 96

  
126
	/*
127
	 * (non-Javadoc)
128
	 * @see org.gvsig.raster.grid.filter.RasterFilter#getOutRasterDataType()
129
	 */
130 97
	public int getOutRasterDataType() {
131 98
		return Buffer.TYPE_BYTE;
132 99
	}
133 100

  
134
	/*
135
	 * (non-Javadoc)
136
	 * @see org.gvsig.raster.grid.filter.RasterFilter#isVisible()
137
	 */
138 101
	public boolean isVisible() {
139
		return false;
102
		return true;
140 103
	}
141 104

  
142
	/*
143
	 * (non-Javadoc)
144
	 * @see org.gvsig.raster.grid.filter.RasterFilter#getInRasterDataType()
145
	 */
146 105
	public int getInRasterDataType() {
147 106
		return Buffer.TYPE_BYTE;
148 107
	}
org.gvsig.raster.tools/branches/org.gvsig.raster.tools_dataaccess_refactoring/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/filter/grayscale/GrayScaleByteFilter.java
21 21
 */
22 22
package org.gvsig.raster.tools.app.basic.tool.filter.grayscale;
23 23

  
24

  
24 25
/**
25 26
 * Filtro para la conversi?n a escala de grises de tipo byte
26
 * 26/06/2008
27 27
 * @author Nacho Brodin nachobrodin@gmail.com
28 28
 */
29 29
public class GrayScaleByteFilter extends GrayScaleFilter {
30
	/*
31
	 * (non-Javadoc)
32
	 * @see org.gvsig.raster.grid.filter.bands.ColorTableFilter#process(int, int)
33
	 */
34 30
	public void process(int col, int line) {
35 31
		byte value = 0;
36 32
		switch (type) {
......
48 44
				break;
49 45
		}
50 46
		
51
		for (int i = 0; i < rasterResult.getBandCount(); i++) 
52
			rasterResult.setElem(line, col, i, value);
47
		rasterResult.setElem(line, col, 0, value);
48
		rasterResult.setElem(line, col, 1, value);
49
		rasterResult.setElem(line, col, 2, value);
50
		rasterResult.setElem(line, col, 3, (byte)255);
51
		
52
		writeAlphaBand(line, col);
53 53
	}
54 54
}
org.gvsig.raster.tools/branches/org.gvsig.raster.tools_dataaccess_refactoring/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/filter/grayscale/GrayScaleManager.java
37 37
/**
38 38
 * Gestor del filtro de conversi?n a escala de grises
39 39
 *
40
 * 26/06/2008
41 40
 * @author Nacho Brodin nachobrodin@gmail.com
42 41
 */
43 42
public class GrayScaleManager implements RasterFilterListManager {
......
88 87
		}
89 88
	}
90 89

  
91
	/*
92
	 * (non-Javadoc)
93
	 * @see org.gvsig.raster.grid.filter.IRasterFilterListManager#getRasterFilterList()
94
	 */
95 90
	@SuppressWarnings("unchecked")
96 91
	public ArrayList getRasterFilterList() {
97 92
		ArrayList filters = new ArrayList();
......
99 94
		return filters;
100 95
	}
101 96

  
102
	/*
103
	 * (non-Javadoc)
104
	 * @see org.gvsig.raster.grid.filter.IRasterFilterListManager#addFilter(java.lang.Class, org.gvsig.raster.dataset.Params)
105
	 */
106
	@SuppressWarnings("unchecked")
107
	public void addFilter(Class classFilter, Params params) throws FilterTypeException {
97
	public void addFilter(Class<?> classFilter, Params params) throws FilterTypeException {
108 98
		if (classFilter.equals(GrayScaleFilter.class)) {
109 99
			int type = 0;
110 100

  
......
116 106
		}
117 107
	}
118 108
	
119
	/*
120
	 * (non-Javadoc)
121
	 * @see org.gvsig.fmap.dal.coverage.grid.RasterFilterListManager#createFilter(org.gvsig.fmap.dal.coverage.datastruct.Params)
122
	 */
123 109
	public RasterFilter createFilter(Params params) {
124 110
		Integer type = ((Integer) params.getParamById("typeBand").getDefaultValue());
125 111
		
......
128 114
		return filter;
129 115
	}
130 116
	
131
	/*
132
	 * (non-Javadoc)
133
	 * @see org.gvsig.fmap.dal.coverage.grid.RasterFilterListManager#addFilter(org.gvsig.fmap.dal.coverage.datastruct.Params)
134
	 */
135 117
	public void addFilter(Params params) throws FilterTypeException {
136 118
		addFilter(GrayScaleFilter.class, params);
137 119
	}
138 120
	
139
	/*
140
	 * (non-Javadoc)
141
	 * @see org.gvsig.fmap.dal.coverage.grid.RasterFilterListManager#getFilterList()
142
	 */
143 121
	public RasterFilterList getFilterList() {
144 122
		return filterList;
145 123
	}
146 124
	
147
	/*
148
	 * (non-Javadoc)
149
	 * @see org.gvsig.fmap.dal.coverage.grid.RasterFilterListManager#setFilterList(org.gvsig.fmap.dal.coverage.grid.RasterFilterList)
150
	 */
151 125
	public void setFilterList(RasterFilterList filterList) {
152 126
		this.filterList = filterList;
153 127
	}
154 128

  
155
	/*
156
	 * (non-Javadoc)
157
	 * @see org.gvsig.raster.grid.filter.IRasterFilterListManager#createFilterListFromStrings(java.util.ArrayList, java.lang.String, int)
158
	 */
159 129
	public int createFilterListFromStrings(List<String> filters, String fil, int filteri) {
160 130
		return filteri;
161 131
	}
162 132

  
163
	/*
164
	 * (non-Javadoc)
165
	 * @see org.gvsig.raster.grid.filter.IRasterFilterListManager#getStringsFromFilterList(java.util.ArrayList, org.gvsig.raster.grid.filter.RasterFilter)
166
	 */
167 133
	public List<String> getStringsFromFilterList(List<String> filterList, RasterFilter rf) {
168 134
		return filterList;
169 135
	}
org.gvsig.raster.tools/branches/org.gvsig.raster.tools_dataaccess_refactoring/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/filter/FilterListener.java
60 60
 * c?digo que controla el panel para el manejo de un layer en la aplicaci?n de
61 61
 * filtros.
62 62
 *
63
 * @version 24/05/2007
64
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
63
 * @author BorSanZa - Borja S?nchez Zamorano 
65 64
 */
66 65
public class FilterListener implements ActionListener, TreeListComponentListener, TreeListChangeListener, PropertiesComponentListener, FilterUIListener, IProcessActions {
67 66
	private FilterPanel               filterPanel  = null;
......
141 140
	 * @param params
142 141
	 * @param classFilter
143 142
	 */
144
	@SuppressWarnings("unchecked")
145
	public void addNewParam(String name, Params params, Class classFilter) {
143
	public void addNewParam(String name, Params params, Class<?> classFilter) {
146 144
		ParamStruct param = new ParamStruct();
147 145
		param.setFilterName(name);
148 146
		param.setFilterParam(params);
......
150 148
		paramsList.add(param);
151 149
	}
152 150

  
153
	/*
154
	 * (non-Javadoc)
155
	 * @see org.gvsig.gui.beans.propertiespanel.PropertiesComponentListener#actionChangeProperties(java.util.EventObject)
156
	 */
157 151
	public void actionChangeProperties(EventObject e) {
158 152
		refreshDataProperties();
159 153
		getFilterPanel().refreshPreview();
160 154
	}
161 155

  
162
	/*
163
	 * (non-Javadoc)
164
	 * @see org.gvsig.gui.beans.treelist.listeners.TreeListChangeListener#actionChangeSelection(org.gvsig.gui.beans.treelist.event.TreeListChangeEvent)
165
	 */
166 156
	public void actionChangeSelection(TreeListChangeEvent e) {
167 157
		changePanel(e.getItem());
168 158
	}
169 159

  
170
	/*
171
	 * (non-Javadoc)
172
	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
173
	 */
174 160
	public void actionPerformed(ActionEvent e) {
175 161
		getFilterPanel().refreshPreview();
176 162
	}
177 163

  
178
	/*
179
	 * (non-Javadoc)
180
	 * @see org.gvsig.gui.beans.treelist.listeners.TreeListComponentListener#elementAdded(org.gvsig.gui.beans.treelist.event.TreeListEvent)
181
	 */
182 164
	public void elementAdded(TreeListEvent e) {
183 165
		getFilterPanel().refreshPreview();
184 166
	}
185 167

  
186
	/*
187
	 * (non-Javadoc)
188
	 * @see org.gvsig.gui.beans.treelist.listeners.TreeListComponentListener#elementMoved(org.gvsig.gui.beans.treelist.event.TreeListEvent)
189
	 */
190 168
	public void elementMoved(TreeListEvent e) {
191 169
		getFilterPanel().refreshPreview();
192 170
	}
193 171

  
194
	/*
195
	 * (non-Javadoc)
196
	 * @see org.gvsig.gui.beans.treelist.listeners.TreeListComponentListener#elementRemoved(org.gvsig.gui.beans.treelist.event.TreeListEvent)
197
	 */
198 172
	public void elementRemoved(TreeListEvent e) {
199 173
		getFilterPanel().refreshPreview();
200 174
	}
......
212 186
	 * @param layerRaster
213 187
	 * @return
214 188
	 */
215
	@SuppressWarnings("unchecked")
216 189
	public ArrayList<ParamStruct> applyFilters(FLyrRaster layerRaster) {
217 190
		ArrayList<ParamStruct> listFilterUsed = new ArrayList<ParamStruct>();
218 191

  
......
231 204

  
232 205
			RasterFilter obj = null;
233 206
			for (int j = 0; j < registeredFilters.size(); j++) {
234
				Class classFilter = (Class) registeredFilters.get(j);
207
				Class<?> classFilter = (Class<?>) registeredFilters.get(j);
235 208
				try {
236 209
					obj = (RasterFilter) classFilter.newInstance();
237 210
					if (obj.getName().equals(((RasterFilter) filtersInit.get(i)).getName()))
......
267 240
		// Metemos los filtros seleccionados en el panel
268 241
		ListModel list = getFilterPanel().getMainPanel().getTreeListContainer().getListModel();
269 242
		for (int i = 0; i < list.getSize(); i++) {
270
			Hashtable hastTable = getFilterPanel().getMainPanel().getTreeListContainer().getMap();
243
			Hashtable<?, ?> hastTable = getFilterPanel().getMainPanel().getTreeListContainer().getMap();
271 244
			for (int j = 0; j < paramsList.size(); j++) {
272 245
				boolean active = true;
273 246
				Param param = ((ParamStruct) paramsList.get(j)).getFilterParam().getParamById("enabled");
......
298 271
		return listFilterUsed;
299 272
	}
300 273

  
301
	/*
302
	 * (non-Javadoc)
303
	 * @see org.gvsig.gui.beans.imagenavigator.IClientImageNavigator#drawImage(java.awt.Graphics2D, double, double, double, double, double, int, int)
304
	 */
305 274
	public void drawImage(FLyrRaster rendering) {
306 275
		rendering.getRender().getFilterList().clear();
307 276

  
......
398 367
			filterPanel.updateNewLayerText();
399 368
	}
400 369

  
401
	/*
402
	 * (non-Javadoc)
403
	 * @see org.gvsig.raster.grid.filter.FilterUIListener#actionValuesCompleted(java.util.EventObject)
404
	 */
405 370
	public void actionValuesCompleted(EventObject e) {
406 371
		actionChangeProperties(e);
407 372
	}
408 373

  
409
	/*
410
	 * (non-Javadoc)
411
	 * @see org.gvsig.rastertools.IProcessActions#end(java.lang.Object)
412
	 */
413 374
	public void end(Object param) {
414 375
		loadLayerInToc((String) param);
415 376
	}
org.gvsig.raster.tools/branches/org.gvsig.raster.tools_dataaccess_refactoring/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/filter/mask/MaskFilter.java
24 24
import java.util.ArrayList;
25 25

  
26 26
import org.gvsig.fmap.dal.coverage.RasterLocator;
27
import org.gvsig.fmap.dal.coverage.dataset.Buffer;
28
import org.gvsig.fmap.dal.coverage.datastruct.GridExtent;
27
import org.gvsig.fmap.dal.coverage.datastruct.Extent;
29 28
import org.gvsig.fmap.dal.coverage.datastruct.NoData;
30 29
import org.gvsig.fmap.dal.coverage.datastruct.Params;
30
import org.gvsig.fmap.dal.coverage.exception.FilterAddException;
31 31
import org.gvsig.fmap.dal.coverage.grid.filter.BaseRasterFilter;
32
import org.gvsig.fmap.dal.coverage.store.RasterDataStore;
33 32
import org.gvsig.raster.fmap.layers.FLyrRaster;
34 33
import org.gvsig.raster.roi.ROI;
35 34

  
......
38 37
 * de la ROI se ponen al valor de la imagen de origen. Los p?xeles fuera
39 38
 * de la ROI se ponen a NoData.
40 39
 * 
41
 * 14/03/2008
42 40
 * @author Nacho Brodin nachobrodin@gmail.com
43 41
 */
44 42
public class MaskFilter extends BaseRasterFilter {
45
	public static String[]         names           = new String[] { "mask" };
46
	protected MaskUI               maskUI          = null;
47
	protected ArrayList<ROI>       rois            = null;
48
	protected boolean              inverse         = false;
43
	public static String[]         names            = new String[] { "mask" };
44
	protected MaskUI               maskUI           = null;
45
	protected ArrayList<ROI>       rois             = null;
46
	protected boolean              inverse          = false;
49 47
	
50 48
	//Extent de la ventana de datos y de la imagen completa.
51
	protected GridExtent           gridExtent      = null;
52
	protected GridExtent           windowExtent    = null;
53
	protected RasterDataStore      dataset         = null;
54
	protected Buffer               rasterAlpha     = null;
55
	protected NoData               noData          = null;
56
	protected double               cellsize        = 0D;
49
	protected Extent               bufferExtent     = null;
50
	protected NoData               noData           = null;
51
	protected double               cellsize         = 0D;
57 52
	
58 53
	/**
59 54
	 * Constructor
......
63 58
		setName(names[0]);
64 59
	}
65 60

  
66
	/*
67
	 * (non-Javadoc)
68
	 * @see org.gvsig.raster.grid.filter.RasterFilter#getGroup()
69
	 */
70 61
	public String getGroup() {
71 62
		return "mascaras";
72 63
	}
73 64

  
74
	/*
75
	 * (non-Javadoc)
76
	 * @see org.gvsig.raster.grid.filter.RasterFilter#getNames()
77
	 */
78 65
	public String[] getNames() {
79 66
		return names;
80 67
	}
81 68

  
82
	/*
83
	 * (non-Javadoc)
84
	 * @see org.gvsig.raster.grid.filter.RasterFilter#getResult(java.lang.String)
85
	 */
86
	public Object getResult(String name) {
87
		if (name.equals("alphaBand"))
88
			return rasterAlpha;
89
		
90
		if (!name.equals("raster"))
91
			return null;
92

  
93
		if (!exec)
94
			return (Object) this.raster;
95

  
96
		return (Object) this.rasterResult;
97
	}
98

  
99
	/*
100
	 * (non-Javadoc)
101
	 * @see org.gvsig.raster.grid.filter.RasterFilter#getUIParams(java.lang.String)
102
	 */
103 69
	public Params getUIParams(String nameFilter) {
104 70
		Params params = RasterLocator.getManager().createParams(
105 71
				"Panel", 
......
128 94
		return maskUI;
129 95
	}
130 96

  
131
	/*
132
	 * (non-Javadoc)
133
	 * @see org.gvsig.raster.grid.filter.RasterFilter#pre()
134
	 */
135 97
	@SuppressWarnings("unchecked")
136
	public void pre() {
137
		exec = true;
138
		raster = rasterResult;
139
		raster = (Buffer) params.get("raster");
98
	public void pre() throws FilterAddException {
99
		super.pre();
140 100
		Boolean inverseBoolean = (Boolean)params.get("inverse");
141 101
		if(inverseBoolean != null)
142 102
			inverse = inverseBoolean.booleanValue();
143
		Boolean transpBoolean = (Boolean)params.get("transparency");
144
								
103
		
145 104
		rois = (ArrayList<ROI>) params.get("rois");
146
		if (rois == null)
147
			rois = new ArrayList<ROI>();
148
		height = raster.getHeight();
149
		width = raster.getWidth();
150 105
		
151
		gridExtent = (GridExtent) environment.get("GridExtent");
152
		windowExtent = (GridExtent) environment.get("WindowExtent");
153
		dataset = (RasterDataStore) environment.get("MultiRasterDataset");
154
		cellsize = dataset.getCellSize();
106
		if(raster.getDataExtent() == null)
107
			throw new FilterAddException("Buffer extension cannot be null");
155 108
		
156
		rasterResult = RasterLocator.getManager().createBuffer(raster.getDataType(), 
157
															raster.getWidth(), 
158
															raster.getHeight(), 
159
															raster.getBandCount(), 
160
															true);
109
		bufferExtent = RasterLocator.getManager().getDataStructFactory().createExtent(raster.getDataExtent());
110
		cellsize = raster.getDataExtent().getWidth() / raster.getWidth();
161 111
		
162
		if(transpBoolean.booleanValue() && raster.getDataType() == Buffer.TYPE_BYTE) 
163
			rasterAlpha = RasterLocator.getManager().createBuffer(Buffer.TYPE_BYTE, raster.getWidth(), raster.getHeight(), 1, true);
112
		createBufferResult(raster.getDataType(), raster.getBandCount());
164 113
	}
165 114
		
166
	/*
167
	 * (non-Javadoc)
168
	 * @see org.gvsig.raster.grid.filter.RasterFilter#process(int, int)
169
	 */
170 115
	public void process(int x, int y) {
171 116
	}
172 117

  
173
	/*
174
	 * (non-Javadoc)
175
	 * @see org.gvsig.raster.grid.filter.RasterFilter#post()
176
	 */
177 118
	public void post() {
178 119
		rasterResult.setNoDataValue(noData);
179 120
	}
org.gvsig.raster.tools/branches/org.gvsig.raster.tools_dataaccess_refactoring/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/filter/mask/MaskShortFilter.java
25 25

  
26 26
import org.gvsig.fmap.dal.coverage.RasterLibrary;
27 27
import org.gvsig.fmap.dal.coverage.datastruct.NoData;
28
import org.gvsig.fmap.dal.coverage.exception.FilterAddException;
28 29
import org.gvsig.raster.roi.ROI;
29 30

  
30 31
/**
......
33 34
 * de la ROI se ponen a NoData. Esta clase es la gestiona los datos para los
34 35
 * raster de tipo short.
35 36
 * 
36
 * 14/03/2008
37 37
 * @author Nacho Brodin nachobrodin@gmail.com
38 38
 */
39 39
public class MaskShortFilter extends MaskFilter {
40 40
	private short nodata     = RasterLibrary.defaultShortNoDataValue;
41 41
	
42
	public void pre() {
42
	public void pre() throws FilterAddException {
43 43
		super.pre();
44 44
		noData = (NoData)params.get("nodata");
45 45
		if(noData != null && noData.isDefined())
46 46
			nodata = noData.getValue().shortValue();
47 47
	}
48 48
	
49
	/*
50
	 * (non-Javadoc)
51
	 * @see org.gvsig.raster.filter.mask.MaskFilter#process(int, int)
52
	 */
53 49
	public void process(int x, int y) {
54
		if ((windowExtent == null) || (gridExtent == null))
50
		if(bufferExtent == null) {
51
			for (int j = 0; j < raster.getBandCount(); j++) 
52
				rasterResult.setElem(y, x, j, raster.getElemShort(y, x, j));
55 53
			return;
56
		double wcX = windowExtent.minX() + ((((double) x) * windowExtent.width()) / ((double) raster.getWidth()));
57
		double wcY = windowExtent.minY() + ((((double) (raster.getHeight() - (y))) * windowExtent.height()) / ((double) raster.getHeight()));
54
		}
55
		double wcX = bufferExtent.minX() + ((((double) x) * bufferExtent.width()) / ((double) raster.getWidth()));
56
		double wcY = bufferExtent.minY() + ((((double) (raster.getHeight() - (y))) * bufferExtent.height()) / ((double) raster.getHeight()));
58 57

  
59 58
		
60 59
		if(inverse) {
61 60
			for (int i = 0; i < rois.size(); i++) {
62 61
				if (((ROI) rois.get(i)).isInside(wcX, wcY, cellsize, cellsize)) {
63
					for (int j = 0; j < raster.getBandCount(); j++) 
62
					for (int j = 0; j < numberOfBandsToProcess(); j++) 
64 63
						rasterResult.setElem(y, x, j, (short)nodata);
65 64
					return;
66 65
				}
67 66
			}
68 67
			
69
			for (int j = 0; j < raster.getBandCount(); j++) 
68
			for (int j = 0; j < numberOfBandsToProcess(); j++) 
70 69
				rasterResult.setElem(y, x, j, raster.getElemShort(y, x, j));
70
			
71 71
			return;
72 72
		}
73 73
		
74 74
		for (int i = 0; i < rois.size(); i++) {
75 75
			if (((ROI) rois.get(i)).isInside(wcX, wcY, cellsize, cellsize)) {
76
				for (int j = 0; j < raster.getBandCount(); j++) 
76
				for (int j = 0; j < numberOfBandsToProcess(); j++) 
77 77
					rasterResult.setElem(y, x, j, raster.getElemShort(y, x, j));
78 78
				return;
79 79
			}
80 80
		}
81 81
		
82
		for (int j = 0; j < raster.getBandCount(); j++) 
82
		for (int j = 0; j < numberOfBandsToProcess(); j++) 
83 83
			rasterResult.setElem(y, x, j, (short)nodata);
84
		
84 85
		return;
85 86
	}
86 87
	
87
	/*
88
	 * (non-Javadoc)
89
	 * @see org.gvsig.raster.filter.mask.MaskFilter#getInRasterDataType()
90
	 */
91 88
	public int getInRasterDataType() {
92 89
		return DataBuffer.TYPE_SHORT;
93 90
	}
94 91
	
95
	/*
96
	 * (non-Javadoc)
97
	 * @see org.gvsig.raster.filter.mask.MaskFilter#getOutRasterDataType()
98
	 */
99 92
	public int getOutRasterDataType() { 
100 93
		return DataBuffer.TYPE_SHORT;
101 94
	}
org.gvsig.raster.tools/branches/org.gvsig.raster.tools_dataaccess_refactoring/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/filter/mask/MaskListManager.java
43 43
 * capa enmascarando con regiones de inter?s. Las zonas fuera del ROI se
44 44
 * pondr?n a NoData.
45 45
 *
46
 * 14/03/2008
47 46
 * @author Nacho Brodin nachobrodin@gmail.com
48 47
 */
49 48
public class MaskListManager implements RasterFilterListManager {
......
102 101
		return filters;
103 102
	}
104 103
	
105
	/*
106
	 * (non-Javadoc)
107
	 * @see org.gvsig.fmap.dal.coverage.grid.RasterFilterListManager#getFilterList()
108
	 */
109 104
	public RasterFilterList getFilterList() {
110 105
		return filterList;
111 106
	}
112 107
	
113
	/*
114
	 * (non-Javadoc)
115
	 * @see org.gvsig.fmap.dal.coverage.grid.RasterFilterListManager#setFilterList(org.gvsig.fmap.dal.coverage.grid.RasterFilterList)
116
	 */
117 108
	public void setFilterList(RasterFilterList filterList) {
118 109
		this.filterList = filterList;
119 110
	}
120 111
	
121
	/*
122
	 * (non-Javadoc)
123
	 * @see org.gvsig.fmap.dal.coverage.grid.RasterFilterListManager#createFilter(org.gvsig.fmap.dal.coverage.datastruct.Params)
124
	 */
125 112
	@SuppressWarnings("unchecked")
126 113
	public RasterFilter createFilter(Params params) {
127 114
		ArrayList<ROI> rois = ((ArrayList<ROI>) params.getParamById("rois").getDefaultValue());
......
137 124
		return filter;
138 125
	}
139 126
	
140
	/*
141
	 * (non-Javadoc)
142
	 * @see org.gvsig.fmap.dal.coverage.grid.RasterFilterListManager#addFilter(org.gvsig.fmap.dal.coverage.datastruct.Params)
143
	 */
144 127
	public void addFilter(Params params) throws FilterTypeException {
145 128
		addFilter(MaskFilter.class, params);
146 129
	}
147 130

  
148
	/*
149
	 * (non-Javadoc)
150
	 * @see org.gvsig.raster.grid.filter.IRasterFilterListManager#addFilter(java.lang.Class, org.gvsig.raster.dataset.Params)
151
	 */
152 131
	@SuppressWarnings("unchecked")
153
	public void addFilter(Class classFilter, Params params) throws FilterTypeException {
132
	public void addFilter(Class<?> classFilter, Params params) throws FilterTypeException {
154 133
		if (classFilter.equals(MaskFilter.class)) {
155 134
			ArrayList<ROI> rois = new ArrayList<ROI>();
156 135
			Boolean inverse = new Boolean(false);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff