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

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


    final double width       = arrow.getTBarSizeDim() + arrow.getTBarSizeNum()*lineWidth;
    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);
View Full Code Here


    final boolean isInverted    = arrow.isInverted();//FIXME shape.PPC
    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.;
    }
View Full Code Here

      length *= -1.;
      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());

View Full Code Here

      lgth *= -1.;
      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);
View Full Code Here

      inset *= -1.;
      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());

View Full Code Here

        SVGElement elt;

        root.setAttribute(LNamespace.LATEXDRAW_NAMESPACE+':'+LNamespace.XML_TYPE, LNamespace.XML_TYPE_ARC);
        root.setAttribute(SVGAttributes.SVG_ID, getSVGID());

        path.add(new SVGPathSegMoveto(start.getX(), start.getY(), false));
        path.add(new SVGPathSegArc(end.getX(), end.getY(), radius, radius, 0, largeArcFlag, false, false));

        if(type==ArcStyle.CHORD)
          path.add(new SVGPathSegClosePath());
        else
View Full Code Here

    final double val = hatchingWidth+hatchingSep;

    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

   */
  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());
    }
View Full Code Here

    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(),
View Full Code Here

    double midy = (cury + prevy) / 2.;
    int i;
    final int size = shape.getNbPoints();
    final int interval = shape.getInterval();

      path.add(new SVGPathSegMoveto(curx, cury, false));

        if(size>interval) {
           prevx = curx;
           prevy = cury;
           curx = shape.getPtAt(interval).getX();
View Full Code Here

TOP

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

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.