Package net.sf.latexdraw.parsers.svg.parsers

Examples of net.sf.latexdraw.parsers.svg.parsers.Graphics2D2SVG


  @Override
  public SVGElement toSVG(final SVGDocument doc) {
    if(doc==null)
      return null;

    final Graphics2D2SVG graphics = new Graphics2D2SVG(doc);
        final SVGElement root;
        final boolean viewCreated;
        // Instead of creating a view, its is gathered from the Java view of the application.
    IViewShape view = MappingRegistry.REGISTRY.getTargetFromSource(shape, IViewDot.class);

    if(view==null) {
      view =  View2DTK.getFactory().createView(shape);
      viewCreated = true;
    }
    else viewCreated = false;

        view.paint(graphics, null);
        root = graphics.getElement();

        root.setAttribute(LNamespace.LATEXDRAW_NAMESPACE+':'+LNamespace.XML_TYPE, LNamespace.XML_TYPE_DOT);
        root.setAttribute(SVGAttributes.SVG_ID, getSVGID());
    root.setAttribute(LNamespace.LATEXDRAW_NAMESPACE+':'+LNamespace.XML_SIZE, String.valueOf(shape.getDiametre()));
    root.setAttribute(LNamespace.LATEXDRAW_NAMESPACE+':'+LNamespace.XML_DOT_SHAPE, shape.getDotStyle().getPSTToken());
    root.setAttribute(LNamespace.LATEXDRAW_NAMESPACE+':'+LNamespace.XML_POSITION, shape.getPosition().getX() + " " + shape.getPosition().getY()); //$NON-NLS-1$

    graphics.dispose();

    if(viewCreated)
      view.flush();

    return root;
View Full Code Here

TOP

Related Classes of net.sf.latexdraw.parsers.svg.parsers.Graphics2D2SVG

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.