Java Code Examples for org.geotools.filter.LiteralExpressionImpl#getValue()
The following examples show how to use
org.geotools.filter.LiteralExpressionImpl#getValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FieldConfigArrow.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Accept. * * @param symbol the symbol * @return true, if successful */ @Override public boolean accept(GraphicalSymbol symbol) { 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; }
Example 2
Source File: IsLike.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Creates the filter. * * @param parameterList the parameter list * @return the filter */ @Override public Filter createFilter(List<Expression> parameterList) { LikeFilterImpl filter = null; if ((parameterList == null) || parameterList.size() != 6) { filter = new IsLikeExtended(); } else { LiteralExpressionImpl pattern = (LiteralExpressionImpl) parameterList.get(1); LiteralExpressionImpl wildcardMulti = (LiteralExpressionImpl) parameterList.get(2); LiteralExpressionImpl wildcardSingle = (LiteralExpressionImpl) parameterList.get(3); LiteralExpressionImpl escape = (LiteralExpressionImpl) parameterList.get(4); LiteralExpressionImpl matchCase = (LiteralExpressionImpl) parameterList.get(5); filter = new IsLikeExtended( parameterList.get(0), (String) pattern.getValue(), (String) wildcardMulti.getValue(), (String) wildcardSingle.getValue(), (String) escape.getValue(), (Boolean) matchCase.getValue()); } return filter; }
Example 3
Source File: IsGreaterThanEqualTo.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Creates the filter. * * @param parameterList the parameter list * @return the filter */ @Override public Filter createFilter(List<Expression> parameterList) { IsGreaterThanOrEqualToImpl filter = null; if ((parameterList == null) || (parameterList.size() < 2) || (parameterList.size() > 3)) { filter = new IsGreaterThanOrEqualToExtended(); } else { LiteralExpressionImpl matchCase = (LiteralExpressionImpl) parameterList.get(2); filter = new IsGreaterThanOrEqualToExtended( parameterList.get(0), parameterList.get(1), (Boolean) matchCase.getValue()); } return filter; }
Example 4
Source File: IsNotEqualTo.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Creates the filter. * * @param parameterList the parameter list * @return the filter */ @Override public Filter createFilter(List<Expression> parameterList) { IsNotEqualToImpl filter = null; if ((parameterList == null) || (parameterList.size() != 3)) { filter = new IsNotEqualToExtended(); } else { LiteralExpressionImpl matchCase = (LiteralExpressionImpl) parameterList.get(2); filter = new IsNotEqualToExtended( parameterList.get(0), parameterList.get(1), (Boolean) matchCase.getValue()); } return filter; }
Example 5
Source File: IsLessThanEqualTo.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Creates the filter. * * @param parameterList the parameter list * @return the filter */ @Override public Filter createFilter(List<Expression> parameterList) { IsLessThenOrEqualToImpl filter = null; if ((parameterList == null) || (parameterList.size() < 2) || (parameterList.size() > 3)) { filter = new IsLessThanOrEqualToExtended(); } else { LiteralExpressionImpl matchCase = (LiteralExpressionImpl) parameterList.get(2); filter = new IsLessThanOrEqualToExtended( parameterList.get(0), parameterList.get(1), (Boolean) matchCase.getValue()); } return filter; }
Example 6
Source File: IsLessThan.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * 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() < 2) || (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; }
Example 7
Source File: FieldConfigWindBarbs.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * 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(WINDBARBS_PREFIX)) { return true; } } } } } return false; }
Example 8
Source File: CoordinateReferenceSystemValues.java From sldeditor with GNU General Public License v3.0 | 6 votes |
@Override public void setValue(Object aValue) { this.value = null; this.expression = null; if (aValue instanceof LiteralExpressionImpl) { LiteralExpressionImpl literal = (LiteralExpressionImpl) aValue; if (literal.getValue() != null) { value = literal.toString(); } } else if ((aValue instanceof AttributeExpressionImpl) || (aValue instanceof FunctionExpressionImpl) || (aValue instanceof MathExpressionImpl)) { this.expression = (Expression) aValue; } else { if (aValue instanceof String) { value = ((String) aValue); } } }
Example 9
Source File: FieldConfigWKT.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * 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(WKT_PREFIX)) { return true; } } } } } return false; }
Example 10
Source File: PolygonFillDetails.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Option selected. * * @param fieldPanelId the field panel id * @param selectedItem the selected item */ @Override public void optionSelected(Class<?> fieldPanelId, String selectedItem) { setSymbolTypeVisibility(fieldPanelId, selectedItem); selectedFillPanelId = fieldPanelId; FieldConfigBase fieldConfig = fieldConfigManager.get(FieldIdEnum.SIZE); if (fieldConfig.isEnabled()) { Expression expression = fieldConfig.getExpression(); if (expression instanceof LiteralExpressionImpl) { LiteralExpressionImpl l = (LiteralExpressionImpl) expression; Double d = (Double) l.getValue(); if (d <= 0.0) { fieldConfigVisitor.populateField( FieldIdEnum.SIZE, getFilterFactory().literal(1)); } } } dataHasChanged(); }
Example 11
Source File: FieldConfigTTF.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * 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(TTF_PREFIX)) { return true; } } } } } return false; }
Example 12
Source File: FieldConfigMarker.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Accept. * * @param symbol the symbol * @return true, if successful */ @Override public boolean accept(GraphicalSymbol symbol) { 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; List<ValueComboBoxData> localSymbolList = getLocalSymbolList(); for (ValueComboBoxData data : localSymbolList) { if (data.getKey().compareTo(valueString) == 0) { return true; } } } } } return false; }
Example 13
Source File: FieldConfigBase.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Populate literal expression. * * @param expression the expression */ private void populateLiteralExpression(Expression expression) { LiteralExpressionImpl lExpression = (LiteralExpressionImpl) expression; Object objValue = lExpression.getValue(); if (objValue instanceof AttributeExpressionImpl) { expressionType = ExpressionTypeEnum.E_ATTRIBUTE; if (attributeSelectionPanel != null) { attributeSelectionPanel.setAttribute((AttributeExpressionImpl) objValue); } setCachedExpression((AttributeExpressionImpl) objValue); } else { expressionType = ExpressionTypeEnum.E_VALUE; populateExpression(objValue); valueUpdated(); } }
Example 14
Source File: PointFillDetails.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Option selected. * * @param fieldPanelId the field panel id * @param selectedItem the selected item */ @Override public void optionSelected(Class<?> fieldPanelId, String selectedItem) { setSymbolTypeVisibility(fieldPanelId, selectedItem); selectedFillPanelId = fieldPanelId; FieldConfigBase fieldConfig = fieldConfigManager.get(FieldIdEnum.SIZE); if (fieldConfig.isEnabled()) { Expression expression = fieldConfig.getExpression(); if (expression instanceof LiteralExpressionImpl) { LiteralExpressionImpl l = (LiteralExpressionImpl) expression; Double d = (Double) l.getValue(); if (d <= 0.0) { fieldConfigVisitor.populateField( FieldIdEnum.SIZE, getFilterFactory().literal(1)); } } } dataHasChanged(); }
Example 15
Source File: SLDTestRunner.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Check literal value. * * @param message the message * @param expression the expression * @param expectedValue the expected value */ private void checkLiteralValue(String message, Expression expression, int expectedValue) { assertEquals(expression.getClass(), LiteralExpressionImpl.class); LiteralExpressionImpl literalExpression = (LiteralExpressionImpl) expression; Object value = literalExpression.getValue(); assertEquals(value.getClass(), Integer.class, message); Integer actualValue = (Integer) value; String additional = String.format(" Expected '%d' Actual '%d'", expectedValue, actualValue); assertTrue((expectedValue == actualValue), message + additional); }
Example 16
Source File: ExpressionNode.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Sets the expression. * * @param expression the expression to set */ public void setExpression(Expression expression) { this.expression = expression; if (expression instanceof LiteralExpressionImpl) { Object value = ((LiteralExpressionImpl) expression).getValue(); if (value instanceof AttributeExpressionImpl) { this.expression = (AttributeExpressionImpl) value; } } setDisplayString(); this.removeAllChildren(); if (this.expression instanceof EnvFunction) { setEnvFunction(); } else if (this.expression instanceof FunctionExpression) { setFunctionExpression(); } else if (this.expression instanceof FunctionImpl) { setFunctionImpl(); } else if (this.expression instanceof Function) { setFunction(); } else if (expression instanceof MathExpressionImpl) { setMathExpression(expression); } else if (expression instanceof AttributeExpressionImpl) { // AttributeExpressionImpl property = (AttributeExpressionImpl) expression; // TypeManager.getInstance().setLiteralType(literal.getValue().getClass()); } else if (expression instanceof LiteralExpressionImpl) { LiteralExpressionImpl literal = (LiteralExpressionImpl) expression; if (literal.getValue() != null) { TypeManager.getInstance().setDataType(literal.getValue().getClass()); } } }
Example 17
Source File: FontUtils.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Converts a org.geotools.styling.Font to java.awt.Font * * @param font the GeoTools font * @return the Java font */ public static java.awt.Font getFont(Font font) { LiteralExpressionImpl sizeExpression = ((LiteralExpressionImpl) font.getSize()); Object obj = sizeExpression.getValue(); int size; if (obj instanceof String) { size = Integer.valueOf((String) obj); } else if (obj instanceof Double) { size = ((Double) obj).intValue(); } else { size = Integer.valueOf(((String) obj).toString()); } int styleMask = java.awt.Font.PLAIN; String styleName = font.getStyle().toString(); if (styleName != null) { if (styleName.compareToIgnoreCase("ITALIC") == 0) { styleMask |= java.awt.Font.ITALIC; } } String weightName = font.getWeight().toString(); if (weightName != null) { if (weightName.compareToIgnoreCase("BOLD") == 0) { styleMask |= java.awt.Font.BOLD; } } String name = font.getFamily().get(0).toString(); return new java.awt.Font(name, styleMask, size); }
Example 18
Source File: SLDTestRunner.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Check literal value. * * @param message the message * @param expression the expression * @param expectedValue the expected value */ private void checkLiteralValue(String message, Expression expression, String expectedValue) { assertEquals(expression.getClass(), LiteralExpressionImpl.class); LiteralExpressionImpl literalExpression = (LiteralExpressionImpl) expression; Object value = literalExpression.getValue(); String actualValue = null; if (value.getClass() == ValueComboBoxData.class) { actualValue = ((ValueComboBoxData) value).getKey(); } else { assertEquals(value.getClass(), String.class, message); actualValue = (String) value; } String additional = String.format(" Expected '%s' Actual '%s'", expectedValue, actualValue); assertTrue(expectedValue.equals(actualValue), message + additional); }
Example 19
Source File: ColourButton.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Populate. * * @param value the colour value * @param opacity the opacity */ public void populate(String value, Expression opacity) { Color tmpColour = null; float alpha = DefaultSymbols.defaultColourOpacity(); if (value == null) { tmpColour = hex2Rgb(DefaultSymbols.defaultColour()); } else { tmpColour = hex2Rgb(value); } if (opacity instanceof LiteralExpressionImpl) { LiteralExpressionImpl literal = (LiteralExpressionImpl) opacity; Object obj = literal.getValue(); if (obj instanceof Long) { alpha = ((Long) obj).floatValue(); } else if (obj instanceof Integer) { alpha = ((Integer) obj).floatValue(); } else if (obj instanceof Float) { alpha = ((Float) obj).floatValue(); } else if (obj instanceof Double) { alpha = ((Double) obj).floatValue(); } else if (obj instanceof String) { Double d = Double.valueOf((String) obj); alpha = d.floatValue(); } else { ConsoleManager.getInstance().error(this, "Unknown number format"); } } colour = new Color( tmpColour.getRed() / 255.0f, tmpColour.getGreen() / 255.0f, tmpColour.getBlue() / 255.0f, alpha); displayColour(); }
Example 20
Source File: WindBarbDetails.java From sldeditor with GNU General Public License v3.0 | 4 votes |
/** Update symbol. */ private void updateSymbol() { if (!Controller.getInstance().isPopulating()) { ValueComboBoxData windSpeedUnits = fieldConfigVisitor.getComboBox(FieldIdEnum.WINDBARB_WINDSPEED_UNITS); Expression windSpeedExpression = fieldConfigVisitor.getExpression(FieldIdEnum.WINDBARB_WINDSPEED); boolean inNorthernHemisphere = fieldConfigVisitor.getBoolean(FieldIdEnum.WINDBARB_NORTHERN_HEMISPHERE); Object windSpeed = null; if (windSpeedExpression == null) { windSpeed = Integer.valueOf(0); } else if (windSpeedExpression instanceof LiteralExpressionImpl) { LiteralExpressionImpl literalExpression = (LiteralExpressionImpl) windSpeedExpression; windSpeed = literalExpression.getValue(); } else if (windSpeedExpression instanceof ConstantExpression) { ConstantExpression constantExpression = (ConstantExpression) windSpeedExpression; windSpeed = constantExpression.getValue(); } else if (windSpeedExpression instanceof AttributeExpressionImpl) { AttributeExpressionImpl attributeExpression = (AttributeExpressionImpl) windSpeedExpression; windSpeed = String.format( "<ogc:PropertyName>%s</ogc:PropertyName>", attributeExpression.getPropertyName()); } else { ConsoleManager.getInstance() .error( this, Localisation.getField( WindBarbDetails.class, "WindBarb.windspeedError1") + windSpeedExpression.getClass().getName()); } String url = String.format( "windbarbs://default(%s)[%s]", windSpeed, windSpeedUnits.getKey()); if (!inNorthernHemisphere) { url = url + HEMISPHERE_S; } windBarbsExpression = getFilterFactory().literal(url); if (parentObj != null) { parentObj.windBarbValueUpdated(); } } }