PDA

View Full Version : Looking for ideas for QLineF objects



harakiri
29th February 2008, 11:41
hi everyone,

i am currently working on a line segmentation project. i already have a working framework that segments all lines of an image and passes the detected lines to the GUI.
the lines are stored as QLineF objects in a QList and drawn on a QWidget using QPainter. furthermore it is possible to select a line by pressing and moving the mouse over it. this is performed by drawing a QRubberband and test for an intersection between every line in the QList and the diagonals of the selected rubber band. additional, i have to implement a test whether a line's start or end point is within the selection because otherwise it would be possible that a line is in the selection but does not intersect with the diagonals (directly, not unbounded intersection).

this is what i have got so far:
http://www.uni-koblenz.de/~harakiri/daten/other/Bildschirmfoto.png

my problems:

everything works fine for my test example, but what about an image containing 500 lines? if the user makes a selection, there will be 2 test if either the start or end point of any of the lines is within the selection and 2 test if one of the diagonals intersects with any of the lines. resulting in 1000 intersection test and 1000 point test...
is there a better way to do this (without dividing the image in regions) ?
isn't it possible to highlight a line whenever the mouse is hovered over it?
after selecting a line it should be possible to auto-select (simply show or highlight) any other line within the picture that has:

nearly the same length +/- x -> easy (x = user's choice)
nearly the same direction with a variation of max. y degree -> i see quite a problem here because i haven't found anything useful in the documentation (y = user's choice)

after selecting two lines, i want to compute and show the 2 pairs of angles in the widget(only for bounded intersection). the user should now be able to choose and select one of the four angels by clicking on it (i wonder how i' m going to realize that...). On top of that, i would like to show any other angle in the GUI with almost the same amplitude, again user's choice. any ideas how to realize this in an efficient way?


right now i'm looking for any ideas or improvements. a discussion is also welcome, thanks in advance for any answer in this thread

wysota
29th February 2008, 11:46
I suggest you use QGraphicsView instead of a plain widget. It has many features you can use (including rubberband selection, hovering, etc.).