本文整理汇总了Java中org.opengis.filter.expression.Expression类的典型用法代码示例。如果您正苦于以下问题:Java Expression类的具体用法?Java Expression怎么用?Java Expression使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Expression类属于org.opengis.filter.expression包,在下文中一共展示了Expression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testClass
import org.opengis.filter.expression.Expression; //导入依赖的package包/类
/**
* Test class.
*
* @param objUnderTest the obj under test
*/
private void testClass(FilterConfigInterface objUnderTest) {
assertNotNull(objUnderTest.getFilterConfiguration());
assertNotNull(objUnderTest.createFilter());
assertNull(objUnderTest.createLogicFilter(null));
BinaryComparisonAbstract filter = (BinaryComparisonAbstract)objUnderTest.createFilter(null);
assertNull(filter.getExpression1());
assertNull(filter.getExpression2());
List<Expression> parameterList = new ArrayList<Expression>();
parameterList.add(ff.literal("expr1"));
filter = (BinaryComparisonAbstract) objUnderTest.createFilter(parameterList);
assertNull(filter.getExpression1());
assertNull(filter.getExpression2());
parameterList.add(ff.literal("expr2"));
parameterList.add(ff.literal(false));
filter = (BinaryComparisonAbstract) objUnderTest.createFilter(parameterList);
assertNotNull(filter.getExpression1());
assertNotNull(filter.getExpression2());
System.out.println(filter.toString());
}
示例2: setValue
import org.opengis.filter.expression.Expression; //导入依赖的package包/类
@Override
public void setValue(Object aValue) {
this.value = null;
this.expression = null;
if (aValue instanceof Float) {
this.value = (Float) aValue;
} else if (aValue instanceof Double) {
this.value = ((Double) aValue).floatValue();
} else if (aValue instanceof LiteralExpressionImpl) {
LiteralExpressionImpl literal = (LiteralExpressionImpl) aValue;
value = literal.evaluate(value, Float.class);
} else if ((aValue instanceof AttributeExpressionImpl)
|| (aValue instanceof FunctionExpressionImpl)
|| (aValue instanceof MathExpressionImpl)) {
this.expression = (Expression) aValue;
}
}
示例3: createFilter
import org.opengis.filter.expression.Expression; //导入依赖的package包/类
/**
* Creates the filter.
*
* @param parameterList the parameter list
* @return the filter
*/
@Override
public Filter createFilter(List<Expression> parameterList) {
IsLessThenImpl filter = null;
if ((parameterList == null) || (parameterList.size() != 3)) {
filter = new IsLessThanExtended();
} else {
LiteralExpressionImpl matchCase = (LiteralExpressionImpl) parameterList.get(2);
filter = new IsLessThanExtended(parameterList.get(0), parameterList.get(1),
(Boolean) matchCase.getValue());
}
return filter;
}
示例4: setAttribute
import org.opengis.filter.expression.Expression; //导入依赖的package包/类
/**
* Sets the attribute.
*
* @param expression the new attribute
*/
public void setAttribute(Expression expression) {
String propertyName = null;
if (expression instanceof PropertyExistsFunction) {
Expression e = ((PropertyExistsFunction) expression).getParameters().get(0);
Object value = ((LiteralExpressionImpl) e).getValue();
propertyName = ((AttributeExpressionImpl) value).getPropertyName();
} else if (expression instanceof AttributeExpressionImpl) {
propertyName = ((AttributeExpressionImpl) expression).getPropertyName();
} else if (expression instanceof LiteralExpressionImpl) {
propertyName = AttributeUtils
.extract((String) ((LiteralExpressionImpl) expression).getValue());
}
if (propertyName != null) {
oldValueObj = propertyName;
attributeComboBox.setSelectedItem(propertyName);
} else {
oldValueObj = propertyName;
attributeComboBox.setSelectedIndex(-1);
}
}
示例5: populate
import org.opengis.filter.expression.Expression; //导入依赖的package包/类
/**
* Populate.
*
* @param expression the expression
*/
public void populate(Expression expression) {
if (expression != null) {
populateAttributeComboxBox(expression);
if ((expression == null) || (expression instanceof NilExpression)
|| (expression instanceof ConstantExpression)
|| (expression instanceof LiteralExpressionImpl)) {
valuePanel.populateExpression(expression);
} else if (expression instanceof AttributeExpressionImpl) {
setAttribute(expression);
} else {
expressionPanel.populateExpression(expression);
}
}
}
示例6: accept
import org.opengis.filter.expression.Expression; //导入依赖的package包/类
/**
* Accept.
*
* @param symbol the symbol
* @return true, if successful
*/
@Override
public boolean accept(GraphicalSymbol symbol) {
if (symbol != null) {
if (symbol instanceof MarkImpl) {
MarkImpl marker = (MarkImpl) symbol;
Expression expression = marker.getWellKnownName();
if (expression instanceof LiteralExpressionImpl) {
LiteralExpressionImpl lExpression = (LiteralExpressionImpl) expression;
Object value = lExpression.getValue();
if (value instanceof String) {
String valueString = (String) value;
if (valueString.startsWith(ArrowUtils.getArrowPrefix())) {
return true;
}
}
}
}
}
return false;
}
示例7: updateSymbol
import org.opengis.filter.expression.Expression; //导入依赖的package包/类
/**
* Update symbol.
*/
private void updateSymbol() {
if (!Controller.getInstance().isPopulating()) {
StandardData standardData = getStandardData();
Expression geometryField = ExtractGeometryField.getGeometryField(fieldConfigVisitor);
PointSymbolizer pointSymbolizer = (PointSymbolizer) SelectedSymbol.getInstance()
.getSymbolizer();
if (pointSymbolizer != null) {
pointSymbolizer.setName(standardData.name);
pointSymbolizer.setDescription(standardData.description);
pointSymbolizer.setUnitOfMeasure(standardData.unit);
pointSymbolizer.setGeometry(geometryField);
this.fireUpdateSymbol();
}
}
}
示例8: testClass
import org.opengis.filter.expression.Expression; //导入依赖的package包/类
/**
* Test class.
*
* @param objUnderTest the obj under test
*/
private void testClass(FilterConfigInterface objUnderTest) {
assertNotNull(objUnderTest.getFilterConfiguration());
assertNotNull(objUnderTest.createFilter());
assertNull(objUnderTest.createLogicFilter(null));
GeometryFilterImpl filter = (GeometryFilterImpl)objUnderTest.createFilter(null);
assertNull(filter.getExpression1());
assertNull(filter.getExpression2());
List<Expression> parameterList = new ArrayList<Expression>();
parameterList.add(ff.literal("expr1"));
filter = (GeometryFilterImpl) objUnderTest.createFilter(parameterList);
assertNull(filter.getExpression1());
assertNull(filter.getExpression2());
parameterList.add(ff.literal("expr2"));
filter = (GeometryFilterImpl) objUnderTest.createFilter(parameterList);
assertNotNull(filter.getExpression1());
assertNotNull(filter.getExpression2());
System.out.println(filter.toString());
}
示例9: createChannelSelectionError
import org.opengis.filter.expression.Expression; //导入依赖的package包/类
/**
* Creates the channel selection error object.
*
* @param styleFactory the style factory
* @param contrastMethod the contrast method
* @return the channel selection
*/
private ChannelSelection createChannelSelectionError(StyleFactoryImpl styleFactory,
ContrastMethod contrastMethod) {
ContrastEnhancement contrastEnhancement = (ContrastEnhancement) styleFactory
.contrastEnhancement(null, contrastMethod.name());
FilterFactory ff = CommonFactoryFinder.getFilterFactory();
Map<String, Expression> options = contrastEnhancement.getOptions();
options.put("algorithm", ff.literal("TestStretchToMinimumMaximum"));
options.put("minValue", ff.literal("1.0"));
options.put("maxValue", ff.literal("5.0"));
SelectedChannelType channelType = styleFactory.createSelectedChannelType("channel name",
contrastEnhancement);
SelectedChannelType[] channels = new SelectedChannelType[3];
channels[0] = channelType;
channels[1] = channelType;
channels[2] = channelType;
ChannelSelection channelSelection = styleFactory.createChannelSelection(channels);
return channelSelection;
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:29,代码来源:VOGeoServerContrastEnhancementNormalizeRedTest.java
示例10: testExpressionPanelv2
import org.opengis.filter.expression.Expression; //导入依赖的package包/类
/**
* Test method for {@link com.sldeditor.filter.v2.expression.ExpressionPanelv2#ExpressionPanelv2(java.util.List)}.
*/
@Test
public void testExpressionPanelv2() {
TestExpressionPanelv2 testObj = new TestExpressionPanelv2(null);
assertNull(testObj.getVendorOptionList());
testObj.dataSourceAboutToUnloaded(null);
testObj.populate((String) null);
testObj.configure("title", String.class, false);
testObj.testShowExpressionDialog(null, null);
FilterFactory ff = CommonFactoryFinder.getFilterFactory();
Expression expectedExpression = ff.add(ff.property("field"), ff.literal(42));
testObj.populate(expectedExpression);
testObj.testShowExpressionDialog(Integer.class, expectedExpression);
assertEquals(testObj.getExpression().toString(), testObj.getExpressionString());
testObj.dataApplied();
testObj.testSelection();
}
示例11: createChannelSelection
import org.opengis.filter.expression.Expression; //导入依赖的package包/类
/**
* Creates the channel selection object.
*
* @param styleFactory the style factory
* @param contrastMethod the contrast method
* @return the channel selection
*/
private ChannelSelection createChannelSelection(StyleFactoryImpl styleFactory,
ContrastMethod contrastMethod) {
ContrastEnhancement contrastEnhancement =
(ContrastEnhancement) styleFactory.contrastEnhancement(null,
contrastMethod.name());
FilterFactory ff = CommonFactoryFinder.getFilterFactory();
Map<String, Expression> options = contrastEnhancement.getOptions();
options.put("algorithm", ff.literal("StretchToMinimumMaximum"));
options.put("minValue", ff.literal("1"));
options.put("maxValue", ff.literal("5"));
SelectedChannelType channelType = styleFactory.createSelectedChannelType("channel name",
contrastEnhancement);
SelectedChannelType[] channels = new SelectedChannelType[3];
channels[0] = channelType;
channels[1] = channelType;
channels[2] = channelType;
ChannelSelection channelSelection = styleFactory.createChannelSelection(channels);
return channelSelection;
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:30,代码来源:VOGeoServerContrastEnhancementNormalizeBlueTest.java
示例12: setFunction
import org.opengis.filter.expression.Expression; //导入依赖的package包/类
/**
* Sets the function.
*
* @param expression the new attribute
*/
public void setFunction(Expression expression) {
if (expression == null) {
functionComboBox.setSelectedIndex(-1);
} else {
if (expression instanceof FunctionExpressionImpl) {
FunctionExpressionImpl functionExpression = (FunctionExpressionImpl) expression;
FunctionName function = functionExpression.getFunctionName();
String functionName = function.getName();
oldValueObj = functionName;
functionComboBox.setSelectedItem(functionName);
} else {
ConsoleManager.getInstance().error(this, Localisation.getString(FunctionField.class,
"DataSourceAttributePanel.error1"));
}
}
}
示例13: showExpressionDialog
import org.opengis.filter.expression.Expression; //导入依赖的package包/类
/**
* Show expression dialog.
*
* @param type the type
* @param expression the expression
*/
protected void showExpressionDialog(Class<?> type, Expression expression) {
rootNode = new ExpressionNode();
if (model != null) {
model.setRoot(rootNode);
ExpressionNode expressionNode = (ExpressionNode) rootNode;
expressionNode.setType(type);
if (expression != null) {
populateExpression(expressionNode, expression);
}
// Auto select the first item
if (tree.getRowCount() > 0) {
tree.setSelectionRow(0);
}
}
}
示例14: getValue
import org.opengis.filter.expression.Expression; //导入依赖的package包/类
/**
* Gets the value from an expression.
*
* @param expression the expression
* @return the value
*/
private static double getValue(Expression expression) {
Object objValue = null;
if (expression instanceof ConstantExpression) {
objValue = ((ConstantExpression) expression).getValue();
} else if (expression instanceof LiteralExpressionImpl) {
objValue = ((LiteralExpressionImpl) expression).getValue();
}
if (objValue instanceof Double) {
return ((Double) objValue).doubleValue();
} else if (objValue instanceof Long) {
return ((Long) objValue).doubleValue();
} else if (objValue instanceof Integer) {
return ((Integer) objValue).doubleValue();
} else if (objValue instanceof String) {
return Double.valueOf((String) objValue).doubleValue();
}
return 0.0;
}
示例15: getFill
import org.opengis.filter.expression.Expression; //导入依赖的package包/类
/**
* Gets the fill.
*
* @param graphicFill the graphic fill
* @param fieldConfigManager the field config manager
* @return the fill
*/
@Override
public Fill getFill(GraphicFill graphicFill, GraphicPanelFieldManager fieldConfigManager) {
if (fieldConfigManager == null) {
return null;
}
Fill fill = null;
FieldConfigBase fieldConfig = fieldConfigManager.get(FieldIdEnum.OVERALL_OPACITY);
if (fieldConfig != null) {
Expression fillColour = null;
Expression fillColourOpacity = null;
if (fieldConfig instanceof FieldConfigColour) {
fillColourOpacity = ((FieldConfigColour) fieldConfig).getColourOpacityExpression();
} else {
fillColourOpacity = fieldConfig.getExpression();
}
fill = getStyleFactory().fill(graphicFill, fillColour, fillColourOpacity);
}
return fill;
}