Joschka
2012-08-23 12:22:04 UTC
Hi,
I want to display an SVG image inside a guiqwt plot to show a vector
overlay on some bitmap images. Starting from Qt's SVG capabilities I found
the QwtPlotSvgItem and tried to implement a new item type for usage with
guiqwt. Attached you find an example of what I have so far: a class that
supports loading of SVG files and displays them inside a plot (the
coordinates of self.bounds are quite odd as I want the image to be
positioned on top of some other image).
For the implementation I had a look at guiqwt's item classes in
guiqwt.image, the base interfaces in guiqwt.interfaces and parameters in
guiqwt.styles. Most of the methods copied from interfaces.IBasePlotItem are
left unchanged as I want to implement functionality step by step as needed
and wanted a quick preview.
The problem I ran into is a display issue. If I start the main script and
pan the display (hold middle mouse button and move mouse) until the left
and top edge of the SVG item disappear in the upper left corner of the plot
window the SVG item sometimes (depending on the zoom level) disappears
completely. The clipping method works correctly If I don't zoom in (scale:
x axis from ca. -200,000 to 700,000 and y axis from ca. -200,000 to
450,000), then I can pan and the SVG item is clipped correctly (parts
outside of the plot window are not shown, but the rest is there). However,
if I zoom in (scale: x axis from ca. -150,000 to 350,000 and y axis from
ca. -150,000 to 200,000), the image disappears as soon the bounding box
(red outline) hits both the left AND top window edges.
How can I resolve this issue? Is there some display method which has to be
re-implemented to consider the current zoom level (view transformation) or
are there methods missing on my implementation?
I am grateful for any pointers or suggestions. I already had a look at the
C++ implementation of QwtPlotSvgItem but couldn't find anything specific.
If I overlooked something while creating the required guiqwt interfaces, I
apologize - I found the structure quite complex though well structured and
logical.
Best regards
Joschka
I want to display an SVG image inside a guiqwt plot to show a vector
overlay on some bitmap images. Starting from Qt's SVG capabilities I found
the QwtPlotSvgItem and tried to implement a new item type for usage with
guiqwt. Attached you find an example of what I have so far: a class that
supports loading of SVG files and displays them inside a plot (the
coordinates of self.bounds are quite odd as I want the image to be
positioned on top of some other image).
For the implementation I had a look at guiqwt's item classes in
guiqwt.image, the base interfaces in guiqwt.interfaces and parameters in
guiqwt.styles. Most of the methods copied from interfaces.IBasePlotItem are
left unchanged as I want to implement functionality step by step as needed
and wanted a quick preview.
The problem I ran into is a display issue. If I start the main script and
pan the display (hold middle mouse button and move mouse) until the left
and top edge of the SVG item disappear in the upper left corner of the plot
window the SVG item sometimes (depending on the zoom level) disappears
completely. The clipping method works correctly If I don't zoom in (scale:
x axis from ca. -200,000 to 700,000 and y axis from ca. -200,000 to
450,000), then I can pan and the SVG item is clipped correctly (parts
outside of the plot window are not shown, but the rest is there). However,
if I zoom in (scale: x axis from ca. -150,000 to 350,000 and y axis from
ca. -150,000 to 200,000), the image disappears as soon the bounding box
(red outline) hits both the left AND top window edges.
How can I resolve this issue? Is there some display method which has to be
re-implemented to consider the current zoom level (view transformation) or
are there methods missing on my implementation?
I am grateful for any pointers or suggestions. I already had a look at the
C++ implementation of QwtPlotSvgItem but couldn't find anything specific.
If I overlooked something while creating the required guiqwt interfaces, I
apologize - I found the structure quite complex though well structured and
logical.
Best regards
Joschka