Added ImageFileCache, removed TileImageLoader.CreateCache.

This commit is contained in:
ClemensF 2012-08-15 21:31:10 +02:00
parent ae4fb7881a
commit db1201ad47
12 changed files with 490 additions and 121 deletions

View file

@ -7,8 +7,8 @@
</configSections>
<applicationSettings>
<SampleApplication.Properties.Settings>
<setting name="UsePersistentCache" serializeAs="String">
<value>False</value>
<setting name="TileCache" serializeAs="String">
<value />
</setting>
</SampleApplication.Properties.Settings>
</applicationSettings>

View file

@ -21,7 +21,7 @@
map content without using their APIs (i.e. Google Maps API or Bing Maps API).
Hence the declarations below are for demonstration purpose only. -->
<map:TileLayer Name="Google Maps" Description="Google Maps - © {y} Google"
<!--<map:TileLayer Name="Google Maps" Description="Google Maps - © {y} Google"
TileSource="http://mt{i}.google.com/vt/x={x}&amp;y={y}&amp;z={z}" MaxZoomLevel="20"/>
<map:TileLayer Name="Google Images" Description="Google Maps - © {y} Google"
TileSource="http://khm{i}.google.com/kh/v=113&amp;x={x}&amp;y={y}&amp;z={z}" MaxZoomLevel="20" HasDarkBackground="True"/>
@ -30,7 +30,7 @@
<map:TileLayer Name="Bing Images" Description="Bing Maps - © {y} Microsoft Corporation"
TileSource="http://ecn.t{i}.tiles.virtualearth.net/tiles/a{q}.jpeg?g=0" MaxZoomLevel="20" HasDarkBackground="True"/>
<map:TileLayer Name="Bing Hybrid" Description="Bing Maps - © {y} Microsoft Corporation"
TileSource="http://ecn.t{i}.tiles.virtualearth.net/tiles/h{q}.jpeg?g=0&amp;stl=h" MaxZoomLevel="20" HasDarkBackground="True"/>
TileSource="http://ecn.t{i}.tiles.virtualearth.net/tiles/h{q}.jpeg?g=0&amp;stl=h" MaxZoomLevel="20" HasDarkBackground="True"/>-->
<!-- The TileLayer below uses an ImageTileSource, which bypasses caching of map tile images -->

View file

@ -19,9 +19,16 @@ namespace SampleApplication
public MainWindow()
{
if (Properties.Settings.Default.UsePersistentCache)
switch (Properties.Settings.Default.TileCache)
{
TileImageLoader.CreateCache<FileDbCache>();
case "FileDbCache":
TileImageLoader.Cache = new FileDbCache(TileImageLoader.DefaultCacheName, TileImageLoader.DefaultCacheDirectory);
break;
case "ImageFileCache":
TileImageLoader.Cache = new ImageFileCache(TileImageLoader.DefaultCacheName, TileImageLoader.DefaultCacheDirectory);
break;
default:
break;
}
InitializeComponent();

View file

@ -25,10 +25,10 @@ namespace SampleApplication.Properties {
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool UsePersistentCache {
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string TileCache {
get {
return ((bool)(this["UsePersistentCache"]));
return ((string)(this["TileCache"]));
}
}
}

View file

@ -2,8 +2,8 @@
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="SampleApplication.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="UsePersistentCache" Type="System.Boolean" Scope="Application">
<Value Profile="(Default)">False</Value>
<Setting Name="TileCache" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>

View file

@ -84,6 +84,10 @@
<Project>{EF44F661-B98A-4676-927F-85D138F82300}</Project>
<Name>FileDbCache</Name>
</ProjectReference>
<ProjectReference Include="..\..\Caching\ImageFileCache\ImageFileCache.csproj">
<Project>{86470440-FEE2-4120-AF5A-3762FB9C536F}</Project>
<Name>ImageFileCache</Name>
</ProjectReference>
<ProjectReference Include="..\..\MapControl\MapControl.csproj">
<Project>{06481252-2310-414A-B9FC-D5739FDF6BD3}</Project>
<Name>MapControl</Name>