A system and method for rapid layout of name tags based on SPD system
By integrating modules for generating initial annotation data files, graphic collision detection, BVH tree construction, and hardware acceleration into the SPD system, the speed and applicability issues of automated annotation layout in ship design were resolved, enabling rapid and reasonable annotation layout and improving design efficiency and annotation quality.
Patent Information
- Application Number
- CN202210639048.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-08
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2042-06-08
AI Technical Summary
In ship design, existing technologies for automated layout annotation are slow, have low applicability, and cannot effectively optimize the annotation positions on complex ship drawings, resulting in heavy workload, low efficiency, and non-standard annotation for designers.
Design a rapid name labeling layout system based on the SPD system, including modules for generating initial labeling data files, graphic collision detection, BVH tree construction, weight algorithm optimization, and hardware acceleration. The system achieves rapid and reasonable labeling layout through hardware acceleration platforms such as OpenCL or CUDA graphics card computing platforms.
It improves the efficiency and standardization of ship drawing annotation, reduces the amount of manual annotation work, realizes the automation and reasonable layout of annotation, and avoids the problems of overlapping and unsightly annotations.
Smart Images

Figure CN115168984B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to digital technology for shipbuilding, and in particular to a method and system for rapid layout of name labeling based on the SPD system. Background Technology
[0002] The Ship Product Design (SPD) system is a design software system with independent intellectual property rights designed to enhance the innovation capabilities of ship design and construction in my country. Based on OpenGL, this system is a 3D CAD graphics platform with independent intellectual property rights, featuring functions such as hull structure design, piping system design, duct design, electrical design, steel outfitting design, and painting production design. It provides a powerful means to establish ship product models with complete topological relationships through solid and parametric modeling technologies, and achieves data and information integration with heterogeneous CAD systems through data interfaces with other systems, creating technical conditions for collaborative design between factories and research institutes.
[0003] As design firms increasingly demand standardization and refinement in 2D drawing production, designers are spending more time creating annotations and laying out the drawings, giving rise to the need for automated annotation. The core of automated annotation technology lies in the automatic layout of annotations, requiring satisfactory results simultaneously in terms of the rationality and aesthetics of annotation placement and the time required for layout calculation.
[0004] There are certain rules and requirements in the layout process of annotations, so automated layout must also meet these requirements to make automatically generated annotations usable. The primary goal is to avoid overlap between annotation bodies and the model. Annotation leaders can only intersect with other line segments when they must cross certain line segments. Furthermore, even if all generated annotations only intersect with their leaders, it's aesthetically unappealing, so overlap between annotations should be avoided as much as possible. Intersection of annotation leaders near the starting point is only allowed if positioning is impossible. Annotations should also be within a single drawing area and have boundary conditions. For aesthetic purposes, leader lines should be angled at 45 degrees and as short as possible. When inputting the same data, the generated annotation positions should be guaranteed to be as consistent as possible.
[0005] A literature search of existing technologies revealed that Xia Wenjun proposed an optimization algorithm for railway box girder reinforcement diagram annotation using FR force guidance in his article "Research on Intelligent Layout Algorithm for Railway Box Girder Reinforcement Diagram Annotation". This method is based on the principle of equilibrium between repulsive and attractive forces. It abstracts specific annotation elements into physical particles and simulates the random motion between particles to optimize the annotation of railway box girder reinforcement diagrams. However, the method in this article also has some technical defects and shortcomings: (1) The algorithm used in this method does not adopt the principle of hardware acceleration, resulting in a low calculation speed. (2) The applicability of this method is low. It will have a good effect on railway box girder reinforcement diagrams, but it does not have the ability to optimize the complex installation diagram annotations of ships. Summary of the Invention
[0006] To address the problems existing in the prior art, the present invention provides a rapid name labeling layout system and method based on the SPD system. Some embodiments of the present invention can quickly generate labeling information for ship drawings in the SPD system, and with the assistance of hardware acceleration, provide a reasonable labeling layout.
[0007] To achieve the above objectives, the present invention adopts the following technical solution:
[0008] This invention first designs a rapid name labeling layout system based on the SPD system. This rapid name labeling layout system is embedded in the SPD system as a subsystem. This subsystem is used to quickly generate labeling information for ship drawings and automatically achieve a reasonable name labeling layout. The rapid name labeling layout system comprises a labeling initial data file generation module, a two-dimensional graphic collision detection module, a static and dynamic BVH tree construction module, a weight algorithm optimization module, a hardware acceleration module, and an SPD labeling generation module.
[0009] The initial data file generation module for annotation is connected to the SPD system and is used to parse the drawing data and drawing information of the SPD ship from the SPD system. The parsed data and information are used as the data source, and the preliminary data extraction and constraint generation of the annotation model are further realized in the data source. The obtained preliminary data and constraint conditions are respectively provided to the two-dimensional graphics collision detection module, the static and dynamic BVH tree construction module and the weight algorithm optimization module.
[0010] The two-dimensional graphic collision detection module is connected to the annotation initial data file generation module. Based on the obtained preparatory data and constraints, it is used to detect the collision state between two-dimensional graphics, provide data support for the subsequent calculation module, and output information on whether the two-dimensional graphics collide or not.
[0011] The static and dynamic BVH tree construction module is connected to the annotation initial data file generation module to obtain preliminary data and constraints. Based on the computing characteristics of CPU and GPU, it separately constructs dynamic BVH tree data structure and static dynamic BVH tree data structure. This BVH tree data structure is used to achieve software acceleration of computation.
[0012] The weighting algorithm optimization module is connected to the annotation initial data file generation module and the two-dimensional graphic collision detection module to obtain preliminary data, constraints, and two-dimensional graphic collision detection data. The preliminary data and constraints are calculated with the results of the two-dimensional graphic collision detection module to obtain an evaluation value. The obtained result is evaluated numerically, and the calculation results are compared to obtain the best calculation result.
[0013] The hardware acceleration module is connected to the two-dimensional graphics collision detection module, the static and dynamic BVH tree construction module and the weight algorithm optimization module respectively. In a computer environment with hardware acceleration conditions, the hardware acceleration of the algorithm is implemented using a graphics card computing platform with OpenCL or CUDA.
[0014] The SPD annotation generation module is connected to the two-dimensional graphics collision detection module, the static and dynamic BVH tree construction module, and the weight algorithm optimization module to obtain data. It is used to annotate by obtaining the final results calculated by the two-dimensional graphics collision detection module, the static and dynamic BVH tree construction module, and the weight algorithm optimization module. The annotation process is run multiple times to generate batch SPD annotation data. The batch generated SPD annotation information is then delivered to the SPD system to complete the rapid layout operation of name annotation.
[0015] This invention also relates to a method for rapid layout of name labels based on an SPD system. This method extracts a label model from existing map data using the SPD system and, through hardware acceleration, quickly and accurately places the labels in appropriate positions. The method specifically includes the following implementation steps:
[0016] The first step is to obtain the drawing data and related drawing information of the SPD vessel in the SPD system, and use them as the data source to analyze the annotation model in the obtained data, thereby extracting preliminary data and generating constraints to obtain the preliminary data and constraints for name annotation.
[0017] The second step is to detect the collision status between labeled models and between labeled models and two-dimensional graphics based on the data source, and to obtain collision data.
[0018] The third step is to construct dynamic BVH tree data structures and static dynamic BVH tree data structures based on the preparatory data and constraints, and to accelerate the computation software through BVH tree data structures.
[0019] The fourth step is to use the weight algorithm optimization module to calculate the results of the initial labeled positions and to evaluate them numerically using the weight calculation formula.
[0020] Fifth, use OpenCL or CUDA graphics card computing platforms to provide hardware acceleration for algorithms that implement collision state detection, BVH tree data structure construction and numerical evaluation.
[0021] Step 6: Using the calculation results of Steps 2, 3, and 4, generate the SPD annotation for this round. After running it multiple times to generate annotation information data in batches, deliver it to the SPD system to complete the rapid layout operation of name annotation.
[0022] In the first step, the process of obtaining data from the SPD system includes:
[0023] S11. Identify the objects to be labeled and collect all labeling information;
[0024] S12. The bounding box size of the labeled graphic is calculated from the labeled text;
[0025] S13. The background graphic determines the scope that needs to be considered based on the object to be labeled;
[0026] S14. Collect relevant data for the drawings required for this round of layout, including the size and scale of the drawings.
[0027] The process of obtaining the bounding box size described above includes:
[0028] Break down the labeled graphic into basic graphic elements;
[0029] Determine the category of the graphic element it belongs to;
[0030] If the primitive is a line, a bounding box is generated using the spline data of the line;
[0031] If it is a text-based graphic element, the actual bounding box displayed on the drawing is obtained through a series of text attributes;
[0032] The calculated bounding boxes are sorted and merged to obtain the final result of the current labeled bounding box, i.e., the bounding box size.
[0033] The data acquisition process for the above drawings is as follows:
[0034] Get the limit range of the current drawing annotations and constrain the position of the layout;
[0035] Obtain the drawing scale of the current drawing for accurate bounding box calculation;
[0036] Get the maximum length of the annotation leader specified by the application;
[0037] Get the current annotation layout mode, which is either wrap or nearest.
[0038] In the second step, the process of obtaining collision data includes:
[0039] S21. Calculate the rough bounding box of all figures;
[0040] S22. Detect whether a collision occurs between them;
[0041] S23. If no collision occurs, mark it as no collision;
[0042] S24. If a collision is detected in the bounding box, perform detailed collision detection at the primitive level; if no collision occurs, mark it as no collision; if a collision occurs, record the number of collisions for subsequent weight calculation.
[0043] In the above collision data calculation process, for the rough calculation of the bounding box, it is necessary to extract the upper left and lower right corner points of the bounding box and determine whether they overlap by calculating the overlap of the two rectangular bounding boxes; for the detailed collision calculation, it is necessary to decompose the two collision detection models into primitives, process the line primitives and text primitives separately, and compare the primitives of the two graphics one by one through geometric calculation to see if they overlap.
[0044] The construction process of the BVH tree data structure in the third step includes:
[0045] S31. Decompose the background of the graphic and calculate the bounding box;
[0046] S32. Construct a solid background graphic and construct line data;
[0047] S33. Calculate Morton codes to represent two-dimensional positions as one-dimensional data. Morton codes are algorithms for encoding grids.
[0048] S34. Construct a BVH tree structure based on the data of each node, and make a judgment on the structure of the BVH tree;
[0049] S35. If it is a static tree structure, copy it to the GPU memory; if it is a dynamic tree structure, do not perform this step.
[0050] The calculation process for the numerical evaluation in the fourth step includes:
[0051] S41. Annotated angle index items formed from the calculation results;
[0052] S42. The annotation leader length index item formed by the calculation results;
[0053] S43. The number of leader lines and their intersections resulting from the calculation;
[0054] S44. The number of intersections between the calculated volume and the background;
[0055] S45. Number of annotation bodies and their intersections;
[0056] S46. Using the weighting formula coefficients, the results obtained from S41-S45 are calculated using the formula to obtain the final weighted evaluation value:
[0057] The coefficients of the weighting formula are a set of real numbers whose sum is 1 obtained through multiple experiments, and the selectable coefficient combinations are [0.13, 0.17, 0.3, 0.25, 0.15].
[0058] The fifth step, which implements hardware acceleration, includes the following:
[0059] S51. Detect whether the current client is running in a GPU environment;
[0060] S52. If it does not exist, use the CPU to calculate;
[0061] S53. If it exists, determine whether a CUDA runtime environment is available;
[0062] S54. If CUDA calculation is not supported, use the OpenCL general graphics card calculation method;
[0063] S55. If CUDA computation is supported, then CUDA shall be used for subsequent computations.
[0064] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0065] 1. This invention solves the problem of manual ship drawings in the original SPD system, reduces the workload of drawing annotation, and improves the drawing output efficiency of designers.
[0066] 2. The system and method of the present invention are integrated into the original SPD system, realizing the automation of the annotation layout in the drawing automation process, which is used to quickly generate annotation information for ship drawings and automatically realize reasonable name annotation layout.
[0067] 3. The system and method of the present invention are integrated into the original SPD system, which solves the problem of designers missing or omitting markings in drawings in the past, and provides a way to standardize the marking of ship drawings. Attached Figure Description
[0068] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0069] Figure 1 This is a flowchart illustrating a rapid layout method for name labeling based on an SPD system according to the present invention.
[0070] Figure 2 This is a schematic diagram illustrating the basic data structure of the SPD automatic layout algorithm.
[0071] Figure 3 A schematic diagram of the technical route for calculating bounding boxes for SPD annotation.
[0072] Figure 4 This is a schematic diagram illustrating the data parsing of the SPD automatic layout algorithm.
[0073] Figure 5 This is a schematic diagram of SPD graphic collision detection technology.
[0074] Figure 6 This is a detailed flowchart of the rough calculation of bounding boxes in SPD graphic collision detection.
[0075] Figure 7 This is a detailed flowchart of the collision calculation in SPD graphic collision detection.
[0076] Figure 8 Construct a route diagram for the SPD graphical BVH tree.
[0077] Figure 9 A schematic diagram illustrating the weight calculation of the SPD annotation results.
[0078] Figure 10 This is a schematic diagram of the CPU-GPU computation logic for the SPD automatic placement algorithm.
[0079] Figure 11 This is a schematic diagram of the overall computing logic of SPDGPU. Detailed Implementation
[0080] The following detailed description, in conjunction with the accompanying drawings and specific embodiments, further elaborates on the automatic nesting method for ship hull plates in an SPD system and the automatic nesting platform for ship hull plates, in order to provide a clearer understanding of its structural composition and implementation method. However, this should not be construed as limiting the scope of protection of this invention.
[0081] This embodiment provides a name tagging rapid layout system and method based on the SPD system. See [link / reference] Figure 1 As shown, the rapid name labeling layout system of the present invention is embedded in the SPD system as a subsystem. This subsystem is used to quickly generate labeling information for ship drawings and automatically achieve a reasonable name labeling layout. The rapid name labeling layout system comprises a labeling initial data file generation module, a two-dimensional graphic collision detection module, a static and dynamic BVH tree construction module, a weight algorithm optimization module, a hardware acceleration module, and an SPD labeling generation module; wherein,
[0082] The initial data file generation module for annotation is connected to the SPD system and is used to parse the drawing data and drawing information of the SPD ship from the SPD system. The parsed data and information are used as the data source, and the preliminary data extraction and constraint generation of the annotation model are further realized in the data source. The obtained preliminary data and constraint conditions are respectively provided to the two-dimensional graphics collision detection module, the static and dynamic BVH tree construction module and the weight algorithm optimization module.
[0083] The two-dimensional graphic collision detection module is connected to the annotation initial data file generation module. Based on the obtained preparatory data and constraints, it is used to detect the collision state between two-dimensional graphics, provide data support for the subsequent calculation module, and output information on whether the two-dimensional graphics collide or not.
[0084] The static and dynamic BVH tree construction module is connected to the annotation initial data file generation module to obtain preliminary data and constraints. Based on the computing characteristics of CPU and GPU, it separately constructs dynamic BVH tree data structure and static dynamic BVH tree data structure. This BVH tree data structure is used to achieve software acceleration of computation.
[0085] The weighting algorithm optimization module is connected to the annotation initial data file generation module and the two-dimensional graphic collision detection module to obtain preliminary data, constraints, and two-dimensional graphic collision detection data. The preliminary data and constraints are calculated with the results of the two-dimensional graphic collision detection module to obtain an evaluation value. The obtained result is evaluated numerically, and the calculation results are compared to obtain the best calculation result.
[0086] The hardware acceleration module is connected to the two-dimensional graphics collision detection module, the static and dynamic BVH tree construction module and the weight algorithm optimization module respectively. In a computer environment with hardware acceleration conditions, the hardware acceleration of the algorithm is implemented using a graphics card computing platform with OpenCL or CUDA.
[0087] The SPD annotation generation module is connected to the two-dimensional graphics collision detection module, the static and dynamic BVH tree construction module, and the weight algorithm optimization module to obtain data. It is used to annotate by obtaining the final results calculated by the two-dimensional graphics collision detection module, the static and dynamic BVH tree construction module, and the weight algorithm optimization module. The annotation process is run multiple times to generate batch SPD annotation data. The batch generated SPD annotation information is then delivered to the SPD system to complete the rapid layout operation of name annotation.
[0088] In this implementation case, the first module is the initial data file generation module. This module's function is to provide the relevant information needed by the SPD system for the model and layout to be annotated, for subsequent modules to calculate. In the SPD system, the layout needs to consider the existing 2D graphics of the current drawing and the annotation graphics to be generated. The 2D graphics of the current drawing are determined by the annotation model; the annotation graphics first need to have their annotation content generated to determine the final annotation graphics.
[0089] This invention also relates to a rapid name label layout method based on an SPD system. This method extracts a label model from existing map data using the SPD system and, through hardware acceleration, quickly and accurately places the labels in appropriate positions. The method specifically includes the following implementation steps:
[0090] The first step is to obtain the drawing data and related drawing information of the SPD vessel in the SPD system, and use them as the data source. The annotation model is parsed from the obtained data to perform the preliminary data extraction and constraint generation method, and obtain the preliminary data and constraints for name annotation.
[0091] The second step is to detect the collision status between labeled models and between labeled models and two-dimensional graphics based on the data source, and to obtain collision data.
[0092] The third step is to construct dynamic BVH tree data structures and static dynamic BVH tree data structures based on the data, and to accelerate the computing software through the BVH tree data structures.
[0093] The fourth step involves using a weighted algorithm optimization module to numerically evaluate the calculation results of the initial labeled positions using a weighted calculation formula.
[0094] Step 5: Utilize a hardware acceleration module to provide hardware acceleration for the algorithms that implement collision state detection, BVH tree data structure construction, and numerical evaluation using an OpenCL or CUDA graphics card computing platform.
[0095] Step 6: Using the calculation results from steps 2, 3, and 4, generate SPD annotations. Run the process multiple times to generate annotation information data in batches, and then deliver it to the SPD system to complete the rapid layout operation of name annotations.
[0096] like Figure 2 As shown, the first step employs the following implementation process: identifying the objects to be annotated and collecting all annotation content information; calculating the bounding box size of the annotated graphics based on the annotation content; determining the background graphics to be included in the scope of consideration based on the aforementioned annotated objects; and collecting relevant information from the drawings required for this round of layout, including paper size and scale. data .
[0097] like Figure 3 As shown, the SPD annotation consists of basic line primitives and text primitives. The steps for calculating the bounding box of the annotation are as follows: The annotation graphic is broken down into basic primitives; its primitive category is determined; if it is a line primitive, a bounding box is generated using the spline data of the line; if it is a text primitive, the actual bounding box displayed on the drawing is obtained using a series of text attributes, such as text height, width factor, font, and text content; the calculated bounding boxes are sorted and merged to obtain the final result of the current annotation bounding box, i.e., the size of the bounding box.
[0098] like Figure 4 As shown, the drawing layout information collected in the SPD system mainly includes the following four points: obtaining the limit range of the current drawing annotation to constrain the position of the layout; obtaining the drawing scale of the current drawing for correct calculation of the bounding box; obtaining the limit length of the annotation leader specified by the application; and obtaining the mode of the current annotation layout, which may be either wrapping mode or proximity mode.
[0099] In this invention patent, 2D graphic collision detection is the core of the layout algorithm. The most crucial aspect of the automatic layout algorithm is avoiding overlap between labeled graphics and existing drawing background information. However, without sufficient optimization, such judgments can lead to lengthy calculations, thus slowing down the overall efficiency of the automatic layout. Collision detection is divided into coarse bounding box calculation and fine collision detection. Coarse bounding box calculation is used to exclude 2D graphics that, based solely on bounding box analysis, show no collision. Coarse calculation minimizes unnecessary computation, thereby increasing overall computational efficiency.
[0100] like Figure 5As shown, calculating whether a label has collided mainly involves the following steps: calculating the coarse bounding boxes of all graphics; detecting whether there is a collision between them; if no collision occurs, marking it as not colliding; if a collision is detected in the bounding boxes, performing detailed collision detection at the primitive level; if no collision occurs, marking it as not colliding; if a collision occurs, recording the number of collisions for subsequent weight calculation.
[0101] like Figure 6 and Figure 7 As shown in the figure, the steps of rough bounding box calculation and fine collision calculation are respectively: For rough bounding box calculation, it is necessary to extract the top left corner and bottom right corner of the bounding box, and determine whether they overlap by calculating the overlap of the two rectangular bounding boxes.
[0102] For detailed collision calculation, it is necessary to decompose the two collision detection models into primitives, process the line primitives and text primitives separately, and compare the primitives of the two graphics one by one through geometric calculation to see if they overlap.
[0103] To achieve software acceleration, both static and dynamic BVH trees were constructed. During layout, a large amount of data needs to be organized. The hierarchical bounding box tree (BVH tree) is a multi-branch tree used to store the bounding box shapes. Its root node represents the largest bounding box, and its multiple child nodes represent multiple child bounding boxes. In SPD layout, the background graphic is fixed, resulting in a static BVH tree that does not need to be changed. The annotation drawing is updated in real-time during layout, resulting in a dynamic BVH tree. Due to this property, repeated updates of the dynamic BVH tree in the GPU, involving repeated copies between GPU memory and system memory, can actually lead to performance degradation. Therefore, a static BVH tree is ultimately located in GPU memory, while the dynamic BVH tree remains in system memory and is managed by the CPU.
[0104] like Figure 8 As shown in the diagram, the construction process of a static BVH tree mainly involves the following steps: decomposing the graphic background and calculating the bounding box; constructing the solid background graphic and line data; calculating the Morton code, which is used to represent two-dimensional positions as one-dimensional data; the Morton code is an algorithm for encoding a grid; and constructing the BVH tree according to the data of each node. The data is then copied to the GPU memory (this step is not performed if the structure tree is dynamic).
[0105] Multiple results can be calculated from collision detection, and only one algorithm can provide the optimal result. The weight algorithm optimization module calculates the values using the weights set by the user and selects the optimal one. For example... Figure 9As shown, the weighting algorithm mainly involves the following calculation steps for the indicator items: the annotation angle formed by the calculation result; the annotation leader length formed by the calculation result; the number of intersections between the annotation leaders formed by the calculation result; the number of intersections between the body and the background formed by the calculation result; the number of intersections between annotation bodies; and finally, the results of the above indicator item calculations are applied using the weighting formula coefficients.
[0106] The evaluation value is obtained, where the coefficients of the weight formula are a set of real numbers whose sum is 1. An example of a set of coefficients to choose from is [0.13, 0.17, 0.3, 0.25, 0.15].
[0107] Hardware acceleration is used in the processing, specifically the OpenCL / CUDA hardware acceleration module. This module optimizes the hardware algorithm by detecting the hardware conditions of the client. CUDA performs optimally on NVIDIA graphics cards, while other graphics cards cannot utilize this technology and can instead use the general-purpose OpenCL algorithm. If the user's computer does not have a graphics card, the CPU can be used for computation, although the efficiency is slightly lower, it can still produce correct results.
[0108] like Figure 10 As shown, in the OpenCL / CUDA hardware acceleration module, the detection process for hardware acceleration involves the following steps: Detecting whether the current client is running in a GPU environment; if no GPU environment exists, CPU computation is used; if a GPU environment exists, it is then determined whether a CUDA environment is available; if CUDA computation is not supported, the OpenCL general graphics card computation method is used; if CUDA computation is supported, CUDA is used for subsequent computations.
[0109] like Figure 11 As shown, in hardware acceleration, the overall GPU computing process consists of the following steps: constructing dynamic and static BVH trees; partitioning the solution domain to reduce GPU computing pressure; performing collision detection on all graphics in the GPU; recording appropriate solutions if they exist in the current solution domain; calculating global solutions if no appropriate solutions exist in the current solution domain; calculating weight values for labeled volumes after partitioning the solution domain; sorting and taking the highest weight value as the current solution.
[0110] This invention can automatically generate annotation layouts based on the SPD system, achieving automated annotation placement and high-speed execution efficiency, thereby improving the productivity of operators.
[0111] Although the above embodiments have provided a detailed description of the present invention, it should be understood by those skilled in the art that modifications or improvements can be made based on the disclosure of the present invention without departing from the spirit and scope of the invention, and such modifications and improvements are all within the spirit and scope of the present invention.
Claims
1. A name tagging rapid layout system based on SPD system, characterized in that, The rapid name labeling layout system is embedded in the SPD system as a subsystem. This subsystem is used to quickly generate labeling information for ship drawings and automatically achieve a reasonable name labeling layout. The rapid name labeling layout system consists of a labeling initial data file generation module, a two-dimensional graphic collision detection module, a static and dynamic BVH tree construction module, a weight algorithm optimization module, a hardware acceleration module, and an SPD labeling generation module. The initial data file generation module for annotation is connected to the SPD system and is used to parse the drawing data and drawing information of the SPD ship from the SPD system. The parsed data and information are used as the data source, and the preliminary data extraction and constraint generation of the annotation model are further realized in the data source. The obtained preliminary data and constraint conditions are respectively provided to the two-dimensional graphics collision detection module, the static and dynamic BVH tree construction module and the weight algorithm optimization module. The two-dimensional graphic collision detection module is connected to the annotation initial data file generation module. Based on the obtained preparatory data and constraints, it is used to detect the collision state between two-dimensional graphics, provide data support for the subsequent calculation module, and output information on whether the two-dimensional graphics collide or not. The static and dynamic BVH tree construction module is connected to the annotation initial data file generation module to obtain preliminary data and constraints. Based on the computing characteristics of CPU and GPU, it constructs dynamic BVH tree data structure and static dynamic BVH tree data structure respectively. The BVH tree data structure is used to achieve software acceleration of computation. The weighting algorithm optimization module is connected to the annotation initial data file generation module and the two-dimensional graphic collision detection module to obtain preliminary data, constraints, and two-dimensional graphic collision detection data. The preliminary data and constraints are calculated with the results of the two-dimensional graphic collision detection module to obtain an evaluation value. The obtained result is evaluated numerically, and the calculation results are compared to obtain the best calculation result. The hardware acceleration module is connected to the two-dimensional graphics collision detection module, the static and dynamic BVH tree construction module and the weight algorithm optimization module respectively. In a computer environment with hardware acceleration conditions, the hardware acceleration of the algorithm is implemented using a graphics card computing platform with OpenCL or CUDA. The SPD annotation generation module is connected to the two-dimensional graphics collision detection module, the static and dynamic BVH tree construction module, and the weight algorithm optimization module to obtain data. It is used to annotate by obtaining the final results calculated by the two-dimensional graphics collision detection module, the static and dynamic BVH tree construction module, and the weight algorithm optimization module. The annotation process is run multiple times to generate batch SPD annotation data. The batch generated SPD annotation information is then delivered to the SPD system to complete the rapid layout operation of name annotation.
2. A method for rapid layout of name tags based on an SPD system, characterized in that, This method is based on the SPD system to extract annotation models from existing map data, and uses hardware acceleration to quickly and accurately place the annotations in appropriate locations. The method specifically includes the following implementation steps: The first step is to obtain the drawing data and related drawing information of the SPD vessel in the SPD system, and use them as the data source to analyze the annotation model in the obtained data, thereby extracting preliminary data and generating constraints to obtain the preliminary data and constraints for name annotation. The second step is to detect the collision status between labeled models and between labeled models and two-dimensional graphics based on the data source, and to obtain collision data. The third step is to construct dynamic BVH tree data structures and static dynamic BVH tree data structures based on the preparatory data and constraints, and to accelerate the computation software through BVH tree data structures. The fourth step is to evaluate the calculation results of the preliminary marked positions numerically using a weighted calculation formula. The calculation process for the numerical evaluation includes: S41. Annotated angle index items formed from the calculation results; S42. The annotation leader length index item formed by the calculation results; S43. The number of leader lines and their intersections resulting from the calculation; S44. The number of intersections between the calculated volume and the background; S45. Number of annotation bodies and their intersections; S46. Using the weighting formula coefficients, the above-mentioned calculation indicators in S41-S45 are converted into the final evaluation value through formula calculation: , where the coefficients of the weight formula are the set of real numbers whose sum is 1 obtained through multiple experiments; Fifth, use OpenCL or CUDA graphics card computing platforms to provide hardware acceleration for algorithms that implement collision state detection, BVH tree data structure construction and numerical evaluation. Step 6: Using the calculation results of Steps 2, 3, and 4, generate the SPD annotations for this round. After running the process multiple times to generate annotation information data in batches, deliver it to the SPD system to complete the rapid layout operation of name annotations.
3. The name labeling rapid layout method based on the SPD system according to claim 2, characterized in that, In the first step, the process of obtaining data from the SPD system includes: S11. Identify the objects to be labeled and collect all labeling information; S12. The bounding box size of the labeled graphic is calculated from the labeled text; S13. The background graphic determines the scope that needs to be considered based on the object to be labeled; S14. Collect relevant data for the drawings required for this round of layout, including the size and scale of the drawings.
4. The name labeling rapid layout method based on the SPD system according to claim 3, characterized in that, The process of obtaining the bounding box size includes: Break down the labeled graphic into basic graphic elements; Determine the category of the graphic element it belongs to; If the primitive is a line, a bounding box is generated using the spline data of the line; If it is a text-based graphic element, the actual bounding box displayed on the drawing is obtained through a series of text attributes; The calculated bounding boxes are sorted and merged to obtain the final result of the current labeled bounding box, i.e., the bounding box size.
5. The name labeling rapid layout method based on the SPD system according to claim 3, characterized in that, The process of obtaining relevant data for the drawings is as follows: Get the limit range of the current drawing annotations and constrain the position of the layout; Obtain the drawing scale of the current drawing for accurate bounding box calculation; Get the maximum length of the annotation leader specified by the application; Get the current annotation layout mode, which is either wrap or nearest.
6. The name labeling rapid layout method based on the SPD system according to claim 2, characterized in that, The second step, the process of obtaining collision data, includes: S21. Calculate the rough bounding box of all graphics; S22. Detect whether a collision occurs between them; S23. If no collision occurs, mark it as no collision; S24. If a bounding box collision is detected, perform detailed collision detection at the primitive level; If no collision occurs, mark it as no collision; if a collision occurs, record the number of collisions for subsequent weight calculations.
7. The name labeling rapid layout method based on the SPD system according to claim 6, characterized in that, For rough bounding box calculations, the top-left and bottom-right corners of the bounding box need to be extracted, and the overlap of the two rectangular bounding boxes is used to determine whether they overlap. For detailed collision calculations, the two collision detection models need to be decomposed into primitives, and the line primitives and text primitives are processed separately. Through geometric calculations, the primitives of the two graphics are compared one by one to see if they overlap.
8. The name labeling rapid layout method based on the SPD system according to claim 2, characterized in that, The construction process of the BVH tree data structure in the third step includes: S31. Decompose the background of the graphic and calculate the bounding box; S32. Construct a solid background graphic and construct line data; S33. Calculate Morton codes to represent two-dimensional positions as one-dimensional data. Morton codes are algorithms for encoding grids. S34. Construct a BVH tree structure based on the data of each node, and make a judgment on the structure of the BVH tree; S35. If it is a static tree structure, copy it to the GPU memory; if it is a dynamic tree structure, do not perform this step.
9. The name labeling rapid layout method based on the SPD system according to claim 2, characterized in that, The fifth step, which implements hardware acceleration, includes the following: S51. Detect whether the current client is running in a GPU environment; S52. If it does not exist, use the CPU to calculate; S53. If it exists, determine whether a CUDA runtime environment is available; S54. If CUDA calculation is not supported, use the OpenCL general graphics card calculation method; S55. If CUDA computation is supported, then CUDA shall be used for subsequent computations.
Citation Information
Patent Citations
Control method of motion of redundant mechanical arm based on configuration plane
CN105234930A
System and method for avoiding overlapping of annotation information based on PDMS drawing output
CN106528937A