@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()) { GridCoverage2D source = ((GridCoverageLayer) getLayer()).getCoverage(); ReferencedEnvelope env = new ReferencedEnvelope(source.getEnvelope2D()); DirectPosition2D trPos = InfoToolHelperUtils.getTransformed(pos, getContentToLayerTransform()); if (env.contains(trPos)) { Object objArray = source.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]); } } } } return result; }
GridCoverageLayerHelper extends InfoToolHelper { @Override public InfoToolResult getInfo(DirectPosition2D pos) throws Exception { InfoToolResult result = new InfoToolResult(); if (isValid()) { GridCoverage2D source = ((GridCoverageLayer) getLayer()).getCoverage(); ReferencedEnvelope env = new ReferencedEnvelope(source.getEnvelope2D()); DirectPosition2D trPos = InfoToolHelperUtils.getTransformed(pos, getContentToLayerTransform()); if (env.contains(trPos)) { Object objArray = source.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]); } } } } return result; } }
GridCoverageLayerHelper extends InfoToolHelper { @Override public InfoToolResult getInfo(DirectPosition2D pos) throws Exception { InfoToolResult result = new InfoToolResult(); if (isValid()) { GridCoverage2D source = ((GridCoverageLayer) getLayer()).getCoverage(); ReferencedEnvelope env = new ReferencedEnvelope(source.getEnvelope2D()); DirectPosition2D trPos = InfoToolHelperUtils.getTransformed(pos, getContentToLayerTransform()); if (env.contains(trPos)) { Object objArray = source.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]); } } } } return result; } GridCoverageLayerHelper(); }
GridCoverageLayerHelper extends InfoToolHelper { @Override public InfoToolResult getInfo(DirectPosition2D pos) throws Exception { InfoToolResult result = new InfoToolResult(); if (isValid()) { GridCoverage2D source = ((GridCoverageLayer) getLayer()).getCoverage(); ReferencedEnvelope env = new ReferencedEnvelope(source.getEnvelope2D()); DirectPosition2D trPos = InfoToolHelperUtils.getTransformed(pos, getContentToLayerTransform()); if (env.contains(trPos)) { Object objArray = source.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]); } } } } return result; } GridCoverageLayerHelper(); @Override void setLayer(Layer layer); @Override boolean isSupportedLayer(Layer layer); @Override InfoToolResult getInfo(DirectPosition2D pos); }
GridCoverageLayerHelper extends InfoToolHelper { @Override public InfoToolResult getInfo(DirectPosition2D pos) throws Exception { InfoToolResult result = new InfoToolResult(); if (isValid()) { GridCoverage2D source = ((GridCoverageLayer) getLayer()).getCoverage(); ReferencedEnvelope env = new ReferencedEnvelope(source.getEnvelope2D()); DirectPosition2D trPos = InfoToolHelperUtils.getTransformed(pos, getContentToLayerTransform()); if (env.contains(trPos)) { Object objArray = source.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]); } } } } return result; } GridCoverageLayerHelper(); @Override void setLayer(Layer layer); @Override boolean isSupportedLayer(Layer layer); @Override InfoToolResult getInfo(DirectPosition2D pos);  }