svn-gvsig-desktop / trunk / extensions / extRasterTools-SE / src / org / gvsig / rastertools / enhanced / graphics / OutputHistogram.java @ 19296
History | View | Annotate | Download (3.58 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.BorderLayout; |
22 |
import java.awt.Color; |
23 |
import java.awt.GridBagConstraints; |
24 |
import java.awt.GridBagLayout; |
25 |
|
26 |
import javax.swing.JLabel; |
27 |
import javax.swing.JPanel; |
28 |
|
29 |
import org.gvsig.raster.beans.canvas.GCanvas; |
30 |
import org.gvsig.raster.beans.canvas.layers.Border; |
31 |
import org.gvsig.raster.beans.canvas.layers.GraphicHistogram; |
32 |
import org.gvsig.raster.dataset.properties.DatasetColorInterpretation; |
33 |
import org.gvsig.raster.datastruct.Histogram; |
34 |
import org.gvsig.raster.util.RasterToolsUtil; |
35 |
|
36 |
/**
|
37 |
* Componente con el histograma de salida.
|
38 |
*
|
39 |
* 20/02/2008
|
40 |
* @author Nacho Brodin nachobrodin@gmail.com
|
41 |
*/
|
42 |
public class OutputHistogram extends HistogramGraphicBase { |
43 |
private static final long serialVersionUID = 1L; |
44 |
|
45 |
/**
|
46 |
* Crea una nueva instancia de OutputHistogram.
|
47 |
*/
|
48 |
public OutputHistogram(Histogram hist, DatasetColorInterpretation ci, double[] minList, double[] maxList) { |
49 |
super(hist, ci, minList, maxList);
|
50 |
init(); |
51 |
} |
52 |
|
53 |
/**
|
54 |
* Inicializaci?n de componentes gr?ficos
|
55 |
*/
|
56 |
protected void init() { |
57 |
super.init();
|
58 |
histogramColor = Color.GREEN;
|
59 |
this.setLayout(new BorderLayout()); |
60 |
this.add(getNorthPanel(), BorderLayout.NORTH); |
61 |
this.add(getCanvas(), BorderLayout.CENTER); |
62 |
this.add(getSouthPanel(), BorderLayout.SOUTH); |
63 |
} |
64 |
|
65 |
/*
|
66 |
* (non-Javadoc)
|
67 |
* @see org.gvsig.rastertools.enhanced.graphics.HistogramGraphicBase#createDrawableElements()
|
68 |
*/
|
69 |
protected void createDrawableElements() { |
70 |
} |
71 |
|
72 |
/*
|
73 |
* (non-Javadoc)
|
74 |
* @see org.gvsig.rastertools.enhanced.graphics.HistogramGraphicBase#getCanvas()
|
75 |
*/
|
76 |
public GCanvas getCanvas() {
|
77 |
if(canvas == null) { |
78 |
GraphicHistogram gHist = new GraphicHistogram(histogramDrawed, histogramColor);
|
79 |
gHist.setType(GraphicHistogram.TYPE_LINE); |
80 |
|
81 |
canvas = new GCanvas(Color.BLACK); |
82 |
canvas.setDrawableElement(new Border(borderColor)); |
83 |
canvas.setDrawableElement(gHist); |
84 |
} |
85 |
return canvas;
|
86 |
} |
87 |
|
88 |
/*
|
89 |
* (non-Javadoc)
|
90 |
* @see org.gvsig.rastertools.enhanced.graphics.HistogramGraphicBase#getNorthPanel()
|
91 |
*/
|
92 |
public JPanel getNorthPanel() { |
93 |
if(north == null) { |
94 |
north = new JPanel(); |
95 |
north.setLayout(new BorderLayout()); |
96 |
north.add(getSlider(), BorderLayout.CENTER);
|
97 |
north.add(new JLabel(RasterToolsUtil.getText(null, "output_hist")), BorderLayout.NORTH); |
98 |
} |
99 |
return north;
|
100 |
} |
101 |
|
102 |
/*
|
103 |
* (non-Javadoc)
|
104 |
* @see org.gvsig.rastertools.enhanced.graphics.HistogramGraphicBase#getSouthPanel()
|
105 |
*/
|
106 |
public JPanel getSouthPanel() { |
107 |
if(south == null) { |
108 |
south = new JPanel(); |
109 |
south.setLayout(new GridBagLayout()); |
110 |
GridBagConstraints gb = new GridBagConstraints(); |
111 |
gb.weightx = 1;
|
112 |
|
113 |
gb.anchor = GridBagConstraints.WEST;
|
114 |
south.add(getMinValue(), gb); |
115 |
|
116 |
gb.anchor = GridBagConstraints.EAST;
|
117 |
south.add(getMaxValue(), gb); |
118 |
} |
119 |
return south;
|
120 |
} |
121 |
|
122 |
} |