1 18 package org.apache.batik.svggen; 19 20 import java.util.HashMap ; 21 import java.util.LinkedList ; 22 import java.util.List ; 23 import java.util.Map ; 24 25 32 public class SVGStrokeDescriptor implements SVGDescriptor, SVGSyntax{ 33 private String strokeWidth; 34 private String capStyle; 35 private String joinStyle; 36 private String miterLimit; 37 private String dashArray; 38 private String dashOffset; 39 40 41 public SVGStrokeDescriptor(String strokeWidth, String capStyle, 42 String joinStyle, String miterLimit, 43 String dashArray, String dashOffset){ 44 if(strokeWidth == null || 45 capStyle == null || 46 joinStyle == null || 47 miterLimit == null || 48 dashArray == null || 49 dashOffset == null) 50 throw new SVGGraphics2DRuntimeException(ErrorConstants.ERR_STROKE_NULL); 51 52 this.strokeWidth = strokeWidth; 53 this.capStyle = capStyle; 54 this.joinStyle = joinStyle; 55 this.miterLimit = miterLimit; 56 this.dashArray = dashArray; 57 this.dashOffset = dashOffset; 58 } 59 60 String getStrokeWidth(){ return strokeWidth; } 61 String getCapStyle(){ return capStyle; } 62 String getJoinStyle(){ return joinStyle; } 63 String getMiterLimit(){ return miterLimit; } 64 String getDashArray(){ return dashArray; } 65 String getDashOffset(){ return dashOffset; } 66 67 public Map getAttributeMap(Map attrMap){ 68 if(attrMap == null) 69 attrMap = new HashMap (); 70 71 attrMap.put(SVG_STROKE_WIDTH_ATTRIBUTE, strokeWidth); 72 attrMap.put(SVG_STROKE_LINECAP_ATTRIBUTE, capStyle); 73 attrMap.put(SVG_STROKE_LINEJOIN_ATTRIBUTE, joinStyle); 74 attrMap.put(SVG_STROKE_MITERLIMIT_ATTRIBUTE, miterLimit); 75 attrMap.put(SVG_STROKE_DASHARRAY_ATTRIBUTE, dashArray); 76 attrMap.put(SVG_STROKE_DASHOFFSET_ATTRIBUTE, dashOffset); 77 78 return attrMap; 79 } 80 81 public List getDefinitionSet(List defSet){ 82 if(defSet == null) 83 defSet = new LinkedList (); 84 85 return defSet; 86 } 87 } 88 | Popular Tags |