Select to view content in your preferred language

Extending Geometry Editing for Windows Tablet 10.1.1

604
2
02-07-2013 01:20 PM
JulieGuillory
Emerging Contributor
I would like the ESRI Mobile Team to look at the fact that you can not create custom GeometryEditMethods or tie into edit method geomtry collection methods.
0 Kudos
2 Replies
DeniseKing
Esri Regular Contributor
Hi Julie,

I recommend you submit your comment "I would like the ESRI Mobile Team to look at the fact that you can not create custom GeometryEditMethods or tie into edit method geometry collection methods." with Esri Support as ArcGIS for Windows Mobile enhancement request or you could post it on ArcGIS Ideas > Mobile GIS site for other mobile users to comment and vote on.

Cheers,
Denise
0 Kudos
JulieGuillory
Emerging Contributor
I have been working on this myself.  I think my initial question, which I think I figured out, was a hook into the GeometryEditMethod.  The EditFeatureAttributesViewModel requires a feature to be passed to it so you can't add this eventhandler within the OnOwnerInitialized Sub as there is no selected feature at this time.  The CollectFeaturesTask seems very straight forward with the collectionstarted and collectionfinished which you can add no problem within the OnOwnerInitialized Sub.

What I ended up doing was add an eventhandler to the manageeditstask.viewcollectedfeaturespage.EditFeatureClick event within the OnOwnerInitialized sub.  Within the editfeatureclick eventhandler I added the eventhandler for creatinggeometryeditoperations.  I can loop through and gett the current editoperations but when I loop through or try to add geometry collection methods none exist at this point and it won't add any either.  Any input would be appreciated. 

Here is a code sample:



Protected Overrides Sub OnOwnerInitialized()

If Not MobileApplication.Current.Dispatcher.CheckAccess() Then

MobileApplication.Current.Dispatcher.BeginInvoke(DirectCast(Sub() OnOwnerInitialized(), System.Threading.ThreadStart))

Return

End If

' Find the Collect Features task

_collectFeaturesTask = TryCast(MobileApplication.Current.Project.Tasks.GetFirstExtensionOfType(GetType(CollectFeaturesTask)), CollectFeaturesTask)

If _collectFeaturesTask Is Nothing Then

Return

End If

�??

If _collectFeaturesTask IsNot Nothing Then

AddHandler _collectFeaturesTask.CollectionStarted, AddressOf _collectFeaturesTask_CollectionStarted

AddHandler _collectFeaturesTask.CollectionCompleted, AddressOf _collectFeaturesTask_CollectionCompleted

End If

�??

�??

_manageEditsTask = TryCast(MobileApplication.Current.Project.Tasks.GetFirstExtensionOfType(GetType(ManageEditsTask)), ManageEditsTask)

_ViewCollectedFeaturesPage = _manageEditsTask.ViewCollectedFeaturesPage

If _manageEditsTask IsNot Nothing Then

MessageBox.Show("Not nothing")

AddHandler _manageEditsTask.ViewCollectedFeaturesPage.EditFeatureClick, AddressOf _manageEditsTask_ViewCollectedFeaturesPage_EditFeatureClick

End If

�??

�??

Dim viewMapTask As ViewMapTask = TryCast(MobileApplication.Current.FindTask(GetType(ViewMapTask)), ViewMapTask)

If viewMapTask IsNot Nothing Then

_homePage = viewMapTask.ViewMapPage

End If

End Sub





Private Sub _manageEditsTask_ViewCollectedFeaturesPage_EditFeatureClick(sender As Object, e As FeatureEventArgs)

�??

_editFeatureAttributesViewModel = New EditFeatureAttributesViewModel(e.Feature)



_feature.BeginEdit()



AddHandler _editFeatureAttributesViewModel.CreatingGeometryEditOperations, AddressOf _editFeatureAttributesViewModel_CreatingGeometryEditOperations



_editFeatureAttributesPage = New EditFeatureAttributesPage(_editFeatureAttributesViewModel)



AddHandler _editFeatureAttributesPage.ClickOk, AddressOf _editFeatureAttributesPage_ClickOk

AddHandler _editFeatureAttributesPage.ClickCancel, AddressOf _editFeatureAttributesPage_ClickCancel

_feature = _editFeatureAttributesViewModel.Feature

Dim menuitem As MenuItem = New MenuItem

menuitem.Header = "Add MGRS Location"

menuitem.Command = AddLocationCommand2

_editFeatureAttributesPage.MenuItems.Add(menuitem)

MobileApplication.Current.Transition(_editFeatureAttributesPage)

End Sub





Private Sub _editFeatureAttributesViewModel_CreatingGeometryEditOperations(sender As Object, e As CreatingGeometryEditOperationsEventArgs)

_coordGeometryCollectionMethod = New MGRSGeometryCollectionMethod

For Each method As GeometryEditMethod In e.GeometryEditMethods

MessageBox.Show("edit method name is " & method.Name.ToString)

MessageBox.Show(" method.GeometryCollectionMethods.Count " & method.GeometryCollectionMethods.Count.ToString)

For Each gcm As GeometryCollectionMethod In method.GeometryCollectionMethods

MessageBox.Show("geometry collection method name is " & method.Name.ToString)

Next

method.GeometryCollectionMethods.Add(_coordGeometryCollectionMethod)

Next

�??

End Sub
0 Kudos