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; |
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 attDesc = fs.getSchema().getDescriptor(i); |
AttributeDescriptor attDesc = fs.getSchema().getDescriptor(i); |
252 |
|
|
253 |
AttributeMetadata attMetaData = new AttributeMetadata(attDesc.getName()); |
AttributeMetadata attMetaData = new AttributeMetadata(attDesc.getName(), map.getLanguages()); |
254 |
map.put(attDesc.getName(), attMetaData); |
map.put(attDesc.getName(), attMetaData); |
255 |
} |
} |
256 |
} |
} |
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 |