use of org.geotools.styling.RemoteOWSImpl in project sldeditor by robward-scisys.
the class UserLayerDetails method updateSymbol.
/**
* Update symbol.
*
* @param changedField the changed field
*/
private void updateSymbol(FieldIdEnum changedField) {
if (!Controller.getInstance().isPopulating()) {
UserLayer userLayer = getStyleFactory().createUserLayer();
String name = fieldConfigVisitor.getText(FieldIdEnum.NAME);
userLayer.setName(name);
// Feature type constraints
List<FeatureTypeConstraint> ftcList = fieldConfigVisitor.getFeatureTypeConstraint(FieldIdEnum.LAYER_FEATURE_CONSTRAINTS);
if ((ftcList != null) && !ftcList.isEmpty()) {
FeatureTypeConstraint[] ftcArray = new FeatureTypeConstraint[ftcList.size()];
userLayer.setLayerFeatureConstraints(ftcList.toArray(ftcArray));
}
// Source
GroupConfigInterface group = getGroup(GroupIdEnum.USER_LAYER_SOURCE);
if (group != null) {
MultiOptionGroup userLayerSourceGroup = (MultiOptionGroup) group;
OptionGroup selectedOption = userLayerSourceGroup.getSelectedOptionGroup();
switch(selectedOption.getId()) {
case REMOTE_OWS_OPTION:
{
RemoteOWS remoteOWS = new RemoteOWSImpl();
String service = fieldConfigVisitor.getText(FieldIdEnum.REMOTE_OWS_SERVICE);
remoteOWS.setService(service);
String onlineResource = fieldConfigVisitor.getText(FieldIdEnum.REMOTE_OWS_ONLINERESOURCE);
remoteOWS.setOnlineResource(onlineResource);
userLayer.setRemoteOWS(remoteOWS);
}
break;
case INLINE_FEATURE_OPTION:
{
String inlineFeatures = fieldConfigVisitor.getText(FieldIdEnum.INLINE_FEATURE);
if ((inlineFeatures != null) && (!inlineFeatures.isEmpty())) {
InlineFeatureUtils.setInlineFeatures(userLayer, inlineFeatures);
}
}
break;
default:
break;
}
}
StyledLayer existingStyledLayer = SelectedSymbol.getInstance().getStyledLayer();
if (existingStyledLayer instanceof UserLayerImpl) {
UserLayerImpl existingUserLayer = (UserLayerImpl) existingStyledLayer;
for (Style style : existingUserLayer.userStyles()) {
userLayer.addUserStyle(style);
}
}
SelectedSymbol.getInstance().replaceStyledLayer(userLayer);
// reduces creation of datasources
if (changedField != null) {
if (changedField == FieldIdEnum.INLINE_FEATURE) {
DataSourceInterface dataSource = DataSourceFactory.getDataSource();
if (dataSource != null) {
dataSource.updateUserLayers();
}
}
}
this.fireUpdateSymbol();
}
}
Aggregations