mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 22:46:58 +00:00
Version 1.9.0:
- added MapBase.ZoomToBounds method - fixed coercing property values in MapBase - improved Location property handling in MapPanel to keep viewport positions near map center - use common view model in sample applications
This commit is contained in:
parent
9f4ab0f3e3
commit
5eafa751f8
37 changed files with 391 additions and 571 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 7 KiB |
|
|
@ -5,6 +5,7 @@
|
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:map="using:MapControl"
|
||||
xmlns:vm="using:ViewModel"
|
||||
xmlns:local="using:StoreApplication"
|
||||
mc:Ignorable="d">
|
||||
<Page.Resources>
|
||||
|
|
@ -114,34 +115,31 @@
|
|||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<local:SampleItemCollection x:Key="Polylines"/>
|
||||
<local:SampleItemCollection x:Key="Points"/>
|
||||
<local:SampleItemCollection x:Key="Pushpins"/>
|
||||
</Page.Resources>
|
||||
<Page.DataContext>
|
||||
<vm:ViewModel/>
|
||||
</Page.DataContext>
|
||||
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<map:Map x:Name="map" MinZoomLevel="2" MaxZoomLevel="18" ZoomLevel="11" Foreground="Black">
|
||||
<map:MapBase.Center>
|
||||
<map:Location Latitude="53.5" Longitude="8.2"/>
|
||||
</map:MapBase.Center>
|
||||
<map:Map x:Name="map" MinZoomLevel="2" Center="{Binding MapCenter}" MaxZoomLevel="18" ZoomLevel="11" Foreground="Black">
|
||||
<map:MapImage x:Name="mapImage" South="53.54031" North="53.74871" West="8.08594" East="8.43750"
|
||||
Source="10_535_330.jpg" Opacity="0.5"/>
|
||||
<map:MapGraticule Opacity="0.6"/>
|
||||
|
||||
<!-- use ItemTemplate or ItemContainerStyle alternatively -->
|
||||
<map:MapItemsControl ItemsSource="{StaticResource Polylines}"
|
||||
<map:MapItemsControl ItemsSource="{Binding Polylines}"
|
||||
ItemTemplate="{StaticResource PolylineItemTemplate}"/>
|
||||
<!--<map:MapItemsControl ItemsSource="{StaticResource Polylines}"
|
||||
<!--<map:MapItemsControl ItemsSource="{Binding Polylines}"
|
||||
ItemContainerStyle="{StaticResource PolylineItemStyle}"/>-->
|
||||
|
||||
<map:MapItemsControl ItemsSource="{StaticResource Points}"
|
||||
<map:MapItemsControl ItemsSource="{Binding Points}"
|
||||
ItemContainerStyle="{StaticResource PointItemStyle}"
|
||||
SelectionMode="Extended"/>
|
||||
|
||||
<map:MapItemsControl ItemsSource="{StaticResource Pushpins}"
|
||||
<map:MapItemsControl ItemsSource="{Binding Pushpins}"
|
||||
ItemContainerStyle="{StaticResource PushpinItemStyle}"/>
|
||||
|
||||
<Path Stroke="Blue" StrokeThickness="3">
|
||||
|
|
|
|||
|
|
@ -1,121 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MapControl;
|
||||
using MapControl;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
namespace StoreApplication
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class MainPage : Page
|
||||
{
|
||||
private SamplePoint movingPoint = new SamplePoint
|
||||
{
|
||||
Name = "Moving",
|
||||
Location = new Location(53.5, 8.25)
|
||||
};
|
||||
|
||||
public MainPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
tileLayerComboBox.SelectedIndex = 0;
|
||||
|
||||
var polylines = (ICollection<object>)Resources["Polylines"];
|
||||
polylines.Add(
|
||||
new SamplePolyline
|
||||
{
|
||||
Locations = LocationCollection.Parse("53.5140,8.1451 53.5123,8.1506 53.5156,8.1623 53.5276,8.1757 53.5491,8.1852 53.5495,8.1877 53.5426,8.1993 53.5184,8.2219 53.5182,8.2386 53.5195,8.2387")
|
||||
});
|
||||
polylines.Add(
|
||||
new SamplePolyline
|
||||
{
|
||||
Locations = LocationCollection.Parse("53.5978,8.1212 53.6018,8.1494 53.5859,8.1554 53.5852,8.1531 53.5841,8.1539 53.5802,8.1392 53.5826,8.1309 53.5867,8.1317 53.5978,8.1212")
|
||||
});
|
||||
|
||||
var points = (ICollection<object>)Resources["Points"];
|
||||
points.Add(
|
||||
new SamplePoint
|
||||
{
|
||||
Name = "Steinbake Leitdamm",
|
||||
Location = new Location(53.51217, 8.16603)
|
||||
});
|
||||
points.Add(
|
||||
new SamplePoint
|
||||
{
|
||||
Name = "Buhne 2",
|
||||
Location = new Location(53.50926, 8.15815)
|
||||
});
|
||||
points.Add(
|
||||
new SamplePoint
|
||||
{
|
||||
Name = "Buhne 4",
|
||||
Location = new Location(53.50468, 8.15343)
|
||||
});
|
||||
points.Add(
|
||||
new SamplePoint
|
||||
{
|
||||
Name = "Buhne 6",
|
||||
Location = new Location(53.50092, 8.15267)
|
||||
});
|
||||
points.Add(
|
||||
new SamplePoint
|
||||
{
|
||||
Name = "Buhne 8",
|
||||
Location = new Location(53.49871, 8.15321)
|
||||
});
|
||||
points.Add(
|
||||
new SamplePoint
|
||||
{
|
||||
Name = "Buhne 10",
|
||||
Location = new Location(53.49350, 8.15563)
|
||||
});
|
||||
points.Add(movingPoint);
|
||||
|
||||
var pushpins = (ICollection<object>)Resources["Pushpins"];
|
||||
pushpins.Add(
|
||||
new SamplePoint
|
||||
{
|
||||
Name = "WHV - Eckwarderhörne",
|
||||
Location = new Location(53.5495, 8.1877)
|
||||
});
|
||||
pushpins.Add(
|
||||
new SamplePoint
|
||||
{
|
||||
Name = "JadeWeserPort",
|
||||
Location = new Location(53.5914, 8.14)
|
||||
});
|
||||
pushpins.Add(
|
||||
new SamplePoint
|
||||
{
|
||||
Name = "Kurhaus Dangast",
|
||||
Location = new Location(53.447, 8.1114)
|
||||
});
|
||||
pushpins.Add(
|
||||
new SamplePoint
|
||||
{
|
||||
Name = "Eckwarderhörne",
|
||||
Location = new Location(53.5207, 8.2323)
|
||||
});
|
||||
|
||||
var timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(0.1) };
|
||||
timer.Tick += MovePoint;
|
||||
timer.Start();
|
||||
}
|
||||
|
||||
private void MovePoint(object sender, object e)
|
||||
{
|
||||
movingPoint.Location = new Location(movingPoint.Location.Latitude + 0.001, movingPoint.Location.Longitude + 0.002);
|
||||
|
||||
if (movingPoint.Location.Latitude > 54d)
|
||||
{
|
||||
movingPoint.Name = "Stopped";
|
||||
((DispatcherTimer)sender).Stop();
|
||||
}
|
||||
}
|
||||
|
||||
private void ImageOpacitySliderValueChanged(object sender, RangeBaseValueChangedEventArgs e)
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("Copyright © Clemens Fischer 2012-2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("1.8.0")]
|
||||
[assembly: AssemblyFileVersion("1.8.0")]
|
||||
[assembly: AssemblyVersion("1.9.0")]
|
||||
[assembly: AssemblyFileVersion("1.9.0")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
|
|
@ -1,51 +0,0 @@
|
|||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using MapControl;
|
||||
|
||||
namespace StoreApplication
|
||||
{
|
||||
public class SamplePoint : INotifyPropertyChanged
|
||||
{
|
||||
private string name;
|
||||
private Location location;
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return name; }
|
||||
set
|
||||
{
|
||||
name = value;
|
||||
OnPropertyChanged("Name");
|
||||
}
|
||||
}
|
||||
|
||||
public Location Location
|
||||
{
|
||||
get { return location; }
|
||||
set
|
||||
{
|
||||
location = value;
|
||||
OnPropertyChanged("Location");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
if (PropertyChanged != null)
|
||||
{
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SamplePolyline
|
||||
{
|
||||
public LocationCollection Locations { get; set; }
|
||||
}
|
||||
|
||||
public class SampleItemCollection : ObservableCollection<object>
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -37,6 +37,9 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Common\ViewModel.cs">
|
||||
<Link>ViewModel.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
|
@ -45,7 +48,6 @@
|
|||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SampleItems.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppxManifest Include="Package.appxmanifest">
|
||||
|
|
@ -53,7 +55,9 @@
|
|||
</AppxManifest>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="10_535_330.jpg" />
|
||||
<Content Include="..\Common\10_535_330.jpg">
|
||||
<Link>10_535_330.jpg</Link>
|
||||
</Content>
|
||||
<Content Include="Assets\Logo.png" />
|
||||
<Content Include="Assets\SmallLogo.png" />
|
||||
<Content Include="Assets\SplashScreen.png" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue