I want to set the real city's map image to the background of the plot.
What class of qwt I should use for this?
I am using qwt multi-axis
Printable View
I want to set the real city's map image to the background of the plot.
What class of qwt I should use for this?
I am using qwt multi-axis
What type of format does your image have - some vector or raster graphic ?
How is your image related to the plot axes - probably by knowing he bounding rectangle ?
Uwe
thanks Uwe,
type of format can be .png or .bmp or .jpeg that there is no problem for converting to a format that qwt multi-axis needs
its a simple image of a dem(by print screen of a dem)
the image relates to the plot axis by converting latitude and longtude to (x,y), knowing two point
For SVGs there is an plot item, but for raster data images you have to implement your own. Simply derive from QwtPlotItem and use QPainter::drawPixmap in YourPlotItem::draw.
If you have the option of using vector graphics ( not embedding raster graphics into a SVG ), this would be preferable as you can zoom in/out then.
Uwe
thanks. I can use SVGs. can you explain more about plot item about svg please?
https://qwt.sourceforge.io/class_qwt_plot_svg_item.html
Try the playground/svgmap example.
so.many thanks. does qwt multiaxis support this? my project is on qwt multiaxis.
so many thanks. it works but there is a problem
for the image.svg that i uploaded, showing is not true. the scale is: (0, 0, 9.513, 6.886). also i uploaded the screenshot of showing image.svg by "svgmap" example in "playground"
The SVG item tries to scale the content of the image according to its view box. When looking at the SVG it looks like the viewBox is a ~QRect( 9, 45, 9, 6 ), while I can see that other SVGs, that work as expected have a viewBox starting at 0, 0. So that might be a bug, that is related to this - I will have a look at it.
But a SVG can be translated easily into a QwtGraphic, so it makes sense to have a QwtPlotGraphicItem, that covers a lot more use cases and QwtPlotSvgItem could be removed then. Guess I will do this next time I'm working on the code.
As a side note: if your SVG image consists of these borders only it makes more sense to use one or several QPainterPaths instead of the SVG. A QPainterPath can be displayed as a QwtPlotShapeItem. The advantage of using a QPainterPath is, that you can set the colors, pen widths and filling, so that they fit to the background. When the boundaries are split into several painter paths you can also show/hide them Individually.
Uwe
Now i am using QwtPlotItem and QPainter for my work and it works so nice. I need to find relation between Latitud and Longtude with each pixel coordinates and use that for plotting lat-lon on the image of a map. how can i find each pixel coordinates of the image of my map that is showing backround the qwtplot?
Hi QJak,
I want to do something very similar to what you have attempted here.
Do you have any code you could share on your progress?
Daniel