@Override public void setSourceImageBandTransform(String varName, BandTransform btr) throws JiffleException { SourceImage image = _images.get(varName); if (image == null) { throw new JiffleException("Unknown source image " + varName); } image.bandTransform = btr; }
@Override public void setSourceImageBandTransform(String varName, BandTransform btr) throws JiffleException { SourceImage image = _images.get(varName); if (image == null) { throw new JiffleException("Unknown source image " + varName); } image.bandTransform = btr; }
public void setDestinationImage(String varName, CoordinateTransform tr) throws JiffleException { try { doSetDestinationImage(varName, tr); } catch (WorldNotSetException ex) { throw new JiffleException(String.format( "Setting a coordinate tranform for a source (%s) without" + "having first set the world bounds and resolution", varName)); } }
@Override public void setSourceImageCoordinateTransform(String varName, CoordinateTransform tr) throws JiffleException { SourceImage image = _images.get(varName); if (image == null) { throw new JiffleException("Unknown source image " + varName); } image.setTransform(tr, tr == null); }
@Override public void setSourceImageCoordinateTransform(String varName, CoordinateTransform tr) throws JiffleException { SourceImage image = _images.get(varName); if (image == null) { throw new JiffleException("Unknown source image " + varName); } image.setTransform(tr, tr == null); }
public void setDestinationImage(String varName, CoordinateTransform tr) throws JiffleException { try { doSetDestinationImage(varName, tr); } catch (WorldNotSetException ex) { throw new JiffleException(String.format( "Setting a coordinate tranform for a source (%s) without" + "having first set the world bounds and resolution", varName)); } }
/** * {@inheritDoc} */ public void setSourceImage(String varName, RenderedImage image, CoordinateTransform tr) throws JiffleException { try { doSetSourceImage(varName, image, tr); } catch (WorldNotSetException ex) { throw new JiffleException(String.format( "Setting a coordinate tranform for a source (%s) without" + "having first set the world bounds and resolution", varName)); } }
/** * {@inheritDoc} */ public void setSourceImage(String varName, RenderedImage image, CoordinateTransform tr) throws JiffleException { try { doSetSourceImage(varName, image, tr); } catch (WorldNotSetException ex) { throw new JiffleException(String.format( "Setting a coordinate tranform for a source (%s) without" + "having first set the world bounds and resolution", varName)); } }
/** {@inheritDoc} */ public void setDestinationImage( String varName, WritableRenderedImage image, CoordinateTransform tr) throws JiffleException { try { doSetDestinationImage(varName, image, tr); } catch (WorldNotSetException ex) { throw new JiffleException( String.format( "Setting a coordinate tranform for a destination (%s) without" + "having first set the world bounds and resolution", varName)); } }
/** {@inheritDoc} */ public void setDestinationImage( String varName, WritableRenderedImage image, CoordinateTransform tr) throws JiffleException { try { doSetDestinationImage(varName, image, tr); } catch (WorldNotSetException ex) { throw new JiffleException( String.format( "Setting a coordinate tranform for a destination (%s) without" + "having first set the world bounds and resolution", varName)); } }
/** * Sets the script. Calling this method will clear any previous script * and runtime objects. * * @param script a Jiffle script * @throws JiffleException if the script is empty or {@code null} */ public final void setScript(String script) throws it.geosolutions.jaiext.jiffle.JiffleException { if (script == null || script.trim().length() == 0) { throw new it.geosolutions.jaiext.jiffle.JiffleException("script is empty !"); } clearCompiledObjects(); // add extra new line just in case last statement hits EOF theScript = script + "\n"; }
/** * Sets the script. Calling this method will clear any previous script * and runtime objects. * * @param script a Jiffle script * @throws JiffleException if the script is empty or {@code null} */ public final void setScript(String script) throws it.geosolutions.jaiext.jiffle.JiffleException { if (script == null || script.trim().length() == 0) { throw new it.geosolutions.jaiext.jiffle.JiffleException("script is empty !"); } clearCompiledObjects(); // add extra new line just in case last statement hits EOF theScript = script + "\n"; }
private String readScriptFile(File scriptFile) throws JiffleException { BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(scriptFile)); StringBuilder sb = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { line = line.trim(); if (line.length() > 0) { sb.append(line); sb.append('\n'); // put the newline back on for the parser } } return sb.toString(); } catch (IOException ex) { throw new JiffleException("Could not read the script file", ex); } finally { if (reader != null) { try { reader.close(); } catch (IOException ignored) { } } } }
private String readScriptFile(File scriptFile) throws JiffleException { BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(scriptFile)); StringBuilder sb = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { line = line.trim(); if (line.length() > 0) { sb.append(line); sb.append('\n'); // put the newline back on for the parser } } return sb.toString(); } catch (IOException ex) { throw new JiffleException("Could not read the script file", ex); } finally { if (reader != null) { try { reader.close(); } catch (IOException ignored) { } } } }
throw new JiffleException("Could not read the script file", ex);
throw new JiffleException("Can't find script file:" + fileName);
private static void reportMessages(Messages messages) throws it.geosolutions.jaiext.jiffle.JiffleException { if (messages.isError()) { String expectionMessage = messages.toString(); throw new it.geosolutions.jaiext.jiffle.JiffleException(expectionMessage); } }
private static void reportMessages(Messages messages) throws it.geosolutions.jaiext.jiffle.JiffleException { if (messages.isError()) { String expectionMessage = messages.toString(); throw new it.geosolutions.jaiext.jiffle.JiffleException(expectionMessage); } }
/** * Gets the runtime object for this script. * <p> * The runtime object is an instance of {@link JiffleRuntime}. By default * it extends an abstract base class supplied JAI-tools: * {@link it.geosolutions.jaiext.jiffle.runtime.AbstractDirectRuntime} * when using the direct runtiem model or * {@link it.geosolutions.jaiext.jiffle.runtime.AbstractIndirectRuntime} * when using the indirect model. This method allows you to * specify a custom base class. The custom class must implement either * {@link JiffleDirectRuntime} or {@link JiffleIndirectRuntime}. * * @param <T> the runtime base class type * @param baseClass the runtime base class * * @return the runtime object * @throws JiffleException if the script has not been compiled or if errors * occur in creating the runtime instance */ public <T extends JiffleRuntime> T getRuntimeInstance(Class<T> baseClass) throws it.geosolutions.jaiext.jiffle.JiffleException { RuntimeModel model = RuntimeModel.get(baseClass); if (model == null) { throw new it.geosolutions.jaiext.jiffle.JiffleException(baseClass.getName() + " does not implement a required Jiffle runtime interface"); } return (T) createRuntimeInstance(model, baseClass, false); }
/** * Gets the runtime object for this script. * <p> * The runtime object is an instance of {@link JiffleRuntime}. By default * it extends an abstract base class supplied JAI-tools: * {@link it.geosolutions.jaiext.jiffle.runtime.AbstractDirectRuntime} * when using the direct runtiem model or * {@link it.geosolutions.jaiext.jiffle.runtime.AbstractIndirectRuntime} * when using the indirect model. This method allows you to * specify a custom base class. The custom class must implement either * {@link JiffleDirectRuntime} or {@link JiffleIndirectRuntime}. * * @param <T> the runtime base class type * @param baseClass the runtime base class * * @return the runtime object * @throws JiffleException if the script has not been compiled or if errors * occur in creating the runtime instance */ public <T extends JiffleRuntime> T getRuntimeInstance(Class<T> baseClass) throws it.geosolutions.jaiext.jiffle.JiffleException { RuntimeModel model = RuntimeModel.get(baseClass); if (model == null) { throw new it.geosolutions.jaiext.jiffle.JiffleException(baseClass.getName() + " does not implement a required Jiffle runtime interface"); } return (T) createRuntimeInstance(model, baseClass, false); }