mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-05 23:02:19 +01:00
Constants naming
This commit is contained in:
parent
107b8e0f90
commit
172a388841
|
|
@ -23,9 +23,9 @@ namespace MapControl.Caching
|
|||
/// </summary>
|
||||
public sealed class FileDbCache : IDistributedCache, IDisposable
|
||||
{
|
||||
private const string keyField = "Key";
|
||||
private const string valueField = "Value";
|
||||
private const string expiresField = "Expires";
|
||||
private const string KeyField = "Key";
|
||||
private const string ValueField = "Value";
|
||||
private const string ExpiresField = "Expires";
|
||||
|
||||
private readonly FileDb fileDb = new FileDb { AutoFlush = true };
|
||||
private readonly Timer timer;
|
||||
|
|
@ -71,9 +71,9 @@ namespace MapControl.Caching
|
|||
|
||||
fileDb.Create(path, new Field[]
|
||||
{
|
||||
new Field(keyField, DataTypeEnum.String) { IsPrimaryKey = true },
|
||||
new Field(valueField, DataTypeEnum.Byte) { IsArray = true },
|
||||
new Field(expiresField, DataTypeEnum.DateTime)
|
||||
new Field(KeyField, DataTypeEnum.String) { IsPrimaryKey = true },
|
||||
new Field(ValueField, DataTypeEnum.Byte) { IsArray = true },
|
||||
new Field(ExpiresField, DataTypeEnum.DateTime)
|
||||
});
|
||||
|
||||
logger?.LogInformation("Created database {path}", path);
|
||||
|
|
@ -99,7 +99,7 @@ namespace MapControl.Caching
|
|||
{
|
||||
try
|
||||
{
|
||||
var record = fileDb.GetRecordByKey(key, new string[] { valueField, expiresField }, false);
|
||||
var record = fileDb.GetRecordByKey(key, new string[] { ValueField, ExpiresField }, false);
|
||||
|
||||
if (record != null && (DateTime)record[1] > DateTime.UtcNow)
|
||||
{
|
||||
|
|
@ -130,8 +130,8 @@ namespace MapControl.Caching
|
|||
|
||||
var fieldValues = new FieldValues(3)
|
||||
{
|
||||
{ valueField, value },
|
||||
{ expiresField, expiration }
|
||||
{ ValueField, value },
|
||||
{ ExpiresField, expiration }
|
||||
};
|
||||
|
||||
try
|
||||
|
|
@ -142,7 +142,7 @@ namespace MapControl.Caching
|
|||
}
|
||||
else
|
||||
{
|
||||
fieldValues.Add(keyField, key);
|
||||
fieldValues.Add(KeyField, key);
|
||||
fileDb.AddRecord(fieldValues);
|
||||
}
|
||||
}
|
||||
|
|
@ -193,7 +193,7 @@ namespace MapControl.Caching
|
|||
|
||||
public void DeleteExpiredItems()
|
||||
{
|
||||
var deletedItemsCount = fileDb.DeleteRecords(new FilterExpression(expiresField, DateTime.UtcNow, ComparisonOperatorEnum.LessThanOrEqual));
|
||||
var deletedItemsCount = fileDb.DeleteRecords(new FilterExpression(ExpiresField, DateTime.UtcNow, ComparisonOperatorEnum.LessThanOrEqual));
|
||||
|
||||
if (deletedItemsCount > 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ namespace MapControl
|
|||
/// </summary>
|
||||
public class MapTileLayer : TilePyramidLayer
|
||||
{
|
||||
private const int tileSize = 256;
|
||||
private const int TileSize = 256;
|
||||
|
||||
private static readonly Point mapTopLeft = new Point(-180d * MapProjection.Wgs84MeterPerDegree,
|
||||
private static readonly Point MapTopLeft = new Point(-180d * MapProjection.Wgs84MeterPerDegree,
|
||||
180d * MapProjection.Wgs84MeterPerDegree);
|
||||
|
||||
public static readonly DependencyProperty TileSourceProperty =
|
||||
|
|
@ -116,9 +116,9 @@ namespace MapControl
|
|||
{
|
||||
// Arrange tiles relative to TileMatrix.XMin/YMin.
|
||||
//
|
||||
var tileSize = MapTileLayer.tileSize << (TileMatrix.ZoomLevel - tile.ZoomLevel);
|
||||
var x = tileSize * tile.X - MapTileLayer.tileSize * TileMatrix.XMin;
|
||||
var y = tileSize * tile.Y - MapTileLayer.tileSize * TileMatrix.YMin;
|
||||
var tileSize = TileSize << (TileMatrix.ZoomLevel - tile.ZoomLevel);
|
||||
var x = tileSize * tile.X - TileSize * TileMatrix.XMin;
|
||||
var y = tileSize * tile.Y - TileSize * TileMatrix.YMin;
|
||||
|
||||
tile.Image.Width = tileSize;
|
||||
tile.Image.Height = tileSize;
|
||||
|
|
@ -134,11 +134,11 @@ namespace MapControl
|
|||
{
|
||||
// Tile matrix origin in pixels.
|
||||
//
|
||||
var tileMatrixOrigin = new Point(tileSize * TileMatrix.XMin, tileSize * TileMatrix.YMin);
|
||||
var tileMatrixOrigin = new Point(TileSize * TileMatrix.XMin, TileSize * TileMatrix.YMin);
|
||||
var tileMatrixScale = MapBase.ZoomLevelToScale(TileMatrix.ZoomLevel);
|
||||
|
||||
((MatrixTransform)RenderTransform).Matrix =
|
||||
ParentMap.ViewTransform.GetTileLayerTransform(tileMatrixScale, mapTopLeft, tileMatrixOrigin);
|
||||
ParentMap.ViewTransform.GetTileLayerTransform(tileMatrixScale, MapTopLeft, tileMatrixOrigin);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -178,14 +178,14 @@ namespace MapControl
|
|||
|
||||
// Tile matrix bounds in pixels.
|
||||
//
|
||||
var bounds = ParentMap.ViewTransform.GetTileMatrixBounds(tileMatrixScale, mapTopLeft, ParentMap.ActualWidth, ParentMap.ActualHeight);
|
||||
var bounds = ParentMap.ViewTransform.GetTileMatrixBounds(tileMatrixScale, MapTopLeft, ParentMap.ActualWidth, ParentMap.ActualHeight);
|
||||
|
||||
// Tile X and Y bounds.
|
||||
//
|
||||
var xMin = (int)Math.Floor(bounds.X / tileSize);
|
||||
var yMin = (int)Math.Floor(bounds.Y / tileSize);
|
||||
var xMax = (int)Math.Floor((bounds.X + bounds.Width) / tileSize);
|
||||
var yMax = (int)Math.Floor((bounds.Y + bounds.Height) / tileSize);
|
||||
var xMin = (int)Math.Floor(bounds.X / TileSize);
|
||||
var yMin = (int)Math.Floor(bounds.Y / TileSize);
|
||||
var xMax = (int)Math.Floor((bounds.X + bounds.Width) / TileSize);
|
||||
var yMax = (int)Math.Floor((bounds.Y + bounds.Height) / TileSize);
|
||||
|
||||
if (TileMatrix != null &&
|
||||
TileMatrix.ZoomLevel == tileMatrixZoomLevel &&
|
||||
|
|
|
|||
Loading…
Reference in a new issue