本文整理汇总了Java中org.geotools.styling.Style.featureTypeStyles方法的典型用法代码示例。如果您正苦于以下问题:Java Style.featureTypeStyles方法的具体用法?Java Style.featureTypeStyles怎么用?Java Style.featureTypeStyles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.geotools.styling.Style
的用法示例。
在下文中一共展示了Style.featureTypeStyles方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateSymbol
import org.geotools.styling.Style; //导入方法依赖的package包/类
/**
* Update symbol.
*/
private void updateSymbol() {
if (!Controller.getInstance().isPopulating()) {
StandardData standardData = getStandardData();
boolean isDefault = fieldConfigVisitor.getBoolean(FieldIdEnum.DEFAULT_STYLE);
Style existingStyle = SelectedSymbol.getInstance().getStyle();
if (existingStyle != null) {
List<org.opengis.style.FeatureTypeStyle> newFTSList =
new ArrayList<org.opengis.style.FeatureTypeStyle>();
for (org.opengis.style.FeatureTypeStyle fts : existingStyle.featureTypeStyles()) {
newFTSList.add(fts);
}
Symbolizer defaultSymbolizer = null;
Style newStyle = (Style) getStyleFactory().style(standardData.name,
standardData.description, isDefault, newFTSList, defaultSymbolizer);
SelectedSymbol.getInstance().replaceStyle(newStyle);
this.fireUpdateSymbol();
}
}
}
示例2: isRasterSymbol
import org.geotools.styling.Style; //导入方法依赖的package包/类
/**
* Checks if the selected Style contains a raster symbol.
*
* @return true, if is raster symbol
*/
public boolean isRasterSymbol() {
Style style = getStyle();
if (style != null) {
for (FeatureTypeStyle fts : style.featureTypeStyles()) {
for (Rule rule : fts.rules()) {
for (Symbolizer symbolizer : rule.symbolizers()) {
if (symbolizer instanceof RasterSymbolizer) {
return true;
}
}
}
}
}
return false;
}
示例3: getFeatureFilterFromStyle
import org.geotools.styling.Style; //导入方法依赖的package包/类
/**
* Retrieve Filter information from the Layer Style.
* TODO maybe there is a better method to do that e.g. using a {@link org.geotools.styling.StyleVisitor}
*
* @param style the style of the layer
* @param ff the filter factory to create (concat) filters
* @param currentScaleDenominator the current scale denominator of the reuquested tiles
*
* @return The filter containing all relevant filters for the current solutions or null if no filter is difined.
*/
private Filter getFeatureFilterFromStyle(Style style, FilterFactory2 ff, double currentScaleDenominator) {
List<Filter> filter = new ArrayList<>();
for (FeatureTypeStyle featureTypeStyle : style.featureTypeStyles()) {
for (Rule rule : featureTypeStyle.rules()) {
if ((rule.getMaxScaleDenominator() < Double.POSITIVE_INFINITY && currentScaleDenominator < rule.getMaxScaleDenominator())
|| (rule.getMinScaleDenominator() > 0 && currentScaleDenominator > rule.getMinScaleDenominator())) {
if (rule.getFilter() != null) {
filter.add(rule.getFilter());
}
} else if (rule.getMinScaleDenominator() == 0 && rule.getMaxScaleDenominator() == Double.POSITIVE_INFINITY) {
//No Scale denominator defined so render all
if (rule.getFilter() == null) {
return null;
} else {
filter.add(rule.getFilter());
}
}
}
}
return filter.isEmpty() ? null : ff.or(filter);
}
示例4: getRasterSymbolizerRule
import org.geotools.styling.Style; //导入方法依赖的package包/类
/**
* Find the first rule which contains a rastersymbolizer, and return it
*
* @param s
* A style to search in
* @return a rule, or null if no raster symbolizers are found.
*/
public static Rule getRasterSymbolizerRule(final Style s) {
final List<FeatureTypeStyle> fts = s.featureTypeStyles();
for (int i = 0; i < fts.size(); i++) {
final FeatureTypeStyle featureTypeStyle = fts.get(i);
final List<Rule> rules = featureTypeStyle.rules();
for (int j = 0; j < rules.size(); j++) {
final Rule rule = rules.get(j);
final Symbolizer[] symbolizers = rule.getSymbolizers();
for (int k = 0; k < symbolizers.length; k++) {
final Symbolizer symbolizer = symbolizers[k];
if (symbolizer instanceof RasterSymbolizer) {
return rule;
}
}
}
}
return null;
}
示例5: hasOnlyOneRule
import org.geotools.styling.Style; //导入方法依赖的package包/类
/**
* Checks for only one rule.
*
* @return true, if successful
*/
public boolean hasOnlyOneRule() {
boolean oneRule = false;
StyledLayer[] styledLayers = sld.getStyledLayers();
int noOfRules = 0;
if (styledLayers != null) {
for (StyledLayer styledLayer : styledLayers) {
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) {
for (Style style : styleList) {
for (FeatureTypeStyle fts : style.featureTypeStyles()) {
noOfRules += fts.rules().size();
}
}
}
}
}
oneRule = (noOfRules == 1);
logger.debug(String.format("Number of rules : %d", noOfRules));
return oneRule;
}
示例6: getDefaultStyle
import org.geotools.styling.Style; //导入方法依赖的package包/类
public static Style getDefaultStyle(final StyledLayerDescriptor sld) {
final Style[] styles = styles(sld);
for (int i = 0; i < styles.length; i++) {
final Style style = styles[i];
final List<FeatureTypeStyle> ftStyles = style.featureTypeStyles();
genericizeftStyles(ftStyles);
if (style.isDefault()) {
return style;
}
}
// no default, so just grab the first one
return styles[0];
}
示例7: getFeatureTypeStyle
import org.geotools.styling.Style; //导入方法依赖的package包/类
/**
* gets the first FeatureTypeStyle
*/
public static FeatureTypeStyle getFeatureTypeStyle(final Style s) {
final List<FeatureTypeStyle> fts = s.featureTypeStyles();
if (fts.size() > 0) {
return fts.get(0);
}
return null;
}
示例8: getDefaultStyle
import org.geotools.styling.Style; //导入方法依赖的package包/类
public static Style getDefaultStyle(StyledLayerDescriptor sld) {
Style[] styles = SLD.styles(sld);
for (int i = 0; i < styles.length; i++) {
Style style = styles[i];
List<FeatureTypeStyle> ftStyles = style.featureTypeStyles();
genericizeftStyles(ftStyles);
if (style.isDefault()) {
return style;
}
}
// no default, so just grab the first one
return styles[0];
}
示例9: StyleWrapper
import org.geotools.styling.Style; //导入方法依赖的package包/类
public StyleWrapper(Style style) {
this.style = style;
name = style.getName();
List<FeatureTypeStyle> featureTypeStyles = style.featureTypeStyles();
for (FeatureTypeStyle featureTypeStyle : featureTypeStyles) {
FeatureTypeStyleWrapper fstW = new FeatureTypeStyleWrapper(featureTypeStyle, this);
featureTypeStylesWrapperList.add(fstW);
}
}
示例10: internal_determineGeometryType
import org.geotools.styling.Style; //导入方法依赖的package包/类
/**
* Internal determine geometry type.
*
* @param sld the sld
* @return the geometry type enum
*/
protected GeometryTypeEnum internal_determineGeometryType(StyledLayerDescriptor sld) {
GeometryTypeEnum geometryType = GeometryTypeEnum.UNKNOWN;
if (sld != null) {
List<StyledLayer> styledLayerList = sld.layers();
int pointCount = 0;
int lineCount = 0;
int polygonCount = 0;
int rasterCount = 0;
for (StyledLayer styledLayer : styledLayerList) {
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) {
for (Style style : styleList) {
for (FeatureTypeStyle fts : style.featureTypeStyles()) {
for (Rule rule : fts.rules()) {
for (org.opengis.style.Symbolizer symbolizer : rule.symbolizers()) {
if (symbolizer instanceof PointSymbolizer) {
pointCount++;
} else if (symbolizer instanceof LineSymbolizer) {
lineCount++;
} else if (symbolizer instanceof PolygonSymbolizer) {
polygonCount++;
} else if (symbolizer instanceof RasterSymbolizer) {
rasterCount++;
}
}
}
}
}
}
}
if (polygonCount > 0) {
geometryType = GeometryTypeEnum.POLYGON;
} else if (lineCount > 0) {
geometryType = GeometryTypeEnum.LINE;
} else if (pointCount > 0) {
geometryType = GeometryTypeEnum.POINT;
} else if (rasterCount > 0) {
geometryType = GeometryTypeEnum.RASTER;
}
}
return geometryType;
}
示例11: containsFonts
import org.geotools.styling.Style; //导入方法依赖的package包/类
/**
* Contains font details.
*
* @param sldData the sld data
* @return the scale sld data
*/
public static List<BatchUpdateFontData> containsFonts(SLDDataInterface sldData) {
List<BatchUpdateFontData> dataList = null;
if (sldData != null) {
StyledLayerDescriptor sld = SLDUtils.createSLDFromString(sldData);
if (sld != null) {
List<StyledLayer> styledLayerList = sld.layers();
if (sld != null) {
for (StyledLayer styledLayer : styledLayerList) {
if (styledLayer instanceof NamedLayerImpl) {
NamedLayerImpl namedLayerImpl = (NamedLayerImpl) styledLayer;
for (Style style : namedLayerImpl.styles()) {
for (FeatureTypeStyle fts : style.featureTypeStyles()) {
for (Rule rule : fts.rules()) {
for (Symbolizer symbolizer : rule.symbolizers()) {
if (symbolizer instanceof TextSymbolizer) {
TextSymbolizer textSymbol =
(TextSymbolizer) symbolizer;
Font font = textSymbol.getFont();
if (font != null) {
if (dataList == null) {
dataList =
new ArrayList<BatchUpdateFontData>();
}
BatchUpdateFontData fontSLDData =
new BatchUpdateFontData(
sld, sldData);
fontSLDData.setNamedLayer(
namedLayerImpl.getName());
fontSLDData.setFeatureTypeStyle(fts.getName());
fontSLDData.setStyle(style.getName());
fontSLDData.setRule(rule);
fontSLDData.setSymbolizer(textSymbol);
fontSLDData.setFont(font);
dataList.add(fontSLDData);
}
}
}
}
}
}
}
}
}
}
}
return dataList;
}
示例12: containsScales
import org.geotools.styling.Style; //导入方法依赖的package包/类
/**
* Contains scales.
*
* @param sldData the sld data
* @return the scale sld data
*/
public static List<ScaleSLDData> containsScales(SLDDataInterface sldData) {
List<ScaleSLDData> dataList = null;
StyledLayerDescriptor sld = SLDUtils.createSLDFromString(sldData);
if (sld != null) {
List<StyledLayer> styledLayerList = sld.layers();
if (sld != null) {
for (StyledLayer styledLayer : styledLayerList) {
if (styledLayer instanceof NamedLayerImpl) {
NamedLayerImpl namedLayerImpl = (NamedLayerImpl) styledLayer;
for (Style style : namedLayerImpl.styles()) {
for (FeatureTypeStyle fts : style.featureTypeStyles()) {
for (Rule rule : fts.rules()) {
double minScale = rule.getMinScaleDenominator();
double maxScale = rule.getMaxScaleDenominator();
if ((minScale > 0.0) || (maxScale > 0.0)) {
if (dataList == null) {
dataList = new ArrayList<ScaleSLDData>();
}
ScaleSLDData scaleSLDData = new ScaleSLDData(sld, sldData);
scaleSLDData.setNamedLayer(namedLayerImpl.getName());
scaleSLDData.setFeatureTypeStyle(fts.getName());
scaleSLDData.setStyle(style.getName());
scaleSLDData.setRule(rule);
if (minScale > 0.0) {
scaleSLDData.setMinScale(minScale);
}
if (maxScale > 0.0) {
scaleSLDData.setMaxScale(maxScale);
}
dataList.add(scaleSLDData);
}
}
}
}
}
}
}
}
return dataList;
}
示例13: populateSLD
import org.geotools.styling.Style; //导入方法依赖的package包/类
@Override
public void populateSLD() {
reset();
SelectedSymbol selectedSymbol = SelectedSymbol.getInstance();
if (selectedSymbol != null) {
StyledLayerDescriptor sld = selectedSymbol.getSld();
rootNode.setUserObject(sld);
treeModel.nodeChanged(rootNode);
if (sld != null) {
List<StyledLayer> styledLayerList = sld.layers();
if (styledLayerList != null) {
for (StyledLayer styledLayer : styledLayerList) {
DefaultMutableTreeNode styledLayerTreeNode = null;
List<Style> styleList = null;
if (styledLayer instanceof NamedLayerImpl) {
NamedLayerImpl namedLayerImpl = (NamedLayerImpl) styledLayer;
styleList = namedLayerImpl.styles();
styledLayerTreeNode = addObject(rootNode, namedLayerImpl, true);
} else if (styledLayer instanceof UserLayerImpl) {
UserLayerImpl userLayerImpl = (UserLayerImpl) styledLayer;
styleList = userLayerImpl.userStyles();
styledLayerTreeNode = addObject(rootNode, userLayerImpl, true);
}
if (styleList != null) {
for (Style style : styleList) {
DefaultMutableTreeNode styleTreeNode = addObject(
styledLayerTreeNode, style, true);
for (FeatureTypeStyle fts : style.featureTypeStyles()) {
DefaultMutableTreeNode ftsTreeNode = addObject(styleTreeNode,
fts, true);
for (Rule rule : fts.rules()) {
DefaultMutableTreeNode ruleTreeNode = addObject(ftsTreeNode,
rule, true);
for (Symbolizer symbolizer : rule.symbolizers()) {
DefaultMutableTreeNode symbolizerTreeNode = addObject(
ruleTreeNode, symbolizer, true);
if ((symbolizer instanceof PointSymbolizer)
|| (symbolizer instanceof PolygonSymbolizer)) {
addObject(
symbolizerTreeNode, SLDTreeLeafFactory
.getInstance().getFill(symbolizer),
true);
}
if ((symbolizer instanceof PolygonSymbolizer)
|| (symbolizer instanceof LineSymbolizer)) {
addObject(symbolizerTreeNode, SLDTreeLeafFactory
.getInstance().getStroke(symbolizer), true);
}
if (symbolizer instanceof RasterSymbolizer) {
handleRasterSymbolizer(symbolizer,
symbolizerTreeNode);
}
}
}
}
}
}
}
}
}
}
}
示例14: findMinimumVersion
import org.geotools.styling.Style; //导入方法依赖的package包/类
/**
* 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();
}
示例15: findSymbolizer
import org.geotools.styling.Style; //导入方法依赖的package包/类
/**
* Find symbolizer.
*
* @param sld the sld
* @param symbolizerToFind the symbolizer to find
* @param otherSLD the other SLD
* @return the symbolizer
*/
public static Symbolizer findSymbolizer(StyledLayerDescriptor sld, Symbolizer symbolizerToFind,
StyledLayerDescriptor otherSLD) {
List<StyledLayer> styledLayerList = sld.layers();
if (styledLayerList != null) {
int styledLayerIndex = 0;
int styleIndex = 0;
int ftsIndex = 0;
int ruleIndex = 0;
int symbolizerIndex = 0;
boolean isNamedLayer = true;
for (StyledLayer styledLayer : styledLayerList) {
List<Style> styleList = null;
if (styledLayer instanceof NamedLayerImpl) {
NamedLayerImpl namedLayerImpl = (NamedLayerImpl) styledLayer;
styleList = namedLayerImpl.styles();
isNamedLayer = true;
} else if (styledLayer instanceof UserLayerImpl) {
UserLayerImpl userLayerImpl = (UserLayerImpl) styledLayer;
styleList = userLayerImpl.userStyles();
isNamedLayer = false;
}
if (styleList != null) {
styleIndex = 0;
for (Style style : styleList) {
ftsIndex = 0;
for (FeatureTypeStyle fts : style.featureTypeStyles()) {
ruleIndex = 0;
for (Rule rule : fts.rules()) {
symbolizerIndex = 0;
for (org.opengis.style.Symbolizer symbolizer : rule.symbolizers()) {
if (symbolizer == symbolizerToFind) {
return findEquivalentSymbolizer(otherSLD, styledLayerIndex,
isNamedLayer, styleIndex, ftsIndex, ruleIndex,
symbolizerIndex);
}
symbolizerIndex++;
}
ruleIndex++;
}
ftsIndex++;
}
styleIndex++;
}
}
styledLayerIndex++;
}
}
return null;
}