-
Notifications
You must be signed in to change notification settings - Fork 521
/
SnapGeometryEdits.xaml
252 lines (252 loc) · 13.1 KB
/
SnapGeometryEdits.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="ArcGIS.Samples.SnapGeometryEdits.SnapGeometryEdits"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Maui;assembly=Esri.ArcGISRuntime.Maui">
<ContentPage.Resources>
<DataTemplate x:Key="SnapSettingTemplate">
<Grid ColumnSpacing="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0"
Text="{Binding Path=Name}"
VerticalOptions="Center"
WidthRequest="160" />
<Switch Grid.Column="1"
HorizontalOptions="End"
IsToggled="{Binding Path=IsEnabled, Mode=TwoWay}"
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>
</ContentPage.Resources>
<Grid>
<esriUI:MapView x:Name="MyMapView" />
<Grid x:Name="CreateEditGeometriesPanel"
Margin="10"
ColumnDefinitions="110,110"
ColumnSpacing="5"
HorizontalOptions="End"
IsVisible="False"
RowDefinitions="auto,auto,auto,auto,auto,auto"
RowSpacing="5"
VerticalOptions="Start">
<Button x:Name="ShowSnapSettingsButton"
Grid.Row="0"
Grid.ColumnSpan="2"
Clicked="ShowSnapSettingsButton_Clicked"
Text="Show snap settings" />
<Border Grid.Row="1"
Grid.ColumnSpan="2"
BackgroundColor="{AppThemeBinding Dark=#3C3C3C,
Light=White}"
HeightRequest="40">
<Border.StrokeShape>
<RoundRectangle CornerRadius="5" />
</Border.StrokeShape>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0"
Margin="10,0"
Text="Reticle vertex tool"
VerticalOptions="Center" />
<Switch x:Name="ReticleVertexToolSwitch"
Grid.Column="1"
HorizontalOptions="End"
Toggled="ReticleVertexToolSwitch_Toggled"
VerticalOptions="Center" />
</Grid>
</Border>
<Button x:Name="PointButton"
Grid.Row="2"
Grid.Column="0"
Clicked="PointButton_Click"
Style="{StaticResource IconStyle}"
Text=""
ToolTipProperties.Text="Point" />
<Button x:Name="MultipointButton"
Grid.Row="2"
Grid.Column="1"
Clicked="MultipointButton_Click"
FontSize="20"
Style="{StaticResource IconStyle}"
Text=""
ToolTipProperties.Text="Multipoint" />
<Button x:Name="PolylineButton"
Grid.Row="3"
Grid.Column="0"
Clicked="PolylineButton_Click"
Style="{StaticResource IconStyle}"
Text=""
ToolTipProperties.Text="Polyline / no shape fill" />
<Button x:Name="PolygonButton"
Grid.Row="3"
Grid.Column="1"
Clicked="PolygonButton_Click"
Style="{StaticResource IconStyle}"
Text=""
ToolTipProperties.Text="Polygon / shape fill" />
<Button Grid.Row="4"
Grid.Column="0"
Clicked="DeleteButton_Click"
IsEnabled="{Binding GeometryEditor.SelectedElement.CanDelete, Source={x:Reference MyMapView}, FallbackValue=False}"
Style="{StaticResource IconStyle}"
Text=""
ToolTipProperties.Text="Delete selected" />
<Button Grid.Row="4"
Grid.Column="1"
Clicked="UndoButton_Click"
IsEnabled="{Binding GeometryEditor.CanUndo, Source={x:Reference MyMapView}}"
Style="{StaticResource IconStyle}"
Text=""
ToolTipProperties.Text="Undo" />
<Button Grid.Row="5"
Grid.Column="0"
Clicked="DiscardButton_Click"
IsEnabled="{Binding GeometryEditor.IsStarted, Source={x:Reference MyMapView}}"
Style="{StaticResource IconStyle}"
Text=""
ToolTipProperties.Text="Discard edits" />
<Button Grid.Row="5"
Grid.Column="1"
Clicked="SaveButton_Click"
IsEnabled="{Binding GeometryEditor.CanUndo, Source={x:Reference MyMapView}}"
Style="{StaticResource IconStyle}"
Text=""
ToolTipProperties.Text="Save edits" />
</Grid>
<Grid x:Name="SnappingSettingsPopup"
Grid.ColumnSpan="2"
Padding="10"
Background="#AA333333"
IsVisible="False">
<Border x:Name="SnapSettingsContainer"
Margin="10"
Background="{AppThemeBinding Dark=Black,
Light=White}"
HorizontalOptions="Center"
MaximumHeightRequest="450"
MaximumWidthRequest="300"
StrokeShape="RoundRectangle 10"
VerticalOptions="Center">
<ScrollView>
<VerticalStackLayout Margin="10">
<Grid ColumnDefinitions="auto,*">
<Label Padding="0,5"
FontAttributes="Bold"
FontSize="14"
Text="Snap settings" />
<Button Grid.Column="1"
Margin="20,0"
Clicked="EnableAllSnapSettingsButton_Click"
HorizontalOptions="End"
Text="Enable all"
VerticalOptions="Center" />
</Grid>
<VerticalStackLayout HeightRequest="130" WidthRequest="250">
<Grid ColumnSpacing="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0"
Text="Snapping"
VerticalOptions="Center"
WidthRequest="160" />
<Switch Grid.Column="1"
HorizontalOptions="End"
IsToggled="{Binding GeometryEditor.SnapSettings.IsEnabled, Source={x:Reference MyMapView}}"
VerticalOptions="Center" />
</Grid>
<Grid ColumnSpacing="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0"
Text="Geometry guides"
VerticalOptions="Center"
WidthRequest="160" />
<Switch Grid.Column="1"
HorizontalOptions="End"
IsEnabled="{Binding GeometryEditor.SnapSettings.IsEnabled, Source={x:Reference MyMapView}}"
IsToggled="{Binding GeometryEditor.SnapSettings.IsGeometryGuidesEnabled, Source={x:Reference MyMapView}}"
VerticalOptions="Center" />
</Grid>
<Grid ColumnSpacing="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0"
Text="Feature snapping"
VerticalOptions="Center"
WidthRequest="160" />
<Switch Grid.Column="1"
HorizontalOptions="End"
IsEnabled="{Binding GeometryEditor.SnapSettings.IsEnabled, Source={x:Reference MyMapView}}"
IsToggled="{Binding GeometryEditor.SnapSettings.IsFeatureSnappingEnabled, Source={x:Reference MyMapView}}"
VerticalOptions="Center" />
</Grid>
</VerticalStackLayout>
<BoxView Margin="0,0,0,5"
HeightRequest="1"
Color="White" />
<Label Padding="0,5"
FontAttributes="Bold"
FontSize="14"
Text="Snap sources" />
<Grid ColumnDefinitions="auto,*">
<Label Grid.Column="0"
Text="Point layers:"
VerticalOptions="Center" />
<Button Grid.Column="1"
Margin="20,0"
Clicked="EnableAllPointSnapSourceButton_Click"
HorizontalOptions="End"
Text="Enable all"
VerticalOptions="Center" />
</Grid>
<CollectionView x:Name="PointSnapSettingsList"
HeightRequest="150"
ItemTemplate="{StaticResource SnapSettingTemplate}"
WidthRequest="250" />
<Grid Margin="0,10,0,0" ColumnDefinitions="0.5*,auto">
<Label Grid.Column="0"
Text="Polyline layers:"
VerticalOptions="Center" />
<Button Grid.Column="1"
Margin="20,0"
Clicked="EnableAllPolylineSnapSourceButton_Click"
HorizontalOptions="End"
Text="Enable all"
VerticalOptions="Center" />
</Grid>
<CollectionView x:Name="PolylineSnapSettingsList"
HeightRequest="90"
ItemTemplate="{StaticResource SnapSettingTemplate}"
WidthRequest="250" />
<Grid Margin="0,10,0,0">
<Label Text="Graphics overlays:" VerticalOptions="Center" />
</Grid>
<CollectionView x:Name="GraphicsOverlaySnapSettingsList"
HeightRequest="60"
ItemTemplate="{StaticResource SnapSettingTemplate}"
WidthRequest="250" />
</VerticalStackLayout>
</ScrollView>
</Border>
</Grid>
</Grid>
</ContentPage>