List of usage examples for java.awt BasicStroke CAP_ROUND
int CAP_ROUND
To view the source code for java.awt BasicStroke CAP_ROUND.
Click Source Link
From source file:org.jfree.eastwood.ChartEngine.java
/** * Parses a string containing a sequence of line style specifications, * returning an array of <code>Stroke</code> objects. * * @param text the line styles./*from w w w. ja va2 s .c o m*/ * * @return The strokes representing the line styles. */ private static Stroke[] parseLineStyles(String text) { if (text == null) { throw new IllegalArgumentException("Null 'text' argument (in parseStrokes(String))."); } String[] codes = breakString(text, '|'); Stroke[] result = new BasicStroke[codes.length]; for (int i = 0; i < codes.length; i++) { float width = 1.0f; float lineRun = 1.0f; float gapRun = 0.0f; int pos = codes[i].indexOf(','); if (pos == -1) { width = Float.parseFloat(codes[i]); } else { String widthStr = codes[i].substring(0, pos); width = Float.parseFloat(widthStr); String remaining = codes[i].substring(pos + 1); pos = remaining.indexOf(','); if (pos == -1) { lineRun = Float.parseFloat(remaining); gapRun = lineRun; } else { String s1 = remaining.substring(0, pos); lineRun = Float.parseFloat(s1); String s2 = remaining.substring(pos + 1); gapRun = Float.parseFloat(s2); } } if (gapRun <= 0.0f) { result[i] = new BasicStroke(width, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); } else { result[i] = new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 5.0f, new float[] { lineRun, gapRun }, 0.0f); } } return result; }
From source file:com.igormaznitsa.mindmap.swing.panel.MindMapPanel.java
private static void drawJumps(final Graphics2D gfx, final MindMap map, final MindMapPanelConfig cfg) { final List<Topic> allTopicsWithJumps = map.findAllTopicsForExtraType(Extra.ExtraType.TOPIC); final float scaledSize = cfg.safeScaleFloatValue(cfg.getJumpLinkWidth(), 0.1f); final Stroke lineStroke = new BasicStroke(scaledSize, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL, 0, new float[] { scaledSize, scaledSize * 3.0f }, 0); final Stroke arrowStroke = new BasicStroke(cfg.safeScaleFloatValue(cfg.getJumpLinkWidth() * 1.0f, 0.3f)); gfx.setColor(cfg.getJumpLinkColor()); final float arrowSize = cfg.safeScaleFloatValue(10.0f * cfg.getJumpLinkWidth(), 0.2f); for (Topic src : allTopicsWithJumps) { final ExtraTopic extra = (ExtraTopic) src.getExtras().get(Extra.ExtraType.TOPIC); src = MindMapUtils.isHidden(src) ? MindMapUtils.findFirstVisibleAncestor(src) : src; final AbstractElement srcElement = (AbstractElement) src.getPayload(); if (extra != null) { Topic dst = map.findTopicForLink(extra); if (dst != null) { if (MindMapUtils.isHidden(dst)) { dst = MindMapUtils.findFirstVisibleAncestor(dst); if (dst == src) { dst = null;/*from w w w.j a va2 s .com*/ } } if (dst != null) { final AbstractElement dstElement = (AbstractElement) dst.getPayload(); if (!MindMapUtils.isHidden(dst)) { final Rectangle2D srcRect = srcElement.getBounds(); final Rectangle2D dstRect = dstElement.getBounds(); drawArrowToDestination(gfx, srcRect, dstRect, lineStroke, arrowStroke, arrowSize); } } } } } }
From source file:jhplot.HChart.java
/** * //from w w w .j a v a 2 s. c om * @param type * =0 - solid, 1-dashed, 2-dashed-dotted,3 dotted * @param width * width * @return */ private Stroke getStrokes(int type, float width, float dash) { float[][] pattern = { { dash }, { dash, dash }, { dash, dash, dash * 0.3f, dash }, { dash * 0.3f, dash * 2f } }; if (type == 0) return new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f); // solid line if (type == 1) return new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, pattern[1], 0.0f); // dashed // line if (type == 2) return new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, pattern[2], 0.0f); // dash-dotted // line if (type == 3) return new BasicStroke(width, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 10.0f, pattern[3], 0.0f); // dotted // line return new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f); }
From source file:org.jfree.eastwood.ChartEngine.java
/** * Process a string which specifies grid line steps and line segment sizes. * * @param spec the grid lines specification. * @param chart the chart./*from ww w .j a v a2 s .c o m*/ */ private static void processGridLinesSpec(String spec, JFreeChart chart) { String[] parts = breakString(spec, ','); double xAxisStepSize = 0.0; double yAxisStepSize = 0.0; float lineSegLength = 3f; float blankSegLength = 6f; if (parts.length > 0) { try { xAxisStepSize = Double.parseDouble(parts[0]); } catch (NumberFormatException e) { } } if (parts.length > 1) { try { yAxisStepSize = Double.parseDouble(parts[1]); } catch (NumberFormatException e) { } } if (parts.length > 2) { try { lineSegLength = Float.parseFloat(parts[2]) * 0.85f; } catch (NumberFormatException e) { } } if (parts.length > 3) { try { blankSegLength = Float.parseFloat(parts[3]) * 0.85f; } catch (NumberFormatException e) { } } if (lineSegLength == 0 && blankSegLength == 0) { lineSegLength = 1f; } if (lineSegLength > 0) { Stroke stroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 10f, new float[] { lineSegLength, blankSegLength }, 0); Plot p = chart.getPlot(); if (p instanceof CategoryPlot) { GCategoryPlot plot = (GCategoryPlot) p; plot.setDomainGridlinesVisible(true); plot.setRangeGridlinesVisible(true); plot.setDomainGridlineStroke(stroke); plot.setRangeGridlineStroke(stroke); plot.setXAxisStepSize(xAxisStepSize / 100.0); plot.setYAxisStepSize(yAxisStepSize / 100.0); } else if (p instanceof XYPlot) { GXYPlot plot = (GXYPlot) p; plot.setDomainGridlinesVisible(true); plot.setRangeGridlinesVisible(true); plot.setDomainGridlineStroke(stroke); plot.setRangeGridlineStroke(stroke); plot.setXAxisStepSize(xAxisStepSize / 100.0); plot.setYAxisStepSize(yAxisStepSize / 100.0); } } }
From source file:org.pentaho.platform.uifoundation.chart.JFreeChartEngine.java
public static Stroke getLineStyleStroke(final String lineStyle, float lineWidth) { BasicStroke stroke = null;//from ww w . j a v a 2s . c o m float[] strokeSteps = null; // Negative linewidths not allowed; reset to default; if (lineWidth < 0) { lineWidth = 1.0f; } if (lineStyle != null) { if (lineStyle.equals(ChartDefinition.LINE_STYLE_DASH_STR)) { strokeSteps = new float[] { 6.0f, 6.0f }; } else if (lineStyle.equals(ChartDefinition.LINE_STYLE_DOT_STR)) { strokeSteps = new float[] { 2.0f, 6.0f }; } else if (lineStyle.equals(ChartDefinition.LINE_STYLE_DASHDOT_STR)) { strokeSteps = new float[] { 10.0f, 6.0f, 2.0f, 6.0f }; } else if (lineStyle.equals(ChartDefinition.LINE_STYLE_DASHDOTDOT_STR)) { strokeSteps = new float[] { 10.0f, 6.0f, 2.0f, 6.0f, 2.0f, 6.0f }; } } if (strokeSteps != null) { stroke = new BasicStroke(lineWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, strokeSteps, 0.0f); } else { stroke = new BasicStroke(lineWidth); } return stroke; }
From source file:org.apache.fop.render.java2d.Java2DBorderPainter.java
/** {@inheritDoc} */ protected void drawBorderLine( // CSOK: ParameterNumber int x1, int y1, int x2, int y2, boolean horz, boolean startOrBefore, int style, Color color) { float w = x2 - x1; float h = y2 - y1; if ((w < 0) || (h < 0)) { log.error("Negative extent received. Border won't be painted."); return;// w w w . ja v a 2 s. c o m } switch (style) { case Constants.EN_DASHED: getG2D().setColor(color); if (horz) { float unit = Math.abs(2 * h); int rep = (int) (w / unit); if (rep % 2 == 0) { rep++; } unit = w / rep; float ym = y1 + (h / 2); BasicStroke s = new BasicStroke(h, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, new float[] { unit }, 0); getG2D().setStroke(s); getG2D().draw(new Line2D.Float(x1, ym, x2, ym)); } else { float unit = Math.abs(2 * w); int rep = (int) (h / unit); if (rep % 2 == 0) { rep++; } unit = h / rep; float xm = x1 + (w / 2); BasicStroke s = new BasicStroke(w, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, new float[] { unit }, 0); getG2D().setStroke(s); getG2D().draw(new Line2D.Float(xm, y1, xm, y2)); } break; case Constants.EN_DOTTED: getG2D().setColor(color); if (horz) { float unit = Math.abs(2 * h); int rep = (int) (w / unit); if (rep % 2 == 0) { rep++; } unit = w / rep; float ym = y1 + (h / 2); BasicStroke s = new BasicStroke(h, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 10.0f, new float[] { 0, unit }, 0); getG2D().setStroke(s); getG2D().draw(new Line2D.Float(x1, ym, x2, ym)); } else { float unit = Math.abs(2 * w); int rep = (int) (h / unit); if (rep % 2 == 0) { rep++; } unit = h / rep; float xm = x1 + (w / 2); BasicStroke s = new BasicStroke(w, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 10.0f, new float[] { 0, unit }, 0); getG2D().setStroke(s); getG2D().draw(new Line2D.Float(xm, y1, xm, y2)); } break; case Constants.EN_DOUBLE: getG2D().setColor(color); if (horz) { float h3 = h / 3; float ym1 = y1 + (h3 / 2); float ym2 = ym1 + h3 + h3; BasicStroke s = new BasicStroke(h3); getG2D().setStroke(s); getG2D().draw(new Line2D.Float(x1, ym1, x2, ym1)); getG2D().draw(new Line2D.Float(x1, ym2, x2, ym2)); } else { float w3 = w / 3; float xm1 = x1 + (w3 / 2); float xm2 = xm1 + w3 + w3; BasicStroke s = new BasicStroke(w3); getG2D().setStroke(s); getG2D().draw(new Line2D.Float(xm1, y1, xm1, y2)); getG2D().draw(new Line2D.Float(xm2, y1, xm2, y2)); } break; case Constants.EN_GROOVE: case Constants.EN_RIDGE: float colFactor = (style == Constants.EN_GROOVE ? 0.4f : -0.4f); if (horz) { Color uppercol = ColorUtil.lightenColor(color, -colFactor); Color lowercol = ColorUtil.lightenColor(color, colFactor); float h3 = h / 3; float ym1 = y1 + (h3 / 2); getG2D().setStroke(new BasicStroke(h3)); getG2D().setColor(uppercol); getG2D().draw(new Line2D.Float(x1, ym1, x2, ym1)); getG2D().setColor(color); getG2D().draw(new Line2D.Float(x1, ym1 + h3, x2, ym1 + h3)); getG2D().setColor(lowercol); getG2D().draw(new Line2D.Float(x1, ym1 + h3 + h3, x2, ym1 + h3 + h3)); } else { Color leftcol = ColorUtil.lightenColor(color, -colFactor); Color rightcol = ColorUtil.lightenColor(color, colFactor); float w3 = w / 3; float xm1 = x1 + (w3 / 2); getG2D().setStroke(new BasicStroke(w3)); getG2D().setColor(leftcol); getG2D().draw(new Line2D.Float(xm1, y1, xm1, y2)); getG2D().setColor(color); getG2D().draw(new Line2D.Float(xm1 + w3, y1, xm1 + w3, y2)); getG2D().setColor(rightcol); getG2D().draw(new Line2D.Float(xm1 + w3 + w3, y1, xm1 + w3 + w3, y2)); } break; case Constants.EN_INSET: case Constants.EN_OUTSET: colFactor = (style == Constants.EN_OUTSET ? 0.4f : -0.4f); if (horz) { color = ColorUtil.lightenColor(color, (startOrBefore ? 1 : -1) * colFactor); getG2D().setStroke(new BasicStroke(h)); float ym1 = y1 + (h / 2); getG2D().setColor(color); getG2D().draw(new Line2D.Float(x1, ym1, x2, ym1)); } else { color = ColorUtil.lightenColor(color, (startOrBefore ? 1 : -1) * colFactor); float xm1 = x1 + (w / 2); getG2D().setStroke(new BasicStroke(w)); getG2D().setColor(color); getG2D().draw(new Line2D.Float(xm1, y1, xm1, y2)); } break; case Constants.EN_HIDDEN: break; default: getG2D().setColor(color); if (horz) { float ym = y1 + (h / 2); getG2D().setStroke(new BasicStroke(h)); getG2D().draw(new Line2D.Float(x1, ym, x2, ym)); } else { float xm = x1 + (w / 2); getG2D().setStroke(new BasicStroke(w)); getG2D().draw(new Line2D.Float(xm, y1, xm, y2)); } } }
From source file:org.apache.fop.render.java2d.Java2DGraphicsPainter.java
public void drawBorderLine(int x1, int y1, int x2, int y2, boolean horz, boolean startOrBefore, int style, Color color) throws IOException { float w = x2 - x1; float h = y2 - y1; if ((w < 0) || (h < 0)) { log.error("Negative extent received. Border won't be painted."); return;//from ww w . j a va2 s . c o m } switch (style) { case Constants.EN_DASHED: getG2D().setColor(color); if (horz) { float unit = Math.abs(2 * h); int rep = (int) (w / unit); if (rep % 2 == 0) { rep++; } unit = w / rep; float ym = y1 + (h / 2); BasicStroke s = new BasicStroke(h, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, new float[] { unit }, 0); getG2D().setStroke(s); getG2D().draw(new Line2D.Float(x1, ym, x2, ym)); } else { float unit = Math.abs(2 * w); int rep = (int) (h / unit); if (rep % 2 == 0) { rep++; } unit = h / rep; float xm = x1 + (w / 2); BasicStroke s = new BasicStroke(w, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, new float[] { unit }, 0); getG2D().setStroke(s); getG2D().draw(new Line2D.Float(xm, y1, xm, y2)); } break; case Constants.EN_DOTTED: getG2D().setColor(color); if (horz) { float unit = Math.abs(2 * h); int rep = (int) (w / unit); if (rep % 2 == 0) { rep++; } unit = w / rep; float ym = y1 + (h / 2); BasicStroke s = new BasicStroke(h, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 10.0f, new float[] { 0, unit }, 0); getG2D().setStroke(s); getG2D().draw(new Line2D.Float(x1, ym, x2, ym)); } else { float unit = Math.abs(2 * w); int rep = (int) (h / unit); if (rep % 2 == 0) { rep++; } unit = h / rep; float xm = x1 + (w / 2); BasicStroke s = new BasicStroke(w, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 10.0f, new float[] { 0, unit }, 0); getG2D().setStroke(s); getG2D().draw(new Line2D.Float(xm, y1, xm, y2)); } break; case Constants.EN_DOUBLE: getG2D().setColor(color); if (horz) { float h3 = h / 3; float ym1 = y1 + (h3 / 2); float ym2 = ym1 + h3 + h3; BasicStroke s = new BasicStroke(h3); getG2D().setStroke(s); getG2D().draw(new Line2D.Float(x1, ym1, x2, ym1)); getG2D().draw(new Line2D.Float(x1, ym2, x2, ym2)); } else { float w3 = w / 3; float xm1 = x1 + (w3 / 2); float xm2 = xm1 + w3 + w3; BasicStroke s = new BasicStroke(w3); getG2D().setStroke(s); getG2D().draw(new Line2D.Float(xm1, y1, xm1, y2)); getG2D().draw(new Line2D.Float(xm2, y1, xm2, y2)); } break; case Constants.EN_GROOVE: case Constants.EN_RIDGE: float colFactor = (style == Constants.EN_GROOVE ? 0.4f : -0.4f); if (horz) { Color uppercol = ColorUtil.lightenColor(color, -colFactor); Color lowercol = ColorUtil.lightenColor(color, colFactor); float h3 = h / 3; float ym1 = y1 + (h3 / 2); getG2D().setStroke(new BasicStroke(h3)); getG2D().setColor(uppercol); getG2D().draw(new Line2D.Float(x1, ym1, x2, ym1)); getG2D().setColor(color); getG2D().draw(new Line2D.Float(x1, ym1 + h3, x2, ym1 + h3)); getG2D().setColor(lowercol); getG2D().draw(new Line2D.Float(x1, ym1 + h3 + h3, x2, ym1 + h3 + h3)); } else { Color leftcol = ColorUtil.lightenColor(color, -colFactor); Color rightcol = ColorUtil.lightenColor(color, colFactor); float w3 = w / 3; float xm1 = x1 + (w3 / 2); getG2D().setStroke(new BasicStroke(w3)); getG2D().setColor(leftcol); getG2D().draw(new Line2D.Float(xm1, y1, xm1, y2)); getG2D().setColor(color); getG2D().draw(new Line2D.Float(xm1 + w3, y1, xm1 + w3, y2)); getG2D().setColor(rightcol); getG2D().draw(new Line2D.Float(xm1 + w3 + w3, y1, xm1 + w3 + w3, y2)); } break; case Constants.EN_INSET: case Constants.EN_OUTSET: colFactor = (style == Constants.EN_OUTSET ? 0.4f : -0.4f); if (horz) { color = ColorUtil.lightenColor(color, (startOrBefore ? 1 : -1) * colFactor); getG2D().setStroke(new BasicStroke(h)); float ym1 = y1 + (h / 2); getG2D().setColor(color); getG2D().draw(new Line2D.Float(x1, ym1, x2, ym1)); } else { color = ColorUtil.lightenColor(color, (startOrBefore ? 1 : -1) * colFactor); float xm1 = x1 + (w / 2); getG2D().setStroke(new BasicStroke(w)); getG2D().setColor(color); getG2D().draw(new Line2D.Float(xm1, y1, xm1, y2)); } break; case Constants.EN_HIDDEN: break; default: getG2D().setColor(color); if (horz) { float ym = y1 + (h / 2); getG2D().setStroke(new BasicStroke(h)); getG2D().draw(new Line2D.Float(x1, ym, x2, ym)); } else { float xm = x1 + (w / 2); getG2D().setStroke(new BasicStroke(w)); getG2D().draw(new Line2D.Float(xm, y1, xm, y2)); } } }
From source file:org.drools.semantics.builder.model.GraphModelImpl.java
public void display() { KKLayout<Concept, Relation> layout = new KKLayout<Concept, Relation>(cgraph); layout.setExchangeVertices(true);/* w w w . j ava 2s . c om*/ layout.setAdjustForGravity(false); layout.setDisconnectedDistanceMultiplier(2.0); layout.setLengthFactor(5.0); layout.setSize(new Dimension(1800, 1000)); VisualizationViewer<Concept, Relation> vv = new VisualizationViewer<Concept, Relation>(layout); vv.setPreferredSize(new Dimension(1850, 1050)); //Sets the viewing area size final Stroke sccStroke = new BasicStroke(5.0f); final Stroke edgeStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL, 10.0f, null, 0.0f); Transformer<Relation, Stroke> edgeStrokeTransformer = new Transformer<Relation, Stroke>() { public Stroke transform(Relation rel) { return rel.getProperty().contains("subConceptOf") ? sccStroke : edgeStroke; } }; Transformer<Concept, Paint> vertexPaint = new Transformer<Concept, Paint>() { public Paint transform(Concept c) { return c.getIri().contains("XMLSchema") ? Color.GREEN : Color.BLUE; } }; vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint); vv.getRenderContext().setEdgeStrokeTransformer(edgeStrokeTransformer); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller()); vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller()); DefaultModalGraphMouse gm = new DefaultModalGraphMouse(); gm.setMode(ModalGraphMouse.Mode.TRANSFORMING); vv.setGraphMouse(gm); // EditingModalGraphMouse gm = // new EditingModalGraphMouse(vv.getRenderContext(), // cgraph.get, cgraph.edgeFactory); vv.addKeyListener(gm.getModeKeyListener()); JFrame frame = new JFrame("Simple Graph View"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(vv); frame.pack(); frame.setVisible(true); }
From source file:org.eclipse.birt.chart.device.g2d.G2dRendererBase.java
/** * Reusable 'strokes' for rendering lines may be obtained from here * // www . j ava 2 s .c om * @param ls * @return stroke */ public final Stroke getCachedStroke(LineAttributes lia) { if (lia == null) return null; Stroke s = _htLineStyles.get(lia); if (s == null) { BasicStroke bs = null; int thickness = lia.getThickness(); if (thickness == 0) { // Thickness can be zero, but dashed pattern can not be. thickness = 1; } if (lia.getStyle().getValue() == LineStyle.DASHED) { float[] faStyle = new float[] { 6 * thickness, 4 * thickness }; bs = new BasicStroke(lia.getThickness(), BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, faStyle, 0); } else if (lia.getStyle().getValue() == LineStyle.DOTTED) { float[] faStyle = new float[] { thickness, 4 * thickness }; bs = new BasicStroke(lia.getThickness(), BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, faStyle, 0); } else if (lia.getStyle().getValue() == LineStyle.DASH_DOTTED) { float[] faStyle = new float[] { 6 * thickness, 4 * thickness, thickness, 4 * thickness }; bs = new BasicStroke(lia.getThickness(), BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, faStyle, 0); } else if (lia.getStyle().getValue() == LineStyle.SOLID) { bs = new BasicStroke(lia.getThickness(), BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND); } if (bs != null) { _htLineStyles.put(lia, bs); } return bs; } return s; }
From source file:org.eclipse.birt.chart.device.svg.SVGGraphics2D.java
/** * Adds stroke color and style information to the element passed in. * //from w ww . j ava 2 s. c o m * @param currentElement * the element to add style information to. * @param isClipped * boolean that determines whether to defer the clipping of the * element */ protected void setStrokeStyle(Element currentElement, boolean deferClipped) { Element element = currentElement; if (deferStrokColor != null) { // Need to get the parent element. element = deferStrokColor; } String style = element.getAttribute("style"); //$NON-NLS-1$ if (style == null) style = ""; //$NON-NLS-1$ if (color != null) { style += "stroke:" + serializeToString(color) + ";"; //$NON-NLS-1$ //$NON-NLS-2$ } if ((stroke != null) && (stroke instanceof BasicStroke)) { BasicStroke bs = (BasicStroke) stroke; if (bs.getLineWidth() > 0) style += "stroke-width:" + bs.getLineWidth() + ";"; //$NON-NLS-1$ //$NON-NLS-2$ if (bs.getDashArray() != null) { StringBuffer dashArrayStr = new StringBuffer(); for (int x = 0; x < bs.getDashArray().length; x++) { dashArrayStr.append(" ").append(bs.getDashArray()[x]); //$NON-NLS-1$ } if (!(dashArrayStr.toString().equals(""))) //$NON-NLS-1$ style += "stroke-dasharray:" + dashArrayStr + ";"; //$NON-NLS-1$ //$NON-NLS-2$ } style += "stroke-miterlimit:" + bs.getMiterLimit() + ";"; //$NON-NLS-1$ //$NON-NLS-2$ switch (bs.getLineJoin()) { case BasicStroke.JOIN_BEVEL: style += "stroke-linejoin:bevel;"; //$NON-NLS-1$ break; case BasicStroke.JOIN_ROUND: style += "stroke-linejoin:round;"; //$NON-NLS-1$ break; } switch (bs.getEndCap()) { case BasicStroke.CAP_ROUND: style += "stroke-linecap:round;"; //$NON-NLS-1$ break; case BasicStroke.CAP_SQUARE: style += "stroke-linecap:square;"; //$NON-NLS-1$ break; } } element.setAttribute("style", style); //$NON-NLS-1$ if (styleClass != null) element.setAttribute("class", styleClass); //$NON-NLS-1$ if (id != null) element.setAttribute("id", id); //$NON-NLS-1$ if ((clip != null) && (!deferClipped)) element.setAttribute("clip-path", "url(#clip" + clip.hashCode() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ }