/// <summary> /// Derived classes must override this method and return a copy of itself. /// </summary> /// <param name="clone">The new clone to add additional properties values.</param> /// <returns> /// A copy of the annotation. /// </returns> /// <remarks> /// This method is called from Clone to allow additional properties to be set. The WpfAnnotationUI properties of the clone will be filled before this method is called. /// </remarks> protected override WpfAnnotationUI CloneOverride(WpfAnnotationUI clone) { TriangleAnnotation ann = clone as TriangleAnnotation; if (ann == null) { return(null); } AnnotationBrush fill = this.Fill; ann.Fill = fill == null ? null : fill.Clone(); AnnotationPen outline = this.Outline; ann.Outline = outline == null ? null : outline.Clone(); if (this.Points.Count > 0) { ann.Points.AddRange(this.Points.ToArray()); } ann.GripMode = this.GripMode; return(ann); }
/// <summary> /// This method is used to serialize the annotation. /// </summary> /// <returns> /// An AnnotationData object with the current annotation settings. /// </returns> /// <remarks>This is used when serializing the annotation to XMP.</remarks> protected override AnnotationData CreateDataSnapshotOverride() { Point[] points = this.Points.ToArray(); AnnotationBrush fill = this.Fill; AnnotationPen outline = this.Outline; if (fill != null) { fill = fill.Clone(); } if (outline != null) { outline = outline.Clone(); } return(new TriangleData(points, fill, outline)); }
/// <summary> /// Clones this instance. /// </summary> /// <returns>Clone of this object.</returns> public override object Clone() { TriangleData data = new TriangleData(); CloneBaseData(data); if (_fill != null) { data._fill = _fill.Clone(); } if (_outline != null) { data._outline = _outline.Clone(); } return(data); }