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


Java Mark.setFill方法代码示例

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


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

示例1: createDefaultPointRule

import org.geotools.styling.Mark; //导入方法依赖的package包/类
/**
 * Creates a default {@link Rule} for a point.
 * 
 * @return the default rule.
 */
public static Rule createDefaultPointRule() {
    Graphic graphic = sf.createDefaultGraphic();
    Mark circleMark = sf.getCircleMark();
    circleMark.setFill(sf.createFill(ff.literal("#" + Integer.toHexString(Color.RED.getRGB() & 0xffffff))));
    circleMark.setStroke(sf.createStroke(ff.literal("#" + Integer.toHexString(Color.BLACK.getRGB() & 0xffffff)),
            ff.literal(DEFAULT_WIDTH)));
    graphic.graphicalSymbols().clear();
    graphic.graphicalSymbols().add(circleMark);
    graphic.setSize(ff.literal(DEFAULT_SIZE));

    PointSymbolizer pointSymbolizer = sf.createPointSymbolizer();
    Rule rule = sf.createRule();
    rule.setName("New rule");
    rule.symbolizers().add(pointSymbolizer);

    pointSymbolizer.setGraphic(graphic);
    return rule;
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:24,代码来源:Utilities.java

示例2: createSymbol

import org.geotools.styling.Mark; //导入方法依赖的package包/类
private GraphicalSymbol createSymbol(FeatureStyleInfo featureStyle) throws LayerException {
	SymbolInfo info = featureStyle.getSymbol();
	if (info.getImage() != null) {

		return styleBuilder.createExternalGraphic(getUrl(info.getImage().getHref()), getFormat(info.getImage()
				.getHref()));
	} else {
		Mark mark;
		if (info.getRect() != null) {
			// TODO: do rectangles by adding custom factory ?
			mark = styleBuilder.createMark(MARK_SQUARE);
		} else if (info.getCircle() != null) {
			mark = styleBuilder.createMark(MARK_CIRCLE);
		} else {
			throw new IllegalArgumentException(
					"Feature style should have either an image, a circle or a rectangle defined. Style name: " +
							featureStyle.getName() + ", index: " + featureStyle.getIndex());
		}
		mark.setFill(createFill(featureStyle));
		mark.setStroke(createStroke(featureStyle));
		return mark;
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:24,代码来源:StyleConverterServiceImpl.java

示例3: createPointStyle

import org.geotools.styling.Mark; //导入方法依赖的package包/类
/**
 * Create a default point style.
 * 
 * @return the created style.
 */
public static Style createPointStyle() {
	final Graphic gr = styleFactory.createDefaultGraphic();

	final Mark mark = styleFactory.getCircleMark();

	mark.setStroke(styleFactory.createStroke(filterFactory.literal(Color.BLUE), filterFactory.literal(1)));

	mark.setFill(styleFactory.createFill(filterFactory.literal(Color.CYAN)));

	gr.graphicalSymbols().clear();
	gr.graphicalSymbols().add(mark);
	gr.setSize(filterFactory.literal(5));

	/*
	 * Setting the geometryPropertyName arg to null signals that we want to draw the default geomettry of features
	 */
	final PointSymbolizer sym = styleFactory.createPointSymbolizer(gr, null);

	final Rule rule = styleFactory.createRule();
	rule.symbolizers().add(sym);
	final FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle(new Rule[] { rule });
	final Style style = styleFactory.createStyle();
	style.featureTypeStyles().add(fts);

	return style;
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:32,代码来源:Utils.java

示例4: createPointStyle

import org.geotools.styling.Mark; //导入方法依赖的package包/类
/**
 * Create a Style to draw point features as circles with blue outlines and
 * cyan fill
 */
private Style createPointStyle() {
    Graphic gr = styleFactory.createDefaultGraphic();

    Mark mark = styleFactory.getCircleMark();

    mark.setStroke(styleFactory.createStroke(
            filterFactory.literal(Color.BLUE), filterFactory.literal(1)));

    mark.setFill(styleFactory.createFill(filterFactory.literal(Color.ORANGE)));

    gr.graphicalSymbols().clear();
    gr.graphicalSymbols().add(mark);
    gr.setSize(filterFactory.literal(5));

    /*
     * Setting the geometryPropertyName arg to null signals that we want to
     * draw the default geomettry of features
     */
    PointSymbolizer sym = styleFactory.createPointSymbolizer(gr, null);

    Rule rule = styleFactory.createRule();
    rule.symbolizers().add(sym);
    FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle(new Rule[]{rule});
    Style style = styleFactory.createStyle();
    style.featureTypeStyles().add(fts);

    return style;
}
 
开发者ID:skp703,项目名称:RainInterpolator,代码行数:33,代码来源:GridMaker.java

示例5: createPointStyle

import org.geotools.styling.Mark; //导入方法依赖的package包/类
/**
 * Create a Style to draw point features as circles with blue outlines
 * and cyan fill
 */
private Style createPointStyle() {
    Graphic gr = styleFactory.createDefaultGraphic();

    Mark mark = styleFactory.getCircleMark();

    mark.setStroke(styleFactory.createStroke(
            filterFactory.literal(Color.BLUE), filterFactory.literal(1)));

    mark.setFill(styleFactory.createFill(filterFactory.literal(Color.CYAN)));

    gr.graphicalSymbols().clear();
    gr.graphicalSymbols().add(mark);
    gr.setSize(filterFactory.literal(5));

    /*
     * Setting the geometryPropertyName arg to null signals that we want to
     * draw the default geomettry of features
     */
    PointSymbolizer sym = styleFactory.createPointSymbolizer(gr, null);

    Rule rule = styleFactory.createRule();
    rule.symbolizers().add(sym);
    FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle(new Rule[]{rule});
    Style style = styleFactory.createStyle();
    style.featureTypeStyles().add(fts);

    return style;
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:33,代码来源:StyleLab.java

示例6: createRule

import org.geotools.styling.Mark; //导入方法依赖的package包/类
/**
 * Helper for createXXXStyle methods. Creates a new Rule containing
 * a Symbolizer tailored to the geometry type of the features that
 * we are displaying.
 */
private Rule createRule(Color outlineColor, Color fillColor) {
    Symbolizer symbolizer = null;
    Fill fill = null;
    Stroke stroke = sf.createStroke(ff.literal(outlineColor), ff.literal(LINE_WIDTH));

    switch (geometryType) {
        case POLYGON:
            fill = sf.createFill(ff.literal(fillColor), ff.literal(OPACITY));
            symbolizer = sf.createPolygonSymbolizer(stroke, fill, geometryAttributeName);
            break;

        case LINE:
            symbolizer = sf.createLineSymbolizer(stroke, geometryAttributeName);
            break;

        case POINT:
            fill = sf.createFill(ff.literal(fillColor), ff.literal(OPACITY));

            Mark mark = sf.getCircleMark();
            mark.setFill(fill);
            mark.setStroke(stroke);

            Graphic graphic = sf.createDefaultGraphic();
            graphic.graphicalSymbols().clear();
            graphic.graphicalSymbols().add(mark);
            graphic.setSize(ff.literal(POINT_SIZE));

            symbolizer = sf.createPointSymbolizer(graphic, geometryAttributeName);
    }

    Rule rule = sf.createRule();
    rule.symbolizers().add(symbolizer);
    return rule;
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:40,代码来源:SelectionLab.java

示例7: getPointsStyle

import org.geotools.styling.Mark; //导入方法依赖的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.Mark.setFill方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。