POST
|
Thanks for reporting this bug. I can reproduce that updating vertex by interaction allows undo/redo while updating vertex by code with MoveSelectedVertex, cannot be undone without the vertex being deleted. It also appears that GeometryChanged event does not report this as move vertex but as move geometry. As a workaround, you may subscribe to SelectedVertexChanged event and use this to track the newly inserted vertex (e.NewVertex.Point will be the unmodified/unsnapped vertex). Whether you interactively add point or call InsertAfterSelectedVertex, this event will fire.
... View more
2 weeks ago
|
1
|
0
|
48
|
POST
|
There may be a few SketchEditor commands that you can specify in XAML (like Complete/Cancel/Undo/Redo/Delete). However, you can only begin a draw in code-behind using one of the StartAsync methods. Based on SketchCreation mode, shape is drawn based on MapView events. For example, tap/click for point or adding vertices in polyline/polygon, drag/move for freehand, arrow, rectangle, triangle, circle, ellipse shapes. Few XAML example code would be to set DataContext to MapView's SketchEditor and use Command Binding. < Grid DataContext = " {Binding ElementName = MyMapView,Path = SketchEditor} " > <Grid.RowDefinitions> < RowDefinition Height = " Auto " /> < RowDefinition Height = " Auto " /> < RowDefinition Height = " Auto " /> < RowDefinition Height = " Auto " /> < RowDefinition Height = " Auto " /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> < ColumnDefinition /> < ColumnDefinition /> </Grid.ColumnDefinitions> < CheckBox IsChecked = " {Binding IsEnabled, Mode = TwoWay} " Content = " IsEnabled " /> < CheckBox IsChecked = " {Binding IsVisible, Mode = TwoWay} " Content = " IsVisible " Grid.Column = " 1 " /> < Slider Minimum = " 0 " Maximum = " 1 " Value = " {Binding Opacity, Mode = TwoWay} " Grid.ColumnSpan = " 2 " Grid.Row = " 1 " /> < Button x: Name = " AddButton " Content = " Add " Command = " {Binding AddCommand} " Grid.Row = " 2 " /> < Button Content = " Delete " Command = " {Binding DeleteCommand} " Grid.Row = " 2 " Grid.Column = " 1 " /> < Button Content = " Undo " Command = " {Binding UndoCommand} " Grid.Row = " 3 " /> < Button Content = " Redo " Command = " {Binding RedoCommand} " Grid.Row = " 3 " Grid.Column = " 1 " /> < Button Content = " Cancel " Command = " {Binding CancelCommand} " Grid.Row = " 4 " /> < Button Content = " Complete " Command = " {Binding CompleteCommand} " Grid.Row = " 4 " Grid.Column = " 1 " /> </ Grid > If you have provided SketchEditorConfiguration in resource, you can access this by key and update it's properties using XAML-binding too. <Window.Resources> < esri: SketchEditConfiguration x: Key = " MySketchEditConfiguration " /> </Window.Resources> < StackPanel DataContext = " {StaticResource MySketchEditConfiguration} " > < ComboBox x: Name = " ResizeModes " SelectedItem = " {Binding ResizeMode, Mode = TwoWay} " /> < CheckBox IsChecked = " {Binding RequireSelectionBeforeDrag, Mode = TwoWay} " Content = " RequireSelectionBeforeDrag " /> < CheckBox IsChecked = " {Binding AllowMove, Mode = TwoWay} " Content = " AllowMove " /> < ComboBox x: Name = " VertexEditModes " SelectedItem = " {Binding VertexEditMode, Mode = TwoWay} " /> < CheckBox IsChecked = " {Binding AllowVertexEditing, Mode = TwoWay} " Content = " AllowVertexEditing " /> < CheckBox IsChecked = " {Binding AllowRotate, Mode = TwoWay} " Content = " AllowRotate " /> </ StackPanel > x Depending whether you are creating a new shape or editing an existing geometry, you may call any of the StartAsync methods. var editConfig = this . Resources [ "MySketchEditConfiguration" ] as SketchEditConfiguration ; var geometry = await MyMapView . SketchEditor . StartAsync ( creationMode , editConfig ) ;
... View more
11-10-2020
09:36 AM
|
0
|
0
|
138
|
POST
|
What version of ArcGIS Runtime SDK for .NET are you using? There should be a Stop which may be less awkward to call in code than Complete command but they function the same. Could it be possible that StartAsync for the next draw is triggered, maybe events are stepping on each other? You can also check SketchEditor.IsEnabled and SketchEditor.Geometry?.IsEmpty() == false to know that something is actively being drawn/edited. You can put breakpoint where `catch(TaskCanceledException){}` is handled or where you have any StartAsync call to see if maybe another session cancels the draw.
... View more
10-01-2020
09:24 AM
|
0
|
1
|
249
|
POST
|
When drawAndEdit parameter is true as in your code snippet, after the drawing a shape it will go to edit mode and wait for Complete command. If you wanted to complete draw as soon as you release the mouse/touch, you'd want drawAndEdit=false for shapes like Arrow, Circle, Ellipse, FreehandLine, FreehandPolygon. You can try the following sample and toggle the value for drawAndEdit, use the Complete/Cancel buttons to end draw/edit mode. Another way is to call MyMapView.SketchEditor.StopAsync() at any time which will also complete the draw/edit. < Grid > < esri: MapView x: Name = " MyMapView " /> < StackPanel VerticalAlignment = " Top " HorizontalAlignment = " Right " Orientation = " Horizontal " > < ComboBox x: Name = " DrawModes " /> < CheckBox x: Name = " DrawAndEdit " Content = " DrawAndEdit " IsChecked = " False " /> < Button Content = " Draw " Click = " OnDraw " /> < Button Content = " Complete " Command = " {Binding ElementName = MyMapView, Path = SketchEditor.CompleteCommand} " /> < Button Content = " Cancel " Command = " {Binding ElementName = MyMapView, Path = SketchEditor.CancelCommand} " /> </ StackPanel > </ Grid > public MainWindow ( ) { InitializeComponent ( ) ; DrawModes . ItemsSource = Enum . GetValues ( typeof ( SketchCreationMode ) ) ; MyMapView . Map = new Map ( Basemap . CreateTopographicVector ( ) ) ; MyMapView . GraphicsOverlays . Add ( new GraphicsOverlay ( ) ) ; } private SimpleFillSymbol _fillSymbol = new SimpleFillSymbol ( SimpleFillSymbolStyle . Solid , Color . Blue , null ) ; private async void OnDraw ( object sender , RoutedEventArgs e ) { try { var drawAndEdit = DrawAndEdit . IsChecked . HasValue && DrawAndEdit . IsChecked . Value ; if ( DrawModes . SelectedItem is SketchCreationMode creationMode ) { var geometry = await MyMapView . SketchEditor . StartAsync ( creationMode , drawAndEdit ) ; MyMapView . GraphicsOverlays [ 0 ] . Graphics . Add ( new Graphic ( geometry , _fillSymbol ) ) ; } } catch ( TaskCanceledException ) { } catch ( Exception ex ) { MessageBox . Show ( ex . Message , ex . GetType ( ) . Name ) ; } } }
... View more
10-01-2020
08:40 AM
|
0
|
5
|
249
|
POST
|
Hi Joe, I think you may be missing a `FeatureTable.UpdateFeatureAsync(feature)` call. You can also check `ArcGISFeatureTable.GetUpdatedFeatures/CountAsync()` if the related feature is included or that this edit results to `ArcGISFeatureTable.HasLocalEdits()` or `Geodatabase.HasLocalEdits()` returning true. Jennifer
... View more
09-25-2020
10:15 AM
|
1
|
1
|
50
|
POST
|
Thank you, Joe for the valuable information you sent us. The issue appears to be the definition expression that is on some of the layers. These expressions are loaded from the webmap, and are filtering out the results returned from GetFeaturesForElementsAsync(). We’ve logged an issue to ignore the expression during this function call. It looks like the definition expressions are being used to create multiple layers, one for each AssetGroup. If you have Pro 2.6 and Enterprise 10.8.1, you can create a map in Pro that contains subtype group layers and publish it to a webmap. This webmap can be consumed using Runtime 100.9, which just shipped today. We suggest using a single SubtypeGroupLayer instead for each server endpoint (i.e. Gas Device/Line/Junction) when you publish your webmap using ArcGIS Pro. This will improve performance, and eliminate the need for using the definition expression. The Runtime equivalent of this layer is SubtypeFeatureLayer. Since it is a sub-class of FeatureLayer, there’s minimal to no change in code necessary. If you are identifying features from this layer, the result will be in SublayerResults. var feature = result . FirstOrDefault ( r = > r . SublayerResults . Any ( sr = > sr . GeoElements . Any ( g = > g is ArcGISFeature ) ) ) ? . SublayerResults ? . FirstOrDefault ( ) ? . GeoElements ? . FirstOrDefault ( ) as ArcGISFeature ;
... View more
08-27-2020
02:31 PM
|
0
|
1
|
81
|
POST
|
I think I have a reproducer now. However, the difference in numbers is not as big as yours and does not change if I create UtilityNetwork with or without a map. Electric Distribution Line Unique Elements `4052` vs Features From Elements `4066` (more features than elements) Electric Distribution Junction Unique Elements `3334` vs Features From Elements `3334` Electric Distribution Device Unique Elements `5045` vs Features From Elements `5425` (more features than elements) var FeatureServerUrl = "https://sampleserver7.arcgisonline.com/arcgis/rest/services/UtilityNetwork/NapervilleElectric/FeatureServer" ; var map = new Map ( Basemap . CreateDarkGrayCanvasVector ( ) ) ; map . InitialViewpoint = new Viewpoint ( InitialExtent ) ; map . OperationalLayers . Add ( new FeatureLayer ( new Uri ( $ "{FeatureServiceUrl}/115" ) ) ) ; map . OperationalLayers . Add ( new FeatureLayer ( new Uri ( $ "{FeatureServiceUrl}/110" ) ) ) ; map . OperationalLayers . Add ( new FeatureLayer ( new Uri ( $ "{FeatureServiceUrl}/100" ) ) ) ; await map . LoadAsync ( ) ; _un = await UtilityNetwork . CreateAsync ( new Uri ( FeatureServiceUrl ) , map ) ; var networkSource = _un . Definition . GetNetworkSource ( "Electric Distribution Device" ) ; var assetGroup = networkSource ? . GetAssetGroup ( "Circuit Breaker" ) ; var assetType = assetGroup ? . GetAssetType ( "Three Phase" ) ; var terminal = assetType ? . TerminalConfiguration ? . Terminals ? . FirstOrDefault ( t = > t . Name == "Source" ) ; var globalId = Guid . Parse ( "{B8493B23-B40B-4E3E-8C4B-0DD83C28D2CC}" ) ; var element = _un . CreateElement ( assetType , globalId , terminal ) ; var parameters = new UtilityTraceParameters ( UtilityTraceType . Connected , new [ ] { element } ) ; var result = await _un . TraceAsync ( parameters ) ; if ( result . FirstOrDefault ( ) is UtilityElementTraceResult elementResult ) { if ( elementResult . Warnings . Count > 0 ) MessageBox . Show ( string . Join ( "\n" , elementResult . Warnings ) , "Trace Result Warnings" , MessageBoxButton . OK ) ; foreach ( var layer in MyMapView . Map . OperationalLayers . OfType < FeatureLayer > ( ) ) { var elements = elementResult . Elements . Where ( el = > el . NetworkSource . FeatureTable == layer . FeatureTable ) ; var features = await _un . GetFeaturesForElementsAsync ( elements ) ; var distinctIds = ( from f in elements select f . ObjectId ) . Distinct ( ) ; System . Diagnostics . Debug . WriteLine ( $ "{layer.FeatureTable.DisplayName}\t:\t Unique Elements `{distinctIds.Count()}` vs Features From Elements `{features.Count()}`" ) ; layer . SelectFeatures ( features ) ; } } In your case, could there be layers that did not load or required credential? You can add the following to troubleshoot. // Check if any layer failed MyMapView . LayerViewStateChanged + = ( s , e ) = > { var error = e . LayerViewState . Error ? ? e . Layer . LoadError ; if ( error != null ) System . Diagnostics . Debug . WriteLine ( $ "{e.Layer.Name} had an error {error.Message}" ) ; } ; // Check if any layer required credential AuthenticationManager . Current . ChallengeHandler = new ChallengeHandler ( async ( info ) = > { return await AuthenticationManager . Current . GenerateCredentialAsync ( info . ServiceUri , "<username>" , "<password>" ) ; } ) ;
... View more
08-12-2020
05:57 PM
|
0
|
0
|
81
|
POST
|
The 5856 elements may not be distinct and may also be belonging to other layers. Do you do something like this? var result = await _un . TraceAsync ( _parameters ) ; if ( result . FirstOrDefault ( ) is UtilityElementTraceResult elementResult ) { if ( elementResult . Warnings . Count > 0 ) MessageBox . Show ( string . Join ( "\n" , elementResult . Warnings ) , "Trace Result Warnings" , MessageBoxButton . OK ) ; foreach ( var layer in MyMapView . Map . OperationalLayers . OfType < FeatureLayer > ( ) ) { var elements = elementResult . Elements . Where ( el = > el . NetworkSource . FeatureTable == layer . FeatureTable ) ; var features = await _un . GetFeaturesForElementsAsync ( elements ) ; layer . SelectFeatures ( features ) ; } } I added this check and the counts seem to match. var distinctIds = ( from f in elements select f . ObjectId ) . Distinct ( ) ; System . Diagnostics . Debug . WriteLine ( $ "Unique Elements `{distinctIds.Count()}` vs Features From Elements `{features.Count()}`" ) ;
... View more
08-12-2020
03:10 PM
|
0
|
1
|
81
|
POST
|
What version of ArcGIS Runtime SDK for .NET are you using? I believe we fixed a bug in 100.6 which is as you describe GetFeaturesForElementsAsync does not return all features. A workaround for that release is to select or query by object id var query = new QueryParameters ( ) ; foreach ( var id in ( from f in elementGroup select f . ObjectId ) . Distinct ( ) ) query . ObjectIds . Add ( id ) ; layer . SelectFeaturesAsync ( query , SelectionMode . New ) ; Can you clarify what invalid results you get? when I create it using UtilityNetwork.CreateAsync Method (Uri, Map) method I am getting the invalid results. If UtilityNetwork was created with a map, the UtilityNetwork.Definition.NetworkSources which have a FeatureTable property will be the same instances in your map. If you created UtilityNetwork first and you wanted to build your map from it, you can also do foreach ( var ns in _un . Definition . NetworkSources ) { if ( ns . SourceUsageType == UtilityNetworkSourceUsageType . SubnetLine ) continue ; map . OperationalLayers . Insert ( 0 , new FeatureLayer ( ns . FeatureTable ) ) ; }
... View more
08-12-2020
02:31 PM
|
0
|
3
|
81
|
POST
|
Can you share some code snippet on how you are handling authentication challenge or adding credentials? At what stage in your app do you get error code 498 (invalid token)? The default client handler we use checks for requests with invalid token and if a token credential is available for the request, it will refresh the token. You can use ArcGISHttpClientHandler.HttpRequestBegin to find out which request is failing or if you have already set challenge handler Authentication.Current.ChallengeHandler = new ChallengeHandler ((info) =>{ // you can check here }); Thanks.
... View more
02-05-2019
01:00 PM
|
0
|
1
|
14
|
Online Status |
Offline
|
Date Last Visited |
2 weeks ago
|