Component automatic positioning method, device and equipment facing MOM service domain, and medium
By calculating the intention distance and positioning edge direction matching degree between components, and combining the overlap, a visual shadow is generated, which solves the misalignment and overlap problem in the component dragging process of the MOM platform, realizes the precise alignment and reasonable layout of components, and improves the user experience and operation efficiency.
Patent Information
- Application Number
- CN202510772264.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-11
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2045-06-11
AI Technical Summary
The existing MOM platform's canvas is prone to misalignment, overlap, and misalignment issues during component dragging, affecting modeling efficiency and user experience.
By calculating the intent distance, positioning edge direction matching degree, and overlap between components, a visual shadow is generated, and the component center point is automatically aligned at the target anchor point, and the coordinates are updated to achieve precise alignment and reasonable layout of components.
It improves the efficiency of precise alignment of components on the canvas, reduces the time users spend manually adjusting, enhances the interactive perception and operational control of the user interface, and improves the smoothness of operation.
Smart Images

Figure CN120631333B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computers, and provides a component automatic positioning method, device, equipment and medium for a MOM business domain. BACKGROUND
[0002] A manufacturing operation management (MOM) platform is an integrated management system that aims to optimize each link in the production process, thereby improving manufacturing efficiency, reducing costs, improving product quality, and achieving flexible production scheduling. In the current practice of business domain modeling and process design of the MOM platform, dragging and layout of components based on a visual canvas is a basic and high-frequency interactive operation.
[0003] However, the canvas of the existing platform is mainly free to place statically, and lacks effective positioning and alignment mechanisms. During the dragging process, components are prone to misalignment, overlap, and misalignment, which seriously affects modeling efficiency and user experience. Therefore, there is an urgent need for a component automatic positioning method that can adapt to business semantics and enhance intelligent response to dragging. SUMMARY
[0004] The present application provides a component automatic positioning method, device, equipment and medium for a MOM business domain, which is used to solve the problem that components are prone to misalignment, overlap, and misalignment during the dragging and layout process.
[0005] In a first aspect, the present application provides a component automatic positioning method for a MOM business domain, applied to a canvas of a MOM platform; the canvas contains a plurality of draggable components; the method comprises:
[0006] In response to a dragging operation of a specified component by a user, calculating an intended distance between a plurality of static components and the specified component on the canvas;
[0007] Calculating a positioning edge direction matching degree between the plurality of static components and the specified component; the positioning edge direction matching degree is used to reflect the matching degree of the boundary direction of the static component and the dragging direction;
[0008] Calculating an overlap degree between the plurality of static components and the specified component;
[0009] Normalizing and weighting the intended distance, the positioning edge direction matching degree, and the overlap degree, and determining the component with the highest score as the target component;
[0010] According to the target component, determining a target anchor point;
[0011] generating a visual shadow at the target anchor point, when the specified component is dragged into a preset range of the shadow, automatically aligning a center point thereof to the target anchor point and updating coordinates.
[0012] Optionally, the step of calculating the intention distance between the plurality of static components and the specified component comprises:
[0013] fitting a movement trajectory of a center point of the specified component to generate a main trend line;
[0014] calculating a perpendicular distance between the plurality of static components and the main trend line, and a Euclidean distance between the plurality of static components and a last point in the movement trajectory;
[0015] constructing an intention vector according to the perpendicular distance and the Euclidean distance, and generating an intention distribution trend line through principal component analysis;
[0016] taking a distance between the plurality of static components and the intention distribution trend line as the intention distance.
[0017] Optionally, the step of constructing the intention vector according to the perpendicular distance and the Euclidean distance, and generating the intention distribution trend line through principal component analysis comprises:
[0018] constructing an intention vector of each static component according to the perpendicular distance and the Euclidean distance;
[0019] constructing an intention matrix according to the intention vectors of the plurality of static components;
[0020] calculating a covariance matrix of the intention matrix, and extracting a feature vector corresponding to a maximum eigenvalue;
[0021] combining a centroid point of the intention vectors in the intention matrix and the feature vector to generate the intention distribution trend line.
[0022] Optionally, the step of normalizing and weighting summing the intention distance, the positioning edge direction matching degree and the overlap degree, and determining the component with the highest score as the target component comprises:
[0023] sorting in descending order of the intention distance to obtain a ranking of the plurality of static components;
[0024] normalizing and weighting summing the ranking, the positioning edge direction matching degree and the overlap degree, and determining the component with the highest score as the target component; the weight coefficients of the ranking and the positioning edge direction matching degree are positive numbers, and the weight coefficient of the overlap degree is a negative number.
[0025] Optionally, the calculating the positional edge direction matching degree between the plurality of static components and the specified component comprises:
[0026] calculating a direction angle of a line connecting a center point of each static component and a center point of the specified component;
[0027] traversing four boundary edges of each static component to determine a positional edge intersecting the line;
[0028] determining a direction median of the positional edge according to a preset angle range of the positional edge;
[0029] determining an absolute deviation between the direction angle and the direction median as the positional edge direction matching degree between each static component and the specified component.
[0030] Optionally, the determining the target anchor point according to the target component comprises:
[0031] determining the target anchor point within a preset angle range of a positional edge of the target component; if the positional edge of the target component is a length of the target component, a distance between the center point of the target component and the target anchor point = (a height of the target component + a height of the specified component) / 2; if the positional edge of the target component is a height of the target component, the distance between the center point of the target component and the target anchor point = (a length of the target component + a length of the specified component) / 2.
[0032] Optionally, the calculating the overlap degree between the plurality of static components and the specified component comprises:
[0033] calculating an overlap width in a horizontal direction between each static component and the specified component;
[0034] calculating an overlap height in a vertical direction between each static component and the specified component;
[0035] taking a product between the overlap width and the overlap height as the overlap degree between the plurality of static components and the specified component.
[0036] In a second aspect, the present application provides a component automatic positioning device for a MOM business domain, which is arranged in a canvas of a MOM platform; the canvas contains a plurality of components that can be dragged; the device comprises:
[0037] a distance calculation module, configured to calculate an intended distance between a plurality of static components and a specified component on the canvas in response to a dragging operation of the specified component by a user;
[0038] The matching degree calculation module is configured to calculate a positioning edge direction matching degree between the plurality of static components and the specified component, wherein the positioning edge direction matching degree is used to reflect a matching degree of a boundary direction of a static component and a dragging direction.
[0039] The overlap degree calculation module is configured to calculate an overlap degree between the plurality of static components and the specified component.
[0040] The component determination module is configured to perform normalized weighted summation on the intention distance, the positioning edge direction matching degree and the overlap degree, and determine a target component with the highest score as the target component.
[0041] The anchor point determination module is configured to determine a target anchor point according to the target component.
[0042] The alignment module is configured to generate a visual shadow at the target anchor point, and when the specified component is dragged into a preset range of the shadow, automatically align a center point of the specified component to the target anchor point and update a coordinate.
[0043] In a third aspect, the present application provides a computer device, which comprises a memory and a processor, the memory stores a computer program, and the processor executes the computer program to realize the component automatic positioning method for a MOM business domain.
[0044] In a fourth aspect, the present application provides a computer readable storage medium, which stores a computer program, and a processor executes the computer program to realize the component automatic positioning method for a MOM business domain.
[0045] Compared with the prior art, the present application has the following beneficial effects:
[0046] The present application provides a component automatic positioning method for a MOM business domain, which is applied to a canvas of a MOM platform; the canvas comprises a plurality of components that can be dragged; the method comprises the following steps: in response to a dragging operation of a user on a specified component, calculating an intention distance between a plurality of static components and the specified component on the canvas; calculating a positioning edge direction matching degree between the plurality of static components and the specified component, wherein the positioning edge direction matching degree is used to reflect a matching degree of a boundary direction of a static component and a dragging direction; calculating an overlap degree between the plurality of static components and the specified component; performing normalized weighted summation on the intention distance, the positioning edge direction matching degree and the overlap degree, and determining a target component with the highest score as the target component; determining a target anchor point according to the target component; and generating a visual shadow at the target anchor point, and when the specified component is dragged into a preset range of the shadow, automatically aligning a center point of the specified component to the target anchor point and updating a coordinate.
[0047] It can be seen that, by the comprehensive calculation of the intention distance, the positioning edge direction matching degree and the overlap degree, the application can accurately judge the positions of the target component and the target anchor point, thereby ensuring the accurate alignment of the components on the canvas, and the introduction of the overlap degree can guarantee the spatial rationality between the components and avoid occlusion and conflict. And through the automatic alignment and positioning technology, the time and effort of the user for manually adjusting and positioning the components can be effectively reduced, and the operation efficiency is improved. And by generating a visual shadow at the target anchor point, the interactive perception of the user interface is enhanced, and this visual feedback mechanism improves the user's operation control feeling and response speed for the platform, so that the whole operation process is more smooth. BRIEF DESCRIPTION OF DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related art, the drawings needed to be used in the embodiments or the related art description will be briefly introduced. Obviously, the drawings in the following description are only embodiments of the present application, and other drawings can be obtained by the drawings provided by the person skilled in the art without creative labor.
[0049] Figure 1 The computer device structure schematic diagram of the hardware running environment related to the embodiments of the present application;
[0050] Figure 2 The flowchart of the component automatic positioning method for the MOM business domain provided by the embodiments of the present application;
[0051] Figure 3 The schematic diagram of the direction angle provided by the embodiments of the present application;
[0052] Figure 4 The schematic diagram of the target anchor point provided by the embodiments of the present application;
[0053] Figure 5 Another flowchart of the component automatic positioning method for the MOM business domain provided by the embodiments of the present application;
[0054] Figure 6 The structure schematic diagram of the component automatic positioning device for the MOM business domain provided by the embodiments of the present application.
[0055] In the figure, 101 is a processor, 102 is a communication bus, 103 is a network interface, 104 is a user interface, and 105 is a memory. DETAILED DESCRIPTION
[0056] In order to make the purposes, technical solutions and advantages of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application. The embodiments in the present application and the features in the embodiments can be combined with each other arbitrarily without conflict. And, although the logical order is shown in the flowchart, in some cases, the steps shown or described can be performed in an order different from that here.
[0057] In order to solve the problems of misalignment, overlap and misalignment of components in the process of dragging and layout, the embodiment of the present application provides a component automatic positioning method for MOM business domain, which can be executed by a computer device. Please refer to Figure 1 The computer device structure diagram of the hardware running environment related to the embodiment of the present application is shown.
[0058] As Figure 1 shown, the computer device can include a processor 101, such as a central processing unit (CPU), a communication bus 102, a user interface 104, a network interface 103 and a memory 105. The communication bus 102 is used to realize the connection and communication between the components. The user interface 104 can include a display, an input unit such as a keyboard, and the user interface 104 can include a standard wired interface, a wireless interface. The network interface 103 can include a standard wired interface, a wireless interface (such as a wireless fidelity (WIreless-FIdelity, WI-FI) interface). The memory 105 can be a high-speed random access memory (RAM) memory, or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk memory. The memory 105 can also be a storage device independent of the aforementioned processor 101.
[0059] Those skilled in the art can understand that Figure 1 the structure shown in the above does not constitute a limitation on the computer device, and can include more or fewer components than the diagram, or combine some components, or different component arrangements.
[0060] As Figure 1 shown, the memory 105 as a storage medium can include an operating system, a network communication module, a user interface module and a component automatic positioning device for MOM business domain.
[0061] In Figure 1 In the computer device shown, the network interface 103 is mainly used for data communication with a network server; the user interface 104 is mainly used for data interaction with a user; the processor 101 and the memory 105 in the computer device of the application can be arranged in the computer device, and the computer device calls the component automatic positioning device for the MOM service domain stored in the memory 105 through the processor 101, and executes the component automatic positioning method for the MOM service domain provided by the embodiment of the application.
[0062] Figure 1 The computer device is installed with a MOM platform, and the MOM platform provides a visual canvas, the canvas contains a plurality of components that can be dragged, and the component is a functional unit encapsulating a specific business capability in the MOM platform. By graphically dragging and connecting the components on the canvas, the service can be quickly built, such as data query service, data conversion service, process control service, etc.
[0063] The MOM platform constructs a Cartesian two-dimensional grid model with the lower left corner as the origin according to the visible area dimension of the current container in the initialization stage, and the right is the positive direction of the X axis, and the upward is the positive direction of the Y axis. The coordinate axis is discretely defined in the smallest granularity unit p=(wx*ix, wy*iy), and the granularity is controlled by the basic pixel width and height (ix and iy) and the scaling factor (wx and wy), which can be dynamically adjusted to support adaptive grid accuracy. In the dynamic canvas, define the edges array as the connection relationship set between the components in the canvas, and the nodes array as the detail set of the components in the canvas.
[0064] Each component has geometric and logical properties, as shown in Table 1:
[0065] Table 1 Component Properties
[0066]
[0067] It should be noted that each component is a rectangle, and the circumscribed rectangle is also the four edges corresponding to the component.
[0068] Please refer to Figure 2 A flowchart of the component automatic positioning method for the MOM service domain provided by the embodiment of the application is shown in the following Figure 1 The computer device shown, a component automatic positioning method for the MOM service domain is introduced. Figure 2
[0069] S201, in response to the user's drag operation on the specified component, calculate the intention distance between the plurality of static components and the specified component on the canvas.
[0070] In the implementation process, when a user performs a drag operation on a specified component on a canvas, the MOM platform can calculate the intention distance between the specified component and multiple static components on the canvas in real time, wherein the multiple static components refer to static components in the canvas other than the specified component.
[0071] In a possible embodiment, the step of calculating the intention distance between the multiple static components and the specified component comprises:
[0072] fitting a moving track of a center point of the specified component to generate a main trend line; calculating a perpendicular distance between the multiple static components and the main trend line, and an Euclidean distance between the multiple static components and a last point in the moving track; constructing an intention vector according to the perpendicular distance and the Euclidean distance, generating an intention distribution trend line through principal component analysis; and taking a distance between the multiple static components and the intention distribution trend line as the intention distance.
[0073] In the implementation process, first, a moving track of a center point of the specified component can be recorded in real time in the process in which the user drags the specified component, and a track point set T={p1, p2, …, p t} is constructed in time sequence, wherein p i =(x i , y i ), p i represents a center point coordinate at the i-th moment, x i represents an abscissa, and y i represents an ordinate. The track point set describes a moving direction of the specified component and a target intention, and each point (p1, p2, …, p t ) in the track point set can be fitted by using a weighted least square method to obtain a main trend line, and the formula is as follows:
[0074] fline(x)=ax+b
[0075] wherein fline(x) represents the main trend line, x represents a point on the main trend line, and a and b are fitting parameters.
[0076] Secondly, a spatial relationship between each static component and the main trend line can be determined according to the main trend line, including a perpendicular distance and an Euclidean distance. The perpendicular distance refers to a shortest distance between a center point of each static component and the main trend line, and is used to measure an alignment degree in a drag path direction. The Euclidean distance refers to a distance between the center point of each static component and a current landing point (i.e., the last point P t in the track set).
[0077] Then, an intention vector of each static component can be constructed according to the perpendicular distance and the Euclidean distance, and the formula is as follows:
[0078] Φ j = (d j _line, d j _target)
[0079] wherein Φ j represents the intention vector of the jth static component, d j _line represents the perpendicular distance between the jth static component and the main trend line, and d j _target represents the Euclidean distance between the jth static component and the current landing point.
[0080] Next, the intention vectors can be reduced in dimension by principal component analysis (PCA), so as to fit a distribution trend curve reflecting the potential operation intention of the user, which represents the area trend where the user may want the components to be positioned.
[0081] Finally, the distance between the center point of each static component and the distribution trend curve can be calculated as the intention distance between each static component and the specified component.
[0082] In the embodiments of the present application, by fitting the moving trajectory of the specified component and calculating the distance between the static components and the main trend line and the trajectory endpoint, the actual spatial distribution and interaction intention between the components can be more accurately reflected, rather than simply the point-to-point distance, which helps to more reasonably understand the layout relationship between the components. And by using the intention vector and principal component analysis to extract the main trend, the potential intention and dynamic change trend in the component layout can be captured, and the prediction and response ability to the user operation behavior can be improved.
[0083] In a possible embodiment, the step of constructing the intention vector according to the perpendicular distance and the Euclidean distance and generating the intention distribution trend line by principal component analysis includes:
[0084] constructing the intention vector of each static component according to the perpendicular distance and the Euclidean distance; constructing an intention matrix according to the intention vectors of the plurality of static components; calculating the covariance matrix of the intention matrix, extracting the eigenvector corresponding to the maximum eigenvalue; and combining the centroid point of the intention vector in the intention matrix with the eigenvector to generate the intention distribution trend line.
[0085] In the specific implementation process, first, the intention matrix can be constructed according to the intention vectors of the plurality of static components, that is, the two-dimensional feature space matrix Φ∈R n×2 .
[0086] Secondly, the intention matrix Φ can be standardized, and the covariance matrix thereof is calculated, and the eigenvector V1=[v x , v yT The feature vector is a main direction in the intention space.
[0087] Then, the average of the intention vectors of the plurality of static components can be determined as a centroid point Φ_=(d_line, d_target). For example, the intention vectors of 3 static components are Φ_=[(3, 5), (4, 6), (5, 7)], d_line=(3+4+5) / 3=4, d_target=(5+6+7) / 3=6, and the centroid point is Φ_=(4, 6).
[0088] Finally, the centroid point Φ_=(d_line, d_target) of the feature vector and the intention vector can be combined to establish an intention distribution trend line by a point-wise method. The intention distribution trend line is a distribution trend that the user is likely to point to, and the formula is as follows:
[0089]
[0090] where fintent(x) represents the intention distribution trend line, x represents a point on the intention distribution trend line, d_line and d_target represent the horizontal coordinate and the vertical coordinate of the centroid point respectively, v x and v y represent the direction components in the two feature dimensions of the perpendicular distance (i.e., the distance of the component to the main trend line) and the Euclidean distance (i.e., the distance of the component to the last point in the trajectory set) in the feature vector, which are used to depict the main change direction in the component intention space.
[0091] In the embodiments of the present application, the perpendicular distance and the Euclidean distance are used to construct the intention vector, which can more accurately capture the relative position relationship and potential interaction intention of each static component. By extracting the maximum eigenvalue and the corresponding feature vector in the intention matrix, the high-dimensional data can be reduced in dimension, the most representative intention vector is extracted, the key information is maintained while the redundancy is reduced, and the efficiency of data processing is improved. The trend line generated by combining the centroid point in the intention matrix and the principal component vector can effectively capture the behavior trend of the specified component.
[0092] S202, calculate a positioning edge direction matching degree between the plurality of static components and the specified component.
[0093] The positioning edge direction matching degree is used to reflect the matching degree of the boundary direction of the static component and the dragging direction.
[0094] In one possible embodiment, the specific steps of S202 include:
[0095] Calculate the direction angle of the line between the center point of each static component and the center point of the specified component; traverse the four boundary edges of each static component to determine the positioning edge intersecting the line; determine the direction median of the positioning edge according to the preset angle range of the positioning edge; determine the absolute deviation between the direction angle and the direction median as the positioning edge direction matching degree between each static component and the specified component.
[0096] In the specific implementation process, each static component defines its boundary orientation anchor point set, and each edge e∈{up, down, left, right} has a preset angle range [θ emin , θ emax ]. The preset angle range is determined according to the triangle of the two end points and the center point. The direction angle θ m is the angle between the line between the center point of each static component and the center point of the specified component and the horizontal line. If the direction angle falls within the preset angle range of a certain edge of a certain static component, it is considered that the edge of the static component has positioning response capability to the current drag behavior, and the edge is determined as the positioning edge intersecting the line.
[0097] Please refer to Figure 3 , the schematic diagram of the direction angle provided by the embodiment of the application. The upper rectangular frame represents the static component, and the preset angle range of the lower edge of the static component is [θ emin , θ emax ]. The lower rectangular frame represents the specified component, and the direction angle between the line between the center points of the two rectangular frames and the horizontal line is θ m . The lower edge of the static component satisfies: θ emin ≤ θ m ≤ θ emax , and the lower edge of the static component is determined as the positioning edge.
[0098] Calculate the direction median of the positioning edge, and the formula is as follows:
[0099] θ emid =(θ emin +θ emax ) / 2
[0100] Wherein, θ emid represents the direction median of the positioning edge, θ emin represents the minimum value of the angle range of the positioning edge, and θ emax represents the maximum value of the angle range of the positioning edge.
[0101] Calculate the absolute deviation between the direction angle and the direction median, and the formula is as follows:
[0102]
[0103] Wherein, DirectionScore represents the positioning edge direction matching degree, θ mThe direction angle of the line connecting the center point of the static component and the center point of the specified component. When DirectionScore→0, it means that the current dragging direction is highly consistent with the positioning direction of the edge.
[0104] In the embodiments of the present application, the matching degree of the direction angle and the positioning edge direction can be used to more accurately determine the spatial relationship between the dragged component and the static component, avoid misjudgment caused by pure distance determination, and thus realize more reasonable automatic alignment of components. The positioning edge direction matching degree reflects the consistency of the dragging direction and the direction of the static component boundary, ensures that the direction is reasonable during automatic alignment, meets the user operation intention, and makes the interface layout more consistent with human visual habits and interaction logic.
[0105] S203, calculate the overlap degree between the plurality of static components and the specified component.
[0106] The overlap degree is used to reflect the spatial overlap area of the quantized static component and the specified component.
[0107] In one possible embodiment, the specific steps of S203 include:
[0108] Calculate the overlap width between each static component and the specified component in the horizontal direction; calculate the overlap height between each static component and the specified component in the vertical direction; and take the product of the overlap width and the overlap height as the overlap degree between the plurality of static components and the specified component.
[0109] In the specific implementation process, each component can be defined as a rectangular area by its spatial coordinate range, and the coordinate range of the area is: horizontal direction: x∈[x1,x2]; vertical direction: y∈[y1,y2]; wherein (x1,y1) is the upper left corner coordinate of the component, and (x2,y2) is the lower right corner coordinate of the component.
[0110] The overlap width between the static component A and the specified component B in the horizontal direction is calculated, and the formula is as follows:
[0111]
[0112] wherein woverlap represents the overlap width, x A1 and x A2 represent the horizontal range of the static component A, x B1 and x B2 represent the horizontal range of the specified component B. min is the minimum function, min(x A2 ,x B2 ) represents the right boundary of the horizontal range, max is the maximum function, and max(x A1 ,x B1represents the left boundary of the horizontal range, and the difference between the two is the overlap width in the horizontal direction. If there is no intersection in the horizontal direction, the overlap width in the horizontal direction is 0.
[0113] Calculate the overlap height between the static component A and the specified component B in the vertical direction, as follows:
[0114]
[0115] wherein hoverlap represents the overlap height, y A1 and y A2 represent the vertical range of the static component A, y B1 and y B2 represent the vertical range of the specified component B. min is the minimum function, min(y A2 , y B2 ) represents the upper boundary of the vertical range, max is the maximum function, max(y A1 , y B1 ) represents the lower boundary of the vertical range, and the difference between the two is the overlap height in the vertical direction. If there is no intersection in the vertical direction, the overlap height in the vertical direction is 0.
[0116] When there is overlap in both the horizontal direction and the vertical direction, the overlap degree can be calculated by the product of the overlap width and the overlap height:
[0117]
[0118] wherein CollisionAvoid represents the overlap degree, woverlap represents the overlap width, and hoverlap represents the overlap height. If CollisionAvoid>0, it is considered that there is an overlap conflict.
[0119] S204, normalize and weight sum the intention distance, the positioning edge direction matching degree, and the overlap degree, and determine the component with the highest score as the target component.
[0120] In one possible embodiment, the specific steps of S204 include:
[0121] Sort according to the intention distance from large to small to obtain the ranking of the plurality of static components; normalize and weight sum the ranking, the positioning edge direction matching degree, and the overlap degree, and determine the component with the highest score as the target component; the weight coefficients of the ranking and the positioning edge direction matching degree are positive numbers, and the weight coefficient of the overlap degree is a negative number.
[0122] In the specific implementation process, first, sort according to the intention distance from large to small to obtain the ranking of the plurality of static components.
[0123] Then, the ranking, the positioning edge direction matching degree and the overlap degree are normalized according to the following formula:
[0124]
[0125] wherein min(c j ) represents the minimum value of the jth static component in the ranking, the positioning edge direction matching degree and the overlap degree, max(c j ) represents the maximum value of the jth static component in the ranking, the positioning edge direction matching degree and the overlap degree, X t (c j ) represents the tth parameter value of the jth static component, i.e. the ranking, the positioning edge direction matching degree or the overlap degree. X t ′(c j ) represents the tth normalized parameter value of the jth static component, i.e. the normalized ranking, the normalized positioning edge direction matching degree or the normalized overlap degree.
[0126] Finally, the normalized ranking, the normalized positioning edge direction matching degree and the normalized overlap degree are weighted and summed, and the component with the highest score is determined as the target component. The specific calculation formula is as follows:
[0127]
[0128] wherein S j represents the score of the jth static component, represents the normalized ranking of the jth static component, represents the normalized positioning edge direction matching degree of the jth static component, represents the normalized overlap degree of the jth static component. λ1 represents the weight coefficient of the ranking, λ2 represents the weight coefficient of the positioning edge direction matching degree, and λ3 represents the weight coefficient of the overlap degree. λ1 and λ2 are positive numbers, and λ3 is a negative number.
[0129] In the embodiments of the present application, the smaller the intention distance, the higher the matching degree of the static component with the target, and therefore the higher the ranking, and the higher the score of the static component; the greater the positioning edge direction matching degree, the more the static component meets the expected direction requirement in layout or position, and therefore the higher the score of the static component; the smaller the overlap degree, the more space there is between the static component and other components, and therefore the higher the score of the static component. Based on the components with high scores, optimization selection is performed to ensure that the design meets the target requirements and maintains sufficient available space and efficient alignment.
[0130] S205, determining a target anchor point according to the target component.
[0131] In one possible implementation, the specific step of S205 includes:
[0132] The target anchor point is determined within a preset angle range of the positioning edge of the target component; if the positioning edge of the target component is the length of the target component, the distance between the center point of the target component and the target anchor point = (the height of the target component + the height of the specified component) / 2; if the positioning edge of the target component is the height of the target component, the distance between the center point of the target component and the target anchor point = (the length of the target component + the length of the specified component) / 2.
[0133] Please refer to Figure 4 , a schematic diagram of a target anchor point provided by the embodiment of the present application. The upper rectangular frame A represents the target component with the highest score, the center points of the four rectangular frames A1, A2, A3 and A4 around the rectangular frame A represent four anchor points respectively, the lower rectangular frame B represents the specified component, and the arrow represents the dragging direction of the specified component B. The lower edge of the target component A is the positioning edge, and the dragging direction of the specified component B falls within the preset angle range of the lower edge of the target component A. Therefore, the center point of the lower edge rectangular frame A1 is the target anchor point, and the distance between the center point of the target component A and the target anchor point = (the height of the target component A + the height of the specified component B) / 2.
[0134] S206, a visual shadow is generated at the target anchor point, and when the specified component is dragged into the preset range of the shadow, the center point of the specified component is automatically aligned to the target anchor point and the coordinates are updated.
[0135] In the specific implementation process, after the target anchor point is determined, a semi-transparent shadow is generated at the target anchor point, the position is located through vision, when the user drags the specified component into the preset range of the shadow, the automatic alignment action is performed to align the center point of the specified component to the target anchor point, and a position update event is triggered to update the actual coordinates of the specified component and update the layout state of the entire canvas.
[0136] Please refer to Figure 5 , another flowchart of the component automatic positioning method for the MOM business domain provided by the embodiment of the present application.
[0137] S501, component dragging.
[0138] When the specified component on the canvas is dragged, the MOM platform performs the component automatic positioning algorithm for the MOM business domain provided by the present application.
[0139] S502, fitting a path trend line.
[0140] The intention distribution trend line is fitted and generated, and the intention distances between the multiple static components and the intention distribution trend line are calculated.
[0141] S503, angle positioning anchor point matching.
[0142] calculating a positioning edge direction matching degree between the plurality of static components and the specified component.
[0143] S504, avoiding overlapping.
[0144] calculating an overlapping degree between the plurality of static components and the specified component.
[0145] S505, positioning an anchor point.
[0146] performing a normalized weighted sum on the intention distance, the positioning edge direction matching degree and the overlapping degree, determining a target component with the highest score as the target component, and determining a target anchor point according to the target component.
[0147] S506, component automatic positioning.
[0148] generating a visual shadow at the target anchor point.
[0149] S507, UI feedback and positioning action execution.
[0150] When the specified component is dragged into a preset range of the shadow, automatically aligning a center point thereof to the target anchor point and updating a coordinate.
[0151] In summary, the application provides a component automatic positioning method for a MOM business domain. The method realizes dynamic prediction of user operation intention through trajectory trend line fitting and component positioning candidate point sorting, and realizes high-precision matching of component boundary positioning anchor point direction and drag path angle, thereby generating an intelligent positioning response effect. An overlapping penalty mechanism is introduced to ensure the spatial rationality between components and avoid occlusion and conflict. The method has the advantages of not relying on static grid, dynamically generating positioning points, intelligently inferring drag intention, etc. The actual effect can achieve a layout experience similar to "dynamic grid positioning", and is more flexible and expandable, and is suitable for business modeling scenarios such as MOM platforms that require high-visual interactive.
[0152] based on the same inventive concept, please refer to Figure 6 The application also provides a component automatic positioning device for a MOM business domain. The device is arranged in a canvas of a MOM platform. The canvas contains a plurality of draggable components. The device comprises:
[0153] a distance calculation module configured to calculate an intention distance between a plurality of static components and a specified component on the canvas in response to a drag operation of the specified component by a user;
[0154] a matching degree calculation module configured to calculate a positioning edge direction matching degree between the plurality of static components and the specified component. The positioning edge direction matching degree is used to reflect the matching degree of the boundary direction of the static component and the drag direction.
[0155] an overlap calculation module configured to calculate an overlap degree between the plurality of static components and the specified component;
[0156] a component determination module configured to normalize and weight sum the intention distance, the positioning edge direction matching degree and the overlap degree, and determine the component with the highest score as the target component;
[0157] an anchor point determination module configured to determine the target anchor point according to the target component;
[0158] an alignment module configured to generate a visual shadow at the target anchor point, and automatically align a center point of the specified component to the target anchor point and update the coordinates when the specified component is dragged into a preset range of the shadow.
[0159] It should be noted that the processor in this embodiment corresponds to each step in the component automatic positioning method for the MOM business domain in the foregoing embodiments one by one, and therefore the specific implementation of this embodiment can refer to the implementation of the component automatic positioning method for the MOM business domain, which will not be described herein again.
[0160] Based on the same inventive concept, the present application further provides a computer device, which comprises a processor, a memory and a computer program stored in the memory, and the computer program realizes the foregoing component automatic positioning method for the MOM business domain when executed by the processor.
[0161] Based on the same inventive concept, the present application further provides a computer storage medium, which stores a computer program, and the computer program realizes the foregoing component automatic positioning method for the MOM business domain when executed by the processor.
[0162] In some embodiments, the computer readable storage medium can be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disc or CD-ROM, etc.; or can be various devices comprising one or any combination of the above memories. The computer can be various computing devices including smart terminals and servers.
[0163] In some embodiments, the executable instructions can be in the form of programs, software, software modules, scripts or codes, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and can be deployed in any form, including being deployed as independent programs or as modules, components, subroutines or other units suitable for use in computing environments.
[0164] As an example, executable instructions can correspond to a file in a file system, can be stored in a part of a file that is used by the operating system to store application program data, can be stored as an "applet" in a general purpose software application, can be stored as a "plugin" in a web browser, or can be stored as an "app" in a mobile device, to name but a few.
[0165] As an example, executable instructions can be deployed to be executed on one computer, or on multiple computers of a system of computers in one location, or on multiple computers of a system of computers distributed among multiple locations and interconnected through a communication network.
[0166] It has to be noted that, as used herein, the terms "comprising", "including", "containing", "characterized by", "comprised of", "comprising" or grammatical equivalents thereof are intended to be open-ended and non-limiting terminology, such that items or components following any of those terms are not intended to be an exhaustive listing of more items or components, or that anything or component not specifically mentioned is necessarily excluded. Furthermore, it is to be understood that the use of "about" or "approximately" in connection with a recited numerical value means that the algebraic value of the number is "within + / - 10 % of the recited value".
[0167] The sequence number of the above-mentioned embodiments of the present application is only for description, and does not represent the advantages and disadvantages of the embodiments.
[0168] Those skilled in the art can clearly understand the above-mentioned embodiment method can be realized by means of software and necessary general hardware platform, of course, also can be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory, a random access memory, a magnetic disk, or an optical disk), and includes a plurality of instructions for causing a multimedia terminal device (which can be a mobile phone, a computer, a television receiver, or a network device) to execute the methods described in the various embodiments of the present application.
[0169] The above are only preferred embodiments of the present application, and do not limit the patent scope of the present application, and any equivalent structure or equivalent process transformation made by using the contents of the specification and drawings, or directly or indirectly applied to other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for automatically locating components facing MOM business domains, characterized in that, Be applied to the canvas of the MOM platform; The canvas contains several components that can be dragged; the method comprises: In response to the user's drag operation on the specified component, calculate the intention distance between the multiple static components on the canvas and the specified component; the calculation of the intention distance between the multiple static components on the canvas and the specified component comprises: Fit the moving track of the center point of the specified component to generate a main trend line; Calculate the perpendicular distance between the multiple static components and the main trend line, and the Euclidean distance between the multiple static components and the last point in the moving track; According to the perpendicular distance and the Euclidean distance, construct an intention vector, and generate an intention distribution trend line through principal component analysis; The distance between the multiple static components and the intention distribution trend line is taken as the intention distance; Calculate the positioning edge direction matching degree between the multiple static components and the specified component; the positioning edge direction matching degree is used to reflect the matching degree of the boundary direction of the static component and the dragging direction; the calculation of the positioning edge direction matching degree between the multiple static components and the specified component comprises: Calculate the direction angle of the connecting line between the center point of each static component and the center point of the specified component; Determine the positioning edge intersecting the connecting line by traversing the four boundary edges of each static component; According to the preset angle range of the positioning edge, determine the direction median value of the positioning edge; The absolute deviation between the direction angle and the direction median value is determined as the positioning edge direction matching degree between each static component and the specified component; Calculate the overlap degree between the multiple static components and the specified component; Normalize and weight sum the intention distance, the positioning edge direction matching degree and the overlap degree, and determine the component with the highest score as the target component; According to the target component, determine the target anchor point; Generate a visual shadow at the target anchor point, and when the specified component is dragged into the preset range of the shadow, automatically align the center point of the specified component to the target anchor point and update the coordinates.
2. The method of claim 1, wherein, The step of constructing an intention vector according to the perpendicular distance and the Euclidean distance, and generating an intention distribution trend line through principal component analysis, comprises: According to the perpendicular distance and the Euclidean distance, construct an intention vector for each static component; According to the intention vectors of the multiple static components, construct an intention matrix; Calculate the covariance matrix of the intention matrix, and extract the eigenvector corresponding to the maximum eigenvalue; Combine the centroid point of the intention vector in the intention matrix and the eigenvector to generate an intention distribution trend line.
3. The method of claim 1, wherein, The step of normalizing and weight summing the intention distance, the positioning edge direction matching degree and the overlap degree, and determining the component with the highest score as the target component, comprises: Sort the multiple static components in descending order of the intention distance to obtain the ranking of the multiple static components; Normalize and weight sum the ranking, the positioning edge direction matching degree and the overlap degree to determine the component with the highest score as the target component; the weight coefficients of the ranking and the positioning edge direction matching degree are positive numbers, and the weight coefficient of the overlap degree is negative.
4. The method of claim 1, wherein, The target anchor point is determined according to the target component, and the target anchor point comprises: The target anchor point is determined within a preset angle range of the positioning edge of the target component; if the positioning edge of the target component is the length of the target component, the distance between the center point of the target component and the target anchor point is equal to (the height of the target component + the height of the specified component) / 2; if the positioning edge of the target component is the height of the target component, the distance between the center point of the target component and the target anchor point is equal to (the length of the target component + the length of the specified component) / 2.
5. The method of claim 1, wherein, The overlap degree between the plurality of static components and the specified component is calculated, and the overlap degree comprises: The overlap width between each static component and the specified component in the horizontal direction is calculated; The overlap height between each static component and the specified component in the vertical direction is calculated; The product of the overlap width and the overlap height is taken as the overlap degree between the plurality of static components and the specified component.
6. A MOM service domain oriented component automatic positioning device, characterized in that, The canvas is arranged on the MOM platform; The canvas comprises a plurality of components that can be dragged; the device comprises: A distance calculation module is configured to calculate the intended distance between the plurality of static components and the specified component on the canvas in response to the dragging operation of the user on the specified component; the intended distance between the plurality of static components and the specified component on the canvas is calculated, and the intended distance comprises: A main trend line is generated by fitting the movement trajectory of the center point of the specified component; The perpendicular distance between the plurality of static components and the main trend line and the Euclidean distance between the plurality of static components and the last point in the movement trajectory are calculated; An intended distribution trend line is generated by principal component analysis according to the perpendicular distance and the Euclidean distance; The distance between the plurality of static components and the intended distribution trend line is taken as the intended distance; A matching degree calculation module is configured to calculate the positioning edge direction matching degree between the plurality of static components and the specified component; the positioning edge direction matching degree is used to reflect the matching degree of the boundary direction of the static component and the dragging direction; the positioning edge direction matching degree between the plurality of static components and the specified component is calculated, and the positioning edge direction matching degree comprises: The direction angle of the connecting line between the center point of each static component and the center point of the specified component is calculated; Each of the four boundary edges of each static component is traversed to determine the positioning edge intersecting the connecting line; The direction median value of the positioning edge is determined according to the preset angle range of the positioning edge; The absolute deviation between the direction angle and the direction median value is determined as the positioning edge direction matching degree between each static component and the specified component; An overlap degree calculation module is configured to calculate the overlap degree between the plurality of static components and the specified component; A component determination module is configured to normalize and weight sum the intended distance, the positioning edge direction matching degree, and the overlap degree, and determine the component with the highest score as the target component; An anchor point determination module is configured to determine the target anchor point according to the target component. An alignment module is configured to generate a visual shadow at the target anchor point, and when the specified component is dragged into a preset range of the shadow, automatically align the center point thereof to the target anchor point and update the coordinates.
7. A computer device, comprising: The computer device comprises a memory and a processor, the memory stores a computer program, and the processor executes the computer program to implement the MOM service domain-oriented component automatic positioning method in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the processor executes the computer program to implement the MOM service domain-oriented component automatic positioning method in any one of claims 1-5.
Citation Information
Patent Citations
Method, system and equipment for generating visualized webpage and storage medium
CN108415706A
Web page drag component positioning method, storage medium, electronic apparatus and system
CN109213409A