Exemplo n.º 1
0
        /// <summary>
        /// Serializes the given graph and tags index to the given stream.
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="graph"></param>
        /// <param name="metaTags"></param>
        public void Serialize(Stream stream, DynamicGraphRouterDataSource <TEdgeData> graph, TagsCollectionBase metaTags)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }
            if (graph == null)
            {
                throw new ArgumentNullException("graph");
            }

            // write the header.
            this.WriteVersionHeader(stream);

            // write the vehicles.
            this.WriteVehicleProfiles(stream, graph.GetSupportedProfiles());

            // write the meta-data.
            this.WriteMeta(stream, metaTags);

            // wrap the stream.
            var routingSerializerStream = new LimitedStream(stream);

            // do the version-specific serialization.
            this.DoSerialize(routingSerializerStream, graph);
        }