本文整理汇总了Java中org.geotools.styling.SLD.opacity方法的典型用法代码示例。如果您正苦于以下问题:Java SLD.opacity方法的具体用法?Java SLD.opacity怎么用?Java SLD.opacity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.geotools.styling.SLD
的用法示例。
在下文中一共展示了SLD.opacity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setFill
import org.geotools.styling.SLD; //导入方法依赖的package包/类
/**
* 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);
}
}
示例2: setStroke
import org.geotools.styling.SLD; //导入方法依赖的package包/类
/**
* TODO summary sentence for setStroke ...
*
* @param line
* @param mode
* @param defaultColor
*/
public void setStroke(final Stroke aLine, final Mode mode, final Color defaultColor) {
listen(false);
try {
boolean enabled = true;
Stroke line = aLine;
if ( line == null ) {
final StyleBuilder builder = new StyleBuilder();
line = builder.createStroke(defaultColor);
enabled = false;
}
this.enabled = enabled && mode != Mode.NONE && line != null;
this.color = SLD.color(line);
this.width = SLD.width(line);
this.opacity = SLD.opacity(line);
// Stroke is used in line, point and polygon
this.on.setEnabled(mode != Mode.NONE);
this.chooser.setColor(this.color);
String text = MessageFormat.format("{0,number,#0}", this.width); //$NON-NLS-1$
this.size.setText(text);
this.size.select(this.size.indexOf(text));
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.size.setEnabled(this.enabled);
this.percent.setEnabled(this.enabled);
} finally {
listen(true); // listen to user now
}
}