Processing method for text annotations in power transmission line plane cross-section diagram software graphical interface
By using local feature processing and coordinate system transformation technology in the transmission line flat section diagram software, the problems of inconvenience in text annotation processing and view display deviation in the existing technology are solved, and a more comprehensive text annotation processing and graphical interface are realized accuracy and flexibility.
Patent Information
- Application Number
- CN202411224473.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-03
- Publication Date
- 2025-01-03
AI Technical Summary
The existing engineering application-type graphical interface drawing software has problems such as inconvenience in handling text annotations, inconspicuous editing process, and deviation in view display due to string rotation, especially in the flat section processing system of AutoCAD and SLCAD overhead power transmission lines. , the string stretching and header orientation settings of text annotations are insufficient, resulting in large view display deviations in the display position and stretch distance.
Provide a method for processing Chinese character annotation in the graphical interface of the transmission line flat section diagram software, including error processing during coordinate system transformation, string stretching and rotation processing, character aspect ratio processing, and element association processing, through local features Processing and coordinate system transformation technology ensures the accuracy and flexibility of text annotation. Specific methods include calculating the drawing coordinate value of each character, translating and rotating the character center, distributing the stretch length evenly, correcting the character width error, setting a local scale and establishing an element association relationship.
It realizes more comprehensive text annotation processing, meets all processing requirements of engineering application software, reduces the amount of calculation, improves the flexibility and accuracy of text annotation, avoids errors in other parts, and ensures text annotation in Correct display and editing in the graphical interface.
Abstract
Description
Technical Field
[0001] The invention relates to the field of data visualization, in particular to a method for processing text annotations in a graphical interface of power transmission line plan and section diagram software. Background Art
[0002] When annotating text in the graphical interface of the power transmission line section drawing software, the text annotations need to be processed accordingly to correctly and accurately display the text content and style. The relevant content includes the text annotation string stretching, string rotation, letter head following angle, letter head facing north, as well as the text annotation font size, font type, font, color, and aspect ratio of the text annotation.
[0003] At present, many engineering application graphical interface drawing software such as "AutoCAD", "SLCAD Overhead Transmission Line Section Processing System" and other software have the following deficiencies in the processing of text: only a part of the text annotation function is set, the set functions are not easy to use, and the process of editing text annotations is not intuitive.
[0004] (1) In AutoCAD, it is not possible to stretch the text string of a text annotation. Although the entire string can be rotated, the direction of the head of a single character in the string cannot be set. The string can only be rotated as a whole so that the head of the character follows the rotation angle of the string.
[0005] (2) In the SLCAD overhead transmission line cross-section processing system, changing the view when the text annotation is rotated will cause the text annotation coordinate system to be confused, and the display position, stretching distance, etc. will produce large view display deviations. Summary of the invention
[0006] The object of the present invention is to provide a method for processing text annotations in the graphical interface of power transmission line plan and section diagram software to improve the comprehensiveness and accuracy of text annotation processing in the graphical interface in order to address all or part of the above-mentioned problems.
[0007] The technical solution adopted by the present invention is as follows:
[0008] A method for processing text annotations in a graphical interface of a power transmission line plan and section diagram software, wherein the text annotations are composed of a string of at least one character; the method comprises at least one of the following processing methods:
[0009] Methods for processing accumulated errors during coordinate system transformation, character string stretching, character string rotation, coordinate value calculation errors, character aspect ratios, and primitive associations;
[0010] The method for processing character string rotation includes:
[0011] Calculate the drawing coordinate value of each character in the graphical interface and the center coordinate value of each character respectively;
[0012] When the direction of the initials of the text annotation needs to follow the angle, when the coordinate system is transformed, the origin of the graphical interface coordinate system is translated to the center of each character, and the local coordinate system is rotated around the center of each character. After the character is output, the original coordinate system is restored; all the output characters are combined into a character string.
[0013] Furthermore, the method for processing character string rotation further includes:
[0014] When the entire string needs to be rotated, during the coordinate transformation, the origin of the graphical interface coordinate system is translated to the center of a character, and the local coordinate system is rotated around the center of the character, and then restored to the original coordinate system after the string is output.
[0015] Furthermore, the method for processing accumulated errors during coordinate system transformation uses local variables to transform the image interface coordinate system when transforming the image interface coordinate system between the calculation coordinate system transformation and the engineering coordinate system, so as to clear the accumulated errors of the graphic interface coordinate system caused by the transformation after a single transformation is completed.
[0016] Furthermore, the method for processing the accumulated error during the coordinate system transformation includes:
[0017] The output positions of text annotations all use the unified coordinate values of the graphical interface;
[0018] Before the text annotation is output, the local variable is used as a temporary variable for coordinate system transformation to perform a reverse transformation of the Y axis of the graphical interface coordinate system, and then the text annotation is output;
[0019] After the text annotation is output, reverse the Y axis of the graphical interface coordinate system again.
[0020] Furthermore, the character string stretching processing method includes:
[0021] When the text annotation is stretched, the stretched length of the text annotation is read, the stretched length is evenly distributed to the intervals between the characters of the text annotation, and all the characters are output uniformly.
[0022] Furthermore, the stretching length is evenly distributed to the intervals between the characters of the text annotation, and all the characters are uniformly output, including:
[0023] Separate the individual characters in the string one by one and store them temporarily;
[0024] Calculate the value of the width of a single character, calculate the width of each character added due to stretching according to the stretching length, and calculate the value of each character from the starting point;
[0025] According to the starting position of the string, the unified drawing coordinate value of each character in the string in the graphical interface is calculated.
[0026] Furthermore, the method for processing the coordinate value calculation error includes:
[0027] When separating a string, measure the width of each separated character one by one;
[0028] When the total measured width of all characters is inconsistent with the total length of the string, the measured width of each character is corrected according to the total length of the string.
[0029] Furthermore, the method for processing the character aspect ratio includes:
[0030] The coordinate system of the graphical interface is translated to the text annotation output position, and the ratio of the X axis to the Y axis is set according to the required aspect ratio to obtain the local scale, and the text annotation is output under the local scale;
[0031] After the text annotation is output, the proportional relationship between the X-axis and Y-axis of the original graphics interface coordinate system is restored.
[0032] Furthermore, the primitive association processing method includes:
[0033] When a composite graphic element in a graphical interface contains text annotations, the text annotations are treated as a graphic element and associated with the composite graphic element in a master-slave relationship. The slave graphic element changes along with the state of the master graphic element, and the state change of the slave graphic element does not affect the master graphic element.
[0034] Furthermore, the primitive association processing method further includes:
[0035] The text annotation is bidirectionally associated with the combined graphic element, and the corresponding ground feature attributes in the combined graphic element are synchronously changed by editing the string content of the text annotation.
[0036] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are:
[0037] 1. The present invention provides a more comprehensive method for processing text annotations in graphical interface software, covering all common functions related to text annotations in graphical interfaces, and is sufficient to meet all processing requirements related to text annotations in engineering application graphical interface software.
[0038] 2. All processing methods in the present invention are based on local features, and will not cause errors in other parts when the processing operation amount is small.
[0039] 3. The present invention establishes an association relationship with combined graphic elements, so that text annotation can be more flexibly implemented in graphical interface software. DETAILED DESCRIPTION
[0040] All features disclosed in this specification, or steps in all methods or processes disclosed, except mutually exclusive features and / or steps, can be combined in any manner.
[0041] Any feature disclosed in this specification (including any additional claims and abstract), unless otherwise stated, may be replaced by other equivalent or alternative features having similar purposes. That is, unless otherwise stated, each feature is only an example of a series of equivalent or similar features.
[0042] Example 1
[0043] A method for processing text annotations in a graphical interface of a power transmission line cross-section diagram software is used to process text annotations, wherein the text annotations are composed of at least one character string, so the processing object is essentially a string or a character. The method for processing text annotations in a graphical interface of a power transmission line cross-section diagram software includes at least one of the following processing methods:
[0044] 1) Methods for dealing with accumulated errors during coordinate system transformation;
[0045] 2) Methods for handling string stretching;
[0046] 3) Method for processing string rotation;
[0047] 4) Methods for processing coordinate value calculation errors;
[0048] 5) Method for processing character aspect ratio;
[0049] 6) Element association processing method.
[0050] 1. Method for handling accumulated errors when transforming the coordinate system of text annotations in graphical interface software.
[0051] (1) Since the default calculation coordinate system of the graphical interface coordinate system in the graphical interface software is a left-handed coordinate system, with the Y axis pointing downward and the coordinate origin at the upper left corner of the graphical interface, but the commonly used engineering coordinate system is a right-handed coordinate system, with the Y axis pointing upward and the coordinate origin at the lower left corner of the graphical interface, when the calculation coordinate system is transformed into the engineering right-handed coordinate system in the graphical interface software, the text annotation will appear upside down. Therefore, it is necessary to restore the graphical interface coordinate system to the calculation coordinate system before outputting the text annotation, and then change it to the engineering coordinate system after the text annotation is output.
[0052] (2) However, when the number of text annotations is large and the number of left-handed coordinate system transformations is too large, such as when the left-handed coordinate system transformation is performed more than a million times during the software operation, the accuracy of the matrix data type during the transformation is limited, that is, the number of valid data bits. This will cause the accumulated extremely small error values in the coordinate system transformation of the graphical interface software to continue to amplify, resulting in systematic deviations in the coordinate system of the graphical interface.
[0053] (3) In order to solve this problem, this embodiment uses local variables to transform the graphic interface coordinate system when transforming the image interface coordinate system between the calculation coordinate system and the engineering coordinate system. Even if the coordinate system deviation accumulated by the graphic interface coordinate system transformation of large amounts of data is cleared after a single transformation, the display and storage position accuracy of large amounts of text annotations is guaranteed.
[0054] In some embodiments, the specific processing method of using local variables to transform the coordinate system of the image interface includes:
[0055] 1) To ensure the correct output position of the text annotation, the output position of the string uses the unified coordinate value of the graphical interface.
[0056] 2) Before the character string needs to be output, the local variable is used as a temporary variable for coordinate system transformation to perform a reverse transformation of the Y axis of the graphical interface coordinate system, and then the text annotation is output.
[0057] 3) After the text annotation is output, the Y axis of the coordinate system of the graphical interface is reversed again. This ensures the consistency of the coordinate system of the text annotation with the coordinate system of other graphics elements in the graphical interface, and eliminates the accumulated errors caused by frequent coordinate system transformations.
[0058] 2. How to handle string stretching.
[0059] (1) When saving a text annotation with stretch attributes in the graphical interface, there are:
[0060] 1) First, take the first click position of the mouse in the graphical interface as the starting point of the output text annotation position, and the second click position as the end point of the output text annotation position.
[0061] 2) The total length of the output text annotation is calculated based on the difference between the two mouse click positions. Whether the total length of the output text annotation is greater than the original length of the string itself is used to determine whether the text annotation has been stretched and the value of the stretched length. It should be noted that since compressing the string will affect the display of the drawing, that is, characters may overlap, the length of the string is not allowed to be compressed. Therefore, if the length between the two mouse click positions is equal to or less than the length of the string itself, it is considered that the string has not been stretched.
[0062] (2) When reading and displaying a stretched character string in a graphical interface, first read the stretched length of the character string, then calculate the length of the interval between each character based on the original length and the required stretched length, evenly distribute the stretched length to the intervals between each character of the text annotation, and then output all the characters uniformly.
[0063] In some embodiments, the stretching process specifically includes:
[0064] 1) First, get the stretched length of the string, that is, the value greater than the original length of the string.
[0065] 2) Then separate the individual characters in the string one by one and store them temporarily.
[0066] 3) Obtain and record the value of the width of each character one by one, as well as the width of each character added due to stretching (when the stretching length is 0, this value is equal to the character width), and calculate and record the value of each character's distance from the starting point.
[0067] 4) Finally, according to the starting position of the string, the unified drawing coordinate value of each character in the string in the graphical interface is calculated.
[0068] 3. How to process string rotation.
[0069] (1) In order to realize the rotation of characters in text annotations and ensure that the position of the characters remains basically unchanged after rotation, it is necessary to first calculate the drawing coordinate value of a single character in the graphical interface, and calculate the center coordinate value of each character based on the height and width of the character, so that the character can be rotated around the center.
[0070] (2) When the text annotation requires the character head to face north, when the coordinate system is transformed, the character orientation is not changed, only the translation amount of the character's drawing coordinate value is changed, so that the drawing position of the character string changes.
[0071] (3) When the text annotation requires the direction of the letterhead to follow the angle, when the coordinate system is transformed, the origin of the graphical interface coordinate system is translated to the center of each character, and the local coordinate system is rotated around the center of each character. After the character is output, the original coordinate system is restored. This process is repeated for each character of the text annotation, and all the output characters are combined into a string. That is, each character in the string is rotated and output separately and then combined into a string, so that each character in the string is rotated.
[0072] (4) The method for rotating the entire text annotation string is also local coordinate transformation. First, calculate the center coordinate value of a single character in the unified graphical interface coordinate system. During the coordinate transformation, translate the origin of the graphical interface coordinate system to the center coordinate of a single character (determined as needed, such as the first, middle, or last) as the origin of the local coordinate system. Then, rotate the local coordinate system with the origin of the local coordinate system as the center. After the coordinate system translation and rotation are completed, output the string. After the string output is completed, it is necessary to restore the coordinate system before translation and rotation to ensure the correctness of the subsequent output coordinates of other graphics elements. This restoration step is to first rotate the coordinate system in the opposite direction along the rotation direction of the coordinate system, and then translate it in the opposite direction according to the translation amount of the origin of the coordinate system, so as to achieve the purpose of restoring the original unified graphical interface coordinate system.
[0073] 4. Methods for handling coordinate value calculation errors.
[0074] (1) Due to the complexity and diversity of computer Chinese font types, commonly used software development platforms cannot accurately obtain the precise string and single character size values when processing strings. In particular, when there are Chinese characters, letters and numbers in the string, the width of the single character will be significantly deviated. As a result, it is impossible to obtain accurate values when obtaining and calculating the coordinate values of a single character in the string, which leads to the accumulation of string coordinate errors during frequent view conversions.
[0075] (2) In this embodiment, a method combining coordinate calculation and approximate simulation is adopted, that is, when separating the character string in the graphical interface, the coordinates and width of each character are obtained by measuring the width of each character one by one. However, when there is a difference between the measured value (that is, the sum of the widths of all the measured characters) and the total length of the character string, the measured calculated value is corrected according to the total length, for example, the difference between the sum and the total length is averaged and added to the space between every two characters. This minimizes the error value generated by the calculation, so that the display position of the text annotation on the graphical interface is as close as possible to the actual position.
[0076] 5. How to handle the character aspect ratio.
[0077] (1) When the text annotation requires outputting a special aspect ratio in a non-uniform regular font, this embodiment displays and outputs the text annotation by changing the ratio of the X-axis to the Y-axis of the local coordinate system.
[0078] (2) Similar to the rotation of characters, before outputting the characters, the coordinate system of the graphical interface is translated to the text annotation output position, and the ratio of the X-axis to the Y-axis is set according to the required aspect ratio to obtain the local scale, and the text annotation is output at this local scale.
[0079] (3) After the text annotation is output, the proportional relationship between the X-axis and the Y-axis of the original graphic interface coordinate system is restored in time, so that only the local output text annotation is affected, and the aspect ratio required by the text annotation is realized.
[0080] 6. Graphics element association processing method.
[0081] (1) When a composite graphic element in a graphical interface software contains a text annotation, the text annotation is used as a graphic element to establish a master-slave relationship with the composite graphic element. For example, the text annotation and the composite graphic element are associated with each other to provide a basis for influencing operations.
[0082] (2) The relationship between the composite graphic element and the text annotation is a master-slave relationship. The composite graphic element is the master graphic element and the text annotation is the slave graphic element. The master-slave relationship means that the slave graphic element changes along with the state of the master graphic element. The state change of the slave graphic element does not affect the master graphic element. For example, if the master graphic element is deleted or moved, the slave graphic element will be deleted or moved; if the slave graphic element is deleted or moved, it will not affect the master graphic element.
[0083] (3) In addition, the text annotation can be bidirectionally associated with the composite primitive, and the corresponding feature attributes in the composite primitive can be changed synchronously by editing the string content of the text annotation, so as to realize batch editing and modification. For example, the feature attributes can be changed by editing the string content of the text annotation through the bidirectional association number of the composite primitive and the text annotation.
[0084] The present invention is not limited to the above-mentioned specific embodiments, but extends to any new features or any new combination disclosed in this specification, as well as any new method or process steps or any new combination disclosed.
Claims
1. A method for processing text annotations in a graphical interface of a power transmission line cross-section diagram software, wherein the text annotations are composed of a string of at least one character; characterized in that: The method includes at least one of the following processing methods: Methods for processing accumulated errors during coordinate system transformation, character string stretching, character string rotation, coordinate value calculation errors, character aspect ratios, and primitive associations; The method for processing character string rotation includes: Calculate the drawing coordinate value of each character in the graphical interface and the center coordinate value of each character respectively; When the direction of the initials of the text annotation needs to follow the angle, when the coordinate system is transformed, the origin of the graphical interface coordinate system is translated to the center of each character, and the local coordinate system is rotated around the center of each character. After the character is output, the original coordinate system is restored; all the output characters are combined into a character string.
2. The method for processing text annotations in the graphical interface of the power transmission line cross-section diagram software as claimed in claim 1, characterized in that: The method for processing character string rotation also includes: When the entire string needs to be rotated, during the coordinate transformation, the origin of the graphical interface coordinate system is translated to the center of a character, and the local coordinate system is rotated around the center of the character, and then restored to the original coordinate system after the string is output.
3. The method for processing text annotations in the graphical interface of the power transmission line cross-section diagram software according to claim 1, characterized in that: The method for processing accumulated errors during coordinate system transformation uses local variables to transform the image interface coordinate system when transforming the image interface coordinate system between the calculation coordinate system transformation and the engineering coordinate system, so as to clear the accumulated errors of the graphic interface coordinate system caused by the transformation after a single transformation is completed.
4. The method for processing text annotations in the graphical interface of the power transmission line cross-section diagram software according to claim 3, characterized in that: The method for processing the accumulated error during the coordinate system transformation includes: The output positions of text annotations all use the unified coordinate values of the graphical interface; Before the text annotation is output, the local variable is used as a temporary variable for coordinate system transformation to perform a reverse transformation of the Y axis of the graphical interface coordinate system, and then the text annotation is output; After the text annotation is output, reverse the Y axis of the graphical interface coordinate system again.
5. The method for processing text annotations in the graphical interface of the power transmission line cross-section diagram software according to claim 1, characterized in that: The method for processing string stretching includes: When the text annotation is stretched, the stretched length of the text annotation is read, the stretched length is evenly distributed to the intervals between the characters of the text annotation, and all the characters are output uniformly.
6. The method for processing text annotations in the graphical interface of the power transmission line cross-section diagram software according to claim 5, characterized in that: The stretching length is evenly distributed to the intervals between the characters of the text annotation, and all characters are output uniformly, including: Separate the individual characters in the string one by one and store them temporarily; Calculate the value of the width of a single character, calculate the width of each character added due to stretching according to the stretching length, and calculate the value of each character from the starting point; According to the starting position of the string, the unified drawing coordinate value of each character in the string in the graphical interface is calculated.
7. The method for processing text annotations in the graphical interface of the power transmission line cross-section diagram software as claimed in claim 1, characterized in that: The method for processing coordinate value calculation errors includes: When separating a string, measure the width of each separated character one by one; When the total measured width of all characters is inconsistent with the total length of the string, the measured width of each character is corrected according to the total length of the string.
8. The method for processing text annotations in the graphical interface of the power transmission line cross-section diagram software according to claim 1, characterized in that: The method for processing the character aspect ratio comprises: The coordinate system of the graphical interface is translated to the text annotation output position, and the ratio of the X axis to the Y axis is set according to the required aspect ratio to obtain the local scale, and the text annotation is output under the local scale; After the text annotation is output, the proportional relationship between the X-axis and Y-axis of the original graphics interface coordinate system is restored.
9. The method for processing text annotations in the graphical interface of the power transmission line cross-section diagram software as claimed in claim 1, characterized in that: The method for processing graphic element association includes: When a composite graphic element in a graphical interface contains text annotations, the text annotations are treated as a graphic element and associated with the composite graphic element in a master-slave relationship. The slave graphic element changes along with the state of the master graphic element, and the state change of the slave graphic element does not affect the master graphic element.
10. The method for processing text annotations in the graphical interface of the power transmission line cross-section diagram software according to claim 9, characterized in that: The method for processing graphic element association further includes: The text annotation is bidirectionally associated with the combined graphic element, and the corresponding ground feature attributes in the combined graphic element are synchronously changed by editing the string content of the text annotation.
