-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GEOS-8263] Allow in layer preview filtering (CQL, OGC and FeatureID)…
… for rasters formats that support filtering
- Loading branch information
Nuno Oliveira
committed
Aug 25, 2017
1 parent
3cb7415
commit 0538a63
Showing
9 changed files
with
328 additions
and
12 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
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
87 changes: 87 additions & 0 deletions
87
src/wms/src/test/java/org/geoserver/wms/staticRasterStore/StaticRasterFormat.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,87 @@ | ||
/* (c) 2017 Open Source Geospatial Foundation - all rights reserved | ||
* This code is licensed under the GPL 2.0 license, available at the root | ||
* application directory. | ||
*/ | ||
package org.geoserver.wms.staticRasterStore; | ||
|
||
import org.geotools.coverage.grid.io.AbstractGridFormat; | ||
import org.geotools.coverage.grid.io.imageio.GeoToolsWriteParams; | ||
import org.geotools.factory.Hints; | ||
import org.geotools.parameter.DefaultParameterDescriptor; | ||
import org.geotools.parameter.DefaultParameterDescriptorGroup; | ||
import org.geotools.parameter.ParameterGroup; | ||
import org.opengis.coverage.grid.Format; | ||
import org.opengis.coverage.grid.GridCoverageWriter; | ||
import org.opengis.filter.Filter; | ||
import org.opengis.parameter.GeneralParameterDescriptor; | ||
import org.opengis.parameter.ParameterDescriptor; | ||
import org.opengis.parameter.ParameterValueGroup; | ||
|
||
import java.util.HashMap; | ||
|
||
/** | ||
* Format class for the static raster reader. | ||
*/ | ||
final class StaticRasterFormat extends AbstractGridFormat implements Format { | ||
|
||
// add filtering capabilities | ||
public static final ParameterDescriptor<Filter> FILTER = | ||
new DefaultParameterDescriptor<>("Filter", Filter.class, null, null); | ||
|
||
StaticRasterFormat() { | ||
setInfo(); | ||
// reader capabilities | ||
readParameters = new ParameterGroup(new DefaultParameterDescriptorGroup( | ||
mInfo, new GeneralParameterDescriptor[]{ | ||
AbstractGridFormat.READ_GRIDGEOMETRY2D, | ||
FILTER})); | ||
} | ||
|
||
private void setInfo() { | ||
HashMap<String, String> info = new HashMap<>(); | ||
info.put("name", "StaticRaster"); | ||
info.put("description", "Static raster store"); | ||
info.put("vendor", "Geotools"); | ||
info.put("docURL", "http://geotools.org/"); | ||
info.put("version", "1.0"); | ||
mInfo = info; | ||
} | ||
|
||
@Override | ||
public StaticRasterReader getReader(Object source) { | ||
// we just create the reader with no hints | ||
return getReader(source, null); | ||
} | ||
|
||
@Override | ||
public StaticRasterReader getReader(Object source, Hints hints) { | ||
return new StaticRasterReader(source); | ||
} | ||
|
||
@Override | ||
public boolean accepts(Object input, Hints hints) { | ||
// we don't need anything here | ||
return false; | ||
} | ||
|
||
@Override | ||
public ParameterValueGroup getReadParameters() { | ||
// this will return the read parameters we setup in the constructor | ||
return super.getReadParameters(); | ||
} | ||
|
||
@Override | ||
public GeoToolsWriteParams getDefaultImageIOWriteParameters() { | ||
throw new UnsupportedOperationException("Operation not supported."); | ||
} | ||
|
||
@Override | ||
public GridCoverageWriter getWriter(Object destination, Hints hints) { | ||
throw new UnsupportedOperationException("Operation not supported."); | ||
} | ||
|
||
@Override | ||
public GridCoverageWriter getWriter(Object destination) { | ||
throw new UnsupportedOperationException("Operation not supported."); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/wms/src/test/java/org/geoserver/wms/staticRasterStore/StaticRasterFormatFactory.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,30 @@ | ||
/* (c) 2017 Open Source Geospatial Foundation - all rights reserved | ||
* This code is licensed under the GPL 2.0 license, available at the root | ||
* application directory. | ||
*/ | ||
package org.geoserver.wms.staticRasterStore; | ||
|
||
import org.geotools.coverage.grid.io.GridFormatFactorySpi; | ||
|
||
import java.awt.*; | ||
import java.util.Collections; | ||
import java.util.Map; | ||
|
||
/** | ||
* Simple factory for the static raster format. | ||
*/ | ||
public final class StaticRasterFormatFactory implements GridFormatFactorySpi { | ||
|
||
public boolean isAvailable() { | ||
// we don't need anything specific | ||
return true; | ||
} | ||
|
||
public StaticRasterFormat createFormat() { | ||
return new StaticRasterFormat(); | ||
} | ||
|
||
public Map<RenderingHints.Key, ?> getImplementationHints() { | ||
return Collections.emptyMap(); | ||
} | ||
} |
Oops, something went wrong.