Hello,
I am encountering some issues when attempting to handle subscribed RowChanged events that are fired when splitting a polyline feature. The underlying feature class represents a road network and is LRS-enabled. This is an enterprise dataset (SDE) that uses traditional versioning. I am running the built-in Split command when performing the split operation. There are route events associated with the polyline features that I'm splitting.
The split model on the feature class is set to 'Update/Insert', which is the default setting. According to this model when a polyline is split, the original feature is updated, becoming the longest of the two split features. The shorter feature is inserted as a new row into the feature class table.
After some testing on several polyline features, I have discovered that in some cases my RowChanged and RowCreated event handlers are not firing in a consistent way. See examples below:
Example #1: This appears to be the most common result when the split is performed:
- A RowChanged event will fire, presumably because the original polyline is being updated but before its geometry changes?
- A RowCreated event fires, when the new feature is created (i.e. the Insert feature).
- A RowChanged event fires again, presumably when updating the original feature after its geometry has changed?
When the last RowChanged event fires, I have noticed that in some cases the ObjectID for the row (args.Row.GetObjectID) is not always the ObjectID of the original feature before the split operation occurs, as one would expect. It actually returns the ObjectID of the new feature that is created. Could this be a bug?
Example #2: Occurs occasionally, I have not determined the circumstances of why this fire differently that in the first scenario described above:
- A RowCreated event fires.
- A single RowChanged event fires.
In summary, I am trying to figure out why the RowChanged events aren't firing in a consistent manner. It's important that these split features are handled properly in my workflows. I did consider changing the Split model to 'Delete/Insert/Insert' but you have to be the data owner to do this. I'm also open to the possibility of a more customized approach (ex: using the Cut method available in the GeometryEngine class).
Thanks for your time!
Hi,
Have you seen ConnerPearce suggestion here?
If you're brave you can try subscribing to the internal SplitEvent to get the new and existing feature.
Note this is an unsupported pattern.
Thanks for the suggestions, very much appreciated.
I have implemented a solution similar to ConnorPearce, where I check for the name of the edit operation in the EditStartedEvent and then set a flag if it is a split operation. I can then use this flag in my RowChangedEvent logic to prevent infinite recursions. This works well when splitting along the edge of a polyline.
The one scenario which is still giving me problems is when the polyline is split at a vertex (ex: define a sketch point that snaps to vertex of polyline). The sequence of events that fires is RowCreated-RowChanged, which appears to be different from what fires when splitting along a polyline edge (RowChanged-RowCreated-RowChanged). I noticed the OID returned from args.row in RowChangeEvents is not always consistent, depending on the specific vertex. Using the Update/Insert split model, it should return the OID of the longest of the split segments that is being updated, but this is not always the case. Could this be an undiscovered bug?
I did notice this posting about an issue that occurs, in part, when splitting at vertices but I'm not sure if it's related: