Revision 4715

View differences:

trunk/extensions/extGeoreferencing/text.properties
3 3
algoritmo=Algoritmo
4 4
anterior=Anterior
5 5
asignar_coordenadas=Asignar Coordenadas
6
borrar_todos=Borrar todos
6
borrar_todos=Borrar todos los puntos
7 7
borrar_uno=Borrar punto seleccionado
8 8
calcular_errores=Calcular errores automaticamente
9 9
cancelar=Cancelar
......
39 39
seleccionar_fichero=Seleccionar fichero
40 40
seleccionar_puntos=Seleccionar Puntos
41 41
Move_from_view=Mover puntos desde la vista
42
selectfromview=Seleccionar desde la vista
42
selectfromview=Seleccionar punto desde la vista
43 43
siguiente=Siguiente
44 44
total=Total
45 45
ultimo=?ltimo
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/fmap/layers/FLyrPoints.java
415 415
	public void PointList2Ascii(String file){;
416 416
		geoPointPersistence.saveAsciiPointList(file);
417 417
	}
418
	
419
	/**
420
	 * 
421
	 * @param geoDialog
422
	 */
423
	public void updateData(GeoreferencingDialog geoDialog){
424
		geoPointPersistence.updateData(geoDialog);
425
	}	
426 418
	//**********************End Methods**********************************
427 419
	
428 420
	//**********************Setters & Getters****************************	
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/dialogs/GeoreferencingDialog.java
220 220
        tablePointsPanel.getPButtonsExportImportPanel().getBExportToAscii().addActionListener(this);
221 221
    }
222 222
    	
223
	/* (non-Javadoc)
224
	 * @see com.iver.andami.ui.mdiManager.SingletonView#getViewModel()
225
	 */
226
	/*public ViewInfo getViewInfo() {
227
		ViewInfo m_viewinfo = new ViewInfo(ViewInfo.MODELESSDIALOG |
228
				ViewInfo.RESIZABLE);
229
		m_viewinfo.setWidth(this.getWidth());
230
		m_viewinfo.setHeight(this.getHeight());
231
		m_viewinfo.setTitle(PluginServices.getText(this,
232
				"cargar_sin_georef"));
233

  
234
		return m_viewinfo;
235
	}*/
236
	
237 223
	/**
238
	 * @see com.iver.mdiApp.ui.MDIManager.SingletonView#getViewModel()
239
	 */
240
	/*public Object getViewModel() {
241
		return "GeoreferencingDialog";
242
	}*/
243
	
244
		
245
	/**
246 224
	 * This method initializes jButton	
247 225
	 * 	
248 226
	 * @return javax.swing.JButton	
......
351 329

  
352 330
			 	lyrGeoRaster.getFLyrPoints().saveState();
353 331
			 	getLyrPoints().XML2PointList(fName);
354
			 	getLyrPoints().updateData(this);
355 332
			}
356 333
		}
357 334
		
......
412 389
			bProcesar = new JButton();
413 390
			bProcesar.setText(PluginServices.getText(this,"procesar"));
414 391
			bProcesar.setEnabled(false);
415
			//bProcesar.setPreferredSize(new java.awt.Dimension(41,25));
416 392
			bProcesar.addActionListener(new java.awt.event.ActionListener() { 
417 393
				public void actionPerformed(java.awt.event.ActionEvent e) {
418 394
                    /*if (PluginServices.getMainFrame() == null) {
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/panels/GeorefOptionsPanel.java
4 4
import java.awt.FlowLayout;
5 5
import java.awt.GridBagConstraints;
6 6
import java.awt.GridBagLayout;
7
import java.awt.event.ActionEvent;
8 7
import java.awt.event.ActionListener;
9
import java.beans.PropertyVetoException;
10 8
import java.io.File;
11 9

  
12
import javax.swing.JCheckBox;
10
import javax.swing.JComboBox;
13 11
import javax.swing.JFileChooser;
14 12
import javax.swing.JLabel;
15 13
import javax.swing.JPanel;
16 14

  
17 15
import com.iver.andami.PluginServices;
18
import com.iver.cit.gvsig.fmap.layers.FLyrPoints;
19
import com.iver.cit.gvsig.gui.View;
20 16
import com.iver.cit.gvsig.gui.dialogs.GeoreferencingDialog;
21

  
22
import javax.swing.JComboBox;
23
import javax.swing.JButton;
24
import javax.swing.filechooser.FileFilter;
25 17
/**
26 18
 * Panel que contiene opciones de georreferenciaci?n a elegir por
27 19
 * el usuario. Esta clase no maneja eventos.
......
41 33
	private JPanel pAlgoritmo = null;
42 34
	private JLabel lAlgoritmo = null;
43 35
	private JComboBox cbAlgoritmo = null;
44
	private JPanel pExportImport = null;
45
	private JPanel pSaveLoad = null;
46
	private JPanel pExportAscii = null;
47
	private JButton bSavePoints = null;
48
	private JButton bLoadPoints = null;
49
	private JButton jButton2 = null;
50 36
	private JPanel jPanel = null;
51
	private String lastPathLoad = "./";
52
	private String lastPathSave = "./";
53 37
	
54 38
	/**
55
	 * Lista de formatos soportados
56
	 */
57
	private String[] fileFilters = {"grf"};
58
	
59
	/**
60 39
	 * This is the default constructor
61 40
	 */
62 41
	public GeorefOptionsPanel(GeoreferencingDialog grd) {
......
85 64
	private JPanel getPGeneral() {
86 65
		if (pGeneral == null) {
87 66
			GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
88
			GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
89 67
			GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
90 68
			GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
91 69
			pGeneral = new JPanel();
......
98 76
			gridBagConstraints5.gridwidth = 1;
99 77
			gridBagConstraints1.gridx = 0;
100 78
			gridBagConstraints1.gridy = 1;
101
			gridBagConstraints3.gridheight = 1;
102
			gridBagConstraints3.gridx = 0;
103
			gridBagConstraints3.gridy = 3;
104 79
			gridBagConstraints7.gridx = 0;
105 80
			gridBagConstraints7.gridy = 2;
106 81
			pGeneral.add(getPGrado(), gridBagConstraints5);
107 82
			pGeneral.add(getPAlgoritmo(), gridBagConstraints1);
108
			pGeneral.add(getPExportImport(), gridBagConstraints3);
109 83
			pGeneral.add(getJPanel(), gridBagConstraints7);
110 84
		}
111 85
		return pGeneral;
......
184 158
	 * 	
185 159
	 * @return javax.swing.JPanel	
186 160
	 */    
187
	private JPanel getPExportImport() {
188
		if (pExportImport == null) {
189
			FlowLayout flowLayout4 = new FlowLayout();
190
			pExportImport = new JPanel();
191
			pExportImport.setLayout(flowLayout4);
192
			pExportImport.setPreferredSize(new java.awt.Dimension(370,35));
193
			flowLayout4.setVgap(1);
194
			pExportImport.add(getPSaveLoad(), null);
195
			pExportImport.add(getPExportAscii(), null);
196
		}
197
		return pExportImport;
198
	}
199
	/**
200
	 * This method initializes jPanel	
201
	 * 	
202
	 * @return javax.swing.JPanel	
203
	 */    
204
	private JPanel getPSaveLoad() {
205
		if (pSaveLoad == null) {
206
			FlowLayout flowLayout5 = new FlowLayout();
207
			pSaveLoad = new JPanel();
208
			pSaveLoad.setLayout(flowLayout5);
209
			pSaveLoad.setPreferredSize(new java.awt.Dimension(210,34));
210
			pSaveLoad.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,1));
211
			flowLayout5.setVgap(4);
212
			pSaveLoad.add(getBSavePoints(), null);
213
			pSaveLoad.add(getBLoadPoints(), null);
214
		}
215
		return pSaveLoad;
216
	}
217
	/**
218
	 * This method initializes jPanel1	
219
	 * 	
220
	 * @return javax.swing.JPanel	
221
	 */    
222
	private JPanel getPExportAscii() {
223
		if (pExportAscii == null) {
224
			FlowLayout flowLayout61 = new FlowLayout();
225
			pExportAscii = new JPanel();
226
			pExportAscii.setLayout(flowLayout61);
227
			pExportAscii.setPreferredSize(new java.awt.Dimension(145,34));
228
			pExportAscii.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,1));
229
			flowLayout61.setVgap(4);
230
			pExportAscii.add(getJButton2(), null);
231
		}
232
		return pExportAscii;
233
	}
234
	/**
235
	 * This method initializes jButton	
236
	 * 	
237
	 * @return javax.swing.JButton	
238
	 */    
239
	private JButton getBSavePoints() {
240
		if (bSavePoints == null) {
241
			bSavePoints = new JButton();
242
			bSavePoints.setText(PluginServices.getText(this,"salvar"));
243
		}
244
		return bSavePoints;
245
	}
246
	/**
247
	 * This method initializes jButton1	
248
	 * 	
249
	 * @return javax.swing.JButton	
250
	 */    
251
	private JButton getBLoadPoints() {
252
		if (bLoadPoints == null) {
253
			bLoadPoints = new JButton();
254
			bLoadPoints.setText(PluginServices.getText(this,"cargar"));
255
		}
256
		return bLoadPoints;
257
	}
258
	/**
259
	 * This method initializes jButton2	
260
	 * 	
261
	 * @return javax.swing.JButton	
262
	 */    
263
	private JButton getJButton2() {
264
		if (jButton2 == null) {
265
			jButton2 = new JButton();
266
			jButton2.setText(PluginServices.getText(this,"exportar_ascii"));
267
		}
268
		return jButton2;
269
	}
270
	/**
271
	 * This method initializes jPanel	
272
	 * 	
273
	 * @return javax.swing.JPanel	
274
	 */    
275 161
	private JPanel getJPanel() {
276 162
		if (jPanel == null) {
277 163
			jPanel = new JPanel();
278
			jPanel.setPreferredSize(new java.awt.Dimension(370,55));
164
			jPanel.setPreferredSize(new java.awt.Dimension(370,75));
279 165
		}
280 166
		return jPanel;
281 167
	}
......
289 175
	 * </UL>
290 176
	 */
291 177
	public void actionPerformed(java.awt.event.ActionEvent e) {
292
		com.iver.cit.gvsig.gui.View  theView = null;
293
		try{
294
			theView = (com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView();
295
		}catch(ClassCastException exc){
296
			return;
297
		}
298
				
299
		//CARGAR PUNTOS
300
		if(e.getSource() == bLoadPoints){
301
			JFileChooser chooser = new JFileChooser(lastPathLoad);
302
			chooser.setDialogTitle(PluginServices.getText(this, "seleccionar_fichero"));
303
			FileFilter f = null;
304
			for(int i=0; i<this.fileFilters.length;i++){
305
				f = new SelectFileFilter(chooser, this.fileFilters[i]);
306
				chooser.addChoosableFileFilter(f);
307
			}
308
			int returnVal = chooser.showOpenDialog(this);
309
			if(returnVal == JFileChooser.APPROVE_OPTION){
310
			 	String fName = chooser.getSelectedFile().toString();
311
			 	FileFilter filter = chooser.getFileFilter();
312
			 	lastPathLoad = chooser.getCurrentDirectory().getAbsolutePath();
313
			
314
			 	if(grd.getLyrGeoRaster().getFLyrPoints() == null)
315
			 		return;
316

  
317
			 	grd.getLyrGeoRaster().getFLyrPoints().saveState();
318
			 	grd.getLyrGeoRaster().getFLyrPoints().XML2PointList(fName);
319
			 	grd.getLyrGeoRaster().getFLyrPoints().updateData(grd);
320
			}
321
		}
322 178
		
323
		//SALVAR PUNTOS
324
		if(e.getSource() == bSavePoints){
325
			JFileChooser chooser = new JFileChooser(lastPathSave);
326
			chooser.setDialogTitle(PluginServices.getText(this, "seleccionar_fichero"));
327
			
328
			//File f = new File(lyrGeoRaster.getName().substring(0, lyrGeoRaster.getName().lastIndexOf("."))+".grf");
329
			//chooser.setSelectedFile(f);
330
			FileFilter f = null;
331
			for(int i=0; i<this.fileFilters.length;i++){
332
				f = new SelectFileFilter(chooser, this.fileFilters[i]);
333
				chooser.addChoosableFileFilter(f);
334
			}
335
			int returnVal = chooser.showOpenDialog(this);
336
			if(returnVal == JFileChooser.APPROVE_OPTION){
337
			 	String fName = chooser.getSelectedFile().toString();
338
			 	FileFilter filter = chooser.getFileFilter();
339
			 	lastPathSave = chooser.getCurrentDirectory().getAbsolutePath();
340

  
341
			 	if(grd.getLyrGeoRaster().getFLyrPoints() != null)
342
			 		grd.getLyrGeoRaster().getFLyrPoints().PointList2XML(fName);
343
			}
344
			
345
		}
346 179
	}
347
	
348
	/**
349
	 * @author Nacho Brodin (brodin_ign@gva.es)
350
	 */
351
	class SelectFileFilter extends javax.swing.filechooser.FileFilter {
352
		
353
		private JFileChooser chooser = null;
354
		private String file = null;
355
		
356
		public SelectFileFilter(JFileChooser ch, String file){
357
			this.chooser = ch;
358
			this.file = file;
359
		}
360
		
361
	    public boolean accept(File f) {
362

  
363
	    	return f.isDirectory() || f.getName().toLowerCase().endsWith("."+file);
364
	    }
365
	    
366
	    public String getDescription() {
367
	    	return file;
368
	    }
369
	    
370
	}
371 180
 }
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/panels/ZoomControlPanel.java
294 294
	 */
295 295
	public void setVisible(boolean visible){
296 296
		canvas.setVisible(visible);
297
		if(!visible)
298
			canvas.setSize(0,0);
299
		else{
300
			canvas.setSize(sX, sY);
301
		}
302 297
		canvas.repaint();
303 298
	}
304 299
	
......
580 575
			double newWCPointX = this.newViewPort.getExtent().getMinX() + ((ptoFin.getX() * this.newViewPort.getExtent().getWidth()) / this.getWidth());
581 576
			int ptoSelectY = (int)(this.getHeight() - ptoFin.getY());
582 577
			double newWCPointY = this.newViewPort.getExtent().getMinY() + ((ptoSelectY * this.newViewPort.getExtent().getHeight()) / this.getHeight());
583
			System.out.println("-->"+ptoFin.getX()+" "+ptoFin.getY());
584 578
						
585 579
        	if(zoomControl.isRightControl()){ //Control de actualizaci?n de pixel de imagen
586 580
        		Point2D pixelImg = zoomControl.getLyrGeoRaster().world2Img(newWCPointX, newWCPointY);
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/selectPoints/DataPointPanel.java
9 9
import javax.swing.JTextField;
10 10

  
11 11
import com.iver.andami.PluginServices;
12
import javax.swing.JCheckBox;
12 13

  
13 14
/**
14 15
 * Panel que contiene la informaci?n de cada punto. 
......
35 36
	private JTextField tLatitud = null;
36 37
	private JTextField tLongitud = null;
37 38
	//**********************End Vars******************************
39
	private JPanel jPanel = null;
40
	private JCheckBox cbActive = null;
38 41
	
39 42
	//**********************Methods*******************************
40 43
	/**
......
53 56
	private void initialize() {                
54 57
		GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
55 58
		gridBagConstraints6.insets = new java.awt.Insets(0,0,0,0);
56
		gridBagConstraints6.gridy = 3;
59
		gridBagConstraints6.gridy = 4;
57 60
		gridBagConstraints6.gridx = 0;
58 61
		GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
59 62
		gridBagConstraints5.insets = new java.awt.Insets(0,0,0,0);
60
		gridBagConstraints5.gridy = 2;
63
		gridBagConstraints5.gridy = 3;
61 64
		gridBagConstraints5.weighty = 0.0D;
62 65
		gridBagConstraints5.gridx = 0;
63 66
		GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
64 67
		gridBagConstraints4.insets = new java.awt.Insets(0,0,0,0);
65
		gridBagConstraints4.gridy = 1;
68
		gridBagConstraints4.gridy = 2;
66 69
		gridBagConstraints4.weighty = 0.0D;
67 70
		gridBagConstraints4.gridx = 0;
68 71
		GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
69 72
		gridBagConstraints3.insets = new java.awt.Insets(0,0,0,0);
70
		gridBagConstraints3.gridy = 0;
73
		gridBagConstraints3.gridy = 1;
71 74
		gridBagConstraints3.ipadx = 0;
72 75
		gridBagConstraints3.gridx = 0;
73 76
		
......
79 82
		this.add(getPY(), gridBagConstraints4);
80 83
		this.add(getPLatitud(), gridBagConstraints5);
81 84
		this.add(getPLongitud(), gridBagConstraints6);
85
		this.add(getJPanel(), new GridBagConstraints());
82 86
	}
83 87
	
84 88
	/**
......
109 113
			flowLayout2.setAlignment(java.awt.FlowLayout.RIGHT);
110 114
			pX = new JPanel();
111 115
			pX.setLayout(flowLayout2);
112
			pX.setPreferredSize(new java.awt.Dimension(185,22));
116
			pX.setPreferredSize(new java.awt.Dimension(185,20));
113 117
			flowLayout2.setVgap(1);
114 118
			flowLayout2.setHgap(0);
115 119
			pX.add(lX, null);
......
131 135
			flowLayout1.setAlignment(java.awt.FlowLayout.RIGHT);
132 136
			pY = new JPanel();
133 137
			pY.setLayout(flowLayout1);
134
			pY.setPreferredSize(new java.awt.Dimension(185,22));
138
			pY.setPreferredSize(new java.awt.Dimension(185,20));
135 139
			flowLayout1.setHgap(0);
136 140
			flowLayout1.setVgap(1);
137 141
			pY.add(lY, null);
......
153 157
			flowLayout3.setAlignment(java.awt.FlowLayout.RIGHT);
154 158
			pLatitud = new JPanel();
155 159
			pLatitud.setLayout(flowLayout3);
156
			pLatitud.setPreferredSize(new java.awt.Dimension(185,22));
160
			pLatitud.setPreferredSize(new java.awt.Dimension(185,20));
157 161
			flowLayout3.setHgap(0);
158 162
			flowLayout3.setVgap(1);
159 163
			pLatitud.add(lLongitud, null);
......
175 179
			flowLayout4.setAlignment(java.awt.FlowLayout.RIGHT);
176 180
			pLongitud = new JPanel();
177 181
			pLongitud.setLayout(flowLayout4);
178
			pLongitud.setPreferredSize(new java.awt.Dimension(185,22));
182
			pLongitud.setPreferredSize(new java.awt.Dimension(185,20));
179 183
			flowLayout4.setHgap(0);
180 184
			flowLayout4.setVgap(1);
181 185
			pLongitud.add(lLatitud, null);
......
194 198
	public JTextField getTX() {
195 199
		if (tX == null) {
196 200
			tX = new JTextField();
197
			tX.setPreferredSize(new java.awt.Dimension(90,19));
201
			tX.setPreferredSize(new java.awt.Dimension(90,17));
198 202
			tX.setHorizontalAlignment(javax.swing.JTextField.LEADING);
199 203
		}
200 204
		return tX;
......
210 214
	public JTextField getTY() {
211 215
		if (tY == null) {
212 216
			tY = new JTextField();
213
			tY.setPreferredSize(new java.awt.Dimension(90,19));
217
			tY.setPreferredSize(new java.awt.Dimension(90,17));
214 218
		}
215 219
		return tY;
216 220
	}
......
225 229
	public JTextField getLatitud() {
226 230
		if (tLatitud == null) {
227 231
			tLatitud = new JTextField();
228
			tLatitud.setPreferredSize(new java.awt.Dimension(111,19));
232
			tLatitud.setPreferredSize(new java.awt.Dimension(111,17));
229 233
			tLatitud.setHorizontalAlignment(javax.swing.JTextField.LEFT);
230 234
		}
231 235
		return tLatitud;
......
241 245
	public JTextField getLongitud() {
242 246
		if (tLongitud == null) {
243 247
			tLongitud = new JTextField();
244
			tLongitud.setPreferredSize(new java.awt.Dimension(111,19));
248
			tLongitud.setPreferredSize(new java.awt.Dimension(111,17));
245 249
			tLongitud.setHorizontalAlignment(javax.swing.JTextField.LEFT);
246 250
		}
247 251
		return tLongitud;
248 252
	}	
249 253
	//**********************End Setters & Getters*****************
254

  
255
	/**
256
	 * This method initializes jPanel	
257
	 * 	
258
	 * @return javax.swing.JPanel	
259
	 */
260
	private JPanel getJPanel() {
261
		if (jPanel == null) {
262
			FlowLayout flowLayout = new FlowLayout();
263
			flowLayout.setVgap(0);
264
			flowLayout.setAlignment(java.awt.FlowLayout.LEFT);
265
			flowLayout.setHgap(0);
266
			jPanel = new JPanel();
267
			jPanel.setName("activo");
268
			jPanel.setLayout(flowLayout);
269
			jPanel.setPreferredSize(new java.awt.Dimension(185,19));
270
			jPanel.add(getCbActive(), null);
271
		}
272
		return jPanel;
273
	}
274

  
275
	/**
276
	 * This method initializes jCheckBox	
277
	 * 	
278
	 * @return javax.swing.JCheckBox	
279
	 */
280
	private JCheckBox getCbActive() {
281
		if (cbActive == null) {
282
			cbActive = new JCheckBox();
283
			cbActive.setText("activo");
284
		}
285
		return cbActive;
286
	}
250 287
}
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/selectPoints/SelectPointsPanel.java
519 519
			grd.setEnlarge(!enlarge);
520 520
			bExtended.setIcon(new ImageIcon(getClass().getResource(pathToImages + "up.png")));
521 521
			if(lyrPoints != null)
522
				lyrPoints.getPointManager().selectPoint(tableControlerPanel.getSelectedIndex(), this.grd);
522
				lyrPoints.getPointManager().selectPoint(tableControlerPanel.getSelectedIndex(), this.grd);			
523 523
		}
524 524
	}
525 525
	
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/utils/PointManager.java
361 361
	public void setFlyrPoints(FLyrPoints flyrPoints) {
362 362
		this.lyrPoints = flyrPoints;
363 363
	}
364
	
365
	public GeoreferencingDialog getDialog() {
366
		return dialog;
367
	}
364 368
	//**********************End Getters & Setters*****************
369

  
365 370
}
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/utils/GeoPointPersistence.java
27 27

  
28 28
import com.iver.andami.PluginServices;
29 29
import com.iver.cit.gvsig.fmap.ViewPort;
30
import com.iver.cit.gvsig.fmap.layers.FLayer;
31
import com.iver.cit.gvsig.fmap.layers.FLyrGeoRaster;
32 30
import com.iver.cit.gvsig.fmap.layers.FLyrPoints;
33 31
import com.iver.cit.gvsig.fmap.layers.GeoPoint;
32
import com.iver.cit.gvsig.gui.View;
34 33
import com.iver.cit.gvsig.gui.dialogs.GeoreferencingDialog;
35 34

  
36 35
/**
......
79 78
	        		Node node = nodeList.item(i);
80 79
	        		if(node.getNodeName().equals("GeoPoint")){
81 80
	        			NodeList nl = node.getChildNodes();
82
		        		this.processGeoPointNodeValue(nl);	
81
	        			this.processGeoPointNodeValue(nl);	
83 82
	        		}
84 83
	        	}
85 84
	        	this.geoPointList = lyrPoints.getListPoint();
......
166 165
		Point2D m = new Point2D.Double();
167 166
		m.setLocation(mX, mY);
168 167
	
169
		lyrPoints.addPoint(p, m);
170
		int pos = lyrPoints.getCountPoints() - 1;
168
		lyrPoints.getPointManager().newEmptyPoint();
169
		View theView = null;
170
		try{
171
			theView = (View)PluginServices.getMDIManager().getActiveView();
172
		}catch(ClassCastException exc){
173
			return;
174
		}
175
		int pos = lyrPoints.getCountPoints() -1;
171 176
		lyrPoints.setPointActive(pos, active);
172 177
		lyrPoints.setLeftCenterPoint(pos,leftCenter);
173
		lyrPoints.setRightCenterPoint(pos,rightCenter);
174
		lyrPoints.setLeftViewPort(pos,leftViewPort);
175
		lyrPoints.setRightViewPort(pos,rightViewPort);
178
		lyrPoints.setRightCenterPoint(pos, rightCenter);
179
		lyrPoints.setLeftViewPort(pos, leftViewPort);
180
		lyrPoints.setRightViewPort(pos, rightViewPort);
181
		lyrPoints.getPointManager().updateData(pos + 1, p, m, lyrPoints.getPointManager().getDialog(), theView);
176 182
		
183
		if(lyrPoints.getCountPoints() > 0){
184
			GeoreferencingDialog grd = lyrPoints.getPointManager().getDialog();
185
			grd.getConectorPanel().getDataPointsTabPanel().
186
				getSelectPointsPanel().getTableControlerPanel().setNItems(lyrPoints.getCountPoints());
187
			grd.getConectorPanel().getDataPointsTabPanel().
188
				getTablePointsPanel().getTableControlerPanel().setNItems(lyrPoints.getCountPoints());
189
			lyrPoints.getPointManager().selectPoint(0, grd);
190
		}
191
		//lyrPoints.addPoint(p, m);
177 192
	}
178 193
	
179 194
	/**
......
305 320
	 * @param i Posici?n del punto en la lista
306 321
	 */
307 322
	private void createXMLGeoPointNode(GeoPoint geoPoint, int i) {
308
		Element xmlGeoPoint, leftCenterPoint, rightCenterPoint, leftViewPort, rightViewPort;
309
		Element itemlevel1, itemlevel2, itemlevel3;
323
		Element xmlGeoPoint;
324
		Element itemlevel1;
310 325

  
311 326
		xmlGeoPoint = xmlDoc.createElement("GeoPoint");
312 327
		xmlGeoPoint.setAttribute("n", String.valueOf(i));
......
396 411
		    return strWriter.toString();
397 412
	}
398 413
	
399

  
400
	/**
401
	 * Actualiza los datos del dialogo con los puntos cargados desde el XML
402
	 * 
403
	 * @param geoDialog
404
	 */
405
	public void updateData(GeoreferencingDialog geoDialog){
406
		com.iver.cit.gvsig.gui.View  theView = null;
407
		try{
408
			theView = (com.iver.cit.gvsig.gui.View) PluginServices.getMDIManager().getActiveView();
409
		}catch(ClassCastException exc){
410
			return;
411
		}
412
		
413
		//Comprobamos que est? la capa cargada
414
		FLyrGeoRaster lyrGeoRaster = geoDialog.getLyrGeoRaster();
415
		boolean loadFLyrPoints = false;
416
		for(int i=0;i<theView.getMapControl().getMapContext().getLayers().getLayersCount();i++){
417
			FLayer lyr = theView.getMapControl().getMapContext().getLayers().getLayer(i);
418
			if(	lyr instanceof FLyrPoints)
419
				loadFLyrPoints = true;
420
		}
421
		
422
		//Si no est? la capa de puntos cargada la cargamos
423
		if(!loadFLyrPoints){
424
			theView.getMapControl().getMapContext().beginAtomicEvent();
425
			theView.getMapControl().getMapContext().getLayers().addLayer(this.lyrPoints);
426
			theView.getMapControl().getMapContext().endAtomicEvent();
427
		}
428
		
429
		//Reseteamos el dialogo
430
		geoDialog.getSelectPointsPanel().resetControls(false);
431
		geoDialog.getSelectPointsPanel().getTableControlerPanel().getCPoint().removeAllItems();
432
		geoDialog.getConectorPanel().getDataPointsTabPanel().getTablePointsPanel().setSaveToDisk(true);
433
		
434
		if(lyrPoints.getCountPoints() > 0){
435
			geoDialog.getConectorPanel().getDataPointsTabPanel().
436
				getSelectPointsPanel().getTableControlerPanel().setNItems(lyrPoints.getCountPoints());
437
			geoDialog.getConectorPanel().getDataPointsTabPanel().
438
				getTablePointsPanel().getTableControlerPanel().setNItems(lyrPoints.getCountPoints());
439
		}
440
		
441
		for(int i=0;i<lyrPoints.getCountPoints();i++){
442
			if(lyrGeoRaster != null){
443
				GeoPoint gp = lyrPoints.getPoint(i);
444
				lyrPoints.getPointManager().updateData(i + 1, 
445
														gp.pixelPoint, 
446
														gp.mapPoint, 
447
														geoDialog, 
448
														null);
449
			}
450
		}
451
		if(lyrPoints.getCountPoints() > 0)
452
			lyrPoints.getPointManager().selectPoint(0, geoDialog);
453
		
454
		theView.getMapControl().getMapContext().invalidate();
455
	}
456 414
	//**********************End Methods***************************
457 415
}

Also available in: Unified diff