Skip to content

Commit

Permalink
200.6.0 Samples Release (#1540)
Browse files Browse the repository at this point in the history
Co-authored-by: Preeti Maske <[email protected]>
Co-authored-by: Hamish Duff <[email protected]>
Co-authored-by: Morten Nielsen <[email protected]>
Co-authored-by: Hamish Duff <[email protected]>
  • Loading branch information
5 people authored Nov 25, 2024
1 parent 2d9d24a commit 4288087
Show file tree
Hide file tree
Showing 53 changed files with 473 additions and 333 deletions.
4 changes: 2 additions & 2 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<ArcGISMapsSDKVersion Condition="'$(ArcGISMapsSDKVersion)'==''">200.5.0</ArcGISMapsSDKVersion>
<ArcGISMapsSDKVersion Condition="'$(ArcGISMapsSDKVersion)'==''">200.6.0</ArcGISMapsSDKVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Esri.ArcGISRuntime" Version="$(ArcGISMapsSDKVersion)" />
Expand All @@ -26,7 +26,7 @@
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageVersion Include="WinUIEx" Version="2.3.4" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.5.240607001" Condition="'$(UseMaui)'!='true'" />
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1" Condition="'$(UseMaui)'!='true'" />
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.3233" Condition="'$(UseMaui)'!='true'" />
<PackageVersion Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.2.13" />
<PackageVersion Include="Microsoft.Toolkit.Uwp.UI.Controls" Version="6.1.1" />
<PackageVersion Include="Microsoft.UI.Xaml" Version="2.5.0" />
Expand Down
17 changes: 0 additions & 17 deletions src/MAUI/Maui.Samples/Helpers/ArcGISLoginPrompt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,6 @@ public static void SetChallengeHandler()
AuthenticationManager.Current.OAuthUserConfigurations.Add(userConfig);
AuthenticationManager.Current.OAuthAuthorizeHandler = new OAuthAuthorize();
}

// ChallengeHandler function that will be called whenever access to a secured resource is attempted.
public static async Task<Credential> PromptCredentialAsync(CredentialRequestInfo info)
{
Credential credential = null;

try
{
// IOAuthAuthorizeHandler will challenge the user for OAuth credentials.
credential = await AuthenticationManager.Current.GenerateCredentialAsync(info.ServiceUri);
}
// OAuth login was canceled, no need to display error to user.
catch (TaskCanceledException) { }
catch (OperationCanceledException) { }

return credential;
}
}

#region IOAuthAuthorizationHandler implementation
Expand Down
4 changes: 2 additions & 2 deletions src/MAUI/Maui.Samples/Platforms/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.esri.arcgisruntime.samples.maui" android:versionCode="3" android:versionName="200.5.0">
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.esri.arcgisruntime.samples.maui" android:versionCode="5" android:versionName="200.6.0">
<application android:allowBackup="true" android:usesCleartextTraffic="true" android:icon="@mipmap/appiconandroid" android:roundIcon="@mipmap/appiconandroid_round" android:supportsRtl="true" android:label="ArcGIS Maps .NET MAUI Samples"></application>
<uses-sdk android:minSdkVersion="26" android:targetSdkVersion="34" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private async Task Initialize()
// WARNING: Never hardcode login information in a production application. This is done solely for the sake of the sample.
string sampleServer7User = "editor01";
string sampleServer7Pass = "S7#i2LWmYH75";
return await AuthenticationManager.Current.GenerateCredentialAsync(info.ServiceUri, sampleServer7User, sampleServer7Pass);
return await AccessTokenCredential.CreateAsync(info.ServiceUri, sampleServer7User, sampleServer7Pass);
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,71 @@
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="Select snap sources" />
Text="Snap sources" />
<Grid ColumnDefinitions="auto,*">
<Label Grid.Column="0"
Text="Point layers:"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,15 @@ private void ResetFromEditingSession()
_selectedGraphic = null;
}

#region Enable Sources Button Handlers
#region Enable Snapping Button Handlers
// Enable all point layer snap sources.
private void EnableAllSnapSettingsButton_Click(object sender, EventArgs e)
{
_geometryEditor.SnapSettings.IsEnabled = true;
_geometryEditor.SnapSettings.IsGeometryGuidesEnabled = true;
_geometryEditor.SnapSettings.IsFeatureSnappingEnabled = true;
}

// Enable all point layer snap sources.
private void EnableAllPointSnapSourceButton_Click(object sender, EventArgs e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A field worker can create new features by editing and snapping the vertices of a

To create a geometry, press the create button to choose the geometry type you want to create (i.e. points, multipoints, polyline, or polygon) and interactively tap and drag on the map view to create the geometry.

To configure snapping, press the snap settings button to enable or disable snapping and choose which snap sources to snap to.
Snap settings can be configured by enabling and disabling snapping, feature snapping, geometry guides and snap sources.

To interactively snap a vertex to a feature or graphic, ensure that snapping is enabled for the relevant snap source and move the mouse pointer or drag a vertex to nearby an existing feature or graphic. When the pointer is close to that existing geoelement, the edit position will be adjusted to coincide with (or snap to), edges and vertices of its geometry. Tap or release the touch pointer to place the vertex at the snapped location.

Expand All @@ -31,7 +31,8 @@ To save your edits, press the save button.
3. Create a `GeometryEditor` and connect it to the map view.
4. Call `SyncSourceSettings` after the map's operational layers are loaded and the geometry editor has connected to the map view.
5. Set `SnapSettings.IsEnabled` and `SnapSourceSettings.IsEnabled` to true for the `SnapSource` of interest.
6. Start the geometry editor with a `GeometryType`.
6. Toggle geometry guides using `SnapSettings.IsGeometryGuidesEnabled` and feature snapping using `SnapSettings.IsFeatureSnappingEnabled`.
7. Start the geometry editor with a `GeometryType`.

## Relevant API

Expand All @@ -57,6 +58,10 @@ To snap to polygon and polyline layers, the recommended approach is to set the `

Snapping can be used during interactive edits that move existing vertices using the `VertexTool` or `ReticleVertexTool`. It is also supported for adding new vertices for input devices with a hover event (such as a mouse move without a mouse button press). Using the `ReticleVertexTool` to add and move vertices allows users of touch screen devices to clearly see the visual cues for snapping.

Geometry guides are enabled by default when snapping is enabled. These allow for snapping to a point coinciding with, parallel to, perpendicular to or extending an existing geometry.

On supported platforms haptic feedback on `SnapState.SnappedToFeature` and `SnapState.SnappedToGeometryGuide` is enabled by default when snapping is enabled. Custom haptic feedback can be configured by setting `SnapSettings.IsHapticFeedbackEnabled` to false and listening to `GeometryEditor.SnapChanged` events to provide specific feedback depending on the `SnapState`.

## Tags

edit, feature, geometry editor, graphics, layers, map, snapping
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private async Task SetServiceFeatureTableFeatureLayer()
// WARNING: Never hardcode login information in a production application. This is done solely for the sake of the sample.
string sampleServer7User = "viewer01";
string sampleServer7Pass = "I68VGU^nMurF";
return await AuthenticationManager.Current.GenerateCredentialAsync(info.ServiceUri, sampleServer7User, sampleServer7Pass);
return await AccessTokenCredential.CreateAsync(info.ServiceUri, sampleServer7User, sampleServer7Pass);
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private async Task Initialize()
// WARNING: Never hardcode login information in a production application. This is done solely for the sake of the sample.
string sampleServer7User = "viewer01";
string sampleServer7Pass = "I68VGU^nMurF";
return await AuthenticationManager.Current.GenerateCredentialAsync(info.ServiceUri, sampleServer7User, sampleServer7Pass);
return await AccessTokenCredential.CreateAsync(info.ServiceUri, sampleServer7User, sampleServer7Pass);
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,7 @@ private async Task Initialize()
_sceneLayerExtentPolygon = builder.ToGeometry();

// Create the SceneLayerPolygonFilter to later apply to the OSM buildings layer.
_sceneLayerPolygonFilter = new SceneLayerPolygonFilter()
{
SpatialRelationship = SceneLayerPolygonFilterSpatialRelationship.Disjoint
};
_sceneLayerPolygonFilter.Polygons.Add(builder.ToGeometry());
_sceneLayerPolygonFilter = new SceneLayerPolygonFilter(new List<Polygon>() { builder.ToGeometry() }, SceneLayerPolygonFilterSpatialRelationship.Disjoint);

// Create the extent graphic so we can add it later with the detailed buildings scene layer.
var simpleLineSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, System.Drawing.Color.Red, 5.0f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,10 @@ private async void LoginInfoEntered(object sender, LoginEventArgs e)
CredentialRequestInfo requestInfo = (CredentialRequestInfo)_loginTaskCompletionSrc.Task.AsyncState;

// Create a token credential using the provided username and password.
TokenCredential userCredentials = await AuthenticationManager.Current.GenerateCredentialAsync
AccessTokenCredential userCredentials = await AccessTokenCredential.CreateAsync
(requestInfo.ServiceUri,
e.Username,
e.Password,
requestInfo.GenerateTokenOptions);
e.Password);

// Set the task completion source result with the ArcGIS network credential.
// AuthenticationManager is waiting for this result and will add it to its Credentials collection.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private async Task Initialize()
// WARNING: Never hardcode login information in a production application. This is done solely for the sake of the sample.
string sampleServer7User = "viewer01";
string sampleServer7Pass = "I68VGU^nMurF";
return await AuthenticationManager.Current.GenerateCredentialAsync(info.ServiceUri, sampleServer7User, sampleServer7Pass);
return await AccessTokenCredential.CreateAsync(info.ServiceUri, sampleServer7User, sampleServer7Pass);
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private async Task Initialize()
// WARNING: Never hardcode login information in a production application. This is done solely for the sake of the sample.
string sampleServer7User = "editor01";
string sampleServer7Pass = "S7#i2LWmYH75";
return await AuthenticationManager.Current.GenerateCredentialAsync(info.ServiceUri, sampleServer7User, sampleServer7Pass);
return await AccessTokenCredential.CreateAsync(info.ServiceUri, sampleServer7User, sampleServer7Pass);
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private async Task Initialize()
string sampleServer7User = "viewer01";
string sampleServer7Pass = "I68VGU^nMurF";

return await AuthenticationManager.Current.GenerateCredentialAsync(info.ServiceUri, sampleServer7User, sampleServer7Pass);
return await AccessTokenCredential.CreateAsync(info.ServiceUri, sampleServer7User, sampleServer7Pass);
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private async Task Initialize()
string sampleServer7User = "viewer01";
string sampleServer7Pass = "I68VGU^nMurF";

return await AuthenticationManager.Current.GenerateCredentialAsync(info.ServiceUri, sampleServer7User, sampleServer7Pass);
return await AccessTokenCredential.CreateAsync(info.ServiceUri, sampleServer7User, sampleServer7Pass);
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private async Task Initialize()
string sampleServer7User = "viewer01";
string sampleServer7Pass = "I68VGU^nMurF";

return await AuthenticationManager.Current.GenerateCredentialAsync(info.ServiceUri, sampleServer7User, sampleServer7Pass);
return await AccessTokenCredential.CreateAsync(info.ServiceUri, sampleServer7User, sampleServer7Pass);
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private async Task Initialize()
string sampleServer7User = "viewer01";
string sampleServer7Pass = "I68VGU^nMurF";

return await AuthenticationManager.Current.GenerateCredentialAsync(info.ServiceUri, sampleServer7User, sampleServer7Pass);
return await AccessTokenCredential.CreateAsync(info.ServiceUri, sampleServer7User, sampleServer7Pass);
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ private async Task Initialize()
"https://sampleserver7.arcgisonline.com/portal/sharing/rest";
string sampleServer7User = "editor01";
string sampleServer7Pass = "S7#i2LWmYH75";
var credential = await AuthenticationManager
.Current
.GenerateCredentialAsync(
var credential = await AccessTokenCredential.CreateAsync(
new Uri(sampleServerPortalUrl),
sampleServer7User,
sampleServer7Pass
Expand Down
18 changes: 0 additions & 18 deletions src/WPF/WPF.Viewer/Helpers/ArcGISLoginPrompt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,24 +67,6 @@ public static async Task<bool> EnsureAGOLCredentialAsync()
return loggedIn;
}

// ChallengeHandler function that will be called whenever access to a secured resource is attempted
public static async Task<Credential> PromptCredentialAsync(CredentialRequestInfo info)
{
Credential credential = null;

try
{
// IOAuthAuthorizeHandler will challenge the user for OAuth credentials
credential = await AuthenticationManager.Current.GenerateCredentialAsync(info.ServiceUri);
}
catch (OperationCanceledException)
{
// OAuth login was canceled, no need to display error to user.
}

return credential;
}

public static void SetChallengeHandler()
{
var userConfig = new OAuthUserConfiguration(new Uri(ArcGISOnlineUrl), AppClientId, new Uri(OAuthRedirectUrl));
Expand Down
Loading

0 comments on commit 4288087

Please sign in to comment.