本文整理汇总了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));
}
示例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);
}
示例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);
}
}
}
示例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;
}
示例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);
}
示例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;
}