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