-
Notifications
You must be signed in to change notification settings - Fork 128
Support for BasemapGallery toolkit control to include 3D Basemaps #628
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
Conversation
Changed 3D basemap identification from Enum to boolean for simplified binding
…wAppearanceSample`.
src/Toolkit/Toolkit.Maui/BasemapGallery/BasemapGallery.Appearance.cs
Outdated
Show resolved
Hide resolved
src/Toolkit/Toolkit.WPF/UI/Controls/BasemapGallery/BasemapGallery.Theme.xaml
Outdated
Show resolved
Hide resolved
src/Toolkit/Toolkit.Maui/BasemapGallery/BasemapGallery.Appearance.cs
Outdated
Show resolved
Hide resolved
src/Toolkit/Toolkit.Maui/BasemapGallery/BasemapGallery.Appearance.cs
Outdated
Show resolved
Hide resolved
src/Toolkit/Toolkit.WinUI/UI/Controls/BasemapGallery/BasemapGallery.Theme.xaml
Outdated
Show resolved
Hide resolved
src/Toolkit/Toolkit.WinUI/UI/Controls/BasemapGallery/BasemapGallery.Theme.xaml
Show resolved
Hide resolved
src/Toolkit/Toolkit.WinUI/Esri.ArcGISRuntime.Toolkit.WinUI.csproj
Outdated
Show resolved
Hide resolved
src/Toolkit/Toolkit/UI/Controls/BasemapGallery/BasemapGalleryController.cs
Outdated
Show resolved
Hide resolved
src/Toolkit/Toolkit.WPF/UI/Controls/BasemapGallery/BasemapGallery.Theme.xaml
Outdated
Show resolved
Hide resolved
src/Toolkit/Toolkit.WinUI/UI/Controls/BasemapGallery/BasemapGallery.Theme.xaml
Outdated
Show resolved
Hide resolved
src/Toolkit/Toolkit/UI/Controls/BasemapGallery/BasemapGalleryController.cs
Outdated
Show resolved
Hide resolved
src/Toolkit/Toolkit/UI/Controls/BasemapGallery/BasemapGalleryController.cs
Outdated
Show resolved
Hide resolved
src/Toolkit/Toolkit/UI/Controls/BasemapGallery/BasemapGalleryController.cs
Outdated
Show resolved
Hide resolved
src/Toolkit/Toolkit/UI/Controls/BasemapGallery/BasemapGalleryController.cs
Outdated
Show resolved
Hide resolved
src/Toolkit/Toolkit/UI/Controls/BasemapGallery/BasemapGalleryController.cs
Show resolved
Hide resolved
src/Toolkit/Toolkit.Maui/BasemapGallery/BasemapGallery.Appearance.cs
Outdated
Show resolved
Hide resolved
src/Toolkit/Toolkit.Maui/BasemapGallery/BasemapGallery.Appearance.cs
Outdated
Show resolved
Hide resolved
src/Toolkit/Toolkit.Maui/BasemapGallery/BasemapGallery.Appearance.cs
Outdated
Show resolved
Hide resolved
src/Toolkit/Toolkit.Maui/BasemapGallery/BasemapGallery.Appearance.cs
Outdated
Show resolved
Hide resolved
src/Toolkit/Toolkit.WinUI/UI/Controls/BasemapGallery/BasemapGallery.Theme.xaml
Outdated
Show resolved
Hide resolved
src/Toolkit/Toolkit.WinUI/UI/Controls/BasemapGallery/BasemapGallery.Theme.xaml
Outdated
Show resolved
Hide resolved
| <toolkit:BasemapGallery | ||
| x:Name="Gallery" | ||
| Width="{x:Bind WidthSlider.Value}" | ||
| Width="{x:Bind WidthSlider.Value, Mode=OneWay}" |
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.
Added Mode to One way to fix Width slider in WinUI and UWP.
| Grid thumbnailGrid = new Grid() { WidthRequest = 64, HeightRequest = 64 }; | ||
| Image thumbnail = new Image { Aspect = Aspect.AspectFill, BackgroundColor = Colors.Transparent, HorizontalOptions = LayoutOptions.Center }; | ||
| Border itemTypeBorder = new Border | ||
| { | ||
| StrokeShape = new RoundRectangle { CornerRadius = new CornerRadius(7) }, | ||
| Padding = new Thickness(4, 0), | ||
| Margin = new Thickness(2), | ||
| HorizontalOptions = LayoutOptions.End, | ||
| VerticalOptions = LayoutOptions.Start, | ||
| }; | ||
| itemTypeBorder.SetAppThemeColor(BackgroundColorProperty, Colors.LightGray, Colors.DarkGray); | ||
| Grid.SetRow(itemTypeBorder, 1); | ||
|
|
||
| Label itemTypeLabel = new Label | ||
| { | ||
| Text = "3D", | ||
| Margin = new Thickness(1), | ||
| HorizontalTextAlignment = TextAlignment.Center, | ||
| FontSize = 9, | ||
| FontAttributes = FontAttributes.Bold | ||
| }; | ||
| itemTypeLabel.SetAppThemeColor(Label.TextColorProperty, Colors.Black, Colors.White); | ||
| itemTypeBorder.Content = itemTypeLabel; | ||
| itemTypeBorder.SetBinding(Border.IsVisibleProperty, static (BasemapGalleryItem item) => item.Is3D, BindingMode.OneWay); | ||
|
|
||
| thumbnailGrid.Children.Add(thumbnail); | ||
| thumbnailGrid.Children.Add(itemTypeBorder); | ||
|
|
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.
Here we added the Type of the Basemap (3D) identifier as seen in screenshot and unified thumbnail in a Grid
| { | ||
| // Special template to take advantage of negative margin support on iOS, Mac | ||
|
|
||
| Border border = new Border | ||
| { | ||
| Padding = new Thickness(0), | ||
| #if __IOS__ | ||
| StrokeThickness = 8, | ||
| #else | ||
| StrokeThickness = 1, | ||
| #endif | ||
| StrokeShape = new Rectangle(), | ||
| }; |
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.
Here, we just moved the code at bottom and maintained same structure as Grid View of BasemapGallery
| private async Task<ObservableCollection<BasemapGalleryItem>> LoadBasemapGalleryItems(ArcGISPortal portal, CancellationToken cancellationToken = default) | ||
| { | ||
| ArcGISPortal defaultPortal = await ArcGISPortal.CreateAsync(cancellationToken); | ||
|
|
||
| var results = await defaultPortal.GetDeveloperBasemapsAsync(cancellationToken); | ||
|
|
||
| var listOfBasemaps = new List<BasemapGalleryItem>(); | ||
|
|
||
| foreach (var basemap in results) | ||
| async Task<List<BasemapGalleryItem>> LoadBasemapsAsync(Func<CancellationToken, Task<IEnumerable<Basemap>>> getBasemapsFunc) | ||
| { | ||
| listOfBasemaps.Add(new BasemapGalleryItem(basemap)); | ||
| var basemaps = await getBasemapsFunc(cancellationToken); | ||
| var basemapItems = basemaps.Select(basemap => new BasemapGalleryItem(basemap)).ToList(); | ||
| foreach (var item in basemapItems) | ||
| { | ||
| _ = item.LoadAsync(); | ||
| } | ||
| return basemapItems; | ||
| } | ||
| var basemapGalleryItems = new List<BasemapGalleryItem>(); | ||
|
|
||
| foreach (var item in listOfBasemaps) | ||
| if (portal.PortalInfo?.Use3DBasemaps is true && GeoModel is Scene) | ||
| { | ||
| _ = item.LoadAsync(); | ||
| _cached3DBasemaps ??= await LoadBasemapsAsync(portal.Get3DBasemapsAsync); | ||
| basemapGalleryItems.AddRange(_cached3DBasemaps); | ||
| } | ||
| return new ObservableCollection<BasemapGalleryItem>(listOfBasemaps); | ||
|
|
||
| _cached2DBasemaps ??= await LoadBasemapsAsync(portal.PortalInfo?.UseVectorBasemaps ?? false | ||
| ? portal.GetVectorBasemapsAsync | ||
| : portal.GetBasemapsAsync); | ||
| basemapGalleryItems.AddRange(_cached2DBasemaps); | ||
|
|
||
| return new ObservableCollection<BasemapGalleryItem>(basemapGalleryItems); |
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.
This is the effort to reduce redundant code and unify Loading of Basemaps based on type of GeoModel, caching and support to 3D basemaps
| public async Task LoadFromDefaultPortal() | ||
| { | ||
| IsLoading = true; | ||
| _loadCancellationTokenSource = new CancellationTokenSource(); | ||
| try | ||
| { | ||
| AvailableBasemaps = await PopulateFromDefaultList(_loadCancellationTokenSource.Token); | ||
| } | ||
| catch (OperationCanceledException) | ||
| { } | ||
| finally | ||
| { | ||
| IsLoading = false; | ||
| } | ||
| } | ||
|
|
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.
This code has been moved close to its invocation and implementation here.
| /// <summary> | ||
| /// Gets a value indicating whether this basemap is a 3D basemap. | ||
| /// </summary> | ||
| public bool Is3D => this.Basemap?.BaseLayers?.OfType<ArcGISSceneLayer>()?.Any() ?? false; | ||
|
|
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.
This property is used to bind the visibility of 3D tag on basemap.
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.
LGTM, thanks 👍 Great job, big PR 👏
* Set version to 200.7 Compile WinUI with AoT support * Order sample collection * Add AoT support to Basemap Gallery * Add x:Bind expressions to sample pages * Add xaml generation to winui * project settings cleanup * Avoid use of implicit datacontext bindings Use relative source or code-behind whenever possible * Rewrites several parts of the SearchView to make it AoT compatible in WinUI (#620) * Rewrites several parts of the SearchView to make it AoT compatible in WinUI * Merge main to v.next (#623) * Update BookmarksView template to use StackLayout and Labels to adapt new CollectionView. (#621) * Add XML namespace and data binding in SymbolEditorSample to resolve bug with Angle property not being refresh in MAUI Android. (#622) * Fix maui version * Remove unused dependency * Update WinUI AoT table * Fix preview in compatibility table * Add built-in barcode scanning (#615) * Add support for built-in iOS barcode scanner * Add Windows support to barcode scanner * Adding barcode scanner to Android (#624) * Adding barcode scanner to Android * Improve windows scanning performance by just using default scanner Improves scanner launch time from ~40s to 1-2s due to a poor/ineffecient device selector string. * Update ios/catalyst target to 18.0 to match default ios tfm * Fix warnings in Android introduced by transitive packages by locking in the dependent version minimums * Fix indents * Support for BasemapGallery toolkit control to include 3D Basemaps (#628) * Add 3D Basemap Gallery support in WPF and BasemapGalleryItem * Add 3D basemap support to BasemapGallery in UWP, WinUI and MAUI Changed 3D basemap identification from Enum to boolean for simplified binding * Added condition to check if `GeoModel` is a `Scene` before fetching 3D basemaps * Renamed `BasemapGallery3DAppearanceSample` to `BasemapGallerySceneViewAppearanceSample`. * Consolidated Basemap fetching methods * Refactor BasemapGalleryItem to dynamically determine Is3D * Refactored 3D tag in BasemapGallery to sta on top right corner of the image in Grid View. * Introduce caching for basemaps in BasemapGalleryController * Update src/Toolkit/Toolkit.WinUI/Esri.ArcGISRuntime.Toolkit.WinUI.csproj * Update bindings to use static lambdas for type safety as new feature from .Net 9 * Reverted binding style for private set properties * Revert Margin in Basemap Gallery Item * Fixing bug in BasemapGallery loading * Restore styling for basemapgallery * Refactor basemap loading to be fully asynchronous * Refactor basemap loading and update visibility handling * Update BasemapGallery itemTypeBorder to theme-based color * Add one-way binding to fix the width sldier in WinUI and UWP and error handling improvements * Refactor loading state handling in BasemapGalleryController * Refactor basemap update logic in BasemapGallery * Enhance theme management in BasemapGallery * Disable aot Several controls are still not AoT compatible * Enhance basemap loading with async task management caching (#631) * Enhance basemap loading with async task management caching - Introduces Task caching mechanism to manage asynchronous loading of basemap gallery items. - Updates `LoadBasemapGalleryItems` to check for ongoing tasks, preventing multiple concurrent loads. * Refactor basemap loading and portal change handling * Refactor basemap handling on portal changes. Restored `HandlePortalChanged` to manage portal changed event including cache invalidation and asynchronous basemap updates. Added invalidating of cache on `AvailableBasemaps` assigned manually. * Skip rendering unknown feature form element types * Skip rendering unknown popup element types * Mac Catalyst min version is 15 * Fix expired app certificate --------- Co-authored-by: Prathamesh Narkhede <[email protected]> Co-authored-by: Prathamesh Narkhede <[email protected]> Co-authored-by: Morten Nielsen <[email protected]>
… 9 (#630) * Set version to 200.7 Compile WinUI with AoT support * Order sample collection * Add AoT support to Basemap Gallery * Add x:Bind expressions to sample pages * Add xaml generation to winui * project settings cleanup * Avoid use of implicit datacontext bindings Use relative source or code-behind whenever possible * Rewrites several parts of the SearchView to make it AoT compatible in WinUI (#620) * Rewrites several parts of the SearchView to make it AoT compatible in WinUI * Merge main to v.next (#623) * Update BookmarksView template to use StackLayout and Labels to adapt new CollectionView. (#621) * Add XML namespace and data binding in SymbolEditorSample to resolve bug with Angle property not being refresh in MAUI Android. (#622) * Fix maui version * Remove unused dependency * Update WinUI AoT table * Fix preview in compatibility table * Add built-in barcode scanning (#615) * Add support for built-in iOS barcode scanner * Add Windows support to barcode scanner * Adding barcode scanner to Android (#624) * Adding barcode scanner to Android * Improve windows scanning performance by just using default scanner Improves scanner launch time from ~40s to 1-2s due to a poor/ineffecient device selector string. * Update ios/catalyst target to 18.0 to match default ios tfm * Fix warnings in Android introduced by transitive packages by locking in the dependent version minimums * Fix indents * Support for BasemapGallery toolkit control to include 3D Basemaps (#628) * Add 3D Basemap Gallery support in WPF and BasemapGalleryItem * Add 3D basemap support to BasemapGallery in UWP, WinUI and MAUI Changed 3D basemap identification from Enum to boolean for simplified binding * Added condition to check if `GeoModel` is a `Scene` before fetching 3D basemaps * Renamed `BasemapGallery3DAppearanceSample` to `BasemapGallerySceneViewAppearanceSample`. * Consolidated Basemap fetching methods * Refactor BasemapGalleryItem to dynamically determine Is3D * Refactored 3D tag in BasemapGallery to sta on top right corner of the image in Grid View. * Introduce caching for basemaps in BasemapGalleryController * Update src/Toolkit/Toolkit.WinUI/Esri.ArcGISRuntime.Toolkit.WinUI.csproj * Update bindings to use static lambdas for type safety as new feature from .Net 9 * Reverted binding style for private set properties * Revert Margin in Basemap Gallery Item * Fixing bug in BasemapGallery loading * Restore styling for basemapgallery * Refactor basemap loading to be fully asynchronous * Refactor basemap loading and update visibility handling * Update BasemapGallery itemTypeBorder to theme-based color * Add one-way binding to fix the width sldier in WinUI and UWP and error handling improvements * Refactor loading state handling in BasemapGalleryController * Refactor basemap update logic in BasemapGallery * Enhance theme management in BasemapGallery * Updated MAUI bindings to use new Compiled Bindings introduced in .Net 9 * Correcting data bindings and tested the code. Removed CodeAnalysis Dynamic Dependencies * Remove unused directives and dependencies in FloorFilter * Remove DynamicDependency attributes and update to correct bindings * Corrected bindings for FormAttachment * Corrected Attachment binding for AttachmentsFormElementView * Fix tooltip binding in AttachmentsFormElementView * Refactor binding expressions for type safety * Refactor popup element bindings for clarity * Refactor element parameter types in bindings to its base type * Update Picker IsEnabled binding in ComboBoxFormInputView to point source to TemplatedParent * Remove AOT compilation from project configuration --------- Co-authored-by: dotMorten <[email protected]> Co-authored-by: Morten Nielsen <[email protected]> Co-authored-by: dotMorten <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.