Map element processing method and device, electronic equipment and storage medium
By performing grid screening and bounding box collision detection in the map display area, combined with the drawing priority, the problem of increasing calculation volume caused by overlapping map elements in complex city maps is solved, and efficient and accurate collision detection effect is achieved, improving the efficiency and readability of map display.
Patent Information
- Application Number
- CN202411825936.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-03-28
AI Technical Summary
In complex city maps, texts and icons such as place names, points of interest and street names may appear concentrated in a small range, resulting in a sharp increase in the calculation amount of collision detection, consume a large amount of computing resources, and affect the efficiency and readability of map display.
Through the combination of grid filtering and bounding box collision detection, the drawing priority of multiple map elements in the map display area is determined, and grid filtering and collision detection are carried out according to the priority, overlapping map elements are excluded, and the number of samples that require accurate collision tests are reduced.
It effectively reduces the calculation amount of collision detection, improves the efficiency and readability of map display, avoids the pressure of map information, and achieves a clear and clear map display effect.
Smart Images

Figure CN119719211A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for processing map elements. Background Art
[0002] In a complex city map, place names, points of interest (POI), street names and other text and icons may appear in a small area.
[0003] In order to effectively display text and icons without overlapping in a limited space and improve the usability of the user interface and the readability of information, it is necessary to use collision detection technology when displaying maps, check the overlapping relationship of map information, and hide some map labels according to certain rules to achieve a clear map display effect. However, when the number of scene objects in the map is very large, the calculation amount of collision detection will increase sharply, making the calculation complexity higher and consuming a lot of computing resources. Summary of the invention
[0004] The present invention provides a method, device, electronic device and storage medium for processing map elements, which can reduce the calculation amount of collision detection while ensuring the map display effect by combining grid screening and collision detection.
[0005] In a first aspect, a method for processing a map element is provided, comprising: Determine the drawing priority of multiple first map elements in the map display area, each of the first map elements corresponds to a bounding box and boundary feature points on the bounding box; Performing grid screening on the plurality of first map elements respectively in descending order of drawing priority to obtain at least one second map element, wherein boundary feature points of the at least one second map element do not overlap with each other; In descending order of drawing priority, performing bounding box collision detection on at least one second map element in sequence to obtain at least one third map element, wherein bounding boxes of at least one third map element do not collide with each other; At least one third map element is drawn in the map display area.
[0006] In a second aspect, a map element processing device is provided, comprising: A determination module, used to determine the drawing priority of a plurality of first map elements in the map display area, each of the first map elements corresponding to a boundary box and boundary feature points on the boundary box; A screening module, used to perform grid screening on the plurality of first map elements respectively in descending order of drawing priority to obtain at least one second map element, wherein the boundary feature points of the at least one second map element do not overlap each other; A detection module, configured to perform bounding box collision detection on at least one second map element in order of drawing priority from high to low, to obtain at least one third map element, wherein bounding boxes of at least one third map element do not collide with each other; The processing module is used to draw at least one third map element in the map display area.
[0007] According to a third aspect, an electronic device is provided, comprising: a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute the method in the first aspect or its various implementations.
[0008] According to a fourth aspect, a computer-readable storage medium is provided for storing a computer program, wherein the computer program enables a computer to execute the method according to the first aspect or its various implementations.
[0009] Through the technical solution provided by the present application, after determining the multiple first map elements contained in the map display area, the drawing priorities of the multiple first map elements can be determined first; then, the multiple first map elements are respectively subjected to grid screening in the order of drawing priorities from high to low, and at least one second map element that is not covered is obtained; further, at least one second map element is subjected to bounding box collision detection in the order of drawing priorities from high to low, and at least one third map element that is not collided is obtained; then, at least one third map element is subjected to drawing processing in the map display area. The present application can retain some non-overlapping map elements by successively performing grid screening and bounding box collision detection on multiple map elements, and can avoid the overlap of map information, so as to achieve a clear and clear map display effect. In view of the fact that rectangular box collision detection can provide accurate detection results, but the performance consumption during calculation is relatively large. Therefore, before performing rectangular box collision detection, a rough collision detection can be performed through grid screening, which greatly reduces the number of samples that need to be accurately tested for collision. The combination of the two collision detection methods can reduce the calculation amount of collision detection and achieve efficient and accurate collision detection effects.
[0010] It should be understood that the above general description and the following detailed description are only exemplary and explanatory and cannot limit the present application. Other features and advantages of the present application will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0012] Figure 1 A schematic diagram of the principle flow of map element processing provided in an embodiment of the present application; Figure 2 An application scenario diagram provided for an embodiment of the present application; Figure 3 A flowchart of a method for processing map elements provided in an embodiment of the present application; Figure 4 A flowchart of a method for processing map elements provided in another embodiment of the present application; Figure 5 A schematic diagram of the principle flow of a grid screening provided in an embodiment of the present application; Figure 6 A schematic diagram of an example of a grid screening index provided in an embodiment of the present application; Figure 7 A CPU occupancy comparison diagram before and after grid screening provided in an embodiment of the present application; Figure 8 A schematic diagram of a collision detection principle flow provided in an embodiment of the present application; Fig. 9 A schematic diagram of the structure of a map element processing device provided in an embodiment of the present application; Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0013] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0014] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0015] In a complex city map, place names, points of interest (POI), street names and other text and icons may appear in a small area.
[0016] In order to effectively display text and icons without overlapping in a limited space and improve the usability of the user interface and the readability of information, it is necessary to use collision detection technology when displaying maps, check the overlapping relationship of map information, and hide some map labels according to certain rules to achieve a clear map display effect. However, when the number of scene objects in the map is very large, the calculation amount of collision detection will increase sharply, making the calculation complexity higher and consuming a lot of computing resources.
[0017] In order to solve the above technical problems, the invention of the present invention is as follows: in order to effectively display text and icons without overlapping in a limited space and improve the usability of the user interface and the readability of information, it is necessary to use collision detection technology when displaying maps, check the overlapping relationship of map information, and hide or adjust some map elements according to certain rules to achieve a clear map display effect. Specifically, Figure 1As shown, when multiple map elements in the map display area are determined and the multiple map elements are prepared to be drawn, the multiple map elements can be grid-filtered in sequence according to the drawing priority. For the covered map elements, the map elements can be deleted; for the map elements that are not covered by the grid screening result, the bounding box collision detection can be further performed. If the collision detection result is that no collision occurs, the map element is drawn in the map display area; if the collision detection result is that a collision occurs, the position of the map element can be adjusted or deleted. By successively performing grid screening and bounding box collision detection, the map elements with regional coverage can be adjusted or eliminated, so that there is no overlap between the map elements finally displayed, thereby avoiding the overlap of map information. Since both grid screening and bounding box collision detection are performed in sequence according to the drawing priority, it can ensure that the map elements with high drawing priority are displayed first. By setting the drawing priority, the displayed map elements can be more in line with user needs, providing users with a good map service experience. In addition, since the rectangular box collision detection can provide accurate detection results, the performance consumption during calculation is relatively large. Therefore, before performing rectangular frame collision detection, a rough collision detection can be performed through grid screening, which greatly reduces the number of samples required for accurate collision testing. The combination of the two collision detection methods can reduce the amount of collision detection calculations and achieve efficient and accurate collision detection results.
[0018] It should be understood that the technical solution of the present invention can be applied to the following scenarios, but is not limited to: In some possible implementations, Figure 2 An application scenario diagram provided by an embodiment of the present invention, such as Figure 2 As shown, the application scenario may include an electronic device 210 and a network device 220. The electronic device 210 may establish a connection with the network device 220 via a wired network or a wireless network.
[0019] Exemplarily, the electronic device 210 may be a desktop computer, a laptop computer, a tablet computer, etc., but is not limited thereto. The network device 220 may be a terminal device or a server, but is not limited thereto. In one embodiment of the present invention, the electronic device 210 may send a request message to the network device 220, and the request message may be used to request to obtain the drawing priorities of the multiple first map elements. Further, the electronic device 210 may receive a response message sent by the network device 220, and the response message includes the drawing priorities of the multiple first map elements.
[0020] also, Figure 2 An electronic device 210 and a network device 220 are provided as an example, but other numbers of electronic devices and network devices may be included in practice, and the present invention is not limited thereto.
[0021] In some other possible implementations, the technical solution of the present invention may also be executed by the above-mentioned electronic device 210, or the technical solution of the present invention may also be executed by the above-mentioned network device 220, and the present invention does not limit this.
[0022] After introducing the application scenarios of the embodiments of the present invention, the technical solutions of the present invention will be described in detail below: Figure 3 A flowchart of a method for processing map elements provided by an embodiment of the present invention. The method can be performed as follows: Figure 2 The electronic device 210 shown is executed, but is not limited thereto. Figure 3 As shown, the method may include the following steps: Step 310: Determine the drawing priority of multiple first map elements in the map display area.
[0023] When the scheme of this embodiment is implemented specifically, it can be a functional module in a map application (Application, APP). The map display area refers to the area in the APP used to display the map, and the size of the map display area can be determined according to the actual page design requirements. Usually, the page in the APP covers the entire screen of the electronic device, or occupies part of the screen. In some examples, the size of the map display area can be equal to the size of the page. In other examples, a part of the page may be divided as the map display area. In actual applications, it can be flexibly set according to needs, and this embodiment does not limit this.
[0024] Among them, the first map element is a map element that can be drawn in the map display area. These elements can be displayed on the map in various ways such as graphics, symbols, colors, and texts to help users understand geographical phenomena, spatial relationships, and the characteristics and changes of the geographical environment. In the process of map making, various map elements can be accurately and clearly drawn on the map in the form of graphics, symbols, colors, etc. These map elements include but are not limited to terrain, landforms, water systems, settlements, transportation networks, administrative boundaries, annotations, etc. In order to facilitate grid screening and bounding box collision detection of the first map elements in sequence, the bounding box of each first map element can be first constructed based on the screen coordinates of the first map element, that is, each first map element corresponds to a bounding box and boundary feature points on the bounding box. In order to ensure the clarity and readability of the map, it is necessary to set the drawing order and priority for different map elements. Users can configure the drawing priority for multiple different types of map elements according to actual application needs. In the process of map making, setting the drawing priority can manage map elements more efficiently. By assigning different priorities to different map elements, it is easier to control which elements should be drawn first and which elements can be refined or adjusted in subsequent stages. This ensures that the most important elements on the map are clearly displayed, avoiding visual confusion caused by overlapping map elements. This helps users get key information faster and improves the overall readability of the map.
[0025] Step 320: Grid screening is performed on the plurality of first map elements respectively in descending order of drawing priority to obtain at least one second map element.
[0026] Wherein, boundary feature points of at least one second map element do not overlap with each other.
[0027] In specific application scenarios, there may be a large number of map elements in the map display area. If collision detection is performed directly on all map elements, the amount of calculation will be very large, which may cause the performance of the application to deteriorate. By first performing grid screening on multiple first map elements, the overlapping map elements can be excluded from collision detection, thereby greatly reducing the number of elements that need collision detection and improving detection efficiency. Since grid screening can reduce the number of elements that need to be processed, it can also reduce memory consumption to a certain extent.
[0028] For the disclosed embodiment, after determining the drawing priority, each of the multiple first map elements can be grid screened in descending order of drawing priority. When it is determined that there is no grid overlap between the first map element and the second map element that has been determined not to be covered, the first map element can be directly determined as the second map element; when it is determined that there is a grid overlap between the first map element and the second map element that has been determined not to be covered, the position of the first map element on the map display area can be updated, or the first map element can be hidden. If it is determined that there is no grid overlap between the first map element after the updated position and the second map element that has been determined not to be covered, the first map element after the updated position is determined to be the second map element. In this way, at least one second map element that has not been covered can be determined among the multiple first map elements.
[0029] Exemplarily, it is determined that a plurality of first map elements included in the map display area include A, B, C, D and E in descending order of drawing priority. When the plurality of first map elements are respectively subjected to grid screening, A can be directly used as the second map element that is not covered, since A has the highest drawing priority. For B, grid overlap can be determined based on A. When it is determined that B does not overlap with A, B can be directly determined as the second map element that is not covered. When it is determined that B overlaps with A, the position of B on the map display area can be updated, or B can be hidden (i.e., not determined as the second map element). If it is determined that B after the updated position does not overlap with A that has been determined not to be covered, B after the updated position is determined to be the second map element. For C, grid overlap can be determined based on the second map element determined in A and B (when it is determined that B is classified as the second map element, the second map element currently determined includes A and B; when it is determined that B is not classified as the second map element, the second map element currently determined includes only A). When it is determined that C does not overlap with the second map element currently determined, C can be directly determined as the second map element that is not covered. When it is determined that C overlaps with the second map element currently determined, the position of C on the map display area can be updated, or C can be hidden (that is, it is not determined as the second map element). If it is determined that there is no grid overlap between C after the updated position and the second map element currently determined, C after the updated position is determined as the second map element. For D, the grid overlap can be determined based on the second map elements determined in A, B, and C. E can be determined based on the second map elements determined in A, B, C, and D. The specific judgment process can refer to the above-mentioned implementation process of grid overlap judgment for B, which will not be repeated here. After completing the grid overlap judgment for E, at least one second map element that is not covered among multiple first map elements can be obtained.
[0030] Step 330: Perform bounding box collision detection on at least one second map element in order of drawing priority from high to low, to obtain at least one third map element.
[0031] The bounding boxes of at least one third map element do not collide with each other.
[0032] For the disclosed embodiment, after determining at least one second map element that is not covered through grid screening, the at least one second map element can be sorted for drawing in descending order of drawing priority, and bounding box collision detection can be performed on each second map element in the sorting order. When it is determined that the second map element does not collide with the third map element that has been determined not to have collided, the second map element can be directly determined as the third map element; when it is determined that the second map element collides with the third map element that has been determined not to have collided, the position of the second map element on the map display area can be updated, or the second map element can be hidden. If it is determined that the second map element after the updated position does not collide with the third map element that has been determined not to have collided, the second map element after the updated position is determined to be the third map element. In this way, at least one third map element that has not collided can be determined in at least one second map element.
[0033] For example, following the example in step 320 of the embodiment, if it is determined that at least one second map element that is not covered includes A, B, and D, the at least one second map element can be sorted in descending order of drawing priority. Since A has the highest drawing priority, it can be directly used as the third map element that has not collided; for B, collision detection can be performed based on A, and when it is determined that B and A have not collided, B can be directly determined as the third map element. When it is determined that B and A collide, the position of B on the map display area can be updated, or B can be hidden (that is, it is not determined as the third map element). If it is determined that the updated position of B does not overlap with the screen coordinates of A that has been determined not to have collided, the updated position of B is determined as the third map element; for D, collision detection can be performed based on the third map element determined from A and B (when it is determined that B is divided into the third map element, the currently determined third map element includes A and B; when it is determined that B is not divided into the third map element, the currently determined third map element only includes A). When it is determined that D does not overlap with the currently determined second map element, D can be directly determined as a third map element that is not covered. When it is determined that D overlaps with the currently determined third map element, the position of D on the map display area can be updated, or D can be hidden (i.e., not determined as the third map element). If it is determined that the updated position of D does not overlap with the currently determined third map element in screen coordinates, the updated position of D is determined as the third map element. After completing the collision detection of D, at least one third map element that has not collided can be obtained.
[0034] Step 340: Draw at least one third map element in the map display area.
[0035] For the disclosed embodiment, after at least one third map element is determined through grid screening and collision detection, the third map element can be drawn on the map display area to achieve non-overlapping display of the third map element. This can make the displayed map elements more in line with user needs and provide users with a good map service experience.
[0036] In summary, according to the method for processing map elements provided by the present invention, after determining the multiple first map elements contained in the map display area, the drawing priorities of the multiple first map elements can be determined first; then, the multiple first map elements are respectively subjected to grid screening in descending order of drawing priority to obtain at least one second map element that is not overlapped; further, the at least one second map element is subjected to bounding box collision detection in descending order of drawing priority to obtain at least one third map element that is not collided; then, the at least one third map element is subjected to drawing processing in the map display area. The present application can retain some non-overlapping map elements by successively performing grid screening and bounding box collision detection on multiple map elements, which can avoid the overlap of map information and achieve a clear and concise map display effect. In view of the fact that rectangular box collision detection can provide accurate detection results, but the performance consumption during calculation is relatively large. Therefore, before performing rectangular box collision detection, a rough collision detection can be performed through grid screening, which greatly reduces the number of samples that need to be subjected to accurate collision testing. The combination of the two collision detection methods can reduce the calculation amount of collision detection and achieve efficient and accurate collision detection effects.
[0037] based on Figure 3 The embodiment shown is a refinement and extension of the above embodiment. In order to fully illustrate the specific implementation process of the method of this embodiment, this embodiment provides the following Figure 4 The specific method shown. Figure 4 based on Figure 3 As shown in Figure 4, the method comprises the following steps: Step 410: Determine the drawing priority of multiple first map elements in the map display area.
[0038] For the embodiment of the present disclosure, the specific implementation process can refer to the relevant description in step 310 of the embodiment, which will not be repeated here.
[0039] Step 420: Determine each first map element as the first current map element in order of drawing priority from high to low.
[0040] The first current map element may be the first map element for which the grid screening process is to be performed.
[0041] Exemplarily, when determining multiple first map elements in the map display area, which include A, B, C, D and E in descending order of drawing priority, A can be first determined as the first current map element, and the grid screening process in step 430 of the embodiment is performed on A; after completing the grid screening process of A, B can be further determined as the first current map element, and the grid screening process in step 430 of the embodiment is performed on B; after completing the grid screening process of B, C can be further determined as the first current map element, and the grid screening process in step 430 of the embodiment is performed on C; after completing the grid screening process of C, D can be further determined as the first current map element, and the grid screening process in step 430 of the embodiment is performed on D; after completing the grid screening process of D, E can be further determined as the first current map element, and the grid screening process in step 430 of the embodiment is performed on E.
[0042] Step 430: Repeat the grid screening process for each first current map element until the first current map element is determined to be the first map element with the lowest drawing priority, and obtain at least one second map element whose boundary feature points do not overlap with each other among the plurality of first map elements.
[0043] For the embodiments of the present disclosure, Figure 5 As shown, when performing grid filtering, the screen coordinates of a predetermined number of boundary feature points (such as four vertices of a boundary box) corresponding to the first current map element may first be converted into grid coordinates according to a preset granularity; then, it is checked whether the predetermined number of grid coordinates are in the grid filtering index corresponding to the first current map element; if it is determined that at least one of the predetermined number of grid coordinates exists in the grid filtering index, the position of the first current map element on the map display area is updated, or the first current map element is hidden, and the processing of the first current map element is terminated, and then the above-mentioned grid filtering process may be repeatedly performed for the first current map element of the next drawing priority; if it is determined that any grid coordinate of the predetermined number of grid coordinates does not exist in the grid filtering index, the first current map element is determined as a second map element and added to the grid filtering index, and the processing of the first current map element is terminated, and then the above-mentioned grid filtering process may be repeatedly performed for the first current map element of the next drawing priority, until the first current map element is determined to be the first map element with the lowest drawing priority, and at least one second map element that is not covered among the multiple first map elements is obtained.
[0044] The grid screening process includes: Step 430-1: Generate a grid filter index corresponding to each first current map element.
[0045] According to the embodiment of the present disclosure, the grid screening index including all grid labels of all second map elements may be gradually updated and generated in the order of drawing priority from high to low.
[0046] For the disclosed embodiment, a grid screening algorithm may be used to perform a grid screening process for each first current map element. The grid screening algorithm may be a traditional grid screening algorithm, which requires dividing the map display screen into a plurality of equal square grids, establishing a grid index with a two-dimensional array, and when calculating whether a map label is overlapped, it is necessary to check whether the grid where the map label is located has been marked, and if so, it is considered that there is an overlap. However, this method will result in a slower calculation speed for grid screening, consume a large amount of computing resources and storage resources, and result in a lower efficiency in drawing map element sketches.
[0047] To address this, the present application may provide a novel grid screening algorithm, in which the screen coordinates of the first current map element may be converted into grid coordinate representation according to a certain granularity, and the grid coordinates of the second map element that is determined to be not covered among multiple first map elements when the first current map element is subjected to grid screening are converted into a sparse matrix after a row-column compression algorithm, and used as the grid screening index of the first current map element. With the subsequent screening of the second map element, the grid coordinates of the screened second map element may be added to the grid screening index. Figure 6 As shown, a grid filter index containing the network coordinates of multiple second map elements can be obtained in the end. row is the row of the grid coordinates of the map label (ie, the second map element), and col is the column of the grid coordinates of the map label (ie, the second map element).
[0048] For the disclosed embodiments, sparse matrices and vertex judgment methods can be used to improve the calculation speed of grid screening, make up for the disadvantages of large consumption of memory and central processing unit (CPU) in traditional grid screening, and significantly reduce the number of map elements for high-precision collision detection.
[0049] Figure 7 The flame graph of CPU usage before and after using the grid filtering method under the same test case. The left side is before using the grid filtering, and the right side is after using the grid filtering. The gray box shows the CPU usage of the collision detection algorithm alone. The comparison chart shows that after using the grid filtering, the CPU usage flame graph of the collision detection algorithm is significantly narrowed, indicating that grid filtering can effectively reduce the CPU usage of collision detection for a large number of data samples.
[0050] Accordingly, for the embodiment of the present disclosure, the embodiment steps may include: determining the second map elements that have been screened out from the multiple first map elements when each first current map element is subjected to grid screening; and generating a grid screening index corresponding to the first current map element based on all grid coordinates contained in the screened second map elements.
[0051] Exemplarily, multiple first map elements included in the map display area are determined, and they include A, B, C, D and E in descending order of drawing priority. When B is used as the first current map element for grid screening, the grid screening index corresponding to B can be generated based on all the grid coordinates contained in A; if B is further determined to be the second map element, when C is used as the first current map element for grid screening, the grid screening index corresponding to C can be generated based on all the grid coordinates contained in A and B; if C is further determined to be the second map element, when D is used as the first current map element for grid screening, the grid screening index corresponding to D can be generated based on all the grid coordinates contained in A, B and C; if D is further determined not to be the second map element, when E is used as the first current map element for grid screening, the grid screening index corresponding to E can also be generated based on all the grid coordinates contained in A, B and C.
[0052] Step 430-2: Determine the boundary grid coordinates of a predetermined number of boundary feature points corresponding to the first current map element.
[0053] For the embodiments of the present disclosure, the embodiment steps may include: determining the bounding box corresponding to the first current map element and the boundary screen coordinates of a predetermined number of boundary feature points on the boundary box; converting the boundary screen coordinates into boundary grid coordinates according to a preset granularity.
[0054] Taking the principle of abstracting 8 pixels × 8 pixels into a grid at a preset granularity as an example, the screen coordinates are converted into grid coordinates:
[0055] In the formula, is the transformed grid coordinate, is screen coordinates.
[0056] Step 430-3: If it is determined that any boundary grid coordinate does not exist in the grid screening index, the first current map element is determined as the second map element.
[0057] Step 430-4: If it is determined that at least one of the boundary grid coordinates exists in the grid filtering index, the position of the first current map element on the map display area is updated, or the first current map element is hidden.
[0058] In the embodiment of the present disclosure, if it is determined that there is no grid overlap between the first current map element after the updated position and the currently determined second map element, the first current map element after the updated position is determined as the second map element.
[0059] Step 440: Determine each second map element as the second current map element in order of drawing priority from high to low.
[0060] Exemplarily, when at least one second map element that is not covered includes A, B, and D in order of drawing priority from high to low, A can be first determined as the second current map element, and the collision detection process in step 450 of the embodiment can be performed on A; after completing the collision detection on A, B can be further determined as the second current map element, and the collision detection process in step 450 of the embodiment can be performed on B; after completing the collision detection on B, D can be further determined as the second current map element, and the collision detection process in step 450 of the embodiment can be performed on D.
[0061] Step 450: Repeat the collision detection process for each second current map element until the second current map element is determined to be the second map element with the lowest drawing priority, and obtain at least one third map element whose bounding boxes do not collide with each other among the plurality of second map elements.
[0062] For the embodiments of the present disclosure, Figure 8 As shown, when performing collision detection, the collision detection index corresponding to the second current map element can be determined first, and the element tag of the third map element can be dynamically stored in the collision detection index, and the element tag is an identifier for identifying the third map element. Then, the N adjacent map elements closest to the second current map element can be searched; it is determined whether the adjacent map element can be found in the collision detection index. If the adjacent map element of the second current map element is not found in the collision detection index, the second current map element can be directly drawn into the map as the third map element, and the element tag corresponding to the second current map element can be updated to the collision detection index; if the adjacent map element of the second current map element exists in the collision detection index, the adjacent map element existing in the collision detection index can be determined as the target map element to be subjected to collision detection. Afterwards, collision detection is performed on the target map element and the second current map element to calculate whether there is overlap between the target map element and the second current map element. When it is determined that there is overlap, the second current map element can be directly deleted; when it is determined that there is no overlap between the two, the second current map element can be drawn into the map as the third map element sketch, and the element label corresponding to the second current map element can be updated to the collision detection index.
[0063] The collision detection process includes: Step 450-1: Generate a collision detection index corresponding to each second current map element.
[0064] For the embodiment of the present disclosure, the collision detection index of the element labels including all the third map elements may be updated and generated step by step in the order of drawing priority from high to low.
[0065] Accordingly, the steps of the embodiment may include: determining a third map element in at least one second map element that is determined to have not collided when performing collision detection on each second current map element; generating a detection index including an element tag of the third map element as a collision detection index of the second current map element, where the element tag is an identifier for identifying the third map element.
[0066] Exemplarily, it is determined that at least one second map element that is not overlapped includes A, B, and D. When B is used as the second current map element for collision detection, a collision detection index including the A element tag may be generated for B; if B is determined to be the third map element, when D is used as the second current map element for collision detection, a collision detection index including the A and B element tags may be generated for D.
[0067] Step 450 - 2 : Determine at least one target map element for which collision detection is to be performed in at least one second map element based on the collision detection index.
[0068] For the embodiments of the present disclosure, when determining the target map element, the Euclidean distance can be used to search for multiple adjacent map elements closest to the second current map element; if the adjacent map element is found, it can be determined whether the element label corresponding to the adjacent map element is included in the collision detection index, and then the adjacent map element included in the collision detection index is determined as at least one target map element to be subjected to collision detection, and the subsequent embodiment steps 450-3, 450-4, and 450-5 are continued to be executed; if it is determined that the collision detection index does not contain the determined adjacent map element, the second current map element can be directly determined as the third map element, and the execution of the embodiment step 460 is directly jumped without continuing to execute the subsequent embodiment steps 450-3, 450-4, and 450-5.
[0069] Accordingly, the steps of the embodiment may include: determining at least one adjacent map element corresponding to the second current map element in at least one second map element; and determining the adjacent map element existing in the collision detection index as the target map element to be subjected to collision detection.
[0070] For example, if multiple adjacent map elements a, b, and c are determined for the second current map element B, it can be further determined whether the element tags corresponding to the adjacent map elements a, b, and c are included in the collision detection index. If it is determined that the collision detection index contains the element tags of the adjacent map elements b and c, the adjacent map elements b and c can be determined as the target map elements corresponding to the second current map element B; if it is determined that the collision detection index does not contain the element tags of the adjacent map elements b and c, the second current map element B can be directly determined as the third map element.
[0071] Step 450 - 3 : Perform bounding box collision detection on the target map element and the second current map element.
[0072] For the embodiments of the present disclosure, the steps of the embodiments may include: determining the first screen coordinates of all boundary feature points on the bounding box corresponding to the target map element, and the second screen coordinates of all boundary feature points on the bounding box corresponding to the second current map element; based on the first screen coordinates and the second screen coordinates, determining whether there is an overlapping area between any target map element and the second current map element; if it is determined that there is an overlapping area, determining that the collision detection result is a collision; if it is determined that there is no overlapping area, determining that the collision detection result is no collision.
[0073] Step 450-4: If it is determined that the boundary boxes of the second current map element and any target map element do not collide with each other, the second current map element is determined as the third map element.
[0074] Step 450-5: If it is determined that the second current map element collides with the bounding box of any target map element, the position of the second current map element on the map display area is updated, or the second current map element is hidden.
[0075] In the embodiment of the present disclosure, if it is determined that there is no grid overlap between the second current map element after the updated position and the currently determined third map element, the second current map element after the updated position is determined as the third map element.
[0076] Step 460: Draw at least one third map element in the map display area.
[0077] In summary, the technical solution in this application can retain some non-overlapping map elements by performing grid screening and bounding box collision detection on multiple map elements in turn, avoid the overlap of map information, and achieve a clear and concise map display effect. Grid screening only performs a rough screening, which greatly reduces the number of map elements that need to be accurately tested for collision. Bounding box collision detection can provide accurate detection results, but the performance consumption during calculation is relatively large. The combination of the two collision detection methods can make up for the shortcomings of a single collision detection algorithm and achieve efficient and accurate collision detection effects. Grid screening needs to process map elements with a large amount of data, which will have the problem of time-consuming query. Sparse matrices are used as grid screening indexes. Due to the characteristics of sparse matrices, they only store non-zero elements and their positions, thereby improving query processing efficiency on the basis of saving storage space. When checking whether the first current map element is already in the grid screening index, only checking whether some grid coordinates of the first current map element are in the grid screening index can reduce the number of queries and improve code execution efficiency. Since grid filtering and bounding box collision detection are performed in sequence according to drawing priority, it can ensure that map elements with high drawing priority are displayed first. By setting the drawing priority, the displayed map elements can better meet user needs and provide users with a good map service experience.
[0078] Based on the above Figure 3 , Figure 4 A detailed description of the processing methods of the provided map elements, such as Fig. 9 As shown, Fig. 9 FIG. 1 is a block diagram of a processing device for map elements according to an exemplary embodiment. Fig. 9 As shown, the device comprises: A determination module 91, which can be used to determine the drawing priority of multiple first map elements in the map display area, each of which corresponds to a boundary box and boundary feature points on the boundary box; A screening module 92, which can be used to perform grid screening on the plurality of first map elements in descending order of drawing priority to obtain at least one second map element, wherein the boundary feature points of the at least one second map element do not overlap each other; The detection module 93 may be used to perform bounding box collision detection on at least one second map element in order of drawing priority from high to low, to obtain at least one third map element, wherein the bounding boxes of the at least one third map element do not collide with each other; The processing module 94 may be used to draw at least one third map element in the map display area.
[0079] In some embodiments of the present application, the screening module 92 may be used to determine each first map element as the first current map element in descending order of drawing priority; repeatedly perform the grid screening process for each first current map element until the first current map element is determined to be the first map element with the lowest drawing priority, and obtain at least one second map element whose boundary feature points do not overlap with each other among the multiple first map elements: The grid filtering process includes: generating a grid filtering index corresponding to each first current map element; determining the boundary grid coordinates of a predetermined number of boundary feature points corresponding to the first current map element; if it is determined that any boundary grid coordinate does not exist in the grid filtering index, determining the first current map element as the second map element; if it is determined that at least one of the boundary grid coordinates exists in the grid filtering index, updating the position of the first current map element on the map display area, or hiding the first current map element.
[0080] In some embodiments of the present application, when generating a grid filtering index corresponding to each first current map element, the filtering module 92 can be specifically used to determine a second map element that has been filtered out from multiple first map elements when performing grid filtering on each first current map element; and generate a grid filtering index corresponding to the first current map element based on all grid coordinates contained in the filtered second map element.
[0081] In some embodiments of the present application, when determining the boundary grid coordinates of a predetermined number of boundary feature points corresponding to the first current map element, the screening module 92 can be specifically used to determine the boundary box corresponding to the first current map element and the boundary screen coordinates of the predetermined number of boundary feature points on the boundary box; and convert the boundary screen coordinates into boundary grid coordinates according to a preset granularity.
[0082] In some embodiments of the present application, the detection module 93 may be used to determine each second map element as a second current map element in order of drawing priority from high to low; repeatedly perform the collision detection process for each second current map element until the second current map element is determined to be the second map element with the lowest drawing priority, and obtain at least one third map element whose bounding boxes do not collide with each other among the plurality of second map elements: The collision detection process includes: generating a collision detection index corresponding to each second current map element; determining at least one target map element to be subjected to collision detection in at least one second map element based on the collision detection index; performing bounding box collision detection on the target map element and the second current map element; if it is determined that the bounding boxes of the second current map element and any target map element do not collide with each other, determining the second current map element as the third map element; if it is determined that the bounding boxes of the second current map element and any target map element collide with each other, updating the position of the second current map element on the map display area, or hiding the second current map element.
[0083] In some embodiments of the present application, when generating a collision detection index corresponding to each second current map element, the detection module 93 can be specifically used to determine a third map element in at least one second map element that is determined to have not collided when performing collision detection on each second current map element; generate a detection index including an element tag of the third map element as the collision detection index of the second current map element, where the element tag is an identifier used to identify the third map element.
[0084] In some embodiments of the present application, when determining at least one target map element to be subjected to collision detection in at least one second map element based on a collision detection index, the detection module 93 can be specifically used to determine at least one adjacent map element corresponding to the second current map element in at least one second map element; and determine the adjacent map element existing in the collision detection index as the target map element to be subjected to collision detection.
[0085] Correspondingly, when performing bounding box collision detection on the target map element and the second current map element, the detection module 93 can be specifically used to determine the first screen coordinates of all boundary feature points on the bounding box corresponding to the target map element, and the second screen coordinates of all boundary feature points on the bounding box corresponding to the second current map element; based on the first screen coordinates and the second screen coordinates, determine whether there is an overlapping area between any target map element and the second current map element; if it is determined that there is an overlapping area, determine that the collision detection result is a collision; if it is determined that there is no overlapping area, determine that the collision detection result is no collision.
[0086] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0087] The embodiment of the present application and the technical solution disclosed in the present invention can retain some non-overlapping map elements by successively performing grid screening and bounding box collision detection on multiple map elements, thereby avoiding the overlap of map information and achieving a clear and concise map display effect. Grid screening only performs a rough screening, which greatly reduces the number of samples that need to be accurately tested for collision. Bounding box collision detection can provide accurate detection results, but the performance consumption during calculation is relatively large. The combination of the two collision detection methods can make up for the shortcomings of a single collision detection algorithm and achieve efficient and accurate collision detection effects. Grid screening needs to process map labels with a large amount of data, which will cause the query to be time-consuming. Sparse matrices are used as grid screening indexes. Due to the characteristics of sparse matrices, they only store non-zero elements and their positions, thereby improving the query processing efficiency on the basis of saving storage space. When checking whether the first current map element is already in the grid screening index, only the grid coordinates of the four vertices of the upper left, upper right, lower right, and lower left of the first current map element are checked to reduce the number of queries and improve the efficiency of code execution. Since grid filtering and bounding box collision detection are performed in sequence according to drawing priority, it can ensure that map elements with high drawing priority are displayed first. By setting the drawing priority, the displayed map elements can better meet user needs and provide users with a good map service experience.
[0088] In the above text, the processing device of the map element of the embodiment of the present invention is described from the perspective of the functional module in conjunction with the accompanying drawings. It should be understood that the functional module can be implemented in the form of hardware, can be implemented by instructions in the form of software, or can be implemented by a combination of hardware and software modules. Specifically, the steps of the embodiment of the method for processing map elements in the embodiment of the present invention can be completed by the hardware integrated logic circuit and / or software instructions in the processor, and the steps of the method for processing map elements applied in conjunction with the embodiment of the present invention can be directly embodied as a hardware decoding processor to be executed, or can be executed by a combination of hardware and software modules in the decoding processor. Optionally, the software module can be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory, and completes the steps in the above-mentioned method for processing map elements in conjunction with its hardware.
[0089] Fig.10 is a schematic block diagram of an electronic device 1000 according to an embodiment of the present invention.
[0090] like Fig.10 As shown, the electronic device 1000 may include: The memory 1010 and the processor 1020, the memory 1010 is used to store the computer program and transmit the program code to the processor 1020. In other words, the processor 1020 can call and run the computer program from the memory 1010 to implement the method in the embodiment of the present invention.
[0091] For example, the processor 1020 may be configured to execute the above method embodiments according to instructions in the computer program.
[0092] In some embodiments of the present invention, the processor 1020 may include but is not limited to: General-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0093] In some embodiments of the present invention, the memory 1010 includes but is not limited to: Volatile memory and / or non-volatile memory. Among them, the non-volatile memory can be read-only memory (ROM), programmable ROM (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM) or flash memory. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct memory bus random access memory (Direct Rambus RAM, DR RAM).
[0094] In some embodiments of the present invention, the computer program may be divided into one or more modules, which are stored in the memory 1010 and executed by the processor 1020 to complete the method provided by the present invention. The one or more modules may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the controller.
[0095] like Fig.10 As shown, the electronic device 1000 may further include: The transceiver 1030 may be connected to the processor 1020 or the memory 1010 .
[0096] The processor 1020 may control the transceiver 1030 to communicate with other devices, specifically, to send data to other devices, or to receive data sent by other devices. The transceiver 1030 may include a transmitter and a receiver. The transceiver 1030 may further include an antenna, and the number of antennas may be one or more.
[0097] It should be understood that the various components in the electronic device are connected via a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus and a status signal bus.
[0098] The present invention also provides a computer storage medium having a computer program stored thereon, which, when executed by a computer, enables the computer to perform the method of the above method embodiment. In other words, an embodiment of the present invention also provides a computer program product containing instructions, which, when executed by a computer, enables the computer to perform the method of the above method embodiment.
[0099] When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (Digital Subscriber Line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integration. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a digital video disc (Digital Video Disc, DVD)), or a semiconductor medium (e.g., a solid-state drive (Solid State Disk, SSD)), etc.
[0100] Those skilled in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments applied herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0101] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the module is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0102] The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. For example, each functional module in each embodiment of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.
[0103] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in this application, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A method for processing map elements, characterized in that: include: Determine a drawing priority of a plurality of first map elements in a map display area, each of the first map elements corresponding to a boundary box and boundary feature points on the boundary box; According to the order of the drawing priorities from high to low, the plurality of first map elements are respectively subjected to grid screening to obtain at least one second map element, wherein the boundary feature points of the at least one second map element do not overlap with each other; In descending order of the drawing priority, sequentially performing bounding box collision detection on the at least one second map element to obtain at least one third map element, wherein bounding boxes of the at least one third map element do not collide with each other; The at least one third map element is drawn in the map display area.
2. The method according to claim 1, characterized in that The step of performing grid screening on the plurality of first map elements in descending order of the drawing priorities to obtain at least one second map element comprises: Determining each of the first map elements as a first current map element in sequence according to the order of the drawing priority from high to low; Repeat the grid screening process for each of the first current map elements until the first current map element is determined to be the first map element with the lowest drawing priority, and obtain at least one second map element in which the boundary feature points of the plurality of first map elements do not overlap each other: The grid screening process includes: Generate a grid filter index corresponding to each of the first current map elements; Determine boundary grid coordinates of a predetermined number of boundary feature points corresponding to the first current map element; If it is determined that any of the boundary grid coordinates does not exist in the grid screening index, determining the first current map element as the second map element; If it is determined that at least one of the boundary grid coordinates exists in the grid filtering index, the position of the first current map element on the map display area is updated, or the first current map element is hidden.
3. The method according to claim 2, characterized in that The generating of the grid screening index corresponding to each of the first current map elements includes: Determining a second map element that has been screened out from the plurality of first map elements when grid screening is performed on each of the first current map elements; Based on all the grid coordinates contained in the filtered second map element, a grid filtering index corresponding to the first current map element is generated.
4. The method according to claim 2, characterized in that: The determining the boundary grid coordinates of a predetermined number of boundary feature points corresponding to the first current map element includes: Determine a bounding box corresponding to the first current map element and boundary screen coordinates of a predetermined number of boundary feature points on the bounding box; The boundary screen coordinates are converted into boundary grid coordinates according to a preset granularity.
5. The method according to claim 1, characterized in that The step of sequentially performing bounding box collision detection on the at least one second map element in descending order of the drawing priority to obtain at least one third map element includes: In descending order of the drawing priority, sequentially determining each of the second map elements as a second current map element; Repeat the collision detection process for each second current map element until the second current map element is determined to be the second map element with the lowest drawing priority, and obtain at least one third map element among the plurality of second map elements whose bounding boxes do not collide with each other: The collision detection process includes: Generate a collision detection index corresponding to each of the second current map elements; Determining at least one target map element to be subjected to collision detection in the at least one second map element based on the collision detection index; Performing bounding box collision detection on the target map element and the second current map element; If it is determined that the boundary boxes of the second current map element and any of the target map elements do not collide with each other, determining the second current map element as the third map element; If it is determined that the second current map element collides with the bounding box of any of the target map elements, the position of the second current map element on the map display area is updated, or the second current map element is hidden.
6. The method according to claim 5, characterized in that The generating of the collision detection index corresponding to each second current map element includes: determining a third map element in the at least one second map element that is determined to have no collision when each of the second current map elements is subjected to collision detection; A detection index including an element tag of the third map element is generated as a collision detection index of the second current map element, wherein the element tag is an identifier for identifying the third map element.
7. The method according to claim 5, characterized in that The determining, based on the collision detection index, at least one target map element to be subjected to collision detection in the at least one second map element comprises: Determining at least one adjacent map element corresponding to the second current map element in the at least one second map element; Determine the adjacent map element existing in the collision detection index as a target map element to be subjected to collision detection; The performing bounding box collision detection on the target map element and the second current map element includes: Determine the first screen coordinates of all boundary feature points on the boundary box corresponding to the target map element, and the second screen coordinates of all boundary feature points on the boundary box corresponding to the second current map element; Based on the first screen coordinates and the second screen coordinates, determining whether there is an overlapping area between any of the target map elements and the second current map element; If it is determined that the overlapping area exists, determining the collision detection result as a collision; If it is determined that the overlapping area does not exist, the collision detection result is determined to be that no collision occurs.
8. A map element processing device, characterized in that: include: A determination module, used to determine the drawing priority of a plurality of first map elements in a map display area, each of the first map elements corresponding to a boundary box and boundary feature points on the boundary box; A screening module, configured to perform grid screening on the plurality of first map elements respectively in descending order of the drawing priorities to obtain at least one second map element, wherein boundary feature points of the at least one second map element do not overlap with each other; a detection module, configured to perform bounding box collision detection on the at least one second map element in order of the drawing priority from high to low, to obtain at least one third map element, wherein bounding boxes of the at least one third map element do not collide with each other; The processing module is used to draw the at least one third map element in the map display area.
9. An electronic device, characterized in that: include: A processor and a memory, the memory being used to store a computer program, and the processor being used to call and run the computer program stored in the memory to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Used to store a computer program, wherein the computer program causes a computer to execute the method according to any one of claims 1 to 7.