Windows PhoneでGoogleマップをキャッシュできますか?私は使用しますGoogleTileSource
:
<my:MapTileLayer Name="street" Margin="0,0,0,32" Height="800" Width="433">
<my:MapTileLayer.TileSources>
<GoogleTileSource:GoogleTile TileTypes="Street"/>
</my:MapTileLayer.TileSources>
</my:MapTileLayer>
それが可能だ?
少し早いですがお礼を。
アップデート
XAML
コード:
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<my:Map Height="756" HorizontalAlignment="Left" Margin="12,6,0,0" Name="googlemap"
CredentialsProvider="AqayajnZU8FSfDGL8jpK5zMKAHmUL27Uqxv_OnpQzJQOI2PoQyxcG7dlR6_g4WWo"
CopyrightVisibility="Collapsed" LogoVisibility="Collapsed"
ScaleVisibility="Visible" VerticalAlignment="Top" Width="438" >
<my:Map.Mode>
<MSPCMCore:MercatorMode/>
</my:Map.Mode>
<my:MapTileLayer Name="street" Margin="0,0,0,32" Height="800" Width="433">
<my:MapTileLayer.TileSources>
<GoogleTileSource:GoogleTile TileTypes="Street"/>
</my:MapTileLayer.TileSources>
</my:MapTileLayer>
<my:MapLayer x:Name="PopupLayer">
<Canvas x:Name="ContentPopup" Visibility="Collapsed">
<Rectangle x:Name="ContentPopupRectangle" Fill="Black"
Opacity="0.6" Canvas.Left="0" Canvas.Top="0"
Height="100" Width="200"/>
<StackPanel Canvas.Left="20" Canvas.Top="10">
<TextBlock x:Name="ContentPopupNickname" FontSize="24" FontWeight="Bold" TextWrapping="Wrap" Width="200"/>
<TextBlock x:Name="ContentPopupLocation" FontSize="16" FontWeight="Bold" TextWrapping="Wrap" Width="200"/>
<TextBlock x:Name="ContentPopupAge" FontSize="16" FontWeight="Bold" TextWrapping="Wrap" Width="200"/>
</StackPanel>
</Canvas>
</my:MapLayer>
</my:Map>
</Grid>
したがって、cs
コード:
public enum GoogleTileTypes
{
Hybrid,
Physical,
Street,
Satellite,
WaterOverlay
}
public class GoogleTile : Microsoft.Phone.Controls.Maps.TileSource
{
private int _server;
private char _mapmode;
private GoogleTileTypes _tiletypes;
public GoogleTileTypes TileTypes
{
get { return _tiletypes; }
set
{
_tiletypes = value;
MapMode = MapModeConverter(value);
}
}
public char MapMode
{
get { return _mapmode; }
set { _mapmode = value; }
}
public int Server
{
get { return _server; }
set { _server = value; }
}
public GoogleTile()
{
UriFormat = @"http://mt{0}.google.com/vt/lyrs={1}&z={2}&x={3}&y={4}";
Server = 0;
}
public override Uri GetUri(int x, int y, int zoomLevel)
{
if (zoomLevel > 0)
{
var Url = string.Format(UriFormat, Server, MapMode, zoomLevel, x, y);
return new Uri(Url);
}
return null;
}
private char MapModeConverter(GoogleTileTypes tiletype)
{
switch (tiletype)
{
case GoogleTileTypes.Hybrid:
{
return 'y';
}
case GoogleTileTypes.Physical:
{
return 't';
}
case GoogleTileTypes.Satellite:
{
return 's';
}
case GoogleTileTypes.Street:
{
return 'm';
}
case GoogleTileTypes.WaterOverlay:
{
return 'r';
}
}
return ' ';
}
}