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

View differences:

ProfilePanel.java
62 62
import com.iver.cit.gvsig.fmap.core.IGeometry;
63 63
import com.iver.cit.gvsig.fmap.core.SymbologyFactory;
64 64
import com.iver.cit.gvsig.fmap.core.symbols.ILineSymbol;
65
import com.iver.cit.gvsig.fmap.core.symbols.IMarkerSymbol;
65 66
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
66 67
import com.iver.cit.gvsig.fmap.layers.GraphicLayer;
67 68
import com.iver.cit.gvsig.fmap.rendering.FGraphic;
......
171 172
	}
172 173
	
173 174
	public void stateChanged(ChangeEvent e) {
175
		
176
		GraphicLayer graphicLayer = mapControl.getMapContext().getGraphicsLayer();
177
		
174 178
		if(e.getSource().equals(getTabbedPane())){
175
	
179
			
180
			
176 181
			if(nextActiveChart==PANELZPROFILE){
177 182
				// Cambia las propiedades del grafico
178 183
				getPointOptionsPanel().getJPanelChart();
179
				GraphicLayer graphicLayer = mapControl.getMapContext().getGraphicsLayer();
180
				graphicLayer.clearAllGraphics();
181
				graphicLayer.clearSymbolsGraphics();
182 184
				getPointOptionsPanel().selectDrawRoiTool();
183
				mapControl.rePaintDirtyLayers();
184
				nextActiveChart = PANELLINEPROFILE;
185 185
				
186 186
				// Se pintan todas las rois que existan en la tabla
187
				ArrayList roisArray = getPointOptionsPanel().getROIs();
188
				if (roisArray != null) {
189
					ISymbol symbol = null;
190
					FGraphic fGraphic = null;
191

  
192
					for (Iterator iter = roisArray.iterator(); iter.hasNext();) { 
193
						VectorialROI vectorialROI = (VectorialROI)iter.next();;
194
						for (Iterator iterator = vectorialROI.getGeometries()
195
								.iterator(); iterator.hasNext();) {
196
							IGeometry geometry = (IGeometry) iterator.next();
197
							switch (geometry.getGeometryType()) {
198
							case FShape.POINT:
199
								symbol = SymbologyFactory.createDefaultMarkerSymbol();
200
								((IMarkerSymbol) symbol).setColor(vectorialROI.getColor());
201
								break;
202
							}
203
							fGraphic = new FGraphic(geometry, graphicLayer
204
									.addSymbol(symbol));
205
							graphicLayer.addGraphic(fGraphic);
206
							getPointOptionsPanel().getRoiGraphics(vectorialROI.getName()).add(fGraphic);
207
						}
208
						
209
					}
210
					getMapControl().drawGraphics();
211
				}
212
				nextActiveChart = PANELLINEPROFILE;
187 213
			}
188 214
			
189 215
			else if(nextActiveChart == PANELLINEPROFILE){
190 216
				getLineOptionsPanel().getJPanelChart();
191
				GraphicLayer graphicLayer = mapControl.getMapContext().getGraphicsLayer();
192
				graphicLayer.clearAllGraphics();
193 217
				getLineOptionsPanel().selectDrawRoiTool();
194 218
			
195 219
				try {
......
200 224
					roi.setBandToOperate(getLineOptionsPanel().getComboBands().getSelectedIndex());
201 225
					getLineOptionsPanel().getTable().setSelectedIndex(0);
202 226
					getLineOptionsPanel().getTable().updateUI();
203
					
227
			
204 228
					// Se pintan las rois que existen en la tabla
205 229
					ArrayList roisArray = getLineOptionsPanel().getROIs();
206 230
					if (roisArray != null) {
......
214 238
									.iterator(); iterator.hasNext();) {
215 239
								IGeometry geometry = (IGeometry) iterator.next();
216 240
								switch (geometry.getGeometryType()) {
217
								case FShape.POINT:
218
									break;
219
								case FShape.POLYGON:
220
									break;
221 241
								case FShape.LINE:
222 242
									symbol = SymbologyFactory.createDefaultLineSymbol();
223 243
									((ILineSymbol) symbol).setLineColor(roiline.getColor());
......
237 257
				} catch (Exception e1) {
238 258
					// TODO: handle exception
239 259
				}
240
				
241
				nextActiveChart= PANELZPROFILE;
242
				
260
				nextActiveChart= PANELZPROFILE;	
243 261
			}
244 262
		}
245 263
	}

Also available in: Unified diff