public GridGeometry invertGridGeometry( Map<String, Object> input, Query targetQuery, GridGeometry targetGridGeometry) throws ProcessException { Method invertGridGeometryMethod = lookupInvertGridGeometry(targetObject, this.method.getName()); if (invertGridGeometryMethod == null) { return targetGridGeometry; } try { Object[] args = buildProcessArguments(invertGridGeometryMethod, input, null, true); args[args.length - 2] = targetQuery; args[args.length - 1] = targetGridGeometry; return (GridGeometry) invertGridGeometryMethod.invoke(targetObject, args); } catch (IllegalAccessException e) { throw new ProcessException(e); } catch (InvocationTargetException e) { Throwable t = e.getTargetException(); if (t instanceof ProcessException) { throw ((ProcessException) t); } else { throw new ProcessException(t); } } }
public Query invertQuery(Query targetQuery, GridGeometry gridGeometry) { RenderingProcess process = (RenderingProcess) this.process; // evaluate input expressions // at this point do not have an object to evaluate them against Map<String, Object> inputs = evaluateInputs(null); try { return process.invertQuery(inputs, targetQuery, gridGeometry); } catch (ProcessException e) { throw new RuntimeException( "Failed to invert the query, error is: " + e.getMessage(), e); } }
public Query invertQuery( Map<String, Object> input, Query targetQuery, GridGeometry targetGridGeometry) throws ProcessException { Method invertQueryMethod = lookupInvertQuery(targetObject, method.getName()); if (invertQueryMethod == null) { return targetQuery; } try { Object[] args = buildProcessArguments(invertQueryMethod, input, null, true); args[args.length - 2] = targetQuery; args[args.length - 1] = targetGridGeometry; return (Query) invertQueryMethod.invoke(targetObject, args); } catch (IllegalAccessException e) { throw new ProcessException(e); } catch (InvocationTargetException e) { Throwable t = e.getTargetException(); if (t instanceof ProcessException) { throw ((ProcessException) t); } else { throw new ProcessException(t); } } }
public GridGeometry invertGridGeometry(Query targetQuery, GridGeometry targetGridGeometry) { RenderingProcess process = (RenderingProcess) this.process; // evaluate input expressions // at this point do not have an object to evaluate them against Map<String, Object> inputs = evaluateInputs(null); try { return process.invertGridGeometry(inputs, targetQuery, targetGridGeometry); } catch (ProcessException e) { throw new RuntimeException( "Failed to invert the grid geometry, error is: " + e.getMessage(), e); } }
@Override public GeneralParameterValue[] customizeReadParams( Map<String, Object> input, GridCoverageReader reader, GeneralParameterValue[] params) { Method customizeReadParamsMethod = lookupCustomizeReadParams(targetObject, this.method.getName()); if (customizeReadParamsMethod == null) { return params; } try { Object[] args = buildProcessArguments(customizeReadParamsMethod, input, null, true); args[args.length - 2] = reader; args[args.length - 1] = params; return (GeneralParameterValue[]) customizeReadParamsMethod.invoke(targetObject, args); } catch (IllegalAccessException e) { throw new ProcessException(e); } catch (InvocationTargetException e) { Throwable t = e.getTargetException(); if (t instanceof ProcessException) { throw ((ProcessException) t); } else { throw new ProcessException(t); } } } }
@Override public GeneralParameterValue[] customizeReadParams( GridCoverageReader reader, GeneralParameterValue[] params) { RenderingProcess process = (RenderingProcess) this.process; // evaluate input expressions // at this point do not have an object to evaluate them against Map<String, Object> inputs = evaluateInputs(null); try { return process.customizeReadParams(inputs, reader, params); } catch (ProcessException e) { throw new RuntimeException( "Failed to customize the reader parameters, error is: " + e.getMessage(), e); } } }
/** * Utility method for checking if two CRS are equals * * @param crsA * @param crsB */ public static void checkCompatibleCRS( CoordinateReferenceSystem crsA, CoordinateReferenceSystem crsB) { // check if they are equal if (!CRS.equalsIgnoreMetadata(crsA, crsB)) { MathTransform mathTransform = null; try { mathTransform = CRS.findMathTransform(crsA, crsB); } catch (FactoryException e) { throw new ProcessException( "Exceptions occurred while looking for a mathTransform between the coverage's CRSs", e); } // Check if their transformation is an identity if (mathTransform != null && !mathTransform.isIdentity()) { throw new ProcessException(MISMATCHING_CRS_MESSAGE); } } } }
public Object evaluate(Object object) { Map<String, Object> processInputs = evaluateInputs(object); // execute the process try { ExceptionProgressListener listener = new ExceptionProgressListener(); Map<String, Object> results = process.execute(processInputs, listener); // some processes have the bad habit of not throwing exceptions, but to // report them to the listener if (listener.getExceptions().size() > 0) { // uh oh, an exception occurred during processing Throwable t = listener.getExceptions().get(0); throw new RuntimeException( "Failed to evaluate process function, error is: " + t.getMessage(), t); } return getResult(results, processInputs); } catch (ProcessException e) { throw new RuntimeException( "Failed to evaluate the process function, error is: " + e.getMessage(), e); } }
throw new ProcessException( "Could not convert " + value throw new ProcessException( "Parameter " + p.key + " is missing but has min multiplicity > 0"); } else if (p.maxOccurs > 1) { throw new ProcessException( "Parameter " + p.key throw new ProcessException( "Parameter " + p.key
public static GridCoverage2D process(GridCoverage2D inputCoverage, ProgressListener monitor) { Map<String, Object> map = new HashMap<String, Object>(); map.put(RasterAspectProcessFactory.inputCoverage.key, inputCoverage); Process process = new RasterAspectProcess(null); Map<String, Object> resultMap; try { resultMap = process.execute(map, monitor); return (GridCoverage2D) resultMap.get(RasterAspectProcessFactory.RESULT.key); } catch (ProcessException e) { LOGGER.log(Level.FINER, e.getMessage(), e); } return null; }
rasterSpaceGeometry = JTS.transform(roi, new AffineTransform2D(mt2d.createInverse())); } catch (MismatchedDimensionException e) { throw new ProcessException(e); } catch (TransformException e) { throw new ProcessException(e); } catch (NoninvertibleTransformException e) { throw new ProcessException(e);
public static GridCoverage2D process(GridCoverage2D inputCoverage, ProgressListener monitor) { Map<String, Object> map = new HashMap<String, Object>(); map.put(RasterFlipProcessFactory.inputCoverage.key, inputCoverage); Process process = new RasterFlipProcess(null); Map<String, Object> resultMap; try { resultMap = process.execute(map, monitor); return (GridCoverage2D) resultMap.get(RasterFlipProcessFactory.RESULT.key); } catch (ProcessException e) { LOGGER.log(Level.FINER, e.getMessage(), e); } return null; }
throws ProcessException { if (coverages == null || coverages.isEmpty()) { throw new ProcessException( Errors.format(ErrorKeys.NULL_ARGUMENT_$1, "Input coverage List"));
public static GridCoverage2D process(GridCoverage2D inputCoverage, ProgressListener monitor) { Map<String, Object> map = new HashMap<String, Object>(); map.put(RasterRoughnessProcessFactory.inputCoverage.key, inputCoverage); Process process = new RasterRoughnessProcess(null); Map<String, Object> resultMap; try { resultMap = process.execute(map, monitor); return (GridCoverage2D) resultMap.get(RasterRoughnessProcessFactory.RESULT.key); } catch (ProcessException e) { LOGGER.log(Level.FINER, e.getMessage(), e); } return null; }
monitor.exceptionOccurred(e); throw new ProcessException(e); } catch (InvocationTargetException e) { Throwable t = e.getTargetException(); throw ((ProcessException) t); } else { throw new ProcessException(t);
public static GridCoverage2D process(GridCoverage2D inputCoverage, ProgressListener monitor) { Map<String, Object> map = new HashMap<String, Object>(); map.put(RasterTPIProcessFactory.inputCoverage.key, inputCoverage); Process process = new RasterTPIProcess(null); Map<String, Object> resultMap; try { resultMap = process.execute(map, monitor); return (GridCoverage2D) resultMap.get(RasterTPIProcessFactory.RESULT.key); } catch (ProcessException e) { LOGGER.log(Level.FINER, e.getMessage(), e); } return null; }
? (coverageB == null ? "coverageA and coverageB" : "coverageA") : "coverageB"; throw new ProcessException(Errors.format(ErrorKeys.NULL_ARGUMENT_$1, coveragesNull)); mathTransform = CRS.findMathTransform(crsA, crsB); } catch (FactoryException e) { throw new ProcessException( "Exceptions occurred while looking for a mathTransform between the 2 coverage's CRSs", e); throw new ProcessException(MISMATCHING_CRS_MESSAGE); Envelope envB = coverageB.getEnvelope(); if (!envA.equals(envB)) { throw new ProcessException(MISMATCHING_ENVELOPE_MESSAGE); if (gridRangeA.getSpan(0) != gridRangeB.getSpan(0) || gridRangeA.getSpan(1) != gridRangeB.getSpan(1)) { throw new ProcessException(MISMATCHING_GRID_MESSAGE);
public static GridCoverage2D process(GridCoverage2D inputCoverage, ProgressListener monitor) { Map<String, Object> map = new HashMap<String, Object>(); map.put(RasterMirrorProcessFactory.inputCoverage.key, inputCoverage); Process process = new RasterMirrorProcess(null); Map<String, Object> resultMap; try { resultMap = process.execute(map, monitor); return (GridCoverage2D) resultMap.get(RasterMirrorProcessFactory.RESULT.key); } catch (ProcessException e) { LOGGER.log(Level.FINER, e.getMessage(), e); } return null; }
@DescribeResult(name = "result", description = "Output feature collection") public SimpleFeatureCollection execute( @DescribeParameter(name = "first", description = "First input feature collection") SimpleFeatureCollection firstFeatures, @DescribeParameter(name = "second", description = "Second feature collection") SimpleFeatureCollection secondFeatures) throws ClassNotFoundException { if (!(firstFeatures .features() .next() .getDefaultGeometry() .getClass() .equals(secondFeatures.features().next().getDefaultGeometry().getClass()))) { throw new ProcessException("Different default geometries, cannot perform union"); } else { return new UnitedFeatureCollection(firstFeatures, secondFeatures); } }
public static GridCoverage2D process(GridCoverage2D inputCoverage, ProgressListener monitor) { Map<String, Object> map = new HashMap<String, Object>(); map.put(RasterTRIProcessFactory.inputCoverage.key, inputCoverage); Process process = new RasterTRIProcess(null); Map<String, Object> resultMap; try { resultMap = process.execute(map, monitor); return (GridCoverage2D) resultMap.get(RasterTRIProcessFactory.RESULT.key); } catch (ProcessException e) { LOGGER.log(Level.FINER, e.getMessage(), e); } return null; }