本文整理汇总了Java中org.opengis.filter.sort.SortOrder类的典型用法代码示例。如果您正苦于以下问题:Java SortOrder类的具体用法?Java SortOrder怎么用?Java SortOrder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SortOrder类属于org.opengis.filter.sort包,在下文中一共展示了SortOrder类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setValueAt
import org.opengis.filter.sort.SortOrder; //导入依赖的package包/类
@Override
public void setValueAt(Object aValue, int row, int column) {
SortBy obj = dataList.get(row);
switch (column) {
case 0:
break;
case COL_SORT_ORDER: {
Boolean b = (Boolean) aValue;
SortOrder sortOrder = b.booleanValue() ? SortOrder.ASCENDING : SortOrder.DESCENDING;
((SortByImpl) obj).setSortOrder(sortOrder);
fireTableCellUpdated(row, column);
if (parentObj != null) {
parentObj.sortOrderUpdated();
}
break;
}
default:
break;
}
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:25,代码来源:SortByTableModel.java
示例2: secondaryIndexExample
import org.opengis.filter.sort.SortOrder; //导入依赖的package包/类
static void secondaryIndexExample(String simpleFeatureTypeName,
DataStore dataStore,
String[] attributeFields,
String attributesQuery,
int maxFeatures,
String sortByField)
throws CQLException, IOException {
// construct a (E)CQL filter from the search parameters,
// and use that as the basis for the query
Filter cqlFilter = CQL.toFilter(attributesQuery);
Query query = new Query(simpleFeatureTypeName, cqlFilter);
query.setPropertyNames(attributeFields);
query.setMaxFeatures(maxFeatures);
if (!sortByField.equals("")) {
FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
SortBy[] sort = new SortBy[]{ff.sort(sortByField, SortOrder.DESCENDING)};
query.setSortBy(sort);
}
// submit the query, and get back an iterator over matching features
FeatureSource featureSource = dataStore.getFeatureSource(simpleFeatureTypeName);
FeatureIterator featureItr = featureSource.getFeatures(query).features();
// loop through all results
int n = 0;
while (featureItr.hasNext()) {
Feature feature = featureItr.next();
StringBuilder sb = new StringBuilder();
sb.append("Feature ID ").append(feature.getIdentifier());
for (String field : attributeFields) {
sb.append(" | ").append(field).append(": ").append(feature.getProperty(field).getValue());
}
System.out.println(sb.toString());
}
featureItr.close();
}
开发者ID:geomesa,项目名称:geomesa-tutorials,代码行数:41,代码来源:FeatureLevelVisibility.java
示例3: secondaryIndexExample
import org.opengis.filter.sort.SortOrder; //导入依赖的package包/类
static void secondaryIndexExample(String simpleFeatureTypeName,
DataStore dataStore,
String[] attributeFields,
String attributesQuery,
int maxFeatures,
String sortByField)
throws CQLException, IOException {
// construct a (E)CQL filter from the search parameters,
// and use that as the basis for the query
Filter cqlFilter = CQL.toFilter(attributesQuery);
Query query = new Query(simpleFeatureTypeName, cqlFilter);
query.setPropertyNames(attributeFields);
query.setMaxFeatures(maxFeatures);
if (!sortByField.equals("")) {
FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
SortBy[] sort = new SortBy[]{ff.sort(sortByField, SortOrder.DESCENDING)};
query.setSortBy(sort);
}
// submit the query, and get back an iterator over matching features
FeatureSource featureSource = dataStore.getFeatureSource(simpleFeatureTypeName);
FeatureIterator featureItr = featureSource.getFeatures(query).features();
// loop through all results
while (featureItr.hasNext()) {
Feature feature = featureItr.next();
StringBuilder sb = new StringBuilder();
sb.append("Feature ID ").append(feature.getIdentifier());
for (String field : attributeFields) {
sb.append(" | ").append(field).append(": ").append(feature.getProperty(field).getValue());
}
System.out.println(sb.toString());
}
featureItr.close();
}
开发者ID:geomesa,项目名称:geomesa-tutorials,代码行数:40,代码来源:AccumuloQuickStart.java
示例4: sortCollection
import org.opengis.filter.sort.SortOrder; //导入依赖的package包/类
/**
* sort the features so no wider polygon covers a smaller polygon.
*
* @param inCollection
* @return
*/
private SimpleFeatureCollection sortCollection(final SimpleFeatureCollection inCollection) {
// seems as the sorting does not work with doubles, so this is sorting the indirect way by using the agg_count
// instead
SortBy sortBy = CommonFactoryFinder.getFilterFactory().sort(AGG_COUNT_ATTRIBUTE_NAME,
SortOrder.DESCENDING);
SimpleFeatureCollection sortedOutputCollection = inCollection.sort(sortBy);
return sortedOutputCollection;
}
开发者ID:geops,项目名称:trafimage-geoserver-transformations,代码行数:15,代码来源:AggregateSimilarLinesAsPolygonsProcess.java
示例5: prepareSearchRequest
import org.opengis.filter.sort.SortOrder; //导入依赖的package包/类
private ElasticRequest prepareSearchRequest(Query query, boolean scroll) throws IOException {
String naturalSortOrder = SortOrder.ASCENDING.toSQL().toLowerCase();
final ElasticRequest searchRequest = new ElasticRequest();
final ElasticDataStore dataStore = getDataStore();
final String docType = dataStore.getDocType(entry.getName());
LOGGER.fine("Preparing " + docType + " (" + entry.getName() + ") query");
if (!scroll) {
if (query.getSortBy()!=null){
for (final SortBy sort : query.getSortBy()) {
final String sortOrder = sort.getSortOrder().toSQL().toLowerCase();
if (sort.getPropertyName() != null) {
final String name = sort.getPropertyName().getPropertyName();
searchRequest.addSort(name, sortOrder);
} else {
naturalSortOrder = sortOrder;
}
}
}
// pagination
searchRequest.setSize(getSize(query));
searchRequest.setFrom(getStartIndex(query));
} else {
if (dataStore.getScrollSize() != null) {
searchRequest.setSize(dataStore.getScrollSize().intValue());
}
if (dataStore.getScrollTime() != null) {
searchRequest.setScroll(dataStore.getScrollTime());
}
}
if (dataStore.isSourceFilteringEnabled()) {
// add source includes
setSourceIncludes(searchRequest);
}
// add query and post filter
final FilterToElastic filterToElastic = new FilterToElastic();
filterToElastic.setFeatureType(buildFeatureType());
filterToElastic.encode(query);
filterFullySupported = filterToElastic.getFullySupported();
if (!filterFullySupported) {
LOGGER.fine("Filter is not fully supported by native Elasticsearch."
+ " Additional post-query filtering will be performed.");
}
final Map<String,Object> queryBuilder = filterToElastic.getQueryBuilder();
final Map<String,Object> nativeQueryBuilder = filterToElastic.getNativeQueryBuilder();
searchRequest.setQuery(queryBuilder);
if (isSort(query) && nativeQueryBuilder.equals(ElasticConstants.MATCH_ALL)) {
searchRequest.addSort("_uid", naturalSortOrder);
}
if (filterToElastic.getAggregations() != null) {
final Map<String, Map<String, Map<String, Object>>> aggregations = filterToElastic.getAggregations();
final Envelope envelope = (Envelope) query.getFilter().accept(ExtractBoundsFilterVisitor.BOUNDS_VISITOR, null);
final long gridSize;
if (dataStore.getGridSize() != null) {
gridSize = dataStore.getGridSize();
} else {
gridSize = (Long) ElasticDataStoreFactory.GRID_SIZE.getDefaultValue();
}
final double gridThreshold;
if (dataStore.getGridThreshold() != null) {
gridThreshold = dataStore.getGridThreshold();
} else {
gridThreshold = (Double) ElasticDataStoreFactory.GRID_THRESHOLD.getDefaultValue();
}
final int precision = GeohashUtil.computePrecision(envelope, gridSize, gridThreshold);
LOGGER.fine("Updating GeoHash grid aggregation precision to " + precision);
GeohashUtil.updateGridAggregationPrecision(aggregations, precision);
searchRequest.setAggregations(aggregations);
searchRequest.setSize(0);
}
return searchRequest;
}
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:81,代码来源:ElasticFeatureSource.java
示例6: testGetFeaturesWithSort
import org.opengis.filter.sort.SortOrder; //导入依赖的package包/类
@Test
public void testGetFeaturesWithSort() throws Exception {
init();
FilterFactory ff = dataStore.getFilterFactory();
SortBy sort = ff.sort("vendor_s", SortOrder.ASCENDING);
Query query = new Query();
query.setSortBy(new SortBy[] { sort });
SimpleFeatureCollection features = featureSource.getFeatures(query);
assertEquals(11, features.size());
SimpleFeatureIterator iterator = features.features();
SimpleFeature f;
try {
assertTrue(iterator.hasNext());
f = iterator.next();
assertEquals("Asus", f.getAttribute("vendor_s"));
assertTrue(iterator.hasNext());
f = iterator.next();
assertEquals("Cisco", f.getAttribute("vendor_s"));
assertTrue(iterator.hasNext());
f = iterator.next();
assertEquals("Cisco", f.getAttribute("vendor_s"));
} finally {
iterator.close();
}
sort = ff.sort("vendor_s", SortOrder.DESCENDING);
query.setSortBy(new SortBy[] { sort });
features = featureSource.getFeatures(query);
iterator = features.features();
try {
assertTrue(iterator.hasNext());
f = iterator.next();
assertEquals("TP-Link", f.getAttribute("vendor_s"));
assertTrue(iterator.hasNext());
f = iterator.next();
assertEquals("Linksys", f.getAttribute("vendor_s"));
assertTrue(iterator.hasNext());
f = iterator.next();
assertEquals("Linksys", f.getAttribute("vendor_s"));
} finally {
iterator.close();
}
}
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:46,代码来源:ElasticFeatureFilterIT.java
示例7: isAscendingSortOrder
import org.opengis.filter.sort.SortOrder; //导入依赖的package包/类
/**
* Checks if is ascending sort order.
*
* @param obj the obj
* @return the boolean
*/
private static Boolean isAscendingSortOrder(SortBy obj) {
return (obj.getSortOrder().name().compareTo(SortOrder.ASCENDING.name()) == 0);
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:10,代码来源:SortByTableModel.java
注:本文中的org.opengis.filter.sort.SortOrder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论