Revision 20304

View differences:

trunk/extensions/extRemoteSensing/src/org/gvsig/remotesensing/profiles/gui/LineProfileOptionsPanel.java
68 68
import org.gvsig.raster.dataset.IRasterDataSource;
69 69
import org.gvsig.raster.grid.Grid;
70 70
import org.gvsig.raster.grid.roi.ROI;
71
import org.gvsig.raster.util.RasterToolsUtil;
71 72
import org.gvsig.remotesensing.profiles.listener.DrawMouseProfileListener;
72 73
import org.gvsig.remotesensing.profiles.listener.LineProfileOptionsListener;
73 74
import org.jfree.chart.axis.NumberAxis;
......
76 77
import com.iver.andami.PluginServices;
77 78
import com.iver.cit.gvsig.fmap.MapControl;
78 79
import com.iver.cit.gvsig.fmap.layers.FLayer;
79
import com.iver.cit.gvsig.fmap.layers.GraphicLayer;
80 80
import com.iver.cit.gvsig.fmap.rendering.FGraphic;
81 81
import com.iver.cit.gvsig.fmap.tools.Behavior.Behavior;
82 82
import com.iver.cit.gvsig.fmap.tools.Behavior.MouseMovementBehavior;
......
111 111
	private JComboBox comboBands = null;
112 112
	private String previousTool = null;
113 113
	
114
	/** 
115
	 * Constructor 
116
	 * */
114 117
	public LineProfileOptionsPanel(ProfilePanel mainPanel) {
115 118
		super();
116 119
		this.mapControl = mainPanel.getMapControl();
......
126 129
		previousTool = mapControl.getCurrentTool();
127 130
	}
128 131
	
132

  
133
	/** Inicializaci?n del panel*/
129 134
	
130 135
	private void initialize() {
131
	
136

  
132 137
		getNewButton().addActionListener(listener);
133 138
		getDeleteButton().addActionListener(listener);
134 139
		getTable().getTable().getJTable().getSelectionModel()
......
136 141
		getTable().getTable().getJTable().getModel().addTableModelListener(
137 142
				listener);
138 143
		
144
		// Asignaci?n de la capa
139 145
		FLyrRasterSE rasterLayer = (FLyrRasterSE) fLayer;
140 146
		IRasterDataSource dsetCopy = null; 
141 147
		dsetCopy = rasterLayer.getDataSource().newDataset();
......
146 152
			bufferFactory.setAllDrawableBands();
147 153
			grid= new Grid(bufferFactory);
148 154
		} catch (RasterBufferInvalidException e) {
149
			e.printStackTrace();
155
			RasterToolsUtil.messageBoxError("buffer_incorrecto", this, e);
150 156
		}
151 157
		StatusBarListener sbl = new StatusBarListener(mapControl);
152 158
		DrawMouseProfileListener drawMouseViewListener = new DrawMouseProfileListener(
......
158 164
	}
159 165
	
160 166
	
167
	/**
168
	 * Tabla que muestra la informaci?n asociada a cada una de las lineas cuyo perfil se quiere extraer
169
	 * La informaci?n para cada linea es: identificador, color asociado, valor maximo, valor m?nimo 
170
	 * y valor medio
171
	 * */
161 172
	public TableContainer getTable() {
162 173
		if (tableContainer == null) {
163 174
			String[] columnNames = { PluginServices.getText(this, "Linea"),
......
176 187
	}
177 188

  
178 189
	
190
	/**
191
	 * @return panel con los controles para agregar o eliminar perfiles y combo 
192
	 * para selecci?n de banda
193
	 * */
179 194
	public JPanel getControlPanel() {
180 195
		if (controlPanel == null) {
181 196
			controlPanel = new JPanel();
......
198 213
		return controlPanel;
199 214
	}
200 215

  
201

  
216
	/**
217
	 * @return JToggleButton para el borrado de perfiles 
218
	 * */
202 219
	public JToggleButton getDeleteButton() {
203 220
		if(deleteButton== null){
204 221
			deleteButton = new JToggleButton();
......
209 226
		return deleteButton;
210 227
	}
211 228

  
212

  
229
	/** 
230
	 * @return JToggleButton para a?adir nuevo perfil 
231
	 * */
213 232
	public JToggleButton getNewButton() {
214 233
		if(newButton== null){
215 234
			newButton = new JToggleButton();
......
221 240
	}
222 241

  
223 242
	
243
	/** Metodo que asigna el cursor asociado al dibujado de la linea y asigna la herramienta 
244
	 * drawLineROI */
245
	
224 246
	public void selectDrawRoiTool() {
225 247
		if (mapControl != null){
226 248
			if (getNewButton().isSelected()) {
......
234 256
	}
235 257

  
236 258
	
259
	/**
260
	 * @return combo para la selecci?n de banda 
261
	 * */
237 262
	public JComboBox getComboBands() {	
238 263
		if (comboBands==null){
239 264
			comboBands= new JComboBox();
......
248 273
		return comboBands;
249 274
	}
250 275
	
276
	/**
277
	 * @return grid fuente de datos
278
	 * */
251 279
	public Grid getGrid(){
252 280
		 return grid;
253 281
	}
254 282

  
255

  
283
	/**
284
	 * @return mapControl
285
	 * */
256 286
	public MapControl getMapControl() {
257 287
		return mapControl;
258 288
	}
......
267 297
		return rois;
268 298
	}
269 299

  
300
	/**
301
	 * @return tabla Hash con las rois actuales del panel
302
	 * */
270 303
	private HashMap getRoiGraphics() {
271 304
		if (roiGraphics == null)
272 305
			roiGraphics = new HashMap();
273 306
		return roiGraphics;
274 307
	}
275 308

  
309
	
310
	/**
311
	 * @return arraylist con las rois que contiene el panel
312
	 * */
276 313
	public ArrayList getROIs() {
277 314
		return new ArrayList(getRois().values());
278 315
	}
279 316
	
317
	/**
318
	 * @param roiName identificador de la roi
319
	 * @return arraylist con los graphics de la roi cuyo nombre se pasa como par?metro
320
	 * */
280 321
	public ArrayList getRoiGraphics(String roiName) {
281 322
		return (ArrayList) getRoiGraphics().get(roiName);
282 323
	}
283 324

  
325
	/**
326
	 * M?todo que a?ade una nueva roi al panel
327
	 * @param roi Roi a a?adir
328
	 * */
284 329
	public void addROI(ROI roi) {
285 330
		getRois().put(roi.getName(), roi);
286 331
		getRoiGraphics().put(roi.getName(), new ArrayList());
......
292 337
	}
293 338

  
294 339

  
340
	/**
341
	 * @return panel sobre el que se dibuja la grafica. 
342
	 * Cada vez que se llama este m?todo se limpia el gr?fico.
343
	 * */
295 344
	public GraphicChartPanel getJPanelChart() {
296 345
		 jPanelChart.cleanChart();
297 346
		 XYPlot plot = jPanelChart.getChart().getChart().getXYPlot();
......
301 350
	}
302 351

  
303 352

  
353
	/**
354
	 * M?todo que elimina de la lista de rois del panel la roi cuyo nombre coincide con el que se pasa como par?metro
355
	 * @param roiName nombre de la ROI a eliminar
356
	 * */
304 357
	public void removeROI(String roiName) {
305 358
		boolean repaint = false;
306 359
		getRois().remove(roiName);
......
317 370
	}
318 371
	
319 372
	
320
	public void UpdateChart(){
373
	/**
374
	 *  M?todo que asigna el color a cada una de las series de la gr?fica
375
	 *  */
376
	public void SetColorSeriesChart(){
321 377
		XYPlot plot = jPanelChart.getChart().getChart().getXYPlot();
322 378
		int index=0;
323 379
		try {
......
325 381
			VectorialROI roi = (VectorialROI)getROIs().get(index);
326 382
			plot.getRenderer().setSeriesPaint(0, roi.getColor());
327 383
		} catch (NotInitializeException e) {
328
			e.printStackTrace();
384
			RasterToolsUtil.messageBoxError("tabla_no_inicializada", this, e);
329 385
		} 	
330 386
	}
331 387
	
388
	/**
389
	 * @param roiName nombre de la roi
390
	 * @return ROI cuyo nombre coincide con el pasado como argumento
391
	 * */
392
	
332 393
	public ROI getROI(String roiName) {
333 394
		return (ROI) getRois().get(roiName);
334 395
	}
335 396

  
397
	
398
	/**
399
	 * @retun identificador de panel activo  PANELZPROFILE o PANELLINEPROFILE 
400
	 * */
336 401
	public int getActive(){
337 402
		return mainPanel.getActivePanel();
338 403
	}
339 404

  
340 405

  
406
	/**
407
	 * @return string con el identificador de la herramienta previa
408
	 * */
341 409
	public String getPreviousTool() {
342 410
		return previousTool;
343 411
	}
412

  
344 413
}
trunk/extensions/extRemoteSensing/src/org/gvsig/remotesensing/profiles/gui/ProfileDialog.java
86 86
	
87 87
	
88 88
	public WindowInfo getWindowInfo() {
89
		WindowInfo m_viewinfo = new WindowInfo(WindowInfo.PALETTE | WindowInfo.RESIZABLE);
89
		WindowInfo m_viewinfo = new WindowInfo(WindowInfo.PALETTE);
90 90
		m_viewinfo.setTitle(PluginServices.getText(this, "perfiles_imagen"));
91 91
		m_viewinfo.setHeight(this.getHeight());
92 92
		m_viewinfo.setWidth(this.getWidth());
......
126 126
		
127 127
	}
128 128

  
129
	/**
130
	 * M?todo que realiza acciones al cerrar el dialogo como eliminar los graphis 
131
	 * de la vista
132
	 * */
129 133
	public void windowClosed() {
130 134
		GraphicLayer graphicLayer = mapControl.getMapContext().getGraphicsLayer();
131 135
		graphicLayer.clearAllGraphics();
trunk/extensions/extRemoteSensing/src/org/gvsig/remotesensing/profiles/gui/ProfilePanel.java
54 54
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel;
55 55
import org.gvsig.gui.beans.defaultbuttonspanel.DefaultButtonsPanel;
56 56
import org.gvsig.gui.beans.graphic.GraphicChartPanel;
57
import org.gvsig.gui.beans.table.exceptions.NotInitializeException;
57 58
import org.gvsig.raster.grid.roi.ROI;
59
import org.gvsig.raster.util.RasterToolsUtil;
58 60

  
59 61
import com.iver.andami.PluginServices;
60 62
import com.iver.cit.gvsig.fmap.MapControl;
......
122 124
	}
123 125

  
124 126
	
127
	/**
128
	 * @return mapControl
129
	 * */
125 130
	public MapControl getMapControl() {
126 131
		return mapControl ;
127 132
	}
128 133

  
129 134
	
130 135
	/**
131
	 * Panel con los tab. 
136
	 * @return JPanel con los tab. 
132 137
	 * */
133 138
	public JPanel getSouthPanel(){
134 139
		if(southPanel== null){
......
144 149
	}
145 150
	
146 151
	
147
	/** @return panel con las opciones zProfiles */
152
	/** 
153
	 * @return panel con las opciones zProfiles 
154
	 * */
148 155
	public ZProfileOptionsPanel getPointOptionsPanel(){
149 156
		if(pointOptionsPanel==null){
150 157
			pointOptionsPanel= new ZProfileOptionsPanel(this);
......
153 160
		return pointOptionsPanel;
154 161
	}
155 162
	
156
	/** @return panel con las opciones lineProfiles */
163
	/**
164
	 *  @return panel con las opciones lineProfiles 
165
	 *  */
157 166
	public LineProfileOptionsPanel getLineOptionsPanel(){
158 167
		if(lineOptionsPanel==null){
159 168
			lineOptionsPanel= new LineProfileOptionsPanel(this);
......
171 180
		return tabbedPane;
172 181
	}
173 182
	
183
	
184
	/** 
185
	 * Acciones a llevar a cabo cuando se cambia de pesta?a
186
	 * */
174 187
	public void stateChanged(ChangeEvent e) {
175 188
		
176
		GraphicLayer graphicLayer = mapControl.getMapContext().getGraphicsLayer();
177
		
178 189
		if(e.getSource().equals(getTabbedPane())){
179 190
			
180
			
181 191
			if(nextActiveChart==PANELZPROFILE){
182
				// Cambia las propiedades del grafico
192
				// Se actualizan las propiedades del gr?fico
183 193
				getPointOptionsPanel().getJPanelChart();
184 194
				getPointOptionsPanel().selectDrawRoiTool();
185 195
				
196
				GraphicLayer graphicLayer = mapControl.getMapContext().getGraphicsLayer();
186 197
				// Se pintan todas las rois que existan en la tabla
187 198
				ArrayList roisArray = getPointOptionsPanel().getROIs();
199
	
188 200
				if (roisArray != null) {
189 201
					ISymbol symbol = null;
190 202
					FGraphic fGraphic = null;
191

  
192 203
					for (Iterator iter = roisArray.iterator(); iter.hasNext();) { 
193 204
						VectorialROI vectorialROI = (VectorialROI)iter.next();;
194
						for (Iterator iterator = vectorialROI.getGeometries()
195
								.iterator(); iterator.hasNext();) {
205
						for (Iterator iterator = vectorialROI.getGeometries().iterator(); iterator.hasNext();) {
196 206
							IGeometry geometry = (IGeometry) iterator.next();
197 207
							switch (geometry.getGeometryType()) {
198 208
							case FShape.POINT:
......
200 210
								((IMarkerSymbol) symbol).setColor(vectorialROI.getColor());
201 211
								break;
202 212
							}
203
							fGraphic = new FGraphic(geometry, graphicLayer
204
									.addSymbol(symbol));
213
							fGraphic = new FGraphic(geometry, graphicLayer.addSymbol(symbol));
205 214
							graphicLayer.addGraphic(fGraphic);
206 215
							getPointOptionsPanel().getRoiGraphics(vectorialROI.getName()).add(fGraphic);
207 216
						}
208
						
209 217
					}
210 218
					getMapControl().drawGraphics();
211 219
				}
220
				// Asignaci?n del siguiente estado
212 221
				nextActiveChart = PANELLINEPROFILE;
213 222
			}
214
			
215 223
			else if(nextActiveChart == PANELLINEPROFILE){
224
				//se actualizan las propiedades del gr?fico
216 225
				getLineOptionsPanel().getJPanelChart();
217 226
				getLineOptionsPanel().selectDrawRoiTool();
218 227
			
219 228
				try {
220
				
221 229
					int selectedRow = getLineOptionsPanel().getTable().getSelectedRow();
222 230
					String roiName = (String)getLineOptionsPanel().getTable().getModel().getValueAt(selectedRow,0);
223 231
					VectorialROI roi = (VectorialROI)getLineOptionsPanel().getROI(roiName);
......
225 233
					getLineOptionsPanel().getTable().setSelectedIndex(0);
226 234
					getLineOptionsPanel().getTable().updateUI();
227 235
			
236
					GraphicLayer graphicLayer = mapControl.getMapContext().getGraphicsLayer();
228 237
					// Se pintan las rois que existen en la tabla
229 238
					ArrayList roisArray = getLineOptionsPanel().getROIs();
239
					
230 240
					if (roisArray != null) {
231 241
						ISymbol symbol = null;
232 242
						FGraphic fGraphic = null;
233

  
243
						
234 244
						for (Iterator iter = roisArray.iterator(); iter.hasNext();) {
235 245
							ROI roiline = (ROI) iter.next();
236 246
							VectorialROI vectorialROI = (VectorialROI) roiline;
237
							for (Iterator iterator = vectorialROI.getGeometries()
238
									.iterator(); iterator.hasNext();) {
247
							for (Iterator iterator = vectorialROI.getGeometries().iterator(); iterator.hasNext();) {
239 248
								IGeometry geometry = (IGeometry) iterator.next();
240 249
								switch (geometry.getGeometryType()) {
241
								case FShape.LINE:
242
									symbol = SymbologyFactory.createDefaultLineSymbol();
243
									((ILineSymbol) symbol).setLineColor(roiline.getColor());
244
									break;
245
								}
246
								fGraphic = new FGraphic(geometry, graphicLayer
247
										.addSymbol(symbol));
250
									case FShape.LINE:
251
										symbol = SymbologyFactory.createDefaultLineSymbol();
252
										((ILineSymbol) symbol).setLineColor(roiline.getColor());
253
										break;
254
									}
255
								fGraphic = new FGraphic(geometry, graphicLayer.addSymbol(symbol));
248 256
								graphicLayer.addGraphic(fGraphic);
249 257
								getLineOptionsPanel().getRoiGraphics(roiline.getName()).add(fGraphic);
250 258
							}
251
							
252 259
						}
253 260
						getMapControl().drawGraphics();
254 261
					}
255
				
256 262
					
257
				} catch (Exception e1) {
258
					// TODO: handle exception
263
				} catch (NotInitializeException e1) {
264
					RasterToolsUtil.messageBoxError("tabla_no_inicializada", this, e1);
259 265
				}
266
				// Asignaci?n del siguiente estado
260 267
				nextActiveChart= PANELZPROFILE;	
261 268
			}
262 269
		}
263 270
	}
264 271

  
265

  
272
	/**
273
	 * @return entero que identifica el panel activo
274
	 * */
266 275
	public int getActivePanel(){
267 276
		return nextActiveChart;
268 277
	}

Also available in: Unified diff