root / trunk / extensions / extRasterTools-SE / src / org / gvsig / rastertools / enhanced / graphics / InputHistogram.java @ 19378
History | View | Annotate | Download (2.75 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*/
|
19 |
package org.gvsig.rastertools.enhanced.graphics; |
20 |
|
21 |
import java.awt.Color; |
22 |
|
23 |
import org.gvsig.raster.beans.canvas.DrawableElement; |
24 |
import org.gvsig.raster.beans.canvas.GCanvas; |
25 |
import org.gvsig.raster.beans.canvas.layers.Border; |
26 |
import org.gvsig.raster.beans.canvas.layers.GraphicHistogram; |
27 |
import org.gvsig.raster.beans.canvas.layers.MinMaxLines; |
28 |
import org.gvsig.raster.beans.canvas.layers.StraightLine; |
29 |
import org.gvsig.raster.datastruct.Histogram; |
30 |
import org.gvsig.rastertools.enhanced.ui.EnhancedListener; |
31 |
/**
|
32 |
* Componente con el histograma de entrada.
|
33 |
*
|
34 |
* 20/02/2008
|
35 |
* @author Nacho Brodin nachobrodin@gmail.com
|
36 |
*/
|
37 |
public class InputHistogram extends HistogramGraphicBase { |
38 |
private static final long serialVersionUID = 681848373747974757L; |
39 |
private MinMaxLines minMaxLines = null; |
40 |
private Color minmaxColor = Color.WHITE; |
41 |
private DrawableElement dElement = null; |
42 |
|
43 |
/**
|
44 |
* Crea una nueva instancia de InputHistogram.
|
45 |
*/
|
46 |
public InputHistogram(Histogram hist, int[] renderBands, double[] minList, double[] maxList) { |
47 |
super(hist, renderBands, minList, maxList);
|
48 |
} |
49 |
|
50 |
/*
|
51 |
* (non-Javadoc)
|
52 |
* @see org.gvsig.rastertools.enhanced.graphics.HistogramGraphicBase#getCanvas()
|
53 |
*/
|
54 |
public GCanvas getCanvas() {
|
55 |
if(canvas == null) { |
56 |
gHist = new GraphicHistogram(histogramDrawed, histogramColor);
|
57 |
gHist.setType(GraphicHistogram.TYPE_LINE); |
58 |
minMaxLines = new MinMaxLines(minmaxColor);
|
59 |
dElement = new StraightLine(Color.YELLOW); |
60 |
//minMaxLines.setActionManager(this);
|
61 |
|
62 |
canvas = new GCanvas(Color.BLACK); |
63 |
canvas.addDrawableElement(new Border(borderColor)); |
64 |
canvas.addDrawableElement(gHist); |
65 |
canvas.addDrawableElement(dElement); |
66 |
canvas.addDrawableElement(minMaxLines); |
67 |
} |
68 |
return canvas;
|
69 |
} |
70 |
|
71 |
/**
|
72 |
* Asigna el listener para gestionar el evento de movimiento de gr?ficos
|
73 |
* @param listener
|
74 |
*/
|
75 |
public void setListener(EnhancedListener listener) { |
76 |
getCanvas().addValueChangedListener(listener); |
77 |
} |
78 |
} |