/// <summary> /// Deserialize the block with the given id. /// </summary> /// <param name="blockId"></param> /// <returns></returns> private CHBlock DeserializeBlock(uint blockId) { int blockOffset; int blockSize; uint blockIdx = blockId / _blockSize; if (blockIdx == 0) { // the block idx zero. blockOffset = _startOfBlocks; blockSize = _blocksIndex.LocationIndex[blockIdx]; } else { // need to calculate offset and size. blockOffset = _startOfBlocks + _blocksIndex.LocationIndex[blockIdx - 1]; blockSize = _blocksIndex.LocationIndex[blockIdx] - _blocksIndex.LocationIndex[blockIdx - 1]; } return(_serializer.DeserializeBlock(_stream, blockOffset, blockSize, false)); }
/// <summary> /// Deserialize the block with the given id. /// </summary> /// <param name="blockId"></param> /// <returns></returns> private CHBlock DeserializeBlock(uint blockId) { int blockOffset; int blockSize; uint blockIdx = blockId / _blockSize; if (blockIdx == 0) { // the block idx zero. blockOffset = _startOfBlocks; blockSize = _blocksIndex.LocationIndex[blockIdx]; } else { // need to calculate offset and size. blockOffset = _startOfBlocks + _blocksIndex.LocationIndex[blockIdx - 1]; blockSize = _blocksIndex.LocationIndex[blockIdx] - _blocksIndex.LocationIndex[blockIdx - 1]; } //OsmSharp.Logging.Log.TraceEvent("CHEdgeDataDataSource.DeserializeBlock", Logging.TraceEventType.Information, // "Deserializing block {0}...", blockId); return(_serializer.DeserializeBlock(_stream, blockOffset, blockSize, true)); }