Statistics
| Revision:

svn-gvsig-desktop / branches / v10 / libraries / libFMap / src / com / iver / cit / gvsig / fmap / edition / LabelExpansion.java @ 11086

History | View | Annotate | Download (2.75 KB)

1 4954 caballero
package com.iver.cit.gvsig.fmap.edition;
2
3
import java.io.IOException;
4
import java.util.ArrayList;
5
import java.util.HashMap;
6
7
import com.iver.cit.gvsig.fmap.core.IRow;
8
import com.iver.cit.gvsig.fmap.core.v02.FLabel;
9
10
/**
11
 * Implementaci?n en memoria de LabelExpansion.
12
 *
13
 * @author Vicente Caballero Navarro
14
 */
15
public class LabelExpansion {
16
        private ArrayList labels = new ArrayList();
17
        //BitSet invalidRows = new BitSet();
18
        /**
19
         * @see com.iver.cit.gvsig.fmap.edition.ExpansionFile#addRow(IRow, int)
20
         */
21
        public int addLabel(FLabel label){
22
                int newIndex = labels.size();
23
                labels.add(label);
24
25
                return newIndex;
26
        }
27
28
        /**
29
         * @see com.iver.cit.gvsig.fmap.edition.ExpansionFile#modifyRow(int,
30
         *                 IRow)
31
         */
32
        public int modifyLabel(int index, FLabel label){
33
                /*if (invalidRows.get(index)) {
34
                        throw new RuntimeException(
35
                                "Se ha intentado modificar una geometr?a que ha sido borrada anteriormente");
36
                }
37
*/
38
                //invalidateRow(index);
39
                labels.add(label);
40
41
                return labels.size() - 1;
42
        }
43
44
        /**
45
         * @see com.iver.cit.gvsig.fmap.edition.ExpansionFile#getRow(int)
46
         */
47
        public FLabel getLabel(int index) {
48
                /*if (invalidRows.get(index)) {
49
                        return null;
50
                }
51
*/
52
                return (FLabel) labels.get(index);
53
        }
54
55
        /**
56
         * @see com.iver.cit.gvsig.fmap.edition.ExpansionFile#invalidateRow(int)
57
         */
58
        /*public void invalidateRow(int index) {
59
                invalidRows.set(index, true);
60
        }
61
*/
62
        /**
63
         * @see com.iver.cit.gvsig.fmap.edition.ExpansionFile#compact()
64
         */
65
        public void compact(HashMap relations) {
66
        /*        ArrayList geoAux = new ArrayList();
67
                Iterator iter = relations.keySet().iterator();
68
                HashMap aux = new HashMap();
69
                int n = 0;
70

71
                while (iter.hasNext()) {
72
                        Integer virtualIndex = (Integer) iter.next();
73
                        Integer expansionIndex = (Integer) relations.get(virtualIndex);
74

75
                        if (!invalidRows.get(expansionIndex.intValue())){
76
                                geoAux.add(rows.get(expansionIndex.intValue()));
77
                                aux.put(new Integer(n), new Integer(geoAux.size()-1));
78
                                n++;
79
                        }
80
                }
81

82
                invalidRows.clear();
83
                rows = geoAux;
84
                relations.clear();
85
                relations.putAll(aux);
86
*/
87
88
        }
89
90
        /**
91
         * @see com.iver.cit.gvsig.fmap.edition.ExpansionFile#getRowCount()
92
         */
93
        /*public int getRowCount() {
94
                return rows.size() - invalidRows.cardinality();
95
        }
96
*/
97
        public void deleteLastLabel() {
98
                //invalidRows.set(rows.size()-1,false);
99
                labels.remove(labels.size()-1);
100
101
        }
102
103
        public void open() throws IOException {
104
                // TODO Auto-generated method stub
105
106
        }
107
108
        public void close() throws IOException {
109
                // TODO Auto-generated method stub
110
111
        }
112
113
        public int getSize() {
114
                return labels.size();
115
        }
116
117
        /* (non-Javadoc)
118
         * @see com.iver.cit.gvsig.fmap.edition.ExpansionFile#validateRow(int)
119
         */
120
        /*public void validateRow(int previousExpansionFileIndex) {
121
                invalidRows.set(previousExpansionFileIndex, false);
122
        }
123

124
        public BitSet getInvalidRows() {
125
                return invalidRows;
126
        }*/
127
}