/// <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)); }
/// <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); }
/// <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); }
/// <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); }