mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-03-30 01:55:18 +02:00
Avalonia using declarations
This commit is contained in:
parent
3d275cd924
commit
286b158abe
|
|
@ -2,7 +2,6 @@
|
||||||
// Copyright © 2024 Clemens Fischer
|
// Copyright © 2024 Clemens Fischer
|
||||||
// Licensed under the Microsoft Public License (Ms-PL)
|
// Licensed under the Microsoft Public License (Ms-PL)
|
||||||
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
#pragma warning disable AVP1001 // The same AvaloniaProperty should not be registered twice
|
#pragma warning disable AVP1001 // The same AvaloniaProperty should not be registered twice
|
||||||
|
|
@ -82,5 +81,10 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
return AddOwner<TOwner, TValue>((StyledProperty<TValue>)property);
|
return AddOwner<TOwner, TValue>((StyledProperty<TValue>)property);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SetBinding(this AvaloniaObject target, AvaloniaProperty property, Binding binding)
|
||||||
|
{
|
||||||
|
target.Bind(property, binding);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,6 @@
|
||||||
// Copyright © 2024 Clemens Fischer
|
// Copyright © 2024 Clemens Fischer
|
||||||
// Licensed under the Microsoft Public License (Ms-PL)
|
// Licensed under the Microsoft Public License (Ms-PL)
|
||||||
|
|
||||||
using Avalonia.Media;
|
|
||||||
using Avalonia.Media.Imaging;
|
|
||||||
using Avalonia.Platform;
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
// Copyright © 2024 Clemens Fischer
|
// Copyright © 2024 Clemens Fischer
|
||||||
// Licensed under the Microsoft Public License (Ms-PL)
|
// Licensed under the Microsoft Public License (Ms-PL)
|
||||||
|
|
||||||
using Avalonia.Animation;
|
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
{
|
{
|
||||||
public class LocationAnimator : InterpolatingAnimator<Location>
|
public class LocationAnimator : InterpolatingAnimator<Location>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
// Copyright © 2024 Clemens Fischer
|
// Copyright © 2024 Clemens Fischer
|
||||||
// Licensed under the Microsoft Public License (Ms-PL)
|
// Licensed under the Microsoft Public License (Ms-PL)
|
||||||
|
|
||||||
using Avalonia.Input;
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,6 @@
|
||||||
// Copyright © 2024 Clemens Fischer
|
// Copyright © 2024 Clemens Fischer
|
||||||
// Licensed under the Microsoft Public License (Ms-PL)
|
// Licensed under the Microsoft Public License (Ms-PL)
|
||||||
|
|
||||||
global using Avalonia;
|
|
||||||
using Avalonia.Animation;
|
|
||||||
using Avalonia.Animation.Easings;
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Controls.Documents;
|
|
||||||
using Avalonia.Media;
|
|
||||||
using Avalonia.Styling;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
// Copyright © 2024 Clemens Fischer
|
// Copyright © 2024 Clemens Fischer
|
||||||
// Licensed under the Microsoft Public License (Ms-PL)
|
// Licensed under the Microsoft Public License (Ms-PL)
|
||||||
|
|
||||||
using Avalonia.Controls;
|
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,6 @@
|
||||||
// Copyright © 2024 Clemens Fischer
|
// Copyright © 2024 Clemens Fischer
|
||||||
// Licensed under the Microsoft Public License (Ms-PL)
|
// Licensed under the Microsoft Public License (Ms-PL)
|
||||||
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Controls.Documents;
|
|
||||||
using Avalonia.Controls.Shapes;
|
|
||||||
using Avalonia.Media;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,24 @@
|
||||||
// Copyright © 2024 Clemens Fischer
|
// Copyright © 2024 Clemens Fischer
|
||||||
// Licensed under the Microsoft Public License (Ms-PL)
|
// Licensed under the Microsoft Public License (Ms-PL)
|
||||||
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Media;
|
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
{
|
{
|
||||||
public partial class MapPanel
|
public partial class MapPanel
|
||||||
{
|
{
|
||||||
|
public static readonly AttachedProperty<bool> AutoCollapseProperty =
|
||||||
|
DependencyPropertyHelper.RegisterAttached<MapPanel, bool>("AutoCollapse");
|
||||||
|
|
||||||
|
public static readonly AttachedProperty<Location> LocationProperty =
|
||||||
|
DependencyPropertyHelper.RegisterAttached<MapPanel, Location>("Location");
|
||||||
|
|
||||||
|
public static readonly AttachedProperty<BoundingBox> BoundingBoxProperty =
|
||||||
|
DependencyPropertyHelper.RegisterAttached<MapPanel, BoundingBox>("BoundingBox");
|
||||||
|
|
||||||
|
static MapPanel()
|
||||||
|
{
|
||||||
|
AffectsParentArrange<MapPanel>(LocationProperty, BoundingBoxProperty);
|
||||||
|
}
|
||||||
|
|
||||||
public MapPanel()
|
public MapPanel()
|
||||||
{
|
{
|
||||||
if (this is MapBase mapBase)
|
if (this is MapBase mapBase)
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,6 @@
|
||||||
// Copyright © 2024 Clemens Fischer
|
// Copyright © 2024 Clemens Fischer
|
||||||
// Licensed under the Microsoft Public License (Ms-PL)
|
// Licensed under the Microsoft Public License (Ms-PL)
|
||||||
|
|
||||||
using Avalonia.Controls.Shapes;
|
|
||||||
using Avalonia.Media;
|
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
{
|
{
|
||||||
public partial class MapPath : Shape
|
public partial class MapPath : Shape
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
// Copyright © 2024 Clemens Fischer
|
// Copyright © 2024 Clemens Fischer
|
||||||
// Licensed under the Microsoft Public License (Ms-PL)
|
// Licensed under the Microsoft Public License (Ms-PL)
|
||||||
|
|
||||||
using Avalonia.Media;
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,6 @@
|
||||||
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System;
|
using System;
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Animation;
|
|
||||||
using Avalonia.Styling;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
// Copyright © 2024 Clemens Fischer
|
// Copyright © 2024 Clemens Fischer
|
||||||
// Licensed under the Microsoft Public License (Ms-PL)
|
// Licensed under the Microsoft Public License (Ms-PL)
|
||||||
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Media;
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,7 @@
|
||||||
// Copyright © 2024 Clemens Fischer
|
// Copyright © 2024 Clemens Fischer
|
||||||
// Licensed under the Microsoft Public License (Ms-PL)
|
// Licensed under the Microsoft Public License (Ms-PL)
|
||||||
|
|
||||||
using Avalonia.Media;
|
|
||||||
using Avalonia.Threading;
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
|
|
@ -16,7 +13,7 @@ namespace MapControl
|
||||||
/// Default folder where the Cache instance may save data, i.e. "C:\ProgramData\MapControl\TileCache".
|
/// Default folder where the Cache instance may save data, i.e. "C:\ProgramData\MapControl\TileCache".
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string DefaultCacheFolder =>
|
public static string DefaultCacheFolder =>
|
||||||
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl", "TileCache");
|
System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl", "TileCache");
|
||||||
|
|
||||||
|
|
||||||
private static async Task LoadTileAsync(Tile tile, Func<Task<IImage>> loadImageFunc)
|
private static async Task LoadTileAsync(Tile tile, Func<Task<IImage>> loadImageFunc)
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,6 @@ using System.Windows;
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
#elif WINUI
|
#elif WINUI
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
#elif AVALONIA
|
|
||||||
using Avalonia.Interactivity;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,6 @@ using System.Windows.Media;
|
||||||
using Windows.UI.Xaml.Media;
|
using Windows.UI.Xaml.Media;
|
||||||
#elif WINUI
|
#elif WINUI
|
||||||
using Microsoft.UI.Xaml.Media;
|
using Microsoft.UI.Xaml.Media;
|
||||||
#elif AVALONIA
|
|
||||||
using ImageSource = Avalonia.Media.IImage;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
// Copyright © 2024 Clemens Fischer
|
// Copyright © 2024 Clemens Fischer
|
||||||
// Licensed under the Microsoft Public License (Ms-PL)
|
// Licensed under the Microsoft Public License (Ms-PL)
|
||||||
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
{
|
{
|
||||||
public static class FilePath
|
public static class FilePath
|
||||||
|
|
@ -11,9 +9,9 @@ namespace MapControl
|
||||||
public static string GetFullPath(string path)
|
public static string GetFullPath(string path)
|
||||||
{
|
{
|
||||||
#if NET6_0_OR_GREATER
|
#if NET6_0_OR_GREATER
|
||||||
return Path.GetFullPath(path, System.AppDomain.CurrentDomain.BaseDirectory);
|
return System.IO.Path.GetFullPath(path, System.AppDomain.CurrentDomain.BaseDirectory);
|
||||||
#else
|
#else
|
||||||
return Path.GetFullPath(path);
|
return System.IO.Path.GetFullPath(path);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using Path = System.IO.Path;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
@ -23,12 +24,6 @@ using Windows.UI.Xaml.Media;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Microsoft.UI.Xaml.Media;
|
using Microsoft.UI.Xaml.Media;
|
||||||
#elif AVALONIA
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Media;
|
|
||||||
using DependencyProperty = Avalonia.AvaloniaProperty;
|
|
||||||
using FrameworkElement = Avalonia.Controls.Control;
|
|
||||||
using ImageSource = Avalonia.Media.IImage;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ using Microsoft.Extensions.Options;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using Path = System.IO.Path;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,6 @@ using System.Windows.Media;
|
||||||
using Windows.UI.Xaml.Media;
|
using Windows.UI.Xaml.Media;
|
||||||
#elif WINUI
|
#elif WINUI
|
||||||
using Microsoft.UI.Xaml.Media;
|
using Microsoft.UI.Xaml.Media;
|
||||||
#elif AVALONIA
|
|
||||||
using ImageSource = Avalonia.Media.IImage;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
// Copyright © 2024 Clemens Fischer
|
// Copyright © 2024 Clemens Fischer
|
||||||
// Licensed under the Microsoft Public License (Ms-PL)
|
// Licensed under the Microsoft Public License (Ms-PL)
|
||||||
|
|
||||||
using System;
|
|
||||||
#if WPF
|
#if WPF
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
|
@ -13,10 +12,33 @@ using Windows.UI.Xaml.Media;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Media;
|
using Microsoft.UI.Xaml.Media;
|
||||||
#elif AVALONIA
|
#elif AVALONIA
|
||||||
using Brush = Avalonia.Media.IBrush;
|
global using Avalonia;
|
||||||
using DependencyProperty = Avalonia.AvaloniaProperty;
|
global using Avalonia.Animation;
|
||||||
using UIElement = Avalonia.Controls.Control;
|
global using Avalonia.Animation.Easings;
|
||||||
|
global using Avalonia.Controls;
|
||||||
|
global using Avalonia.Controls.Documents;
|
||||||
|
global using Avalonia.Controls.Shapes;
|
||||||
|
global using Avalonia.Data;
|
||||||
|
global using Avalonia.Input;
|
||||||
|
global using Avalonia.Interactivity;
|
||||||
|
global using Avalonia.Media;
|
||||||
|
global using Avalonia.Media.Imaging;
|
||||||
|
global using Avalonia.Platform;
|
||||||
|
global using Avalonia.Styling;
|
||||||
|
global using Avalonia.Threading;
|
||||||
|
global using Brush = Avalonia.Media.IBrush;
|
||||||
|
global using ImageSource = Avalonia.Media.IImage;
|
||||||
|
global using DependencyObject = Avalonia.AvaloniaObject;
|
||||||
|
global using DependencyProperty = Avalonia.AvaloniaProperty;
|
||||||
|
global using UIElement = Avalonia.Controls.Control;
|
||||||
|
global using FrameworkElement = Avalonia.Controls.Control;
|
||||||
|
global using HorizontalAlignment = Avalonia.Layout.HorizontalAlignment;
|
||||||
|
global using VerticalAlignment = Avalonia.Layout.VerticalAlignment;
|
||||||
|
global using PathFigureCollection = Avalonia.Media.PathFigures;
|
||||||
|
global using PointCollection = System.Collections.Generic.List<Avalonia.Point>;
|
||||||
|
global using PropertyPath = System.String;
|
||||||
#endif
|
#endif
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,6 @@ using System.Windows;
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
#elif WINUI
|
#elif WINUI
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
#elif AVALONIA
|
|
||||||
using DependencyProperty = Avalonia.AvaloniaProperty;
|
|
||||||
using FrameworkElement = Avalonia.Controls.Control;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,6 @@ using Windows.UI.Xaml.Media;
|
||||||
#elif WINUI
|
#elif WINUI
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Media;
|
using Microsoft.UI.Xaml.Media;
|
||||||
#elif AVALONIA
|
|
||||||
using Avalonia.Media;
|
|
||||||
using DependencyProperty = Avalonia.AvaloniaProperty;
|
|
||||||
using PathFigureCollection = Avalonia.Media.PathFigures;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,6 @@ using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Microsoft.UI.Xaml.Media;
|
using Microsoft.UI.Xaml.Media;
|
||||||
using DispatcherTimer = Microsoft.UI.Dispatching.DispatcherQueueTimer;
|
using DispatcherTimer = Microsoft.UI.Dispatching.DispatcherQueueTimer;
|
||||||
#elif AVALONIA
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Media;
|
|
||||||
using Avalonia.Threading;
|
|
||||||
using Brush = Avalonia.Media.IBrush;
|
|
||||||
using DependencyProperty = Avalonia.AvaloniaProperty;
|
|
||||||
using ImageSource = Avalonia.Media.IImage;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,6 @@ using Windows.Foundation;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Microsoft.UI.Xaml.Media;
|
using Microsoft.UI.Xaml.Media;
|
||||||
#elif AVALONIA
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Media;
|
|
||||||
using DependencyProperty = Avalonia.AvaloniaProperty;
|
|
||||||
using FrameworkElement = Avalonia.Controls.Control;
|
|
||||||
using HorizontalAlignment = Avalonia.Layout.HorizontalAlignment;
|
|
||||||
using VerticalAlignment = Avalonia.Layout.VerticalAlignment;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -43,17 +36,6 @@ namespace MapControl
|
||||||
|
|
||||||
public partial class MapPanel : Panel, IMapElement
|
public partial class MapPanel : Panel, IMapElement
|
||||||
{
|
{
|
||||||
public static readonly DependencyProperty AutoCollapseProperty =
|
|
||||||
DependencyPropertyHelper.RegisterAttached<MapPanel, bool>("AutoCollapse");
|
|
||||||
|
|
||||||
public static readonly DependencyProperty LocationProperty =
|
|
||||||
DependencyPropertyHelper.RegisterAttached<MapPanel, Location>("Location", null,
|
|
||||||
(element, oldValue, newValue) => (element.Parent as MapPanel)?.InvalidateArrange());
|
|
||||||
|
|
||||||
public static readonly DependencyProperty BoundingBoxProperty =
|
|
||||||
DependencyPropertyHelper.RegisterAttached<MapPanel, BoundingBox>("BoundingBox", null,
|
|
||||||
(element, oldValue, newValue) => (element.Parent as MapPanel)?.InvalidateArrange());
|
|
||||||
|
|
||||||
private static readonly DependencyProperty ViewPositionProperty =
|
private static readonly DependencyProperty ViewPositionProperty =
|
||||||
DependencyPropertyHelper.RegisterAttached<MapPanel, Point?>("ViewPosition");
|
DependencyPropertyHelper.RegisterAttached<MapPanel, Point?>("ViewPosition");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,6 @@ using Windows.UI.Xaml.Media;
|
||||||
#elif WINUI
|
#elif WINUI
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Media;
|
using Microsoft.UI.Xaml.Media;
|
||||||
#elif AVALONIA
|
|
||||||
using DependencyProperty = Avalonia.AvaloniaProperty;
|
|
||||||
using PathFigureCollection = Avalonia.Media.PathFigures;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,6 @@ using System.Windows;
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
#elif WINUI
|
#elif WINUI
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
#elif AVALONIA
|
|
||||||
using DependencyProperty = Avalonia.AvaloniaProperty;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,6 @@ using System.Windows;
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
#elif WINUI
|
#elif WINUI
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
#elif AVALONIA
|
|
||||||
using DependencyProperty = Avalonia.AvaloniaProperty;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
|
|
|
||||||
|
|
@ -24,14 +24,6 @@ using Microsoft.UI.Xaml.Controls;
|
||||||
using Microsoft.UI.Xaml.Data;
|
using Microsoft.UI.Xaml.Data;
|
||||||
using Microsoft.UI.Xaml.Media;
|
using Microsoft.UI.Xaml.Media;
|
||||||
using Microsoft.UI.Xaml.Shapes;
|
using Microsoft.UI.Xaml.Shapes;
|
||||||
#elif AVALONIA
|
|
||||||
using Avalonia.Data;
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Controls.Shapes;
|
|
||||||
using DependencyProperty = Avalonia.AvaloniaProperty;
|
|
||||||
using HorizontalAlignment = Avalonia.Layout.HorizontalAlignment;
|
|
||||||
using VerticalAlignment = Avalonia.Layout.VerticalAlignment;
|
|
||||||
using PointCollection = System.Collections.Generic.List<Avalonia.Point>;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
|
|
@ -78,19 +70,12 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
base.SetParentMap(map);
|
base.SetParentMap(map);
|
||||||
|
|
||||||
#if AVALONIA
|
|
||||||
line.Bind(Shape.StrokeProperty,
|
|
||||||
new Binding { Source = map, Path = nameof(MapBase.Foreground) });
|
|
||||||
|
|
||||||
line.Bind(Shape.StrokeThicknessProperty,
|
|
||||||
new Binding { Source = this, Path = nameof(StrokeThickness) });
|
|
||||||
#else
|
|
||||||
line.SetBinding(Shape.StrokeProperty,
|
line.SetBinding(Shape.StrokeProperty,
|
||||||
new Binding { Source = map, Path = new PropertyPath(nameof(MapBase.Foreground)) });
|
new Binding { Source = map, Path = new PropertyPath(nameof(MapBase.Foreground)) });
|
||||||
|
|
||||||
line.SetBinding(Shape.StrokeThicknessProperty,
|
line.SetBinding(Shape.StrokeThicknessProperty,
|
||||||
new Binding { Source = this, Path = new PropertyPath(nameof(StrokeThickness)) });
|
new Binding { Source = this, Path = new PropertyPath(nameof(StrokeThickness)) });
|
||||||
#endif
|
|
||||||
#if UWP || WINUI
|
#if UWP || WINUI
|
||||||
label.SetBinding(TextBlock.ForegroundProperty,
|
label.SetBinding(TextBlock.ForegroundProperty,
|
||||||
new Binding { Source = map, Path = new PropertyPath(nameof(MapBase.Foreground)) });
|
new Binding { Source = map, Path = new PropertyPath(nameof(MapBase.Foreground)) });
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,6 @@ using Windows.UI.Xaml.Media;
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Media;
|
using Microsoft.UI.Xaml.Media;
|
||||||
#elif AVALONIA
|
|
||||||
using Avalonia.Media;
|
|
||||||
using DependencyProperty = Avalonia.AvaloniaProperty;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,6 @@ using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Microsoft.UI.Xaml.Media;
|
using Microsoft.UI.Xaml.Media;
|
||||||
using DispatcherTimer = Microsoft.UI.Dispatching.DispatcherQueueTimer;
|
using DispatcherTimer = Microsoft.UI.Dispatching.DispatcherQueueTimer;
|
||||||
#elif AVALONIA
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Media;
|
|
||||||
using Avalonia.Threading;
|
|
||||||
using Brush = Avalonia.Media.IBrush;
|
|
||||||
using DependencyProperty = Avalonia.AvaloniaProperty;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,6 @@ using Windows.UI.Xaml.Media;
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Media;
|
using Microsoft.UI.Xaml.Media;
|
||||||
#elif AVALONIA
|
|
||||||
using Avalonia.Media;
|
|
||||||
using HorizontalAlignment = Avalonia.Layout.HorizontalAlignment;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,6 @@ using Windows.UI.Xaml.Media;
|
||||||
#elif WINUI
|
#elif WINUI
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Microsoft.UI.Xaml.Media;
|
using Microsoft.UI.Xaml.Media;
|
||||||
#elif AVALONIA
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Media;
|
|
||||||
using ImageSource = Avalonia.Media.IImage;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
|
@ -147,7 +146,7 @@ namespace MapControl
|
||||||
|
|
||||||
private static async Task LoadCachedTileAsync(Tile tile, Uri uri, string cacheName)
|
private static async Task LoadCachedTileAsync(Tile tile, Uri uri, string cacheName)
|
||||||
{
|
{
|
||||||
var extension = Path.GetExtension(uri.LocalPath);
|
var extension = System.IO.Path.GetExtension(uri.LocalPath);
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(extension) || extension.Equals(".jpeg", StringComparison.OrdinalIgnoreCase))
|
if (string.IsNullOrEmpty(extension) || extension.Equals(".jpeg", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,6 @@ using System.Windows.Media;
|
||||||
using Windows.UI.Xaml.Media;
|
using Windows.UI.Xaml.Media;
|
||||||
#elif WINUI
|
#elif WINUI
|
||||||
using Microsoft.UI.Xaml.Media;
|
using Microsoft.UI.Xaml.Media;
|
||||||
#elif AVALONIA
|
|
||||||
using ImageSource = Avalonia.Media.IImage;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,6 @@ using System.Windows;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
#elif UWP
|
#elif UWP
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
#elif AVALONIA
|
|
||||||
using Avalonia.Threading;
|
|
||||||
using DependencyObject = Avalonia.AvaloniaObject;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,6 @@ using Windows.UI.Xaml.Media;
|
||||||
#elif WINUI
|
#elif WINUI
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Media;
|
using Microsoft.UI.Xaml.Media;
|
||||||
#elif AVALONIA
|
|
||||||
using DependencyProperty = Avalonia.AvaloniaProperty;
|
|
||||||
using ImageSource = Avalonia.Media.IImage;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,6 @@ using Windows.UI.Xaml;
|
||||||
#elif WINUI
|
#elif WINUI
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
#elif AVALONIA
|
|
||||||
using Avalonia.Interactivity;
|
|
||||||
using DependencyProperty = Avalonia.AvaloniaProperty;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,6 @@ using Windows.UI.Xaml.Media;
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Microsoft.UI.Xaml.Media;
|
using Microsoft.UI.Xaml.Media;
|
||||||
#elif AVALONIA
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Media;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,9 @@ namespace MapControl
|
||||||
FrameworkPropertyMetadataOptions options)
|
FrameworkPropertyMetadataOptions options)
|
||||||
where TOwner : DependencyObject
|
where TOwner : DependencyObject
|
||||||
{
|
{
|
||||||
return DependencyProperty.Register(name, typeof(TValue), typeof(TOwner), new FrameworkPropertyMetadata(defaultValue, options));
|
var metadata = new FrameworkPropertyMetadata(defaultValue, options);
|
||||||
|
|
||||||
|
return DependencyProperty.Register(name, typeof(TValue), typeof(TOwner), metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DependencyProperty Register<TOwner, TValue>(
|
public static DependencyProperty Register<TOwner, TValue>(
|
||||||
|
|
@ -45,6 +47,16 @@ namespace MapControl
|
||||||
return DependencyProperty.Register(name, typeof(TValue), typeof(TOwner), metadata);
|
return DependencyProperty.Register(name, typeof(TValue), typeof(TOwner), metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static DependencyProperty RegisterAttached<TOwner, TValue>(
|
||||||
|
string name,
|
||||||
|
TValue defaultValue,
|
||||||
|
FrameworkPropertyMetadataOptions options)
|
||||||
|
{
|
||||||
|
var metadata = new FrameworkPropertyMetadata(defaultValue, options);
|
||||||
|
|
||||||
|
return DependencyProperty.RegisterAttached(name, typeof(TValue), typeof(TOwner), metadata);
|
||||||
|
}
|
||||||
|
|
||||||
public static DependencyProperty RegisterAttached<TOwner, TValue>(
|
public static DependencyProperty RegisterAttached<TOwner, TValue>(
|
||||||
string name,
|
string name,
|
||||||
TValue defaultValue = default,
|
TValue defaultValue = default,
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,17 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
public partial class MapPanel
|
public partial class MapPanel
|
||||||
{
|
{
|
||||||
|
public static readonly DependencyProperty AutoCollapseProperty =
|
||||||
|
DependencyPropertyHelper.RegisterAttached<MapPanel, bool>("AutoCollapse");
|
||||||
|
|
||||||
|
public static readonly DependencyProperty LocationProperty =
|
||||||
|
DependencyPropertyHelper.RegisterAttached<MapPanel, Location>("Location", null,
|
||||||
|
FrameworkPropertyMetadataOptions.AffectsParentArrange);
|
||||||
|
|
||||||
|
public static readonly DependencyProperty BoundingBoxProperty =
|
||||||
|
DependencyPropertyHelper.RegisterAttached<MapPanel, BoundingBox>("BoundingBox", null,
|
||||||
|
FrameworkPropertyMetadataOptions.AffectsParentArrange);
|
||||||
|
|
||||||
public MapPanel()
|
public MapPanel()
|
||||||
{
|
{
|
||||||
if (this is MapBase)
|
if (this is MapBase)
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,17 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
public partial class MapPanel
|
public partial class MapPanel
|
||||||
{
|
{
|
||||||
|
public static readonly DependencyProperty AutoCollapseProperty =
|
||||||
|
DependencyPropertyHelper.RegisterAttached<MapPanel, bool>("AutoCollapse");
|
||||||
|
|
||||||
|
public static readonly DependencyProperty LocationProperty =
|
||||||
|
DependencyPropertyHelper.RegisterAttached<MapPanel, Location>("Location", null,
|
||||||
|
(element, oldValue, newValue) => (element.Parent as MapPanel)?.InvalidateArrange());
|
||||||
|
|
||||||
|
public static readonly DependencyProperty BoundingBoxProperty =
|
||||||
|
DependencyPropertyHelper.RegisterAttached<MapPanel, BoundingBox>("BoundingBox", null,
|
||||||
|
(element, oldValue, newValue) => (element.Parent as MapPanel)?.InvalidateArrange());
|
||||||
|
|
||||||
public MapPanel()
|
public MapPanel()
|
||||||
{
|
{
|
||||||
InitMapElement(this);
|
InitMapElement(this);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue