Set<GetSourceValue> positions = Jiffle.getReadPositions(script, Arrays.asList(sourceName)); if (positions.isEmpty()) { return null; Band band = position.getPos().getBand(); Expression index = band.getIndex(); if (index == null) { bands.add(0); } else if (index instanceof ScalarLiteral) { bands.add(Integer.valueOf(((ScalarLiteral) band.getIndex()).getValue())); } else { if (LOGGER.isLoggable(Level.FINE)) {
/** * Associates a variable name with a source image. The default coordinate * system will be used for this image. * The image will be stored by the builder as a weak reference. * * @param varName variable name * @param sourceImage the source image * @return the instance of this class to allow method chaining */ public JiffleBuilder source(String varName, RenderedImage sourceImage) { return source(varName, sourceImage, null); }
private JiffleBuilder doSetWorld(Rectangle2D worldBounds, double xres, double yres) { worldInfo = new WorldInfo(); worldInfo.bounds = worldBounds; worldInfo.xres = xres; worldInfo.yres = yres; return this; }
private JiffleDirectRuntime getRuntimeWithImagesBlock() throws Exception { String script = "images {" + " src1=read; src2=read; src3=read;" + " dest1=write; dest2=write; dest3=write;" + "}" + "dest1 = src1; dest2 = src2; dest3 = src3;" ; Jiffle jiffle = new Jiffle(); jiffle.setScript(script); jiffle.compile(); return jiffle.getRuntimeInstance(); }
public void runScriptWithBuilder(File scriptFile) throws Exception { // docs-begin-builder-example JiffleBuilder builder = new JiffleBuilder(); // These chained methods read the script from a file, // create a new image for the output, and run the script builder.script(scriptFile).dest("destImg", 500, 500).run(); RenderedImage result = builder.getImage("destImg"); // docs-end-builder-example } }
public void getSourceFromJiffleObject(String script) throws JiffleException { Jiffle jiffle = new Jiffle(); jiffle.setScript(script); // You have to compile the script before getting the runtime // source otherwise an Exception will be thrown jiffle.compile(); // Get the Java source. The boolean argument specifies that we // want the input script copied into the class javadocs String runtimeSource = jiffle.getRuntimeSource(true); } // docs end getSourceFromJiffleObject
public void getSourceFromJiffleBuilder(String script) throws JiffleException { JiffleBuilder builder = new JiffleBuilder(); builder.script(script); // Set source and destination parameters, then... String runtimeSource = builder.getRuntimeSource(); } // docs end getSourceFromJiffleBuilder
@Test(expected=JiffleException.class) public void invalidBaseClass() throws Exception { class Foo extends NullRuntime { } setupSingleDestScript(); Object runtime = jiffle.getRuntimeInstance(Foo.class); }
/** * Creates a new instance with the given list of messages. * * @param errors list of error messages */ public JiffleException(List<String> errors) { super(listToString(errors)); }
/** * Reads the script from {@code scriptFile}. * * @param scriptFile file containing the script * * @return the instance of this class to allow method chaining * @throws JiffleException if there were problems reading the file */ public JiffleBuilder script(File scriptFile) throws JiffleException { script = readScriptFile(scriptFile); return this; }
/** * Creates a new instance. */ public Jiffle() { init(); }
private static void reportMessages(Jiffle.Result result) throws it.geosolutions.jaiext.jiffle.JiffleException { reportMessages(result.messages); }
private JiffleDirectRuntime getRuntime(String script) throws Exception { Jiffle jiffle = new Jiffle(); jiffle.setScript(script); jiffle.compile(); return jiffle.getRuntimeInstance(); } }
/** * Associates a variable name with a source image. The default coordinate * system will be used for this image. * The image will be stored by the builder as a weak reference. * * @param varName variable name * @param sourceImage the source image * @return the instance of this class to allow method chaining */ public JiffleBuilder source(String varName, RenderedImage sourceImage) { return source(varName, sourceImage, null); }
private JiffleBuilder doSetWorld(Rectangle2D worldBounds, double xres, double yres) { worldInfo = new WorldInfo(); worldInfo.bounds = worldBounds; worldInfo.xres = xres; worldInfo.yres = yres; return this; }
/** * Creates a new instance with the given list of messages. * * @param errors list of error messages */ public JiffleException(List<String> errors) { super(listToString(errors)); }
/** * Reads the script from {@code scriptFile}. * * @param scriptFile file containing the script * * @return the instance of this class to allow method chaining * @throws JiffleException if there were problems reading the file */ public JiffleBuilder script(File scriptFile) throws JiffleException { script = readScriptFile(scriptFile); return this; }
/** * Creates a new instance. */ public Jiffle() { init(); }