Revision 3102 trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/Dialogs/GeoreferencingDialog.java

View differences:

GeoreferencingDialog.java
27 27
import com.iver.cit.gvsig.fmap.tools.Behavior.GeoRedimBehavior;
28 28
import com.iver.cit.gvsig.fmap.tools.Behavior.MouseMovementBehavior;
29 29
import com.iver.cit.gvsig.fmap.tools.Behavior.PointBehavior;
30
import com.iver.cit.gvsig.gui.View;
31 30
import com.iver.cit.gvsig.gui.Panels.ConectorPanel;
31
import com.iver.cit.gvsig.gui.Panels.OptionsPanel;
32 32
import com.iver.cit.gvsig.gui.Panels.SelectPointsPanel;
33
import com.iver.cit.gvsig.gui.Panels.ZoomControlPanel;
33 34
import com.iver.cit.gvsig.gui.toolListeners.GeorefMovePointListener;
34 35
import com.iver.cit.gvsig.gui.toolListeners.GeorefPanListener;
35 36
import com.iver.cit.gvsig.gui.toolListeners.GeorefPointSelectorListener;
......
54 55
	private JButton bSave = null;  //  @jve:decl-index=0:
55 56
	private GeoRedimBehavior rb = null;
56 57
	private GeoMoveBehavior mb = null;
57
	private static boolean loadTools = false;
58
	private boolean loadTools = false;
58 59
	private JInternalFrame frame = null;
59 60

  
60 61
	private ConectorPanel	conectorPanel = null;
......
100 101
    private void initialize() {
101 102
    	//Cargamos las herramientas la primera vez que abrimos la ventana
102 103
        if(!loadTools){
103
        	GeoreferencingDialog.loadTools = true;
104
	        com.iver.cit.gvsig.gui.View vista = (com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView();
104
        	loadTools = true;
105
        	com.iver.cit.gvsig.gui.View  vista = null;
106
			try{
107
				vista = (com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView();
108
			}catch(ClassCastException exc){
109
				return;
110
			}
105 111
	        MapControl mapCtrl = vista.getMapControl();
106 112

  
107 113
			StatusBarListener sbl = new StatusBarListener(mapCtrl);
......
229 235
		this.mb = mb;
230 236
	}
231 237
	
238
	/**
239
	 * Obtiene el punto de la lista que ha sido seleccionado
240
	 * @return
241
	 */
242
	public int getSelectedPoint(){
243
		return getConectorPanel().getDataPointsTabPanel().
244
			getSelectPointsPanel().getTableControlerPanel().getSelectedIndex();
245
	}
232 246
	
247
	/**
248
	 * Obtiene el control de la mini imagen que tiene los botones a la izquierda
249
	 * @return ZoomControlPanel
250
	 */
251
	public ZoomControlPanel getZoomControlLeft(){
252
		return this.getConectorPanel().getAdjustGeorefPanel().getZoomLeft();
253
	}
254
	
255
	/**
256
	 * Obtiene el control de la mini imagen que tiene los botones a la derecha
257
	 * @return ZoomControlPanel
258
	 */
259
	public ZoomControlPanel getZoomControlRight(){
260
		return this.getConectorPanel().getAdjustGeorefPanel().getZoomRight();
261
	}
262
	
263
	/**
264
	 * Obtiene el panel de selecci?n de puntos
265
	 * @return Panel de selecci?n de puntos
266
	 */
267
	public SelectPointsPanel getSelectPointsPanel(){
268
		return this.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel();
269
	}
270
	
271
	/**
272
	 * Obtiene el panel de opciones
273
	 * @return OptionPanel
274
	 */
275
	public OptionsPanel getOptionsPanel(){
276
		return getConectorPanel().getAdjustGeorefPanel().getOptionsPanel();
277
	}
278
	
233 279
	/* (non-Javadoc)
234 280
	 * @see com.iver.andami.ui.mdiManager.SingletonView#getViewModel()
235 281
	 */
......
275 321
	 * </UL>
276 322
	 */
277 323
	public void actionPerformed(java.awt.event.ActionEvent e) {
278
		if(e.getSource() == bAceptar){
279
			View theView = (View) PluginServices.getMDIManager().getActiveView();
280
			FLyrGeoRaster lyrGeoRaster = null;
281
			FLyrPoints lyrPoints = null;
282
				
324
		com.iver.cit.gvsig.gui.View  theView = null;
325
		try{
326
			theView = (com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView();
327
		}catch(ClassCastException exc){
328
			return;
329
		}
330
		FLyrPoints lyrPoints = null;
331
		FLyrGeoRaster lyrGeoRaster = null;
332
		
333
		if(e.getSource() == bAceptar || e.getSource() == bCancelar){
283 334
			for(int i=0;i<theView.getMapControl().getMapContext().getLayers().getLayersCount();i++){
284 335
				FLayer lyr = theView.getMapControl().getMapContext().getLayers().getLayer(i);
285 336
				if(	lyr instanceof FLyrGeoRaster && 
286 337
					lyr.getName().startsWith("*") &&
287 338
					lyr.isActive()){
288
											
289
					//Campbiamos el nombre a la capa GeoRaster
290
					lyr.setName(lyr.getName().substring(1, lyr.getName().length()));
291
					lyr.setActive(false);
339
					
292 340
					lyrGeoRaster = (FLyrGeoRaster)lyr;
293
					lyrPoints = lyrGeoRaster.getFLyrPoints();
341
					try{
342
						lyrPoints = lyrGeoRaster.getFLyrPoints();
343
						
344
						//Si cancelamos recuperamos el estado inicial de la capa de puntos
345
						if(e.getSource() == bCancelar)
346
							lyrPoints.recoveryState();
347
						
348
					}catch(ClassCastException exc){
349
						return;
350
					}
351
					
352
					if(e.getSource() == bAceptar){
353
						//Campbiamos el nombre a la capa GeoRaster
354
						lyr.setName(lyr.getName().substring(1, lyr.getName().length()));
355
						lyr.setActive(false);
356
					}
357
					
294 358
				}
295
			}
296
				
297
											
359
			}					
298 360
			theView.getMapControl().setTool("zoomIn");
299
				
300
			//Cerramos la ventana
361
			
362
			//Cerramos la ventana 
301 363
			//(se ejecuta el evento internalFrameClosing de GeoRasterFrameListener)
302 364
			try{
303 365
				frame.setClosed(true);
304 366
			}catch(PropertyVetoException exc){}
305 367
		}
306 368
		
369
		
307 370
	}
308 371
	
309 372
	/**
......
341 404
		if (bCancelar == null) {
342 405
			bCancelar = new JButton();
343 406
			bCancelar.setText(PluginServices.getText(this,"cancelar"));
344
			bCancelar.addActionListener(new java.awt.event.ActionListener() { 
345
				public void actionPerformed(java.awt.event.ActionEvent e) {   					
346
					//Cerramos la ventana 
347
					//(se ejecuta el evento internalFrameClosing de GeoRasterFrameListener)
348
					try{
349
						frame.setClosed(true);
350
					}catch(PropertyVetoException exc){}
351
				}
352
			});
407
			bCancelar.addActionListener(this);
353 408
		}
354 409
		return bCancelar;
355 410
	}
......
414 469
			this.getConectorPanel().setCanvasVisible(true);
415 470
		}
416 471
		frame.pack();
417
	}
472
	}	
418 473

  
419
	public SelectPointsPanel getSelectPointsPanel(){
420
		return this.getConectorPanel().getDataPointsTabPanel().getSelectPointsPanel();
421
	}
422
	
423

  
424 474
	/* (non-Javadoc)
425 475
	 * @see java.awt.event.ComponentListener#componentHidden(java.awt.event.ComponentEvent)
426 476
	 */

Also available in: Unified diff