svn-gvsig-desktop / trunk / extensions / extRasterTools-SE / src-test-ui / org / gvsig / raster / beans / canvas / GCanvasTest.java @ 19945
History | View | Annotate | Download (2.9 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2005 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.raster.beans.canvas; |
20 |
|
21 |
import java.awt.Color; |
22 |
import java.awt.Dimension; |
23 |
|
24 |
import org.gvsig.raster.beans.canvas.layers.Border; |
25 |
import org.gvsig.raster.beans.canvas.layers.GraphicHistogram; |
26 |
import org.gvsig.raster.beans.canvas.layers.InfoLayer; |
27 |
import org.gvsig.raster.beans.canvas.layers.MinMaxLines; |
28 |
import org.gvsig.raster.beans.canvas.layers.functions.LogaritmicExponentialLine; |
29 |
import org.gvsig.rastertools.TestUI; |
30 |
/**
|
31 |
* Test para comprobar el funcionamiento basico de un GCanvas
|
32 |
*
|
33 |
* 14-oct-2007
|
34 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
35 |
*/
|
36 |
public class GCanvasTest implements IGCanvasListener { |
37 |
private TestUI jFrame = null; |
38 |
private GCanvas component = null; |
39 |
private LogaritmicExponentialLine line = null; |
40 |
private MinMaxLines minMaxLines = null; |
41 |
private InfoLayer infoLayer = null; |
42 |
|
43 |
public GCanvasTest() {
|
44 |
initialize(); |
45 |
} |
46 |
|
47 |
private void initialize() { |
48 |
jFrame = new TestUI("GCanvasTest"); |
49 |
double[] histR = new double[]{0, 0, 3, 4, 5, 8, 7, 18, 45, 36, 21, 36, 12, 23, 23, 40, 17, 10, 5, 1, 0, 0, 0}; |
50 |
GraphicHistogram gHistR = new GraphicHistogram(histR, Color.RED); |
51 |
gHistR.setType(GraphicHistogram.TYPE_FILL); |
52 |
|
53 |
line = new LogaritmicExponentialLine(Color.YELLOW, -1.0); |
54 |
//line = new ExponentialLine(Color.YELLOW);
|
55 |
//line = new LogaritmicLine(Color.YELLOW);
|
56 |
DrawableElement border = new Border(Color.WHITE); |
57 |
minMaxLines = new MinMaxLines(Color.white); |
58 |
infoLayer = new InfoLayer(Color.white); |
59 |
|
60 |
component = new GCanvas(Color.BLACK); |
61 |
component.addDrawableElement(border); |
62 |
component.addDrawableElement(gHistR); |
63 |
component.addDrawableElement(minMaxLines); |
64 |
component.addDrawableElement(line); |
65 |
component.addDrawableElement(infoLayer); |
66 |
|
67 |
component.addValueChangedListener(this);
|
68 |
|
69 |
jFrame.setSize(new Dimension(222, 248)); |
70 |
jFrame.setContentPane(component); |
71 |
|
72 |
jFrame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); |
73 |
jFrame.setVisible(true);
|
74 |
} |
75 |
|
76 |
public static void main(String[] args) { |
77 |
new GCanvasTest();
|
78 |
} |
79 |
|
80 |
public void actionDataDragged(GCanvasEvent e) {} |
81 |
public void actionDataChanged(GCanvasEvent e) {} |
82 |
} |