PageRenderTime 36ms CodeModel.GetById 34ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/Main/src/DynamicDataDisplay.Maps/Servers/FileServers/VEPathProvider.cs

#
C# | 34 lines | 30 code | 4 blank | 0 comment | 5 complexity | b7fcaedd9c9f513ebc94b80f421de9da MD5 | raw file
Possible License(s): CC-BY-SA-3.0
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using System.Text;
 5using Microsoft.Research.DynamicDataDisplay.Charts.Maps;
 6
 7namespace Microsoft.Research.DynamicDataDisplay.Maps.Servers.FileServers
 8{
 9	public sealed class VEPathProvider : TilePathProvider
10	{
11		public override string GetTilePath(TileIndex id)
12		{
13			StringBuilder builder = new StringBuilder();
14
15			int minLevel = 1;
16
17			checked
18			{
19				for (int level = minLevel; level <= id.Level; level++)
20				{
21					char ch = '0';
22					int halfTilesNum = (int)Math.Pow(2, id.Level - level);
23					if ((id.X & halfTilesNum) != 0)
24						ch += (char)1;
25					if ((id.Y & halfTilesNum) == 0)
26						ch += (char)2;
27					builder.Append(ch);
28				}
29			}
30
31			return builder.ToString();
32		}
33	}
34}