An animation display method for an agricultural machinery navigation system
Through the combination of Qt C++ program and leaflet map API, the real movement and trajectory display of vehicles on the map in the agricultural machinery navigation system is solved, and the problem of vehicle motion artifacts and high resource occupation in the traditional agricultural machinery navigation system is provided, and good visual effects and actual map indications are provided.
Patent Information
- Application Number
- CN202410581799.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-11
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2044-05-11
AI Technical Summary
In traditional agricultural machinery navigation systems, the simulation of vehicle motion effects is unreal, the front of the vehicle cannot rotate, the trajectory line is serious, the visual effect is poor, the system resource occupies high, and the map is enlarged and reduced and the actual latitude and longitude indicator cannot be achieved.
The Qt C++ program is used to open the html page through QWebEngineView, and the leaflet map API is used to realize the real movement of the vehicle on the map. The front of the vehicle rotates in the direction. The track line is the actual map track. The QWebChannel communicates with the Qt C++ code to control the display of vehicle icons and track lines.
The real vehicle movement effect is presented on the map. The front of the vehicle rotates in the direction of the vehicle. The trajectory line is the actual map trajectory. The system resource occupies a small amount. You can see the fields and road conditions on the map. It supports the map enlargement and reduction, real animation display is realized.
Abstract
Description
Technical Field
[0001] The present invention relates to a method for animating display of an agricultural machinery navigation system, belonging to the technical field of agricultural machinery navigation system software. Background Art
[0002] Traditional animations of agricultural machinery navigation achieve the false effect of the vehicle moving forward through the reverse movement of the screen background. If the vehicle moves, it will go out of the screen boundary, so the vehicle cannot move. The vehicle head always points forward and cannot rotate. The background grid moves backward and rotates, with complex algorithms, large amounts of code, high consumption of system resources, and the inability to see the actual field area and road conditions. Summary of the Invention
[0003] The technical problem to be solved by the present invention is to overcome the defects of the prior art and provide a method for animating display of an agricultural machinery navigation system. The present invention can present the real effect of vehicle movement on an actual map, with the vehicle head rotating along with the movement direction of the vehicle, and the trajectory line being the actual map trajectory line. The map library file is only dozens of K in size, occupying little system resources.
[0004] Preferably, the present invention provides a method for animating display of an agricultural machinery navigation system, including:
[0005] Using a Qt C++ program to open an html page through the control QWebEngineView;
[0006] Based on the pre-edited leaflet map API code, the html page runs the leaflet map API;
[0007] The leaflet map API communicates with the Qt C++ code using QWebChannel.
[0008] Preferably, the leaflet map API communicates with the Qt C++ code using QWebChannel, including:
[0009] Using Qt C++ code to define QWebEnginePage and QWebChannel objects;
[0010] Defining bridge as the bridge for communication between the Qt C++ program and the leaflet map API;
[0011] The leaflet map API transfers longitude and latitude values to the Qt C++ program;
[0012] The Qt C++ program sends commands to the leaflet map API to execute animations.
[0013] Preferably, pre-edit and generate the Leaflet map API code, including:
[0014] Create a map object;
[0015] Create an online map tile layer or add a grid to a blank board;
[0016] A function to add a vehicle icon to the map;
[0017] Create a total track line layer;
[0018] Create a function to specify the rotation angle of the vehicle icon;
[0019] Use the Qt C++ program to record the latitude and longitude movement track data into the database;
[0020] Find out the actual length corresponding to the map zoom level, and according to the vehicle parameters of the agricultural machinery, adjust the corresponding width of the track line of the agricultural machinery and the size of the vehicle icon.
[0021] Preferably, create a map object, including:
[0022] Obtain the map zoom level by accessing the latitude and longitude data of the navigation receiver.
[0023] Preferably, add a vehicle icon to the map, including:
[0024] Use the Qt C++ program to send a command to the Leaflet map API to add a vehicle icon.
[0025] Preferably, create a total track line layer, including:
[0026] Add each drawn track line of the agricultural machinery to the total track line layer, delete all track lines through the total track line layer, zoom in and out of the Leaflet map API or uniformly adjust the width of the track lines.
[0027] Preferably, create a function to specify the rotation angle of the vehicle icon, including:
[0028] Use the Qt C++ program to send a command to the Leaflet map API to control the rotation direction of the front of the agricultural machinery.
[0029] Preferably, the Leaflet map API is JavaScript code.
[0030] Preferably, the present invention provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the program, the steps of the method according to any one of the first aspect are implemented.
[0031] Preferably, the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method described in any one of the first aspects are implemented.
[0032] Beneficial effects achieved by the present invention:
[0033] The present invention can present the real effect of vehicle movement on an actual map, with the vehicle head rotating along the vehicle movement direction and the trajectory line being the actual map trajectory line. The map library file is only dozens of K in size, occupying little system resources. If the industrial tablet computer is connected to the network, map tiles can be downloaded from the Internet to obtain a real map effect, and the field areas and road conditions on the map can be seen, with good visual effects. The animation effect is directly realized by the map, without the need to write complex background animation codes as in the traditional way; if the industrial tablet computer is not connected to the network, the present invention can use a blank picture as a whiteboard to draw the vehicle movement effect and trajectory. Since there is no need to transmit the picture data over the network, this method occupies even less resources. The map animation has the value of indicating actual longitude and latitude. The width of the trajectory line and the size of the vehicle can also be calculated according to the vehicle parameters and corresponding to the map zoom level to achieve a more realistic display effect. In addition, the map can be zoomed in and out by expanding and contracting with two fingers, which is also a function of the map itself and cannot be achieved by the traditional method. Specific embodiments
[0034] Defects existing in the prior art (the disadvantages and deficiencies should be pointed out through reasoning and analysis in combination with the prior art introduced in the previous part):
[0035] 1. The traditional agricultural machinery navigation animation only realizes the simulation effect of vehicle movement. By the reverse movement of the background of the picture, it creates an illusion of the vehicle moving forward, without the graphical indication value of actual longitude and latitude. The traditional way is the movement of the background, not the vehicle movement, with poor visual effects.
[0036] 2. The animation area in the traditional way is simulated, and the actual field areas and road conditions cannot be intuitively seen, with poor visual experience effects.
[0037] 3. In the traditional way, the vehicle head always points forward and cannot rotate, and an additional indication of the vehicle head heading angle is required.
[0038] 4. In the traditional way, the vehicle trajectory line cannot be drawn on the actual map presentation effect. The trajectory line is always a false straight line without a real indication effect.
[0039] 5. The traditional way cannot expand and contract the picture with two fingers, cannot implement touch operations, and cannot achieve the zooming in and out of the picture.
[0040] 6. Implementing animation effects in the traditional way involves complex algorithms, a large amount of code, and high consumption of system resources.
[0041] 7. The traditional way cannot achieve clicking on the animation area to obtain actual longitude and latitude data.
[0042] For the convenience of describing the technical solution of the application, some concepts involved in the present application will be described first. The present invention can achieve:
[0043] 1. Present the real effect of vehicle movement on an actual map. Using the leaflet map, the leaflet map library file is only dozens of K in size, occupying little system resources. There has been no such real map implementation method in the agricultural machinery navigation system industry before.
[0044] 2. If the industrial tablet computer is connected to the Internet, map tiles can be downloaded instantaneously from the Internet to obtain a real map effect. The field areas and road conditions on the map can be seen, similar to the navigation map experience seen in the Didi Chuxing software, with good visual effects. The animation effect is directly implemented by the map.
[0045] 3. If the industrial tablet computer is not connected to the Internet, a blank picture is used as the map tile, and the vehicle runs on the whiteboard effect. The vehicle head rotates with the actual movement effect, with north at the top, south at the bottom, west on the left, and east on the right, and a real longitude and latitude movement track is drawn. Since there is no need for network transmission of the screen data, this method occupies even less system resources. By adding a grid on the whiteboard, the visual effect is enhanced. Another way is to download the map tiles in advance and store them in the tablet computer, so that a real map can also be displayed offline.
[0046] 4. Truly achieve the visual effect of vehicle movement, rather than the background movement in the traditional way. After the vehicle moves, the center point of the map is switched to the longitude and latitude position where the vehicle is located. This ensures that the vehicle does not run out of the screen boundary.
[0047] 5. QWebEngineView is a control in the Qt framework for displaying Web content. It is implemented based on the Chromium kernel, provides the function of rendering HTML documents, and supports scripting using JavaScript.
[0048] The implementation method of the map animation technology is as follows: Compile the QWebEngineView module and the development package of chrome with a Qt C++ program, and install the chrome browser kernel on the industrial tablet computer; use the Qt C++ program on the tablet computer to open the html page through QWebEngineView, and the html page runs the leaflet map API Javascript code to achieve the map animation effect. The library files used are as follows:
[0049] leaflet.js, QtWebEngineProcess, libQt5WebEngineCore, libQt5Positioning, libQt5OpenGL, etc.
[0050] 6. The map API is JavaScript code that communicates with Qt C++ code using QWebChannel. Through QWebChannel, a two-way communication channel can be established between the Qt application and the map JavaScript embedded in QWebEngineView. The specific communication method is as follows:
[0051] (1) The Qt C++ code defines QWebEnginePage and QWebChannel objects.
[0052] (2) The map JavaScript code defines bridge to establish a bridge for communication between the Qt C++ program and JavaScript:
[0053] window.bridge = channel.objects.map;
[0054] (3) The map JavaScript passes longitude and latitude values to the Qt C++ program:
[0055] window.bridge.getCoordinates(lng,lat);
[0056] (4) The Qt C++ program sends commands to the map JavaScript to execute animations:
[0057] ui->webEngine->page()->runJavaScript(cmd);
[0058] The specific implementation method of the map animation JavaScript code is as follows:
[0059] Create a map object. By accessing the longitude and latitude data of the navigation receiver, debug to find the appropriate map zoom level.
[0060] Create an online map tile layer, or add a grid to a blank board.
[0061] Create a function to add a vehicle icon to the map, and the Qt C++ program sends commands to the map JavaScript to add the vehicle icon.
[0062] Create a total track line layer, add each drawn track line to the total track line layer. Through the total track line layer, all track lines can be deleted together, or when the map is zoomed in or out, the width of the track lines can be adjusted uniformly.
[0063] Create a function to specify the rotation angle of the vehicle icon. The Qt C++ program sends commands to the map to control the rotation direction of the vehicle head.
[0064] The Qt C++ program records the latitude and longitude movement track data in the database. When the program starts next time, it loads the latitude and longitude movement track data and sends it to the map to draw the historical track lines on the map.
[0065] (7) Find the actual length corresponding to the map zoom level, and adjust the corresponding width of the vehicle track line and the size of the vehicle icon according to the vehicle parameters, so as to have a suitable display ratio of the track line and the size ratio of the vehicle icon on the map, achieving a more realistic display effect.
[0066] In the embodiment of the present application, the present invention provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, it implements the steps of the method described in any one of the above.
[0067] In the embodiment of the present application, the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the steps of the method described in any one of the above.
[0068] Each embodiment in this specification is described in a progressive manner. The same or similar parts between each embodiment can be referred to each other, and the key points of each embodiment are the differences from other embodiments.
[0069] Those skilled in the art will easily think of other implementation schemes of the present invention after considering the specification and practicing the invention here. This application aims to cover any variations, uses, or adaptive changes of the present invention, which follow the general principles of the present invention and include the common general knowledge or conventional technical means in the technical field not invented by the present invention. The specification and embodiments are only regarded as exemplary, and the true scope and spirit of the present invention are pointed out by the following claims.
[0070] The above specific implementation manners further elaborate on the purpose, technical solution, and beneficial effects of the present application. It should be understood that the above is only the specific implementation manner of the present application and is not used to limit the protection scope of the present application. Any modifications, equivalent replacements, improvements, etc. made on the basis of the technical solution of the present application should be included in the protection scope of the present application.
Claims
1. A method for animating the display of an agricultural machinery navigation system, characterized in that, including: Use a Qt C++ program to open an html page through the QWebEngineView control; Based on the pre-edited leaflet map API code, the html page runs the leaflet map API; The leaflet map API communicates with the Qt C++ code using QWebChannel; The leaflet map API communicates with the Qt C++ code using QWebChannel, including: Use Qt C++ code to define QWebEnginePage and QWebChannel objects; Define bridge as the bridge for communication between the Qt C++ program and the leaflet map API; The leaflet map API passes the longitude and latitude values to the Qt C++ program; The Qt C++ program sends commands to the leaflet map API to execute animations; Pre-edit and generate the leaflet map API code, including: Create a map object; Create an online map tile layer or add a grid to a blank board; Function to add vehicle icons to the map; Create a total track line layer; Create a function to set the rotation angle of a specified vehicle icon; Use a Qt C++ program to record the longitude and latitude movement track data into the database; Find the actual length corresponding to the map zoom level, and adjust the corresponding width of the agricultural machinery track line and the size of the vehicle icon according to the vehicle parameters of the agricultural machinery.
2. A method for animating the display of an agricultural machinery navigation system according to claim 1, wherein: Create a map object, including: Obtain the map zoom level by accessing the longitude and latitude data of the navigation receiver.
3. A method for animating the display of an agricultural machinery navigation system according to claim 2, wherein: Add vehicle icons to the map, including: Use a Qt C++ program to send commands to the leaflet map API to add vehicle icons.
4. A method for animating the display of an agricultural machinery navigation system according to claim 3, wherein: Create a total track line layer, including: Add each drawn track line of the agricultural machinery to the total track line layer, and delete all track lines through the total track line layer, zoom in and out on the leaflet map API, or uniformly adjust the width of the track lines.
5. A method for animating the display of an agricultural machinery navigation system according to claim 4, wherein: Create a function to set the rotation angle of a specified vehicle icon, including: Use a Qt C++ program to send commands to the leaflet map API to control the rotation direction of the agricultural machinery's vehicle head.
6. A method for animating the display of an agricultural machinery navigation system according to claim 1, wherein: The leaflet map API is Javascript code.
7. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method described in any one of claims 1 to 6.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method described in any one of claims 1 to 6.
Citation Information
Patent Citations
Map motion trail animation implementation method and device, electronic equipment and storage medium
CN111063010A
Implementation method, system and equipment for graphically editing train database
CN113094035A
Simulation system visual real-time display device and method based on Qt and offline 3D map
CN116204063A