当前位置: 首页>>代码示例>>Java>>正文


Java Fill.setOpacity方法代码示例

本文整理汇总了Java中org.geotools.styling.Fill.setOpacity方法的典型用法代码示例。如果您正苦于以下问题:Java Fill.setOpacity方法的具体用法?Java Fill.setOpacity怎么用?Java Fill.setOpacity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.geotools.styling.Fill的用法示例。


在下文中一共展示了Fill.setOpacity方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createDefaultPolygonFeatureTypeStyle

import org.geotools.styling.Fill; //导入方法依赖的package包/类
private FeatureTypeStyle createDefaultPolygonFeatureTypeStyle(String strokeColor, String strokeWidth, String fillColor, String opacity){
	Stroke polygonStroke = sf.getDefaultStroke();
       polygonStroke.setWidth(filterFactory.literal(new Integer(strokeWidth)));
       polygonStroke.setColor(filterFactory.literal(strokeColor));
       polygonStroke.setOpacity(filterFactory.literal(opacity));
       
       Fill polygonFill = sf.getDefaultFill();        
       polygonFill.setColor(filterFactory.literal(fillColor));        
       polygonFill.setOpacity(filterFactory.literal(opacity));      
       
       PolygonSymbolizer polySym = sf.createPolygonSymbolizer();
       polySym.setFill(polygonFill);
       polySym.setStroke(polygonStroke);

       Rule polygonRule = sf.createRule();
       polygonRule.symbolizers().add(polySym);
       FeatureTypeStyle polygonFeatureTypeStyle = sf.createFeatureTypeStyle(new Rule[]{polygonRule});
       
       return polygonFeatureTypeStyle;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:21,代码来源:LayerFactory.java

示例2: createDefaultPointFeatureTypeStyle

import org.geotools.styling.Fill; //导入方法依赖的package包/类
private FeatureTypeStyle createDefaultPointFeatureTypeStyle(String radius, String color, String opacity){	
	Fill pointFill = sf.getDefaultFill();        
	pointFill.setColor(filterFactory.literal(color));        
	pointFill.setOpacity(filterFactory.literal(opacity));
       
	Stroke pointStroke = sf.getDefaultStroke();
	pointStroke.setWidth(filterFactory.literal(new Integer(DEFAULT_STROKE_WIDTH)));
	pointStroke.setColor(filterFactory.literal(DEFAULT_COLOR));
	pointStroke.setOpacity(filterFactory.literal(opacity));

	StyleBuilder sb = new StyleBuilder();
	Mark circle = sb.createMark(StyleBuilder.MARK_CIRCLE, pointFill,pointStroke);
	Graphic graph = sb.createGraphic(null, circle, null, Double.parseDouble(opacity), Double.parseDouble(radius) , DEFAULT_POINT_ROTATION);
       PointSymbolizer pointSymbolizer = sb.createPointSymbolizer(graph);		
       
       Rule pointRule = sf.createRule();
       pointRule.symbolizers().add(pointSymbolizer);
       FeatureTypeStyle pointFeatureTypeStyle = sf.createFeatureTypeStyle(new Rule[]{pointRule});
	
       return pointFeatureTypeStyle;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:22,代码来源:LayerFactory.java

示例3: updateSymbol

import org.geotools.styling.Fill; //导入方法依赖的package包/类
/**
 * Update symbol.
 */
private void updateSymbol() {
    if (!Controller.getInstance().isPopulating()) {
        if (symbolizer instanceof PolygonSymbolizer) {
            PolygonSymbolizerImpl newPolygonSymbolizer = (PolygonSymbolizerImpl) symbolizer;

            GraphicFill graphicFill = getGraphicFill();
            Fill fill = symbolTypeFactory.getFill(graphicFill, this.fieldConfigManager);

            Expression expOpacity = fieldConfigVisitor
                    .getExpression(FieldIdEnum.OVERALL_OPACITY);

            // If field is not enabled it returns null
            if ((fill != null) && (expOpacity != null)) {
                fill.setOpacity(expOpacity);
            }

            newPolygonSymbolizer.setFill(fill);

            if (vendorOptionFillFactory != null) {
                vendorOptionFillFactory.updateSymbol(newPolygonSymbolizer);
            }
        }

        this.fireUpdateSymbol();
    }
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:30,代码来源:PolygonFillDetails.java

示例4: visit

import org.geotools.styling.Fill; //导入方法依赖的package包/类
@Override
public void visit(PolygonSymbolizer poly) {
    super.visit(poly);
    PolygonSymbolizer polyCopy = (PolygonSymbolizer) pages.peek();
    Fill polyFill = polyCopy.getFill();
    if (polyFill != null) {
        polyFill.setOpacity(polyFillExp);
    }

    Stroke polyStroke = polyCopy.getStroke();
    if (polyStroke != null) {
        polyStroke.setOpacity(polyStrokeExp);
    }
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:15,代码来源:FeatureLayer.java

示例5: getPointsStyle

import org.geotools.styling.Fill; //导入方法依赖的package包/类
/**
 * Create style for a points layer. 
 * 
 * @param schema
 * @return a point style with labels.
 */
public static Style getPointsStyle( SimpleFeatureType schema ) {
    Style style = SLD.createSimpleStyle(schema);

    Rule origRule = style.featureTypeStyles().get(0).rules().get(0);

    Symbolizer symbolizer = origRule.symbolizers().get(0);
    PointSymbolizer pointSymbolizer = (PointSymbolizer) symbolizer;
    Graphic graphic = pointSymbolizer.getGraphic();

    // size
    graphic.setSize(ff.literal("12"));

    Mark pointMark = new MarkImpl();
    pointMark.setWellKnownName(ff.literal("circle"));
    graphic.graphicalSymbols().clear();
    graphic.graphicalSymbols().add(pointMark);

    Stroke stroke = pointMark.getStroke();
    if (stroke == null) {
        stroke = sf.createStroke(ff.literal("#940000"), ff.literal("1"), ff.literal("1"));
    } else {
        stroke.setColor(ff.literal("#940000"));
        stroke.setOpacity(ff.literal("1"));
    }
    pointMark.setStroke(stroke);

    Fill fill = pointMark.getFill();
    if (fill == null) {
        fill = sf.createFill(ff.literal("#FF0000"), ff.literal("0.5"));
    } else {
        fill.setColor(ff.literal("#FF0000"));
        fill.setOpacity(ff.literal("0.5"));
    }
    pointMark.setFill(fill);

    LabelPlacement labelPlacement = sf.createPointPlacement(sf.createAnchorPoint(ff.literal(0.0), ff.literal(0.0)),
            sf.createDisplacement(ff.literal(0.0), ff.literal(0.0)), ff.literal(0.0));

    Font font = sb.createFont("Arial", false, false, 12); //$NON-NLS-1$
    TextSymbolizer textSymbolizer = sf.createTextSymbolizer(//
            sf.createFill(ff.literal("#000000")), //
            new Font[]{font}, //
            null, //
            ff.property(DataSource.TIMESTAMP_H), //
            labelPlacement, //
            null);
    origRule.symbolizers().add(textSymbolizer);

    // Rule rule = sf.createRule();
    // rule.symbolizers().add(pointSymbolizer);
    // rule.symbolizers().add(textSymbolizer);
    //
    // FeatureTypeStyle fts = sf.createFeatureTypeStyle(new Rule[]{rule});
    // Style newStyle = sf.createStyle();
    // newStyle.featureTypeStyles().add(fts);

    return style;
}
 
开发者ID:debrief,项目名称:deelite,代码行数:65,代码来源:StyleGenerator.java


注:本文中的org.geotools.styling.Fill.setOpacity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。