ProductTransformation { public AffineTransform getTransform() { return transform; } ProductTransformation(Rectangle subsetRectangle, boolean flipX, boolean flipY); static ProductTransformation parse(String productTransformationString, Rectangle productRectangle); AffineTransform getTransform();  }
@Test public void testTransformationSubset() throws Exception { AffineTransform i2o = new ProductTransformation(SUBSET_PRODUCT, false, false).getTransform(); assertEquals(point(5f, 5f), i2o.transform(point(15f, 25f), null)); assertEquals(point(0f, 0f), i2o.transform(point(10f, 20f), null)); assertEquals(point(30f, 0f), i2o.transform(point(40f, 20f), null)); assertEquals(point(30f, 30f), i2o.transform(point(40f, 50f), null)); assertEquals(point(0f, 30f), i2o.transform(point(10f, 50f), null)); }
@Test public void testTransformationFlipY() throws Exception { AffineTransform i2o = new ProductTransformation(INPUT_PRODUCT, false, true).getTransform(); assertEquals(point(85f, 25f), i2o.transform(point(15f, 25f), null)); assertEquals(point(90f, 20f), i2o.transform(point(10f, 20f), null)); assertEquals(point(60f, 20f), i2o.transform(point(40f, 20f), null)); assertEquals(point(60f, 50f), i2o.transform(point(40f, 50f), null)); assertEquals(point(90f, 50f), i2o.transform(point(10f, 50f), null)); }
@Test public void testTransformationFlipX() throws Exception { AffineTransform i2o = new ProductTransformation(INPUT_PRODUCT, true, false).getTransform(); assertEquals(point(15f, 475f), i2o.transform(point(15f, 25f), null)); assertEquals(point(10f, 480f), i2o.transform(point(10f, 20f), null)); assertEquals(point(40f, 480f), i2o.transform(point(40f, 20f), null)); assertEquals(point(40f, 450f), i2o.transform(point(40f, 50f), null)); assertEquals(point(10f, 450f), i2o.transform(point(10f, 50f), null)); }
@Test public void testTransformationSubsetAndFlipY() throws Exception { AffineTransform i2o = new ProductTransformation(SUBSET_PRODUCT, false, true).getTransform(); assertEquals(point(25f, 5f), i2o.transform(point(15f, 25f), null)); assertEquals(point(30f, 0f), i2o.transform(point(10f, 20f), null)); assertEquals(point(0f, 0f), i2o.transform(point(40f, 20f), null)); assertEquals(point(0f, 30f), i2o.transform(point(40f, 50f), null)); assertEquals(point(30f, 30f), i2o.transform(point(10f, 50f), null)); }
@Test public void testTransformationSubsetAndFlipX() throws Exception { AffineTransform i2o = new ProductTransformation(SUBSET_PRODUCT, true, false).getTransform(); assertEquals(point(5f, 25f), i2o.transform(point(15f, 25f), null)); assertEquals(point(0f, 30f), i2o.transform(point(10f, 20f), null)); assertEquals(point(30f, 30f), i2o.transform(point(40f, 20f), null)); assertEquals(point(30f, 0f), i2o.transform(point(40f, 50f), null)); assertEquals(point(0f, 0f), i2o.transform(point(10f, 50f), null)); }
@Test public void testTransformationSubsetAndFlipYAndFlipX() throws Exception { AffineTransform i2o = new ProductTransformation(SUBSET_PRODUCT, true, true).getTransform(); assertEquals(point(25f, 25f), i2o.transform(point(15f, 25f), null)); assertEquals(point(30f, 30f), i2o.transform(point(10f, 20f), null)); assertEquals(point(0f, 30f), i2o.transform(point(40f, 20f), null)); assertEquals(point(0f, 0f), i2o.transform(point(40f, 50f), null)); assertEquals(point(30f, 0f), i2o.transform(point(10f, 50f), null)); }