Geometric evaluation label arrangement method and device, computer device, computer readable storage medium and computer program product
By introducing associated weights and refined layout into the measurement software of the coordinate measuring machine, the problems of label overlap and leader line intersection were solved, realizing automatic label arrangement and clear and beautiful view, thus improving user experience and efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHOTEST TECH INC
- Filing Date
- 2026-03-31
- Publication Date
- 2026-06-16
AI Technical Summary
The coordinate measuring machine's measurement software suffers from poor user experience and time-consuming manual adjustments due to issues such as label overlap and leader line intersection.
By introducing the concept of association weights, and comprehensively considering the position of feature elements, available space, and label size information, intelligent and automated label arrangement is achieved, including pre-allocation and subsequent fine-grained layout, eliminating lead line intersections.
It achieves a view with balanced label distribution and clear, non-intersecting leader lines, improving user experience and work efficiency, and avoiding the time wasted on manual adjustments.
Smart Images

Figure CN121957595B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of automatic measurement technology, and in particular to a method, apparatus, computer device, computer-readable storage medium, and computer program product for arranging geometric evaluation labels. Background Technology
[0002] A coordinate measuring machine (CMM) is a precision measuring instrument that can measure the spatial coordinates of parts. With the rapid development of modern manufacturing technology, CMMs have become important equipment for inspecting the geometric dimensions and positional accuracy of parts. They are characterized by high precision, large measurement range, good performance, and strong versatility, and are widely used in fields such as machinery manufacturing, electronics, automotive, and aerospace.
[0003] When measuring a workpiece, the software needs to perform dimensional calculations or spatial geometric evaluations on the measured feature elements and display the measurement results in the view in the form of labels. The labels are connected to the specified positions of the feature elements in the workpiece model through leaders, forming a visual correspondence between the measured value and the measured geometric feature.
[0004] In related technologies, after the measurement results of coordinate measuring software are output in batches by the measurement program, there are often cases of overlapping labels and crossed leaders, which greatly affects the user's experience; while manually dragging and dropping to adjust the label position is too time-consuming. Summary of the Invention
[0005] Therefore, it is necessary to provide a geometric evaluation label arrangement method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can efficiently improve the visual effect of labels, addressing the aforementioned technical problems.
[0006] Firstly, this application provides a method for arranging geometric evaluation labels, including:
[0007] The available space information of multiple optional edges of the window view of the measurement software, the distance between at least one target feature element in the window view and the optional edge, and the size information of the label to be arranged corresponding to the target feature element are obtained; the label to be arranged is used to display the geometric evaluation result corresponding to the target feature element;
[0008] Based on the available space information, the distance, and the size information, determine the association weight between the label to be arranged corresponding to the target feature element and each of the optional edges;
[0009] Based on the association weight, the labels to be arranged corresponding to at least one of the target feature elements are associated with the corresponding target edges;
[0010] For each of the optional edges, the layout of the associated labels on the optional edges is adjusted according to the size information of the associated labels of the optional edges and the intersection of the leaders, so as to obtain the window view with the labels arranged; the leaders are used to associate the target feature elements with the labels to be arranged in the window view.
[0011] Secondly, this application also provides a geometric evaluation label arrangement device, comprising:
[0012] The acquisition module is used to acquire available space information of multiple optional edges of the window view of the measurement software, the distance between at least one target feature element in the window view and the optional edge, and the size information of the label to be arranged corresponding to the target feature element; the label to be arranged is used to display the geometric evaluation result corresponding to the target feature element.
[0013] The determining module is used to determine the association weight between the label to be arranged corresponding to the target feature element and each of the optional edges based on the available space information, the distance, and the size information;
[0014] The association module is used to associate the labels to be arranged corresponding to the at least one target feature element with the corresponding target edge according to the association weight;
[0015] The adjustment module is used to adjust the layout of the associated labels on each of the optional edges according to the size information of the associated labels of the optional edges and the intersection of the leaders, so as to obtain the window view with the labels arranged; the leaders are used to associate the target feature elements with the labels to be arranged in the window view.
[0016] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps included in any of the foregoing method embodiments.
[0017] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps included in any of the foregoing method embodiments.
[0018] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps included in any of the foregoing method embodiments.
[0019] The aforementioned geometric evaluation label arrangement method, apparatus, computer equipment, computer-readable storage medium, and computer program product, by introducing the concept of association weights, transform the label allocation problem into a quantifiable multi-factor comprehensive decision-making problem, achieving intelligent and automated label allocation. Through refined placement of labels on the same side and elimination of leader line intersections, the cleanliness and readability of the view are further improved. Uniform distribution based on dimensional information ensures that labels do not overlap and are arranged in an orderly manner; based on an iterative optimization process of leader line intersection detection and exchange, leader line intersections are completely eliminated with minimal computational cost. This two-stage processing method of "allocation first, optimization later" ensures both global balance and local precision, thereby enabling fully automatic label arrangement of measurement results. Users no longer need to spend a lot of time manually dragging and adjusting, significantly improving work efficiency. The view after arrangement features balanced label distribution, clear and non-intersecting leader lines, and a neat and orderly arrangement, allowing users to quickly and accurately match measured values with corresponding geometric features, effectively improving the user experience of the measurement software. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a diagram illustrating the application environment of a geometric evaluation label arrangement method in one embodiment.
[0022] Figure 2 This is a flowchart illustrating a geometric evaluation label arrangement method in one embodiment;
[0023] Figure 3 This is a schematic diagram of labels, edges, and feature elements in one embodiment;
[0024] Figure 4 This is a schematic diagram illustrating label overlap in one embodiment;
[0025] Figure 5 This is a schematic diagram illustrating the overlapping of labels in one embodiment;
[0026] Figure 6 This is a schematic diagram of label overlap and intersection elimination in one embodiment;
[0027] Figure 7 This is a schematic diagram showing the completed label arrangement in one embodiment;
[0028] Figure 8 A schematic diagram illustrating the creation of an interface for a subview in one embodiment;
[0029] Figure 9 This is a structural block diagram of a geometric evaluation label arrangement device in one embodiment;
[0030] Figure 10 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0031] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0032] Before describing the embodiments of this application, the relevant technologies and their existing problems will be further explained:
[0033] In related technologies, measurement software often lacks an automatic label arrangement mechanism during the label creation stage. It frequently generates all labels directly near feature elements or in default positions, leading to two typical problems: first, multiple labels stack and obscure each other on the screen, making it impossible for users to clearly read the obscured measurement values; second, the connecting lines between the labels and the measured features are crisscrossed, making it difficult for users to quickly and accurately match the measurement values with the corresponding geometric features. Even if some software allows users to manually drag and adjust the label positions, this manual adjustment method is extremely time-consuming and accuracy is difficult to guarantee when there are many labels.
[0034] Therefore, a label layout scheme is needed that can guarantee label layout efficiency and visual effect after layout.
[0035] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.
[0036] The geometric evaluation label arrangement method provided in this application is applicable to the measurement software of a coordinate measuring machine (CMM) for automatically arranging measurement result labels. The CMM can be used as follows: Figure 1As shown, the system includes a computer (or host computer), a motion controller, and a measuring machine. The computer has built-in measurement software responsible for configuring the measurement program and evaluating the measurement results. The motion controller coordinates and controls the motor-driven measuring machine based on the measurement program, enabling it to perform motion measurements along the expected work trajectory and feeding back measurement signals to acquire measurement data. The basic structure of the measuring machine includes a probe, a motion system, and a marble working platform. The motion system includes mutually perpendicular X-axis, Y-axis, and Z-axis drive structures, which control the relative movement of the probe and the marble platform in the X, Y, and Z directions, respectively. During the measurement process, the workpiece is placed on the marble working platform, and the probe is controlled to move along the expected work trajectory to contact and measure the workpiece. The position of the contact point between the probe and the workpiece is recorded to obtain measurement data. Besides being used in coordinate measuring machines, this software can also be applied to other software scenarios that require labeling with digital models or drawings, such as label layout in CAD software, where labels can be used to display design data for corresponding feature elements.
[0037] When measuring a workpiece, the measurement software needs to calculate the dimensions of the measured feature elements and display the measurement results in the view as labels. The labels are connected to designated positions of the feature elements in the workpiece model via leaders, forming a visual correspondence between the measured value and the measured geometric feature. The label arrangement method provided in this embodiment can solve the problems of label overlap, leader crossing, and time-consuming manual adjustment in the prior art.
[0038] In one exemplary embodiment, such as Figure 2 As shown, a geometric evaluation label arrangement method is provided, which can be applied to... Figure 1 Taking a coordinate measuring machine as an example, the following steps are included:
[0039] Step 202: Obtain the available space information of multiple optional edges of the window view of the measurement software, the distance between at least one target feature element in the window view and the optional edge, and the size information of the label to be arranged corresponding to the target feature element; the label to be arranged is used to display the geometric evaluation result corresponding to the target feature element.
[0040] Specifically, the labels to be arranged are generated according to the measurement commands for the target feature elements in the measurement software.
[0041] In this context, the window view of the measurement software refers to the display interface used to show the workpiece model and measurement results. Users can perform operations such as translation or rotation on the workpiece model to change the viewing angle. In this embodiment, the 3D coordinates of the workpiece model are projected onto the two-dimensional interface coordinates of the display interface based on the current viewing angle, and the positions of feature elements are determined based on the two-dimensional interface coordinates.
[0042] Optional edges refer to the edge areas in the window view that can be used to place labels. In this embodiment, optional edges include four edges: the top, bottom, left, and right edges of the window. Each optional edge has its corresponding available space information, which characterizes the amount of space available for placing labels on the current edge. Specifically, the available space information may include the length (for the top and bottom edges) or height (for the left and right edges) of the edge, as well as the size of the blank areas reserved at both ends of the edge. For example, for the top and bottom edges, the available space information is the horizontal available length of the edge; for the left and right edges, the available space information is the vertical available height of the edge.
[0043] Target feature elements refer to the geometric features on the workpiece model that require the display of measurement results, such as points, lines, circles, and arcs. The measurement program contains corresponding measurement commands for these feature elements. Executing these commands generates corresponding measurement results, and a label is generated for each measurement result. The distribution of the labels is related to the position of the feature elements. When the viewing angle of the workpiece model changes, the coordinates of the feature elements on the 2D interface also change, and the distribution of the corresponding labels also changes accordingly.
[0044] The distance between a target feature element and the optional edges refers to the distance from the feature element to the four edges of the window, calculated based on the two-dimensional display coordinates of the target feature element in the window view from the current perspective. Specifically, the pixel distances to the top, bottom, left, and right edges of the window can be calculated based on the two-dimensional display coordinates of the feature element.
[0045] The size information of the labels to be arranged refers to the size of each label itself, including its width and height. Different labels may have different sizes; for example, the width of the label may vary depending on the measured length of the content. In this embodiment, the size information is used to subsequently determine the layout position of the label on each side and to determine whether a side can accommodate the label.
[0046] Step 204: Based on the available space information, the distance, and the size information, determine the association weight between the label to be arranged corresponding to the target feature element and each of the optional edges.
[0047] Association weight is a quantitative indicator used to characterize the tendency of a label to be assigned to each available edge. Determining association weight requires considering several factors: First, a label should be as close as possible to its corresponding feature element. Therefore, the closer a feature element is to an edge, the greater the association weight of that edge for that label should be; that is, association weight is negatively correlated with distance. For example, ... Figure 3 As shown, based on the distance between feature element T1 and each side, the label A1 corresponding to T1 has the largest association weight with the side below.
[0048] Secondly, the available space on each side is limited and cannot accommodate labels without restriction. Therefore, the determination of association weights needs to meet the space constraints of each side. In addition, the size of the label itself will also affect whether it can be accommodated by a certain side. Therefore, size information is also an important basis for determining association weights.
[0049] Specifically, the principles for determining the weights of the three factors—distance, available space information, and size information—can be as follows:
[0050] The principle of distance factor influence: the closer a feature element is to an optional edge, the greater the association weight of that edge with its label, and vice versa. This principle ensures that labels naturally tend to be distributed on the side of the screen edge near their corresponding feature element, thus making the leader line as short and intuitive as possible, avoiding excessively long leaders or those crossing the central area of the screen. For example, for a feature element located on the left side of the window, its corresponding label should be preferentially assigned to the left, so that the leader line only needs to extend a short distance to the left to connect the label, making it visually clearer.
[0051] The principle of influence of available space information: The larger the available space of an optional edge, the greater the association weight of that edge with unassigned labels, and vice versa. This principle achieves a balanced distribution of labels among the edges, avoiding excessive concentration of labels on one side due to uneven distribution of feature points, which would exceed the space capacity of that side. For example, if most feature elements are concentrated on the right side of the window, distance alone would lead to a large number of labels being assigned to the right side, but the available space on the right side is limited and cannot accommodate too many labels. In this case, by introducing the influence of available space information, the weight of the right side on subsequent labels can be dynamically reduced, guiding some labels to other edges that still have spare space.
[0052] The principle of size information influence: The size information (width and height) of a label is mainly used to determine whether the label can be accommodated by a certain side. In determining the association weight, size information and available space information work together: when the real-time available space on a side is less than the size of the label to be assigned, the weight of that side for that label should be set to zero, meaning that the side cannot accommodate the label. This principle ensures the feasibility of the allocation result and effectively prevents the situation where a label cannot be placed due to insufficient space after being assigned to a side.
[0053] In summary, the relationship between the three factors can be summarized as follows: distance determines the initial tendency, spatial constraints are dynamically adjusted, and size ensures feasible allocation. Through this multi-factor comprehensive weighting method, this embodiment can achieve a balanced distribution and effective containment of labels on all sides while maintaining the intuitiveness of the lead wires.
[0054] Step 206: According to the association weight, associate the labels to be arranged corresponding to the at least one target feature element with the corresponding target edge.
[0055] After determining the association weight between each label to be arranged and each optional edge, the labels can be assigned according to the weight. Specifically, for each label to be arranged, it can be associated with the optional edge with the largest association weight, which is the target edge corresponding to that label. In this way, each label is assigned to the window edge that best suits it, taking into account both the position of the feature element and the spatial capacity of each edge.
[0056] Unlike the disordered distribution of labels in related technologies, this embodiment pre-assigns labels to different window edges based on association weights, so that each label has a clear placement area, avoiding disordered accumulation of labels in the central area of the screen from the source, and laying the foundation for subsequent refined layout.
[0057] It should be noted that the determination of association weights can be a static, one-time calculation, or it can be dynamically adjusted during the allocation process based on the real-time available space of each edge. In the dynamic adjustment approach, as labels are continuously allocated to each edge, the available space of each edge gradually decreases, and the association weight of that edge to the remaining unallocated labels also decreases accordingly, thereby achieving a balanced distribution of labels across the edges.
[0058] Step 208: For each of the optional edges, adjust the layout of the associated labels on the optional edges according to the size information of the associated labels of the optional edges and the intersection of the leaders, to obtain the window view with the labels arranged; the leaders are used to associate the target feature elements with the labels to be arranged in the window view.
[0059] Simply assigning labels to the correct edges doesn't guarantee a clear and aesthetically pleasing final display. Randomly placing labels on the same side can still result in overlapping labels, or labels that are too densely or too sparsely arranged, hindering user readability. Figure 4 As shown, label A1 and label A2 overlap.
[0060] By carefully arranging the labels, they can be evenly distributed along the edge, making full use of the available space while ensuring appropriate spacing between labels to avoid visual crowding. For example... Figure 5 As shown, after the layout adjustment, there is no overlap between label A1 and label A2.
[0061] The benefits of this layout adjustment are twofold: firstly, neatly arranged labels are more in line with users' visual habits, making it easier to find and read quickly; secondly, evenly distributed labels provide a good initial state for subsequent lead cross detection, reducing the number of crosses that need to be adjusted.
[0062] After assigning labels to the target edges, fine-tuning the placement of multiple labels on the same edge is necessary to ensure a clear and aesthetically pleasing final display. The size (width and height) of the labels is a fundamental parameter determining whether they can be accommodated on a given edge and how they should be arranged. For the top and bottom edges, labels are arranged horizontally, so their width is a key consideration; for the left and right edges, labels are arranged vertically, so their height is a key consideration. Layout adjustments based on size information achieve the following effects: First, by calculating the ratio of the total label size to the available space on the edge, a reasonable spacing between labels can be determined, ensuring even distribution of labels on that edge. Second, when detecting label overlap, comparing the position coordinates and dimensions of adjacent labels allows for accurate determination of whether and to what extent overlap exists, providing a quantitative basis for overlap elimination.
[0063] Meanwhile, leader line intersections are one of the main factors affecting the readability of label views. When multiple labels are on the same side, their leaders may intersect, easily causing visual confusion and making it difficult for users to quickly associate the labels with their corresponding feature elements.
[0064] Adjustments based on leader intersections are made by detecting whether the leaders of any two labels on the same side intersect. When an intersection is detected, the order of the two labels is swapped, effectively eliminating leader intersections. The core advantage of this adjustment method is that it maintains the leaders as straight lines (compared to changing the leader shape by adding inflection points or extension points), resulting in a cleaner and clearer visual appearance; and it only requires swapping within the same side, leading to low computational complexity and high efficiency. For example, ... Figure 5 As shown, a crossover was detected between the leaders corresponding to labels A1 and A2. After adjustment, the label arrangement can be obtained where the leaders no longer crossover. Figure 6 As shown.
[0065] By iteratively detecting and exchanging data, it is ultimately possible to ensure that the leaders of all labels on the same side do not intersect, thus achieving a clean and aesthetically pleasing view.
[0066] Specifically, the initial position of each label on each side needs to be determined based on the available space on each side and the label size allocated to that side. A uniform distribution principle is typically adopted, arranging labels at equal intervals along the side to avoid overlap. Specifically, for the top and bottom sides, labels are arranged horizontally; for the left and right sides, labels are arranged vertically. The spacing between adjacent labels can be calculated using the formula G=(DS) / K, where D is the available space size of the side, S is the total size of all labels allocated to that side, and K is the number of labels allocated to that side.
[0067] Secondly, it is necessary to detect and adjust for leader line intersections. For example, one end of the leader line connects to the center of the feature element, and the other end connects to the center of the label. Once the label position is determined, the leader line position is also determined. Of course, the leader line can also connect to other positions of the feature element or label, depending on the internal parameter design of the measurement software. Multiple labels on the same side may form intersecting leader lines with their corresponding feature elements, affecting the readability of the view. This embodiment detects leader line intersections on the same side. If an intersection is found, the intersection is eliminated by swapping the arrangement order of the relevant labels, and this process is iterated until all the leader lines of all labels on that side are free of intersection.
[0068] Through the above steps, this embodiment achieves automatic arrangement of measurement result labels, solving the problems of label overlap, lead wire crossing, and time-consuming manual adjustment in the prior art, and can obtain results such as... Figure 7 The clear and aesthetically pleasing view of measurement results enhances user experience and work efficiency.
[0069] In an optional embodiment, the method may further include an overload detection and adjustment step. After completing the lead cross detection and adjustment, it is detected whether the actual occupied size of each side exceeds the space range defined by the available space information of that side. If the actual occupied size of a side exceeds the space range, the label exceeding the space range on that side is moved to another side with the smallest current actual occupied size, and the lead cross detection is re-performed on the moved label until the actual occupied size of all sides does not exceed the corresponding space range and the leads of any two labels on the same side have no intersection. This step can avoid new space overload problems caused by lead cross adjustment, forming a complete closed-loop optimization. For example, if the left and top sides share the upper left corner of the display interface, when the label located in the corner on the top side is swapped with other labels, the size of the swapped label may be different, and its width may be larger than the width of the original label, causing the total size of the labels that the left side needs to accommodate to increase, which may exceed the space range defined by the available space information on the left side. Therefore, an overload detection and adjustment step is required.
[0070] In another optional embodiment, the method may further include a view segmentation preprocessing step. When the number of labels to be arranged is too large, exceeding the total capacity of each side of the window, the upper limit of the number of labels that the window can accommodate at one time can be calculated based on the label size and the available space information of each side of the window. If the total number of labels to be arranged exceeds this upper limit, the window view is divided into multiple subviews, and the above arrangement method is performed on the labels in each subview. This step can fundamentally solve the information overload problem caused by the excessive number of labels, ensuring the simplicity and readability of each individual view.
[0071] The label arrangement method provided in this embodiment transforms the label allocation problem into a quantifiable multi-factor comprehensive decision-making problem by introducing the concept of association weight. The association weight comprehensively considers the position (distance) of feature elements, the carrying capacity of each side (available space information), and the physical size of the label itself (size information), achieving intelligent and automated label allocation. Compared to the random generation or simple stacking of labels in existing technologies, this embodiment allows labels to naturally tend to be distributed on the screen edge near their corresponding features, ensuring the shortness and straightness of the leader lines from the source. Simultaneously, through dynamic adjustment of spatial constraints, a balanced distribution of labels on each side is achieved, avoiding the problem of excessive crowding on one side. By performing refined positional layout and leader line intersection elimination on the same side, the cleanliness and readability of the view are further improved. Uniform distribution based on size information ensures that labels do not overlap and are arranged in an orderly manner; the iterative optimization process based on leader line intersection detection and exchange completely eliminates leader line intersection phenomena with minimal computational cost. This two-stage processing method of allocation followed by optimization ensures both global balance and local refinement. In summary, this embodiment achieves fully automated label arrangement of measurement results, eliminating the need for users to spend significant time manually dragging and adjusting labels, thus significantly improving work efficiency. The resulting view features balanced label distribution, clear and non-intersecting leader lines, and a neat and orderly arrangement, allowing users to quickly and accurately correlate measured values with corresponding geometric features, effectively improving the user experience of the measurement software. The method provided in this embodiment can be widely applied to the software systems of precision measuring equipment such as coordinate measuring machines, and has significant practical value.
[0072] In some embodiments, determining the association weight between the label to be arranged corresponding to the target feature element and each of the optional edges based on the available space information, the distance, and the size information includes:
[0073] For each target feature element, the initial association weight between the label to be arranged corresponding to the target feature element and each of the optional edges is determined based on the distance from the target feature element to each of the optional edges; wherein, the initial association weight is negatively correlated with the distance.
[0074] And / or, if the distance from the target feature element to the corner of the window view is less than a preset threshold, the initial association weights between the label to be arranged corresponding to the target feature element and the two adjacent sides of the corner are adjusted to a first weight multiplied by a first coefficient and a second weight multiplied by a second coefficient, respectively; wherein, the first coefficient is less than 1 and the second coefficient is greater than 1.
[0075] And / or, based on the initial association weight, the labels to be arranged corresponding to each of the target feature elements are pre-associated to the corresponding optional edges, and the available space information of each of the optional edges is updated according to the pre-association results.
[0076] Based on the updated available space information, the initial association weights of the labels to be arranged that have not yet been associated are adjusted. The association weight of the optional edge for the labels to be arranged that have not yet been associated is positively correlated with the size of the available space of the optional edge.
[0077] The initial association weight refers to the degree of association between the label and each optional edge, considering only the positional factors of the feature elements. The core idea of this step is that the label should be as close as possible to its corresponding feature element. Therefore, the closer the feature element is to an edge, the greater the initial association weight of that edge to the label, and vice versa. Specifically, the initial association weight can be calculated using a preset mapping function based on the distance values from the feature element to each edge. For example, an inverse proportional function or a linearly decreasing function can be used to give edges with smaller distances a larger initial weight. It should be noted that the initial association weight is determined only based on distance and does not yet consider the spatial capacity constraints of each edge or the label size constraints; therefore, it is called the initial association weight, providing a basis for subsequent dynamic adjustments.
[0078] In some optional embodiments, considering that in practical applications, when a feature element is particularly close to a window corner, the distance from the feature element to the two adjacent sides of that corner is very close, resulting in very similar initial association weights of these two sides to the label. In this case, without intervention, the label is easily affected by the combined effect of the two sides and is difficult to clearly assign. When there are multiple feature elements close to the corner, labels may overlap densely in the corner, affecting the aesthetics of the view. Therefore, this embodiment introduces a corner handling mechanism: First, a minimum distance parameter is specified as a preset threshold, and the distance from the feature element to the nearest corner of the window is calculated. If this distance is less than the preset threshold, the feature element is considered to be close to the corner, and its initial association weight needs to be adjusted. The specific adjustment method can be: multiply the initial association weights of the label corresponding to the feature element to the two adjacent sides of the corner by a first coefficient and a second coefficient, respectively. The first coefficient is less than 1, used to weaken the weight of one side; the second coefficient is greater than 1, used to strengthen the weight of the other side. Through this adjustment, the balance of the initial association weights of the two sides is disrupted, allowing the label to be more clearly identified as belonging to a certain side, avoiding accumulation at the corner.
[0079] For example, assuming a feature element is near the bottom left corner of the window, its distances to both the bottom and left sides are very close, and the initial association weights W_down and W_left are also very close. In this case, multiplying W_down by a first coefficient α (α < 1) yields the adjusted first weight W_down' = α × W_down, and multiplying W_left by a second coefficient β (β > 1) yields the adjusted second weight W_left' = β × W_left. Through this adjustment, the association weight of the label on the left side is significantly greater than that on the bottom, and the label will be preferentially assigned to the left, thus avoiding the accumulation of other labels in the bottom corner. It should be noted that the specific values of the first and second coefficients can be adjusted according to the actual application scenario to break the balance without excessively deviating from the original distance relationship.
[0080] Optionally, when a feature element is near a corner, the initial association weight of that feature element to the nearest edge is weakened (i.e., multiplied by a first coefficient α), while the initial association weight to the remaining edges is strengthened (multiplied by a second coefficient β). In this case, the capacity pressure on the nearest edge can be reduced, and the label to be arranged for that feature element can be preferentially pre-associated to other edges.
[0081] In some optional embodiments, before considering space capacity constraints, a pre-allocation is performed based on the currently determined initial association weights to understand the initial load of each edge. Specifically, for each target feature element, its corresponding label to be arranged is pre-associated to the optional edge with the largest initial association weight. During the pre-association process, the number of labels pre-associated to each optional edge is counted, and the real-time available space information of each optional edge is updated based on the size information of these labels. The method for updating the available space information can be as follows: for each optional edge, the sizes of all labels pre-associated to that edge (width for top and bottom edges, height for left and right edges) are summed to obtain the pre-occupied size of that edge; then, the pre-occupied size is subtracted from the original available space of that edge to obtain the updated real-time available space. This real-time available space information will be used for subsequent dynamic weight adjustments.
[0082] Furthermore, after pre-association, the available space of each optional edge has changed: edges with more pre-associated labels have correspondingly smaller available space; edges with fewer pre-associated labels have relatively more available space. This change in space should, in turn, affect the subsequent label allocation tendency, that is, edges with more space should be more attractive to unassigned labels.
[0083] Specifically, for each optional edge, its current association weight with unassociated labels to be arranged should be positively correlated with the real-time available space of that edge. The larger the available space, the greater the weight; the smaller the available space, the smaller the weight. This adjustment can be implemented based on a preset adjustment function, such as multiplying the initial association weight by a coefficient proportional to the available space.
[0084] For example, when the real-time available space of an optional edge is less than the size of a label to be assigned, the edge can no longer accommodate the label. In this case, the association weight of the edge with the label can be directly set to zero, indicating that the edge no longer has the possibility of assigning the label. This processing ensures the feasibility of the allocation result and can suppress the situation where a label cannot be placed after being assigned to an edge due to insufficient space. Through the above dynamic adjustment, this embodiment realizes an adaptive mechanism in which edges with more space are more likely to be assigned subsequent labels, thereby guiding labels to flow to edges with spare space, and ultimately achieving a balanced distribution of all edges.
[0085] It should be noted that the above steps can be performed iteratively: after completing one round of pre-association and weight adjustment, a new round of pre-association can be performed based on the adjusted weights, the available space can be updated again, and the weights can be adjusted again until the association weights of all labels are stable or the preset number of iterations is reached. This iterative optimization method can more accurately achieve the optimal allocation under multiple constraints.
[0086] This embodiment establishes a direct correlation between label assignment and feature element position, ensuring that labels naturally tend to be distributed on the screen edge near their corresponding features. This guarantees the shortness and straightness of the leader lines from the source, preventing them from being too long or crossing the central area of the screen. Furthermore, it is specifically optimized for the special case where feature elements are near window corners. By introducing a preset threshold and adjusting asymmetric coefficients, the weight balance caused by the close proximity of two adjacent edges at corners is effectively broken, avoiding the problem of multiple labels densely stacking and overlapping at corners, thus improving the aesthetics and readability of the layout.
[0087] In some embodiments, the step of pre-associating the labels to be arranged corresponding to each of the target feature elements to the corresponding optional edges according to the initial association weight includes:
[0088] For each target feature element, the label to be arranged corresponding to the target feature element is pre-associated to the optional edge with the largest initial association weight;
[0089] For each optional edge, the labels to be arranged are added to the current edge in descending order of their initial association weights. The available space information of the optional edge is updated after each addition.
[0090] The initial determination of the attribution tendency of each label provides basic data for subsequent spatial capacity assessment and dynamic weight adjustment. Specifically, for each target feature element, after completing the initial association weight calculation and corner processing, the system obtains the initial association weight value between the label to be arranged for that feature element and the four optional edges (top, bottom, left, and right).
[0091] Taking a target feature element as an example, assuming its initial association weights to the top, bottom, left, and right edges are W_up, W_down, W_left, and W_right respectively, and after comparison, W_left is found to have the largest value, then the label is pre-associated to the left edge. Each label tends to choose the edge that currently attracts it the most (i.e., has the largest weight). It should be noted that this pre-association is not the final assignment result, but a temporary assignment in an intermediate state. Its purpose is to let the system understand how each label will choose its assigned edge if only distance factors (and corner processing corrections) are considered, so that the preload of each edge can be evaluated based on this preliminary selection. This step provides the necessary input for subsequent dynamic adjustments based on spatial capacity.
[0092] After completing the pre-association of all labels, each optional edge acquires a batch of labels pre-associated to it. However, simply knowing which labels are pre-associated to a certain edge is insufficient; it is also necessary to determine the addition order of these labels on that edge and to evaluate the space consumption of that edge in real time. Therefore, to address this issue, in this embodiment, for each optional edge, the system sorts all labels pre-associated to that edge in descending order of their initial association weights. The basis for this sorting logic is that the larger the initial association weight of a label, the stronger the binding relationship between the label and the edge, and its allocation needs should be prioritized. For example, assuming that labels A, B, and C are pre-associated on the left, with initial association weights W_A=0.9, W_B=0.7, and W_C=0.5 respectively, the addition order would be A→B→C.
[0093] Following the above sorting order, the system adds each label to the current edge sequentially. Here, "adding" means logically confirming that the label occupies a portion of the current edge's space. For each added label, the system needs to update the real-time available space information of the current edge based on the label's size information. Specifically, for the top and bottom edges, the space occupied by the label is reflected in its width; for the left and right edges, the space occupied by the label is reflected in its height. Assuming the current available space on the left is L_available, and the height of the first pre-associated label A is H_A, then after adding label A, the real-time available space on the left is updated to L_available' = L_available - H_A. When label B is subsequently added, the calculation continues based on the updated available space, i.e., L_available'' = L_available' - H_B, and so on.
[0094] The system dynamically adjusts the weights of labels to be assigned by utilizing real-time available space information on each side. Specifically, as labels are continuously added to each optional edge, the remaining space is gradually consumed; the association weight of that optional edge with other unadded labels to be assigned will gradually weaken. The system iterates through all four sides of the window to adjust the weights of the labels to be assigned on each side. For example, when the remaining space on a certain side gradually decreases or becomes insufficient to accommodate the next label to be added, the system can reduce the association weight of that edge with subsequent unassigned labels, or even reset its weight to zero, thereby achieving real-time feedback of space capacity to allocation decisions.
[0095] It should be noted that adding descriptions in this step is still a logical operation in the pre-association stage, not the final formal allocation. Its core purpose is to simulate the allocation process, obtain the space consumption curves of each side, and provide a quantitative basis for subsequent weight adjustments. The final formal allocation will be carried out again based on the adjusted final weights after the dynamic weight adjustment is completed in the aforementioned steps.
[0096] In some optional embodiments, in practical applications, the number of labels may exceed the capacity limits of the four sides of the window. In this case, after the real-time available space information of each side is insufficient to accommodate the labels, the weight of the remaining overloaded labels on each side is set to 0, and a specified flag is added to these labels. During the subsequent allocation process, these labels carrying the specified flag will be placed in the flag position by default (e.g., overlapping and placed in a selected position), or directly hidden, or automatically allocated to the next subview (e.g., a subview can be created to plan these overloaded labels). Thus, even if the number of labels is too large, label allocation processing can still be achieved.
[0097] In some embodiments, adjusting the layout of the associated labels on each of the optional edges based on the size information of the associated labels and the intersection of the leader lines to obtain the window view with the labels arranged includes:
[0098] For each of the optional edges, the initial position coordinates of each label to be arranged on the current edge are determined based on the size information of each label to be arranged associated with the same edge and the available space information of the current edge, so that the arrangement of each label to be arranged satisfies the preset distribution conditions.
[0099] Based on the initial position coordinates, determine whether adjacent labels to be arranged overlap. If they overlap, adjust the coordinates of the overlapping labels to obtain the first position coordinates of each label to be arranged (this step can be omitted).
[0100] Based on the first position coordinates, detect whether there is an intersection point between the lead lines of any two labels to be arranged on the same side;
[0101] If there is an intersection, swap the arrangement order of the two labels to be arranged on the current edge, and update the position coordinates of each label to be arranged until the leads of any two labels to be arranged on the current edge have no intersection, and obtain the second position coordinates of each label to be arranged.
[0102] Based on the second position coordinates, detect whether the actual occupied size of each of the optional edges exceeds the space range defined by the available space information of the current edge;
[0103] If the actual occupied size of any of the optional edges exceeds the space range, move the labels to be arranged that exceed the current edge to the other optional edge with the smallest actual occupied size, and re-perform the lead line cross detection on the moved labels until the actual occupied size of all optional edges does not exceed the corresponding space range and the leads of any two labels to be arranged on the same edge have no intersection (this step can be omitted).
[0104] After label allocation (i.e., determining the target edge to which each label ultimately belongs), each edge has a batch of labels to be arranged. However, simply knowing which labels are assigned to a certain edge is insufficient; it is also necessary to determine the specific positions of these labels on that edge. Specifically, in this embodiment, the determination of the initial position coordinates can consider the following two factors: first, the available space information of the current edge; and second, the size information of all labels associated with that edge. The basic goal is to arrange the labels evenly on the edge, making full use of the available space of that edge while ensuring appropriate spacing between the labels to avoid visual crowding.
[0105] Specifically, for the top and bottom edges, the labels are arranged horizontally, and the width of each label needs to be considered; for the left and right edges, the labels are arranged vertically, and the height of each label needs to be considered. Preset distribution conditions can include various forms, such as label center alignment, label edge alignment, and equal label spacing. In a preferred embodiment, the preset distribution condition is that the labels are evenly distributed along their respective edges, with equal spacing between adjacent labels.
[0106] It should be noted that the initial position coordinates determined in this step are only the basis for subsequent adjustments, and further adjustments may be made based on the results of overlap detection and lead line intersection detection.
[0107] In some optional embodiments, theoretically, the labels should not overlap after the initial positions are determined according to preset distribution conditions. However, in practical applications, due to inconsistent label sizes, approximations of preset distribution conditions, etc., adjacent labels may still partially overlap. This step is precisely to detect and eliminate such overlap, ensuring that the labels are visually completely separated. Specifically, the labels are usually rectangular areas, and the coverage area of each label in the window can be determined by its position coordinates and size information. For two adjacent labels on the same side, their position coordinates and sizes can be compared to determine whether there is overlap. For example, for labels A and B arranged from left to right above, assuming the top-left corner coordinates of label A are (x_A, y_A) and the width is w_A; and the top-left corner coordinates of label B are (x_B, y_B) and the width is w_B. If x_A + w_A > x_B, it means that the right side of label A extends beyond the left side of label B, and the two labels overlap.
[0108] If overlap is detected, the positions of the corresponding labels need to be adjusted to eliminate it. There are several ways to adjust them: for example, the two overlapping labels can be slightly adjusted to the sides to separate them; or the label located behind can be moved backward a certain distance in a counter-clockwise direction to provide adjustment space for the overlapping labels. Regardless of the method used, the goal of the adjustment is to ensure that all adjacent labels do not overlap and to maintain the original uniform distribution characteristics as much as possible. The resulting coordinates of each label position after adjustment are called the first position coordinates.
[0109] In some optional embodiments, after ensuring that labels do not overlap, it is also necessary to address the issue of leader line intersections. One end of a leader line connects to the center of a feature element, and the other end connects to the center of a label. Once the label position is determined, the position of the leader line is also determined. Multiple labels on the same side may form intersecting leader lines with their corresponding feature elements, affecting the readability of the view. Based on this, this embodiment eliminates all leader line intersections by detecting whether the leader lines of any two labels on the same side intersect, and swapping the arrangement order of the two labels when an intersection is found, in an iterative manner.
[0110] Specifically, for labels on the same edge, traversal and detection can be performed according to a preset calculation direction (such as counterclockwise or clockwise). Taking a certain edge as an example, label A in the first position is selected, and its lead line crossover detection is performed with all subsequent labels B, C, D, etc. The detection method is as follows: based on the lead line of label A (connecting feature element A and label A) and the lead line of label B (connecting feature element B and label B), it is determined whether the two line segments intersect. If an intersection point exists, it means that the lead lines cross, and the order of labels A and B on that edge is swapped.
[0111] After the swap, the new label at the first position (original label B) continues to perform lead line cross-checking with all labels after the currently calculated position. After the check is completed, the label at the second position is selected, and the operation continues with all labels after it, until the last two labels are selected and cross-checking is completed. If a cross-check occurs and a swap is performed during a certain traversal, the traversal needs to be restarted until no cross-check is found in a complete traversal. Through this iterative detection and swapping method, it can be ensured that the leads of any two labels on the edge do not cross, and the second position coordinates of each label are obtained. This adjustment method can maintain the lead line in a straight line form (compared to changing the shape of the lead line by adding inflection points or extension points), which is more visually concise and clear; and it only requires swapping operations within the same edge, with less computation and higher efficiency.
[0112] In some optional embodiments, considering that eliminating lead wire crossings by swapping the label order in the aforementioned steps may change the label arrangement order on the edges, thereby affecting the actual occupied size of each edge. For example, if the original label arrangement order on a certain edge was A, B, C, after cross-detection and swapping, it may become B, A, C. Although the total size of the labels remains unchanged, swapping the positions of labels of different sizes may cause the actual occupied size of that edge to change (for example, a label that was originally wider may be swapped to the edge position, causing the edge area to exceed the available space).
[0113] Specifically, based on the second position coordinates, the actual occupied size of all labels on each optional edge can be calculated. For the top and bottom edges, the actual occupied size is the sum of the widths of all labels plus the spacing between labels; for the left and right edges, the actual occupied size is the sum of the heights of all labels plus the spacing between labels. The actual occupied size is compared with the space range defined by the available space information of that edge. If the actual occupied size exceeds the space range, it indicates that the edge is overloaded.
[0114] In some alternative implementations, for overloaded edges, the excess labels need to be moved to other edges with available space. The selection principle for the target edge to be moved is to choose the other optional edge with the smallest current actual occupied size to ensure load balancing after the move. The selection principle for the labels to be moved is to prioritize moving the label farthest from the current edge (or with the smallest weight), or prioritize moving the smaller label to make room for other edges. Alternatively, for overloaded edges, a specified flag is added to the overloaded labels (prioritizing the label with the smallest weight to the current edge). Labels carrying the specified flag can be hidden, moved to other areas besides the window edge (such as an area near the center), or assigned to the next subview.
[0115] In some optional embodiments, after the movement is complete, the leader line cross-checking needs to be performed again on the moved labels because the labels have changed their side, and the leader line connection relationship has changed, which may result in new cross-lines. Repeat the aforementioned steps until the actual occupied size of all optional sides does not exceed the corresponding space range, and the leaders of any two labels to be arranged on the same side have no intersection points. At this point, the label layout adjustment is complete, and a window view showing the completed label arrangement is obtained.
[0116] In some embodiments, determining the initial position coordinates of each label to be arranged on the current side based on the size information of each label to be arranged associated with the same side and the available space information of the current side, so that the arrangement of each label to be arranged satisfies a preset distribution condition, includes:
[0117] For the labels to be arranged that are associated with the first target direction, sort them according to the display coordinates of the target feature elements corresponding to each label in the first target direction to obtain a sorting result;
[0118] For each edge, the spacing between adjacent labels to be arranged on the current edge is calculated based on the available space information of the current edge, the total size of all labels to be arranged associated with the current edge, and the number of labels to be arranged associated with the current edge.
[0119] Based on the sorting result and the interval distance, determine the initial position coordinates of each label to be arranged on the current edge that satisfy the preset distribution conditions.
[0120] The first target direction refers to the coordinate axis direction associated with the label arrangement direction. Specifically, for the labels to be arranged that are associated with the top and bottom edges, they are arranged horizontally, so they need to be sorted according to the display coordinates of the target feature elements corresponding to each label in the horizontal direction (i.e., the X-axis direction); for the labels to be arranged that are associated with the left and right edges, they are arranged vertically, so they need to be sorted according to the display coordinates of the target feature elements corresponding to each label in the vertical direction (i.e., the Y-axis direction).
[0121] This embodiment takes into account that the arrangement order of the labels on the edge should be consistent with the position order of their corresponding feature elements in the view. The rationale for this principle is that when the user observes the feature elements from left to right (or from top to bottom) in the view, the corresponding labels are also arranged in the same order, which helps to establish an intuitive spatial correspondence and facilitates quick location by the user.
[0122] Taking the labels associated with the above as an example, suppose there are three labels corresponding to feature elements A, B, and C, with their horizontal display coordinates in the current view being X_A=100, X_B=200, and X_C=150, respectively. Sorting them in ascending order of their horizontal coordinates, the resulting order is A (X=100), C (X=150), and B (X=200). Therefore, in the above image, these three labels will be arranged from left to right in the order A, C, and B.
[0123] For tags associated with the elements below, the same sorting logic (from left to right) can be used; for tags associated with the left and right sides, they are arranged in order from top to bottom (or bottom to top) according to the vertical coordinates. In a preferred embodiment, to maintain visual consistency, a clockwise arrangement rule can be uniformly adopted: top from left to right, right from top to bottom, bottom from right to left, and left from bottom to top. Regardless of the specific rule used, the core is to establish a relationship between the position of feature elements and the order of tag arrangement.
[0124] After determining the label arrangement order, it is also necessary to determine the specific spacing between them to achieve a uniform distribution. Specifically, it is necessary to calculate the total size of all labels to be arranged that are associated with the current edge. For the top and bottom edges, the total size S is the sum of the widths of all labels; for the left and right edges, the total size S is the sum of the heights of all labels. That is: S = Σ(the size of label i in the arrangement direction);
[0125] Secondly, the available space information D of the current edge is known. For the top and bottom edges, D is the available horizontal length of the edge; for the left and right edges, D is the available vertical height of the edge. The available space information usually excludes the blank areas reserved at both ends of the edge. Thirdly, the number K of labels to be arranged associated with the current edge is known. Under uniform distribution conditions, the spacing G between adjacent labels can be calculated using the following formula: G = (D - S) / (K - 1) (when K > 1);
[0126] If K = 1, meaning there is only one label, then there is no need to calculate the spacing; the label can be placed directly in the middle of the edge or according to preset rules. This ensures that the labels are evenly spaced along the edge, making full use of the available space while avoiding labels being too crowded or too sparse.
[0127] It should be noted that the calculated spacing G needs to meet certain reasonable requirements. If G is too small (e.g., less than the preset minimum spacing threshold), the labels may be too crowded. In this case, the placement of the labels can be adjusted appropriately, such as using end-alignment instead of uniform distribution. If G is too large, it means that there is sufficient space on the front edge, and uniform distribution can achieve a good visual effect.
[0128] After obtaining the sorting order and spacing, the specific coordinates of each label can be determined. Taking the above as an example, assuming the sorted label sequence is Label_1, Label_2, ..., Label_K, with corresponding widths w_1, w_2, ..., w_K respectively, and the calculated spacing is G. Let the coordinate of the left starting point above be X_start (i.e., the leftmost position in the available space), then the X-coordinate of the top-left corner of each label can be calculated as follows:
[0129] The X coordinate of Label_1 is: X_1 = X_start;
[0130] The X coordinate of Label_2 is: X_2 = X_start + w_1 + G;
[0131] The X coordinate of Label_3: X_3 = X_start + w_1 + G + w_2 + G = X_start + w_1 + w_2 + 2G; ...;
[0132] The X coordinate of Label_K is: X_K = X_start + (w_1 + w_2 + ... + w_{K-1}) + (K-1)×G;
[0133] For the bottom, a similar calculation method can be used, but the arrangement direction may be from right to left; for the left and right, the Y coordinates need to be calculated instead of the X coordinates, the principle is the same, and will not be repeated here. After determining the X coordinates (for the top / bottom) or Y coordinates (for the left / right) of each label, it is also necessary to determine their coordinates perpendicular to the arrangement direction. Usually, the labels maintain a fixed offset distance from the edges in the vertical direction, that is, the labels are placed close to the edges or with appropriate margins. For example, for the top, the Y coordinate of the label can be set to the preset margin value offset downwards from the top position.
[0134] The above calculations yield the initial position coordinates of each label on the current edge. These coordinates satisfy two basic requirements: first, the labels are arranged in order according to the display coordinates of the feature elements; second, the labels are distributed with equal spacing. This initial position provides a good foundation for subsequent overlap detection and leader line intersection adjustment.
[0135] This embodiment uses the display coordinates of feature elements in the target direction as the sorting basis, establishing an intuitive correspondence between the position of feature elements and the order of label arrangement. The advantage of this correspondence is that when a user observes a feature element from left to right in the view, the corresponding labels are also arranged in the same order on the side, which helps establish spatial coherence and allows users to quickly associate labels with their corresponding feature elements. For example, when a user sees a feature point on the left side of the view, they will naturally look for the label corresponding to that feature point in the upper or lower left position. This cognitive habit is highly consistent with the sorting logic of this embodiment.
[0136] In some embodiments, the method further includes:
[0137] For the optional edge of the window view in the second target direction, the number of labels that the current edge can accommodate is calculated based on the size information of the label to be arranged with the largest size in the second target direction and the available space information of the current edge.
[0138] The maximum number of labels that the window view can display at one time is determined based on the minimum value among the number of labels that each of the optional edges can accommodate;
[0139] If the total number of labels to be arranged exceeds the upper limit of the number of labels, the window view is divided into multiple subviews, and the label arrangement method in the above embodiment is executed on the labels to be arranged in each subview.
[0140] In some optional embodiments, considering that in practical applications, when the number of measurement results to be displayed simultaneously is huge, even with the optimized layout method of the aforementioned embodiments, the window view may become too crowded due to the excessive number of labels, making it impossible to clearly display all labels. This embodiment fundamentally solves the information overload problem caused by exceeding the label limit by introducing a view segmentation preprocessing mechanism. First, it is necessary to calculate the maximum number of labels that each optional side can accommodate. Since different labels may have different sizes, it is quite complex to directly use the actual size of each label for accurate calculation. In order to simplify the calculation and reserve a certain tolerance space, this embodiment selects the label with the largest size in a specific direction as the standard to estimate the accommodating capacity of each side.
[0141] The second target direction refers to the dimensional measurement direction perpendicular to the label arrangement direction. Specifically: For the top and bottom edges of the window, the labels are arranged horizontally, and the key dimension affecting the capacity is the label height. Because regardless of the label width, if its height exceeds the reserved space on that edge, it cannot be placed there. Therefore, for the top and bottom edges, the label with the largest height among all the labels to be arranged needs to be selected as the standard label. Correspondingly, for the left and right edges of the window, the labels are arranged vertically, and the key dimension affecting the capacity is the label width. Therefore, for the left and right edges, the label with the largest width among all the labels to be arranged needs to be selected as the standard label.
[0142] Taking the calculation of the number of tags that can be accommodated as an example: Let the available space above be D_up (i.e., the available length in the horizontal direction), and the width of the maximum height tag be W_max (because the focus above is on horizontal arrangement, so width is used instead of height). Then the number of tags that can be accommodated above, N_up, can be estimated as: N_up = floor(D_up / W_max); where floor represents the floor function. The logic of this estimation is: in the worst case (i.e., all tags have the maximum width), the maximum number of tags that can be accommodated above is the available space divided by the maximum width. Using the maximum size as the standard ensures that the calculated capacity is a conservative estimate, that is, the actual number of tags that can be accommodated will not exceed this estimate, thus avoiding subsequent placement failures due to overly optimistic estimations.
[0143] The calculation method is similar for the bottom, left, and right sides: Bottom: N_down = floor(D_down / W_max), where D_down is the available space at the bottom and W_max is the maximum width; Left: N_left = floor(D_left / H_max), where D_left is the available space on the left and H_max is the maximum height; Right: N_right = floor(D_right / H_max), where D_right is the available space on the right and H_max is the maximum height.
[0144] It should be noted that this estimation method is a simplified approximation. In practical applications, more accurate algorithms can be considered, such as weighted averaging based on the distribution of label sizes. However, using the maximum size as the standard can meet the needs of engineering applications, and it is simple to calculate and provides sufficient safety margin.
[0145] In some alternative embodiments, after obtaining the number of labels that can be accommodated on the four sides, the maximum number of labels that a window view can display at a time can be the simple sum of the four numbers. Theoretically, if the labels can be ideally and evenly distributed on the four sides, then the total capacity limit can be the sum of the capacity of the four sides.
[0146] In some alternative embodiments, after obtaining the number of labels that the four sides can accommodate, it is also necessary to consider the balance in the actual allocation; in the actual allocation, due to the uneven distribution of the position of the feature elements, the number of labels actually allocated to each side may not reach its theoretical capacity limit.
[0147] To ensure that no side becomes overloaded due to improper allocation under any circumstances, this embodiment adopts a conservative estimation method: take the minimum number of labels that the four sides can accommodate, multiply it by 4 (i.e., the number of sides), and use this as the upper limit of the number of labels that the window view can display at one time. That is: upper limit = min(N_up, N_down, N_left, N_right) × 4;
[0148] Assuming a worst-case scenario where the load on all four edges is perfectly balanced, with each edge receiving the same number of labels, then the actual number of labels assigned to each edge cannot exceed its minimum capacity. Therefore, the total capacity limit is this minimum multiplied by 4. This conservative estimate ensures that even with a very balanced label distribution, the capacity of any single edge will not be exceeded.
[0149] In another alternative embodiment, the sum of the capacity of each side is used as the upper limit, and an overload protection mechanism needs to be added in the subsequent allocation process.
[0150] After determining the upper limit of the number of labels that a window view can display at a time, the total number of labels to be arranged is compared with this upper limit. If the total number does not exceed the upper limit, the label arrangement method described in the previous embodiment can be executed directly in the current window; if the total number exceeds the upper limit, the labels need to be divided into multiple subviews for display. There are various designs for the specific method of view segmentation. In an exemplary embodiment, segmentation can be performed according to the positional order of the feature elements corresponding to the labels in the view, for example, dividing the feature elements evenly into several groups, with each group generating a subview. This can be illustrated as follows: Figure 8 The preset view creation interface shown is used to accept information such as the number of subviews and their names.
[0151] In another exemplary embodiment, the measurement results can also be segmented according to the type or importance of the labels, displaying different types of measurement results in different subviews. It is understood that regardless of the segmentation method used, the number of labels in each subview should not exceed the aforementioned label count limit. Then, for each subview containing the labels to be arranged, the label arrangement method described in any of the preceding embodiments is executed independently to obtain multiple arranged subviews. Users can view the measurement results in different subviews by switching views or using pagination.
[0152] In an optional embodiment, the multiple sub-views can be displayed as tabs in the measurement software, allowing users to switch between different sub-views by clicking on different tabs. This approach solves the problem of information overload in a single view and provides users with a flexible viewing method.
[0153] This embodiment divides the excessive number of tags into multiple subviews for independent processing. This ensures the simplicity and readability of each individual view while providing a unified access point through tabs and other methods. This strategy of dividing the data into multiple subviews allows the method to be extended to any number of tags, exhibiting good scalability.
[0154] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.
[0155] Based on the same inventive concept, this application also provides a label arrangement device for implementing the label arrangement method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more of the label arrangement device embodiments provided below can be found in the limitations of the label arrangement method described above, and will not be repeated here.
[0156] In one exemplary embodiment, such as Figure 9As shown, a geometric evaluation label arrangement device 300 is provided, comprising:
[0157] The acquisition module 302 is used to acquire available space information of multiple optional edges of the window view of the measurement software, the distance between at least one target feature element in the window view and the optional edge, and the size information of the label to be arranged corresponding to the target feature element; the label to be arranged is used to display the geometric evaluation result corresponding to the target feature element.
[0158] The determining module 304 is used to determine the association weight between the label to be arranged corresponding to the target feature element and each of the optional edges based on the available space information, the distance, and the size information;
[0159] The association module 306 is used to associate the labels to be arranged corresponding to the at least one target feature element with the corresponding target edge according to the association weight;
[0160] The adjustment module 308 is used to adjust the layout of the associated labels on each of the optional edges according to the size information of the associated labels of the optional edges and the intersection of the leaders, so as to obtain the window view with the labels arranged; the leaders are used to associate the target feature elements with the labels to be arranged in the window view.
[0161] Each module in the aforementioned label arrangement device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.
[0162] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 10As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When executed by the processor, the computer program implements a tag arrangement method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0163] Those skilled in the art will understand that Figure 10 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0164] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps included in any of the foregoing method embodiments.
[0165] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps included in any of the foregoing method embodiments.
[0166] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps included in any of the foregoing method embodiments.
[0167] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0168] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0169] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0170] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for arranging geometric evaluation labels, characterized in that, The method includes: The available space information of multiple optional edges of the window view of the measurement software, the distance between at least one target feature element in the window view and the optional edge, and the size information of the label to be arranged corresponding to the target feature element are obtained; the label to be arranged is used to display the geometric evaluation result corresponding to the target feature element; Based on the available space information, the distance, and the size information, the association weight between the label to be arranged corresponding to the target feature element and each of the optional edges is determined; the process of determining the association weight includes: for each target feature element, based on the distance from the target feature element to each of the optional edges, determining the initial association weight between the label to be arranged corresponding to the target feature element and each of the optional edges; wherein, the initial association weight is negatively correlated with the distance; If the distance from the target feature element to the corner of the window view is less than a preset threshold, the initial association weights between the label to be arranged corresponding to the target feature element and the two adjacent sides of the corner are adjusted to a first weight multiplied by a first coefficient and a second weight multiplied by a second coefficient, respectively; wherein, the first coefficient is less than 1 and the second coefficient is greater than 1; Based on the initial association weight, the labels to be arranged corresponding to each target feature element are pre-associated to the corresponding optional edges, and the available space information of each optional edge is updated according to the pre-association result; Based on the updated available space information, the initial association weights of the labels to be arranged that have not yet been associated are adjusted, wherein the association weight of the optional edge to the labels to be arranged that have not yet been associated is positively correlated with the size of the available space of the optional edge; based on the association weights, the labels to be arranged corresponding to at least one of the target feature elements are associated with the corresponding target edges. For each of the optional edges, the layout of the associated labels on the optional edges is adjusted according to the size information of the associated labels of the optional edges and the intersection of the leaders, so as to obtain the window view with the labels arranged; the leaders are used to associate the target feature elements with the labels to be arranged in the window view.
2. The method according to claim 1, characterized in that, The step of pre-associating the labels to be arranged corresponding to each of the target feature elements to the corresponding optional edges according to the initial association weight includes: For each target feature element, the label to be arranged corresponding to the target feature element is pre-associated to the optional edge with the largest initial association weight; For each optional edge, the labels to be arranged are added to the current edge in descending order of their initial association weights. The available space information of the optional edge is updated after each addition.
3. The method according to claim 1, characterized in that, The step of adjusting the layout of the associated labels on each of the optional edges based on the size information of the associated labels and the intersection of the leader lines to obtain the window view with the labels arranged includes: For each of the optional edges, the initial position coordinates of each label to be arranged on the current edge are determined based on the size information of each label to be arranged associated with the same edge and the available space information of the current edge, so that the arrangement of each label to be arranged satisfies the preset distribution conditions. Based on the initial position coordinates, determine whether adjacent labels to be arranged overlap. If they overlap, adjust the coordinates of the overlapping labels to obtain the first position coordinates of each label to be arranged. Based on the first position coordinates, detect whether there is an intersection point between the lead lines of any two labels to be arranged on the same side; If there is an intersection, swap the arrangement order of the two labels to be arranged on the current edge, and update the position coordinates of each label to be arranged until the leads of any two labels to be arranged on the current edge have no intersection, and obtain the second position coordinates of each label to be arranged. Based on the second position coordinates, detect whether the actual occupied size of each of the optional edges exceeds the space range defined by the available space information of the current edge; If the actual occupied size of any of the optional edges exceeds the space range, move the labels to be arranged that exceed the current edge to the other optional edge with the smallest actual occupied size, and re-perform the lead line cross detection on the moved labels until the actual occupied size of all optional edges does not exceed the corresponding space range and the leads of any two labels to be arranged on the same edge have no intersection.
4. The method according to claim 3, characterized in that, The step of determining the initial position coordinates of each label to be arranged on the current side based on the size information of each label to be arranged associated with the same side and the available space information of the current side, so that the arrangement of each label to be arranged satisfies the preset distribution conditions, includes: For the labels to be arranged that are associated with the first target direction, sort them according to the display coordinates of the target feature elements corresponding to each label in the first target direction to obtain a sorting result; For each of the optional edges, the spacing between adjacent labels to be arranged on the current edge is calculated based on the available space information of the current edge, the total size of all labels to be arranged associated with the current edge, and the number of labels to be arranged associated with the current edge. Based on the sorting result and the interval distance, determine the initial position coordinates of each label to be arranged on the current edge that satisfy the preset distribution conditions.
5. The method according to any one of claims 1-4, characterized in that, The method further includes: For the optional edge of the window view in the second target direction, the number of labels that the current edge can accommodate is calculated based on the size information of the label to be arranged with the largest size in the second target direction and the available space information of the current edge. The maximum number of labels that the window view can display at one time is determined based on the minimum value among the number of labels that each of the optional edges can accommodate; If the total number of labels to be arranged exceeds the upper limit of the number of labels, the window view is divided into multiple subviews, and the label arrangement method according to any one of claims 1 to 4 is performed on the labels to be arranged in each subview.
6. A geometric evaluation label arrangement device, characterized in that, The device includes: The acquisition module is used to acquire available space information of multiple optional edges of the window view of the measurement software, the distance between at least one target feature element in the window view and the optional edge, and the size information of the label to be arranged corresponding to the target feature element; the label to be arranged is used to display the geometric evaluation result corresponding to the target feature element. The determining module is used to determine the association weight between the label to be arranged corresponding to the target feature element and each of the optional edges based on the available space information, the distance, and the size information; the process of determining the association weight includes: for each target feature element, determining the initial association weight between the label to be arranged corresponding to the target feature element and each of the optional edges based on the distance from the target feature element to each of the optional edges; wherein, the initial association weight is negatively correlated with the distance; If the distance from the target feature element to the corner of the window view is less than a preset threshold, the initial association weights between the label to be arranged corresponding to the target feature element and the two adjacent sides of the corner are adjusted to a first weight multiplied by a first coefficient and a second weight multiplied by a second coefficient, respectively; wherein, the first coefficient is less than 1 and the second coefficient is greater than 1; Based on the initial association weight, the labels to be arranged corresponding to each target feature element are pre-associated to the corresponding optional edges, and the available space information of each optional edge is updated according to the pre-association result; Based on the updated available space information, the initial association weights of the labels to be arranged that have not yet been associated are adjusted. The association weight of the optional edge for the labels to be arranged that have not yet been associated is positively correlated with the size of the available space of the optional edge. The association module is used to associate the labels to be arranged corresponding to the at least one target feature element with the corresponding target edge according to the association weight; The adjustment module is used to adjust the layout of the associated labels on each of the optional edges according to the size information of the associated labels of the optional edges and the intersection of the leaders, so as to obtain the window view with the labels arranged; the leaders are used to associate the target feature elements with the labels to be arranged in the window view.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.
9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.