i have no idea how i can implement it...
does anyone have an idea?
how to access the point list or anything else.
thanks
Solved! Go to Solution.
Sorry I missed that part from the last reply. Easiest way is to use PolylineBuilder class. It works basically like StringBuilder.
PolylineBuilder builder = new PolylineBuilder(polyline); // Create new builder from existing polyline builder.AddPoint(new MapPoint(x3, y3, polyline.SpatialReference)); // how to add new point to end of the polyline builder.Parts[0][1] = new MapPoint(x3, y3, polyline.SpatialReference); // how to change one specific point in the polyline graphic.Geometry = builder.ToGeometry(); // create new polyline from the builder
Please see guide documentation : Edit features—ArcGIS Runtime SDK for .NET | ArcGIS for Developers and online sample Code Example - Editor_Sketching or https://github.com/Esri/arcgis-runtime-samples-dotnet/blob/master/src/Desktop/ArcGISRuntimeSDKDotNet... sample from samples reporsitory.
Key points here are using Editor class to edit existing geometry and then save that to geodatabase / feature service if needed.
Please let me know if you have following questions.
HI,
Thanks for your answer but...
i dont want to save it for any local saving,
i want to change the one point of the line,
if i have line with point [(x1,y1),(x2,y2)] i want to edit it in code to be [(x1,y1),(x3,y3)]
In that case you can create new Polyline and replace Graphic.Geometry with that one. In ArcGIS Runtime for .NET, geometries are immutable object so you can just replace the exiting geometry with new one.
So on higher level you can do it like this
Graphic graphic = GetMyWorkingGraphic(); // existing Graphic with geometry that you want to replace / edit Polyline polyline = CreateNewPolylineWithChanges(); // create new geometry with the changes graphic.Geometry = polyline; // set geometry with changes to the graphic
To see how to create geometries in code, please see samples
Thanks Antti!
I understand what you say,
Do you have any idea how to take my current polyline and extract the points from it?
thanks again!
Shahar.
Sorry I missed that part from the last reply. Easiest way is to use PolylineBuilder class. It works basically like StringBuilder.
PolylineBuilder builder = new PolylineBuilder(polyline); // Create new builder from existing polyline builder.AddPoint(new MapPoint(x3, y3, polyline.SpatialReference)); // how to add new point to end of the polyline builder.Parts[0][1] = new MapPoint(x3, y3, polyline.SpatialReference); // how to change one specific point in the polyline graphic.Geometry = builder.ToGeometry(); // create new polyline from the builder
Thanks, it helped a lot