PDA

View Full Version : Keep the size of a user defined item



Semeto
22nd June 2015, 16:35
Hello everybody,

i wanna draw a user defined symbol - the shape of a small mobile robo - on a qwtpolarplot with enabled qwtpolarmagnifier.

For the first try i used a qwtpolarmarker with a rectangular qwtsymbol as symbol.


QwtSymbol( QwtSymbol::Rect, Qt::NoBrush, QPen( QBrush( Qt::blue ), 4, Qt::SolidLine ), QSize( 70, 50 ) )

Unfortunately the symbol is not becoming bigger/smaller when i zoom in/out. Is there an easy way to increase/decrease the size of this rectangular when the user is zooming??

As i understand this the size in painter cord (70;50) is kept constant when i use the zooming function - but i want the real size of the robo (e. g. 1m;0.7m) kept constant. Hope you understand what i try to express.


My second idea was to subclass qwtpolaritem, but i have no idea how i can achieve my goal that the size of the symbol is increased/decreased when i use the mousewheel to zoom in/out.

Another question: is there a possibility to rotate a qwtsymbol so that i can display the 2D-angle of the robo??

Instead of all i could use a qwtcurve to display the shape of the robo (and also the 2D-angle) but this sounds like a quick and dirty solution.


Hope someone can point me in the right direction. ;)

Regards

semeto

Uwe
24th June 2015, 05:49
I recommend to derive from QwtPolarItem. The attributes of your items are: the position. radius and heading.
The when painting all you need to do is to use the scalemaps to translate your attributes into paint device coordinates. The scaling is included in the transformations of your map - nothing extra to do for zooming.

Uwe