Examples of SVGPathSegCurvetoCubic


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

      return ;
    }

    assertTrue(pathSeg instanceof SVGPathSegCurvetoCubic);

    SVGPathSegCurvetoCubic seg2 = (SVGPathSegCurvetoCubic)pathSeg;

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

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

      gap *= -1.;
    }

    final double lgth2 = arrow.isInverted() ? lgth : 0.;
    path.add(new SVGPathSegMoveto(-lgth+lgth2-gap, width/2., false));
    path.add(new SVGPathSegCurvetoCubic(-lgth+lgth2-gap, -width/2., 0., width/2., 0., -width/2., false));

    marker.appendChild(rbracket);
    rbracket.setAttribute(SVGAttributes.SVG_STROKE, CSSColors.INSTANCE.getColorName(isShadow ? shape.getShadowCol() : shape.getLineColour(), true));
    rbracket.setAttribute(SVGAttributes.SVG_FILL, SVGAttributes.SVG_VALUE_NONE);
    rbracket.setAttribute(LNamespace.LATEXDRAW_NAMESPACE+':'+LNamespace.XML_ARROW_TBAR_SIZE_NUM, String.valueOf(arrow.getTBarSizeNum()));
View Full Code Here

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

  public void setPath(final SVGPathSegList list) {
    if(list==null || list.size()<2 || !(list.get(0) instanceof SVGPathSegMoveto))
      throw new IllegalArgumentException();

    final SVGPathSegMoveto m   = (SVGPathSegMoveto)list.get(0);
    SVGPathSegCurvetoCubic c;
    int i=1;
        final int size = list.size();

        shape.addPoint(ShapeFactory.createPoint(m.getX(), m.getY()));

    if(size>1 && list.get(1) instanceof SVGPathSegCurvetoCubic) {// We set the control point of the first point.
      c = (SVGPathSegCurvetoCubic)list.get(1);
      shape.getFirstCtrlPtAt(-1).setPoint(c.getX1(), c.getY1());
    }

    while(i<size && list.get(i) instanceof SVGPathSegCurvetoCubic) {
      c = (SVGPathSegCurvetoCubic)list.get(i);
      shape.addPoint(ShapeFactory.createPoint(c.getX(), c.getY()));
      shape.getFirstCtrlPtAt(-1).setPoint(c.getX2(), c.getY2());
      i++;
    }

    if(shape.getPtAt(-1).equals(shape.getPtAt(0), 0.00001)) {// We set the shape as closed
      shape.removePoint(-1);
View Full Code Here

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

    final int size       = shape.getNbPoints();
        int i;
        final SVGPathSegList path = new SVGPathSegList();

    path.add(new SVGPathSegMoveto(shape.getPtAt(0).getX(), shape.getPtAt(0).getY(), false));
    path.add(new SVGPathSegCurvetoCubic(shape.getPtAt(1).getX(), shape.getPtAt(1).getY(), shape.getFirstCtrlPtAt(0).getX(),
        shape.getFirstCtrlPtAt(0).getY(), shape.getFirstCtrlPtAt(1).getX(), shape.getFirstCtrlPtAt(1).getY(), false));

    for(i=2; i<size; i++)
      path.add(new SVGPathSegCurvetoCubic(shape.getPtAt(i).getX(), shape.getPtAt(i).getY(),
                        shape.getSecondCtrlPtAt(i-1).getX(), shape.getSecondCtrlPtAt(i-1).getY(),
                        shape.getFirstCtrlPtAt(i).getX(), shape.getFirstCtrlPtAt(i).getY(), false));

    if(shape.isClosed()) {
            final IPoint ctrl1b = shape.getFirstCtrlPtAt(0).centralSymmetry(shape.getPtAt(0));
            final IPoint ctrl2b = shape.getFirstCtrlPtAt(-1).centralSymmetry(shape.getPtAt(-1));

            path.add(new SVGPathSegCurvetoCubic(shape.getPtAt(0).getX(), shape.getPtAt(0).getY(), ctrl2b.getX(), ctrl2b.getY(), ctrl1b.getX(), ctrl1b.getY(), false));

            path.add(new SVGPathSegClosePath());
    }

    return path;
View Full Code Here

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

            midx = (curx + prevx) / 2.;
            midy = (cury + prevy) / 2.;
            final double x2 = (prevx + midx) / 2.;
            final double y2 = (prevy + midy) / 2.;

            path.add(new SVGPathSegCurvetoCubic(midx, midy, x1, y1, x2, y2, false));
        }

        if(i-interval+1<size) {
          final double x1 = (midx + curx) / 2.;
          final double y1 = (midy + cury) / 2.;
            prevx = curx;
            prevy = cury;
            curx = shape.getPtAt(-1).getX();
            cury = shape.getPtAt(-1).getY();
            midx = (curx + prevx) / 2.;
            midy = (cury + prevy) / 2.;
            final double x2 = (prevx + midx) / 2.;
            final double y2 = (prevy + midy) / 2.;

            path.add(new SVGPathSegCurvetoCubic(shape.getPtAt(-1).getX(), shape.getPtAt(-1).getY(), x1, y1, x2, y2, false));
        }
  }
View Full Code Here

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

    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);
      }
      pi.next();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.