Revision 20309
trunk/extensions/extRemoteSensing/src/org/gvsig/remotesensing/profiles/listener/DrawMouseProfileListener.java | ||
---|---|---|
82 | 82 |
|
83 | 83 |
private ProfilePanel panel = null; |
84 | 84 |
|
85 |
/** |
|
86 |
* Constructor |
|
87 |
* @param panel principal de perfiles |
|
88 |
* */ |
|
85 | 89 |
public DrawMouseProfileListener(ProfilePanel panel) { |
86 | 90 |
this.panel= panel; |
87 | 91 |
} |
88 | 92 |
|
89 |
public void pointFixed(MeasureEvent event) throws BehaviorException { |
|
90 |
} |
|
91 |
|
|
92 |
public void points(MeasureEvent event) throws BehaviorException { |
|
93 |
} |
|
94 |
|
|
95 | 93 |
/** |
96 |
* Eventos tras el dibujado de una linea. |
|
94 |
* Eventos tras el dibujado de una linea. Se pinta la geometria dibujada en la vista y se genera el |
|
95 |
* gr?fico asociado. |
|
97 | 96 |
* */ |
98 | 97 |
public void polylineFinished(MeasureEvent event) throws BehaviorException { |
99 | 98 |
|
... | ... | |
108 | 107 |
selectedRow = panel.getLineOptionsPanel().getTable().getSelectedRow(); |
109 | 108 |
roiName = (String)panel.getLineOptionsPanel().getTable().getModel().getValueAt(selectedRow,0); |
110 | 109 |
lineRoi = (VectorialROI)panel.getLineOptionsPanel().getROI(roiName); |
111 |
|
|
110 |
|
|
111 |
// Si hay una roi con mas de una geometria no se hace nada. |
|
112 | 112 |
if(lineRoi.getGeometries().size()>0) |
113 | 113 |
return; |
114 | 114 |
|
... | ... | |
131 | 131 |
drawChartRoi(lineRoi,panel.getLineOptionsPanel().getComboBands().getSelectedIndex()); |
132 | 132 |
} |
133 | 133 |
} catch (NotInitializeException e) { |
134 |
e.printStackTrace(); |
|
135 |
} |
|
136 |
|
|
134 |
RasterToolsUtil.messageBoxError("tabla_no_inicializada", this, e); |
|
135 |
} |
|
137 | 136 |
} |
138 | 137 |
|
139 |
public boolean cancelDrawing() { |
|
140 |
return true; |
|
141 |
} |
|
142 |
|
|
138 |
/** |
|
139 |
* @return cursor asociado al panel activo |
|
140 |
* */ |
|
143 | 141 |
public Cursor getCursor() { |
144 | 142 |
if(panel.getPointOptionsPanel().getNextActive()==ProfilePanel.PANELZPROFILE) |
145 | 143 |
return panel.getLineOptionsPanel().getToolCursor(); |
... | ... | |
149 | 147 |
|
150 | 148 |
|
151 | 149 |
/** |
152 |
* Eventos tras el dibujado de un punto. |
|
150 |
* Eventos tras el dibujado de un punto. Se a?ade el punto a la roi activa del panel. |
|
151 |
* Si esta roi tiene alguna geometria, se elimina. |
|
153 | 152 |
* */ |
154 | 153 |
public void point(PointEvent event) throws BehaviorException { |
155 | 154 |
|
... | ... | |
169 | 168 |
pointRoi.clear(); |
170 | 169 |
pointRoi.addGeometry(geometry); |
171 | 170 |
panel.getPointOptionsPanel().addROI(pointRoi); |
172 |
|
|
173 |
ISymbol symbol = null; |
|
174 |
FGraphic fGraphic = null; |
|
175 |
ArrayList roisArray =panel.getPointOptionsPanel().getROIs(); |
|
176 |
GraphicLayer graphicLayer = panel.getPointOptionsPanel().getMapControl().getMapContext().getGraphicsLayer(); |
|
177 |
|
|
178 |
for (Iterator iter = roisArray.iterator(); iter.hasNext();) { |
|
179 |
VectorialROI vectorialROI = (VectorialROI)iter.next();; |
|
180 |
for (Iterator iterator = vectorialROI.getGeometries() |
|
181 |
.iterator(); iterator.hasNext();) { |
|
182 |
geometry = (IGeometry) iterator.next(); |
|
183 |
switch (geometry.getGeometryType()) { |
|
184 |
case FShape.POINT: |
|
185 |
symbol = SymbologyFactory.createDefaultMarkerSymbol(); |
|
186 |
((IMarkerSymbol) symbol).setColor(vectorialROI.getColor()); |
|
187 |
break; |
|
188 |
} |
|
189 |
fGraphic = new FGraphic(geometry, graphicLayer |
|
190 |
.addSymbol(symbol)); |
|
191 |
graphicLayer.addGraphic(fGraphic); |
|
192 |
panel.getPointOptionsPanel().getRoiGraphics(vectorialROI.getName()).add(fGraphic); |
|
193 |
} |
|
194 |
|
|
195 |
} |
|
196 |
panel.getPointOptionsPanel().getMapControl().drawGraphics(); |
|
197 |
|
|
198 |
int nSeries = panel.getPointOptionsPanel().getROIs().size(); |
|
199 |
int[][] series = new int[nSeries][pointRoi.getBandCount()+1]; |
|
200 |
String[] names = new String[nSeries]; |
|
201 |
|
|
202 |
// Se establecen los colores de las graficas segun color de las rois |
|
203 |
for(int iSerie = 0; iSerie < nSeries; iSerie++){ |
|
204 |
series[iSerie][0] = 0; |
|
205 |
names[iSerie] = "Band " + (iSerie+1); |
|
206 |
pointRoi=(VectorialROI) panel.getPointOptionsPanel().getROIs().get(iSerie); |
|
207 |
for (int i = 1; i <= pointRoi.getBandCount(); i++){ |
|
208 |
pointRoi.setBandToOperate(i-1); |
|
209 |
series[iSerie][i] = (int) pointRoi.getMeanValue(); |
|
210 |
} |
|
211 |
} |
|
212 |
// Actualizacion del grafico |
|
213 |
panel.getPointOptionsPanel().UpdateChart(); |
|
214 |
panel.getPointOptionsPanel().getJPanelChart().setNewChart(series, names); |
|
171 |
// Actualizaci?n del gr?fico |
|
172 |
drawChartAllPointsRois(); |
|
215 | 173 |
panel.getPointOptionsPanel().getNewButton().setSelected(false); |
216 | 174 |
panel.getMapControl().setTool(panel.getPointOptionsPanel().getPreviousTool()); |
217 | 175 |
} catch (NotInitializeException e) { |
218 |
e.printStackTrace(); |
|
219 |
} catch (GridException e) { |
|
220 |
RasterToolsUtil.messageBoxError(PluginServices.getText(this, "grid_error"), this, e); |
|
176 |
RasterToolsUtil.messageBoxError("tabla_no_inicializada", this, e); |
|
221 | 177 |
} |
222 | 178 |
} |
223 | 179 |
|
224 |
public void pointDoubleClick(PointEvent event) throws BehaviorException { |
|
225 |
} |
|
226 |
|
|
227 |
|
|
228 |
|
|
229 |
|
|
180 |
|
|
230 | 181 |
/** |
231 |
* Metodo que se encarga de pintar la roi que se pasa como parametro sobre el grafico. |
|
182 |
* Metodo que se encarga de pintar la roi de tipo linea que se pasa como parametro sobre el grafico.
|
|
232 | 183 |
* La vanda de la que se tomar?n los valores es la que se pasa como par?metro. |
233 | 184 |
* */ |
234 | 185 |
private void drawChartRoi(VectorialROI roi, int band){ |
235 | 186 |
|
236 | 187 |
try { |
237 |
|
|
238 | 188 |
int[][] series; |
239 | 189 |
series = new int[1][roi.getValues()]; |
240 | 190 |
String[] names = new String[1]; |
... | ... | |
287 | 237 |
} |
288 | 238 |
} |
289 | 239 |
} |
290 |
|
|
291 | 240 |
// Actualizacion del grafico |
292 | 241 |
panel.getLineOptionsPanel().SetColorSeriesChart(); |
293 | 242 |
panel.getLineOptionsPanel().getJPanelChart().setNewChart(series, names); |
... | ... | |
302 | 251 |
panel.getLineOptionsPanel().getTable().getModel().setValueAt(new Double(mean), selectedRow, 4); |
303 | 252 |
|
304 | 253 |
} catch (GridException e) { |
305 |
e.printStackTrace();
|
|
254 |
RasterToolsUtil.messageBoxError(PluginServices.getText(this, "grid_error"), this, e);
|
|
306 | 255 |
} catch (NotInitializeException e) { |
307 |
// TODO Auto-generated catch block |
|
308 |
e.printStackTrace(); |
|
256 |
RasterToolsUtil.messageBoxError("tabla_no_inicializada", this, e); |
|
309 | 257 |
} |
310 |
|
|
311 | 258 |
} |
312 | 259 |
|
260 |
/** |
|
261 |
* M?todo que realiza el repintado del grafico con todas las rois la tabla del panel zprofile. |
|
262 |
* */ |
|
263 |
private void drawChartAllPointsRois(){ |
|
264 |
|
|
265 |
ISymbol symbol = null; |
|
266 |
FGraphic fGraphic = null; |
|
267 |
IGeometry geometry=null; |
|
268 |
ArrayList roisArray =panel.getPointOptionsPanel().getROIs(); |
|
269 |
GraphicLayer graphicLayer = panel.getPointOptionsPanel().getMapControl().getMapContext().getGraphicsLayer(); |
|
270 |
VectorialROI pointRoi=null; |
|
271 |
|
|
272 |
for (Iterator iter = roisArray.iterator(); iter.hasNext();) { |
|
273 |
pointRoi= (VectorialROI)iter.next();; |
|
274 |
for (Iterator iterator = pointRoi.getGeometries() |
|
275 |
.iterator(); iterator.hasNext();) { |
|
276 |
geometry = (IGeometry) iterator.next(); |
|
277 |
switch (geometry.getGeometryType()) { |
|
278 |
case FShape.POINT: |
|
279 |
symbol = SymbologyFactory.createDefaultMarkerSymbol(); |
|
280 |
((IMarkerSymbol) symbol).setColor(pointRoi.getColor()); |
|
281 |
break; |
|
282 |
} |
|
283 |
fGraphic = new FGraphic(geometry, graphicLayer |
|
284 |
.addSymbol(symbol)); |
|
285 |
graphicLayer.addGraphic(fGraphic); |
|
286 |
panel.getPointOptionsPanel().getRoiGraphics(pointRoi.getName()).add(fGraphic); |
|
287 |
} |
|
288 |
} |
|
289 |
panel.getPointOptionsPanel().getMapControl().drawGraphics(); |
|
290 |
|
|
291 |
int nSeries = panel.getPointOptionsPanel().getROIs().size(); |
|
292 |
int[][] series = new int[nSeries][pointRoi.getBandCount()+1]; |
|
293 |
String[] names = new String[nSeries]; |
|
313 | 294 |
|
295 |
// Se establecen los colores de las graficas segun color de las rois |
|
296 |
for(int iSerie = 0; iSerie < nSeries; iSerie++){ |
|
297 |
series[iSerie][0] = 0; |
|
298 |
names[iSerie] = "Band " + (iSerie+1); |
|
299 |
pointRoi=(VectorialROI) panel.getPointOptionsPanel().getROIs().get(iSerie); |
|
300 |
try { |
|
301 |
for (int i = 1; i <= pointRoi.getBandCount(); i++){ |
|
302 |
pointRoi.setBandToOperate(i-1); |
|
303 |
series[iSerie][i] = (int) pointRoi.getMeanValue(); |
|
304 |
} |
|
305 |
} catch (GridException e) { |
|
306 |
RasterToolsUtil.messageBoxError(PluginServices.getText(this, "grid_error"), this, e); |
|
307 |
} |
|
308 |
} |
|
309 |
panel.getPointOptionsPanel().UpdateChart(); |
|
310 |
panel.getPointOptionsPanel().getJPanelChart().setNewChart(series, names); |
|
311 |
} |
|
314 | 312 |
|
313 |
|
|
314 |
public boolean cancelDrawing() { |
|
315 |
return true; |
|
316 |
} |
|
317 |
|
|
318 |
public void pointFixed(MeasureEvent event) throws BehaviorException { |
|
319 |
} |
|
315 | 320 |
|
321 |
public void points(MeasureEvent event) throws BehaviorException { |
|
322 |
} |
|
316 | 323 |
|
317 |
|
|
318 |
|
|
319 |
|
|
320 |
|
|
321 |
|
|
322 |
|
|
324 |
public void pointDoubleClick(PointEvent event) throws BehaviorException { |
|
325 |
} |
|
323 | 326 |
} |
Also available in: Unified diff