CN114675824A - Layout file generation method and device, electronic equipment and storage medium - Google Patents

Layout file generation method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114675824A
CN114675824A CN202011563018.4A CN202011563018A CN114675824A CN 114675824 A CN114675824 A CN 114675824A CN 202011563018 A CN202011563018 A CN 202011563018A CN 114675824 A CN114675824 A CN 114675824A
Authority
CN
China
Prior art keywords
layout
template
parameters
elements
attribute
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011563018.4A
Other languages
Chinese (zh)
Inventor
徐和银
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Gridsum Technology Co Ltd
Original Assignee
Beijing Gridsum Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Gridsum Technology Co Ltd filed Critical Beijing Gridsum Technology Co Ltd
Priority to CN202011563018.4A priority Critical patent/CN114675824A/en
Publication of CN114675824A publication Critical patent/CN114675824A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/186Templates

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention relates to a layout file generation method, a layout file generation device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring template identification information and template layout parameters, wherein the template layout parameters comprise attribute parameters and rule parameters; extracting a layout template corresponding to the template identification information from a pre-constructed template set list according to the template identification information; acquiring elements corresponding to the attribute parameters from a pre-constructed element library according to the attribute parameters; and according to the rule parameters, positioning the positions of the elements in the layout template, and filling the elements to the positions to generate a layout file. By the method, the existing file layout mode is abandoned, automatic layout is realized according to user-defined requirements, and layout files are generated. Therefore, the individual requirements of the user are ensured, and the expected layout effect of the user is achieved.

Description

Layout file generation method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for generating a layout file, an electronic device, and a storage medium.
Background
In the computer programming process, the layout is an integral part of the interface design process. The good layout mode can provide good design support for the content display of the whole system. The interface layout influences the practicability of the system, the popularization and the sale of the system or products and the like.
The layout methods in the prior art include, for example, a streaming layout, a floating layout, a relative layout, an absolute layout, and the like.
And (3) in a streaming layout, namely a layout without decoration, all elements occupy the left in the container, and the automatic line feed of insufficient space is carried out for processing. In the floating layout, in the case of the streaming layout, the positions of elements of the streaming layout are changed by floating. Relative layout, the emphasis is on "relative", i.e., the operation of positioning relative to the position of the current element in the parent element. The absolute layout, the emphasis is "absolute", and the position of the current element is referred to the origin of the parent element to perform the position locating operation.
Obviously, the layout modes have respective rules, and when a user desires to realize personalized element layout, the expected effect cannot be achieved by simply using any layout mode. Therefore, how to complete the automatic layout according to the layout mode desired by the user becomes a technical problem to be solved by the application.
Disclosure of Invention
In order to solve the technical problems described above or at least partially solve the technical problems, the present invention provides a layout file generation method, apparatus, electronic device, and storage medium.
In a first aspect, the present invention provides a layout file generating method, including:
acquiring template identification information and template layout parameters, wherein the template layout parameters comprise attribute parameters and rule parameters;
extracting a layout template corresponding to the template identification information from a pre-constructed template set list according to the template identification information;
acquiring elements corresponding to the attribute parameters from a pre-constructed element library according to the attribute parameters;
and according to the rule parameters, positioning the positions of the elements in the layout template, and filling the elements to the positions to generate a layout file.
In an optional embodiment of the present invention, the element includes a control and/or a container, and the element library includes a control set and a container set; according to the attribute parameters, obtaining elements corresponding to the attribute parameters from a pre-constructed element library, specifically comprising:
when the element comprises a control, extracting the control corresponding to the attribute parameter from the control set according to the attribute parameter;
and/or, when the element comprises a container, extracting the container corresponding to the attribute parameter from the container combination according to the attribute parameter.
In an alternative embodiment of the invention, the rule parameters include: a first spatial id of the element, and a second spatial id indicating a different region in the layout template;
According to the rule parameters, the positions of the elements in the layout template are positioned, and the method specifically comprises the following steps:
and matching the first space id and the second space id, and when the matching is successful, determining the position of the positioning element in the layout template as an area corresponding to the second space id.
In an alternative embodiment of the invention, the rule parameters further comprise: after the specification parameters of the elements are positioned in the area corresponding to the second space id in the layout template, the method further comprises the following steps:
and determining the space size occupied by the elements in the area corresponding to the second space id according to the specification parameters.
In an alternative embodiment of the invention, the rule parameters further comprise: and the parent container id corresponding to the element is used for indicating that the element is added into the parent container corresponding to the parent container id.
In an alternative embodiment of the invention, the rule parameters further comprise: and the sequence number of the element is used for indicating that the element is added into the area corresponding to the second space id according to the sorting sequence corresponding to the sequence number.
In an alternative embodiment of the invention, the attribute parameters further comprise: a type parameter of the element for indicating a type of the element.
In a second aspect, the present invention provides a layout file generating apparatus, including:
The system comprises an acquisition module, a processing module and a display module, wherein the acquisition module is used for acquiring template identification information and template layout parameters, and the template layout parameters comprise attribute parameters and rule parameters;
the extraction module is used for extracting a layout template corresponding to the template identification information from a pre-constructed template set list according to the template identification information;
the acquisition module is also used for acquiring elements corresponding to the attribute parameters from a pre-constructed element library according to the attribute parameters;
the positioning module is used for positioning the positions of the elements in the layout template according to the rule parameters;
and the filling module is used for filling the elements to the positions so as to generate the layout file.
In a third aspect, the present invention provides an electronic device, comprising: at least one processor, and at least one memory, bus connected with the processor; the processor and the memory complete mutual communication through a bus; the processor is configured to call program instructions in the memory to perform the layout file generation method of any of the first aspects described above.
In a fourth aspect, an embodiment of the present invention provides a storage medium, where one or more programs are stored, and the one or more programs are executable by one or more processors to implement the layout file generation method in any one of the first aspects.
According to the technical scheme provided by the embodiment of the invention, after the template identification information and the template layout parameters are obtained, the component template corresponding to the template identification information is extracted from the pre-constructed template set list according to the template identification information. And then, according to the attribute parameters, acquiring elements corresponding to the attribute parameters from a pre-constructed element library. And then, according to the attribute parameters and the rule parameters, positioning the positions of the elements in the layout template, and filling the elements to the positions to generate a layout file. In the process, the conventional file layout mode is abandoned, and automatic layout is realized according to user-defined requirements, and layout files are generated. Therefore, the personalized requirements of the user are ensured, and the expected layout effect of the user is achieved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments or technical solutions in the prior art of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art to obtain other drawings without inventive labor.
Fig. 1 is a schematic diagram of an implementation flow of a layout file generation method according to an embodiment of the present invention;
FIG. 2 is a schematic view of a grid container provided by the present invention;
FIG. 3 is a schematic view of a horizontal line feed container according to the present invention;
FIG. 4 is a schematic view of a horizontal vessel provided by the present invention;
FIG. 5 is a schematic view of a vertical vessel provided by the present invention;
FIG. 6 is a schematic diagram of a container in a horizontal layout nested in a vertical layout according to the present invention;
FIG. 7 is a schematic diagram of a container in a vertical layout nested with a horizontal layout according to the present invention;
fig. 8 is a schematic structural diagram of a layout file generating apparatus according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
As shown in fig. 1, an implementation flow diagram of a layout file generation method provided in an embodiment of the present invention is specifically shown, where the method specifically includes the following steps:
step 110, obtaining template identification information and template layout parameters.
Specifically, the template layout parameters include attribute parameters and rule parameters.
And 120, extracting a layout template corresponding to the template identification information from the pre-constructed template set list according to the template identification information.
Specifically, the template identification information may include, for example, a template name, and/or a template id. Through the identification information, the layout template corresponding to the template name and/or the template id can be inquired from the pre-constructed template set list and extracted to be used as the layout template to be applied subsequently.
In a specific example, the pre-constructed template set may include a more common template or a user-defined template. Of course, the modulo set list may be enriched continuously subsequently to achieve the iterative update of the template set list.
Specifically, each template may be formed by a grid container, and the template mainly functions to divide a space to be laid out into space regions according to the rule of the grid container. Each template consists of a template name (and/or a template id) and a template structure, wherein the template name marks the name of the template (if the template id is the template, the template is used as the unique identifier of the template), and the template structure determines the layout form of the current template. Common structures are contained in the template set list, such as a two-row one-column structure, a three-row two-column structure, and the like. If the current template set list does not meet the requirements of the user, the user can also expand the template set list and generate the required layout template by calling the setting template interface.
And step 130, acquiring elements corresponding to the attribute parameters from the pre-constructed element library according to the attribute parameters.
Optionally, the elements may include controls and/or containers. The control may be, for example, a button control, a text control, a time selection control, and the like, and of course, other controls may also be included, which is not limited herein.
The container may, for example, comprise: the above-mentioned grid containers, horizontal line containers, horizontal containers, vertical containers, nested vertical containers in a horizontal layout, nested horizontal containers in a vertical layout, and the like.
Hereinafter, the above-described containers are described:
grid container: the grid container divides the space occupied by the current container into a division rule specified by a user to divide the whole space, and the grid container is mainly divided according to lines and rows through the current space. For example, the following may be set: the 3 rows and 3 columns first row height 50 pixels, second row and third row are shown with a 1 to 2 effect, the first and second columns are shown with a 1 to 1 effect, and the third column width 100 pixels.
The grid container performs the following operations in the process of page rendering: and a, acquiring the width and the height of the area where the current container is located to obtain the height and the width of the occupied area. b, acquiring a row set [50, 2 ] and a column set [ 100] set by a user. And c, respectively judging whether the sum of the fixed values in the row or column set exceeds the height or width of the area space occupied by the grid container, if so, prompting an error, otherwise, normally executing subsequent calculation. And d, under the condition that the sum of the fixed values of the rows and the columns does not exceed the values of the height and the width of the area space occupied by the grid container, respectively calculating according to the row set and the column set, and assuming that the height of the area occupied by the current container is y and the width is x.
According to the layout division rule, a corresponding specific height set can be obtained through a calculation formula:
[50,(y-50)*1/3,(y-50)*2/3];
width set:
[(x-100)*1/2,(x-100)*1/2,100]。
e: the effect shown in fig. 2 is obtained by the above calculation. Referring specifically to fig. 2, fig. 2 shows that in the width direction, the widths of the last column are 100 pixels, and the widths of the first two columns are respectively in a ratio of 1 to 1, so that the widths of the first two columns are (x-100) × 1/2 pixels. In the height direction, the first row is first arranged with 50 pixels in height, and the barriers in the last two rows are 1 to 2, so that the height of the second row is (y-50) × 1/3 pixels, and the height of the third row is (y-50) × 2/3 pixels.
Horizontal line feed container: the horizontal line feed container is configured to lay out elements placed in the container in a horizontal direction, and the elements are automatically fed when the width of the elements in the container exceeds the width of the space of the area occupied by the horizontal container, for example, the horizontal line feed container is placed in an area with an area space width of x, a plurality of buttons with a width of 90 pixels and a height of 40 pixels are placed in the horizontal line feed container, and when the sum of the widths of the plurality of buttons exceeds x, the last element button in the current row is automatically used as the head element of the next row. Referring specifically to FIG. 3, FIG. 3 illustrates that the last element automatically swaps as the first element of the second row when the sum of the widths of the elements of the first row of the horizontal wrapping container exceeds the total width of the container.
Horizontal container: specifically, as shown in fig. 4, the horizontal container is arranged from left to right by arranging the elements in the container, the default size (preset width) of the elements is realized in the horizontal direction, the entire space is occupied by the vertical direction (height), and when the sum of the widths of the contents of the elements exceeds the width of the space in the area occupied by the horizontal container, the excess contents are hidden.
Vertical container: specifically, as shown in fig. 5, the vertical container displays a default size (preset height) in the vertical direction by arranging the elements placed in the container from top to bottom, the horizontal direction (width) occupies the entire space, and when the sum of the heights of the contents of the elements exceeds the height of the space in the area occupied by the vertical container, the contents of the excess portion are hidden.
The horizontal container and the vertical container are nested for use: the number of the horizontal or vertical layout is relatively small, the number of the horizontal and vertical nesting is large, the concept of axes is introduced, the understanding of axes is simply direction, but the concept of axes in multi-dimensional space includes directions. This is for convenience of description only and will be described in brief.
Basically, all the contact in the development system is a plane space, which is generally described by using two axes, and in the process of layout, the origin of the layout space is generally taken as the origin of the layout according to the upper left corner of the screen. Under the condition of horizontal layout, the horizontal direction is called as a main shaft, and the vertical direction is a secondary shaft; in the case of a vertical layout, conversely, the vertical direction is called the major axis and the horizontal direction is the minor axis.
The horizontal layout nests the vertical layout, first according to a simple rule, because the elements in the vertical layout behave in a similar way as in fig. 5, but because the elements in the vertical layout are put under the horizontal layout due to the nesting, the width of the elements in the vertical layout in the horizontal direction becomes auto (automatic) specific width, which is added by default by the elements, while the elements in the vertical layout also become auto (automatic) all elements finally behave as default width and height of the elements in both the horizontal and vertical directions, as shown in fig. 6.
And nesting the horizontal layout under the vertical layout, wherein the elements are similar to the elements in the nested vertical layout under the horizontal layout, and the rule of nesting the vertical layout under the horizontal layout is adopted. Nesting the horizontal rules under the vertical layout, the width and height of the element finally appear as default width and height, and the element is aligned horizontally, which is different from the element in fig. three, and is specifically shown in fig. 7.
In addition to nesting between horizontal layouts and vertical layouts, horizontal layouts may also nest horizontal layouts and vertical layouts may also nest vertical layouts, since the representation of an element in the case of horizontal and nested horizontal or vertically nested vertical is the same as the representation of an element in a single horizontal or vertical, and will not be described further herein.
Acquiring an element corresponding to the attribute parameter from a pre-constructed element library according to the attribute parameter, which may include:
when the element comprises a control, extracting the control corresponding to the attribute parameter from the control set according to the attribute parameter;
and/or, when the element comprises a container, extracting the container corresponding to the attribute parameter from the container combination according to the attribute parameter.
Further optionally, the attribute parameters may include an id of the element. The id of the element serves as a unique identifier of the element to identify the element itself. And according to the element attribute, actually, the corresponding element is obtained from the element library according to the element id.
Optionally, the attribute parameter of the element may include, in addition to the id of the element, a type parameter of the element to determine the kind of the element.
And 140, positioning the positions of the elements in the layout template according to the rule parameters, and filling the elements to the positions to generate a layout file.
In particular, the rule parameters of an element may include a first spatial id associated with the element and a second spatial id to indicate a different region in the layout template.
According to the rule parameters, the positions of the elements in the layout template are positioned, and the method specifically comprises the following steps:
and matching the first space id and the second space id, and when the matching is successful, positioning the element in the layout template in a region corresponding to the second space id.
Specifically, each element has a corresponding space id, i.e., a first space id. The space id is used to indicate which region of the layout template the element is in. And the element template itself may also set the second spatial id. For identifying different regions in the template. In an alternative example, if the selected template is a two-row and one-column structure, the second space Id corresponding to the upper region is automatically labeled as 1, and the second space Id corresponding to the lower region is automatically labeled as 2. The second spaces Id in the template are accumulated sequentially starting from 1 by the system according to a top-to-bottom left-to-right sequence.
Optionally, the rule parameters may also include specification parameters of the elements. After the location of the element in the layout template is the area corresponding to the second space id, the method further includes:
And determining the space size occupied by the elements in the area corresponding to the second space id according to the specification parameters.
Specifically, the specification parameters may include width, height, and margin, etc. After the rule parameters include the original specification parameters, after the area of the element in the layout template is determined, the size of the space occupied by the element in the area can be determined.
Optionally, the rule parameters may further include: and the parent container id corresponding to the element is used for indicating that the element is added into the parent container corresponding to the parent container id.
That is, when the rule parameter corresponding to the element further includes a parent container id, the current element needs to be a child element of a parent container to which the parent container id belongs according to the parent container id.
Optionally, the rule parameters further include: and the sequence number of the element is used for indicating that the element is added into the area corresponding to the second space id according to the sorting sequence corresponding to the sequence number.
The rule parameters of an element also include the sequence number of the element, in effect to more accurately locate the element in the region. The system can add the elements to the corresponding areas of the layout template in sequence according to the sequence number as required.
In a complete process, according to the rule parameters, the positions of the elements in the layout template are located, and the elements are filled in the positions to generate the layout file, which may include the following processes:
Firstly, matching is carried out according to a first space id of an element and a second space id corresponding to an area in a layout template, and the area where the element is located is determined. For example, the area of the layout template is divided into 3 areas. Then, all elements are divided into 3 groups after the above process is performed.
Then, for each group of elements, the space occupied by the elements in the region is determined according to the specification parameters. And sequentially adding the group of elements into the region according to the sequence numbers in the group of elements. Further, if the element includes a parent element id, it is also necessary to confirm that a child element having the parent element id exists and add the child element to the parent element.
According to the layout file generation method provided by the embodiment of the invention, after the template identification information and the template layout parameters are acquired, the component template corresponding to the template identification information is extracted from the pre-constructed template set list according to the template identification information. And then, acquiring elements corresponding to the attribute parameters from a pre-constructed element library according to the attribute parameters. And then, according to the attribute parameters and the rule parameters, positioning the positions of the elements in the layout template, and filling the elements to the positions to generate a layout file. In the process, the existing file layout mode is abandoned, automatic layout is realized according to user-defined requirements, and layout files are generated. Therefore, the individual requirements of the user are ensured, and the expected layout effect of the user is achieved.
Moreover, the elements can be positioned accurately. The method comprises the steps of including areas of elements in a layout template, accurately determining the positions of the elements according to the sequence of element placement spaces, the size of the space occupied by the elements in the areas, whether the elements are to be placed in corresponding parent elements and the like. Therefore, the method can be applied to the layout process with a complex interface. The positioning of elements by containers such as a grid container partition space, a horizontal container, a horizontal line feed container, a vertical container and the like is efficiently processed, and a personalized efficient layout solution is provided for a user.
Corresponding to the above method embodiment, an embodiment of the present invention further provides a layout file generating apparatus, as shown in fig. 8, the apparatus includes: an acquisition module 801, an extraction module 802, a location module 803, and a fill module 804.
An obtaining module 801, configured to obtain template identification information and template layout parameters, where the template layout parameters include attribute parameters and rule parameters;
an extracting module 802, configured to extract a layout template corresponding to the template identification information from a pre-constructed template set list according to the template identification information;
the obtaining module 801 is further configured to obtain, according to the attribute parameter, an element corresponding to the attribute parameter from a pre-constructed element library;
A positioning module 803, configured to position the element in the layout template according to the rule parameter;
a filling module 804 for filling elements into the positions to generate the layout file.
Optionally, the elements include controls and/or containers, and the element library includes a control set and a container set; the obtaining unit is specifically configured to:
when the element comprises a control, extracting the control corresponding to the attribute parameter from the control set according to the attribute parameter;
and/or, when the element comprises a container, extracting the container corresponding to the attribute parameter from the container combination according to the attribute parameter.
Optionally, the rule parameters include: a first spatial id of the element, and a second spatial id indicating a different region in the layout template;
the positioning module 803 is specifically configured to match the first space id with the second space id, and when the matching is successful, the position of the positioning element in the layout template is an area corresponding to the second space id.
Optionally, the rule parameters further include: specification parameters of the elements, the apparatus further comprising: and the processing module 805 is configured to determine, according to the specification parameter, a size of a space occupied by the element in the area corresponding to the second space id.
Optionally, the rule parameters further include: and the parent container id corresponding to the element is used for indicating that the element is added into the parent container corresponding to the parent container id.
Optionally, the rule parameters further include: and the sequence numbers of the elements are used for indicating that the elements are added into the area corresponding to the second space id according to the sorting sequence corresponding to the sequence numbers.
Optionally, the attribute parameters further include: a type parameter of the element for indicating a type of the element.
The layout file generating apparatus includes a processor and a memory, the obtaining module 801, the extracting module 802, the locating module 803, the filling module 804, the processing module 805, and the like are all stored in the memory as program modules, and the processor executes the program modules stored in the memory to implement corresponding functions.
According to the layout file generation device provided by the embodiment of the invention, after the template identification information and the template layout parameters are obtained, the component template corresponding to the template identification information is extracted from the pre-constructed template set list according to the template identification information. And then, according to the attribute parameters, acquiring elements corresponding to the attribute parameters from a pre-constructed element library. And then, according to the attribute parameters and the rule parameters, positioning the positions of the elements in the layout template, and filling the elements to the positions to generate a layout file. In the process, the existing file layout mode is abandoned, automatic layout is realized according to user-defined requirements, and layout files are generated. Therefore, the individual requirements of the user are ensured, and the expected layout effect of the user is achieved.
Moreover, the elements can be positioned accurately. The layout template comprises areas of elements in the layout template, the positions of the elements are accurately determined according to the sequence in the element placement space, the space occupied by the elements in the areas, whether the elements are to be placed in corresponding parent elements and the like. Therefore, the method can be applied to the layout process with a complex interface. The efficient processing grid container divides the location of space, horizontal container, horizontal line-feed container, vertical container and other containers to elements, and provides a personalized efficient layout solution for users.
The embodiment of the invention also provides a storage medium (computer readable storage medium). The storage medium herein stores one or more programs. Among others, storage media may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, a hard disk, or a solid state disk; the memory may also comprise a combination of memories of the kind described above.
When one or more programs in the storage medium are executable by one or more processors, the layout file generation method executed on the electronic device side as described above is realized.
The processor is used for executing the layout file generation program stored in the memory so as to realize the following steps of the layout file generation method executed on the electronic equipment side:
acquiring template identification information and template layout parameters, wherein the template layout parameters comprise attribute parameters and rule parameters;
extracting a layout template corresponding to the template identification information from a pre-constructed template set list according to the template identification information;
acquiring elements corresponding to the attribute parameters from a pre-constructed element library according to the attribute parameters;
and according to the rule parameters, positioning the positions of the elements in the layout template, and filling the elements to the positions to generate a layout file.
In an optional embodiment of the present invention, the element includes a control and/or a container, and the element library includes a control set and a container set; according to the attribute parameters, obtaining elements corresponding to the attribute parameters from a pre-constructed element library, specifically comprising:
when the element comprises a control, extracting the control corresponding to the attribute parameter from the control set according to the attribute parameter;
and/or, when the element comprises a container, extracting the container corresponding to the attribute parameter from the container combination according to the attribute parameter.
In an alternative embodiment of the invention, the rule parameters include: a first spatial id of the element, and a second spatial id indicating a different region in the layout template;
according to the rule parameters, the positions of the elements in the layout template are positioned, and the method specifically comprises the following steps:
and matching the first space id and the second space id, and when the matching is successful, positioning the element in the layout template in a region corresponding to the second space id.
In an alternative embodiment of the invention, the rule parameters further comprise: after the specification parameters of the elements are positioned in the area corresponding to the second space id in the layout template, the method further comprises the following steps:
and determining the space size occupied by the element in the area corresponding to the second space id according to the specification parameters.
In an alternative embodiment of the invention, the rule parameters further comprise: and the parent container id corresponding to the element is used for indicating that the element is added into the parent container corresponding to the parent container id.
In an alternative embodiment of the invention, the rule parameters further comprise: and the sequence number of the element is used for indicating that the element is added into the area corresponding to the second space id according to the sorting sequence corresponding to the sequence number.
In an alternative embodiment of the invention, the attribute parameters further comprise: a type parameter of the element for indicating a type of the element.
The embodiment of the invention provides a processor, which is used for running a program, wherein the program executes the following steps during running: acquiring template identification information and template layout parameters, wherein the template layout parameters comprise attribute parameters and rule parameters;
extracting a layout template corresponding to the template identification information from a pre-constructed template set list according to the template identification information;
acquiring elements corresponding to the attribute parameters from a pre-constructed element library according to the attribute parameters;
and according to the rule parameters, positioning the positions of the elements in the layout template, and filling the elements to the positions to generate a layout file.
Fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, where the electronic device 90 shown in fig. 9 includes: at least one processor 901, and at least one memory 902, bus 903 connected to processor 901; the processor 901 and the memory 902 complete communication with each other through the bus 903; the processor is used for calling the program instructions in the memory to execute the layout file generation method. The electronic device herein may be a server, a PC, a PAD, a mobile phone, etc.
The invention also provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device:
Acquiring template identification information and template layout parameters, wherein the template layout parameters comprise attribute parameters and rule parameters;
extracting a layout template corresponding to the template identification information from a pre-constructed template set list according to the template identification information;
acquiring elements corresponding to the attribute parameters from a pre-constructed element library according to the attribute parameters;
and according to the rule parameters, positioning the positions of the elements in the layout template, and filling the elements to the positions to generate a layout file.
In an optional embodiment of the present invention, the element includes a control and/or a container, and the element library includes a control set and a container set; according to the attribute parameters, obtaining elements corresponding to the attribute parameters from a pre-constructed element library, specifically comprising:
when the element comprises a control, extracting the control corresponding to the attribute parameter from the control set according to the attribute parameter;
and/or, when the element comprises a container, extracting the container corresponding to the attribute parameter from the container combination according to the attribute parameter.
In an alternative embodiment of the invention, the rule parameters include: a first spatial id of the element, and a second spatial id indicating a different region in the layout template;
According to the rule parameters, the positions of the elements in the layout template are positioned, and the method specifically comprises the following steps:
and matching the first space id and the second space id, and when the matching is successful, determining the position of the positioning element in the layout template as an area corresponding to the second space id.
In an alternative embodiment of the invention, the rule parameters further comprise: after the specification parameters of the elements are positioned in the area corresponding to the second space id in the layout template, the method further comprises the following steps:
and determining the space size occupied by the element in the area corresponding to the second space id according to the specification parameters.
In an alternative embodiment of the invention, the rule parameters further comprise: and the parent container id corresponding to the element is used for indicating that the element is added into the parent container corresponding to the parent container id.
In an alternative embodiment of the invention, the rule parameters further comprise: and the sequence number of the element is used for indicating that the element is added into the area corresponding to the second space id according to the sorting sequence corresponding to the sequence number.
In an alternative embodiment of the invention, the attribute parameters further comprise: a type parameter of the element for indicating a type of the element.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a device includes one or more processors (CPUs), memory, and a bus. The device may also include input/output interfaces, network interfaces, and the like.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip. The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above description is only an example of the present invention and is not intended to limit the present invention. Various modifications and alterations to this invention will become apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.

Claims (10)

1. A layout file generation method, the method comprising:
acquiring template identification information and template layout parameters, wherein the template layout parameters comprise attribute parameters and rule parameters;
extracting a layout template corresponding to the template identification information from a pre-constructed template set list according to the template identification information;
acquiring elements corresponding to the attribute parameters from a pre-constructed element library according to the attribute parameters;
and according to the rule parameters, positioning the positions of the elements in the layout template, and filling the elements to the positions to generate the layout file.
2. The method according to claim 1, wherein the elements comprise controls and/or containers, and the element library comprises a control set and a container set; the obtaining, according to the attribute parameter, an element corresponding to the attribute parameter from a pre-constructed element library specifically includes:
when the element comprises a control, extracting the control corresponding to the attribute parameter from the control set according to the attribute parameter;
and/or when the element comprises a container, extracting a container corresponding to the attribute parameter from the container combination according to the attribute parameter.
3. The method according to claim 1 or 2, wherein the rule parameters comprise: a first spatial id of the element, and a second spatial id indicating a different region in the layout template;
the positioning the position of the element in the layout template according to the rule parameter specifically includes:
and matching the first space id with the second space id, and when the matching is successful, positioning the position of the element in the layout template as an area corresponding to the second space id.
4. The method of claim 3, wherein the rule parameters further comprise: after the positioning of the specification parameter of the element in the layout template is the area corresponding to the second spatial id, the method further includes:
and determining the space size occupied by the element in the area corresponding to the second space id according to the specification parameters.
5. The method of claim 3, wherein the rule parameters further comprise: and the parent container id corresponding to the element is used for indicating that the element is added into the parent container corresponding to the parent container id.
6. The method of claim 3, wherein the rule parameters further comprise: and the sequence numbers of the elements are used for indicating that the elements are added into the area corresponding to the second space id according to the sorting sequence corresponding to the sequence numbers.
7. The method of claim 3, wherein the attribute parameters further comprise: a type parameter of the element for indicating a type of the element.
8. A layout file generation apparatus, characterized in that the apparatus comprises:
the system comprises an acquisition module, a processing module and a display module, wherein the acquisition module is used for acquiring template identification information and template layout parameters, and the template layout parameters comprise attribute parameters and rule parameters;
the extraction module is used for extracting a layout template corresponding to the template identification information from a pre-constructed template set list according to the template identification information;
the acquisition module is further used for acquiring elements corresponding to the attribute parameters from a pre-constructed element library according to the attribute parameters;
the positioning module is used for positioning the positions of the elements in the layout template according to the rule parameters;
and the filling module is used for filling the elements to the positions so as to generate the layout file.
9. An electronic device, comprising: at least one processor, and at least one memory, bus connected with the processor; the processor and the memory complete mutual communication through the bus; the processor is used for calling the program instructions in the memory to execute the method of any one of claims 1-7.
10. A storage medium storing one or more programs, the one or more programs being executable by one or more processors to implement the method of any one of claims 1-7.
CN202011563018.4A 2020-12-25 2020-12-25 Layout file generation method and device, electronic equipment and storage medium Pending CN114675824A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011563018.4A CN114675824A (en) 2020-12-25 2020-12-25 Layout file generation method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011563018.4A CN114675824A (en) 2020-12-25 2020-12-25 Layout file generation method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114675824A true CN114675824A (en) 2022-06-28

Family

ID=82069646

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011563018.4A Pending CN114675824A (en) 2020-12-25 2020-12-25 Layout file generation method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114675824A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117289937A (en) * 2023-11-27 2023-12-26 成都中科极云软件有限公司 Method and system for realizing linkage of internal and external data of layout container in low-code platform

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117289937A (en) * 2023-11-27 2023-12-26 成都中科极云软件有限公司 Method and system for realizing linkage of internal and external data of layout container in low-code platform
CN117289937B (en) * 2023-11-27 2024-01-26 成都中科极云软件有限公司 Method and system for realizing linkage of internal and external data of layout container in low-code platform

Similar Documents

Publication Publication Date Title
CN109375972B (en) Method, apparatus, computer device and storage medium for multi-element layout
KR20170131669A (en) Method and apparatus for generating composite image
US9116648B1 (en) Method for automatic photo album layout and printing
KR20140067252A (en) Apparatus, method and computer readable recording medium for arranging a plurality of the items automatically in a space
CN109062885B (en) Method, device and equipment for adjusting layout of text box
CN108460003B (en) Text data processing method and device
CN114675824A (en) Layout file generation method and device, electronic equipment and storage medium
US20030222922A1 (en) Automatic layout generation
CN110020291B (en) Webpage layout processing method and device
CN111273826B (en) Desktop icon management method, device, equipment and storage medium
CN110633111B (en) Method and device for accelerating loading speed of application interface
CN113867862B (en) List page layout method and computing device
CN113011150B (en) Newspaper typesetting system and method
CN107391144B (en) View display method and device
CN111782740A (en) Seat data processing method, computing device and storage medium
CN115145565A (en) Rule engine-based data visualization large-screen layout method and device
CN113961184A (en) Page layout processing method and device, storage medium and electronic equipment
CN112767419A (en) Method and system for cutting nine-grid of atlas
CN109582191B (en) Menu content display method and device
CN107066245A (en) A kind of processing method and processing device of menu list
CN112800357A (en) Web page presenting method, device, equipment and storage medium
CN112068828A (en) Title control generation method, device, system, equipment and medium
CN115577202A (en) Plate fixed-point adding method and device based on grid layout system
CN117539491B (en) Page layout method, page layout device, electronic device, storage medium and program product
CN112100540B (en) CANVAS-based picture cross mirror tiling method and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination