Tabnine Logo
Jiffle.setImageParams
Code IndexAdd Tabnine to your IDE (free)

How to use
setImageParams
method
in
it.geosolutions.jaiext.jiffle.Jiffle

Best Java code snippets using it.geosolutions.jaiext.jiffle.Jiffle.setImageParams (Showing top 20 results out of 315)

origin: geosolutions-it/jai-ext

private void createRuntimeInstances() {
  try {
    Jiffle jiffle = new Jiffle();
    Map<String, Jiffle.ImageRole> imageParams = new HashMap<>();
    imageParams.put(WORLD_NAME, Jiffle.ImageRole.SOURCE);
    imageParams.put(NEXT_WORLD_NAME, Jiffle.ImageRole.DEST);
    
    // First create a runtime for the toroidal world
    URL url = getClass().getResource("life-toroid.jfl");
    File file = new File(url.toURI());
    jiffle.setScript(file);
    jiffle.setImageParams(imageParams);
    jiffle.compile();
    toroidRuntime = jiffle.getRuntimeInstance();
    // Now create a second runtime for the hard-edged world
    url = getClass().getResource("life-edges.jfl");
    file = new File(url.toURI());
    jiffle.setScript(file);
    jiffle.setImageParams(imageParams);
    jiffle.compile();
    edgeRuntime = jiffle.getRuntimeInstance();
    // Set the active runtime
    activeRuntime = worldType == WorldType.EDGES ? edgeRuntime : toroidRuntime;
    
  } catch (Exception ex) {
    throw new RuntimeException(ex);
  }
}

origin: geosolutions-it/jai-ext

@Test(expected=UnsupportedOperationException.class)
public void tryToModifyImageParams() {
  System.out.println("   trying to modify map returned by getImageParams");
  
  imageParams.put("dest", Jiffle.ImageRole.DEST);
  jiffle.setImageParams(imageParams);
  
  Map<String, Jiffle.ImageRole> unmodifiableMap = jiffle.getImageParams();
  
  // this should provoke an exception
  unmodifiableMap.clear();
}
origin: geosolutions-it/jai-ext

@Test(expected=JiffleException.class)
public void compileWithNoScript() throws Exception {
  System.out.println("   compile with no script set");
  
  imageParams.put("dest", Jiffle.ImageRole.DEST);
  jiffle.setImageParams(imageParams);
  jiffle.compile();
}
origin: geosolutions-it/jai-ext

/**
 * Creates a new instance by compiling the script read from {@code scriptFile}. 
 * Using this constructor is equivalent to:
 * <pre><code>
 * Jiffle jiffle = new Jiffle();
 * jiffle.setScript(scriptFile);
 * jiffle.setImageParams(params);
 * jiffle.compile();
 * </code></pre>
 * 
 * @param scriptFile file containing the Jiffle script
 * 
 * @param params defines the names and roles of image variables
 *        referred to in the script.
 * 
 * @throws JiffleException on compilation errors
 */
public Jiffle(File scriptFile, Map<String, Jiffle.ImageRole> params)
    throws it.geosolutions.jaiext.jiffle.JiffleException {
  init();
  setScript(scriptFile);
  setImageParams(params);
  compile();
}

origin: it.geosolutions.jaiext.jiffle/jt-jiffle-language

/**
 * Creates a new instance by compiling the script read from {@code scriptFile}. 
 * Using this constructor is equivalent to:
 * <pre><code>
 * Jiffle jiffle = new Jiffle();
 * jiffle.setScript(scriptFile);
 * jiffle.setImageParams(params);
 * jiffle.compile();
 * </code></pre>
 * 
 * @param scriptFile file containing the Jiffle script
 * 
 * @param params defines the names and roles of image variables
 *        referred to in the script.
 * 
 * @throws JiffleException on compilation errors
 */
public Jiffle(File scriptFile, Map<String, Jiffle.ImageRole> params)
    throws it.geosolutions.jaiext.jiffle.JiffleException {
  init();
  setScript(scriptFile);
  setImageParams(params);
  compile();
}

origin: geosolutions-it/jai-ext

private void setupSingleDestScript() throws JiffleException {
  String script = "dest = 42;";
  jiffle.setScript(script);
  
  imageParams.put("dest", Jiffle.ImageRole.DEST);
  jiffle.setImageParams(imageParams);
  jiffle.compile();
}

origin: it.geosolutions.jaiext.jiffle/jt-jiffle-language

/**
 * Creates a new instance by compiling the provided script. Using this
 * constructor is equivalent to:
 * <pre><code>
 * Jiffle jiffle = new Jiffle();
 * jiffle.setScript(script);
 * jiffle.setImageParams(params);
 * jiffle.compile();
 * </code></pre>
 * 
 * @param script Jiffle source code to compile
 * 
 * @param params defines the names and roles of image variables
 *        referred to in the script.
 * @throws JiffleException on compilation errors
 * 
 */
public Jiffle(String script, Map<String, Jiffle.ImageRole> params)
    throws it.geosolutions.jaiext.jiffle.JiffleException {
  init();
  setScript(script);
  setImageParams(params);
  compile();
}
origin: geosolutions-it/jai-ext

/**
 * Creates a new instance by compiling the provided script. Using this
 * constructor is equivalent to:
 * <pre><code>
 * Jiffle jiffle = new Jiffle();
 * jiffle.setScript(script);
 * jiffle.setImageParams(params);
 * jiffle.compile();
 * </code></pre>
 * 
 * @param script Jiffle source code to compile
 * 
 * @param params defines the names and roles of image variables
 *        referred to in the script.
 * @throws JiffleException on compilation errors
 * 
 */
public Jiffle(String script, Map<String, Jiffle.ImageRole> params)
    throws it.geosolutions.jaiext.jiffle.JiffleException {
  init();
  setScript(script);
  setImageParams(params);
  compile();
}
origin: geosolutions-it/jai-ext

@Test
public void setImageParams() {
  System.out.println("   set and get image params");
  
  imageParams.put("src1", Jiffle.ImageRole.SOURCE);
  imageParams.put("src2", Jiffle.ImageRole.SOURCE);
  imageParams.put("dest1", Jiffle.ImageRole.DEST);
  imageParams.put("dest2", Jiffle.ImageRole.DEST);
  jiffle.setImageParams(imageParams);
  
  Map<String, Jiffle.ImageRole> result = jiffle.getImageParams();
  assertEquals(imageParams.size(), result.size());
  for (String name : imageParams.keySet()) {
    assertTrue(imageParams.get(name).equals(result.get(name)));
  }
}

origin: geosolutions-it/jai-ext

@Test(expected=JiffleParserException.class)
public void compileInvalidScriptThrowsException() throws Exception {
  System.out.println("   compile invalid script and get exception");
  
  // script with an uninitialized variable
  String script = "dest = x;";
  imageParams.put("dest", Jiffle.ImageRole.DEST);
  
  jiffle.setScript(script);
  jiffle.setImageParams(imageParams);
  jiffle.compile();
}
origin: geosolutions-it/jai-ext

  @Test(expected=JiffleException.class)
  public void getRuntimeBeforeCompiling() throws Exception {
    System.out.println("   getRuntimeInstance before compiling");
    
    String script = "dest = 42;";
    jiffle.setScript(script);
    
    imageParams.put("dest", Jiffle.ImageRole.DEST);
    jiffle.setImageParams(imageParams);
    
    JiffleRuntime runtime = jiffle.getRuntimeInstance();
  }    
}
origin: geosolutions-it/jai-ext

private JiffleDirectRuntime getRuntime(String script) throws Exception {
  Jiffle jiffle = new Jiffle();
  jiffle.setScript(script);
  
  Map<String, Jiffle.ImageRole> params = new HashMap<>();
  params.put("dest", Jiffle.ImageRole.DEST);
  jiffle.setImageParams(params);
  jiffle.compile();
  
  return jiffle.getRuntimeInstance();
}

origin: geosolutions-it/jai-ext

jiffle.setImageParams(imageParams);
jiffle.compile();
runtime =
origin: it.geosolutions.jaiext.jiffle/jt-jiffle-op

jiffle.setImageParams(imageParams);
jiffle.compile();
runtime =
origin: geosolutions-it/jai-ext

@Test
public void compileValidScript() throws Exception {
  System.out.println("   compile valid script");
  
  String script = "dest = 42;";
  imageParams.put("dest", Jiffle.ImageRole.DEST);
  
  jiffle.setScript(script);
  jiffle.setImageParams(imageParams);
  jiffle.compile();
  
  assertTrue(jiffle.isCompiled());
}
origin: geosolutions-it/jai-ext

@Test
public void compileInvalidScriptAndCheckStatus() throws Exception {
  System.out.println("   compile invalid script and check status");
  
  // script with an uninitialized variable
  String script = "dest = x;";
  imageParams.put("dest", Jiffle.ImageRole.DEST);
  
  jiffle.setScript(script);
  jiffle.setImageParams(imageParams);
  
  try {
    jiffle.compile();
  } catch (JiffleParserException ignored) {}
  
  assertFalse(jiffle.isCompiled());
}

origin: geosolutions-it/jai-ext

jiffle.setImageParams(imageParams);
origin: geosolutions-it/jai-ext

private JiffleDirectRuntime getRuntime(String script) throws Exception {
  Jiffle jiffle = new Jiffle();
  jiffle.setScript(script);
  
  Map<String, Jiffle.ImageRole> imageParams = new HashMap<>();
  imageParams.put("dest", Jiffle.ImageRole.DEST);
  
  jiffle.setImageParams(imageParams);
  jiffle.compile();
  JiffleDirectRuntime runtime = jiffle.getRuntimeInstance();
  
  WritableRenderedImage destImg = ImageUtilities.createConstantImage(WIDTH, WIDTH, 0d);
  runtime.setDestinationImage("dest", destImg);
  
  return runtime;
}

origin: it.geosolutions.jaiext.jiffle/jt-jiffle-language

setImageParams(r.result);
origin: geosolutions-it/jai-ext

setImageParams(r.result);
it.geosolutions.jaiext.jiffleJifflesetImageParams

Javadoc

Sets the image parameters. These define which variables in the script refer to images and their types (source or destination).

This may be called before or after setting the script. No check is made between script and parameters until the script is compiled.

Popular methods of Jiffle

  • <init>
    Creates a new instance by compiling the provided script. Using this constructor is equivalent to: J
  • compile
    Compiles the script into Java source for the runtime class.
  • getRuntimeInstance
    Gets the runtime object for this script. The runtime object is an instance of JiffleRuntime. By defa
  • setScript
    Sets the script. Calling this method will clear any previous script and runtime objects.
  • isCompiled
    Tests whether the script has been compiled successfully.
  • getReadPositions
    A utility method returning the source positions used in a given script
  • getRuntimeSource
    Gets a copy of the Java source for the runtime class. The script must have been compiled before call
  • clearCompiledObjects
    Clears all compiler and runtime objects.
  • createRuntimeInstance
  • createRuntimeSource
  • getImageParams
    Gets the current image parameters. The parameters are returned as an unmodifiable map.
  • getName
    Gets the name assigned to this object. This will either be the default name or one assigned by the c
  • getImageParams,
  • getName,
  • getRuntimeBaseClass,
  • getScript,
  • getScriptImageParams,
  • init,
  • parseScript,
  • reportMessages,
  • setName

Popular in Java

  • Start an intent from android
  • setContentView (Activity)
  • getContentResolver (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now