Package net.sf.latexdraw.parsers.svg

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


import static org.junit.Assert.*;

public class TestSVGDefsElement extends AbstractTestSVGElement {
  @Test
  public void testEnableRendering() throws MalformedSVGDocument {
    SVGDefsElement defs = new SVGDefsElement(node, null);
    assertFalse(defs.enableRendering());
  }
View Full Code Here


  }


  @Test
  public void testGetDef() throws MalformedSVGDocument {
    SVGDefsElement defs = new SVGDefsElement(node, null);
    SVGMarkerElement mark = new SVGMarkerElement(node.getOwnerDocument());

    mark.setAttribute(SVGAttributes.SVG_ID, SVGAttributes.SVG_ID);
    defs.appendChild(mark);

    assertNull(defs.getDef(null));
    assertNull(defs.getDef("")); //$NON-NLS-1$
    assertNull(defs.getDef("dsqd")); //$NON-NLS-1$
    assertEquals(mark, defs.getDef("id")); //$NON-NLS-1$
  }
View Full Code Here

  @SuppressWarnings("unused")
  @Test
  public void testContructor() throws MalformedSVGDocument {
    try {
      new SVGDefsElement(null, null);
      fail();
    }
    catch(Exception e){/**/}

    new SVGDefsElement(node, null);
  }
View Full Code Here

    // Creation of the SVG document.
    final List<IShape> shapes  = drawing.getShapes();
    final SVGDocument doc     = new SVGDocument();
    final SVGSVGElement root   = doc.getFirstChild();
    final SVGGElement g     = new SVGGElement(doc);
    final SVGDefsElement defs  = new SVGDefsElement(doc);
    SVGElement elt;

    root.appendChild(defs);
    root.appendChild(g);
    root.setAttribute("xmlns:"+LNamespace.LATEXDRAW_NAMESPACE, LNamespace.LATEXDRAW_NAMESPACE_URI);//$NON-NLS-1$
View Full Code Here

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

    final SVGDefsElement defs  = doc.getFirstChild().getDefs();
    final double rotationAngle = shape.getRotationAngle();
    final double startAngle    = shape.getAngleStart()%(2.*Math.PI);
    final double endAngle      = shape.getAngleEnd()%(2.*Math.PI);
    final ArcStyle type      = shape.getArcStyle();
        final SVGElement root    = new SVGGElement(doc);
View Full Code Here

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

    final SVGDefsElement defs = doc.getFirstChild().getDefs();
    final SVGElement root   = new SVGGElement(doc);
        SVGElement elt;
        final String path     = getPathSegList().toString();

    root.setAttribute(LNamespace.LATEXDRAW_NAMESPACE+':'+LNamespace.XML_TYPE, LNamespace.XML_TYPE_BEZIER_CURVE);
View Full Code Here

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

        final SVGElement root     = new SVGGElement(doc);
    final SVGDefsElement defs   = doc.getFirstChild().getDefs();
    final StringBuilder points   = new StringBuilder();
    final List<IPoint> pts    = shape.getPoints();
    SVGPolyLineElement elt;

    root.setAttribute(LNamespace.LATEXDRAW_NAMESPACE + ':' + LNamespace.XML_TYPE, LNamespace.XML_TYPE_JOINED_LINES);
View Full Code Here

        shapes  = drawing.getSelection().getShapes();
      else shapes = drawing.getShapes();

      root.appendChild(g);
      root.setAttribute("xmlns:"+LNamespace.LATEXDRAW_NAMESPACE, LNamespace.LATEXDRAW_NAMESPACE_URI);//$NON-NLS-1$
      root.appendChild(new SVGDefsElement(doc));

      try {
            for(final IShape sh : shapes) {
              // For each shape an SVG element is created.
              elt = SVGShapesFactory.INSTANCE.createSVGElement(sh, doc);
View Full Code Here

TOP

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

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.