public void runtimeExample() throws Exception { // docs start // World bounds Rectangle2D worldBounds = new Rectangle2D.Double( 750000, 6500000, 100000, 50000); // Common image bounds Rectangle imageBounds = new Rectangle(0, 0, 4000, 2000); // Set the bounds (world units) and resolution of the // processing area runtimeObj.setWorldByNumPixels(worldBounds, 4000, 2000); // Create a new transform that converts from world units to // pixel positions using the CoordinateTransforms helper class CoordinateTransform tr = CoordinateTransforms.getTransform( worldBounds, imageBounds); // Set this coordinate transform object to be used with all images runtimeObj.setDefaultTransform(tr); // docs end } }
JiffleDirectRuntime runtime = jiffle.getRuntimeInstance(); runtime.setDefaultTransform(_defaultTransform); if (worldInfo != null) { runtime.setWorldByResolution(worldInfo.bounds, worldInfo.xres, worldInfo.yres);
JiffleDirectRuntime runtime = jiffle.getRuntimeInstance(); runtime.setDefaultTransform(_defaultTransform); if (worldInfo != null) { runtime.setWorldByResolution(worldInfo.bounds, worldInfo.xres, worldInfo.yres);
/** * Setting a default transform without having previously set the world * bounds should throw a JiffleException. */ @Test(expected=JiffleException.class) public void forgetTheWorldBeforeDefaultTransform() throws Exception { System.out.println(" forget to set the world before setting default transform"); JiffleDirectRuntime runtime = getRuntime("images {dest=write;} dest = 42;"); CoordinateTransform tr = CoordinateTransforms.translation(10, 10); runtime.setDefaultTransform(tr); }
runtime.setDefaultTransform(tr);