angle = Math.toRadians(angle); double y = starty; double x = startx; double[] dashes = pattern.getPattern(); if (dashes.length > 0) { while (startx < b.getMaximumX() && angle < 90) { y = starty; x = startx;
buf.append('M'); buf.append(' '); buf.append(SVGUtils.formatNumberAttribute(x)); buf.append(' '); buf.append(SVGUtils.formatNumberAttribute(y)); buf.append(' ');
    protected String getSVGPath(Bounds b, HatchLinePattern pattern,            double dotlength) {        StringBuffer buf = new StringBuffer();        Point base = pattern.getBasePoint();        Point offset = pattern.getOffsetPoint(); //       b.debug();//        System.out.println("base:" + base);//        System.out.println("baseX:" + pattern.getBaseX() + "         baseY:"//                + pattern.getBaseY());//        System.out.println("offset:" + offset);//        System.out.println("offsetX:" + pattern.getOffsetX()//                + "         offsetY:" + pattern.getOffsetY());        double startx = 0;        if (base.getX() < b.getMinimumX()) {            startx = base.getX()                    + Math.abs(offset.getX())                    * Math.floor(Math.abs((b.getMinimumX() - base.getX())                            / offset.getX()));        } else {            startx = base.getX()                    - Math.abs(offset.getX())                    * Math.ceil(Math.abs((b.getMinimumX() - base.getX())                            / offset.getX()));        }        double starty = 0;        if (base.getY() < b.getMinimumY()) {            starty = base.getY()                    + Math.abs(offset.getY())                    * Math.floor(Math.abs((b.getMinimumY() - base.getY())                            / offset.getY()));        } else {            starty = base.getY()                    - Math.abs(offset.getY())                    * Math.ceil(Math.abs((b.getMinimumY() - base.getY())                            / offset.getY()));        }        double angle = pattern.getRotationAngle();//        System.out.println("angle:" + pattern.getRotationAngle() + " fix="//                + angle);//        System.out.println("startx:" + startx + "    starty:" + starty);        angle = Math.toRadians(angle);        double y = starty;        double x = startx;        double[] dashes = pattern.getPattern();        if (dashes.length > 0) {            while (startx < b.getMaximumX() && angle < 90) {                y = starty;                x = startx;                buf.append('M');                buf.append(' ');                buf.append(x);                buf.append(' ');                buf.append(y);                buf.append(' ');                while (y < b.getMaximumY() && x < b.getMaximumX()) {                    for (int i = 0; i < dashes.length; i++) {                        x += Math.cos(angle) * Math.abs(dashes[i]);                        y += Math.sin(angle) * Math.abs(dashes[i]);                        if (dashes[i] > 0) {                            buf.append('L');                            buf.append(' ');                            buf.append(x);                            buf.append(' ');                            buf.append(y);                            buf.append(' ');                        } else if (dashes[i] < 0) {                            buf.append('M');                            buf.append(' ');                            buf.append(x);                            buf.append(' ');                            buf.append(y);                            buf.append(' ');                        } else {                            // a dot                            buf.append('l');                            buf.append(' ');                            buf.append(dotlength);                            buf.append(' ');                            buf.append(dotlength);                            buf.append(' ');                        }                    }                }                startx += Math.abs(offset.getX());            }        } else {            // draw a solid line            while(startx<b.getMaximumX()){                buf.append('M');                buf.append(' ');                buf.append(startx);                buf.append(' ');                buf.append(starty);                buf.append(' ');                 x =1/Math.tan(angle)*b.getHeight()+startx;                 buf.append('L');                 buf.append(' ');                 buf.append(x);                 buf.append(' ');                 buf.append(b.getMaximumY());                 buf.append(' ');                 startx += Math.abs(offset.getX());            }        }        //System.out.println("pattern length:" + buf.length());        return buf.toString();    }