protected Stroke getStroke(VPFSymbolAttributes attr) { BasicStroke stroke; float lineWidth = (float) attr.getOutlineWidth() + .5f; // Exagerate a bit line width if (attr.getOutlineStippleFactor() > 0) { // Dashed line - determine dash array from 16 bit stipple pattern ArrayList<Float> dashList = new ArrayList<Float>(); short pattern = attr.getOutlineStipplePattern(); int length = 0; boolean dash = true; for (int i = 0; i < 16; i++) { boolean dashBit = ((pattern << i) & 0x8000) > 0; if (dashBit != dash) { dashList.add((float) length); length = attr.getOutlineStippleFactor(); dash = dashBit; } else length += attr.getOutlineStippleFactor(); } dashList.add((float) length); float[] dashArray = new float[dashList.size()]; for (int i = 0; i < dashList.size(); i++) { dashArray[i] = dashList.get(i); } stroke = new BasicStroke( lineWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 10f, dashArray, 0f); } else { // Plain line stroke = new BasicStroke(lineWidth); } return stroke; }