Hi,
I had been exploring on ArcGIS Runtime SDK for WPF and now currently, considering transitioning to the SDK for .NET.
One of the issue I was stumped on was - the missing VertexAdded event by MapView.Editor. Is there any ways I could obtain and manipulate vertices added while doing freehand drawing?
Thanks in advance
Solved! Go to Solution.
You can provide IProgress<GeometryEditStatus> for the Editor when requesting the geometry and do stuff in the progress handler.
private async Task RequestFreehand()
{
try
{
var progress = new Progress<GeometryEditStatus>();
progress.ProgressChanged += progress_ProgressChanged;
var geometry = await MyMapView.Editor.RequestShapeAsync(DrawShape.Freehand, null, progress) as Polyline;
progress.ProgressChanged -= progress_ProgressChanged;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
void progress_ProgressChanged(object sender, GeometryEditStatus e)
{
if (e.GeometryEditAction == GeometryEditAction.AddedVertex)
{
// Stuff
}
}
Hope this helps. I'm a bit curious that what kind of use case you have so if you can, could you describe what you are going to do and why when the vertex is added?
You can provide IProgress<GeometryEditStatus> for the Editor when requesting the geometry and do stuff in the progress handler.
private async Task RequestFreehand()
{
try
{
var progress = new Progress<GeometryEditStatus>();
progress.ProgressChanged += progress_ProgressChanged;
var geometry = await MyMapView.Editor.RequestShapeAsync(DrawShape.Freehand, null, progress) as Polyline;
progress.ProgressChanged -= progress_ProgressChanged;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
void progress_ProgressChanged(object sender, GeometryEditStatus e)
{
if (e.GeometryEditAction == GeometryEditAction.AddedVertex)
{
// Stuff
}
}
Hope this helps. I'm a bit curious that what kind of use case you have so if you can, could you describe what you are going to do and why when the vertex is added?
Thanks for the tip! Now I see it can be done this way
The use case was for reducing the number of points on-the-fly - as in, while user was adding points using freehand drawing mode, our algorithm has to already decide to retain or drop the vertex that was added.
I would be interested to hear more about this use case. If you have time, could you write down use case, reason behind the algorithm and what kind of outcome you are expecting / needing and mail to me? You can see my email address from my profile.
cheers,
Antti
Hey, did you get my mail? It seems that i have some problems to send a mail to you.
Hi Antti,
I had not received your mail. I will mail you another address. Thanks.
Lina