Revision 19684
trunk/extensions/extRemoteSensing/src/org/gvsig/remotesensing/profiles/listener/LineProfileOptionsListener.java | ||
---|---|---|
1 |
package org.gvsig.remotesensing.profiles.listener; |
|
2 |
|
|
3 |
import java.awt.Color; |
|
4 |
import java.awt.event.ActionEvent; |
|
5 |
import java.awt.event.ActionListener; |
|
6 |
|
|
7 |
import javax.swing.event.ListSelectionEvent; |
|
8 |
import javax.swing.event.ListSelectionListener; |
|
9 |
import javax.swing.event.TableModelEvent; |
|
10 |
import javax.swing.event.TableModelListener; |
|
11 |
import javax.swing.table.DefaultTableModel; |
|
12 |
|
|
13 |
import org.gvsig.fmap.raster.grid.roi.VectorialROI; |
|
14 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent; |
|
15 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener; |
|
16 |
import org.gvsig.gui.beans.table.exceptions.NotInitializeException; |
|
17 |
import org.gvsig.gui.beans.table.models.IModel; |
|
18 |
import org.gvsig.raster.grid.roi.ROI; |
|
19 |
import org.gvsig.remotesensing.profiles.gui.LineProfileOptionsPanel; |
|
20 |
|
|
21 |
public class LineProfileOptionsListener implements ButtonsPanelListener, ActionListener, ListSelectionListener, TableModelListener { |
|
22 |
|
|
23 |
LineProfileOptionsPanel optionsPanel = null; |
|
24 |
|
|
25 |
public LineProfileOptionsListener( LineProfileOptionsPanel optionsPanel){ |
|
26 |
this.optionsPanel= optionsPanel; |
|
27 |
} |
|
28 |
|
|
29 |
|
|
30 |
public void actionButtonPressed(ButtonsPanelEvent e) { |
|
31 |
// TODO Auto-generated method stub |
|
32 |
|
|
33 |
} |
|
34 |
|
|
35 |
public void actionPerformed(ActionEvent e) { |
|
36 |
if (e.getSource() == optionsPanel.getNewButton()){ |
|
37 |
try { |
|
38 |
String roiName= ""; |
|
39 |
roiName = "Line" + String.valueOf(optionsPanel.getTable().getRowCount()); |
|
40 |
Object row [] = ((IModel)optionsPanel.getTable().getModel()).getNewLine(); |
|
41 |
row[0]= roiName; |
|
42 |
((DefaultTableModel)optionsPanel.getTable().getModel()).addRow(row); |
|
43 |
if (optionsPanel.getGrid()!=null){ |
|
44 |
ROI roi = new VectorialROI(optionsPanel.getGrid()); |
|
45 |
roi.setName(roiName); |
|
46 |
roi.setColor((Color)row[4]); |
|
47 |
optionsPanel.addROI(roi); |
|
48 |
} |
|
49 |
optionsPanel.getTable().setSelectedIndex(optionsPanel.getTable().getRowCount()-1); |
|
50 |
} catch (NotInitializeException e1) { |
|
51 |
e1.printStackTrace(); |
|
52 |
} |
|
53 |
optionsPanel.selectDrawRoiTool(); |
|
54 |
optionsPanel.getNewButton().setSelected(true); |
|
55 |
optionsPanel.getDeleteButton().setSelected(false); |
|
56 |
} |
|
57 |
|
|
58 |
} |
|
59 |
|
|
60 |
public void valueChanged(ListSelectionEvent e) { |
|
61 |
// TODO Auto-generated method stub |
|
62 |
|
|
63 |
} |
|
64 |
|
|
65 |
public void tableChanged(TableModelEvent e) { |
|
66 |
// TODO Auto-generated method stub |
|
67 |
|
|
68 |
} |
|
69 |
|
|
70 |
} |
trunk/extensions/extRemoteSensing/src/org/gvsig/remotesensing/profiles/listener/ZProfileOptionsListener.java | ||
---|---|---|
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 |
package org.gvsig.remotesensing.profiles.listener; |
|
41 |
|
|
42 |
import java.awt.Color; |
|
43 |
import java.awt.event.ActionEvent; |
|
44 |
import java.awt.event.ActionListener; |
|
45 |
import java.util.ArrayList; |
|
46 |
import java.util.Iterator; |
|
47 |
|
|
48 |
import javax.swing.event.ListSelectionEvent; |
|
49 |
import javax.swing.event.ListSelectionListener; |
|
50 |
import javax.swing.event.TableModelEvent; |
|
51 |
import javax.swing.event.TableModelListener; |
|
52 |
import javax.swing.table.DefaultTableModel; |
|
53 |
|
|
54 |
import org.gvsig.fmap.raster.grid.roi.VectorialROI; |
|
55 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent; |
|
56 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener; |
|
57 |
import org.gvsig.gui.beans.table.exceptions.NotInitializeException; |
|
58 |
import org.gvsig.gui.beans.table.models.IModel; |
|
59 |
import org.gvsig.raster.grid.GridException; |
|
60 |
import org.gvsig.raster.grid.roi.ROI; |
|
61 |
import org.gvsig.remotesensing.profiles.gui.ZProfileOptionsPanel; |
|
62 |
|
|
63 |
import com.iver.cit.gvsig.fmap.core.SymbologyFactory; |
|
64 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
|
65 |
import com.iver.cit.gvsig.fmap.layers.GraphicLayer; |
|
66 |
import com.iver.cit.gvsig.fmap.rendering.FGraphic; |
|
67 |
/** |
|
68 |
* Clase que define el comportamiento tras los eventos del panel de opciones. |
|
69 |
* |
|
70 |
* @author aMu?oz (alejandro.munoz@uclm.es) |
|
71 |
* @version 11/3/2008 |
|
72 |
*/ |
|
73 |
|
|
74 |
public class ZProfileOptionsListener implements ButtonsPanelListener, ActionListener, ListSelectionListener, TableModelListener { |
|
75 |
|
|
76 |
ZProfileOptionsPanel optionsPanel = null; |
|
77 |
|
|
78 |
|
|
79 |
public ZProfileOptionsListener( ZProfileOptionsPanel optionsPanel){ |
|
80 |
this.optionsPanel= optionsPanel; |
|
81 |
} |
|
82 |
|
|
83 |
|
|
84 |
public void actionButtonPressed(ButtonsPanelEvent e) { |
|
85 |
|
|
86 |
} |
|
87 |
|
|
88 |
public void actionPerformed(ActionEvent e) { |
|
89 |
|
|
90 |
if (e.getSource() == optionsPanel.getNewButton()){ |
|
91 |
try { |
|
92 |
String roiName= ""; |
|
93 |
roiName = "Point" + String.valueOf(optionsPanel.getTable().getRowCount()); |
|
94 |
Object row [] = ((IModel)optionsPanel.getTable().getModel()).getNewLine(); |
|
95 |
row[0]= roiName; |
|
96 |
((DefaultTableModel)optionsPanel.getTable().getModel()).addRow(row); |
|
97 |
if (optionsPanel.getGrid()!=null){ |
|
98 |
ROI roi = new VectorialROI(optionsPanel.getGrid()); |
|
99 |
roi.setName(roiName); |
|
100 |
roi.setColor((Color)row[4]); |
|
101 |
optionsPanel.addROI(roi); |
|
102 |
} |
|
103 |
optionsPanel.getTable().setSelectedIndex(optionsPanel.getTable().getRowCount()-1); |
|
104 |
} catch (NotInitializeException e1) { |
|
105 |
e1.printStackTrace(); |
|
106 |
} |
|
107 |
optionsPanel.selectDrawRoiTool(); |
|
108 |
optionsPanel.getNewButton().setSelected(true); |
|
109 |
optionsPanel.getDeleteButton().setSelected(false); |
|
110 |
} |
|
111 |
|
|
112 |
// Cada vez que se elimina una roi |
|
113 |
if (e.getSource() == optionsPanel.getDeleteButton()){ |
|
114 |
try { |
|
115 |
if (optionsPanel.getTable().getSelectedRows().length>0){ |
|
116 |
optionsPanel.getJPanelChart().cleanChart(); |
|
117 |
String className = (String)optionsPanel.getTable().getModel().getValueAt(optionsPanel.getTable().getSelectedRow(),0); |
|
118 |
optionsPanel.removeROI(className); |
|
119 |
((DefaultTableModel)optionsPanel.getTable().getModel()).removeRow(optionsPanel.getTable().getSelectedRow()); |
|
120 |
|
|
121 |
for (Iterator iter = optionsPanel.getROIs().iterator(); iter.hasNext();) { |
|
122 |
ROI roi =(VectorialROI) iter.next(); |
|
123 |
int nSeries = optionsPanel.getROIs().size(); |
|
124 |
int[][] series = new int[nSeries][roi.getBandCount()+1]; |
|
125 |
String[] names = new String[nSeries]; |
|
126 |
|
|
127 |
// Se establecen los colores de las graficas segun color de las rois |
|
128 |
for(int iSerie = 0; iSerie < nSeries; iSerie++){ |
|
129 |
series[iSerie][0] = 0; |
|
130 |
names[iSerie] = "Band " + (iSerie+1); |
|
131 |
roi=(VectorialROI) optionsPanel.getROIs().get(iSerie); |
|
132 |
for (int i = 1; i <= roi.getBandCount(); i++){ |
|
133 |
roi.setBandToOperate(i-1); |
|
134 |
series[iSerie][i] = (int) roi.getMeanValue(); |
|
135 |
} |
|
136 |
} |
|
137 |
|
|
138 |
// Actualizacion del grafico |
|
139 |
optionsPanel.UpdateChart(); |
|
140 |
optionsPanel.getJPanelChart().setNewChart(series, names); |
|
141 |
|
|
142 |
} |
|
143 |
optionsPanel.UpdateChart(); |
|
144 |
optionsPanel.updateUI(); |
|
145 |
|
|
146 |
} |
|
147 |
} catch (NotInitializeException e2) { |
|
148 |
// TODO Auto-generated catch block |
|
149 |
e2.printStackTrace(); |
|
150 |
} catch (GridException e2) { |
|
151 |
// TODO Auto-generated catch block |
|
152 |
e2.printStackTrace(); |
|
153 |
} |
|
154 |
} |
|
155 |
} |
|
156 |
|
|
157 |
|
|
158 |
|
|
159 |
public void valueChanged(ListSelectionEvent e) { |
|
160 |
// TODO Auto-generated method stub |
|
161 |
|
|
162 |
} |
|
163 |
|
|
164 |
public void tableChanged(TableModelEvent e) { |
|
165 |
// Corregir segun cualsea definitivamente la columna asociada al color |
|
166 |
if(e.getColumn()==4){ |
|
167 |
String roiName = (String)optionsPanel.getTable().getTable().getJTable().getValueAt(e.getFirstRow(),0); |
|
168 |
ArrayList graphics = optionsPanel.getRoiGraphics(roiName); |
|
169 |
if(optionsPanel.getMapControl()!=null){ |
|
170 |
GraphicLayer graphicLayer = optionsPanel.getMapControl().getMapContext().getGraphicsLayer(); |
|
171 |
ISymbol symbol = null; |
|
172 |
Color color = (Color)optionsPanel.getTable().getTable().getJTable().getValueAt(e.getFirstRow(),4); |
|
173 |
for (int i = 0; i< graphics.size(); i++){ |
|
174 |
symbol = SymbologyFactory.createDefaultSymbolByShapeType(((FGraphic)graphics.get(i)).getGeom().getGeometryType(), color); |
|
175 |
((FGraphic)graphics.get(i)).setIdSymbol(graphicLayer.addSymbol(symbol)); |
|
176 |
} |
|
177 |
optionsPanel.getROI(roiName).setColor(color); |
|
178 |
optionsPanel.getMapControl().drawGraphics(); |
|
179 |
} |
|
180 |
|
|
181 |
optionsPanel.UpdateChart(); |
|
182 |
} |
|
183 |
} |
|
184 |
|
|
185 |
} |
|
186 |
|
trunk/extensions/extRemoteSensing/src/org/gvsig/remotesensing/profiles/listener/DrawMouseProfileListener.java | ||
---|---|---|
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.listener; |
|
42 |
|
|
43 |
import java.awt.Color; |
|
44 |
import java.awt.Cursor; |
|
45 |
import java.awt.geom.Point2D; |
|
46 |
import java.util.ArrayList; |
|
47 |
import java.util.Iterator; |
|
48 |
|
|
49 |
import org.gvsig.fmap.raster.grid.roi.VectorialROI; |
|
50 |
import org.gvsig.gui.beans.table.exceptions.NotInitializeException; |
|
51 |
import org.gvsig.raster.grid.GridException; |
|
52 |
import org.gvsig.remotesensing.profiles.gui.LineProfileOptionsPanel; |
|
53 |
import org.gvsig.remotesensing.profiles.gui.ZProfileOptionsPanel; |
|
54 |
|
|
55 |
import com.iver.cit.gvsig.fmap.core.GeneralPathX; |
|
56 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
|
57 |
import com.iver.cit.gvsig.fmap.core.ShapeFactory; |
|
58 |
import com.iver.cit.gvsig.fmap.core.SymbologyFactory; |
|
59 |
import com.iver.cit.gvsig.fmap.core.symbols.ILineSymbol; |
|
60 |
import com.iver.cit.gvsig.fmap.core.symbols.IMarkerSymbol; |
|
61 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
|
62 |
import com.iver.cit.gvsig.fmap.core.symbols.SimpleMarkerSymbol; |
|
63 |
import com.iver.cit.gvsig.fmap.layers.GraphicLayer; |
|
64 |
import com.iver.cit.gvsig.fmap.rendering.FGraphic; |
|
65 |
import com.iver.cit.gvsig.fmap.tools.BehaviorException; |
|
66 |
import com.iver.cit.gvsig.fmap.tools.Events.MeasureEvent; |
|
67 |
import com.iver.cit.gvsig.fmap.tools.Events.PointEvent; |
|
68 |
import com.iver.cit.gvsig.fmap.tools.Listeners.PointListener; |
|
69 |
import com.iver.cit.gvsig.fmap.tools.Listeners.PolylineListener; |
|
70 |
|
|
71 |
/** |
|
72 |
* Clase que define el comportamiento tras los eventos de dibujado sobre la imagen. |
|
73 |
* Se encarga del pintado de la grafica asociada a la geometria (punto o linea) dibujada. |
|
74 |
* |
|
75 |
* @author aMu?oz (alejandro.munoz@uclm.es) |
|
76 |
* @version 11/3/2008 |
|
77 |
*/ |
|
78 |
|
|
79 |
public class DrawMouseProfileListener implements PolylineListener,PointListener { |
|
80 |
|
|
81 |
private ZProfileOptionsPanel pointOptionsPanel = null; |
|
82 |
private LineProfileOptionsPanel lineOptionsPanel = null; |
|
83 |
|
|
84 |
public DrawMouseProfileListener(ZProfileOptionsPanel optionsPanel) { |
|
85 |
this.pointOptionsPanel = optionsPanel; |
|
86 |
} |
|
87 |
|
|
88 |
public DrawMouseProfileListener(LineProfileOptionsPanel lineOptionsPanel) { |
|
89 |
this.lineOptionsPanel = lineOptionsPanel; |
|
90 |
} |
|
91 |
|
|
92 |
public void pointFixed(MeasureEvent event) throws BehaviorException { |
|
93 |
} |
|
94 |
|
|
95 |
public void points(MeasureEvent event) throws BehaviorException { |
|
96 |
} |
|
97 |
|
|
98 |
public void polylineFinished(MeasureEvent event) throws BehaviorException { |
|
99 |
|
|
100 |
|
|
101 |
GeneralPathX gp = event.getGP(); |
|
102 |
IGeometry geometry = null; |
|
103 |
geometry = ShapeFactory.createPolyline2D(gp); |
|
104 |
String roiName = ""; |
|
105 |
VectorialROI lineRoi= null; |
|
106 |
int selectedRow; |
|
107 |
try { |
|
108 |
selectedRow = lineOptionsPanel.getTable().getSelectedRow(); |
|
109 |
roiName = (String)lineOptionsPanel.getTable().getModel().getValueAt(selectedRow,0); |
|
110 |
lineRoi = (VectorialROI)lineOptionsPanel.getROI(roiName); |
|
111 |
lineRoi.addGeometry(geometry); |
|
112 |
ISymbol sym = null; |
|
113 |
Color geometryColor = (Color)lineOptionsPanel.getTable().getModel().getValueAt(selectedRow, 4); |
|
114 |
sym =SymbologyFactory.createDefaultLineSymbol(); |
|
115 |
((ILineSymbol)sym).setLineColor(geometryColor); |
|
116 |
lineOptionsPanel.getTable().getModel().setValueAt(new Integer(lineRoi.getValues()), selectedRow, 5); |
|
117 |
GraphicLayer graphicLayer = lineOptionsPanel.getMapControl().getMapContext().getGraphicsLayer(); |
|
118 |
FGraphic fGraphic = new FGraphic(geometry,graphicLayer.addSymbol(sym)); |
|
119 |
lineOptionsPanel.getMapControl().getMapContext().getGraphicsLayer().addGraphic(fGraphic); |
|
120 |
lineOptionsPanel.getRoiGraphics(roiName).add(fGraphic); |
|
121 |
lineOptionsPanel.getMapControl().drawGraphics(); |
|
122 |
|
|
123 |
int nSeries = lineOptionsPanel.getROIs().size(); |
|
124 |
int[][] series = new int[nSeries][lineRoi.getNX()*lineRoi.getNY()]; |
|
125 |
String[] names = new String[nSeries]; |
|
126 |
|
|
127 |
// Se establecen los colores de las graficas segun color de las rois |
|
128 |
for(int iSerie = 0; iSerie < nSeries; iSerie++){ |
|
129 |
series[iSerie][0] = 0; |
|
130 |
names[iSerie] = "Band " + (iSerie+1); |
|
131 |
lineRoi.setBandToOperate(lineOptionsPanel.getComboBands().getSelectedIndex()); |
|
132 |
lineRoi=(VectorialROI) lineOptionsPanel.getROIs().get(iSerie); |
|
133 |
int k=0; |
|
134 |
for (int i = 0; i < lineRoi.getNX(); i++){ |
|
135 |
for (int j = 0; j < lineRoi.getNY(); j++){ |
|
136 |
series[iSerie][k] = (int) lineRoi.getCellValueAsByte(i,j); |
|
137 |
k++; |
|
138 |
} |
|
139 |
} |
|
140 |
} |
|
141 |
// Actualizacion del grafico |
|
142 |
lineOptionsPanel.UpdateChart(); |
|
143 |
lineOptionsPanel.getJPanelChart().setNewChart(series, names); |
|
144 |
|
|
145 |
|
|
146 |
} catch (NotInitializeException e) { |
|
147 |
// TODO Auto-generated catch block |
|
148 |
e.printStackTrace(); |
|
149 |
} catch (GridException e) { |
|
150 |
e.printStackTrace(); |
|
151 |
} |
|
152 |
|
|
153 |
|
|
154 |
|
|
155 |
|
|
156 |
|
|
157 |
} |
|
158 |
|
|
159 |
public boolean cancelDrawing() { |
|
160 |
return true; |
|
161 |
} |
|
162 |
|
|
163 |
public Cursor getCursor() { |
|
164 |
if(pointOptionsPanel!=null) |
|
165 |
return pointOptionsPanel.getToolCursor(); |
|
166 |
else |
|
167 |
return lineOptionsPanel.getToolCursor(); |
|
168 |
} |
|
169 |
|
|
170 |
|
|
171 |
// Acciones que se desencadenan al elegir un punto |
|
172 |
public void point(PointEvent event) throws BehaviorException { |
|
173 |
Point2D point = event.getPoint(); |
|
174 |
Point2D p= pointOptionsPanel.getMapControl().getViewPort().toMapPoint(point); |
|
175 |
IGeometry geometry = ShapeFactory.createPoint2D(p.getX(),p.getY()); |
|
176 |
VectorialROI pointRoi= null; |
|
177 |
String roiName = ""; |
|
178 |
int selectedRow; |
|
179 |
try { |
|
180 |
|
|
181 |
selectedRow = pointOptionsPanel.getTable().getSelectedRow(); |
|
182 |
roiName = (String)pointOptionsPanel.getTable().getModel().getValueAt(selectedRow,0); |
|
183 |
pointRoi =(VectorialROI) pointOptionsPanel.getRois().get(roiName); |
|
184 |
pointRoi.clear(); |
|
185 |
pointRoi.addGeometry(geometry); |
|
186 |
pointOptionsPanel.addROI(pointRoi); |
|
187 |
|
|
188 |
// Hacer un repintado de todas las rois del panel de opciones |
|
189 |
ArrayList listRois= pointOptionsPanel.getROIs(); |
|
190 |
FGraphic fGraphic = null; |
|
191 |
GraphicLayer graphicLayer = pointOptionsPanel.getMapControl().getMapContext().getGraphicsLayer(); |
|
192 |
graphicLayer.clearAllGraphics(); |
|
193 |
graphicLayer.clearSymbolsGraphics(); |
|
194 |
|
|
195 |
for (Iterator iter = listRois.iterator(); iter.hasNext();) { |
|
196 |
VectorialROI roi = (VectorialROI)iter.next(); |
|
197 |
Color geometryColor = (Color)pointOptionsPanel.getTable().getModel().getValueAt(selectedRow, 4); |
|
198 |
ISymbol sym = SymbologyFactory.createDefaultMarkerSymbol(); |
|
199 |
((IMarkerSymbol)sym).setColor(geometryColor); |
|
200 |
((SimpleMarkerSymbol)sym).setStyle(SimpleMarkerSymbol.CIRCLE_STYLE); |
|
201 |
|
|
202 |
fGraphic = new FGraphic(geometry,graphicLayer.addSymbol(sym)); |
|
203 |
pointOptionsPanel.getMapControl().getMapContext().getGraphicsLayer().addGraphic(fGraphic); |
|
204 |
pointOptionsPanel.getRoiGraphics(roi.getName()).add(fGraphic); |
|
205 |
} |
|
206 |
|
|
207 |
pointOptionsPanel.getMapControl().drawGraphics(); |
|
208 |
pointOptionsPanel.getNewButton().setSelected(false); |
|
209 |
pointOptionsPanel.getMapControl().rePaintDirtyLayers(); |
|
210 |
|
|
211 |
|
|
212 |
int nSeries = pointOptionsPanel.getROIs().size(); |
|
213 |
int[][] series = new int[nSeries][pointRoi.getBandCount()+1]; |
|
214 |
String[] names = new String[nSeries]; |
|
215 |
|
|
216 |
// Se establecen los colores de las graficas segun color de las rois |
|
217 |
for(int iSerie = 0; iSerie < nSeries; iSerie++){ |
|
218 |
series[iSerie][0] = 0; |
|
219 |
names[iSerie] = "Band " + (iSerie+1); |
|
220 |
pointRoi=(VectorialROI) pointOptionsPanel.getROIs().get(iSerie); |
|
221 |
for (int i = 1; i <= pointRoi.getBandCount(); i++){ |
|
222 |
pointRoi.setBandToOperate(i-1); |
|
223 |
series[iSerie][i] = (int) pointRoi.getMeanValue(); |
|
224 |
} |
|
225 |
} |
|
226 |
// Actualizacion del grafico |
|
227 |
pointOptionsPanel.UpdateChart(); |
|
228 |
pointOptionsPanel.getJPanelChart().setNewChart(series, names); |
|
229 |
|
|
230 |
} catch (NotInitializeException e) { |
|
231 |
e.printStackTrace(); |
|
232 |
} catch (GridException e) { |
|
233 |
e.printStackTrace(); |
|
234 |
} |
|
235 |
} |
|
236 |
|
|
237 |
public void pointDoubleClick(PointEvent event) throws BehaviorException { |
|
238 |
} |
|
239 |
|
|
240 |
} |
Also available in: Unified diff