-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/map pin cluster #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
5186770
4e0e05e
8472e5a
2e0af6d
7463830
1e78169
16a59d0
2d8507d
d828d5c
bbfa719
65dfa01
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,18 @@ | ||
| using Chinook.DynamicMvvm; | ||
| using Uno.Extensions; | ||
| using Cartography.DynamicMap; | ||
| using Chinook.DynamicMvvm; | ||
| using Chinook.SectionsNavigation; | ||
| using GeolocatorService; | ||
| using Samples.Entities; | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
| using System.Reactive; | ||
| using System.Reactive.Concurrency; | ||
| using System.Reactive.Linq; | ||
| using System.Reactive.Threading.Tasks; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
| using Cartography.DynamicMap; | ||
| using GeolocatorService; | ||
| using Uno.Extensions; | ||
| using Uno.Logging; | ||
| using Samples.Entities; | ||
| using System.Collections.Generic; | ||
| using Uno; | ||
| using Windows.Devices.Geolocation; | ||
| using Chinook.SectionsNavigation; | ||
| using System.Reactive.Concurrency; | ||
|
|
||
| namespace Samples.Presentation | ||
| { | ||
|
|
@@ -32,8 +29,9 @@ public class DynamicMap_FeaturesPageViewModel : ViewModel, IDynamicMapComponent | |
| private ISectionsNavigator _sectionsNavigator; | ||
| private readonly IDispatcherScheduler _dispatcherScheduler; | ||
|
|
||
| public DynamicMap_FeaturesPageViewModel() | ||
| public DynamicMap_FeaturesPageViewModel(bool isClusterEnabled = false) | ||
| { | ||
| IsClusterEnabled = isClusterEnabled; | ||
| _geolocatorService = this.GetService<IGeolocatorService>(); | ||
| _sectionsNavigator = this.GetService<ISectionsNavigator>(); | ||
| _dispatcherScheduler = this.GetService<IDispatcherScheduler>(); | ||
|
|
@@ -179,6 +177,12 @@ public bool IsUserDragging | |
| set => this.Set(value); | ||
| } | ||
|
|
||
| public bool IsClusterEnabled | ||
|
||
| { | ||
| get => this.Get<bool>(initialValue: false); | ||
| set => this.Set(value); | ||
|
||
| } | ||
|
|
||
| public LocationResult UserLocation | ||
| { | ||
| get => this.Get<LocationResult>(); | ||
|
|
@@ -292,17 +296,57 @@ private PushpinEntity[] GetInitialPushpins() | |
| new PushpinEntity | ||
| { | ||
| Name = "Pushpin 1", | ||
| Coordinates = new Geopoint(new BasicGeoposition{Latitude = 46.3938717, Longitude = -72.0921769}) | ||
| Coordinates = new Geopoint(new BasicGeoposition { Latitude = 45.5040713, Longitude = -73.5587092 }) | ||
| }, | ||
| new PushpinEntity | ||
| { | ||
| Name = "Pushpin 2", | ||
| Coordinates = new Geopoint(new BasicGeoposition { Latitude = 45.5502838, Longitude = -73.2801901 }) | ||
| Coordinates = new Geopoint(new BasicGeoposition { Latitude = 45.5041113, Longitude = -73.5584092 }) | ||
| }, | ||
| new PushpinEntity | ||
| { | ||
| Name = "Pushpin 3", | ||
| Coordinates = new Geopoint(new BasicGeoposition { Latitude = 45.5502838, Longitude = -72.0921769 }) | ||
| Coordinates = new Geopoint(new BasicGeoposition { Latitude = 45.5035613, Longitude = -73.5587392 }) | ||
| }, | ||
| new PushpinEntity | ||
| { | ||
| Name = "Pushpin 4", | ||
| Coordinates = new Geopoint(new BasicGeoposition { Latitude = 45.5043413, Longitude = -73.5567092 }) | ||
| }, | ||
| new PushpinEntity | ||
| { | ||
| Name = "Pushpin 5", | ||
| Coordinates = new Geopoint(new BasicGeoposition { Latitude = 45.5040713, Longitude = -73.5547092 }) | ||
| }, | ||
| new PushpinEntity | ||
| { | ||
| Name = "Pushpin 6", | ||
| Coordinates = new Geopoint(new BasicGeoposition { Latitude = 45.5042713, Longitude = -73.5583092 }) | ||
| }, | ||
| new PushpinEntity | ||
| { | ||
| Name = "Pushpin 7", | ||
| Coordinates = new Geopoint(new BasicGeoposition { Latitude = 45.5046513, Longitude = -73.5587492 }) | ||
| }, | ||
| new PushpinEntity | ||
| { | ||
| Name = "Pushpin 8", | ||
| Coordinates = new Geopoint(new BasicGeoposition { Latitude = 45.5042313, Longitude = -73.5583562 }) | ||
| }, | ||
| new PushpinEntity | ||
| { | ||
| Name = "Pushpin 9", | ||
| Coordinates = new Geopoint(new BasicGeoposition { Latitude = 45.5040313, Longitude = -73.5584322 }) | ||
| }, | ||
| new PushpinEntity | ||
| { | ||
| Name = "Pushpin 10", | ||
| Coordinates = new Geopoint(new BasicGeoposition { Latitude = 45.5502338, Longitude = -73.2801901 }) | ||
| }, | ||
| new PushpinEntity | ||
| { | ||
| Name = "Pushpin 11", | ||
| Coordinates = new Geopoint(new BasicGeoposition { Latitude = 45.5501838, Longitude = -72.0921769 }) | ||
| }, | ||
| }; | ||
| } | ||
|
|
@@ -387,7 +431,7 @@ private async Task<GeoViewPort> GetUserCoordinates(CancellationToken ct) | |
| var newPushpin = await CreatePushpinAtCenter(ct); | ||
|
|
||
| var list = pushpins.ToList(); | ||
| list.Add((IGeoLocated)newPushpin); | ||
| list.Add(newPushpin); | ||
|
|
||
| Pushpins = list.ToArray(); | ||
| }); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,6 +103,12 @@ public int? AnimationDurationSeconds | |
| await _sectionsNavigator.Navigate(ct, () => new DynamicMapMenuViewModel()); | ||
| }); | ||
|
|
||
| public bool IsClusterEnabled | ||
|
||
| { | ||
| get => this.Get(initialValue: false); | ||
| set => this.Set(value); | ||
| } | ||
|
|
||
| private MapViewPort GetStartingCoordinates() | ||
| { | ||
| var mapViewPort = new MapViewPort(new Geopoint(new BasicGeoposition { Latitude = 45.503343, Longitude = -73.571695 })); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,7 @@ | |
|
|
||
| <ItemGroup Condition="'$(TargetFramework)' == 'xamarinios10'"> | ||
| <PackageReference Include="Xamarin.Google.iOS.Maps" Version="3.9.0" /> | ||
| <PackageReference Include="Xamarin.Google.Maps.Utils" Version="1.3.4" /> | ||
|
||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
|
|
@@ -55,12 +56,9 @@ | |
| </ItemGroup> | ||
|
|
||
| <ItemGroup Condition="'$(TargetFramework)' == 'monoandroid12.0'"> | ||
| <PackageReference Include="Xamarin.GooglePlayServices.Base"> | ||
| <Version>117.6.0.5</Version> | ||
| </PackageReference> | ||
| <PackageReference Include="Xamarin.GooglePlayServices.Maps"> | ||
| <Version>117.0.1.5</Version> | ||
| </PackageReference> | ||
| <PackageReference Include="Xamarin.Google.Maps.Utils" Version="1.3.4" /> | ||
| <PackageReference Include="Xamarin.GooglePlayServices.Base" Version="117.6.0.5" /> | ||
| <PackageReference Include="Xamarin.GooglePlayServices.Maps" Version="117.0.1.5" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,27 +11,27 @@ namespace Cartography.DynamicMap | |
| public interface IDynamicMapComponent | ||
|
||
| { | ||
| /// <summary> | ||
| /// Pushpins to display on map | ||
| /// Pushpins to display on map. | ||
| /// </summary> | ||
| IGeoLocated[] Pushpins { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Selected pushpin | ||
| /// Selected pushpin. | ||
| /// </summary> | ||
| IGeoLocated[] SelectedPushpins { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Groups to display on map | ||
| /// Groups to display on map. | ||
| /// </summary> | ||
| IGeoLocatedGrouping<IGeoLocated[]> Groups { get; set; } | ||
|
||
|
|
||
| /// <summary> | ||
| /// Min delay to wait between two map viewport update | ||
| /// Min delay to wait between two map viewport update. | ||
| /// </summary> | ||
| TimeSpan ViewPortUpdateMinDelay { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Equality comparer to use to filter the map viewport updates | ||
| /// Equality comparer to use to filter the map viewport updates. | ||
| /// </summary> | ||
| IEqualityComparer<MapViewPort> ViewPortUpdateFilter { get; set; } | ||
|
|
||
|
|
@@ -41,48 +41,53 @@ public interface IDynamicMapComponent | |
| Action<Geocoordinate> OnMapTapped { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Defines whether user tracking is enabled - READ / WRITE | ||
| /// Defines whether user tracking is enabled - READ / WRITE. | ||
|
||
| /// </summary> | ||
| bool IsUserTrackingCurrentlyEnabled { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Whether or not the user is currently dragging the map | ||
| /// Whether or not the user is currently dragging the map. | ||
| /// </summary> | ||
| bool IsUserDragging { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// User location if any and if display requested, else empty value | ||
| /// </summary> | ||
| LocationResult UserLocation { get; set; } | ||
| /// <summary> | ||
| /// Whether or not the pushpin clustering is enabled. | ||
| /// </summary> | ||
| bool IsClusterEnabled { get; set; } | ||
|
||
|
|
||
| /// <summary> | ||
| /// User location if any and if display requested, else empty value. | ||
| /// </summary> | ||
| LocationResult UserLocation { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// VisibleRegion of the map - READ ONLY | ||
| /// VisibleRegion of the map - READ ONLY. | ||
|
||
| /// </summary> | ||
| MapViewPortCoordinates ViewPortCoordinates { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// ViewPort of the map - READ / WRITE - First viewport MUST be provided by VM | ||
| /// ViewPort of the map - READ / WRITE - First viewport MUST be provided by VM. | ||
| /// </summary> | ||
| MapViewPort ViewPort { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Sets the desired animation duration | ||
| /// Sets the desired animation duration. | ||
| /// </summary> | ||
| int? AnimationDurationSeconds { get; set; } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// The MapComponent default value for some field | ||
| /// The MapComponent default value for some field. | ||
| /// </summary> | ||
| public static class MapComponentDefaultValue | ||
| { | ||
| /// <summary> | ||
| /// Get the Default ViewPortUpdateMinDelay | ||
| /// Get the Default ViewPortUpdateMinDelay. | ||
| /// </summary> | ||
| public static TimeSpan DefaultViewPortUpdateMinDelay = TimeSpan.FromMilliseconds(250); | ||
|
|
||
| /// <summary> | ||
| /// Get the Default ViewPortUpdateFilter | ||
| /// Get the Default ViewPortUpdateFilter. | ||
| /// </summary> | ||
| public static IEqualityComparer<MapViewPort> DefaultViewPortUpdateFilter = | ||
| new PrettyMapViewPortEqualityComparer(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know I'm nit-picky but use some capital letters please. Don't do it if you don't want to.