I am unable to determine a geometry if a geometry is updated when that Change comes from the Modify tools of Scale/Move/Rotate.
What is happening is that in my module I subscribe to the RowChangedEvent. In this event, i catch when a user modifies vertices or clips an item, that way i can update that object accordingly. i do this by getting the original pre change geometry like this. This is currently working
<SPAN class="comment token">//GET THE PRE EDIT SHAPE</SPAN>
Inspector inspr <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">await</SPAN> <SPAN class="token function">GetInspectorForRow</SPAN><SPAN class="punctuation token">(</SPAN>args<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">false</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">//This is the Value before the vertices change</SPAN>
pmi<SPAN class="punctuation token">.</SPAN>OriginalGeometry <SPAN class="operator token">=</SPAN> inspr<SPAN class="punctuation token">.</SPAN>Shape<SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Then I get the actual change in shape which I get from the arg using the following
<SPAN class="comment token">//GET THE POST EDIT SHAPE</SPAN>
<SPAN class="keyword token">int</SPAN> shapeIndex <SPAN class="operator token">=</SPAN> args<SPAN class="punctuation token">.</SPAN>Row<SPAN class="punctuation token">.</SPAN><SPAN class="token function">GetTable</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">GetDefinition</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">FindField</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Shape"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
Geometry geomNew <SPAN class="operator token">=</SPAN> args<SPAN class="punctuation token">.</SPAN>Row<SPAN class="punctuation token">[</SPAN>shapeIndex<SPAN class="punctuation token">]</SPAN> <SPAN class="keyword token">as</SPAN> Geometry<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>geomNew <SPAN class="operator token">!=</SPAN> <SPAN class="keyword token">null</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
pmi<SPAN class="punctuation token">.</SPAN>NewShape <SPAN class="operator token">=</SPAN> geomNew<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Clone</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>I then use the above before and after geometries to determine if the shape had changed, if so make some calculations and do work, if not, then rollback or do something else. But in comparing these two geometries, it works when it comes from edit vertices or clipping, etc.
<SPAN class="comment token">//CHECK IF THERE WAS A SHAPE CHANGE</SPAN>
<SPAN class="keyword token">bool</SPAN> shapeChanged <SPAN class="operator token">=</SPAN> <SPAN class="operator token">!</SPAN>pmi<SPAN class="punctuation token">.</SPAN>OriginalGeometry<SPAN class="punctuation token">.</SPAN><SPAN class="token function">IsEqual</SPAN><SPAN class="punctuation token">(</SPAN>pmi<SPAN class="punctuation token">.</SPAN>NewShape<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN></SPAN>
But when using Scale/Move/Rotate it sees them as the same geometry always. All of my attempts to use the following have also proven to not work.
<SPAN class="comment token">//THESE DON'T YIELD THE EXPECTED RESULTS</SPAN>
Args<SPAN class="punctuation token">.</SPAN>HasValueChanged <SPAN class="comment token">//Always True</SPAN>
Inspector<SPAN class="punctuation token">.</SPAN>GeometryAttribute<SPAN class="punctuation token">.</SPAN>OriginalValue
Inspector<SPAN class="punctuation token">.</SPAN>GeometryAttribute<SPAN class="punctuation token">.</SPAN>CurrentValue
<SPAN class="keyword token">bool</SPAN> shapeChangedCorrect <SPAN class="operator token">=</SPAN> <SPAN class="operator token">!</SPAN>OriginalGeometry<SPAN class="punctuation token">.</SPAN><SPAN class="token function">IsEqual</SPAN><SPAN class="punctuation token">(</SPAN>NewGeometry<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">//Always Equal</SPAN>
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Any Suggestions on what I need to do to compare the original and new value when using the modify tools? I need this as a change to an area might need to be filled in by another type of area. The original value allowed a user to roll back. But now that the above doesn't work for the modified tools, the following cancel option doesn't work for these tools either.
<SPAN class="comment token">//ROLL BACK FAILS WHEN USING ROTATE/SCALE/MOVE</SPAN>
<SPAN class="comment token">//Roll Back or undo changes from the edit</SPAN>
args<SPAN class="punctuation token">.</SPAN><SPAN class="token function">CancelEdit</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN> Task<SPAN class="punctuation token">.</SPAN><SPAN class="token function">FromResult</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">false</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>