use of com.sldeditor.common.datasource.attribute.DataSourceAttributeData in project sldeditor by robward-scisys.
the class DataSourceImpl method readAttributes.
/**
* Read attributes.
*
* @param attributeData the attribute data
*/
/* (non-Javadoc)
* @see com.sldeditor.datasource.DataSourceInterface#updateAttributes(com.sldeditor.render.iface.RenderAttributeDataInterface)
*/
@Override
public void readAttributes(DataSourceAttributeListInterface attributeData) {
if (attributeData == null) {
return;
}
List<DataSourceAttributeData> valueMap = new ArrayList<DataSourceAttributeData>();
SimpleFeatureCollection featureCollection = dataSourceInfo.getFeatureCollection();
if (featureCollection != null) {
SimpleFeatureIterator iterator = featureCollection.features();
if (iterator.hasNext()) {
SimpleFeature feature = iterator.next();
List<Object> attributes = feature.getAttributes();
for (int i = 0; i < attributes.size(); i++) {
Name fieldName = fieldNameMap.get(i);
DataSourceAttributeData data = new DataSourceAttributeData(fieldName, fieldTypeMap.get(i), attributes.get(i));
valueMap.add(data);
}
}
}
attributeData.setData(valueMap);
}
Aggregations