示例#1
0
        /// <summary>
        /// Deserialize a Scene2D from the given stream.
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="compressed"></param>
        /// <returns></returns>
        public static IScene2DPrimitivesSource DeserializeStyled(Stream stream, bool compressed)
        {
            // create the serializer.
            var serializer = new OsmSharp.UI.Renderer.Scene.Storage.Styled.Scene2DStyledSerializer();

            return(serializer.Deserialize(stream));
        }
示例#2
0
        /// <summary>
        /// Serializes this scene2D to the given stream.
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="compress"></param>
        public void SerializeStyled(Stream stream, bool compress)
        {
            // build the index.
            var index = new RTreeMemoryIndex <Scene2DEntry>();

            foreach (var primitiveLayer in _primitives)
            {
                foreach (var primitive in primitiveLayer.Value)
                {
                    index.Add(primitive.GetBox(), new Scene2DEntry()
                    {
                        Layer            = primitiveLayer.Key,
                        Id               = 0,
                        Scene2DPrimitive = primitive
                    });
                }
            }

            // create the serializer.
            var serializer = new OsmSharp.UI.Renderer.Scene.Storage.Styled.Scene2DStyledSerializer();

            serializer.Serialize(stream, index);
        }
示例#3
0
        /// <summary>
        /// Serializes this scene2D to the given stream.
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="compress"></param>
        public void SerializeStyled(Stream stream, bool compress)
        {
            // build the index.
            var index = new RTreeMemoryIndex<Scene2DEntry>();
            foreach (var primitiveLayer in _primitives)
            {
                foreach (var primitive in primitiveLayer.Value)
                {
                    index.Add(primitive.GetBox(), new Scene2DEntry()
                    {
                        Layer = primitiveLayer.Key,
                        Id = 0,
                        Scene2DPrimitive = primitive
                    });
                }
            }

            // create the serializer.
            var serializer = new OsmSharp.UI.Renderer.Scene.Storage.Styled.Scene2DStyledSerializer();
            serializer.Serialize(stream, index);
        }
示例#4
0
 /// <summary>
 /// Deserialize a Scene2D from the given stream.
 /// </summary>
 /// <param name="stream"></param>
 /// <param name="compressed"></param>
 /// <returns></returns>
 public static IScene2DPrimitivesSource DeserializeStyled(Stream stream, bool compressed)
 {
     // create the serializer.
     var serializer = new OsmSharp.UI.Renderer.Scene.Storage.Styled.Scene2DStyledSerializer();
     return serializer.Deserialize(stream);
 }