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

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

本文整理了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

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

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

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

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

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

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

  1. /**
  2. * Returns true if the query will hit all the geometry columns with no row filtering (a
  3. * condition that allows to use spatial index statistics to compute the table bounds)
  4. *
  5. * @param query
  6. * @param schema
  7. * @return
  8. */
  9. private boolean isFullBoundsQuery(Query query, SimpleFeatureType schema) {
  10. if (query == null) {
  11. return true;
  12. }
  13. if (!Filter.INCLUDE.equals(query.getFilter())) {
  14. return false;
  15. }
  16. if (query.getProperties() == Query.ALL_PROPERTIES) {
  17. return true;
  18. }
  19. List<String> names = Arrays.asList(query.getPropertyNames());
  20. for (AttributeDescriptor ad : schema.getAttributeDescriptors()) {
  21. if (ad instanceof GeometryDescriptor) {
  22. if (!names.contains(ad.getLocalName())) {
  23. return false;
  24. }
  25. }
  26. }
  27. return true;
  28. }

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

  1. if (query.getProperties() == null) {
  2. return;
  3. for (PropertyName attribute : query.getProperties()) {
  4. if (attribute.evaluate(schema) == null) {
  5. if (schema instanceof SimpleFeatureType) {

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

  1. /**
  2. * Copy contructor.
  3. *
  4. * @param query the query to copy
  5. */
  6. public Query(Query query) {
  7. this(
  8. query.getTypeName(),
  9. query.getNamespace(),
  10. query.getFilter(),
  11. query.getMaxFeatures(),
  12. query.getProperties(),
  13. query.getHandle());
  14. this.sortBy = query.getSortBy();
  15. this.coordinateSystem = query.getCoordinateSystem();
  16. this.coordinateSystemReproject = query.getCoordinateSystemReproject();
  17. this.version = query.getVersion();
  18. this.hints = query.getHints();
  19. this.startIndex = query.getStartIndex();
  20. this.alias = query.getAlias();
  21. this.joins = new ArrayList();
  22. for (Join j : query.getJoins()) {
  23. this.joins.add(new Join(j));
  24. }
  25. }

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

  1. /** Test of set/getProperties method, of class org.geotools.data.Query. */
  2. public void testProperties() {
  3. final FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
  4. // System.out.println("testProperties");
  5. Query query = new Query();
  6. assertNull(query.getProperties());
  7. List<PropertyName> properties = new ArrayList<PropertyName>();
  8. NamespaceSupport nsContext = new NamespaceSupport();
  9. nsContext.declarePrefix("foo", "FooNamespace");
  10. PropertyName fooProp = ff.property("foo", nsContext);
  11. PropertyName barProp = ff.property("bar", nsContext);
  12. properties.add(fooProp);
  13. properties.add(barProp);
  14. query.setProperties(properties);
  15. List<PropertyName> properties2 = query.getProperties();
  16. assertNotNull(properties);
  17. assertEquals(fooProp, properties2.get(0));
  18. assertEquals(barProp, properties2.get(1));
  19. assertEquals(nsContext, properties2.get(0).getNamespaceContext());
  20. // test compatibility with getPropertyNames method
  21. String[] names = query.getPropertyNames();
  22. assertEquals("foo", names[0]);
  23. assertEquals("bar", names[1]);
  24. query.setProperties(Query.ALL_PROPERTIES);
  25. assertNull(query.getProperties());
  26. query = new Query("Test", Filter.INCLUDE, properties);
  27. assertNotNull(query.getProperties());
  28. }

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

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

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

  1. /**
  2. * Copy contructor, clones the state of a generic Query into a DefaultQuery
  3. *
  4. * @param query
  5. */
  6. public DefaultQuery(Query query) {
  7. this(
  8. query.getTypeName(),
  9. query.getNamespace(),
  10. query.getFilter(),
  11. query.getMaxFeatures(),
  12. query.getProperties(),
  13. query.getHandle());
  14. this.sortBy = query.getSortBy();
  15. this.coordinateSystem = query.getCoordinateSystem();
  16. this.coordinateSystemReproject = query.getCoordinateSystemReproject();
  17. this.version = query.getVersion();
  18. this.hints = query.getHints();
  19. this.startIndex = query.getStartIndex();
  20. this.alias = query.getAlias();
  21. this.joins = query.getJoins();
  22. }
  23. }

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

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

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

  1. List<PropertyName> propNames =
  2. getSurrogatePropertyNames(
  3. query.getProperties(),
  4. mapping,
  5. includeProps instanceof Boolean

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

  1. /** Test of getPropertyNames method, of class org.geotools.data.Query. */
  2. public void testPropertyNames() {
  3. // System.out.println("testPropertyNames");
  4. Query query = new Query();
  5. assertNull(query.getPropertyNames());
  6. query.setPropertyNames(new String[] {"foo", "bar"});
  7. String names[] = query.getPropertyNames();
  8. assertNotNull(names);
  9. assertEquals("foo", names[0]);
  10. List list = Arrays.asList(names);
  11. query.setPropertyNames(list);
  12. names = query.getPropertyNames();
  13. assertEquals("bar", names[1]);
  14. // test compatibility with getProperties method
  15. List<PropertyName> properties2 = query.getProperties();
  16. assertNotNull(properties2);
  17. assertEquals("foo", properties2.get(0).getPropertyName());
  18. assertEquals("bar", properties2.get(1).getPropertyName());
  19. query.setPropertyNames(Query.ALL_NAMES);
  20. assertNull(query.getPropertyNames());
  21. query = new Query("Test", Filter.INCLUDE, new String[] {"foo", "wibble"});
  22. assertNotNull(query.getPropertyNames());
  23. }

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

  1. private Query namedQuery(Query query) {
  2. Query namedQuery =
  3. namedQuery(
  4. query.getFilter(), query.getMaxFeatures(), query instanceof JoiningQuery);
  5. namedQuery.setProperties(query.getProperties());
  6. namedQuery.setCoordinateSystem(query.getCoordinateSystem());
  7. namedQuery.setCoordinateSystemReproject(query.getCoordinateSystemReproject());
  8. namedQuery.setHandle(query.getHandle());
  9. namedQuery.setMaxFeatures(query.getMaxFeatures());
  10. namedQuery.setStartIndex(query.getStartIndex());
  11. namedQuery.setSortBy(query.getSortBy());
  12. namedQuery.setHints(query.getHints());
  13. if (query instanceof JoiningQuery) {
  14. ((JoiningQuery) namedQuery).setQueryJoins(((JoiningQuery) query).getQueryJoins());
  15. ((JoiningQuery) namedQuery).setRootMapping(((JoiningQuery) query).getRootMapping());
  16. }
  17. return namedQuery;
  18. }

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

  1. /**
  2. * Searches for an optional property among the query attributes. Returns true only if the
  3. * property is explicitly listed
  4. *
  5. * @param query
  6. * @param property
  7. * @return
  8. */
  9. protected boolean hasOutputProperty(Query query, Name property, boolean includedByDefault) {
  10. if (query.getProperties() == null) {
  11. return includedByDefault;
  12. }
  13. final String localPart = property.getLocalPart();
  14. final String namespaceURI = property.getNamespaceURI();
  15. for (PropertyName pn : query.getProperties()) {
  16. if (localPart.equals(pn.getPropertyName())
  17. && (pn.getNamespaceContext() == null
  18. || namespaceURI.equals(pn.getNamespaceContext().getURI("")))) {
  19. return true;
  20. }
  21. }
  22. return false;
  23. }

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

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

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

  1. /**
  2. * Checks the attributes in the query (which we got from the SLD) match the
  3. * schema, throws an {@link IllegalFilterException} otherwise
  4. * @param schema
  5. * @param attributeNames
  6. */
  7. void checkAttributeExistence(FeatureType schema, Query query) {
  8. if(query.getProperties() == null) {
  9. return;
  10. }
  11. for (PropertyName attribute : query.getProperties()) {
  12. if(attribute.evaluate(schema) == null) {
  13. if (schema instanceof SimpleFeatureType) {
  14. List<Name> allNames = new ArrayList<Name>();
  15. for (PropertyDescriptor pd : schema.getDescriptors()) {
  16. allNames.add(pd.getName());
  17. }
  18. throw new IllegalFilterException("Could not find '" +
  19. attribute + "' in the FeatureType (" + schema.getName() +
  20. "), available attributes are: " + allNames);
  21. } else {
  22. throw new IllegalFilterException("Could not find '" +
  23. attribute + "' in the FeatureType (" + schema.getName() +
  24. ")");
  25. }
  26. }
  27. }
  28. }

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

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

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

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

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

  1. /**
  2. * Copy contructor, clones the state of a generic Query into a DefaultQuery
  3. * @param query
  4. */
  5. public DefaultQuery(Query query) {
  6. this(query.getTypeName(), query.getNamespace(), query.getFilter(), query.getMaxFeatures(),
  7. query.getProperties(), query.getHandle());
  8. this.sortBy = query.getSortBy();
  9. this.coordinateSystem = query.getCoordinateSystem();
  10. this.coordinateSystemReproject = query.getCoordinateSystemReproject();
  11. this.version = query.getVersion();
  12. this.hints = query.getHints();
  13. this.startIndex = query.getStartIndex();
  14. this.alias = query.getAlias();
  15. this.joins = query.getJoins();
  16. }

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

  1. private Query namedQuery(Query query) {
  2. Query namedQuery = namedQuery(query.getFilter(), query.getMaxFeatures(), query instanceof JoiningQuery);
  3. namedQuery.setProperties(query.getProperties());
  4. namedQuery.setCoordinateSystem(query.getCoordinateSystem());
  5. namedQuery.setCoordinateSystemReproject(query.getCoordinateSystemReproject());
  6. namedQuery.setHandle(query.getHandle());
  7. namedQuery.setMaxFeatures(query.getMaxFeatures());
  8. namedQuery.setSortBy(query.getSortBy());
  9. namedQuery.setHints(query.getHints());
  10. if (query instanceof JoiningQuery) {
  11. ((JoiningQuery) namedQuery).setQueryJoins(((JoiningQuery) query).getQueryJoins());
  12. }
  13. return namedQuery;
  14. }

相关文章