org.geotools.data.Query.getProperties()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(9.7k)|赞(0)|评价(0)|浏览(163)

本文整理了Java中org.geotools.data.Query.getProperties方法的一些代码示例,展示了Query.getProperties的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getProperties方法的具体详情如下:
包路径:org.geotools.data.Query
类名称:Query
方法名:getProperties

Query.getProperties介绍

[英]Get the names of the properties that this Query will retrieve values for as part of the returned org.geotools.feature.FeatureCollection.
[中]获取此查询将作为返回组织的一部分检索其值的属性的名称。地理工具。特色特色系列。

代码示例

代码示例来源:origin: geoserver/geoserver

int limitedAttributeSize = mixed.getProperties() != null ? mixed.getProperties().size() : 0;
final FeatureCollection<T, F> fc = delegate.getFeatures(mixed);
if (fc == null) {

代码示例来源:origin: geoserver/geoserver

List<PropertyName> securityProperties = securityQuery.getProperties();
if (securityProperties != null && securityProperties.size() > 0) {
  List<PropertyName> userProperties = userQuery.getProperties();
  if (userProperties == null) {
    result.setProperties(securityProperties);

代码示例来源:origin: geotools/geotools

List<PropertyName> nativeProperties = nativeQuery.getProperties();
Query q = new Query(nativeQuery);
if (nativeProperties == Query.ALL_PROPERTIES) {

代码示例来源:origin: geotools/geotools

/**
 * Returns true if the query will hit all the geometry columns with no row filtering (a
 * condition that allows to use spatial index statistics to compute the table bounds)
 *
 * @param query
 * @param schema
 * @return
 */
private boolean isFullBoundsQuery(Query query, SimpleFeatureType schema) {
  if (query == null) {
    return true;
  }
  if (!Filter.INCLUDE.equals(query.getFilter())) {
    return false;
  }
  if (query.getProperties() == Query.ALL_PROPERTIES) {
    return true;
  }
  List<String> names = Arrays.asList(query.getPropertyNames());
  for (AttributeDescriptor ad : schema.getAttributeDescriptors()) {
    if (ad instanceof GeometryDescriptor) {
      if (!names.contains(ad.getLocalName())) {
        return false;
      }
    }
  }
  return true;
}

代码示例来源:origin: geotools/geotools

if (query.getProperties() == null) {
  return;
for (PropertyName attribute : query.getProperties()) {
  if (attribute.evaluate(schema) == null) {
    if (schema instanceof SimpleFeatureType) {

代码示例来源:origin: geotools/geotools

/**
 * Copy contructor.
 *
 * @param query the query to copy
 */
public Query(Query query) {
  this(
      query.getTypeName(),
      query.getNamespace(),
      query.getFilter(),
      query.getMaxFeatures(),
      query.getProperties(),
      query.getHandle());
  this.sortBy = query.getSortBy();
  this.coordinateSystem = query.getCoordinateSystem();
  this.coordinateSystemReproject = query.getCoordinateSystemReproject();
  this.version = query.getVersion();
  this.hints = query.getHints();
  this.startIndex = query.getStartIndex();
  this.alias = query.getAlias();
  this.joins = new ArrayList();
  for (Join j : query.getJoins()) {
    this.joins.add(new Join(j));
  }
}

代码示例来源:origin: geotools/geotools

/** Test of set/getProperties method, of class org.geotools.data.Query. */
public void testProperties() {
  final FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
  // System.out.println("testProperties");
  Query query = new Query();
  assertNull(query.getProperties());
  List<PropertyName> properties = new ArrayList<PropertyName>();
  NamespaceSupport nsContext = new NamespaceSupport();
  nsContext.declarePrefix("foo", "FooNamespace");
  PropertyName fooProp = ff.property("foo", nsContext);
  PropertyName barProp = ff.property("bar", nsContext);
  properties.add(fooProp);
  properties.add(barProp);
  query.setProperties(properties);
  List<PropertyName> properties2 = query.getProperties();
  assertNotNull(properties);
  assertEquals(fooProp, properties2.get(0));
  assertEquals(barProp, properties2.get(1));
  assertEquals(nsContext, properties2.get(0).getNamespaceContext());
  // test compatibility with getPropertyNames method
  String[] names = query.getPropertyNames();
  assertEquals("foo", names[0]);
  assertEquals("bar", names[1]);
  query.setProperties(Query.ALL_PROPERTIES);
  assertNull(query.getProperties());
  query = new Query("Test", Filter.INCLUDE, properties);
  assertNotNull(query.getProperties());
}

代码示例来源:origin: geotools/geotools

joinAttributes(firstQuery.getProperties(), secondQuery.getProperties());

代码示例来源:origin: geotools/geotools

/**
   * Copy contructor, clones the state of a generic Query into a DefaultQuery
   *
   * @param query
   */
  public DefaultQuery(Query query) {
    this(
        query.getTypeName(),
        query.getNamespace(),
        query.getFilter(),
        query.getMaxFeatures(),
        query.getProperties(),
        query.getHandle());
    this.sortBy = query.getSortBy();
    this.coordinateSystem = query.getCoordinateSystem();
    this.coordinateSystemReproject = query.getCoordinateSystemReproject();
    this.version = query.getVersion();
    this.hints = query.getHints();
    this.startIndex = query.getStartIndex();
    this.alias = query.getAlias();
    this.joins = query.getJoins();
  }
}

代码示例来源:origin: geotools/geotools

if (query != null && query.getProperties() != null) {
  setPropertyNames(query.getProperties());
} else {

代码示例来源:origin: geotools/geotools

List<PropertyName> propNames =
    getSurrogatePropertyNames(
        query.getProperties(),
        mapping,
        includeProps instanceof Boolean

代码示例来源:origin: geotools/geotools

/** Test of getPropertyNames method, of class org.geotools.data.Query. */
public void testPropertyNames() {
  // System.out.println("testPropertyNames");
  Query query = new Query();
  assertNull(query.getPropertyNames());
  query.setPropertyNames(new String[] {"foo", "bar"});
  String names[] = query.getPropertyNames();
  assertNotNull(names);
  assertEquals("foo", names[0]);
  List list = Arrays.asList(names);
  query.setPropertyNames(list);
  names = query.getPropertyNames();
  assertEquals("bar", names[1]);
  // test compatibility with getProperties method
  List<PropertyName> properties2 = query.getProperties();
  assertNotNull(properties2);
  assertEquals("foo", properties2.get(0).getPropertyName());
  assertEquals("bar", properties2.get(1).getPropertyName());
  query.setPropertyNames(Query.ALL_NAMES);
  assertNull(query.getPropertyNames());
  query = new Query("Test", Filter.INCLUDE, new String[] {"foo", "wibble"});
  assertNotNull(query.getPropertyNames());
}

代码示例来源:origin: geotools/geotools

private Query namedQuery(Query query) {
  Query namedQuery =
      namedQuery(
          query.getFilter(), query.getMaxFeatures(), query instanceof JoiningQuery);
  namedQuery.setProperties(query.getProperties());
  namedQuery.setCoordinateSystem(query.getCoordinateSystem());
  namedQuery.setCoordinateSystemReproject(query.getCoordinateSystemReproject());
  namedQuery.setHandle(query.getHandle());
  namedQuery.setMaxFeatures(query.getMaxFeatures());
  namedQuery.setStartIndex(query.getStartIndex());
  namedQuery.setSortBy(query.getSortBy());
  namedQuery.setHints(query.getHints());
  if (query instanceof JoiningQuery) {
    ((JoiningQuery) namedQuery).setQueryJoins(((JoiningQuery) query).getQueryJoins());
    ((JoiningQuery) namedQuery).setRootMapping(((JoiningQuery) query).getRootMapping());
  }
  return namedQuery;
}

代码示例来源:origin: org.geoserver.community/gs-oseo-core

/**
 * Searches for an optional property among the query attributes. Returns true only if the
 * property is explicitly listed
 *
 * @param query
 * @param property
 * @return
 */
protected boolean hasOutputProperty(Query query, Name property, boolean includedByDefault) {
  if (query.getProperties() == null) {
    return includedByDefault;
  }
  final String localPart = property.getLocalPart();
  final String namespaceURI = property.getNamespaceURI();
  for (PropertyName pn : query.getProperties()) {
    if (localPart.equals(pn.getPropertyName())
        && (pn.getNamespaceContext() == null
            || namespaceURI.equals(pn.getNamespaceContext().getURI("")))) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.geotools/gt-jdbc

return false;
if(query.getProperties() == Query.ALL_PROPERTIES) {
  return true;

代码示例来源:origin: org.geotools/gt-render

/**
 * Checks the attributes in the query (which we got from the SLD) match the 
 * schema, throws an {@link IllegalFilterException} otherwise
 * @param schema
 * @param attributeNames
 */
void checkAttributeExistence(FeatureType schema, Query query) {
  if(query.getProperties() == null) {
    return;
  }
  
  for (PropertyName attribute : query.getProperties()) {
    if(attribute.evaluate(schema) == null) {
      if (schema instanceof SimpleFeatureType) {
        List<Name> allNames = new ArrayList<Name>();
        for (PropertyDescriptor pd : schema.getDescriptors()) {
          allNames.add(pd.getName());
        }
        throw new IllegalFilterException("Could not find '" + 
            attribute + "' in the FeatureType (" + schema.getName() + 
            "), available attributes are: " + allNames);
      } else {
        throw new IllegalFilterException("Could not find '" + 
          attribute + "' in the FeatureType (" + schema.getName() + 
          ")");
      }
    }
  }
}

代码示例来源:origin: org.geoserver.csw/gs-csw-simple-store

if (q.getProperties() != null && q.getProperties().size() > 0) {
  records = new RetypingFeatureCollection(records, q.getProperties());

代码示例来源:origin: org.geotools/gt-app-schema

if (query != null && query.getProperties() != null) {
  setPropertyNames(query.getProperties());
} else {

代码示例来源:origin: org.geotools/gt-main

/**
 * Copy contructor, clones the state of a generic Query into a DefaultQuery
 * @param query
 */
public DefaultQuery(Query query) {
 this(query.getTypeName(), query.getNamespace(), query.getFilter(), query.getMaxFeatures(),
   query.getProperties(), query.getHandle());
 this.sortBy = query.getSortBy();
 this.coordinateSystem = query.getCoordinateSystem();
 this.coordinateSystemReproject = query.getCoordinateSystemReproject();
 this.version = query.getVersion();
 this.hints = query.getHints();
 this.startIndex = query.getStartIndex();
 this.alias = query.getAlias();
 this.joins = query.getJoins();
}

代码示例来源:origin: org.geotools/gt-app-schema

private Query namedQuery(Query query) {
  Query namedQuery = namedQuery(query.getFilter(), query.getMaxFeatures(), query instanceof JoiningQuery);        
  namedQuery.setProperties(query.getProperties());
  namedQuery.setCoordinateSystem(query.getCoordinateSystem());
  namedQuery.setCoordinateSystemReproject(query.getCoordinateSystemReproject());
  namedQuery.setHandle(query.getHandle());
  namedQuery.setMaxFeatures(query.getMaxFeatures());
  namedQuery.setSortBy(query.getSortBy());
  namedQuery.setHints(query.getHints());
  if (query instanceof JoiningQuery) {
    ((JoiningQuery) namedQuery).setQueryJoins(((JoiningQuery) query).getQueryJoins());
  }
  return namedQuery;
}

相关文章