CN114820729A - Element one-key layout method and device - Google Patents

Element one-key layout method and device Download PDF

Info

Publication number
CN114820729A
CN114820729A CN202210177464.4A CN202210177464A CN114820729A CN 114820729 A CN114820729 A CN 114820729A CN 202210177464 A CN202210177464 A CN 202210177464A CN 114820729 A CN114820729 A CN 114820729A
Authority
CN
China
Prior art keywords
spacing
row
column
selected element
determining
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
CN202210177464.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 Jinwei Zhiguang Information Technology Co ltd
Original Assignee
Beijing Jinwei Zhiguang Information 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 Jinwei Zhiguang Information Technology Co ltd filed Critical Beijing Jinwei Zhiguang Information Technology Co ltd
Priority to CN202210177464.4A priority Critical patent/CN114820729A/en
Publication of CN114820729A publication Critical patent/CN114820729A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/30Determination of transform parameters for the alignment of images, i.e. image registration
    • G06T7/33Determination of transform parameters for the alignment of images, i.e. image registration using feature-based methods
    • G06T7/337Determination of transform parameters for the alignment of images, i.e. image registration using feature-based methods involving reference images or patches
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/206Drawing of charts or graphs

Abstract

The invention discloses an element one-key layout method and device, comprising the following steps: under the condition that a layout instruction for each selected element in a current canvas is received, determining a starting point corresponding to each selected element; determining the row of the selected elements based on the starting point and simultaneously calculating the row spacing of each row; determining a column spacing for each of the selected elements; updating the row and column of each selected element based on the row spacing and the column spacing. In the process, under the condition that a plurality of selected elements need to be laid out, the starting point of each selected element is determined firstly, the line spacing of each selected element is directly determined based on the starting point, the column spacing of each selected element is determined, the layout of each selected element can be realized through one operation based on the line spacing and the column spacing, and the operation times are reduced.

Description

Element one-key layout method and device
Technical Field
The invention relates to the technical field of image processing, in particular to an element one-key layout method and device.
Background
When a user uses a canvas product, a scene with multiple elements is often present, where the elements may be design drawings or text cards, for example, multiple design drawings are arranged in multiple rows according to states or modules, and the design drawings need to be uniformly distributed and aligned according to both the X axis and the Y axis, so as to achieve a better display effect.
The canvas product provides a one-dimensional distribution or alignment method to help a user align the design drawings of the X axis or the Y axis, and under the condition that a plurality of rows of design drawings need to be aligned, the user needs to manually input the number of columns and then click to rearrange the design drawings, and the layout process can be realized by multiple operations.
Disclosure of Invention
In view of the above, the present invention provides a method and an apparatus for one-key layout of elements, which are used to solve the problem that a canvas product provides a one-dimensional distribution or alignment method to help a user align an X-axis or Y-axis design drawing, and in a scenario where a plurality of rows of design drawings need to be aligned, the user needs to manually input a number of columns and then click "rearrangement" to rearrange the design drawings, and the layout process described above needs to be implemented by multiple operations. The specific scheme is as follows:
an element-key layout method, comprising:
under the condition that a layout instruction for each selected element in a current canvas is received, determining a starting point corresponding to each selected element;
determining the row of the selected elements based on the starting point and simultaneously calculating the row spacing of each row;
determining a column spacing for each of the selected elements;
updating the row and column of each selected element based on the row spacing and the column spacing.
The above method, optionally, determining a starting point corresponding to each selected element includes:
traversing the current canvas from top to bottom, and recording and detecting the upper edge of the first selected element;
traversing the current canvas from left to right, recording and detecting a left edge of a first selected element;
and determining the intersection point of the upper edge and the left edge, and taking the intersection point as the starting point of each selected element.
The method optionally, determining the row of the selected elements based on the starting point, and calculating the line spacing of each row, includes:
taking the number of selected elements which do not overlap or elements with the overlap ratio smaller than a preset overlap ratio threshold value from top to bottom along the Y axis in each selected element as the row number of each selected element aiming at the starting point;
for each line, dividing each selected element into a current line with the shortest moving distance;
the line spacing for each line is calculated.
The method optionally includes calculating a line pitch of each line, including:
obtaining the current line spacing between all the lines, and calculating the average line spacing based on all the current line spacing;
comparing the average line spacing with a preset line spacing threshold;
and when the average line spacing is smaller than or equal to the preset line spacing threshold, the line spacing is the preset line spacing threshold, otherwise, the line spacing is the average line spacing.
The above method, optionally, determining the column pitch of each selected element, includes:
identifying a target row of each selected element, wherein the target row contains the row with the most selected elements in each selected element;
acquiring the current column spacing of adjacent selected elements in the target row;
calculating the average column pitch of each current column pitch;
an element-key layout apparatus comprising:
the first determining module is used for determining a starting point corresponding to each selected element in the current canvas under the condition that a layout instruction of each selected element is received;
a determining and calculating module, configured to determine, based on the starting point, a row in which the selected elements are located, and calculate a row spacing for each row;
a second determining module for determining a column pitch of each of the selected elements;
and the updating module is used for updating the row and column of each selected element based on the row spacing and the column spacing.
The above apparatus, optionally, the first determining module includes:
the first recording unit is used for traversing the current canvas from top to bottom and recording and detecting the upper edge of the first selected element;
the second recording unit is used for traversing the current canvas from left to right and recording and detecting the left edge of the first selected element;
and the first determining unit is used for determining the intersection point of the upper edge and the left edge, and taking the intersection point as the starting point of each selected element.
The above apparatus, optionally, the determining and calculating module includes:
a second determining unit, configured to, for the starting point, take, from top to bottom along the Y axis, the number of selected elements that do not overlap after extending laterally or elements whose overlap ratio is smaller than a preset overlap ratio threshold value, as the number of rows of the selected elements;
a dividing unit, configured to divide, for each line, each selected element into a current line having a shortest moving distance;
and the first calculation unit is used for calculating the line spacing of each line.
The above apparatus, optionally, the first calculating unit includes:
the obtaining and calculating subunit is used for obtaining the current line spacing between the lines and calculating the average line spacing based on the current line spacing;
a comparison subunit, configured to compare the average line spacing with a preset line spacing threshold;
a determining subunit, configured to, when the average line spacing is smaller than or equal to the preset line spacing threshold, set the line spacing as the preset line spacing threshold, otherwise, set the line spacing as the average line spacing.
The above apparatus, optionally, the second determining module includes:
the identification unit is used for identifying a target row of each selected element, wherein the target row contains the row with the most selected elements in each selected element;
the acquisition unit is used for acquiring the current column spacing of adjacent selected elements in the target row;
a second calculation unit for calculating an average column pitch of each current column pitch;
and the judging unit is used for comparing the average column spacing with a preset column spacing threshold, and if the average column spacing is smaller than or equal to the preset column spacing threshold, the column spacing is the preset column spacing threshold, otherwise, the column spacing is the average column spacing.
Compared with the prior art, the invention has the following advantages:
the invention discloses an element one-key layout method and device, comprising the following steps: under the condition that a layout instruction for each selected element in a current canvas is received, determining a starting point corresponding to each selected element; determining the row of the selected elements based on the starting point and simultaneously calculating the row spacing of each row; determining a column spacing for each of the selected elements; updating the row and column of each selected element based on the row spacing and the column spacing. In the process, under the condition that a plurality of selected elements need to be laid out, the starting point of each selected element is determined firstly, the line spacing of each selected element is directly determined based on the starting point, the column spacing of each selected element is determined, the layout of each selected element can be realized through one operation based on the line spacing and the column spacing, and the operation times are reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flowchart of an element-by-key layout method disclosed in an embodiment of the present application;
fig. 2 is a schematic diagram of a method for determining a starting point according to an embodiment of the present disclosure;
FIG. 3 is a diagram illustrating a method for determining a number of rows and determining a row of a selected element according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of a line spacing calculation method disclosed in an embodiment of the present application;
FIG. 5 is a schematic diagram of a column pitch calculation method disclosed in an embodiment of the present application;
FIG. 6-1 is a schematic diagram of a selected element layout according to an embodiment of the present disclosure;
FIG. 6-2 is a schematic diagram of a layout of selected elements as disclosed in an embodiment of the present application;
FIG. 7 is a schematic illustration of a row arrangement disclosed in an embodiment of the present application;
fig. 8 is a block diagram of a device for element-key layout according to an embodiment of the present disclosure.
Detailed Description
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 only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The invention discloses an element one-key layout method and device, which are applied to the process of layout of a plurality of selected elements to finally realize two-dimensional distribution alignment, wherein the selected elements can be design drawings or character cards and the like, the two-dimensional distribution alignment refers to alignment uniformly distributed according to X axis and Y circumference, in the prior art, after a plurality of elements are selected, "left alignment", "center alignment", "horizontal uniform distribution" and the like can be selected, and the elements are aligned or uniformly distributed in one dimension (X axis or Y axis). Or after the number of columns is input, the design drawing is reordered according to the number of the selected columns by clicking 'rearrangement', and if a scene that a plurality of selected elements need to be aligned in the x axis and the y axis needs to be realized, multiple operations are needed. In order to solve the above problem, the present invention provides a method for element-key layout, the execution flow of the method is shown in fig. 1, and the method comprises the following steps:
s101, under the condition that a layout instruction for each selected element in a current canvas is received, determining a starting point corresponding to each selected element;
in the embodiment of the present invention, when a layout instruction for each selected element in a current canvas is received, the selected elements in the current canvas as a whole may be traversed from top to bottom through the current canvas, an upper edge of the detected first selected element is recorded, the current canvas is traversed from left to right, a left edge of the detected first selected element is recorded, the current canvas may also be traversed from left to right, a left edge of the detected first selected element is recorded, the current canvas is traversed from top to bottom, an upper edge of the detected first selected element is recorded, the upper edge and the left edge are extended, an intersection point of the upper edge and the left edge is determined, and the focus is used as a starting point of each selected element. As shown in fig. 2, the selected elements are numbered in the order from 1 to 6, and as can be seen from the above method, the upper edge of the selected element numbered 1 is traversed from top to bottom through the upper edge of the current canvas, the left edge of the selected element numbered 2 is traversed from left to right through the left edge of the current canvas, and the intersection P of the two is used as the starting point.
S102, determining the row of each selected element based on the starting point, and simultaneously calculating the row spacing of each row;
in the embodiment of the present invention, for the starting point, the number of selected elements, which do not overlap after extending laterally from top to bottom along the Y axis, or elements whose overlap ratio is smaller than a preset overlap ratio threshold value, in each selected element is taken as the number of rows of each selected element, where the preset overlap ratio threshold value may be set based on experience or specific circumstances, and in the embodiment of the present invention, no specific limitation is made, and preferably, in the embodiment of the present invention, the preset overlap ratio threshold value is 20%. Further, if each selected element has multiple element tops aligned, the left selected element is taken as "line number judgment element 0".
And respectively calculating the moving distance from each selected element to each line, and dividing each selected element into the current line with the shortest moving distance.
As shown in fig. 3, the selected element numbered 1 and the selected element numbered 2 are misaligned elements and are divided into different rows, the selected element numbered 3 and the selected element numbered 4 have a degree of overlap of less than 20% and are divided into different rows, and the selected element numbered 5 and the selected element numbered 6 have a degree of overlap of more than 20% and are divided into the same row.
Further, calculating a line spacing of each line, obtaining a current line spacing between the lines, and calculating an average line spacing of the current line spacings, where the current line spacing overlapping the selected elements is 0, comparing the average line spacing with a preset line spacing threshold, and when the average line spacing is less than or equal to the preset line spacing threshold, the line spacing is the preset line spacing threshold, otherwise, the line spacing is the average line spacing. The preset line spacing threshold may be set based on experience or specific conditions, and is not specifically limited in the embodiment of the present invention.
Preferably, in the embodiment of the present invention, the preset line spacing threshold is 40px for example, as shown in fig. 4, the current line spacing of the first line and the second line is a1, the current line spacing of the second line and the third line is a2, and the current line spacing of the third line and the fourth line is a3, assuming that the line spacing is a. Then a ═ a (a1+
a2+ a3)/3, and if a < 40px, the line spacing is 40 px.
S103, determining the column spacing of each selected element;
in this embodiment of the present invention, a target row of each selected element is identified, where the target row includes a row with the most selected elements among the selected elements, a current column pitch of adjacent selected elements in the target row is obtained, an average column pitch of each current column pitch is calculated, the average column pitch is compared with a preset column pitch threshold, if the average column pitch is less than or equal to the preset column pitch threshold, the column pitch is the preset column pitch threshold, otherwise, the column pitch is the average column pitch, where the preset column pitch threshold may be set based on experience or specific conditions, and in this embodiment of the present invention, specific limitation is not performed, and preferably, in this embodiment of the present invention, the preset column pitch threshold is taken as 40px for example, as shown in fig. 5, a left-right pitch average b of a row with the most selected elements is taken as a column pitch (an overlapping element pitch is 0), the first row of the selected elements is the row with the most elements, and for the first row elements, the current column spacing between adjacent selected elements is b1, b2 and b3 respectively, so that b is equal to (b1+ b2+ b3)/3, and if b < 40px, the column spacing is 40 px.
And S104, updating the row and column of each selected element based on the row spacing and the column spacing.
In the embodiment of the present invention, when a layout instruction for each selected element is received, the row and column of each selected element are updated based on the row spacing and the column spacing, and the specific updating process is as follows:
further, aiming at column arrangement, the leftmost element is the first selected element of each row, the first selected element of each row is left-aligned, and the rest selected elements are sequentially arranged along the X axis from left to right according to the column spacing; for row arrangement, the selected elements in each row are aligned at the top and are sequentially arranged from top to bottom at row intervals, as shown in fig. 6-1, the schematic diagram before the layout is shown, the selected elements numbered 1, 2, 3, 4, and 5 before the layout are shown in fig. 6-1, as shown in fig. 6-2, the schematic diagram after the layout is shown, and the selected elements numbered 1, 2, 3, 4, and 5 after the layout are shown in fig. 6-2.
The invention discloses an element one-key layout method and device, comprising the following steps: under the condition that a layout instruction for each selected element in a current canvas is received, determining a starting point corresponding to each selected element; determining the row of the selected elements based on the starting point and simultaneously calculating the row spacing of each row; determining a column spacing for each of the selected elements; updating the row and column of each selected element based on the row spacing and the column spacing. In the process, under the condition that a plurality of selected elements need to be laid out, the starting point of each selected element is determined firstly, the line spacing of each selected element is directly determined based on the starting point, the column spacing of each selected element is determined, the layout of each selected element can be realized through one operation based on the line spacing and the column spacing, and the operation times are reduced.
Further, as shown in fig. 7, for the row arrangement, sorting is performed according to a minimum row spacing of 40px, so as to ensure that the selected elements are not arranged in an overlapping manner, obtain the length of each selected element, and when the length of the selected element exceeds a preset length threshold, the spacing between the selected element that is too long and the next row element is 40px, where the preset length threshold may be set based on experience or a specific situation, which is not specifically limited in the embodiment of the present invention.
Based on the foregoing element-key layout method, in an embodiment of the present invention, an element-key layout apparatus is further provided, a block diagram of a structure of the apparatus is shown in fig. 8, where the apparatus includes:
a first determination module 201, a determination and calculation module 202, a second determination module 203, and an update module 204.
Wherein the content of the first and second substances,
the first determining module 201 is configured to, in a case that a layout instruction for each selected element in a current canvas is received, determine a starting point corresponding to each selected element;
the determining and calculating module 202 is configured to determine, based on the starting point, a row in which the selected elements are located, and calculate a row spacing of each row;
the second determining module 203, configured to determine a column pitch of each selected element;
the updating module 204 is configured to update the row and column of each selected element based on the row spacing and the column spacing.
The invention discloses an element one-key layout device, comprising: under the condition that a layout instruction for each selected element in a current canvas is received, determining a starting point corresponding to each selected element; determining the row of the selected elements based on the starting point and simultaneously calculating the row spacing of each row; determining a column spacing for each of the selected elements; updating the row and column of each selected element based on the row spacing and the column spacing. In the process, under the condition that a plurality of selected elements need to be laid out, the starting point of each selected element is determined firstly, the line spacing of each selected element is directly determined based on the starting point, the column spacing of each selected element is determined, the layout of each selected element can be realized through one operation based on the line spacing and the column spacing, and the operation times are reduced.
In this embodiment of the present invention, the first determining module 201 includes:
a first recording unit 205, a second recording unit 206 and a first determining unit 207.
Wherein the content of the first and second substances,
the first recording unit 205, configured to traverse the current canvas from top to bottom, and record and detect an upper edge of a first selected element;
the second recording unit 206, configured to traverse the current canvas from left to right, and record and detect a left edge of the first selected element;
the first determining unit 207 is configured to determine an intersection of the upper edge and the left edge, where the intersection is used as a starting point of each selected element.
In this embodiment of the present invention, the determining and calculating module 202 includes:
a second determination unit 208, a division unit 209, and a first calculation unit 210.
Wherein the content of the first and second substances,
the second determining unit 208 is configured to, for the starting point, use, as the row number of each selected element, the number of selected elements that do not overlap after extending laterally from top to bottom along the Y axis or the number of elements whose overlap ratio is smaller than a preset overlap ratio threshold value in each selected element;
the dividing unit 209 is configured to divide, for each line, each selected element into a current line with a shortest moving distance;
the first calculating unit 210 is configured to calculate a line spacing of each line.
In this embodiment of the present invention, the first calculating unit 210 includes:
an acquisition and calculation subunit 211, a comparison subunit 212 and a determination subunit 213.
Wherein the content of the first and second substances,
the obtaining and calculating subunit 211 is configured to obtain current line spacings between the lines, and calculate an average line spacing based on the current line spacings;
the comparing subunit 212 is configured to compare the average line spacing with a preset line spacing threshold;
the determining subunit 213 is configured to, when the average line spacing is smaller than or equal to the preset line spacing threshold, set the line spacing as the preset line spacing threshold, otherwise, set the line spacing as the average line spacing.
In this embodiment of the present invention, the second determining module 203 includes:
a recognition unit 214, an acquisition unit 215, a second calculation unit 216, and a determination unit 217.
Wherein the content of the first and second substances,
the identifying unit 214 is configured to identify a target row of each selected element, where the target row includes a row with the most selected elements among the selected elements;
the obtaining unit 215 is configured to obtain a current column pitch of adjacent selected elements in the target row;
the second calculating unit 216 is configured to calculate an average column pitch of each current column pitch;
the determining unit 217 is configured to compare the average column pitch with a preset column pitch threshold, where if the average column pitch is smaller than or equal to the preset column pitch threshold, the column pitch is the preset column pitch threshold, and otherwise, the column pitch is the average column pitch.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application 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 present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. 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.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). 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 application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application 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 are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. An element-key layout method, comprising:
under the condition that a layout instruction for each selected element in a current canvas is received, determining a starting point corresponding to each selected element;
determining the row of the selected elements based on the starting point and simultaneously calculating the row spacing of each row;
determining a column spacing for each of the selected elements;
updating the row and column of each selected element based on the row spacing and the column spacing.
2. The method of claim 1, wherein determining a starting point corresponding to each selected element comprises:
traversing the current canvas from top to bottom, and recording and detecting the upper edge of the first selected element;
traversing the current canvas from left to right, recording and detecting a left edge of a first selected element;
and determining the intersection point of the upper edge and the left edge, and taking the intersection point as the starting point of each selected element.
3. The method of claim 1, wherein determining the row of the selected elements based on the starting point and calculating the inter-row spacing for each row comprises:
taking the number of selected elements which do not overlap or elements with the overlap ratio smaller than a preset overlap ratio threshold value from top to bottom along the Y axis in each selected element as the row number of each selected element aiming at the starting point;
for each line, dividing each selected element into a current line with the shortest moving distance;
the line spacing for each line is calculated.
4. The method of claim 3, wherein calculating the row spacing for each row comprises:
obtaining the current line spacing between all the lines, and calculating the average line spacing based on all the current line spacing;
comparing the average line spacing with a preset line spacing threshold;
and when the average line spacing is smaller than or equal to the preset line spacing threshold, the line spacing is the preset line spacing threshold, otherwise, the line spacing is the average line spacing.
5. The method of claim 1, wherein determining a column spacing for each of the selected elements comprises:
identifying a target row of each selected element, wherein the target row contains the row with the most selected elements in each selected element;
acquiring the current column spacing of adjacent selected elements in the target row;
calculating the average column pitch of each current column pitch;
comparing the average column pitch with a preset column pitch threshold, wherein if the average column pitch is smaller than or equal to the preset column pitch threshold, the column pitch is the preset column pitch threshold, otherwise, the column pitch is the average column pitch.
6. An element-key layout apparatus, comprising:
the first determining module is used for determining a starting point corresponding to each selected element in the current canvas under the condition that a layout instruction of each selected element is received;
a determining and calculating module, configured to determine, based on the starting point, a row in which the selected elements are located, and calculate a row spacing for each row;
a second determining module for determining a column pitch of each of the selected elements;
and the updating module is used for updating the row and column of each selected element based on the row spacing and the column spacing.
7. The apparatus of claim 6, wherein the first determining module comprises:
the first recording unit is used for traversing the current canvas from top to bottom and recording and detecting the upper edge of the first selected element;
the second recording unit is used for traversing the current canvas from left to right and recording and detecting the left edge of the first selected element;
and the first determining unit is used for determining the intersection point of the upper edge and the left edge, and taking the intersection point as the starting point of each selected element.
8. The apparatus of claim 6, wherein the determining and calculating module comprises:
a second determining unit, configured to, for the starting point, take, from top to bottom along the Y axis, the number of selected elements that do not overlap after extending laterally or elements whose overlap ratio is smaller than a preset overlap ratio threshold value, as the number of rows of the selected elements;
a dividing unit, configured to divide, for each line, each selected element into a current line with a shortest moving distance;
and the first calculation unit is used for calculating the line spacing of each line.
9. The apparatus of claim 8, wherein the first computing unit comprises:
the obtaining and calculating subunit is used for obtaining the current line spacing between the lines and calculating the average line spacing based on the current line spacing;
a comparison subunit, configured to compare the average line spacing with a preset line spacing threshold;
a determining subunit, configured to, when the average line spacing is smaller than or equal to the preset line spacing threshold, set the line spacing as the preset line spacing threshold, otherwise, set the line spacing as the average line spacing.
10. The apparatus of claim 6, wherein the second determining module comprises:
the identification unit is used for identifying a target row of each selected element, wherein the target row contains the row with the most selected elements in each selected element;
the acquisition unit is used for acquiring the current column spacing of adjacent selected elements in the target row;
a second calculation unit for calculating an average column pitch of each current column pitch;
and the judging unit is used for comparing the average column spacing with a preset column spacing threshold, and if the average column spacing is smaller than or equal to the preset column spacing threshold, the column spacing is the preset column spacing threshold, otherwise, the column spacing is the average column spacing.
CN202210177464.4A 2022-02-24 2022-02-24 Element one-key layout method and device Pending CN114820729A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210177464.4A CN114820729A (en) 2022-02-24 2022-02-24 Element one-key layout method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210177464.4A CN114820729A (en) 2022-02-24 2022-02-24 Element one-key layout method and device

Publications (1)

Publication Number Publication Date
CN114820729A true CN114820729A (en) 2022-07-29

Family

ID=82527248

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210177464.4A Pending CN114820729A (en) 2022-02-24 2022-02-24 Element one-key layout method and device

Country Status (1)

Country Link
CN (1) CN114820729A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115268720A (en) * 2022-08-16 2022-11-01 北京尽微致广信息技术有限公司 Page rendering method, device and equipment and readable storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115268720A (en) * 2022-08-16 2022-11-01 北京尽微致广信息技术有限公司 Page rendering method, device and equipment and readable storage medium

Similar Documents

Publication Publication Date Title
US9348848B2 (en) Methods and apparatus for identifying tables in digital files
CN106610774B (en) Webpage table editing method and device
CN109416728A (en) Object detection method, device and computer system
CN110569489B (en) PDF file-based form data analysis method and device
CN114820729A (en) Element one-key layout method and device
CN108804458A (en) A kind of reptile web retrieval method and apparatus
CN108198322B (en) Magnetic stripe positioning method and device
CN107609011B (en) Database record maintenance method and device
US20200225759A1 (en) Gesture control method and apparatus for display screen
CN111125088A (en) Multi-level data processing method and device
CN117235069A (en) Index creation method, data query method, device, equipment and storage medium
CN110889065B (en) Page stay time determination method, device and equipment
CN110908587B (en) Method and device for storing time sequence data
US11100361B1 (en) Method and apparatus for processing feature point matching result
CN116214930A (en) 3D printing method, printer and medium
CN108984572B (en) Website information pushing method and device
CN109816677B (en) Information detection method and device
CN110968754B (en) Detection method and device for crawler page turning strategy
US20160232187A1 (en) Dump analysis method, apparatus and non-transitory computer readable storage medium
CN112329407A (en) Method and device for adding data in table and electronic equipment
CN106776652B (en) Data processing method and device
US20120123717A1 (en) Electronic device and method of optimizing measurement paths
US20160373736A1 (en) Methods and Apparatus for Storing Data Related to Video Decoding
CN110991164A (en) Legal document processing method and device
CN113868266B (en) Method and device for generating star model layout of web front end and electronic equipment

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