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


Java Literal.getValue方法代码示例

本文整理汇总了Java中org.opengis.filter.expression.Literal.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java Literal.getValue方法的具体用法?Java Literal.getValue怎么用?Java Literal.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opengis.filter.expression.Literal的用法示例。


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

示例1: utcTimeZone

import org.opengis.filter.expression.Literal; //导入方法依赖的package包/类
private static void utcTimeZone() throws Exception{
	
	// utcTimeZone start
    Filter filter = ECQL.toFilter("2006-11-30T01:00:00+03:00 DURING 2006-11-30T00:30:00+03:00/2006-11-30T01:30:00+03:00 ");
	// utcTimeZone end
    Utility.prittyPrintFilter(filter);
    
    Boolean result = filter.evaluate(null);
    System.out.println("Result of filter evaluation: " + result);

    During during = (During) filter;
    Literal literal = (Literal)during.getExpression1();
    Date date = (Date)literal.getValue();
    
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ");
    TimeZone tz = TimeZone.getTimeZone("GMT+0300");
    sdf.setTimeZone(tz);
    System.out.println("Expression 1 as Date: " +sdf.format(date));
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:20,代码来源:ECQLExamples.java

示例2: visit

import org.opengis.filter.expression.Literal; //导入方法依赖的package包/类
/**
 * Please note we are only visiting literals involved in spatial operations.
 * 
 * @param literal
 *            , hopefully a Geometry or Envelope
 * @param data
 *            Incoming BoundingBox (or Envelope or CRS)
 * 
 * @return ReferencedEnvelope updated to reflect literal
 */
@Override
public Object visit(
		final Literal expression,
		final Object data ) {
	final Object value = expression.getValue();
	if (value instanceof Geometry) {
		final Geometry geometry = (Geometry) value;
		return geometry;
	}
	else {
		LOGGER.info("LiteralExpression ignored!");
	}
	return bbox(data);
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:25,代码来源:ExtractGeometryFilterVisitor.java

示例3: populateField

import org.opengis.filter.expression.Literal; //导入方法依赖的package包/类
/**
 * Populate field.
 *
 * @param font the font
 */
@Override
public void populateField(Font font) {
    if ((textField != null) && (font != null)) {
        if (font.getFamily().isEmpty()) {
            textField.setText("");
        } else if (font.getFamily().isEmpty() || (font.getStyle() == null)
                || (font.getWeight() == null) || (font.getSize() == null)) {
            textField.setText("");
        } else {
            textField.setText(sampleText);

            int styleIndex = 0;
            int weightIndex = 0;
            String familyName = font.getFamily().get(0).toString();
            String styleName = ((Literal) font.getStyle()).getValue().toString();
            for (int index = 0; index < styles.length; index++) {
                if (styles[index].equalsIgnoreCase(styleName)) {
                    styleIndex = index;
                    break;
                }
            }

            String weightName = ((Literal) font.getWeight()).getValue().toString();
            for (int index = 0; index < weights.length; index++) {
                if (weights[index].equalsIgnoreCase(weightName)) {
                    weightIndex = index;
                    break;
                }
            }

            StringBuilder sb = new StringBuilder(familyName);
            if (weightIndex == 0) {
                if (styleIndex == 0) {
                    sb.append("-PLAIN-");
                } else {
                    sb.append("-ITALIC-");
                }
            } else {
                if (styleIndex == 0) {
                    sb.append("-BOLD-");
                } else {
                    sb.append("-BOLDITALIC-");
                }
            }

            // Get font size
            int size = 12;
            if (font.getSize() instanceof Literal) {
                Literal sizeExpression = (Literal) font.getSize();
                Object obj = sizeExpression.getValue();
                if (obj instanceof Number) {
                    Number number = (Number) obj;
                    size = number.intValue();
                } else if (obj instanceof String) {
                    size = Double.valueOf((String) obj).intValue();
                }
            }
            sb.append(size);

            java.awt.Font sampleFont = java.awt.Font.decode(sb.toString());

            textField.setFont(sampleFont);
        }
    }
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:71,代码来源:FieldConfigFontPreview.java

示例4: evaluateLiteral

import org.opengis.filter.expression.Literal; //导入方法依赖的package包/类
protected Object evaluateLiteral(Literal expression, Class target ) {
    Object literal = null;

    // HACK: let expression figure out the right value for numbers,
    // since the context is almost always improperly set and the
    // numeric converters try to force floating points to integrals
    // JD: the above is no longer true, so instead do a safe conversion
    if(target != null) {
        // use the target type
        if (Number.class.isAssignableFrom(target)) {
            literal = safeConvertToNumber(expression, target);

            if (literal == null) {
                literal = safeConvertToNumber(expression, Number.class);
            }
        }
        else {
            literal = expression.evaluate(null, target);
        }
    }

    //check for conversion to number
    if (target == null) {
        // we don't know the target type, check for a conversion to a number

        Number number = safeConvertToNumber(expression, Number.class);
        if (number != null) {
            literal = number;
        }
    }

    // if the target was not known, of the conversion failed, try the
    // type guessing dance literal expression does only for the following
    // method call
    if(literal == null)
        literal = expression.evaluate(null);

    // if that failed as well, grab the value as is
    if(literal == null)
        literal = expression.getValue();

    return literal;
}
 
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:44,代码来源:FilterToElastic.java

示例5: visit

import org.opengis.filter.expression.Literal; //导入方法依赖的package包/类
/**
 * Please note we are only visiting literals involved in spatial operations.
 *
 * @param literal
 *            , hopefully a Geometry or Envelope
 * @param data
 *            Incoming BoundingBox (or Envelope or CRS)
 *
 * @return ReferencedEnvelope updated to reflect literal
 */
@Override
public Object visit(
		final Literal expression,
		final Object data ) {
	final Object value = expression.getValue();
	return btime(value);
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:18,代码来源:ExtractTimeFilterVisitor.java

示例6: visit

import org.opengis.filter.expression.Literal; //导入方法依赖的package包/类
/**
 * Please note we are only visiting literals involved in spatial operations.
 * 
 * @param literal
 *            , hopefully a Geometry or Envelope
 * @param data
 *            Incoming BoundingBox (or Envelope or CRS)
 * 
 * @return ReferencedEnvelope updated to reflect literal
 */
@Override
public Object visit(
		final Literal expression,
		final Object data ) {
	final Object value = expression.getValue();
	return value;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:18,代码来源:PropertyFilterVisitor.java


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