Package net.sf.latexdraw.parsers.svg

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



  @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$
View Full Code Here


  public SVGElement toSVG(final SVGDocument doc, final boolean isShadow) {
    if(doc==null || !arrow.hasStyle())
      return null;

    final ArrowStyle arrowStyle = arrow.getArrowStyle();
    final SVGElement marker   = new SVGMarkerElement(doc);
    final double lineWidth    = arrow.getShape().getFullThickness();
    double gapPostion       = 0.;

    if(arrowStyle==ArrowStyle.CIRCLE_END || arrowStyle==ArrowStyle.CIRCLE_IN)
      gapPostion = toSVGCircle(doc, lineWidth, isShadow, marker);
    else
    if(arrowStyle==ArrowStyle.DISK_END || arrowStyle==ArrowStyle.DISK_IN)
      gapPostion = toSVGDisk(doc, lineWidth, isShadow, marker);
    else
    if(arrowStyle.isBar())
      toSVGBar(doc, lineWidth, isShadow, marker);
    else if(arrowStyle.isSquareBracket())
      toSVGSquareBracket(doc, lineWidth, isShadow, marker);
    else
    if(arrowStyle==ArrowStyle.RIGHT_ARROW || arrowStyle==ArrowStyle.LEFT_ARROW)
      toSVGArrow(doc, lineWidth, isShadow, marker);
    else
    if(arrowStyle.isRoundBracket())
      toSVGRoundBracket(doc, lineWidth, isShadow, marker);
    else
    if(arrowStyle==ArrowStyle.LEFT_DBLE_ARROW || arrowStyle==ArrowStyle.RIGHT_DBLE_ARROW)
      toSVGDoubleArrow(doc, lineWidth, isShadow, marker);
    else
    if(arrowStyle==ArrowStyle.ROUND_IN)
      toSVGRoundIn(doc, isShadow, marker);

    if(!LNumber.equalsDouble(gapPostion,0.))
      marker.setAttribute(SVGAttributes.SVG_REF_X, String.valueOf(gapPostion/lineWidth));

    marker.setAttribute(SVGAttributes.SVG_OVERFLOW, SVGAttributes.SVG_VALUE_VISIBLE);
    marker.setAttribute(SVGAttributes.SVG_ORIENT, SVGAttributes.SVG_VALUE_AUTO);

    return marker;
  }
View Full Code Here

TOP

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

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.