CN114579238B - Primitive alignment method, device and equipment - Google Patents
Primitive alignment method, device and equipment Download PDFInfo
- Publication number
- CN114579238B CN114579238B CN202210189863.2A CN202210189863A CN114579238B CN 114579238 B CN114579238 B CN 114579238B CN 202210189863 A CN202210189863 A CN 202210189863A CN 114579238 B CN114579238 B CN 114579238B
- Authority
- CN
- China
- Prior art keywords
- primitive
- adjusted
- graphic element
- alignment
- alignment mode
- 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.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/451—Execution arrangements for user interfaces
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Processing Or Creating Images (AREA)
Abstract
The embodiment of the application provides a method, a device and equipment for aligning graphic elements, wherein the method comprises the following steps: detecting that the to-be-adjusted graphic element is displaced, and respectively calculating the distance between the to-be-adjusted graphic element and each reference graphic element positioned on the same page; when at least one reference graphic element with the distance from the graphic element to be adjusted being smaller than a first threshold value is monitored, respectively predicting an alignment mode of the graphic element to be adjusted and at least one reference graphic element, and generating an adsorption line corresponding to the alignment mode; when the target reference graphic element with the distance smaller than the second threshold value from the graphic element to be adjusted is monitored, positioning the alignment position in the graphic element to be adjusted according to the alignment mode corresponding to the adsorption line of the target reference graphic element; and adjusting the position of the primitive to be adjusted until the alignment position in the primitive to be adjusted is overlapped with the adsorption line of the target reference primitive. By using the method, the automatic alignment of the graphic elements is realized, and the problems of inaccurate alignment caused by manual alignment and time and labor consumption are solved.
Description
Technical Field
The present application relates to the field of UI design technologies, and in particular, to a method, an apparatus, and a device for primitive alignment.
Background
Along with the popularization of mobile terminal equipment, a large number of applets or applications are emerging in the application market of the mobile terminal equipment, wherein applications capable of realizing the graphic editing function are increasingly popular with users, and generally, the applications capable of realizing the graphic editing function can provide materials such as customized templates, graphic element lists and the like for the users, support the functions such as scaling, rotation and text editing of the graphic elements and the like, and the users can manufacture personal electronic business cards, propaganda posters for picture refinement and the like after simple learning.
When a user needs to perform small-amplitude position alignment adjustment on a specific graphic element, one mode adopted is to enlarge the area where the graphic element is positioned, so as to assist the user in adjusting the position of the graphic element, in this case, the graphic element is sometimes limited by the size of a display screen of the mobile terminal or pixel setting, and the condition that the graphic element is displayed in a fuzzy manner is caused, so that the user is inconvenient to identify and operate the graphic element; in the other way, the graphic element is dragged by means of the reference line or the grid line, so that the position of the graphic element is adjusted, and in the case, a user sometimes has difficulty in grasping the force for adjusting the graphic element, and the graphic element position is greatly deviated due to the fact that the graphic element is dragged too fast, or the graphic element is dragged too fast, the graphic element position is not obviously changed, the user needs to repeatedly try to continuously adjust the position of the graphic element, so that the whole process is time-consuming and labor-consuming, and the user experience is poor.
Disclosure of Invention
The invention provides a primitive alignment method which is used for solving the problem that the primitive position cannot be accurately adjusted to an alignment position when fine adjustment alignment is carried out on the primitive position in the prior art.
In a first aspect, the present application provides a primitive alignment method, including:
Detecting that the to-be-adjusted graphic element is displaced, and respectively calculating the distance between the to-be-adjusted graphic element and each reference graphic element positioned on the same page;
When at least one reference graphic element with the distance smaller than a first threshold value from the graphic element to be adjusted is monitored, respectively predicting an alignment mode of the at least one reference graphic element, and generating an adsorption line corresponding to the alignment mode;
When the target reference graphic element with the distance smaller than the second threshold value from the graphic element to be adjusted is monitored, positioning the alignment position in the graphic element to be adjusted according to the alignment mode corresponding to the adsorption line of the target reference graphic element;
and adjusting the position of the to-be-adjusted primitive, wherein the alignment position in the to-be-adjusted primitive is overlapped with the adsorption line of the target reference primitive.
An optional implementation manner is to calculate the distance between the primitive to be adjusted and each reference primitive located on the same page, including:
establishing a coordinate system by taking any point in the page as a coordinate origin;
And respectively selecting a reference point on the to-be-adjusted primitive and the reference primitive for each reference primitive in the reference primitives, and determining the distance between the to-be-adjusted primitive and the reference primitive according to the coordinate value of the reference point of the to-be-adjusted primitive and the coordinate value of the reference point of the reference primitive.
An optional implementation manner is that a reference point is selected on the primitive to be adjusted and the reference primitive respectively, including:
Respectively determining the edge contours of the primitives to be adjusted and the reference primitives by using an edge detection algorithm;
Selecting a first point in the edge contour point set of the to-be-adjusted primitive, and selecting a second point in the edge contour point set of the reference primitive, so that the distance between the first point and the second point is nearest;
And determining the first point as the reference point of the primitive to be adjusted, and determining the second point as the reference point of the reference primitive.
An optional implementation manner is to predict alignment modes of the at least one reference primitive and generate adsorption lines corresponding to the alignment modes, and the method includes:
generating a minimum circumscribed rectangle frame of the at least one reference primitive;
For each reference primitive in the at least one reference primitive, respectively determining auxiliary lines corresponding to different alignment modes based on the minimum circumscribed rectangular frame according to a preset alignment mode;
And predicting the auxiliary line corresponding to the closest alignment mode as the adsorption line according to the positions of the to-be-adjusted primitive and at least one reference primitive.
In an alternative embodiment, the auxiliary line includes at least one of the following:
a straight line where the left border of the minimum circumscribed rectangular frame corresponding to the left alignment mode is located;
a straight line where the right frame of the minimum circumscribed rectangular frame corresponding to the right alignment mode is located;
a straight line of the upper frame of the minimum circumscribed rectangular frame corresponding to the upper alignment mode;
A straight line of the lower frame of the minimum circumscribed rectangular frame corresponding to the lower alignment mode;
A transverse center line where the center point of the minimum circumscribed rectangular frame corresponding to the transverse centering alignment mode is located;
And a longitudinal center line where the center point of the minimum circumscribed rectangular frame corresponding to the longitudinal centering alignment mode is located.
An optional implementation manner is that, according to the positions of the primitives to be adjusted and at least one reference primitive, the auxiliary line corresponding to the closest alignment mode is predicted to be an adsorption line, including:
Determining a measuring point with the shortest auxiliary line distance corresponding to the alignment mode in the primitives to be adjusted according to each alignment mode of each reference primitive in the at least one reference primitive, and calculating the distance between the measuring point and the auxiliary line corresponding to the alignment mode;
And determining an alignment mode corresponding to the shortest distance in the distances as a closest alignment mode, and predicting an auxiliary line corresponding to the closest alignment mode as an adsorption line.
In an alternative embodiment, adjusting the position of the primitive to be adjusted, after the alignment position in the primitive to be adjusted is overlapped with the adsorption line of the target reference primitive, the method further includes:
monitoring an instruction for moving the primitive to be adjusted, and determining the moving speed and/or displacement of the primitive to be adjusted;
when the moving speed is judged to be greater than a preset speed threshold, the position of the primitive to be adjusted is adjusted according to the moving speed, and/or when the displacement is judged to be greater than a preset displacement threshold, the position of the primitive to be adjusted is adjusted according to the displacement;
otherwise, judging the instruction for moving the primitive to be adjusted as an invalid instruction.
In a second aspect, the present application provides a primitive alignment device, including:
The calculation module is used for monitoring the displacement of the to-be-adjusted graphic element and respectively calculating the distance between the to-be-adjusted graphic element and each reference graphic element positioned on the same page;
The generation module is used for respectively predicting the alignment mode of the at least one reference graphic element when the distance between the at least one reference graphic element and the graphic element to be adjusted is smaller than a first threshold value, and generating an adsorption line corresponding to the alignment mode;
the positioning module is used for positioning the alignment position in the to-be-adjusted primitive according to the alignment mode corresponding to the adsorption line of the target reference primitive when the target reference primitive with the to-be-adjusted primitive distance smaller than the second threshold value is monitored;
And the adjustment module is used for adjusting the position of the to-be-adjusted primitive, and the alignment position in the to-be-adjusted primitive is overlapped with the adsorption line of the target reference primitive.
In a third aspect, the present application provides a primitive alignment device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing when executing the computer program:
Detecting that the to-be-adjusted graphic element is displaced, and respectively calculating the distance between the to-be-adjusted graphic element and each reference graphic element positioned on the same page;
When at least one reference graphic element with the distance smaller than a first threshold value from the graphic element to be adjusted is monitored, respectively predicting an alignment mode of the at least one reference graphic element, and generating an adsorption line corresponding to the alignment mode;
When the target reference graphic element with the distance smaller than the second threshold value from the graphic element to be adjusted is monitored, positioning the alignment position in the graphic element to be adjusted according to the alignment mode corresponding to the adsorption line of the target reference graphic element;
and adjusting the position of the to-be-adjusted primitive, wherein the alignment position in the to-be-adjusted primitive is overlapped with the adsorption line of the target reference primitive.
In a fourth aspect, the application provides a computer readable storage medium having stored thereon computer program instructions which, when executed by a processor, implement:
Detecting that the to-be-adjusted graphic element is displaced, and respectively calculating the distance between the to-be-adjusted graphic element and each reference graphic element positioned on the same page;
When at least one reference graphic element with the distance smaller than a first threshold value from the graphic element to be adjusted is monitored, respectively predicting an alignment mode of the at least one reference graphic element, and generating an adsorption line corresponding to the alignment mode;
When the target reference graphic element with the distance smaller than the second threshold value from the graphic element to be adjusted is monitored, positioning the alignment position in the graphic element to be adjusted according to the alignment mode corresponding to the adsorption line of the target reference graphic element;
and adjusting the position of the to-be-adjusted primitive, wherein the alignment position in the to-be-adjusted primitive is overlapped with the adsorption line of the target reference primitive.
According to the method, the distance between the to-be-adjusted primitive and each reference primitive is monitored, the adsorption line corresponding to the alignment mode of at least one reference primitive is generated when the distance is smaller than the first threshold value, and the position of the to-be-adjusted primitive is adjusted to be aligned with the reference primitive according to the corresponding adsorption line when the distance is smaller than the second threshold value, so that automatic alignment of the primitive is realized, and the problems of inaccurate alignment caused by manual alignment and time and labor consumption are solved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly described below, it will be apparent that the drawings in the following description are only some embodiments of the present application, and that other drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of a primitive alignment method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of an alignment method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a primitive alignment position to be adjusted according to an embodiment of the present application;
FIG. 4 is a flowchart of a method for calculating a distance between a pixel to be adjusted and a reference pixel according to an embodiment of the present application;
FIG. 5 is a schematic diagram of reference points in a primitive alignment process according to an embodiment of the present application;
FIG. 6 is a flowchart of a method for generating an adsorption line according to an embodiment of the present application;
FIG. 7 is a schematic diagram of adsorption lines in a primitive alignment process according to an embodiment of the present application;
FIG. 8 is a schematic diagram of a primitive alignment device according to an embodiment of the present application;
Fig. 9 is a schematic diagram of a primitive alignment device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be described in further detail below with reference to the accompanying drawings, and it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The application scenario described in the embodiment of the present application is for more clearly describing the technical solution of the embodiment of the present application, and does not constitute a limitation on the technical solution provided by the embodiment of the present application, and as a person of ordinary skill in the art can know that the technical solution provided by the embodiment of the present application is applicable to similar technical problems as the new application scenario appears. In the description of the present application, unless otherwise indicated, the meaning of "a plurality" is two or more.
Along with the popularization of mobile terminal equipment, a large number of applets or applications are emerging in the application market of the mobile terminal equipment, wherein applications capable of realizing the graphic editing function are increasingly popular with users, and generally, the applications capable of realizing the graphic editing function can provide materials such as customized templates, graphic element lists and the like for the users, support the functions such as scaling, rotation and text editing of the graphic elements and the like, and the users can manufacture personal electronic business cards, propaganda posters for picture refinement and the like after simple learning.
At present, when a user needs to perform small-amplitude position alignment adjustment on a specific graphic element, one mode adopted is to enlarge the area where the graphic element is positioned, so as to assist the user in adjusting the position of the graphic element, in this case, the graphic element is sometimes limited by the size of a display screen of a mobile terminal or pixel setting, the condition that the graphic element is displayed in a fuzzy manner occurs, and the user is inconvenient to identify and operate the graphic element; in the other way, the graphic element is dragged by means of the reference line or the grid line, so that the position of the graphic element is adjusted, and in the case, a user sometimes has difficulty in grasping the force for adjusting the graphic element, and the graphic element position is greatly deviated due to the fact that the graphic element is dragged too fast, or the graphic element is dragged too fast, the graphic element position is not obviously changed, the user needs to repeatedly try to continuously adjust the position of the graphic element, so that the whole process is time-consuming and labor-consuming, and the user experience is poor.
In order to solve the above-mentioned problems, the present application provides a primitive alignment method, where an execution body of the method includes, but is not limited to, at least one of a server, a terminal, and an electronic device capable of being configured to execute the method provided by the embodiment of the present application. In other words, the primitive alignment method may be performed by software or hardware installed in a terminal device or a server device, and the software may be a blockchain platform. The server may be an independent server, or may be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (ContentDelivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms.
Referring to fig. 1, an embodiment of the present application provides a flowchart of a primitive alignment method, as shown in fig. 1, including:
step 101, monitoring displacement of the to-be-adjusted graphic element, and respectively calculating the distance between the to-be-adjusted graphic element and each reference graphic element positioned on the same page;
In the embodiment of the application, the graphic element is simply called graphic element, the page can be any graphic editing page, the page can contain various graphic elements such as button elements, prompt boxes, editing boxes, pictures and the like, the shapes of the graphic element to be adjusted and the reference graphic element are not limited in the embodiment of the application, and the shapes can be regular graphs or irregular graphs.
The graphic element to be adjusted refers to a graphic element moving in a page, the reference graphic element refers to a graphic element which does not move in the page and has a fixed position, and as an optional implementation manner, other graphic elements except the graphic element to be adjusted on the page where the graphic element to be adjusted is located are determined as the reference graphic element.
In implementation, whether the to-be-adjusted graphic element is displaced or not is monitored by monitoring operations such as mouse clicking and mouse dragging of a user, and if the to-be-adjusted graphic element is monitored to be displaced, the distances between the to-be-adjusted graphic element and all the reference graphic elements on the same page are calculated.
102, When at least one reference graphic element with the distance smaller than a first threshold value from the graphic element to be adjusted is monitored, respectively predicting an alignment mode of the at least one reference graphic element, and generating an adsorption line corresponding to the alignment mode;
in the embodiment of the present application, the value of the first threshold is not limited, and may be set according to actual requirements, for example, the first threshold is set to 5 cm, 8 cm, and so on.
In the process of carrying out the graphic element alignment, when the distance between the graphic element to be adjusted and at least one reference graphic element is monitored to be gradually reduced to a first threshold value, determining that the at least one reference graphic element is the graphic element which needs to be aligned for the graphic element to be adjusted, and respectively generating adsorption lines corresponding to the at least one reference graphic element.
For each reference primitive in the at least one reference primitive, when generating the adsorption line corresponding to the primitive to be adjusted and the reference primitive, firstly predicting the alignment mode of the primitive to be adjusted and the reference primitive according to the position relation between the reference primitive and the primitive to be adjusted, and then generating the adsorption line corresponding to the alignment mode according to the predicted alignment mode.
The adsorption line may be in various forms such as a straight line, a radial line, a line segment, etc., and in the embodiment of the present application, the direction of the adsorption line is not limited, and the adsorption line may be a horizontal line or a vertical line in a transverse direction, or may be an oblique line inclined to a certain direction.
As shown in fig. 2, the above alignment includes, but is not limited to, left alignment, right alignment, up alignment, down alignment, and lateral centering alignment, i.e., longitudinal centering alignment.
Step 103, when the target reference graphic element with the distance smaller than the second threshold value from the graphic element to be adjusted is monitored, positioning the alignment position in the graphic element to be adjusted according to the alignment mode corresponding to the adsorption line of the target reference graphic element;
In the embodiment of the present application, the specific value of the second threshold is not limited, but it should be noted that the value of the second threshold needs to be smaller than the value of the first threshold.
In detail, when the distance between the to-be-adjusted primitive and the target reference primitive is further reduced to the second threshold value, positioning the alignment position in the to-be-adjusted primitive according to the generated adsorption line corresponding to the target reference primitive and the alignment mode corresponding to the adsorption line, wherein the alignment position in the to-be-adjusted primitive is the edge point of the to-be-adjusted primitive corresponding to the alignment mode.
Specifically, as shown in fig. 3, the primitive to be adjusted is aligned to the left of the target reference primitive, and the adsorption line is generated on the left edge line of the target reference primitive, where the alignment position of the primitive to be adjusted is selected as the left edge point a of the primitive to be adjusted.
It should be noted that, because the value of the second threshold is smaller than the value of the first threshold, when the distance between the primitive to be adjusted and the target reference primitive is reduced to the second threshold, the adsorption line corresponding to the target reference primitive is necessarily generated in advance.
Step 104, adjusting the position of the primitive to be adjusted, wherein the aligned position in the primitive to be adjusted is overlapped with the adsorption line of the target reference primitive;
In implementation, since the alignment position of the primitive to be adjusted is determined according to the alignment mode corresponding to the adsorption line of the target reference primitive, the alignment position of the primitive to be adjusted is overlapped with the adsorption line of the target primitive, so that the primitive to be adjusted and the target reference primitive can be aligned.
According to the method, the distance between the to-be-adjusted primitive and the reference primitive is calculated in real time, when the distance is reduced to the first threshold value, the adsorption line corresponding to the alignment mode of the reference primitive is generated, when the distance is further reduced to the second threshold value, the alignment position of the to-be-adjusted primitive is determined according to the alignment mode, the position of the to-be-adjusted primitive is adjusted according to the alignment position and the adsorption line, the effect of automatic alignment of the to-be-adjusted primitive and the reference primitive is achieved, and a user does not need to repeatedly adjust or move the to-be-adjusted primitive manually, so that the operation efficiency and the user operation experience of the alignment of the primitives are improved.
As an optional implementation manner, in order to prevent misoperation caused by problems such as hand sliding, adjusting a position of the primitive to be adjusted, and after the aligned position in the primitive to be adjusted is overlapped with the adsorption line of the target reference primitive, further includes:
monitoring an instruction for moving the primitive to be adjusted, and determining the moving speed and/or displacement of the primitive to be adjusted;
when the moving speed is judged to be greater than a preset speed threshold, the position of the primitive to be adjusted is adjusted according to the moving speed, and/or when the displacement is judged to be greater than a preset displacement threshold, the position of the primitive to be adjusted is adjusted according to the displacement;
otherwise, judging the instruction for moving the primitive to be adjusted as an invalid instruction.
In implementation, after the primitive to be adjusted is aligned with the target reference primitive, when the movement of the primitive to be adjusted of a user is monitored, firstly, the movement speed and/or displacement of the primitive to be adjusted are obtained, whether the primitive to be adjusted belongs to misoperation of the user is judged according to the movement speed and/or displacement, if the movement speed is greater than a preset speed threshold value and/or the displacement is greater than a preset displacement threshold value, the operation of the user is judged to be effective operation, and the position adjustment of the primitive to be adjusted is carried out according to the movement speed and/or displacement of the corresponding primitive to be adjusted; otherwise, judging the operation of the user as invalid operation, and not adjusting the position of the primitive to be adjusted.
In the embodiment of the application, the values of the preset speed threshold and the preset displacement threshold are not limited, and can be adjusted according to actual requirements.
It should be noted that, the moving of the primitive to be adjusted may only include moving the primitive to be adjusted aligned with the target reference primitive to a position not aligned with the target reference primitive, or may further include moving the primitive to be adjusted while maintaining the alignment with the target reference primitive, for example, moving the primitive to be adjusted up and down while maintaining the left alignment with the target reference primitive.
According to the method, compared with the movement of the non-aligned primitive to be adjusted, the user moves the aligned primitive to be adjusted, and the movement speed and/or the displacement amount are/is larger, so that the phenomenon of hand sliding can be effectively prevented, and the larger position deviation is avoided when the primitive to be adjusted is moved.
Referring to fig. 4, in the following step 101, a method for calculating a distance between a to-be-adjusted primitive and each reference primitive located on the same page is described in detail, and the method for calculating a distance between a to-be-adjusted primitive and each reference primitive located on the same page includes the following steps:
Step 401, establishing a coordinate system by taking any point in the page as a coordinate origin;
in the embodiment of the application, the selection of the coordinate origin is not limited, and the coordinate origin can be selected as any point on the page.
Step 402, for each reference primitive in the reference primitives, selecting a reference point on the primitive to be adjusted and the reference primitive, and determining the distance between the primitive to be adjusted and the reference primitive according to the coordinate value of the reference point of the primitive to be adjusted and the coordinate value of the reference point of the reference primitive;
In implementation, when selecting the reference points on the primitive to be adjusted and each reference primitive, an alternative implementation manner is to determine the reference points on the primitive to be adjusted and each reference primitive according to the predefined reference point position, for example, define the center point of the primitive as the reference point of the primitive in advance; in another alternative embodiment, an edge detection algorithm is used to obtain the edge profiles of the primitives to be adjusted and the reference primitives, and the corresponding reference points are determined according to the edge profiles, for example, any vertex in the edge profile is used as the reference point of the corresponding primitive.
As an optional implementation manner, selecting a reference point on the primitive to be adjusted and the reference primitive respectively includes:
Respectively determining the edge contours of the primitives to be adjusted and the reference primitives by using an edge detection algorithm;
Selecting a first point in the edge contour point set of the to-be-adjusted primitive, and selecting a second point in the edge contour point set of the reference primitive, so that the distance between the first point and the second point is nearest;
And determining the first point as the reference point of the primitive to be adjusted, and determining the second point as the reference point of the reference primitive.
It should be noted that, the reference points selected on the primitives to be adjusted are selected according to the corresponding reference primitives, and the reference points selected on the primitives to be adjusted may be the same or different for different reference primitives.
It should be noted that if there are multiple sets of first points and second points in the edge contour point set of the primitive to be adjusted and the edge contour point set of the reference primitive, it is possible to achieve that the first points and the second points are closest to each other, any one of the first points and the second points is selected, the first point is determined as the reference point of the primitive to be adjusted, and the second point is determined as the reference point of the reference primitive.
As shown in fig. 5, in the edge contour point set of the primitive to be adjusted, for the first point of the reference primitive 1, the first point of the reference primitive 1 is the point B in the graph, and for the first point of the reference primitive 1, the point B is selected as the reference point of the primitive to be adjusted for the reference primitive 1, and the point C is selected as the reference point of the primitive to be adjusted for the reference primitive 2 when the reference point on the primitive to be adjusted is selected.
Referring to fig. 6, the method for generating the adsorption line in step 102 is described in detail below:
as an alternative embodiment, predicting the alignment of the at least one reference primitive and generating the adsorption line corresponding to the alignment respectively, including the following steps:
Step 601, generating a minimum circumscribed rectangle frame of the at least one reference primitive;
step 602, for each reference primitive in the at least one reference primitive, determining auxiliary lines corresponding to each alignment mode based on the minimum circumscribed rectangular frame according to a preset alignment mode;
in step 603, the auxiliary line corresponding to the closest alignment mode is predicted to be the adsorption line according to the positions of the primitive to be adjusted and at least one reference primitive.
In implementation, the auxiliary lines corresponding to the various alignment manners in the step 602 may be multiple, and the root may be an alternative implementation, where the auxiliary lines include at least one of the following:
A straight line (first auxiliary line) where a left frame of the minimum circumscribed rectangular frame corresponding to the left alignment mode is located;
A straight line (second auxiliary line) where the right frame of the minimum circumscribed rectangular frame corresponding to the right alignment manner is located;
a straight line (a third auxiliary line) where an upper frame of the minimum circumscribed rectangular frame corresponding to the upper alignment mode is located;
a straight line (fourth auxiliary line) in which a lower frame of the minimum circumscribed rectangular frame corresponding to the lower alignment manner is located;
A transverse center line (fifth auxiliary line) where a center point of the minimum circumscribed rectangular frame corresponding to the transverse centering alignment manner is located;
a longitudinal center line (sixth auxiliary line) where a center point of the minimum circumscribed rectangular frame corresponding to the longitudinal center alignment is located.
The six auxiliary lines can assist in achieving the effects of left alignment, right alignment, upper alignment, lower alignment and centering alignment between the to-be-adjusted graphic element and the reference graphic element, and in practical application, the types of the auxiliary lines can be increased or decreased according to practical needs.
As an optional implementation manner, in step 603, predicting, according to the positions of the primitive to be adjusted and the at least one reference primitive, the auxiliary line corresponding to the closest alignment mode as the adsorption line includes:
Determining a measuring point with the shortest auxiliary line distance corresponding to the alignment mode in the primitives to be adjusted according to each alignment mode of each reference primitive in the at least one reference primitive, and calculating the distance between the measuring point and the auxiliary line corresponding to the alignment mode;
For each reference primitive in the at least one reference primitive, determining an alignment corresponding to the shortest distance in the distances as a closest alignment, and predicting an auxiliary line corresponding to the closest alignment as an adsorption line.
In the embodiment of the invention, if the alignment mode corresponding to the shortest distance is a left alignment mode, determining a first auxiliary line where a left frame of a minimum circumscribed rectangular frame corresponding to the left alignment mode is located as an adsorption line; if the alignment mode corresponding to the shortest distance is the upper alignment mode, determining a third auxiliary line where the upper frame of the minimum circumscribed rectangular frame corresponding to the upper alignment mode is located as an adsorption line, and if the alignment mode corresponding to the shortest distance is other alignment modes, determining the adsorption line is similar to the above, and the detailed description is omitted.
As shown in fig. 7, an embodiment of the present application provides a schematic diagram of an adsorption line in an alignment process of a primitive, where in a graphic editing page shown in fig. 7, the graphic editing page includes a primitive to be adjusted, a reference primitive 1 and a reference primitive 2, taking three positions of the primitive to be adjusted in a moving process as examples, where the position 1 is an initial position of the primitive to be adjusted, when the primitive to be adjusted moves to the position 2, a distance between the primitive to be adjusted and the reference primitive 1 is reduced to a first threshold, and according to a determination of a distance between a measurement point in the primitive to be adjusted corresponding to different alignment modes and an auxiliary line in the reference primitive 1, when an alignment mode corresponding to a shortest distance is a left alignment mode, the first auxiliary line corresponding to the reference primitive is used as an adsorption line, and the adsorption line 1 shown in the drawing is generated on the reference primitive 1;
When the primitive to be adjusted moves to the position 3, the distance between the primitive to be adjusted and the reference primitive 1 is reduced to a first threshold value, and the distance between the measurement point in the primitive to be adjusted corresponding to different alignment modes and the auxiliary line in the reference primitive 1 is determined, and when the alignment mode corresponding to the shortest distance is a lower alignment mode, a fourth auxiliary line corresponding to the reference primitive is used as an adsorption line, and an adsorption line 2 shown in the figure is generated on the reference primitive 1;
since the distance between the primitive to be adjusted and the reference primitive 2 does not satisfy the first threshold during the movement of the primitive to be adjusted, no adsorption line is generated on the reference primitive 2.
The primitive alignment device in the embodiment of the application is described below with reference to the accompanying drawings.
Fig. 8 is a schematic diagram of a primitive alignment device according to an embodiment of the present invention, as shown in fig. 7, where the device includes:
The calculating module 801 is configured to monitor that the to-be-adjusted primitive is displaced, and calculate distances between the to-be-adjusted primitive and each reference primitive located on the same page respectively;
a generating module 802, configured to predict an alignment manner of at least one reference primitive when the distance between the at least one reference primitive and the primitive to be adjusted is less than a first threshold, and generate an adsorption line corresponding to the alignment manner;
A positioning module 803, configured to, when detecting a target reference primitive whose distance from the primitive to be adjusted is smaller than a second threshold, position an alignment position in the primitive to be adjusted according to an alignment manner corresponding to an adsorption line of the target reference primitive;
the adjusting module 804 is configured to adjust the position of the primitive to be adjusted, and the aligned position in the primitive to be adjusted overlaps the adsorption line of the target reference primitive.
Optionally, the calculating module 801 is configured to calculate a distance between the to-be-adjusted primitive and each reference primitive located on the same page, and includes:
establishing a coordinate system by taking any point in the page as a coordinate origin;
And respectively selecting a reference point on the to-be-adjusted primitive and the reference primitive for each reference primitive in the reference primitives, and determining the distance between the to-be-adjusted primitive and the reference primitive according to the coordinate value of the reference point of the to-be-adjusted primitive and the coordinate value of the reference point of the reference primitive.
Optionally, the calculating module 801 is configured to select a reference point on the to-be-adjusted primitive and the reference primitive, respectively, including:
Respectively determining the edge contours of the primitives to be adjusted and the reference primitives by using an edge detection algorithm;
Selecting a first point in the edge contour point set of the to-be-adjusted primitive, and selecting a second point in the edge contour point set of the reference primitive, so that the distance between the first point and the second point is nearest;
And determining the first point as the reference point of the primitive to be adjusted, and determining the second point as the reference point of the reference primitive.
Optionally, the generating module 802 is configured to predict an alignment manner of the at least one reference primitive, and generate an adsorption line corresponding to the alignment manner, and includes:
generating a minimum circumscribed rectangle frame of the at least one reference primitive;
For each reference primitive in the at least one reference primitive, respectively determining auxiliary lines corresponding to different alignment modes based on the minimum circumscribed rectangular frame according to a preset alignment mode;
And predicting the auxiliary line corresponding to the closest alignment mode as the adsorption line according to the positions of the to-be-adjusted primitive and at least one reference primitive.
Optionally, the auxiliary line includes at least one of the following:
a straight line where the left border of the minimum circumscribed rectangular frame corresponding to the left alignment mode is located;
a straight line where the right frame of the minimum circumscribed rectangular frame corresponding to the right alignment mode is located;
a straight line of the upper frame of the minimum circumscribed rectangular frame corresponding to the upper alignment mode;
A straight line of the lower frame of the minimum circumscribed rectangular frame corresponding to the lower alignment mode;
A transverse center line where the center point of the minimum circumscribed rectangular frame corresponding to the transverse centering alignment mode is located;
And a longitudinal center line where the center point of the minimum circumscribed rectangular frame corresponding to the longitudinal centering alignment mode is located.
Optionally, the generating module 802 is configured to predict, according to the positions of the primitive to be adjusted and the at least one reference primitive, that an auxiliary line corresponding to the closest alignment mode is an adsorption line, including:
Determining a measuring point with the shortest auxiliary line distance corresponding to the alignment mode in the primitives to be adjusted according to each alignment mode of each reference primitive in the at least one reference primitive, and calculating the distance between the measuring point and the auxiliary line corresponding to the alignment mode;
And determining an alignment mode corresponding to the shortest distance in the distances as a closest alignment mode, and predicting an auxiliary line corresponding to the closest alignment mode as an adsorption line.
Optionally, the generating module 802 is configured to adjust a position of the primitive to be adjusted, and after the aligned position in the primitive to be adjusted is overlapped with the adsorption line of the target reference primitive, the generating module is further configured to:
monitoring an instruction for moving the primitive to be adjusted, and determining the moving speed and/or displacement of the primitive to be adjusted;
when the moving speed is judged to be greater than a preset speed threshold, the position of the primitive to be adjusted is adjusted according to the moving speed, and/or when the displacement is judged to be greater than a preset displacement threshold, the position of the primitive to be adjusted is adjusted according to the displacement;
otherwise, judging the instruction for moving the primitive to be adjusted as an invalid instruction.
Based on the same application conception, the embodiment of the invention also provides a primitive alignment device, and the primitive alignment device in the embodiment of the invention is described below with reference to the accompanying drawings.
Those skilled in the art will appreciate that the various aspects of the application may be implemented as a system, method, or program product. Accordingly, aspects of the application may be embodied in the following forms, namely: an entirely hardware embodiment, an entirely software embodiment (including firmware, micro-code, etc.) or an embodiment combining hardware and software aspects may be referred to herein as a "circuit," module "or" system.
In some possible embodiments, a device according to the application may comprise at least one processor, and at least one memory. Wherein the memory stores program code that, when executed by the processor, causes the processor to perform the steps in the primitive alignment methods described above in this specification according to various exemplary embodiments of the present application.
An apparatus 900 according to this embodiment of the application is described below with reference to fig. 9. The device 900 shown in fig. 9 is merely an example, and should not be construed as limiting the functionality and scope of use of embodiments of the present application.
As shown in fig. 9, device 900 is embodied in the form of a general purpose device. The components of device 900 may include, but are not limited to: the at least one processor 901, the at least one memory 902, and a bus 903 connecting the various system components (including the memory 902 and the processor 901), wherein the memory stores program code that, when executed by the processor, causes the processor to perform the steps of:
Detecting that the to-be-adjusted graphic element is displaced, and respectively calculating the distance between the to-be-adjusted graphic element and each reference graphic element positioned on the same page;
When at least one reference graphic element with the distance smaller than a first threshold value from the graphic element to be adjusted is monitored, respectively predicting an alignment mode of the at least one reference graphic element, and generating an adsorption line corresponding to the alignment mode;
When the target reference graphic element with the distance smaller than the second threshold value from the graphic element to be adjusted is monitored, positioning the alignment position in the graphic element to be adjusted according to the alignment mode corresponding to the adsorption line of the target reference graphic element;
and adjusting the position of the to-be-adjusted primitive, wherein the alignment position in the to-be-adjusted primitive is overlapped with the adsorption line of the target reference primitive.
Bus 903 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a processor, and a local bus using any of a variety of bus architectures.
The memory 902 may include readable media in the form of volatile memory, such as Random Access Memory (RAM) 9021 and/or cache memory 9022, and may further include Read Only Memory (ROM) 9023.
The memory 902 may also include a program/utility 9025 having a set (at least one) of program modules 9024, such program modules 9024 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment.
Device 900 may also communicate with one or more external devices 904 (e.g., keyboard, pointing device, etc.), one or more devices that enable a user to interact with device 900, and/or any devices (e.g., router, modem, etc.) that enable device 900 to communicate with one or more other devices. Such communication may occur through an input/output (I/O) interface 905. Also, device 900 can communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet, through network adapter 906. As shown, the network adapter 906 communicates with other modules for the device 900 over the bus 903. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with device 900, including, but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
Optionally, the processor is configured to calculate a distance between the primitive to be adjusted and each reference primitive located on the same page, and includes:
establishing a coordinate system by taking any point in the page as a coordinate origin;
And respectively selecting a reference point on the to-be-adjusted primitive and the reference primitive for each reference primitive in the reference primitives, and determining the distance between the to-be-adjusted primitive and the reference primitive according to the coordinate value of the reference point of the to-be-adjusted primitive and the coordinate value of the reference point of the reference primitive.
Optionally, the processor is configured to select a reference point on the to-be-adjusted primitive and the reference primitive, and includes:
Respectively determining the edge contours of the primitives to be adjusted and the reference primitives by using an edge detection algorithm;
Selecting a first point in the edge contour point set of the to-be-adjusted primitive, and selecting a second point in the edge contour point set of the reference primitive, so that the distance between the first point and the second point is nearest;
And determining the first point as the reference point of the primitive to be adjusted, and determining the second point as the reference point of the reference primitive.
Optionally, the processor is configured to predict an alignment manner of the at least one reference primitive, and generate an adsorption line corresponding to the alignment manner, and includes:
generating a minimum circumscribed rectangle frame of the at least one reference primitive;
For each reference primitive in the at least one reference primitive, respectively determining auxiliary lines corresponding to different alignment modes based on the minimum circumscribed rectangular frame according to a preset alignment mode;
And predicting the auxiliary line corresponding to the closest alignment mode as the adsorption line according to the positions of the to-be-adjusted primitive and at least one reference primitive.
Optionally, the auxiliary line includes at least one of the following:
a straight line where the left border of the minimum circumscribed rectangular frame corresponding to the left alignment mode is located;
a straight line where the right frame of the minimum circumscribed rectangular frame corresponding to the right alignment mode is located;
a straight line of the upper frame of the minimum circumscribed rectangular frame corresponding to the upper alignment mode;
A straight line of the lower frame of the minimum circumscribed rectangular frame corresponding to the lower alignment mode;
A transverse center line where the center point of the minimum circumscribed rectangular frame corresponding to the transverse centering alignment mode is located;
And a longitudinal center line where the center point of the minimum circumscribed rectangular frame corresponding to the longitudinal centering alignment mode is located.
Optionally, the processor is configured to predict, according to the positions of the primitive to be adjusted and the at least one reference primitive, that an auxiliary line corresponding to the closest alignment mode is an adsorption line, including:
Determining a measuring point with the shortest auxiliary line distance corresponding to the alignment mode in the primitives to be adjusted according to each alignment mode of each reference primitive in the at least one reference primitive, and calculating the distance between the measuring point and the auxiliary line corresponding to the alignment mode;
And determining an alignment mode corresponding to the shortest distance in the distances as a closest alignment mode, and predicting an auxiliary line corresponding to the closest alignment mode as an adsorption line.
Optionally, the processor is configured to adjust a position of the primitive to be adjusted, and after the aligned position in the primitive to be adjusted overlaps with the adsorption line of the target reference primitive, the method further includes:
monitoring an instruction for moving the primitive to be adjusted, and determining the moving speed and/or displacement of the primitive to be adjusted;
when the moving speed is judged to be greater than a preset speed threshold, the position of the primitive to be adjusted is adjusted according to the moving speed, and/or when the displacement is judged to be greater than a preset displacement threshold, the position of the primitive to be adjusted is adjusted according to the displacement;
otherwise, judging the instruction for moving the primitive to be adjusted as an invalid instruction.
In some possible embodiments, aspects of a primitive alignment method provided by the present application may also be implemented in the form of a program product comprising program code for causing a computer device to perform the steps of a primitive alignment method according to the various exemplary embodiments of the present application as described herein when the program product is run on a computer device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable disk, a hard disk, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The program product for monitoring of embodiments of the present application may employ a portable compact disc read only memory (CD-ROM) and include program code and may run on a device. However, the program product of the present application is not limited thereto, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The readable signal medium may include a data signal propagated in baseband or as part of a carrier wave with readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user device, partly on the user device, as a stand-alone software package, partly on the user device, partly on a remote device, or entirely on the remote device or server. In the case of remote devices, the remote device may be connected to the user device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external device (e.g., connected via the Internet using an Internet service provider).
It should be noted that although several units or sub-units of the apparatus are mentioned in the above detailed description, such a division is merely exemplary and not mandatory. Indeed, the features and functions of two or more of the elements described above may be embodied in one element in accordance with embodiments of the present application. Conversely, the features and functions of one unit described above may be further divided into a plurality of units to be embodied.
Furthermore, although the operations of the methods of the present application are depicted in the drawings in a particular order, this is not required or suggested that these operations must be performed in this particular order or that all of the illustrated operations must be performed in order to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step to perform, and/or one step decomposed into multiple steps to perform.
It will be appreciated by those skilled in the art that 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 block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flowchart and/or block of the flowchart and block diagrams, and combinations of flowcharts and 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 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 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 block diagram block or blocks.
While preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present application without departing from the spirit or scope of the application. Thus, it is intended that the present application also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.
Claims (7)
1. A method of primitive alignment, the method comprising:
Detecting that the to-be-adjusted graphic element is displaced, and respectively calculating the distance between the to-be-adjusted graphic element and each reference graphic element positioned on the same page;
When at least one reference graphic element with the distance from the graphic element to be adjusted being smaller than a first threshold value is monitored, generating a minimum circumscribed rectangular frame of the at least one reference graphic element; for each reference primitive in the at least one reference primitive, respectively determining auxiliary lines corresponding to different alignment modes based on the minimum circumscribed rectangular frame according to a preset alignment mode; determining a measuring point with the shortest auxiliary line distance corresponding to the alignment mode in the to-be-adjusted primitive according to each alignment mode of each reference primitive in the at least one reference primitive, and calculating the distance between the measuring point and the auxiliary line corresponding to the alignment mode; determining an alignment mode corresponding to the shortest distance in the distances as a closest alignment mode, and predicting an auxiliary line corresponding to the closest alignment mode as an adsorption line;
When the target reference graphic element with the distance smaller than the second threshold value from the graphic element to be adjusted is monitored, positioning the alignment position in the graphic element to be adjusted according to the alignment mode corresponding to the adsorption line of the target reference graphic element; the value of the second threshold value is smaller than that of the first threshold value;
adjusting the position of the primitive to be adjusted until the alignment position in the primitive to be adjusted is overlapped with the adsorption line of the target reference primitive;
Wherein the auxiliary line comprises at least one of the following: a straight line where the left border of the minimum circumscribed rectangular frame corresponding to the left alignment mode is located; a straight line where the right frame of the minimum circumscribed rectangular frame corresponding to the right alignment mode is located; a straight line where an upper frame of the minimum circumscribed rectangular frame corresponding to the upper alignment mode is located; a straight line where the lower frame of the minimum circumscribed rectangular frame corresponding to the lower alignment mode is located; a transverse midline where the center point of the minimum circumscribed rectangular frame corresponding to the transverse centering alignment mode is located; and a longitudinal midline where the center point of the minimum circumscribed rectangular frame corresponding to the longitudinal centering alignment mode is located.
2. The method according to claim 1, wherein calculating the distance between the primitive to be adjusted and each reference primitive located on the same page, respectively, comprises:
Establishing a coordinate system by taking any point in the page as a coordinate origin;
and respectively selecting a reference point on the to-be-adjusted primitive and the reference primitive for each reference primitive in the reference primitives, and determining the distance between the to-be-adjusted primitive and the reference primitive according to the coordinate value of the reference point of the to-be-adjusted primitive and the coordinate value of the reference point of the reference primitive.
3. The method according to claim 2, wherein selecting a reference point on the primitive to be adjusted and the reference primitive, respectively, comprises:
respectively determining the edge contour of the primitive to be adjusted and the reference primitive by using an edge detection algorithm;
Selecting a first point in the edge contour point set of the to-be-adjusted primitive, and selecting a second point in the edge contour point set of the reference primitive, so that the distance between the first point and the second point is nearest;
And determining the first point as a reference point of the primitive to be adjusted, and determining the second point as a reference point of the reference primitive.
4. The method of claim 1, wherein adjusting the position of the primitive to be adjusted to an aligned position in the primitive to be adjusted is overlapped with the adsorption line of the target reference primitive further comprises:
monitoring an instruction for moving a graphic element to be adjusted, and determining the moving speed and/or displacement of the graphic element to be adjusted;
when the moving speed is judged to be greater than a preset speed threshold, the position of the primitive to be adjusted is adjusted according to the moving speed, and/or when the displacement is judged to be greater than a preset displacement threshold, the position of the primitive to be adjusted is adjusted according to the displacement;
otherwise, judging the instruction for moving the primitive to be adjusted as an invalid instruction.
5. A primitive alignment device, the device comprising:
the calculation module is used for monitoring the displacement of the to-be-adjusted graphic element and respectively calculating the distance between the to-be-adjusted graphic element and each reference graphic element positioned on the same page;
The generation module is used for generating a minimum circumscribed rectangular frame of at least one reference graphic element when the distance between the at least one reference graphic element and the graphic element to be adjusted is smaller than a first threshold value; for each reference primitive in the at least one reference primitive, respectively determining auxiliary lines corresponding to different alignment modes based on the minimum circumscribed rectangular frame according to a preset alignment mode; determining a measuring point with the shortest auxiliary line distance corresponding to the alignment mode in the to-be-adjusted primitive according to each alignment mode of each reference primitive in the at least one reference primitive, and calculating the distance between the measuring point and the auxiliary line corresponding to the alignment mode; determining an alignment mode corresponding to the shortest distance in the distances as a closest alignment mode, and predicting an auxiliary line corresponding to the closest alignment mode as an adsorption line;
The positioning module is used for positioning the alignment position in the to-be-adjusted primitive according to the alignment mode corresponding to the adsorption line of the target reference primitive when the target reference primitive with the distance smaller than the second threshold value is monitored; the value of the second threshold value is smaller than that of the first threshold value;
the adjusting module is used for adjusting the position of the primitive to be adjusted until the alignment position in the primitive to be adjusted is overlapped with the adsorption line of the target reference primitive;
Wherein the auxiliary line comprises at least one of the following: a straight line where the left border of the minimum circumscribed rectangular frame corresponding to the left alignment mode is located; a straight line where the right frame of the minimum circumscribed rectangular frame corresponding to the right alignment mode is located; a straight line where an upper frame of the minimum circumscribed rectangular frame corresponding to the upper alignment mode is located; a straight line where the lower frame of the minimum circumscribed rectangular frame corresponding to the lower alignment mode is located; a transverse midline where the center point of the minimum circumscribed rectangular frame corresponding to the transverse centering alignment mode is located; and a longitudinal midline where the center point of the minimum circumscribed rectangular frame corresponding to the longitudinal centering alignment mode is located.
6. A primitive alignment device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the method of any of claims 1-4 when the computer program is executed by the processor.
7. A computer readable storage medium having stored thereon computer program instructions, which when executed by a processor, implement the steps of the method of any of claims 1-4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210189863.2A CN114579238B (en) | 2022-02-28 | 2022-02-28 | Primitive alignment method, device and equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210189863.2A CN114579238B (en) | 2022-02-28 | 2022-02-28 | Primitive alignment method, device and equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114579238A CN114579238A (en) | 2022-06-03 |
CN114579238B true CN114579238B (en) | 2024-08-20 |
Family
ID=81771283
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210189863.2A Active CN114579238B (en) | 2022-02-28 | 2022-02-28 | Primitive alignment method, device and equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114579238B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108920053A (en) * | 2018-06-29 | 2018-11-30 | 维沃移动通信有限公司 | A kind of alignment schemes and mobile terminal |
CN110389810A (en) * | 2019-07-31 | 2019-10-29 | 阿里巴巴集团控股有限公司 | A kind of method, device and equipment for quickly putting UI control on virtual canvas |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7287241B2 (en) * | 2003-06-17 | 2007-10-23 | Microsoft Corporation | Snaplines for control object positioning |
US20140095986A1 (en) * | 2012-09-30 | 2014-04-03 | Vinay Krishnaswamy | Baseline Alignment |
US10331319B2 (en) * | 2016-06-29 | 2019-06-25 | Adobe Inc. | Objects alignment and distribution layout |
CN111352545A (en) * | 2019-05-07 | 2020-06-30 | 鸿合科技股份有限公司 | Automatic adsorption method of interactive service and related equipment |
CN112764654B (en) * | 2021-01-29 | 2022-10-25 | 北京达佳互联信息技术有限公司 | Component adsorption operation method and device, terminal and storage medium |
CN113626018A (en) * | 2021-07-06 | 2021-11-09 | 深圳点猫科技有限公司 | Application interface design method and device, electronic equipment and storage medium |
-
2022
- 2022-02-28 CN CN202210189863.2A patent/CN114579238B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108920053A (en) * | 2018-06-29 | 2018-11-30 | 维沃移动通信有限公司 | A kind of alignment schemes and mobile terminal |
CN110389810A (en) * | 2019-07-31 | 2019-10-29 | 阿里巴巴集团控股有限公司 | A kind of method, device and equipment for quickly putting UI control on virtual canvas |
Also Published As
Publication number | Publication date |
---|---|
CN114579238A (en) | 2022-06-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3916634A2 (en) | Text recognition method and device, and electronic device | |
US20210389149A1 (en) | Method and device for drawing a three-dimensional road network map, apparatus and medium | |
US9645733B2 (en) | Mechanism for switching between document viewing windows | |
JP2021197190A (en) | Optical character recognition methods, devices, electronic devices and storage media | |
US9323436B2 (en) | Utilizing drawing guides in determining the display of smart guides in a drawing program | |
CN107632773A (en) | For obtaining the method and device of information | |
CN112256254B (en) | A method and device for generating layout code | |
CN114063858A (en) | Image processing method, device, electronic device and storage medium | |
EP3828733B1 (en) | Visual search method, visual search device and electrical device | |
US12190445B2 (en) | High-precision map construction method, apparatus and electronic device | |
CN113657396A (en) | Training method, translation display method, device, electronic equipment and storage medium | |
US20240281938A1 (en) | Video processing method and apparatus, electronic device, and medium | |
CN114882313B (en) | Method, device, electronic equipment and storage medium for generating image annotation information | |
CN114579238B (en) | Primitive alignment method, device and equipment | |
CN113837194A (en) | Image processing method, image processing apparatus, electronic device, and storage medium | |
CN115638785B (en) | Robot mapping method and device, electronic equipment and storage medium | |
CN115493581B (en) | Robot movement map generation method, device, equipment and storage medium | |
CN112882775A (en) | Method and device for self-adaptive adjustment of page template | |
CN115841475A (en) | Heart image segmentation method, device, equipment and storage medium | |
CN114092874B (en) | Training method of target detection model, target detection method and related equipment thereof | |
CN109144364B (en) | Interaction method, system, equipment and storage medium for floating layer dissolving | |
CN113126866A (en) | Object determination method and device, electronic equipment and storage medium | |
CN110276567A (en) | Method and device for checking ground area identification code based on automatic guided transport vehicle | |
CN115237289B (en) | Hot zone range determining method, device, equipment and storage medium | |
CN110888583A (en) | Page display method, system and device 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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |