Revision 1822

View differences:

branches/gvSIG_CAD_Layout_version/applications/appgvSIG/src/com/iver/cit/gvsig/LayoutControls.java
97 97
			layout.setTool(Layout.SELECT);
98 98
		} else if (s.compareTo("CADSELECT") == 0) {
99 99
			layout.setCadTool("selection");
100
			for (int i=0;i<layout.getFFrames().size();i++){
101
				((IFFrame)layout.getFFrames().get(i)).setSelected(false);
100
			IFFrame[] frames=layout.getFFrames1();
101
			for (int i=0;i<frames.length;i++){
102
				frames[i].setSelected(false);
102 103
			}
103 104
		} else if (s.compareTo("POINT") == 0) {
104 105
			layout.setCadTool("point");
branches/gvSIG_CAD_Layout_version/applications/appgvSIG/src/com/iver/cit/gvsig/GraphicControls.java
46 46
 */
47 47
package com.iver.cit.gvsig;
48 48

  
49
import java.io.IOException;
50

  
49 51
import com.iver.andami.PluginServices;
50 52
import com.iver.andami.plugins.Extension;
51 53
import com.iver.andami.ui.mdiManager.View;
52 54

  
55
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
53 56
import com.iver.cit.gvsig.gui.layout.FLayoutGraphics;
54 57
import com.iver.cit.gvsig.gui.layout.Layout;
55 58

  
......
57 60

  
58 61

  
59 62
/**
60
 * Extensi?n que actua sobre el Layout para controlas las diferentes
63
 * Extensi?n que actua sobre el Layout para controlar las diferentes
61 64
 * operaciones sobre los gr?ficos.
62 65
 *
63 66
 * @author Vicente Caballero Navarro
......
72 75
		Layout layout = (Layout) PluginServices.getMDIManager().getActiveView();
73 76
		FLayoutGraphics lg = new FLayoutGraphics(layout);
74 77
		logger.debug("Comand : " + s);
75

  
78
		try {
76 79
		if (s.compareTo("SIMPLIFICAR") == 0) {
77 80
			lg.simplify();
78 81
		} else if (s.compareTo("AGRUPAR") == 0) {
......
92 95
		} else if (s.compareTo("POSICIONAR") == 0) {
93 96
			lg.position();
94 97
		}
98
		} catch (DriverIOException e) {
99
			e.printStackTrace();
100
		} catch (IOException e) {
101
			e.printStackTrace();
102
		}
95 103
	}
96 104

  
97 105
	/**
branches/gvSIG_CAD_Layout_version/applications/appgvSIG/src/com/iver/cit/gvsig/gui/cad/RemoveFFrameCommand.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package com.iver.cit.gvsig.gui.cad;
42

  
43
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
44
import com.iver.cit.gvsig.fmap.edition.Command;
45
import com.iver.cit.gvsig.gui.layout.LayoutEditableFeature;
46
import com.iver.cit.gvsig.gui.layout.fframes.IFFrame;
47

  
48
import java.io.IOException;
49

  
50

  
51
/**
52
 * DOCUMENT ME!
53
 *
54
 * @author Vicente Caballero Navarro
55
 */
56
public class RemoveFFrameCommand implements Command {
57
	private LayoutEditableFeature lef;
58
	private int index;
59
	private IFFrame frame;
60

  
61
	/**
62
	 * Crea un nuevo RemoveFFrameCommand.
63
	 *
64
	 * @param lef DOCUMENT ME!
65
	 * @param frame DOCUMENT ME!
66
	 * @param num DOCUMENT ME!
67
	 */
68
	public RemoveFFrameCommand(LayoutEditableFeature lef, IFFrame frame, int num) {
69
		this.lef = lef;
70
		index = num;
71
		this.frame = frame;
72
	}
73

  
74
	/**
75
	 * @see com.iver.cit.gvsig.fmap.edition.Command#undo()
76
	 */
77
	public void undo() throws DriverIOException, IOException {
78
		index = lef.undoRemoveFFrame(frame, index);
79
	}
80

  
81
	/**
82
	 * @see com.iver.cit.gvsig.fmap.edition.Command#redo()
83
	 */
84
	public void redo() throws DriverIOException, IOException {
85
		lef.doRemoveFFrame(index);
86
	}
87
}
branches/gvSIG_CAD_Layout_version/applications/appgvSIG/src/com/iver/cit/gvsig/gui/cad/AddFFrameCommand.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package com.iver.cit.gvsig.gui.cad;
42

  
43
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
44
import com.iver.cit.gvsig.fmap.edition.Command;
45
import com.iver.cit.gvsig.fmap.edition.DefaultEditableFeatureSource;
46
import com.iver.cit.gvsig.fmap.edition.EditableFeatureSource;
47
import com.iver.cit.gvsig.gui.layout.Layout;
48
import com.iver.cit.gvsig.gui.layout.LayoutEditableFeature;
49
import com.iver.cit.gvsig.gui.layout.fframes.IFFrame;
50

  
51
import java.io.IOException;
52

  
53

  
54
/**
55
 * DOCUMENT ME!
56
 *
57
 * @author Vicente Caballero Navarro
58
 */
59
public class AddFFrameCommand implements Command {
60
	private LayoutEditableFeature lef;
61
	private int index;
62
	private IFFrame frame;
63

  
64
	/**
65
	 * Crea un nuevo AddFFrameCommand.
66
	 *
67
	 * @param lef DOCUMENT ME!
68
	 * @param frame DOCUMENT ME!
69
	 * @param num DOCUMENT ME!
70
	 */
71
	public AddFFrameCommand(LayoutEditableFeature lef, IFFrame frame, int num) {
72
		this.lef = lef;
73
		index = num;
74
		this.frame = frame;
75
	}
76

  
77
	/**
78
	 * @see com.iver.cit.gvsig.fmap.edition.Command#undo()
79
	 */
80
	public void undo() throws DriverIOException, IOException {
81
		lef.undoAddFFrame(index);
82
	}
83

  
84
	/**
85
	 * @see com.iver.cit.gvsig.fmap.edition.Command#redo()
86
	 */
87
	public void redo() throws DriverIOException, IOException {
88
		index = lef.doAddFFrame(frame);
89
	}
90
}
branches/gvSIG_CAD_Layout_version/applications/appgvSIG/src/com/iver/cit/gvsig/gui/cad/CadGrid.java
64 64
	/**
65 65
	 * Crea un nuevo CadGrid.
66 66
	 *
67
	 * @param cta DOCUMENT ME!
67
	 * @param cta CADToolAdapter
68 68
	 */
69 69
	public CadGrid(CADToolAdapter cta) {
70 70
		this.cta = cta;
71 71
	}
72 72

  
73 73
	/**
74
	 * Inserta el viewPort.
74
	 * Inserta la matriz de transformaci?n a aplicar.
75 75
	 *
76
	 * @param at
76
	 * @param at Matriz de transformaci?n.
77 77
	 */
78 78
	public void setAT(AffineTransform at) {
79 79
		this.at = at;
80 80
	}
81 81

  
82 82
	/**
83
	 * DOCUMENT ME!
83
	 * Inserta la distancia entre punto y punto del grid en la coordenadas X.
84 84
	 *
85
	 * @param d DOCUMENT ME!
85
	 * @param d distancia entre punto y punto en la coordenada X.
86 86
	 */
87 87
	public void setGridSizeX(double d) {
88 88
		gridSizeX = d; //(int)cta.fromDistance(d);
89 89
	}
90 90

  
91 91
	/**
92
	 * DOCUMENT ME!
92
	 * Inserta la distancia entre punto y punto del grid en la coordenadas Y.
93 93
	 *
94
	 * @param d DOCUMENT ME!
94
	 * @param d distancia entre punto y punto en la coordenada Y.
95 95
	 */
96 96
	public void setGridSizeY(double d) {
97 97
		gridSizeY = d; //(int)cta.fromDistance(d);
98 98
	}
99 99

  
100 100
	/**
101
	 * DOCUMENT ME!
101
	 * Devuelve la distancia entre punto y punto en la coordenada X.
102 102
	 *
103
	 * @return DOCUMENT ME!
103
	 * @return distancia entre punto y punto en la coordenada X.
104 104
	 */
105 105
	public double getGridSizeX() {
106 106
		return gridSizeX;
107 107
	}
108 108

  
109 109
	/**
110
	 * DOCUMENT ME!
111
	 *
112
	 * @return DOCUMENT ME!
113
	 */
110
	* Devuelve la distancia entre punto y punto en la coordenada Y.
111
	*
112
	* @return distancia entre punto y punto en la coordenada Y.
113
	*/
114 114
	public double getGridSizeY() {
115 115
		return gridSizeY;
116 116
	}
branches/gvSIG_CAD_Layout_version/applications/appgvSIG/src/com/iver/cit/gvsig/gui/cad/tools/SelectionCadTool.java
152 152
										FGeometry.SELECTHANDLER)[j]);
153 153
								selectedGeometryIndex.add(new Integer(i));
154 154
							}
155
							
155 156
						}
156 157
					}
157 158

  
branches/gvSIG_CAD_Layout_version/applications/appgvSIG/src/com/iver/cit/gvsig/gui/cad/tools/ScaleCadTool.java
96 96
			PluginServices.getMDIManager().setWaitCursor();
97 97
			lastPoint = new Point2D.Double(ds[0], ds[1]);
98 98

  
99
			double w;
99
			/*double w;
100 100
			double h;
101 101
			w = lastPoint.getX() - firstPoint.getX();
102 102
			h = lastPoint.getY() - firstPoint.getY();
103

  
103
*/
104 104
			try {
105 105
				//ViewPort vp = getCadToolAdapter().getMapControl().getViewPort(); 
106 106
				editingSource.startComplexGeometry();
branches/gvSIG_CAD_Layout_version/applications/appgvSIG/src/com/iver/cit/gvsig/gui/cad/ViewCADToolAdapter.java
40 40
 */
41 41
package com.iver.cit.gvsig.gui.cad;
42 42

  
43
import com.iver.andami.PluginServices;
44
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
45
import com.iver.cit.gvsig.fmap.edition.EditableFeatureSource;
43 46
import com.iver.cit.gvsig.fmap.layers.FBitSet;
44 47
import com.iver.cit.gvsig.fmap.tools.BehaviorException;
48
import com.iver.cit.gvsig.gui.cad.tools.SelectionCadTool;
49
import com.iver.fsac.Automaton;
45 50

  
46 51
import java.awt.Graphics;
47 52
import java.awt.event.MouseEvent;
48 53
import java.awt.geom.AffineTransform;
49 54
import java.awt.geom.Point2D;
50 55
import java.awt.geom.Rectangle2D;
56
import java.io.IOException;
51 57

  
52 58

  
53 59
/**
......
56 62
 * @author Vicente Caballero Navarro
57 63
 */
58 64
public class ViewCADToolAdapter extends CADToolAdapter {
65
	private boolean questionAsked = false;
59 66
	/**
60 67
	 * Pinta de alguna manera especial las geometrias seleccionadas para la
61 68
	 * edici?n. En caso de que el snapping est? activado, pintar? el efecto
......
170 177
		return getMapControl().getViewPort().fromMapPoint(p);
171 178
	}
172 179
	/**
173
	 * DOCUMENT ME!
180
	 * Configura el men? con las opciones adecuadas.
174 181
	 */
175 182
	public void configureMenu() {
176 183
		String[] desc = ((CadTool) cadToolStack.peek()).getAutomaton()
......
187 194
		}
188 195
		}
189 196
	}
197
	/**
198
	 * DOCUMENT ME!
199
	 *
200
	 * @param text DOCUMENT ME!
201
	 * @param source DOCUMENT ME!
202
	 * @param sel DOCUMENT ME!
203
	 * @param values DOCUMENT ME!
204
	 */
205
	protected void transition(String text, EditableFeatureSource source,
206
		FBitSet sel, double[] values) {
207
		questionAsked = false;
208
		//logger.debug(text);
209

  
210
		int ret = ((CadTool) cadToolStack.peek()).transition(text, source, sel,
211
				values);
212

  
213
		if ((ret & Automaton.AUTOMATON_FINISHED) == Automaton.AUTOMATON_FINISHED) {
214
			popCadTool();
215

  
216
			if (cadToolStack.isEmpty()) {
217
				pushCadTool(new SelectionCadTool());
218
				PluginServices.getMainFrame().selectTool("selection");
219
			}
220

  
221
			askQuestion();
222
			if (getMapControl()!=null)
223
			getMapControl().drawMap(false);
224
		} else {
225
			if (((CadTool) cadToolStack.peek()).getAutomaton().checkState('c')) {
226
				refresh();
227
			}
228

  
229
			if (!questionAsked) {
230
				askQuestion();
231
			}
232
		}
233
			configureMenu();
234
		PluginServices.getMainFrame().enableControls();
235
	}
236
	/**
237
	 * DOCUMENT ME!
238
	 */
239
	private void askQuestion() {
240
		CadTool cadtool=(CadTool) cadToolStack.peek();
241
		if (cadtool.getAutomaton().getStatus()==0){
242
			PluginServices.getMainFrame().addTextToConsole("\n" +cadtool.getName());
243
		}
244
		PluginServices.getMainFrame().addTextToConsole("\n" + cadtool.getQuestion());
245
		questionAsked = true;
246
		
247
	}
248
	/**
249
	 * @param actionCommand
250
	 */
251
	public void keyPressed(String actionCommand) {
252
		if (actionCommand.equals("eliminar")){
253
			delete();
254
		}else if (actionCommand.equals("escape")) {
255
				cadToolStack.clear();
256
				pushCadTool(new SelectionCadTool());
257
				selection.clear();
258
				getMapControl().drawMap(false);
259
				PluginServices.getMainFrame().selectTool("selection");
260
				askQuestion();
261
		} 
262
		PluginServices.getMainFrame().enableControls();
263
	}
264
	/**
265
	 * Elimina las geometr?as seleccionadas actualmente
266
	 */
267
	private void delete() {
268
		editableFeatureSource.startComplexGeometry();
269
		try {
270
		for (int i = selection.nextSetBit(0); i >= 0;
271
				i = selection.nextSetBit(i + 1)) {
272
				editableFeatureSource.removeGeometry(i);
273
		}
274
		} catch (DriverIOException e) {
275
			e.printStackTrace();
276
		} catch (IOException e) {
277
			e.printStackTrace();
278
		} finally {
279
		try {
280
			editableFeatureSource.endComplexGeometry();
281
		} catch (IOException e1) {
282
			e1.printStackTrace();
283
		} catch (DriverIOException e1) {
284
			e1.printStackTrace();
285
		}
286
		}
287
		selection.clear();
288
		refresh();
289
	}
290

  
190 291
}
branches/gvSIG_CAD_Layout_version/applications/appgvSIG/src/com/iver/cit/gvsig/gui/cad/CADToolAdapter.java
45 45
	//private FSymbol symbol = new FSymbol(FConstant.SYMBOL_TYPE_POINT, Color.RED);
46 46
	private Point2D mapAdjustedPoint;
47 47
	private CadMapControl cadMapControl;
48
	private boolean questionAsked = false;
48
	//private boolean questionAsked = false;
49 49
	protected CadGrid grid;// = new CadGrid();
50 50
	protected Point2D adjustedPoint;
51 51
	private boolean snapping=true;
......
335 335

  
336 336
	public abstract void configureMenu();
337 337

  
338
	
338 339
	/**
339 340
	 * DOCUMENT ME!
340 341
	 *
341
	 * @param text DOCUMENT ME!
342
	 * @param source DOCUMENT ME!
343
	 * @param sel DOCUMENT ME!
344
	 * @param values DOCUMENT ME!
345
	 */
346
	protected void transition(String text, EditableFeatureSource source,
347
		FBitSet sel, double[] values) {
348
		questionAsked = false;
349
		logger.debug(text);
350

  
351
		int ret = ((CadTool) cadToolStack.peek()).transition(text, source, sel,
352
				values);
353

  
354
		if ((ret & Automaton.AUTOMATON_FINISHED) == Automaton.AUTOMATON_FINISHED) {
355
			popCadTool();
356

  
357
			if (cadToolStack.isEmpty()) {
358
				pushCadTool(new SelectionCadTool());
359
				PluginServices.getMainFrame().selectTool("selection");
360
			}
361

  
362
			askQuestion();
363
			if (getMapControl()!=null)
364
			getMapControl().drawMap(false);
365
		} else {
366
			if (((CadTool) cadToolStack.peek()).getAutomaton().checkState('c')) {
367
				refresh();
368
			}
369

  
370
			if (!questionAsked) {
371
				askQuestion();
372
			}
373
		}
374
		//if (console!=null){
375
			configureMenu();
376
		//}
377
		PluginServices.getMainFrame().enableControls();
378
	}
379

  
380
	/**
381
	 * DOCUMENT ME!
382
	 *
383 342
	 * @param value DOCUMENT ME!
384 343
	 */
385 344
	public abstract void setGrid(boolean value);
......
451 410
				PluginServices.getMainFrame().selectTool("selection");
452 411
			}
453 412

  
454
			askQuestion();
455

  
456
			getMapControl().drawMap(false);
413
			//askQuestion();
414
			
415
			//getMapControl().drawMap(false);
457 416
		}
458 417
	}
459 418

  
......
464 423
		cadToolStack.pop();
465 424
	}
466 425

  
467
	/**
468
	 * DOCUMENT ME!
469
	 */
470
	private void askQuestion() {
471
		CadTool cadtool=(CadTool) cadToolStack.peek();
472
		if (cadtool.getAutomaton().getStatus()==0){
473
			PluginServices.getMainFrame().addTextToConsole("\n" +cadtool.getName());
474
		}
475
		PluginServices.getMainFrame().addTextToConsole("\n" + cadtool.getQuestion());
476
		questionAsked = true;
477
		
478
	}
426
	
479 427

  
480 428
	/**
481 429
	 * DOCUMENT ME!
......
486 434
		cadToolStack.clear();
487 435
		pushCadTool(cadTool);
488 436
		//if (console!=null)
489
		askQuestion();
437
		//askQuestion();
490 438
	}
491 439

  
492 440
	/**
......
537 485
		this.cadMapControl = cadMapControl;
538 486
	}
539 487

  
488
	
540 489
	/**
541
	 * Elimina las geometr?as seleccionadas actualmente
542
	 */
543
	private void delete() {
544
		editableFeatureSource.startComplexGeometry();
545
		try {
546
		for (int i = selection.nextSetBit(0); i >= 0;
547
				i = selection.nextSetBit(i + 1)) {
548
				editableFeatureSource.removeGeometry(i);
549
		}
550
		} catch (DriverIOException e) {
551
			e.printStackTrace();
552
		} catch (IOException e) {
553
			e.printStackTrace();
554
		} finally {
555
		try {
556
			editableFeatureSource.endComplexGeometry();
557
		} catch (IOException e1) {
558
			e1.printStackTrace();
559
		} catch (DriverIOException e1) {
560
			e1.printStackTrace();
561
		}
562
		}
563
		selection.clear();
564
		refresh();
565
		//getCadMapControl().getMapControl().drawMap(false);
566
	}
567

  
568
	/**
569 490
	 * @param b
570 491
	 */
571 492
	public void setAdjustGrid(boolean b) {
572 493
		grid.setAdjustGrid(b);
573 494
	}
574 495

  
575
	/**
576
	 * @param actionCommand
577
	 */
578
	public void keyPressed(String actionCommand) {
579
		if (actionCommand.equals("eliminar")){
580
			delete();
581
		}else if (actionCommand.equals("escape")) {
582
				cadToolStack.clear();
583
				pushCadTool(new SelectionCadTool());
584
				selection.clear();
585
				getMapControl().drawMap(false);
586
				PluginServices.getMainFrame().selectTool("selection");
587
				askQuestion();
588
		} 
589
		PluginServices.getMainFrame().enableControls();
590
	}
496
	
591 497
	public abstract AffineTransform getAT();
592 498
	public abstract double toDistance(int i);
593 499
	public FBitSet getSelection(){
......
613 519
	public Point2D getAdjustedPoint(){
614 520
		return adjustedPoint;
615 521
	}
522
	protected abstract void transition(String text, EditableFeatureSource source,
523
			FBitSet sel, double[] values);
524
	public abstract void keyPressed(String actionCommand);
525
	public boolean isSelected(IGeometry g){
526
		return true;
527
	}
616 528
}
branches/gvSIG_CAD_Layout_version/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/CADPopupMenu.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*
19
* For more information, contact:
20
*
21
*  Generalitat Valenciana
22
*   Conselleria d'Infraestructures i Transport
23
*   Av. Blasco Ib??ez, 50
24
*   46010 VALENCIA
25
*   SPAIN
26
*
27
*      +34 963862235
28
*   gvsig@gva.es
29
*      www.gvsig.gva.es
30
*
31
*    or
32
*
33
*   IVER T.I. S.A
34
*   Salamanca 50
35
*   46005 Valencia
36
*   Spain
37
*
38
*   +34 963163400
39
*   dac@iver.es
40
*/
41
package com.iver.cit.gvsig.gui.layout;
42

  
43
import java.awt.Font;
44
import java.awt.Point;
45
import java.awt.event.ActionEvent;
46
import java.awt.event.ActionListener;
47

  
48
import javax.swing.JMenuItem;
49
import javax.swing.JPopupMenu;
50

  
51
import com.iver.andami.PluginServices;
52
import com.iver.cit.gvsig.gui.cad.tools.SelectionCadTool;
53

  
54

  
55
public class CADPopupMenu extends JPopupMenu {
56
    private final static Font theFont = new Font("SansSerif", Font.PLAIN, 10);
57
    private JMenuItem m_ok=null;
58
    private JMenuItem m_close = null;
59
    private JMenuItem m_cancel = null;
60
    private FLayoutGraphics m_flg = null;
61
    private Layout m_layout = null;
62
    private Point m_p = null;
63

  
64
    /**
65
     * Crea un nuevo Popupmenu.
66
     *
67
     * @param layout Layout sobre el que se abre el Popupmenu.
68
     * @param p punto donde se abre el popupmenu.
69
     */
70
    public CADPopupMenu(Layout layout, Point p) {
71
        m_layout = layout;
72
        m_flg = new FLayoutGraphics(m_layout);
73
        m_p = p;
74
        initialize();
75
    }
76

  
77
    /**
78
     * Inicializa los componentes del Popupmenu.
79
     */
80
    private void initialize() {
81
    	m_ok=new JMenuItem(PluginServices.getText(this,"Aceptar"));
82
        m_close = new JMenuItem(PluginServices.getText(this,"Cerrar"));
83
        m_cancel = new JMenuItem(PluginServices.getText(this,"Cancelar"));
84
        add(m_ok);
85
        addSeparator();
86
        add(m_close);
87
        addSeparator();
88
        add(m_cancel);
89
        addSeparator();
90
        m_ok.addActionListener(new ActionListener() {
91
				public void actionPerformed(ActionEvent e) {
92
					try{
93
					 m_layout.getCadToolAdapter().transition("aceptar");  
94
	                 m_layout.refresh();
95
					}catch (Exception e1) {
96
						
97
					}
98
				}
99
			});
100
        m_close.addActionListener(new ActionListener() {
101
                public void actionPerformed(ActionEvent e) {
102
                    try{
103
                	m_layout.getCadToolAdapter().transition("cerrar");  
104
                    m_layout.refresh();
105
                    }catch (Exception e1) {
106
					}
107
                }
108
            });
109
        m_cancel.addActionListener(new ActionListener() {
110
			public void actionPerformed(ActionEvent e) {
111
				m_layout.getCadToolAdapter().popCadTool();
112
				m_layout.getCadToolAdapter().pushCadTool(new SelectionCadTool());
113
			}
114
		});
115
        this.show(m_layout, m_p.x, m_p.y);
116
    }
117
}
118

  
branches/gvSIG_CAD_Layout_version/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/ModifyFFrameCommand.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package com.iver.cit.gvsig.gui.layout;
42

  
43
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
44
import com.iver.cit.gvsig.fmap.edition.Command;
45
import com.iver.cit.gvsig.gui.layout.fframes.IFFrame;
46

  
47
import java.io.IOException;
48

  
49

  
50
/**
51
 * DOCUMENT ME!
52
 *
53
 * @author Vicente Caballero Navarro
54
 */
55
public class ModifyFFrameCommand implements Command {
56
	private LayoutEditableFeature lef;
57
	private int indexnew;
58
	private int indexant;
59
	private IFFrame framenew;
60
	private IFFrame frameant;
61

  
62
	/**
63
	 * Crea un nuevo ModifyFFrameCommand.
64
	 *
65
	 * @param lef DOCUMENT ME!
66
	 * @param frameant DOCUMENT ME!
67
	 * @param framenew DOCUMENT ME!
68
	 * @param indexant DOCUMENT ME!
69
	 * @param indexnew DOCUMENT ME!
70
	 */
71
	public ModifyFFrameCommand(LayoutEditableFeature lef, IFFrame frameant,
72
		IFFrame framenew, int indexant, int indexnew) {
73
		this.lef = lef;
74
		this.indexnew = indexnew;
75
		this.indexant = indexant;
76
		this.framenew = framenew;
77
		this.frameant = frameant;
78
	}
79

  
80
	/**
81
	 * @see com.iver.cit.gvsig.fmap.edition.Command#undo()
82
	 */
83
	public void undo() throws DriverIOException, IOException {
84
		//indexant=indexnew;
85
		int aux = lef.undoModifyFFrame(frameant, indexant, indexnew);
86
		indexant = indexnew;
87
		indexnew = aux;
88

  
89
		IFFrame auxframe = framenew;
90
		framenew = frameant;
91
		frameant = auxframe;
92

  
93
		//int aux=indexnew;
94
		//indexnew=indexant;
95
		//indexant=aux;
96
	}
97

  
98
	/**
99
	 * @see com.iver.cit.gvsig.fmap.edition.Command#redo()
100
	 */
101
	public void redo() throws DriverIOException, IOException {
102
		int aux = lef.doModifyFFrame(frameant, indexant, indexnew);
103
		indexant = indexnew;
104
		indexnew = aux;
105

  
106
		IFFrame auxframe = framenew;
107
		framenew = frameant;
108
		frameant = auxframe;
109

  
110
		//int aux=indexnew;
111
		//indexnew=indexant;
112
		//indexant=aux;
113
	}
114
}
branches/gvSIG_CAD_Layout_version/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/GeometryComposite.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package com.iver.cit.gvsig.gui.layout;
42

  
43
import com.iver.cit.gvsig.fmap.core.IGeometry;
44
import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
45

  
46

  
47
/**
48
 * DOCUMENT ME!
49
 *
50
 * @author Vicente Caballero Navarro
51
 */
52
public class GeometryComposite {
53
	private FSymbol symbol;
54
	private IGeometry geometry;
55

  
56
	/**
57
	 *
58
	 */
59
	public GeometryComposite(FSymbol symbol, IGeometry geometry) {
60
		this.symbol = symbol;
61
		this.geometry = geometry;
62
	}
63

  
64
	/**
65
	 * DOCUMENT ME!
66
	 *
67
	 * @return DOCUMENT ME!
68
	 */
69
	public FSymbol getSymbol() {
70
		return symbol;
71
	}
72

  
73
	/**
74
	 * DOCUMENT ME!
75
	 *
76
	 * @return DOCUMENT ME!
77
	 */
78
	public IGeometry getGeometry() {
79
		return geometry;
80
	}
81
}
branches/gvSIG_CAD_Layout_version/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/LayoutAdapter.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package com.iver.cit.gvsig.gui.layout;
42

  
43
/**
44
 * DOCUMENT ME!
45
 *
46
 * @author Vicente Caballero Navarro
47
 */
48
public class LayoutAdapter {
49
	private LayoutCADToolAdapter lCADta;
50

  
51
	/**
52
	 * Crea un nuevo LayoutAdapter.
53
	 *
54
	 * @param l DOCUMENT ME!
55
	 */
56
	public LayoutAdapter(Layout l) {
57
		lCADta = new LayoutCADToolAdapter(l);
58
	}
59

  
60
	/**
61
	 * DOCUMENT ME!
62
	 *
63
	 * @return DOCUMENT ME!
64
	 */
65
	public LayoutCADToolAdapter getCADToolAdapter() {
66
		return lCADta;
67
	}
68

  
69
	/**
70
	 * DOCUMENT ME!
71
	 */
72
	public void undo() {
73
	}
74

  
75
	/**
76
	 * DOCUMENT ME!
77
	 */
78
	public void redo() {
79
	}
80
}
branches/gvSIG_CAD_Layout_version/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/commands/ModifyFFrameCommand.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package com.iver.cit.gvsig.gui.layout.commands;
42

  
43
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
44
import com.iver.cit.gvsig.fmap.edition.Command;
45
import com.iver.cit.gvsig.gui.layout.LayoutEditableFeature;
46
import com.iver.cit.gvsig.gui.layout.fframes.IFFrame;
47

  
48
import java.io.IOException;
49

  
50

  
51
/**
52
 * Comando para modificar un FFrame, tanto en tama?o como en lugar.
53
 *
54
 * @author Vicente Caballero Navarro
55
 */
56
public class ModifyFFrameCommand implements Command {
57
	private LayoutEditableFeature lef;
58
	private int indexant;
59
	private int previousExtensionIndex;
60
	private IFFrame framenew;
61
	private IFFrame frameant;
62

  
63
	/**
64
	 * Crea un nuevo ModifyFFrameCommand.
65
	 *
66
	 * @param lef LayoutEditableFeature
67
	 * @param frameant FFrame anterior.
68
	 * @param framenew FFrame nuevo.
69
	 * @param indexant ?ndice del FFrame anterior.
70
	 * @param previousExtensionIndex ?ndice del FFrame nuevo.
71
	 */
72
	public ModifyFFrameCommand(LayoutEditableFeature lef, IFFrame frameant,
73
		IFFrame framenew, int indexant, int previousExtensionIndex) {
74
		this.lef = lef;
75
		this.indexant = indexant;
76
		this.framenew = framenew;
77
		this.frameant = frameant;
78
		this.previousExtensionIndex = previousExtensionIndex;
79
	}
80

  
81
	/**
82
	 * @see com.iver.cit.gvsig.fmap.edition.Command#undo()
83
	 */
84
	public void undo() throws DriverIOException, IOException {
85
		int aux = lef.undoModifyFFrame(frameant, indexant,
86
				previousExtensionIndex);
87
		IFFrame auxframe = framenew;
88
		framenew = frameant;
89
		frameant = auxframe;
90
	}
91

  
92
	/**
93
	 * @see com.iver.cit.gvsig.fmap.edition.Command#redo()
94
	 */
95
	public void redo() throws DriverIOException, IOException {
96
		int aux = lef.doModifyFFrame(frameant, indexant, framenew);
97
		IFFrame auxframe = framenew;
98
		framenew = frameant;
99
		frameant = auxframe;
100
	}
101
}
0 102

  
branches/gvSIG_CAD_Layout_version/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/commands/AddFFrameCommand.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package com.iver.cit.gvsig.gui.layout.commands;
42

  
43
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
44
import com.iver.cit.gvsig.fmap.edition.Command;
45
import com.iver.cit.gvsig.gui.layout.LayoutEditableFeature;
46
import com.iver.cit.gvsig.gui.layout.fframes.IFFrame;
47

  
48
import java.io.IOException;
49

  
50

  
51
/**
52
 * Comando A?adir un FFrame.
53
 *
54
 * @author Vicente Caballero Navarro
55
 */
56
public class AddFFrameCommand implements Command {
57
	private LayoutEditableFeature lef;
58
	private int index;
59
	private IFFrame frame;
60

  
61
	/**
62
	 * Crea un nuevo AddFFrameCommand.
63
	 *
64
	 * @param lef LayoutEditableFeature
65
	 * @param frame FFrame
66
	 * @param num ?ndice.
67
	 */
68
	public AddFFrameCommand(LayoutEditableFeature lef, IFFrame frame, int num) {
69
		this.lef = lef;
70
		index = num;
71
		this.frame = frame;
72
	}
73

  
74
	/**
75
	 * @see com.iver.cit.gvsig.fmap.edition.Command#undo()
76
	 */
77
	public void undo() throws DriverIOException, IOException {
78
		lef.undoAddFFrame(index);
79
	}
80

  
81
	/**
82
	 * @see com.iver.cit.gvsig.fmap.edition.Command#redo()
83
	 */
84
	public void redo() throws DriverIOException, IOException {
85
		index = lef.doAddFFrame(frame);
86
	}
87
}
0 88

  
branches/gvSIG_CAD_Layout_version/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/commands/RemoveFFrameCommand.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package com.iver.cit.gvsig.gui.layout.commands;
42

  
43
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
44
import com.iver.cit.gvsig.fmap.edition.Command;
45
import com.iver.cit.gvsig.gui.layout.LayoutEditableFeature;
46
import com.iver.cit.gvsig.gui.layout.fframes.IFFrame;
47

  
48
import java.io.IOException;
49

  
50

  
51
/**
52
 * Comando de eliminar un FFrame.
53
 *
54
 * @author Vicente Caballero Navarro
55
 */
56
public class RemoveFFrameCommand implements Command {
57
	private LayoutEditableFeature lef;
58
	private int index;
59
	private IFFrame frame;
60

  
61
	/**
62
	 * Crea un nuevo RemoveFFrameCommand.
63
	 *
64
	 * @param lef LayoutEditableFeature
65
	 * @param frame FFrame.
66
	 * @param num ?ndice del FFrame en el Layout.
67
	 */
68
	public RemoveFFrameCommand(LayoutEditableFeature lef, IFFrame frame, int num) {
69
		this.lef = lef;
70
		index = num;
71
		this.frame = frame;
72
	}
73

  
74
	/**
75
	 * @see com.iver.cit.gvsig.fmap.edition.Command#undo()
76
	 */
77
	public void undo() throws DriverIOException, IOException {
78
		index = lef.undoRemoveFFrame(frame, index);
79
	}
80

  
81
	/**
82
	 * @see com.iver.cit.gvsig.fmap.edition.Command#redo()
83
	 */
84
	public void redo() throws DriverIOException, IOException {
85
		lef.doRemoveFFrame(index);
86
	}
87
}
0 88

  
branches/gvSIG_CAD_Layout_version/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/LayoutEditableFeature.java
40 40
 */
41 41
package com.iver.cit.gvsig.gui.layout;
42 42

  
43
import java.awt.geom.Rectangle2D;
44
import java.io.IOException;
45
import java.util.ArrayList;
46
import java.util.Hashtable;
47

  
48 43
import com.iver.cit.gvsig.fmap.core.IGeometry;
49 44
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
50
import com.iver.cit.gvsig.fmap.edition.AddGeometryCommand;
51 45
import com.iver.cit.gvsig.fmap.edition.DefaultEditableFeatureSource;
52
import com.iver.cit.gvsig.fmap.edition.ExpansionFile;
53 46
import com.iver.cit.gvsig.fmap.edition.MemoryExpansionFile;
54
import com.iver.cit.gvsig.fmap.edition.OriginalFeatureAdapter;
55 47
import com.iver.cit.gvsig.fmap.layers.FBitSet;
56
import com.iver.cit.gvsig.gui.cad.AddFFrameCommand;
57
import com.iver.cit.gvsig.gui.cad.RemoveFFrameCommand;
58
import com.iver.cit.gvsig.gui.cad.tools.SelectionCadTool;
59
import com.iver.cit.gvsig.gui.layout.fframes.FFrameView;
48
import com.iver.cit.gvsig.gui.layout.commands.AddFFrameCommand;
49
import com.iver.cit.gvsig.gui.layout.commands.ModifyFFrameCommand;
50
import com.iver.cit.gvsig.gui.layout.commands.RemoveFFrameCommand;
51
import com.iver.cit.gvsig.gui.layout.fframes.FFrameGraphic;
60 52
import com.iver.cit.gvsig.gui.layout.fframes.IFFrame;
61 53

  
62
import com.vividsolutions.jts.geom.Envelope;
63
import com.vividsolutions.jts.index.quadtree.Quadtree;
54
import java.awt.geom.Point2D;
55
import java.awt.geom.Rectangle2D;
64 56

  
57
import java.io.IOException;
65 58

  
59
import java.util.ArrayList;
60
import java.util.Enumeration;
61
import java.util.Hashtable;
62

  
63

  
66 64
/**
67
 * DOCUMENT ME!
65
 * Clase encargada de la edici?n en el Layout, lo que se hace es llevar por un
66
 * lado los FFrame y por otro las geoemetr?as de tal forma que un
67
 * FFrameGraphic contiene dentro una geometr?a para dibujarse y hacer alguna
68
 * operaci?n, pero la selecci?n de geometr?as y el control de sus handlers se
69
 * hace de la misma forma que en la vista utilizando los m?todos del
70
 * DefaultEditableFeature.
68 71
 *
69 72
 * @author Vicente Caballero Navarro
70 73
 */
71 74
public class LayoutEditableFeature extends DefaultEditableFeatureSource {
75
	/*Referencia la Layout, sobre el que gestionar los elementos*/
72 76
	private Layout layout;
73
	private Hashtable rel = new Hashtable();
74
	private int total=0;
75
	private ArrayList geomComp=new ArrayList();
76
	// hay que relacionar lo que se a?ade con lo que se elimina mediante una hashtable y 
77
	// comprobar si nums se esta usando en alg?n sitio y si no se usa eliminarlo.
78
	
77

  
78
	/*Relaciona el ?ndice general de FFrames a?adidos con el ?ndice real que ocupa la geometr?a*/
79
	private Hashtable relGeom = new Hashtable();
80

  
81
	/*Relaciona el ?ndice rela de la geometr?a con el ?ndice general de FFrame*/
82
	private Hashtable relGeomFFrame = new Hashtable();
83

  
84
	/*Relaciona el ?ndice general de los FFrame con el indice virtual de la geometr?a*/
85
	private Hashtable relGeomTotal = new Hashtable();
86

  
87
	/*N?mero total de geometr?as a?adidas*/
88
	private int numTotal = 0;
89

  
79 90
	/**
80 91
	 * Crea un nuevo DefaultLayoutEditable.
81 92
	 *
82
	 * @param l DOCUMENT ME!
93
	 * @param l Referencia al Layout.
94
	 * @param selection Selecci?n.
83 95
	 */
84
	public LayoutEditableFeature(Layout l,FBitSet selection) {
85
		super(new MemoryExpansionFile(),new LayoutOriginalFeature(l), selection);
96
	public LayoutEditableFeature(Layout l, FBitSet selection) {
97
		super(new MemoryExpansionFile(), new LayoutOriginalFeature(l), selection);
86 98
		layout = l;
87 99
	}
88
	
89
	public int addFFrame(IFFrame frame) {
90
		int num=0;
100

  
101
	/**
102
	 * A?ade un FFrame y su AddFFrameCommand para poder realizar el undo y
103
	 * redo.
104
	 *
105
	 * @param frame FFrame a a?adir.
106
	 *
107
	 * @return devuelve la posici?n en la que se a?ade el fframe.
108
	 *
109
	 * @throws DriverIOException
110
	 * @throws IOException
111
	 */
112
	public int addFFrame(IFFrame frame) throws DriverIOException, IOException {
113
		int findex = doAddFFrame(frame);
114

  
91 115
		if (complex) {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff