Search in sources :

Example 6 with DataSourcePropertiesInterface

use of com.sldeditor.common.datasource.DataSourcePropertiesInterface in project sldeditor by robward-scisys.

the class DataSourceConnectorShapeFile method getDataSourceProperties.

/* (non-Javadoc)
     * @see com.sldeditor.datasource.connector.DataSourceConnectorInterface#getDataSourceProperties()
     */
@Override
public DataSourcePropertiesInterface getDataSourceProperties(Map<String, String> propertyMap) {
    DataSourcePropertiesInterface properties = new DataSourceProperties(this);
    properties.setPropertyMap(propertyMap);
    return properties;
}
Also used : DataSourcePropertiesInterface(com.sldeditor.common.datasource.DataSourcePropertiesInterface) DataSourceProperties(com.sldeditor.common.datasource.impl.DataSourceProperties)

Example 7 with DataSourcePropertiesInterface

use of com.sldeditor.common.datasource.DataSourcePropertiesInterface in project sldeditor by robward-scisys.

the class MXDParser method processDataSource.

/**
 * Process fields.
 *
 * @param layerName the layer name
 * @param dataSourcePropertiesElement the data source properties element
 * @return the data source properties
 */
private DataSourcePropertiesInterface processDataSource(String layerName, JsonElement dataSourcePropertiesElement) {
    Map<String, String> propertyMap = new LinkedHashMap<String, String>();
    if (dataSourcePropertiesElement != null) {
        JsonObject dsObj = dataSourcePropertiesElement.getAsJsonObject();
        JsonElement typeElement = dsObj.get(DatasourceKeys.TYPE);
        if (typeElement != null) {
            propertyMap.put(DatasourceKeys.TYPE, typeElement.getAsString());
        }
        JsonElement pathElement = dsObj.get(DatasourceKeys.PATH);
        if (pathElement != null) {
            propertyMap.put(DatasourceKeys.PATH, pathElement.getAsString());
        }
        JsonObject properties = dsObj.getAsJsonObject(DatasourceKeys.PROPERTIES);
        if (properties != null) {
            for (Map.Entry<String, JsonElement> field : properties.entrySet()) {
                propertyMap.put(field.getKey(), field.getValue().getAsString());
            }
        }
    }
    DataSourcePropertiesInterface dataSourceProperties = DataSourceManager.getInstance().convert(propertyMap);
    return dataSourceProperties;
}
Also used : JsonElement(com.google.gson.JsonElement) JsonObject(com.google.gson.JsonObject) DataSourcePropertiesInterface(com.sldeditor.common.datasource.DataSourcePropertiesInterface) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

DataSourcePropertiesInterface (com.sldeditor.common.datasource.DataSourcePropertiesInterface)7 DataSourceProperties (com.sldeditor.common.datasource.impl.DataSourceProperties)5 JsonElement (com.google.gson.JsonElement)2 JsonObject (com.google.gson.JsonObject)1 SLDData (com.sldeditor.common.SLDData)1 SLDDataInterface (com.sldeditor.common.SLDDataInterface)1 StyleWrapper (com.sldeditor.common.StyleWrapper)1 DataSourceFieldInterface (com.sldeditor.common.datasource.DataSourceFieldInterface)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 StyledLayerDescriptor (org.geotools.styling.StyledLayerDescriptor)1