Statistics
| Revision:

gvsig-raster / org.gvsig.raster / trunk / org.gvsig.raster / org.gvsig.raster.swing / org.gvsig.raster.swing.impl / src / main / java / org / gvsig / raster / swing / impl / canvas / layer / function / DefaultBaseFunction.java @ 2443

History | View | Annotate | Download (2.37 KB)

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.swing.impl.canvas.layer.function;
23

    
24
import java.awt.Graphics;
25
import java.util.ArrayList;
26

    
27
import org.gvsig.raster.swing.gcanvas.BaseFunction;
28
import org.gvsig.raster.swing.gcanvas.DrawableElement;
29
import org.gvsig.raster.swing.impl.canvas.layer.DefaultMinMaxLines;
30
/**
31
 * Todo algoritmo que queramos que implemente un realce, debe heredar de esta base
32
 * para poder distinguir los drawables genericos de los algoritmos.
33
 * 
34
 * @version 03/03/2008
35
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
36
 */
37
public abstract class DefaultBaseFunction extends DrawableElement implements BaseFunction {
38
        protected double      minx       = 0.0D;
39
        protected double      maxx       = 1.0D;
40
        
41

    
42
        /**
43
         * Especifica el limite minimo del algoritmo en forma de porcentaje
44
         * @param minx
45
         */
46
        public void setMinX(double minx) {
47
                this.minx = minx;
48
        }
49

    
50
        /**
51
         * Especifica el limite maximo del algoritmo en forma de porcentaje
52
         * @param maxx
53
         */
54
        public void setMaxX(double maxx) {
55
                this.maxx = maxx;
56
        }
57
        
58
        /*
59
         * (non-Javadoc)
60
         * @see org.gvsig.raster.beans.canvas.DrawableElement#paint(java.awt.Graphics)
61
         */
62
        protected void paint(Graphics g) {
63
                ArrayList<DrawableElement> elements = canvas.getDrawableElements(DefaultMinMaxLines.class);
64
                if (elements.size() > 0) {
65
                        DefaultMinMaxLines minMaxLines = (DefaultMinMaxLines) elements.get(0);
66
                        setMinX(minMaxLines.getMinDistance());
67
                        setMaxX(minMaxLines.getMaxDistance());
68
                }
69
        }
70
}