本文整理汇总了C#中TileIndex类的典型用法代码示例。如果您正苦于以下问题:C# TileIndex类的具体用法?C# TileIndex怎么用?C# TileIndex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TileIndex类属于命名空间,在下文中一共展示了TileIndex类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateRequestUriCore
protected override string CreateRequestUriCore(TileIndex index)
{
int z = (int)index.Level;
int shift = MapTileProvider.GetSideTilesCount(z) / 2;
int x = index.X + shift;
int y = MapTileProvider.GetSideTilesCount(z) - 1 - index.Y - shift;
char serverIdx = (char)('a' + CurrentServer);
string uri = "";
switch (renderer)
{
case OpenStreetMapRenderer.Mapnik:
uri = "tile.openstreetmap.org";
break;
case OpenStreetMapRenderer.Osmarenderer:
uri = "tah.openstreetmap.org/Tiles/tile";
break;
case OpenStreetMapRenderer.CycleMap:
uri = "andy.sandbox.cloudmade.com/tiles/cycle";
break;
case OpenStreetMapRenderer.NoName:
uri = "tile.cloudmade.com/fd093e52f0965d46bb1c6c6281022199/3/256";
break;
default:
break;
}
return String.Format(UriFormat, z.ToString(), x.ToString(), y.ToString(), serverIdx.ToString(), uri);
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:29,代码来源:OpenStreetMapServer.cs
示例2:
public BitmapImage this[TileIndex id]
{
get
{
return cache[id];
}
}
开发者ID:elsiete,项目名称:DynamicDataDisplay,代码行数:7,代码来源:MemoryTileServer.cs
示例3:
public BitmapSource this[TileIndex id]
{
get
{
return (BitmapSource)cache[id].Target;
}
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:7,代码来源:WeakRefMemoryTileServer.cs
示例4: BeginLoadImage
public override void BeginLoadImage(TileIndex id)
{
if (Contains(id))
ReportSuccess(cache[id], id);
else
ReportFailure(id);
}
开发者ID:elsiete,项目名称:DynamicDataDisplay,代码行数:7,代码来源:MemoryTileServer.cs
示例5: CreateRequestUriCore
protected sealed override string CreateRequestUriCore(TileIndex index)
{
string indexString = CreateTileIndexString(index);
string res = String.Format(UriFormat, CurrentServer, indexString);
return res;
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:7,代码来源:VEServerBase.cs
示例6: BeginSaveImage
public void BeginSaveImage(TileIndex id, BitmapImage image)
{
string imagePath = GetImagePath(id);
bool errorWhileDeleting = false;
bool containsOld = Contains(id);
if (containsOld && saveOption == SaveOption.ForceUpdate)
try
{
File.Delete(imagePath);
}
catch (IOException exc)
{
// todo возможно, тут добавить файл в очередь на удаление или перезапись новым содержимым
// когда он перестанет быть блокированным
Debug.WriteLine(String.Format("{0} - error while deleting tile {1}: {2}", Name, id, exc.Message));
errorWhileDeleting = true;
}
bool shouldSave = saveOption == SaveOption.ForceUpdate && !errorWhileDeleting ||
saveOption == SaveOption.PreserveOld && !containsOld;
if (shouldSave)
{
Debug.WriteLine("Began to save id = " + id);
Statistics.IntValues["ImagesSaved"]++;
ImageSaver saver = ScreenshotHelper.SaveBitmapToFile;
saver.BeginInvoke((BitmapImage)image.GetAsFrozen(), imagePath, null, null);
}
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:32,代码来源:WriteableFileSystemTileServer.cs
示例7: BeginLoadImage
public override void BeginLoadImage(TileIndex id)
{
if (CanLoadFast(id))
resourceServer.BeginLoadImage(id);
else
base.BeginLoadImage(id);
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:7,代码来源:VEHybridMixedServer.cs
示例8: BeginLoadBitmapImpl
protected void BeginLoadBitmapImpl(Stream stream, TileIndex id)
{
Dispatcher.BeginInvoke((Action)(() =>
{
BitmapImage bmp = new BitmapImage();
SubscribeBitmapEvents(bmp);
pendingBitmaps.Add(bmp, id);
MemoryStream memStream = new MemoryStream();
stream.CopyTo(memStream);
memStream.Seek(0, SeekOrigin.Begin);
stream.Dispose();
bmp.BeginInit();
bmp.StreamSource = memStream;
bmp.CacheOption = BitmapCacheOption.OnLoad;
bmp.EndInit();
if (!bmp.IsDownloading)
{
UnsubscribeBitmapEvents(bmp);
ReportSuccess(memStream, bmp, id);
pendingBitmaps.Remove(bmp);
bmp.Freeze();
}
}));
}
开发者ID:modulexcite,项目名称:DynamicDataDisplay,代码行数:27,代码来源:TileServerBase.cs
示例9: CreateRequestUriCore
protected override string CreateRequestUriCore(TileIndex index)
{
int level = (int)index.Level;
int x = index.X;
int y = index.Y;
return String.Format(UriFormat, level.ToString(), x.ToString(), y.ToString());
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:8,代码来源:ETopoServer.cs
示例10: BeginSaveImage
public void BeginSaveImage(TileIndex id, BitmapSource image, Stream stream)
{
if (image == null)
throw new ArgumentNullException("image");
cache[id] = new WeakReference(image);
Statistics.IntValues["ImagesSaved"]++;
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:8,代码来源:WeakRefMemoryTileServer.cs
示例11: CreateRequestUriCore
protected override string CreateRequestUriCore(TileIndex index)
{
int level = (int)index.Level;
var y = MapTileProvider.GetSideTilesCount(level) / 2 + index.Y;
var x = MapTileProvider.GetSideTilesCount(level) / 2 + index.X;
string uri = String.Format(UriFormat, CurrentServer, level, x, y);
return uri;
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:8,代码来源:GoogleMoonServer.cs
示例12: CreateRequestUri
protected override string CreateRequestUri(TileIndex index)
{
int z = index.Level;
int x = index.X;
int y = MapTileProvider.GetSideTilesNum(z) - 1 - index.Y;
return String.Format(UriFormat, z, x, y);
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:8,代码来源:OpenStreetMapServer.cs
示例13: Contains
public override bool Contains(TileIndex id)
{
if (!metadataRequestSent)
{
SendMetadataRequest();
}
return loaded && base.Contains(id);
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:8,代码来源:VEImageryServerBase.cs
示例14: CreateResourceName
private string CreateResourceName(TileIndex id)
{
StringBuilder builder = new StringBuilder(currentPrefix);
builder = builder.Append(id.Level).Append(".").Append(id.X).Append("x")
.Append(id.Y).Append(fileExtension);
return builder.ToString();
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:8,代码来源:ResourcesTileServer.cs
示例15: GetTilePath
public override string GetTilePath(TileIndex id)
{
StringBuilder builder = new StringBuilder("z");
builder = builder.Append(id.Level).Append(Path.DirectorySeparatorChar).Append(id.X).Append('x').Append(id.Y);
return builder.ToString();
}
开发者ID:elsiete,项目名称:DynamicDataDisplay,代码行数:8,代码来源:DefaultPathProvider.cs
示例16: Contains
public override bool Contains(TileIndex id)
{
string path = pathProvider.GetTilePath(id) + extension;
Uri uri = GetPartUri(path);
bool exists = package.PartExists(uri);
return exists;
}
开发者ID:elsiete,项目名称:DynamicDataDisplay,代码行数:8,代码来源:ZipFileTileServer.cs
示例17: ReportFailure
protected override void ReportFailure(TileIndex id)
{
runningDownloadsNum--;
BeginLoadImageFromQueue();
base.ReportFailure(id);
}
开发者ID:elsiete,项目名称:DynamicDataDisplay,代码行数:8,代码来源:NetworkTileServer.cs
示例18: CreateRequestUriCore
protected override string CreateRequestUriCore(TileIndex index)
{
int x = index.X;
int y = MapTileProvider.GetSideTilesCount(index.Level) - 1 - index.Y;
int z = (int)index.Level;
string uri = String.Format(UriFormat, x, y, z);
return uri;
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:8,代码来源:WikiMapiaServer.cs
示例19: BeginSaveImage
public void BeginSaveImage(TileIndex id, BitmapSource image, Stream stream)
{
string imagePath = GetImagePath(id);
bool errorWhileDeleting = false;
bool containsOld = Contains(id);
if (containsOld && saveOption == SaveOption.ForceUpdate)
{
try
{
File.Delete(imagePath);
}
catch (IOException exc)
{
// todo возможно, тут добавить файл в очередь на удаление или перезапись новым содержимым
// когда он перестанет быть блокированным
MapsTraceSource.Instance.ServerInformationTraceSource.TraceInformation("{0} - error while deleting tile {1}: {2}", ServerName, id, exc.Message);
errorWhileDeleting = true;
}
}
bool shouldSave = saveOption == SaveOption.ForceUpdate && !errorWhileDeleting ||
saveOption == SaveOption.PreserveOld && !containsOld;
if (shouldSave)
{
MapsTraceSource.Instance.ServerInformationTraceSource.TraceInformation(String.Format("{0}: begin to save: id = {1}", ServerName, id));
FileMap[id] = true;
Statistics.IntValues["ImagesSaved"]++;
BitmapSource bmp = image;
if (!bmp.IsFrozen) {
}
ThreadPool.QueueUserWorkItem(new WaitCallback((unused) =>
{
// Try to write tile to cache. Conflicts are possible
// especially in case of multiple Map control instances.
// That's why exception is only dumped to debug output.
try
{
if (stream == null)
{
ScreenshotHelper.SaveBitmapToFile(bmp, imagePath);
}
else
{
ScreenshotHelper.SaveStreamToFile(stream, imagePath);
}
}
catch (Exception exc)
{
Debug.WriteLine(String.Format("Error writing tile to cache: {0}", exc.Message));
}
}));
}
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:58,代码来源:WriteableFileSystemTileServer.cs
示例20: GetNameByIndex
protected override string GetNameByIndex(TileIndex index)
{
int level = (int)index.Level;
int x = index.X; //MapTileProvider.GetSideTilesCount(level) + index.X - 1;
int y = index.Y; //MapTileProvider.GetSideTilesCount(level) - index.Y - 2;
var result = String.Format("{0}_{1}", x.ToString(), y.ToString());
return result;
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:9,代码来源:DeepZoomFileServer.cs
注:本文中的TileIndex类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论