@Test public void getInfoOutsideCoverageReturnsEmptyResult() throws Exception { DirectPosition2D pos = new DirectPosition2D( WORLD.getCoordinateReferenceSystem(), WORLD.getMaxX() + 1, WORLD.getMaxY() + 1); InfoToolResult info = helper.getInfo(pos); assertNotNull(info); assertEquals(0, info.getNumFeatures()); }
@Override public InfoToolResult getInfo(DirectPosition2D pos) throws Exception { InfoToolResult result = new InfoToolResult(); if (isValid()) { DirectPosition trPos = InfoToolHelperUtils.getTransformed(pos, getContentToLayerTransform()); if (cachedCoverage == null || !cachedCoverage.getEnvelope2D().contains(trPos)) { if (!renewCachedCoverage(trPos)) { return result; } } try { Object objArray = cachedCoverage.evaluate(trPos); Number[] bandValues = InfoToolHelperUtils.asNumberArray(objArray); if (bandValues != null) { result.newFeature("Raw values"); for (int i = 0; i < bandValues.length; i++) { result.setFeatureValue("Band " + i, bandValues[i]); } } } catch (PointOutsideCoverageException e) { } } return result; }
GridReaderLayerHelper extends InfoToolHelper { @Override public InfoToolResult getInfo(DirectPosition2D pos) throws Exception { InfoToolResult result = new InfoToolResult(); if (isValid()) { DirectPosition trPos = InfoToolHelperUtils.getTransformed(pos, getContentToLayerTransform()); if (cachedCoverage == null || !cachedCoverage.getEnvelope2D().contains(trPos)) { if (!renewCachedCoverage(trPos)) { return result; } } try { Object objArray = cachedCoverage.evaluate(trPos); Number[] bandValues = InfoToolHelperUtils.asNumberArray(objArray); if (bandValues != null) { result.newFeature("Raw values"); for (int i = 0; i < bandValues.length; i++) { result.setFeatureValue("Band " + i, bandValues[i]); } } } catch (PointOutsideCoverageException e) { } } return result; } }
GridReaderLayerHelper extends InfoToolHelper { @Override public InfoToolResult getInfo(DirectPosition2D pos) throws Exception { InfoToolResult result = new InfoToolResult(); if (isValid()) { DirectPosition trPos = InfoToolHelperUtils.getTransformed(pos, getContentToLayerTransform()); if (cachedCoverage == null || !cachedCoverage.getEnvelope2D().contains(trPos)) { if (!renewCachedCoverage(trPos)) { return result; } } try { Object objArray = cachedCoverage.evaluate(trPos); Number[] bandValues = InfoToolHelperUtils.asNumberArray(objArray); if (bandValues != null) { result.newFeature("Raw values"); for (int i = 0; i < bandValues.length; i++) { result.setFeatureValue("Band " + i, bandValues[i]); } } } catch (PointOutsideCoverageException e) { } } return result; } GridReaderLayerHelper(); }
GridReaderLayerHelper extends InfoToolHelper { @Override public InfoToolResult getInfo(DirectPosition2D pos) throws Exception { InfoToolResult result = new InfoToolResult(); if (isValid()) { DirectPosition trPos = InfoToolHelperUtils.getTransformed(pos, getContentToLayerTransform()); if (cachedCoverage == null || !cachedCoverage.getEnvelope2D().contains(trPos)) { if (!renewCachedCoverage(trPos)) { return result; } } try { Object objArray = cachedCoverage.evaluate(trPos); Number[] bandValues = InfoToolHelperUtils.asNumberArray(objArray); if (bandValues != null) { result.newFeature("Raw values"); for (int i = 0; i < bandValues.length; i++) { result.setFeatureValue("Band " + i, bandValues[i]); } } } catch (PointOutsideCoverageException e) { } } return result; } GridReaderLayerHelper(); @Override boolean isSupportedLayer(Layer layer); @Override void setLayer(Layer layer); @Override boolean isValid(); @Override InfoToolResult getInfo(DirectPosition2D pos); }
GridReaderLayerHelper extends InfoToolHelper { @Override public InfoToolResult getInfo(DirectPosition2D pos) throws Exception { InfoToolResult result = new InfoToolResult(); if (isValid()) { DirectPosition trPos = InfoToolHelperUtils.getTransformed(pos, getContentToLayerTransform()); if (cachedCoverage == null || !cachedCoverage.getEnvelope2D().contains(trPos)) { if (!renewCachedCoverage(trPos)) { return result; } } try { Object objArray = cachedCoverage.evaluate(trPos); Number[] bandValues = InfoToolHelperUtils.asNumberArray(objArray); if (bandValues != null) { result.newFeature("Raw values"); for (int i = 0; i < bandValues.length; i++) { result.setFeatureValue("Band " + i, bandValues[i]); } } } catch (PointOutsideCoverageException e) { } } return result; } GridReaderLayerHelper(); @Override boolean isSupportedLayer(Layer layer); @Override void setLayer(Layer layer); @Override boolean isValid(); @Override InfoToolResult getInfo(DirectPosition2D pos);  }