use of com.sldeditor.ui.detail.config.base.OptionGroup 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:
updateRemoteOWS(userLayer);
break;
case INLINE_FEATURE_OPTION:
updateInlineFeatureOption(userLayer);
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);
// Update inline data sources if the inline data changed,
// reduces creation of datasources
updateInLineFeature(changedField);
this.fireUpdateSymbol();
}
}
use of com.sldeditor.ui.detail.config.base.OptionGroup in project sldeditor by robward-scisys.
the class RasterSymbolizerDetails method updateContrastEnhancement.
/**
* Update contrast enhancement.
*
* @param gammaValueExpression the gamma value expression
* @return the contrast enhancement
*/
private ContrastEnhancement updateContrastEnhancement(Expression gammaValueExpression) {
ContrastEnhancement contrastEnhancement = null;
GroupConfigInterface group = getGroup(GroupIdEnum.RASTER_CONTRAST);
if (group.isPanelEnabled()) {
String method = null;
group = getGroup(GroupIdEnum.RASTER_OVERALL_CONTRAST_METHOD);
if (group != null) {
MultiOptionGroup contrastNormalizeMethodGroup = (MultiOptionGroup) group;
OptionGroup selectedOption = contrastNormalizeMethodGroup.getSelectedOptionGroup();
if (selectedOption != null) {
method = selectedOption.getLabel();
}
}
contrastEnhancement = (ContrastEnhancement) getStyleFactory().contrastEnhancement(gammaValueExpression, method);
}
return contrastEnhancement;
}
use of com.sldeditor.ui.detail.config.base.OptionGroup in project sldeditor by robward-scisys.
the class RasterSymbolizerDetails method populateContrastMethod.
/**
* Populate contrast method.
*
* @param contrastEnhancement the contrast enhancement
* @param contrastMethodGroup the contrast method group
*/
private void populateContrastMethod(ContrastEnhancement contrastEnhancement, GroupIdEnum contrastMethodGroup) {
GroupConfigInterface group = getGroup(contrastMethodGroup);
if (group != null) {
GroupIdEnum selectedNormalizeMethod = GroupIdEnum.UNKNOWN;
MultiOptionGroup contrastNormalizeMethodGroup = (MultiOptionGroup) group;
if (contrastEnhancement != null) {
ContrastMethod contrastMethod = contrastEnhancement.getMethod();
if (contrastMethod != null) {
String contrastMethodString = contrastMethod.name();
for (OptionGroup option : contrastNormalizeMethodGroup.getGroupList()) {
if (option.getLabel().compareToIgnoreCase(contrastMethodString) == 0) {
selectedNormalizeMethod = option.getId();
}
}
}
}
contrastNormalizeMethodGroup.setOption(selectedNormalizeMethod);
}
}
use of com.sldeditor.ui.detail.config.base.OptionGroup in project sldeditor by robward-scisys.
the class RasterSymbolizerDetails method extractContrastEnhancementGroup.
/**
* Extract contrast enhancement group.
*
* @param channelGroup the channel group
* @param contrastGroup the contrast group
* @param gammaField the gamma field
* @param contrastMethod the contrast method
* @return the selected channel type
*/
private SelectedChannelType extractContrastEnhancementGroup(GroupIdEnum channelGroup, GroupIdEnum contrastGroup, FieldIdEnum gammaField, GroupIdEnum contrastMethod) {
SelectedChannelType channelType = null;
GroupConfigInterface group = getGroup(channelGroup);
if (group.isPanelEnabled()) {
Expression channelName = this.vendorOptionRasterFactory.getChannelName(channelGroup);
GroupConfigInterface contrastGrp = getGroup(contrastGroup);
ContrastEnhancement contrastEnhancement = null;
if (contrastGrp.isPanelEnabled()) {
Expression gammaExpression = fieldConfigVisitor.getExpression(gammaField);
GroupConfigInterface constrastMethodGroup = getGroup(contrastMethod);
if (constrastMethodGroup != null) {
String method = null;
MultiOptionGroup constrastMethodGroup2 = (MultiOptionGroup) constrastMethodGroup;
OptionGroup selectedOption = constrastMethodGroup2.getSelectedOptionGroup();
if (selectedOption != null) {
method = selectedOption.getLabel();
}
contrastEnhancement = (ContrastEnhancement) getStyleFactory().contrastEnhancement(gammaExpression, method);
}
}
channelType = getStyleFactory().createSelectedChannelType(channelName, contrastEnhancement);
}
return channelType;
}
use of com.sldeditor.ui.detail.config.base.OptionGroup in project sldeditor by robward-scisys.
the class TextSymbolizerDetails method updateSymbol.
/**
* Update symbol.
*/
private void updateSymbol() {
if (!Controller.getInstance().isPopulating()) {
Expression haloRadius = fieldConfigVisitor.getExpression(FieldIdEnum.HALO_RADIUS);
// Label placement
LabelPlacement labelPlacement = null;
MultiOptionGroup labelPlacementPanel = (MultiOptionGroup) getGroup(GroupIdEnum.PLACEMENT);
OptionGroup labelPlacementOption = labelPlacementPanel.getSelectedOptionGroup();
if (labelPlacementOption.getId() == GroupIdEnum.POINTPLACEMENT) {
labelPlacement = updatePointPlacement();
} else if (labelPlacementOption.getId() == GroupIdEnum.LINEPLACEMENT) {
labelPlacement = updateLinePlacement();
}
FieldConfigColour fdmFillColour = (FieldConfigColour) fieldConfigManager.get(FieldIdEnum.FILL_COLOUR);
Expression fillColour = fdmFillColour.getColourExpression();
Expression fillColourOpacity = fieldConfigVisitor.getExpression(FieldIdEnum.TEXT_OPACITY);
Fill fill = getStyleFactory().createFill(fillColour, fillColourOpacity);
FieldConfigColour fdmHaloColour = (FieldConfigColour) fieldConfigManager.get(FieldIdEnum.HALO_COLOUR);
Expression haloFillColour = fdmHaloColour.getColourExpression();
Expression haloFillColourOpacity = fdmHaloColour.getColourOpacityExpression();
Fill haloFill = getStyleFactory().fill(null, haloFillColour, haloFillColourOpacity);
//
// Halo
//
Halo halo = updateHalo(haloRadius, haloFill);
//
// Font
//
Font font = extractFont();
// Any changes made to the font details need to be reflected
// back to the FieldConfigFontPreview field
fieldConfigVisitor.populateFontField(FieldIdEnum.FONT_PREVIEW, font);
StandardData standardData = getStandardData();
Expression label = fieldConfigVisitor.getExpression(FieldIdEnum.LABEL);
Expression geometryField = fieldConfigVisitor.getExpression(FieldIdEnum.GEOMETRY);
String geometryFieldName = null;
Expression defaultGeometryField = getFilterFactory().property(geometryFieldName);
TextSymbolizer textSymbolizer = getStyleFactory().textSymbolizer(standardData.getName(), defaultGeometryField, standardData.getDescription(), (standardData.getUnit() != null) ? standardData.getUnit().getUnit() : null, label, font, labelPlacement, halo, fill);
if ((geometryField != null) && !geometryField.toString().isEmpty()) {
textSymbolizer.setGeometry(geometryField);
}
if (vendorOptionTextFactory != null) {
vendorOptionTextFactory.updateSymbol(textSymbolizer);
}
SelectedSymbol.getInstance().replaceSymbolizer(textSymbolizer);
this.fireUpdateSymbol();
}
}
Aggregations