User component processing method and device
The method and device automate the component adjustment process in electronic design by using a mapping table to match user components with sublayers, reducing manual effort and enhancing design efficiency and quality.
Patent Information
- Application Number
- CN202411190712.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-06
AI Technical Summary
Existing electronic design tools require significant manual adjustments and increased workload due to templated component libraries that do not fully meet specific design requirements, especially for complex designs.
A method and device that utilize a pre-built mapping table to match user component information with sublayer information, determining the user component with the highest matching degree and replacing sublayers in the template with these components, thereby automating the adjustment process.
Reduces the workload and time required for designers by automatically finding and replacing components that best match design requirements, improving design efficiency and quality.
Smart Images

Figure CN119089528A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic design technology, and in particular to a method and device for processing a user component. Background Art
[0002] In the field of electronic design, design teams usually build exclusive component libraries to complete component design content. However, in existing design tools, there are templated design contents, that is, through the information provided by the user (design drawings or input text descriptions), the template library is searched and recalled to find the content that matches the information provided by the user, thereby helping users to quickly generate design content and improve the work efficiency of designers.
[0003] Although in the traditional design process, designers can improve drawing efficiency by using these predefined component libraries to draw designs, because component libraries are often templated, the generated content may not fully meet the specific design requirements of the team. Therefore, although templated generation can speed up the design process, designers still need to manually adjust and replace the content matched by the template library to apply the components and parameters defined by the team. This increases the workload and time and energy of designers, especially when dealing with complex designs, the workload of manual adjustment increases significantly. Summary of the invention
[0004] Based on the above-mentioned deficiencies of the prior art, the present application provides a method and device for processing user components to solve the problem of increasing the workload and time and energy of designers.
[0005] In order to achieve the above objectives, this application provides the following technical solutions:
[0006] The first aspect of the present application provides a method for processing a user component, including:
[0007] Obtaining component information of all user components in the user team library and layer information of all sublayers in the target template; wherein the component information of the user component at least includes the name and size information of the user component; and the layer information of the sublayer at least includes the target name and target information of the sublayer;
[0008] For all the sub-layers, respectively, in a pre-built mapping table, the target name and target size information of the sub-layers are matched with the name and size information of all the user components;
[0009] When there are multiple target user components matching the sublayer among all the user components, determine the target user component with the highest matching degree with the sublayer from each of the target user components; wherein the target user component refers to a user component whose name and size information are consistent with the target name and target size information of the sublayer;
[0010] Replace the sublayer in the target template with the target user component with the highest matching degree;
[0011] All target user components in the target template are adjusted.
[0012] Optionally, in the above-mentioned method for processing user components, the step of obtaining component information of all user components in the user team library and layer information of all sublayers in the target template includes:
[0013] In response to triggering a component selection operation in a menu bar in the design platform, displaying a component interface;
[0014] In response to triggering a selection operation in the component interface, according to the user team library selected by the user in the component interface, obtaining component information of all user components in the user team library from a database;
[0015] Obtaining search information sent by the user, and searching the template library for a template list corresponding to the search information;
[0016] In response to triggering a selection operation in the template list, layer information of all sub-layers in the target template is obtained according to the target template selected in the template list.
[0017] Optionally, in the above-mentioned method for processing user components, determining the target user component with the highest matching degree with the sub-layer from each of the target user components includes:
[0018] Determine the edit distance between the sublayer and each of the target user components;
[0019] When there are multiple minimum target edit distances among all edit distances, obtain the target user components corresponding to all target edit distances;
[0020] Calculating size differences between the sublayer and target user components corresponding to all target edit distances;
[0021] Extracting a target size difference with a minimum difference from all size differences, and determining a target user component corresponding to the target size difference as the target user component with the highest matching degree with the sublayer;
[0022] When there is a target edit distance with a minimum value among all edit distances, the target user component corresponding to the target edit distance is determined as the target user component with the highest matching degree with the sub-layer.
[0023] Optionally, in the above-mentioned method for processing user components, determining the edit distance between the sub-layer and each of the target user components includes:
[0024] For each of the target user components, respectively, modify the name of the target user component to the target name of the sublayer through an editing operation, and record the number of modifications; wherein the number of modifications refers to the number of times the name is completely modified to the target name through the editing operation;
[0025] The number of modifications is determined as an edit distance between the sublayer and the target user component.
[0026] Optionally, in the above-mentioned method for processing user components, the step of calculating the size differences between the sublayer and all target user components corresponding to the target edit distances includes:
[0027] Extracting the target width and target height of the sublayer from the target size information of the sublayer, and extracting the width and height of each target user component from the size information of all target user components corresponding to the target edit distances;
[0028] For each target user component corresponding to the target edit distance, calculate a first absolute value of a difference between a target width of the sublayer and a width of the target user component;
[0029] Calculate a second absolute value of the difference between the target height of the sublayer and the height of the target user component;
[0030] The first absolute value and the second absolute value are summed to obtain a size difference between the sublayer and the target user component.
[0031] Optionally, in the above method for processing user components, the adjusting all target user components in the target template includes:
[0032] Acquire the text content and layout information of all target sublayers; wherein the target sublayer refers to the sublayer replaced by the target user component in the target template; the layout information at least includes the width layout mode and the height layout mode of the target sublayer;
[0033] For each of the target sub-layers, searching for a replacement user component corresponding to the target sub-layer from all target user components included in the target template; wherein the replacement user component refers to a target user component that replaces the target sub-layer;
[0034] Copy the text content of the target sublayer to the replacement user component;
[0035] The width layout mode of the replacement user component is adjusted to the width layout mode of the target sublayer, and the height layout mode of the replacement user component is adjusted to the height layout mode of the target sublayer.
[0036] Optionally, in the above-mentioned method for processing user components, after matching the target name and target size information of the sublayer with the name and size information of all the user components in a pre-built mapping table for all the sublayers, the method further includes:
[0037] When there is a target user component matching the sublayer among all the user components, replacing the sublayer in the target template with the target user component;
[0038] All target user components in the target template are adjusted.
[0039] A second aspect of the present application provides a user component processing device, including:
[0040] An information acquisition unit, used to acquire component information of all user components in the user team library and layer information of all sub-layers in the target template; wherein the component information of the user component at least includes the name and size information of the user component; and the layer information of the sub-layer at least includes the target name and target information of the sub-layer;
[0041] A matching unit, for matching the target name and target size information of the sub-layers with the name and size information of all the user components in a pre-built mapping table for all the sub-layers respectively;
[0042] A component determination unit, configured to determine, when there are multiple target user components matching the sublayer among all the user components, a target user component with the highest matching degree with the sublayer from each of the target user components; wherein the target user component refers to a user component whose name and size information are consistent with the target name and target size information of the sublayer;
[0043] A replacement unit, configured to replace the sublayer in the target template with the target user component with the highest matching degree;
[0044] The adjustment unit is used to adjust all target user components in the target template.
[0045] Optionally, in the above-mentioned processing device of the user component, the information acquisition unit includes:
[0046] A display unit, for displaying a component interface in response to triggering a component selection operation in a menu bar in the design platform;
[0047] A first acquisition unit, configured to, in response to triggering a selection operation in the component interface, acquire component information of all user components in the user team library from a database according to a user team library selected by a user in the component interface;
[0048] A second acquisition unit is used to acquire the search information sent by the user and search the template library for a template list corresponding to the search information;
[0049] A third acquisition unit is configured to acquire layer information of all sub-layers in the target template according to the target template selected in the template list in response to triggering a selection operation in the template list.
[0050] Optionally, in the above-mentioned user component processing device, the component determination unit includes:
[0051] A distance determination unit, used to determine the edit distance between the sub-layer and each of the target user components;
[0052] A component acquisition unit, used for acquiring target user components corresponding to all target edit distances when there are multiple minimum target edit distances among all edit distances;
[0053] A difference calculation unit, used for calculating the size differences between the sublayer and the target user components corresponding to all the target edit distances;
[0054] A first determining subunit is used to extract a target size difference with a minimum difference from all size differences, and determine a target user component corresponding to the target size difference as the target user component with the highest matching degree with the sublayer;
[0055] The second determining subunit is configured to determine, when there is a target edit distance with a minimum value among all edit distances, a target user component corresponding to the target edit distance as the target user component with the highest matching degree with the sublayer.
[0056] Optionally, in the processing device of the user component, the distance determination unit includes:
[0057] A modification unit, for modifying the name of each target user component to the target name of the sublayer through an editing operation, and recording the number of modifications; wherein the number of modifications refers to the number of times the name is completely modified to the target name through the editing operation;
[0058] The distance sub-determination unit determines the number of modifications as the edit distance between the sub-layer and the target user component.
[0059] Optionally, in the processing device of the user component, the difference calculation unit includes:
[0060] An extraction unit, configured to extract a target width and a target height of the sublayer from the target size information of the sublayer, and to extract a width and a height of each target user component from the size information of all target user components corresponding to the target edit distances;
[0061] A first calculation unit, configured to calculate, for each of the target user components corresponding to the target edit distance, a first absolute value of a difference between a target width of the sublayer and a width of the target user component;
[0062] A second calculation unit, used for calculating a second absolute value of a difference between a target height of the sublayer and a height of the target user component;
[0063] A summing unit is used to sum the first absolute value and the second absolute value to obtain a size difference between the sub-layer and the target user component.
[0064] Optionally, in the above-mentioned processing device of the user component, the adjustment unit includes:
[0065] A fourth acquisition unit is used to acquire the text content and layout information of all target sub-layers; wherein the target sub-layer refers to the sub-layer replaced by the target user component in the target template; the layout information at least includes the width layout mode and the height layout mode of the target sub-layer;
[0066] A search unit, configured to search for a replacement user component corresponding to the target sublayer from all target user components included in the target template for each target sublayer; wherein the replacement user component refers to a target user component that replaces the target sublayer;
[0067] A copying unit, used for copying the text content of the target sub-layer to the replacement user component;
[0068] The adjusting subunit is used to adjust the width layout mode of the replacement user component to the width layout mode of the target sublayer, and to adjust the height layout mode of the replacement user component to the height layout mode of the target sublayer.
[0069] Optionally, the processing device of the user component further includes:
[0070] A replacement subunit, used for replacing the sublayer in the target template with the target user component when there is a target user component matching the sublayer among all the user components;
[0071] The adjustment subunit is used to adjust all target user components in the target template.
[0072] The present application provides a method for processing user components, which obtains the component information of all user components in the user team library and the layer information of all sublayers in the target template, wherein the component information of the user component at least includes the name and size information of the user component, and the layer information of the sublayer at least includes the target name and target information of the sublayer, and then for all sublayers, respectively, in a pre-built mapping table, the target name and target size information of the sublayer are matched with the name and size information of all user components, when there are multiple target user components matching the sublayer in all user components, the target user component with the highest matching degree with the sublayer is determined from each target user component, wherein the target user component refers to the user component whose name and size information are consistent with the target name and target size information of the sublayer, and then the target user component with the highest matching degree replaces the sublayer in the target template, and finally adjusts all target user components in the target template. Thus, the user component that best matches the sublayer in the template is found through the mapping table, and the sublayer is replaced by it, which avoids the need for designers to manually adjust and replace the content matched by the template library, thereby effectively reducing the workload and time and energy of designers. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0074] Figure 1 A flowchart of a method for processing a user component provided in an embodiment of the present application;
[0075] Figure 2A schematic diagram of a display component interface provided in an embodiment of the present application;
[0076] Figure 3 A schematic diagram of the structure of a display interface of a template list provided in an embodiment of the present application;
[0077] Figure 4 A schematic diagram of a flow chart of a sub-layer matching method provided in an embodiment of the present application;
[0078] Figure 5 A flowchart of a method for determining an edit distance provided in an embodiment of the present application;
[0079] Figure 6 A schematic diagram of a flow chart of a method for calculating a size difference provided in an embodiment of the present application;
[0080] Figure 7 A schematic diagram of a flow chart of a method for adjusting a target user component in a template provided in an embodiment of the present application;
[0081] Figure 8 A schematic diagram of the structure of a processing device for a user component provided in another embodiment of the present application. DETAILED DESCRIPTION
[0082] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0083] In this application, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0084] The present application embodiment provides a method and device for processing a user component, such as Figure 1 As shown, the specific steps include:
[0085] S101. Obtain component information of all user components in the user team library and layer information of all sublayers in the target template.
[0086] The layer information of a sublayer includes at least the target name and target information of the sublayer.
[0087] It is understandable that the user team library refers to the file library that stores styles and user components, so there can be multiple user team libraries. It should be noted that the file library (that is, the user team library) can be used for sharing and become a public asset within the designer team. All designers in this team can use the user team library.
[0088] Optionally, the designer can select a user team library to open in the user team library selection interface provided by the system. Accordingly, the system will respond to the designer's selection operation to obtain the user team library selected by the designer, thereby obtaining the component information of all user components in the user team library selected by the designer from the MasterGo database. The component information of the user component includes at least the name and size information of the user component.
[0089] The target template refers to the template that the designer searches for in the template library according to his own needs. Each template in the template library has multiple sub-layers, and each sub-layer has corresponding layer information. Therefore, after the system searches for the target template, it will automatically obtain the layer information of all sub-layers in the target template. Among them, the layer information of the sub-layer includes at least the target name and target information of the sub-layer.
[0090] Optionally, in another embodiment of the present application, a specific implementation of step S101 includes the following steps:
[0091] In response to triggering a component selection operation in a menu bar in the design platform, a component interface is displayed.
[0092] It is understandable that when a designer has a design need, he or she will first use the design platform displayed on the front end to select a component from the menu bar of the options. The system will then respond to the component selection operation in the menu bar in the design platform and display the component interface to the designer.
[0093] For details, see Display component interface. Figure 2 The content shown.
[0094] In response to triggering a selection operation in the component interface, component information of all user components in the user team library is acquired from the database according to the user team library selected by the user in the component interface.
[0095] Specifically, after the component interface is shown to the designer, the designer will select the user team library, that is, the file library, that he needs in the component interface according to his needs. At this time, the system will automatically obtain the component information of all user components in the user team library from the database based on the user team library selected by the designer, so as to complete the adaptation operation in the target template later.
[0096] Get the search information sent by the user, and search the template library for a list of templates corresponding to the search information.
[0097] It should be noted that the target template acquisition process is divided into two parts: template retrieval and template generation. The template retrieval needs to retrieve matching template content based on the retrieval information. Therefore, it is necessary to first obtain the retrieval information sent by the user and search the template library for the template list corresponding to the retrieval information.
[0098] In response to a selection operation in the trigger template list, layer information of all sublayers in the target template is obtained according to the target template selected in the template list.
[0099] It should be noted that the template is generated based on the template list obtained by retrieval, and the user can then choose to generate one of them. Therefore, after the system searches for the template list corresponding to the retrieval information, it will be displayed to the designer so that the designer can select one of the items in the template list. The system will then generate the template based on the template selected by the designer, that is, the target template, and obtain the layer information of all sub-layers in the target template for subsequent adaptation operations.
[0100] For details, please refer to the schematic diagram of the structure of the template list display interface. Figure 3 The content shown.
[0101] It should also be noted that obtaining component information of all user components in the user team library and obtaining layer information of all sublayers in the target template can be done in parallel without any order of precedence, because they are two independent tasks that do not interfere with each other.
[0102] S102 . For all sub-layers respectively, in a pre-built mapping table, match the target name and target size information of the sub-layers with the name and size information of all user components respectively.
[0103] It should be noted that the mapping table is a dynamically maintained table content, which contains a large number of matching rules, and the mapping table will be iteratively updated as needed, such as adding new rules, adjusting existing rules, deleting rules, etc. Therefore, in the embodiment of the present application, the mapping table can be used to accurately find matching user components for all sub-layers, so the specific content of the mapping table can be seen in Table 1:
[0104] Table 1
[0105]
[0106]
[0107]
[0108]
[0109] It should also be noted that Table 1 is only used for illustration, and the mapping table is not limited to the content shown in Table 1.
[0110] Specifically, the target names and target size signals of all sub-layers, as well as the names and size information of all user components, can be compared and searched in the mapping table, so as to find the matching sub-layers and user components from all sub-layers and all user components. More specifically, when matching names in the mapping table, it is case-insensitive, and spaces / - are regarded as the same content, for example, badge-dot and Badge / dot are regarded as the same name.
[0111] S103: When there are multiple target user components matching the sub-layer among all the user components, determine the target user component with the highest matching degree with the sub-layer from each target user component.
[0112] The target user component refers to a user component whose name and size information are consistent with the target name and target size information of the sublayer.
[0113] It should be noted that when there are multiple target user components matching the sub-layer among all the matched user components, it is necessary to find the target user component with the highest matching degree with the sub-layer from the target user components according to the pre-established priority rules. Only based on the target user component with the highest matching degree can the designer improve the content generated by the templated solution to better meet the designer's design requirements.
[0114] S104: Replace the sublayer in the target template with the target user component with the highest matching degree.
[0115] It is understandable that after finding the target user component that best matches all sub-layers in the target template based on the mapping table, it is also necessary to replace the sub-layer in the target template with the target user component with the highest matching degree, so as to achieve the use of user components to generate design content instead of design content generated by templated solutions, thereby improving the quality of design content and reducing the time cost of designers manually replacing sub-layers.
[0116] Optionally, in another embodiment of the present application, a specific implementation of step S104 is as follows: Figure 4 As shown, the following steps are included:
[0117] S401: Determine the edit distance between each sub-layer and each target user component.
[0118] It should be noted that when there are multiple matching target user components in a sublayer, the target user component that best matches the sublayer can be found based on the edit distance, so the edit distance between the sublayer and each target user component needs to be determined in advance. The edit distance is also called the Levenshtein Distance, which is an indicator to measure the similarity between two strings. It is defined as the minimum number of edit operations required to convert one string into another.
[0119] Optionally, in another embodiment of the present application, a specific implementation of step S401 is as follows: Figure 5 As shown, the following steps are included:
[0120] S501. For each target user component, modify the name of the target user component to the target name of the sublayer through an editing operation, and record the number of modifications.
[0121] The number of modifications refers to the number of times the name is completely modified to the target name through editing operations.
[0122] It can be understood that in the embodiment of the present application, the target user component closest to the sublayer can be found based on the edit distance, because the edit distance is used to measure the similarity between two strings, also known as the Levenshtein distance, which represents the minimum number of operations required to convert one string into another by inserting, deleting or replacing a character, that is, through the editing operation of insertion, deletion or replacement, the name of the target user component is modified to the target name of the sublayer, and the minimum number of operations, that is, the number of modifications, is recorded.
[0123] For example, suppose there is a target user component named "component" that needs to be modified to a sublayer of "target". You can modify "component" to "target" by replacing 'c' with 't' and inserting 'a' and 'r', then the edit distance is 3. Therefore, we will record 3 as the number of modifications.
[0124] S502: Determine the number of modifications as the edit distance between the sub-layer and the target user component.
[0125] S402: Determine whether there are multiple minimum target edit distances among all edit distances.
[0126] It can be understood that when the edit distances between the sub-layer and each target user component are determined, in order to determine the target user component that best matches the sub-layer from multiple target user components so that the target user component is more in line with the design style in the target template, the minimum target edit distance can be extracted from all edit distances, and there may be one or more minimum target edit distances. Therefore, in order to further understand the number of minimum values, it is necessary to further determine whether there are multiple minimum target edit distances among all edit distances. Therefore, if there are multiple minimum target edit distances among all edit distances, execute step S403.
[0127] If there are not multiple minimum target edit distances among all edit distances, it means that there may be a minimum target edit distance among all edit distances, so step S406 is executed at this time.
[0128] S403: When there are multiple minimum target edit distances among all edit distances, obtain target user components corresponding to all target edit distances.
[0129] Therefore, when there are multiple minimum target edit distances among all edit distances, it is necessary to obtain the target user components corresponding to all target edit distances, so as to further determine the target user component that best matches the sublayer, that is, execute step S402.
[0130] S404: Calculate the size differences between the sub-layer and the target user components corresponding to all target edit distances.
[0131] Specifically, when there are multiple minimum target edit distances among all edit distances, the most matching target user component can be found based on the size difference, where the size difference refers to the sum of the width and height differences. Therefore, it is necessary to pre-calculate the size differences between the sub-layers and the target user components corresponding to all target edit distances.
[0132] Optionally, in another embodiment of the present application, a specific implementation of step S404 is as follows: Figure 6 As shown, the following steps are included:
[0133] S601, extracting the target width and target height of the sublayer from the target size information of the sublayer, and extracting the width and height of each target user component from the size information of the target user components corresponding to all target edit distances.
[0134] It is understandable that when there are multiple minimum target edit distances among all edit distances, it is necessary to find the most matching target user component through the size difference, that is, to search by the sum of the width and height differences. Therefore, it is necessary to execute step S601 to obtain the target width and target height of the sublayer, as well as the width and height of the target user component.
[0135] S602 : For each target user component corresponding to each target edit distance, calculate a first absolute value of a difference between a target width of the sublayer and a width of the target user component.
[0136] Specifically, the calculation expression of the first absolute value is:
[0137] First absolute value = |TemplateWidth-UserCompWidth|
[0138] S603: Calculate the second absolute value of the difference between the target height of the sublayer and the height of the target user component.
[0139] Specifically, the calculation expression of the second absolute value is:
[0140] The second absolute value = |TemplateHeight-UserCompHeight|
[0141] S604: Sum the first absolute value and the second absolute value to obtain a size difference between the sub-layer and the target user component.
[0142] Specifically, the calculation expression for the size difference between the sublayer and the target user component is:
[0143] |TemplateWidth-UserCompWidth|+|TemplateHeight-UserCompHeight|
[0144] S405 , extracting a target size difference with a minimum difference from all size differences, and determining a target user component corresponding to the target size difference as the target user component with the highest matching degree with the sublayer.
[0145] It can be understood that in the embodiment of the present application, in order to effectively find the target user component that is closest to or has a higher matching degree with the sub-layer, the target size difference with the smallest difference is extracted from all size differences, so that the target user component corresponding to the target size difference is the target user component that best matches the sub-layer.
[0146] S406: When there is a target edit distance with a minimum value among all edit distances, the target user component corresponding to the target edit distance is determined as the target user component with the highest matching degree with the sub-layer.
[0147] S105: Adjust all target user components in the target template.
[0148] It should be noted that after all sublayers in the target template are replaced with the target user components with the highest matching degree, some adaptability adjustments will be automatically made to all target user components in the target template so that the user components better match the design style in the template.
[0149] Optionally, the adjustment means can adjust the size, color, position and other aspects of the target user component. The specific adjustment depends on the desired effect and design specifications. Therefore, in actual operation, graphic design software or development tools can be used to adjust the target user components one by one to ensure that they are consistent with the expected target template.
[0150] Optionally, in another embodiment of the present application, a specific implementation of step S105 is as follows: Figure 7 As shown, the following steps are included:
[0151] S701. Obtain the text content and layout information of all target sub-layers.
[0152] It should be noted that in order for all target user components in the target template to be more consistent with the design style in the target template and effectively help designers save a lot of time for secondary editing, in the application embodiment, it is necessary to use the text content and layout information of the target sub-layer to adjust all target user components in the target template. Among them, the target sub-layer refers to the sub-layer replaced by the target user component in the target template.
[0153] In addition, the layout information includes at least a width layout mode and a height layout mode of the target sublayer.
[0154] S702 , for each target sub-layer, searching for a replacement user component corresponding to the target sub-layer from all target user components included in the target template.
[0155] The replacement user component refers to a target user component that replaces the target sublayer.
[0156] It should be noted that in order to accurately adapt the target user component of the replacement tune based on the text content and layout information of the target sub-layer, it is necessary to find the replacement user component corresponding to the target sub-layer from all the target user components contained in the target template, so as to achieve the effect of "prescribing the right medicine for the right disease".
[0157] S703, copy the text content of the target sub-layer to the replacement user component.
[0158] It should be noted that adaptive adjustments may include adjusting the component copy after replacement. Specifically, since the copy in the user component is usually a placeholder, the copy content will be adjusted according to actual business needs when using the target user component, and the copy in the target template is filled in according to the design effect of this template. Therefore, when using the target user component to replace the sub-layer in the target template, the copy in the replaced sub-layer needs to be copied to the user component, that is, the original copy content in the target template is retained.
[0159] S704: Adjust the width layout mode of the replaced user component to the width layout mode of the target sublayer, and adjust the height layout mode of the replaced user component to the height layout mode of the target sublayer.
[0160] It should be noted that adaptive adjustment may include not only adjusting the replaced component text, but also adjusting the automatic layout settings of the target user component (automatic layout settings are a layout function in the design tool that can automatically sort the layers in the component according to the specified rules without manual adjustment. The automatic layout settings include fixed, adaptive, and full. Fixed means that the width and height of the component are fixed and will not change due to other layers. Adaptive means that the width and height of the component automatically increase or decrease according to the arrangement of the sublayers. Full means that the width and height of the component change according to the size of the parent layer). For specific adjustment rules, please refer to the content shown in Table 2. The specific content is as follows:
[0161] Table 2
[0162]
[0163]
[0164] It should also be noted that Table 2 is an automatic layout adjustment table, which is only used for illustration, and the automatic layout adjustment table is not limited to the content shown in Table 2. At the same time, the automatic layout adjustment table is also a dynamically maintained table content, which will be continuously updated and adjusted as the demand iteration process progresses. For example, a new item may be added, an item may be reduced, or the content of an item may be modified.
[0165] For example, there are three sublayers a, b, and c in the target template, and the target user component is X. Assuming that after the above steps, it is determined that there is a mapping relationship between the sublayer b in the target template and X, the width of b is adapted and the width of X is filled, then the width of X is set to fixed. Or if the height of b is filled and the height of X is adapted, then the height of X is set to filled.
[0166] Optionally, in another embodiment of the present application, after executing step S102, the following steps are further included:
[0167] When there is a target user component matching the sublayer among all user components, the sublayer in the target template is replaced by the target user component.
[0168] It can be understood that when there is a target user component that matches the sublayer among all user components, that is, among multiple user components, a target user component that best matches the sublayer is found, then the sublayer in the target template can be replaced with the best matching user component.
[0169] Make adjustments to all target user components in the target template.
[0170] It should be noted that the specific implementation method of adjusting all target user components in the target template may refer to step S105 in the above method embodiment, which will not be described in detail here.
[0171] The present application provides a method for processing user components, which obtains the component information of all user components in the user team library and the layer information of all sublayers in the target template, wherein the component information of the user component at least includes the name and size information of the user component, and the layer information of the sublayer at least includes the target name and target information of the sublayer, and then for all sublayers, respectively, in a pre-built mapping table, the target name and target size information of the sublayer are matched with the name and size information of all user components, when there are multiple target user components matching the sublayer in all user components, the target user component with the highest matching degree with the sublayer is determined from each target user component, wherein the target user component refers to the user component whose name and size information are consistent with the target name and target size information of the sublayer, and then the target user component with the highest matching degree replaces the sublayer in the target template, and finally adjusts all target user components in the target template. Thus, the user component that best matches the sublayer in the template is found through the mapping table, and the sublayer is replaced by it, which avoids the need for designers to manually adjust and replace the content matched by the template library, thereby effectively reducing the workload and time and energy of designers.
[0172] Another embodiment of the present application provides a processing device for a user component, such as Figure 8 As shown, it includes the following units:
[0173] The information acquisition unit 801 is used to acquire the component information of all user components in the user team library and the layer information of all sub-layers in the target template. The component information of the user component at least includes the name and size information of the user component. The layer information of the sub-layer at least includes the target name and target information of the sub-layer.
[0174] The matching unit 802 is used to match the target name and target size information of the sub-layers with the name and size information of all user components in a pre-built mapping table for all sub-layers respectively.
[0175] The component determination unit 803 is used to determine the target user component with the highest matching degree with the sublayer from each target user component when there are multiple target user components matching the sublayer among all the user components. The target user component refers to the user component whose name and size information are consistent with the target name and target size information of the sublayer.
[0176] The replacement unit 804 is used to replace the sub-layer in the target template with the target user component with the highest matching degree.
[0177] The adjustment unit 805 is used to adjust all target user components in the target template.
[0178] It should be noted that the specific working process of the above-mentioned units in the embodiment of the present application can refer to steps S101 to S105 in the above-mentioned method embodiment, and will not be repeated here.
[0179] Optionally, in a processing device of a user component provided in another embodiment of the present application, the information acquisition unit 801 includes:
[0180] The display unit is used to display the component interface in response to triggering a component selection operation in a menu bar in the design platform.
[0181] The first acquisition unit is used to respond to a selection operation in the trigger component interface and acquire component information of all user components in the user team library from the database according to the user team library selected by the user in the component interface.
[0182] The second acquisition unit is used to acquire the search information sent by the user and search the template library for a template list corresponding to the search information.
[0183] The third acquisition unit is used to respond to the selection operation in the trigger template list and acquire the layer information of all sub-layers in the target template according to the target template selected in the template list.
[0184] Optionally, in a user component processing device provided by another embodiment of the present application, the component determination unit 803 includes:
[0185] The distance determination unit is used to determine the edit distance between the sub-layer and each target user component.
[0186] The component acquisition unit is used to acquire target user components corresponding to all target edit distances when there are multiple minimum target edit distances among all edit distances.
[0187] The difference calculation unit is used to calculate the size difference between the sub-layer and the target user components corresponding to all target edit distances.
[0188] The first determination subunit is used to extract a target size difference with a minimum difference from all size differences, and determine a target user component corresponding to the target size difference as the target user component with the highest matching degree with the sublayer.
[0189] The second determining subunit is configured to determine the target user component corresponding to the target edit distance as the target user component having the highest matching degree with the sublayer when there is a target edit distance with a minimum value among all the edit distances.
[0190] Optionally, in a processing device of a user component provided in another embodiment of the present application, the distance determination unit includes:
[0191] The modification unit is used to modify the name of each target user component to the target name of the sublayer through an editing operation, and record the number of modifications, where the number of modifications refers to the number of times the name is completely modified to the target name through the editing operation.
[0192] The distance sub-determination unit determines the number of modifications as the edit distance between the sub-layer and the target user component.
[0193] Optionally, in a processing device of a user component provided in another embodiment of the present application, the difference calculation unit includes:
[0194] The extraction unit is used to extract the target width and target height of the sublayer from the target size information of the sublayer, and to extract the width and height of each target user component from the size information of the target user components corresponding to all target edit distances.
[0195] The first calculation unit is used to calculate the first absolute value of the difference between the target width of the sublayer and the width of the target user component for each target user component corresponding to the target edit distance.
[0196] The second calculation unit is used to calculate a second absolute value of the difference between the target height of the sublayer and the height of the target user component.
[0197] The summing unit is used to sum the first absolute value and the second absolute value to obtain the size difference between the sub-layer and the target user component.
[0198] Optionally, in a processing device for a user component provided in another embodiment of the present application, the adjusting unit 805 includes:
[0199] The fourth acquisition unit is used to acquire the text content and layout information of all target sub-layers. The target sub-layer refers to the sub-layer replaced by the target user component in the target template. The layout information at least includes the width layout mode and the height layout mode of the target sub-layer.
[0200] The search unit is used to search for a replacement user component corresponding to the target sublayer from all target user components included in the target template for each target sublayer, wherein the replacement user component refers to the target user component that replaces the target sublayer.
[0201] The copy unit is used to copy the text content of the target sublayer to the replacement user component.
[0202] The adjustment subunit is used to adjust the width layout mode of the replaced user component to the width layout mode of the target sublayer, and to adjust the height layout mode of the replaced user component to the height layout mode of the target sublayer.
[0203] Optionally, a user component processing device provided in another embodiment of the present application further includes:
[0204] The sub-replacement unit is used to replace the sub-layer in the target template with the target user component when there is a target user component matching the sub-layer among all user components.
[0205] The adjustment subunit is used to adjust all target user components in the target template.
[0206] It should be noted that the specific working process of each unit provided in the above embodiments of the present application can refer to the corresponding steps in the above method embodiments, and will not be repeated here.
[0207] It should also be noted that a user component processing device provided in an embodiment of the present application has the technical effects of any of the above embodiments, and the embodiments of the present application are not described in detail here.
[0208] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0209] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for processing a user component, characterized in that: include: Obtaining component information of all user components in the user team library and layer information of all sublayers in the target template; wherein the component information of the user component at least includes the name and size information of the user component; and the layer information of the sublayer at least includes the target name and target information of the sublayer; For all the sub-layers, respectively, in a pre-built mapping table, the target name and target size information of the sub-layers are matched with the name and size information of all the user components; When there are multiple target user components matching the sublayer among all the user components, determine the target user component with the highest matching degree with the sublayer from each of the target user components; wherein the target user component refers to a user component whose name and size information are consistent with the target name and target size information of the sublayer; Replace the sublayer in the target template with the target user component with the highest matching degree; All target user components in the target template are adjusted.
2. The method according to claim 1, characterized in that The component information of all user components in the user team library and the layer information of all sublayers in the target template are obtained, including: In response to triggering a component selection operation in a menu bar in the design platform, displaying a component interface; In response to triggering a selection operation in the component interface, according to the user team library selected by the user in the component interface, obtaining component information of all user components in the user team library from a database; Obtaining search information sent by the user, and searching the template library for a template list corresponding to the search information; In response to triggering a selection operation in the template list, layer information of all sub-layers in the target template is obtained according to the target template selected in the template list.
3. The method according to claim 1, characterized in that The step of determining, from each of the target user components, a target user component having the highest matching degree with the sub-layer, includes: Determine the edit distance between the sublayer and each of the target user components; When there are multiple minimum target edit distances among all edit distances, the target user components corresponding to all target edit distances are obtained; Calculating size differences between the sublayer and target user components corresponding to all target edit distances; Extracting a target size difference with a minimum difference from all size differences, and determining a target user component corresponding to the target size difference as the target user component with the highest matching degree with the sublayer; When there is a target edit distance with a minimum value among all edit distances, the target user component corresponding to the target edit distance is determined as the target user component with the highest matching degree with the sublayer.
4. The method according to claim 3, characterized in that The determining the edit distance between the sub-layer and each of the target user components includes: For each of the target user components, respectively, modify the name of the target user component to the target name of the sublayer through an editing operation, and record the number of modifications; wherein the number of modifications refers to the number of times the name is completely modified to the target name through the editing operation; The number of modifications is determined as an edit distance between the sublayer and the target user component.
5. The method according to claim 3, characterized in that: The calculating the size difference between the sublayer and the target user components corresponding to all the target edit distances respectively includes: Extracting the target width and target height of the sublayer from the target size information of the sublayer, and extracting the width and height of each target user component from the size information of all target user components corresponding to the target edit distances; For each target user component corresponding to the target edit distance, calculate a first absolute value of a difference between a target width of the sublayer and a width of the target user component; Calculate a second absolute value of the difference between the target height of the sublayer and the height of the target user component; The first absolute value and the second absolute value are summed to obtain a size difference between the sublayer and the target user component.
6. The method according to claim 1, characterized in that The adjusting of all target user components in the target template includes: Acquire the text content and layout information of all target sublayers; wherein the target sublayer refers to the sublayer replaced by the target user component in the target template; the layout information at least includes the width layout mode and the height layout mode of the target sublayer; For each of the target sub-layers, searching for a replacement user component corresponding to the target sub-layer from all target user components included in the target template; wherein the replacement user component refers to a target user component that replaces the target sub-layer; Copy the text content of the target sublayer to the replacement user component; The width layout mode of the replacement user component is adjusted to the width layout mode of the target sublayer, and the height layout mode of the replacement user component is adjusted to the height layout mode of the target sublayer.
7. The method according to claim 1, characterized in that After matching the target name and target size information of the sublayer with the name and size information of all the user components in the pre-built mapping table for all the sublayers, the method further includes: When there is a target user component matching the sublayer among all the user components, replacing the sublayer in the target template with the target user component; All target user components in the target template are adjusted.
8. A processing device for a user component, characterized in that: include: An information acquisition unit, used to acquire component information of all user components in the user team library and layer information of all sub-layers in the target template; wherein the component information of the user component at least includes the name and size information of the user component; and the layer information of the sub-layer at least includes the target name and target information of the sub-layer; A matching unit, for matching the target name and target size information of the sub-layers with the name and size information of all the user components in a pre-built mapping table for all the sub-layers respectively; A component determination unit, configured to determine, when there are multiple target user components matching the sublayer among all the user components, a target user component with the highest matching degree with the sublayer from each of the target user components; wherein the target user component refers to a user component whose name and size information are consistent with the target name and target size information of the sublayer; A replacement unit, configured to replace the sublayer in the target template with the target user component with the highest matching degree; The adjustment unit is used to adjust all target user components in the target template.
9. The device according to claim 8, characterized in that The information acquisition unit comprises: A display unit, for displaying a component interface in response to triggering a component selection operation in a menu bar in the design platform; A first acquisition unit, configured to, in response to triggering a selection operation in the component interface, acquire component information of all user components in the user team library from a database according to a user team library selected by a user in the component interface; A second acquisition unit is used to acquire the search information sent by the user and search the template library for a template list corresponding to the search information; A third acquisition unit is configured to acquire layer information of all sub-layers in the target template according to the target template selected in the template list in response to triggering a selection operation in the template list.
10. The device according to claim 8, characterized in that The component determination unit includes: A distance determination unit, used to determine the edit distance between the sub-layer and each of the target user components; A component acquisition unit, used for acquiring target user components corresponding to all target edit distances when there are multiple minimum target edit distances among all edit distances; A difference calculation unit, used for calculating the size differences between the sublayer and the target user components corresponding to all the target edit distances; A first determining subunit is used to extract a target size difference with a minimum difference from all size differences, and determine a target user component corresponding to the target size difference as the target user component with the highest matching degree with the sublayer; The second determining subunit is configured to determine, when there is a target edit distance with a minimum value among all edit distances, a target user component corresponding to the target edit distance as the target user component with the highest matching degree with the sublayer.
