` public static void main(String[] args) { File file = JFileDataStoreChooser.showOpenFile("shp", null); if (file == null) return; try{
public static void main(String[] args) {
File file = JFileDataStoreChooser.showOpenFile("shp", null);
if (file == null) return;
try{
FileDataStore store = FileDataStoreFinder.getDataStore(file);
SimpleFeatureSource featureSource = store.getFeatureSource();
FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
String[] selection = new String[1000];
for(int i=0; i<selection.length; i++){
selection[i] = i+"";
}
ArrayList<Filter> match = new ArrayList<Filter>();
for (String name : selection) {
Filter aMatch = ff.equal(ff.property("ID"), ff.literal(name), false);
match.add(aMatch);
}
Filter filter = ff.or(match);
SimpleFeatureCollection features = featureSource.getFeatures(filter);
// Create a map content and add our shapefile to it
MapContent map = new MapContent();
map.setTitle("Quickstart");
Style style = SLD.createSimpleStyle(features.getSchema());
Layer layer = new FeatureLayer(features, style);
map.addLayer(layer);
// Now display the map
JMapFrame.showMap(map);
}catch (Exception e)
{
e.printStackTrace();
}
}`
Are there some faster way to do this? ......