mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
MapPanel implementation
This commit is contained in:
parent
ece82bd654
commit
7b45efd33e
|
|
@ -213,12 +213,12 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
var point = MapProjection.LocationToMap(location);
|
var point = MapProjection.LocationToMap(location);
|
||||||
|
|
||||||
if (!point.HasValue)
|
if (point.HasValue)
|
||||||
{
|
{
|
||||||
return null;
|
point = ViewTransform.MapToView(point.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ViewTransform.MapToView(point.Value);
|
return point;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -191,8 +191,7 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
var position = parentMap.LocationToView(location);
|
var position = parentMap.LocationToView(location);
|
||||||
|
|
||||||
if (parentMap.MapProjection.Type <= MapProjectionType.NormalCylindrical &&
|
if (IsOutsideViewport(position) && parentMap.MapProjection.Type <= MapProjectionType.NormalCylindrical)
|
||||||
IsOutsideViewport(position))
|
|
||||||
{
|
{
|
||||||
position = parentMap.LocationToView(
|
position = parentMap.LocationToView(
|
||||||
new Location(location.Latitude, parentMap.CoerceLongitude(location.Longitude)));
|
new Location(location.Latitude, parentMap.CoerceLongitude(location.Longitude)));
|
||||||
|
|
@ -219,8 +218,7 @@ namespace MapControl
|
||||||
var position = parentMap.ViewTransform.MapToView(rectCenter);
|
var position = parentMap.ViewTransform.MapToView(rectCenter);
|
||||||
var projection = parentMap.MapProjection;
|
var projection = parentMap.MapProjection;
|
||||||
|
|
||||||
if (projection.Type <= MapProjectionType.NormalCylindrical &&
|
if (IsOutsideViewport(position) && projection.Type <= MapProjectionType.NormalCylindrical)
|
||||||
IsOutsideViewport(position))
|
|
||||||
{
|
{
|
||||||
var location = projection.MapToLocation(rectCenter);
|
var location = projection.MapToLocation(rectCenter);
|
||||||
|
|
||||||
|
|
@ -258,21 +256,24 @@ namespace MapControl
|
||||||
private void ArrangeChildElement(FrameworkElement element, Size panelSize)
|
private void ArrangeChildElement(FrameworkElement element, Size panelSize)
|
||||||
{
|
{
|
||||||
var location = GetLocation(element);
|
var location = GetLocation(element);
|
||||||
var position = location != null ? GetViewPosition(location) : null;
|
|
||||||
|
|
||||||
SetViewPosition(element, ref position);
|
if (location != null)
|
||||||
|
|
||||||
if (GetAutoCollapse(element))
|
|
||||||
{
|
{
|
||||||
SetVisible(element, !IsOutsideViewport(position));
|
var position = GetViewPosition(location);
|
||||||
}
|
|
||||||
|
SetViewPosition(element, ref position);
|
||||||
|
|
||||||
|
if (GetAutoCollapse(element))
|
||||||
|
{
|
||||||
|
SetVisible(element, !IsOutsideViewport(position));
|
||||||
|
}
|
||||||
|
|
||||||
if (position.HasValue)
|
|
||||||
{
|
|
||||||
ArrangeElement(element, position.Value);
|
ArrangeElement(element, position.Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
element.ClearValue(ViewPositionProperty);
|
||||||
|
|
||||||
var boundingBox = GetBoundingBox(element);
|
var boundingBox = GetBoundingBox(element);
|
||||||
|
|
||||||
if (boundingBox != null)
|
if (boundingBox != null)
|
||||||
|
|
@ -394,19 +395,17 @@ namespace MapControl
|
||||||
|
|
||||||
internal static Size GetDesiredSize(FrameworkElement element)
|
internal static Size GetDesiredSize(FrameworkElement element)
|
||||||
{
|
{
|
||||||
var width = 0d;
|
var width = element.DesiredSize.Width;
|
||||||
var height = 0d;
|
var height = element.DesiredSize.Height;
|
||||||
|
|
||||||
if (element.DesiredSize.Width >= 0d &&
|
if (width < 0d || width == double.PositiveInfinity)
|
||||||
element.DesiredSize.Width < double.PositiveInfinity)
|
|
||||||
{
|
{
|
||||||
width = element.DesiredSize.Width;
|
width = 0d;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (element.DesiredSize.Height >= 0d &&
|
if (height < 0d || height == double.PositiveInfinity)
|
||||||
element.DesiredSize.Height < double.PositiveInfinity)
|
|
||||||
{
|
{
|
||||||
height = element.DesiredSize.Height;
|
height = 0d;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Size(width, height);
|
return new Size(width, height);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue