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


Java StyleBuilder类代码示例

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


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

示例1: paint

import org.geotools.styling.StyleBuilder; //导入依赖的package包/类
/**
 * @param obj
 *            The FT_coverage to render This method shall be reworked.
 */
public static void paint(final RasterSymbolizer symbolizer, final IFeature obj, final Viewport viewport, final double opacity) {
    FT_Coverage fcoverage = (FT_Coverage) obj;
    try {
        GridCoverage2D coverage = fcoverage.coverage();
        IEnvelope view = viewport.getEnvelopeInModelCoordinates();
        Envelope renderEnvelope = new Envelope(view.minX(), view.maxX(), view.minY(), view.maxY());
        GridCoverageRenderer renderer = new GridCoverageRenderer(coverage.getCoordinateReferenceSystem(), renderEnvelope, viewport.getLayerViewPanels()
                .iterator().next().getVisibleRect(), null);
        org.geotools.styling.RasterSymbolizer s = new StyleBuilder().createRasterSymbolizer();
        s.setOpacity(new FilterFactoryImpl().literal(opacity * symbolizer.getOpacity()));
        logger.warn("Replace by a GL function");
        // renderer.paint(coverage, s);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return;
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:22,代码来源:RenderGL11Util.java

示例2: testAccept

import org.geotools.styling.StyleBuilder; //导入依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename#accept(org.opengis.style.GraphicalSymbol)}.
 */
@Test
public void testAccept() {
    boolean valueOnly = true;
    FieldConfigFilename field = new FieldConfigFilename(
            new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly),
            null, null, null);

    assertFalse(field.accept(null));

    StyleBuilder styleBuilder = new StyleBuilder();
    ExternalGraphicImpl externalGraphic = (ExternalGraphicImpl) styleBuilder
            .createExternalGraphic("test.tmp", "png");
    assertTrue(field.accept(externalGraphic));

    Mark marker = styleBuilder.createMark("triangle");
    assertFalse(field.accept(marker));
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:22,代码来源:FieldConfigFilenameTest.java

示例3: testAccept

import org.geotools.styling.StyleBuilder; //导入依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF#accept(org.opengis.style.GraphicalSymbol)}.
 */
@Test
public void testAccept() {
    boolean valueOnly = true;
    FieldConfigTTF field = new FieldConfigTTF(
            new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly),
            null, null, null);

    assertFalse(field.accept(null));

    StyleBuilder styleBuilder = new StyleBuilder();
    ExternalGraphicImpl externalGraphic = (ExternalGraphicImpl) styleBuilder
            .createExternalGraphic("test.tmp", "png");
    assertFalse(field.accept(externalGraphic));

    Mark marker1 = styleBuilder.createMark("triangle");
    assertFalse(field.accept(marker1));

    Mark marker2 = styleBuilder.createMark("ttf://Arial");
    assertTrue(field.accept(marker2));
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:25,代码来源:FieldConfigTTFTest.java

示例4: testColour

import org.geotools.styling.StyleBuilder; //导入依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigPopulation#populateColourField(com.sldeditor.ui.detail.config.FieldId, org.opengis.filter.expression.Expression, org.opengis.filter.expression.Expression)}.
 */
@Test
public void testColour() {

    FieldIdEnum fieldId = FieldIdEnum.DESCRIPTION;

    GraphicPanelFieldManager fieldConfigManager = new GraphicPanelFieldManager(String.class);

    FieldConfigColour colourField = new FieldConfigColour(
            new FieldConfigCommonData(Geometry.class, fieldId, "label", true));
    colourField.createUI();
    colourField.createUI();
    fieldConfigManager.add(fieldId, colourField);

    FieldConfigPopulation obj = new FieldConfigPopulation(fieldConfigManager);

    StyleBuilder styleBuilder = new StyleBuilder();
    Expression colour = styleBuilder.colorExpression(Color.red);

    obj.populateColourField(fieldId, colour);
    FieldIdEnum wrongFieldEnum = FieldIdEnum.ELSE_FILTER;
    obj.populateColourField(wrongFieldEnum, colour);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:27,代码来源:FieldConfigPopulationTest.java

示例5: testFont

import org.geotools.styling.StyleBuilder; //导入依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.FieldConfigPopulation#populateFontField(com.sldeditor.common.xml.ui.FieldIdEnum, org.geotools.styling.Font)}.
 */
@Test
public void testFont() {

    FieldIdEnum fieldId = FieldIdEnum.DESCRIPTION;

    GraphicPanelFieldManager fieldConfigManager = new GraphicPanelFieldManager(String.class);

    FieldConfigFont fontField = new FieldConfigFont(
            new FieldConfigCommonData(Geometry.class, fieldId, "label", true));
    fontField.createUI();
    fieldConfigManager.add(fieldId, fontField);

    FieldConfigPopulation obj = new FieldConfigPopulation(fieldConfigManager);

    StyleBuilder styleBuilder = new StyleBuilder();

    Font expectedValue = styleBuilder.createFont(java.awt.Font.decode(null));
    obj.populateFontField(fieldId, expectedValue);

    // This shouldn't work as it does not know about the field
    FieldIdEnum wrongFieldEnum = FieldIdEnum.ELSE_FILTER;
    obj.populateFontField(wrongFieldEnum, expectedValue);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:28,代码来源:FieldConfigPopulationTest.java

示例6: testAccept

import org.geotools.styling.StyleBuilder; //导入依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.FieldConfigWKT#accept(org.opengis.style.GraphicalSymbol)}.
 */
@Test
public void testAccept() {
    boolean valueOnly = true;
    FieldConfigWKT field = new FieldConfigWKT(
            new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly),
            null, null, null);

    assertFalse(field.accept(null));

    StyleBuilder styleBuilder = new StyleBuilder();
    ExternalGraphicImpl externalGraphic = (ExternalGraphicImpl) styleBuilder
            .createExternalGraphic("test.tmp", "png");
    assertFalse(field.accept(externalGraphic));

    Mark marker1 = styleBuilder.createMark("star");
    assertFalse(field.accept(marker1));

    //CHECKSTYLE:OFF
    Mark marker2 = styleBuilder.createMark(
            "wkt://MULTILINESTRING((-0.25 -0.25, -0.125 -0.25), (0.125 -0.25, 0.25 -0.25), (-0.25 0.25, -0.125 0.25), (0.125 0.25, 0.25 0.25))");
    //CHECKSTYLE:ON
    assertTrue(field.accept(marker2));
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:28,代码来源:FieldConfigWKTTest.java

示例7: testAccept

import org.geotools.styling.StyleBuilder; //导入依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.arrow.FieldConfigArrow#accept(org.opengis.style.GraphicalSymbol)}.
 */
@Test
public void testAccept() {
    boolean valueOnly = true;
    FieldConfigArrow field = new FieldConfigArrow(
            new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly),
            null, null, null);

    assertFalse(field.accept(null));

    StyleBuilder styleBuilder = new StyleBuilder();

    Mark marker1 = styleBuilder.createMark("star");
    assertFalse(field.accept(marker1));

    Mark marker2 = styleBuilder.createMark("extshape://arrow?hr=1.2&t=0.34&ab=0.56");
    assertTrue(field.accept(marker2));
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:22,代码来源:FieldConfigArrowTest.java

示例8: testAccept

import org.geotools.styling.StyleBuilder; //导入依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs#accept(org.opengis.style.GraphicalSymbol)}.
 */
@Test
public void testAccept() {
    boolean valueOnly = true;
    FieldConfigWindBarbs field = new FieldConfigWindBarbs(
            new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly),
            null, null, null);

    assertFalse(field.accept(null));

    StyleBuilder styleBuilder = new StyleBuilder();
    ExternalGraphicImpl externalGraphic = (ExternalGraphicImpl) styleBuilder
            .createExternalGraphic("test.tmp", "png");
    assertFalse(field.accept(externalGraphic));

    Mark marker1 = styleBuilder.createMark("triangle");
    assertFalse(field.accept(marker1));

    Mark marker2 = styleBuilder.createMark("windbarbs://default(15)[kts]");
    assertTrue(field.accept(marker2));
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:25,代码来源:FieldConfigWindBarbsTest.java

示例9: createControl

import org.geotools.styling.StyleBuilder; //导入依赖的package包/类
/**
 * TODO summary sentence for createControl ...
 * 
 * @param parent
 * @param klisten
 * @param build
 * @return Generated composite
 */
public Composite createControl(final Composite parent, final KeyListener klisten, final StyleBuilder build) {
	final Composite part = AbstractSimpleConfigurator.subpart(parent, "Point");

	this.on = new Button(part, SWT.CHECK);
	// this.on.addSelectionListener( this.sync );

	this.size = new Combo(part, SWT.DROP_DOWN);
	this.size.setItems(new String[] { "1", "2", "3", "5", "10", "15" }); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
	this.size.setTextLimit(2);
	this.size.addKeyListener(klisten);
	this.size.setToolTipText("Graphic size");

	this.name = new Combo(part, SWT.DROP_DOWN);
	this.name.setItems(build.getWellKnownMarkNames());
	this.name.setTextLimit(9);
	this.name.addKeyListener(klisten);
	this.name.setToolTipText("Shape type");
	return part;
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:28,代码来源:GraphicViewer.java

示例10: createDefaultPointFeatureTypeStyle

import org.geotools.styling.StyleBuilder; //导入依赖的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

示例11: featureTypeStyleExample

import org.geotools.styling.StyleBuilder; //导入依赖的package包/类
private void featureTypeStyleExample() {
    // featureTypeStyleExample start
    StyleBuilder styleBuilder = new StyleBuilder();
    Style style = styleBuilder.createStyle();
    
    PointSymbolizer pointSymbolizer = styleBuilder.createPointSymbolizer();
    
    Graphic graphic = styleBuilder.createGraphic();
    ExternalGraphic external = styleBuilder.createExternalGraphic("file:///C:/images/house.gif",
            "image/gif");
    graphic.graphicalSymbols().add(external);
    graphic.graphicalSymbols().add(styleBuilder.createMark("circle"));
    
    pointSymbolizer.setGraphic(graphic);
    
    Rule rule = styleBuilder.createRule(pointSymbolizer);
    FeatureTypeStyle featureTypeStyle = styleBuilder.createFeatureTypeStyle("Feature", rule);
    style.featureTypeStyles().add(featureTypeStyle);
    
    // featureTypeStyleExample end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:22,代码来源:StyleExamples.java

示例12: quickPointSymbolizer

import org.geotools.styling.StyleBuilder; //导入依赖的package包/类
private void quickPointSymbolizer() {
    // quickPointSymbolizer start
    // "testPoint" feature type style
    StyleBuilder sb = new StyleBuilder();
    FilterFactory2 ff = sb.getFilterFactory();
    
    Mark testMark = sb.createMark(sb.attributeExpression("name"), sb.createFill(Color.RED, 0.5),
            null);
    Graphic graph = sb.createGraphic(null, // An external graphics if needed
            new Mark[] { testMark }, // a Mark if not an external graphics
            null, // aSymbol
            ff.literal(1), // opacity
            ff.property("size"), // read from feature "size" attribute
            ff.property("rotation")); // rotation, here read into the feature
    PointSymbolizer aPointSymbolizer = sb.createPointSymbolizer(graph);
    
    // creation of the style
    Style style = sb.createStyle(aPointSymbolizer);
    // quickPointSymbolizer end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:21,代码来源:StyleExamples.java

示例13: create

import org.geotools.styling.StyleBuilder; //导入依赖的package包/类
public static Style create(DataStore dataStore, ShapeFileParameter param,
		FeatureType type) {
	try {
		StyleBuilder styleBuilder = new StyleBuilder();
		Style style = styleBuilder.createStyle();
		double[] breaks = createBreaks(param.min, param.max);
		Color[] colors = createColors();
		Rule[] rules = createRules(param.name, styleBuilder, breaks,
				colors, type);
		String typeName = dataStore.getTypeNames()[0];
		FeatureTypeStyle fts = styleBuilder.createFeatureTypeStyle(
				typeName, rules);
		style.featureTypeStyles().add(fts);
		return style;
	} catch (Exception e) {
		Logger log = LoggerFactory.getLogger(SFMapStyle.class);
		log.error("failed to create shape file style", e);
		return null;
	}
}
 
开发者ID:GreenDelta,项目名称:olca-app,代码行数:21,代码来源:SFMapStyle.java

示例14: createRules

import org.geotools.styling.StyleBuilder; //导入依赖的package包/类
private static Rule[] createRules(String parameter,
		StyleBuilder styleBuilder, double[] breaks, Color[] colors,
		FeatureType type) {
	FilterFactory filterFactory = CommonFactoryFinder
			.getFilterFactory(GeoTools.getDefaultHints());
	Rule[] rules = new Rule[breaks.length];
	for (int i = 0; i < breaks.length; i++) {
		Symbolizer symbolizer = createSymbolizer(styleBuilder, colors[i],
				type);
		Rule rule = styleBuilder.createRule(symbolizer);
		Expression property = filterFactory.property(parameter);
		Filter filter = filterFactory.lessOrEqual(property,
				filterFactory.literal(breaks[i]));
		if (i > 0) {
			Filter greater = filterFactory.greater(property,
					filterFactory.literal(breaks[i - 1]));
			filter = filterFactory.and(filter, greater);
		}
		rule.setFilter(filter);
		rules[i] = rule;
	}
	return rules;
}
 
开发者ID:GreenDelta,项目名称:olca-app,代码行数:24,代码来源:SFMapStyle.java

示例15: TextSymbolizerDetails

import org.geotools.styling.StyleBuilder; //导入依赖的package包/类
/**
 * Constructor.
 */
public TextSymbolizerDetails() {
    super(TextSymbolizerDetails.class);

    // Cache the default point placement anchor point values
    StyleBuilder styleBuilder = new StyleBuilder();
    PointPlacement defaultPointPlacement = styleBuilder.createPointPlacement();
    defaultPointPlacementAnchorPointX = defaultPointPlacement.getAnchorPoint()
            .getAnchorPointX();
    defaultPointPlacementAnchorPointY = defaultPointPlacement.getAnchorPoint()
            .getAnchorPointY();

    createUI();
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:17,代码来源:TextSymbolizerDetails.java


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