Statistics
| Revision:

svn-gvsig-desktop / branches / pilotoDWG / libraries / libFMap / src / com / iver / cit / gvsig / fmap / edition / ModifyGeometryCommand.java @ 1591

History | View | Annotate | Download (1.14 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
 * Modifica una geometr?a del EditableFeatureSource 
11
 */
12
public class ModifyGeometryCommand implements Command {
13
        private DefaultEditableFeatureSource efs;
14
        private IGeometry geomAnt;
15
        private IGeometry geomNext;
16
        private int indexAnt;
17
        private int previousIndex;
18
        public ModifyGeometryCommand(DefaultEditableFeatureSource ef,int i,int p,IGeometry newg) throws IOException, DriverIOException{
19
                efs=ef;
20
                indexAnt=i;
21
                geomNext=newg;
22
                previousIndex=p;
23
                geomAnt=efs.getGeometry(indexAnt);
24
        }
25
        /**
26
         * @throws DriverIOException
27
         * @throws IOException
28
         * @see com.iver.cit.gvsig.fmap.edition.Command#undo()
29
         */
30
        public void undo() throws IOException, DriverIOException {
31
                efs.undoModifyGeometry(indexAnt,previousIndex);
32
        }
33
        /**
34
         * @throws DriverIOException
35
         * @throws IOException
36
         * @see com.iver.cit.gvsig.fmap.edition.Command#redo()
37
         */
38
        public void redo() throws IOException, DriverIOException {
39
                        ((DefaultEditableFeatureSource)efs).doModifyGeometry(indexAnt,geomNext);
40
                }
41
}