Examples of SVGPathSegList


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

  /**
   * @return True if the path is composed of lines and has a 'close path' segment at the end.
   * @since 0.1
   */
  public boolean isLines() {
    final SVGPathSegList segList = getSegList();

    if(segList.size()<3 || !(segList.get(0) instanceof SVGPathSegMoveto))
      return false;

    boolean ok = true;
    int i;
        final int size;

        for(i=1, size=segList.size()-1; i<size && ok; i++)
      if(!(segList.get(i) instanceof SVGPathSegLineto))
        ok = false;

    return ok;
  }
View Full Code Here

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

  /**
   * @return True if the path is composed of lines and has a 'close path' segment at the end.
   * @since 0.1
   */
  public boolean isPolygon() {
    final SVGPathSegList segList = getSegList();

    if(segList.isEmpty() || !(segList.get(0) instanceof SVGPathSegMoveto))
      return false;

    boolean ok = true;
    int i;
        final int size;

        for(i=1, size=segList.size()-1; i<size && ok; i++)
      if(!(segList.get(i) instanceof SVGPathSegLineto))
        ok = false;

    if(!(segList.get(segList.size()-1) instanceof SVGPathSegClosePath))
      ok = false;

    return ok;
  }
View Full Code Here

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

   * @return the segList.
   * @since 0.1
   */
  public SVGPathSegList getSegList() {
    final String path       = getPathData();
    final SVGPathSegList segList = new SVGPathSegList();
    final SVGPathParser pp      = new SVGPathParser(path, segList);
   
    try{ pp.parse(); }
    catch(final ParseException e) { throw new IllegalArgumentException(e + " But : \"" + path + "\" found."); } //$NON-NLS-1$ //$NON-NLS-2$
   
View Full Code Here

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

  /**
   * @return The path of the hatchings of the shape.
   * @since 2.0.0
   */
  public SVGPathSegList getSVGHatchingsPath() {
    final SVGPathSegList path = new SVGPathSegList();

    if(!shape.hasHatchings())
      return path;

    final String hatchingStyle   = shape.getFillingStyle().getLatexToken();
View Full Code Here

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

    if(shape.getNbPoints()<2)
      return null;

    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.SVGPathSegList

  /**
   * @return The path of the shape.
   * @since 2.0.0
   */
  public SVGPathSegList getPath() {
    final SVGPathSegList path = new SVGPathSegList();

    switch(shape.getType()) {
      case CURVES:
        getPathCurves(path);
        break;
      case LINES:
        getPathLines(path);
        break;
    }

    if(!shape.isOpen())
      path.add(new SVGPathSegClosePath());

    return path;
  }
View Full Code Here

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

  @SuppressWarnings("nls")
  @Override
  public void parse() throws ParseException {
    final PathIterator pi     = shape.getPathIterator(null);
    final double[] coords       = new double[6];
    final SVGPathSegList list   = new SVGPathSegList();
    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);
      }
      pi.next();
    }

    element.setAttribute(SVGAttributes.SVG_D, list.toString());
    list.clear(); // Freeing the memory.
  }
View Full Code Here

Examples of org.w3c.dom.svg.SVGPathSegList

        SVGOMPathElement pe = (SVGOMPathElement) e;
        AWTPathProducer app = new AWTPathProducer();
        try {
            // 'd' attribute - required
            SVGPathSegList p = pe.getAnimatedPathSegList();
            app.setWindingRule(CSSUtilities.convertFillRule(e));
            SVGAnimatedPathDataSupport.handlePathSegList(p, app);
        } catch (LiveAttributeException ex) {
            throw new BridgeException(ctx, ex);
        } finally {
View Full Code Here

Examples of org.w3c.dom.svg.SVGPathSegList

        AWTPathProducer app = new AWTPathProducer();
        try {
            // 'd' attribute - required
            SVGOMAnimatedPathData _d = pe.getAnimatedPathData();
            _d.check();
            SVGPathSegList p = _d.getAnimatedPathSegList();
            app.setWindingRule(CSSUtilities.convertFillRule(e));
            SVGAnimatedPathDataSupport.handlePathSegList(p, app);
        } catch (LiveAttributeException ex) {
            throw new BridgeException(ctx, ex);
        } finally {
View Full Code Here

Examples of org.w3c.dom.svg.SVGPathSegList

    /**
     * Returns the base value of the attribute as an {@link AnimatableValue}.
     */
    public AnimatableValue getUnderlyingValue(AnimationTarget target) {
        SVGPathSegList psl = getPathSegList();
        PathArrayProducer pp = new PathArrayProducer();
        SVGAnimatedPathDataSupport.handlePathSegList(psl, pp);
        return new AnimatablePathDataValue(target, pp.getPathCommands(),
                                           pp.getPathParameters());
    }
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.