本文整理汇总了Java中org.geomajas.sld.PolygonSymbolizerInfo类的典型用法代码示例。如果您正苦于以下问题:Java PolygonSymbolizerInfo类的具体用法?Java PolygonSymbolizerInfo怎么用?Java PolygonSymbolizerInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PolygonSymbolizerInfo类属于org.geomajas.sld包,在下文中一共展示了PolygonSymbolizerInfo类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSymbolizer
import org.geomajas.sld.PolygonSymbolizerInfo; //导入依赖的package包/类
private PolygonSymbolizerInfo createSymbolizer(ShapeStyle shapeStyle) {
FeatureStyleInfo fs = new FeatureStyleInfo();
fs.setFillColor(shapeStyle.getFillColor());
fs.setStrokeColor(shapeStyle.getStrokeColor());
fs.setFillOpacity(shapeStyle.getFillOpacity());
fs.setStrokeOpacity(shapeStyle.getStrokeOpacity());
fs.setStrokeWidth((int) shapeStyle.getStrokeWidth());
fs.setName("");
return (PolygonSymbolizerInfo) StyleUtil.createSymbolizer(LayerType.POLYGON, fs);
}
示例2: testSimpleStyle
import org.geomajas.sld.PolygonSymbolizerInfo; //导入依赖的package包/类
@Test
public void testSimpleStyle() throws JiBXException {
FillInfo fillInfo = StyleUtil.createFill("#FFFF00", 0.5f);
StrokeInfo strokeInfo = StyleUtil.createStroke("red", 3, 0.5f, "3 4");
PolygonSymbolizerInfo polygonSymbolizerInfo = StyleUtil.createPolygonSymbolizer(fillInfo, strokeInfo);
RuleInfo ruleInfo = StyleUtil.createRule("myTitle", "myName", polygonSymbolizerInfo);
IBindingFactory bfact = BindingDirectory.getFactory(StyledLayerDescriptorInfo.class);
IMarshallingContext mctx = bfact.createMarshallingContext();
StringWriter sw = new StringWriter();
mctx.setOutput(sw);
mctx.marshalDocument(ruleInfo);
Assert.assertEquals(
"<sld:Rule xmlns:sld=\"http://www.opengis.net/sld\">" +
"<sld:Name>myName</sld:Name>" +
"<sld:Title>myTitle</sld:Title>" +
"<sld:PolygonSymbolizer>" +
"<sld:Fill>" +
"<sld:CssParameter name=\"fill\">#FFFF00</sld:CssParameter>" +
"<sld:CssParameter name=\"fill-opacity\">0.5</sld:CssParameter>" +
"</sld:Fill>" +
"<sld:Stroke>" +
"<sld:CssParameter name=\"stroke\">red</sld:CssParameter>" +
"<sld:CssParameter name=\"stroke-width\">3</sld:CssParameter>" +
"<sld:CssParameter name=\"stroke-dasharray\">3 4</sld:CssParameter>" +
"<sld:CssParameter name=\"stroke-opacity\">0.5</sld:CssParameter>" +
"</sld:Stroke>" +
"</sld:PolygonSymbolizer>" +
"</sld:Rule>",
sw.toString());
}
示例3: createRule
import org.geomajas.sld.PolygonSymbolizerInfo; //导入依赖的package包/类
public static RuleInfo createRule(LayerType type, FeatureStyleInfo featureStyle) {
SymbolInfo symbol = featureStyle.getSymbol();
RuleInfo rule = null;
StrokeInfo stroke = StyleUtil.createStroke(featureStyle.getStrokeColor(), (int) featureStyle.getStrokeWidth(),
featureStyle.getStrokeOpacity(), null);
FillInfo fill = StyleUtil.createFill(featureStyle.getFillColor(), featureStyle.getFillOpacity());
switch (type) {
case GEOMETRY:
break;
case LINESTRING:
case MULTILINESTRING:
LineSymbolizerInfo line = StyleUtil.createLineSymbolizer(stroke);
rule = StyleUtil.createRule(featureStyle.getName(), featureStyle.getName(), line);
break;
case MULTIPOINT:
case POINT:
GraphicInfo graphic = null;
if (symbol.getCircle() != null) {
MarkInfo circle = StyleUtil.createMark(WKN_CIRCLE, fill, stroke);
graphic = StyleUtil.createGraphic(circle, (int) (2 * symbol.getCircle().getR()));
} else if (symbol.getRect() != null) {
MarkInfo rect = StyleUtil.createMark(WKN_SQUARE, fill, stroke);
graphic = StyleUtil.createGraphic(rect, (int) symbol.getRect().getH());
} else {
ExternalGraphicInfo image = StyleUtil.createExternalGraphic(symbol.getImage().getHref());
graphic = StyleUtil.createGraphic(image, symbol.getImage().getHeight());
}
PointSymbolizerInfo point = StyleUtil.createPointSymbolizer(graphic);
rule = StyleUtil.createRule(featureStyle.getName(), featureStyle.getName(), point);
break;
case POLYGON:
case MULTIPOLYGON:
default:
PolygonSymbolizerInfo polygon = StyleUtil.createPolygonSymbolizer(fill, stroke);
rule = StyleUtil.createRule(featureStyle.getName(), featureStyle.getName(), polygon);
break;
}
return rule;
}
示例4: getMultiPolygonStyle
import org.geomajas.sld.PolygonSymbolizerInfo; //导入依赖的package包/类
private PolygonSymbolizerInfo getMultiPolygonStyle() {
RuleInfo rule = getFirstRule(layerBeansMultiPolygonStyleInfo.getUserStyle());
return (PolygonSymbolizerInfo) rule.getSymbolizerList().get(0);
}
示例5: getSyntheticStyle
import org.geomajas.sld.PolygonSymbolizerInfo; //导入依赖的package包/类
private PolygonSymbolizerInfo getSyntheticStyle() {
RuleInfo rule = getFirstRule(layerBeansSyntheticStyleInfo.getUserStyle());
return (PolygonSymbolizerInfo) rule.getSymbolizerList().get(0);
}
示例6: convert
import org.geomajas.sld.PolygonSymbolizerInfo; //导入依赖的package包/类
@Override
public NamedStyleInfo convert(UserStyleInfo userStyle, FeatureInfo featureInfo) throws LayerException {
NamedStyleInfo namedStyleInfo = new NamedStyleInfo();
LabelStyleInfo labelStyleInfo = new LabelStyleInfo();
List<FeatureStyleInfo> featureStyleInfos = new ArrayList<FeatureStyleInfo>();
for (FeatureTypeStyleInfo featureTypeStyleInfo : userStyle.getFeatureTypeStyleList()) {
int styleIndex = 0;
for (RuleInfo ruleInfo : featureTypeStyleInfo.getRuleList()) {
FeatureStyleInfo featureStyleInfo = new FeatureStyleInfo();
if (null != ruleInfo.getChoice() && ruleInfo.getChoice().ifFilter()) {
featureStyleInfo.setFormula(convertFormula(ruleInfo.getChoice().getFilter(), featureInfo));
}
for (SymbolizerTypeInfo symbolizerTypeInfo : ruleInfo.getSymbolizerList()) {
if (symbolizerTypeInfo instanceof PointSymbolizerInfo) {
PointSymbolizerInfo pointInfo = (PointSymbolizerInfo) symbolizerTypeInfo;
convertSymbol(featureStyleInfo, pointInfo);
} else if (symbolizerTypeInfo instanceof LineSymbolizerInfo) {
LineSymbolizerInfo lineInfo = (LineSymbolizerInfo) symbolizerTypeInfo;
convertStroke(featureStyleInfo, lineInfo.getStroke());
} else if (symbolizerTypeInfo instanceof PolygonSymbolizerInfo) {
PolygonSymbolizerInfo polygonInfo = (PolygonSymbolizerInfo) symbolizerTypeInfo;
convertFill(featureStyleInfo, polygonInfo.getFill());
convertStroke(featureStyleInfo, polygonInfo.getStroke());
} else if (symbolizerTypeInfo instanceof TextSymbolizerInfo) {
TextSymbolizerInfo textInfo = (TextSymbolizerInfo) symbolizerTypeInfo;
labelStyleInfo.setFontStyle(convertFont(textInfo.getFont()));
for (ExpressionInfo expr : textInfo.getLabel().getExpressionList()) {
if (expr instanceof LiteralTypeInfo ) {
String literalValue = expr.getValue();
labelStyleInfo.setLabelValueExpression("'" + literalValue + "'");
} else { // Assume expr is of class PropertyNameInfo
labelStyleInfo.setLabelAttributeName(expr.getValue());
}
}
convertFontFill(labelStyleInfo.getFontStyle(), textInfo.getFill());
FeatureStyleInfo background = new FeatureStyleInfo();
if (textInfo.getHalo() != null) {
convertFill(background, textInfo.getHalo().getFill());
}
labelStyleInfo.setBackgroundStyle(background);
} else {
log.warn("Symbolizer type " + symbolizerTypeInfo
+ "cannot be converted to feature style info, reverting to default style");
}
}
if (featureStyleInfo.getStrokeColor() == null && featureStyleInfo.getFillColor() != null) {
// avoid default stroke by setting invisible
featureStyleInfo.setStrokeColor("black");
featureStyleInfo.setStrokeOpacity(0);
featureStyleInfo.setStrokeWidth(0);
}
featureStyleInfo.setIndex(styleIndex++);
featureStyleInfo.setName(ruleInfo.getTitle() != null ? ruleInfo.getTitle() : ruleInfo.getName());
featureStyleInfos.add(featureStyleInfo);
}
}
namedStyleInfo.setName(userStyle.getTitle() != null ? userStyle.getTitle() : userStyle.getName());
namedStyleInfo.setFeatureStyles(featureStyleInfos);
namedStyleInfo.setLabelStyle(labelStyleInfo);
return namedStyleInfo;
}
示例7: createPolygonSymbolizer
import org.geomajas.sld.PolygonSymbolizerInfo; //导入依赖的package包/类
/**
* Creates a polygon symbolizer with the specified fill and stroke.
*
* @param fillInfo the fill
* @param strokeInfo the stroke
* @return the symbolizer
*/
public static PolygonSymbolizerInfo createPolygonSymbolizer(FillInfo fillInfo, StrokeInfo strokeInfo) {
PolygonSymbolizerInfo symbolizerInfo = new PolygonSymbolizerInfo();
symbolizerInfo.setFill(fillInfo);
symbolizerInfo.setStroke(strokeInfo);
return symbolizerInfo;
}