Select to view content in your preferred language

Possible Bug in Row Change

426
0
05-17-2018 11:25 AM
MKa
by
Frequent Contributor

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

//GET THE PRE EDIT SHAPE
Inspector inspr = await GetInspectorForRow(args, false);

//This is the Value before the vertices change
pmi.OriginalGeometry = inspr.Shape;‍‍‍‍‍‍‍‍‍‍‍‍‍

Then I get the actual change in shape which I get from the arg using the following

//GET THE POST EDIT SHAPE
int shapeIndex = args.Row.GetTable().GetDefinition().FindField("Shape");
Geometry geomNew = args.Row[shapeIndex] as Geometry;
if (geomNew != null)
{
    pmi.NewShape = geomNew.Clone();
}‍‍‍‍‍‍

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. 

//CHECK IF THERE WAS A SHAPE CHANGE
bool shapeChanged = !pmi.OriginalGeometry.IsEqual(pmi.NewShape);

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.  

//THESE DON'T YIELD THE EXPECTED RESULTS
Args.HasValueChanged //Always True
Inspector.GeometryAttribute.OriginalValue 
Inspector.GeometryAttribute.CurrentValue
bool shapeChangedCorrect = !OriginalGeometry.IsEqual(NewGeometry); //Always Equal
‍‍‍‍

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.

//ROLL BACK FAILS WHEN USING ROTATE/SCALE/MOVE
//Roll Back or undo changes from the edit
args.CancelEdit(() => Task.FromResult(false));‍‍

Tags (1)
0 Kudos
0 Replies