Statistics
| Revision:

svn-gvsig-desktop / branches / org.gvsig.desktop-2018a / org.gvsig.desktop.library / org.gvsig.raster / org.gvsig.raster.lib / org.gvsig.raster.lib.buffer.spi / src / main / java / org / gvsig / raster / lib / buffer / spi / operations / AbstractSpecifiedBandsOperation.java @ 43835

History | View | Annotate | Download (2.61 KB)

1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2018 gvSIG Association
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., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.raster.lib.buffer.spi.operations;
24

    
25
import java.util.ArrayList;
26
import java.util.List;
27

    
28
import org.gvsig.raster.lib.buffer.api.BandInfo;
29
import org.gvsig.raster.lib.buffer.api.exceptions.BufferOperationException;
30
import org.gvsig.raster.lib.buffer.api.operations.SpecifiedBandsOperation;
31
import org.gvsig.raster.lib.buffer.spi.exceptions.ProcessingOperationException;
32

    
33
/**
34
 * @author fdiaz
35
 *
36
 */
37
public abstract class AbstractSpecifiedBandsOperation extends AbstractOperation implements SpecifiedBandsOperation {
38

    
39
    protected List<Integer> bandsToProcess;
40

    
41
    /**
42
     *
43
     */
44
    public AbstractSpecifiedBandsOperation() {
45
        // TODO Auto-generated constructor stub
46
    }
47

    
48
    @SuppressWarnings("unchecked")
49
    @Override
50
    public void preProcess() throws BufferOperationException {
51
        super.preProcess();
52
        if(this.parameters.getDynClass().getDynField(BANDS_TO_PROCESS_PARAM)!=null) {
53
            bandsToProcess = (List<Integer>)this.parameters.getDynValue(BANDS_TO_PROCESS_PARAM);
54
        }
55

    
56
        if(this.bandsToProcess==null) {
57
            bandsToProcess = new ArrayList<Integer>(buffer.getBandCount());
58
        };
59
        if(this.bandsToProcess.size()==0){
60
            for (int i=0; i<buffer.getBandCount(); i++){
61
                bandsToProcess.add(i);
62
            }
63
        }
64
    }
65

    
66

    
67
    /**
68
     * @param band
69
     * @return
70
     */
71
    protected boolean isProcessableBand(int band) {
72
        return bandsToProcess.contains(band);
73
    }
74

    
75

    
76
    @Override
77
    public void process() throws ProcessingOperationException {
78
        super.process();
79
    }
80

    
81
    @Override
82
    public void postProcess() throws BufferOperationException {
83
        super.postProcess();
84
    }
85
}