PDA

View Full Version : Draw a mesh using Qwt?



alex_sh
5th October 2010, 14:45
Hello,

I need to draw an interactive mesh using Qwt 6. I'm attaching a rough screenshot which shows approximately what I mean.

The mesh should be zoomable / pannable (no problem there), and the user should be able to select the individual triangles (by clicking inside them), as well as multiple triangles using rubber band dragging. The selected triangle has either highlighted sides, or a different fill color (whichever is easier to implement). Each triangle has a number shown inside it, and it should be shown only if the triangle's pixel size is large enough for the text to fit in it.
I don't have the source data format yet, but I'm sure I can adapt it to whatever format is necessary.

I've used Qwt in the past for drawing curves, but I have no idea how to approach this problem. I guess the numbers could be drawn as markers (but I will need to somehow show/hide them depending on their triangle size). As for the mesh itself (using a curve for each side seems too much) and the 2 options for triangle selection - I have no idea how to do that.

Any help (hints, suggestions, pointers, code, ...) would be really appreciated.
Thanks in advance!

5271

Uwe
5th October 2010, 15:17
You have to implement a new type of plot item: derive from QwtPlotItem.
( Using markers or curves absolutely makes no sense. )

Uwe

alex_sh
5th October 2010, 16:55
Thanks, I'll try to do that.