Пример #1
0
        public IGraphScene <IVisual, IVisualEdge> LoadFromContent(Content <Stream> source, IGraph <IVisual, IVisualEdge> sourceGraph, IGraphSceneLayout <IVisual, IVisualEdge> layout)
        {
            var result = default(IGraphScene <IVisual, IVisualEdge>);

            try {
                var name = string.Empty;
                if (source.Description != null)
                {
                    name = source.Description.ToString();
                }

                Int64 id = 0;
                if (source.Source is Int64)
                {
                    id = (Int64)source.Source;
                }

                result = LoadFromStream(source.Data, sourceGraph, layout);
                if (result != null)
                {
                    result.State.Clean  = true;
                    result.State.Hollow = false;
                    var info = SheetStore.RegisterSceneInfo(id, name);
                    result.State.CopyTo(info.State);
                }
            } finally {
            }
            return(result);
        }
Пример #2
0
        protected SceneInfo SaveToThing(IGraphScene <IVisual, IVisualEdge> scene, IGraphSceneLayout <IVisual, IVisualEdge> layout, IThing thing, string name)
        {
            var result = default(SceneInfo);

            if (thing is IStreamThing || thing == null)
            {
                var content = new Content <Stream> (
                    new MemoryStream(), CompressionType.bZip2, ContentTypes.LimadaSheet);

                var serializer = new SheetSerializer();
                serializer.Save(content.Data, scene.Graph, layout);
                content.Data.Position = 0;
                content.Description   = name;

                thing = new VisualThingsContentViz().AssignContent(scene.Graph, thing, content);

                result = SheetStore.RegisterSceneInfo(thing.Id, name);
                result.State.Hollow = false;
                result.State.Clean  = true;
                result.State.CopyTo(scene.State);
            }
            else
            {
                throw new ArgumentException("thing must be a StreamThing");
            }
            return(result);
        }