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

Examples of net.sf.latexdraw.parsers.svg.path.SVGPathSegLineto


      return ;
    }

    assertTrue(pathSeg instanceof SVGPathSegLineto);

    SVGPathSegLineto seg2 = (SVGPathSegLineto)pathSeg;

    assertEquals(seg.getX(), seg2.getX(), 0.0001);
    assertEquals(seg.getY(), seg2.getY(), 0.0001);
    assertEquals(seg.isRelative(), seg2.isRelative());
  }
View Full Code Here


    final SVGPathSegList path   = new SVGPathSegList();
    final double x         = arrow.getArrowStyle()==ArrowStyle.BAR_IN ? arrow.isLeftArrow() ? 0.5 : -0.5 : 0.;

    bar.setAttribute(LNamespace.LATEXDRAW_NAMESPACE+':'+LNamespace.XML_ARROW_TBAR_SIZE_NUM, String.valueOf(arrow.getTBarSizeNum()));
    path.add(new SVGPathSegMoveto(x, -width/(lineWidth*2.), false));
    path.add(new SVGPathSegLineto(x, width/(lineWidth*2.), false));
    bar.setPathData(path);
    bar.setAttribute(SVGAttributes.SVG_STROKE, CSSColors.INSTANCE.getColorName(isShadow ? shape.getShadowCol() : shape.getLineColour(), true));
    bar.setAttribute(SVGAttributes.SVG_FILL, SVGAttributes.SVG_VALUE_NONE);
    bar.setPathData(path);
    bar.setStrokeWidth(1.);
View Full Code Here

    final double gapPostion;

    if(arrow.getArrowStyle()==ArrowStyle.LEFT_SQUARE_BRACKET) {
      final double lgth2 = isInverted ? -lgth : 0.;
      path.add(new SVGPathSegMoveto(lgth+lgth2+0.5, -width/(lineWidth*2)+0.5, false));
      path.add(new SVGPathSegLineto(lgth2, -width/(lineWidth*2)+0.5, false));
      path.add(new SVGPathSegLineto(lgth2, width/(lineWidth*2)-0.5, false));
      path.add(new SVGPathSegLineto(lgth+lgth2+0.5, width/(lineWidth*2)-0.5, false));
      gapPostion = isInverted ? -lineWidth/4. : -lineWidth/2.;
    }
    else {
      final double lgth2 = isInverted ? lgth : 0.;
      path.add(new SVGPathSegMoveto(-lgth+lgth2-0.5, -width/(lineWidth*2)+0.5, false));
      path.add(new SVGPathSegLineto(lgth2, -width/(lineWidth*2)+0.5, false));
      path.add(new SVGPathSegLineto(lgth2, width/(lineWidth*2)-0.5, false));
      path.add(new SVGPathSegLineto(-lgth+lgth2-0.5, width/(lineWidth*2)-0.5, false));
      gapPostion = isInverted ? lineWidth/4. : lineWidth/2.;
    }

    marker.appendChild(bar);
    bar.setAttribute(LNamespace.LATEXDRAW_NAMESPACE+':'+LNamespace.XML_ARROW_TBAR_SIZE_NUM, String.valueOf(arrow.getTBarSizeNum()));
View Full Code Here

      inset *= -1.;
    }

    final double lgth2 = arrow.isInverted() ? length : 0.;
    path.add(new SVGPathSegMoveto(lgth2, 0., false));
    path.add(new SVGPathSegLineto(-length+lgth2, width/2., false));
    path.add(new SVGPathSegLineto(-length+inset+lgth2, 0.false));
    path.add(new SVGPathSegLineto(-length+lgth2, -width/2., false));
    path.add(new SVGPathSegClosePath());

    marker.appendChild(arrowSVG);
    arrowSVG.setAttribute(LNamespace.LATEXDRAW_NAMESPACE+':'+LNamespace.XML_ARROW_SIZE_NUM, String.valueOf(arrow.getArrowSizeNum()));
    arrowSVG.setAttribute(SVGAttributes.SVG_FILL, CSSColors.INSTANCE.getColorName(isShadow ? shape.getShadowCol() : shape.getLineColour(), true));
View Full Code Here

      length *= -1.;
    }

    final double lgth2 = arrow.isInverted() ? length*2 : 0.;
    path.add(new SVGPathSegMoveto(lgth2, 0., false));
    path.add(new SVGPathSegLineto(-length+lgth2, width/2., false));
    path.add(new SVGPathSegLineto(-length+inset+lgth2, 0., false));
    path.add(new SVGPathSegLineto(-length+lgth2, -width/2., false));
    path.add(new SVGPathSegClosePath());
    path.add(new SVGPathSegMoveto(-length+lgth2, 0., false));
    path.add(new SVGPathSegLineto(-length*2+lgth2, width/2., false));
    path.add(new SVGPathSegLineto(-length*2+inset+lgth2, 0., false));
    path.add(new SVGPathSegLineto(-length*2+lgth2, -width/2., false));
    path.add(new SVGPathSegClosePath());

    marker.appendChild(arrowSVG);
    arrowSVG.setAttribute(LNamespace.LATEXDRAW_NAMESPACE+':'+LNamespace.XML_ARROW_SIZE_NUM, String.valueOf(arrow.getArrowSizeNum()));
    arrowSVG.setAttribute(SVGAttributes.SVG_FILL, CSSColors.INSTANCE.getColorName(isShadow ? shape.getShadowCol() : shape.getLineColour(), true));
View Full Code Here

        if(type==ArcStyle.CHORD)
          path.add(new SVGPathSegClosePath());
        else
          if(type==ArcStyle.WEDGE) {
            final IPoint gravityCenter = shape.getGravityCentre();
            path.add(new SVGPathSegLineto(gravityCenter.getX(), gravityCenter.getY(), false));
            path.add(new SVGPathSegClosePath());
          }

        if(shape.hasShadow())  {
          final SVGElement shad = new SVGPathElement(doc);
View Full Code Here

    if(LNumber.equalsDouble(angle2, 0.))
      // Drawing the hatchings vertically.
      for(double x = nwx; x<sex; x+=val) {
        path.add(new SVGPathSegMoveto(x, nwy, false));
        path.add(new SVGPathSegLineto(x, sey, false));
      }
    else
      // Drawing the hatchings horizontally.
      if(LNumber.equalsDouble(angle2, halphPI) || LNumber.equalsDouble(angle2, -halphPI))
        for(double y = nwy; y<sey; y+=val) {
          path.add(new SVGPathSegMoveto(nwx, y, false));
          path.add(new SVGPathSegLineto(sex, y, false));
        }
      else {
        // Drawing the hatchings by rotation.
        final double incX = val/Math.cos(angle2);
        final double incY = val/Math.sin(angle2);
        final double maxX;
        double y1;
                double x2;
                final double y2;
                final double x1;

                if(angle2>0.) {
          y1    = nwy;
          maxX = sex + (sey-(nwy<0?nwy:0)) * Math.tan(angle2);
        }
        else  {
          y1    = sey;
          maxX = sex - sey * Math.tan(angle2);
        }

        x1 = nwx;
        x2 = x1;
        y2 = y1;

        if(incX<0. || LNumber.equalsDouble(incX, 0.))
          return ;

        while(x2 < maxX) {
          x2 += incX;
          y1 += incY;
          path.add(new SVGPathSegMoveto(x1, y1, false));
          path.add(new SVGPathSegLineto(x2, y2, false));
        }
      }
  }
View Full Code Here

           prevy = cury;
           curx = shape.getPtAt(interval).getX();
           cury = shape.getPtAt(interval).getY();
           midx = (curx + prevx) / 2.;
           midy = (cury + prevy) / 2.;
           path.add(new SVGPathSegLineto(midx, midy, false));
        }

        for(i=interval*2; i<size; i+=interval)  {
          final double x1 = (midx + curx) / 2.;
          final double y1 = (midy + cury) / 2.;
View Full Code Here

    final int interval = shape.getInterval();

    path.add(new SVGPathSegMoveto(p.getX(), p.getY(), false));

    for(i=interval; i<size; i+=interval)
      path.add(new SVGPathSegLineto(shape.getPtAt(i).getX(), shape.getPtAt(i).getY(), false));

    if(i-interval<size)
      path.add(new SVGPathSegLineto(shape.getPtAt(-1).getX(), shape.getPtAt(-1).getY(), false));
  }
View Full Code Here

    element           = new SVGPathElement(document);

    while(!pi.isDone()) {
      switch(pi.currentSegment(coords)) {
        case PathIterator.SEG_CLOSE  : list.add(new SVGPathSegClosePath()); break;
        case PathIterator.SEG_LINETO: list.add(new SVGPathSegLineto(coords[0], coords[1], false)); break;
        case PathIterator.SEG_MOVETO: list.add(new SVGPathSegMoveto(coords[0], coords[1], false)); break;
        case PathIterator.SEG_CUBICTO: list.add(new SVGPathSegCurvetoCubic(coords[4], coords[5], coords[0], coords[1], coords[2], coords[3], false)); break;
        case PathIterator.SEG_QUADTO: list.add(new SVGPathSegCurvetoQuadratic(coords[2], coords[3], coords[0], coords[1], false)); break;
        default: throw new ParseException("Invalid Path2D element:" + pi.currentSegment(coords), -1);
      }
View Full Code Here

TOP

Related Classes of net.sf.latexdraw.parsers.svg.path.SVGPathSegLineto

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.