use of org.geotools.styling.FeatureTypeStyle 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.FeatureTypeStyle 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;
}
use of org.geotools.styling.FeatureTypeStyle in project sldeditor by robward-scisys.
the class MinimumVersion method findMinimumVersion.
/**
* Find minimum version.
*
* @param sld the sld
*/
public void findMinimumVersion(StyledLayerDescriptor sld) {
vendorOptionsPresentList.clear();
Object parentObj = null;
if ((sld != null) && (uiMgr != null)) {
uiMgr.getMinimumVersion(parentObj, sld, vendorOptionsPresentList);
List<StyledLayer> styledLayerList = sld.layers();
if (styledLayerList != null) {
parentObj = sld;
for (StyledLayer styledLayer : styledLayerList) {
uiMgr.getMinimumVersion(parentObj, styledLayer, vendorOptionsPresentList);
List<Style> styleList = null;
if (styledLayer instanceof NamedLayerImpl) {
NamedLayerImpl namedLayerImpl = (NamedLayerImpl) styledLayer;
styleList = namedLayerImpl.styles();
} else if (styledLayer instanceof UserLayerImpl) {
UserLayerImpl userLayerImpl = (UserLayerImpl) styledLayer;
styleList = userLayerImpl.userStyles();
}
if (styleList != null) {
parentObj = styledLayer;
for (Style style : styleList) {
uiMgr.getMinimumVersion(parentObj, style, vendorOptionsPresentList);
parentObj = style;
for (FeatureTypeStyle fts : style.featureTypeStyles()) {
uiMgr.getMinimumVersion(parentObj, fts, vendorOptionsPresentList);
parentObj = fts;
for (Rule rule : fts.rules()) {
uiMgr.getMinimumVersion(parentObj, rule, vendorOptionsPresentList);
parentObj = rule;
for (Symbolizer symbolizer : rule.symbolizers()) {
uiMgr.getMinimumVersion(parentObj, symbolizer, vendorOptionsPresentList);
}
}
}
}
}
}
}
}
removeStrictSLD();
}
use of org.geotools.styling.FeatureTypeStyle in project sldeditor by robward-scisys.
the class NewRasterSLD method create.
/**
* Creates the symbol.
*
* @return the styled layer descriptor
*/
/* (non-Javadoc)
* @see com.sldeditor.create.NewSLDInterface#create()
*/
@Override
public StyledLayerDescriptor create() {
StyledLayerDescriptor sld = getStyleFactory().createStyledLayerDescriptor();
NamedLayer namedLayer = getStyleFactory().createNamedLayer();
sld.addStyledLayer(namedLayer);
Style style = getStyleFactory().createStyle();
namedLayer.addStyle(style);
List<FeatureTypeStyle> ftsList = style.featureTypeStyles();
FeatureTypeStyle fts = getStyleFactory().createFeatureTypeStyle();
ftsList.add(fts);
Rule rule = getStyleFactory().createRule();
fts.rules().add(rule);
RasterSymbolizer raster = DefaultSymbols.createDefaultRasterSymbolizer();
rule.symbolizers().add(raster);
return sld;
}
use of org.geotools.styling.FeatureTypeStyle in project sldeditor by robward-scisys.
the class ExtractAttributes method visit.
/**
* (non-Javadoc)
*
* @see org.geotools.styling.visitor.DuplicatingStyleVisitor#visit(org.geotools.styling.
* FeatureTypeStyle)
*/
public void visit(FeatureTypeStyle fts) {
FeatureTypeStyle copy = new FeatureTypeStyleImpl(fts);
Rule[] rules = fts.getRules();
int length = rules.length;
Rule[] rulesCopy = new Rule[length];
for (int i = 0; i < length; i++) {
if (rules[i] != null) {
rules[i].accept(this);
rulesCopy[i] = (Rule) pages.pop();
}
}
copy.setRules(rulesCopy);
if (fts.getTransformation() != null) {
copy.setTransformation(copy(fts.getTransformation()));
}
if (fts.getOnlineResource() != null) {
copy.setOnlineResource(fts.getOnlineResource());
}
copy.getOptions().clear();
copy.getOptions().putAll(fts.getOptions());
String sortbyGroup = fts.getOptions().get(FeatureTypeStyle.SORT_BY_GROUP);
if (sortbyGroup != null) {
List<String> foundList = new ArrayList<String>();
extractAttribute(String.class, ff.property(sortbyGroup), foundList);
}
String sortby = fts.getOptions().get(FeatureTypeStyle.SORT_BY);
if (sortby != null) {
SortBy[] sortByArray = SLDStyleFactory.getSortBy(fts.getOptions());
for (SortBy sortBy : sortByArray) {
List<String> foundList = new ArrayList<String>();
extractAttribute(String.class, ff.property(sortBy.getPropertyName().getPropertyName()), foundList);
}
}
if (STRICT && !copy.equals(fts)) {
throw new IllegalStateException("Was unable to duplicate provided FeatureTypeStyle:" + fts);
}
pages.push(copy);
}
Aggregations