written in front
Recently, Boss asked to embed the current osgGIS effect into the webpage to realize it. After more than a week of tossing, it was finally done.
Let me talk about my own environment first: the system is Window10, the osg version is 3.4, the qt version is 5.9, and the vs2017 compilation project is 64-bit.
I have read a lot of blog posts on the Internet before, and the overall process is similar, but those articles have a common feature, they are older, and most of them are developed with 32-bit software. There should be no problem with using vs+qt to embed web pages. But now all the programs I develop are 64-bit programs, which are quite different from the technical route of my predecessors.
Of course, the general idea is still:OSG embeds QT, and QT embeds web pages, thus realizing the combination of OSG and web pages (IE kernel)。
ActiveQT server plugin
Using VS+QT to build an Activex project does not need to be detailed, first post a map:
Always choose the default, you can build a whole ActiveQT framework.
The ID number on the first line of thehtmlin the document[Objet]the value of the object.
osg embed QT
For the combination of osg and QT, you can check the official examples given by OSGosgviewerQT。
(The code has been uploaded to GitHub)
Difficult IE (key)
After the 64-bit ActiveQT control is made, opening it directly with ie will probably not load successfully. Open the ie browser, the default is to directly open the 32-bit (you can find iexplore through the window explorer–open the file location to confirm), even if you choose 64-bit, it will not be successful under normal circumstances, this is where you are stuck .
Quoted from a passage on the Internet “After opening multiple tabs in IE browser at the same time, Windows will run multiple different IEXPLORE.EXE processes at the same time. The “loosely coupled IE” process management technology introduced in the version of . This technology allows the IE browser to separate the main window and tabs with different, separated IEXPLORE.EXE processes. If a tab encounters If there is a problem, it needs to be closed, which can avoid affecting the entire IE browser main window and other tabs. This will help improve the stability and security of the IE browser.”
That is, when makinghtmlFinally, even if you choose to use 64 ie to open, at least two threads will be started. Viewing method: open an ie webpage, select “task manager” and select “ie go to details”, as shown in the figure: (generally, you will see to two processes, one is the 64-bit open, and the other is the 32-bit ie process opened by default)
Now, all we have to do is to set IE single-process 64-bit startup, there are two methods:
ie single process start method one:
Run gpedit.msc Group Policy Manager. Open “Tab Process Growth” in “Computer Configuration—”Administrative Templates—”Windows Components—”Internet Explorer”, set it to Enabled, and set the tab process growth to 0. After application, IE enters single-process mode. At this time, use iexplore.exe in the C:\Program Files\Internet Explore directory (IE in this directory is 64-bit) to open the html file that calls the 64-bit control, and you can successfully call the 64-bit control.
ie single process startup method two:
If the above method fails, you can (Baidu experience)https://jingyan.baidu.com/art…