예제 #1
0
        public void CopyFrom(GraphDocument from, Altaxo.Graph.Gdi.GraphCopyOptions options)
        {
            if (object.ReferenceEquals(this, from))
            {
                return;
            }

            using (var suspendToken = SuspendGetToken())
            {
                Camera   = from.Camera;   // Camera is immutable
                Lighting = from.Lighting; // lighting is immutable

                if (0 != (options & Altaxo.Graph.Gdi.GraphCopyOptions.CloneNotes))
                {
                    ChildCopyToMember(ref _notes, from._notes);
                }

                if (0 != (options & Altaxo.Graph.Gdi.GraphCopyOptions.CloneProperties))
                {
                    // Clone also the graph properties
                    if (from._graphProperties != null && from._graphProperties.Count > 0)
                    {
                        PropertyBagNotNull.CopyFrom(from._graphProperties);
                    }
                    else
                    {
                        _graphProperties = null;
                    }
                }

                // the order is important here: clone the layers only before setting the printable graph bounds and other
                // properties, otherwise some errors will happen
                var newRootLayer = RootLayer;
                if (Altaxo.Graph.Gdi.GraphCopyOptions.CopyLayerAll == (options & Altaxo.Graph.Gdi.GraphCopyOptions.CopyLayerAll))
                {
                    newRootLayer = (HostLayer)from._rootLayer.Clone();
                }
                else if (0 != (options & Altaxo.Graph.Gdi.GraphCopyOptions.CopyLayerAll))
                {
                    // don't clone the layers, but copy the style of each each of the souce layers to the destination layers - this has to be done recursively
                    newRootLayer.CopyFrom(from._rootLayer, options);
                }
                RootLayer = newRootLayer;

                suspendToken.Resume();
            }
        }
예제 #2
0
 /// <summary>
 /// The table properties, key is a string, val is a object you want to store here.
 /// </summary>
 /// <remarks>The properties are saved on disc (with exception of those who's name starts with "tmp/".
 /// If the property you want to store is only temporary, the property name should therefore
 /// start with "tmp/".</remarks>
 public void SetGraphProperty(string key, object val)
 {
     PropertyBagNotNull.SetValue(key, val);
 }