Revision 1548 branches/pilotoDWG/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/ModifyGeometryCommand.java
ModifyGeometryCommand.java | ||
---|---|---|
12 | 12 |
public class ModifyGeometryCommand implements Command { |
13 | 13 |
private EditableFeatureSource efs; |
14 | 14 |
private IGeometry geomAnt; |
15 |
private IGeometry geomNew; |
|
16 |
private int index; |
|
15 |
private IGeometry geomNext; |
|
16 |
private int indexAnt; |
|
17 |
private int indexNext; |
|
17 | 18 |
public ModifyGeometryCommand(EditableFeatureSource ef,int i,IGeometry newg){ |
18 | 19 |
efs=ef; |
19 |
index=i; |
|
20 |
geomNew=newg;
|
|
20 |
indexAnt=i;
|
|
21 |
geomNext=newg;
|
|
21 | 22 |
} |
22 | 23 |
/** |
23 | 24 |
* @see com.iver.cit.gvsig.fmap.edition.Command#execute() |
24 | 25 |
*/ |
25 | 26 |
public void execute() { |
26 | 27 |
try { |
27 |
geomAnt=efs.getGeometry(index); |
|
28 |
geomAnt=efs.getGeometry(indexAnt);
|
|
28 | 29 |
} catch (IOException e) { |
29 | 30 |
e.printStackTrace(); |
30 | 31 |
} catch (DriverIOException e) { |
... | ... | |
36 | 37 |
* @see com.iver.cit.gvsig.fmap.edition.Command#undo() |
37 | 38 |
*/ |
38 | 39 |
public void undo() { |
39 |
try { |
|
40 |
efs.modifyGeometry(index,geomAnt); |
|
41 |
|
|
40 |
/* try { |
|
41 |
indexNext=efs.getGeometryCount(); |
|
42 |
efs.addGeometry(geomAnt); |
|
43 |
efs.removeGeometry(indexAnt); |
|
44 |
} catch (DriverIOException e) { |
|
45 |
e.printStackTrace(); |
|
42 | 46 |
} catch (IOException e) { |
43 | 47 |
e.printStackTrace(); |
44 |
} catch (DriverIOException e) { |
|
45 |
e.printStackTrace(); |
|
46 | 48 |
} |
49 |
*/ |
|
50 |
try { |
|
51 |
indexNext=indexAnt; |
|
52 |
efs.modifyGeometry(indexAnt,geomAnt); |
|
53 |
|
|
54 |
} catch (IOException e) { |
|
55 |
e.printStackTrace(); |
|
56 |
} catch (DriverIOException e) { |
|
57 |
e.printStackTrace(); |
|
47 | 58 |
} |
59 |
|
|
60 |
} |
|
48 | 61 |
/** |
49 | 62 |
* @see com.iver.cit.gvsig.fmap.edition.Command#redo() |
50 | 63 |
*/ |
51 | 64 |
public void redo() { |
65 |
/* try { |
|
66 |
indexAnt=efs.getGeometryCount(); |
|
67 |
efs.addGeometry(geomNext); |
|
68 |
efs.removeGeometry(indexNext); |
|
69 |
} catch (DriverIOException e) { |
|
70 |
e.printStackTrace(); |
|
71 |
} catch (IOException e) { |
|
72 |
e.printStackTrace(); |
|
73 |
} |
|
74 |
*/ |
|
52 | 75 |
try { |
53 |
efs.modifyGeometry(index,geomNew);
|
|
76 |
efs.modifyGeometry(indexAnt,geomNext);
|
|
54 | 77 |
} catch (IOException e) { |
55 | 78 |
e.printStackTrace(); |
56 | 79 |
} catch (DriverIOException e) { |
57 | 80 |
e.printStackTrace(); |
81 |
}catch (RuntimeException e) { |
|
82 |
try { |
|
83 |
indexAnt=efs.getGeometryCount(); |
|
84 |
efs.addGeometry(geomNext); |
|
85 |
//IGeometry g=geomAnt; |
|
86 |
//geomAnt=geomNext; |
|
87 |
//geomNext=g; |
|
88 |
} catch (DriverIOException e2) { |
|
89 |
e2.printStackTrace(); |
|
90 |
} catch (IOException e2) { |
|
91 |
e2.printStackTrace(); |
|
92 |
} |
|
58 | 93 |
} |
94 |
|
|
59 | 95 |
} |
60 | 96 |
} |
Also available in: Unified diff