本文整理汇总了Java中org.opengis.filter.expression.PropertyName类的典型用法代码示例。如果您正苦于以下问题:Java PropertyName类的具体用法?Java PropertyName怎么用?Java PropertyName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropertyName类属于org.opengis.filter.expression包,在下文中一共展示了PropertyName类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addGeometryProperties
import org.opengis.filter.expression.PropertyName; //导入依赖的package包/类
protected List<PropertyName> addGeometryProperties (FeatureTypeInfo meta, List<PropertyName> oldProperties) throws IOException {
List<AttributeTypeInfo> atts = meta.attributes();
Iterator ii = atts.iterator();
List<PropertyName> properties = new ArrayList<PropertyName>(oldProperties);
while (ii.hasNext()) {
AttributeTypeInfo ati = (AttributeTypeInfo) ii.next();
PropertyName propName = filterFactory.property (ati.getName());
if(meta.getFeatureType().getDescriptor(ati.getName()) instanceof GeometryDescriptor
&& !properties.contains(propName) ) {
properties.add(propName);
}
}
return properties;
}
示例2: visitDistanceSpatialOperator
import org.opengis.filter.expression.PropertyName; //导入依赖的package包/类
protected void visitDistanceSpatialOperator(DistanceBufferOperator filter,
PropertyName property, Literal geometry, boolean swapped,
Object extraData) {
property.accept(delegate, extraData);
key = (String) delegate.field;
geometry.accept(delegate, extraData);
final Geometry geo = delegate.currentGeometry;
lat = geo.getCentroid().getY();
lon = geo.getCentroid().getX();
final double inputDistance = filter.getDistance();
final String inputUnits = filter.getDistanceUnits();
distance = Double.valueOf(toMeters(inputDistance, inputUnits));
delegate.queryBuilder = ImmutableMap.of("bool", ImmutableMap.of("must", MATCH_ALL,
"filter", ImmutableMap.of("geo_distance",
ImmutableMap.of("distance", distance+SI.METER.toString(), key, ImmutableList.of(lon,lat)))));
if ((filter instanceof DWithin && swapped)
|| (filter instanceof Beyond && !swapped)) {
delegate.queryBuilder = ImmutableMap.of("bool", ImmutableMap.of("must_not", delegate.queryBuilder));
}
}
示例3: visit
import org.opengis.filter.expression.PropertyName; //导入依赖的package包/类
@Override
public Object visit(
final PropertyName expression,
final Object data ) {
final String name = expression.getPropertyName();
if (validateName(expression.getPropertyName())) {
// for (final String[] range : validParamRanges) {
// if (range[0].equals(name) || range[1].equals(name)) {
// return new ParameterTimeConstraint(
// range[0] + "_" + range[1]);
// }
// }
return new ParameterTimeConstraint(
name);
}
return new TemporalConstraints();
}
示例4: FixedDWithinImpl
import org.opengis.filter.expression.PropertyName; //导入依赖的package包/类
public FixedDWithinImpl(
final Expression e1,
final Expression e2,
final String units,
final double distance )
throws IllegalFilterException,
TransformException {
super(
new LiteralExpressionImpl(
mil.nga.giat.geowave.adapter.vector.utils.FeatureGeometryUtils.buffer(
getCRS(
e1,
e2),
e1 instanceof PropertyName ? e2.evaluate(
null,
com.vividsolutions.jts.geom.Geometry.class) : e1.evaluate(
null,
com.vividsolutions.jts.geom.Geometry.class),
units,
distance).getLeft()),
e1 instanceof PropertyName ? e1 : e2);
this.units = units;
this.distance = distance;
}
示例5: visitBinarySpatialOperator
import org.opengis.filter.expression.PropertyName; //导入依赖的package包/类
protected Object visitBinarySpatialOperator(BinarySpatialOperator filter,
PropertyName property, Literal geometry, boolean swapped,
Object extraData) {
try {
if (filter instanceof DistanceBufferOperator) {
visitDistanceSpatialOperator((DistanceBufferOperator) filter,
property, geometry, swapped, extraData);
} else {
visitComparisonSpatialOperator(filter, property, geometry,
swapped, extraData);
}
} catch (IOException e) {
throw new RuntimeException(IO_ERROR, e);
}
return extraData;
}
示例6: visitDistanceSpatialOperator
import org.opengis.filter.expression.PropertyName; //导入依赖的package包/类
void visitDistanceSpatialOperator(DistanceBufferOperator filter,
PropertyName property, Literal geometry, boolean swapped,
Object extraData) throws IOException {
if ((filter instanceof DWithin && !swapped)
|| (filter instanceof Beyond && swapped)) {
out.write("ST_DWithin(");
property.accept(delegate, extraData);
out.write(",");
geometry.accept(delegate, extraData);
out.write(",");
out.write(toMeters(filter.getDistance(), filter.getDistanceUnits()));
out.write(")");
}
if ((filter instanceof DWithin && swapped)
|| (filter instanceof Beyond && !swapped)) {
out.write("Distance(");
property.accept(delegate, extraData);
out.write(",");
geometry.accept(delegate, extraData);
out.write(") > ");
out.write(Double.toString(filter.getDistance()));
}
}
示例7: createCompareFilter
import org.opengis.filter.expression.PropertyName; //导入依赖的package包/类
@Override
public Filter createCompareFilter(String name, String comparator, String value) {
PropertyName attribute = FF.property(name);
Expression val = FF.literal(value);
if ("<".equals(comparator)) {
return FF.less(attribute, val);
} else if (">".equals(comparator)) {
return FF.greater(attribute, val);
} else if (">=".equals(comparator)) {
return FF.greaterOrEqual(attribute, val);
} else if ("<=".equals(comparator)) {
return FF.lessOrEqual(attribute, val);
} else if ("=".equals(comparator)) {
return FF.equals(attribute, val);
} else if ("==".equals(comparator)) {
return FF.equals(attribute, val);
} else if ("<>".equals(comparator)) {
return FF.notEqual(attribute, val, false);
} else {
throw new IllegalArgumentException("Could not interpret compare filter. Argument (" + value
+ ") not known.");
}
}
示例8: validateSortBy
import org.opengis.filter.expression.PropertyName; //导入依赖的package包/类
void validateSortBy(List<SortBy> sortBys, FeatureTypeInfo meta, final GetFeatureRequest3D request)
throws IOException {
FeatureType featureType = meta.getFeatureType();
for (SortBy sortBy : sortBys) {
PropertyName name = sortBy.getPropertyName();
if (name.evaluate(featureType) == null) {
throw new WFSException(request, "Illegal property name: " + name.getPropertyName()
+ " for feature type " + meta.prefixedName(), "InvalidParameterValue");
}
}
}
示例9: createPropertyName
import org.opengis.filter.expression.PropertyName; //导入依赖的package包/类
protected PropertyName createPropertyName (String path, NamespaceSupport namespaceContext) {
if (path.contains("/")) {
return filterFactory.property(path, namespaceContext);
} else {
if (path.contains(":")) {
int i = path.indexOf(":");
return filterFactory.property(new NameImpl(namespaceContext.getURI(path.substring(0, i)), path.substring(i+1) ));
} else {
return filterFactory.property(path);
}
}
}
示例10: visitBinarySpatialOperator
import org.opengis.filter.expression.PropertyName; //导入依赖的package包/类
protected Object visitBinarySpatialOperator(BinarySpatialOperator filter,
PropertyName property, Literal geometry, boolean swapped,
Object extraData) {
if (filter instanceof DistanceBufferOperator) {
visitDistanceSpatialOperator((DistanceBufferOperator) filter,
property, geometry, swapped, extraData);
} else {
visitComparisonSpatialOperator(filter, property, geometry,
swapped, extraData);
}
return extraData;
}
示例11: visitComparisonSpatialOperator
import org.opengis.filter.expression.PropertyName; //导入依赖的package包/类
void visitComparisonSpatialOperator(BinarySpatialOperator filter,
PropertyName property, Literal geometry, boolean swapped, Object extraData) {
// if geography case, sanitize geometry first
this.geometry = geometry;
if(isCurrentGeography()) {
this.geometry = clipToWorld(geometry);
}
visitBinarySpatialOperator(filter, (Expression)property, (Expression)this.geometry, swapped, extraData);
// if geography case, sanitize geometry first
if(isCurrentGeography()) {
if(isWorld(this.geometry)) {
// nothing to filter in this case
delegate.queryBuilder = MATCH_ALL;
return;
} else if(isEmpty(this.geometry)) {
if(!(filter instanceof Disjoint)) {
delegate.queryBuilder = ImmutableMap.of("bool", ImmutableMap.of("must_not", MATCH_ALL));
} else {
delegate.queryBuilder = MATCH_ALL;
}
return;
}
}
visitBinarySpatialOperator(filter, (Expression)property, (Expression)this.geometry, swapped, extraData);
}
示例12: visit
import org.opengis.filter.expression.PropertyName; //导入依赖的package包/类
/**
* Writes the FilterBuilder for the attribute Expression.
*
* @param expression the attribute.
*
*/
@Override
public Object visit(PropertyName expression, Object extraData) {
LOGGER.finest("exporting PropertyName");
SimpleFeatureType featureType = this.featureType;
Class target = null;
if(extraData instanceof Class) {
target = (Class) extraData;
}
//first evaluate expression against feature type get the attribute,
AttributeDescriptor attType = (AttributeDescriptor) expression.evaluate(featureType);
String encodedField;
if ( attType != null ) {
encodedField = attType.getLocalName();
if(target != null && target.isAssignableFrom(attType.getType().getBinding())) {
// no need for casting, it's already the right type
target = null;
}
} else {
// fall back to just encoding the property name
encodedField = expression.getPropertyName();
}
if (target != null) {
LOGGER.fine("PropertyName type casting not implemented");
}
field = encodedField;
return extraData;
}
示例13: colorBrewerExample
import org.opengis.filter.expression.PropertyName; //导入依赖的package包/类
void colorBrewerExample(SimpleFeatureCollection featureCollection) {
// colorBrewerExample start
// STEP 0 Set up Color Brewer
ColorBrewer brewer = ColorBrewer.instance();
// STEP 1 - call a classifier function to summarise your content
FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
PropertyName propteryExpression = ff.property("height");
// classify into five categories
Function classify = ff.function("Quantile", propteryExpression, ff.literal(5));
Classifier groups = (Classifier) classify.evaluate(featureCollection);
// STEP 2 - look up a predefined palette from color brewer
String paletteName = "GrBu";
Color[] colors = brewer.getPalette(paletteName).getColors(5);
// STEP 3 - ask StyleGenerator to make a set of rules for the Classifier
// assigning features the correct color based on height
FeatureTypeStyle style = StyleGenerator.createFeatureTypeStyle(
groups,
propteryExpression,
colors,
"Generated FeatureTypeStyle for GreeBlue",
featureCollection.getSchema().getGeometryDescriptor(),
StyleGenerator.ELSEMODE_IGNORE,
0.95,
null);
// colorBrewerExample end
}
示例14: visit
import org.opengis.filter.expression.PropertyName; //导入依赖的package包/类
@Override
public Object visit(
final PropertyName expression,
final Object data ) {
if ((data != null) && (data instanceof Collection)) {
((Collection) data).add(expression.getPropertyName());
return data;
}
final Set<String> names = new HashSet<String>();
names.add(expression.getPropertyName());
return names;
}
示例15: visit
import org.opengis.filter.expression.PropertyName; //导入依赖的package包/类
@Override
public Object visit(
final PropertyName expression,
final Object data ) {
return new ExtractGeometryFilterVisitorResult(
null,
null);
}