/// <summary> /// Return a copied object for an object (first pass only). /// </summary> /// <param name="obj"></param> /// <returns></returns> /// <remarks> /// <para> /// First this method looks up <paramref name="obj" /> in its mapping /// table--if it finds an object, it returns it, because presumably it /// has already been copied. /// Otherwise it calls <see cref="T:Northwoods.Go.GoObject" />.<see cref="M:Northwoods.Go.GoObject.CopyObject(Northwoods.Go.GoCopyDictionary)" /> in order to /// make a copy of <paramref name="obj" />. /// If <paramref name="obj" /> is null, this returns null. /// </para> /// <para> /// The primary use of this method is to be called by <see cref="T:Northwoods.Go.GoDocument" />'s /// <c>GoDocument.CopyFromCollection(IGoCollection, bool, bool, SizeF, GoCopyDictionary)</c> method. /// This is also typically called within a <see cref="M:Northwoods.Go.GoObject.CopyObject(Northwoods.Go.GoCopyDictionary)" /> /// override method to make a copy of a referenced object that is not /// a child of the copied object. /// </para> /// <para> /// If you don't call this in the context of a /// <c>GoDocument.CopyFromCollection(IGoCollection, bool, bool, SizeF, GoCopyDictionary)</c> method, /// be sure to call <see cref="M:Northwoods.Go.GoCopyDictionary.FinishDelayedCopies" /> afterwards to perform the /// second copying pass, which resolves references and can do other copying work /// as implemented by <see cref="T:Northwoods.Go.GoObject" />.<see cref="M:Northwoods.Go.GoObject.CopyObjectDelayed(Northwoods.Go.GoCopyDictionary,Northwoods.Go.GoObject)" />. /// </para> /// <para> /// The easiest way to make a full copy of an object in a document is to call /// <see cref="T:Northwoods.Go.GoDocument" />.<see cref="M:Northwoods.Go.GoDocument.AddCopy(Northwoods.Go.GoObject,System.Drawing.PointF)" />, which calls <c>CopyFromCollection</c>. /// However, if you want to create a copy of an object without adding it to a document, /// you can call <see cref="M:Northwoods.Go.GoCopyDictionary.CopyComplete(Northwoods.Go.GoObject)" />, which performs both copying passes. /// </para> /// </remarks> public virtual GoObject Copy(GoObject obj) { if (obj == null) { return(null); } GoObject goObject = this[obj] as GoObject; if (goObject == null) { goObject = obj.CopyObject(this); } return(goObject); }