mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 22:46:58 +00:00
Use C# 7
This commit is contained in:
parent
3ffb613f80
commit
310f0cca9a
21 changed files with 51 additions and 86 deletions
|
|
@ -16,16 +16,9 @@ namespace MapControl
|
|||
/// </summary>
|
||||
public abstract class AzimuthalProjection : MapProjection
|
||||
{
|
||||
public override bool IsNormalCylindrical
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override Rect BoundingBoxToRect(BoundingBox boundingBox)
|
||||
{
|
||||
var cbbox = boundingBox as CenteredBoundingBox;
|
||||
|
||||
if (cbbox != null)
|
||||
if (boundingBox is CenteredBoundingBox cbbox)
|
||||
{
|
||||
var center = LocationToMap(cbbox.Center);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,11 @@ namespace MapControl
|
|||
CrsId = "EPSG:4326";
|
||||
}
|
||||
|
||||
public override bool IsNormalCylindrical
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override Vector GetRelativeScale(Location location)
|
||||
{
|
||||
return new Vector(
|
||||
|
|
|
|||
|
|
@ -388,8 +388,7 @@ namespace MapControl
|
|||
{
|
||||
Children.Remove(oldLayer);
|
||||
|
||||
var mapLayer = oldLayer as IMapLayer;
|
||||
if (mapLayer != null)
|
||||
if (oldLayer is IMapLayer mapLayer)
|
||||
{
|
||||
if (mapLayer.MapBackground != null)
|
||||
{
|
||||
|
|
@ -406,8 +405,7 @@ namespace MapControl
|
|||
{
|
||||
Children.Insert(0, newLayer);
|
||||
|
||||
var mapLayer = newLayer as IMapLayer;
|
||||
if (mapLayer != null)
|
||||
if (newLayer is IMapLayer mapLayer)
|
||||
{
|
||||
if (mapLayer.MapBackground != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -228,9 +228,7 @@ namespace MapControl
|
|||
element.Height = rect.Height;
|
||||
element.Arrange(rect);
|
||||
|
||||
var rotateTransform = element.RenderTransform as RotateTransform;
|
||||
|
||||
if (rotateTransform != null)
|
||||
if (element.RenderTransform is RotateTransform rotateTransform)
|
||||
{
|
||||
rotateTransform.Angle = parentMap.ViewTransform.Rotation;
|
||||
}
|
||||
|
|
@ -293,9 +291,7 @@ namespace MapControl
|
|||
|
||||
private static void ParentMapPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var mapElement = obj as IMapElement;
|
||||
|
||||
if (mapElement != null)
|
||||
if (obj is IMapElement mapElement)
|
||||
{
|
||||
mapElement.ParentMap = e.NewValue as MapBase;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ namespace MapControl
|
|||
/// </summary>
|
||||
public virtual bool IsNormalCylindrical
|
||||
{
|
||||
get { return true; }
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -26,9 +26,7 @@ namespace MapControl
|
|||
|
||||
protected override void InsertItem(int index, IEnumerable<Location> polygon)
|
||||
{
|
||||
var observablePolygon = polygon as INotifyCollectionChanged;
|
||||
|
||||
if (observablePolygon != null)
|
||||
if (polygon is INotifyCollectionChanged observablePolygon)
|
||||
{
|
||||
CollectionChangedEventManager.AddListener(observablePolygon, this);
|
||||
}
|
||||
|
|
@ -38,9 +36,7 @@ namespace MapControl
|
|||
|
||||
protected override void SetItem(int index, IEnumerable<Location> polygon)
|
||||
{
|
||||
var observablePolygon = this[index] as INotifyCollectionChanged;
|
||||
|
||||
if (observablePolygon != null)
|
||||
if (this[index] is INotifyCollectionChanged observablePolygon)
|
||||
{
|
||||
CollectionChangedEventManager.RemoveListener(observablePolygon, this);
|
||||
}
|
||||
|
|
@ -50,9 +46,7 @@ namespace MapControl
|
|||
|
||||
protected override void RemoveItem(int index)
|
||||
{
|
||||
var observablePolygon = this[index] as INotifyCollectionChanged;
|
||||
|
||||
if (observablePolygon != null)
|
||||
if (this[index] is INotifyCollectionChanged observablePolygon)
|
||||
{
|
||||
CollectionChangedEventManager.RemoveListener(observablePolygon, this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,11 @@ namespace MapControl
|
|||
CrsId = "EPSG:3857";
|
||||
}
|
||||
|
||||
public override bool IsNormalCylindrical
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool IsWebMercator
|
||||
{
|
||||
get { return true; }
|
||||
|
|
|
|||
|
|
@ -25,6 +25,11 @@ namespace MapControl
|
|||
CrsId = "EPSG:3395";
|
||||
}
|
||||
|
||||
public override bool IsNormalCylindrical
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override double MaxLatitude
|
||||
{
|
||||
get { return maxLatitude; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue