public virtual void removeColor(string strColorName) { VElement vElem = getChildElementVector(ElementName.COLOR, null, null, true, 0, false); if (vElem != null) { int size = vElem.Count; for (int i = 0; i < size; i++) { JDFColor c = (JDFColor)vElem[i]; if (strColorName.Equals(c.getActualColorName())) { c.deleteNode(); } } } }
/// /// <summary> * Get the Color Element with Name=name /// * </summary> /// * <param name="String"> /// * name the name of the color /// * </param> /// * <returns> JDFColor the color with the matching name, or null if no matching /// * element exists </returns> /// public virtual JDFColor getColorWithName(string colorName) { JDFColor color = null; if (colorName == null) { throw new JDFException("Bad colorname:" + colorName); } VElement v = getChildElementVector(ElementName.COLOR, null, null, true, 0, false); if (v != null) { int pos = -1; int siz = v.Count; for (int i = 0; i < siz; i++) { color = (JDFColor)v[i]; if (colorName.Equals(color.getName()) || colorName.Equals(color.getActualColorName())) { if (pos < 0) { pos = i; } else { throw new JDFException("Multiple colors exist for:" + colorName); } } } color = (JDFColor)(pos == -1 ? null : v[pos]); } return(color); }