Hi,
I have a simple polyline feature layer and there are some polylines on it that I want to reshape/replace with new polylines and I'm having a little trouble with it. So, this code here works fine:
public async Task SetPolylineShapeAsyncViaCursor(int polylineId, ArcGISGeo.Polyline newPolyline) {
FeatureLayer polylineFeatureLayer =
if (polylineFeatureLayer == null)
return;
await ArcGISTasks.QueuedTask.Run(() => {
var queryFilter = new ArcGISData.QueryFilter();
queryFilter.WhereClause = String.Format("{0} = {1}", "PID", polylineId);
var cursor = polylineFeatureLayer.Search(queryFilter);
if (cursor.MoveNext()) {
var feature = (ArcGISData.Feature)cursor.Current;
feature.SetShape(newPolyline);
feature.Store();
}
});
}
However, I'd very much prefer to use an EditOperation since this polyline operation is part of a bigger editing process and I eventually want to pass around an EditOperation instance that all methods use and in the end ExecuteAsync is called once. For now I'd like to have it working with a local EditOperation, but it doesn't work when I try to modify the shape via EditOperation.Reshape (it only yields an "EditOperation failed" error):
public async Task SetPolylineShapeAsyncViaReshape(int polylineId, ArcGISGeo.Polyline newPolyline) {
FeatureLayer polylineFeatureLayer =
if (polylineFeatureLayer == null)
return;
long polylineOID = await this.GetPolylineOIDAsync(polylineId);
if (polylineOID == -1)
return;
var polylineOperation = new EditOperation();
polylineOperation.Reshape(polylineFeatureLayer, polylineOID, newPolyline);
await polylineOperation.ExecuteAsync();
}
It must be a small detail that's missing but I'd be glad if somebody could tell me what I'm doing wrong.
Thanks in adavance
Best Regards
Christian