Java Code Examples for org.geotools.styling.StyleBuilder#createFill()

The following examples show how to use org.geotools.styling.StyleBuilder#createFill() . 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: 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 2
Source File: FeatureLayer.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
private ApplyingStyleVisitor() {
    StyleBuilder sb = new StyleBuilder();
    final double layerOpacity = 1.0 - getTransparency();
    polyFillExp = sb.literalExpression(polyFillOpacity * layerOpacity);
    polyStrokeExp = sb.literalExpression(polyStrokeOpacity * layerOpacity);
    textExp = sb.literalExpression(textOpacity * layerOpacity);
    defaultTextFill = sb.createFill(Color.BLACK, textOpacity * layerOpacity);
}
 
Example 3
Source File: FillViewer.java    From gama with GNU General Public License v3.0 2 votes vote down vote up
/**
 * TODO summary sentence for getFill ...
 *
 * @param build
 *
 * @return Fill defined by this model
 */
public Fill getFill(final StyleBuilder build) {
	if (!this.enabled) { return null; }
	if (!Double.isNaN(this.opacity)) { return build.createFill(this.color, this.opacity); }
	return build.createFill(this.color);
}