Page MenuHomePhabricator

Measurement Bugs on MAC
Closed, ResolvedPublic

Description

When you draw "Polygon" or "Line Path" the order of the conneciton between the points is quite random.

Event Timeline

Also, after finishing a Line Path or Polyong, the FIRST set point is deleted again.

Here a short summary of the bug:

The problem is that the insertion index (more exactly the current selected controlpoint index of the figured) is not incremented correctly in the planar figure's AddControlPoint function.

The reason for that is:

When drawing a PlanarPolygon controlpoint are inserted in two cases:

  1. when adding a point by left click
  2. right after a left click which is kind of a preview of where the next point will be placed

The new controlpoint of 2. is then moved according to the mouse movement and its coordinates are always updated in the planarPolygon's controlpointlist.

The problem now is that when the user adds the control point this "added" point differs slightly from the "moved" point:

E.g.:

MOVE: projected point 1: [100.036, 151.063]

vs.

ADD: Projected Point 2: [100.32, 151.403]

I think there might be some conversion or rounding errors.

When the points are compared in the AddControlPoint function of the PlanarFigure MITK thinks these are different point and hence does not increment the selected control point index.

When then next "moving" control point is inserted the wrong index is taken and so on...

Did some further investigation:

The problem is that the PositionEvent (more precisely) its world position has changed somehow. I.e. the last AcMovePoint PositionEvent has slightly different coordinates than the AcAddPoint (after left click) PositionEvent.

We finally figured out the reason for this bug:

Moving and pressing the mouse delivers QMouseEvents to the QmitkRenderWindow which is kind of the root of the mitk interaction chain. One would assume that if you move the mouse and then click the left mouse button like it is done for placing a new control point for the PlanarPolygon would both give you the mouse position. This is the case on linux and windows systems but not on mac ox :-)

With the fix for T9223 the logic of inserting a control point for planar figures has been changed which is why this problem now appears on mac. This fix compares the inserted points and sets the currently selected control point accordingly. On mac os x this comparison fails because of the slightly different mouse position most of the time and hence a wrong current control point is set.

Solution for this bug:
Change the logic for inserting points again. The points are inserted at the given position but we have to take care with setting the current control point correctly.

After talking to daniel und markus we found a solution:

In the PlanarFigureInteractor the nextIndex for inserting a point is calculated. This is necessary if a point is added to the figure after it has been initially placed. Otherwise points should simply be appended to the figure's point list.

We simply added a check for the "initiallyplaced" property of the figure. If this property is true the index must be determined otherwise the index is -1 which means that the point will be appended

[c6f47c]: Merge branch 'bug-13097-weird-planarfigure-interaction-on-mac'

Merged commits:

2012-10-24 08:48:25 Andreas Fetzer [a54e29]
Fixed weird interaction behaviour during drawing PlanarPolygons and Paths

Added a check if a new point is added. Now if the figure was already finished
the insertion index is calculated since a new point was added afterwards.
Otherwise the points will simply be appended