Disclosure of Invention
In view of this, the disclosure proposes a stereoscopic grid graph generating method based on the LOD technology, which can design a suitable drawing and displaying method under the condition of a given hardware configuration, and efficiently construct and display a 3D stereoscopic grid model of a ground feature (hereinafter, we mainly take a building as an example), so as to ensure that the 3D stereoscopic grid data graph system can smoothly perform interactive operations such as selection, dragging, and the like.
According to an aspect of the present invention, there is provided a stereoscopic mesh map generating method based on LOD technology, the method including:
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 grid number N which can be drawn, and formulating a mapping relation between a map scaling 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 zoom level a and the mesh subdivision level b into a memory;
and drawing a stereoscopic grid map of the ground object according to the mapping relation 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 ground object.
In one possible implementation, the method further includes:
and drawing a three-dimensional grid map of the ground object based on a 3D (three-dimensional) il drawing method, and storing and loading the three-dimensional grid map of the ground object in a 3D (three-dimensional) il format.
In one possible implementation manner, the drawing of the stereoscopic grid map of the ground object based on the 3DTiles drawing method, and the storing and loading of the stereoscopic grid map of the ground object in the 3DTiles format include:
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 LOD of the 3DTiles tree structure, and generating a JSON file of the 3 DTiles;
calculating a three-dimensional grid map of each node of the 3DTiles tree structure according to the 3DTiles tree structure and grid vector data of the ground object, and obtaining and storing a B3DM file of the three-dimensional grid map of the ground object drawn based on the 3DTiles drawing method;
reading the JSON file of the 3DTiles to obtain a tree structure of the 3DTiles, loading a B3DM file of the corresponding three-dimensional grid map of the ground object according to the current grid subdivision level B, and displaying the three-dimensional grid map of the ground object.
In a possible implementation manner, the generating the stereoscopic mesh map of the ground object according to the mapping relationship between the map scaling level a and the mesh subdivision level b and the beidou mesh code corresponding to the mesh vector data of the ground object includes:
acquiring a current visible geographic area coordinate and a current map scaling level a;
inquiring the ground object to be displayed in the geographic area, and inquiring the current mesh division level b corresponding to the current map scaling level a according to the mapping relation between the map scaling level a and the mesh division 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 object according to the Beidou grid code corresponding to the grid vector data of the ground object.
In one possible implementation, the grid vector data of the ground object includes contour data of the ground object, height information, and a split ground object contour polygon.
In one possible implementation, the map scaling level a is used to determine a displayable geographic area range size;
and the meshing level b is used for determining the number of the three-dimensional meshing diagrams of the ground feature.
According to the stereoscopic grid map generation method based on the LOD technology, grid vector data of ground objects are obtained, beidou grid coding is conducted on the grid vector data, and the Beidou grid coding is stored in a memory; determining the maximum grid number N which can be drawn, and making a mapping relation between a map scaling 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 zoom level a and the mesh subdivision level b into a memory; and drawing a stereoscopic grid map of the ground object according to the mapping relation 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 ground object. The 3D three-dimensional grid model of the ground object can be constructed and displayed efficiently by designing a proper drawing and displaying method under the condition of given hardware configuration, so that the 3D three-dimensional grid data diagram 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 disclosure will be described in detail below with reference to the drawings. In the drawings, like reference numbers indicate identical or functionally similar elements. Although various aspects of the embodiments are illustrated in the accompanying drawings, the drawings are not necessarily drawn to scale unless specifically indicated.
The word "exemplary" is used 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.
In addition, numerous specific details are set forth in the following detailed description 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 well known to those skilled in the art have not been described in detail in order not to obscure the present disclosure.
The method disclosed by the disclosure is used for solving the performance problem in the process of drawing a large number of ground feature (building) three-dimensional grid diagrams, and comprises two methods:
if the related service data is generated after the 3D stereoscopic grid map of the ground object is generated, the drawing grid patterns (line width, color, transparency and the like) are required to be changed in real time according to the related service data, a drawing method based on grid vector data is adopted, proper drawing constraint limitation is used according to the current detail requirement, and a drawing interface is directly used for carrying out real-time drawing, so that the grid patterns can be modified in real time. In the drawing process, drawing constraint is carried out by adopting a pre-established LOD rule, so that the rendering of unnecessary details is reduced, and the real-time drawing performance is improved. The basic idea is to acquire grid vector data (including ground contour grid codes, building heights and the like) of ground objects from the rear end, then directly draw grids by using a front-end drawing interface, and correspondingly draw constraints aiming at different detail requirements (LOD rules formulated in advance) in the drawing process so as to improve drawing efficiency.
If the generated 3D three-dimensional grid map of the ground object is not changed in real time in the application of the associated service data, a drawing method based on a 3D (three-dimensional) files format is adopted. The basic idea is to store the three-dimensional grid graph of the ground object drawn in advance into a 3DTiles format, and directly load the 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 LOD technology according to an embodiment of the present disclosure. The method can be applied to the generation of a 3D stereoscopic grid map of the ground object, wherein the ground object can comprise a building, a mountain and the like, and the ground object is taken as the building for the convenience of explanation and understanding of the method. As shown in fig. 3, the method may include:
step S1: and acquiring grid vector data of the ground object, performing Beidou grid coding on the grid vector data, and storing the Beidou grid coding into a memory.
Wherein, the ground feature can be a building, a mountain, etc., and the grid vector data can comprise contour data, height information and a split contour polygon. For example, the contour data, building height and other information of the building are obtained, the contour data and the building height information of the building are stored in a database, the contour polygon of the building is split into a grid set, and the contour polygon of the building is coded as the grid set and stored in the database.
After the grid vector data of the ground object are obtained, the grid vector data can be stored in a background memory through Beidou grid codes, so that a stereoscopic grid map of the ground object can be conveniently drawn through inquiring the Beidou grid codes of the ground object, and the rear end associates service data according to the Beidou grid codes of the ground object.
Step S2: and determining the maximum grid number N which can be drawn, and formulating a mapping relation between a map scaling level a of the LOD technology and the meshing level b according to the maximum grid number N.
Wherein the map zoom level a may be used to determine a displayable geographic area range size; the mesh subdivision hierarchy b may be used to determine the number of stereomesh drawings of the feature.
For example, when a 3D stereoscopic grid map is presented on a map, the efficiency of loading and rendering the 3D stereoscopic grid map depends on the hardware performance of the machine and the number of grids to be rendered.
The maximum number of renderable grids N, N being a positive integer, may be determined based on machine hardware performance. Given a hardware configuration, the number of stereoscopic grids that can be drawn with the maximum smoothness of user interaction is to be ensured (generally can be determined through experiments).
The number of grids to be drawn depends on two factors: a zoom level a and a mesh subdivision level b of the map.
The zoom level a of the map may determine the size of the geographical area that may be displayed, determine the number of buildings that are visible, and ultimately affect the number of 3D stereoscopic meshes displayed. For example, as the zoom level a of the map is smaller, the larger the geographic area range in which the display window is visible, the more buildings are visible, but the smaller and coarser the detail of a single building display. When the zoom level a of the map is larger, the smaller the geographical area range visible by the display window, the fewer buildings are visible, but the larger and fine-detail the single building is displayed.
FIGS. 4 and 5 show schematic diagrams of building perspective grid diagrams when the zoom level is small and when the zoom level is large, respectively, according to an embodiment of the present disclosure; fig. 6 shows a schematic diagram of a single building perspective grid map according to an embodiment of the present disclosure.
The zoom level a of the map, for example, determines the size of the geographical area range that can be displayed and the number of buildings that are visible, ultimately affecting the number of 3D stereoscopic meshes displayed.
As shown in fig. 4, when the map zoom level a is small, the entire building can be seen on the display window, but the building is small and the detail is rough, and the white model of the drawn building is used for display.
As shown in fig. 5, as the lens is zoomed in (the map zoom level a becomes larger), the single building becomes larger gradually, and a stereoscopic mesh map of the building starts to be drawn. The process of drawing the three-dimensional grid map of the building comprises the steps of firstly selecting a proper grid subdivision level b, calculating the grid number of the building to be drawn according to the grid subdivision level b, and similarly, calculating the grid number of all the buildings to be drawn in the whole window range, wherein the grid number of all the buildings to be drawn is smaller than the maximum drawable grid number N. According to this principle, for each map scaling level a, a corresponding mesh division level b can be confirmed, and a stereoscopic mesh map of the map scaling level a can be drawn. At the moment, only the three-dimensional grid lines outside the white mould 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 map of all the buildings is drawn, a certain building is selected to draw all the grids thereof, and the grids in which the service data are associated are marked with different colors.
The mesh dissection hierarchy b may determine the size of a single stereoscopic mesh, thereby determining the number of meshes that actually need to be drawn. For example, the lower the meshing level b, the larger the single stereoscopic mesh, the fewer the number of meshes that a single building needs to draw; the higher the meshing level b, the smaller the individual stereoscopic meshes, the more meshes a single building needs to draw. For drawing a stereoscopic mesh map of a building, one stereoscopic mesh can cover the building if the mesh division level b is too low, and the stereoscopic mesh lines are too densely distinguished from the meshes if the mesh division level b is too high. The mesh division level b is generally selected from the specification of 32 meters of 21 levels to the specification of 1 meter of 26 levels in view of the aesthetic and efficiency of drawing, and the selection of the mesh division level b can be adjusted according to actual service requirements, which is not limited herein.
Step S3: storing the mapping relation between the map zoom level a and the mesh division level b into a memory;
step S4: and drawing a stereoscopic grid map of the ground object according to the mapping relation 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 ground object.
Through step S2, LOD rules can be determined, and the mapping relationship between the corresponding graph scaling level a and mesh division level b can be stored in the background memory.
Fig. 7 shows a further defined flow chart of step S3 according to an embodiment of the present disclosure.
In an example, as shown in fig. 7, step S3 may include:
step S31: acquiring a current visible geographic area coordinate and a current map scaling level a;
step S32: inquiring the ground object to be displayed in the geographic area, and inquiring the current mesh division level b corresponding to the current map scaling level a according to the mapping relation between the map scaling level a and the mesh division 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 object according to the Beidou grid code corresponding to the grid vector data of the ground object.
For example, the front end communicates to the background the current visible geographic area location coordinates and the current map zoom level a. The background inquires out the building to be displayed in the current visible range, determines whether to draw a stereoscopic grid according to the map scaling level a, inquires out the corresponding grid subdivision level b according to the map scaling level a, generates corresponding grid vector data according to the grid subdivision level b, and transmits the grid subdivision level b and Beidou grid codes corresponding to the corresponding grid vector data to the front end. And after the front end receives the vector data of the building and the corresponding Beidou grid codes, starting a drawing engine to draw a three-dimensional grid diagram of the building.
If the related service data of the 3D grid map of the building does not need to be changed in real time after the drawing is completed, the 3D grid map of the building can be drawn and stored, and the 3D grid model data drawn and stored by the method can be directly loaded when the service scene is needed, so that the drawing and loading speeds of the 3D grid model are greatly improved.
According to the stereoscopic grid map generation method based on the LOD technology, grid vector data of ground objects are obtained, beidou grid coding is conducted on the grid vector data, and the Beidou grid coding is stored in a memory; determining the maximum grid number N which can be drawn, and making a mapping relation between a map scaling 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 zoom level a and the mesh subdivision level b into a memory; and drawing a stereoscopic grid map of the ground object according to the mapping relation 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 ground object. The 3D three-dimensional grid model of the ground object can be constructed and displayed efficiently by designing a proper drawing and displaying method under the condition of given hardware configuration, so that the 3D three-dimensional grid data diagram system can smoothly perform interactive operations such as selection, dragging and the like.
However, if the generated 3D stereoscopic grid map of the ground object is not changed in real time in the associated service data application, a drawing method based on the 3DTiles format is adopted.
Fig. 8 shows a tree structure diagram of 3DTiles according to an embodiment of the present disclosure.
The 3DTiles is obtained by adding a hierarchical LOD structure on the basis of the glTF, and is a format specially designed for massive geographic 3D data streaming and massive rendering. As shown in FIG. 8, one tile set in 3DTiles is a tree structure composed of a series of tiles, each tile having the format shown in Table 1. Each tile is organized in a tree structure, incorporating the concept of Hierarchical LOD (HLOD) for the fastest and optimal rendering of stereoscopic spatial grid data. In the tree structure, each tile has a bounding box attribute that can completely enclose the tile and child node data in space.
Format of the form
|
Use of the same
|
Batch 3D model (b 3 dm)
|
Large heterogeneous 3D model comprising three-dimensional building, topography and the like
|
Example 3D model (i 3 dm)
|
Examples of 3D models, e.g. trees, wind turbines, etc
|
Point cloud (pnts)
|
Point cloud
|
Combined data (cmpt)
|
Combining the slices of different formats into one slice |
TABLE 1
Fig. 9 shows a flowchart of a method for generating a stereoscopic mesh map based on LOD technology according to another embodiment of the present disclosure. As shown in fig. 10, the method may further include:
and S5, drawing a three-dimensional grid map of the ground object based on a 3D (three-dimensional) figures drawing method, and storing and loading the three-dimensional grid map of the ground object in a 3D figures format.
Fig. 9 shows a further defined flow chart of step S5 according to an embodiment of the present disclosure.
In an example, as shown in fig. 9, step S5 may include:
step S51: determining a tree structure of the 3DTiles according to the grid vector data of the ground object and the grid subdivision level b;
step S52: calculating the error of each layer LOD of the tree structure of 3DTiles, and generating a JSON file of 3 DTiles;
step S53: calculating a three-dimensional grid map of each node of the 3DTiles tree structure according to the 3DTiles tree structure and grid vector data of the ground object, and obtaining and storing a B3DM file of the three-dimensional grid map of the ground object drawn based on the 3DTiles drawing method;
step S54: reading a JSON file of the 3DTiles to analyze a tree structure of the 3DTiles, loading a B3DM file of a corresponding three-dimensional grid diagram of the ground object according to the current grid subdivision level B, and displaying the three-dimensional grid diagram of the ground object.
Fig. 11 shows a schematic diagram of a building perspective grid generated based on the 3DTiles 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 each three-dimensional grid of each level can be split into 8 three-dimensional grids of the next level. Selecting a proper subdivision level [ b1, b2, b3, & gt, bm ] according to actual service requirements, wherein the subdivision level of a root node (root node) of the 3D tiles tree structure is b1 (minimum subdivision hierarchical level, maximum three-dimensional grid) and comprises three-dimensional grid sets of all buildings; the corresponding subdivision level of the second layer is b2, the building three-dimensional grid set is divided into any subset (the division method is arbitrary, for example, the number of 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 second layer 3DTiles tree structure; the subdivision level corresponding to the third layer is b3, and the building set corresponding to each sub-node of the upper layer is subdivided into a plurality of sub-sets to form the sub-nodes of the 3DTiles tree structure of the third layer; the subdivision level corresponding to the lowest layer of leaf nodes (left nodes) is (the maximum subdivision level number, the grid block is the minimum), and the leaf nodes do not need to be segmented again.
When the JSON file of 3DTiles is generated according to the determined Geometric Error (GE), the geometric error directly affects the LOD effect of the 3 DTiles. In actual rendering, the system calculates SSE (screen space error) for the current tile based on the relative positions of the tile and the camera, and if the SSE is less than the GE of the tile, the tile will be displayed in detail as its sub-tile. Geometric errors of all levels can be determined based on the mesh calculation GE corresponding to the subdivision level of the current tile, and the geometric errors of all levels and the generated 3DTiles tree structure information are packaged to generate a JSON file of the 3 DTiles.
Calculating the space position information of grid vertexes according to grid codes corresponding to the three-dimensional grids, and then carrying out coordinate transformation on the space position information of the grid vertexes, wherein a world coordinate system (XYZ) is used in converting an earth coordinate system (longitude and latitude height) into a B3 DM; and then, calculating triangular surface and normal vector information required by drawing and rendering according to the grid vertexes, and packaging according to the file rule of the B3DM to generate a corresponding B3DM model data file. After a 3DTiles stereoscopic grid diagram is generated, the stereoscopic grid diagram is deployed to the background, the front end analyzes the tree structure by reading the JSON file of the 3DTiles, and a B3DM model with a proper level is loaded according to the current vision for display. As shown in fig. 11, the lower left portion is visually close to where the building's stereoscopic grid is denser (more detail can be seen close to, represented by the smaller stereoscopic grid). The rest is far away and the building's stereoscopic grid is sparse (the detail is seen to be rough far away, represented by the larger grid).
By adopting the drawing method based on the 3DTiles format, the three-dimensional grid drawing of the ground object can be drawn without real-time change in the application of the associated service data in the generated 3D three-dimensional grid drawing of the ground object, and better loading efficiency and interaction response speed can be achieved.
The foregoing description of the embodiments of the present disclosure has been presented for purposes of illustration and description, and is not intended to be exhaustive or limited to the embodiments disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the various embodiments described. The terminology used herein was chosen in order to best explain the principles of the embodiments, the practical application, or the technical improvements in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.