Revision 22874
trunk/libraries/libTopology/src/com/iver/cit/gvsig/drivers/DriverBasedCollection.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 10-abr-2006 |
|
3 |
* |
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
5 |
* |
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
7 |
* |
|
8 |
* This program is free software; you can redistribute it and/or |
|
9 |
* modify it under the terms of the GNU General Public License |
|
10 |
* as published by the Free Software Foundation; either version 2 |
|
11 |
* of the License, or (at your option) any later version. |
|
12 |
* |
|
13 |
* This program is distributed in the hope that it will be useful, |
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
* GNU General Public License for more details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License |
|
19 |
* along with this program; if not, write to the Free Software |
|
20 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
21 |
* |
|
22 |
* For more information, contact: |
|
23 |
* |
|
24 |
* Generalitat Valenciana |
|
25 |
* Conselleria d'Infraestructures i Transport |
|
26 |
* Av. Blasco Ib??ez, 50 |
|
27 |
* 46010 VALENCIA |
|
28 |
* SPAIN |
|
29 |
* |
|
30 |
* +34 963862235 |
|
31 |
* gvsig@gva.es |
|
32 |
* www.gvsig.gva.es |
|
33 |
* |
|
34 |
* or |
|
35 |
* |
|
36 |
* IVER T.I. S.A |
|
37 |
* Salamanca 50 |
|
38 |
* 46005 Valencia |
|
39 |
* Spain |
|
40 |
* |
|
41 |
* +34 963163400 |
|
42 |
* dac@iver.es |
|
43 |
*/ |
|
44 |
/* CVS MESSAGES: |
|
45 |
* |
|
46 |
* $Id: |
|
47 |
* $Log: |
|
48 |
*/ |
|
49 |
package com.iver.cit.gvsig.drivers; |
|
50 |
|
|
51 |
import java.util.Collection; |
|
52 |
import java.util.Iterator; |
|
53 |
|
|
54 |
import com.iver.cit.gvsig.fmap.layers.FBitSet; |
|
55 |
import com.iver.cit.gvsig.fmap.layers.ReadableVectorial; |
|
56 |
/** |
|
57 |
* |
|
58 |
* Implementation of collection which saves and reads |
|
59 |
* its objects from a subjacent driver. |
|
60 |
* |
|
61 |
* @author Alvaro Zabala |
|
62 |
* |
|
63 |
*/ |
|
64 |
public abstract class DriverBasedCollection |
|
65 |
implements Collection { |
|
66 |
|
|
67 |
/** |
|
68 |
* Adapter associated to this collection |
|
69 |
*/ |
|
70 |
protected ReadableVectorial adapter; |
|
71 |
/** |
|
72 |
* Bitset that marks the index of the added |
|
73 |
*/ |
|
74 |
protected FBitSet bitset; |
|
75 |
|
|
76 |
// protected |
|
77 |
|
|
78 |
|
|
79 |
/** |
|
80 |
* Constructor |
|
81 |
* @param adapter |
|
82 |
*/ |
|
83 |
public DriverBasedCollection(ReadableVectorial adapter) { |
|
84 |
this.adapter = adapter; |
|
85 |
this.bitset = new FBitSet(); |
|
86 |
} |
|
87 |
|
|
88 |
|
|
89 |
public boolean add(Object obj) { |
|
90 |
if(! (obj instanceof AbstractDriverCollectionEntry)) |
|
91 |
return false; |
|
92 |
AbstractDriverCollectionEntry entry = |
|
93 |
(AbstractDriverCollectionEntry)obj; |
|
94 |
int idx = entry.getDriverIdx(); |
|
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
|
100 |
// TODO Auto-generated method stub |
|
101 |
return false; |
|
102 |
} |
|
103 |
|
|
104 |
|
|
105 |
public boolean addAll(Collection arg0) { |
|
106 |
// TODO Auto-generated method stub |
|
107 |
return false; |
|
108 |
} |
|
109 |
|
|
110 |
|
|
111 |
public void clear() { |
|
112 |
bitset.clear(); |
|
113 |
} |
|
114 |
|
|
115 |
public boolean contains(Object arg0) { |
|
116 |
// TODO Auto-generated method stub |
|
117 |
return false; |
|
118 |
} |
|
119 |
|
|
120 |
public boolean containsAll(Collection arg0) { |
|
121 |
// TODO Auto-generated method stub |
|
122 |
return false; |
|
123 |
} |
|
124 |
|
|
125 |
public boolean isEmpty() { |
|
126 |
return bitset.cardinality() == 0; |
|
127 |
} |
|
128 |
|
|
129 |
public Iterator iterator() { |
|
130 |
// TODO Auto-generated method stub |
|
131 |
return null; |
|
132 |
} |
|
133 |
|
|
134 |
public boolean remove(Object arg0) { |
|
135 |
// TODO Auto-generated method stub |
|
136 |
return false; |
|
137 |
} |
|
138 |
|
|
139 |
public boolean removeAll(Collection arg0) { |
|
140 |
// TODO Auto-generated method stub |
|
141 |
return false; |
|
142 |
} |
|
143 |
|
|
144 |
public boolean retainAll(Collection arg0) { |
|
145 |
// TODO Auto-generated method stub |
|
146 |
return false; |
|
147 |
} |
|
148 |
|
|
149 |
public int size() { |
|
150 |
// TODO Auto-generated method stub |
|
151 |
return 0; |
|
152 |
} |
|
153 |
|
|
154 |
public Object[] toArray() { |
|
155 |
// TODO Auto-generated method stub |
|
156 |
return null; |
|
157 |
} |
|
158 |
|
|
159 |
public Object[] toArray(Object[] arg0) { |
|
160 |
// TODO Auto-generated method stub |
|
161 |
return null; |
|
162 |
} |
|
163 |
|
|
164 |
} |
trunk/libraries/libTopology/src/com/iver/cit/gvsig/drivers/DriverCollectionEntriesBuilder.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 10-abr-2006 |
|
3 |
* |
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
5 |
* |
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
7 |
* |
|
8 |
* This program is free software; you can redistribute it and/or |
|
9 |
* modify it under the terms of the GNU General Public License |
|
10 |
* as published by the Free Software Foundation; either version 2 |
|
11 |
* of the License, or (at your option) any later version. |
|
12 |
* |
|
13 |
* This program is distributed in the hope that it will be useful, |
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
* GNU General Public License for more details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License |
|
19 |
* along with this program; if not, write to the Free Software |
|
20 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
21 |
* |
|
22 |
* For more information, contact: |
|
23 |
* |
|
24 |
* Generalitat Valenciana |
|
25 |
* Conselleria d'Infraestructures i Transport |
|
26 |
* Av. Blasco Ib??ez, 50 |
|
27 |
* 46010 VALENCIA |
|
28 |
* SPAIN |
|
29 |
* |
|
30 |
* +34 963862235 |
|
31 |
* gvsig@gva.es |
|
32 |
* www.gvsig.gva.es |
|
33 |
* |
|
34 |
* or |
|
35 |
* |
|
36 |
* IVER T.I. S.A |
|
37 |
* Salamanca 50 |
|
38 |
* 46005 Valencia |
|
39 |
* Spain |
|
40 |
* |
|
41 |
* +34 963163400 |
|
42 |
* dac@iver.es |
|
43 |
*/ |
|
44 |
/* CVS MESSAGES: |
|
45 |
* |
|
46 |
* $Id: |
|
47 |
* $Log: |
|
48 |
*/ |
|
49 |
package com.iver.cit.gvsig.drivers; |
|
50 |
|
|
51 |
import java.util.HashMap; |
|
52 |
import java.util.Map; |
|
53 |
|
|
54 |
/** |
|
55 |
* This class builds AbstractDriverCollectionEntry implementations. |
|
56 |
* |
|
57 |
* It has registered many factories, to use the most appropiate each time. |
|
58 |
* |
|
59 |
* @author Alvaro Zabala |
|
60 |
* |
|
61 |
*/ |
|
62 |
public class DriverCollectionEntriesBuilder { |
|
63 |
/** |
|
64 |
* Factory registry |
|
65 |
*/ |
|
66 |
Map<Integer, DriverCollectionEntryFactory> factories = |
|
67 |
new HashMap<Integer, DriverCollectionEntryFactory>(); |
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
public AbstractDriverCollectionEntry createCollectionEntry(int entryType, int entryIdx) { |
|
75 |
// TODO Auto-generated method stub |
|
76 |
return null; |
|
77 |
} |
|
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
} |
trunk/libraries/libTopology/src/com/iver/cit/gvsig/drivers/AbstractDriverCollectionEntry.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 10-abr-2006 |
|
3 |
* |
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
5 |
* |
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
7 |
* |
|
8 |
* This program is free software; you can redistribute it and/or |
|
9 |
* modify it under the terms of the GNU General Public License |
|
10 |
* as published by the Free Software Foundation; either version 2 |
|
11 |
* of the License, or (at your option) any later version. |
|
12 |
* |
|
13 |
* This program is distributed in the hope that it will be useful, |
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
* GNU General Public License for more details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License |
|
19 |
* along with this program; if not, write to the Free Software |
|
20 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
21 |
* |
|
22 |
* For more information, contact: |
|
23 |
* |
|
24 |
* Generalitat Valenciana |
|
25 |
* Conselleria d'Infraestructures i Transport |
|
26 |
* Av. Blasco Ib??ez, 50 |
|
27 |
* 46010 VALENCIA |
|
28 |
* SPAIN |
|
29 |
* |
|
30 |
* +34 963862235 |
|
31 |
* gvsig@gva.es |
|
32 |
* www.gvsig.gva.es |
|
33 |
* |
|
34 |
* or |
|
35 |
* |
|
36 |
* IVER T.I. S.A |
|
37 |
* Salamanca 50 |
|
38 |
* 46005 Valencia |
|
39 |
* Spain |
|
40 |
* |
|
41 |
* +34 963163400 |
|
42 |
* dac@iver.es |
|
43 |
*/ |
|
44 |
/* CVS MESSAGES: |
|
45 |
* |
|
46 |
* $Id: |
|
47 |
* $Log: |
|
48 |
*/ |
|
49 |
package com.iver.cit.gvsig.drivers; |
|
50 |
/** |
|
51 |
* |
|
52 |
* @author Alvaro Zabala |
|
53 |
* |
|
54 |
*/ |
|
55 |
public abstract class AbstractDriverCollectionEntry { |
|
56 |
|
|
57 |
protected int driverIdx; |
|
58 |
|
|
59 |
public int getDriverIdx(){ |
|
60 |
return driverIdx; |
|
61 |
} |
|
62 |
|
|
63 |
public void setDriverIdx(int driverIdx){ |
|
64 |
this.driverIdx = driverIdx; |
|
65 |
} |
|
66 |
|
|
67 |
public abstract Object getUserData(); |
|
68 |
} |
trunk/libraries/libTopology/src/com/iver/cit/gvsig/drivers/DriverCollectionEntryFactory.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 10-abr-2006 |
|
3 |
* |
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
5 |
* |
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
7 |
* |
|
8 |
* This program is free software; you can redistribute it and/or |
|
9 |
* modify it under the terms of the GNU General Public License |
|
10 |
* as published by the Free Software Foundation; either version 2 |
|
11 |
* of the License, or (at your option) any later version. |
|
12 |
* |
|
13 |
* This program is distributed in the hope that it will be useful, |
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
* GNU General Public License for more details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License |
|
19 |
* along with this program; if not, write to the Free Software |
|
20 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
21 |
* |
|
22 |
* For more information, contact: |
|
23 |
* |
|
24 |
* Generalitat Valenciana |
|
25 |
* Conselleria d'Infraestructures i Transport |
|
26 |
* Av. Blasco Ib??ez, 50 |
|
27 |
* 46010 VALENCIA |
|
28 |
* SPAIN |
|
29 |
* |
|
30 |
* +34 963862235 |
|
31 |
* gvsig@gva.es |
|
32 |
* www.gvsig.gva.es |
|
33 |
* |
|
34 |
* or |
|
35 |
* |
|
36 |
* IVER T.I. S.A |
|
37 |
* Salamanca 50 |
|
38 |
* 46005 Valencia |
|
39 |
* Spain |
|
40 |
* |
|
41 |
* +34 963163400 |
|
42 |
* dac@iver.es |
|
43 |
*/ |
|
44 |
/* CVS MESSAGES: |
|
45 |
* |
|
46 |
* $Id: |
|
47 |
* $Log: |
|
48 |
*/ |
|
49 |
package com.iver.cit.gvsig.drivers; |
|
50 |
/** |
|
51 |
* Factory for AbstractDriverCollectionEntry |
|
52 |
* @author Alvaro Zabala |
|
53 |
* |
|
54 |
*/ |
|
55 |
public interface DriverCollectionEntryFactory { |
|
56 |
public AbstractDriverCollectionEntry createCollectionEntry(int entryIdx); |
|
57 |
} |
trunk/libraries/libTopology/src/com/iver/cit/gvsig/drivers/VectorErrorMemoryDriver.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 10-abr-2006 |
|
3 |
* |
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
5 |
* |
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
7 |
* |
|
8 |
* This program is free software; you can redistribute it and/or |
|
9 |
* modify it under the terms of the GNU General Public License |
|
10 |
* as published by the Free Software Foundation; either version 2 |
|
11 |
* of the License, or (at your option) any later version. |
|
12 |
* |
|
13 |
* This program is distributed in the hope that it will be useful, |
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
* GNU General Public License for more details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License |
|
19 |
* along with this program; if not, write to the Free Software |
|
20 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
21 |
* |
|
22 |
* For more information, contact: |
|
23 |
* |
|
24 |
* Generalitat Valenciana |
|
25 |
* Conselleria d'Infraestructures i Transport |
|
26 |
* Av. Blasco Ib??ez, 50 |
|
27 |
* 46010 VALENCIA |
|
28 |
* SPAIN |
|
29 |
* |
|
30 |
* +34 963862235 |
|
31 |
* gvsig@gva.es |
|
32 |
* www.gvsig.gva.es |
|
33 |
* |
|
34 |
* or |
|
35 |
* |
|
36 |
* IVER T.I. S.A |
|
37 |
* Salamanca 50 |
|
38 |
* 46005 Valencia |
|
39 |
* Spain |
|
40 |
* |
|
41 |
* +34 963163400 |
|
42 |
* dac@iver.es |
|
43 |
*/ |
|
44 |
/* CVS MESSAGES: |
|
45 |
* |
|
46 |
* $Id: |
|
47 |
* $Log: |
|
48 |
*/ |
|
49 |
package com.iver.cit.gvsig.drivers; |
|
50 |
|
|
51 |
import java.awt.geom.Rectangle2D; |
|
52 |
import java.sql.Types; |
|
53 |
|
|
54 |
import org.geotools.referencefork.referencing.operation.builder.MappedPosition; |
|
55 |
import org.gvsig.referencing.MappedPositionContainer; |
|
56 |
|
|
57 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
58 |
import com.hardcode.gdbms.driver.exceptions.ReloadDriverException; |
|
59 |
import com.hardcode.gdbms.driver.exceptions.WriteDriverException; |
|
60 |
import com.hardcode.gdbms.engine.data.DataSourceFactory; |
|
61 |
import com.hardcode.gdbms.engine.data.driver.ObjectDriver; |
|
62 |
import com.hardcode.gdbms.engine.data.edition.DataWare; |
|
63 |
import com.hardcode.gdbms.engine.values.Value; |
|
64 |
import com.hardcode.gdbms.engine.values.ValueFactory; |
|
65 |
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException; |
|
66 |
import com.iver.cit.gvsig.fmap.core.FShape; |
|
67 |
import com.iver.cit.gvsig.fmap.core.GeneralPathX; |
|
68 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
|
69 |
import com.iver.cit.gvsig.fmap.core.ShapeFactory; |
|
70 |
import com.iver.cit.gvsig.fmap.drivers.BoundedShapes; |
|
71 |
import com.iver.cit.gvsig.fmap.drivers.DriverAttributes; |
|
72 |
import com.iver.cit.gvsig.fmap.drivers.VectorialDriver; |
|
73 |
|
|
74 |
/** |
|
75 |
* Memory driver to adapt MappedPositionContainer (which contains MappedPosition) |
|
76 |
* to fmap driver interfaces. It only returns geometries (no fields) |
|
77 |
* |
|
78 |
* @author Alvaro Zabala |
|
79 |
* |
|
80 |
*/ |
|
81 |
public class VectorErrorMemoryDriver implements VectorialDriver, ObjectDriver, |
|
82 |
BoundedShapes { |
|
83 |
|
|
84 |
public static final Rectangle2D EMPTY_FULL_EXTENT = new Rectangle2D.Double(); |
|
85 |
|
|
86 |
private DriverAttributes attr = new DriverAttributes(); |
|
87 |
|
|
88 |
/** |
|
89 |
* Name of the data source of this driver |
|
90 |
*/ |
|
91 |
String name; |
|
92 |
|
|
93 |
/** |
|
94 |
* Container of MappedPosition |
|
95 |
*/ |
|
96 |
MappedPositionContainer mappedPositionContainer; |
|
97 |
|
|
98 |
/** |
|
99 |
* Full extent of all features |
|
100 |
*/ |
|
101 |
Rectangle2D fullExtent; |
|
102 |
|
|
103 |
/** |
|
104 |
* Constructor |
|
105 |
* |
|
106 |
* @param name |
|
107 |
* descriptive name of the data source |
|
108 |
* @param features |
|
109 |
* collection of features in memory |
|
110 |
* @param definition |
|
111 |
* definition of the layer of these features |
|
112 |
*/ |
|
113 |
public VectorErrorMemoryDriver(String name, |
|
114 |
MappedPositionContainer mappedPositionContainer) { |
|
115 |
this.name = name; |
|
116 |
this.mappedPositionContainer = mappedPositionContainer; |
|
117 |
attr.setLoadedInMemory(true); |
|
118 |
try { |
|
119 |
computeFullExtent(); |
|
120 |
} catch (ExpansionFileReadException e) { |
|
121 |
e.printStackTrace(); |
|
122 |
} catch (ReadDriverException e) { |
|
123 |
e.printStackTrace(); |
|
124 |
} |
|
125 |
} |
|
126 |
|
|
127 |
public int getShapeType() { |
|
128 |
return FShape.LINE; |
|
129 |
} |
|
130 |
|
|
131 |
public String getName() { |
|
132 |
return name; |
|
133 |
} |
|
134 |
|
|
135 |
public int getShapeCount() throws ReadDriverException { |
|
136 |
return mappedPositionContainer.getCount(); |
|
137 |
} |
|
138 |
|
|
139 |
public Rectangle2D getFullExtent() throws ReadDriverException, |
|
140 |
ExpansionFileReadException { |
|
141 |
if (fullExtent == null) { |
|
142 |
// collection is empty |
|
143 |
return EMPTY_FULL_EXTENT; |
|
144 |
} |
|
145 |
return fullExtent; |
|
146 |
} |
|
147 |
|
|
148 |
public IGeometry getShape(int index) throws ReadDriverException { |
|
149 |
if (index < mappedPositionContainer.getCount()){ |
|
150 |
MappedPosition mappedPosition = mappedPositionContainer.getMappedPosition(index); |
|
151 |
double[] sourceCoords = mappedPosition.getSource().getCoordinates(); |
|
152 |
double[] targetCoords = mappedPosition.getTarget().getCoordinates(); |
|
153 |
GeneralPathX gpx = new GeneralPathX(); |
|
154 |
gpx.moveTo(sourceCoords[0], sourceCoords[1]); |
|
155 |
gpx.lineTo(targetCoords[0], targetCoords[1]); |
|
156 |
return ShapeFactory.createPolyline2D(gpx); |
|
157 |
|
|
158 |
|
|
159 |
} |
|
160 |
else |
|
161 |
return null; |
|
162 |
} |
|
163 |
|
|
164 |
public void reload() throws ReloadDriverException { |
|
165 |
} |
|
166 |
|
|
167 |
public DriverAttributes getDriverAttributes() { |
|
168 |
return attr; |
|
169 |
} |
|
170 |
|
|
171 |
public boolean isWritable() { |
|
172 |
return false; |
|
173 |
} |
|
174 |
|
|
175 |
public int[] getPrimaryKeys() throws ReadDriverException { |
|
176 |
return null; |
|
177 |
} |
|
178 |
|
|
179 |
public void write(DataWare dataWare) throws WriteDriverException, |
|
180 |
ReadDriverException { |
|
181 |
} |
|
182 |
|
|
183 |
public void setDataSourceFactory(DataSourceFactory dsf) { |
|
184 |
} |
|
185 |
|
|
186 |
public Value getFieldValue(long rowIndex, int fieldId) |
|
187 |
throws ReadDriverException { |
|
188 |
if(fieldId == 0) |
|
189 |
return ValueFactory.createValue(rowIndex); |
|
190 |
else |
|
191 |
return ValueFactory.createNullValue(); |
|
192 |
} |
|
193 |
|
|
194 |
public int getFieldCount() throws ReadDriverException { |
|
195 |
return 1; |
|
196 |
} |
|
197 |
|
|
198 |
public String getFieldName(int fieldId) throws ReadDriverException { |
|
199 |
if(fieldId == 0) |
|
200 |
return "fid"; |
|
201 |
else |
|
202 |
return ""; |
|
203 |
} |
|
204 |
|
|
205 |
public long getRowCount() throws ReadDriverException { |
|
206 |
return getShapeCount(); |
|
207 |
} |
|
208 |
|
|
209 |
public int getFieldType(int i) throws ReadDriverException { |
|
210 |
if(i == 0) |
|
211 |
return Types.NUMERIC; |
|
212 |
else |
|
213 |
return -1; |
|
214 |
} |
|
215 |
|
|
216 |
public int getFieldWidth(int i) throws ReadDriverException { |
|
217 |
return 20; |
|
218 |
} |
|
219 |
|
|
220 |
public Rectangle2D getShapeBounds(int index) throws ReadDriverException, |
|
221 |
ExpansionFileReadException { |
|
222 |
IGeometry geometry = getShape(index); |
|
223 |
return geometry.getBounds2D(); |
|
224 |
} |
|
225 |
|
|
226 |
public int getShapeType(int index) throws ReadDriverException { |
|
227 |
IGeometry geometry = getShape(index); |
|
228 |
return geometry.getGeometryType(); |
|
229 |
} |
|
230 |
|
|
231 |
private void computeFullExtent() throws ExpansionFileReadException, ReadDriverException { |
|
232 |
|
|
233 |
for (int i = 0; i < getRowCount(); i++) { |
|
234 |
Rectangle2D rAux = getShapeBounds(i); |
|
235 |
if (fullExtent == null) |
|
236 |
fullExtent = rAux; |
|
237 |
else |
|
238 |
fullExtent.add(rAux); |
|
239 |
}//for |
|
240 |
} |
|
241 |
|
|
242 |
public MappedPositionContainer getMappedPositionContainer() { |
|
243 |
return mappedPositionContainer; |
|
244 |
} |
|
245 |
|
|
246 |
} |
Also available in: Unified diff