Graph element identification method and device, computer device, and storage medium

By generating unique identifiers for basic graphic elements and directly retrieving their original information from a pre-set database, the problems of long processing time and high resource consumption in existing technologies are solved, enabling real-time feedback of basic graphic elements and improving user experience.

CN118470738BActive Publication Date: 2026-07-24GLODON CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GLODON CO LTD
Filing Date
2023-02-08
Publication Date
2026-07-24

Smart Images

  • Figure CN118470738B_ABST
    Figure CN118470738B_ABST
Patent Text Reader

Abstract

The application can provide a primitive identification method and device, computer equipment and a storage medium. The primitive identification method comprises: displaying an electronic drawing based on basic elements stored in a first container, the basic elements being obtained by discretely processing basic primitives contained in the electronic drawing; in response to an interactive operation, determining target position coordinate information corresponding to the interactive operation; determining selected basic primitives according to bounding box information of the basic primitives stored in a second container and the target position coordinate information, generating unique identifiers of the selected basic primitives; and accessing a preset database with the unique identifiers as keys to obtain original information of the selected basic primitives. The application realizes instant feedback of the original information of the basic primitives, the process of obtaining the original information of the basic primitives is time-saving, and user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, specifically to methods and apparatus for primitive recognition, computer equipment, and storage media. Background Technology

[0002] In computer graphics, primitives can include basic primitives and block primitives, with many basic primitives nested within block primitives. Basic primitives can be displayed on a display device, while block primitives cannot. In complex nesting relationships, a basic primitive can be uniquely identified based on the nesting path, thereby obtaining its original information (or original business information). Original information includes, for example, the style, width, and height of text primitives, and the major and minor axis radii, start and end angles, etc., of elliptical primitives. This enables primitive identification for business requirements, such as comparing primitive information before and after file modifications, or obtaining information about a certain range of basic primitives on a display device for display or application.

[0003] In related technologies, to obtain the original information of basic primitives nested in block primitives, it is first necessary to load all the original information and keep it resident in memory. Secondly, it is necessary to determine the access path of the current basic primitive according to the nesting relationship between the current basic primitive and the block primitive. Then, the current basic primitive and its original information are determined according to the access path. The above process not only consumes high computing resources, but also takes a long time, making it difficult to provide the user with the original information of the basic primitive in real time. Summary of the Invention

[0004] To address the problem that existing primitive recognition methods struggle to provide users with real-time feedback of the original information of basic primitives (especially those nested within block primitives), this invention provides a primitive recognition method and apparatus, computer equipment, and storage medium to achieve real-time feedback of the original information of basic primitives.

[0005] To achieve the above-mentioned technical objectives, the present invention provides a method for identifying graphic elements. The method includes: displaying an electronic drawing based on basic elements stored in a first container, wherein the basic elements are obtained by discretizing the basic graphic elements contained in the electronic drawing; determining target position coordinate information corresponding to the interactive operation in response to an interactive operation; determining selected basic graphic elements based on the bounding box information of the basic graphic elements stored in a second container and the target position coordinate information, and generating a unique identifier for the selected basic graphic elements; and accessing a preset database using the unique identifier as a keyword to obtain the original information of the selected basic graphic elements.

[0006] To achieve the above-mentioned technical objectives, the present invention also provides a graphic element recognition device, the device comprising: a drawing display module, used to display an electronic drawing based on basic elements stored in a first container, wherein the basic elements are basic elements obtained by discretizing the basic graphic elements contained in the electronic drawing; a coordinate determination module, used to determine target position coordinate information corresponding to the interactive operation in response to the interactive operation; a graphic element determination module, used to determine selected basic graphic elements based on the bounding box information of the basic graphic elements stored in a second container and the target position coordinate information, and used to generate a unique identifier for the selected basic graphic elements; and an information acquisition module, used to access a preset database using the unique identifier as a keyword to obtain the original information of the selected basic graphic elements.

[0007] To achieve the above-mentioned technical objectives, the present invention provides a computer device including a memory and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor performs the steps of the primitive recognition method in any embodiment of the present invention.

[0008] To achieve the above-mentioned technical objectives, the present invention can also provide a storage medium storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the primitive recognition method described in any embodiment of the present invention.

[0009] The beneficial effects of this invention include: compared with the problem in related technologies where it is difficult to obtain the original information of basic graphic elements, resulting in the inability to provide real-time feedback of the original information, this invention determines the selected basic graphic elements based on the bounding box information of the basic graphic elements stored in the second container and the target position coordinate information corresponding to the interactive operation, and generates a unique identifier for the selected basic graphic elements. Thus, the original information of the basic graphic elements is directly obtained from the preset database using this unique identifier as a keyword. It can be seen that this invention can realize the real-time feedback function of the original information of basic graphic elements, and the process of obtaining the original information of basic graphic elements is relatively short. This invention is particularly suitable for determining the basic graphic elements and obtaining their original information within block graphic elements with complex nesting relationships, which significantly improves the user experience and satisfaction. Attached Figure Description

[0010] Figure 1 A flowchart illustrating a primitive recognition method according to one or more embodiments of the present invention is shown.

[0011] Figure 2 This illustration shows a flowchart of one or more embodiments of the present invention for determining the selected basic primitives based on the bounding box information and target position coordinate information of the basic primitives stored in the second container.

[0012] Figure 3 The diagram illustrates a process for writing the original information of each basic graphic element into a preset database according to one or more embodiments of the present invention.

[0013] Figure 4 A schematic diagram of basic graphic elements in an electronic drawing source file according to one or more embodiments of the present invention is shown.

[0014] Figure 5 A schematic diagram of the contents stored in the first container is shown in one or more embodiments of the present invention.

[0015] Figure 6 A schematic diagram of the contents stored in the second container is shown in one or more embodiments of the present invention.

[0016] Figure 7 A schematic diagram of the contents stored in a third container is shown in one or more embodiments of the present invention.

[0017] Figure 8 A schematic diagram illustrating the implementation principle of the primitive recognition method in one or more embodiments of the present invention is shown.

[0018] Figure 9 A schematic diagram of the structure of a graphic element recognition device according to one or more embodiments of the present invention is shown.

[0019] Figure 10 A schematic diagram of the internal structure of a computer device according to one or more embodiments of the present invention is shown. Detailed Implementation

[0020] The graphic element recognition method and apparatus, computer equipment, and storage medium provided by the present invention will be explained and described in detail below with reference to the accompanying drawings.

[0021] like Figure 1 As shown, one or more embodiments of the present invention provide a primitive recognition method, which includes, but is not limited to, steps S110 to S140.

[0022] Step S110: Display the electronic drawing based on the basic elements stored in the first container. The basic elements are the basic elements obtained after discretizing the basic graphic elements contained in the electronic drawing.

[0023] The basic elements include points, lines, and triangles. In display devices, basic primitives need to be discretized into basic elements that have no actual business meaning before being displayed. To save resource consumption, display devices generally do not store the original information of basic primitives.

[0024] Combination Figure 4As shown, electronic drawings can be saved as files on a computer device, i.e., the original electronic drawing file in this embodiment. The electronic drawing contains basic elements and block elements, and the numbers shown represent element codes (IDs). For example, 451 represents the code of a block element, 452 represents the code of a basic element, 461 represents the code of a basic element, 462 represents the code of a block element, 471 represents the code of a basic element, 472 represents the code of a block element, and 481, 482, and 483 represent the codes of three different basic elements.

[0025] A basic primitive is the smallest unit of a primitive, such as a string of text (e.g., ...). Figure 4 Examples of basic graphic elements include a "hello" symbol, a straight line, a polyline, and a circle. Basic graphic elements can be drawn and displayed on a display device. It should be understood that basic graphic elements cannot be directly loaded by the display engine of the display device. Instead, they are discretized into basic elements and then pushed to the display engine for loading, thereby enabling the display of the corresponding basic graphic elements.

[0026] Block primitives are composed of nested basic primitives and / or sub-block primitives, where sub-block primitives are also a type of block primitive. Block primitives are mainly used to organize basic primitives and block primitives according to logical relationships; block primitives themselves cannot be displayed.

[0027] Step S120: In response to the interactive operation, determine the target position coordinate information corresponding to the interactive operation.

[0028] When a user interacts with a display device, the interactive operations involved in this embodiment of the invention may be, for example, click operations and / or selection operations, to determine the target position coordinate information within the corresponding range and achieve the purpose of specifying the interaction range.

[0029] The target location coordinate information includes the click location coordinate information corresponding to the click operation or multiple location coordinate information within the selected area corresponding to the box selection operation.

[0030] Determining the target location coordinates corresponding to the interactive operation may include: using a quadtree acceleration method to select the target location coordinates corresponding to the interactive operation.

[0031] Step S130: Determine the selected basic graphic elements based on the bounding box information and target position coordinate information of the basic graphic elements stored in the second container, and generate a unique identifier for the selected basic graphic elements.

[0032] The selected basic graphic elements are the basic graphic elements within the selected area and / or the basic graphic elements that intersect with the selected area, or the basic graphic elements at the clicked location, etc.; the number of selected basic graphic elements can be multiple, or it can be one.

[0033] Step S140: Access the preset database using the unique identifier as the key to obtain the original information of the selected basic graphic elements.

[0034] The preset database involved in this invention is a database that stores the original information of basic graphic elements using unique identifiers as keywords.

[0035] For text primitives, the original information is, for example, the font type, width, and height of a string of text; for polyline primitives, the original information is, for example, the line type and line width of a polyline; for circle primitives, the original information is, for example, the center and radius of a circle.

[0036] Therefore, this invention provides a method for identifying graphic elements based on unique identifiers, enabling the acquisition of original information of selected basic graphic elements. Particularly for basic graphic elements within block graphic elements with complex nesting relationships, such as block graphic elements containing text, geometric shapes like circles, and polylines in a multi-layered nested manner, this invention can more quickly identify selected basic graphic elements and provide real-time feedback of their original information compared to existing technologies. In interactive graphic element recognition scenarios, even with a large amount of original information data, this invention can still quickly output the original information of selected basic graphic elements, thereby enabling business expansion applications and greatly improving user satisfaction; for example, in web-based (web page) graphics display scenarios, this invention can achieve faster loading of the original information of basic graphic elements displayed on the web compared to existing technologies.

[0037] like Figure 2 As shown, the basic primitives to be selected are determined based on the bounding box information and target position coordinate information of the basic primitives stored in the second container, including but not limited to steps S131 and S132.

[0038] Step S131: Traverse the bounding box information of the basic primitives stored in the second container.

[0039] In this embodiment, the second container is a lightweight container that does not contain complex original business information and is closer to the display device, allowing the display device to call it at high speed. Therefore, this embodiment can achieve high-speed traversal of the second container, which is a lightweight container.

[0040] Step S132: Match the bounding box information obtained by traversal with the target position coordinate information, and determine the basic primitives to be selected based on the matching result.

[0041] For example, by matching the bounding box information obtained through traversal with the target position coordinate information, the geometric relationship between the target position corresponding to the target position coordinate information and the bounding box corresponding to the bounding box information is determined, and the basic primitive is selected based on the geometric relationship.

[0042] Specifically, in this embodiment, determining the selected basic graphic elements based on the matching results may include: if the repetition between the target location coordinate information and the current bounding box information reaches a preset threshold, then the basic graphic element corresponding to the current bounding box information is determined to be the selected basic graphic element.

[0043] The repeatability can be used to represent a geometric relationship between the target position and the bounding box. The preset threshold in the embodiments of the present invention can be determined according to the actual accuracy requirements, such as 90%, but is not limited to this.

[0044] Compared with the method of determining the access path of basic primitives from the original information, the above embodiments of the present invention identify the selected basic primitives based on the bounding box and target position matching method. This method does not require loading a large amount of original information and uses a quadtree to accelerate the selection, thereby greatly shortening the time consumption of the basic primitive identification process.

[0045] In one or more embodiments of the present invention, the second container also stores encoding information and index information. The encoding information is the encoding information of the outermost primitive in which the basic primitive is located, and the index information is the index information of the basic elements discretized from the basic primitive in the first container.

[0046] In this embodiment, the outermost graphic element is specifically a block graphic element.

[0047] In this embodiment, generating a unique identifier for the selected basic graphic element includes: using the encoding information of the outermost graphic element where the selected basic graphic element is located, the index information corresponding to the selected basic graphic element, and the bounding box information of the selected basic graphic element to form a unique identifier for the selected basic graphic element.

[0048] The specific form of the unique identifier is encoding information-index information-bounding box information, such as "451-1-0", where 451 represents encoding information, 1 represents index information, and 0 represents bounding box information.

[0049] The unique identifier of the selected basic graphic elements is formed by encoding information, index information and bounding box information. This method can ensure that the selected basic graphic elements are uniquely determined, and thus ensure that the original information of the selected basic graphic elements can be accurately obtained based on the unique identifier.

[0050] In this embodiment, in the second container, the encoding information, index information, and bounding box information are stored according to the nesting relationship between the basic primitive and the outermost primitive in which the basic primitive is located.

[0051] In this embodiment, the second container is traversed, and the encoding information of the outermost primitive, the index information of the selected basic primitive, and the bounding box information of the selected basic primitive are determined according to the traversal path.

[0052] like Figure 6 As shown, the second container is used to store encoding information, index information, and bounding box information. In this embodiment, the encoding information is the ID of the outermost primitive where the current basic primitive is located, the index information is the index of the basic element where the current basic primitive is located in the first container, and the bounding box information is the sequence number of the current basic primitive among all basic primitives at the index of the current basic primitive. The storage location of this sequence number is used to store the bounding box information of the current basic primitive.

[0053] Based on the above embodiments, this invention can convert the complex nested relationships between basic primitives and block primitives into first- and second-level subordinate relationships. The outermost block primitive is located at the first level, and each of the nested inner basic primitives is located at the second level. By expanding the nested relationship, this invention can effectively simplify the logical relationship between basic primitives and the outermost block primitive. At the same time, it can quickly determine the outermost primitive based on quadtree accelerated selection, so that the basic elements of the selected basic primitives can be quickly accessed based on the outermost primitive.

[0054] Combination Figure 3 As shown, in one or more embodiments of the present invention, before displaying the electronic drawing based on the basic elements stored in the first container, the graphic element recognition method further includes step S100.

[0055] Step S100: Traverse each basic graphic element contained in the electronic drawing, and obtain the basic element corresponding to each basic graphic element by discretizing each basic graphic element, and store the basic element in the first container.

[0056] In this embodiment, the discretization process is specifically vectorized discretization to obtain vectorized basic elements. The basic elements corresponding to each basic primitive specifically refer to the basic elements contained in each basic primitive.

[0057] This embodiment can discretize basic primitives into basic elements such as points, lines, and triangles, and store them in a first container. The basic elements discretized from each basic primitive are merged according to their type and stored in the corresponding positions in the first container.

[0058] like Figure 5 As shown, the first container has a predefined data structure to store indices, coordinate point sets, and other content. For example, the index... Figure 5 In the [0], [1], ..., [n] coordinate point set, for example... Figure 5 The numbers 0, 0, 0, 100, 100, 0, 100, 100, 0, 200, 100, 0, ... etc., and other content such as Figure 5The data includes the following types: line segment; color: red; others, etc. For line segments in a coordinate point set: three numbers represent one endpoint, and six numbers in sequence represent two endpoints. For example, (0,0,0,100,100,0) can be used to draw a line segment, and then six numbers in sequence can be used to draw another line segment. For triangles in a coordinate point set: three numbers can represent one endpoint of a triangle. For example, (0,0,0,0,100,0,100,0,0,0) can be used to draw a triangle. Other content may include the element type, color, or other attribute information of basic elements. The data stored in the first container of this embodiment can be used to push to the display device and does not contain the original information of basic graphic elements.

[0059] Based on the above embodiments, the present invention can quickly provide basic elements pre-stored in the first container to the display device, thereby greatly improving the efficiency of the display device in loading and displaying electronic drawings.

[0060] like Figure 3 As shown, in one or more embodiments of the present invention, after traversing each basic graphic element contained in the electronic drawing, the graphic element identification method further includes steps S101 to S106.

[0061] Step S101: Based on the nesting relationship between each basic graphic element and the outermost graphic element determined during the process of traversing each basic graphic element contained in the electronic drawing, generate a first preset identifier for each basic graphic element.

[0062] In this embodiment, the nesting relationship between the basic primitives and their outermost primitives is determined during the traversal process. The outermost primitive is generally a block primitive. A first preset identifier is formed based on the nesting relationship determined during the traversal process, for example, "451-462-472-483". Here, 483 is the ID of the innermost basic primitive, and the other IDs are the IDs of each layer of block primitives in the block primitive nesting process. The first preset identifier is also a unique identifier.

[0063] Combination Figure 8 As shown, in this embodiment, the original basic graphic elements (basic graphic elements before discretization) contained in the electronic drawing are vectorized and discretized in advance, so that the obtained basic elements are stored in the first container, and a first preset identifier is generated according to the access path of the basic graphic elements.

[0064] This embodiment can store the index information of each basic graphic element discretely formed into basic elements in the first container through the second container, and generate a unique identifier for each basic graphic element based on the index information.

[0065] like Figure 6As shown, the unique identifier of each basic graphic element in this embodiment is generated when the basic graphic element is discrete. The specific form of the unique identifier is encoding information-index information-bounding box information, such as "451-1-0", where 451 represents encoding information, 1 represents index information, and 0 represents bounding box information. In this embodiment, the encoding information is the ID of the outermost graphic element where the current basic graphic element is located, the index information is the index of the basic element where the current basic graphic element is located in the first container, and the bounding box information is the sequence number of the current basic graphic element among all basic graphic elements in the index where the current basic graphic element is located. The storage location of this sequence number is used to store the bounding box information of the current basic graphic element, which can be understood as the sorting position of the current basic graphic element in the index. In this embodiment, 451 is the ID of the outermost block graphic element of the basic graphic element, 1 indicates that the basic elements (e.g., black line segments) discrete from the basic graphic element are stored in the index [1] in the first container, and 0 indicates that the sequence number of the basic graphic element (451 blocks are located in all basic graphic elements in the index [1]) is the basic graphic element. The information stored in the storage location of this sequence number is the bounding box.

[0066] During the interaction process, such as step S130 above, the step of generating a unique identifier for the selected basic graphic elements is equivalent to restoring the unique identifier. When determining the selected basic graphic elements, the second container is traversed until the selected basic graphic elements are determined. Combining the example above, for the basic graphic element at index [0], its traversal path is "451-1-0", which is also the unique identifier; in step S140, the original information of the selected basic graphic elements can be obtained from the preset database using the unique identifier as the key.

[0067] Step S102: For each basic graphic element, construct a mapping relationship between a first preset identifier and a unique identifier, and use a third container to store the mapping relationship.

[0068] like Figure 7 As shown, the third container in this embodiment can store the mapping relationship in the form of a hash table. The mapping relationship in the form of a hash table is, for example, <"451-462-472-483", "451-1-0">. The mapping relationship is stored in the third container, but it is not limited to this.

[0069] As can be seen, this embodiment establishes a mapping relationship between a first preset identifier and a unique identifier for each basic graphic element, and stores it in a third container for subsequent steps. Based on this, if the first preset identifier is obtained, the corresponding unique identifier can be directly determined.

[0070] Step S103: Iterate through each basic graphic element contained in the electronic drawing again to obtain the original information of each basic graphic element.

[0071] For example, the original information of a basic text element includes the text content, style, width, height, and insertion position; the original information of an ellipse element includes the ellipse's major and minor axis radii, start and end angles, etc., but is not limited to these.

[0072] Step S104: Based on the nesting relationship between each basic graphic element and the outermost graphic element where each basic graphic element is located, determined during the process of re-traversing each basic graphic element contained in the electronic drawing, a second preset identifier for each basic graphic element is generated.

[0073] For the same basic graphic element, the second preset identifier and the first preset identifier in this embodiment have the same content, but are generated at different stages. Step S100, which traverses and accesses the basic graphic elements in the original electronic drawing file, is to discretize the basic graphic elements and realize their vectorization. Step S103, which traverses and accesses the basic graphic elements in the original electronic drawing file, is to obtain the original information of the basic graphic elements. The content accessed in these two steps is the same, but the purposes are different.

[0074] Step S105: Based on the mapping relationship between each second preset identifier and the third container, obtain each unique identifier corresponding to each second preset identifier.

[0075] The mapping relationship is the mapping relationship between the first preset identifier and the unique identifier. In this embodiment, the second preset identifier is used as the first preset identifier in the mapping relationship. Therefore, each unique identifier corresponding to each second preset identifier can be directly determined and obtained according to the mapping relationship.

[0076] Step S106: Using each unique identifier as a key, write the original information of each basic graphic element into the preset database.

[0077] In this embodiment of the invention, a unique identifier is used as the keyword for querying a preset database. The original information of basic graphic elements is written into the preset database, thereby allowing the original information of the corresponding basic graphic elements to be directly obtained from the preset database through the unique identifier.

[0078] Based on the above embodiments, the present invention enables the pre-generation of unique identifiers for each basic graphic element, and the writing of the original information of the basic graphic element into a preset database based on the unique identifier, thereby realizing the function of storing the original information in the database, that is, realizing the function of storing the original basic graphic element information in the database. Based on storing the original information of the basic graphic elements in the preset database in advance, the present invention can efficiently retrieve the original information of the basic graphic elements when needed.

[0079] In one or more embodiments of the present invention, storing basic elements in a first container includes: storing a set of coordinate points representing the basic elements in the first container.

[0080] Combination Figure 5As shown, the set of coordinate points is stored in the first container according to the corresponding index, as in the example below.

[0081] The set of coordinate points corresponding to index [0]: 0,0,0,100,100,0,100,100,0,200,100,0,…

[0082] The set of coordinate points corresponding to index [1]: 0,200,0,100,100,0,100,100,0,200,100,0,…

[0083] The set of coordinate points corresponding to index [n]: 0,0,0,0,100,0,100,0,0,100,100,0…

[0084] Based on storing the coordinate point set, the basic elements of the basic primitives in this embodiment can be loaded more quickly when called by the display device, thereby loading the basic primitives more quickly, which significantly improves the loading speed of the basic primitives and helps to reduce the performance requirements of the display engine.

[0085] In one or more embodiments of the present invention, determining the target position coordinate information corresponding to the interactive operation includes: determining the screen coordinate information corresponding to the interactive operation; and converting the screen coordinate information into target position coordinate information.

[0086] In this embodiment, converting screen coordinate information into target position coordinate information includes: calculating the target position coordinate information corresponding to the screen coordinate information based on the translation, rotation, and scaling information of the graphic elements on the page where the electronic drawing is located.

[0087] Based on the above embodiments, the present invention can also accurately obtain the target location information corresponding to the interactive operation through coordinate transformation, so as to further ensure that the subsequently selected basic graphic elements are the basic graphic elements that the user is interested in.

[0088] like Figure 9 As shown, based on the same inventive concept as the primitive recognition method provided in at least one embodiment of the present invention, some embodiments of the present invention can also provide a primitive recognition device.

[0089] The graphic element recognition device includes, but is not limited to, a drawing display module, a coordinate determination module, a graphic element determination module, and an information acquisition module, as detailed below.

[0090] The drawing display module is used to display electronic drawings based on the basic elements stored in the first container. The basic elements are obtained by discretizing the basic graphic elements contained in the electronic drawing.

[0091] The coordinate determination module is used to determine the target location coordinate information corresponding to the interactive operation in response to the interactive operation.

[0092] The primitive determination module is used to determine the selected basic primitives based on the bounding box information and target position coordinate information of the basic primitives stored in the second container, and to generate a unique identifier for the selected basic primitives.

[0093] The information acquisition module is used to access a preset database using a unique identifier as the key to obtain the original information of the selected basic graphic elements.

[0094] Optionally, the primitive determination module includes a first traversal module and an information matching module.

[0095] The first traversal module is used to traverse the bounding box information of the basic primitives stored in the second container.

[0096] The information matching module is used to match the bounding box information obtained through traversal with the target location coordinate information, and determine the basic primitives to be selected based on the matching results.

[0097] Optionally, the second container also stores encoding information and index information. The encoding information is the encoding information of the outermost primitive in which the basic primitive is located, and the index information is the index information of the basic elements discretized from the basic primitive in the first container.

[0098] Optionally, the primitive determination module further includes a primitive forming module. The primitive forming module is used to form a unique identifier for the selected basic primitive using the encoding information of the outermost primitive in which the selected basic primitive is located, the index information corresponding to the selected basic primitive, and the bounding box information of the selected basic primitive.

[0099] Optionally, in the second container, the encoding information, index information, and bounding box information are stored according to the nesting relationship between the basic primitive and the outermost primitive in which the basic primitive is located.

[0100] Optionally, the primitive recognition device also includes a second traversal module, a discrete processing module, and an element storage module.

[0101] The second traversal module is used to traverse each basic graphic element contained in the electronic drawing.

[0102] The discrete processing module is used to obtain the basic elements corresponding to each basic primitive by performing discrete processing on each basic primitive.

[0103] The element storage module is used to store basic elements into the first container.

[0104] Optionally, the primitive recognition device further includes a first identifier generation module, a mapping relationship construction module, a third traversal module, a second identifier generation module, a unique identifier acquisition module, and an original information writing module.

[0105] The first identifier generation module is used to generate a first preset identifier for each basic graphic element based on the nesting relationship between each basic graphic element and the outermost graphic element where each basic graphic element is located, as determined during the process of traversing each basic graphic element contained in the electronic drawing.

[0106] The mapping relationship construction module is used to construct a mapping relationship between a first preset identifier and a unique identifier for each basic graphic element, and to store the mapping relationship using a third container.

[0107] The third traversal module is used to traverse each basic graphic element contained in the electronic drawing again to obtain the original information of each basic graphic element.

[0108] The second identifier generation module is used to generate a second preset identifier for each basic graphic element based on the nesting relationship between each basic graphic element and the outermost graphic element of each basic graphic element determined during the process of re-traversing each basic graphic element contained in the electronic drawing.

[0109] The unique identifier acquisition module is used to acquire each unique identifier corresponding to each second preset identifier based on the mapping relationship between each second preset identifier and the third container.

[0110] The original information writing module is used to write the original information of each basic graphic element into a preset database, using each unique identifier as the key.

[0111] Optionally, the element storage module is used to store the set of coordinate points representing basic elements in the first container.

[0112] Optionally, the coordinate determination module includes a coordinate determination unit and a coordinate transformation unit.

[0113] The coordinate determination unit is used to determine the screen coordinate information corresponding to the interactive operation.

[0114] The coordinate transformation unit is used to convert screen coordinate information into target position coordinate information.

[0115] like Figure 10 As shown, based on the same inventive concept, one or more embodiments of the present invention can also provide a computer device, including a memory and a processor. The memory stores computer-readable instructions, which, when executed by the processor, cause the processor to perform the steps of the graphic element recognition method in any embodiment of the present invention. The detailed implementation process of the graphic element recognition method has been described in detail in this specification and will not be repeated here.

[0116] like Figure 10As shown, based on the same inventive concept as the primitive recognition method provided in at least one embodiment of the present invention, one or more embodiments of the present invention can also provide a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors cause the one or more processors to perform the steps of the primitive recognition method in any embodiment of the present invention. The detailed implementation process of the primitive recognition method has been described in detail in this specification and will not be repeated here.

[0117] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable storage medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable storage medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable storage media include: electrical connections (electronic devices) having one or more wires, portable computer disks (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM, or flash memory), fiber optic devices, and compact disc read-only memory (CDROM). Furthermore, computer-readable storage media can even be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.

[0118] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0119] In the description of this specification, the references to terms such as "this embodiment," "an embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0120] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0121] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and simple improvements made on the substantive content of the present invention should be included within the protection scope of the present invention.

Claims

1. A primitive recognition method, characterized in that, The method includes: The electronic drawing is displayed based on the basic elements stored in the first container. The basic elements are obtained by discretizing the basic graphic elements contained in the electronic drawing. In response to an interactive operation, determine the target location coordinate information corresponding to the interactive operation; The selected basic graphic elements are determined based on the bounding box information of the basic graphic elements stored in the second container and the target position coordinate information, and a unique identifier for the selected basic graphic elements is generated. Using the unique identifier as a keyword, the preset database is accessed to obtain the original information of the selected basic graphic elements; The second container also stores encoding information and index information. The encoding information is the encoding information of the outermost primitive where the basic primitive is located, and the index information is the index information of the basic elements discretized from the basic primitive in the first container. The unique identifier for generating the selected basic primitives includes: The unique identifier of the selected basic graphic element is formed by using the encoding information of the outermost graphic element where the selected basic graphic element is located, the index information corresponding to the selected basic graphic element, and the bounding box information of the selected basic graphic element.

2. The primitive recognition method according to claim 1, characterized in that, The step of determining the selected basic primitives based on the bounding box information of the basic primitives stored in the second container and the target position coordinate information includes: The bounding box information of the basic primitives stored in the second container is traversed. The bounding box information obtained through traversal is matched with the target location coordinate information, and the basic primitives to be selected are determined based on the matching results.

3. The primitive recognition method according to claim 1 or 2, characterized in that, In the second container, the encoding information, the index information, and the bounding box information are stored according to the nesting relationship between the basic primitives and the outermost primitives in which the basic primitives are located.

4. The primitive recognition method according to claim 1 or 2, characterized in that, Before displaying the electronic drawing based on the basic elements stored in the first container, the method further includes: The basic elements corresponding to each basic graphic element are obtained by traversing each basic graphic element and discretizing each basic graphic element, and the basic elements are stored in the first container.

5. The primitive recognition method according to claim 4, characterized in that, After traversing each basic graphic element contained in the electronic drawing, the method further includes: Based on the nesting relationship between each basic graphic element and the outermost graphic element determined during the process of traversing each basic graphic element contained in the electronic drawing, a first preset identifier for each basic graphic element is generated. For each basic graphic element, a mapping relationship between a first preset identifier and a unique identifier is constructed, and the mapping relationship is stored using a third container; The original information of each basic graphic element in the electronic drawing is obtained by iterating through each basic graphic element again. Based on the nesting relationship between each basic graphic element and the outermost graphic element determined during the process of re-traversing each basic graphic element contained in the electronic drawing, a second preset identifier for each basic graphic element is generated. Based on each second preset identifier and the mapping relationship stored in the third container, obtain each unique identifier corresponding to each second preset identifier; Using each unique identifier as a keyword, the original information of each basic graphic element is written into the preset database.

6. The primitive recognition method according to claim 4, characterized in that, The step of storing the basic elements in the first container includes: The set of coordinate points used to represent the basic element is stored in the first container.

7. The primitive recognition method according to claim 1, characterized in that, Determining the target location coordinate information corresponding to the interactive operation includes: Determine the screen coordinate information corresponding to the interactive operation; The screen coordinate information is converted into the target position coordinate information.

8. A graphic element recognition device, characterized in that, The device includes: The drawing display module is used to display electronic drawings based on basic elements stored in the first container. The basic elements are obtained by discretizing the basic graphic elements contained in the electronic drawings. The coordinate determination module is used to determine the target position coordinate information corresponding to the interactive operation in response to the interactive operation. The primitive determination module is used to determine the selected basic primitives based on the bounding box information of the basic primitives stored in the second container and the target position coordinate information, and to generate a unique identifier for the selected basic primitives. The information acquisition module is used to access a preset database using the unique identifier as a keyword to obtain the original information of the selected basic graphic elements; The second container also stores encoding information and index information. The encoding information is the encoding information of the outermost primitive where the basic primitive is located, and the index information is the index information of the basic elements discretized from the basic primitive in the first container. The primitive determination module includes a primitive formation module; The primitive forming module is used to form a unique identifier for the selected basic primitive by using the encoding information of the outermost primitive in which the selected basic primitive is located, the index information corresponding to the selected basic primitive, and the bounding box information of the selected basic primitive.

9. A computer device, characterized in that, The method includes a memory and a processor, wherein the memory stores computer-readable instructions that, when executed by the processor, cause the processor to perform the steps of the primitive recognition method as described in any one of claims 1 to 7.

10. A storage medium storing computer-readable instructions, characterized in that, When the computer-readable instructions are executed by one or more processors, the one or more processors cause the one or more processors to perform the steps of the primitive recognition method as described in any one of claims 1 to 7.