Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GEOT-3977] Have shapefile declare support for natural order sorting
git-svn-id: http://svn.osgeo.org/geotools/branches/2.7.x@38416 e5c1c795-43da-0310-a71f-fac65c449510
- Loading branch information
aaime
committed
Dec 13, 2011
1 parent
dfd100c
commit b7f1145
Showing
4 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...lugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileQueryCapabilities.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* GeoTools - The Open Source Java GIS Toolkit | ||
* http://geotools.org | ||
* | ||
* (C) 2008, Open Source Geospatial Foundation (OSGeo) | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; | ||
* version 2.1 of the License. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
*/ | ||
package org.geotools.data.shapefile; | ||
|
||
import org.geotools.data.QueryCapabilities; | ||
import org.opengis.filter.sort.SortBy; | ||
|
||
/** | ||
* The usual capabilities, plug a twist: we always return features sorted according to the | ||
* feature id | ||
* | ||
* @author Andrea Aime - GeoSolutions | ||
*/ | ||
class ShapefileQueryCapabilities extends QueryCapabilities { | ||
|
||
@Override | ||
public boolean supportsSorting(SortBy[] sortAttributes) { | ||
// we always return features in the pk increasing order | ||
if(sortAttributes != null && sortAttributes.length == 1 && sortAttributes[0] == SortBy.NATURAL_ORDER) { | ||
return true; | ||
} else { | ||
return super.supportsSorting(sortAttributes); | ||
} | ||
} | ||
} |