Revision 3578 trunk/libraries/libCq CMS for java.old/src/org/cresques/io/raster/RasterFilter.java

View differences:

RasterFilter.java
24 24
package org.cresques.io.raster;
25 25

  
26 26
import java.awt.Image;
27

  
28 27
import java.util.Hashtable;
29 28

  
29
import org.cresques.geo.ViewPortData;
30
import org.cresques.px.Extent;
30 31

  
32

  
31 33
/**
32 34
 * Filtro para raster. Ancestro de todos los filtros.
33 35
 * @author Luis W. Sevilla (sevilla_lui@gva.es)
34 36
 */
35 37
public abstract class RasterFilter implements IRasterFilter {
36
    protected RasterBuf raster = null;
37
    protected RasterStats stats = null;
38
    protected Image image = null;
39
    protected int[] px = new int[4];
40
    protected int height = 0;
41
    protected int width = 0;
42
    protected Hashtable params = new Hashtable();
43
    protected int incX = 1;
44
    protected int incY = 1;
45
    protected boolean exec = true; //Si est? a false no se ejecuta el  filtro
38
    protected RasterBuf 	raster = null;
39
    protected RasterStats 	stats = null;
40
    protected Image 		image = null;
41
    protected int[] 		px = new int[4];
42
    protected int 			height = 0;
43
    protected int 			width = 0;
44
    protected Hashtable 	params = new Hashtable();
45
    protected int 			incX = 1;
46
    protected int 			incY = 1;
47
    protected ViewPortData	viewPortData = null;
48
    protected Extent		extent = null;
49
    
50
    /**
51
     * Variable que control la aplicaci?n o no del filtro. Si est? a false aunque est? en 
52
     * la pila el filtro no se ejecutar?.
53
     */
54
    protected boolean 		exec = true; 
46 55

  
47 56
    /**
57
     * @author Nacho Brodin (brodin_ign@gva.es)
58
     */
59
    public static class Kernel{
60
    	public float[][] kernel = null;
61
    	public Kernel(float[][] k){
62
    		this.kernel = k;
63
    	}
64
    	
65
    	public float kernelOperation(Kernel k){
66
    		float res = 0;
67
    		for(int i=0;i<3;i++)
68
    			for(int j=0;j<3;j++)
69
    				res += kernel[i][j] *  k.kernel[i][j];
70
    		return res;
71
    	}
72
    	
73
    }
74

  
75
    /**
48 76
     * Constructor
49 77
     */
50 78
    public RasterFilter() {
......
78 106

  
79 107
    /**
80 108
     * A?ade un par?metro al filtro
109
     * @param name	Clave del par?metro
110
     * @param param Objeto pasado como par?metro
81 111
     */
82 112
    public void addParam(String name, Object param) {
83 113
        params.put(name, param);
84 114
    }
85 115

  
86 116
    /**
117
     * Elimina un par?metro del filtro
118
     * @param name Clave del par?metro a eliminar
119
     */
120
    public void removeParam(String name){
121
    	params.remove(name);
122
    }
123
    
124
    /**
125
     * Obtiene un par?metro a partir de la clave
126
     * @param name Par?metro
127
     * @return Par?metro
128
     */
129
    public Object getParam(String name){
130
    	return params.get(name);
131
    }
132
    
133
    /**
87 134
     * Funci?n que contiene el c?digo a ejecutar antes de aplicar el filtro
88 135
     */
89 136
    abstract public void pre();
......
118 165
     * @param name        clave para obtener un objeto resultado del filtro.
119 166
     */
120 167
    abstract public Object getResult(String name);
168

  
169
	/**
170
	 * @param viewPortData The viewPortData to set.
171
	 */
172
	public void setViewPortData(ViewPortData viewPortData) {
173
		this.viewPortData = viewPortData;
174
	}
175
	/**
176
	 * @param extent The extent to set.
177
	 */
178
	public void setExtent(Extent extent) {
179
		this.extent = extent;
180
	}
121 181
}

Also available in: Unified diff