littlenavmap
littlenavmap copied to clipboard
web plugin "ol-map" display is "garbled" when using spherical projection, former display settings appear to be in cached tiles
Hi @KOKAProduktion , hi @albar965 ,
I'm sorry to bother you, I'm just trying out the ol-map plugin with Little Navmap 2.7.9. :O :| 😊
The map display is garbled when the projection is set to "Spherical". Initially, when opening LNm 2.7.9 the projection was set at "Mercator" in the menu although the globe rendered as the Spherical projection inside LNm, I set it to "Spherical" explicitly and then back to "Mercator" to have display and menu be in sync again. I last time modified the projection in a main release of LNm.
I just noticed: on every start of LNm 2.7.9 the projection is set to "Mercator" in the menu even if i closed LNm when "Spherical" was enabled and "Spherical" is still used for the globe display after start of LNm 2.7.9. @albar965
After syncing "Mercator" projection, the web map display is fine, except it uses cached tiles which can contain previous View settings, eg. the map grid:
The /web/ol/index.bundle.js
contains code from you, @KOKAProduktion ? Can you provide the unminified source and build instructions?
I saw the following output with spherical projection:
I just noticed: on every start of LNm 2.7.9 the projection is set to "Mercator" in the menu even if i closed LNm when "Spherical" was enabled and "Spherical" is still used for the globe display after start of LNm 2.7.9.
Bug introduced with the latest changes to the theme handling. Will fix.
I saw the following output with spherical projection:
Sorry, I cannot reproduce this. Neither legacy nor modern UI mode. I see either the Globe or Mercator in the web UI.
I just noticed: on every start of LNm 2.7.9 the projection is set to "Mercator" in the menu even if i closed LNm when "Spherical" was enabled and "Spherical" is still used for the globe display after start of LNm 2.7.9
Should be fixed with 3904a6720b49841fc2475178e24ff1f62e8933a8 .
Sorry, I cannot reproduce this. Neither legacy nor modern UI mode. I see either the Globe or Mercator in the web UI.
You need to enable the plugin "ol-map" from the plugin menu in the modern UI.
Thank you for fixing the projection menu!
I think I'll disable spherical projection for all map services. Does not make sense anyway IMO.
BTW: Some queries are apparently not deleted once using the ol-map. Seems that the MapActionsController
is deleted too late.
[15 13:58:16.584 DEBUG] navapp.cpp:279: NavApp::deInit() delete databaseMeta
[15 13:58:16.584 DEBUG] navapp.cpp:283: NavApp::deInit() delete databaseMetaNav
[15 13:58:16.584 WARN ] :0: QSqlDatabasePrivate::removeDatabase: connection 'LNMDBSIM' is still in use, all queries will cease to work.
[15 13:58:16.584 WARN ] :0: QSqlDatabasePrivate::removeDatabase: connection 'LNMDBNAV' is still in use, all queries will cease to work.
[15 13:58:16.584 WARN ] :0: QSqlDatabasePrivate::removeDatabase: connection 'LNMDBUSER' is still in use, all queries will cease to work.
[15 13:58:16.584 WARN ] :0: QSqlDatabasePrivate::removeDatabase: connection 'LNMDBTRACK' is still in use, all queries will cease to work.
[15 13:58:16.584 DEBUG] navapp.cpp:287: NavApp::deInit() delete magDecReader
[15 13:58:16.584 DEBUG] navapp.cpp:291: NavApp::deInit() delete moraReader
[15 13:58:16.584 DEBUG] navapp.cpp:295: NavApp::deInit() delete vehicleIcons
[15 13:58:16.584 DEBUG] navapp.cpp:299: NavApp::deInit() delete splashScreen
[15 13:58:16.584 DEBUG] mainwindow.cpp:543: MainWindow::~MainWindow() Unit::deInit()
[15 13:58:16.584 DEBUG] mainwindow.cpp:547: MainWindow::~MainWindow() Settings::shutdown()
[15 13:58:16.584 DEBUG] settings.cpp:86: Settings::shutdown()
[15 13:58:16.614 DEBUG] mainwindow.cpp:559: MainWindow::~MainWindow() destructor about to shut down logging
[15 13:58:16.625 DEBUG] ../littlenavmap/src/webapi/mapactionscontroller.cpp:188: virtual MapActionsController::~MapActionsController()
[15 13:58:16.625 DEBUG] ../littlenavmap/src/webapi/mapactionscontroller.cpp:209: void MapActionsController::deInit()
[15 13:58:16.625 DEBUG] ../littlenavmap/src/mapgui/mappaintwidget.cpp:127: virtual MapPaintWidget::~MapPaintWidget() delete paintLayer
[15 13:58:16.625 DEBUG] ../atools/src/util/filesystemwatcher.cpp:42: virtual atools::util::FileSystemWatcher::~FileSystemWatcher()
[15 13:58:16.625 DEBUG] ../littlenavmap/src/mapgui/mappaintwidget.cpp:130: virtual MapPaintWidget::~MapPaintWidget() delete screenIndex
[15 13:58:16.625 DEBUG] ../littlenavmap/src/mapgui/mappaintwidget.cpp:133: virtual MapPaintWidget::~MapPaintWidget() delete aircraftTrack
[15 13:58:16.626 DEBUG] ../littlenavmap/src/mapgui/mappaintwidget.cpp:136: virtual MapPaintWidget::~MapPaintWidget() delete aircraftTrackLogbook
[15 13:58:16.626 DEBUG] ../littlenavmap/src/mapgui/mappaintwidget.cpp:139: virtual MapPaintWidget::~MapPaintWidget() delete apronGeometryCache
[15 13:58:16.626 DEBUG] ../littlenavmap/src/mapgui/mappaintwidget.cpp:142: virtual MapPaintWidget::~MapPaintWidget() delete mapQuery
[15 13:58:16.641 INFO ] ../littlenavmap/src/main.cpp:400: app.exec() done, retval is 0 (ok)
13:58:16: /home/alex/Projekte/build-littlenavmap-debug/littlenavmap exited with code 0
You need to enable the plugin "ol-map" from the plugin menu in the modern UI.
Fixed with 30bf04c562accf190e40b11119fa0d174e2c6453 . Now always Mercator.
No idea how to fix the out of sync / late deletion of MapActionsController
. Might cause crashes if there are incoming requests during shutdown.
Hi guys!
I hope you're well? Thanks for exploring and finding these issues!
The map display is garbled when the projection is set to "Spherical".
Yes, OL is using the proj4.js@^2.7.2 lib for projections. AFAIK it is not capable of handling the spherical projection Marble is providing here. So this projection can't be used within the OL implementation.
I guess the correct fix would be to provide the desired projection as a param to the MapActionsController
call and setting it to "Mercator" by the OL implementation. This way "Spherical" could still be queried if desired by other consumers.
After syncing "Mercator" projection, the web map display is fine, except it uses cached tiles which can contain previous View settings, eg. the map grid:
I'll take a look at this. Maybe I've overlooked something, since I tend to tinker with my browser cache settings.
The /web/ol/index.bundle.js contains code from you, @KOKAProduktion ? Can you provide the unminified source and build instructions?
https://github.com/KOKAProduktion/littlenavmap-openlayers/tree/feature/lnm-webapi
It's a default node.js application so
git clone https://github.com/KOKAProduktion/littlenavmap-openlayers.git
cd ./littlenavmap-openlayers
git checkout feature/lnm-webapi
npm install
npm run start
would serve a development instance querying a running LNM on your local host. And
npm run build
would create the minified deployment version into dist/Little Navmap/web/ol
added to this repo at #826
Some queries are apparently not deleted once using the ol-map. Seems that the MapActionsController is deleted too late.
Oo. Can't really say that I know how deletion works... When creating the MapActionsController
I just faithfully copied the MapPaintWidget
handling logic from WebMapController
so I may be doing something wrong here. Should I investigate? Would you guys have any hints for me?
Thx again and cheers!
Hi,
Oo. Can't really say that I know how deletion works... When creating the
MapActionsController
I just faithfully copied theMapPaintWidget
handling logic fromWebMapController
so I may be doing something wrong here. Should I investigate? Would you guys have any hints for me?
WebMapController
is deleted from NavApp::deInit()
but this does not delete the MapActionsController
. The latter one contains MapPaintWidget
(indirectly or so) which again aggregates several query classes having active database queries.
Now Qt deletes all child objects of an object automatically which results in MapActionsController
and all its descendants deleted once the main window is closed (main window passed as parent to it). It is deleted including map widget and the queries but too late when the databases are already closed. That's why Sqlite shows the warning message.
I could not really follow through the code with the debugger since GDB chokes when the socket is closed.
Alex
Without having looked at the code again or understanding the issue in detail, some hints:
db connections might have to be closed, like file resources from an os have to be closed, or like in PHP (https://www.php.net/manual/en/pdo.connections.php, https://www.php.net/manual/en/function.sqlsrv-close.php) where closing with PDO equals assigning null to the connection to get it garbage collected.
The latter doesn't apply in C++ so you would have to manage closing connections appropriately as you see fit yourself.
Additionally, memory doesn't get released automatically in C++ (if you don't use something like ("Ad"!) https://github.com/u-an-i/MemoryManagement), so once a class object is going to be not used again and on program exit it should get delete
d, freeing any other associated resources, upon which the ~ClassName()
destructor is called.
For the map service I can think of requiring delete
ing only when the webserver gets turned off from the menu or when the program exits. Regarding connections they should then at least be closed at last (though you might want to close them earlier and reestablish them per map API query, depends on expectation of query rate I guess) (which also might enable them to be accessed again by other programs running in the os, so they wouldn't just be a "memory leak" but might block other programs ("might" in the meaning of I having no clue wrt such os resources)).
Qt might (or does as stated by Alex) delete
all its classes objects on program exit itself but the order of doing so might not fit the needs of how they might depend on each other.
@KOKAProduktion I thank you for your reference to your repo, I will take a look once I find leisure.
Fixed some time ago by using Mercator for webmap.