Statistics
| Revision:

root / trunk / libraries / libCq_CMS_praster / src / org / cresques / filter / bands / RemoveBandsFilter.java @ 8026

History | View | Annotate | Download (2.59 KB)

1
/*
2
 * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
3
 *
4
 * Copyright (C) 2004-5.
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 * cresques@gmail.com
23
 */
24
package org.cresques.filter.bands;
25

    
26
import org.cresques.filter.RasterFilter;
27
import org.cresques.io.datastruct.Statistic;
28

    
29

    
30
/**
31
 *
32
 * @author Nacho Brodin (brodin_ign@gva.es)
33
 */
34
public abstract class RemoveBandsFilter extends RasterFilter {
35
    public String bands = "RGB";
36
    protected int mascara = 0xffffffff;
37
    protected int m0 = 0xff;
38
    protected int m1 = 0xff;
39
    protected int m2 = 0xff;
40
    protected int m3 = 0xff;
41

    
42
    /**
43
     * Constructor
44
     *
45
     */
46
    public RemoveBandsFilter() {
47
        super();
48
    }
49

    
50
    /**
51
     * Operaciones que se realizan antes de la ejecuci?n del filtro
52
     */
53
    public void pre() {
54
        //Obtenci?n de par?metros comunes a todos
55
        this.stats = (Statistic) params.get("stats");
56
        this.bands = (String) params.get("bands");
57

    
58
        if (bands.compareTo("RGB") == 0) { //No modifica ninguna banda -> no se ejecuta el filtro
59
            this.exec = false;
60

    
61
            return;
62
        }
63

    
64
        if (bands.compareTo("R") == 0) {
65
            mascara = 0xff00ffff;
66
            m1 = 0x00;
67
        }
68

    
69
        if (bands.compareTo("G") == 0) {
70
            mascara = 0xffff00ff;
71
            m2 = 0x00;
72
        }
73

    
74
        if (bands.compareTo("B") == 0) {
75
            mascara = 0xffffff00;
76
            m3 = 0x00;
77
        }
78

    
79
        if (bands.compareTo("RG") == 0) {
80
            mascara = 0xff0000ff;
81
            m1 = m2 = 0x00;
82
        }
83

    
84
        if (bands.compareTo("RB") == 0) {
85
            mascara = 0xff00ff00;
86
            m1 = m3 = 0x00;
87
        }
88

    
89
        if (bands.compareTo("GB") == 0) {
90
            mascara = 0xffff0000;
91
            m2 = m3 = 0x00;
92
        }
93
    }
94

    
95
    /**
96
     * Operaciones que se realizan despu?s de la ejecuci?n del filtro
97
     */
98
    public void post() {
99
    }
100
}