Vector file generation method and apparatus, electronic device, and readable storage medium
Patent Information
- Application Number
- CN202210956182.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-10
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2042-08-10
AI Technical Summary
[0003]本申请的主要目的在于提供一种矢量文件生成方法、装置、电子设备及可读存储介质,旨在解决矢量对象合并效果差的技术问题
[0067]本申请提供了一种矢量文件生成方法、装置、电子设备及可读存储介质,首先将各矢量对象的头尾点为标识点,分别确定与各所述标识点距离最近的最近标识点其中,所述标识点和对应的最近标识点归属于不同的矢量对象,从而获取每一所述标识点在各所述最近标识点中的出现次数,根据各所述出现次数,生成各所述标识点共同对应的合并顺序链,实现了依据各标识点作为其他标识点的最近标识点的次数,规划各标点的合并顺序,从而根据所述合并顺序链,即可将各所述矢量对象进行顺序合并,得到目标矢量文件,该目标矢量文件中的各矢量对象将会处于顺序连接状态,也即各矢量对象将会依据合并顺序链连接为单一矢量对象,所以克服了目前通过mapinfo等软件进行线段合并,但是对于合并保存的矢量文件,其中所包含的对象数据通过并未按照顺序进行排序,也即当前合并保存的矢量文件中的对象数据处于乱序状态,而导致矢量对象合并的效果较差的技术缺陷,提升了矢量对象合并的效果。
Smart Images

Figure CN117633940B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer-aided computing technology, and in particular to a vector file generation method, apparatus, electronic device, and readable storage medium. Background Technology
[0002] In practical engineering, vector files are often used in calculations. Currently, when merging vector objects, software such as MapInfo is usually used to merge line segments. However, the object data contained in the merged and saved vector file is not sorted in order, meaning that the object data in the currently merged and saved vector file is in a disordered state, resulting in poor vector object merging performance. Summary of the Invention
[0003] The main purpose of this application is to provide a method, apparatus, electronic device and readable storage medium for generating vector files, aiming to solve the technical problem of poor vector object merging effect.
[0004] To achieve the above objectives, this application provides a vector file generation method, the vector file generation method comprising:
[0005] Using the endpoints of each vector object as marker points, determine the nearest marker point to each marker point, wherein the marker point and the corresponding nearest marker point belong to different vector objects;
[0006] Obtain the occurrence count of each of the aforementioned identifiers among the nearest identifiers, and generate a merged order chain corresponding to all the aforementioned identifiers based on the occurrence counts.
[0007] According to the merging order chain, the vector objects are sequentially merged to obtain the target vector file.
[0008] Optionally, the step of generating a merged sequence chain corresponding to each of the aforementioned identifiers based on their occurrence counts includes:
[0009] Based on the occurrence frequency of each of the aforementioned points, the starting point and ending point of the current sequence chain are selected from the aforementioned identifier points, and the starting point is taken as the current sequence node.
[0010] Determine whether there exists a first target marker point among the marker points that belongs to the same vector object as the current sequential node;
[0011] If it exists, the first target identifier is added to the current sequence chain as the next node of the current sequence node, and the current sequence node is updated to the first target identifier.
[0012] If it does not exist, the nearest identifier corresponding to the current sequential node is added to the current sequential chain as the next node of the current sequential node, and the current sequential node is updated to the nearest identifier.
[0013] Return to the execution steps: Determine whether there is a first target marker point among the marker points that belongs to the same vector object as the current sequence node, until the current sequence node is detected as the termination point, and use the current sequence chain as the merged sequence chain.
[0014] Optionally, the step of filtering the start and end points of the current sequence chain from the identified points according to the occurrence frequency of each of the aforementioned points includes:
[0015] Among all the identified points, the identified points that appear zero times are selected as the endpoints of the first instance object;
[0016] If the number of endpoints of each first instance object is greater than the preset number of endpoints, then the endpoints of each first instance object that belong to the same vector object are discarded;
[0017] Select the start point and the end point from the remaining endpoints of the first instance object;
[0018] If the number of endpoints of each first instance object is not greater than the preset number of endpoints, then the starting point and the ending point are selected from the endpoints of each first instance object.
[0019] Optionally, the step of adding the nearest identifier corresponding to the current sequential node as the next node to the current sequential node in the current sequential chain includes:
[0020] Among the identified nodes, determine the nearest identified point corresponding to the current sequential node to obtain the second target identified point;
[0021] If the node direction from the current sequence node to the second target identifier changes, then the second target identifier is removed from each of the identifier nodes, and the process returns to the following step: determine the nearest identifier corresponding to the current sequence node among each of the identifier nodes to obtain the second target identifier.
[0022] If the node direction from the current sequential node to the second target identifier point has not changed, then the second target identifier point is added to the current sequential chain as the next node of the current sequential node.
[0023] Optionally, after the step of determining the nearest identifier point corresponding to the current sequential node among each of the identifier nodes to obtain the second target identifier point, the vector file generation method further includes:
[0024] Obtain the deflection angle from the current sequential node to the second target identifier point;
[0025] If the deflection angle is greater than a preset deflection angle threshold, it is determined that the node direction from the current sequential node to the second target identifier has changed;
[0026] If the deflection angle is not greater than the preset deflection angle threshold, it is determined that the node direction from the current sequence node to the second target identifier point has not changed.
[0027] Optionally, the step of sequentially merging the vector objects according to the merging order chain to obtain the target vector file includes:
[0028] The order in which each vector object is added is determined based on the merge order chain.
[0029] The order in which object nodes are added is determined based on the order of the head and tail nodes of each vector object in the merged sequence chain.
[0030] Based on the order in which the objects and nodes were added, the object nodes of each vector object were sequentially added to the merge node list to obtain the target vector file.
[0031] Optionally, the step of determining the nearest marker point to each of the marker points, wherein the marker point and the corresponding nearest marker point belong to different vector objects, includes:
[0032] Determine each candidate marker point within a preset distance range of the marker point, wherein the marker point and the corresponding candidate marker point belong to different vector objects;
[0033] Based on the distance between the marker point and each of the candidate marker points, the nearest marker point that is closest to the marker point is selected from among the candidate marker points.
[0034] This application also provides a vector file generation apparatus, the vector file generation apparatus comprising:
[0035] The determination module is used to identify the head and tail points of each vector object as marker points, and to determine the nearest marker point that is closest to each marker point, wherein the marker point and the corresponding nearest marker point belong to different vector objects;
[0036] The sequence chain generation module is used to obtain the number of times each of the aforementioned identifiers appears in each of the nearest identifiers, and generate a merged sequence chain corresponding to each of the aforementioned identifiers based on the number of occurrences.
[0037] The vector file generation module is used to sequentially merge the vector objects according to the merging order chain to obtain the target vector file.
[0038] Optionally, the sequence chain generation module is further configured to:
[0039] Based on the occurrence frequency of each of the aforementioned points, the starting point and ending point of the current sequence chain are selected from the aforementioned identifier points, and the starting point is taken as the current sequence node.
[0040] Determine whether there exists a first target marker point among the marker points that belongs to the same vector object as the current sequential node;
[0041] If it exists, the first target identifier is added to the current sequence chain as the next node of the current sequence node, and the current sequence node is updated to the first target identifier.
[0042] If it does not exist, the nearest identifier corresponding to the current sequential node is added to the current sequential chain as the next node of the current sequential node, and the current sequential node is updated to the nearest identifier.
[0043] Return to the execution steps: Determine whether there is a first target marker point among the marker points that belongs to the same vector object as the current sequence node, until the current sequence node is detected as the termination point, and use the current sequence chain as the merged sequence chain.
[0044] Optionally, the sequence chain generation module is further configured to:
[0045] Among all the identified points, the identified points that appear zero times are selected as the endpoints of the first instance object;
[0046] If the number of endpoints of each first instance object is greater than the preset number of endpoints, then the endpoints of each first instance object that belong to the same vector object are discarded;
[0047] Select the start point and the end point from the remaining endpoints of the first instance object;
[0048] If the number of endpoints of each first instance object is not greater than the preset number of endpoints, then the starting point and the ending point are selected from the endpoints of each first instance object.
[0049] Optionally, the sequence chain generation module is further configured to:
[0050] Among the identified nodes, determine the nearest identified point corresponding to the current sequential node to obtain the second target identified point;
[0051] If the node direction from the current sequence node to the second target identifier changes, then the second target identifier is removed from each of the identifier nodes, and the process returns to the following step: determine the nearest identifier corresponding to the current sequence node among each of the identifier nodes to obtain the second target identifier.
[0052] If the node direction from the current sequential node to the second target identifier point has not changed, then the second target identifier point is added to the current sequential chain as the next node of the current sequential node.
[0053] Optionally, the sequence chain generation module is further configured to:
[0054] Obtain the deflection angle from the current sequential node to the second target identifier point;
[0055] If the deflection angle is greater than a preset deflection angle threshold, it is determined that the node direction from the current sequential node to the second target identifier has changed;
[0056] If the deflection angle is not greater than the preset deflection angle threshold, it is determined that the node direction from the current sequence node to the second target identifier point has not changed.
[0057] Optionally, the vector file generation module is further configured to:
[0058] The order in which each vector object is added is determined based on the merge order chain.
[0059] The order in which object nodes are added is determined based on the order of the head and tail nodes of each vector object in the merged sequence chain.
[0060] Based on the order in which the objects and nodes were added, the object nodes of each vector object were sequentially added to the merge node list to obtain the target vector file.
[0061] Optionally, the determining module is further configured to:
[0062] Determine each candidate marker point within a preset distance range of the marker point, wherein the marker point and the corresponding candidate marker point belong to different vector objects;
[0063] Based on the distance between the marker point and each of the candidate marker points, the nearest marker point that is closest to the marker point is selected from among the candidate marker points.
[0064] This application also provides an electronic device, which is a physical device, comprising: a memory, a processor, and a program for the vector file generation method stored in the memory and executable on the processor. When the program for the vector file generation method is executed by the processor, it can implement the steps of the vector file generation method as described above.
[0065] This application also provides a computer-readable storage medium storing a program implementing a vector file generation method, wherein when the program is executed by a processor, it implements the steps of the vector file generation method as described above.
[0066] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the vector file generation method described above.
[0067] This application provides a vector file generation method, apparatus, electronic device, and readable storage medium. First, the head and tail points of each vector object are designated as marker points. The nearest marker point to each marker point is determined, wherein the marker point and its corresponding nearest marker point belong to different vector objects. The number of times each marker point appears among the nearest marker points is obtained. Based on the number of occurrences, a merging order chain corresponding to all marker points is generated. This realizes the planning of the merging order of marker points based on the number of times each marker point is the nearest marker point to other marker points. Therefore, according to the merging order chain, the vector objects can be sequentially merged to obtain a target vector file. The vector objects in this target vector file will be in a sequentially connected state, meaning they will be connected into a single vector object according to the merging order chain. This overcomes the technical defect of current line segment merging software such as MapInfo, where the object data in the merged and saved vector file is not sorted in order, resulting in poor vector object merging performance. This method improves the effectiveness of vector object merging. Attached Figure Description
[0068] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0069] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0070] Figure 1 This is a flowchart illustrating the first embodiment of the vector file generation method of this application;
[0071] Figure 2 This is a schematic diagram showing the distribution of each vector object in the vector file generation method of this application;
[0072] Figure 3 This is a table illustrating the method for generating vector files in this application, which calculates the nearest marker point for each marker point.
[0073] Figure 4 This is a table illustrating the number of times each marker appears in the most recent punctuation mark in the vector file generation method of this application.
[0074] Figure 5 This is a flowchart illustrating the second embodiment of the vector file generation method of this application;
[0075] Figure 6 This is a schematic diagram of an embodiment of the vector file generation method of this application, in which there are interfering vector objects among the vector objects.
[0076] Figure 7 This is a flowchart illustrating the third embodiment of the vector file generation method of this application;
[0077] Figure 8 This is a schematic diagram illustrating the situation where vector objects are duplicated in the vector file generation method of this application.
[0078] Figure 9 This is a schematic diagram showing when vector objects partially overlap in the vector file generation method of this application.
[0079] Figure 10 This is a schematic diagram of the device structure according to an embodiment of the vector file generation apparatus of this application;
[0080] Figure 11 This is a schematic diagram of the device structure of the hardware operating environment involved in the vector file generation method in this application embodiment.
[0081] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0082] To make the above-mentioned objectives, features, and advantages of this application more apparent and understandable, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0083] Reference Figure 1 This application provides a vector file generation method. In a first embodiment of the vector file generation method, the vector file generation method includes:
[0084] Step S10: Take the endpoints of each vector object as marker points, and determine the nearest marker point that is closest to each marker point, wherein the marker point and the corresponding nearest marker point belong to different vector objects;
[0085] Step S20: Obtain the number of times each of the aforementioned identifiers appears in each of the nearest identifiers, and generate a merged order chain that is common to each of the aforementioned identifiers based on the number of occurrences.
[0086] Step S30: According to the merging sequence chain, the vector objects are sequentially merged to obtain the target vector file.
[0087] In this embodiment, it should be noted that the vector object can be a polyline segment with direction information, and the vector object includes at least one object node, with the object nodes at both ends of the vector object being the endpoints of the vector object. The vector file generation method can be applied to route mapping auxiliary software, such as railway route mapping or highway route mapping.
[0088] As an example, steps S10 to S30 include: numbering each vector object to obtain a vector object number; identifying the endpoints of each vector object according to the vector object number and the node order of each vector object to obtain an identifier point; determining the nearest other identifier point for each identifier point to obtain the nearest identifier point corresponding to each identifier point; obtaining the occurrence count of each identifier point among the nearest identifier points; filtering start and end points among the identifier points according to the occurrence count; determining sequential connection points between the start and end points among the identifier points according to the distance relationship between the identifier points and the vector object affiliation relationship; using the sequential chain formed by the start point, the sequential connection points, and the end point as the merged sequential chain; and adding the object nodes in each vector object to the node list according to the merged sequential chain and the node order within each vector object to merge the vector objects and obtain the target vector file. The distance relationship is used to characterize whether one marker point is the nearest marker point to another marker point, and the vector object affiliation relationship is used to characterize whether two marker points belong to the same vector object.
[0089] As an example, refer to Figure 2There are 5 vector objects, A, B, C, D, and E. A has two markers, A_0 and A_1; B has two markers, B_0 and B_1; C has two markers, C_0 and C_1; D has two markers, D_0 and D_1; and E has two markers, E_0 and E_1. Further refer to... Figure 3 The nearest marker to each marker can be determined. The nearest marker to A_0 is B_0, the nearest marker to A_1 is B_0, the nearest marker to B_0 is A_1, the nearest marker to B_1 is C_1, the nearest marker to C_0 is E_1, the nearest marker to C_1 is B_1, the nearest marker to D_0 is E_0, the nearest marker to D_1 is E_0, the nearest marker to E_0 is D_0, and the nearest marker to E_1 is C_0. Further reference... Figure 4 This allows us to count the number of times each marker appears in the nearest marker. The marker with a zero occurrence count can be used as the starting point and the ending point. Thus, if A_0 is used as the starting point and D_1 as the ending point, the merged sequence chain A_0-A_1-B_0-B_1-C_1-C_0-E_1-E_0-D_0-D_1 can be obtained based on the distance relationship between the markers and the vector object affiliation relationship.
[0090] As an example, the step of filtering the start and end points among the identified points based on the frequency of occurrence of each point includes:
[0091] Based on the occurrence frequency of each of the aforementioned markers, markers with an occurrence frequency of zero are selected from each of the aforementioned markers; a starting point is arbitrarily selected from the markers with an occurrence frequency of zero, and another marker with an occurrence frequency of zero other than the starting point is selected as the ending point, wherein the number of markers with an occurrence frequency of zero is usually 2.
[0092] As an example, each vector object includes existing vector objects and vector objects to be merged. The step of sequentially merging the vector objects according to the merging order chain to obtain the target vector file includes:
[0093] Based on the existing vector objects, according to the node arrangement order in the merging sequence chain, the object nodes of each vector object to be merged are added sequentially to the node list of the existing vector objects to obtain the target vector file.
[0094] As an example, the target vector file includes a merged single vector object, and after step S30, it further includes:
[0095] If the endpoint distance between the endpoints of the merged single vector object and the endpoints of other unmerged vector objects is greater than a preset endpoint distance threshold, then the vector object merging is considered complete. If not, the merged single vector object is treated as an existing vector object, and the other unmerged vector objects are treated as vector objects to be merged. Then, the process returns to step S10 until the endpoint distance between the endpoints of the merged single vector object and the endpoints of other unmerged vector objects is detected to be greater than the preset endpoint distance threshold.
[0096] The step of generating a merged sequence chain corresponding to each of the aforementioned identifiers based on their occurrence frequency includes:
[0097] Step S21: Based on the occurrence frequency of each of the above, filter the starting point and ending point of the current sequence chain from the above marker points, and take the starting point as the current sequence node;
[0098] Step S22: Determine whether there is a first target marker point among the marker points that belongs to the same vector object as the current sequential node;
[0099] Step S23: If it exists, add the first target identifier as the next node of the current sequence node to the current sequence chain, and update the current sequence node to the first target identifier.
[0100] Step S24: If it does not exist, add the nearest identifier corresponding to the current sequential node as the next node of the current sequential node to the current sequential chain, and update the current sequential node to the nearest identifier.
[0101] Step S25, return to the execution steps: determine whether there is a first target identifier point among the identifier points that belongs to the same vector object as the current sequence node, until the current sequence node is detected as the termination point, and use the current sequence chain as the merged sequence chain.
[0102] As an example, steps S21 to S25 include: selecting markers with an occurrence count of zero from among the markers based on the occurrence counts, and using the starting point as the starting point and ending point of the current sequence chain; determining whether there is a first target marker belonging to the same vector object as the current sequence node among the markers; if there is a first target marker belonging to the same vector object as the current sequence node, adding the first target marker as the next node of the current sequence node to the current sequence chain, and updating the current sequence node to the first target marker; if there is no first target marker belonging to the same vector object as the current sequence node, adding the nearest marker corresponding to the current sequence node as the next node of the current sequence node to the current sequence chain, and updating the current sequence node to the nearest marker; returning to the execution step: determining whether there is a first target marker belonging to the same vector object as the current sequence node among the markers, until the current sequence node is detected as the ending point, and using the current sequence chain as the merged sequence chain. This application embodiment realizes that the connection order between each marker point is determined according to the distance relationship between the marker points and whether each marker point belongs to the same vector object, and a merging order chain is obtained. Then, according to the merging order chain and the node order inside each vector object, each vector object can be merged into a single vector object by connecting the object nodes in each vector object in sequence.
[0103] The step of sequentially merging the vector objects according to the merging order chain to obtain the target vector file includes:
[0104] Step S31: Determine the object addition order of each vector object according to the merge order chain;
[0105] Step S32: Determine the node addition order of object nodes in each vector object according to the head and tail node order of each vector object in the merging sequence chain;
[0106] Step S33: Based on the order in which the objects were added and the order in which the nodes were added, the object nodes of each vector object are added to the merge node list in sequence to obtain the target vector file.
[0107] In this embodiment, it should be noted that the target vector file can be a list of nodes composed of object nodes in each vector object, and the merging order chain is used to characterize the addition order in which all object nodes in each vector object are added to the node list.
[0108] As an example, steps S31 to S32 include: using the arrangement order of the identifier points of each vector object in the merging sequence chain as the object addition order of all object nodes in that vector object; determining the node addition order of the object nodes in each vector object according to the head and tail node order of each vector object in the merging sequence chain; and adding the object nodes in each vector object to the merging node list in sequence according to the object addition order and the node addition order to obtain the target vector file.
[0109] As an example, the step of determining the node addition order of object nodes in each vector object based on the head and tail node order of each vector object in the merged order chain includes:
[0110] If the head and tail nodes of the vector object in the merged sequence chain are in the order from head node to tail node, then the node addition order of the object nodes in the vector object is in ascending order; if the head and tail nodes of the vector object in the merged sequence chain are in the order from tail node to head node, then the node addition order of the object nodes in the vector object is in descending order. Assume ascending order means the node addition order is the same as the order of the merged sequence chain, and descending order means the node addition order is the opposite of the order of the merged sequence chain. For example, assuming the merged sequence chain is A_0-A_1-B_0-B_1-C_1-C_0-E_1-E_0-D_0-D_1, then the node addition order of the vector objects corresponding to A_0-A_1, B_0-B_1, and D_0-D_1 is ascending order, while the node addition order of the vector objects corresponding to C_1-C_0 and E_1-E_0 is descending order.
[0111] The step of determining the nearest marker point to each of the marker points, wherein the marker point and its corresponding nearest marker point belong to different vector objects, includes:
[0112] Step S11: Determine each candidate marker point within a preset distance range of the marker point, wherein the marker point and the corresponding candidate marker point belong to different vector objects;
[0113] Step S12: Based on the distance between the marker point and each of the candidate marker points, select the nearest marker point that is closest to the marker point from among the candidate marker points.
[0114] As an example, steps S11 to S12 include: determining each candidate marker point within a preset distance range of the marker point, wherein the marker point and the corresponding candidate marker point belong to different vector objects; calculating the distance between the marker point and each candidate marker point to obtain the distance of each marker point; and selecting the nearest marker point from among the candidate marker points based on the distance of each marker point. This embodiment of the application filters candidate marker points by setting a preset distance range, which can prevent marker points that are too far away from being selected as the nearest marker point, and also prevent previously selected marker points from being added back to the merging order chain, thereby preventing disorder in the merging order chain. For example, suppose there are vector objects A, B, and C. A has two markers, A_0 and A_1; B has two markers, B_0 and B_1; C has two markers, C_0 and C_1; and D has two markers, D_0 and D_1. The nearest marker to A_1 is B_0. The distance between B_1 and A_1 is less than the distance between B_1 and D_0. If no preset distance range is set, A_1 will be used as the nearest marker to B_1 again. A_1, B_0, and B_1 will form a closed loop, resulting in A_0-A_1-B_0-B_1-A_1, which prevents the formation of a sequence chain and causes disorder in the merging sequence chain. If a preset distance range is set, D_0 and D_1 will not be added to the merging sequence chain, and A_1 will not be added to the sequence chain repeatedly. This will result in the merging sequence chain being A_0-A_1-B_0-B_1.
[0115] This application provides a vector file generation method. First, the head and tail points of each vector object are designated as marker points. The nearest marker point to each marker point is determined, where each marker point and its nearest marker point belong to different vector objects. The number of times each marker point appears among the nearest marker points is obtained. Based on these occurrences, a merging order chain is generated, corresponding to all marker points. This method plans the merging order of marker points based on the number of times each marker point is the nearest marker point to other marker points. According to the merging order chain, the vector objects can be sequentially merged to obtain a target vector file. The vector objects in this target vector file will be in a sequentially connected state, meaning they will be connected into a single vector object according to the merging order chain. This overcomes the technical defect of current line segment merging software such as MapInfo, where the object data in the merged and saved vector file is not sorted in order, resulting in poor merging performance. This method improves the merging effect of vector objects.
[0116] In another embodiment of this application, content that is the same as or similar to the above embodiment can be referred to the above description, and will not be repeated hereafter. Based on this, refer to Figure 5 The step of filtering the start and end points of the current sequence chain from the identified points according to the occurrence frequency of each of the aforementioned points includes:
[0117] Step S21: Select the marker points that appear zero times from among the marker points as the endpoints of the first instance object;
[0118] Step S22: If the number of endpoints of each first instance object is greater than the preset number of endpoints, then discard the endpoints of each first instance object that belong to the same vector object.
[0119] Step S23: Select the start point and the end point from the remaining endpoints of the first instance object;
[0120] Step S24: If the number of endpoints of each first instance object is not greater than the preset number of endpoints, then select the start point and the end point from each of the first instance object endpoints.
[0121] In this embodiment, it should be noted that in actual cartographic processes, interfering vector objects often affect the accuracy of the cartography, such as reference vectors. Figure 6 When there is an interference vector object F, there are 4 marker points with a zero occurrence count. In this case, the marker points with a zero occurrence count cannot be directly used as the starting point and the ending point.
[0122] As an example, steps S21 to S24 include: selecting markers that appear zero times from each of the markers as endpoints of the first instance object; if the number of endpoints of each first instance object is greater than a preset number of endpoints, it proves that there are interfering vector objects in each of the vector objects, discarding endpoints belonging to the same vector object from each of the first instance object endpoints, arbitrarily selecting the starting point from the remaining endpoints of each first instance object, and using the remaining endpoints of the first instance object other than the starting point as the ending point; if the number of endpoints of each first instance object is not greater than the preset number of endpoints, it proves that there are no interfering vector objects in each of the vector objects, arbitrarily selecting the starting point from each of the first instance object endpoints, and using the endpoints of the first instance object other than the starting point as the ending point. For example, further refer to Figure 6 , Figure 6The endpoints of the first instance object that appear zero times are A_0, D_1, F_0 and F_1. F_0 and F_1 both belong to vector object F. Therefore, vector object F is an interference vector object. F_0 and F_1 need to be discarded from A_0, D_1, F_0 and F_1 to obtain two remaining endpoints of the first instance object, A_0 and D_1, which can be used as the starting point and the ending point, respectively.
[0123] This application provides a method for removing interfering vector objects. Specifically, it involves selecting markers that appear zero times from each set of markers as endpoints of a first instance object. If the number of endpoints of each first instance object is greater than a preset number of endpoints, endpoints belonging to the same vector object are discarded. A start point and an end point are selected from the remaining first instance object endpoints. If the number of endpoints of each first instance object is not greater than the preset number of endpoints, a start point and an end point are selected from the remaining first instance object endpoints. In other words, if two markers appearing zero times among the most recent markers belong to the same vector object, this vector object can be determined as an interfering vector object. Discarding the endpoints of this interfering vector object removes its interference with vector file generation, ensuring the accuracy and reliability of the vector file generation process.
[0124] In another embodiment of this application, content that is the same as or similar to the above embodiment can be referred to the above description, and will not be repeated hereafter. Based on this, refer to Figure 7 The step of adding the nearest identifier corresponding to the current sequential node as the next node to the current sequential chain includes:
[0125] Step S241: Determine the nearest identifier point corresponding to the current sequential node among each of the identifier nodes to obtain the second target identifier point;
[0126] Step S242: If the node direction from the current sequence node to the second target identifier changes, then the second target identifier is removed from each of the identifier nodes, and the process returns to the execution step: determine the nearest identifier corresponding to the current sequence node among each of the identifier nodes to obtain the second target identifier.
[0127] Step S243: If the node direction from the current sequential node to the second target identifier point has not changed, then the second target identifier point is added to the current sequential chain as the next node of the current sequential node.
[0128] In this embodiment, it should be noted that during the circuit drawing process, node data duplication often occurs between vector objects. If the vector objects are directly merged, the number of nodes in the merged single vector object will be duplicated, which will affect the accuracy of the description of the merged single vector object. As an example, refer to Figure 8 , Figure 8 If vector objects C and D are duplicates, then vector A should be merged with vector object C, but not with vector object D. (Refer to...) Figure 9 In the figure, the two vector objects partially overlap, that is, object nodes 4 to 5 overlap with object nodes 6 to 8.
[0129] As an example, steps S243 to S244 include: determining the nearest marker point corresponding to the current sequence node among each of the marker nodes, and taking the nearest marker point corresponding to the current sequence node as the second target marker point; determining whether the node direction from the current sequence node to the second target marker point has changed based on the first coordinate value of the current sequence node and the second coordinate value of the second target marker point; if the node direction from the current sequence node to the second target marker point has changed, then determining that the second target marker point is a turning point, removing the second target marker point from each of the marker nodes, and returning to the execution step: determining the nearest marker point corresponding to the current sequence node among each of the marker nodes to obtain the second target marker point; if the node direction from the current sequence node to the second target marker point has not changed, then determining that the second target marker point is not a turning point, and adding the second target marker point as the next node of the current sequence node to the current sequence chain.
[0130] After the step of determining the nearest identifier point corresponding to the current sequential node among each of the identifier nodes to obtain the second target identifier point, the vector file generation method further includes:
[0131] Step A10: Obtain the deflection angle from the current sequential node to the second target identifier point;
[0132] Step A20: If the deflection angle is greater than a preset deflection angle threshold, it is determined that the node direction from the current sequence node to the second target identifier point has changed.
[0133] Step A30: If the deflection angle is not greater than the preset deflection angle threshold, it is determined that the node direction from the current sequence node to the second target identifier point has not changed.
[0134] As an example, steps A10 to A30 include: calculating the deflection angle from the current sequential node to the second target marker point based on the coordinate deviation between the first coordinate value of the current sequential node and the second coordinate value of the second target marker point; if the deflection angle is greater than a preset deflection angle threshold, then the second target marker point is determined to be a turning point, and the node direction from the current sequential node to the second target marker point changes; if the deflection angle is not greater than the preset deflection angle threshold, then the second target marker point is determined not to be a turning point, and the node direction from the current sequential node to the second target marker point does not change. As an example, the preset deflection angle threshold can be 90 degrees.
[0135] This application provides a vector file generation method, which involves determining the nearest identifier point corresponding to the current sequential node among each of the identifier nodes to obtain a second target identifier point; if the node direction from the current sequential node to the second target identifier point changes, the second target identifier point is removed from each of the identifier nodes, and the process returns to the execution step: determining the nearest identifier point corresponding to the current sequential node among each of the identifier nodes to obtain a second target identifier point; if the node direction from the current sequential node to the second target identifier point does not change, the second target identifier point is added to the current sequential chain as the next node of the current sequential node. In this embodiment, the method detects whether the nearest marker corresponding to the current sequential node is a turnaround point by determining whether the node direction between the current sequential node and the corresponding nearest marker has changed. This detects whether the current sequential node and the corresponding nearest marker are duplicate nodes. If they are duplicates, the nearest marker is discarded. If they are not duplicates, the nearest marker is added to the merged sequence chain and then added to the object node list. Therefore, it can avoid adding duplicate example object node data or overlapping object nodes to the merged sequence chain for merging, thereby ensuring the accuracy and reliability of the description of the single vector object obtained after merging.
[0136] Reference Figure 10 This application also provides a vector file generation apparatus, the vector file generation apparatus comprising:
[0137] The determination module is used to identify the head and tail points of each vector object as marker points, and to determine the nearest marker point that is closest to each marker point, wherein the marker point and the corresponding nearest marker point belong to different vector objects;
[0138] The sequence chain generation module is used to obtain the number of times each of the aforementioned identifiers appears in each of the nearest identifiers, and generate a merged sequence chain corresponding to each of the aforementioned identifiers based on the number of occurrences.
[0139] The vector file generation module is used to sequentially merge the vector objects according to the merging order chain to obtain the target vector file.
[0140] Optionally, the sequence chain generation module is further configured to:
[0141] Based on the occurrence frequency of each of the aforementioned points, the starting point and ending point of the current sequence chain are selected from the aforementioned identifier points, and the starting point is taken as the current sequence node.
[0142] Determine whether there exists a first target marker point among the marker points that belongs to the same vector object as the current sequential node;
[0143] If it exists, the first target identifier is added to the current sequence chain as the next node of the current sequence node, and the current sequence node is updated to the first target identifier.
[0144] If it does not exist, the nearest identifier corresponding to the current sequential node is added to the current sequential chain as the next node of the current sequential node, and the current sequential node is updated to the nearest identifier.
[0145] Return to the execution steps: Determine whether there is a first target marker point among the marker points that belongs to the same vector object as the current sequence node, until the current sequence node is detected as the termination point, and use the current sequence chain as the merged sequence chain.
[0146] Optionally, the sequence chain generation module is further configured to:
[0147] Among all the identified points, the identified points that appear zero times are selected as the endpoints of the first instance object;
[0148] If the number of endpoints of each first instance object is greater than the preset number of endpoints, then the endpoints of each first instance object that belong to the same vector object are discarded;
[0149] Select the start point and the end point from the remaining endpoints of the first instance object;
[0150] If the number of endpoints of each first instance object is not greater than the preset number of endpoints, then the starting point and the ending point are selected from the endpoints of each first instance object.
[0151] Optionally, the sequence chain generation module is further configured to:
[0152] Among the identified nodes, determine the nearest identified point corresponding to the current sequential node to obtain the second target identified point;
[0153] If the node direction from the current sequence node to the second target identifier changes, then the second target identifier is removed from each of the identifier nodes, and the process returns to the following step: determine the nearest identifier corresponding to the current sequence node among each of the identifier nodes to obtain the second target identifier.
[0154] If the node direction from the current sequential node to the second target identifier point has not changed, then the second target identifier point is added to the current sequential chain as the next node of the current sequential node.
[0155] Optionally, the sequence chain generation module is further configured to:
[0156] Obtain the deflection angle from the current sequential node to the second target identifier point;
[0157] If the deflection angle is greater than a preset deflection angle threshold, it is determined that the node direction from the current sequential node to the second target identifier has changed;
[0158] If the deflection angle is not greater than the preset deflection angle threshold, it is determined that the node direction from the current sequence node to the second target identifier point has not changed.
[0159] Optionally, the vector file generation module is further configured to:
[0160] The order in which each vector object is added is determined based on the merge order chain.
[0161] The order in which object nodes are added is determined based on the order of the head and tail nodes of each vector object in the merged sequence chain.
[0162] Based on the order in which the objects and nodes were added, the object nodes of each vector object were sequentially added to the merge node list to obtain the target vector file.
[0163] Optionally, the determining module is further configured to:
[0164] Determine each candidate marker point within a preset distance range of the marker point, wherein the marker point and the corresponding candidate marker point belong to different vector objects;
[0165] Based on the distance between the marker point and each of the candidate marker points, the nearest marker point that is closest to the marker point is selected from among the candidate marker points.
[0166] The vector file generation apparatus provided in this application, employing the vector file generation method described in the above embodiments, solves the technical problem of poor vector object merging effect. Compared with the prior art, the beneficial effects of the vector file generation apparatus provided in this application are the same as those of the vector file generation method described in the above embodiments, and other technical features in this vector file generation apparatus are the same as those disclosed in the previous embodiment method, and will not be repeated here.
[0167] This application provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform the vector file generation method in the first embodiment described above.
[0168] The following is for reference. Figure 11 The diagram illustrates a structural schematic of an electronic device suitable for implementing embodiments of the present disclosure. The electronic devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 11 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0169] like Figure 11 As shown, an electronic device may include a processing unit (such as a central processing unit, graphics processing unit, etc.) that can perform various appropriate actions and processes based on a program stored in read-only memory (ROM) or a program loaded from a storage device into random access memory (RAM). The RAM also stores various programs and data required for the operation of the electronic device. The processing unit, ROM, and RAM are interconnected via a bus. Input / output (I / O) interfaces are also connected to the bus.
[0170] Typically, the following systems can be connected to the I / O interface: input devices including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices including, for example, magnetic tapes, hard disks, etc.; and communication devices. Communication devices allow electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although electronic devices with various systems are shown in the figures, it should be understood that it is not required to implement or possess all the systems shown. More or fewer systems may be implemented alternatively.
[0171] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from a storage device, or installed from a ROM. When the computer program is executed by a processing device, it performs the functions defined above in the methods of embodiments of this disclosure.
[0172] The electronic device provided in this application uses the vector file generation method in the above embodiments, which solves the technical problem of poor vector object merging effect. Compared with the prior art, the beneficial effects of the electronic device provided in this application are the same as those of the vector file generation method provided in Embodiment 1 above, and other technical features of the electronic device are the same as those disclosed in the method of the previous embodiment, and will not be repeated here.
[0173] It should be understood that various parts of this disclosure can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics may be combined in any suitable manner in one or more embodiments or examples.
[0174] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0175] This embodiment provides a computer-readable storage medium having computer-readable program instructions stored thereon, which are used to execute the vector file generation method in Embodiment 1 above.
[0176] The computer-readable storage medium provided in this application embodiment may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0177] The aforementioned computer-readable storage medium may be included in an electronic device or may exist independently without being assembled into an electronic device.
[0178] The aforementioned computer-readable storage medium carries one or more programs. When the aforementioned one or more programs are executed by an electronic device, the electronic device causes the following: taking the endpoints of each vector object as marker points, determining the nearest marker point to each marker point, wherein the marker point and the corresponding nearest marker point belong to different vector objects; obtaining the number of occurrences of each marker point among the nearest marker points, generating a merge order chain corresponding to each marker point based on the number of occurrences; and sequentially merging the vector objects according to the merge order chain to obtain a target vector file.
[0179] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0180] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0181] The modules described in the embodiments of this disclosure can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0182] The computer-readable storage medium provided in this application stores computer-readable program instructions for executing the above-described vector file generation method, thus solving the technical problem of poor vector object merging effect. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application embodiment are the same as the beneficial effects of the vector file generation method provided in the above embodiments, and will not be repeated here.
[0183] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the vector file generation method described above.
[0184] The computer program product provided in this application solves the technical problem of poor vector object merging effect. Compared with the prior art, the beneficial effects of the computer program product provided in the embodiments of this application are the same as the beneficial effects of the vector file generation method provided in the above embodiments, and will not be repeated here.
[0185] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent scope of this application.
Claims
1. A method for generating vector files, characterized in that, The vector file generation method is applied to railway or highway route mapping, and the vector file generation method includes: The endpoints of each vector object are used as marker points. Each candidate marker point is determined within a preset distance range of the marker point. The vector object is a polyline segment with direction information. The marker point and the corresponding candidate marker point belong to different vector objects. Based on the distance between the marker point and each candidate marker point, the nearest marker point that is closest to the marker point is selected from among the candidate marker points. Obtain the occurrence count of each of the aforementioned identifiers among the nearest identifiers. Based on the occurrence counts, filter the start and end points of the current sequence chain among the identifiers and use the start point as the current sequence node. Determine whether there exists a first target marker point among the marker points that belongs to the same vector object as the current sequential node; If it exists, the first target identifier is added to the current sequence chain as the next node of the current sequence node, and the current sequence node is updated to the first target identifier. If it does not exist, the nearest identifier corresponding to the current sequential node is added to the current sequential chain as the next node of the current sequential node, and the current sequential node is updated to the nearest identifier. Return to the execution steps: Determine whether there is a first target marker point among the marker points that belongs to the same vector object as the current sequence node, until the current sequence node is detected as the termination point, and use the current sequence chain as the merged sequence chain; According to the merging order chain, the vector objects are sequentially merged to obtain the target vector file; The step of adding the nearest identifier corresponding to the current sequential node as the next node to the current sequential chain includes: Among the identified nodes, determine the nearest identified point corresponding to the current sequential node to obtain the second target identified point; Obtain the deflection angle from the current sequential node to the second target identifier point; If the deflection angle is greater than the preset deflection angle threshold, it is determined that the node direction from the current sequence node to the second target identifier point has changed, the second target identifier point is removed from each of the identifier nodes, and the execution step is returned: determine the nearest identifier point corresponding to the current sequence node in each of the identifier nodes to obtain the second target identifier point; If the deflection angle is not greater than a preset deflection angle threshold, it is determined that the node direction from the current sequence node to the second target identifier point has not changed, and the second target identifier point is added to the current sequence chain as the next node of the current sequence node.
2. The vector file generation method as described in claim 1, characterized in that, The step of filtering the start and end points of the current sequence chain from the identified points according to the occurrence frequency of each point includes: Among all the identified points, the identified points that appear zero times are selected as the endpoints of the first instance object; If the number of endpoints of each first instance object is greater than the preset number of endpoints, then the endpoints of each first instance object that belong to the same vector object are discarded; Select the start point and the end point from the remaining endpoints of the first instance object; If the number of endpoints of each first instance object is not greater than the preset number of endpoints, then the starting point and the ending point are selected from the endpoints of each first instance object.
3. The vector file generation method as described in claim 1, characterized in that, The step of sequentially merging the vector objects according to the merging order chain to obtain the target vector file includes: The order in which each vector object is added is determined based on the merge order chain. The order in which object nodes are added is determined based on the order of the head and tail nodes of each vector object in the merged sequence chain. Based on the order in which the objects and nodes were added, the object nodes of each vector object were sequentially added to the merge node list to obtain the target vector file.
4. A vector file generation device, characterized in that, The vector file generation apparatus is applied to the vector file generation method according to any one of claims 1 to 3, and the vector file generation apparatus comprises: The determination module is used to take the endpoints of each vector object as marker points, determine each candidate marker point within a preset distance range of the marker points, wherein the vector object is a polyline segment with direction information, the marker point and the corresponding candidate marker point belong to different vector objects, and select the nearest marker point that is closest to the marker point from among the candidate marker points according to the distance between the marker point and each candidate marker point; The sequence chain generation module is used to obtain the occurrence count of each of the aforementioned marker points among the nearest marker points. Based on the occurrence counts, it filters the start and end points of the current sequence chain among the marker points, takes the start point as the current sequence node, and determines whether there is a first target marker point among the marker points that belongs to the same vector object as the current sequence node. If there is, it adds the first target marker point as the next node of the current sequence node to the current sequence chain and updates the current sequence node to the first target marker point. If there is no target marker point, it adds the nearest marker point corresponding to the current sequence node as the next node of the current sequence node to the current sequence chain and updates the current sequence node to the nearest marker point. The module then returns to the execution step: determining whether there is a first target marker point among the marker points that belongs to the same vector object as the current sequence node. Upon detecting that the current sequence node is the termination point, the current sequence chain is used as the merged sequence chain, and the nearest identifier point corresponding to the current sequence node is determined among the identifier nodes to obtain the second target identifier point. The deflection angle from the current sequence node to the second target identifier point is obtained. If the deflection angle is greater than a preset deflection angle threshold, it is determined that the node direction from the current sequence node to the second target identifier point has changed. The second target identifier point is removed from each of the identifier nodes, and the process returns to the execution step: determining the nearest identifier point corresponding to the current sequence node among the identifier nodes to obtain the second target identifier point. If the deflection angle is not greater than a preset deflection angle threshold, it is determined that the node direction from the current sequence node to the second target identifier point has not changed. The second target identifier point is added to the current sequence chain as the next node of the current sequence node. The vector file generation module is used to sequentially merge the vector objects according to the merging order chain to obtain the target vector file.
5. An electronic device, characterized in that, The electronic device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the steps of the vector file generation method according to any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program implementing a vector file generation method, which is executed by a processor to implement the steps of the vector file generation method as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Algorithm for realizing finding of lake center based on Voronoi graph
CN103310470A
Multi-target buffer area merging method for performing regular acceptance and rejection on each arc section
CN111274344A