Disclosure of Invention
In view of this, the present disclosure provides a method for generating a three-dimensional grid map based on an LOD technology, which can design a suitable drawing and displaying method under a given hardware configuration condition, efficiently construct and display a 3D three-dimensional grid model of a ground object (hereinafter, we mainly take a building as an example), and ensure that a 3D three-dimensional grid data map system can smoothly perform interactive operations such as selection, dragging, and the like.
According to an aspect of the present invention, a method for generating a stereoscopic mesh map based on an LOD technique is provided, where the method includes:
acquiring grid vector data of a ground object, performing Beidou grid coding on the grid vector data, and storing the Beidou grid coding into a memory;
determining the maximum drawable grid number N, and drawing the mapping relation between the map zooming level a and the grid subdivision level b of the LOD technology according to the maximum grid number N;
storing the mapping relation of the map zooming level a and the mesh subdivision level b into a memory;
and drawing a three-dimensional grid graph of the ground feature according to the mapping relation between the map zooming level a and the grid subdivision level b and the Beidou grid code corresponding to the grid vector data of the ground feature.
In one possible implementation, the method further includes:
and drawing the three-dimensional grid map of the ground feature based on a 3DTiles drawing method, and storing and loading the three-dimensional grid map of the ground feature in a 3DTiles format.
In one possible implementation, drawing a three-dimensional grid map of the feature based on a 3DTiles drawing method, and storing and loading the three-dimensional grid map of the feature in a 3DTiles format includes:
determining a tree structure of 3DTiles according to the grid vector data of the ground feature and the grid subdivision level b;
calculating the error of each layer of LOD of the tree structure of the 3DTiles, and generating a JSON file of the 3 DTiles;
calculating a three-dimensional grid map of each node of the tree structure of the 3DTiles according to the tree structure of the 3DTiles and the grid vector data of the ground features, and obtaining and storing a B3DM file of the three-dimensional grid map of the ground features drawn based on the 3DTiles drawing method;
reading the JSON file of the 3DTiles to analyze the tree structure of the 3DTiles, loading a B3DM file of the corresponding three-dimensional grid map of the ground feature according to the current grid subdivision level B, and displaying the three-dimensional grid map of the ground feature.
In a possible implementation manner, the generating a three-dimensional grid map of the surface feature according to the mapping relationship between the map scaling level a and the grid subdivision level b and the beidou grid code corresponding to the grid vector data of the surface feature includes:
acquiring the coordinates of a current visible geographic area and a current map zooming level a;
inquiring the ground features to be displayed in the geographic area, and inquiring a current mesh generation level b corresponding to the current map zooming level a according to the mapping relation between the map zooming level a and the mesh generation level b;
generating grid vector data of the ground object corresponding to the current grid subdivision level b according to the current grid subdivision level b and the ground object to be displayed;
and starting a drawing engine to generate a three-dimensional grid map of the ground feature according to the Beidou grid codes corresponding to the grid vector data of the ground feature.
In one possible implementation, the mesh vector data of the feature includes contour data of the feature, height information, and a subdivided feature contour polygon.
In one possible implementation, the map zoom level a is used to determine the size of the displayable geographical area range;
and the mesh subdivision level b is used for determining the number of the three-dimensional mesh graphs of the ground feature.
According to the method for generating the three-dimensional grid map based on the LOD technology, Beidou grid coding is carried out on grid vector data by acquiring the grid vector data of ground objects, and the Beidou grid coding is stored in a memory; determining the maximum drawable grid number N, and formulating the mapping relation between a map zooming level a and a grid subdivision level b of the LOD technology according to the maximum grid number N; storing the mapping relation between the map zooming level a and the mesh subdivision level b into a memory; and drawing a three-dimensional grid graph of the ground object according to the mapping relation between the map zooming level a and the grid subdivision level b and the Beidou grid codes corresponding to the grid vector data of the ground object. The method can design a proper drawing and displaying method under the condition of given hardware configuration, efficiently construct and display the 3D stereoscopic grid model of the ground feature, and ensure that the 3D stereoscopic grid data graph system can smoothly perform interactive operations such as selection, dragging and the like.
Other features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments, which proceeds with reference to the accompanying drawings.
Detailed Description
Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. In the drawings, like reference numbers can indicate functionally identical or similar elements. While the various aspects of the embodiments are presented in drawings, the drawings are not necessarily drawn to scale unless specifically indicated.
The word "exemplary" is used exclusively herein to mean "serving as an example, embodiment, or illustration. Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments.
Furthermore, in the following detailed description, numerous specific details are set forth in order to provide a better understanding of the present disclosure. It will be understood by those skilled in the art that the present disclosure may be practiced without some of these specific details. In some instances, methods, means, elements and circuits that are well known to those skilled in the art have not been described in detail so as not to obscure the present disclosure.
The method disclosed by the invention is mainly used for solving the performance problem in the process of drawing a large number of three-dimensional grid maps of buildings (buildings), and comprises two methods:
if the 3D grid graph of the ground feature is generated and then the associated service data is needed to change the drawing grid pattern (line width, color, transparency and the like) in real time according to the associated service data, a drawing method based on grid vector data is adopted, proper drawing constraint limitation is used according to the current detail requirement, the drawing interface is directly used for drawing in real time, and the real-time modification of the grid pattern can be realized. And the drawing constraint is carried out by adopting a preset LOD rule in the drawing process, the rendering of unnecessary details is reduced, and the real-time drawing performance is improved. The basic idea is to obtain grid vector data (including ground feature contour grid codes, such as a building and the like) of ground features from the rear end, then directly draw the grid by using a front-end drawing interface, and perform corresponding drawing constraint aiming at different detail requirements (preset LOD rules) in the drawing process so as to improve the drawing efficiency.
If the generated 3D grid map of the surface feature does not change in real time in the application of the associated service data, a drawing method based on a 3D files format is adopted. The basic idea is to store a three-dimensional grid map of a ground feature drawn in advance into a 3DTiles format, and directly load 3DTiles data during loading, so that better loading efficiency and interaction response speed can be achieved.
Fig. 3 shows a flowchart of a method for generating a stereoscopic mesh map based on the LOD technique according to an embodiment of the present disclosure. The method can be applied to the generation of a 3D grid map of the ground features, wherein the ground features can comprise buildings, mountains and the like. As shown in fig. 3, the method may include:
step S1: acquiring grid vector data of ground objects, carrying out Beidou grid coding on the grid vector data, and storing the Beidou grid coding into a memory.
The ground object can be a building, a mountain or the like, and the grid vector data can include contour data, height information and a subdivided contour polygon. For example, the contour data and the building height information of a building are obtained, the contour data and the building height information of the building are stored in a database, the contour polygons of the building are divided into mesh sets, and the contour polygons of the building are coded and stored in the database.
After the grid vector data of the ground object is obtained, Beidou grid codes can be further carried out on the grid vector data and stored in a background memory, so that a stereoscopic grid graph of the ground object can be conveniently drawn by inquiring the Beidou grid codes of the ground object, and the back end associates service data according to the Beidou grid codes of the ground object.
Step S2: and determining the maximum drawable grid number N, and drawing the mapping relation between the map zooming level a and the grid subdivision level b of the LOD technology according to the maximum grid number N.
Wherein map zoom level a may be used to determine a displayable geographic area range size; the mesh subdivision level b may be used to determine the number of stereograms of the terrain.
For example, when a 3D stereoscopic mesh map is shown on a map, the efficiency of loading and rendering the 3D stereoscopic mesh map depends on the hardware performance of the machine and the number of meshes to be rendered.
The maximum drawable number of grids N, which is a positive integer, may be determined according to the machine hardware performance. Under the premise of a given hardware configuration, the maximum number of stereoscopic grids which can be drawn for fluency of user interaction is ensured (generally, the number can be determined through experiments).
The number of grids to be drawn depends on two factors: a zoom level a and a mesh split level b of the map.
The zoom level a of the map may determine the size of the geographical area that can be displayed, determine the number of buildings that are visible, and ultimately affect the number of 3D stereoscopic meshes that are displayed. For example, when the zoom level a of the map is smaller, the larger the geographical area range in which the display window is visible, the more buildings are visible, but the single building display is smaller and the details are coarse. When the zoom level a of the map is larger, the smaller the geographical area range in which the display window is visible, the fewer buildings are visible, but the single building is displayed larger and fine in detail.
FIGS. 4 and 5 are schematic diagrams illustrating a perspective grid view of a building when a zoom level is small and when the zoom level is large, respectively, according to an embodiment of the present disclosure; FIG. 6 is a schematic diagram showing a three-dimensional grid diagram of a single building according to an embodiment of the present disclosure.
For example, the zoom level a of the map determines the size of the geographical area that can be displayed and the number of visible buildings, which ultimately affects the number of 3D stereoscopic meshes displayed.
As shown in fig. 4, when the map zoom level a is small, the entire area of the building can be seen on the display window, but the building is small and the details are coarse, and the white mold of the drawn building is used for showing.
As shown in fig. 5, as the lens is zoomed in (the map zoom level a becomes larger), the single building becomes gradually larger, and the drawing of the stereoscopic mesh map of the building is started. The process of drawing the three-dimensional grid graph of the building comprises the steps of firstly selecting a proper grid subdivision level b, calculating the number of grids to be drawn of the building according to the grid subdivision level b, and similarly, calculating the number of grids to be drawn of all buildings in the whole window range, wherein the number of the grids to be drawn of all the buildings is required to be smaller than the maximum drawable grid number N. According to the principle, the corresponding mesh subdivision level b can be confirmed for each map zooming level a, and the stereo mesh graph of the map zooming level a can be drawn. At this time, only the three-dimensional grid lines outside the white mode are drawn, so that the drawn three-dimensional grid data can be further reduced, and the drawing performance of the three-dimensional grid map is improved.
As shown in fig. 6, after the three-dimensional grid maps of all buildings are drawn, a certain building is selected to draw all grids, and the grids associated with the service data are marked with different colors.
The mesh subdivision level b can determine the size of a single three-dimensional mesh, so as to determine the number of meshes which need to be drawn actually. For example, the lower the mesh subdivision level b is, the larger a single three-dimensional mesh is, the fewer the number of meshes that a single building needs to draw is; the higher the mesh subdivision level b is, the smaller the single three-dimensional mesh is, and the more the number of meshes which need to be drawn by a single building is. For drawing a three-dimensional grid graph of a building, if the grid subdivision level b is too low, one three-dimensional grid can cover the building, and if the grid subdivision level b is too high, the three-dimensional grid lines are too dense to distinguish the grid. From the viewpoint of drawing beauty and efficiency, the mesh generation level b is generally selected between the specification of 32 meters at the 21 level and the specification of 1 meter at the 26 level, and the selection of the mesh generation level b can be adjusted according to actual business requirements, which is not limited herein.
Step S3: storing the mapping relation of the map zooming level a and the mesh subdivision level b into a memory;
step S4: and drawing a three-dimensional grid graph of the ground feature according to the mapping relation between the map zooming level a and the grid subdivision level b and the Beidou grid code corresponding to the grid vector data of the ground feature.
Through the step S2, the LOD rule can be determined, and the mapping relationship of the corresponding graph scaling level a and mesh partitioning level b can be stored in the background memory as well.
FIG. 7 illustrates a further defined flowchart in which step S3 occurs according to an embodiment of the present disclosure.
In one example, as shown in fig. 7, step S3 may include:
step S31: acquiring the coordinates of a current visible geographic area and a current map zooming level a;
step S32: inquiring the ground features to be displayed in the geographic area, and inquiring a current mesh generation level b corresponding to the current map zooming level a according to the mapping relation between the map zooming level a and the mesh generation level b;
step S33: generating grid vector data of the ground object corresponding to the current grid subdivision level b according to the current grid subdivision level b and the ground object to be displayed;
step S34: and starting a drawing engine to generate a three-dimensional grid map of the ground feature according to the Beidou grid codes corresponding to the grid vector data of the ground feature.
For example, the front end transmits the currently visible geographic area location coordinates and the current map zoom level a to the back end. And querying a building needing to be displayed in the current visible range by the background, determining whether to draw a three-dimensional grid according to the map zooming level a, querying a corresponding grid subdivision level b according to the map zooming level a, generating corresponding grid vector data by the background according to the grid subdivision level b, and transmitting the grid subdivision level b and the Beidou grid code corresponding to the corresponding grid vector data to the front end together. And after receiving the vector data of the building and the corresponding Beidou grid codes, the front end starts a drawing engine to draw a three-dimensional grid map of the building.
If the 3D grid map of the building is associated with the service data after the 3D grid map is drawn and does not need to be changed in real time, the 3D grid map of the building can be drawn and stored firstly, and the 3D grid model data drawn and stored by the method can be directly loaded when a service scene needs, so that the drawing and loading speeds of the 3D grid model are greatly improved.
According to the method for generating the three-dimensional grid map based on the LOD technology, Beidou grid coding is carried out on grid vector data by acquiring the grid vector data of ground objects, and the Beidou grid coding is stored in a memory; determining the maximum drawable grid number N, and formulating the mapping relation between a map zooming level a and a grid subdivision level b of the LOD technology according to the maximum grid number N; storing the mapping relation between the map zooming level a and the mesh subdivision level b into a memory; and drawing a three-dimensional grid graph of the ground object according to the mapping relation between the map zooming level a and the grid subdivision level b and the Beidou grid codes corresponding to the grid vector data of the ground object. The method can design a proper drawing and displaying method under the condition of given hardware configuration, efficiently construct and display the 3D stereoscopic grid model of the ground feature, and ensure that the 3D stereoscopic grid data graph system can smoothly perform interactive operations such as selection, dragging and the like.
However, if the generated 3D mesh map of the surface feature does not change in real time in the associated service data application, a drawing method based on the 3D files format is adopted.
Fig. 8 shows a schematic diagram of a tree structure in which 3DTiles according to an embodiment of the present disclosure appears.
The 3D files is obtained by adding a layered LOD structure on the basis of the glTF, and is specially designed for streaming transmission of a large amount of geographic 3D data and mass rendering. As shown in FIG. 8, a tileset in 3D files is a tree structure consisting of a series of tiles, and the format of each tile is shown in Table 1. Each tile is organized in a tree structure, combining the concept of level lod (hlod) to render the stereo space mesh data most quickly and optimally. In the tree structure, each tile has a bounding box attribute that can completely surround the data of the tile and child nodes in space.
Format
|
Use of
|
Batch 3D model (b3dm)
|
Large heterogeneous 3D (three-dimensional) modelTypes, including three-dimensional buildings, terrains, etc
|
Example 3D model (i3dm)
|
Examples of 3D models, e.g. trees, wind generators, etc
|
Point cloud (pnts)
|
Point cloud
|
Combined data (cmpt)
|
The slices of the above different formats are combined into one slice |
TABLE 1
Fig. 9 shows a flowchart of a stereoscopic mesh map generation method based on the LOD technique according to another embodiment of the present disclosure. As shown in fig. 10, the method may further include:
and step S5, drawing the three-dimensional grid map of the ground feature based on a 3DTiles drawing method, and storing and loading the three-dimensional grid map of the ground feature in a 3DTiles format.
FIG. 9 illustrates a further defined flowchart in which step S5 occurs according to an embodiment of the present disclosure.
In one example, as shown in fig. 9, step S5 may include:
step S51: determining a tree structure of 3DTiles according to the grid vector data of the ground feature and the grid subdivision level b;
step S52: calculating the error of each layer of LOD of the tree structure of the 3DTiles, and generating a JSON file of the 3 DTiles;
step S53: calculating a three-dimensional grid map of each node of the tree structure of the 3DTiles according to the tree structure of the 3DTiles and grid vector data of the ground features, and obtaining and storing a B3DM file of the three-dimensional grid map of the ground features drawn based on the 3DTiles drawing method;
step S54: reading the JSON file of the 3DTiles to analyze the tree structure of the 3DTiles, loading the B3DM file of the corresponding three-dimensional grid map of the ground feature according to the current grid subdivision level B, and displaying the three-dimensional grid map of the ground feature.
Fig. 11 illustrates a schematic diagram showing a three-dimensional grid map of a building generated based on the 3d files format according to an embodiment of the present disclosure.
For example, a tree structure in 3DTiles format is constructed. The Beidou grid codes have LOD attributes, and the three-dimensional grid of each level can be divided into 8 three-dimensional grids of the next level. Selecting a proper subdivision level [ b1, b2, b3,.. once, bm ] according to actual service requirements, wherein the subdivision level of a root node (root node) of a 3DTiles tree structure is b1 (the minimum subdivision level number is the maximum three-dimensional grid), and the subdivision level comprises all building three-dimensional grid sets; the subdivision level corresponding to the second layer is b2, the building three-dimensional grid set is divided into any subsets (the dividing method is arbitrary, for example, the number of the subsets can be specified, and the subsets are divided by using a clustering algorithm such as k-means), and each subset forms a child node (child node) of the 3D nodes tree structure of the second layer; the subdivision level corresponding to the third layer is b3, and a building set corresponding to each child node on the upper layer is divided into a plurality of child sets to form child nodes of a 3DTiles tree structure on the third layer; the subdivision level corresponding to the leaf node (left node) at the lowest layer is (the maximum subdivision level number, the grid block is minimum), and the leaf node does not need to be divided again.
When the JSON file of the 3DTiles is generated according to the determined Geometric Error (GE), the geometric error directly influences the LOD effect of the 3 DTiles. When actually drawing, the system calculates the SSE (screen space error) of the tile according to the relative positions of the current tile and the camera, and if the SSE is smaller than the GE of the tile, the tile is refined and displayed as a sub-tile of the tile. And determining the geometric error of each layer based on the mesh calculation GE corresponding to the subdivision level of the current tile, and packaging the geometric error of each layer together with the generated 3DTiles tree structure information to generate a JSON file of the 3 DTiles.
Calculating the space position information of the grid vertex according to the grid code corresponding to the three-dimensional grid, then performing coordinate transformation on the space position information of the grid vertex, and converting the space position information of the grid vertex from a terrestrial coordinate system (longitude and latitude height) into a world coordinate system (XYZ) used in B3 DM; and then, calculating triangular surface and normal vector information required by drawing and rendering according to the mesh vertexes, and packaging according to the file rule of B3DM to generate a corresponding B3DM model data file. And generating a 3DTiles stereoscopic grid diagram, deploying the stereoscopic grid diagram to a background, analyzing a tree structure by reading a JSON file of the 3DTiles at the front end, and loading a B3DM model with a proper level according to the current vision to display. As shown in fig. 11, the lower left part is visually near and the building's solid grid is denser (more detail can be seen near, represented by the smaller solid grid). The rest is at a distance, and the stereo grid of the building is sparse (the visible details at the distance are coarse, represented by a larger grid).
By adopting the drawing method based on the 3D files format, the generated 3D grid map of the ground object does not change the three-dimensional grid map for drawing the ground object in real time in the application of associated service data, and better loading efficiency and interactive response speed can be achieved.
Having described embodiments of the present disclosure, the foregoing description is intended to be exemplary, not exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen in order to best explain the principles of the embodiments, the practical application, or improvements made to the technology in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.