@Test public void test() throws Exception { SimpleFeatureSource source = dataStore.getFeatureSource("hexa"); assertTrue(source.getCount(Query.ALL) > 0); Map<String, Object> input = new HashMap<String, Object>(); input.put(HexagonProcessFactory.extent.key, source.getBounds()); input.put(HexagonProcessFactory.boundsSource.key, source.getFeatures()); input.put(HexagonProcessFactory.orientation.key, HexagonOrientation.ANGLED); input.put(HexagonProcessFactory.sideLen.key, source.getBounds().getWidth() / 5.0); SimpleFeatureCollection result = null; org.geotools.process.Process process = new HexagonProcess(null); Map<String, Object> resultMap = process.execute(input, null); result = (SimpleFeatureCollection) resultMap.get(HexagonProcessFactory.RESULT.key); assertTrue(result.size() > 0); HexagonProcessFactory factory = new HexagonProcessFactory(); process = factory.create(); resultMap = process.execute(input, null); result = (SimpleFeatureCollection) resultMap.get(AreaProcessFactory.RESULT.key); assertTrue(result.size() > 0); }
@Override public Map<String, Object> execute(Map<String, Object> input, ProgressListener monitor) throws ProcessException { ReferencedEnvelope gridBounds = (ReferencedEnvelope) Params.getValue(input, HexagonProcessFactory.extent, null); SimpleFeatureCollection boundsSource = (SimpleFeatureCollection) Params.getValue(input, HexagonProcessFactory.boundsSource, null); if (gridBounds == null) { throw new NullPointerException("extent parameters required"); } Double sideLen = (Double) Params.getValue(input, HexagonProcessFactory.sideLen, null); HexagonOrientation orientation = (HexagonOrientation) Params.getValue(input, HexagonProcessFactory.orientation, HexagonProcessFactory.orientation.sample); if (sideLen == null || sideLen == 0) { throw new NullPointerException("sideLen parameter should be grater than 0"); } SimpleFeatureCollection resultFc = null; try { HexagonOperation operation = new HexagonOperation(); operation.setBoundsSource(boundsSource); operation.setOrientation(orientation); resultFc = operation.execute(gridBounds, sideLen); } catch (IOException e) { throw new ProcessException(e); } Map<String, Object> resultMap = new HashMap<String, Object>(); resultMap.put(HexagonProcessFactory.RESULT.key, resultFc); return resultMap; }
HexagonProcess extends AbstractStatisticsProcess { @Override public Map<String, Object> execute(Map<String, Object> input, ProgressListener monitor) throws ProcessException { ReferencedEnvelope gridBounds = (ReferencedEnvelope) Params.getValue(input, HexagonProcessFactory.extent, null); SimpleFeatureCollection boundsSource = (SimpleFeatureCollection) Params.getValue(input, HexagonProcessFactory.boundsSource, null); if (gridBounds == null) { throw new NullPointerException("extent parameters required"); } Double sideLen = (Double) Params.getValue(input, HexagonProcessFactory.sideLen, null); HexagonOrientation orientation = (HexagonOrientation) Params.getValue(input, HexagonProcessFactory.orientation, HexagonProcessFactory.orientation.sample); if (sideLen == null || sideLen == 0) { throw new NullPointerException("sideLen parameter should be grater than 0"); } SimpleFeatureCollection resultFc = null; try { HexagonOperation operation = new HexagonOperation(); operation.setBoundsSource(boundsSource); operation.setOrientation(orientation); resultFc = operation.execute(gridBounds, sideLen); } catch (IOException e) { throw new ProcessException(e); } Map<String, Object> resultMap = new HashMap<String, Object>(); resultMap.put(HexagonProcessFactory.RESULT.key, resultFc); return resultMap; } }
HexagonProcess extends AbstractStatisticsProcess { @Override public Map<String, Object> execute(Map<String, Object> input, ProgressListener monitor) throws ProcessException { ReferencedEnvelope gridBounds = (ReferencedEnvelope) Params.getValue(input, HexagonProcessFactory.extent, null); SimpleFeatureCollection boundsSource = (SimpleFeatureCollection) Params.getValue(input, HexagonProcessFactory.boundsSource, null); if (gridBounds == null) { throw new NullPointerException("extent parameters required"); } Double sideLen = (Double) Params.getValue(input, HexagonProcessFactory.sideLen, null); HexagonOrientation orientation = (HexagonOrientation) Params.getValue(input, HexagonProcessFactory.orientation, HexagonProcessFactory.orientation.sample); if (sideLen == null || sideLen == 0) { throw new NullPointerException("sideLen parameter should be grater than 0"); } SimpleFeatureCollection resultFc = null; try { HexagonOperation operation = new HexagonOperation(); operation.setBoundsSource(boundsSource); operation.setOrientation(orientation); resultFc = operation.execute(gridBounds, sideLen); } catch (IOException e) { throw new ProcessException(e); } Map<String, Object> resultMap = new HashMap<String, Object>(); resultMap.put(HexagonProcessFactory.RESULT.key, resultFc); return resultMap; } HexagonProcess(ProcessFactory factory); }
HexagonProcess extends AbstractStatisticsProcess { @Override public Map<String, Object> execute(Map<String, Object> input, ProgressListener monitor) throws ProcessException { ReferencedEnvelope gridBounds = (ReferencedEnvelope) Params.getValue(input, HexagonProcessFactory.extent, null); SimpleFeatureCollection boundsSource = (SimpleFeatureCollection) Params.getValue(input, HexagonProcessFactory.boundsSource, null); if (gridBounds == null) { throw new NullPointerException("extent parameters required"); } Double sideLen = (Double) Params.getValue(input, HexagonProcessFactory.sideLen, null); HexagonOrientation orientation = (HexagonOrientation) Params.getValue(input, HexagonProcessFactory.orientation, HexagonProcessFactory.orientation.sample); if (sideLen == null || sideLen == 0) { throw new NullPointerException("sideLen parameter should be grater than 0"); } SimpleFeatureCollection resultFc = null; try { HexagonOperation operation = new HexagonOperation(); operation.setBoundsSource(boundsSource); operation.setOrientation(orientation); resultFc = operation.execute(gridBounds, sideLen); } catch (IOException e) { throw new ProcessException(e); } Map<String, Object> resultMap = new HashMap<String, Object>(); resultMap.put(HexagonProcessFactory.RESULT.key, resultFc); return resultMap; } HexagonProcess(ProcessFactory factory); ProcessFactory getFactory(); static SimpleFeatureCollection process(ReferencedEnvelope extent,
            SimpleFeatureCollection boundsSource, Double sideLen, HexagonOrientation orientation,
            ProgressListener monitor); @Override Map<String, Object> execute(Map<String, Object> input, ProgressListener monitor); }
HexagonProcess extends AbstractStatisticsProcess { @Override public Map<String, Object> execute(Map<String, Object> input, ProgressListener monitor) throws ProcessException { ReferencedEnvelope gridBounds = (ReferencedEnvelope) Params.getValue(input, HexagonProcessFactory.extent, null); SimpleFeatureCollection boundsSource = (SimpleFeatureCollection) Params.getValue(input, HexagonProcessFactory.boundsSource, null); if (gridBounds == null) { throw new NullPointerException("extent parameters required"); } Double sideLen = (Double) Params.getValue(input, HexagonProcessFactory.sideLen, null); HexagonOrientation orientation = (HexagonOrientation) Params.getValue(input, HexagonProcessFactory.orientation, HexagonProcessFactory.orientation.sample); if (sideLen == null || sideLen == 0) { throw new NullPointerException("sideLen parameter should be grater than 0"); } SimpleFeatureCollection resultFc = null; try { HexagonOperation operation = new HexagonOperation(); operation.setBoundsSource(boundsSource); operation.setOrientation(orientation); resultFc = operation.execute(gridBounds, sideLen); } catch (IOException e) { throw new ProcessException(e); } Map<String, Object> resultMap = new HashMap<String, Object>(); resultMap.put(HexagonProcessFactory.RESULT.key, resultFc); return resultMap; } HexagonProcess(ProcessFactory factory); ProcessFactory getFactory(); static SimpleFeatureCollection process(ReferencedEnvelope extent,
            SimpleFeatureCollection boundsSource, Double sideLen, HexagonOrientation orientation,
            ProgressListener monitor); @Override Map<String, Object> execute(Map<String, Object> input, ProgressListener monitor);  }