Esempio n. 1
0
 /** Sets the higlight of an array of elements. Assumes that hilight is not set to 'none' */
 public static void makeHilight(
     SVGElement[] elements, MapMetadata mmd, String mmdOrderElementName) {
   String cssStyle = mmd.getOrderParamString(mmdOrderElementName, MapMetadata.ATT_HILIGHT_CLASS);
   for (int i = 0; i < elements.length; i++) {
     elements[i].setAttributeNS(null, SVGConstants.SVG_CLASS_ATTRIBUTE, cssStyle);
   }
 } // makeHilight()
Esempio n. 2
0
 /**
  * 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()
Esempio n. 3
0
  /**
   * Applies the appropriate Stroke color and Filter (if any) to an array of elements
   *
   * <p>mmdOrderElementName = e.g., MapMetadata.EL_HOLD
   */
  public static void makeStyled(
      SVGElement[] elements, MapMetadata mmd, String mmdOrderElementName, Power 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(')');
      filter = sb.toString();
    } else {
      filter = null;
    }

    String powerColor = mmd.getPowerColor(power);

    for (int i = 0; i < elements.length; i++) {
      elements[i].setAttributeNS(null, CSSConstants.CSS_STROKE_PROPERTY, powerColor);
      if (filter != null) {
        elements[i].setAttributeNS(null, SVGConstants.SVG_FILTER_ATTRIBUTE, filter);
      }
    }
  } // makeStyled()
Esempio n. 4
0
 /** 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()
Esempio n. 5
0
 /** 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()