class 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);
        }

        // Create a copy of this view.
        group = group.copy();
        // Scale, if necessary, to the given glyph size.
        final double[] scale = LienzoShapeUtils.getScaleFactor(bb.getWidth(),
                                                               bb.getHeight(),
                                                               width,
                                                               height);
        group.setScale(scale[0],
                       scale[1]);

        return group;
    }

    protected  LienzoShapeGlyphRenderer();
    @Inject public  LienzoShapeGlyphRenderer(final FactoryManager factoryManager);
      LienzoShapeGlyphRenderer(final FactoryManager factoryManager,
                             final Function<ShapeView<?>, BoundingBox> boundingBoxProvider,
                             final Function<ShapeView<?>, Group> groupProvider);

}