Revision 20304 trunk/extensions/extRemoteSensing/src/org/gvsig/remotesensing/profiles/gui/ProfilePanel.java

View differences:

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