/** * Applies the appropriate Stroke color and Filter (if any) to an element. * * <p>mmdOrderElementName = e.g., MapMetadata.EL_HOLD */ public static void makeStyled( SVGElement element, MapMetadata mmd, String mmdOrderElementName, Power power) { element.setAttributeNS(null, CSSConstants.CSS_STROKE_PROPERTY, mmd.getPowerColor(power)); String filter = mmd.getOrderParamString(mmdOrderElementName, MapMetadata.ATT_FILTERID); if (filter.length() > 0) { StringBuffer sb = new StringBuffer(filter.length() + 6); sb.append("url(#"); sb.append(filter); sb.append(')'); element.setAttributeNS(null, SVGConstants.SVG_FILTER_ATTRIBUTE, sb.toString()); } } // makeStyled()
/** Adds the given end-Marker to an element (usually a Line) */ public static void addMarker(SVGElement element, MapMetadata mmd, String mmdOrderElementName) { element.setAttributeNS( null, CSSConstants.CSS_MARKER_END_PROPERTY, "url(#" + mmd.getOrderParamString(mmdOrderElementName, MapMetadata.ATT_MARKERID) + ')'); } // addMarker()
/** Sets the higlight of an element. Assumes that hilight is not set to 'none' */ public static void makeHilight(SVGElement element, MapMetadata mmd, String mmdOrderElementName) { String cssStyle = mmd.getOrderParamString(mmdOrderElementName, MapMetadata.ATT_HILIGHT_CLASS); element.setAttributeNS(null, SVGConstants.SVG_CLASS_ATTRIBUTE, cssStyle); } // makeHilight()