本文整理汇总了Java中org.opengis.filter.expression.Expression.evaluate方法的典型用法代码示例。如果您正苦于以下问题:Java Expression.evaluate方法的具体用法?Java Expression.evaluate怎么用?Java Expression.evaluate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opengis.filter.expression.Expression
的用法示例。
在下文中一共展示了Expression.evaluate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getGraphicSize
import org.opengis.filter.expression.Expression; //导入方法依赖的package包/类
/**
* Gets a numeric value for the given graphic
*
* @param feature sample to be used for evals
* @param pointSymbolizer symbolizer
* @param defaultSize size to use is none can be taken from the graphic
*/
private double getGraphicSize(Feature feature, Graphic graphic, int defaultSize) {
if (graphic != null) {
Expression sizeExp = graphic.getSize();
if (sizeExp instanceof Literal) {
Object size = sizeExp.evaluate(feature);
if (size != null) {
if (size instanceof Double) {
return (Double) size;
}
try {
return Double.parseDouble(size.toString());
} catch (NumberFormatException e) {
return defaultSize;
}
}
}
}
return defaultSize;
}
示例2: getWidthSize
import org.opengis.filter.expression.Expression; //导入方法依赖的package包/类
/**
* Gets a numeric value for the given graphic
*
* @param feature sample to be used for evals
* @param pointSymbolizer symbolizer
* @param defaultSize size to use is none can be taken from the graphic
*/
private double getWidthSize(Feature feature, Expression widthExp, int defaultSize) {
if (widthExp != null) {
if (widthExp instanceof Literal) {
Object size = widthExp.evaluate(feature);
if (size != null) {
if (size instanceof Double) {
return (Double) size;
}
try {
return Double.parseDouble(size.toString());
} catch (NumberFormatException e) {
return defaultSize;
}
}
}
}
return defaultSize;
}