use of org.geotools.styling.Rule in project sldeditor by robward-scisys.
the class SelectedSymbol method updateInternalData.
/**
* Update internal data based on the supplied mask.
*
* @param maskValue the mask value
*/
private void updateInternalData(SelectedSymbolMask.SymbolMaskEnum maskValue) {
SymbolData localSymbolData = new SymbolData();
SelectedSymbolMask mask = new SelectedSymbolMask(maskValue);
if (sld == null) {
return;
}
StyledLayer[] styledLayers = sld.getStyledLayers();
if (styledLayers != null) {
localSymbolData.initialiseSelectedStyledLayerIndex();
for (StyledLayer styledLayer : styledLayers) {
localSymbolData.setStyledLayer(styledLayer);
if (styledLayer == symbolData.getStyledLayer()) {
this.symbolData.update(localSymbolData);
return;
}
List<Style> styleList = null;
if ((styledLayer instanceof NamedLayerImpl) && mask.shouldContinue(SelectedSymbolMask.SymbolMaskEnum.E_STYLED_LAYER)) {
NamedLayerImpl namedLayerImpl = (NamedLayerImpl) styledLayer;
styleList = namedLayerImpl.styles();
} else if ((styledLayer instanceof UserLayerImpl) && mask.shouldContinue(SelectedSymbolMask.SymbolMaskEnum.E_STYLED_LAYER)) {
UserLayerImpl userLayerImpl = (UserLayerImpl) styledLayer;
styleList = userLayerImpl.userStyles();
}
if (mask.shouldContinue(SelectedSymbolMask.SymbolMaskEnum.E_STYLE) && (styleList != null)) {
localSymbolData.initialiseSelectedStyleIndex();
for (Style style : styleList) {
localSymbolData.setStyle(style);
if (style == symbolData.getStyle()) {
this.symbolData.update(localSymbolData);
return;
}
if (mask.shouldContinue(SelectedSymbolMask.SymbolMaskEnum.E_FEATURE_TYPE_STYLE)) {
localSymbolData.initialiseSelectedFTSIndex();
for (FeatureTypeStyle fts : style.featureTypeStyles()) {
localSymbolData.setFeatureTypeStyle(fts);
if (fts == symbolData.getFeatureTypeStyle()) {
this.symbolData.update(localSymbolData);
return;
}
if (mask.shouldContinue(SelectedSymbolMask.SymbolMaskEnum.E_RULE)) {
localSymbolData.initialiseSelectedRuleIndex();
for (Rule rule : fts.rules()) {
localSymbolData.setRule(rule);
if (rule == symbolData.getRule()) {
this.symbolData.update(localSymbolData);
return;
}
if (mask.shouldContinue(SelectedSymbolMask.SymbolMaskEnum.E_SYMBOLIZER)) {
localSymbolData.initialiseSelectedSymbolizerIndex();
for (Symbolizer symbol : rule.symbolizers()) {
localSymbolData.setSymbolizer(symbol);
if (symbol == this.symbolData.getSymbolizer()) {
this.symbolData.update(localSymbolData);
return;
} else {
localSymbolData.incrementSelectedSymbolizerIndex();
}
}
}
localSymbolData.incrementSelectedRuleIndex();
}
}
localSymbolData.incrementSelectedFTSIndex();
}
}
localSymbolData.incrementSelectedStyleIndex();
}
}
localSymbolData.incrementSelectedStyledLayerIndex();
}
}
}
use of org.geotools.styling.Rule in project sldeditor by robward-scisys.
the class DefaultSymbols method createNewRule.
/**
* Creates the new rule.
*
* @return the rule
*/
public static Rule createNewRule() {
Rule rule = styleFactory.createRule();
rule.setName(Localisation.getString(SLDTreeTools.class, "TreeItem.newRule"));
return rule;
}
use of org.geotools.styling.Rule in project sldeditor by robward-scisys.
the class DefaultSymbols method createNewLine.
/**
* Creates a new line symbol.
*
* @return the styled layer descriptor
*/
public static StyledLayerDescriptor createNewLine() {
StyledLayerDescriptor sld = styleFactory.createStyledLayerDescriptor();
NamedLayer namedLayer = styleFactory.createNamedLayer();
sld.addStyledLayer(namedLayer);
Style style = styleFactory.createStyle();
namedLayer.addStyle(style);
List<FeatureTypeStyle> ftsList = style.featureTypeStyles();
FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();
ftsList.add(fts);
Rule rule = styleFactory.createRule();
fts.rules().add(rule);
LineSymbolizer line = createDefaultLineSymbolizer();
rule.symbolizers().add(line);
return sld;
}
use of org.geotools.styling.Rule in project sldeditor by robward-scisys.
the class DefaultSymbols method createNewPoint.
/**
* Creates a new point symbol.
*
* @return the styled layer descriptor
*/
public static StyledLayerDescriptor createNewPoint() {
StyledLayerDescriptor sld = styleFactory.createStyledLayerDescriptor();
NamedLayer namedLayer = styleFactory.createNamedLayer();
sld.addStyledLayer(namedLayer);
Style style = styleFactory.createStyle();
namedLayer.addStyle(style);
List<FeatureTypeStyle> ftsList = style.featureTypeStyles();
FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();
ftsList.add(fts);
Rule rule = styleFactory.createRule();
fts.rules().add(rule);
PointSymbolizer point = createDefaultPointSymbolizer();
rule.symbolizers().add(point);
return sld;
}
use of org.geotools.styling.Rule in project sldeditor by robward-scisys.
the class DefaultSymbols method createNewRaster.
/**
* Creates the new raster symbol.
*
* @return the styled layer descriptor
*/
public static StyledLayerDescriptor createNewRaster() {
StyledLayerDescriptor sld = styleFactory.createStyledLayerDescriptor();
NamedLayer namedLayer = styleFactory.createNamedLayer();
sld.addStyledLayer(namedLayer);
Style style = styleFactory.createStyle();
namedLayer.addStyle(style);
List<FeatureTypeStyle> ftsList = style.featureTypeStyles();
FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();
ftsList.add(fts);
Rule rule = styleFactory.createRule();
fts.rules().add(rule);
RasterSymbolizer raster = createDefaultRasterSymbolizer();
rule.symbolizers().add(raster);
return sld;
}
Aggregations