Method and system for merging annotations with same and continuous annotations

By implementing the combined labeling method of the same and continuous control points in the CAD drawing labeling system, the problem of manual labeling is solved, and the drawing efficiency and labeling accuracy are improved.

CN119939683APending Publication Date: 2025-05-06CHINA RAILWAY CHONGQING SURVEYING DESIGN RES INST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510001479.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-02
Publication Date
2025-05-06

AI Technical Summary

Technical Problem

When converting reinforced concrete structures into CAD drawings, the number of control points for manual labeling of steel bars is huge, time-consuming and prone to errors, especially when a large number of labels have the same and continuous labels.

Method used

Provide a method of merging labeling with the same and continuous labeling. By reading the figures selected by the designer's box, filtering out the center of the circle as the control point, and determining whether the control point is a straight line. If so, merging labeling is performed, repetitive points are excluded, and horizontal angle labeling, vertical angle labeling or alignment labeling is performed according to the designer's choice.

Benefits of technology

The batch annotation of control points is realized, drawing efficiency is improved, and equal and continuous annotations are presented in the form of "number × length", reducing the time and error rate of manual annotation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119939683A_ABST
    Figure CN119939683A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of engineering drawing labeling, and particularly discloses a combined labeling method and system with identical and continuous labeling, and the method comprises the following steps: reading a graph selected by a designer, filtering out a circle in the graph, taking the circle center as a control point, and creating a Poi nt3d [] array; judging whether all the control points are a straight line or not, if the control points belong to the same straight line, judging the slope tan x of the straight line, and if the control points belong to the same straight line, judging the slope tan xlt; if 1, all the control points are ranked from small to large according to the x-axis coordinate values of the control points; if it is xlt; if 1, sorting all the control points from small to large according to the Y-axis coordinate values of the control points, marking according to the sequence, and eliminating repeated points; carrying out horizontal corner labeling, vertical corner labeling or alignment labeling according to the selection of a designer; and if the designer does not select how to label, corner labeling is carried out by default. By adopting the technical scheme, batch labeling of the control points is realized, the drawing efficiency is improved, and the accuracy of naked eye identification labeling is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of engineering drawing annotation, and relates to a method and system for merging annotations that are identical and continuous. Background Art

[0002] As a general-purpose drawing software, CAD is widely used in various fields. It has great advantages in the conversion of detailed drawings of industrial buildings, civil buildings and municipal bridge construction.

[0003] When converting reinforced concrete structures into CAD drawings, the number of control points for steel bar marking in the drawings is huge. Manual marking one by one is very time-consuming, and when there are a large number of identical and continuous markings (such as Figure 1 It is easy to make mistakes when counting the number of segments required (as shown). Summary of the invention

[0004] The object of the present invention is to provide a method and system for merging annotations when the annotations are identical and continuous, so as to realize merging annotations when the annotations are identical and continuous, and solve the problem that manual annotation is time-consuming and error-prone.

[0005] In order to achieve the above object, the basic scheme of the present invention is: a method for merging annotations with the same and continuous annotations, comprising the following steps:

[0006] S1, read the graphics selected by the designer through TypedValue[] and SelectionFilter, filter out the circles in the graphics, use the center of the circle as the control point, and create a Point3d[] array;

[0007] S2, judging whether all control points are a straight line to determine whether to mark;

[0008] If they do not belong to the same straight line, no marking is performed, and an abnormal prompt is given to indicate that the designer has selected the wrong point. If they belong to the same straight line, step S3 is performed;

[0009] S3, determine the slope tan x of the straight line. If |tan x|<1, sort all control points according to their x-axis coordinate values ​​from small to large.

[0010] If |cot x|<1, all control points are sorted from small to large according to their Y-axis coordinate values ​​and marked in this order;

[0011] S4, determining whether there are duplicate points in the control points, and if there are duplicate points, excluding the duplicate points;

[0012] S5, according to the designer's choice, horizontal corner marking, vertical corner marking or alignment marking is performed; if the designer does not choose how to mark, the corner marking is performed by default;

[0013] Determine the slope of the line where the control point is located. If the slope |tan x|≤1, mark the horizontal corner.

[0014] If the slope |cot x|<1, then mark the vertical corner;

[0015] S6, create a new annotation array a equal to the original annotation array, and then enter the returned original annotation array one by one. If it is empty, it will not be entered, and the sequence number -1 will achieve the effect of only entering non-empty annotations;

[0016] S7, record the number of times the variable records sequence number -1 "times3", create a new annotation array b with a length of "original annotation array length - times3", and enter the points of the new annotation array a into the new annotation array b one by one to achieve the effect of only entering non-duplicate points and deleting extra elements.

[0017] The working principle and beneficial effect of this basic solution are as follows: This technical solution conducts secondary development on the CAD in work, reads the graphics selected by the designer, filters out the circles in the graphics, uses the center of the circle as the control point, and determines whether all the control points are a straight line. If they are on the same straight line, the slope tan x of the straight line is determined for subsequent annotation. When duplicate points are found, the duplicate points are excluded to avoid judgment errors in subsequent annotation.

[0018] According to the designer's choice, annotations are made (horizontal corner annotations, vertical corner annotations, alignment annotations). If the designer does not choose a specific annotation, default annotations are made for different slopes. It is necessary to first determine the slope tan x of the line. In order to prevent the situation where x=90°, if |tan x|<1, all control points are counted according to whether the difference between their adjacent x-axis coordinates is equal; if |cot x|<1, all control points are counted according to whether the difference between their Y-axis coordinates is equal. If continuous and equal annotations appear, the merged annotations are presented in the form of "quantity × length". This solution can realize batch annotation of control points, and ensures that equal and continuous annotations are in the form of "quantity × length", which improves drawing efficiency and ensures the accuracy of naked eye identification of annotations.

[0019] Further, the method for determining whether all control points are a straight line in step S2 is:

[0020] Determine whether the slope exists, that is, whether it is a vertical line. If the difference between the horizontal coordinates of the control points is not equal to 0, the slope exists. Otherwise, the slope does not exist and all the points are on a vertical line.

[0021] When the slope exists, determine whether the slope tan x of the straight line formed by each control point is equal. If the slope is equal, each point is on the straight line with the slope tan x. Otherwise, there are points that are not on the straight line:

[0022]

[0023] Among them, point[i] and point[j] represent two different points, Y represents the vertical coordinate, and X represents the horizontal coordinate.

[0024] Simple operation and easy to use.

[0025] Further, in step S4, it is determined whether there are duplicate points in the control points. If there are duplicate points, the duplicate points are excluded. The specific steps are as follows:

[0026] The control points are arranged from small to large according to the x-axis coordinate or y-coordinate value. When the same points appear, they must be adjacent points;

[0027] If the horizontal and vertical coordinates of adjacent points are equal, they are considered as duplicate points, and no additional duplicate points are marked, and the coordinates of the duplicate points are prompted to the designer;

[0028] Create a new array a with the same length as the original array, and enter the points of the original array one by one. If duplicate points are encountered, only the first duplicate point is entered, and subsequent duplicate points are not entered. The sequence number -1 achieves the effect of only entering non-duplicate points.

[0029] Record the number of times the variable sequence number is minus 1, and create a new array b with a length of "original array length - times". Enter the points of the new array a into the new array b one by one to achieve the effect of only entering non-duplicate points and deleting extra elements.

[0030] When duplicate points are found, exclude them to avoid misjudgment in subsequent annotation.

[0031] Further, in step S5, the steps of marking the horizontal corner according to the designer's choice are:

[0032] When selecting horizontal corner annotation, determine whether it is a vertical line Point3d[i].X = Point3d[j].X, that is, when the horizontal coordinates of two points are equal, if it is a vertical line, an exception is output to prompt the designer that the annotation selection is wrong and cannot be marked;

[0033] Conversely, horizontal corner annotation is performed by creating an annotation array: find the point with the smallest y-axis coordinate in the new array b of control points as the annotation baseline, use the x-axis coordinate difference between the current control point and the next control point as the annotation length, and then set times2 as the number of times the adjacent annotation lengths are equal. When the current annotation is equal to the next annotation, times2 = times2 + 1;

[0034] When the previous segment is equal to the current segment, and the next segment is not equal to the current segment, calculate the length of each segment:

[0035] Length=(pt[it imes2].X-pt[i+1].X)*(pt[it imes2].X-pt[i+1].X);

[0036] Length = √Length;

[0037] Length=Length / (t imes2+1);

[0038] Length × mark = (times2 + 1) + "×" + Length;

[0039] Where time2 is the number of times the lengths of adjacent annotations are equal, pt[i] represents the i-th point after sorting, pt[i].X represents the horizontal coordinate of the i-th point after sorting, "×" represents the multiplication sign, and Length is the length of a single segment annotation;

[0040] If the current annotation is not equal to the previous annotation and the next annotation, the current line segment is directly annotated;

[0041] If the current annotation is the first segment, and it is not equal to the next segment, the current segment will be directly annotated;

[0042] If the current annotation is the last segment and is not equal to the previous segment, the current segment will be annotated directly;

[0043] If the current annotation is the last segment and is equal to the previous segment, calculate the length of each segment:

[0044] Length=(pt[it imes2].X-pt[i+1].X)*(pt[it imes2].X-pt[i+1].X);

[0045] Length = √Length;

[0046] Length=Length / (t imes2+1);

[0047] Length × mark = (times2 + 1) + "×" + Length;

[0048] Finally, store it in the annotation array and return it.

[0049] Horizontal corner marking is then carried out according to the designer's choice to facilitate operation.

[0050] Further, in step S5, the steps of marking the vertical corners according to the designer's selection are:

[0051] When selecting a vertical corner annotation, determine whether it is a horizontal straight line Point3d[i].Y = Point3d[j].Y. If it is a horizontal straight line, an exception is thrown to prompt the designer that the annotation selection is wrong and cannot be marked;

[0052] Conversely, create a label array to label the vertical corner: find the point with the smallest x-axis coordinate in the new array b of the control points as the labeling baseline, use the y-axis coordinate difference between the current point and the next point as the labeling length, set times2 as the number of times the adjacent label lengths are equal, and when the current label is equal to the next label, times2 = times2 + 1;

[0053] When the previous segment is equal to the current segment, and the next segment is not equal to the current segment, calculate the length of each segment:

[0054] Length=(pt[i-times2].Y-pt[i+1].Y)*(pt[i-times2].Y-pt[i+1].Y);

[0055] Length = √Length;

[0056] Length = Length / (times2 + 1);

[0057] Length × mark = (times2 + 1) + "×" + Length;

[0058] Where times2 is the number of times the lengths of adjacent annotations are equal, pt[i] represents the i-th point after sorting, pt[i].Y represents the ordinate of the i-th point after sorting, and Length is the length of a single segment annotation;

[0059] If the current annotation is not equal to the previous annotation and the next annotation, the current line segment is directly annotated;

[0060] If the current annotation is the first segment, and it is not equal to the next segment, the current segment will be directly annotated;

[0061] If the current annotation is the last segment and is not equal to the previous segment, the current segment will be annotated directly;

[0062] If the current annotation is the last segment and is equal to the previous segment, calculate the length of each segment:

[0063] Length=(pt[i-times2].Y-pt[i+1].Y)*(pt[i-times2].Y-pt[i+1].Y);

[0064] Length = √Length;

[0065] Length = Length / (times2 + 1);

[0066] Length × mark = (times2 + 1) + "×" + Length;

[0067] Finally, store it in the annotation array and return it.

[0068] Vertical corner marking can be done according to the designer's choice, which is flexible to use.

[0069] Further, in step S5, the steps of performing alignment marking according to the designer's selection are:

[0070] When selecting aligned annotation, determine whether it is a vertical line. If it is a vertical line Point3d[i].X = Point3d[j].X, the annotation method is the same as the vertical corner annotation, but the creation of the corner annotation is changed to the creation of the aligned annotation.

[0071] If it is not a vertical line, create a label array, take the x-axis coordinate difference between the current point and the next point as the label length, then set times2 as the number of times the adjacent label lengths are equal. When the current label is equal to the next label, times2 = times2 + 1.

[0072] When the previous segment is equal to the current segment, and the next segment is not equal to the current segment, calculate the length of each segment:

[0073] Length=(pt[i-times2].Y-pt[i+1].Y)*(pt[i-times2].Y-pt[i+1].Y)+(pt[i-times2].X-pt[i+1].X)*(pt[i-times2].X-pt[i+1].X);

[0074] Length = √Length;

[0075] Length=Length / (t imes2+1);

[0076] Length × mark = (times2 + 1) + "×" + Length;

[0077] Where time2 is the number of times the lengths of adjacent annotations are equal, pt[i] represents the i-th point after sorting, pt[i].X represents the horizontal coordinate of the i-th point after sorting, pt[i].Y represents the vertical coordinate of the i-th point after sorting, and Length is the length of a single segment annotation;

[0078] If the current annotation is not equal to the previous annotation and the next annotation, the current line segment is directly annotated;

[0079] If the current annotation is the first segment, and it is not equal to the next segment, the current segment will be directly annotated;

[0080] If the current annotation is the last segment and is not equal to the previous segment, the current segment will be annotated directly;

[0081] If the current annotation is the last segment and is equal to the previous segment, calculate the length of each segment:

[0082] Length=(pt[it imes2].Y-pt[i+1].Y)*(pt[it imes2].Y-pt[i+1].Y)+(pt[it imes2].X-pt[i+1].X)*(pt[it imes2].X-pt[i+1].X);

[0083] Length = √Length;

[0084] Length=Length / (t imes2+1);

[0085] Length × mark = (times2 + 1) + "×" + Length;

[0086] Finally, store it in the annotation array and return it.

[0087] Alignment and marking are then performed according to the designer's choice, and marking is performed as needed to ensure accuracy.

[0088] The present invention further provides a system for merging annotations with identical and continuous annotations, comprising a processing unit, wherein the processing unit executes the method of the present invention to merge annotations for situations where the annotations are identical and continuous.

[0089] This system uses processing units to achieve batch marking of control points and ensures equal and continuous marking in the form of "quantity × length", which improves drawing efficiency and ensures the accuracy of marking recognition by the naked eye. BRIEF DESCRIPTION OF THE DRAWINGS

[0090] Figure 1 It is a structural schematic diagram of how many segments are required when a large number of identical and continuous annotations are present in the prior art;

[0091] Figure 2 It is a schematic diagram of array entry for processing duplicate points of the method for merging annotations with identical and continuous annotations of the present invention;

[0092] Figure 3 It is a schematic diagram of deleting additional elements for processing duplicate points in the method for merging annotations with identical and continuous annotations of the present invention;

[0093] Figure 4 It is a schematic diagram of array entry in step S6 of the method for merging annotations with identical and continuous annotations of the present invention;

[0094] Figure 5 It is a schematic diagram of deleting elements in step S7 of the method for merging annotations with identical and continuous annotations of the present invention;

[0095] Figure 6 It is a flow chart of the method for merging identical and continuous annotations of the present invention. DETAILED DESCRIPTION

[0096] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.

[0097] In the description of the present invention, it is necessary to understand that the terms "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc., indicating the orientation or position relationship, are based on the orientation or position relationship shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.

[0098] In the description of the present invention, unless otherwise specified and limited, it should be noted that the terms "installed", "connected" and "connected" should be understood in a broad sense. For example, it can be a mechanical connection or an electrical connection, or it can be the internal connection between two components. It can be a direct connection or an indirect connection through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to the specific circumstances.

[0099] The present invention discloses a method for merging annotations with identical and continuous annotations, such as Figure 6 As shown, the following steps are included:

[0100] S1, reads the graphics selected by the designer through TypedValue[] and SelectionFilter, filters out the circles in the graphics, takes the center of the circle as the control point, and creates a Point3d[] array, which contains the x-axis coordinate value, y-axis coordinate value, z-axis coordinate value, and number of points of the control point in CAD;

[0101] S2, judging whether all control points are a straight line to determine whether to mark;

[0102] If they do not belong to the same straight line, no marking is performed, and an abnormal prompt is given to indicate that the designer has selected the wrong point. If they belong to the same straight line, step S3 is performed;

[0103] S3, determine the slope tan x of the straight line. If |tan x|<1, sort all control points according to their x-axis coordinate values ​​from small to large.

[0104] If |cot x|<1, all control points are sorted from small to large according to their Y-axis coordinate values ​​and marked in this order;

[0105] S4, determine whether there are duplicate points in the control points, and exclude the duplicate points if there are duplicate points; when duplicate points are found, exclude the duplicate points to avoid misjudgment in subsequent marking.

[0106] S5, according to the designer's choice, horizontal corner marking, vertical corner marking or alignment marking is performed; if the designer does not choose how to mark, the corner marking is performed by default for different slopes;

[0107] Determine the slope of the line where the control point is located. To prevent the situation where x = 90°, if the slope |tan x| ≤ 1, mark the horizontal corner.

[0108] If the slope |cot x|<1, a vertical corner annotation is performed; if continuous and equal annotations appear, the merged annotations are presented in the form of "quantity × length".

[0109] S6, create a new annotation array a equal to the original annotation array, and then enter the returned original annotation array one by one. If it is empty, it will not be entered, and the sequence number -1 achieves the effect of only entering non-empty annotations, such as Figure 4 As shown;

[0110] S7, record the number of times the variable records sequence number -1 "times3", create a new annotation array b with a length of "original annotation array length - times3", and enter the points of the new annotation array a into the new annotation array b one by one (such as Figure 5 As shown in the figure), the effect of only entering non-duplicate points and deleting extra elements is achieved.

[0111] In a preferred embodiment of the present invention, the method for determining whether all control points are a straight line in step S2 is:

[0112] Determine whether the slope exists, that is, whether it is a vertical line. If the difference between the horizontal coordinates of the control points is not equal to 0, the slope exists. Otherwise, the slope does not exist and all the points are on a vertical line.

[0113] When the slope exists, determine whether the slope tan x of the straight line formed by each control point is equal. If the slope is equal, each point is on the straight line with the slope tan x. Otherwise, there are points that are not on the straight line:

[0114]

[0115] Among them, point[i] and point[j] represent two different points, Y represents the vertical coordinate, and X represents the horizontal coordinate.

[0116] In a preferred solution of the present invention, in step S4, it is determined whether there are duplicate points in the control points, and if there are duplicate points, the duplicate points are excluded. The specific steps are as follows:

[0117] The control points are arranged from small to large according to the x-axis coordinate or y-coordinate value. When the same points appear, they must be adjacent points;

[0118] If the horizontal and vertical coordinates of adjacent points are equal, they are considered as duplicate points, and no additional duplicate points are marked, and the coordinates of the duplicate points are prompted to the designer;

[0119] Create a new array a with the same length as the original array, and enter the points of the original array one by one. If duplicate points are encountered, only the first duplicate point is entered, and subsequent duplicate points are not entered. The sequence number -1 achieves the effect of only entering non-duplicate points, such as Figure 2 As shown;

[0120] Record the number of times the variable sequence number minus 1, create a new array b with a length of "original array length minus times", and enter the points of the new array a into the new array b one by one, so as to achieve the effect of only entering non-duplicate points and deleting extra elements, such as Figure 3 shown.

[0121] In a preferred embodiment of the present invention, in step S5, the step of marking the horizontal corner according to the designer's choice is as follows:

[0122] When selecting horizontal corner annotation, determine whether it is a vertical line Point3d[i].X = Point3d[j].X, that is, when the horizontal coordinates of two points are equal, if it is a vertical line, an exception is output to prompt the designer that the annotation selection is wrong and cannot be marked;

[0123] Conversely, horizontal corner annotation is performed by creating an annotation array: find the point with the smallest y-axis coordinate in the new array b of control points as the annotation baseline, take the x-axis coordinate difference between the current control point and the next control point as the annotation length, and then set a time2 as the number of times the adjacent annotation lengths are equal. When the current annotation is equal to the next annotation, time2=times2+1;

[0124] When the previous segment is equal to the current segment, and the next segment is not equal to the current segment, calculate the length of each segment:

[0125] Length=(pt[it imes2].X-pt[i+1].X)*(pt[it imes2].X-pt[i+1].X);

[0126] Length = √Length;

[0127] Length=Length / (t imes2+1);

[0128] Length × mark = (times2 + 1) + "×" + Length;

[0129] Where time2 is the number of times the lengths of adjacent annotations are equal, pt[i] represents the i-th point after sorting, pt[i].X represents the horizontal coordinate of the i-th point after sorting, "×" represents the multiplication sign, and Length is the length of a single segment annotation;

[0130] If the current annotation is not equal to the previous annotation and the next annotation, the current line segment is directly annotated;

[0131] If the current annotation is the first segment, and it is not equal to the next segment, the current segment will be directly annotated;

[0132] If the current annotation is the last segment and is not equal to the previous segment, the current segment will be annotated directly;

[0133] If the current annotation is the last segment and is equal to the previous segment, calculate the length of each segment:

[0134] Length=(pt[i-times2].X-pt[i+1].X)*(pt[i-times2].X-pt[i+1].X);

[0135] Length = √Length;

[0136] Length = Length / (times2 + 1);

[0137] Length × mark = (times2 + 1) + "×" + Length;

[0138] Finally, store it in the annotation array and return it.

[0139] In a preferred embodiment of the present invention, in step S5, the step of marking the vertical corner according to the designer's choice is as follows:

[0140] When selecting a vertical corner annotation, determine whether it is a horizontal straight line Point3d[i].Y = Point3d[j].Y. If it is a horizontal straight line, an exception is thrown to prompt the designer that the annotation selection is wrong and cannot be marked;

[0141] Conversely, create a label array to label the vertical corner: find the point with the smallest x-axis coordinate in the new array b of the control points as the labeling baseline, use the y-axis coordinate difference between the current point and the next point as the labeling length, set times2 as the number of times the adjacent label lengths are equal, and when the current label is equal to the next label, times2 = times2 + 1;

[0142] When the previous segment is equal to the current segment, and the next segment is not equal to the current segment, calculate the length of each segment:

[0143] Length=(pt[i-times2].Y-pt[i+1].Y)*(pt[i-times2].Y-pt[i+1].Y);

[0144] Length = √Length;

[0145] Length = Length / (times2 + 1);

[0146] Length × mark = (times2 + 1) + "×" + Length;

[0147] Where times2 is the number of times the lengths of adjacent annotations are equal, pt[i] represents the i-th point after sorting, pt[i].Y represents the ordinate of the i-th point after sorting, and Length is the length of a single segment annotation;

[0148] If the current annotation is not equal to the previous annotation and the next annotation, the current line segment is directly annotated;

[0149] If the current annotation is the first segment, and it is not equal to the next segment, the current segment will be directly annotated;

[0150] If the current annotation is the last segment and is not equal to the previous segment, the current segment will be annotated directly;

[0151] If the current annotation is the last segment and is equal to the previous segment, calculate the length of each segment:

[0152] Length=(pt[i-times2].Y-pt[i+1].Y)*(pt[i-times2].Y-pt[i+1].Y);

[0153] Length = √Length;

[0154] Length = Length / (times2 + 1);

[0155] Length × mark = (times2 + 1) + "×" + Length;

[0156] Finally, store it in the annotation array and return it.

[0157] In a preferred embodiment of the present invention, in step S5, the step of further performing alignment marking according to the designer's selection is:

[0158] When selecting aligned annotation, determine whether it is a vertical line. If it is a vertical line, Point3d[i].X = Point3d[j].X. The annotation method is the same as the vertical corner annotation, but the creation of the corner annotation is changed to the creation of the aligned annotation.

[0159] If it is not a vertical line, create a label array, take the x-axis coordinate difference between the current point and the next point as the label length, and then set a time2 as the number of times the adjacent label lengths are equal. When the current label is equal to the next label, times2 = time2 + 1;

[0160] When the previous segment is equal to the current segment, and the next segment is not equal to the current segment, calculate the length of each segment:

[0161] Length=(pt[it imes2].Y-pt[i+1].Y)*(pt[it imes2].Y-pt[i+1].Y)+(pt[it imes2].X-pt[i+1].X)*(pt[it imes2].X-pt[i+1].X);

[0162] Length = √Length;

[0163] Length=Length / (t imes2+1);

[0164] Length × mark = (times2 + 1) + "×" + Length;

[0165] Where time2 is the number of times the lengths of adjacent annotations are equal, pt[i] represents the i-th point after sorting, pt[i].X represents the horizontal coordinate of the i-th point after sorting, pt[i].Y represents the vertical coordinate of the i-th point after sorting, and Length is the length of a single segment annotation;

[0166] If the current annotation is not equal to the previous annotation and the next annotation, the current line segment is directly annotated;

[0167] If the current annotation is the first segment, and it is not equal to the next segment, the current segment will be directly annotated;

[0168] If the current annotation is the last segment and is not equal to the previous segment, the current segment will be annotated directly;

[0169] If the current annotation is the last segment and is equal to the previous segment, calculate the length of each segment:

[0170] Length=(pt[it imes2].Y-pt[i+1].Y)*(pt[it imes2].Y-pt[i+1].Y)+(pt[it imes2].X-pt[i+1].X)*(pt[it imes2].X-pt[i+1].X);

[0171] Length = √Length;

[0172] Length=Length / (t imes2+1);

[0173] Length × mark = (times2 + 1) + "×" + Length;

[0174] Finally, store it in the annotation array and return it.

[0175] The present invention also provides a system for merging annotations with identical and continuous annotations, comprising a processing unit, wherein the processing unit executes the method of the present invention to merge annotations for situations where the annotations are identical and continuous.

[0176] There are a large number of control points in rail transit CAD drawings, and manual labeling is very time-consuming, and manual segmentation is prone to errors. The present invention can realize batch labeling of control points and ensure equal and continuous labeling in the form of "quantity × length", which improves drawing efficiency and ensures the accuracy of naked eye recognition of labeling.

[0177] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0178] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.

Claims

1. A method for merging annotations with identical and continuous annotations, characterized in that: The steps include: S1, read the graphics selected by the designer through TypedValue[] and SelectionFilter, filter out the circles in the graphics, use the center of the circle as the control point, and create a Point3d[] array; S2, judging whether all control points are a straight line to determine whether to mark; If they do not belong to the same straight line, no marking is performed, and an abnormal prompt is given to indicate that the designer has selected the wrong point. If they belong to the same straight line, step S3 is performed; S3, determine the slope tan x of the straight line. If |tan x|<1, sort all control points according to their x-axis coordinate values ​​from small to large. If |cot x|<1, all control points are sorted from small to large according to their Y-axis coordinate values ​​and marked in this order; S4, determining whether there are duplicate points in the control points, and if there are duplicate points, excluding the duplicate points; S5, according to the designer's choice, horizontal corner marking, vertical corner marking or alignment marking is performed; if the designer does not choose how to mark, the corner marking is performed by default; Determine the slope of the line where the control point is located. If the slope |tan x|≤1, mark the horizontal corner. If the slope |cot x|<1, then mark the vertical corner; S6, create a new annotation array a equal to the original annotation array, and then enter the returned original annotation array one by one. If it is empty, it will not be entered, and the sequence number -1 will achieve the effect of only entering non-empty annotations; S7, record the number of times the variable records sequence number -1 "times3", create a new annotation array b with a length of "original annotation array length - times3", and enter the points of the new annotation array a into the new annotation array b one by one to achieve the effect of only entering non-duplicate points and deleting extra elements.

2. The method for merging identical and continuous annotations according to claim 1, characterized in that: The method for determining whether all control points are a straight line in step S2 is: Determine whether the slope exists, that is, whether it is a vertical line. If the difference between the horizontal coordinates of the control points is not equal to 0, the slope exists. Otherwise, the slope does not exist and all the points are on a vertical line. When the slope exists, determine whether the slope tan x of the straight line formed by each control point is equal. If the slope is equal, each point is on the straight line with the slope tan x. Otherwise, there are points that are not on the straight line: Among them, point[i] and point[j] represent two different points, Y represents the vertical coordinate, and X represents the horizontal coordinate.

3. The method for merging identical and continuous annotations according to claim 1, characterized in that: In step S4, it is determined whether there are duplicate points in the control points. If there are duplicate points, the duplicate points are excluded. The specific steps are as follows: The control points are arranged from small to large according to the x-axis coordinate or y-coordinate value. When the same points appear, they must be adjacent points; If the horizontal and vertical coordinates of adjacent points are equal, they are considered as duplicate points, and no additional duplicate points are marked, and the coordinates of the duplicate points are prompted to the designer; Create a new array a with the same length as the original array, and enter the points of the original array one by one. If duplicate points are encountered, only the first duplicate point is entered, and subsequent duplicate points are not entered. The sequence number -1 achieves the effect of only entering non-duplicate points. Record the number of times the variable sequence number is minus 1, create a new array b with a length of "original array length - times", and enter the points of the new array a into the new array b one by one, so as to achieve the effect of only entering non-duplicate points and deleting extra elements.

4. The method for merging identical and continuous annotations according to claim 1, characterized in that: In step S5, the steps of marking the horizontal corner according to the designer's choice are as follows: When selecting horizontal corner annotation, determine whether it is a vertical line Point3d[i].X = Point3d[j].X, that is, when the horizontal coordinates of two points are equal, if it is a vertical line, an exception is output to prompt the designer that the annotation selection is wrong and cannot be marked; Conversely, horizontal corner annotation is performed by creating an annotation array: find the point with the smallest y-axis coordinate in the new array b of control points as the annotation baseline, use the x-axis coordinate difference between the current control point and the next control point as the annotation length, and then set times2 as the number of times the adjacent annotation lengths are equal. When the current annotation is equal to the next annotation, times2 = times2 + 1; When the previous segment is equal to the current segment, and the next segment is not equal to the current segment, calculate the length of each segment: Length=(pt[i-times2].X-pt[i+1].X)*(pt[i-times2].X-pt[i+1].X); Length = √Length; Length = Length / (times2 + 1); Length × mark = (times2 + 1) + "×" + Length; Where times2 is the number of times the lengths of adjacent annotations are equal, pt[i] represents the i-th point after sorting, pt[i].X represents the horizontal coordinate of the i-th point after sorting, "×" represents the multiplication sign, and Length is the length of a single segment annotation; If the current annotation is not equal to the previous annotation and the next annotation, the current line segment is directly annotated; If the current annotation is the first segment, and it is not equal to the next segment, the current segment will be directly annotated; If the current annotation is the last segment and is not equal to the previous segment, the current segment will be annotated directly; If the current annotation is the last segment and is equal to the previous segment, calculate the length of each segment: Length=(pt[i-times2].X-pt[i+1].X)*(pt[i-times2].X-pt[i+1].X); Length = √Length; Length = Length / (times2 + 1); Length × mark = (times2 + 1) + "×" + Length; Finally, store it in the annotation array and return it.

5. The method for merging identical and continuous annotations according to claim 1, characterized in that: In step S5, the steps of marking the vertical corner according to the designer's choice are: When selecting a vertical corner annotation, determine whether it is a horizontal straight line Point3d[i].Y = Point3d[j].Y. If it is a horizontal straight line, an exception is thrown to prompt the designer that the annotation selection is wrong and cannot be marked; Conversely, create a label array to label the vertical corner: find the point with the smallest x-axis coordinate in the new array b of the control points as the labeling baseline, use the y-axis coordinate difference between the current point and the next point as the labeling length, set times2 as the number of times the adjacent label lengths are equal, and when the current label is equal to the next label, times2 = times2 + 1; When the previous segment is equal to the current segment, and the next segment is not equal to the current segment, calculate the length of each segment: Length=(pt[i-times2].Y-pt[i+1].Y)*(pt[i-times2].Y-pt[i+1].Y); Length = √Length; Length = Length / (times2 + 1); Length × mark = (times2 + 1) + "×" + Length; Where times2 is the number of times the lengths of adjacent annotations are equal, pt[i] represents the i-th point after sorting, pt[i].Y represents the ordinate of the i-th point after sorting, and Length is the length of a single segment annotation; If the current annotation is not equal to the previous annotation and the next annotation, the current line segment is directly annotated; If the current annotation is the first segment, and it is not equal to the next segment, the current segment will be directly annotated; If the current annotation is the last segment and is not equal to the previous segment, the current segment will be annotated directly; If the current annotation is the last segment and is equal to the previous segment, calculate the length of each segment: Length=(pt[i-times2].Y-pt[i+1].Y)*(pt[i-times2].Y-pt[i+1].Y); Length = √Length; Length = Length / (times2 + 1); Length × mark = (times2 + 1) + "×" + Length; Finally, store it in the annotation array and return it.

6. The method for merging identical and continuous annotations according to claim 1, characterized in that: In step S5, the steps of performing alignment marking according to the designer's selection are: When selecting aligned annotation, determine whether it is a vertical line. If it is a vertical line, Point3d[i].X = Point3d[j].X. The annotation method is the same as the vertical corner annotation, but the creation of the corner annotation is changed to the creation of the aligned annotation. If it is not a vertical line, create a label array, take the x-axis coordinate difference between the current point and the next point as the label length, then set times2 as the number of times the adjacent label lengths are equal. When the current label is equal to the next label, times2 = times2 + 1. When the previous segment is equal to the current segment, and the next segment is not equal to the current segment, calculate the length of each segment: Length=(pt[i-times2].Y-pt[i+1].Y)*(pt[i-times2].Y-pt[i+1].Y)+(pt[i-times2].X-pt[i+1].X)*(pt[i-times2].X-pt[i+1].X); Length = √Length; Length = Length / (times2 + 1); Length × mark = (times2 + 1) + "×" + Length; Where times2 is the number of times the lengths of adjacent annotations are equal, pt[i] represents the i-th point after sorting, pt[i].X represents the horizontal coordinate of the i-th point after sorting, pt[i].Y represents the vertical coordinate of the i-th point after sorting, and Length is the length of a single segment annotation; If the current annotation is not equal to the previous annotation and the next annotation, the current line segment is directly annotated; If the current annotation is the first segment, and it is not equal to the next segment, the current segment will be directly annotated; If the current annotation is the last segment and is not equal to the previous segment, the current segment will be annotated directly; If the current annotation is the last segment and is equal to the previous segment, calculate the length of each segment: Length=(pt[i-times2].Y-pt[i+1].Y)*(pt[i-times2].Y-pt[i+1].Y)+(pt[i-times2].X-pt[i+1].X)*(pt[i-times2].X-pt[i+1].X); Length = √Length; Length = Length / (times2 + 1); Length × mark = (times2 + 1) + "×" + Length; Finally, store it in the annotation array and return it.

7. A system for merging annotations with identical and continuous annotations, characterized in that: The method comprises a processing unit, wherein the processing unit executes the method according to any one of claims 1 to 6, and merges the annotations in the case where the annotations are identical and continuous.