Clone geometries

945
3
08-22-2017 03:09 AM
ManelKEDDAR
New Contributor III

Hello , Is there any way methods to clone geometries using arcgis runtime v100.1 ? i've checked the API references and i saw it's possible to clone only layers , symbols , maps ,ect but there's no geometries cloning ? for example MapPoint cloning ?

Thanks

0 Kudos
3 Replies
AnttiKajanus1
Occasional Contributor III

Hi,

Geometries are immutable by nature so you if your workflow is to copy the geometry and then doing edits into it, you should use GeometryBuilders such as MapPointBuilder Class. These behaves similarly to StringBuilder and when you have done with the edits just call GeometryBuilder(T).ToGeometry Method method to get the final geometry out.

Hope that helps.

ManelKEDDAR
New Contributor III

Thanks that really helped me 

0 Kudos
dotMorten_esri
Esri Notable Contributor

There's a couple of ways it can be done. Here's two:

Polygon p = new Polygon(...);
var p2 = new PolygonBuilder(p).ToGeometry();
var p3 = new Polygon(p.Parts, p.SpatialReference);

0 Kudos