本文整理汇总了Java中org.geotools.styling.Rule.symbolizers方法的典型用法代码示例。如果您正苦于以下问题:Java Rule.symbolizers方法的具体用法?Java Rule.symbolizers怎么用?Java Rule.symbolizers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.geotools.styling.Rule
的用法示例。
在下文中一共展示了Rule.symbolizers方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convert
import org.geotools.styling.Rule; //导入方法依赖的package包/类
@Override
public void convert(Rule rule, JsonElement element, String layerName, int transparency) {
if(element == null) return;
if(rule == null) return;
JsonObject obj = element.getAsJsonObject();
@SuppressWarnings("unused")
int style = getInt(obj, CommonSymbolKeys.STYLE);
List<Symbolizer> symbolizerList = rule.symbolizers();
List<Stroke> strokeList = convert(obj);
Stroke stroke = null;
if(!strokeList.isEmpty())
{
stroke = strokeList.get(0);
}
LineSymbolizer lineSymbolizer = styleFactory.createLineSymbolizer(stroke, null);
symbolizerList.add(lineSymbolizer);
}
示例2: convert
import org.geotools.styling.Rule; //导入方法依赖的package包/类
/**
* Convert.
*
* @param rule the rule
* @param element the element
* @param layerName the layer name
* @param transparency the transparency
*/
@Override
public void convert(Rule rule, JsonElement element, String layerName, int transparency) {
if(rule == null) return;
if(element == null) return;
JsonObject obj = element.getAsJsonObject();
List<Symbolizer> symbolizerList = rule.symbolizers();
List<Stroke> strokeList = convert(obj);
Stroke stroke = null;
if(!strokeList.isEmpty())
{
stroke = strokeList.get(0);
}
LineSymbolizer lineSymbolizer = styleFactory.createLineSymbolizer(stroke, null);
symbolizerList.add(lineSymbolizer);
}
示例3: convert
import org.geotools.styling.Rule; //导入方法依赖的package包/类
@Override
public void convert(Rule rule, JsonElement element, String layerName, int transparency) {
if(element == null) return;
if(rule == null) return;
List<Symbolizer> symbolizerList = rule.symbolizers();
List<Graphic> markerList = convert(element);
if(markerList != null)
{
for(Graphic marker : markerList)
{
PointSymbolizer pointSymbolizer = styleFactory.createPointSymbolizer(marker, null);
symbolizerList.add(pointSymbolizer);
}
}
}
示例4: isRasterSymbol
import org.geotools.styling.Rule; //导入方法依赖的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;
}
示例5: convert
import org.geotools.styling.Rule; //导入方法依赖的package包/类
@Override
public void convert(Rule rule, JsonElement element, String layerName, int transparency) {
if(element == null) return;
if(rule == null) return;
JsonObject obj = element.getAsJsonObject();
@SuppressWarnings("unused")
int style = getInt(obj, CommonSymbolKeys.STYLE);
List<Symbolizer> symbolizerList = rule.symbolizers();
JsonElement jsonOutlineElement = obj.get(SimpleFillSymbolKeys.OUTLINE);
List<Stroke> strokeList = SymbolManager.getInstance().getStrokeList(jsonOutlineElement);
Stroke stroke = null;
if(strokeList != null)
{
if(!strokeList.isEmpty())
{
stroke = strokeList.get(0);
}
}
Expression fillColour = getColour(obj.get(SimpleFillSymbolKeys.FILL_COLOUR));
Fill fill = null;
if(fillColour != null)
{
fill = styleFactory.createFill(fillColour, getTransparency(transparency));
}
PolygonSymbolizer polygonSymbolizer = styleFactory.createPolygonSymbolizer(stroke, fill, null);
symbolizerList.add(polygonSymbolizer);
}
示例6: convert
import org.geotools.styling.Rule; //导入方法依赖的package包/类
/**
* Convert.
*
* @param rule the rule
* @param element the element
* @param layerName the layer name
* @param transparency the transparency
*/
@Override
public void convert(Rule rule, JsonElement element, String layerName, int transparency) {
if(rule == null) return;
if(element == null) return;
JsonArray layerArray = element.getAsJsonArray();
List<Symbolizer> symbolizerList = rule.symbolizers();
if(layerArray.size() > 0)
{
for(int index = 0; index < layerArray.size(); index ++)
{
JsonObject obj = layerArray.get(index).getAsJsonObject();
List<Stroke> strokeList = null;
JsonElement jsonOutlineElement = obj.get(MultiLayerLineSymbolKeys.LINE);
strokeList = SymbolManager.getInstance().getStrokeList(jsonOutlineElement);
if(strokeList != null)
{
for(Stroke stroke : strokeList)
{
LineSymbolizer lineSymbolizer = styleFactory.createLineSymbolizer(stroke, null);
symbolizerList.add(lineSymbolizer);
}
}
}
}
}
示例7: convert
import org.geotools.styling.Rule; //导入方法依赖的package包/类
/**
* Convert.
*
* @param rule the rule
* @param element the element
* @param layerName the layer name
* @param transparency the transparency
*/
@Override
public void convert(Rule rule, JsonElement element, String layerName, int transparency) {
if (rule == null)
return;
if (element == null)
return;
JsonArray layerArray = element.getAsJsonArray();
List<Symbolizer> symbolizerList = rule.symbolizers();
if (layerArray.size() > 0) {
for (int index = 0; index < layerArray.size(); index++) {
JsonObject obj = layerArray.get(index).getAsJsonObject();
JsonElement jsonElement = obj.get(MultiLayerMarkerSymbolKeys.MARKER);
if (jsonElement != null) {
JsonObject asJsonObject = jsonElement.getAsJsonObject();
if (asJsonObject != null) {
List<Graphic> markerList = SymbolManager.getInstance()
.getMarkerList(asJsonObject);
if (markerList != null) {
for (Graphic marker : markerList) {
PointSymbolizer pointSymbolizer = styleFactory
.createPointSymbolizer(marker, null);
symbolizerList.add(pointSymbolizer);
}
}
}
}
}
}
}
示例8: convert
import org.geotools.styling.Rule; //导入方法依赖的package包/类
@Override
public void convert(Rule rule, JsonElement element, String layerName, int transparency) {
if(rule == null) return;
if(element == null) return;
JsonArray layerArray = element.getAsJsonArray();
List<Symbolizer> symbolizerList = rule.symbolizers();
if(layerArray.size() > 0)
{
for(int index = 0; index < layerArray.size(); index ++)
{
JsonObject obj = layerArray.get(index).getAsJsonObject();
// Handle fills
List<Symbolizer> createdSymbolizerList = SymbolManager.getInstance().getFillSymbol(layerName, obj.get(MultiLayerFillSymbolKeys.FILL), transparency);
if(symbolizerList != null)
{
symbolizerList.addAll(createdSymbolizerList);
}
// Handle strokes
JsonElement jsonOutlineElement = obj.get(MultiLayerFillSymbolKeys.OUTLINE);
List<Stroke> strokeList = SymbolManager.getInstance().getStrokeList(jsonOutlineElement);
if(strokeList != null)
{
List<Symbolizer> createdLineSymbolizerList = new ArrayList<Symbolizer>();
for(Stroke stroke : strokeList)
{
LineSymbolizer lineSymbol = styleFactory.createLineSymbolizer();
lineSymbol.setStroke(stroke);
createdLineSymbolizerList.add(lineSymbol);
}
symbolizerList.addAll(createdLineSymbolizerList);
}
}
}
}
示例9: convert
import org.geotools.styling.Rule; //导入方法依赖的package包/类
@Override
public void convert(Rule rule, JsonElement element, String layerName, int transparency) {
if(rule == null) return;
if(element == null) return;
JsonObject obj = element.getAsJsonObject();
List<Symbolizer> symbolizerList = rule.symbolizers();
List<Stroke> strokeList = SymbolManager.getInstance().getStrokeList(obj.get(PictureFillSymbolKeys.OUTLINE));
Stroke stroke = null;
if(!strokeList.isEmpty())
{
stroke = strokeList.get(0);
}
Fill fill = getFill(layerName, obj, transparency);
PolygonSymbolizer polygonSymbolizer = styleFactory.createPolygonSymbolizer(stroke, fill, null);
symbolizerList.add(polygonSymbolizer);
}
示例10: internal_determineGeometryType
import org.geotools.styling.Rule; //导入方法依赖的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.Rule; //导入方法依赖的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: populateSLD
import org.geotools.styling.Rule; //导入方法依赖的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);
}
}
}
}
}
}
}
}
}
}
}
示例13: findMinimumVersion
import org.geotools.styling.Rule; //导入方法依赖的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();
}
示例14: findSymbolizer
import org.geotools.styling.Rule; //导入方法依赖的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;
}
示例15: externalGraphicSymbolVisitor
import org.geotools.styling.Rule; //导入方法依赖的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);
}
}
}
}
}
}
}
}