예제 #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()
예제 #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()
예제 #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()
예제 #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()
예제 #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()