svn-gvsig-desktop / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / edition / AnnotationEditableAdapter.java @ 4256
History | View | Annotate | Download (1.87 KB)
1 |
package com.iver.cit.gvsig.fmap.edition; |
---|---|
2 |
|
3 |
import java.io.IOException; |
4 |
import java.util.ArrayList; |
5 |
|
6 |
import com.hardcode.gdbms.engine.values.NumericValue; |
7 |
import com.hardcode.gdbms.engine.values.Value; |
8 |
import com.iver.cit.gvsig.fmap.core.IRow; |
9 |
import com.iver.cit.gvsig.fmap.core.v02.FLabel; |
10 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
11 |
|
12 |
public class AnnotationEditableAdapter extends VectorialEditableAdapter{ |
13 |
private ArrayList labels; |
14 |
private int[] mapping; |
15 |
|
16 |
public int doAddRow(IRow feat) throws DriverIOException, IOException { |
17 |
return super.doAddRow(feat); |
18 |
} |
19 |
|
20 |
public int doModifyRow(int calculatedIndex, IRow feat) throws IOException, DriverIOException { |
21 |
Value value=feat.getAttribute(mapping[0]);
|
22 |
((FLabel)labels.get(calculatedIndex)).setString(value.toString()); |
23 |
if (mapping[1]==mapping[0]){ |
24 |
((FLabel)labels.get(calculatedIndex)).setRotation(((NumericValue)value).doubleValue()); |
25 |
} |
26 |
return super.doModifyRow(calculatedIndex, feat); |
27 |
} |
28 |
|
29 |
public IRow doRemoveRow(int index) throws DriverIOException, IOException { |
30 |
return super.doRemoveRow(index); |
31 |
} |
32 |
|
33 |
public void undoAddRow(int calculatedIndex) throws DriverIOException, IOException { |
34 |
super.undoAddRow(calculatedIndex);
|
35 |
} |
36 |
|
37 |
public void undoModifyRow(int calculatedIndex, int previousExpansionFileIndex) throws IOException, DriverIOException { |
38 |
super.undoModifyRow(calculatedIndex, previousExpansionFileIndex);
|
39 |
Value value=this.getRow(calculatedIndex).getAttribute(mapping[0]); |
40 |
((FLabel)labels.get(calculatedIndex)).setString(value.toString()); |
41 |
if (mapping[1]==mapping[0]){ |
42 |
((FLabel)labels.get(calculatedIndex)).setRotation(((NumericValue)value).doubleValue()); |
43 |
} |
44 |
} |
45 |
|
46 |
public void undoRemoveRow(int index) throws IOException, DriverIOException { |
47 |
super.undoRemoveRow(index);
|
48 |
} |
49 |
|
50 |
public AnnotationEditableAdapter(ArrayList labels,int[] mapping) { |
51 |
super();
|
52 |
this.labels=labels;
|
53 |
this.mapping=mapping;
|
54 |
} |
55 |
|
56 |
} |