Library element configuration method, device, electronic device and storage medium
Through dynamic assembly and attribute configuration, the problem of cumbersome primitive configuration is solved, the flexibility and versatility of primitive configuration are improved, and the process of modifying and maintaining primitives is simplified.
Patent Information
- Application Number
- CN202110722169.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-28
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2041-06-28
AI Technical Summary
The configuration operation of graphic elements in the prior art is cumbersome and requires a large amount of repetitive work. Especially when professional libraries in various industries require a large number of graphic elements, it is difficult to modify and maintain the graphic elements.
By reading the library element configuration file and element attribute configuration file, dynamically assemble sub-elements to form parent elements, and perform dynamic attribute configuration based on the element attribute configuration file, which reduces the complexity of element configuration and improves flexibility. sex and versatility.
It achieves the simplification of graphic element configuration, reduces the complexity of graphic element modification and maintenance, improves the flexibility and versatility of graphic element configuration, and avoids the need for separate DWG files and program source code modifications for each graphic element.
Smart Images

Figure CN113553635B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for configuring picture library elements. Background Art
[0002] CAD (Computer Aided Design) software is the most widely used general-purpose computer-aided design and drawing software, with powerful two-dimensional drawing capabilities and editing functions. CAD secondary development can be used to customize and expand CAD functions. AutoCAD or domestic CAD software supports secondary development. Among them, commonly used secondary development interfaces include AutoLisp, .Net and ObjectARX. Through the above interfaces, you can add a gallery panel to the CAD interface and develop a CAD application plug-in. After loading the plug-in in CAD, a customized gallery with professional characteristics can be displayed in the user drawing interface.
[0003] The types of primitive entities added through secondary development are divided into block entities and custom entities. Block entities are a type of entity that comes with CAD and can be directly operated using the interface it provides. All secondary development interfaces can define and draw primitives through block entities. Custom entities are unique to ObjectARX secondary development. Since ObjectARX shares the address space with AutoCAD, it can quickly access and operate the AutoCAD graphics database. Based on the CAD base class entity, developers can create a new entity, namely a custom entity. The drawing and modification of custom entities can be redefined by the developer.
[0004] However, the block entity definition method requires that the attributes of the primitives be set in the block definition dwg file in advance, and the attributes need to be defined for each primitive. Primitives of the same category usually have the same attribute domain, but it is still necessary to define the attributes for each primitive, which results in a large amount of repetition. In addition, each new primitive requires a corresponding dwg file. Since professional libraries in various industries require a large number of primitives, even if only some features need to be changed, a new primitive dwg file needs to be created. When the number of primitives is large, it is difficult to modify and maintain the primitives. The custom entity method allows you to add attributes to each type of custom entity in the program, but this method requires you to define the attributes in the program. If you need to modify the attribute definition, you need to modify the program source code, and you still need to set a dwg file for each primitive. Summary of the invention
[0005] The present invention provides a method, device, electronic device and storage medium for configuring picture library elements, so as to solve the defects of the prior art that the picture element configuration operation is complicated and the workload is large.
[0006] The present invention provides a method for configuring picture library elements, comprising:
[0007] Reading a library primitive configuration file and a primitive attribute configuration file; the library primitive configuration file includes a description of the sub-primitive composition of each primitive;
[0008] When loading a library, each sub-element is dynamically assembled based on the library element configuration file to form a corresponding parent element, and the parent element is dynamically configured with attributes based on the element attribute configuration file.
[0009] According to a method for configuring a library element provided by the present invention, when loading a library, each sub-element is dynamically assembled based on the library element configuration file to form a corresponding parent element, specifically including:
[0010] Determine the selected element in the panel;
[0011] Determine the relative coordinates of each sub-element of the selected element based on the sub-element composition description of the selected element in the image library element configuration file;
[0012] Based on the relative coordinates of each sub-element of the selected element, each sub-element is combined and drawn in the workspace to form a parent element corresponding to the selected element.
[0013] According to a library primitive configuration method provided by the present invention, the method of drawing the sub-primitives in the workspace based on the relative coordinates of the sub-primitives of the selected primitive specifically includes:
[0014] Determine the absolute coordinates of each sub-element in the workspace based on the insertion point coordinates of the selected element in the workspace and the relative coordinates of each sub-element;
[0015] Read the dwg files of each sub-element;
[0016] Based on the absolute coordinates of each sub-element in the workspace, the dwg file of the corresponding sub-element is drawn in the workspace.
[0017] According to a method for configuring image gallery elements provided by the present invention, the image element attribute configuration file includes attribute information included in each type of image element.
[0018] According to a method for configuring a graphic library element provided by the present invention, the method of dynamically configuring the attributes of the parent graphic element based on the graphic element attribute configuration file specifically includes:
[0019] Based on the type of the parent class primitive, query the attribute information of the parent class primitive from the primitive attribute configuration file;
[0020] The attribute information of the parent class primitive is stored in an extended dictionary of the parent class primitive.
[0021] According to a method for configuring a gallery element provided by the present invention, the step of reading a gallery element configuration file and an element attribute configuration file specifically includes:
[0022] Obtaining the gallery graphic element configuration file and the graphic element attribute configuration file;
[0023] Deserialize and extract the image library primitive configuration file and the primitive attribute configuration file to obtain primitive configuration information of each primitive and attribute information of each type of primitive;
[0024] Based on the primitive configuration information of each primitive and the attribute information of each type of primitive, the primitives and primitive attributes are associated according to the primitive type.
[0025] According to a gallery primitive configuration method provided by the present invention, the gallery primitive configuration file and the primitive attribute configuration file are structured data or semi-structured data.
[0026] The present invention also provides a library element configuration device, comprising:
[0027] A configuration file reading unit, used to read a library graphic element configuration file and a graphic element attribute configuration file; the library graphic element configuration file includes a description of the sub-graphic element composition of each graphic element;
[0028] The dynamic loading unit of the picture library is used to dynamically assemble each sub-picture element based on the picture library picture element configuration file to form a corresponding parent class picture element when loading the picture library, and dynamically configure the properties of the parent class picture element based on the picture element attribute configuration file.
[0029] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the above-mentioned methods for configuring picture gallery elements when executing the computer program.
[0030] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned methods for configuring image gallery elements are implemented.
[0031] The library graphic element configuration method, device, electronic device and storage medium provided by the present invention read the library graphic element configuration file and the graphic element attribute configuration file, and when loading the library, dynamically assemble each sub-graphic element based on the library graphic element configuration file to form a corresponding parent class graphic element, and dynamically configure the attributes of the parent class graphic element based on the graphic element attribute configuration file, thereby reducing the complexity of the graphic element configuration and improving the flexibility and versatility of the graphic element configuration. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0033] Figure 1 A schematic diagram of the flow of the library element configuration method provided by the present invention;
[0034] Figure 2 A brief schematic diagram of the library element configuration method provided by the present invention;
[0035] Figure 3 An exemplary configuration of a gallery element configuration file provided by the present invention;
[0036] Figure 4 An exemplary configuration of a primitive attribute configuration file provided by the present invention;
[0037] Figure 5 A schematic diagram of the structure of the image library element configuration device provided by the present invention;
[0038] Figure 6 This is a schematic structural diagram of an electronic device provided by the present invention. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0040] Figure 1 A schematic diagram of a flow chart of a method for configuring image gallery elements provided by an embodiment of the present invention, such as Figure 1 As shown, the method includes:
[0041] Step 110, reading a library primitive configuration file and a primitive attribute configuration file; the library primitive configuration file includes a description of the sub-primitive composition of each primitive;
[0042] Step 120, when loading the library, dynamically assemble each sub-element based on the library element configuration file to form a corresponding parent element, and dynamically configure the attributes of the parent element based on the element attribute configuration file.
[0043] Specifically, the gallery element configuration file is used to define each element in the gallery, which contains the configuration information of each element, such as the sub-element composition description of each element. Here, the gallery element configuration file may include but is not limited to the category of the element, the name of the element, the thumbnail of the element, the element execution command, the sub-element composition description and the element attributes. Among them, the sub-element composition description of the element may include but is not limited to the file path of the sub-element and the offset of the sub-element, and the sub-element composition description contains at least one sub-element description; the element attributes may include but are not limited to the attribute name and its corresponding attribute value. The element attribute configuration file may include but is not limited to the attribute name, attribute type and attribute meaning of each element.
[0044] When the image library element configuration file and the image element attribute configuration file are defined or updated, the above image library element configuration file and the image element attribute configuration file can be read.
[0045] In the process of loading the library, each sub-element can be dynamically assembled based on the library element configuration file to form the corresponding parent element. Specifically, the sub-element composition description corresponding to each element in the library element configuration file can be used to determine what kind of sub-element combination each element is composed of. When loading the library, each sub-element can be dynamically assembled into the corresponding parent element based on the above combination information of each element. In addition, the properties of the parent element can be dynamically configured based on the element attribute configuration file.
[0046] The embodiment of the present invention decomposes the primitives in the library into basic sub-primitives, and describes the sub-primitives contained in each primitive in the library primitive configuration file, so that multiple sub-primitives can be dynamically assembled into corresponding parent class primitives when loading the library, without drawing and storing corresponding dwg files for each primitive, thereby reducing the complexity of primitive configuration and improving the flexibility of primitive configuration.
[0047] In addition, the definitions of primitives and attributes are stored in independent configuration files, which are separated from the software coding, and the above-mentioned primitive configuration process is completed dynamically during the library loading process. Therefore, when the designer needs to modify the primitive configuration in the library, for example, when the sub-element composition or partial attributes of the primitive need to be modified, it is only necessary to update the library primitive configuration file or primitive attribute configuration file accordingly without recompiling the software. After updating the library primitive configuration file or primitive attribute configuration file, the library loading process can be executed again to realize the dynamic update of the primitive configuration, which further improves the flexibility and versatility of the primitive configuration.
[0048] The method provided by the embodiment of the present invention reads a library primitive configuration file and a primitive attribute configuration file, and when loading the library, dynamically assembles each sub-primitive based on the library primitive configuration file to form a corresponding parent class primitive, and dynamically configures the attributes of the parent class primitive based on the primitive attribute configuration file, thereby reducing the complexity of the primitive configuration and improving the flexibility and versatility of the primitive configuration.
[0049] Based on the above embodiment, when loading the library, each sub-element is dynamically assembled based on the library element configuration file to form a corresponding parent element, specifically including:
[0050] Determine the selected element in the panel;
[0051] Based on the description of the sub-element composition of the selected element in the image library element configuration file, determine the relative coordinates of each sub-element of the selected element;
[0052] Based on the relative coordinates of each sub-element of the selected element, each sub-element is combined and drawn in the workspace to form a parent element corresponding to the selected element.
[0053] Specifically, for one or more custom entity classes pre-defined using the ObjectARX development kit, the custom entity class corresponding to the primitive type can be dynamically instantiated and configured according to the primitive definition in the library primitive configuration file.
[0054] Specifically, after the user clicks on an element in the library panel, the selected element in the current panel can be determined. Based on the sub-element composition description of the selected element in the library element configuration file, the relative coordinates of each sub-element contained in the above selected element can be determined. Among them, the relative coordinates of each sub-element can indicate the relative position relationship of each sub-element in the corresponding parent element. Here, the relative coordinates of each sub-element can be determined based on the offset of the sub-element in the sub-element composition description. Based on the relative coordinates of each sub-element, each sub-element can be combined and drawn in the workspace to form the parent element corresponding to the above selected element.
[0055] Based on any of the above embodiments, based on the relative coordinates of each sub-element of the selected element, drawing each sub-element combination in the workspace specifically includes:
[0056] Based on the insertion point coordinates of the selected primitive in the workspace and the relative coordinates of each sub-primitive, determine the absolute coordinates of each sub-primitive in the workspace;
[0057] Read the dwg files of each sub-element;
[0058] Based on the absolute coordinates of each sub-entity in the workspace, the dwg file of the corresponding sub-entity is drawn in the workspace.
[0059] Specifically, when the user selects the insertion point of the primitive in the workspace, the insertion point coordinates of the selected primitive in the workspace are obtained. Combined with the insertion point coordinates of the selected primitive in the workspace and the relative coordinates of each sub-primitive, the absolute coordinates of each sub-primitive in the workspace can be determined. Read the dwg file of each sub-primitive. Here, the dwg file of each sub-primitive can be stored in the primitive source file directory, and the thumbnail of each sub-primitive can also be stored in the directory, where the thumbnail can be a file in any picture format, such as a jpg file, a bmp file, a png file, etc. Subsequently, according to the absolute coordinates of each sub-primitive in the workspace, the dwg file of the corresponding sub-primitive is drawn in the workspace.
[0060] Based on any of the above embodiments, the graphic element attribute configuration file includes attribute information of each type of graphic element.
[0061] Specifically, the primitive attribute configuration file uses the primitive type as the basic storage unit to store the attribute information contained in each type of primitive. Therefore, when designers need to update primitive attributes, especially when they need to make the same update to a certain type of primitives, they can use the primitive attribute configuration file to perform update operations such as adding, deleting or modifying primitives according to the primitive category, without having to perform an attribute update operation for each primitive, which greatly reduces the complexity of primitive attribute configuration and further improves the flexibility of primitive configuration.
[0062] The method provided by the embodiment of the present invention reduces the complexity of primitive attribute configuration and further improves the flexibility of primitive configuration by storing attribute information contained in each type of primitive in a primitive attribute configuration file according to primitive type.
[0063] Based on any of the above embodiments, the parent class graphic element is dynamically configured based on the graphic element attribute configuration file, specifically including:
[0064] Based on the type of the parent class element, query the attribute information of the parent class element from the element attribute configuration file;
[0065] The attribute information of the parent class entity is stored in the extended dictionary of the parent class entity.
[0066] Specifically, the type of the parent class primitive is obtained, and based on this, the attribute information of the parent class primitive is queried from the primitive attribute configuration file. Subsequently, the attribute information of the parent class primitive is stored in the extended dictionary of the parent class primitive to realize the dynamic configuration of the parent class primitive attributes. Among them, the attribute information may include various attributes and their corresponding default values. If the attribute values of some or all attributes of the parent class primitive are also set in the library primitive configuration file, the attribute values set in the library primitive configuration file must also be stored in the attributes corresponding to the parent class primitive extended dictionary to realize the personalized attribute configuration of the primitive.
[0067] Based on any of the above embodiments, step 110 specifically includes:
[0068] Get the gallery element configuration file and element attribute configuration file;
[0069] Deserialize and extract the image library element configuration file and the element attribute configuration file to obtain the element configuration information of each element and the attribute information of each type of element;
[0070] Based on the primitive configuration information of each primitive and the attribute information of each type of primitive, the primitives and primitive attributes are associated according to the primitive type.
[0071] Specifically, the library primitive configuration file and the primitive attribute configuration file are obtained. The configuration file can be read through the database interface, or dynamically read into the memory variable in the form of a file (xml, json, EXCEL, etc.). Subsequently, the library primitive configuration file and the primitive attribute configuration file can be deserialized and extracted to obtain the primitive configuration information of each primitive and the attribute information of each type of primitive, and based on the primitive configuration information of each primitive and the attribute information of each type of primitive, the primitive and the primitive attribute are associated according to the primitive type to facilitate reading the attribute information of each primitive.
[0072] Based on any of the above embodiments, the gallery primitive configuration file and the primitive attribute configuration file are structured data or semi-structured data.
[0073] Specifically, the gallery element configuration file and the element attribute configuration file can be any structured data or semi-structured data to meet various application scenarios. For example, the format of the configuration file can include but is not limited to XML text files, JSON text files, relational databases, non-relational databases, text expressions with fixed semantic syntax formats, or EXCEL tables.
[0074] Based on any of the above embodiments, Figure 2 A brief schematic diagram of a method for configuring image gallery elements provided by an embodiment of the present invention is shown in FIG. Figure 2As shown, the method mainly includes the following three steps:
[0075] Define the library element configuration file and the element attribute configuration file, and separate the element definition and the element attribute definition as software configuration items from the program source code. The exemplary configurations of the library element configuration file and the element attribute configuration file are as follows: Figure 3 and Figure 4 shown.
[0076] Read and preprocess library primitive configuration files and primitive attribute configuration files.
[0077] The library is dynamically loaded according to the library element configuration file and the element attribute configuration file. Among them, the program uses the ObjectARX development kit to define one or more custom entity classes, rewrites the functions related to drawing elements in the class, and then dynamically assembles sub-elements through the configuration file to form the final parent class element instance, and adds attributes to the element. The specific element configuration method is as described in the above embodiment, which will not be repeated here.
[0078] Based on any of the above embodiments, Figure 5 A schematic diagram of the structure of a device for configuring image library elements provided by an embodiment of the present invention is shown in FIG. Figure 5 As shown, the device includes: a configuration file reading unit 510 and a gallery dynamic loading unit 520.
[0079] The configuration file reading unit 510 is used to read the image library primitive configuration file and the primitive attribute configuration file; the image library primitive configuration file includes a description of the sub-primitive composition of each primitive;
[0080] The gallery dynamic loading unit 520 is used to dynamically assemble each sub-element to form a corresponding parent-class element based on the gallery element configuration file when loading the gallery, and dynamically configure the attributes of the parent-class element based on the element attribute configuration file.
[0081] The device provided by the embodiment of the present invention reads a gallery primitive configuration file and a primitive attribute configuration file, and when loading a gallery, dynamically assembles each sub-primitive based on the gallery primitive configuration file to form a corresponding parent class primitive, and dynamically configures the attributes of the parent class primitive based on the primitive attribute configuration file, thereby reducing the complexity of the primitive configuration and improving the flexibility and versatility of the primitive configuration.
[0082] Based on any of the above embodiments, when loading a library, each sub-element is dynamically assembled based on the library element configuration file to form a corresponding parent element, specifically including:
[0083] Determine the selected element in the panel;
[0084] Based on the description of the sub-element composition of the selected element in the image library element configuration file, determine the relative coordinates of each sub-element of the selected element;
[0085] Based on the relative coordinates of each sub-element of the selected element, each sub-element is combined and drawn in the workspace to form a parent element corresponding to the selected element.
[0086] Based on any of the above embodiments, based on the relative coordinates of each sub-element of the selected element, drawing each sub-element combination in the workspace specifically includes:
[0087] Based on the insertion point coordinates of the selected primitive in the workspace and the relative coordinates of each sub-primitive, determine the absolute coordinates of each sub-primitive in the workspace;
[0088] Read the dwg files of each sub-element;
[0089] Based on the absolute coordinates of each sub-entity in the workspace, the dwg file of the corresponding sub-entity is drawn in the workspace.
[0090] Based on any of the above embodiments, the graphic element attribute configuration file includes attribute information of each type of graphic element.
[0091] The device provided by the embodiment of the present invention reduces the complexity of primitive attribute configuration and further improves the flexibility of primitive configuration by storing attribute information contained in each type of primitive in a primitive attribute configuration file according to primitive type.
[0092] Based on any of the above embodiments, the parent class graphic element is dynamically configured based on the graphic element attribute configuration file, specifically including:
[0093] Based on the type of the parent class element, query the attribute information of the parent class element from the element attribute configuration file;
[0094] The attribute information of the parent class entity is stored in the extended dictionary of the parent class entity.
[0095] Based on any of the above embodiments, the configuration file reading unit 510 is specifically used for:
[0096] Get the gallery element configuration file and element attribute configuration file;
[0097] Deserialize and extract the image library element configuration file and the element attribute configuration file to obtain the element configuration information of each element and the attribute information of each type of element;
[0098] Based on the primitive configuration information of each primitive and the attribute information of each type of primitive, the primitives and primitive attributes are associated according to the primitive type.
[0099] Based on any of the above embodiments, the gallery primitive configuration file and the primitive attribute configuration file are structured data or semi-structured data.
[0100] Figure 6 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 6 As shown, the electronic device may include: a processor 610, a communication interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communication interface 620 and the memory 630 communicate with each other through the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute the library element configuration method, which includes: reading a library element configuration file and an element attribute configuration file; the library element configuration file includes a description of the sub-element composition of each element; when loading the library, based on the library element configuration file, dynamically assembling each sub-element to form a corresponding parent element, and dynamically configuring the attributes of the parent element based on the element attribute configuration file.
[0101] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0102] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the library element configuration method provided by the above-mentioned methods, and the method includes: reading a library element configuration file and an element attribute configuration file; the library element configuration file contains a description of the sub-element composition of each element; when loading the library, based on the library element configuration file, dynamically assemble each sub-element to form a corresponding parent class element, and based on the element attribute configuration file, dynamically configure the attributes of the parent class element.
[0103] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the above-mentioned library element configuration methods, the methods comprising: reading a library element configuration file and an element attribute configuration file; the library element configuration file contains a description of the sub-element composition of each element; when loading the library, based on the library element configuration file, dynamically assembling each sub-element to form a corresponding parent class element, and dynamically configuring the attributes of the parent class element based on the element attribute configuration file.
[0104] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0105] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0106] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for configuring picture elements in a picture library, characterized in that: include: Read the image library element configuration file and the element attribute configuration file; The library graphic element configuration file includes a description of the sub-graphic element composition of each graphic element; When loading a library, dynamically assemble each sub-element based on the library element configuration file to form a corresponding parent element, and dynamically configure the attributes of the parent element based on the element attribute configuration file; When the library is loaded, each sub-element is dynamically assembled based on the library element configuration file to form a corresponding parent element, specifically including: Determine the selected element in the panel; Determine the relative coordinates of each sub-element of the selected element based on the sub-element composition description of the selected element in the image library element configuration file; Based on the relative coordinates of each sub-element of the selected element, each sub-element is combined and drawn in the workspace to form a parent element corresponding to the selected element; Drawing the sub-element combinations in the workspace based on the relative coordinates of the sub-element of the selected element specifically includes: Determine the absolute coordinates of each sub-element in the workspace based on the insertion point coordinates of the selected element in the workspace and the relative coordinates of each sub-element; Read the dwg files of each sub-element; Based on the absolute coordinates of each sub-element in the workspace, the dwg file of the corresponding sub-element is drawn in the workspace.
2. The method for configuring picture library elements according to claim 1, characterized in that: The graphic element attribute configuration file includes attribute information of each type of graphic element.
3. The method for configuring picture library elements according to claim 2, characterized in that: The dynamically configuring the attributes of the parent class graphic element based on the graphic element attribute configuration file specifically includes: Based on the type of the parent class primitive, query the attribute information of the parent class primitive from the primitive attribute configuration file; The attribute information of the parent class primitive is stored in an extended dictionary of the parent class primitive.
4. The method for configuring picture library elements according to claim 2, characterized in that: The reading of the gallery element configuration file and the element attribute configuration file specifically includes: Obtaining the gallery graphic element configuration file and the graphic element attribute configuration file; Deserialize and extract the image library primitive configuration file and the primitive attribute configuration file to obtain primitive configuration information of each primitive and attribute information of each type of primitive; Based on the primitive configuration information of each primitive and the attribute information of each type of primitive, the primitives and primitive attributes are associated according to the primitive type.
5. The method for configuring picture library elements according to any one of claims 1 to 4, characterized in that: The gallery graphic element configuration file and the graphic element attribute configuration file are structured data or semi-structured data.
6. A device for configuring picture elements in a picture library, characterized in that: include: A configuration file reading unit, used for reading a gallery element configuration file and an element attribute configuration file; The library graphic element configuration file includes a description of the sub-graphic element composition of each graphic element; A dynamic loading unit for a picture library, used for dynamically assembling each sub-picture element based on the picture library picture element configuration file to form a corresponding parent class picture element when loading the picture library, and dynamically configuring the attributes of the parent class picture element based on the picture element attribute configuration file; When the library is loaded, each sub-element is dynamically assembled based on the library element configuration file to form a corresponding parent element, specifically including: Determine the selected element in the panel; Determine the relative coordinates of each sub-element of the selected element based on the sub-element composition description of the selected element in the image library element configuration file; Based on the relative coordinates of each sub-element of the selected element, each sub-element is combined and drawn in the workspace to form a parent element corresponding to the selected element; Drawing the sub-element combinations in the workspace based on the relative coordinates of the sub-element of the selected element specifically includes: Determine the absolute coordinates of each sub-element in the workspace based on the insertion point coordinates of the selected element in the workspace and the relative coordinates of each sub-element; Read the dwg files of each sub-element; Based on the absolute coordinates of each sub-element in the workspace, the dwg file of the corresponding sub-element is drawn in the workspace.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the library primitive configuration method as described in any one of claims 1 to 5 are implemented.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for configuring the image gallery primitives as claimed in any one of claims 1 to 5 are implemented.
