本文整理汇总了Java中org.geotools.styling.FeatureTypeStyle.rules方法的典型用法代码示例。如果您正苦于以下问题:Java FeatureTypeStyle.rules方法的具体用法?Java FeatureTypeStyle.rules怎么用?Java FeatureTypeStyle.rules使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.geotools.styling.FeatureTypeStyle
的用法示例。
在下文中一共展示了FeatureTypeStyle.rules方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldRenderSymbol
import org.geotools.styling.FeatureTypeStyle; //导入方法依赖的package包/类
/**
* Should render symbol.
*
* @param style the style
* @param ruleToRender the rule to render
* @return true, if successful
*/
private boolean shouldRenderSymbol(Style style, FeatureTypeStyle ftsToRender,
Rule ruleToRender) {
if (ruleToRender == null) {
return true;
}
for (FeatureTypeStyle fts : style.featureTypeStyles()) {
if (fts == ftsToRender) {
for (Rule rule : fts.rules()) {
if (rule == ruleToRender) {
return true;
}
}
}
}
return false;
}
示例2: isRasterSymbol
import org.geotools.styling.FeatureTypeStyle; //导入方法依赖的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: updateSymbol
import org.geotools.styling.FeatureTypeStyle; //导入方法依赖的package包/类
/**
* Update symbol.
*/
private void updateSymbol() {
if (!Controller.getInstance().isPopulating()) {
StandardData standardData = getStandardData();
Expression transformation = fieldConfigVisitor
.getExpression(FieldIdEnum.TRANSFORMATION);
FeatureTypeStyle existingFTS = SelectedSymbol.getInstance().getFeatureTypeStyle();
if (existingFTS != null) {
List<org.opengis.style.Rule> newRuleList = new ArrayList<org.opengis.style.Rule>();
for (org.opengis.style.Rule rule : existingFTS.rules()) {
newRuleList.add(rule);
}
FeatureTypeStyle fts = (FeatureTypeStyle) getStyleFactory().featureTypeStyle(
standardData.name, (org.opengis.style.Description) standardData.description,
existingFTS.getFeatureInstanceIDs(), existingFTS.featureTypeNames(),
existingFTS.semanticTypeIdentifiers(), newRuleList);
if (transformation != null) {
fts.setTransformation(transformation);
}
if (vendorOptionFTSFactory != null) {
vendorOptionFTSFactory.updateSymbol(fts);
}
SelectedSymbol.getInstance().replaceFeatureTypeStyle(fts);
this.fireUpdateSymbol();
}
}
}
示例4: internal_determineGeometryType
import org.geotools.styling.FeatureTypeStyle; //导入方法依赖的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;
}
示例5: containsFonts
import org.geotools.styling.FeatureTypeStyle; //导入方法依赖的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;
}
示例6: containsScales
import org.geotools.styling.FeatureTypeStyle; //导入方法依赖的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;
}
示例7: populateSLD
import org.geotools.styling.FeatureTypeStyle; //导入方法依赖的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);
}
}
}
}
}
}
}
}
}
}
}
示例8: findMinimumVersion
import org.geotools.styling.FeatureTypeStyle; //导入方法依赖的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();
}
示例9: findSymbolizer
import org.geotools.styling.FeatureTypeStyle; //导入方法依赖的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;
}
示例10: findRule
import org.geotools.styling.FeatureTypeStyle; //导入方法依赖的package包/类
/**
* Find rule.
*
* @param sld the sld
* @param ruleToFind the rule to find
* @param otherSLD the other SLD
* @return the rule
*/
public static Rule findRule(StyledLayerDescriptor sld, Rule ruleToFind,
StyledLayerDescriptor otherSLD) {
if (sld != null) {
List<StyledLayer> styledLayerList = sld.layers();
if (styledLayerList != null) {
int styledLayerIndex = 0;
int styleIndex = 0;
int ftsIndex = 0;
int ruleIndex = 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()) {
if (rule == ruleToFind) {
return findEquivalentRule(otherSLD, styledLayerIndex,
isNamedLayer, styleIndex, ftsIndex, ruleIndex);
}
ruleIndex++;
}
ftsIndex++;
}
styleIndex++;
}
}
styledLayerIndex++;
}
}
}
return null;
}
示例11: externalGraphicSymbolVisitor
import org.geotools.styling.FeatureTypeStyle; //导入方法依赖的package包/类
/**
* Find the SLD graphical symbols.
*
* @param resourceLocator the resource locator
* @param sld the sld
* @param externalImageList the external image list
* @param process the process
*/
private static void externalGraphicSymbolVisitor(URL resourceLocator,
StyledLayerDescriptor sld, List<String> externalImageList,
ProcessGraphicSymbolInterface process) {
if (sld == null) {
return;
}
if (process == null) {
return;
}
for (StyledLayer styledLayer : sld.layers()) {
List<Style> styles = null;
if (styledLayer instanceof NamedLayer) {
NamedLayerImpl namedLayer = (NamedLayerImpl) styledLayer;
styles = namedLayer.styles();
} else if (styledLayer instanceof UserLayer) {
UserLayerImpl userLayer = (UserLayerImpl) styledLayer;
styles = userLayer.userStyles();
}
if (styles != null) {
for (Style style : styles) {
for (FeatureTypeStyle fts : style.featureTypeStyles()) {
for (Rule rule : fts.rules()) {
for (Symbolizer symbolizer : rule.symbolizers()) {
if (symbolizer instanceof PointSymbolizer) {
PointSymbolizer point = (PointSymbolizer) symbolizer;
if (point.getGraphic() != null) {
process.processGraphicalSymbol(resourceLocator,
point.getGraphic().graphicalSymbols(),
externalImageList);
}
} else if (symbolizer instanceof LineSymbolizer) {
LineSymbolizer line = (LineSymbolizer) symbolizer;
updateStroke(resourceLocator, line.getStroke(),
externalImageList,
process);
} else if (symbolizer instanceof PolygonSymbolizer) {
PolygonSymbolizer polygon = (PolygonSymbolizer) symbolizer;
updateStroke(resourceLocator, polygon.getStroke(),
externalImageList,
process);
updateFill(resourceLocator, polygon.getFill(),
externalImageList,
process);
}
}
}
}
}
}
}
}