@Test @SuppressWarnings("unchecked") public void testRender() { final Group group = tested.render(glyph, 150d, 351d); assertEquals(this.group, group); verify(this.group, times(1)).setScale(eq(1d), eq(1d)); }
@Override @SuppressWarnings("unchecked") public Group render(final ShapeGlyph glyph, final double width, final double height) { final String definitionId = glyph.getDefinitionId(); final Supplier<ShapeFactory> factorySupplier = glyph.getFactorySupplier(); final Shape shape = factorySupplier.get().newShape(factoryManager.newDefinition(definitionId)); final ShapeView<?> view = shape.getShapeView(); final BoundingBox bb = boundingBoxProvider.apply(view); Group group = groupProvider.apply(view); if (null == group) { throw new RuntimeException("Shape view [" + view.toString() + "] not supported for " + "this shape glyph builder [" + this.getClass().getName()); } if (view instanceof HasTitle) { final HasTitle hasTitle = (HasTitle) view; hasTitle.setTitle(null); } group = group.copy(); final double[] scale = LienzoShapeUtils.getScaleFactor(bb.getWidth(), bb.getHeight(), width, height); group.setScale(scale[0], scale[1]); return group; }
LienzoShapeGlyphRenderer implements LienzoGlyphRenderer<ShapeGlyph> { @Override @SuppressWarnings("unchecked") public Group render(final ShapeGlyph glyph, final double width, final double height) { final String definitionId = glyph.getDefinitionId(); final Supplier<ShapeFactory> factorySupplier = glyph.getFactorySupplier(); final Shape shape = factorySupplier.get().newShape(factoryManager.newDefinition(definitionId)); final ShapeView<?> view = shape.getShapeView(); final BoundingBox bb = boundingBoxProvider.apply(view); Group group = groupProvider.apply(view); if (null == group) { throw new RuntimeException("Shape view [" + view.toString() + "] not supported for " + "this shape glyph builder [" + this.getClass().getName()); } if (view instanceof HasTitle) { final HasTitle hasTitle = (HasTitle) view; hasTitle.setTitle(null); } group = group.copy(); final double[] scale = LienzoShapeUtils.getScaleFactor(bb.getWidth(), bb.getHeight(), width, height); group.setScale(scale[0], scale[1]); return group; } }
LienzoShapeGlyphRenderer implements LienzoGlyphRenderer<ShapeGlyph> { @Override @SuppressWarnings("unchecked") public Group render(final ShapeGlyph glyph, final double width, final double height) { final String definitionId = glyph.getDefinitionId(); final Supplier<ShapeFactory> factorySupplier = glyph.getFactorySupplier(); final Shape shape = factorySupplier.get().newShape(factoryManager.newDefinition(definitionId)); final ShapeView<?> view = shape.getShapeView(); final BoundingBox bb = boundingBoxProvider.apply(view); Group group = groupProvider.apply(view); if (null == group) { throw new RuntimeException("Shape view [" + view.toString() + "] not supported for " + "this shape glyph builder [" + this.getClass().getName()); } if (view instanceof HasTitle) { final HasTitle hasTitle = (HasTitle) view; hasTitle.setTitle(null); } group = group.copy(); final double[] scale = LienzoShapeUtils.getScaleFactor(bb.getWidth(), bb.getHeight(), width, height); group.setScale(scale[0], scale[1]); return group; } protected  LienzoShapeGlyphRenderer(); @Inject  LienzoShapeGlyphRenderer(final FactoryManager factoryManager);   LienzoShapeGlyphRenderer(final FactoryManager factoryManager,
                             final Function<ShapeView<?>, BoundingBox> boundingBoxProvider,
                             final Function<ShapeView<?>, Group> groupProvider); }
LienzoShapeGlyphRenderer implements LienzoGlyphRenderer<ShapeGlyph> { @Override @SuppressWarnings("unchecked") public Group render(final ShapeGlyph glyph, final double width, final double height) { final String definitionId = glyph.getDefinitionId(); final Supplier<ShapeFactory> factorySupplier = glyph.getFactorySupplier(); final Shape shape = factorySupplier.get().newShape(factoryManager.newDefinition(definitionId)); final ShapeView<?> view = shape.getShapeView(); final BoundingBox bb = boundingBoxProvider.apply(view); Group group = groupProvider.apply(view); if (null == group) { throw new RuntimeException("Shape view [" + view.toString() + "] not supported for " + "this shape glyph builder [" + this.getClass().getName()); } if (view instanceof HasTitle) { final HasTitle hasTitle = (HasTitle) view; hasTitle.setTitle(null); } group = group.copy(); final double[] scale = LienzoShapeUtils.getScaleFactor(bb.getWidth(), bb.getHeight(), width, height); group.setScale(scale[0], scale[1]); return group; } protected  LienzoShapeGlyphRenderer(); @Inject  LienzoShapeGlyphRenderer(final FactoryManager factoryManager);   LienzoShapeGlyphRenderer(final FactoryManager factoryManager,
                             final Function<ShapeView<?>, BoundingBox> boundingBoxProvider,
                             final Function<ShapeView<?>, Group> groupProvider); @Override Class<ShapeGlyph> getGlyphType(); @Override @SuppressWarnings("unchecked") Group render(final ShapeGlyph glyph,
                        final double width,
                        final double height); }
LienzoShapeGlyphRenderer implements LienzoGlyphRenderer<ShapeGlyph> { @Override @SuppressWarnings("unchecked") public Group render(final ShapeGlyph glyph, final double width, final double height) { final String definitionId = glyph.getDefinitionId(); final Supplier<ShapeFactory> factorySupplier = glyph.getFactorySupplier(); final Shape shape = factorySupplier.get().newShape(factoryManager.newDefinition(definitionId)); final ShapeView<?> view = shape.getShapeView(); final BoundingBox bb = boundingBoxProvider.apply(view); Group group = groupProvider.apply(view); if (null == group) { throw new RuntimeException("Shape view [" + view.toString() + "] not supported for " + "this shape glyph builder [" + this.getClass().getName()); } if (view instanceof HasTitle) { final HasTitle hasTitle = (HasTitle) view; hasTitle.setTitle(null); } group = group.copy(); final double[] scale = LienzoShapeUtils.getScaleFactor(bb.getWidth(), bb.getHeight(), width, height); group.setScale(scale[0], scale[1]); return group; } protected  LienzoShapeGlyphRenderer(); @Inject  LienzoShapeGlyphRenderer(final FactoryManager factoryManager);   LienzoShapeGlyphRenderer(final FactoryManager factoryManager,
                             final Function<ShapeView<?>, BoundingBox> boundingBoxProvider,
                             final Function<ShapeView<?>, Group> groupProvider); @Override Class<ShapeGlyph> getGlyphType(); @Override @SuppressWarnings("unchecked") Group render(final ShapeGlyph glyph,
                        final double width,
                        final double height);  }