use of org.geotools.filter.AttributeExpressionImpl in project ddf by codice.
the class CswQueryFactory method buildSort.
private SortBy[] buildSort(SortByType sort) throws CswException {
if (sort == null || sort.getSortProperty() == null) {
return null;
}
SortBy[] sortByArr = parseSortBy(sort);
if (sortByArr == null || sortByArr.length == 0) {
return null;
}
List<SortBy> sortBys = new ArrayList<>(sortByArr.length);
for (SortBy cswSortBy : sortByArr) {
if (cswSortBy.getPropertyName() == null) {
LOGGER.debug("No property name in primary sort criteria");
return null;
}
String name = cswSortBy.getPropertyName().getPropertyName();
PropertyName propName = new AttributeExpressionImpl(new NameImpl(name));
SortBy sortBy = new SortByImpl(propName, cswSortBy.getSortOrder());
sortBys.add(sortBy);
}
if (sortBys.isEmpty()) {
return null;
}
return sortBys.toArray(new SortBy[0]);
}
use of org.geotools.filter.AttributeExpressionImpl in project sldeditor by robward-scisys.
the class CoordinateReferenceSystemValues method setValue.
/*
* (non-Javadoc)
*
* @see
* com.sldeditor.rendertransformation.types.RenderTransformValueInterface#setValue(java.lang.
* Object)
*/
@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);
}
}
}
use of org.geotools.filter.AttributeExpressionImpl 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.AttributeExpressionImpl in project sldeditor by robward-scisys.
the class FieldConfigBase method attributeUpdated.
/**
* Attribute updated.
*
* @param attributeName the attribute name
*/
@Override
public void attributeUpdated(String attributeName) {
expressionType = ExpressionTypeEnum.E_ATTRIBUTE;
NameImpl name = new NameImpl(attributeName);
setCachedExpression(new AttributeExpressionImpl(name));
setValueFieldState();
fireDataChanged();
}
use of org.geotools.filter.AttributeExpressionImpl in project sldeditor by robward-scisys.
the class WindBarbDetails method updateSymbol.
/**
* 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();
}
}
}
Aggregations