root / trunk / extensions / extRemoteSensing / src / org / gvsig / remotesensing / profiles / gui / ProfilePanel.java @ 19683
History | View | Annotate | Download (5.38 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007 Instituto de Desarrollo Regional 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 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha)
|
34 |
* Campus Universitario s/n
|
35 |
* 02071 Alabacete
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 967 599 200
|
39 |
*/
|
40 |
|
41 |
package org.gvsig.remotesensing.profiles.gui; |
42 |
|
43 |
import java.awt.BorderLayout; |
44 |
import java.awt.Dimension; |
45 |
import java.awt.event.ActionEvent; |
46 |
import java.awt.event.ActionListener; |
47 |
import java.util.Iterator; |
48 |
|
49 |
import javax.swing.JPanel; |
50 |
import javax.swing.JTabbedPane; |
51 |
import javax.swing.event.ChangeEvent; |
52 |
import javax.swing.event.ChangeListener; |
53 |
|
54 |
import org.gvsig.fmap.raster.grid.roi.VectorialROI; |
55 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel; |
56 |
import org.gvsig.gui.beans.defaultbuttonspanel.DefaultButtonsPanel; |
57 |
import org.gvsig.gui.beans.graphic.GraphicChartPanel; |
58 |
import org.jfree.chart.axis.NumberAxis; |
59 |
import org.jfree.chart.axis.NumberTickUnit; |
60 |
import org.jfree.chart.plot.XYPlot; |
61 |
|
62 |
import com.iver.andami.PluginServices; |
63 |
import com.iver.cit.gvsig.fmap.MapControl; |
64 |
|
65 |
/**
|
66 |
* Clase que define el panel donde aparece el grafico de del perfil espectral de los puntos que seleccione el
|
67 |
* usuario.
|
68 |
*
|
69 |
* @author aMu?oz (alejandro.munoz@uclm.es)
|
70 |
* @version 11/3/2008
|
71 |
*/
|
72 |
|
73 |
public class ProfilePanel extends DefaultButtonsPanel implements ChangeListener{ |
74 |
|
75 |
private static final long serialVersionUID = 1L; |
76 |
private GraphicChartPanel jPanelChart = null; |
77 |
private MapControl mapControl = null;; |
78 |
private JPanel southPanel = null; |
79 |
private ZProfileOptionsPanel pointOptionsPanel= null; |
80 |
private LineProfileOptionsPanel lineOptionsPanel= null; |
81 |
private JTabbedPane tabbedPane = null; |
82 |
|
83 |
/** Constructor del panel.
|
84 |
* @param flayer capa de la que se van a tomar los puntos
|
85 |
**/
|
86 |
public ProfilePanel(ProfileDialog dialog){
|
87 |
super(ButtonsPanel.BUTTONS_ACCEPTCANCEL);
|
88 |
this.mapControl= dialog.getMapControl();
|
89 |
initialize(); |
90 |
} |
91 |
|
92 |
|
93 |
/**
|
94 |
* Inicializacion del panel que contiene el grafico
|
95 |
* */
|
96 |
private void initialize() { |
97 |
this.setLayout(new BorderLayout()); |
98 |
this.add(getChart(), BorderLayout.CENTER); |
99 |
this.add(getSouthPanel(), BorderLayout.SOUTH); |
100 |
} |
101 |
|
102 |
/**
|
103 |
* @return grafico actual
|
104 |
* */
|
105 |
public GraphicChartPanel getChart(){
|
106 |
if(jPanelChart == null){ |
107 |
jPanelChart = new GraphicChartPanel();
|
108 |
this.jPanelChart.getChart().getChart().getPlot().setBackgroundImage(null); |
109 |
jPanelChart.getChart().setDomainZoomable(false);
|
110 |
jPanelChart.getChart().setRangeZoomable(false);
|
111 |
jPanelChart.getChart().setDisplayToolTips(true);
|
112 |
|
113 |
} |
114 |
return jPanelChart;
|
115 |
} |
116 |
|
117 |
|
118 |
|
119 |
public MapControl getMapControl() {
|
120 |
return mapControl ;
|
121 |
} |
122 |
|
123 |
|
124 |
|
125 |
public JPanel getSouthPanel(){ |
126 |
if(southPanel== null){ |
127 |
southPanel= new JPanel(); |
128 |
BorderLayout bd= new BorderLayout(); |
129 |
southPanel.setLayout(bd); |
130 |
southPanel.setPreferredSize(new Dimension(150,110)); |
131 |
getTabbedPane().addTab(PluginServices.getText(this, "zProfile"), getPointOptionsPanel()); |
132 |
getTabbedPane().addTab(PluginServices.getText(this, "opciones"), getLineOptionsPanel()); |
133 |
//southPanel.add(getTabbedPane(), BorderLayout.SOUTH);
|
134 |
southPanel.add(getTabbedPane(),BorderLayout.CENTER);
|
135 |
} |
136 |
return southPanel;
|
137 |
|
138 |
} |
139 |
|
140 |
|
141 |
|
142 |
public ZProfileOptionsPanel getPointOptionsPanel(){
|
143 |
if(pointOptionsPanel==null){ |
144 |
pointOptionsPanel= new ZProfileOptionsPanel(mapControl);
|
145 |
pointOptionsPanel.setMainPanel(this);
|
146 |
pointOptionsPanel.setJPanelChart(getChart()); |
147 |
} |
148 |
return pointOptionsPanel;
|
149 |
} |
150 |
|
151 |
|
152 |
public LineProfileOptionsPanel getLineOptionsPanel(){
|
153 |
if(lineOptionsPanel==null){ |
154 |
lineOptionsPanel= new LineProfileOptionsPanel(mapControl);
|
155 |
lineOptionsPanel.setMainPanel(this);
|
156 |
lineOptionsPanel.setJPanelChart(getChart()); |
157 |
} |
158 |
return lineOptionsPanel;
|
159 |
} |
160 |
|
161 |
/**
|
162 |
* Actualiza los colores las graficas en funcion de los colores de las rois de la tabla
|
163 |
* */
|
164 |
public void UpdateColorsChart(){ |
165 |
XYPlot plot = jPanelChart.getChart().getChart().getXYPlot(); |
166 |
int index=-1; |
167 |
for (Iterator iter = getPointOptionsPanel().getROIs().iterator(); iter.hasNext();){ |
168 |
VectorialROI roi = (VectorialROI)iter.next(); |
169 |
index=index+1;
|
170 |
plot.getRenderer().setSeriesPaint(index, roi.getColor()); |
171 |
} |
172 |
} |
173 |
|
174 |
|
175 |
public JTabbedPane getTabbedPane(){ |
176 |
if(tabbedPane==null){ |
177 |
tabbedPane= new JTabbedPane(); |
178 |
tabbedPane.addChangeListener(this);
|
179 |
} |
180 |
return tabbedPane;
|
181 |
} |
182 |
|
183 |
public void stateChanged(ChangeEvent e) { |
184 |
// TODO Auto-generated method stub
|
185 |
if(e.getSource().equals(getTabbedPane())){
|
186 |
System.out.print("Cambiando pesta?a"); |
187 |
} |
188 |
} |
189 |
|
190 |
|
191 |
|
192 |
} |