use of com.sldeditor.datasource.example.ExampleLineInterface in project sldeditor by robward-scisys.
the class CreateSampleData method createAttributes.
/**
* Creates the attributes.
*
* @param fieldList the field list
* @param fieldMap the field map
* @param featureType the feature type
* @param builder the builder
* @param feature the feature
*/
private void createAttributes(List<DataSourceAttributeData> fieldList, Map<String, DataSourceAttributeData> fieldMap, SimpleFeatureType featureType, SimpleFeatureBuilder builder, SimpleFeature feature) {
builder.init((SimpleFeature) feature);
int index = 0;
for (AttributeDescriptor descriptor : featureType.getAttributeDescriptors()) {
AttributeType attributeType = descriptor.getType();
Object value = null;
Class<?> fieldType = attributeType.getBinding();
if (attributeType instanceof GeometryTypeImpl) {
geometryType = GeometryTypeMapping.getGeometryType(fieldType);
switch(geometryType) {
case POLYGON:
ExamplePolygonInterface examplePolygon = DataSourceFactory.createExamplePolygon(null);
value = examplePolygon.getPolygon();
break;
case LINE:
ExampleLineInterface exampleLine = DataSourceFactory.createExampleLine(null);
value = exampleLine.getLine();
break;
case POINT:
default:
ExamplePointInterface examplePoint = DataSourceFactory.createExamplePoint(null);
value = examplePoint.getPoint();
break;
}
} else {
if ((fieldList != null) && (index < fieldList.size())) {
DataSourceAttributeData attrData = fieldMap.get(descriptor.getLocalName());
if (attrData != null) {
value = attrData.getValue();
}
}
value = getFieldTypeValue(index, attributeType.getName().getLocalPart(), fieldType, value);
}
builder.add(value);
index++;
}
}
use of com.sldeditor.datasource.example.ExampleLineInterface in project sldeditor by robward-scisys.
the class DataSourceFactoryTest method testCreateExampleLine.
/**
* Test method for {@link
* com.sldeditor.datasource.impl.DataSourceFactory#createExampleLine(java.lang.Object)}.
*/
@Test
public void testCreateExampleLine() {
ExampleLineInterface exampleLine = DataSourceFactory.createExampleLine(null);
assertEquals(ExampleLineImpl.class, exampleLine.getClass());
}
Aggregations