public Element drawLine(List<mxPoint> pts,Map<String,Object> style){
  Element group=document.createElement("g");
  Element path=document.createElement("path");
  String strokeColor=mxUtils.getString(style,mxConstants.STYLE_STROKECOLOR);
  float tmpStroke=(float)(mxUtils.getFloat(style,mxConstants.STYLE_STROKEWIDTH,1));
  float strokeWidth=(float)(tmpStroke * scale);
  if (strokeColor != null && strokeWidth > 0) {
    Object marker=style.get(mxConstants.STYLE_STARTARROW);
    mxPoint pt=pts.get(1);
    mxPoint p0=pts.get(0);
    mxPoint offset=null;
    if (marker != null) {
      float size=(float)(mxUtils.getFloat(style,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_MARKERSIZE));
      offset=drawMarker(group,marker,pt,p0,size,tmpStroke,strokeColor);
    }
 else {
      double dx=pt.getX() - p0.getX();
      double dy=pt.getY() - p0.getY();
      double dist=Math.max(1,Math.sqrt(dx * dx + dy * dy));
      double nx=dx * strokeWidth / dist;
      double ny=dy * strokeWidth / dist;
      offset=new mxPoint(nx / 2,ny / 2);
    }
    if (offset != null) {
      p0=(mxPoint)p0.clone();
      p0.setX(p0.getX() + offset.getX());
      p0.setY(p0.getY() + offset.getY());
      offset=null;
    }
    marker=style.get(mxConstants.STYLE_ENDARROW);
    pt=pts.get(pts.size() - 2);
    mxPoint pe=pts.get(pts.size() - 1);
    if (marker != null) {
      float size=(float)(mxUtils.getFloat(style,mxConstants.STYLE_ENDSIZE,mxConstants.DEFAULT_MARKERSIZE));
      offset=drawMarker(group,marker,pt,pe,size,tmpStroke,strokeColor);
    }
 else {
      double dx=pt.getX() - p0.getX();
      double dy=pt.getY() - p0.getY();
      double dist=Math.max(1,Math.sqrt(dx * dx + dy * dy));
      double nx=dx * strokeWidth / dist;
      double ny=dy * strokeWidth / dist;
      offset=new mxPoint(nx / 2,ny / 2);
    }
    if (offset != null) {
      pe=(mxPoint)pe.clone();
      pe.setX(pe.getX() + offset.getX());
      pe.setY(pe.getY() + offset.getY());
      offset=null;
    }
    pt=p0;
    String d="M " + pt.getX() + " "+ pt.getY();
    for (int i=1; i < pts.size() - 1; i++) {
      pt=pts.get(i);
      d+=" L " + pt.getX() + " "+ pt.getY();
    }
    d+=" L " + pe.getX() + " "+ pe.getY();
    path.setAttribute("d",d);
    path.setAttribute("stroke",strokeColor);
    path.setAttribute("fill","none");
    path.setAttribute("stroke-width",String.valueOf(strokeWidth));
    group.appendChild(path);
    appendSvgElement(group);
  }
  return group;
}

public Element drawLine ( List < mxPoint > pts , Map < String , Object > style ) { Element group = document . createElement ( "g" ) ; Element path = document . createElement ( "path" ) ; String strokeColor = mxUtils . getString ( style , mxConstants . STYLE_STROKECOLOR ) ; float tmpStroke = ( float ) ( mxUtils . getFloat ( style , mxConstants . STYLE_STROKEWIDTH , 1 ) ) ; float strokeWidth = ( float ) ( tmpStroke * scale ) ; if ( strokeColor != null && strokeWidth > 0 ) { Object marker = style . get ( mxConstants . STYLE_STARTARROW ) ; mxPoint pt = pts . get ( 1 ) ; mxPoint p0 = pts . get ( 0 ) ; mxPoint offset = null ; if ( marker != null ) { float size = ( float ) ( mxUtils . getFloat ( style , mxConstants . STYLE_STARTSIZE , mxConstants . DEFAULT_MARKERSIZE ) ) ; offset = drawMarker ( group , marker , pt , p0 , size , tmpStroke , strokeColor ) ; } else { double dx = pt . getX ( ) - p0 . getX ( ) ; double dy = pt . getY ( ) - p0 . getY ( ) ; double dist = Math . max ( 1 , Math . sqrt ( dx * dx + dy * dy ) ) ; double nx = dx * strokeWidth / dist ; double ny = dy * strokeWidth / dist ; offset = new mxPoint ( nx / 2 , ny / 2 ) ; } if ( offset != null ) { p0 = ( mxPoint ) p0 . clone ( ) ; p0 . setX ( p0 . getX ( ) + offset . getX ( ) ) ; p0 . setY ( p0 . getY ( ) + offset . getY ( ) ) ; offset = null ; } marker = style . get ( mxConstants . STYLE_ENDARROW ) ; pt = pts . get ( pts . size ( ) - 2 ) ; mxPoint pe = pts . get ( pts . size ( ) - 1 ) ; if ( marker != null ) { float size = ( float ) ( mxUtils . getFloat ( style , mxConstants . STYLE_ENDSIZE , mxConstants . DEFAULT_MARKERSIZE ) ) ; offset = drawMarker ( group , marker , pt , pe , size , tmpStroke , strokeColor ) ; } else { double dx = pt . getX ( ) - p0 . getX ( ) ; double dy = pt . getY ( ) - p0 . getY ( ) ; double dist = Math . max ( 1 , Math . sqrt ( dx * dx + dy * dy ) ) ; double nx = dx * strokeWidth / dist ; double ny = dy * strokeWidth / dist ; offset = new mxPoint ( nx / 2 , ny / 2 ) ; } if ( offset != null ) { pe = ( mxPoint ) pe . clone ( ) ; pe . setX ( pe . getX ( ) + offset . getX ( ) ) ; pe . setY ( pe . getY ( ) + offset . getY ( ) ) ; offset = null ; } pt = p0 ; String d = "M " + pt . getX ( ) + " " + pt . getY ( ) ; for ( int i = 1 ; i < pts . size ( ) - 1 ; i ++ ) { pt = pts . get ( i ) ; d += " L " + pt . getX ( ) + " " + pt . getY ( ) ; } d += " L " + pe . getX ( ) + " " + pe . getY ( ) ; path . setAttribute ( "d" , d ) ; path . setAttribute ( "stroke" , strokeColor ) ; path . setAttribute ( "fill" , "none" ) ; path . setAttribute ( "stroke-width" , String . valueOf ( strokeWidth ) ) ; group . appendChild ( path ) ; appendSvgElement ( group ) ; } return group ; }
draws the given lines as segments between all points of the given list of mxpoints .
