diff --git a/MapControl/Shared/BoundingBox.cs b/MapControl/Shared/BoundingBox.cs index ecb4d26b..a0151a50 100644 --- a/MapControl/Shared/BoundingBox.cs +++ b/MapControl/Shared/BoundingBox.cs @@ -42,31 +42,31 @@ namespace MapControl public double South { - get { return south; } - set { south = Math.Min(Math.Max(value, -90d), 90d); } + get => south; + set => south = Math.Min(Math.Max(value, -90d), 90d); } public double North { - get { return north; } - set { north = Math.Min(Math.Max(value, -90d), 90d); } + get => north; + set => north = Math.Min(Math.Max(value, -90d), 90d); } public virtual double Width { - get { return East - West; } + get => East - West; protected set { } } public virtual double Height { - get { return North - South; } + get => North - South; protected set { } } public virtual Location Center { - get { return new Location((South + North) / 2d, (West + East) / 2d); } + get => new Location((South + North) / 2d, (West + East) / 2d); protected set { } } diff --git a/MapControl/Shared/GeoImage.cs b/MapControl/Shared/GeoImage.cs index f5c3ff6a..8857938b 100644 --- a/MapControl/Shared/GeoImage.cs +++ b/MapControl/Shared/GeoImage.cs @@ -41,8 +41,8 @@ namespace MapControl public string SourcePath { - get { return (string)GetValue(SourcePathProperty); } - set { SetValue(SourcePathProperty, value); } + get => (string)GetValue(SourcePathProperty); + set => SetValue(SourcePathProperty, value); } public GeoImage() diff --git a/MapControl/Shared/GroundOverlay.cs b/MapControl/Shared/GroundOverlay.cs index f5fde74b..04918680 100644 --- a/MapControl/Shared/GroundOverlay.cs +++ b/MapControl/Shared/GroundOverlay.cs @@ -61,8 +61,8 @@ namespace MapControl public string SourcePath { - get { return (string)GetValue(SourcePathProperty); } - set { SetValue(SourcePathProperty, value); } + get => (string)GetValue(SourcePathProperty); + set => SetValue(SourcePathProperty, value); } private async Task SourcePathPropertyChanged(string sourcePath) diff --git a/MapControl/Shared/Location.cs b/MapControl/Shared/Location.cs index e0ef4549..e17217f3 100644 --- a/MapControl/Shared/Location.cs +++ b/MapControl/Shared/Location.cs @@ -29,8 +29,8 @@ namespace MapControl public double Latitude { - get { return latitude; } - set { latitude = Math.Min(Math.Max(value, -90d), 90d); } + get => latitude; + set => latitude = Math.Min(Math.Max(value, -90d), 90d); } public double Longitude { get; set; } diff --git a/MapControl/Shared/MapBase.cs b/MapControl/Shared/MapBase.cs index 2bafd8a7..a2183bb2 100644 --- a/MapControl/Shared/MapBase.cs +++ b/MapControl/Shared/MapBase.cs @@ -85,8 +85,8 @@ namespace MapControl /// public Brush Foreground { - get { return (Brush)GetValue(ForegroundProperty); } - set { SetValue(ForegroundProperty, value); } + get => (Brush)GetValue(ForegroundProperty); + set => SetValue(ForegroundProperty, value); } /// @@ -96,8 +96,8 @@ namespace MapControl /// public UIElement MapLayer { - get { return (UIElement)GetValue(MapLayerProperty); } - set { SetValue(MapLayerProperty, value); } + get => (UIElement)GetValue(MapLayerProperty); + set => SetValue(MapLayerProperty, value); } /// @@ -105,8 +105,8 @@ namespace MapControl /// public MapProjection MapProjection { - get { return (MapProjection)GetValue(MapProjectionProperty); } - set { SetValue(MapProjectionProperty, value); } + get => (MapProjection)GetValue(MapProjectionProperty); + set => SetValue(MapProjectionProperty, value); } /// @@ -115,8 +115,8 @@ namespace MapControl /// public Location ProjectionCenter { - get { return (Location)GetValue(ProjectionCenterProperty); } - set { SetValue(ProjectionCenterProperty, value); } + get => (Location)GetValue(ProjectionCenterProperty); + set => SetValue(ProjectionCenterProperty, value); } /// @@ -124,8 +124,8 @@ namespace MapControl /// public Location Center { - get { return (Location)GetValue(CenterProperty); } - set { SetValue(CenterProperty, value); } + get => (Location)GetValue(CenterProperty); + set => SetValue(CenterProperty, value); } /// @@ -133,8 +133,8 @@ namespace MapControl /// public Location TargetCenter { - get { return (Location)GetValue(TargetCenterProperty); } - set { SetValue(TargetCenterProperty, value); } + get => (Location)GetValue(TargetCenterProperty); + set => SetValue(TargetCenterProperty, value); } /// @@ -144,8 +144,8 @@ namespace MapControl /// public double MinZoomLevel { - get { return (double)GetValue(MinZoomLevelProperty); } - set { SetValue(MinZoomLevelProperty, value); } + get => (double)GetValue(MinZoomLevelProperty); + set => SetValue(MinZoomLevelProperty, value); } /// @@ -155,8 +155,8 @@ namespace MapControl /// public double MaxZoomLevel { - get { return (double)GetValue(MaxZoomLevelProperty); } - set { SetValue(MaxZoomLevelProperty, value); } + get => (double)GetValue(MaxZoomLevelProperty); + set => SetValue(MaxZoomLevelProperty, value); } /// @@ -164,8 +164,8 @@ namespace MapControl /// public double ZoomLevel { - get { return (double)GetValue(ZoomLevelProperty); } - set { SetValue(ZoomLevelProperty, value); } + get => (double)GetValue(ZoomLevelProperty); + set => SetValue(ZoomLevelProperty, value); } /// @@ -173,8 +173,8 @@ namespace MapControl /// public double TargetZoomLevel { - get { return (double)GetValue(TargetZoomLevelProperty); } - set { SetValue(TargetZoomLevelProperty, value); } + get => (double)GetValue(TargetZoomLevelProperty); + set => SetValue(TargetZoomLevelProperty, value); } /// @@ -182,8 +182,8 @@ namespace MapControl /// public double Heading { - get { return (double)GetValue(HeadingProperty); } - set { SetValue(HeadingProperty, value); } + get => (double)GetValue(HeadingProperty); + set => SetValue(HeadingProperty, value); } /// @@ -191,8 +191,8 @@ namespace MapControl /// public double TargetHeading { - get { return (double)GetValue(TargetHeadingProperty); } - set { SetValue(TargetHeadingProperty, value); } + get => (double)GetValue(TargetHeadingProperty); + set => SetValue(TargetHeadingProperty, value); } /// @@ -201,8 +201,8 @@ namespace MapControl /// public TimeSpan AnimationDuration { - get { return (TimeSpan)GetValue(AnimationDurationProperty); } - set { SetValue(AnimationDurationProperty, value); } + get => (TimeSpan)GetValue(AnimationDurationProperty); + set => SetValue(AnimationDurationProperty, value); } /// @@ -211,18 +211,15 @@ namespace MapControl /// public EasingFunctionBase AnimationEasingFunction { - get { return (EasingFunctionBase)GetValue(AnimationEasingFunctionProperty); } - set { SetValue(AnimationEasingFunctionProperty, value); } + get => (EasingFunctionBase)GetValue(AnimationEasingFunctionProperty); + set => SetValue(AnimationEasingFunctionProperty, value); } /// /// Gets the scaling factor from cartesian map coordinates to view coordinates, /// i.e. pixels per meter, as a read-only dependency property. /// - public double ViewScale - { - get { return (double)GetValue(ViewScaleProperty); } - } + public double ViewScale => (double)GetValue(ViewScaleProperty); /// /// Gets the ViewTransform instance that is used to transform between cartesian map coordinates diff --git a/MapControl/Shared/MapGraticule.cs b/MapControl/Shared/MapGraticule.cs index 3c37466f..44276d06 100644 --- a/MapControl/Shared/MapGraticule.cs +++ b/MapControl/Shared/MapGraticule.cs @@ -57,8 +57,8 @@ namespace MapControl /// public double MinLineDistance { - get { return (double)GetValue(MinLineDistanceProperty); } - set { SetValue(MinLineDistanceProperty, value); } + get => (double)GetValue(MinLineDistanceProperty); + set => SetValue(MinLineDistanceProperty, value); } private void SetLineDistance() diff --git a/MapControl/Shared/MapImageLayer.cs b/MapControl/Shared/MapImageLayer.cs index fa7f2176..8a683126 100644 --- a/MapControl/Shared/MapImageLayer.cs +++ b/MapControl/Shared/MapImageLayer.cs @@ -74,8 +74,8 @@ namespace MapControl /// public string Description { - get { return (string)GetValue(DescriptionProperty); } - set { SetValue(DescriptionProperty, value); } + get => (string)GetValue(DescriptionProperty); + set => SetValue(DescriptionProperty, value); } /// @@ -85,8 +85,8 @@ namespace MapControl /// public double RelativeImageSize { - get { return (double)GetValue(RelativeImageSizeProperty); } - set { SetValue(RelativeImageSizeProperty, value); } + get => (double)GetValue(RelativeImageSizeProperty); + set => SetValue(RelativeImageSizeProperty, value); } /// @@ -94,8 +94,8 @@ namespace MapControl /// public TimeSpan UpdateInterval { - get { return (TimeSpan)GetValue(UpdateIntervalProperty); } - set { SetValue(UpdateIntervalProperty, value); } + get => (TimeSpan)GetValue(UpdateIntervalProperty); + set => SetValue(UpdateIntervalProperty, value); } /// @@ -103,8 +103,8 @@ namespace MapControl /// public bool UpdateWhileViewportChanging { - get { return (bool)GetValue(UpdateWhileViewportChangingProperty); } - set { SetValue(UpdateWhileViewportChangingProperty, value); } + get => (bool)GetValue(UpdateWhileViewportChangingProperty); + set => SetValue(UpdateWhileViewportChangingProperty, value); } /// @@ -112,8 +112,8 @@ namespace MapControl /// public Brush MapBackground { - get { return (Brush)GetValue(MapBackgroundProperty); } - set { SetValue(MapBackgroundProperty, value); } + get => (Brush)GetValue(MapBackgroundProperty); + set => SetValue(MapBackgroundProperty, value); } /// @@ -121,8 +121,8 @@ namespace MapControl /// public Brush MapForeground { - get { return (Brush)GetValue(MapForegroundProperty); } - set { SetValue(MapForegroundProperty, value); } + get => (Brush)GetValue(MapForegroundProperty); + set => SetValue(MapForegroundProperty, value); } /// @@ -130,8 +130,8 @@ namespace MapControl /// public double LoadingProgress { - get { return (double)GetValue(LoadingProgressProperty); } - private set { SetValue(LoadingProgressProperty, value); } + get => (double)GetValue(LoadingProgressProperty); + private set => SetValue(LoadingProgressProperty, value); } /// diff --git a/MapControl/Shared/MapItemsControl.cs b/MapControl/Shared/MapItemsControl.cs index f544c936..f5da9242 100644 --- a/MapControl/Shared/MapItemsControl.cs +++ b/MapControl/Shared/MapItemsControl.cs @@ -36,8 +36,8 @@ namespace MapControl /// public bool AutoCollapse { - get { return (bool)GetValue(AutoCollapseProperty); } - set { SetValue(AutoCollapseProperty, value); } + get => (bool)GetValue(AutoCollapseProperty); + set => SetValue(AutoCollapseProperty, value); } /// @@ -45,8 +45,8 @@ namespace MapControl /// public Location Location { - get { return (Location)GetValue(LocationProperty); } - set { SetValue(LocationProperty, value); } + get => (Location)GetValue(LocationProperty); + set => SetValue(LocationProperty, value); } /// @@ -54,8 +54,8 @@ namespace MapControl /// public string LocationMemberPath { - get { return (string)GetValue(LocationMemberPathProperty); } - set { SetValue(LocationMemberPathProperty, value); } + get => (string)GetValue(LocationMemberPathProperty); + set => SetValue(LocationMemberPathProperty, value); } } diff --git a/MapControl/Shared/MapOverlay.cs b/MapControl/Shared/MapOverlay.cs index f6102f37..edbddc75 100644 --- a/MapControl/Shared/MapOverlay.cs +++ b/MapControl/Shared/MapOverlay.cs @@ -22,92 +22,92 @@ namespace MapControl { public FontFamily FontFamily { - get { return (FontFamily)GetValue(FontFamilyProperty); } - set { SetValue(FontFamilyProperty, value); } + get => (FontFamily)GetValue(FontFamilyProperty); + set => SetValue(FontFamilyProperty, value); } public double FontSize { - get { return (double)GetValue(FontSizeProperty); } - set { SetValue(FontSizeProperty, value); } + get => (double)GetValue(FontSizeProperty); + set => SetValue(FontSizeProperty, value); } public FontStyle FontStyle { - get { return (FontStyle)GetValue(FontStyleProperty); } - set { SetValue(FontStyleProperty, value); } + get => (FontStyle)GetValue(FontStyleProperty); + set => SetValue(FontStyleProperty, value); } public FontStretch FontStretch { - get { return (FontStretch)GetValue(FontStretchProperty); } - set { SetValue(FontStretchProperty, value); } + get => (FontStretch)GetValue(FontStretchProperty); + set => SetValue(FontStretchProperty, value); } public FontWeight FontWeight { - get { return (FontWeight)GetValue(FontWeightProperty); } - set { SetValue(FontWeightProperty, value); } + get => (FontWeight)GetValue(FontWeightProperty); + set => SetValue(FontWeightProperty, value); } public Brush Foreground { - get { return (Brush)GetValue(ForegroundProperty); } - set { SetValue(ForegroundProperty, value); } + get => (Brush)GetValue(ForegroundProperty); + set => SetValue(ForegroundProperty, value); } public Brush Stroke { - get { return (Brush)GetValue(StrokeProperty); } - set { SetValue(StrokeProperty, value); } + get => (Brush)GetValue(StrokeProperty); + set => SetValue(StrokeProperty, value); } public double StrokeThickness { - get { return (double)GetValue(StrokeThicknessProperty); } - set { SetValue(StrokeThicknessProperty, value); } + get => (double)GetValue(StrokeThicknessProperty); + set => SetValue(StrokeThicknessProperty, value); } public DoubleCollection StrokeDashArray { - get { return (DoubleCollection)GetValue(StrokeDashArrayProperty); } - set { SetValue(StrokeDashArrayProperty, value); } + get => (DoubleCollection)GetValue(StrokeDashArrayProperty); + set => SetValue(StrokeDashArrayProperty, value); } public double StrokeDashOffset { - get { return (double)GetValue(StrokeDashOffsetProperty); } - set { SetValue(StrokeDashOffsetProperty, value); } + get => (double)GetValue(StrokeDashOffsetProperty); + set => SetValue(StrokeDashOffsetProperty, value); } public PenLineCap StrokeDashCap { - get { return (PenLineCap)GetValue(StrokeDashCapProperty); } - set { SetValue(StrokeDashCapProperty, value); } + get => (PenLineCap)GetValue(StrokeDashCapProperty); + set => SetValue(StrokeDashCapProperty, value); } public PenLineCap StrokeStartLineCap { - get { return (PenLineCap)GetValue(StrokeStartLineCapProperty); } - set { SetValue(StrokeStartLineCapProperty, value); } + get => (PenLineCap)GetValue(StrokeStartLineCapProperty); + set => SetValue(StrokeStartLineCapProperty, value); } public PenLineCap StrokeEndLineCap { - get { return (PenLineCap)GetValue(StrokeEndLineCapProperty); } - set { SetValue(StrokeEndLineCapProperty, value); } + get => (PenLineCap)GetValue(StrokeEndLineCapProperty); + set => SetValue(StrokeEndLineCapProperty, value); } public PenLineJoin StrokeLineJoin { - get { return (PenLineJoin)GetValue(StrokeLineJoinProperty); } - set { SetValue(StrokeLineJoinProperty, value); } + get => (PenLineJoin)GetValue(StrokeLineJoinProperty); + set => SetValue(StrokeLineJoinProperty, value); } public double StrokeMiterLimit { - get { return (double)GetValue(StrokeMiterLimitProperty); } - set { SetValue(StrokeMiterLimitProperty, value); } + get => (double)GetValue(StrokeMiterLimitProperty); + set => SetValue(StrokeMiterLimitProperty, value); } } } diff --git a/MapControl/Shared/MapPanel.cs b/MapControl/Shared/MapPanel.cs index 78515e07..c1fb5d7e 100644 --- a/MapControl/Shared/MapPanel.cs +++ b/MapControl/Shared/MapPanel.cs @@ -45,8 +45,8 @@ namespace MapControl public MapBase ParentMap { - get { return parentMap; } - set { SetParentMap(value); } + get => parentMap; + set => SetParentMap(value); } /// diff --git a/MapControl/Shared/MapPath.cs b/MapControl/Shared/MapPath.cs index 08079599..faa409ba 100644 --- a/MapControl/Shared/MapPath.cs +++ b/MapControl/Shared/MapPath.cs @@ -36,13 +36,13 @@ namespace MapControl /// public Location Location { - get { return (Location)GetValue(LocationProperty); } - set { SetValue(LocationProperty, value); } + get => (Location)GetValue(LocationProperty); + set => SetValue(LocationProperty, value); } public MapBase ParentMap { - get { return parentMap; } + get => parentMap; set { if (parentMap != null) diff --git a/MapControl/Shared/MapPolygon.cs b/MapControl/Shared/MapPolygon.cs index e4492de8..4580e670 100644 --- a/MapControl/Shared/MapPolygon.cs +++ b/MapControl/Shared/MapPolygon.cs @@ -34,8 +34,8 @@ namespace MapControl #endif public IEnumerable Locations { - get { return (IEnumerable)GetValue(LocationsProperty); } - set { SetValue(LocationsProperty, value); } + get => (IEnumerable)GetValue(LocationsProperty); + set => SetValue(LocationsProperty, value); } public MapPolygon() diff --git a/MapControl/Shared/MapPolyline.cs b/MapControl/Shared/MapPolyline.cs index 1de46f2c..a321ddd2 100644 --- a/MapControl/Shared/MapPolyline.cs +++ b/MapControl/Shared/MapPolyline.cs @@ -34,8 +34,8 @@ namespace MapControl #endif public IEnumerable Locations { - get { return (IEnumerable)GetValue(LocationsProperty); } - set { SetValue(LocationsProperty, value); } + get => (IEnumerable)GetValue(LocationsProperty); + set => SetValue(LocationsProperty, value); } public MapPolyline() diff --git a/MapControl/Shared/MapScale.cs b/MapControl/Shared/MapScale.cs index 6e32caae..71ea8dc4 100644 --- a/MapControl/Shared/MapScale.cs +++ b/MapControl/Shared/MapScale.cs @@ -63,8 +63,8 @@ namespace MapControl public Thickness Padding { - get { return (Thickness)GetValue(PaddingProperty); } - set { SetValue(PaddingProperty, value); } + get => (Thickness)GetValue(PaddingProperty); + set => SetValue(PaddingProperty, value); } protected override Size MeasureOverride(Size availableSize) diff --git a/MapControl/Shared/MapTileLayer.cs b/MapControl/Shared/MapTileLayer.cs index 8f1a9edd..7946eb5c 100644 --- a/MapControl/Shared/MapTileLayer.cs +++ b/MapControl/Shared/MapTileLayer.cs @@ -34,18 +34,12 @@ namespace MapControl /// /// A default MapTileLayer using OpenStreetMap data. /// - public static MapTileLayer OpenStreetMapTileLayer + public static MapTileLayer OpenStreetMapTileLayer => new MapTileLayer { - get - { - return new MapTileLayer - { - TileSource = new TileSource { UriFormat = "https://tile.openstreetmap.org/{z}/{x}/{y}.png" }, - SourceName = "OpenStreetMap", - Description = "© [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)" - }; - } - } + TileSource = new TileSource { UriFormat = "https://tile.openstreetmap.org/{z}/{x}/{y}.png" }, + SourceName = "OpenStreetMap", + Description = "© [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)" + }; public static readonly DependencyProperty MinZoomLevelProperty = DependencyProperty.Register( nameof(MinZoomLevel), typeof(int), typeof(MapTileLayer), new PropertyMetadata(0)); @@ -75,8 +69,8 @@ namespace MapControl /// public int MinZoomLevel { - get { return (int)GetValue(MinZoomLevelProperty); } - set { SetValue(MinZoomLevelProperty, value); } + get => (int)GetValue(MinZoomLevelProperty); + set => SetValue(MinZoomLevelProperty, value); } /// @@ -84,8 +78,8 @@ namespace MapControl /// public int MaxZoomLevel { - get { return (int)GetValue(MaxZoomLevelProperty); } - set { SetValue(MaxZoomLevelProperty, value); } + get => (int)GetValue(MaxZoomLevelProperty); + set => SetValue(MaxZoomLevelProperty, value); } /// @@ -94,8 +88,8 @@ namespace MapControl /// public double ZoomLevelOffset { - get { return (double)GetValue(ZoomLevelOffsetProperty); } - set { SetValue(ZoomLevelOffsetProperty, value); } + get => (double)GetValue(ZoomLevelOffsetProperty); + set => SetValue(ZoomLevelOffsetProperty, value); } protected override Size MeasureOverride(Size availableSize) diff --git a/MapControl/Shared/MapTileLayerBase.cs b/MapControl/Shared/MapTileLayerBase.cs index 44bcc61c..249e5806 100644 --- a/MapControl/Shared/MapTileLayerBase.cs +++ b/MapControl/Shared/MapTileLayerBase.cs @@ -88,8 +88,8 @@ namespace MapControl /// public TileSource TileSource { - get { return (TileSource)GetValue(TileSourceProperty); } - set { SetValue(TileSourceProperty, value); } + get => (TileSource)GetValue(TileSourceProperty); + set => SetValue(TileSourceProperty, value); } /// @@ -97,8 +97,8 @@ namespace MapControl /// public string SourceName { - get { return (string)GetValue(SourceNameProperty); } - set { SetValue(SourceNameProperty, value); } + get => (string)GetValue(SourceNameProperty); + set => SetValue(SourceNameProperty, value); } /// @@ -106,8 +106,8 @@ namespace MapControl /// public string Description { - get { return (string)GetValue(DescriptionProperty); } - set { SetValue(DescriptionProperty, value); } + get => (string)GetValue(DescriptionProperty); + set => SetValue(DescriptionProperty, value); } /// @@ -116,8 +116,8 @@ namespace MapControl /// public int MaxBackgroundLevels { - get { return (int)GetValue(MaxBackgroundLevelsProperty); } - set { SetValue(MaxBackgroundLevelsProperty, value); } + get => (int)GetValue(MaxBackgroundLevelsProperty); + set => SetValue(MaxBackgroundLevelsProperty, value); } /// @@ -125,8 +125,8 @@ namespace MapControl /// public TimeSpan UpdateInterval { - get { return (TimeSpan)GetValue(UpdateIntervalProperty); } - set { SetValue(UpdateIntervalProperty, value); } + get => (TimeSpan)GetValue(UpdateIntervalProperty); + set => SetValue(UpdateIntervalProperty, value); } /// @@ -134,8 +134,8 @@ namespace MapControl /// public bool UpdateWhileViewportChanging { - get { return (bool)GetValue(UpdateWhileViewportChangingProperty); } - set { SetValue(UpdateWhileViewportChangingProperty, value); } + get => (bool)GetValue(UpdateWhileViewportChangingProperty); + set => SetValue(UpdateWhileViewportChangingProperty, value); } /// @@ -143,8 +143,8 @@ namespace MapControl /// public Brush MapBackground { - get { return (Brush)GetValue(MapBackgroundProperty); } - set { SetValue(MapBackgroundProperty, value); } + get => (Brush)GetValue(MapBackgroundProperty); + set => SetValue(MapBackgroundProperty, value); } /// @@ -152,8 +152,8 @@ namespace MapControl /// public Brush MapForeground { - get { return (Brush)GetValue(MapForegroundProperty); } - set { SetValue(MapForegroundProperty, value); } + get => (Brush)GetValue(MapForegroundProperty); + set => SetValue(MapForegroundProperty, value); } /// @@ -161,13 +161,13 @@ namespace MapControl /// public double LoadingProgress { - get { return (double)GetValue(LoadingProgressProperty); } - private set { SetValue(LoadingProgressProperty, value); } + get => (double)GetValue(LoadingProgressProperty); + private set => SetValue(LoadingProgressProperty, value); } public MapBase ParentMap { - get { return parentMap; } + get => parentMap; set { if (parentMap != null) @@ -186,15 +186,7 @@ namespace MapControl } } - protected bool IsBaseMapLayer - { - get - { - return parentMap != null - && parentMap.Children.Count > 0 - && parentMap.Children[0] == this; - } - } + protected bool IsBaseMapLayer => parentMap != null && parentMap.Children.Count > 0 && parentMap.Children[0] == this; protected abstract void SetRenderTransform(); diff --git a/MapControl/Shared/PushpinBorder.cs b/MapControl/Shared/PushpinBorder.cs index 92612286..80c6a713 100644 --- a/MapControl/Shared/PushpinBorder.cs +++ b/MapControl/Shared/PushpinBorder.cs @@ -22,14 +22,14 @@ namespace MapControl { public Size ArrowSize { - get { return (Size)GetValue(ArrowSizeProperty); } - set { SetValue(ArrowSizeProperty, value); } + get => (Size)GetValue(ArrowSizeProperty); + set => SetValue(ArrowSizeProperty, value); } public double BorderWidth { - get { return (double)GetValue(BorderWidthProperty); } - set { SetValue(BorderWidthProperty, value); } + get => (double)GetValue(BorderWidthProperty); + set => SetValue(BorderWidthProperty, value); } protected virtual Geometry BuildGeometry() diff --git a/MapControl/Shared/TileSource.cs b/MapControl/Shared/TileSource.cs index d2cbaf07..721ca250 100644 --- a/MapControl/Shared/TileSource.cs +++ b/MapControl/Shared/TileSource.cs @@ -29,7 +29,7 @@ namespace MapControl /// public string UriFormat { - get { return uriFormat; } + get => uriFormat; set { uriFormat = value?.Replace("{c}", "{s}"); // for backwards compatibility since 5.4.0 diff --git a/MapControl/Shared/WmsImageLayer.cs b/MapControl/Shared/WmsImageLayer.cs index 111b150a..00425c81 100644 --- a/MapControl/Shared/WmsImageLayer.cs +++ b/MapControl/Shared/WmsImageLayer.cs @@ -60,8 +60,8 @@ namespace MapControl /// public Uri ServiceUri { - get { return (Uri)GetValue(ServiceUriProperty); } - set { SetValue(ServiceUriProperty, value); } + get => (Uri)GetValue(ServiceUriProperty); + set => SetValue(ServiceUriProperty, value); } /// @@ -69,8 +69,8 @@ namespace MapControl /// public string Layers { - get { return (string)GetValue(LayersProperty); } - set { SetValue(LayersProperty, value); } + get => (string)GetValue(LayersProperty); + set => SetValue(LayersProperty, value); } /// @@ -78,8 +78,8 @@ namespace MapControl /// public string Styles { - get { return (string)GetValue(StylesProperty); } - set { SetValue(StylesProperty, value); } + get => (string)GetValue(StylesProperty); + set => SetValue(StylesProperty, value); } /// diff --git a/MapControl/Shared/WmtsTileLayer.cs b/MapControl/Shared/WmtsTileLayer.cs index 20a0ae31..9e377ff4 100644 --- a/MapControl/Shared/WmtsTileLayer.cs +++ b/MapControl/Shared/WmtsTileLayer.cs @@ -47,8 +47,8 @@ namespace MapControl /// public Uri CapabilitiesUri { - get { return (Uri)GetValue(CapabilitiesUriProperty); } - set { SetValue(CapabilitiesUriProperty, value); } + get => (Uri)GetValue(CapabilitiesUriProperty); + set => SetValue(CapabilitiesUriProperty, value); } /// @@ -56,14 +56,11 @@ namespace MapControl /// public string LayerIdentifier { - get { return (string)GetValue(LayerIdentifierProperty); } - set { SetValue(LayerIdentifierProperty, value); } + get => (string)GetValue(LayerIdentifierProperty); + set => SetValue(LayerIdentifierProperty, value); } - public IEnumerable ChildLayers - { - get { return Children.Cast(); } - } + public IEnumerable ChildLayers => Children.Cast(); public Dictionary TileMatrixSets { get; } = new Dictionary(); diff --git a/MapControl/UWP/TileImageLoader.UWP.cs b/MapControl/UWP/TileImageLoader.UWP.cs index 2fe3060e..dab1a696 100644 --- a/MapControl/UWP/TileImageLoader.UWP.cs +++ b/MapControl/UWP/TileImageLoader.UWP.cs @@ -25,10 +25,7 @@ namespace MapControl /// Default folder path where an IImageCache instance may save cached data, /// i.e. Windows.Storage.ApplicationData.Current.TemporaryFolder.Path. /// - public static string DefaultCacheFolder - { - get { return Windows.Storage.ApplicationData.Current.TemporaryFolder.Path; } - } + public static string DefaultCacheFolder => Windows.Storage.ApplicationData.Current.TemporaryFolder.Path; /// /// An IImageCache implementation used to cache tile images. diff --git a/MapControl/WPF/ImageFileCache.WPF.cs b/MapControl/WPF/ImageFileCache.WPF.cs index 7e5c4063..6064c529 100644 --- a/MapControl/WPF/ImageFileCache.WPF.cs +++ b/MapControl/WPF/ImageFileCache.WPF.cs @@ -21,20 +21,14 @@ namespace MapControl.Caching private readonly MemoryCache memoryCache = MemoryCache.Default; - public override string Name - { - get { return string.Empty; } - } + public override string Name => string.Empty; - public override DefaultCacheCapabilities DefaultCacheCapabilities - { - get { return DefaultCacheCapabilities.None; } - } + public override DefaultCacheCapabilities DefaultCacheCapabilities => DefaultCacheCapabilities.None; public override object this[string key] { - get { return Get(key); } - set { Set(key, value, null); } + get => Get(key); + set => Set(key, value, null); } protected override IEnumerator> GetEnumerator() diff --git a/MapControl/WPF/Map.WPF.cs b/MapControl/WPF/Map.WPF.cs index 92555648..044be016 100644 --- a/MapControl/WPF/Map.WPF.cs +++ b/MapControl/WPF/Map.WPF.cs @@ -42,8 +42,8 @@ namespace MapControl /// public double MouseWheelZoomDelta { - get { return (double)GetValue(MouseWheelZoomDeltaProperty); } - set { SetValue(MouseWheelZoomDeltaProperty, value); } + get => (double)GetValue(MouseWheelZoomDeltaProperty); + set => SetValue(MouseWheelZoomDeltaProperty, value); } /// @@ -51,8 +51,8 @@ namespace MapControl /// public ManipulationModes ManipulationMode { - get { return (ManipulationModes)GetValue(ManipulationModeProperty); } - set { SetValue(ManipulationModeProperty, value); } + get => (ManipulationModes)GetValue(ManipulationModeProperty); + set => SetValue(ManipulationModeProperty, value); } private void OnManipulationStarted(object sender, ManipulationStartedEventArgs e) diff --git a/MapControl/WPF/MapContentControl.WPF.cs b/MapControl/WPF/MapContentControl.WPF.cs index c607d635..29b6b30a 100644 --- a/MapControl/WPF/MapContentControl.WPF.cs +++ b/MapControl/WPF/MapContentControl.WPF.cs @@ -26,8 +26,8 @@ namespace MapControl /// public bool AutoCollapse { - get { return (bool)GetValue(AutoCollapseProperty); } - set { SetValue(AutoCollapseProperty, value); } + get => (bool)GetValue(AutoCollapseProperty); + set => SetValue(AutoCollapseProperty, value); } /// @@ -35,8 +35,8 @@ namespace MapControl /// public Location Location { - get { return (Location)GetValue(LocationProperty); } - set { SetValue(LocationProperty, value); } + get => (Location)GetValue(LocationProperty); + set => SetValue(LocationProperty, value); } } @@ -55,8 +55,8 @@ namespace MapControl public CornerRadius CornerRadius { - get { return (CornerRadius)GetValue(CornerRadiusProperty); } - set { SetValue(CornerRadiusProperty, value); } + get => (CornerRadius)GetValue(CornerRadiusProperty); + set => SetValue(CornerRadiusProperty, value); } } } diff --git a/MapControl/WPF/MapItemsImageLayer.WPF.cs b/MapControl/WPF/MapItemsImageLayer.WPF.cs index d695a3bc..3d60fc4e 100644 --- a/MapControl/WPF/MapItemsImageLayer.WPF.cs +++ b/MapControl/WPF/MapItemsImageLayer.WPF.cs @@ -25,8 +25,8 @@ namespace MapControl public IEnumerable ItemsSource { - get { return (IEnumerable)GetValue(ItemsSourceProperty); } - set { SetValue(ItemsSourceProperty, value); } + get => (IEnumerable)GetValue(ItemsSourceProperty); + set => SetValue(ItemsSourceProperty, value); } protected override async Task GetImageAsync(IProgress progress) diff --git a/MapControl/WPF/MapMultiPolygon.WPF.cs b/MapControl/WPF/MapMultiPolygon.WPF.cs index 3cda3e66..70a8ccd5 100644 --- a/MapControl/WPF/MapMultiPolygon.WPF.cs +++ b/MapControl/WPF/MapMultiPolygon.WPF.cs @@ -27,8 +27,8 @@ namespace MapControl /// public IEnumerable> Polygons { - get { return (IEnumerable>)GetValue(PolygonsProperty); } - set { SetValue(PolygonsProperty, value); } + get => (IEnumerable>)GetValue(PolygonsProperty); + set => SetValue(PolygonsProperty, value); } public MapMultiPolygon() diff --git a/MapControl/WPF/MapPath.WPF.cs b/MapControl/WPF/MapPath.WPF.cs index e8a4f734..0ba67506 100644 --- a/MapControl/WPF/MapPath.WPF.cs +++ b/MapControl/WPF/MapPath.WPF.cs @@ -18,14 +18,11 @@ namespace MapControl public Geometry Data { - get { return (Geometry)GetValue(DataProperty); } - set { SetValue(DataProperty, value); } + get => (Geometry)GetValue(DataProperty); + set => SetValue(DataProperty, value); } - protected override Geometry DefiningGeometry - { - get { return Data; } - } + protected override Geometry DefiningGeometry => Data; #region Methods used only by derived classes MapPolyline, MapPolygon and MapMultiPolygon diff --git a/MapControl/WPF/PushpinBorder.WPF.cs b/MapControl/WPF/PushpinBorder.WPF.cs index 7c182170..0ea13dbd 100644 --- a/MapControl/WPF/PushpinBorder.WPF.cs +++ b/MapControl/WPF/PushpinBorder.WPF.cs @@ -43,26 +43,26 @@ namespace MapControl public Brush Background { - get { return (Brush)GetValue(BackgroundProperty); } - set { SetValue(BackgroundProperty, value); } + get => (Brush)GetValue(BackgroundProperty); + set => SetValue(BackgroundProperty, value); } public Brush BorderBrush { - get { return (Brush)GetValue(BorderBrushProperty); } - set { SetValue(BorderBrushProperty, value); } + get => (Brush)GetValue(BorderBrushProperty); + set => SetValue(BorderBrushProperty, value); } public CornerRadius CornerRadius { - get { return (CornerRadius)GetValue(CornerRadiusProperty); } - set { SetValue(CornerRadiusProperty, value); } + get => (CornerRadius)GetValue(CornerRadiusProperty); + set => SetValue(CornerRadiusProperty, value); } public Thickness Padding { - get { return (Thickness)GetValue(PaddingProperty); } - set { SetValue(PaddingProperty, value); } + get => (Thickness)GetValue(PaddingProperty); + set => SetValue(PaddingProperty, value); } protected override Size MeasureOverride(Size constraint) diff --git a/MapControl/WPF/TileImageLoader.WPF.cs b/MapControl/WPF/TileImageLoader.WPF.cs index 1e1e86a3..c2b1c63c 100644 --- a/MapControl/WPF/TileImageLoader.WPF.cs +++ b/MapControl/WPF/TileImageLoader.WPF.cs @@ -14,10 +14,8 @@ namespace MapControl /// /// Default folder path where an ObjectCache instance may save cached data, i.e. C:\ProgramData\MapControl\TileCache /// - public static string DefaultCacheFolder - { - get { return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl", "TileCache"); } - } + public static string DefaultCacheFolder => + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl", "TileCache"); /// /// An ObjectCache instance used to cache tile image data. The default value is MemoryCache.Default. diff --git a/MapControl/WinUI/Map.WinUI.cs b/MapControl/WinUI/Map.WinUI.cs index b9f6eea8..0cdbc7a1 100644 --- a/MapControl/WinUI/Map.WinUI.cs +++ b/MapControl/WinUI/Map.WinUI.cs @@ -45,8 +45,8 @@ namespace MapControl /// public double MouseWheelZoomDelta { - get { return (double)GetValue(MouseWheelZoomDeltaProperty); } - set { SetValue(MouseWheelZoomDeltaProperty, value); } + get => (double)GetValue(MouseWheelZoomDeltaProperty); + set => SetValue(MouseWheelZoomDeltaProperty, value); } private void OnPointerWheelChanged(object sender, PointerRoutedEventArgs e) diff --git a/MapControl/WinUI/MapContentControl.WinUI.cs b/MapControl/WinUI/MapContentControl.WinUI.cs index f785b5fd..63d15726 100644 --- a/MapControl/WinUI/MapContentControl.WinUI.cs +++ b/MapControl/WinUI/MapContentControl.WinUI.cs @@ -36,8 +36,8 @@ namespace MapControl /// public bool AutoCollapse { - get { return (bool)GetValue(AutoCollapseProperty); } - set { SetValue(AutoCollapseProperty, value); } + get => (bool)GetValue(AutoCollapseProperty); + set => SetValue(AutoCollapseProperty, value); } /// @@ -45,8 +45,8 @@ namespace MapControl /// public Location Location { - get { return (Location)GetValue(LocationProperty); } - set { SetValue(LocationProperty, value); } + get => (Location)GetValue(LocationProperty); + set => SetValue(LocationProperty, value); } protected override void OnApplyTemplate() diff --git a/MapControl/WinUI/PushpinBorder.WinUI.cs b/MapControl/WinUI/PushpinBorder.WinUI.cs index 46033de6..e5efa38d 100644 --- a/MapControl/WinUI/PushpinBorder.WinUI.cs +++ b/MapControl/WinUI/PushpinBorder.WinUI.cs @@ -80,8 +80,8 @@ namespace MapControl public UIElement Child { - get { return border.Child; } - set { border.Child = value; } + get => border.Child; + set => border.Child = value; } private void SetBorderMargin() diff --git a/MapControl/WinUI/TileImageLoader.WinUI.cs b/MapControl/WinUI/TileImageLoader.WinUI.cs index 169d7714..d178b24c 100644 --- a/MapControl/WinUI/TileImageLoader.WinUI.cs +++ b/MapControl/WinUI/TileImageLoader.WinUI.cs @@ -25,10 +25,8 @@ namespace MapControl /// /// Default folder path where an IImageCache instance may save cached data, i.e. C:\ProgramData\MapControl\TileCache /// - public static string DefaultCacheFolder - { - get { return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl", "TileCache"); } - } + public static string DefaultCacheFolder => + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl", "TileCache"); /// /// An IImageCache implementation used to cache tile images.