[QGIS-Developer] PYQGIS - OpenGL in QgsPluginLayer

Sébastien Peillet sebastien.peillet at oslandia.com
Wed Mar 3 09:38:11 PST 2021


Hi Eric,

As Martin said, Vincent Mora created a plugin layer in QGIS 2.x to
render OpenGL layer. This plugin layer was designed to render a mesh
layer as it was not available yet in QGIS. So only this kind of layer
has been developped, but you should be able to use the OpenGlLayer class
to create other kind of layer. Since last year, I inherited projects
that depend of that plugin layer and migrated the meshlayer on QGIS 3.x
. I juste pushed the recent update on the gitlab.com repository
(Oslandia left the github.com one) :
https://gitlab.com/Oslandia/qgis/meshlayer

The latest update is necessary to use the meshlayer on QGIS >= 3.14 .

Regards

Sébastien

On 03/03/2021 17:48, Eric Younkin - NOAA Federal wrote:
> Hi Martin,
>
> Thanks for the quick reply.  This is for NOAA nautical chart
> symbology, following the s57/s52 spec.  You can see the symbology in
> the online viewer here
> <https://www.nauticalcharts.noaa.gov/ENCOnline/enconline.html>.  It is
> basically a very complex spec that we generated for display in a
> wxPython widget a long time ago using GDAL 1.x commands.  S57 is
> already an existing OGR driver, although I do not know what exactly
> that driver does.  I do know that it does not somehow generate the
> symbology of the data for you to then render.
>
> The vector data would be a combination of area/line/point features,
> and I don't think it would be a fit for the Mesh layer.
>
> We'd like to make this symbology available in QGIS, so that users can
> drag in a s57 file and view the chart.  You can use one of our WMS
> services, but having the file support would be useful.  Ideally in a
> plugin layer, so that I can also use it in our other apps that use
> PYQGIS QgsMapCanvas widgets.
>
> Thanks,
> Eric
>
> On Wed, Mar 3, 2021 at 11:00 AM Martin Dobias <wonder.sk at gmail.com
> <mailto:wonder.sk at gmail.com>> wrote:
>
>     Hi Eric
>
>     On Wed, Mar 3, 2021 at 3:48 PM Eric Younkin - NOAA Federal
>     <eric.g.younkin at noaa.gov <mailto:eric.g.younkin at noaa.gov>> wrote:
>
>         Looking for some advice.  We have a need to use OpenGL to
>         draw the symbology associated with some vector data.  All of
>         our code uses OpenGL 1.x.  I was thinking we could use the
>         QOpenGLWidget and the QgsPluginLayer to add our OpenGL
>         rendered symbology to a QgsMapCanvas as a new layer.  
>
>         Is this possible?  Is there an example anyone knows of that is
>         kind of similar to this idea?  Or is there a better way to
>         approach this problem?
>
>
>     Could you please provide some more details regarding the symbology
>     you would like to get rendered? A screenshot would help a lot...
>
>     If you plan to use mesh-based weather data, maybe what you are
>     trying to do is already possible with the mesh layer in QGIS out
>     of the box (e.g. display of arrows, streamlines, trace animation),
>     or there is only small amount of extra work do be done in QGIS
>     core to achieve that.
>
>     As for OpenGL approach (it looks like you already have some
>     existing code you would like to adapt to QGIS)... are you looking
>     just at 2D rendering or 3D rendering as well? I know some time ago
>     for QGIS 2.x Vincent Mora has created a plugin layer that used
>     OpenGL to render to offscreen image and then draw it in map canvas
>     [1] which involved some hacks. With QOpenGLWidget approach I would
>     be quite cautious as it may not work well, or have some strange
>     issues on different platforms. For example, I _think_ the
>     QOpenGLWidget can't be semi-transparent (but I may be wrong), so
>     mixing its content with the rest of the map could be quite tricky...
>
>     Regards
>     Martin
>
>     [1] https://github.com/Oslandia/meshlayer
>
>
>
> -- 
> Eric Younkin
> Physical Scientist
> NOAA OCS, Hydrographic Systems and Technology Branch
> 1315 East-West Highway
> N/CS11, Room 6604
> Silver Spring, MD 20910
> Office: 240-847-8208
> Cell: 828-331-8197
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

-- 
Sébastien Peillet

Ingénieur développement
Oslandia
01.88.33.76.86
sebastien.peillet at oslandia.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20210303/89289125/attachment-0001.html>


More information about the QGIS-Developer mailing list