Revision 23290 branches/v2_0_0_prep/libraries/libFMap_spatialindex/src-test/org/gvsig/fmap/data/index/SpatialIndexTest.java
SpatialIndexTest.java | ||
---|---|---|
36 | 36 |
import org.apache.log4j.ConsoleAppender; |
37 | 37 |
import org.apache.log4j.Logger; |
38 | 38 |
import org.apache.log4j.SimpleLayout; |
39 |
import org.gvsig.fmap.data.index.gt2.QuadTreeGt2Factory; |
|
40 |
import org.gvsig.fmap.data.index.jsi.RTreeJsiFactory; |
|
41 |
import org.gvsig.fmap.data.index.jts.QuadTreeJtsFactory; |
|
42 |
import org.gvsig.fmap.data.index.spatialindex.RTreeSptLibFactory; |
|
39 |
import org.gvsig.fmap.data.DataManager; |
|
40 |
import org.gvsig.fmap.data.feature.AttributeDescriptor; |
|
41 |
import org.gvsig.fmap.data.feature.DefaultFeatureType; |
|
42 |
import org.gvsig.fmap.data.feature.Feature; |
|
43 |
import org.gvsig.fmap.data.feature.FeatureAttributeDescriptor; |
|
44 |
import org.gvsig.fmap.data.feature.FeatureCollection; |
|
45 |
import org.gvsig.fmap.data.feature.FeatureType; |
|
46 |
import org.gvsig.fmap.data.feature.IsNotAttributeSettingException; |
|
47 |
import org.gvsig.fmap.data.index.spatial.PersistentSpatialIndex; |
|
48 |
import org.gvsig.fmap.data.index.spatial.SpatialIndex; |
|
49 |
import org.gvsig.fmap.data.index.spatial.SpatialIndexFactory; |
|
50 |
import org.gvsig.fmap.data.index.spatial.SpatialIndexParameters; |
|
51 |
import org.gvsig.fmap.data.index.spatial.SpatialQueryParameters; |
|
52 |
import org.gvsig.fmap.data.index.spatial.gt2.QuadTreeGt2Factory; |
|
53 |
import org.gvsig.fmap.data.index.spatial.jsi.RTreeJsiFactory; |
|
54 |
import org.gvsig.fmap.data.index.spatial.jts.QuadTreeJtsFactory; |
|
55 |
import org.gvsig.fmap.data.index.spatial.spatialindex.RTreeSptLibFactory; |
|
56 |
import org.gvsig.fmap.geom.Geometry; |
|
43 | 57 |
import org.gvsig.fmap.geom.primitive.Curve2D; |
44 | 58 |
import org.gvsig.fmap.geom.primitive.DefaultEnvelope; |
45 | 59 |
import org.gvsig.fmap.geom.primitive.Envelope; |
... | ... | |
125 | 139 |
return extent; |
126 | 140 |
} |
127 | 141 |
|
142 |
private FeatureCollection newFeatureCollection() { |
|
143 |
DataManager man = DataManager.getManager(); |
|
144 |
return null; |
|
145 |
} |
|
128 | 146 |
|
147 |
private FeatureType newFeatureType() { |
|
148 |
DefaultFeatureType fType = new DefaultFeatureType(); |
|
149 |
|
|
150 |
try { |
|
151 |
AttributeDescriptor descriptorID = (AttributeDescriptor) fType |
|
152 |
.createAttributeDescriptor(); |
|
153 |
descriptorID.loading(); |
|
154 |
descriptorID.setType(FeatureAttributeDescriptor.TYPE_INT); |
|
155 |
descriptorID.setName("ID"); |
|
156 |
descriptorID.setDefaultValue(new Integer(0)); |
|
157 |
descriptorID.stopLoading(); |
|
158 |
fType.add(descriptorID); |
|
159 |
|
|
160 |
AttributeDescriptor descriptorShape = (AttributeDescriptor) fType |
|
161 |
.createAttributeDescriptor(); |
|
162 |
descriptorShape.loading(); |
|
163 |
descriptorShape.setType(FeatureAttributeDescriptor.TYPE_GEOMETRY); |
|
164 |
descriptorShape.setName("GEOMETRY"); |
|
165 |
descriptorShape.setDefaultValue(null); |
|
166 |
descriptorShape.stopLoading(); |
|
167 |
fType.add(descriptorShape); |
|
168 |
fType.setDefaultGeometry("GEOMETRY"); |
|
169 |
|
|
170 |
AttributeDescriptor descriptorEntity = (AttributeDescriptor) fType |
|
171 |
.createAttributeDescriptor(); |
|
172 |
descriptorEntity.loading(); |
|
173 |
descriptorEntity.setType(FeatureAttributeDescriptor.TYPE_STRING); |
|
174 |
descriptorEntity.setName("Entity"); |
|
175 |
descriptorEntity.setDefaultValue("Entity"); |
|
176 |
descriptorEntity.stopLoading(); |
|
177 |
fType.add(descriptorEntity); |
|
178 |
|
|
179 |
AttributeDescriptor descriptorLayer = (AttributeDescriptor) fType |
|
180 |
.createAttributeDescriptor(); |
|
181 |
descriptorLayer.loading(); |
|
182 |
descriptorLayer.setType(FeatureAttributeDescriptor.TYPE_STRING); |
|
183 |
descriptorLayer.setName("Layer"); |
|
184 |
descriptorLayer.setDefaultValue("default"); |
|
185 |
descriptorLayer.stopLoading(); |
|
186 |
fType.add(descriptorLayer); |
|
187 |
|
|
188 |
AttributeDescriptor descriptorColor = (AttributeDescriptor) fType |
|
189 |
.createAttributeDescriptor(); |
|
190 |
descriptorColor.loading(); |
|
191 |
descriptorColor.setType(FeatureAttributeDescriptor.TYPE_INT); |
|
192 |
descriptorColor.setName("Color"); |
|
193 |
descriptorColor.setDefaultValue(new Integer(0)); |
|
194 |
descriptorColor.stopLoading(); |
|
195 |
fType.add(descriptorColor); |
|
196 |
|
|
197 |
AttributeDescriptor descriptorElevation = (AttributeDescriptor) fType |
|
198 |
.createAttributeDescriptor(); |
|
199 |
descriptorElevation.loading(); |
|
200 |
descriptorElevation.setType(FeatureAttributeDescriptor.TYPE_DOUBLE); |
|
201 |
descriptorElevation.setName("Elevation"); |
|
202 |
descriptorElevation.setDefaultValue(new Double(0)); |
|
203 |
descriptorElevation.stopLoading(); |
|
204 |
fType.add(descriptorElevation); |
|
205 |
|
|
206 |
AttributeDescriptor descriptorThickness = (AttributeDescriptor) fType |
|
207 |
.createAttributeDescriptor(); |
|
208 |
descriptorThickness.loading(); |
|
209 |
descriptorThickness.setType(FeatureAttributeDescriptor.TYPE_DOUBLE); |
|
210 |
descriptorThickness.setName("Thickness"); |
|
211 |
descriptorThickness.setDefaultValue(new Double(0)); |
|
212 |
descriptorThickness.stopLoading(); |
|
213 |
fType.add(descriptorThickness); |
|
214 |
|
|
215 |
AttributeDescriptor descriptorText = (AttributeDescriptor) fType |
|
216 |
.createAttributeDescriptor(); |
|
217 |
descriptorText.loading(); |
|
218 |
descriptorText.setType(FeatureAttributeDescriptor.TYPE_STRING); |
|
219 |
descriptorText.setName("Text"); |
|
220 |
descriptorText.setDefaultValue(""); |
|
221 |
descriptorText.stopLoading(); |
|
222 |
fType.add(descriptorText); |
|
223 |
|
|
224 |
AttributeDescriptor descriptorHeightText = (AttributeDescriptor) fType |
|
225 |
.createAttributeDescriptor(); |
|
226 |
descriptorHeightText.loading(); |
|
227 |
descriptorHeightText.setType(FeatureAttributeDescriptor.TYPE_FLOAT); |
|
228 |
descriptorHeightText.setName("HeightText"); |
|
229 |
descriptorHeightText.setDefaultValue(new Float(10)); |
|
230 |
descriptorHeightText.stopLoading(); |
|
231 |
fType.add(descriptorHeightText); |
|
232 |
|
|
233 |
AttributeDescriptor descriptorRotationText = (AttributeDescriptor) fType |
|
234 |
.createAttributeDescriptor(); |
|
235 |
descriptorRotationText.loading(); |
|
236 |
descriptorRotationText |
|
237 |
.setType(FeatureAttributeDescriptor.TYPE_DOUBLE); |
|
238 |
descriptorRotationText.setName("Rotation"); |
|
239 |
descriptorRotationText.setDefaultValue(new Double(10)); |
|
240 |
descriptorRotationText.stopLoading(); |
|
241 |
fType.add(descriptorRotationText); |
|
242 |
fType.setDefaultGeometry("GEOMETRY"); |
|
243 |
fType.setGeometryTypes(new int[] { Geometry.TYPES.GEOMETRY }); |
|
244 |
} catch (IsNotAttributeSettingException e) { |
|
245 |
e.printStackTrace(); |
|
246 |
} |
|
247 |
|
|
248 |
return fType; |
|
249 |
|
|
250 |
} |
|
251 |
|
|
129 | 252 |
} |
Also available in: Unified diff