org.geotools.styling.Fill Java Examples

The following examples show how to use org.geotools.styling.Fill. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SLDTreeLeafFactory.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Update fill.
 *
 * @param selected the selected
 * @param symbolizer the symbolizer
 * @return the fill
 */
public Fill updateFill(boolean selected, Symbolizer symbolizer) {
    if (symbolizer == null) {
        return null;
    }

    boolean currentValue = hasFill(symbolizer);

    if (currentValue != selected) {
        SLDTreeLeafInterface obj = map.get(symbolizer.getClass());
        if (obj != null) {
            if (selected) {
                logger.debug("Set fill");
                obj.createFill(symbolizer);
            } else {
                logger.debug("Clear fill");
                obj.removeFill(symbolizer);
            }
        }
    }
    return getFill(symbolizer);
}
 
Example #2
Source File: FeatureLayerConfigurationPersistencyTest.java    From snap-desktop with GNU General Public License v3.0 6 votes vote down vote up
@SuppressWarnings({"deprecation"})
private static Style createStyle() {
    StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory(null);
    FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(null);
    PolygonSymbolizer symbolizer = styleFactory.createPolygonSymbolizer();
    Fill fill = styleFactory.createFill(
            filterFactory.literal("#FFAA00"),
            filterFactory.literal(0.5)
    );
    symbolizer.setFill(fill);
    Rule rule = styleFactory.createRule();
    rule.setSymbolizers(new Symbolizer[]{symbolizer});
    FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();
    fts.setRules(new Rule[]{rule});

    Style style = styleFactory.createStyle();
    style.addFeatureTypeStyle(fts);
    return style;
}
 
Example #3
Source File: PictureFillSymbol.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
@Override
public List<Symbolizer> convertToFill(String layerName, JsonElement element, int transparency) {
    if(element == null) return null;

    JsonObject obj = element.getAsJsonObject();

    List<Symbolizer> symbolizerList = new ArrayList<Symbolizer>();

    Fill fill = getFill(layerName, obj, transparency);

    PolygonSymbolizer polygon = styleFactory.createPolygonSymbolizer();
    polygon.setStroke(null);
    polygon.setFill(fill);
    symbolizerList.add(polygon);

    return symbolizerList;
}
 
Example #4
Source File: StyleGenerator.java    From constellation with Apache License 2.0 6 votes vote down vote up
private static Rule makeFillRule() {
    final FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory();
    final StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory();

    // create a partially opaque outline stroke
    final Stroke stroke = styleFactory.createStroke(
            filterFactory.literal(Color.BLACK),
            filterFactory.literal(1),
            filterFactory.literal(.5)
    );

    // create a partially opaque fill
    Fill fill = styleFactory.createFill(
            filterFactory.literal(COLORS.next()),
            filterFactory.literal(.5)
    );

    // setting the geometryPropertyName arg to null signals that we want to draw the default geometry of features
    final PolygonSymbolizer sym = styleFactory.createPolygonSymbolizer(stroke, fill, null);

    final Rule rule = styleFactory.createRule();
    rule.symbolizers().add(sym);

    return rule;
}
 
Example #5
Source File: SimpleFillSymbol.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
@Override
public List<Symbolizer> convertToFill(String layerName, JsonElement element, int transparency) {
    if(element == null) return null;

    JsonObject obj = element.getAsJsonObject();

    List<Symbolizer> symbolizerList = new ArrayList<Symbolizer>();
    Expression fillColour = getColour(obj.get(SimpleFillSymbolKeys.FILL_COLOUR));
    Expression transparencyExpression = getTransparency(transparency);
    Fill fill = null;

    if(fillColour != null)
    {
        fill = styleFactory.createFill(fillColour, transparencyExpression);
    }

    PolygonSymbolizer polygon = styleFactory.createPolygonSymbolizer();
    polygon.setStroke(null);
    polygon.setFill(fill);
    symbolizerList.add(polygon);

    return symbolizerList;
}
 
Example #6
Source File: ShapefileLoader.java    From snap-desktop with GNU General Public License v3.0 6 votes vote down vote up
private static Style createPolygonStyle() {
    PolygonSymbolizer symbolizer = styleFactory.createPolygonSymbolizer();
    Fill fill = styleFactory.createFill(
            filterFactory.literal("#FFAA00"),
            filterFactory.literal(0.5)
    );
    final Stroke stroke = styleFactory.createStroke(filterFactory.literal(Color.BLACK),
                                                    filterFactory.literal(1));
    symbolizer.setFill(fill);
    symbolizer.setStroke(stroke);
    Rule rule = styleFactory.createRule();
    rule.symbolizers().add(symbolizer);
    FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();
    fts.rules().add(rule);

    Style style = styleFactory.createStyle();
    style.featureTypeStyles().add(fts);
    return style;
}
 
Example #7
Source File: StyleConverterServiceImpl.java    From geomajas-project-server with GNU Affero General Public License v3.0 6 votes vote down vote up
private TextSymbolizer createTextSymbolizer(LabelStyleInfo labelStyle, LayerType layerType) {
	Fill fontFill = styleBuilder.createFill(styleBuilder.literalExpression(labelStyle.getFontStyle().getColor()),
			styleBuilder.literalExpression(labelStyle.getFontStyle().getOpacity()));
	TextSymbolizer symbolizer = styleBuilder.createTextSymbolizer();
	symbolizer.setFill(fontFill);
	FontStyleInfo fontInfo = labelStyle.getFontStyle();
	symbolizer.setFont(styleBuilder.createFont(styleBuilder.literalExpression(fontInfo.getFamily()),
			styleBuilder.literalExpression(fontInfo.getStyle()),
			styleBuilder.literalExpression(fontInfo.getWeight()),
			styleBuilder.literalExpression(fontInfo.getSize())));
	symbolizer.setLabel(styleBuilder.attributeExpression(labelStyle.getLabelAttributeName()));
	Fill haloFill = styleBuilder.createFill(
			styleBuilder.literalExpression(labelStyle.getBackgroundStyle().getFillColor()),
			styleBuilder.literalExpression(labelStyle.getBackgroundStyle().getFillOpacity()));
	symbolizer.setHalo(styleBuilder.createHalo(haloFill, 1));
	// label placement : point at bottom-center of label (same as vectorized)
	switch (layerType) {
		case MULTIPOINT:
		case POINT:
			symbolizer.setLabelPlacement(styleBuilder.createPointPlacement(0.5, 0, 0));
			break;
		default:
			break;
	}
	return symbolizer;
}
 
Example #8
Source File: Utils.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Create a default polygon style.
 *
 * @return the created style.
 */
public static Style createPolygonStyle() {

	// create a partially opaque outline stroke
	final Stroke stroke = styleFactory.createStroke(filterFactory.literal(Color.BLUE), filterFactory.literal(1),
			filterFactory.literal(0.5));

	// create a partial opaque fill
	final Fill fill = styleFactory.createFill(filterFactory.literal(Color.CYAN), filterFactory.literal(0.5));

	/*
	 * Setting the geometryPropertyName arg to null signals that we want to draw the default geomettry of features
	 */
	final PolygonSymbolizer sym = styleFactory.createPolygonSymbolizer(stroke, fill, 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;
}
 
Example #9
Source File: FieldConfigFilename.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Gets the fill.
 *
 * @param graphicFill the graphic fill
 * @param fieldConfigManager the field config manager
 * @return the fill
 */
@Override
public Fill getFill(GraphicFill graphicFill, GraphicPanelFieldManager fieldConfigManager) {
    if (fieldConfigManager == null) {
        return null;
    }

    Fill fill = null;
    FieldConfigBase fieldConfig = fieldConfigManager.get(FieldIdEnum.OVERALL_OPACITY);
    if (fieldConfig != null) {
        Expression fillColour = null;
        Expression fillColourOpacity = null;

        if (fieldConfig instanceof FieldConfigColour) {
            fillColourOpacity = ((FieldConfigColour) fieldConfig).getColourOpacityExpression();
        } else {
            fillColourOpacity = fieldConfig.getExpression();
        }

        fill = getStyleFactory().fill(graphicFill, fillColour, fillColourOpacity);
    }
    return fill;
}
 
Example #10
Source File: SelectedSymbolTest.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Gets the graphic.
 *
 * @param symbolizer the symbolizer
 * @return the graphic
 */
private Graphic getGraphic(Symbolizer symbolizer) {
    Graphic graphic = null;

    if (symbolizer instanceof PointSymbolizerImpl) {
        PointSymbolizer pointSymbolizer = (PointSymbolizer) symbolizer;
        graphic = pointSymbolizer.getGraphic();
    } else if (symbolizer instanceof PolygonSymbolizerImpl) {
        PolygonSymbolizer polygonSymbolizer = (PolygonSymbolizer) symbolizer;
        if (polygonSymbolizer != null) {
            Fill fill = polygonSymbolizer.getFill();

            if (fill != null) {
                graphic = fill.getGraphicFill();
            }
        }
    }

    return graphic;
}
 
Example #11
Source File: SelectedSymbolTest.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Test method for {@link
 * com.sldeditor.common.data.SelectedSymbol#getSymbolList(org.opengis.style.GraphicalSymbol)}.
 */
@Test
public void testGetSymbolList() {

    StyleFactoryImpl styleFactory = (StyleFactoryImpl) CommonFactoryFinder.getStyleFactory();
    FilterFactory ff = CommonFactoryFinder.getFilterFactory();

    Stroke stroke = null;
    Fill fill = styleFactory.createFill(ff.literal(DefaultSymbols.defaultColour()));
    GraphicalSymbol symbolToAdd = styleFactory.mark(ff.literal("circle"), fill, stroke);

    List<GraphicalSymbol> symbolList = SelectedSymbol.getInstance().getSymbolList(symbolToAdd);

    assertEquals(1, symbolList.size());

    assertEquals(symbolToAdd, symbolList.get(0));
}
 
Example #12
Source File: GetMinimumVersionTest.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/** Test method for PolygonFillDetails */
@Test
public void testPolygonFillGetMinimumVersion() {
    PolygonFillDetails details = new PolygonFillDetails();

    details.getMinimumVersion(null, null, null);

    Fill fill = styleFactory.createFill(ff.literal("#654321"), ff.literal(3.2));
    Graphic graphicFill = styleFactory.createDefaultGraphic();
    fill.setGraphicFill(graphicFill);

    List<VendorOptionPresent> vendorOptionsPresentList = null;
    Object parentObj = null;
    details.getMinimumVersion(parentObj, fill, vendorOptionsPresentList);

    vendorOptionsPresentList = new ArrayList<VendorOptionPresent>();
    details.getMinimumVersion(parentObj, fill, vendorOptionsPresentList);

    assertTrue(vendorOptionsPresentList.size() == 0);
}
 
Example #13
Source File: FillTreeItemTest.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Test method for {@link
 * com.sldeditor.ui.tree.item.FillTreeItem#getTreeString(java.lang.Object)}.
 */
@Test
public void testGetTreeString() {
    FillTreeItem item = new FillTreeItem();
    String actualValue = item.getTreeString(null, null);
    String expectedValue = Localisation.getString(SLDTreeTools.class, "TreeItem.fill");
    assertTrue(actualValue.compareTo(expectedValue) == 0);

    Fill fill = DefaultSymbols.createDefaultGraphicFill();

    actualValue = item.getTreeString(null, fill);
    assertTrue(actualValue.compareTo(expectedValue) == 0);

    actualValue = item.getTreeString(null, fill);
    assertTrue(actualValue.compareTo(expectedValue) == 0);
}
 
Example #14
Source File: SLDTreeLeafPoint.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Fill getFill(Symbolizer symbolizer) {
    if (symbolizer instanceof PointSymbolizer) {
        PointSymbolizer point = (PointSymbolizer) symbolizer;
        Graphic graphic = point.getGraphic();

        if (graphic != null) {
            List<GraphicalSymbol> symbolList = graphic.graphicalSymbols();

            if ((symbolList != null) && !symbolList.isEmpty()) {
                GraphicalSymbol obj = symbolList.get(0);

                if (obj instanceof MarkImpl) {
                    MarkImpl mark = (MarkImpl) obj;

                    return mark.getFill();
                }
            }
        }
    }
    return null;
}
 
Example #15
Source File: FieldConfigWKT.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Gets the fill value.
 *
 * @param fieldConfigManager the field config manager
 * @return the fill value
 */
private Fill getFillValue(GraphicPanelFieldManager fieldConfigManager) {
    Fill fill;
    FieldConfigBase field;
    Expression expFillColour = null;
    Expression expFillColourOpacity = null;

    field = fieldConfigManager.get(this.fillFieldConfig.getColour());
    if (field instanceof FieldConfigColour) {
        FieldConfigColour colourField = (FieldConfigColour) field;

        expFillColour = colourField.getColourExpression();
    }

    // Opacity
    field = fieldConfigManager.get(this.fillFieldConfig.getOpacity());
    if (field != null) {
        expFillColourOpacity = field.getExpression();
    }
    fill = getStyleFactory().createFill(expFillColour, expFillColourOpacity);
    return fill;
}
 
Example #16
Source File: FieldConfigArrow.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Gets the fill value.
 *
 * @param fieldConfigManager the field config manager
 * @param fillEnabled the fill enabled
 * @return the fill value
 */
private Fill getFillValue(GraphicPanelFieldManager fieldConfigManager, boolean fillEnabled) {
    FieldConfigBase field;
    Fill fill = null;

    if (fillEnabled && (fillFieldConfig != null)) {
        Expression expFillColour = null;
        Expression expFillColourOpacity = null;

        field = fieldConfigManager.get(fillFieldConfig.getColour());
        if (field instanceof FieldConfigColour) {
            FieldConfigColour colourField = (FieldConfigColour) field;

            expFillColour = colourField.getColourExpression();
        }

        field = fieldConfigManager.get(fillFieldConfig.getOpacity());
        if (field != null) {
            expFillColourOpacity = field.getExpression();
        }
        fill = getStyleFactory().createFill(expFillColour, expFillColourOpacity);
    }
    return fill;
}
 
Example #17
Source File: FeatureLayer.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void visit(TextSymbolizer text) {
    super.visit(text);
    TextSymbolizer textCopy = (TextSymbolizer) pages.peek();
    Fill textFill = textCopy.getFill();
    if (textFill != null) {
        Expression opacityExpression = textFill.getOpacity();
        if (opacityExpression != null) {
            textOpacity = opacityExpression.evaluate(opacityExpression, Double.class);
        }
    }
}
 
Example #18
Source File: SLDTreeLeafPolygon.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Fill getFill(Symbolizer symbolizer) {
    Fill fill = null;

    if (symbolizer instanceof PolygonSymbolizer) {
        PolygonSymbolizer polygon = (PolygonSymbolizer) symbolizer;

        fill = polygon.getFill();
    }
    return fill;
}
 
Example #19
Source File: FeatureLayer.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void visit(TextSymbolizer text) {
    super.visit(text);
    TextSymbolizer textCopy = (TextSymbolizer) pages.peek();
    Fill textFill = textCopy.getFill();
    if (textFill != null) {
        textFill.setOpacity(textExp);
    } else {
        textCopy.setFill(defaultTextFill);
    }
}
 
Example #20
Source File: FeatureLayer.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
@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);
    }
}
 
Example #21
Source File: FillViewer.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
/**
 * TODO summary sentence for setFill ...
 *
 * @param fill
 * @param mode
 * @param enabled
 */
public void setFill(final Fill fill2, final Mode mode, final Color defaultColor) {
	listen(false);
	try {

		boolean enabled = true;
		Fill fill = fill2;
		if (fill == null) {
			final StyleBuilder builder = new StyleBuilder();
			fill = builder.createFill(defaultColor, 0.5);
			enabled = false;
		}

		this.enabled = enabled && mode != Mode.NONE && mode != Mode.LINE && fill != null;
		this.color = SLD.color(fill);
		this.opacity = SLD.opacity(fill);

		// Fill is used in point and polygon
		this.on.setEnabled(mode != Mode.NONE && mode != Mode.LINE);
		this.chooser.setColor(this.color);

		final String text = MessageFormat.format("{0,number,#0%}", this.opacity); //$NON-NLS-1$
		this.percent.setText(text);
		this.percent.select(this.percent.indexOf(text));

		this.on.setSelection(this.enabled);
		this.chooser.setEnabled(this.enabled);
		this.percent.setEnabled(this.enabled);
	} finally {
		listen(true);
	}
}
 
Example #22
Source File: SLDExternalImages.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Update fill.
 *
 * @param resourceLocator the resource locator
 * @param fill the fill
 * @param externalImageList the external image list
 */
private static void updateFill(
        URL resourceLocator,
        Fill fill,
        List<String> externalImageList,
        ProcessGraphicSymbolInterface process) {
    if ((fill != null) && (fill.getGraphicFill() != null)) {
        process.processGraphicalSymbol(
                resourceLocator, fill.getGraphicFill().graphicalSymbols(), externalImageList);
    }
}
 
Example #23
Source File: SLDTreeLeafPointTest.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Test method for {@link
 * com.sldeditor.common.tree.leaf.SLDTreeLeafPoint#getFill(org.opengis.style.Symbolizer)}.
 */
@Test
public void testGetFill() {
    SLDTreeLeafPoint leaf = new SLDTreeLeafPoint();
    assertNull(leaf.getFill(null));
    assertNull(leaf.getFill(DefaultSymbols.createDefaultPolygonSymbolizer()));

    PointSymbolizer pointSymbolizer = DefaultSymbols.createDefaultPointSymbolizer();

    Fill expectedFill = null;
    Graphic graphic = pointSymbolizer.getGraphic();

    if (graphic != null) {
        List<GraphicalSymbol> symbolList = graphic.graphicalSymbols();

        if ((symbolList != null) && !symbolList.isEmpty()) {
            GraphicalSymbol obj = symbolList.get(0);

            if (obj != null) {
                if (obj instanceof MarkImpl) {
                    MarkImpl mark = (MarkImpl) obj;

                    expectedFill = mark.getFill();
                }
            }
        }
    }

    assertEquals(expectedFill, leaf.getFill(pointSymbolizer));
}
 
Example #24
Source File: SLDTreeLeafFactory.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Checks if item is selected.
 *
 * @param userObject the user object
 * @param parentSymbolizer the parent symbolizer
 * @return true, if is item selected
 */
public boolean isItemSelected(Object userObject, Symbolizer parentSymbolizer) {
    boolean selectedItem = false;

    if (userObject instanceof Fill) {
        selectedItem = hasFill(parentSymbolizer);
    } else if (userObject instanceof Stroke) {
        selectedItem = hasStroke(parentSymbolizer);
    }

    return selectedItem;
}
 
Example #25
Source File: StyleGenerator.java    From constellation with Apache License 2.0 5 votes vote down vote up
private static Style createLineStyle() {
    final StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory();
    final FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory();

    // create a partially opaque outline stroke
    final Stroke stroke = styleFactory.createStroke(
            filterFactory.literal(Color.WHITE),
            filterFactory.literal(1),
            filterFactory.literal(.5)
    );

    // create a partially opaque fill
    final Fill fill = styleFactory.createFill(
            filterFactory.literal(Color.RED),
            filterFactory.literal(.25)
    );

    // setting the geometryPropertyName arg to null signals that we want to draw the default geometry of features
    final PolygonSymbolizer sym = styleFactory.createPolygonSymbolizer(stroke, fill, null);

    // make rule
    final Rule rule = styleFactory.createRule();
    rule.symbolizers().add(sym);

    final FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle(new Rule[]{rule});
    final Style style = styleFactory.createStyle();
    style.getDescription().setTitle("Line Style");
    style.featureTypeStyles().add(fts);

    return style;
}
 
Example #26
Source File: SLDTreeLeafFactory.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Gets the fill.
 *
 * @param symbolizer the symbolizer
 * @return the fill
 */
public Fill getFill(Symbolizer symbolizer) {
    Fill fill = null;
    if (symbolizer != null) {
        SLDTreeLeafInterface obj = map.get(symbolizer.getClass());
        if (obj != null) {
            fill = obj.getFill(symbolizer);
        }

        if (fill == null) {
            fill = styleFactory.getDefaultFill();
        }
    }
    return fill;
}
 
Example #27
Source File: SLDTreeLeafLine.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Gets the fill.
 *
 * @param symbolizer the symbolizer
 * @return the fill
 */
/*
 * (non-Javadoc)
 *
 * @see com.sldeditor.ui.tree.SLDTreeLeafInterface#getFill(org.opengis.style.Symbolizer)
 */
@Override
public Fill getFill(Symbolizer symbolizer) {
    return null;
}
 
Example #28
Source File: DefaultSymbols.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a default graphic fill.
 *
 * @return the fill
 */
public static Fill createDefaultGraphicFill() {

    Graphic graphicFill = styleFactory.createDefaultGraphic();

    Expression colour = ff.literal(DEFAULT_FILL_COLOUR);
    Expression backgroundColour = null;
    Expression opacity = ff.literal(1.0);

    return styleFactory.createFill(colour, backgroundColour, opacity, graphicFill);
}
 
Example #29
Source File: StyleUtilities.java    From hortonmachine with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a default {@link Rule} for a polygon.
 * 
 * @return the default rule.
 */
public static Rule createDefaultPolygonRule() {
    PolygonSymbolizer polygonSymbolizer = sf.createPolygonSymbolizer();
    Fill fill = createDefaultFill();
    polygonSymbolizer.setFill(fill);
    polygonSymbolizer.setStroke(createDefaultStroke());

    Rule rule = sf.createRule();
    rule.setName("New rule");
    rule.symbolizers().add(polygonSymbolizer);

    return rule;
}
 
Example #30
Source File: DefaultSymbols.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates the default polygon symbolizer.
 *
 * @return the polygon symbolizer
 */
public static PolygonSymbolizer createDefaultPolygonSymbolizer() {
    Stroke stroke = styleFactory.createStroke(ff.literal(DEFAULT_LINE_COLOUR), ff.literal(2));

    Fill fill = styleFactory.getDefaultFill();
    PolygonSymbolizer polygonSymbolizer = styleFactory.createPolygonSymbolizer();
    polygonSymbolizer.setStroke(stroke);
    polygonSymbolizer.setFill(fill);
    return polygonSymbolizer;
}