CN117453844A - Map loading method, map loading device, electronic equipment, storage medium and program product - Google Patents

Map loading method, map loading device, electronic equipment, storage medium and program product Download PDF

Info

Publication number
CN117453844A
CN117453844A CN202311478346.8A CN202311478346A CN117453844A CN 117453844 A CN117453844 A CN 117453844A CN 202311478346 A CN202311478346 A CN 202311478346A CN 117453844 A CN117453844 A CN 117453844A
Authority
CN
China
Prior art keywords
level
displayed
detail
data
map
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311478346.8A
Other languages
Chinese (zh)
Inventor
任亚飞
赵剑
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202311478346.8A priority Critical patent/CN117453844A/en
Publication of CN117453844A publication Critical patent/CN117453844A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/29Geographical information databases
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Remote Sensing (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Instructional Devices (AREA)

Abstract

The application discloses a map loading method, a map loading device, electronic equipment, a storage medium and a program product, which can be applied to the field of maps; the method and the device can acquire at least one level of detail to be displayed corresponding to the level of detail to be displayed of the map, and determine a data block to be processed corresponding to the level of detail to be displayed according to the level of detail to be displayed; determining a data block to be rendered by using the style data of the map elements in the data block to be processed, rendering the elements to be rendered by using the cache data of the detail level to be displayed and the style data of the data block to be rendered to obtain rendering data, and finally loading the map of the level to be displayed according to the rendering data of all the detail levels to be displayed. The map of the display level can be obtained through rendering data in at least one detail level to be displayed, hierarchical rendering can be realized, cache data are utilized in rendering, repeated rendering can be avoided, the calculation force for loading the map is reduced, and the map loading performance is improved.

Description

Map loading method, map loading device, electronic equipment, storage medium and program product
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a map loading method, a map loading device, an electronic device, a storage medium, and a program product.
Background
The map is an earth surface map in which various geographical elements are marked with symbols or characters according to a certain proportion and are represented on a plane by using a projection method. The electronic map is a map product which uses computer technology to digitally process the existing map data and presents various geographic information in a digital form.
When the electronic map is loaded, map data can be processed to be converted into a visualized image, however, at present, when the electronic map is loaded, the problem of performance waste exists.
Disclosure of Invention
The embodiment of the application provides a map loading method, a map loading device, electronic equipment, a storage medium and a program product, which can improve the map loading performance.
The embodiment of the application provides a map loading method, which comprises the following steps:
acquiring at least one level of detail to be displayed corresponding to a level to be displayed of a map;
determining a data block to be processed corresponding to the level of detail to be displayed according to the level to be displayed, wherein the data block to be processed comprises a plurality of map elements;
determining an element to be rendered corresponding to the level of detail to be displayed from the plurality of map elements according to the style data corresponding to the map elements;
Rendering the element to be rendered by using the cache data corresponding to the level of detail to be displayed and the style data corresponding to the element to be rendered, so as to obtain rendering data corresponding to the level of detail to be displayed;
and loading the map of the level to be displayed according to the rendering data corresponding to each level of detail to be displayed.
The embodiment of the application also provides a map loading device, which comprises:
the level acquisition unit is used for acquiring at least one level of detail to be displayed corresponding to the level to be displayed of the map;
the data block determining unit is used for determining a data block to be processed corresponding to the level of detail to be displayed according to the level to be displayed, wherein the data block to be processed comprises a plurality of map elements;
the element determining unit is used for determining an element to be rendered corresponding to the level of detail to be displayed from the map elements according to the style data corresponding to the map elements;
the rendering unit is used for rendering the element to be rendered by utilizing the cache data corresponding to the level of detail to be displayed and the style data corresponding to the element to be rendered, so as to obtain rendering data corresponding to the level of detail to be displayed;
and the loading unit is used for loading the map of the level to be displayed according to the rendering data corresponding to each level of detail to be displayed.
In some embodiments, the hierarchy acquisition unit further comprises:
a level group determining subunit, configured to determine a display level group to which the level to be displayed belongs, where the display levels in the display level group share map data of the same data level;
a hierarchy map obtaining subunit, configured to obtain a hierarchy map relationship corresponding to the display level group, where the hierarchy map relationship includes a correspondence relationship between each display level in the display level group and a level of detail;
and the level determining subunit is used for determining at least one level of detail to be displayed corresponding to the level of detail to be displayed from the levels of detail according to the level mapping relation.
In some embodiments, the hierarchy acquisition unit further comprises:
a level group determining subunit, configured to determine a display level group to which the level to be displayed belongs, where the display levels in the display level group share map data of the same data level;
a candidate determining subunit, configured to determine a candidate level of detail according to the display level group;
and the level acquisition subunit is used for determining the level of detail to be displayed from the candidate levels of detail according to the attribute value corresponding to each candidate level of detail and the display level group.
In some embodiments, the acquisition subunit is further to:
determining a highest display level in the display level group as a designated display level;
carrying out shift processing on a preset value according to the appointed display level and the level to be displayed to obtain a shift result;
determining an operation result corresponding to each candidate detail level by using the shift result and the attribute value corresponding to each candidate detail level;
and determining the candidate detail level of which the operation result meets the preset condition as the detail level to be displayed.
In some embodiments, the level group determination subunit is further to:
determining a data level to be displayed corresponding to the level to be displayed based on a level mapping relation between the display level and the data level, wherein the display level comprises the level to be displayed;
and determining at least one display level corresponding to the data level to be displayed as a display level group in which the data level to be displayed is located.
In some embodiments, the data block determination unit further comprises:
the data level acquisition subunit is used for acquiring the data level to be displayed corresponding to the level to be displayed;
a size obtaining subunit, configured to obtain size data corresponding to each map data block in the data level to be displayed;
The view acquisition subunit is used for mapping the view data of the display area into the map data to obtain the view data to be processed;
an index calculation subunit, configured to calculate a to-be-processed index corresponding to the to-be-displayed level of detail by using the to-be-processed view data and the size data of the map data block;
and the data block acquisition subunit is used for acquiring the data block to be processed corresponding to the detail level to be displayed by utilizing the index to be processed.
In some embodiments, the data block acquisition subunit is further configured to:
inquiring the index to be processed in a map cache;
if the index to be processed is queried in the map cache, acquiring a data block to be processed corresponding to the index to be processed from the map cache;
and if the index to be processed is not queried in the map cache, acquiring compressed map data corresponding to the index to be processed from a designated file, and analyzing and processing the compressed map data to obtain a data block to be processed.
In some embodiments, the element determination unit further comprises:
a style acquisition subunit, configured to acquire style data corresponding to the map element and an effective level corresponding to the style data;
The validation determining subunit is used for determining an initial validation level of the style data according to the validation level of the style data and the level to be displayed aiming at the style data corresponding to each map element;
the matching subunit is used for matching the initial effective level of the style data with the initial effective level of the detail level to be displayed to obtain style data matched with the detail level to be displayed;
and the element determining subunit is used for determining the map element corresponding to the style data with the matched detail level to be displayed as the element to be rendered corresponding to the detail level to be displayed.
In some embodiments, the rendering unit further comprises:
the model obtaining subunit is used for obtaining an element model corresponding to the element to be rendered according to the cache data corresponding to the detail level to be displayed;
and the rendering subunit is used for rendering the element model corresponding to each element to be rendered by using the style data corresponding to the element to be rendered to obtain rendering data corresponding to the detail level to be displayed.
In some embodiments, the model acquisition subunit is further to:
obtaining cache data corresponding to the detail level to be displayed, wherein the cache data comprises element models corresponding to loaded elements in the detail level to be displayed;
If the element to be rendered is queried in the loaded elements, acquiring an element model corresponding to the element to be rendered from the cache data;
and if the element to be rendered is not queried in the loaded elements, modeling the element to be rendered to obtain an element model corresponding to the element to be rendered.
In some embodiments, the element model includes a plurality of grids, the rendering subunit further configured to:
determining the style attribute of each grid in the element model by utilizing style data corresponding to each element to be rendered according to the element model corresponding to each element to be rendered, so as to obtain grids carrying the style attribute;
and rendering each grid carrying the style attribute to obtain rendering data corresponding to the detail level to be displayed.
The embodiment of the application also provides electronic equipment, which comprises a memory, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to perform steps in any of the map loading methods provided by the embodiments of the present application.
Embodiments of the present application also provide a computer readable storage medium storing a plurality of instructions adapted to be loaded by a processor to perform steps in any of the map loading methods provided by the embodiments of the present application.
Embodiments of the present application also provide a computer program product comprising computer programs/instructions which, when executed by a processor, implement steps in any of the map loading methods provided by the embodiments of the present application.
According to the embodiment of the application, at least one detail level to be displayed of the map can be determined, the data block to be processed corresponding to the detail level to be displayed is determined according to the display level, wherein the data block to be processed comprises a plurality of map elements, the data block to be rendered corresponding to the detail level to be displayed is determined from the map elements by means of style data corresponding to the map elements, the cache data of the detail level to be displayed are utilized, the style of the data block to be rendered is processed, the data block to be rendered is rendered, so that rendering data corresponding to each detail level to be displayed are obtained, and the map of the level to be displayed is loaded based on the rendering data corresponding to each detail level to be displayed. The map with one display level can be obtained through rendering data in at least one detail level to be displayed, hierarchical rendering can be realized, and in rendering, cache data of the detail level to be displayed can be utilized, so that repeated rendering can be avoided, the calculation force for loading the map is reduced, and the map loading performance is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly introduced below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1a is an application scenario schematic diagram of a map loading method provided in an embodiment of the present application;
fig. 1b is a schematic flow chart of a map loading method according to an embodiment of the present application;
FIG. 1c is a schematic illustration of a map at different display levels provided by an embodiment of the present application;
FIG. 1d is a schematic diagram of a tile map provided by an embodiment of the present application;
FIG. 1e is a schematic diagram of a level mapping relationship provided in an embodiment of the present application;
FIG. 1f is a schematic diagram of a hierarchical mapping relationship provided in an embodiment of the present application;
FIG. 1g is a schematic diagram illustrating the division of display levels provided in embodiments of the present application;
FIG. 1h is a schematic diagram of calculating a pending index according to an embodiment of the present application;
FIG. 2a is a flowchart of a map loading method according to another embodiment of the present disclosure;
Fig. 2b is a schematic diagram of an overall framework of a map loading method according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a map loading device according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
The embodiment of the application provides a map loading method, a map loading device, electronic equipment, a storage medium and a program product.
The map loading device can be integrated in an electronic device, and the electronic device can be a terminal, a server and other devices. The terminal can be a mobile phone, a tablet personal computer, an intelligent Bluetooth device, a notebook computer or a personal computer (Personal Computer, PC), an intelligent voice interaction device, an intelligent household appliance, a vehicle-mounted terminal, an aircraft and other devices; the server may be a single server or a server cluster composed of a plurality of servers.
In some embodiments, the map loading device may also be integrated in a plurality of electronic devices, for example, the map loading device may be integrated in a plurality of servers, and the map loading method of the present application is implemented by the plurality of servers.
In some embodiments, the server may also be implemented in the form of a terminal.
For example, referring to fig. 1a, there is shown a schematic view of an application scenario of a map loading method, in which a terminal 101 and a database 102 may be included.
The database 102 may store map data, and the terminal 101 may view an electronic map through an application program or a web page. The terminal 101 may acquire map data from the database 102 in advance and store it in the terminal 101 for map loading.
The user can view the map on the terminal 101 according to actual use requirements, and appoint the level to be displayed, the terminal 101 obtains the level to be displayed, and then the terminal 101 can obtain at least one level of detail to be displayed corresponding to the level to be displayed; determining a data block to be processed corresponding to a level of detail to be displayed according to the level to be displayed, wherein the data block to be processed comprises a plurality of map elements; determining elements to be rendered corresponding to the display detail level from a plurality of map elements according to style data corresponding to the map elements; rendering the element to be rendered by using the cache data corresponding to the level of detail to be displayed and the style data corresponding to the element to be rendered, so as to obtain rendering data corresponding to the level of detail to be displayed; and finally, loading the map of the level to be displayed according to the rendering data corresponding to each level of detail to be displayed.
The following will describe in detail. The order of the following examples is not limited to the preferred order of the examples. It will be appreciated that in the specific embodiments of the present application, where user-related data is involved, such as user-specified levels to be displayed, when the above embodiments of the present application are applied to specific products or technologies, user approval or consent is required, and the collection, use and processing of the related data is required to comply with relevant laws and regulations and standards of the relevant country and region. For example, when the user uses the electronic map for the first time, the data collection notification may be displayed through the terminal, and after detecting the confirmation operation of the user on the data collection notification, the designated level to be displayed is acquired.
In this embodiment, a map loading method is provided, as shown in fig. 1b, and the specific flow of the map loading method may be as follows:
110. and acquiring at least one level of detail to be displayed corresponding to the level to be displayed of the map.
The to-be-displayed level refers to a display level of the map to be displayed on the terminal, wherein the display level refers to the display degree of the map under different zoom levels. In general, lower display levels represent a large-scale presentation of the entire map area, while higher display levels represent more detailed, magnified map areas.
For example, referring to FIG. 1c, a schematic diagram of a map at different display levels is shown. The gray area in fig. 1c represents the view range of the screen, each grid represents one map data block, and when the display level is 18, the contents in 4 map data blocks can be displayed, when the display level is 19, the contents in two map data blocks can be displayed, and when the display level is 18, only the contents of one map data block can be displayed, and as the display level increases, the displayed geographic area becomes smaller.
The level to be displayed can be obtained by detecting a specific event. For example, the specific event may include a zoom event corresponding to a zoom operation, a pan event corresponding to a pan operation, and the like, and after the specific event is detected, a handler corresponding to the specific event may be called to obtain the level to be displayed.
A level of detail (LOD) refers to a technique used in map rendering to represent different levels of detail of a scene, by using different levels of detail at different levels of detail, to accommodate different levels of display of the map. For example, the higher the level of display, the higher the level of detail, the more detailed the map is presented, the lower the level of display, the lower the level of detail, and the less detail the map is presented.
A map of a high level of detail may be implemented by further adding refined map elements on the basis of a low level of detail. For example, in a map of a low level of detail, a road is only displayed as a line, lanes and the like within the road cannot be viewed, and in a map of a high level of detail, the line may be widened and lanes may be added thereto, so that the display of the lanes is finer. Then a map element of a plurality of different levels of detail may be included in a map of a level to be displayed, whereby the level to be displayed may correspond to at least one level of detail to be displayed.
As an implementation manner, when at least one level of detail to be displayed corresponding to a level to be displayed is obtained, a display level group to which the level to be displayed belongs may be determined, and the display levels in the display level group share map data of the same data level; acquiring a hierarchy mapping relation corresponding to the display level group, wherein the hierarchy mapping relation comprises a corresponding relation between each display level in the display level group and a detail level; and determining at least one detail level to be displayed corresponding to the level to be displayed from the detail levels according to the level mapping relation.
The display level group refers to a level group to which a level to be displayed belongs, the level group is a result obtained by grouping a plurality of display levels of a map in advance, the maximum number of display levels contained in each level group is a preset number, and the preset number can be adjusted according to actual needs, for example, the preset number can be 3 or 5, and in the embodiment of the present application, the following description is performed only by taking the preset number as 3 as an example. When the preset number is 3, it indicates that at most 3 display levels can be included in one level group.
Wherein, the display levels in the same level group share the map data of the same data level, and the display levels in the display level group also share the map data of the same data level.
The data level refers to the level that map data has, which is typically organized in the form of a tile map, which refers to the division of the entire map area into a number of map data blocks, each map data block being a tile, each tile representing map data within a certain geographical area. The tiles may be grid tiles, that is, each tile is a picture, and may also be vector tiles, that is, each tile is vector data formed by points, lines and planes, where a specific tile is a grid tile or a vector tile may be set according to actual needs, and is not limited herein specifically.
Tile maps typically use a pyramid structure to store and organize map data, for example, referring to fig. 1d, a schematic diagram of a tile map is shown. In fig. 1d, the map data is divided into a plurality of tiles, one tile is one map data block, and a plurality of layers are formed according to different zoom levels, one layer is one data level. Each data level contains a set of tiles, where the top-most tile in the pyramid represents the largest extent of the map, while the next level of tiles represents more detailed map detail, and the extent of the map represented by the tiles in each data level is the same.
In some embodiments, when the display levels are divided into the level groups, the same grouping identifier may be set for the display levels in the same level group, and then each display level corresponds to one grouping identifier. When determining the display level group to which the to-be-displayed level belongs, acquiring a group identifier corresponding to the to-be-displayed level as the to-be-displayed group identifier, and then determining the display level with the to-be-displayed group identifier as the display level group to which the to-be-displayed level belongs. For example, there are display levels 3-20, where display levels 18-20 each have a group identification 1 and display levels 3-5 each have a group identification 2, and if the level to be displayed is 19, the group identification may be determined to be the group identification 1, so that 18-19 are the display level groups to which the level to be displayed belongs.
In some embodiments, since the display levels in the same display level group share map data of the same data level, the data level to be displayed corresponding to the level to be displayed may be acquired, and the display level of the map data using the data level to be displayed is determined as the display level group. For example, the data level to be displayed corresponding to the level to be displayed may be determined based on a level mapping relation between the display level and the data level, where the display level includes the level to be displayed; and determining at least one display level corresponding to the data level to be displayed as a display level group in which the data level to be displayed is located.
The level mapping relation can be preset according to actual needs, if the display levels of the map are divided into 18 levels in total, and when the preset number is 3 from 3 to 20, at most 3 display levels correspond to one data level. For example, referring to FIG. 1e, a schematic diagram of a level mapping relationship is shown. In fig. 1e, if the level to be displayed is 19, the corresponding data level is 15, and the display levels 18, 19, 20 are the display level groups in which the level to be displayed is located, among the display levels of the data level 15, including the display levels 18, 19, 20.
After the display level group is acquired, a hierarchical mapping relationship between each display level and a level of detail in the display level group may be acquired. Optionally, the hierarchical mapping relationship may be stored in correspondence with the identifier of the level group, and after determining the display level group, the identifier of the display level group may be used to find the hierarchical mapping relationship corresponding to the display level group.
The hierarchical mapping relationship includes a correspondence relationship between each display level in the level group to be displayed and a level of detail, for example, refer to fig. 1f, which shows a schematic diagram of the hierarchical mapping relationship. The to-be-displayed level group includes display levels 18-20, and as can be seen from fig. 1f, when the display level is 18, the corresponding level of detail is LOD0; when the display level is 19, the corresponding detail levels are LOD0 and LOD1; when the display level is 20, the corresponding detail levels are LOD0, LOD1 and LOD2. Wherein the content of one level of detail is handled by one manager, namely level instance in fig. 1e, the content of visible LOD0 is handled by level instance0, the content of LOD1 is handled by level instance1, and the content of LOD2 is handled by level instance 2.
If the level to be displayed is 19, at least one level of detail to be displayed corresponding to the level to be displayed can be determined to be LOD0 and LOD1 through the hierarchical mapping relation, and used managers are level instance0 and level instance1.
In some embodiments, when at least one level of detail to be displayed corresponding to the level to be displayed is obtained, a display level group to which the level to be displayed belongs may be determined, where the display levels in the display level group share map data of the same data level; determining candidate detail levels according to the display level group; and determining the detail level to be displayed from the candidate detail levels according to the attribute value corresponding to each candidate detail level and the display level group.
The display level group to which the level to be displayed belongs is the same as the above determination method, and reference may be made to the corresponding content described above, which is not described herein.
The candidate levels of detail may be obtained according to the display level group, where the number of candidate levels of detail may be consistent with the number of display levels in the display level group, for example, if there are 3 display levels in the display level group, there are 3 candidate levels of detail, and the levels of the three candidate levels of detail sequentially increase, for example, may be LOD0, LOD1, LOD2. If there are 4 candidate levels of detail, LOD0, LOD1, LOD2, and LOD3.
After determining the candidate levels of detail, an attribute value corresponding to each candidate level of detail may be obtained, where the attribute value may be used to represent a display level in the display level group at which the candidate level of detail is effective, e.g., the 3 display levels described above, if the candidate level of detail is effective at display levels 18-20, the attribute value may be binary 111, converted to decimal 7, each bit of binary may represent a display level, and, further, if the candidate level of detail is effective at display levels 19-20, the attribute value may be binary 011, converted to decimal 3. The attribute value corresponding to the candidate level of detail may be set according to actual needs, which is not specifically limited herein.
For example, referring to table 1, a correspondence table between candidate levels of detail and attribute values is shown, where the correspondence table may be preset according to actual needs, and when needed, the attribute value corresponding to each candidate level of detail may be obtained by querying the correspondence table.
TABLE 1
Candidate level of detail LOD0 LOD1 LOD2
LevelInstance 0 1 2
Display level [18,20] [19,20] [20]
Attribute value 7 3 1
According to the attribute value corresponding to each candidate level of detail and the display level group, the level of detail to be displayed can be determined from the candidate levels of detail. As an embodiment, the level of detail to be displayed may be determined from the candidate levels of detail by a preset calculation formula, for example, the highest display level in the display level group may be determined as the designated display level; carrying out shift processing on a preset value according to the appointed display level and the level to be displayed to obtain a shift result; determining an operation result corresponding to the candidate detail level by using the shift result and the attribute value corresponding to the candidate detail level; and determining the candidate detail level of which the operation result meets the preset condition as the detail level to be displayed.
The display level group includes a plurality of display levels, and the highest display level can be determined from the display levels, for example, the display level group includes 18, 19, and 20, and then 20 is the highest display level, and the highest display level is determined as the designated display level for subsequent calculation.
The preset value may be a value set according to actual needs, and in this embodiment of the present application, the preset value may be 1. When the specified display level and the level to be displayed are utilized to determine the shift result, the difference between the specified display level and the level to be displayed can be calculated to obtain the shift digit; and shifting the preset value leftwards by the shifting bit number to obtain a shifting result. For example, a display level of 20 is designated, a level to be displayed of 19 is set to 1, if the preset value is set to 1, 1 needs to be shifted left by 1 bit, 1 is represented as 0001 in binary, and the shift result is 0010.
Then, the shift result and the attribute value corresponding to each candidate level of detail can be bitwise and operated to obtain an operation result corresponding to each candidate level of detail. For example, the attribute value of candidate level of detail LOD0 is 7, the attribute value of candidate level of detail LOD1 is 3, and the attribute value of candidate level of detail LOD2 is 1. The result of the operation of the candidate level of detail LOD0 is 0010& 0111=0010; the result of the operation of the candidate level of detail LOD1 is 0010& 0011=0010; the result of the operation of the candidate level of detail LOD2 is 0010& 0001=0001.
When the operation result is not 0, it may be considered that the operation result meets a preset condition, and according to the foregoing calculation, it may be known that the operation result of the candidate detail levels LOD0 and LOD1 is not 0, and when the level to be displayed is 19, the determined at least one detail level to be displayed is LOD0 and LOD1. Specifically, the above calculation process can be expressed by the following formula:
Hit=(1<<(MaxLevel–currentLevel))&LOD.layerMask;
Wherein Hit represents an operation result; maxLevel denotes a specified display level; currentLevel represents the level to be displayed; lod.
According to the method, at least one detail level to be displayed corresponding to the level to be displayed can be determined, and the fact that the content in the detail level to be displayed needs to be loaded simultaneously is indicated for displaying the map data under the level to be displayed.
120. And determining the data block to be processed corresponding to the detail level to be displayed according to the level to be displayed.
The to-be-processed data block refers to a map data block in a tile map to be used when the map of the to-be-displayed level is displayed, and as described above, one tile in the tile map is a map data block, and the map data block to be used for each level of detail to be displayed needs to be determined, so as to obtain the to-be-processed data block.
It will be appreciated that when displaying a map on a terminal, it is generally not possible to display all map data in one data level, i.e. when displaying a map on a terminal, only a part of the map data blocks in a certain data level may be used, subject to the limitation of the display area of the terminal. Similarly, in order to load a map of a level to be displayed on a terminal, it is necessary to calculate a map data block used when the map is loaded in a display area of the terminal.
As described above, if the map of the level to be displayed needs to be displayed, at least one content of the level of detail to be displayed needs to be displayed, and each level of detail to be displayed needs to determine the corresponding data block to be processed.
As an implementation manner, when determining the to-be-processed data block corresponding to each level of detail to be displayed according to the level to be displayed, the to-be-displayed data level corresponding to the level to be displayed may be obtained; acquiring size data corresponding to each map data block in the data level to be displayed; mapping the view field data of the display area into the map data to obtain view field data to be processed; calculating a to-be-processed index by using the to-be-processed view data and the size data of the map data block; and acquiring the data block to be processed corresponding to the detail level to be displayed by using the index to be processed.
The data level to be displayed refers to a level corresponding to map data used when loading the map of the level to be displayed, and a mapping relationship between the display level and the data level, namely, a level mapping relationship can be established in advance so as to determine the level of the data to be displayed directly based on the level mapping relationship.
In the tile map shown in fig. 1d, the size of each map data block is the same, so that the size data corresponding to each map data block can be directly obtained, and if the map data block is generally rectangular, the length and width of any map data block can be obtained as the size data corresponding to the map data block. If the sizes of the map data blocks in each data level are the same in the tile map, and the sizes of the map data blocks in different data levels are different, the length and the width of the map data blocks in the data level to be displayed can be obtained according to the data level to be displayed, so that the size data of the map data blocks can be obtained.
In a tile map, each map data block has its unique identity, which in some embodiments may be determined by the data level of the map data block in the pyramid, and the coordinates in that data level. In other embodiments, the unique identification of the map data block may be an identification assigned to each tile according to a preset encoding rule. In the embodiment of the present application, the unique identification of the map data block in each data level may be determined by the coordinates of the map data block.
The display area refers to an area for displaying a map on the terminal, and the display area may be an area of the whole display screen or a partial area in the display screen. The field-of-view data of the display area refers to a field-of-view range of the virtual camera, which can be used to simulate a viewing angle in the map data, and by adjusting parameters of the virtual camera, such as a position, an orientation, etc., of the virtual camera, different map effects can be presented in the display area.
For example, the virtual camera may capture map data in a look-down manner, and as the distance of the virtual camera from the tile map changes, a map of different display levels may be presented. For another example, the virtual camera may capture map data from a sideways perspective, and as the distance between the virtual camera and the tile data changes, maps of different display levels may be presented, with the closer the map data to the virtual camera, the finer the presentation.
That is, the display level may be divided based on the distance between the virtual camera and the map data, and the angle of the virtual camera may be a top view angle, a side view angle, or the like. For example, referring to FIG. 1g, a schematic diagram of the division of display levels is shown. In fig. 1g, the virtual camera is divided into display levels in a side view, and the displayed content is different in fineness, that is, LOD, among the different display levels. In fig. 1g, the dashed line characterizes the field of view of the virtual camera, which may be at the position of the O-point, in such a way that different LOD displays may be made, depending on the distance from the virtual camera, divided into different display levels.
In the embodiment of the application, the map loading of the virtual camera in a top view is only taken as an example for explanation. The visual field data of the display area can be obtained through calculation through the size of the display area, the transformation relation among the coordinate systems and the projection mode, then the visual field data of the display area is mapped into the map data, namely, the visual field data is transformed into the coordinate system where the map data is located, and the visual field data to be processed can be obtained.
The field of view data to be processed may refer to size data of a rectangular area, for example, in the embodiment of the present application, the field of view data to be processed may refer to coordinates of an upper left corner and coordinates of a lower right corner of a camera field of view in a coordinate system where map data is located. The index to be processed may be calculated from the field of view data to be processed and the size data of the map data block. The index to be processed may be represented by a row number and a column number of a map data block, and referring to fig. 1h, a schematic diagram of calculating the index to be processed is shown. In fig. 1h, the rows are in the x-axis direction and the columns are in the y-axis direction, and there are 4 rows and 4 columns.
When calculating the index to be processed, the minimum line number and the minimum column number may be obtained by dividing the upper left corner coordinate by the size of the map data block, for example, the coordinates of the point a are (x 1, y 1), the map data block is square, the size is L, x1/L is the minimum line number, and y1/L is the minimum column number. The maximum line number and the maximum column number can be calculated by dividing the lower right corner coordinates by the map data block size, for example, the coordinates of the B point are (x 2, y 2), then x2/L is the maximum line number and y2/L is the maximum column number. For example, in fig. 1g, the indices to be processed may be determined to be (2, 2), (2, 3), (2, 4), (3, 2), (3, 3), (3, 4), where (2, 2) represents the map data block of row 2 and column 2, and the meaning of the other indices is similar.
It should be noted that, in some embodiments, the index to be processed may also be obtained by encoding the row number and the column number, and then the row number and the column number may be encoded according to a corresponding encoding rule, so as to obtain the index to be processed, where a specific encoding rule may be set according to an actual requirement, and the specific encoding rule is not limited herein. For example, the shifting process may be performed on both the row number and the column number, so as to obtain a shifted row number and a shifted column number; and performing bit-wise OR operation on the shifted row number and the shifted column number to obtain the index to be processed.
The foregoing line numbers and column numbers are in decimal form, and can be converted into binary line numbers and binary column numbers, for example, 2 can be represented as 10,3 and binary is 11, and then the binary line numbers and the binary column numbers can be subjected to shift processing, respectively. For example, shifting 16 bits to the left results in a shifted row number and a shifted column number. A bitwise or operation means that if two binary numbers have the same value on some of them, then the result on these bits is also the same, e.g., 0010 and 0011 are bitwise or operation, then the result is 0011. Thus, by bitwise OR operation, the row number and column number may be encoded as the index to be processed.
It should be noted that, since the field of view data to be processed and the level to be displayed will not change along with the change of the level of detail to be displayed, the index to be processed corresponding to each level of detail to be displayed is the same, and can be calculated by one manager of the level of detail to be displayed and then shared with other managers.
In some embodiments, each manager of the level of detail to be displayed may calculate a pending index and send it to other managers at random for verification, and if all the pending indexes calculated by the managers are the same, the verification may be considered to pass, so as to ensure the accuracy of map loading.
For example, in the foregoing example, the level instance0 and the level instance1 work, the level instance0 sends its calculated pending index 0 to the level instance1, and the level instance1 sends its calculated pending index 1 to the level instance0. The level instance0 may compare the pending index 1 with the pending index 0 calculated by itself, and if the comparison is consistent, send a confirmation signal to other managers, and similar level instance1 may perform the same operation. After each manager receives the acknowledgement signal sent by the other manager, the index calculation can be considered to be correct, and the subsequent steps are continued.
After the to-be-processed index corresponding to each level of detail to be displayed is obtained, the original to-be-processed data block can be queried by utilizing the to-be-processed index. As an implementation manner, a map buffer may be preset, in which used map data blocks may be stored, and in order to quickly obtain the data blocks to be processed, the data blocks to be processed may be preferentially obtained from the map buffer, so when the data blocks to be processed are obtained according to the index to be processed, the index to be processed may be queried in the map buffer; if the index to be processed is queried in the map cache, acquiring a data block to be processed corresponding to the index to be processed from the map cache; and if the index to be processed is not queried in the map cache, acquiring compressed map data corresponding to the index to be processed from a designated file, and analyzing and processing the compressed map data to obtain a data block to be processed.
It should be noted that, the map data is first stored in the hard disk of the terminal, and the data in the hard disk is compressed data, and when in use, analysis processing is needed, and the map data after analysis processing can be loaded into the memory for loading the map. The data in the map cache is the map data after analysis processing, and can be directly used without analysis again, so that if the data block to be processed is directly obtained from the map cache, the analysis time can be saved, and the map loading efficiency can be accelerated.
In some embodiments, the map data stored in the map cache is a map data block used in a history period, which may be set according to actual needs, for example, 1 hour, 24 hours, or the like before the current time.
When the index to be processed is obtained, the index to be processed can be queried in the map cache, and if the index to be processed is queried in the map cache, the index to be processed indicates that the corresponding data block to be processed can be directly obtained from the map cache. If the index to be processed cannot be queried in the map cache, compressed map data corresponding to the index to be processed data is required to be acquired from the designated file, and then the compressed map data is analyzed to obtain the data block to be processed.
For example, the compressed map data may be decompressed to obtain decompressed map data, and format analysis may be performed on the decompressed map data to convert the decompressed map data into a format that can be processed, so as to obtain a data block to be processed, where the data block to be processed may include a plurality of map elements, for example, a road, a lake, a river, and the like.
130. And determining the element to be rendered corresponding to the level of detail to be displayed from the map elements according to the style data corresponding to the map elements.
After the data block to be processed corresponding to each level of detail to be displayed is obtained, a plurality of map elements contained in the data block to be processed can be obtained. The style data refers to data for describing visual properties of map elements, wherein the visual properties may include information of colors, line widths, filling effects, symbol icons, etc. of the map elements to enable visualization of the map.
In some embodiments, because of the plurality of map elements included in the data block to be processed, map elements using the same style data may be used as an element group, and a style identification may be set for the element group to indicate style data characterized by each map element in the element group using the same style identification.
Therefore, the style identification corresponding to the element group can be obtained through obtaining the element group in which the map element is located, and the style data corresponding to each map element can be obtained through utilizing the style identification.
Since the visual properties of map elements are different in different levels of detail, even the style data used is different. For example, for a map element such as a road, the road is shown as a line when the level of detail is LOD0, and a map element such as a lane line needs to be added to the road shown by LOD0 when the level of detail is LOD 1.
Therefore, by analyzing the style data corresponding to the map elements, the map elements which are required to be responsible in the detail level to be displayed, namely the elements to be rendered, can be determined from the map elements. As in the previous example, the map elements may include roads and lane lines, LOD0 needs to be responsible for roads, and LOD1 needs to be responsible for lane lines.
In some embodiments, when determining an element to be rendered corresponding to a level of detail to be displayed according to style data of a map element, style data corresponding to the map element and an effective level corresponding to the style data may be obtained; determining an initial validation level of the style data according to the validation level of the style data and the level group to be displayed aiming at the style data corresponding to each map element; matching the initial effective level of the style data with the initial effective level of the detail level to be displayed to obtain style data matched with the detail level to be displayed; and determining map elements corresponding to the style data with the matched detail levels to be displayed as elements to be rendered corresponding to the detail levels to be displayed.
It should be noted that, when determining the level of detail to be displayed, the level of detail to be displayed is used, that is, the level of detail to be displayed is related to the level of detail to be displayed, in order to determine the association relationship between the style data and the level of detail to be displayed, the relationship between the style data of the map element and the level of detail to be displayed needs to be obtained first.
As an embodiment, after style data of the map element is acquired, the validation level corresponding to each style data may be continuously acquired. The corresponding relation between the preset style data and the effective display level may be preset, where the preset style data may be all style data required for loading the map, and the preset style data may include style data corresponding to the map element acquired at this time. The effective display level refers to the display level corresponding to the style data when the style data is effective, so that the effective display level corresponding to the style data can be directly determined to be an efficiency level through the mapping relation.
The initial validation level of the style data refers to the minimum validation level of the style data in the display level group, after the validation level corresponding to the style data is obtained, the intersection of the validation level of the style data and the display level group can be calculated, and then the minimum validation level is determined from the intersection, so that the initial validation level of the style data is obtained. For example, display level group is 18-20, and style 1 validation level is 17-20, and style 2 validation level is 19-20, then style 1 intersection is 18-20, with minimum validation level 18, then style 1 initial validation level is 18; the intersection of pattern 2 is 19-20, with a minimum validation level of 19, and the initial validation level of pattern 2 is 19.
The initial validation level of the level of detail to be displayed refers to the minimum display level corresponding to the level of detail to be displayed, for example, as can be seen from fig. 1f, the initial validation level of LOD0 is 18 if the display level corresponding to the level of detail LOD0 is 18, the initial validation level of LOD1 is 19-20 if the display level corresponding to the level of detail LOD1 is 19.
And then, matching the initial effective level corresponding to the style data with the initial effective level of the detail level to be displayed, and when the initial effective level and the initial effective level are consistent, considering that the style data is matched with the detail level to be displayed. For example, if LOD0 has a start validation level of 18, LOD1 has a start validation level of 19, pattern 1 has a start validation level of 18, pattern 2 has a start validation level of 19, then LOD0 matches pattern 1 and LOD1 matches pattern 2.
And then determining map elements corresponding to the style data with matched detail levels to be displayed as elements to be rendered corresponding to the detail levels to be displayed. For example, if style 1 corresponds to map element 1 and style 2 corresponds to map element 2, then map element 1 is the element to be rendered corresponding to LOD0 and map element 2 is the element to be rendered corresponding to LOD 1.
Therefore, the style data of each map element can be utilized to determine the element to be rendered which needs to be processed for the detail level to be displayed from a plurality of map elements in the map data block.
140. And rendering the element to be rendered by using the cache data corresponding to the level of detail to be displayed and the style data corresponding to the element to be rendered, so as to obtain the rendering data corresponding to the level of detail to be displayed.
One manager may be responsible for data of one level of detail to be displayed, for example, when the level to be displayed is 19, there are 2 levels of detail to be displayed, and two managers are respectively responsible for processing data in one level of detail to be displayed. The buffer data corresponding to the detail level to be displayed refers to buffer data of a corresponding manager, the buffer data can comprise processed data in the detail level to be displayed, and data required for rendering the element to be rendered can be obtained from the buffer data of the detail level to be displayed, so that repeated processing is avoided.
When rendering an element to be rendered, the element to be rendered typically needs to be converted into a grid model to obtain an element model. The grid model may be composed of a plurality of triangular grids, quadrilateral grids and the like, and may be set according to actual needs. After the element model is obtained, rendering can be performed in combination with the element model and style data. In some embodiments, when the rendering data corresponding to the level of detail to be displayed is obtained, an element model corresponding to the element to be rendered may be obtained according to the cached data corresponding to the level of detail to be displayed; and rendering the element model corresponding to each element to be rendered by using the style data corresponding to the element to be rendered to obtain rendering data corresponding to the detail level to be displayed.
The data of a detail level to be displayed is processed by a manager, and for the detail level to be displayed, the cache data of the corresponding manager can be directly obtained, and the element model corresponding to the element to be rendered is obtained according to the cache data. The cached data may store data processed in the level of detail to be displayed, for example, an element model of a loaded element, so that the element model of the element to be rendered may be obtained by using the cached data corresponding to the level of detail to be displayed.
For an element model of each element to be rendered, the element model can comprise a plurality of grids, and the style attribute of each grid in the element model can be determined by using style data to obtain grids carrying the style attribute; and rendering the grids carrying the style attributes to obtain rendering data corresponding to the detail level to be displayed.
The style data may include color, line type and line width, filling style, transparency, and the like, and determining the style attribute of the grid refers to setting the style attribute of each grid in the element model, for example, setting the color, transparency, texture, and the like for the grid, so as to obtain the grid carrying the style attribute. And finally, rendering each grid carrying style attributes in the element model by using a graphic rendering engine or a graphic library to obtain the rendering data of the element model, and performing the processing on each element model in the detail level to be displayed to obtain the rendering data corresponding to the detail level to be displayed.
In some embodiments, when obtaining an element model corresponding to an element to be rendered, obtaining cache data corresponding to the level of detail to be displayed, where the cache data includes an element model corresponding to a loaded element in the level of detail to be displayed; if the element to be rendered is queried in the loaded elements, acquiring an element model corresponding to the element to be rendered from the cache data; and if the element to be rendered is not queried in the loaded elements, modeling the element to be rendered to obtain an element model corresponding to the element to be rendered.
The cached data corresponding to the level of detail to be displayed may include an element model corresponding to the loaded element in the level of detail to be displayed. That is, if the content of a certain level of detail to be displayed has been loaded before loading the map of the level to be displayed, the loaded data may be stored in the cache data. Therefore, the element to be rendered can be queried in the cache data, if the element to be rendered exists, the element to be rendered is indicated to be loaded, and the element model of the element to be rendered can be directly obtained from the cache data. If the element to be rendered is not queried in the cache data, the element to be rendered also needs to be modeled again for rendering, and modeling processing can be performed on the element to be rendered so as to obtain an element model corresponding to the element to be rendered.
As one implementation, each map element has an element identifier thereof, the element identifier corresponding to the loaded element in the cache data can become the loaded identifier, when the element to be rendered is queried in the cache data, the element identifier of the element to be rendered can be queried in the loaded identifier, and if the element identifier is found, the element model of the loaded element represented by the loaded identifier is directly obtained.
If the element identification of the element to be rendered is not queried in the loaded identifications, modeling processing is directly carried out on the element to be rendered so as to obtain an element model corresponding to the element to be rendered. For example, the geometric information of the element to be rendered may be obtained, where the geometric information may include vertex coordinates, bounding boxes, texture coordinates, and the like of the element to be rendered, and then, based on the geometric information of the element to be rendered, the mesh division process is performed to generate an element model corresponding to the element to be rendered.
In the foregoing example, if the level to be displayed is 19, at least one corresponding level of detail to be displayed is LOD0 and LOD1, if LOD0 has already been loaded, the model corresponding to the element to be rendered may be directly obtained from the cached data of LOD0, so that no modeling is required in LOD0 again, which can greatly improve the rendering efficiency and ensure the smoothness of map loading.
150. And loading the map under the level to be displayed according to the rendering data corresponding to each level of detail to be displayed.
Since the rendering data of each level of detail to be displayed is acquired, and the data in each level of detail to be displayed needs to be loaded in the map of the level of detail to be displayed, the rendering data corresponding to all levels of detail to be displayed can be directly overlapped, so that the map of the level to be displayed can be loaded.
As an implementation manner, when the rendering data corresponding to each level of detail to be displayed is superimposed, the priority of the level of detail to be displayed may be determined first, where the higher the level of detail to be displayed is, the higher the priority is; and then superposing the rendering data corresponding to the detail level to be displayed according to the priority, namely, the rendering data with high priority covers the rendering data with low priority, so that the map with the level to be displayed is loaded.
The map loading scheme provided by the embodiment of the application can be applied to various map loading scenes. For example, taking map loading on a vehicle-mounted terminal as an example, one display level may correspond to at least one level of detail to be displayed, and when loading a map of a certain display level, data in the loaded level of detail to be displayed may be multiplexed without repeated processing, so as to improve the performance of map loading.
By the method provided by the embodiment of the application, when the map of the level to be displayed is loaded, at least one level of detail to be displayed corresponding to the level to be displayed can be acquired first, and data of each level of detail to be displayed can be processed by a manager. For one level of detail to be displayed, a data block to be processed corresponding to the level of detail to be displayed can be determined, a plurality of map elements can be included in the data block to be processed, then the map elements can be utilized to determine the elements to be rendered responsible for the level of detail to be displayed, the cache data of the level of detail to be displayed and the style data of the elements to be rendered are utilized to render the elements to be rendered so as to obtain rendering data corresponding to each level of detail to be displayed, and then the map of the level to be displayed is loaded based on the rendering data corresponding to each level of detail to be displayed. The map with one display level can be obtained through rendering data of at least one detail level to be displayed, hierarchical rendering can be realized, and in rendering, cache data of the detail level to be displayed can be utilized, so that repeated rendering is avoided, the calculation force for loading the map is reduced, and the map loading performance is improved.
The method described in the above embodiments will be described in further detail below.
In this embodiment, a detailed description will be given of a method of the embodiment of the present application by taking, as an example, map loading during lane-level navigation, where a display level range of a map is 18-20 and a map data block is a tile during lane-level navigation.
As shown in fig. 2a, a specific flow of a map loading method is as follows:
210. and the terminal acquires the to-be-displayed level and the screen area data.
220. And the terminal determines at least one detail level to be displayed by using the level to be displayed, and acquires a tile to be processed corresponding to the detail level to be displayed by using the level to be displayed and screen area data.
230. And the terminal determines the element to be rendered corresponding to the detail level to be displayed by using the style data corresponding to the map element.
240. And the terminal performs rendering treatment on the element to be rendered through the cache data of the detail level to be displayed and the style data of the element to be rendered, so as to obtain rendering data.
250. And the terminal superimposes rendering data corresponding to each level of detail to be displayed and loads the map of the level to be displayed.
The contents of steps 210 to 250 may refer to the corresponding parts of the foregoing embodiments, and in order to describe the traffic data determining method in more detail, refer to fig. 2b, which is a schematic diagram of the overall framework of the map loading method, and will be described in detail with reference to fig. 2 b.
When a user views a map by using the terminal, the terminal can acquire the level to be displayed of the map which the user wants to view, and can acquire data of a display area for displaying the map in the terminal at the same time.
At least one level of detail to be displayed can be determined by using the level of detail to be displayed through the rendering thread, and a manager corresponding to each level of detail to be displayed, namely a level instance, is 19, and a level instance0 and a level instance1 can be obtained.
And then acquiring a tile index to be processed, namely screen task clipping, by utilizing the level to be displayed and the display area data. To avoid render thread blocking, the render thread may send the pending tile index to the modeling thread for asynchronous modeling.
The modeling thread may obtain a corresponding to-be-processed data block according to the to-be-processed tile index, where the to-be-processed tile may include a plurality of map elements, and then determine to-be-rendered elements corresponding to the level of detail to be displayed, that is, to-be-rendered elements required to be processed by each manager, by using style data corresponding to the map elements, which corresponds to the tile content picking in fig. 2 b.
Because each manager has corresponding cache data, whether the element model of the element to be rendered exists or not can be firstly inquired from the cache data, if so, the element model of the element to be rendered is directly obtained from the cache data, and repeated modeling is not needed. If the cache data does not have the element model of the element to be rendered, modeling the element to be rendered to obtain the element model. For example, if the content is changed from the display level 18 to 19, since the content of the 18 levels is already loaded, the manager level 0 corresponding to the 18 levels is originally participating in rendering, and at this time, the element model in the level 0 can be directly obtained.
The modeling thread can send the obtained element model to the rendering thread again, so that the rendering thread can assemble a rendering queue through each manager, real-time rendering of the tiles is performed by using style data corresponding to the elements to be rendered, and finally, a map is displayed in the display area. The map finally displayed can be a rendering effect of tile superposition under each manager.
In the scheme, when the level to be displayed is gradually enlarged from 18 levels to 20 levels, the level instance0 always participates in rendering, so that a map to be displayed can be quickly rendered in zooming, and the problems of switching blocking and white screen can be avoided.
As can be seen from the above, according to the map loading method provided by the embodiment of the present application, a map of a level to be displayed may be obtained through at least one level of detail to be displayed, and a manager is responsible for data of the level of detail to be displayed, so as to implement hierarchical rendering. When the level to be displayed is switched, if the change range of the level to be displayed is not large, the cache data of the manager can be fully utilized, repeated modeling is avoided, calculation force is saved, and the map loading performance is further improved.
In order to better implement the method, the embodiment of the application also provides a map loading device, which can be integrated in an electronic device, wherein the electronic device can be a terminal, a server and other devices. The terminal can be a mobile phone, a tablet personal computer, an intelligent Bluetooth device, a notebook computer, a personal computer, an intelligent voice interaction device, an intelligent household appliance, a vehicle-mounted terminal, an aircraft and other devices; the server may be a single server or a server cluster composed of a plurality of servers.
For example, in the present embodiment, a specific example of integrating the map loading device into the terminal will be described in detail.
For example, as shown in fig. 3, the map loading apparatus may include a hierarchy acquisition unit 310, a data block determination unit 320, an element determination unit 330, a rendering unit 340, and a loading unit 350, as follows:
a (one) hierarchy acquisition unit 310
And the at least one level of detail to be displayed is used for acquiring the corresponding level of detail to be displayed of the map.
In some embodiments, the hierarchy acquisition unit 310 further includes:
a level group determining subunit, configured to determine a display level group to which the level to be displayed belongs, where the display levels in the display level group share map data of the same data level;
a hierarchy map obtaining subunit, configured to obtain a hierarchy map relationship corresponding to the display level group, where the hierarchy map relationship includes a correspondence relationship between each display level in the display level group and a level of detail;
and the level determining subunit is used for determining at least one level of detail to be displayed corresponding to the level of detail to be displayed from the levels of detail according to the level mapping relation.
In some embodiments, the hierarchy acquisition unit further comprises:
a level group determining subunit, configured to determine a display level group to which the level to be displayed belongs, where the display levels in the display level group share map data of the same data level;
A candidate determining subunit, configured to determine a candidate level of detail according to the display level group;
and the level acquisition subunit is used for determining the level of detail to be displayed from the candidate levels of detail according to the attribute value corresponding to each candidate level of detail and the display level group.
In some embodiments, the acquisition subunit is further to:
determining a highest display level in the display level group as a designated display level;
carrying out shift processing on a preset value according to the appointed display level and the level to be displayed to obtain a shift result;
determining an operation result corresponding to each candidate detail level by using the shift result and the attribute value corresponding to each candidate detail level;
and determining the candidate detail level of which the operation result meets the preset condition as the detail level to be displayed.
In some embodiments, the level group determination subunit is further to:
determining a data level to be displayed corresponding to the level to be displayed based on a level mapping relation between the display level and the data level, wherein the display level comprises the level to be displayed;
and determining at least one display level corresponding to the data level to be displayed as a display level group in which the data level to be displayed is located.
(two) data block determination unit 320
And the data block to be processed is used for determining the data block to be processed corresponding to the level of detail to be displayed according to the level to be displayed, and the data block to be processed comprises a plurality of map elements.
In some embodiments, the data block determination unit 320 further includes:
the data level acquisition subunit is used for acquiring the data level to be displayed corresponding to the level to be displayed;
a size obtaining subunit, configured to obtain size data corresponding to each map data block in the data level to be displayed;
the view acquisition subunit is used for mapping the view data of the display area into the map data to obtain the view data to be processed;
an index calculation subunit, configured to calculate a to-be-processed index corresponding to the to-be-displayed level of detail by using the to-be-processed view data and the size data of the map data block;
and the data block acquisition subunit is used for acquiring the data block to be processed corresponding to the detail level to be displayed by utilizing the index to be processed.
In some embodiments, the data block acquisition subunit is further configured to:
inquiring the index to be processed in a map cache;
if the index to be processed is queried in the map cache, acquiring a data block to be processed corresponding to the index to be processed from the map cache;
And if the index to be processed is not queried in the map cache, acquiring compressed map data corresponding to the index to be processed from a designated file, and analyzing and processing the compressed map data to obtain a data block to be processed.
(III) element determination Unit 330
And determining the element to be rendered corresponding to the level of detail to be displayed from the map elements according to the style data corresponding to the map elements.
In some embodiments, the element determination unit 330 further includes:
a style acquisition subunit, configured to acquire style data corresponding to the map element and an effective level corresponding to the style data;
the validation determining subunit is used for determining an initial validation level of the style data according to the validation level of the style data and the level to be displayed aiming at the style data corresponding to each map element;
the matching subunit is used for matching the initial effective level of the style data with the initial effective level of the detail level to be displayed to obtain style data matched with the detail level to be displayed;
and the element determining subunit is used for determining the map element corresponding to the style data with the matched detail level to be displayed as the element to be rendered corresponding to the detail level to be displayed.
(IV) rendering Unit 340
And rendering the element to be rendered by using the cache data corresponding to the level of detail to be displayed and the style data corresponding to the element to be rendered, so as to obtain rendering data corresponding to the level of detail to be displayed.
In some embodiments, rendering unit 340 further includes:
the model obtaining subunit is used for obtaining an element model corresponding to the element to be rendered according to the cache data corresponding to the detail level to be displayed;
and the rendering subunit is used for rendering the element model corresponding to each element to be rendered by using the style data corresponding to the element to be rendered to obtain rendering data corresponding to the detail level to be displayed.
In some embodiments, the model acquisition subunit is further to:
obtaining cache data corresponding to the detail level to be displayed, wherein the cache data comprises element models corresponding to loaded elements in the detail level to be displayed;
if the element to be rendered is queried in the loaded elements, acquiring an element model corresponding to the element to be rendered from the cache data;
and if the element to be rendered is not queried in the loaded elements, modeling the element to be rendered to obtain an element model corresponding to the element to be rendered.
In some embodiments, the element model includes a plurality of grids, the rendering subunit further configured to:
determining the style attribute of each grid in the element model by utilizing style data corresponding to each element to be rendered according to the element model corresponding to each element to be rendered, so as to obtain grids carrying the style attribute;
and rendering each grid carrying the style attribute to obtain rendering data corresponding to the detail level to be displayed.
(fifth) load Unit 350
And loading the map of the level to be displayed according to the rendering data corresponding to each level of detail to be displayed.
In the implementation, each unit may be implemented as an independent entity, or may be implemented as the same entity or several entities in any combination, and the implementation of each unit may be referred to the foregoing method embodiment, which is not described herein again.
As can be seen from the above, the map loading device of the present embodiment may obtain at least one level of detail to be displayed corresponding to the level of detail to be displayed, where the map of the level of detail to be displayed may be obtained from data of at least one level of detail to be displayed, and a manager is responsible for data corresponding to one level of detail to be displayed, so that hierarchical rendering may be implemented.
The embodiment of the application also provides electronic equipment which can be a terminal, a server and other equipment. The terminal can be a mobile phone, a tablet computer, an intelligent Bluetooth device, a notebook computer, a personal computer and the like; the server may be a single server, a server cluster composed of a plurality of servers, or the like.
In some embodiments, the map loading device may also be integrated in a plurality of electronic devices, for example, the map loading device may be integrated in a plurality of servers, and the map loading method of the present application is implemented by the plurality of servers.
In this embodiment, a detailed description will be given taking an electronic device of this embodiment as an example of a terminal, for example, as shown in fig. 4, which shows a schematic structural diagram of the electronic device according to the embodiment of the present application, specifically:
the electronic device may include one or more processor cores 401, one or more computer-readable storage media memory 402, a power supply 403, an input module 404, and a communication module 405, among other components. Those skilled in the art will appreciate that the electronic device structure shown in fig. 4 is not limiting of the electronic device and may include more or fewer components than shown, or may combine certain components, or may be arranged in different components. Wherein:
The processor 401 is a control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, and performs various functions of the electronic device and processes data by running or executing software programs and/or modules stored in the memory 402, and calling data stored in the memory 402, thereby performing overall detection of the electronic device. In some embodiments, processor 401 may include one or more processing cores; in some embodiments, processor 401 may integrate an application processor that primarily processes operating systems, user interfaces, applications, and the like, with a modem processor that primarily processes wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 401.
The memory 402 may be used to store software programs and modules, and the processor 401 executes various functional applications and data processing by executing the software programs and modules stored in the memory 402. The memory 402 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required for at least one function, and the like; the storage data area may store data created according to the use of the electronic device, etc. In addition, memory 402 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.
The electronic device also includes a power supply 403 for powering the various components, and in some embodiments, the power supply 403 may be logically connected to the processor 401 by a power management system, such that charge, discharge, and power consumption management functions are performed by the power management system. The power supply 403 may also include one or more of any of a direct current or alternating current power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
The electronic device may also include an input module 404, which input module 404 may be used to receive entered numeric or character information and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
The electronic device may also include a communication module 405, and in some embodiments the communication module 405 may include a wireless module, through which the electronic device may wirelessly transmit over a short distance, thereby providing wireless broadband internet access to the user. For example, the communication module 405 may be used to facilitate a user in transceiving, browsing web pages, accessing streaming media, and the like.
Although not shown, the electronic device may further include a display unit or the like, which is not described herein. In particular, in this embodiment, the processor 401 in the electronic device loads executable files corresponding to the processes of one or more application programs into the memory 402 according to the following instructions, and the processor 401 executes the application programs stored in the memory 402, so as to implement various functions as follows:
Acquiring at least one level of detail to be displayed corresponding to a level to be displayed of a map;
determining a data block to be processed corresponding to the level of detail to be displayed according to the level to be displayed, wherein the data block to be processed comprises a plurality of map elements;
determining an element to be rendered corresponding to the level of detail to be displayed from the plurality of map elements according to the style data corresponding to the map elements;
rendering the element to be rendered by using the cache data corresponding to the level of detail to be displayed and the style data corresponding to the element to be rendered, so as to obtain rendering data corresponding to the level of detail to be displayed;
and loading the map of the level to be displayed according to the rendering data corresponding to each level of detail to be displayed.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
As can be seen from the foregoing, in the embodiment of the present application, at least one level of detail to be displayed corresponding to the level to be displayed may be obtained from data of the at least one level of detail to be displayed, and a manager is responsible for the data corresponding to the one level of detail to be displayed, so that hierarchical rendering may be implemented, and when the level to be displayed is switched, if the range of variation of the level to be displayed is not large, the cache data of the manager may be fully utilized, so that repeated modeling is avoided, calculation force is saved, and further, the performance of map loading is improved.
Those of ordinary skill in the art will appreciate that all or a portion of the steps of the various methods of the above embodiments may be performed by instructions, or by instructions controlling associated hardware, which may be stored in a computer-readable storage medium and loaded and executed by a processor.
To this end, embodiments of the present application provide a computer readable storage medium having stored therein a plurality of instructions capable of being loaded by a processor to perform steps in any of the map loading methods provided by embodiments of the present application. For example, the instructions may perform the steps of:
acquiring at least one level of detail to be displayed corresponding to a level to be displayed of a map;
determining a data block to be processed corresponding to the level of detail to be displayed according to the level to be displayed, wherein the data block to be processed comprises a plurality of map elements;
determining an element to be rendered corresponding to the level of detail to be displayed from the plurality of map elements according to the style data corresponding to the map elements;
rendering the element to be rendered by using the cache data corresponding to the level of detail to be displayed and the style data corresponding to the element to be rendered, so as to obtain rendering data corresponding to the level of detail to be displayed;
And loading the map of the level to be displayed according to the rendering data corresponding to each level of detail to be displayed.
Wherein the storage medium may include: read Only Memory (ROM), random access Memory (RAM, random Access Memory), magnetic or optical disk, and the like.
According to one aspect of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The computer instructions are read from a computer-readable storage medium by a processor of an electronic device, which executes the computer instructions, causing the electronic device to perform the methods provided in the various alternative implementations of the map loading aspect provided in the above embodiments.
Because the instructions stored in the storage medium may execute steps in any map loading method provided in the embodiments of the present application, the beneficial effects that any map loading method provided in the embodiments of the present application may be achieved, which are detailed in the previous embodiments and are not described herein.
The foregoing has described in detail a map loading method, apparatus, electronic device, storage medium and program product provided in the embodiments of the present application, and specific examples have been applied to illustrate the principles and embodiments of the present application, where the foregoing description of the embodiments is only for aiding in understanding the method and core idea of the present application; meanwhile, those skilled in the art will have variations in the specific embodiments and application scope in light of the ideas of the present application, and the present description should not be construed as limiting the present application in view of the above.

Claims (15)

1. A map loading method, the method comprising:
acquiring at least one level of detail to be displayed corresponding to a level to be displayed of a map;
determining a data block to be processed corresponding to the level of detail to be displayed according to the level to be displayed, wherein the data block to be processed comprises a plurality of map elements;
determining an element to be rendered corresponding to the level of detail to be displayed from the plurality of map elements according to the style data corresponding to the map elements;
rendering the element to be rendered by using the cache data corresponding to the level of detail to be displayed and the style data corresponding to the element to be rendered, so as to obtain rendering data corresponding to the level of detail to be displayed;
and loading the map of the level to be displayed according to the rendering data corresponding to each level of detail to be displayed.
2. The method according to claim 1, wherein the obtaining at least one level of detail to be displayed corresponding to a level of detail to be displayed of the map comprises:
determining a display level group to which the level to be displayed belongs, wherein the display levels in the display level group share map data of the same data level;
acquiring a hierarchy mapping relation corresponding to the display level group, wherein the hierarchy mapping relation comprises a corresponding relation between each display level in the display level group and a detail level;
And determining at least one detail level to be displayed corresponding to the level to be displayed from the detail levels according to the level mapping relation.
3. The method according to claim 1, wherein the obtaining at least one level of detail to be displayed corresponding to a level of detail to be displayed of the map comprises:
determining a display level group to which the level to be displayed belongs, wherein the display levels in the display level group share map data of the same data level;
determining candidate detail levels according to the display level group;
and determining the detail level to be displayed from the candidate detail levels according to the attribute value corresponding to each candidate detail level and the display level group.
4. A method according to claim 3, wherein determining a level of detail to be displayed from the candidate levels of detail based on the attribute value corresponding to each of the candidate levels of detail and the set of display levels comprises:
determining a highest display level in the display level group as a designated display level;
carrying out shift processing on a preset value according to the appointed display level and the level to be displayed to obtain a shift result;
determining an operation result corresponding to the candidate detail level by using the shift result and the attribute value corresponding to the candidate detail level;
And determining the candidate detail level of which the operation result meets the preset condition as the detail level to be displayed.
5. The method according to any one of claims 2-4, wherein said determining a display level group at which the level to be displayed is located comprises:
determining a data level to be displayed corresponding to the level to be displayed based on a level mapping relation between the display level and the data level, wherein the display level comprises the level to be displayed;
and in the level mapping relation, determining at least one display level corresponding to the data level to be displayed as a display level group in which the level to be displayed is positioned.
6. The method according to claim 1, wherein the determining, according to the level to be displayed, a block of data to be processed corresponding to the level of detail to be displayed includes:
acquiring a data level to be displayed corresponding to the level to be displayed;
acquiring size data corresponding to each map data block in the data level to be displayed;
mapping the view field data of the display area into the map data to obtain view field data to be processed;
calculating a to-be-processed index corresponding to the to-be-displayed detail level by using the to-be-processed view field data and the size data of the map data block;
And acquiring the data block to be processed corresponding to the detail level to be displayed by using the index to be processed.
7. The method of claim 6, wherein the obtaining, using the pending index, a pending data block corresponding to the level of detail to be displayed comprises:
inquiring the index to be processed in a map cache;
if the index to be processed is queried in the map cache, acquiring a data block to be processed corresponding to the index to be processed from the map cache;
and if the index to be processed is not queried in the map cache, acquiring compressed map data corresponding to the index to be processed from a designated file, and analyzing and processing the compressed map data to obtain a data block to be processed.
8. The method according to claim 1, wherein the determining, from the plurality of map elements, the element to be rendered corresponding to the level of detail to be displayed according to the style data corresponding to the map element includes:
acquiring style data corresponding to the map elements and an effective level corresponding to the style data;
for style data corresponding to each map element, determining an initial validation level of the style data according to the validation level of the style data and the level to be displayed;
Matching the initial effective level of the style data with the initial effective level of the detail level to be displayed to obtain style data matched with the detail level to be displayed;
and determining map elements corresponding to the style data with the matched detail levels to be displayed as elements to be rendered corresponding to the detail levels to be displayed.
9. The method according to claim 1, wherein rendering the element to be rendered using the cached data corresponding to the level of detail to be displayed and the style data corresponding to the element to be rendered, to obtain rendered data corresponding to the level of detail to be displayed, comprises:
obtaining an element model corresponding to the element to be rendered according to the cache data corresponding to the detail level to be displayed;
and rendering the element model corresponding to each element to be rendered by using the style data corresponding to the element to be rendered to obtain rendering data corresponding to the detail level to be displayed.
10. The method of claim 9, wherein the obtaining the element model corresponding to the element to be rendered according to the cached data corresponding to the level of detail to be displayed comprises:
Obtaining cache data corresponding to the detail level to be displayed, wherein the cache data comprises element models corresponding to loaded elements in the detail level to be displayed;
if the element to be rendered is queried in the loaded elements, acquiring an element model corresponding to the element to be rendered from the cache data;
and if the element to be rendered is not queried in the loaded elements, modeling the element to be rendered to obtain an element model corresponding to the element to be rendered.
11. The method according to claim 9, wherein the element model includes a plurality of grids, and the rendering processing is performed on the element model corresponding to each element to be rendered by using style data corresponding to the element to be rendered, so as to obtain rendering data corresponding to a level of detail to be displayed, including:
determining the style attribute of each grid in the element model by utilizing style data corresponding to each element to be rendered according to the element model corresponding to each element to be rendered, so as to obtain grids carrying the style attribute;
and rendering each grid carrying the style attribute to obtain rendering data corresponding to the detail level to be displayed.
12. A map loading device, the device comprising:
the level acquisition unit is used for acquiring at least one level of detail to be displayed corresponding to the level to be displayed of the map;
the data block determining unit is used for determining a data block to be processed corresponding to the level of detail to be displayed according to the level to be displayed, wherein the data block to be processed comprises a plurality of map elements;
the element determining unit is used for determining an element to be rendered corresponding to the level of detail to be displayed from the map elements according to the style data corresponding to the map elements;
the rendering unit is used for rendering the element to be rendered by utilizing the cache data corresponding to the level of detail to be displayed and the style data corresponding to the element to be rendered, so as to obtain rendering data corresponding to the level of detail to be displayed;
and the loading unit is used for loading the map of the level to be displayed according to the rendering data corresponding to each level of detail to be displayed.
13. An electronic device comprising a processor and a memory, the memory storing a plurality of instructions; the processor loads instructions from the memory to perform the steps in the map loading method as claimed in any one of claims 1 to 11.
14. A computer readable storage medium storing a plurality of instructions adapted to be loaded by a processor to perform the steps in the map loading method of any one of claims 1 to 11.
15. A computer program product comprising a plurality of instructions which when executed by a processor implement the steps in the map loading method of any one of claims 1 to 11.
CN202311478346.8A 2023-11-07 2023-11-07 Map loading method, map loading device, electronic equipment, storage medium and program product Pending CN117453844A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311478346.8A CN117453844A (en) 2023-11-07 2023-11-07 Map loading method, map loading device, electronic equipment, storage medium and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311478346.8A CN117453844A (en) 2023-11-07 2023-11-07 Map loading method, map loading device, electronic equipment, storage medium and program product

Publications (1)

Publication Number Publication Date
CN117453844A true CN117453844A (en) 2024-01-26

Family

ID=89587152

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311478346.8A Pending CN117453844A (en) 2023-11-07 2023-11-07 Map loading method, map loading device, electronic equipment, storage medium and program product

Country Status (1)

Country Link
CN (1) CN117453844A (en)

Similar Documents

Publication Publication Date Title
CN102306395B (en) Distributed drawing method and device of three-dimensional data
CN101447091B (en) Method and apparatus for processing graphics
CN110990516B (en) Map data processing method, device and server
CN108267154B (en) Map display method and device
CN110992469A (en) Visualization method and system for massive three-dimensional model data
CN102110280B (en) Spatial data processing method and device
CN112100795B (en) Computer aided design drawing comparison method and device
CN102368259A (en) Electronic map data storage and query method, device and system
DE202013012486U1 (en) User interface for orienting a camera view towards surfaces within a 3-D map and facilities that incorporate the user interface
EP2589933B1 (en) Navigation device, method of predicting a visibility of a triangular face in an electronic map view
CN107491522A (en) Switching method and device between a kind of two-dimensional map and three-dimensional map
CN114693875A (en) Point cloud visualization optimization method and system, electronic device and storage medium
CN116628123B (en) Dynamic slice generation method and system based on spatial database
CN107679150B (en) Mass three-dimensional data rapid scheduling method
CN112370783A (en) Virtual object rendering method and device, computer equipment and storage medium
US8438199B1 (en) System and method for identifying and highlighting a graphic element
CN115482269A (en) Method and device for calculating earth volume, terminal equipment and storage medium
EP2979251A1 (en) Three-dimensional map display system
CN117453844A (en) Map loading method, map loading device, electronic equipment, storage medium and program product
WO2016054859A1 (en) Electronic map hierarchical management method
CN102074004B (en) Method and device for determining type of barrier of spatial entity
CN111414104A (en) Electronic map local display method and device
CN114387378A (en) Image generation method and device based on digital twin rendering engine and electronic equipment
CN111966853B (en) Management method of remote sensing image
CN110580397A (en) display system for engineering project centralized display platform

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication