mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Version 1.12.1: Some cleanup and minor improvements.
This commit is contained in:
parent
4f37eaa914
commit
ed140c6d01
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
|
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.12.0")]
|
[assembly: AssemblyVersion("1.12.1")]
|
||||||
[assembly: AssemblyFileVersion("1.12.0")]
|
[assembly: AssemblyFileVersion("1.12.1")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
|
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.12.0")]
|
[assembly: AssemblyVersion("1.12.1")]
|
||||||
[assembly: AssemblyFileVersion("1.12.0")]
|
[assembly: AssemblyFileVersion("1.12.1")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 2012
|
# Visual Studio 2013
|
||||||
|
VisualStudioVersion = 12.0.30501.0
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileDbCache", "Caching\FileDbCache\FileDbCache.csproj", "{EF44F661-B98A-4676-927F-85D138F82300}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileDbCache", "Caching\FileDbCache\FileDbCache.csproj", "{EF44F661-B98A-4676-927F-85D138F82300}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageFileCache", "Caching\ImageFileCache\ImageFileCache.csproj", "{86470440-FEE2-4120-AF5A-3762FB9C536F}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageFileCache", "Caching\ImageFileCache\ImageFileCache.csproj", "{86470440-FEE2-4120-AF5A-3762FB9C536F}"
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ namespace MapControl
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Map : MapBase
|
public class Map : MapBase
|
||||||
{
|
{
|
||||||
public static readonly DependencyProperty MouseWheelZoomChangeProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty MouseWheelZoomDeltaProperty = DependencyProperty.Register(
|
||||||
"MouseWheelZoomChange", typeof(double), typeof(Map), new PropertyMetadata(1d));
|
"MouseWheelZoomDelta", typeof(double), typeof(Map), new PropertyMetadata(1d));
|
||||||
|
|
||||||
private Point? mousePosition;
|
private Point? mousePosition;
|
||||||
|
|
||||||
|
|
@ -28,15 +28,15 @@ namespace MapControl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the amount by which the ZoomLevel property changes during a MouseWheel event.
|
/// Gets or sets the amount by which the ZoomLevel property changes during a MouseWheel event.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double MouseWheelZoomChange
|
public double MouseWheelZoomDelta
|
||||||
{
|
{
|
||||||
get { return (double)GetValue(MouseWheelZoomChangeProperty); }
|
get { return (double)GetValue(MouseWheelZoomDeltaProperty); }
|
||||||
set { SetValue(MouseWheelZoomChangeProperty, value); }
|
set { SetValue(MouseWheelZoomDeltaProperty, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnMouseWheel(object sender, MouseWheelEventArgs e)
|
private void OnMouseWheel(object sender, MouseWheelEventArgs e)
|
||||||
{
|
{
|
||||||
var zoomChange = MouseWheelZoomChange * (double)e.Delta / 120d;
|
var zoomChange = MouseWheelZoomDelta * (double)e.Delta / 120d;
|
||||||
ZoomMap(e.GetPosition(this), TargetZoomLevel + zoomChange);
|
ZoomMap(e.GetPosition(this), TargetZoomLevel + zoomChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ namespace MapControl
|
||||||
public static readonly DependencyProperty ManipulationModeProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty ManipulationModeProperty = DependencyProperty.Register(
|
||||||
"ManipulationMode", typeof(ManipulationModes), typeof(Map), new PropertyMetadata(ManipulationModes.All));
|
"ManipulationMode", typeof(ManipulationModes), typeof(Map), new PropertyMetadata(ManipulationModes.All));
|
||||||
|
|
||||||
public static readonly DependencyProperty MouseWheelZoomChangeProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty MouseWheelZoomDeltaProperty = DependencyProperty.Register(
|
||||||
"MouseWheelZoomChange", typeof(double), typeof(Map), new PropertyMetadata(1d));
|
"MouseWheelZoomDelta", typeof(double), typeof(Map), new PropertyMetadata(1d));
|
||||||
|
|
||||||
private Point? mousePosition;
|
private Point? mousePosition;
|
||||||
|
|
||||||
|
|
@ -37,18 +37,18 @@ namespace MapControl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the amount by which the ZoomLevel property changes during a MouseWheel event.
|
/// Gets or sets the amount by which the ZoomLevel property changes during a MouseWheel event.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double MouseWheelZoomChange
|
public double MouseWheelZoomDelta
|
||||||
{
|
{
|
||||||
get { return (double)GetValue(MouseWheelZoomChangeProperty); }
|
get { return (double)GetValue(MouseWheelZoomDeltaProperty); }
|
||||||
set { SetValue(MouseWheelZoomChangeProperty, value); }
|
set { SetValue(MouseWheelZoomDeltaProperty, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnMouseWheel(MouseWheelEventArgs e)
|
protected override void OnMouseWheel(MouseWheelEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnMouseWheel(e);
|
base.OnMouseWheel(e);
|
||||||
|
|
||||||
var zoomChange = MouseWheelZoomChange * (double)e.Delta / 120d;
|
var zoomDelta = MouseWheelZoomDelta * (double)e.Delta / 120d;
|
||||||
ZoomMap(e.GetPosition(this), TargetZoomLevel + zoomChange);
|
ZoomMap(e.GetPosition(this), TargetZoomLevel + zoomDelta);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
|
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
|
||||||
|
|
@ -79,7 +79,7 @@ namespace MapControl
|
||||||
if (mousePosition.HasValue)
|
if (mousePosition.HasValue)
|
||||||
{
|
{
|
||||||
var position = e.GetPosition(this);
|
var position = e.GetPosition(this);
|
||||||
TranslateMap((Point)(position - mousePosition));
|
TranslateMap((Point)(position - mousePosition.Value));
|
||||||
mousePosition = position;
|
mousePosition = position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@ namespace MapControl
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Map : MapBase
|
public class Map : MapBase
|
||||||
{
|
{
|
||||||
public static readonly DependencyProperty MouseWheelZoomChangeProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty MouseWheelZoomDeltaProperty = DependencyProperty.Register(
|
||||||
"MouseWheelZoomChange", typeof(double), typeof(Map), new PropertyMetadata(1d));
|
"MouseWheelZoomDelta", typeof(double), typeof(Map), new PropertyMetadata(1d));
|
||||||
|
|
||||||
private Point? mousePosition;
|
private Point? mousePosition;
|
||||||
|
|
||||||
|
|
@ -36,16 +36,16 @@ namespace MapControl
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the amount by which the ZoomLevel property changes during a MouseWheel event.
|
/// Gets or sets the amount by which the ZoomLevel property changes during a MouseWheel event.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double MouseWheelZoomChange
|
public double MouseWheelZoomDelta
|
||||||
{
|
{
|
||||||
get { return (double)GetValue(MouseWheelZoomChangeProperty); }
|
get { return (double)GetValue(MouseWheelZoomDeltaProperty); }
|
||||||
set { SetValue(MouseWheelZoomChangeProperty, value); }
|
set { SetValue(MouseWheelZoomDeltaProperty, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPointerWheelChanged(object sender, PointerRoutedEventArgs e)
|
private void OnPointerWheelChanged(object sender, PointerRoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var point = e.GetCurrentPoint(this);
|
var point = e.GetCurrentPoint(this);
|
||||||
var zoomChange = MouseWheelZoomChange * (double)point.Properties.MouseWheelDelta / 120d;
|
var zoomChange = MouseWheelZoomDelta * (double)point.Properties.MouseWheelDelta / 120d;
|
||||||
ZoomMap(point.Position, TargetZoomLevel + zoomChange);
|
ZoomMap(point.Position, TargetZoomLevel + zoomChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ namespace MapControl
|
||||||
|
|
||||||
private void OnRenderSizeChanged(object sender, SizeChangedEventArgs e)
|
private void OnRenderSizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
{
|
{
|
||||||
((RectangleGeometry)Clip).Rect = new Rect(0d, 0d, RenderSize.Width, RenderSize.Height);
|
((RectangleGeometry)Clip).Rect = new Rect(new Point(), e.NewSize);
|
||||||
ResetTransformOrigin();
|
ResetTransformOrigin();
|
||||||
UpdateTransform();
|
UpdateTransform();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -381,8 +381,8 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
var p1 = MapTransform.Transform(southWest);
|
var p1 = MapTransform.Transform(southWest);
|
||||||
var p2 = MapTransform.Transform(northEast);
|
var p2 = MapTransform.Transform(northEast);
|
||||||
var lonScale = ActualWidth / (p2.X - p1.X) * 360d / TileSource.TileSize;
|
var lonScale = RenderSize.Width / (p2.X - p1.X) * 360d / TileSource.TileSize;
|
||||||
var latScale = ActualHeight / (p2.Y - p1.Y) * 360d / TileSource.TileSize;
|
var latScale = RenderSize.Height / (p2.Y - p1.Y) * 360d / TileSource.TileSize;
|
||||||
var lonZoom = Math.Log(lonScale, 2d);
|
var lonZoom = Math.Log(lonScale, 2d);
|
||||||
var latZoom = Math.Log(latScale, 2d);
|
var latZoom = Math.Log(latScale, 2d);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,9 +64,7 @@
|
||||||
<Reference Include="System.Core">
|
<Reference Include="System.Core">
|
||||||
<HintPath>$(TargetFrameworkDirectory)System.Core.dll</HintPath>
|
<HintPath>$(TargetFrameworkDirectory)System.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
<Reference Include="System.Net" />
|
<Reference Include="System.Net" />
|
||||||
<Reference Include="System.Windows.Browser" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AnimationEx.Silverlight.cs" />
|
<Compile Include="AnimationEx.Silverlight.cs" />
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ namespace MapControl
|
||||||
}
|
}
|
||||||
|
|
||||||
var geometry = (PathGeometry)path.Data;
|
var geometry = (PathGeometry)path.Data;
|
||||||
var bounds = ParentMap.ViewportTransform.Inverse.TransformBounds(new Rect(0d, 0d, ParentMap.RenderSize.Width, ParentMap.RenderSize.Height));
|
var bounds = ParentMap.ViewportTransform.Inverse.TransformBounds(new Rect(new Point(), ParentMap.RenderSize));
|
||||||
var start = ParentMap.MapTransform.Transform(new Point(bounds.X, bounds.Y));
|
var start = ParentMap.MapTransform.Transform(new Point(bounds.X, bounds.Y));
|
||||||
var end = ParentMap.MapTransform.Transform(new Point(bounds.X + bounds.Width, bounds.Y + bounds.Height));
|
var end = ParentMap.MapTransform.Transform(new Point(bounds.X + bounds.Width, bounds.Y + bounds.Height));
|
||||||
var minSpacing = MinLineSpacing * 360d / (Math.Pow(2d, ParentMap.ZoomLevel) * 256d);
|
var minSpacing = MinLineSpacing * 360d / (Math.Pow(2d, ParentMap.ZoomLevel) * 256d);
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ namespace MapControl
|
||||||
Children.Add(new MapImage { Opacity = 0d });
|
Children.Add(new MapImage { Opacity = 0d });
|
||||||
|
|
||||||
updateTimer.Interval = TileContainer.UpdateInterval;
|
updateTimer.Interval = TileContainer.UpdateInterval;
|
||||||
updateTimer.Tick += (o, e) => UpdateImage();
|
updateTimer.Tick += (s, e) => UpdateImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -119,15 +119,15 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
updateTimer.Stop();
|
updateTimer.Stop();
|
||||||
|
|
||||||
if (ParentMap != null && ActualWidth > 0 && ActualHeight > 0)
|
if (ParentMap != null && RenderSize.Width > 0 && RenderSize.Height > 0)
|
||||||
{
|
{
|
||||||
updateInProgress = true;
|
updateInProgress = true;
|
||||||
|
|
||||||
var relativeSize = Math.Max(RelativeImageSize, 1d);
|
var relativeSize = Math.Max(RelativeImageSize, 1d);
|
||||||
var width = ActualWidth * relativeSize;
|
var width = RenderSize.Width * relativeSize;
|
||||||
var height = ActualHeight * relativeSize;
|
var height = RenderSize.Height * relativeSize;
|
||||||
var dx = (ActualWidth - width) / 2d;
|
var dx = (RenderSize.Width - width) / 2d;
|
||||||
var dy = (ActualHeight - height) / 2d;
|
var dy = (RenderSize.Height - height) / 2d;
|
||||||
|
|
||||||
var loc1 = ParentMap.ViewportPointToLocation(new Point(dx, dy));
|
var loc1 = ParentMap.ViewportPointToLocation(new Point(dx, dy));
|
||||||
var loc2 = ParentMap.ViewportPointToLocation(new Point(dx + width, dy));
|
var loc2 = ParentMap.ViewportPointToLocation(new Point(dx + width, dy));
|
||||||
|
|
|
||||||
|
|
@ -27,5 +27,10 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
return new MapItem();
|
return new MapItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool IsItemItsOwnContainerOverride(object item)
|
||||||
|
{
|
||||||
|
return item is MapItem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,11 @@ namespace MapControl
|
||||||
return new MapItem();
|
return new MapItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool IsItemItsOwnContainerOverride(object item)
|
||||||
|
{
|
||||||
|
return item is MapItem;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a Geometry that selects all items inside its fill area, i.e.
|
/// Gets or sets a Geometry that selects all items inside its fill area, i.e.
|
||||||
/// where Geometry.FillContains returns true for the item's viewport position.
|
/// where Geometry.FillContains returns true for the item's viewport position.
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,8 @@ namespace MapControl
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void AddParentMapHandlers(FrameworkElement element)
|
public static void AddParentMapHandlers(FrameworkElement element)
|
||||||
{
|
{
|
||||||
element.Loaded += (o, e) => GetParentMap(element);
|
element.Loaded += (s, e) => GetParentMap(element);
|
||||||
element.Unloaded += (o, e) => element.ClearValue(ParentMapProperty);
|
element.Unloaded += (s, e) => element.ClearValue(ParentMapProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MapBase GetParentMap(UIElement element)
|
public static MapBase GetParentMap(UIElement element)
|
||||||
|
|
|
||||||
|
|
@ -89,12 +89,15 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
var location = GetLocation(element);
|
var location = GetLocation(element);
|
||||||
|
|
||||||
ArrangeElement(element, finalSize, location != null);
|
|
||||||
|
|
||||||
if (location != null)
|
if (location != null)
|
||||||
{
|
{
|
||||||
|
ArrangeElementWithLocation(element);
|
||||||
SetViewportPosition(element, parentMap, location);
|
SetViewportPosition(element, parentMap, location);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ArrangeElementWithoutLocation(element, finalSize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return finalSize;
|
return finalSize;
|
||||||
|
|
@ -138,9 +141,14 @@ namespace MapControl
|
||||||
var parentMap = mapElement != null ? mapElement.ParentMap : GetParentMap(element);
|
var parentMap = mapElement != null ? mapElement.ParentMap : GetParentMap(element);
|
||||||
var location = e.NewValue as Location;
|
var location = e.NewValue as Location;
|
||||||
|
|
||||||
if ((location != null) != (e.OldValue != null))
|
if (location == null)
|
||||||
{
|
{
|
||||||
ArrangeElement(element, null, location != null);
|
ArrangeElementWithoutLocation(element, Size.Empty);
|
||||||
|
}
|
||||||
|
else if (e.OldValue == null)
|
||||||
|
{
|
||||||
|
// Arrange element once when Location was null before
|
||||||
|
ArrangeElementWithLocation(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetViewportPosition(element, parentMap, location);
|
SetViewportPosition(element, parentMap, location);
|
||||||
|
|
@ -153,7 +161,7 @@ namespace MapControl
|
||||||
|
|
||||||
if (parentMap != null && location != null)
|
if (parentMap != null && location != null)
|
||||||
{
|
{
|
||||||
// keep viewport position near map center
|
// Keep ViewportPosition near map center
|
||||||
var mapPosition = parentMap.MapTransform.Transform(location, parentMap.Center.Longitude);
|
var mapPosition = parentMap.MapTransform.Transform(location, parentMap.Center.Longitude);
|
||||||
viewportPosition = parentMap.ViewportTransform.Transform(mapPosition);
|
viewportPosition = parentMap.ViewportTransform.Transform(mapPosition);
|
||||||
element.SetValue(ViewportPositionProperty, viewportPosition);
|
element.SetValue(ViewportPositionProperty, viewportPosition);
|
||||||
|
|
@ -194,87 +202,92 @@ namespace MapControl
|
||||||
translateTransform.Y = viewportPosition.Y;
|
translateTransform.Y = viewportPosition.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ArrangeElement(UIElement element, Size? panelSize, bool hasLocation)
|
private static void ArrangeElementWithLocation(UIElement element)
|
||||||
{
|
{
|
||||||
var rect = new Rect(0d, 0d, element.DesiredSize.Width, element.DesiredSize.Height);
|
var rect = new Rect(0d, 0d, element.DesiredSize.Width, element.DesiredSize.Height);
|
||||||
var frameworkElement = element as FrameworkElement;
|
var frameworkElement = element as FrameworkElement;
|
||||||
|
|
||||||
if (frameworkElement != null)
|
if (frameworkElement != null)
|
||||||
{
|
{
|
||||||
if (hasLocation)
|
switch (frameworkElement.HorizontalAlignment)
|
||||||
{
|
{
|
||||||
switch (frameworkElement.HorizontalAlignment)
|
case HorizontalAlignment.Center:
|
||||||
{
|
rect.X = -rect.Width / 2d;
|
||||||
case HorizontalAlignment.Center:
|
break;
|
||||||
rect.X = -rect.Width / 2d;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HorizontalAlignment.Right:
|
case HorizontalAlignment.Right:
|
||||||
rect.X = -rect.Width;
|
rect.X = -rect.Width;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
switch (frameworkElement.VerticalAlignment)
|
|
||||||
{
|
|
||||||
case VerticalAlignment.Center:
|
|
||||||
rect.Y = -rect.Height / 2d;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VerticalAlignment.Bottom:
|
|
||||||
rect.Y = -rect.Height;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (frameworkElement.HorizontalAlignment != HorizontalAlignment.Left ||
|
|
||||||
frameworkElement.VerticalAlignment != VerticalAlignment.Top)
|
switch (frameworkElement.VerticalAlignment)
|
||||||
{
|
{
|
||||||
if (!panelSize.HasValue)
|
case VerticalAlignment.Center:
|
||||||
{
|
rect.Y = -rect.Height / 2d;
|
||||||
var panel = frameworkElement.Parent as Panel;
|
break;
|
||||||
panelSize = panel != null ? panel.RenderSize : new Size();
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (frameworkElement.HorizontalAlignment)
|
case VerticalAlignment.Bottom:
|
||||||
{
|
rect.Y = -rect.Height;
|
||||||
case HorizontalAlignment.Center:
|
break;
|
||||||
rect.X = (panelSize.Value.Width - rect.Width) / 2d;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HorizontalAlignment.Right:
|
default:
|
||||||
rect.X = panelSize.Value.Width - rect.Width;
|
break;
|
||||||
break;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
case HorizontalAlignment.Stretch:
|
element.Arrange(rect);
|
||||||
rect.Width = panelSize.Value.Width;
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
private static void ArrangeElementWithoutLocation(UIElement element, Size parentSize)
|
||||||
break;
|
{
|
||||||
}
|
var rect = new Rect(0d, 0d, element.DesiredSize.Width, element.DesiredSize.Height);
|
||||||
|
var frameworkElement = element as FrameworkElement;
|
||||||
|
|
||||||
switch (frameworkElement.VerticalAlignment)
|
if (frameworkElement != null)
|
||||||
{
|
{
|
||||||
case VerticalAlignment.Center:
|
if (parentSize.IsEmpty)
|
||||||
rect.Y = (panelSize.Value.Height - rect.Height) / 2d;
|
{
|
||||||
break;
|
var parent = frameworkElement.Parent as UIElement;
|
||||||
|
parentSize = parent != null ? parent.RenderSize : new Size();
|
||||||
|
}
|
||||||
|
|
||||||
case VerticalAlignment.Bottom:
|
switch (frameworkElement.HorizontalAlignment)
|
||||||
rect.Y = panelSize.Value.Height - rect.Height;
|
{
|
||||||
break;
|
case HorizontalAlignment.Center:
|
||||||
|
rect.X = (parentSize.Width - rect.Width) / 2d;
|
||||||
|
break;
|
||||||
|
|
||||||
case VerticalAlignment.Stretch:
|
case HorizontalAlignment.Right:
|
||||||
rect.Height = panelSize.Value.Height;
|
rect.X = parentSize.Width - rect.Width;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
case HorizontalAlignment.Stretch:
|
||||||
break;
|
rect.Width = parentSize.Width;
|
||||||
}
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (frameworkElement.VerticalAlignment)
|
||||||
|
{
|
||||||
|
case VerticalAlignment.Center:
|
||||||
|
rect.Y = (parentSize.Height - rect.Height) / 2d;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VerticalAlignment.Bottom:
|
||||||
|
rect.Y = parentSize.Height - rect.Height;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VerticalAlignment.Stretch:
|
||||||
|
rect.Height = parentSize.Height;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@ using System.Runtime.InteropServices;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
#if SILVERLIGHT
|
#if SILVERLIGHT
|
||||||
[assembly: AssemblyTitle("Silverlight Map Control")]
|
[assembly: AssemblyTitle("XAML Map Control (Silverlight)")]
|
||||||
[assembly: AssemblyDescription("XAML Map Control Library for Silverlight")]
|
[assembly: AssemblyDescription("XAML Map Control Library for Silverlight")]
|
||||||
#else
|
#else
|
||||||
[assembly: AssemblyTitle("WPF Map Control")]
|
[assembly: AssemblyTitle("XAML Map Control (WPF)")]
|
||||||
[assembly: AssemblyDescription("XAML Map Control Library for WPF")]
|
[assembly: AssemblyDescription("XAML Map Control Library for WPF")]
|
||||||
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
|
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -15,8 +15,8 @@ using System.Windows;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
|
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.12.0")]
|
[assembly: AssemblyVersion("1.12.1")]
|
||||||
[assembly: AssemblyFileVersion("1.12.0")]
|
[assembly: AssemblyFileVersion("1.12.1")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,9 @@ namespace MapControl
|
||||||
|
|
||||||
internal void BeginGetTiles(TileLayer tileLayer, IEnumerable<Tile> tiles)
|
internal void BeginGetTiles(TileLayer tileLayer, IEnumerable<Tile> tiles)
|
||||||
{
|
{
|
||||||
if (tiles.Any())
|
var tileList = tiles.ToList();
|
||||||
|
|
||||||
|
if (tileList.Count > 0)
|
||||||
{
|
{
|
||||||
// get current TileLayer property values in UI thread
|
// get current TileLayer property values in UI thread
|
||||||
var dispatcher = tileLayer.Dispatcher;
|
var dispatcher = tileLayer.Dispatcher;
|
||||||
|
|
@ -76,7 +78,7 @@ namespace MapControl
|
||||||
var animateOpacity = tileLayer.AnimateTileOpacity;
|
var animateOpacity = tileLayer.AnimateTileOpacity;
|
||||||
|
|
||||||
ThreadPool.QueueUserWorkItem(o =>
|
ThreadPool.QueueUserWorkItem(o =>
|
||||||
GetTiles(tiles.ToList(), dispatcher, tileSource, sourceName, maxDownloads, animateOpacity));
|
GetTiles(tileList, dispatcher, tileSource, sourceName, maxDownloads, animateOpacity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,14 +19,15 @@ namespace MapControl
|
||||||
RenderTransform = transform;
|
RenderTransform = transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Panel TileContainer
|
private Panel TileContainer
|
||||||
{
|
{
|
||||||
get { return Parent as Panel; }
|
get { return Parent as Panel; }
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void RenderTiles()
|
private void RenderTiles()
|
||||||
{
|
{
|
||||||
Children.Clear();
|
Children.Clear();
|
||||||
|
|
||||||
foreach (var tile in tiles)
|
foreach (var tile in tiles)
|
||||||
{
|
{
|
||||||
Children.Add(tile.Image);
|
Children.Add(tile.Image);
|
||||||
|
|
|
||||||
|
|
@ -17,12 +17,12 @@ namespace MapControl
|
||||||
|
|
||||||
public Brush Background { get; set; }
|
public Brush Background { get; set; }
|
||||||
|
|
||||||
protected ContainerVisual TileContainer
|
private ContainerVisual TileContainer
|
||||||
{
|
{
|
||||||
get { return Parent as ContainerVisual; }
|
get { return Parent as ContainerVisual; }
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void RenderTiles()
|
private void RenderTiles()
|
||||||
{
|
{
|
||||||
using (var drawingContext = RenderOpen())
|
using (var drawingContext = RenderOpen())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,9 @@ namespace MapControl
|
||||||
|
|
||||||
private readonly MatrixTransform transform = new MatrixTransform();
|
private readonly MatrixTransform transform = new MatrixTransform();
|
||||||
private readonly TileImageLoader tileImageLoader = new TileImageLoader();
|
private readonly TileImageLoader tileImageLoader = new TileImageLoader();
|
||||||
private List<Tile> tiles = new List<Tile>();
|
|
||||||
private string description = string.Empty;
|
private string description = string.Empty;
|
||||||
|
private TileSource tileSource;
|
||||||
|
private List<Tile> tiles = new List<Tile>();
|
||||||
private Int32Rect grid;
|
private Int32Rect grid;
|
||||||
private int zoomLevel;
|
private int zoomLevel;
|
||||||
|
|
||||||
|
|
@ -59,7 +60,6 @@ namespace MapControl
|
||||||
partial void Initialize();
|
partial void Initialize();
|
||||||
|
|
||||||
public string SourceName { get; set; }
|
public string SourceName { get; set; }
|
||||||
public TileSource TileSource { get; set; }
|
|
||||||
public int MinZoomLevel { get; set; }
|
public int MinZoomLevel { get; set; }
|
||||||
public int MaxZoomLevel { get; set; }
|
public int MaxZoomLevel { get; set; }
|
||||||
public int MaxParallelDownloads { get; set; }
|
public int MaxParallelDownloads { get; set; }
|
||||||
|
|
@ -73,10 +73,36 @@ namespace MapControl
|
||||||
set { description = value.Replace("{y}", DateTime.Now.Year.ToString()); }
|
set { description = value.Replace("{y}", DateTime.Now.Year.ToString()); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TileSource TileSource
|
||||||
|
{
|
||||||
|
get { return tileSource; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
tileSource = value;
|
||||||
|
|
||||||
|
if (grid.Width > 0 && grid.Height > 0)
|
||||||
|
{
|
||||||
|
tileImageLoader.CancelGetTiles();
|
||||||
|
tiles.Clear();
|
||||||
|
|
||||||
|
if (tileSource != null)
|
||||||
|
{
|
||||||
|
SelectTiles();
|
||||||
|
RenderTiles();
|
||||||
|
tileImageLoader.BeginGetTiles(this, tiles.Where(t => !t.HasImageSource));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RenderTiles();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string TileSourceUriFormat
|
public string TileSourceUriFormat
|
||||||
{
|
{
|
||||||
get { return TileSource != null ? TileSource.UriFormat : string.Empty; }
|
get { return tileSource != null ? tileSource.UriFormat : string.Empty; }
|
||||||
set { TileSource = new TileSource(value); }
|
set { TileSource = !string.IsNullOrWhiteSpace(value) ? new TileSource(value) : null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void SetTransformMatrix(Matrix transformMatrix)
|
internal void SetTransformMatrix(Matrix transformMatrix)
|
||||||
|
|
@ -84,14 +110,14 @@ namespace MapControl
|
||||||
transform.Matrix = transformMatrix;
|
transform.Matrix = transformMatrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected internal virtual void UpdateTiles(int zoomLevel, Int32Rect grid)
|
internal void UpdateTiles(int zoomLevel, Int32Rect grid)
|
||||||
{
|
{
|
||||||
this.grid = grid;
|
this.grid = grid;
|
||||||
this.zoomLevel = zoomLevel;
|
this.zoomLevel = zoomLevel;
|
||||||
|
|
||||||
tileImageLoader.CancelGetTiles();
|
tileImageLoader.CancelGetTiles();
|
||||||
|
|
||||||
if (TileSource != null)
|
if (tileSource != null)
|
||||||
{
|
{
|
||||||
SelectTiles();
|
SelectTiles();
|
||||||
RenderTiles();
|
RenderTiles();
|
||||||
|
|
@ -99,14 +125,14 @@ namespace MapControl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected internal virtual void ClearTiles()
|
internal void ClearTiles()
|
||||||
{
|
{
|
||||||
tileImageLoader.CancelGetTiles();
|
tileImageLoader.CancelGetTiles();
|
||||||
tiles.Clear();
|
tiles.Clear();
|
||||||
RenderTiles();
|
RenderTiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void SelectTiles()
|
private void SelectTiles()
|
||||||
{
|
{
|
||||||
var maxZoomLevel = Math.Min(zoomLevel, MaxZoomLevel);
|
var maxZoomLevel = Math.Min(zoomLevel, MaxZoomLevel);
|
||||||
var minZoomLevel = maxZoomLevel;
|
var minZoomLevel = maxZoomLevel;
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,9 @@
|
||||||
<DefaultLanguage>en-US</DefaultLanguage>
|
<DefaultLanguage>en-US</DefaultLanguage>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
|
||||||
|
<TargetPlatformIdentifier>Windows</TargetPlatformIdentifier>
|
||||||
<TargetPlatformVersion>8.1</TargetPlatformVersion>
|
<TargetPlatformVersion>8.1</TargetPlatformVersion>
|
||||||
<MinimumVisualStudioVersion>12</MinimumVisualStudioVersion>
|
|
||||||
<TargetFrameworkVersion />
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
[assembly: AssemblyTitle("WinRT Map Control")]
|
[assembly: AssemblyTitle("XAML Map Control (WinRT)")]
|
||||||
[assembly: AssemblyDescription("XAML Map Control Library for Windows Runtime")]
|
[assembly: AssemblyDescription("XAML Map Control Library for Windows Runtime")]
|
||||||
|
|
||||||
[assembly: AssemblyProduct("XAML Map Control")]
|
[assembly: AssemblyProduct("XAML Map Control")]
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
|
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.12.0")]
|
[assembly: AssemblyVersion("1.12.1")]
|
||||||
[assembly: AssemblyFileVersion("1.12.0")]
|
[assembly: AssemblyFileVersion("1.12.1")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ namespace ViewModel
|
||||||
Interval = TimeSpan.FromSeconds(0.1)
|
Interval = TimeSpan.FromSeconds(0.1)
|
||||||
};
|
};
|
||||||
|
|
||||||
timer.Tick += (sender, e) =>
|
timer.Tick += (s, e) =>
|
||||||
{
|
{
|
||||||
var p = Points.Last();
|
var p = Points.Last();
|
||||||
p.Location = new Location(p.Location.Latitude + 0.001, p.Location.Longitude + 0.002);
|
p.Location = new Location(p.Location.Latitude + 0.001, p.Location.Longitude + 0.002);
|
||||||
|
|
@ -181,7 +181,7 @@ namespace ViewModel
|
||||||
if (p.Location.Latitude > 54d)
|
if (p.Location.Latitude > 54d)
|
||||||
{
|
{
|
||||||
p.Name = "Stopped";
|
p.Name = "Stopped";
|
||||||
((DispatcherTimer)sender).Stop();
|
((DispatcherTimer)s).Stop();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
|
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.12.0")]
|
[assembly: AssemblyVersion("1.12.1")]
|
||||||
[assembly: AssemblyFileVersion("1.12.0")]
|
[assembly: AssemblyFileVersion("1.12.1")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,6 @@
|
||||||
</Style>
|
</Style>
|
||||||
<Style x:Key="PointItemStyle" TargetType="map:MapItem">
|
<Style x:Key="PointItemStyle" TargetType="map:MapItem">
|
||||||
<Setter Property="map:MapPanel.Location" Value="{Binding Location}"/>
|
<Setter Property="map:MapPanel.Location" Value="{Binding Location}"/>
|
||||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
|
||||||
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="map:MapItem">
|
<ControlTemplate TargetType="map:MapItem">
|
||||||
|
|
@ -84,7 +82,6 @@
|
||||||
</Style>
|
</Style>
|
||||||
<Style x:Key="PushpinItemStyle" TargetType="map:MapItem">
|
<Style x:Key="PushpinItemStyle" TargetType="map:MapItem">
|
||||||
<Setter Property="map:MapPanel.Location" Value="{Binding Location}"/>
|
<Setter Property="map:MapPanel.Location" Value="{Binding Location}"/>
|
||||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
|
||||||
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
|
|
@ -157,7 +154,7 @@
|
||||||
<Slider Width="100" Minimum="0" Maximum="1"
|
<Slider Width="100" Minimum="0" Maximum="1"
|
||||||
Value="{Binding Opacity, ElementName=mapImage, Mode=TwoWay}"/>
|
Value="{Binding Opacity, ElementName=mapImage, Mode=TwoWay}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<CheckBox Margin="5" VerticalAlignment="Bottom" Content="Seamarks" Click="SeamarksClick"/>
|
<CheckBox Margin="5" VerticalAlignment="Bottom" Content="Seamarks" Checked="SeamarksChecked" Unchecked="SeamarksUnchecked"/>
|
||||||
<ComboBox x:Name="tileLayerComboBox" Margin="5" VerticalAlignment="Bottom" Width="120" SelectionChanged="TileLayerSelectionChanged">
|
<ComboBox x:Name="tileLayerComboBox" Margin="5" VerticalAlignment="Bottom" Width="120" SelectionChanged="TileLayerSelectionChanged">
|
||||||
<sys:String>OpenStreetMap</sys:String>
|
<sys:String>OpenStreetMap</sys:String>
|
||||||
<sys:String>OpenCycleMap</sys:String>
|
<sys:String>OpenCycleMap</sys:String>
|
||||||
|
|
|
||||||
|
|
@ -39,20 +39,14 @@ namespace SilverlightApplication
|
||||||
map.TileLayer = tileLayers[(string)comboBox.SelectedItem];
|
map.TileLayer = tileLayers[(string)comboBox.SelectedItem];
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SeamarksClick(object sender, RoutedEventArgs e)
|
private void SeamarksChecked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var checkBox = (CheckBox)sender;
|
map.TileLayers.Add((TileLayer)((TileLayerCollection)Resources["TileLayers"])["Seamarks"]);
|
||||||
var tileLayers = (TileLayerCollection)Resources["TileLayers"];
|
}
|
||||||
var tileLayer = tileLayers["Seamarks"];
|
|
||||||
|
|
||||||
if ((bool)checkBox.IsChecked)
|
private void SeamarksUnchecked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
map.TileLayers.Add(tileLayer);
|
map.TileLayers.Remove((TileLayer)((TileLayerCollection)Resources["TileLayers"])["Seamarks"]);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
map.TileLayers.Remove(tileLayer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
|
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.12.0")]
|
[assembly: AssemblyVersion("1.12.1")]
|
||||||
[assembly: AssemblyFileVersion("1.12.0")]
|
[assembly: AssemblyFileVersion("1.12.1")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,6 @@
|
||||||
<HintPath>$(TargetFrameworkDirectory)System.Core.dll</HintPath>
|
<HintPath>$(TargetFrameworkDirectory)System.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Net" />
|
<Reference Include="System.Net" />
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
<Reference Include="System.Windows.Browser" />
|
<Reference Include="System.Windows.Browser" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,6 @@
|
||||||
</Style>
|
</Style>
|
||||||
<Style x:Key="PointItemStyle" TargetType="map:MapItem">
|
<Style x:Key="PointItemStyle" TargetType="map:MapItem">
|
||||||
<Setter Property="local:BindingHelper.LocationPath" Value="Location"/>
|
<Setter Property="local:BindingHelper.LocationPath" Value="Location"/>
|
||||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
|
||||||
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
|
||||||
<Setter Property="Foreground" Value="Black"/>
|
<Setter Property="Foreground" Value="Black"/>
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
|
|
@ -104,7 +102,6 @@
|
||||||
</Style>
|
</Style>
|
||||||
<Style x:Key="PushpinItemStyle" TargetType="map:MapItem">
|
<Style x:Key="PushpinItemStyle" TargetType="map:MapItem">
|
||||||
<Setter Property="local:BindingHelper.LocationPath" Value="Location"/>
|
<Setter Property="local:BindingHelper.LocationPath" Value="Location"/>
|
||||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
|
||||||
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
||||||
<Setter Property="Foreground" Value="Black"/>
|
<Setter Property="Foreground" Value="Black"/>
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
|
|
@ -182,7 +179,7 @@
|
||||||
<TextBlock Text="Image Opacity" HorizontalAlignment="Center" Foreground="Gray" FontSize="14"/>
|
<TextBlock Text="Image Opacity" HorizontalAlignment="Center" Foreground="Gray" FontSize="14"/>
|
||||||
<Slider Margin="10,-10,10,-10" Width="200" Value="50" ValueChanged="ImageOpacitySliderValueChanged"/>
|
<Slider Margin="10,-10,10,-10" Width="200" Value="50" ValueChanged="ImageOpacitySliderValueChanged"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<CheckBox Margin="10" VerticalAlignment="Center" Content="Seamarks" Click="SeamarksClick"/>
|
<CheckBox Margin="10" VerticalAlignment="Center" Content="Seamarks" Checked="SeamarksChecked" Unchecked="SeamarksUnchecked"/>
|
||||||
<ComboBox x:Name="tileLayerComboBox" Margin="10" Width="200" VerticalAlignment="Center" SelectionChanged="TileLayerSelectionChanged">
|
<ComboBox x:Name="tileLayerComboBox" Margin="10" Width="200" VerticalAlignment="Center" SelectionChanged="TileLayerSelectionChanged">
|
||||||
<ComboBoxItem>OpenStreetMap</ComboBoxItem>
|
<ComboBoxItem>OpenStreetMap</ComboBoxItem>
|
||||||
<ComboBoxItem>OpenCycleMap</ComboBoxItem>
|
<ComboBoxItem>OpenCycleMap</ComboBoxItem>
|
||||||
|
|
|
||||||
|
|
@ -21,27 +21,21 @@ namespace StoreApplication
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SeamarksClick(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
var checkBox = (CheckBox)sender;
|
|
||||||
var tileLayers = (TileLayerCollection)Resources["TileLayers"];
|
|
||||||
var tileLayer = tileLayers["Seamarks"];
|
|
||||||
|
|
||||||
if ((bool)checkBox.IsChecked)
|
|
||||||
{
|
|
||||||
map.TileLayers.Add(tileLayer);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
map.TileLayers.Remove(tileLayer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void TileLayerSelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void TileLayerSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
var comboBox = (ComboBox)sender;
|
var comboBox = (ComboBox)sender;
|
||||||
var tileLayers = (TileLayerCollection)Resources["TileLayers"];
|
var tileLayers = (TileLayerCollection)Resources["TileLayers"];
|
||||||
map.TileLayer = tileLayers[(string)((ComboBoxItem)comboBox.SelectedItem).Content];
|
map.TileLayer = tileLayers[(string)((ComboBoxItem)comboBox.SelectedItem).Content];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SeamarksChecked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
map.TileLayers.Add((TileLayer)((TileLayerCollection)Resources["TileLayers"])["Seamarks"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SeamarksUnchecked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
map.TileLayers.Remove((TileLayer)((TileLayerCollection)Resources["TileLayers"])["Seamarks"]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
|
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.12.0")]
|
[assembly: AssemblyVersion("1.12.1")]
|
||||||
[assembly: AssemblyFileVersion("1.12.0")]
|
[assembly: AssemblyFileVersion("1.12.1")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
|
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.12.0")]
|
[assembly: AssemblyVersion("1.12.1")]
|
||||||
[assembly: AssemblyFileVersion("1.12.0")]
|
[assembly: AssemblyFileVersion("1.12.1")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -66,8 +66,6 @@
|
||||||
</Style>
|
</Style>
|
||||||
<Style x:Key="PointItemStyle" TargetType="map:MapItem">
|
<Style x:Key="PointItemStyle" TargetType="map:MapItem">
|
||||||
<Setter Property="map:MapPanel.Location" Value="{Binding Location}"/>
|
<Setter Property="map:MapPanel.Location" Value="{Binding Location}"/>
|
||||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
|
||||||
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="map:MapItem">
|
<ControlTemplate TargetType="map:MapItem">
|
||||||
|
|
@ -124,7 +122,6 @@
|
||||||
</MultiBinding>
|
</MultiBinding>
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
|
||||||
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
|
|
@ -224,7 +221,8 @@
|
||||||
<Slider ToolTip="Image Opacity" Width="100" VerticalAlignment="Center"
|
<Slider ToolTip="Image Opacity" Width="100" VerticalAlignment="Center"
|
||||||
Minimum="0" Maximum="1" Value="{Binding Opacity, ElementName=mapImage}"/>
|
Minimum="0" Maximum="1" Value="{Binding Opacity, ElementName=mapImage}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<CheckBox ToolTip="Seamarks Overlay" Margin="7" VerticalAlignment="Bottom" Content="Seamarks" Click="SeamarksClick"/>
|
<CheckBox ToolTip="Seamarks Overlay" Margin="7" VerticalAlignment="Bottom" Content="Seamarks"
|
||||||
|
Checked="SeamarksChecked" Unchecked="SeamarksUnchecked"/>
|
||||||
<ComboBox ToolTip="Tile Layer" Margin="5" VerticalAlignment="Bottom" DisplayMemberPath="SourceName"
|
<ComboBox ToolTip="Tile Layer" Margin="5" VerticalAlignment="Bottom" DisplayMemberPath="SourceName"
|
||||||
SelectedIndex="0" ItemsSource="{Binding Source={StaticResource TileLayersViewSource}}"/>
|
SelectedIndex="0" ItemsSource="{Binding Source={StaticResource TileLayersViewSource}}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
|
||||||
|
|
@ -78,19 +78,14 @@ namespace WpfApplication
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SeamarksClick(object sender, RoutedEventArgs e)
|
private void SeamarksChecked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var seamarks = (TileLayer)Resources["SeamarksTileLayer"];
|
map.TileLayers.Add((TileLayer)Resources["SeamarksTileLayer"]);
|
||||||
var checkBox = (CheckBox)sender;
|
}
|
||||||
|
|
||||||
if ((bool)checkBox.IsChecked)
|
private void SeamarksUnchecked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
map.TileLayers.Add(seamarks);
|
map.TileLayers.Remove((TileLayer)Resources["SeamarksTileLayer"]);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
map.TileLayers.Remove(seamarks);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyCompany("Clemens Fischer")]
|
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
|
[assembly: AssemblyCopyright("Copyright © 2014 Clemens Fischer")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyVersion("1.12.0")]
|
[assembly: AssemblyVersion("1.12.1")]
|
||||||
[assembly: AssemblyFileVersion("1.12.0")]
|
[assembly: AssemblyFileVersion("1.12.1")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// This code was generated by a tool.
|
||||||
// Runtime Version:4.0.30319.34003
|
// Runtime Version:4.0.30319.34014
|
||||||
//
|
//
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
// the code is regenerated.
|
// the code is regenerated.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue