📄 fidindexertest.java
字号:
/*
* GeoTools - OpenSource mapping toolkit
* http://geotools.org
* (C) 2002-2006, GeoTools Project Managment Committee (PMC)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
package org.geotools.data.shapefile.indexed;
import java.io.IOException;
import org.geotools.data.FeatureSource;
import org.geotools.data.Query;
import org.geotools.data.shapefile.ShpFiles;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
public class FidIndexerTest extends FIDTestCase {
public FidIndexerTest( ) throws IOException {
super("FidIndexerTest");
}
protected void tearDown() throws Exception {
super.tearDown();
}
/*
* Test method for 'org.geotools.index.fid.FidIndexer.generate(URL)'
*/
public void testGenerate() throws Exception {
ShpFiles shpFiles = new ShpFiles(backshp.toURL());
FidIndexer.generate(shpFiles);
IndexedShapefileDataStore ds = new IndexedShapefileDataStore(backshp
.toURL(), null, false, false, IndexType.NONE);
FeatureSource<SimpleFeatureType, SimpleFeature> fs = ds.getFeatureSource();
int features = fs.getCount(Query.ALL);
IndexedFidReader reader = new IndexedFidReader(shpFiles);
try {
assertEquals(features, reader.getCount());
int i = 1;
while (reader.hasNext()) {
assertEquals(shpFiles.getTypeName() + "." + i, reader.next());
assertEquals(shpFiles.getTypeName() + "." + i, i - 1, reader.currentSHXIndex());
i++;
}
assertEquals(features, i - 1);
} finally {
reader.close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -