Skip to content

Commit 54f1781

Browse files
duffhprathameshnarkhedewilliambohrmann3
authored
[New sample] Snap geometry edits with utility network rules (#1566)
Co-authored-by: Prathamesh Narkhede <55591622+prathameshnarkhede@users.noreply.github.com> Co-authored-by: William Bohrmann <wbohrmann@esri.com>
1 parent 4caa5d9 commit 54f1781

20 files changed

Lines changed: 2138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ContentPage x:Class="ArcGIS.Samples.SnapGeometryEditsWithUtilityNetworkRules.SnapGeometryEditsWithUtilityNetworkRules"
3+
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
5+
xmlns:converters="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
6+
xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Maui;assembly=Esri.ArcGISRuntime.Maui">
7+
<ContentPage.Resources>
8+
<DataTemplate x:Key="SnapSettingTemplate">
9+
<Grid ColumnDefinitions="auto,130,*" ColumnSpacing="10">
10+
<Image Grid.Column="0"
11+
HeightRequest="15"
12+
HorizontalOptions="Start"
13+
Source="{Binding Path=Symbol}"
14+
VerticalOptions="Center"
15+
WidthRequest="15" />
16+
<Label Grid.Column="1"
17+
Text="{Binding Path=Name}"
18+
VerticalOptions="Center" />
19+
<CheckBox Grid.Column="2"
20+
IsChecked="{Binding Path=SnapSourceSettings.IsEnabled}"
21+
VerticalOptions="Center" />
22+
</Grid>
23+
</DataTemplate>
24+
<Style x:Key="IconStyle" TargetType="Button">
25+
<Style.Setters>
26+
<Setter Property="FontFamily" Value="calcite-ui-icons-24" />
27+
<Setter Property="FontSize" Value="25" />
28+
<Setter Property="BackgroundColor" Value="{AppThemeBinding Dark=#3C3C3C, Light=White}" />
29+
</Style.Setters>
30+
</Style>
31+
<converters:InvertedBoolConverter x:Key="InvertedBoolConverter" />
32+
</ContentPage.Resources>
33+
<Grid>
34+
<esriUI:MapView x:Name="MyMapView" GeoViewTapped="MyMapView_GeoViewTapped" />
35+
<Border x:Name="SnappingControls"
36+
Margin="10"
37+
HorizontalOptions="End"
38+
IsVisible="False"
39+
StrokeThickness="0"
40+
VerticalOptions="Start"
41+
WidthRequest="250">
42+
<Border.StrokeShape>
43+
<RoundRectangle CornerRadius="5"/>
44+
</Border.StrokeShape>
45+
<Grid>
46+
<Grid.RowDefinitions>
47+
<RowDefinition Height="auto" />
48+
<RowDefinition Height="*" />
49+
</Grid.RowDefinitions>
50+
<StackLayout Grid.Row="0"
51+
Orientation="Vertical"
52+
Spacing="5">
53+
<Border Background="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Dark}}" StrokeThickness="0">
54+
<Border.StrokeShape>
55+
<RoundRectangle CornerRadius="5" />
56+
</Border.StrokeShape>
57+
<StackLayout>
58+
<Label x:Name="InstructionsLabel"
59+
Padding="10"
60+
FontSize="14"
61+
Text="Tap a point feature to edit." />
62+
</StackLayout>
63+
</Border>
64+
<StackLayout x:Name="SelectedFeaturePanel"
65+
IsVisible="False"
66+
Spacing="5">
67+
<Border Padding="10"
68+
Background="{AppThemeBinding Light={StaticResource White},
69+
Dark={StaticResource Dark}}"
70+
StrokeThickness="0">
71+
<Border.StrokeShape>
72+
<RoundRectangle CornerRadius="5" />
73+
</Border.StrokeShape>
74+
<StackLayout>
75+
<Label Margin="0,0,0,5"
76+
FontAttributes="Bold"
77+
FontSize="14"
78+
Text="Feature selected" />
79+
<Grid RowSpacing="5">
80+
<Grid.ColumnDefinitions>
81+
<ColumnDefinition Width="auto" />
82+
<ColumnDefinition Width="*" />
83+
</Grid.ColumnDefinitions>
84+
<Grid.RowDefinitions>
85+
<RowDefinition Height="auto" />
86+
<RowDefinition Height="auto" />
87+
</Grid.RowDefinitions>
88+
<Label Grid.Row="0"
89+
Grid.Column="0"
90+
Margin="0,0,5,0"
91+
Text="AssetGroup:" />
92+
<Label x:Name="SelectedAssetGroupLabel"
93+
Grid.Row="0"
94+
Grid.Column="1" />
95+
<Label Grid.Row="1"
96+
Grid.Column="0"
97+
Margin="0,0,5,0"
98+
Text="AssetType:" />
99+
<Label x:Name="SelectedAssetTypeLabel"
100+
Grid.Row="1"
101+
Grid.Column="1" />
102+
</Grid>
103+
</StackLayout>
104+
</Border>
105+
<Button x:Name="SnapSourcesButton"
106+
Clicked="SnapSourcesButton_Clicked"
107+
Text="Snap sources" />
108+
<Button x:Name="GeometryEditorButton"
109+
Clicked="GeometryEditorButton_Click"
110+
IsEnabled="{Binding GeometryEditor.IsStarted, Source={x:Reference MyMapView}, Converter={StaticResource InvertedBoolConverter}}"
111+
Text="Start editor" />
112+
<Grid ColumnSpacing="5">
113+
<Grid.ColumnDefinitions>
114+
<ColumnDefinition Width="0.5*" />
115+
<ColumnDefinition Width="0.5*" />
116+
</Grid.ColumnDefinitions>
117+
<Button Grid.Column="0"
118+
Clicked="DiscardButton_Click"
119+
IsEnabled="{Binding GeometryEditor.IsStarted, Source={x:Reference MyMapView}}"
120+
Style="{StaticResource IconStyle}"
121+
Text="&#xe080;"
122+
ToolTipProperties.Text="Discard edits" />
123+
<Button x:Name="SaveButton"
124+
Grid.Column="1"
125+
Clicked="SaveButton_Click"
126+
IsEnabled="{Binding GeometryEditor.CanUndo, Source={x:Reference MyMapView}}"
127+
Style="{StaticResource IconStyle}"
128+
Text="&#xe06f;"
129+
ToolTipProperties.Text="Save edits" />
130+
</Grid>
131+
</StackLayout>
132+
</StackLayout>
133+
</Grid>
134+
</Border>
135+
<Grid x:Name="SnapSourcesPopupBackground"
136+
Grid.ColumnSpan="2"
137+
Padding="10"
138+
Background="#AA333333"
139+
IsVisible="False">
140+
<Grid.GestureRecognizers>
141+
<TapGestureRecognizer Tapped="SnapSourcesPopupBackground_Tapped" />
142+
</Grid.GestureRecognizers>
143+
</Grid>
144+
<Border x:Name="SnapSourcesPopup"
145+
Margin="10"
146+
Background="{AppThemeBinding Dark=Black,
147+
Light=White}"
148+
HorizontalOptions="Center"
149+
IsVisible="False"
150+
HeightRequest="250"
151+
StrokeShape="RoundRectangle 10"
152+
VerticalOptions="Center"
153+
WidthRequest="300">
154+
<ScrollView>
155+
<StackLayout Padding="10" Spacing="10">
156+
<Label Padding="0,5"
157+
FontAttributes="Bold"
158+
FontSize="14"
159+
Text="Snap sources" />
160+
<CollectionView x:Name="SnapSourcesList"
161+
Margin="15,0"
162+
ItemTemplate="{StaticResource SnapSettingTemplate}" />
163+
<Label FontAttributes="Bold"
164+
FontSize="14"
165+
Text="SnapRuleBehavior" />
166+
<StackLayout Margin="20,0,0,0" Orientation="Horizontal">
167+
<Rectangle Grid.Column="0"
168+
Margin="0,0,5,0"
169+
Fill="Green"
170+
HeightRequest="10"
171+
WidthRequest="10" />
172+
<Label Text="None" />
173+
</StackLayout>
174+
<StackLayout Margin="20,0,0,0" Orientation="Horizontal">
175+
<Rectangle Grid.Column="0"
176+
Margin="0,0,5,0"
177+
Fill="Orange"
178+
HeightRequest="10"
179+
WidthRequest="10" />
180+
<Label Text="RulesLimitSnapping" />
181+
</StackLayout>
182+
<StackLayout Margin="20,0,0,0" Orientation="Horizontal">
183+
<Rectangle Grid.Column="0"
184+
Margin="0,0,5,0"
185+
Fill="Red"
186+
HeightRequest="10"
187+
WidthRequest="10" />
188+
<Label Text="RulesPreventSnapping" />
189+
</StackLayout>
190+
</StackLayout>
191+
</ScrollView>
192+
</Border>
193+
</Grid>
194+
</ContentPage>

0 commit comments

Comments
 (0)