2 |
2 |
|
3 |
3 |
import java.awt.BorderLayout;
|
4 |
4 |
import java.awt.Color;
|
|
5 |
import java.awt.Graphics2D;
|
5 |
6 |
import java.awt.Image;
|
|
7 |
import java.awt.RenderingHints;
|
|
8 |
import java.awt.image.BufferedImage;
|
6 |
9 |
|
7 |
10 |
import javax.swing.ImageIcon;
|
8 |
11 |
import javax.swing.JPanel;
|
... | ... | |
11 |
14 |
import org.gvsig.raster.buffer.BufferFactory;
|
12 |
15 |
import org.gvsig.raster.dataset.IBuffer;
|
13 |
16 |
import org.gvsig.raster.dataset.io.RasterDriverException;
|
|
17 |
import org.jfree.chart.ChartFactory;
|
14 |
18 |
import org.jfree.chart.ChartPanel;
|
15 |
19 |
import org.jfree.chart.JFreeChart;
|
16 |
20 |
import org.jfree.chart.axis.NumberAxis;
|
17 |
21 |
import org.jfree.chart.plot.FastScatterPlot;
|
|
22 |
import org.jfree.chart.plot.PlotOrientation;
|
|
23 |
import org.jfree.chart.plot.XYPlot;
|
|
24 |
import org.jfree.chart.renderer.xy.XYDotRenderer;
|
|
25 |
import org.jfree.data.xy.XYDataset;
|
|
26 |
import org.jfree.data.xy.XYSeries;
|
|
27 |
import org.jfree.data.xy.XYSeriesCollection;
|
18 |
28 |
|
19 |
29 |
import com.iver.cit.gvsig.fmap.layers.FLayer;
|
20 |
30 |
|
... | ... | |
23 |
33 |
private static final long serialVersionUID = 1L;
|
24 |
34 |
private JFreeChart chart;
|
25 |
35 |
private ChartPanel jPanelChart = null;
|
|
36 |
private FastScatterPlot plot = null;
|
|
37 |
private String band1= "banda1";
|
|
38 |
private String band2= "banda2";
|
26 |
39 |
boolean create= false;
|
27 |
|
float data[][]= null;
|
|
40 |
private float data[][]= null;
|
28 |
41 |
FLayer fLayer= null;
|
29 |
42 |
|
30 |
43 |
|
... | ... | |
53 |
66 |
|
54 |
67 |
private void createChart() {
|
55 |
68 |
|
56 |
|
NumberAxis domainAxis = new NumberAxis("X");
|
|
69 |
NumberAxis domainAxis = new NumberAxis(band1);
|
57 |
70 |
domainAxis.setAutoRangeIncludesZero(false);
|
58 |
|
NumberAxis rangeAxis = new NumberAxis("Y");
|
|
71 |
NumberAxis rangeAxis = new NumberAxis(band2);
|
59 |
72 |
rangeAxis.setAutoRangeIncludesZero(false);
|
60 |
73 |
|
61 |
74 |
// Cargo cono los datos iniciales el chart
|
62 |
75 |
setDataChart(fLayer);
|
63 |
|
FastScatterPlot plot = new FastScatterPlot(this.data, domainAxis, rangeAxis);
|
|
76 |
plot = new FastScatterPlot(this.data, domainAxis, rangeAxis);
|
|
77 |
|
|
78 |
|
64 |
79 |
chart = new JFreeChart("Fast Scatter Plot", plot);
|
|
80 |
chart.getRenderingHints().put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
|
|
81 |
|
65 |
82 |
Image img = new ImageIcon(ScatterPlotPanel.class.getClassLoader().getResource("images/splash.png")).getImage();
|
66 |
83 |
plot.setBackgroundPaint(null);
|
67 |
84 |
plot.setBackgroundImageAlpha(0.18f);
|
68 |
85 |
plot.setBackgroundImage(img);
|
69 |
86 |
chart.setBackgroundPaint(Color.white);
|
70 |
87 |
plot.setBackgroundPaint(new Color(245, 245, 245));
|
71 |
|
|
|
88 |
|
72 |
89 |
}
|
73 |
90 |
|
74 |
91 |
|
... | ... | |
92 |
109 |
int indice = 0;
|
93 |
110 |
data= new float[2][width*height];
|
94 |
111 |
|
95 |
|
|
96 |
112 |
if (buffer.getDataType()== IBuffer.TYPE_BYTE){
|
97 |
113 |
for(int i=0; i<width;i++){
|
98 |
114 |
for(int j=0; j<height; j++){
|
... | ... | |
133 |
149 |
}
|
134 |
150 |
}
|
135 |
151 |
}
|
|
152 |
}
|
136 |
153 |
|
|
154 |
|
|
155 |
|
|
156 |
public FastScatterPlot getPlot(){
|
|
157 |
return plot;
|
|
158 |
|
137 |
159 |
}
|
138 |
|
|
139 |
|
}
|
|
160 |
|
|
161 |
|
|
162 |
}
|
|
163 |
|
|
164 |
|