ArcGIS Runtime .NET Editing point graphics

4082
2
05-12-2015 10:35 AM
EdwardBlair
Occasional Contributor

Hello -

Am trying to allow editing (specifically a MoveGeometry)  for a selected point graphic.  This seems to work OK for selected polyline or polygon, but not points.   Here's what I try to do - which is entirely based on an Esri code sample:

var editConfig = Editor.EditorConfiguration;                

switch (m_selectedGraphic.Geometry.GeometryType)                

{                    

     case GeometryType.Polygon:                    

     case GeometryType.Polyline:                        

          editConfig.AllowAddVertex = true;                        

          editConfig.AllowDeleteVertex = true;                        

          editConfig.AllowMoveGeometry = true;                        

          editConfig.AllowMoveVertex = true;                        

          editConfig.AllowRotateGeometry = true;                        

          editConfig.AllowScaleGeometry = true;                        

          break;                    

     case GeometryType.Point:                    

     case GeometryType.Multipoint:                        

          editConfig.AllowAddVertex = false;                        

          editConfig.AllowDeleteVertex = false;                        

          editConfig.AllowMoveGeometry = true;                        

          editConfig.AllowMoveVertex = false;                        

          editConfig.AllowRotateGeometry = false;                        

          editConfig.AllowScaleGeometry = false;                        

          break;                

}                                

     var resultGeometry = m_selectedGraphic.Geometry;                

     var progress = new Progress();                

     progress.ProgressChanged += (a, b) => { };                

     var g = m_selectedGraphic;                

     g.IsVisible = false;                

     var r = await Editor.EditGeometryAsync(g.Geometry, null, progress);

HERE an error is thrown saying that the operation is not supported on the geometry type (Point).  Is there some other way to edit point features?

Any suggestions would be much appreciated.

Thanks,

Ed

0 Kudos
2 Replies
EdwardBlair
Occasional Contributor

So, it might not be the best way to do this, but a way I found to permit moving a point feature is to convert the geometry to an envelope right before the call to:

Editor.EditGeometryAsync

and when the edit is complete restore the geometry of the graphic to a point using Envelope.GetCenter().

Yes, the symbology of the graphic becomes an envelope during the actual editing of the geometry (the move) but it reverts to the original once the edit is complete.

Ed

0 Kudos
AnttiKajanus1
Occasional Contributor III

You could request new point and replace old one with that using Editor.RequestPointAsync Method. If you could also check sample 'MovePoints'.

0 Kudos