svn-gvsig-desktop / branches / pilotoDWG / libraries / libFMap / src / com / iver / cit / gvsig / fmap / edition / AddGeometryCommand.java @ 1591
History | View | Annotate | Download (1.03 KB)
1 | 1241 | fernando | |
---|---|---|---|
2 | package com.iver.cit.gvsig.fmap.edition; |
||
3 | |||
4 | 1535 | vcaballero | import java.io.IOException; |
5 | |||
6 | 1540 | vcaballero | import com.iver.cit.gvsig.fmap.core.IGeometry; |
7 | 1535 | vcaballero | import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
8 | |||
9 | |||
10 | 1241 | fernando | /**
|
11 | * A?ade una geometr?a nueva al EditableFeatureSource
|
||
12 | */
|
||
13 | public class AddGeometryCommand implements Command { |
||
14 | 1540 | vcaballero | private IGeometry geometry;
|
15 | 1535 | vcaballero | private int index; |
16 | 1591 | fernando | private DefaultEditableFeatureSource efs;
|
17 | public AddGeometryCommand(DefaultEditableFeatureSource ef,IGeometry g,int i){ |
||
18 | 1535 | vcaballero | efs=ef; |
19 | 1572 | vcaballero | index=i; |
20 | 1587 | vcaballero | geometry=g; |
21 | 1535 | vcaballero | } |
22 | 1241 | fernando | /**
|
23 | 1572 | vcaballero | * @throws IOException
|
24 | * @throws DriverIOException
|
||
25 | 1587 | vcaballero | * @throws IOException
|
26 | * @throws DriverIOException
|
||
27 | 1428 | fernando | * @see com.iver.cit.gvsig.fmap.edition.Command#undo()
|
28 | */
|
||
29 | 1587 | vcaballero | public void undo() throws DriverIOException, IOException { |
30 | 1572 | vcaballero | efs.undoAddGeometry(index); |
31 | 1428 | fernando | } |
32 | 1540 | vcaballero | /**
|
33 | 1587 | vcaballero | * @throws DriverIOException
|
34 | * @throws IOException
|
||
35 | 1540 | vcaballero | * @see com.iver.cit.gvsig.fmap.edition.Command#redo()
|
36 | */
|
||
37 | 1587 | vcaballero | public void redo() throws DriverIOException, IOException { |
38 | 1540 | vcaballero | index=efs.getGeometryCount(); |
39 | 1572 | vcaballero | ((DefaultEditableFeatureSource)efs).doAddGeometry(geometry); |
40 | 1587 | vcaballero | |
41 | 1540 | vcaballero | } |
42 | 1241 | fernando | } |