Graphics element management method, device, equipment and storage medium

By establishing a tree structure in automatic recognition of CAD drawings, obtaining the current primitives and obtaining corresponding nodes from the tree structure, searching for matching primitives that match the current primitives based on the node, the low performance problem caused by traversing the entire set when matching primitives in the existing technology is solved, and efficient primitive management is achieved.

CN114443112BActive Publication Date: 2025-05-02深圳市万翼数字技术有限公司
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111664850.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-31
Publication Date
2025-05-02
Estimated Expiration
2041-12-31

AI Technical Summary

Technical Problem

In the current technology, when automatically identifying CAD drawings, brute force global traversal and screening are used, resulting in serious degradation of program performance. Especially when looking for element matching, it is necessary to traverse the entire set, which takes a lot of time.

Method used

By establishing a tree structure, obtaining the current element and obtaining the corresponding node from the tree structure, searching for matching elements matching the current element based on the node. If the current node does not save the matching element, then its adjacent nodes are obtained and the search continues.

Benefits of technology

Through the node search of the tree structure, the search range of element matching is significantly reduced, the efficiency of element management is improved, and the running time of the program is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114443112B_ABST
    Figure CN114443112B_ABST
Patent Text Reader

Abstract

The present application relates to a method, device, equipment and storage medium for managing graphic elements, which includes obtaining a current graphic element for searching; obtaining a current node storing the current graphic element from an established tree structure; and searching for a matching graphic element that matches the current graphic element based on the current node. Since the coordinate interval of the area corresponding to the current node is smaller than the coordinate interval of the drawing, searching for matching graphic elements based on the current node greatly reduces the search range, thereby improving the management efficiency of graphic elements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computers, and in particular to a graphic element management method, device, equipment and storage medium. Background Art

[0002] In the prior art, in the programming work of automatic recognition of CAD drawings, it is found that there are a large number of cases where violent global traversal and screening are used in the program, which seriously reduces the program performance.

[0003] The following beam matching problem is a typical example:

[0004] To determine the basic geometric dimensions of a beam from the flat construction drawing, at least two contour lines along the length of the beam are required (the height of the beam section is not considered here for the time being, and the height should be obtained from the centralized / in-situ annotation). In the early drawing processing, all the straight line segments that make up the beam are taken out and put into the set A. Now randomly take a line L1 from A, which is one of the two parallel contour lines of a beam. We need to find another beam line L2 that matches it from A according to some rules. Figure 1 shown.

[0005] Although L2 and L1 are close to each other, their positions in set A may be far apart. Assuming that the number of beam segments in A is N, then in the worst case, to find a beam that matches L1, it is necessary to traverse the entire set from beginning to end, which takes a long time. Summary of the invention

[0006] The present application provides a method, device, equipment and storage medium for managing graphic elements, so as to solve the problem of low efficiency of graphic element management.

[0007] In a first aspect, a method for managing graphic elements is provided, comprising:

[0008] Get the current primitive for searching;

[0009] From the established tree structure, a current node storing the current graphic element is obtained; each node in the tree structure corresponds to an area of ​​the drawing; any graphic element in the drawing is stored in a node of the tree structure, and the coordinate interval of the area corresponding to the node storing the any graphic element is the minimum coordinate interval in the tree structure that can contain the coordinates of the any graphic element;

[0010] Based on the current node, a matching primitive matching the current primitive is searched.

[0011] Optionally, based on the current node, searching for a matching primitive that matches the current primitive includes:

[0012] When it is determined that the current node does not store the matching primitive, obtaining an adjacent node of the current node;

[0013] The matching graphic element is searched from the graphic elements stored in the adjacent node, and there are two coordinate points in a colinear manner in the coordinate interval of the region corresponding to the adjacent node, and the two coordinate points are simultaneously located in the coordinate interval of the region corresponding to the current node.

[0014] Optionally, the current node saves the arbitrary graphic element according to a similarity parameter, where the similarity parameter indicates a degree of similarity between the arbitrary graphic element and a preset reference line;

[0015] Determining that the current node does not store the matching primitive includes:

[0016] Obtaining adjacent graphics elements adjacent to the current graphics element stored in the current node;

[0017] Acquire a first similarity parameter of the adjacent primitive and a second similarity parameter of the current primitive;

[0018] Calculating a parameter difference between the first similarity parameter and the second similarity parameter;

[0019] When the parameter difference is not less than the parameter threshold, it is determined that the current node does not store the matching primitive.

[0020] Optionally, the similarity parameters include:

[0021] The Hausdorff distance between any one of the graphic elements and the preset reference line.

[0022] Optionally, obtaining the adjacent nodes of the current node includes:

[0023] Get the parent node of the current node;

[0024] Get N sibling nodes of the parent node;

[0025] For any brother node among the N brother nodes, determine whether the brother node has a child node;

[0026] If so, searching for the adjacent node from the child node;

[0027] If not, the sibling node is used as the adjacent node.

[0028] In a second aspect, a method for managing graphic elements is provided, comprising:

[0029] Get M graphics elements in the drawing;

[0030] Obtaining the coordinates of each of the M graphic elements;

[0031] For any one of the M primitives, based on the coordinates of the any one primitive, a node corresponding to the any one primitive in a pre-established tree structure is determined; each node in the tree structure corresponds to an area of ​​the drawing; and the coordinate interval of the area corresponding to the node of the any one primitive is the minimum coordinate interval in the tree structure that can contain the coordinates of the any one primitive;

[0032] The arbitrary graphic element is saved in a node corresponding to the arbitrary graphic element.

[0033] Optionally, based on the coordinates of the arbitrary graphic element, determining a node corresponding to the arbitrary graphic element in a pre-established tree structure includes:

[0034] Obtaining the coordinate interval of the area corresponding to each node in the tree structure and the coordinates of the center point of any one of the graphic elements;

[0035] Searching T coordinate intervals including the coordinates of the center point from the coordinate intervals;

[0036] Obtaining a first coordinate interval with the smallest coordinate range among the T coordinate intervals, and M second coordinate intervals, wherein the nodes corresponding to the second coordinate intervals are upper-layer nodes of the nodes corresponding to the first coordinate intervals;

[0037] Determine whether any one of the graphic elements in the drawing exceeds the range of the first coordinate interval;

[0038] If not, taking the node corresponding to the first coordinate interval as the node corresponding to the any one graphic element;

[0039] If so, search the M second coordinate intervals for a target second coordinate interval that includes the endpoint coordinates of the arbitrary graphic element and has the smallest coordinate range, and use the node corresponding to the target second coordinate interval as the node corresponding to the arbitrary graphic element.

[0040] Optionally, saving the arbitrary graphic element to a node corresponding to the arbitrary graphic element includes:

[0041] Acquire a similarity parameter indicating the degree of similarity between the arbitrary graphic element and a preset reference line;

[0042] Based on the similarity parameter, determining the order in which the arbitrary graphic elements are stored in the node corresponding to the arbitrary graphic element;

[0043] The arbitrary one graphic element is saved in the node corresponding to the arbitrary one graphic element according to the saving order.

[0044] Optionally, obtaining a similarity parameter indicating the degree of similarity between any graphic element and a preset reference line includes:

[0045] Calculating the Hausdorff distance between any one of the graphic elements and the preset reference line;

[0046] The Hausdorff distance is used as the similarity parameter.

[0047] In a third aspect, a graphics element management device is provided, comprising:

[0048] A first acquisition unit, used for acquiring a current primitive for searching;

[0049] Second, from the established tree structure, a current node storing the current graphic element is obtained; each node in the tree structure corresponds to an area of ​​the drawing; any graphic element in the drawing is stored in a node of the tree structure, and the coordinate interval of the area corresponding to the node storing the any graphic element is the minimum coordinate interval in the tree structure that can contain the coordinates of the any graphic element;

[0050] The search unit is used to search for a matching primitive matching the current primitive based on the current node.

[0051] In a fourth aspect, a graphic element management device is provided, comprising:

[0052] A third acquisition unit is used to acquire M graphic elements in the drawing;

[0053] A fourth acquisition unit, used for acquiring the coordinates of each of the M graphic elements;

[0054] A determination unit is used to determine, for any one of the M primitives, a node corresponding to the arbitrary one of the primitives in a pre-established tree structure based on the coordinates of the arbitrary one of the primitives; each node in the tree structure corresponds to an area of ​​the drawing; and the coordinate interval of the area corresponding to the node of the arbitrary one of the primitives is the minimum coordinate interval in the tree structure that can contain the coordinates of the arbitrary one of the primitives;

[0055] A saving unit is used to save any one of the graphic elements to a node corresponding to the any one of the graphic elements.

[0056] In a fifth aspect, an electronic device is provided, comprising: a processor, a memory and a communication bus, wherein the processor and the memory communicate with each other via the communication bus;

[0057] The memory is used to store computer programs;

[0058] The processor is used to execute the program stored in the memory to implement the graphic element management method described in the first aspect or the second aspect.

[0059] In a sixth aspect, a computer-readable storage medium is provided, storing a computer program, wherein the computer program, when executed by a processor, implements the graphic element management method described in the first aspect or the second aspect.

[0060] The above technical solution provided by the embodiment of the present application has the following advantages over the prior art: the method provided by the embodiment of the present application obtains the current primitive for search; obtains the current node storing the current primitive from the established tree structure; searches for matching primitives matching the current primitive based on the current node. Since the coordinate interval of the area corresponding to the current node is smaller than the coordinate interval of the drawing, searching for matching primitives based on the current node greatly reduces the search range, thereby improving the management efficiency of the primitives. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0062] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0063] Figure 1 A schematic diagram of a scene of searching for a beam line L2 matching L1 from a set A in the related art;

[0064] Figure 2 A schematic diagram of a flow chart of a method for managing graphic elements provided in an embodiment of the present application;

[0065] Figure 3 A schematic diagram of the principle of mounting a certain drawing provided in an embodiment of the present application to a quadtree;

[0066] Figure 4 A schematic diagram of another process of the method for managing graphic elements provided in the embodiment of the present application;

[0067] Figure 5 A schematic diagram of the structure of a graphic element management device provided in an embodiment of the present application;

[0068] Figure 6 A schematic diagram of another structure of the graphic element management device provided in the embodiment of the present application;

[0069] Figure 7A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0070] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0071] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0072] The embodiment of the present application provides a method for managing graphic elements, which can be applied to any electronic device;

[0073] The electronic device in the embodiment of the present application may include a terminal or a server, which is not limited in the embodiment of the present application. The terminal includes various handheld devices with wireless communication functions, vehicle-mounted devices, wearable devices (such as smart watches, smart bracelets, pedometers, etc.), computing devices or other processing precisions connected to wireless modems. User Equipment (UE for short), Mobile Station (MS for short), terminal device, etc. For the convenience of description, the above-mentioned devices are collectively referred to as electronic devices.

[0074] like Figure 2 As shown, the method may include the following steps:

[0075] Step 201: Get the current primitive for searching.

[0076] It should be understood that the current primitive here can be any primitive indicated by the user. In the application, the user can indicate the current primitive by directly inputting a primitive, or can indicate a primitive from multiple primitives displayed by the electronic device as the current primitive, which is not specifically limited in this embodiment.

[0077] Any primitive in this embodiment includes but is not limited to a line segment or a point. The line segment here can be a straight line segment or a curve segment, which is not specifically limited in this embodiment.

[0078] Step 202: Obtain the current node storing the current graphic element from the established tree structure; each node in the tree structure corresponds to an area of ​​the drawing; any graphic element in the drawing is stored in a node of the tree structure, and the coordinate interval of the area corresponding to the node storing any graphic element is the minimum coordinate interval that can contain the coordinates of any graphic element in the tree structure.

[0079] The tree structure in this embodiment may be a quadtree, a KD tree, an R tree, or a binary space partition tree (BSP), etc., which is not specifically limited in this embodiment.

[0080] It should be understood that when the nodes in the tree structure correspond to the areas of the drawing, since each area corresponds to a unique coordinate interval on the drawing, each node in the tree structure corresponds to a unique coordinate interval. It should be noted that although each node corresponds to a unique coordinate interval, it does not affect the overlap or mutual inclusion of coordinate intervals corresponding to different nodes. Therefore, for any primitive in the drawing, there are at least two nodes that store the primitive.

[0081] In an example, taking the tree structure as a quadtree, the area corresponding to the root node A is the area where the drawing is located, the coordinates of the upper left corner of the drawing are (0,0), and the coordinates of the lower right corner are (1000,1000); the root node A includes four child nodes b, c, d, and e. The coordinate range of the area corresponding to the child node b is (0,0) to (500,500), the coordinate range of the area corresponding to the child node c is (500,0) to (1000,500), and so on. The coordinates of the element s in the drawing are (10,20). When saving the element s in the node of the quadtree, it can be determined based on the coordinates of the element s that the root node A or the child node b can save the element s. Since the coordinate range of the child node b is smaller than the coordinate range of the root node A, the element s is saved in the child node b.

[0082] Step 203: Based on the current node, search for a matching primitive that matches the current primitive.

[0083] In this embodiment, the matching primitive is searched from the current node first. If the matching primitive is not stored in the current node, the adjacent nodes of the current node are obtained; and the matching primitive is searched from the primitives stored in the adjacent nodes.

[0084] There are two co-linear coordinate points in the coordinate interval of the region corresponding to the adjacent nodes, and the two coordinate points are simultaneously located in the coordinate interval of the region corresponding to the current node.

[0085] It should be understood that when two coordinate points are collinear, and the two coordinate points belong to both the coordinate interval of the area corresponding to the adjacent node and the coordinate interval of the area corresponding to the current node, it means that there is an overlapping line segment between an edge of the area corresponding to the adjacent node and an edge of the area corresponding to the current node, and the overlapping line segment includes at least the line segment formed by the above-mentioned two collinear coordinate points.

[0086] It should be understood that when two graphic elements are close in length, consistent in direction, and not far apart, it indicates that the two graphic elements match.

[0087] In this embodiment, with the help of a preset reference line, it is determined whether a matching primitive is stored in the current node through the similarity between different primitives and the preset reference line.

[0088] In a specific embodiment, the current node saves any graphic element according to a similarity parameter, and the similarity parameter indicates the degree of similarity between any graphic element and a preset reference line; obtains adjacent graphic elements adjacent to the current graphic element saved in the current node; obtains a first similarity parameter of the adjacent graphic element, and a second similarity parameter of the current graphic element; calculates a parameter difference between the first similarity parameter and the second similarity parameter; and when the parameter difference is not less than a parameter threshold, determines that the current node does not save a matching graphic element.

[0089] It should be understood that when a matching primitive is stored in the current node, when the current node stores the current primitive and the matching primitive according to the indicated parameters, the current primitive and the matching primitive are adjacent in the storage order, and the parameter difference of the similarity parameter between the current primitive and the matching primitive is less than the parameter threshold. Therefore, when the first similarity parameter and the second similarity parameter are not less than the parameter threshold, it can be determined that the current node does not store a matching primitive.

[0090] It should be understood that there may be two adjacent primitives adjacent to the current primitive. In this case, it is necessary to calculate the parameter differences between the current primitive and the two adjacent primitives respectively. When both parameter differences are not less than the parameter threshold, it is determined that the current node does not save the matching primitive.

[0091] In this embodiment, the Hausdorff distance is used, but not limited to, to indicate the degree of similarity between any primitive and a preset reference line.

[0092] In this embodiment, in order to improve management efficiency, adjacent nodes are obtained from nodes in the same layer as the current node first. When there are no adjacent nodes in the same layer, adjacent nodes are obtained from nodes in the previous layer of the current node.

[0093] In a specific embodiment, the parent node of the current node is obtained; N sibling nodes of the parent node are obtained; for any sibling node among the N sibling nodes, it is determined whether the sibling node has a child node; if so, an adjacent node is searched from the child node; if not, the sibling node is used as an adjacent node.

[0094] It should be understood that when the tree structure is a quadtree, the value of N here is 3.

[0095] In the technical solution provided by the embodiment of the present application, the current primitive for search is obtained; the current node storing the current primitive is obtained from the established tree structure; and the matching primitive matching the current primitive is searched based on the current node. Since the coordinate interval of the area corresponding to the current node is smaller than the coordinate interval of the drawing, the matching primitive is searched based on the current node, which greatly reduces the search range, thereby improving the management efficiency of the primitives.

[0096] The above technical solution is explained below with an example:

[0097] See also Figure 3 , Figure 3 The schematic diagram of the principle of mounting a certain drawing to a quadtree shown in this embodiment. There are 30 primitives in the drawing, 1 to 30 (as shown in the left figure above), which have been stored in the quadtree (as shown in the right figure above). Then suppose that one of the primitives, such as primitive 30, is given, and it is hoped to find a primitive that satisfies a certain matching relationship with primitive 30. Then, using the old method, we can only traverse all 30 primitives to check one by one. Now, with the efficient query efficiency of the quadtree, we can quickly complete this query and search process. The steps are as follows:

[0098] 3.1 Find the quadtree node to which primitive 30 belongs: Starting from the quadtree root node, find the child node whose management scope includes primitive 30. Here, we will find node B, and then find the child node of B, and find the child node t whose management scope includes primitive 30. In this way, we can locate node t where primitive 30 is mounted in just three steps.

[0099] 3.2 Find the elements adjacent to element 30 for matching: In general engineering drawings, it is not difficult to conclude based on experience that if two elements can match each other (such as two parallel beam outlines), the distance between them will definitely not be very far. If we look for it from the adjacent elements of element 30, the probability of successful matching will be very high. Most of the elements adjacent to element 30 are hung under node t, such as elements 28 and 29, and a few are hung in the adjacent nodes of t. For example, element 19. At this time, these elements with greater "suspicion" are checked one by one. In the best case, it only takes two times to find the matching element. In the worst case, it is necessary to traverse 14 elements from 14 to 19, 1 to 6, and 28, 29.

[0100] Let's take the beam as an example. If the total number of beam lines is N, all of these beam lines are managed by a quadtree. If the height of the quadtree is h (the root node is also considered a layer), then the number of leaf nodes at the bottom layer is 4h-1. On average, the number of primitives contained in each leaf node can be estimated to be k = N / 4h-1. The time complexity of matching a single primitive is O(k), and if all beam lines are matched one by one, the time complexity is O(Nk), that is, O(N 2 / 4h-1), and the time cost of building the quadtree is O(NlogN), the total time complexity is O(N 2 / 4h-1+NlogN), which is better than the initial O(N 2 ) is much faster. Assuming N = 1000 and h = 3, it is calculated that the time efficiency of the two algorithms can theoretically differ by ten times. Although this is an ideal situation where the primitives are evenly distributed and the quadtree is relatively balanced, the huge difference in efficiency between the two methods is still very clear. At the same time, the Hausdorff distance is introduced for re-sorting. Two matching primitives are often very close in the set, which can further improve the efficiency of searching the primitive set under the child node. After actual application comparison tests on multiple drawings, after using quadtree for management, the search and matching rate of primitives has generally increased by more than three times, and can be as high as nearly ten times.

[0101] Based on the same inventive concept, the present application embodiment provides a primitive management method, such as Figure 4 As shown, the method may include the following steps:

[0102] Step 401, obtaining M graphic elements in the drawing;

[0103] Step 402, obtaining the coordinates of each of the M graphic elements;

[0104] Step 403: for any one of the M primitives, based on the coordinates of the any one primitive, determine a node corresponding to the any one primitive in a pre-established tree structure; each node in the tree structure corresponds to an area of ​​the drawing; the coordinate interval of the area corresponding to the node of the any one primitive is stored as the minimum coordinate interval in the tree structure that can contain the coordinates of any one primitive;

[0105] Step 404: Save any one graphic element to the node corresponding to the any one graphic element.

[0106] It should be understood that the M graphics elements here may be all graphics elements or part of the graphics elements in the drawing, that is, this embodiment implements storing all graphics elements in the drawing in a pre-established tree structure according to the coordinates of the graphics elements.

[0107] In this embodiment, the number of layers of the tree structure, the number of nodes in each layer, and the maximum number of primitives stored in each node can all be pre-set based on the drawing. Taking the tree structure as a quadtree as an example, the maximum number of layers of the quadtree is generally determined based on the maximum scale of the drawing. According to usage experience, H is 4 to 7, which can adapt to almost all drawings encountered. The maximum number of primitives contained in each node K can be estimated based on the total number of primitives in the drawing and the number of quadtree layers. According to experience, it is appropriate to take 20 to 200.

[0108] It should be understood that when the number of primitives stored in a node reaches the maximum number K, the node is split into smaller child nodes. Taking the quadtree as an example, if the number of primitives already mounted in a child node reaches the maximum number K set in the first step, the node is split into four smaller child nodes, and the primitives mounted by the current node are mounted under the four child nodes.

[0109] In this embodiment, the relationship between the graphic elements and the regions in the tree structure includes the situation that the graphic elements completely belong to one region, and the graphic elements are interspersed with multiple regions. Therefore, in order to improve the efficiency of graphic element management, the node corresponding to any graphic element is determined based on the coordinates of the center point of the graphic element.

[0110] In a specific embodiment, the coordinate intervals of the areas corresponding to each node in the tree structure and the coordinates of the center point of any graphic element are obtained; T coordinate intervals including the coordinates of the center point are searched from the coordinate intervals; the first coordinate interval with the smallest coordinate range and M second coordinate intervals are obtained from the T coordinate intervals, and the node corresponding to the second coordinate interval is the upper node of the node corresponding to the first coordinate interval; it is determined whether any graphic element in the drawing exceeds the range of the first coordinate interval; if not, the node corresponding to the first coordinate interval is used as the node corresponding to the any graphic element; if so, a target second coordinate interval with the smallest coordinate range and including the endpoint coordinates of any graphic element is searched from the M second coordinate intervals, and the node corresponding to the target second coordinate interval is used as the node corresponding to the any graphic element.

[0111] In this embodiment, it is possible to determine whether any of the graphic elements in the drawing exceeds the range of the first coordinate interval based on the length of any of the graphic elements or the endpoint coordinates of any of the graphic elements. Specifically, when the endpoint coordinates of an endpoint of any of the graphic elements do not fall within the range of the first coordinate interval, it is determined that any of the graphic elements in the drawing exceeds the range of the first coordinate interval. It should be understood that when determining whether any of the graphic elements exceeds the range of the first coordinate interval based on the length of any of the graphic elements, the endpoint coordinates of any of the graphic elements are determined based on the length and the center point coordinates, and then the endpoint coordinates are used to determine whether it exceeds the range of the first coordinate interval.

[0112] In an example, taking the tree structure as a quadtree, the coordinate range of the area corresponding to the root node A is (1000, 1000); the root node A includes four child nodes b, c, d, and e. The coordinate range of the area corresponding to the child node b is (0, 0) to (500, 500), the coordinate range of the area corresponding to the child node c is (500, 0) to (1000, 500), and so on. There is a graphic element s in the drawing whose center point coordinates are (250, 490). When saving graphic element s in the node of the quadtree, based on the center point coordinates of graphic element s, it can be determined that the coordinate interval that can include the center point coordinates of graphic element s is the coordinate interval corresponding to the root node A or the coordinate interval corresponding to the child node b, wherein the coordinate interval corresponding to the child node b is the first coordinate interval, and the coordinate interval corresponding to the root node A is the second coordinate interval. When the endpoint coordinates of graphic element s are both located in the coordinate interval corresponding to the child node b, the child node b is taken as the node corresponding to graphic element s; when there is an endpoint coordinate of graphic element s that is not located in the coordinate interval corresponding to the child node b, the root node A is taken as the node corresponding to graphic element s.

[0113] In this embodiment, in order to further improve management efficiency, when saving any graphic element to a node corresponding to any graphic element, the saving order of any graphic element can be obtained, and the graphic element can be saved in the node corresponding to any graphic element based on the saving order.

[0114] In a specific embodiment, a similarity parameter indicating the degree of similarity between any graphic element and a preset reference line is obtained; based on the similarity parameter, the storage order of any graphic element in the node corresponding to any graphic element is determined; and the graphic element is stored in the node corresponding to any graphic element according to the storage order.

[0115] In the application, similar parameters of any graphic element may be sorted with similar parameters of other graphic elements stored in a node corresponding to any graphic element, thereby determining the storage order of any graphic element.

[0116] In this embodiment, the similarity parameter includes but is not limited to the Hausdorff distance between any primitive and a preset reference line.

[0117] Based on the same concept, an embodiment of the present application provides a primitive management device. The specific implementation of the device can refer to the description of the method embodiment part, and the repeated parts will not be repeated. Figure 5 As shown, the device mainly includes:

[0118] A first acquisition unit 501 is used to acquire a current primitive for searching;

[0119] The second acquisition unit 502 is used to acquire the current node storing the current graphic element from the established tree structure; each node in the tree structure corresponds to an area of ​​the drawing; any graphic element in the drawing is stored in a node of the tree structure, and the coordinate interval of the area corresponding to the node storing any graphic element is the minimum coordinate interval that can contain the coordinates of any graphic element in the tree structure;

[0120] The searching unit 503 is used to search for a matching primitive matching the current primitive based on the current node.

[0121] Optionally, the searching unit 503 is used for:

[0122] When it is determined that the current node does not store a matching primitive, the adjacent nodes of the current node are obtained;

[0123] Search for matching primitives from primitives saved in adjacent nodes. There are two colinear coordinate points in the coordinate interval of the region corresponding to the adjacent nodes, and the two coordinate points are simultaneously located in the coordinate interval of the region corresponding to the current node.

[0124] Optionally, the current node saves any one of the primitives according to a similarity parameter, where the similarity parameter indicates the degree of similarity between any one of the primitives and a preset reference line;

[0125] The search unit 503 is used to:

[0126] Get the adjacent graphics elements stored in the current node that are adjacent to the current graphics element;

[0127] Obtaining a first similarity parameter of an adjacent primitive and a second similarity parameter of a current primitive;

[0128] calculating a parameter difference between a first similarity parameter and a second similarity parameter;

[0129] When the parameter difference is not less than the parameter threshold, it is determined that the current node does not store a matching primitive.

[0130] Optionally, similar parameters include:

[0131] The Hausdorff distance between any element and the preset reference line.

[0132] Optionally, the searching unit 503 is used for:

[0133] Get the parent node of the current node;

[0134] Get the N sibling nodes of the parent node;

[0135] For any brother node among the N brother nodes, determine whether the brother node has a child node;

[0136] If so, search for adjacent nodes from the child nodes;

[0137] If not, use the sibling nodes as adjacent nodes.

[0138] Based on the same concept, an embodiment of the present application provides a primitive management device. The specific implementation of the device can refer to the description of the method embodiment part, and the repeated parts will not be repeated. Figure 6 As shown, the device mainly includes:

[0139] The third acquisition unit 601 is used to acquire M graphic elements in the drawing;

[0140] The fourth acquisition unit 602 is used to acquire the coordinates of each of the M graphic elements;

[0141] The determining unit 603 is used to determine, for any one of the M primitives, a node corresponding to the arbitrary primitive in a pre-established tree structure based on the coordinates of the arbitrary primitive; each node in the tree structure corresponds to an area of ​​the drawing; and the coordinate interval of the area corresponding to the node of the arbitrary primitive is the minimum coordinate interval in the tree structure that can contain the coordinates of any one of the primitives;

[0142] The saving unit 604 is used to save any one of the graphic elements to the node corresponding to the any one of the graphic elements.

[0143] Optionally, the determining unit 603 is configured to:

[0144] Get the coordinate range of the area corresponding to each node in the tree structure, as well as the coordinates of the center point of any graphic element;

[0145] Find T coordinate intervals including the coordinates of the center point from the coordinate intervals;

[0146] Obtain a first coordinate interval with the smallest coordinate range among the T coordinate intervals, and M second coordinate intervals, where the nodes corresponding to the second coordinate intervals are upper-level nodes of the nodes corresponding to the first coordinate intervals;

[0147] Determine whether any element in the drawing exceeds the range of the first coordinate interval;

[0148] If not, the node corresponding to the first coordinate interval is taken as the node corresponding to any one of the graphic elements;

[0149] If so, search the M second coordinate intervals for a target second coordinate interval that includes the endpoint coordinates of any one of the graphic elements and has the smallest coordinate range, and use the node corresponding to the target second coordinate interval as the node corresponding to any one of the graphic elements.

[0150] Optionally, the storage unit 604 is used to:

[0151] Obtaining a similarity parameter indicating the degree of similarity between any graphic element and a preset reference line;

[0152] Based on the similarity parameter, determining the order in which any one of the graph elements is stored in the node corresponding to any one of the graph elements;

[0153] The primitives are saved in the nodes corresponding to any primitives in the saving order.

[0154] Optionally, the storage unit 604 is used to:

[0155] Calculate the Hausdorff distance between any primitive and the preset reference line;

[0156] The Hausdorff distance was used as the similarity parameter.

[0157] Based on the same concept, an electronic device is also provided in the embodiment of the present application, such as Figure 7 As shown, the electronic device mainly includes: a processor 701, a memory 702 and a communication bus 703, wherein the processor 701 and the memory 702 communicate with each other through the communication bus 703. The memory 702 stores a program executable by the processor 701, and the processor 701 executes the program stored in the memory 702 to implement the following steps:

[0158] Obtain the current primitive for searching; obtain the current node storing the current primitive from the established tree structure; each node in the tree structure corresponds to an area of ​​the drawing; any primitive in the drawing is stored in a node of the tree structure, and the coordinate interval of the area corresponding to the node storing any primitive is the minimum coordinate interval that can contain the coordinates of any primitive in the tree structure; based on the current node, search for a matching primitive that matches the current primitive;

[0159] or,

[0160] Get M graphics elements in the drawing; get the coordinates of each graphics element in the M graphics elements; for any graphics element in the M graphics elements, determine the node corresponding to the any graphics element in a pre-established tree structure based on the coordinates of the any graphics element; each node in the tree structure corresponds to an area of ​​the drawing; the coordinate interval of the area corresponding to the node of any graphics element is the minimum coordinate interval in the tree structure that can contain the coordinates of any graphics element; save any graphics element to the node corresponding to the any graphics element.

[0161] The communication bus 703 mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus 703 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0162] The memory 702 may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Alternatively, the memory may also be at least one storage device located away from the processor 701.

[0163] The above-mentioned processor 701 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc., and can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0164] In another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed on a computer, the computer executes the graphic element management method described in the above embodiment.

[0165] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instruction is loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instruction is transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, a data center, etc. that contains one or more available media integration. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape, etc.), an optical medium (e.g., a DVD) or a semiconductor medium (e.g., a solid-state hard disk), etc.

[0166] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0167] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for managing graphic elements, characterized in that: include: Get the current primitive for searching; From the established tree structure, obtain a current node storing the current primitive; Each node in the tree structure corresponds to an area of ​​the drawing; any graphic element in the drawing is stored in a node of the tree structure, and the coordinate interval of the area corresponding to the node storing the any graphic element is the minimum coordinate interval in the tree structure that can contain the coordinates of the any graphic element, and the coordinate interval of the area corresponding to the current node is smaller than the coordinate interval of the drawing; Based on the current node, searching for a matching primitive that matches the current primitive; The step of searching for a matching primitive that matches the current primitive based on the current node includes: When it is determined that the current node does not store the matching primitive, obtaining an adjacent node of the current node; The matching graphic element is searched from the graphic elements stored in the adjacent node, and there are two coordinate points in a colinear manner in the coordinate interval of the region corresponding to the adjacent node, and the two coordinate points are simultaneously located in the coordinate interval of the region corresponding to the current node.

2. The method according to claim 1, characterized in that: The current node saves the arbitrary graphic element according to a similarity parameter, where the similarity parameter indicates a degree of similarity between the arbitrary graphic element and a preset reference line; Determining that the current node does not store the matching primitive includes: Obtaining adjacent graphics elements adjacent to the current graphics element stored in the current node; Acquire a first similarity parameter of the adjacent primitive and a second similarity parameter of the current primitive; Calculating a parameter difference between the first similarity parameter and the second similarity parameter; When the parameter difference is not less than the parameter threshold, it is determined that the current node does not store the matching primitive.

3. The method according to claim 2, characterized in that The similar parameters include: The Hausdorff distance between any one of the graphic elements and the preset reference line.

4. The method according to claim 1, characterized in that: Obtaining the adjacent nodes of the current node includes: Get the parent node of the current node; Get N sibling nodes of the parent node; For any brother node among the N brother nodes, determine whether the brother node has a child node; If so, searching for the adjacent node from the child node; If not, the sibling node is used as the adjacent node.

5. A method for managing graphic elements, characterized in that: include: Get M graphics elements in the drawing; Obtaining the coordinates of each of the M graphic elements; For any one of the M primitives, based on the coordinates of the any one primitive, a node corresponding to the any one primitive in a pre-established tree structure is determined; each node in the tree structure corresponds to an area of ​​the drawing; and the coordinate interval of the area corresponding to the node of the any one primitive is the minimum coordinate interval in the tree structure that can contain the coordinates of the any one primitive; Saving the arbitrary graphic element to the node corresponding to the arbitrary graphic element; Wherein, the method further comprises: Get the current primitive for searching; From the established tree structure, a current node storing the current graphic element is obtained; each node in the tree structure corresponds to an area of ​​the drawing; any graphic element in the drawing is stored in a node of the tree structure, and the coordinate interval of the area corresponding to the node storing the any graphic element is the minimum coordinate interval that can contain the coordinates of the any graphic element in the tree structure, and the coordinate interval of the area corresponding to the current node is smaller than the coordinate interval of the drawing; Based on the current node, searching for a matching primitive that matches the current primitive; The step of searching for a matching primitive that matches the current primitive based on the current node includes: When it is determined that the current node does not store the matching primitive, obtaining an adjacent node of the current node; The matching graphic element is searched from the graphic elements stored in the adjacent node, and there are two coordinate points in a colinear manner in the coordinate interval of the region corresponding to the adjacent node, and the two coordinate points are simultaneously located in the coordinate interval of the region corresponding to the current node.

6. The method according to claim 5, characterized in that Determining a node corresponding to the arbitrary graphic element in a pre-established tree structure based on the coordinates of the arbitrary graphic element includes: Obtaining the coordinate interval of the area corresponding to each node in the tree structure and the coordinates of the center point of any one of the graphic elements; Searching T coordinate intervals including the coordinates of the center point from the coordinate intervals; Obtaining a first coordinate interval with the smallest coordinate range among the T coordinate intervals, and M second coordinate intervals, wherein the nodes corresponding to the second coordinate intervals are upper-layer nodes of the nodes corresponding to the first coordinate intervals; Determine whether any one of the graphic elements in the drawing exceeds the range of the first coordinate interval; If not, taking the node corresponding to the first coordinate interval as the node corresponding to the any one graphic element; If so, search the M second coordinate intervals for a target second coordinate interval that includes the endpoint coordinates of the arbitrary graphic element and has the smallest coordinate range, and use the node corresponding to the target second coordinate interval as the node corresponding to the arbitrary graphic element.

7. The method according to claim 5, characterized in that Saving the arbitrary graphic element to a node corresponding to the arbitrary graphic element includes: Acquire a similarity parameter indicating the degree of similarity between the arbitrary graphic element and a preset reference line; Determining the order in which the arbitrary graphic elements are stored in the node corresponding to the arbitrary graphic element based on the similarity parameter, wherein the similarity parameter indicates the degree of similarity between the arbitrary graphic element and a preset reference line; The arbitrary one graphic element is saved in the node corresponding to the arbitrary one graphic element according to the saving order.

8. The method according to claim 7, characterized in that Get similarity parameters indicating the degree of similarity between any element and the preset reference line, including: Calculating the Hausdorff distance between any one of the graphic elements and the preset reference line; The Hausdorff distance is used as the similarity parameter.

9. A graphic element management device, characterized in that: include: A first acquisition unit, used for acquiring a current primitive for searching; A second acquisition unit is used to acquire a current node storing the current graphic element from the established tree structure; each node in the tree structure corresponds to an area of ​​the drawing; any graphic element in the drawing is stored in a node of the tree structure, and the coordinate interval of the area corresponding to the node storing the any graphic element is the minimum coordinate interval that can contain the coordinates of the any graphic element in the tree structure, and the coordinate interval of the area corresponding to the current node is smaller than the coordinate interval of the drawing; A searching unit, configured to search for a matching primitive matching the current primitive based on the current node; The step of searching for a matching primitive that matches the current primitive based on the current node includes: When it is determined that the current node does not store the matching primitive, obtaining an adjacent node of the current node; The matching graphic element is searched from the graphic elements stored in the adjacent node, and there are two coordinate points in a colinear manner in the coordinate interval of the region corresponding to the adjacent node, and the two coordinate points are simultaneously located in the coordinate interval of the region corresponding to the current node.

10. A graphic element management device, characterized in that: include: A third acquisition unit is used to acquire M graphic elements in the drawing; A fourth acquisition unit, used for acquiring the coordinates of each of the M graphic elements; A determination unit is used to determine, for any one of the M primitives, a node corresponding to the arbitrary one of the primitives in a pre-established tree structure based on the coordinates of the arbitrary one of the primitives; each node in the tree structure corresponds to an area of ​​the drawing; and the coordinate interval of the area corresponding to the node of the arbitrary one of the primitives is the minimum coordinate interval in the tree structure that can contain the coordinates of the arbitrary one of the primitives; A saving unit, used for saving the arbitrary graphic element to a node corresponding to the arbitrary graphic element; Wherein, the graphic element management device further includes: A first acquisition unit, used for acquiring a current primitive for searching; A second acquisition unit is used to acquire a current node storing the current graphic element from the established tree structure; each node in the tree structure corresponds to an area of ​​the drawing; any graphic element in the drawing is stored in a node of the tree structure, and the coordinate interval of the area corresponding to the node storing the any graphic element is the minimum coordinate interval that can contain the coordinates of the any graphic element in the tree structure, and the coordinate interval of the area corresponding to the current node is smaller than the coordinate interval of the drawing; A searching unit, configured to search for a matching primitive matching the current primitive based on the current node; The step of searching for a matching primitive that matches the current primitive based on the current node includes: When it is determined that the current node does not store the matching primitive, obtaining an adjacent node of the current node; The matching graphic element is searched from the graphic elements stored in the adjacent node, and there are two coordinate points in a colinear manner in the coordinate interval of the region corresponding to the adjacent node, and the two coordinate points are simultaneously located in the coordinate interval of the region corresponding to the current node.

11. An electronic device, characterized in that: include: A processor, a memory and a communication bus, wherein the processor and the memory communicate with each other via the communication bus; The memory is used to store computer programs; The processor is used to execute the program stored in the memory to implement the graphic element management method described in any one of claims 1-4 or the graphic element management method described in any one of claims 5-8.

12. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the graphic element management method described in any one of claims 1 to 4 or the graphic element management method described in any one of claims 5 to 8 is implemented.

Citation Information

Patent Citations

  • Retrieval method and device applied to massive spatial data retrieval

    CN103440280A