private void ValidateModifiers(ArrowShapeModifier value) { bool hasLeftClipModifier = ((value & ArrowShapeModifier.LeftClip) == ArrowShapeModifier.LeftClip); bool hasRightClipModifier = ((value & ArrowShapeModifier.RightClip) == ArrowShapeModifier.RightClip); if ((!allowLRModifier) && (hasLeftClipModifier || hasRightClipModifier)) { throw new ArgumentException("The left clip or right clip modifier is not valid for the arrow shape type " + Value + "."); } if (hasLeftClipModifier && hasRightClipModifier) { throw new ArgumentException("Only the left or right of the arrow shape can be clipped - the combination of the two is invalid."); } bool hasOModifier = ((value & ArrowShapeModifier.Open) == ArrowShapeModifier.Open); if (!allowOModifier && hasOModifier) { throw new ArgumentException("The open modifier is not valid for the arrow shape type " + Value + "."); } }
/// <summary> /// Modifies the specified modifications. /// </summary> /// <param name="modifications">The modifications.</param> /// <returns></returns> public ArrowShape Modify(ArrowShapeModifier modifications) { ValidateModifiers(modifications); var shape = (ArrowShape) Clone(); shape.modifiers = modifications; return shape; }