-
Notifications
You must be signed in to change notification settings - Fork 531
[New sample] Snap geometry edits with utility network rules #1566
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
Changes from 12 commits
59723ec
4b490bc
9f23cb6
1b2f0f6
dc0679a
41abdd4
d6746b7
71ff895
10ff349
b608f1c
1a9c625
8873604
f8a7f3a
ec5d158
0470c72
d870094
ff61331
6fbb6b1
f4061fc
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 |
|---|---|---|
| @@ -0,0 +1,187 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <ContentPage x:Class="ArcGIS.Samples.SnapGeometryEditsWithUtilityNetworkRules.SnapGeometryEditsWithUtilityNetworkRules" | ||
| xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
| xmlns:converters="http://schemas.microsoft.com/dotnet/2022/maui/toolkit" | ||
| xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Maui;assembly=Esri.ArcGISRuntime.Maui"> | ||
| <ContentPage.Resources> | ||
| <DataTemplate x:Key="SnapSettingTemplate"> | ||
| <Grid ColumnDefinitions="auto,130,*" ColumnSpacing="10"> | ||
| <Image Grid.Column="0" | ||
| HeightRequest="15" | ||
| HorizontalOptions="Start" | ||
| Source="{Binding Path=Symbol}" | ||
| VerticalOptions="Center" | ||
| WidthRequest="15" /> | ||
| <Label Grid.Column="1" | ||
| Text="{Binding Path=Name}" | ||
| VerticalOptions="Center" /> | ||
| <CheckBox Grid.Column="2" | ||
| IsChecked="{Binding Path=SnapSourceSettings.IsEnabled}" | ||
| VerticalOptions="Center" /> | ||
| </Grid> | ||
| </DataTemplate> | ||
| <Style x:Key="IconStyle" TargetType="Button"> | ||
| <Style.Setters> | ||
| <Setter Property="FontFamily" Value="calcite-ui-icons-24" /> | ||
| <Setter Property="FontSize" Value="25" /> | ||
| <Setter Property="BackgroundColor" Value="{AppThemeBinding Dark=#3C3C3C, Light=White}" /> | ||
| </Style.Setters> | ||
| </Style> | ||
| <converters:InvertedBoolConverter x:Key="InvertedBoolConverter" /> | ||
| </ContentPage.Resources> | ||
| <Grid> | ||
| <esriUI:MapView x:Name="MyMapView" GeoViewTapped="MyMapView_GeoViewTapped" /> | ||
| <Border x:Name="SnappingControls" | ||
| Margin="10" | ||
| HorizontalOptions="End" | ||
| IsVisible="False" | ||
| StrokeThickness="0" | ||
| VerticalOptions="Start" | ||
| WidthRequest="250"> | ||
| <Grid> | ||
| <Grid.RowDefinitions> | ||
| <RowDefinition Height="auto" /> | ||
| <RowDefinition Height="*" /> | ||
| </Grid.RowDefinitions> | ||
| <StackLayout Grid.Row="0" | ||
| Orientation="Vertical" | ||
| Spacing="5"> | ||
| <Border Background="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Dark}}" StrokeThickness="0"> | ||
| <Border.StrokeShape> | ||
| <RoundRectangle CornerRadius="5" /> | ||
| </Border.StrokeShape> | ||
| <StackLayout> | ||
| <Label x:Name="InstructionsLabel" | ||
| Padding="10" | ||
| FontSize="14" | ||
| Text="Tap a point feature to edit." /> | ||
| </StackLayout> | ||
| </Border> | ||
| <StackLayout x:Name="SelectedFeaturePanel" | ||
| IsVisible="False" | ||
| Spacing="5"> | ||
| <Border Padding="10" | ||
| Background="{AppThemeBinding Light={StaticResource White}, | ||
| Dark={StaticResource Dark}}" | ||
| StrokeThickness="0"> | ||
| <Border.StrokeShape> | ||
| <RoundRectangle CornerRadius="5" /> | ||
| </Border.StrokeShape> | ||
| <StackLayout> | ||
| <Label Margin="0,0,0,5" | ||
| FontAttributes="Bold" | ||
| FontSize="14" | ||
| Text="Feature selected" /> | ||
| <Grid RowSpacing="5"> | ||
| <Grid.ColumnDefinitions> | ||
| <ColumnDefinition Width="auto" /> | ||
| <ColumnDefinition Width="*" /> | ||
| </Grid.ColumnDefinitions> | ||
| <Grid.RowDefinitions> | ||
| <RowDefinition Height="auto" /> | ||
| <RowDefinition Height="auto" /> | ||
| </Grid.RowDefinitions> | ||
| <Label Grid.Row="0" | ||
| Grid.Column="0" | ||
| Margin="0,0,5,0" | ||
| Text="AssetGroup:" /> | ||
| <Label x:Name="SelectedAssetGroupLabel" | ||
| Grid.Row="0" | ||
| Grid.Column="1" /> | ||
| <Label Grid.Row="1" | ||
| Grid.Column="0" | ||
| Margin="0,0,5,0" | ||
| Text="AssetType:" /> | ||
| <Label x:Name="SelectedAssetTypeLabel" | ||
| Grid.Row="1" | ||
| Grid.Column="1" /> | ||
| </Grid> | ||
| </StackLayout> | ||
| </Border> | ||
| <Button x:Name="SnapSourcesButton" | ||
| Clicked="SnapSourcesButton_Clicked" | ||
| Text="Snap sources" /> | ||
| <Button x:Name="GeometryEditorButton" | ||
| Clicked="GeometryEditorButton_Click" | ||
| IsEnabled="{Binding GeometryEditor.IsStarted, Source={x:Reference MyMapView}, Converter={StaticResource InvertedBoolConverter}}" | ||
| Text="Start editor" /> | ||
| <Grid ColumnSpacing="5"> | ||
| <Grid.ColumnDefinitions> | ||
| <ColumnDefinition Width="0.5*" /> | ||
| <ColumnDefinition Width="0.5*" /> | ||
| </Grid.ColumnDefinitions> | ||
| <Button Grid.Column="0" | ||
| Clicked="DiscardButton_Click" | ||
| IsEnabled="{Binding GeometryEditor.IsStarted, Source={x:Reference MyMapView}}" | ||
| Style="{StaticResource IconStyle}" | ||
| Text="" | ||
| ToolTipProperties.Text="Discard edits" /> | ||
| <Button x:Name="SaveButton" | ||
| Grid.Column="1" | ||
| Clicked="SaveButton_Click" | ||
| IsEnabled="{Binding GeometryEditor.CanUndo, Source={x:Reference MyMapView}}" | ||
| Style="{StaticResource IconStyle}" | ||
| Text="" | ||
| ToolTipProperties.Text="Save edits" /> | ||
| </Grid> | ||
| </StackLayout> | ||
| </StackLayout> | ||
| </Grid> | ||
| </Border> | ||
| <Grid x:Name="SnapSourcesPopup" | ||
| Grid.ColumnSpan="2" | ||
| Padding="10" | ||
| Background="#AA333333" | ||
| IsVisible="False"> | ||
| <Border Margin="10" | ||
| Background="{AppThemeBinding Dark=Black, | ||
| Light=White}" | ||
| HorizontalOptions="Center" | ||
| StrokeShape="RoundRectangle 10" | ||
| VerticalOptions="Center" | ||
| WidthRequest="300"> | ||
| <Border.GestureRecognizers> | ||
| <TapGestureRecognizer /> | ||
| </Border.GestureRecognizers> | ||
| <StackLayout Padding="10" Spacing="10"> | ||
| <Label Padding="0,5" | ||
| FontAttributes="Bold" | ||
| FontSize="14" | ||
| Text="Snap sources" /> | ||
| <CollectionView x:Name="SnapSourcesList" | ||
| Margin="15,0" | ||
| ItemTemplate="{StaticResource SnapSettingTemplate}" /> | ||
| <Label FontAttributes="Bold" | ||
| FontSize="14" | ||
| Text="SnapRuleBehavior" /> | ||
| <StackLayout Margin="20,0,0,0" Orientation="Horizontal"> | ||
| <Rectangle Grid.Column="0" | ||
| Margin="0,0,5,0" | ||
| Fill="Green" | ||
| HeightRequest="10" | ||
| WidthRequest="10" /> | ||
| <Label Text="None" /> | ||
| </StackLayout> | ||
| <StackLayout Margin="20,0,0,0" Orientation="Horizontal"> | ||
| <Rectangle Grid.Column="0" | ||
| Margin="0,0,5,0" | ||
| Fill="Orange" | ||
| HeightRequest="10" | ||
| WidthRequest="10" /> | ||
| <Label Text="RulesLimitSnapping" /> | ||
| </StackLayout> | ||
| <StackLayout Margin="20,0,0,0" Orientation="Horizontal"> | ||
| <Rectangle Grid.Column="0" | ||
| Margin="0,0,5,0" | ||
| Fill="Red" | ||
| HeightRequest="10" | ||
| WidthRequest="10" /> | ||
| <Label Text="RulesPreventSnapping" /> | ||
| </StackLayout> | ||
| <Button Clicked="SnapSourcesButton_Clicked" Text="Close" /> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your choice, but I think this button could be removed. A tap gesture recognizer when tapping a semitransparent border would work since you're following the popup UI pattern, alike the TakeScreenshot MAUI sample.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought about using a tap gesture recognizer here as well, I tried with and without and I think I prefer the button in this case. Mostly because we don't need a scroll view here so it's easy to see the snap sources and the close button all together. If you're happy I'll leave it in.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed my mind and removed it 👍
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My apologies, the TakeScreenshot sample wasn't a great example since tapping anywhere on screen closes the screenshot "popup". Tapping anywhere in the popup, say the snap source checkbox shouldn't close the popup automatically. But tapping the greyed out GeoView should close out the popup. DisplayGrid is a better sample of what I meant by the popup UI pattern. The problem was the grid with the greyed out the semitransparent background was the parent of the popup, so tapping the popup was also tapping the grid due to inheritance. I went ahead and separated the popup background from the actual popup (indention is why the diff is large, did not make any other edits). commit: 6fbb6b1 |
||
| </StackLayout> | ||
| </Border> | ||
| </Grid> | ||
| </Grid> | ||
| </ContentPage> | ||


Uh oh!
There was an error while loading. Please reload this page.