Map data processing method and device and computer program product
By generating cutting lines, converting polygons with holes into Euler's graphs and traversing the sub-rings through graphs, the inefficiency problem in traditional methods is solved, and efficient polygon segmentation is achieved.
Patent Information
- Application Number
- CN202510031710.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-08
- Publication Date
- 2025-05-13
AI Technical Summary
The prior art is difficult to efficiently process complex polygons with holes, which leads to the need to segment them in some application scenarios. However, traditional facet algorithms are inefficient and prone to performance problems.
By generating cutting lines, the polygonal region with holes is converted into Euler graphs, thereby extracting multiple sub-rings through graph traversal to achieve the segmentation of polygons.
This method avoids a large number of calculations of spatial relationships between lines and faces, and greatly reduces the calculation amount compared with traditional facet algorithms, improves processing efficiency, and reduces the impact on system performance.
Smart Images

Figure CN119991875A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of map data technology, and in particular to a map data processing method, device and computer program product. Background Art
[0002] In the production of map data, hole scenes often appear, such as an island in the middle of the ocean, an artificial lake in the middle of a park, and so on. Due to the complexity of geographic data, such hole scenes will lead to the appearance of complex polygons with holes. The complex polygons have a large number of vertices and edges, even tens of thousands of edges, and contain one or more irregular holes. In some application scenarios, it is necessary to segment such complex polygons with holes to obtain multiple polygons without holes. Therefore, how to provide a map data processing method to efficiently achieve the segmentation of complex polygons with holes has become an urgent problem to be solved. Summary of the invention
[0003] In view of this, the present application provides a method, device and computer program product for processing map data, so as to efficiently segment complex polygons with holes.
[0004] This application provides the following solutions:
[0005] In a first aspect, a method for processing map data is provided, the method comprising:
[0006] Acquire map data, wherein the map data includes a polygonal area, and the polygonal area includes at least one hole area;
[0007] Generate a cutting line for the polygonal area, wherein the cutting line enters the polygonal area from a point on the outer contour of the polygonal area, passes through inner points of each hole area in sequence, and exits the polygonal area from another point on the outer contour of the polygonal area;
[0008] Constructing an Euler graph using the cutting line and the cutting results of the outer contour and the inner contour of the polygonal area by the cutting line;
[0009] extracting a plurality of subrings from the Euler graph;
[0010] Output the area information respectively constituted by the multiple sub-rings.
[0011] In a second aspect, a map data processing device is provided, the device comprising:
[0012] A data acquisition unit configured to acquire map data, wherein the map data includes a polygonal area, and the polygonal area includes at least one hole area;
[0013] a cutting line generating unit, configured to generate a cutting line for the polygonal area, wherein the cutting line penetrates into the polygonal area from a point on the outer contour of the polygonal area, sequentially passes through inner points of each hole area, and passes out of the polygonal area from another point on the outer contour of the polygonal area;
[0014] A graph construction unit is configured to construct an Euler graph using the cutting line and the cutting result of the outer contour and the inner contour of the polygonal area by the cutting line;
[0015] A graph search unit configured to extract a plurality of subrings from the Euler graph;
[0016] The data output unit is configured to output the area information respectively constituted by the multiple sub-rings.
[0017] In a third aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the steps of any one of the methods in the first aspect are implemented.
[0018] In a fourth aspect, an electronic device is provided, including:
[0019] one or more processors; and
[0020] A memory associated with the one or more processors, the memory being used to store program instructions, wherein the program instructions, when read and executed by the one or more processors, execute the steps of the method described in any one of the first aspects above.
[0021] According to a fifth aspect, a computer program product is provided, comprising a computer program, wherein a processor executes the steps of any one of the methods described in the first aspect.
[0022] According to the specific embodiments provided in this application, this application discloses the following technical effects:
[0023] This application converts the polygonal area with holes into the form of an Euler graph by means of cutting lines, extracts multiple subrings from the Euler graph, and thus divides the polygonal area with holes into multiple areas without holes. In other words, this application converts the hole cutting problem into a graph traversal problem by constructing cutting lines. There is no need to traverse each edge of the polygonal area to construct faces, nor is there a need to determine the inclusion relationship between the faceting result and the polygonal area, thus avoiding a large amount of calculation of the spatial relationship between lines and faces. Therefore, compared with traditional faceting algorithms, the amount of calculation is greatly reduced, the processing efficiency is improved, and the impact on system performance is reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in 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 paying creative work.
[0025] Figure 1 is a system architecture diagram applicable to the embodiments of the present application;
[0026] Figure 2 A flowchart of a method for processing map data provided in an embodiment of the present application;
[0027] Figure 3 A schematic diagram of a complex polygon with a hole provided in an embodiment of the present application;
[0028] Figure 4 A schematic diagram of a cutting line provided in an embodiment of the present application;
[0029] Figure 5a A schematic diagram of a directed edge set corresponding to a first type of label provided in an embodiment of the present application;
[0030] Figure 5b A schematic diagram of a directed edge set corresponding to a second type of label provided in an embodiment of the present application;
[0031] Figure 5c A schematic diagram of a directed edge set corresponding to a third type of label provided in an embodiment of the present application;
[0032] Figure 5d A schematic diagram of an Euler diagram provided in an embodiment of the present application;
[0033] Figure 6 A flow chart of traversing an Euler graph using a group label avoidance method provided in an embodiment of the present application;
[0034] Figure 7 A schematic diagram of adjacent successor edges provided in an embodiment of the present application;
[0035] Figure 8 A schematic diagram of a region formed by one of the sub-rings provided in an embodiment of the present application;
[0036] Fig. 9 A schematic diagram of a region segmentation result provided in an embodiment of the present application;
[0037] Fig.10 A schematic block diagram of a map data processing device provided in an embodiment of the present application;
[0038] Fig.11 A schematic block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0039] 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. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0040] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.
[0041] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0042] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0043] The traditional method of processing map data for hole scenes uses a faceting algorithm. The faceting algorithm needs to traverse each vertex of the polygon to construct a face to obtain multiple sub-polygons. It also needs to determine the inclusion relationship between each sub-polygon and the original polygon, introducing a large number of calculations of spatial relationships between lines and faces. Since the number of polygon vertices involved in the map data is usually large, reaching tens of thousands, and involves a large number of calculations of vector products, azimuths, etc., using a faceting algorithm to process map data will result in low efficiency and may even lead to performance issues such as timeouts, false freezes, and memory overflows.
[0044] In view of this, the present application provides a new idea. In order to facilitate the understanding of the present application, the system architecture on which the present application is based is first described. Figure 1 An exemplary system architecture to which the embodiments of the present application can be applied is shown. Figure 1 As shown in , the system architecture may include: a user terminal and a server running on a user terminal.
[0045] The server provides map services to users, such as providing map data to the user terminal in response to service requests from the user terminal, providing navigation services, traffic information (including traffic conditions of road sections), etc. to the user terminal.
[0046] The user end can request map-related services from the server end based on the user's operation events, receive map data, navigation data, traffic information, etc. returned by the server end, and display them to the user through a map page. As one of the achievable methods, the user end can display traffic information on a map page using the method provided in the embodiment of the present application, which will be described in detail in subsequent embodiments.
[0047] The user end may be a client running on a user terminal, a small program, or a Web application running through a browser.
[0048] User terminals may include, but are not limited to, smart mobile terminals, wearable devices, PCs (Personal Computers), etc. Smart mobile devices may include mobile phones, tablet computers, PDAs (Personal Digital Assistants), Internet car terminals, etc. Wearable devices may include smart watches, smart glasses, smart bracelets, VR (Virtual Reality) devices, AR (Augmented Reality), mixed reality devices (i.e., devices that can support both virtual reality and augmented reality), etc.
[0049] The server can be an independent server, a server group, or a cloud server. A cloud server, also known as a cloud computing server or cloud host, is a host product in the cloud computing service system to solve the defects of difficult management and weak service scalability in traditional physical hosts and virtual private servers (VPS) services.
[0050] As one possible implementation method, the server may first process the map data using the method provided in the embodiment of the present application, and then send the processed map data to the rendering engine of the user terminal for rendering. The specific processing method may refer to the description in the subsequent embodiments.
[0051] As another achievable method, the server sends the map data to the client, and the client processes the map data using the method provided in the embodiment of the present application, and sends the processed map data to the rendering engine for rendering. The specific processing method can be found in the records of the subsequent embodiments.
[0052] In addition to sending the processed map data to the rendering engine for rendering, it can also be used in other scenarios, such as building map models.
[0053] It should be understood that Figure 1 The number of servers, clients and user terminals in the embodiment is only for illustration. Any number of servers, clients and user terminals may be provided according to implementation requirements.
[0054] Figure 2 This is a flow chart of a method for processing map data provided in an embodiment of the present application. Figure 2 As shown in , the method may include the following steps:
[0055] Step 201: Acquire map data, where the map data includes a polygonal area, and the polygonal area includes at least one hole area.
[0056] Step 203: Generate a cutting line for the polygonal area. The cutting line enters the polygonal area from a point on the outer contour of the polygonal area, passes through the inner points of each hole area in sequence, and exits the polygonal area from another point on the outer contour of the polygonal area.
[0057] Step 205: Construct an Euler graph using the cutting lines and the cutting results of the outer contour and inner contour of the polygonal area by the cutting lines.
[0058] Step 207: extract multiple subrings from the Euler graph.
[0059] Step 209: Output the area information respectively constituted by the multiple sub-rings.
[0060] It can be seen from the above process that the present application converts the polygonal area with holes into the form of an Euler graph by means of cutting lines, and obtains multiple subrings by searching the Euler graph, thereby dividing the polygonal area with holes into multiple areas without holes. In other words, the present application transforms the hole cutting problem into a graph traversal problem by constructing cutting lines. There is no need to traverse each edge of the polygonal area to construct faces, nor is there a need to determine the inclusion relationship between the faceting result and the polygonal area, thus avoiding a large amount of calculation of the spatial relationship between lines and faces. Therefore, compared with traditional faceting algorithms, the amount of calculation is greatly reduced, the processing efficiency is improved, and the impact on system performance is reduced.
[0061] The following is a detailed description of each step in the above process and the effects that can be further produced in conjunction with the embodiments. It should be noted that the "first" and "second" limitations involved in the present disclosure do not have limitations in terms of size, order, and quantity, and are only used to distinguish them in name, for example, "first preset duration" and "second preset duration" are used to distinguish two preset durations.
[0062] First, the above step 201, namely “obtaining map data”, is described in detail in conjunction with the embodiment.
[0063] Due to the complexity of the shape and distribution of geographical areas, holes often appear in the produced map data. For example, islands appear in the polygonal area corresponding to the ocean, artificial lakes appear in the polygonal area corresponding to the park, and so on. In map data, polygonal areas are often complex polygons, and most of them are complex concave polygons, which have a large number of vertices and edges, even tens of thousands of edges, and contain one or more irregular holes.
[0064] Usually in a complex polygon with holes, the polygon area and the hole area belong to different area types. For example, in the above example, the polygon area belongs to the ocean area type, and the hole area belongs to the island area type; the polygon area belongs to the park area type, and the hole area belongs to the artificial lake area type; and so on. Different area types usually need to be rendered in different colors in the map data, for example, the ocean area type is rendered in blue, the island area type is rendered in brown, and so on.
[0065] To facilitate understanding, let's take an example. Figure 3 The polygonal area shown in is a complex concave polygon, which consists of more than 10,000 vertices and edges, and contains four hole areas, A, B, C and D. If the complex polygonal area is directly provided to the rendering engine for rendering, the rendering engine cannot process it. Usually, the rendering engine can only render polygonal areas without holes. Therefore, it is necessary to render the polygonal area with holes (i.e. Figure 3 The orange part in the middle) is divided into multiple sub-polygonal areas without holes.
[0066] The above step 203, namely "generating cutting lines for polygonal areas", is described in detail below in conjunction with an embodiment.
[0067] In the embodiment of the present application, the generated cutting line needs to meet the following conditions: penetrate the polygonal area from a point on the outer contour of the polygonal area, pass through the inner points of each hole area in sequence (that is, it needs to pass through each hole in the polygon to form a cut), and pass out of the polygonal area from another point on the outer contour of the polygonal area. The above-mentioned "passing through" means passing through the interior of the area, and cannot be geometrically collinear, tangent, or separated.
[0068] In this step, the circumscribed rectangle of the polygonal area may be first determined, and the first point and the second point outside the polygonal area may be determined by using the circumscribed rectangle; starting from the first point, the inner points of each hole area may be connected in sequence according to a preset order until the inner point of the last hole area, and then the inner point of the last hole area may be connected to the second point to form a cutting line. The first point and the second point may allow the switching line to pass through each hole area only once, for example, the first point and the second point may be located at opposite corners of the circumscribed rectangle, respectively.
[0069] As one possible way to achieve this, Figure 4 As shown in , first determine the circumscribed rectangle of the polygonal area; then expand the sides of the circumscribed rectangle respectively to obtain the expanded rectangle. When expanding the sides of the circumscribed rectangle respectively, the expansion can be a preset distance or a preset ratio. For example, the expansion is 5% based on the center point of the circumscribed rectangle.
[0070] Starting from the first vertex of the expansion rectangle, the inner points of each hole area are connected in sequence according to a preset order until the inner point of the last hole area, and then the inner point of the last hole area is connected to the second vertex of the expansion rectangle to form a cutting line.
[0071] It should be noted that the purpose of expanding the sides of the circumscribed rectangle is to ensure that the cutting line penetrates the polygonal area from the outer contour of the polygonal area. However, in the actual processing process, the expansion can be omitted and the inner points of each hole area can be connected in sequence starting from the first vertex of the circumscribed rectangle.
[0072] The inner point refers to a point inside the hole region, which is not located on the outline of the hole region and is completely surrounded by the outline of the hole region. It should be noted that in the embodiment of the present application, the outline of the hole region is essentially the inner outline of the polygonal region.
[0073] The first vertex and the second vertex of the above-mentioned outward-expanding rectangle are respectively located at the opposite corners of the outward-expanding rectangle. Figure 4 As shown in , the first vertex is the vertex of the lower left corner of the expanded rectangle, and the second vertex is the vertex of the upper right corner of the expanded rectangle. When connecting the inner points of each hole area in sequence, the coordinates corresponding to each inner point on the X-axis can be arranged in ascending order, or the coordinates corresponding to each inner point on the Y-axis can be arranged in ascending order, etc.
[0074] It should be noted that, as one of the achievable methods, the first vertex and the inner point of the hole region, the inner points of the hole region, and the inner points of the hole region and the second vertex are all connected by straight line segments, such as Figure 4As shown by the red cutting line in the middle. As another achievable method, the first vertex and the inner point of the hole area, the inner points of the hole area, and the inner point of the hole area and the second vertex can also be connected by a curve segment, but the curve segment needs to ensure that it only passes through each hole area once. Since the straight line segment connection method can effectively ensure that the cutting line only passes through the hole area once, the calculation is simple, so the straight line segment connection method is preferred.
[0075] The above step 205, namely "constructing an Euler graph by using cutting lines and the cutting results of the outer contour and the inner contour of the polygonal area by the cutting lines", is described in detail below in conjunction with the embodiments.
[0076] An Euler graph is an undirected or directed graph in which a closed path can be found that passes through each edge in the graph only once. Such a path is called an Euler circuit. A graph with an Euler circuit is an Euler graph. The degrees of all vertices in an Euler graph are even numbers. An Euler graph can be divided into multiple subrings, and each subring is a valid Euler circuit.
[0077] In order to facilitate the subsequent traversal of the Euler graph to split the subrings, in the embodiment of the present application, when constructing the Euler graph, directed edges are used for construction. The directed edges used to construct the Euler graph include: the cutting result obtained by cutting the outer contour of the polygonal area by the cutting line, the cutting result obtained by cutting the inner contour of the polygonal area by the cutting line, and the cutting result obtained by cutting the outer contour and inner contour of the polygonal area by the cutting line.
[0078] As one of the feasible methods, the outer contour of the polygonal area is cut by the cutting line to obtain the directed edge set of the first type of label; the inner contour of the polygonal area is cut by the cutting line to obtain the directed edge set of the second type of label; the line segments located between the different types of edges in the cutting line are used to obtain the directed edge set of the third type of label; the directed edges in the directed edge set of the third type of label are copied, the directions of the copied directed edges are flipped and then added to the directed edge set of the third type of label; and then the directed edge set of the first type of label, the directed edge set of the second type of label and the directed edge set of the third type of label are used to construct a directed graph, and the obtained directed graph is an Euler graph.
[0079] The directions of the directed edges in the directed edge set of the first type of label and the directed edge set of the second type of label are opposite. For example, the directions of the directed edges in the directed edge set of the first type of label are counterclockwise, and the directions of the directed edges in the directed edge set of the second type of label are clockwise; or, the directions of the directed edges in the directed edge set of the first type of label are clockwise, and the directions of the directed edges in the directed edge set of the second type of label are counterclockwise.
[0080] For example Figure 5a As shown in , when the outer contour of the polygonal area is cut by the cutting line to obtain the segments of the edges, the intersection of the outer contour of the polygonal area and the cutting line can be determined. As shown in the figure, there are 6 intersections between the outer contour of the polygonal area and the cutting line. The outer contours between the adjacent intersections are the segments of the edges obtained by cutting: e1, e2, e3, ..., e7, a total of 7 edges, and the direction of each segment of the edge is defined in a clockwise direction according to the connection relationship. The directed edges obtained by cutting are different from the original edges of the polygonal area. A directed edge obtained by cutting may be composed of multiple original edges. e1, e2, e3, ..., e7 constitute the directed edge set E1, and each directed edge in E1 is marked with the first type label: label1.
[0081] For example Figure 5b As shown in , when the inner contour of the polygonal area is cut by the cutting line to obtain the segments, the intersection of the inner contour of the polygonal area (i.e., the contour of the hole area) can be determined. As shown in the figure, there are 8 intersections between the inner contour of the polygonal area and the cutting line. The inner contours between the adjacent intersections are the segments of the edges obtained by cutting: d1, d2, d3, ..., d8, a total of 8 edges, and the direction of each segment of the edge is defined in the counterclockwise direction according to the connection relationship. d1, d2, d3, ..., d8 constitute a directed edge set E2, and each directed edge in E2 is labeled with the second type of label: label2.
[0082] It should be noted that, in addition to labeling d1, d2, d3, ..., d8 with label2, each directed edge segment obtained by cutting each hole area can also be used to form a directed edge set, and each of them can be labeled with different types of labels. For example, d1 and d2 form E21, which is labeled with label21; d3 and d4 form E22, which is labeled with label22; d5 and d6 form E23, which is labeled with label23; d7 and d8 form E24, which is labeled with label24.
[0083] For example Figure 5cAs shown in , when using the line segments between the different types of edges in the cutting line, all the intersections of the cutting line with the outer contour and inner contour of the polygon are determined, and the segments of the cutting line between the different types of intersections are retained. For example, the intersection of the cutting line with the outer contour of the polygon is defined as the first type of intersection, and the intersection of the cutting line with the inner contour of the polygon is defined as the second type of intersection. Then the cutting line parts between the adjacent first type of intersection and second type of intersection are used as directed edges: c1, c2, c3, ..., c6, a total of 6 directed edges. The direction of the directed edge can be defined from far to near according to the distance from the starting point of the cutting line (i.e., the first vertex mentioned above), or from near to far according to the distance from the starting point of the cutting line. c1, c2, c3, ..., c6 constitute a directed edge set E3, and each directed edge in E3 is labeled with a third type of label: label3.
[0084] Add the directed edges in E1, E2 and E3 to the directed graph G. The vertices between the directed edges are the vertices in the directed graph G. In addition, in order to ensure that the directed graph G becomes an Euler graph, copy each directed edge in the directed edge set E3, and flip the direction of each copied directed edge to obtain b1, b2, b3, ..., b6. Then b1, b2, b3, ..., b6 are respectively labeled with the third type label label3 and added to the directed graph G, thereby obtaining an Euler graph, as shown in Figure 5d as shown in .
[0085] The above step 207, namely "extracting multiple subrings from the Euler graph", is described in detail below in conjunction with an embodiment.
[0086] As one of the feasible ways, the group label avoidance method can be used to traverse the Euler graph to obtain multiple sub-rings.
[0087] Specifically, you can Figure 6 As shown in , the following steps are included:
[0088] Step 601: Take a directed edge from the Euler graph as the starting edge to start traversal.
[0089] Step 602: query the adjacent successor edge set of the directed edge currently traversed, and select from the adjacent successor edge set a directed edge having a different type of label from the directed edge currently traversed.
[0090] The so-called adjacent successor edge of a directed edge refers to the next directed edge pointed to by the currently traversed directed edge. The currently traversed directed edge and the next directed edge connect to the same vertex. Figure 7 As shown in , for example, the adjacent successor edge set of directed edge e1 includes c1 and e2, and the adjacent successor edge set of directed edge d1 includes directed edges d2 and c6.
[0091] Take the directed edge e1 as an example, its label is label1, the label of c1 in the successor edge set is label3, the label of e2 is label1, select c1.
[0092] Step 603: The selected directed edge is used as the currently traversed directed edge.
[0093] Step 604: Determine whether the starting edge has been traversed. If yes, execute step 605; otherwise, continue to execute step 602;
[0094] Continuing with the above example, we take c1 as the currently traversed directed edge, and continue to determine that its adjacent successor edge set includes d7, the label of d7 is label2, and select d7, and then continue to take d7 as the currently traversed directed edge. And so on, until the starting edge e1 is traversed.
[0095] Step 605: Record each traversed directed edge as a subring, and delete each traversed directed edge from the Euler graph.
[0096] After traversing to the starting edge e1, each directed edge traversed is recorded as a subring, such as Figure 8 As shown in the figure, the area enclosed by the sub-ring is shown as the green part in the figure.
[0097] Step 606: Determine whether all directed edges of the Euler graph have been traversed. If so, execute step 607; otherwise, continue to execute step 601.
[0098] Step 607: Output the sub-ring and end the process.
[0099] After all directed edges are traversed, all subrings in the Euler graph can be obtained, so that Figure 2 In step 209, the area information of each sub-ring is output. Fig. 9 As shown in the figure, the areas formed by the sub-rings in the final output are shown in green, pink and blue. It can be seen that the complex polygon with holes is divided into three areas without holes.
[0100] It should be noted that, in addition to the above-mentioned group label avoidance method, other search algorithms such as DFS (depth-first search) may also be used to traverse the Euler graph to obtain multiple subrings.
[0101] After obtaining the area information respectively constituted by each sub-ring in the manner provided by the above-mentioned embodiment of the present application, it can be applied to a variety of scenarios. As one of the scenarios, the area information respectively constituted by each sub-ring can be output to the rendering engine. For example, the area information respectively constituted by each sub-ring and the color representation information of the corresponding polygonal area can be provided to the rendering engine, so that the rendering engine can render the areas respectively constituted by each sub-ring belonging to the same polygonal area as specified colors. Among them, the color representation information may include RGB (red, green, blue) color representation, YUV (brightness, chroma) color representation, HSV (hue, saturation, brightness) color representation, etc.
[0102] As another scenario, the area information formed by each sub-ring can be output to the modeling device. For example, the modeling device can use the area information formed by each sub-ring to establish a map model. The established map model can be a two-dimensional model or a three-dimensional model.
[0103] After testing, under the same test conditions, the processing method provided by the embodiment of the present application can improve the system performance by 10 to 15 times compared with the processing method of the traditional faceting algorithm. And as the complexity of the polygon increases, the effect is more obvious.
[0104] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0105] According to an embodiment of another aspect, a device for processing map data is provided. Fig.10 A schematic block diagram of a map data processing device provided in an embodiment of the present application. Fig.10 As shown, the device 1000 may include: a data acquisition unit 1001, a cutting line generation unit 1002, a graph construction unit 1003, a graph search unit 1004 and a data output unit 1005. The main functions of each component unit are as follows:
[0106] The data acquisition unit 1001 is configured to acquire map data, where the map data includes a polygonal area, and the polygonal area includes at least one hole area.
[0107] The cutting line generating unit 1002 is configured to generate a cutting line for the polygonal area. The cutting line enters the polygonal area from a point on the outer contour of the polygonal area, passes through the inner points of each hole area in sequence, and passes out of the polygonal area from another point on the outer contour of the polygonal area.
[0108] The graph construction unit 1003 is configured to construct an Euler graph using cutting lines and the cutting results of the outer contour and the inner contour of the polygonal area by the cutting lines.
[0109] The graph search unit 1004 is configured to extract multiple subrings from the Euler graph.
[0110] The data output unit 1005 is configured to output area information respectively constituted by the multiple sub-rings.
[0111] As one of the achievable methods, the cutting line generation unit 1002 can be specifically configured as: determining the circumscribed rectangle of the polygonal area; using the circumscribed rectangle to determine the first point and the second point outside the polygonal area; starting from the first point, connecting the inner points of each hole area in sequence according to a preset order until the inner point of the last hole area, and then connecting the inner point of the last hole area to the second point to form a cutting line, and the first point and the second point make the cutting line pass through each hole area only once.
[0112] As one achievable manner, the first point and the inner point, the inner points and the inner point and the second point are all connected by straight line segments.
[0113] As one of the achievable methods, the graph construction unit 1003 can be specifically configured as follows: using the edge segments obtained by cutting the outer contour of the polygonal area by the cutting line to obtain a directed edge set of the first type of label, using the edge segments obtained by cutting the inner contour of the polygonal area by the cutting line to obtain a directed edge set of the second type of label, using the line segments located between the edges of different types in the cutting line to obtain a directed edge set of the third type of label; using the directed edge set of the first type of label, the directed edge set of the second type of label and the directed edge set of the third type of label to construct an Euler graph.
[0114] As one of the achievable methods, when the graph construction unit 1003 constructs an Euler graph using a directed edge set of a first type of label, a directed edge set of a second type of label, and a directed edge set of a third type of label, it can be specifically configured as follows: constructing a directed graph using a directed edge set of a first type of label, a directed edge set of a second type of label, and a directed edge set of a third type of label; copying each directed edge in the edge set of the third type of label, flipping the direction of each copied directed edge, marking each directed edge obtained after flipping the direction with a third type of label and adding them to the directed graph, so that the resulting directed graph is an Euler graph.
[0115] As one achievable manner, the directions of the directed edges in the directed edge set of the first type of label are counterclockwise, and the directions of the directed edges in the directed edge set of the second type of label are clockwise.
[0116] As another achievable manner, the directions of the directed edges in the directed edge set of the first type of label are clockwise, and the directions of the directed edges in the directed edge set of the second type of label are counterclockwise.
[0117] As one of the achievable ways, the graph search unit 1004 may be specifically configured to: traverse the Euler graph of the data output unit using a group label avoidance method to obtain a plurality of sub-rings.
[0118] As one of the feasible ways, when the graph search unit 1004 uses the group label avoidance method to traverse the Euler graph and obtains multiple sub-rings, it can be specifically configured as follows: taking out a directed edge from the Euler graph as the starting edge to start traversal; querying the set of adjacent successor edges of the currently traversed directed edge, and selecting a directed edge with a different type of label from the currently traversed directed edge from the adjacent successor edge set; taking the selected directed edge as the currently traversed directed edge, and continuing to execute the step of querying the set of adjacent successor edges of the currently traversed directed edge until the starting edge is traversed; recording each traversed directed edge as a sub-ring, and deleting each traversed directed edge from the Euler graph, and continuing to execute the step of taking out a directed edge from the Euler graph as the starting edge to start traversal, until all directed edges of the Euler graph are traversed.
[0119] As one of the achievable ways, the data output unit 1005 can output the area information respectively constituted by the multiple sub-rings to the rendering engine, so that the rendering engine can render the areas respectively constituted by the multiple sub-rings.
[0120] As another achievable manner, the data output unit 1005 may output the area information respectively constituted by the multiple sub-rings to the modeling device, so that the modeling device can use the area information respectively constituted by the multiple sub-rings to establish a map model.
[0121] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the unit described as a separate component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.
[0122] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0123] In addition, an embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps of any one of the methods in the aforementioned method embodiments are implemented.
[0124] And an electronic device, comprising:
[0125] one or more processors; and
[0126] A memory associated with the one or more processors, the memory being used to store program instructions, wherein the program instructions, when read and executed by the one or more processors, execute the steps of the method described in any one of the aforementioned method embodiments.
[0127] The present application also provides a computer program product, including a computer program, which implements the steps of any one of the methods in the aforementioned method embodiments when executed by a processor.
[0128] in, Fig.11 The architecture of the electronic device is shown as an example, which may include a processor 1110, a video display adapter 1111, a disk drive 1112, an input / output interface 1113, a network interface 1114, and a memory 1120. The processor 1110, the video display adapter 1111, the disk drive 1112, the input / output interface 1113, the network interface 1114, and the memory 1120 may be communicatively connected via a communication bus 1130.
[0129] Among them, the processor 1110 can be implemented by a general-purpose CPU, a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, etc., to execute relevant programs to implement the technical solutions provided in this application.
[0130] The memory 1120 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1120 can store an operating system 1121 for controlling the operation of the electronic device 1100, and a basic input and output system (BIOS) 1122 for controlling the low-level operation of the electronic device 1100. In addition, a web browser 1123, a data storage management system 1124, and a map data processing device 1000, etc. can also be stored. The above-mentioned map data processing device 1000 can be an application program that specifically implements the operations of the aforementioned steps in the embodiment of the present application. In short, when the technical solution provided by the present application is implemented by software or firmware, the relevant program code is stored in the memory 1120 and is called and executed by the processor 1110.
[0131] The input / output interface 1113 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0132] The network interface 1114 is used to connect to a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).
[0133] The bus 1130 comprises a pathway for transmitting information between the various components of the device (eg, the processor 1110 , the video display adapter 1111 , the disk drive 1112 , the input / output interface 1113 , the network interface 1114 , and the memory 1120 ).
[0134] It should be noted that, although the above device only shows a processor 1110, a video display adapter 1111, a disk drive 1112, an input / output interface 1113, a network interface 1114, a memory 1120, a bus 1130, etc., in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include components necessary for implementing the solution of the present application, and does not necessarily include all the components shown in the figure.
[0135] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be essentially or partly contributed to the prior art in the form of a computer program product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.
[0136] The technical solution provided by the present application is described in detail above. The principle and implementation method of the present application are described in detail using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present application.
Claims
1. A method for processing map data, characterized in that: The method comprises: Acquire map data, wherein the map data includes a polygonal area, and the polygonal area includes at least one hole area; Generate a cutting line for the polygonal area, wherein the cutting line enters the polygonal area from a point on the outer contour of the polygonal area, passes through inner points of each hole area in sequence, and exits the polygonal area from another point on the outer contour of the polygonal area; Constructing an Euler graph using the cutting line and the cutting results of the outer contour and the inner contour of the polygonal area by the cutting line; extracting a plurality of subrings from the Euler graph; Output the area information respectively constituted by the multiple sub-rings.
2. The method according to claim 1, characterized in that Generating a cutting line for the polygonal area includes: Determine the circumscribed rectangle of the polygonal area; Determine a first point and a second point outside the polygonal area using the circumscribed rectangle; Starting from the first point, connecting the inner points of each hole area in sequence according to a preset order until the inner point of the last hole area, and then connecting the inner point of the last hole area to the second point to form the cutting line; The first point and the second point enable the cutting line to pass through each hole area only once.
3. The method according to claim 2, characterized in that The first point and the inner point, the inner points and the inner point and the second point are all connected by straight line segments.
4. The method according to claim 1, characterized in that Using the cutting line and the cutting result of the outer contour and the inner contour of the polygonal area by the cutting line, constructing the Euler graph includes: Using the edge segments obtained by cutting the outer contour of the polygonal area by the cutting line, a directed edge set of the first type of label is obtained; Using the edge segments obtained by cutting the inner contour of the polygonal area by the cutting line, a directed edge set of the second type of label is obtained; Using each line segment between different types of edges in the cutting line, a directed edge set of a third type of label is obtained; each directed edge in the directed edge set of the third type of label is copied, and each directed edge obtained by copying is flipped in direction and then added to the directed edge set of the third type of label; A directed graph is constructed using the directed edge set of the first type of labels, the directed edge set of the second type of labels, and the directed edge set of the third type of labels, and the resulting directed graph is an Euler graph.
5. The method according to claim 4, characterized in that The directions of the directed edges in the directed edge set of the first type of labels are counterclockwise, and the directions of the directed edges in the directed edge set of the second type of labels are clockwise; or, The directions of the directed edges in the directed edge set of the first type of tags are clockwise, and the directions of the directed edges in the directed edge set of the second type of tags are counterclockwise.
6. The method according to claim 4 or 5, characterized in that: Extracting a plurality of subrings from the Euler graph comprises: The Euler graph is traversed using a group label avoidance method to obtain a plurality of subrings.
7. The method according to claim 6, characterized in that The method of traversing the Euler graph by using the group label avoidance method to obtain multiple subrings includes: Take a directed edge from the Euler graph as the starting edge to start traversal; Querying a set of adjacent successor edges of a currently traversed directed edge, and selecting a directed edge having a different type of label from the currently traversed directed edge from the adjacent successor edge set; The selected directed edge is used as the directed edge currently traversed, and the step of querying the set of adjacent successor edges of the directed edge currently traversed is continued until the starting edge is traversed; Each directed edge traversed is recorded as a subring, and each directed edge traversed is deleted from the Euler graph, and the step of taking a directed edge from the Euler graph as a starting edge to start traversal is continued until all directed edges of the Euler graph are traversed.
8. The method according to any one of claims 1 to 5, characterized in that Outputting the area information respectively formed by the multiple sub-rings includes: Outputting the area information respectively constituted by the plurality of sub-rings to a rendering engine, so that the rendering engine renders the areas respectively constituted by the plurality of sub-rings; or, The area information respectively formed by the plurality of sub-rings is output to a modeling device, so that the modeling device can use the area information respectively formed by the plurality of sub-rings to establish a map model.
9. A map data processing device, characterized in that: The device comprises: A data acquisition unit configured to acquire map data, wherein the map data includes a polygonal area, and the polygonal area includes at least one hole area; a cutting line generating unit, configured to generate a cutting line for the polygonal area, wherein the cutting line penetrates into the polygonal area from a point on the outer contour of the polygonal area, sequentially passes through inner points of each hole area, and passes out of the polygonal area from another point on the outer contour of the polygonal area; A graph construction unit is configured to construct an Euler graph using the cutting line and the cutting result of the outer contour and the inner contour of the polygonal area by the cutting line; A graph search unit configured to extract a plurality of subrings from the Euler graph; The data output unit is configured to output the area information respectively constituted by the multiple sub-rings.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.