use of org.geotools.filter.LiteralExpressionImpl in project sldeditor by robward-scisys.
the class IsLessThan method createFilter.
/**
* 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;
}
use of org.geotools.filter.LiteralExpressionImpl in project sldeditor by robward-scisys.
the class FontUtils method getFont.
/**
* 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);
}
use of org.geotools.filter.LiteralExpressionImpl in project sldeditor by robward-scisys.
the class FieldConfigGeometryField method populateExpression.
/**
* Populate expression.
*
* @param objValue the obj value
*/
/*
* (non-Javadoc)
*
* @see com.sldeditor.ui.detail.config.FieldConfigBase#populateExpression(java.lang.Object)
*/
@Override
public void populateExpression(Object objValue) {
String propertyName = null;
if (objValue instanceof PropertyExistsFunction) {
Expression e = ((PropertyExistsFunction) objValue).getParameters().get(0);
propertyName = e.toString();
} else if (objValue instanceof AttributeExpressionImpl) {
propertyName = ((AttributeExpressionImpl) objValue).getPropertyName();
} else if (objValue instanceof LiteralExpressionImpl) {
propertyName = AttributeUtils.extract((String) ((LiteralExpressionImpl) objValue).getValue());
}
populateField(propertyName);
}
use of org.geotools.filter.LiteralExpressionImpl in project sldeditor by robward-scisys.
the class FieldConfigColour method populateExpression.
/**
* Populate expression.
*
* @param objValue the obj value
*/
/*
* (non-Javadoc)
*
* @see com.sldeditor.ui.detail.config.FieldConfigBase#populateExpression(java.lang.Object)
*/
@Override
public void populateExpression(Object objValue) {
String sValue = null;
boolean validColour = true;
if (objValue instanceof LiteralExpressionImpl) {
sValue = ((LiteralExpressionImpl) objValue).toString();
} else if (objValue instanceof String) {
sValue = (String) objValue;
} else {
validColour = false;
if (objValue != null) {
ConsoleManager.getInstance().error(this, "Colour expression is of unknown type : " + objValue.getClass().getName());
} else {
// Null is allowed, just will not be shown
}
}
if ((colourButton != null) && validColour) {
if (!sValue.startsWith("#")) {
ConsoleManager.getInstance().error(this, "Colour string does not start with #" + sValue);
} else {
Expression opacity = getFilterFactory().literal(DefaultSymbols.defaultColourOpacity());
colourButton.populate(sValue, opacity);
if (!FieldConfigColour.this.isSuppressUndoEvents()) {
Color newValue = colourButton.getColour();
UndoManager.getInstance().addUndoEvent(new UndoEvent(this, getFieldId(), oldValueObj, newValue));
oldValueObj = newValue;
}
}
}
}
use of org.geotools.filter.LiteralExpressionImpl in project sldeditor by robward-scisys.
the class ColourMapData method getNextQuantity.
/**
* Gets the next quantity.
*
* @return the next quantity
*/
public Expression getNextQuantity() {
Expression nextQuantity = null;
if (quantity != null) {
if (quantity instanceof LiteralExpressionImpl) {
double quantityValue = Double.parseDouble(quantity.toString());
nextQuantity = ff.literal(quantityValue + 1);
} else {
// Could be a function expression so just leave alone
nextQuantity = quantity;
}
}
return nextQuantity;
}
Aggregations