41 |
|
|
42 |
import org.apache.log4j.Logger; |
import org.apache.log4j.Logger; |
43 |
import org.geotools.data.FeatureSource; |
import org.geotools.data.FeatureSource; |
|
import org.geotools.data.store.EmptyFeatureCollection; |
|
44 |
import org.geotools.feature.FeatureCollection; |
import org.geotools.feature.FeatureCollection; |
45 |
import org.geotools.styling.Style; |
import org.geotools.styling.Style; |
46 |
import org.opengis.feature.simple.SimpleFeature; |
import org.opengis.feature.simple.SimpleFeature; |
51 |
|
|
52 |
import schmitzm.geotools.io.GeoImportUtil; |
import schmitzm.geotools.io.GeoImportUtil; |
53 |
import schmitzm.geotools.styling.StylingUtil; |
import schmitzm.geotools.styling.StylingUtil; |
54 |
import skrueger.AttributeMetaData; |
import skrueger.AttributeMetadata; |
55 |
import skrueger.i8n.Translation; |
import skrueger.i8n.Translation; |
56 |
|
|
57 |
import com.vividsolutions.jts.geom.Envelope; |
import com.vividsolutions.jts.geom.Envelope; |
244 |
public AttributeMetadataMap getAttributeMetaDataMap() { |
public AttributeMetadataMap getAttributeMetaDataMap() { |
245 |
if (map == null) { |
if (map == null) { |
246 |
|
|
247 |
map = new AttributeMetadataMap(); |
map = new AttributeMetadataMap(new String[] {Translation.getActiveLang()}); |
248 |
|
|
249 |
// Leaving out the first one, it will be the_geom |
// Leaving out the first one, it will be the_geom |
250 |
for (int i = 1; i < fs.getSchema().getAttributeCount(); i++) { |
for (int i = 1; i < fs.getSchema().getAttributeCount(); i++) { |
251 |
AttributeDescriptor att = fs.getSchema().getDescriptor(i); |
AttributeDescriptor attDesc = fs.getSchema().getDescriptor(i); |
252 |
|
|
253 |
AttributeMetaData attMetaData = new AttributeMetaData(i, att |
AttributeMetadata attMetaData = new AttributeMetadata(attDesc.getName(), map.getLanguages()); |
254 |
.getLocalName()); |
map.put(attDesc.getName(), attMetaData); |
|
map.put(i, attMetaData); |
|
255 |
} |
} |
256 |
} |
} |
257 |
return map; |
return map; |
302 |
|
|
303 |
@Override |
@Override |
304 |
public FeatureCollection<SimpleFeatureType, SimpleFeature> getFeatureCollectionFiltered() { |
public FeatureCollection<SimpleFeatureType, SimpleFeature> getFeatureCollectionFiltered() { |
305 |
final FeatureCollection<SimpleFeatureType, SimpleFeature> fc = getFeatureCollection(); |
// final FeatureCollection<SimpleFeatureType, SimpleFeature> fc = getFeatureCollection(); |
306 |
if (filter == Filter.EXCLUDE) |
// if (filter == Filter.EXCLUDE) |
307 |
return new EmptyFeatureCollection(fc.getSchema()); |
// return new EmptyFeatureCollection(fc.getSchema()); |
308 |
if (filter == Filter.INCLUDE) |
// if (filter == Filter.INCLUDE) |
309 |
return fc; |
// return fc; |
310 |
return fc.subCollection(filter); |
// return fc.subCollection(filter); |
311 |
|
|
312 |
|
try { |
313 |
|
return getFeatureSource().getFeatures(filter); |
314 |
|
} catch (IOException e) { |
315 |
|
throw new RuntimeException(e); |
316 |
|
} |
317 |
} |
} |
318 |
|
|
319 |
@Override |
@Override |