Method, system and equipment for drawing train number of web version train working diagram and medium
By dividing the web-based train time map into partitions along the vertical axis and using hash table indexes, combined with offset layers to generate candidate regions, the problem of unclear train number display was solved, achieving efficient and clear train number drawing, and adapting to the real-time interaction needs in complex scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 卡斯柯信号(成都)有限公司
- Filing Date
- 2026-01-09
- Publication Date
- 2026-05-05
AI Technical Summary
Existing technologies struggle to clearly display train numbers on web-based train timetables, especially in scenarios with frequent timetable updates and complex environments. Current collision detection methods cause overlapping and obscuring of train numbers, impacting scheduling efficiency and safety.
The drawing area of the web-based train timetable is divided into multiple continuous partitions along the vertical axis. A cache structure associated with the partitions is established, and a hash table is used for fast indexing and collision detection. Non-collision candidate areas are generated through an offset layer for drawing train numbers, and the coordinate information is updated in the cache structure.
It improves the visual clarity of train numbers, reduces computational overhead and memory usage, adapts to real-time interaction requirements, ensures the visual continuity of train numbers and the main body of the train line, reduces misjudgments and omissions, and improves the accuracy and efficiency of the train schedule.
Smart Images

Figure CN121982133A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of web-based train timetable visualization technology, and in particular to a method, system, device, and medium for drawing train numbers in a web-based train timetable. Background Technology
[0002] As the core foundation of railway transportation, the web-based train timetable is crucial for ensuring safe, efficient, and orderly transportation. By scientifically arranging train routes and sequences through the timetable, dispatchers can maximize the utilization of railway line capacity and achieve maximum transportation benefits. The train number, as the core information identifying trains in the timetable, is clearly and unobstructed, and its display directly affects the efficiency and accuracy of dispatching work.
[0003] In the field of web-based train timetable visualization technology, collision detection of graphic elements is a key technology to ensure the correct display of train numbers. Existing technologies mainly employ three common collision detection methods: First, the global traversal method compares all existing graphic elements pairwise to determine overlap. While this method is logically simple, it faces significant performance bottlenecks in practical applications and is difficult to adapt to real-time interactive requirements. Second, quadtrees or spatial partitioning trees recursively divide the drawing area and only detect elements within the same area. This method is more suitable for static or low-frequency update scenarios. In dynamic scenarios like train timetables where graphic elements are frequently moved, added, deleted, or updated, the tree structure needs to be frequently rebuilt or updated, leading to high maintenance costs and complex implementation. Third, the grid-based partitioning method divides the canvas into fixed-size grids to store elements within the area. However, since train numbers consist of letters and numbers with varying lengths, it's difficult to unify the grid granularity, easily resulting in overly sparse or overly dense storage, leading to memory waste or collision detection failure.
[0004] In the prior art, for example, Chinese patent CN121118196A provides a method, device, and medium for annotating beams and slabs. The method includes receiving annotation configuration parameters of a target annotation view; annotating the target annotation view according to the selected annotation update mode and annotation configuration parameters to generate target beam and slab annotations; performing collision detection on the target beam and slab annotations according to avoidance rules and beam and slab priorities to obtain standard beam and slab annotations; and generating drawing annotations for the target annotation view according to the template description family and the cross-sectional dimensions of the beam and slabs to be annotated. However, this is clearly a different application scenario from train time diagrams, making it difficult for those skilled in the art to transfer the technology. The challenge lies in the fact that with the continuous growth in railway passenger and freight demand, the number of operating lines that each dispatcher needs to manage has increased significantly. In addition, the train departure intervals are short, the operating lines on the timetable are densely arranged, and there are also complex situations such as inconsistent train number lengths, the need for real-time additions, deletions and modifications, and different directions of up and down on the operating lines. Existing collision detection technology is difficult to adapt to the special application scenarios of train timetables, which makes it easy for train numbers to overlap and obscure. Dispatchers cannot quickly locate the operating line of the target train, which not only affects the efficiency and accuracy of dispatching work, but may also pose a hidden danger to train operation safety.
[0005] In view of the above, this application is hereby submitted. Summary of the Invention
[0006] This application provides a method, system, device, and medium for drawing train numbers in a web-based train timetable, which solves the technical problem of unclear train number display in existing web-based train timetables and achieves the technical effect of improving the visual clarity of train numbers in web-based train timetables.
[0007] Firstly, this application provides a method for drawing train number diagrams on a web-based train timetable, including: The drawing area of the web-based train timetable is divided into multiple consecutive partitions along the vertical axis, and a cache structure associated with the partitions is established. The cache structure is used to store the train number and the corresponding graphic area coordinate information located in each partition. When it is necessary to draw or update a target train number, the corresponding initial graphic area is determined according to the text attribute of the target train number, and the initial partition associated with the initial graphic area is determined from the partitions based on the vertical coordinate range of the initial graphic area. By indexing the coordinate information of the graphic regions of other train numbers already stored in the initial partition using the cache structure, collision detection is performed on the coordinate information of the initial graphic region and the coordinate information of the graphic regions of other train numbers. If the collision detection result indicates a collision, candidate graphic regions are generated sequentially along the vertical axis in multiple preset offset layers according to the drawing direction of the running line corresponding to the target train number. Collision detection is then performed on the candidate graphic regions sequentially to select a candidate graphic region that has not collided from the multiple candidate graphic regions as the final drawing region. Draw the target train number within the final drawing area, and update and store the target train number and the corresponding coordinate information of the final drawing area into the corresponding partition in the cache structure.
[0008] In some embodiments of this application, based on the foregoing scheme, a cache structure associated with the partition is established, including: A hash table with partition index as the key is established as the cache structure. The value corresponding to each key stores the train number located in the corresponding partition and the coordinate information of the graphic area corresponding to the train number.
[0009] In some embodiments of this application, based on the foregoing solution, when it is necessary to delete the target train number, the method further includes: Remove the target train number and its corresponding graphic area coordinates from all partitions of the cache structure.
[0010] In some embodiments of this application, based on the aforementioned scheme, collision detection is performed on the coordinate information of the initial graphic region and the coordinate information of the graphic regions of other train numbers, including: The rectangle intersection method is used to detect whether the rectangle corresponding to the coordinate information of the initial graphic area intersects with the rectangle corresponding to the coordinate information of the graphic area of other train numbers. A collision is determined to occur when the detection results meet the intersection conditions corresponding to the rectangle intersection method.
[0011] In some embodiments of this application, based on the foregoing scheme, the method for generating candidate graphic regions includes: Determine the offset direction of the initial graphic area based on the drawing direction of the running line corresponding to the target train number; Candidate graphic regions are generated based on the ordinate of the initial graphic region, the current preset offset layer, and the preset offset step.
[0012] In some embodiments of this application, based on the foregoing scheme, candidate graphic regions are generated according to the ordinate of the initial graphic region, the current preset offset layer, and the preset offset step, including: When the drawing direction is upward, the candidate graphic region is offset downward based on the initial graphic region; When the drawing direction is downward, the candidate graphic region is shifted upward based on the initial graphic region.
[0013] In some embodiments of this application, based on the aforementioned scheme, if no candidate graphic region that has not collided is found in all preset offset layers, a candidate graphic region is determined from a preset default offset layer as the final drawing region.
[0014] Secondly, this application provides a web-based train timetable number drawing system for rendering and displaying train timetables on a display page, and applying a web-based train timetable number drawing method as provided in the first aspect during the display process.
[0015] Thirdly, this application provides an electronic device, comprising: processor; Memory used to store processor-executable instructions; The processor is configured to execute a method for drawing train numbers in a web-based train timetable, as provided in the first aspect.
[0016] Fourthly, this application provides a non-transitory computer-readable storage medium that, when the instructions in the storage medium are executed by the processor of an electronic device, enables the electronic device to execute a web-based train timetable number drawing method as provided in the first aspect.
[0017] One or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages: 1. By dividing the drawing area into continuous partitions along the vertical axis, collision detection is performed only in the initial partition associated with the target train number, eliminating the need for global traversal of all train numbers. Combined with a hash table caching structure, fast indexing is achieved, effectively reducing the computational overhead during the detection process. This adapts to the performance requirements of real-time interactive web-based train timetables and significantly improves collision detection efficiency.
[0018] 2. It can flexibly handle complex scenarios such as real-time addition, updating, and deletion of train numbers, inconsistent lengths, and different directions of operation lines. When deleting a train number, the corresponding information in the cache can be removed simultaneously. When updating, the old data is cleared before storing the new information to avoid interference from residual old data and ensure that the cache structure is always consistent with the actual drawing of the operation diagram.
[0019] 3. When a collision occurs, the offset direction is determined based on the drawing direction of the running line. Candidate graphic areas are generated sequentially through preset offset layers and offset steps. At the same time, the visual continuity between the train number and the main body of the running line is ensured. Even if there is a collision in all offset layers, the drawing can be completed through the default offset layer, which solves the problem of overlapping and occlusion of train numbers and improves the visualization clarity of the running map.
[0020] 4. A hash table with partition index as the key is used as the cache structure. It only stores the current visible train number and the corresponding graphic area coordinate information. There is no long-term accumulated invalid data. After deleting the train number, the empty partition can be released to avoid memory waste. The overall structure is lightweight, with reasonable resource consumption and low maintenance cost, and it is easy to implement in engineering.
[0021] 5. The rectangular intersection method is used to determine the collision of the graphic area corresponding to the train number. This method determines whether there is an intersection through clear coordinate comparison rules. Combined with the local focusing characteristics of partitioned detection, it reduces false judgments and false omissions, provides a reliable basis for the accurate execution of subsequent avoidance strategies, and ensures the accuracy of the presentation of the operation diagram information. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 A flowchart illustrating a method for drawing train numbers in a web-based train timetable, as provided in this application embodiment; Figure 2 This is a schematic diagram of the partitioning provided in an embodiment of this application; Figure 3 This is a partial schematic diagram of a train timetable before applying the web-based train timetable number drawing method provided in the embodiments of this application; Figure 4 This is a partial schematic diagram of a train timetable after applying the method for drawing train numbers in a web-based train timetable provided in the embodiments of this application; Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0024] This application provides a method, system, device, and medium for drawing train numbers in a web-based train timetable, which solves the technical problem of unclear train number display in existing train timetables.
[0025] To better understand the above technical solutions, the following will provide a detailed explanation of the technical solutions in conjunction with the accompanying drawings and specific implementation methods.
[0026] Example 1 This application provides embodiments such as Figure 1 The method for drawing train numbers in a web-based train timetable includes steps S1-S5.
[0027] Step S1: Divide the drawing area of the web-based train time map into multiple consecutive partitions along the vertical axis, and establish a cache structure associated with the partitions. The cache structure is used to store the train number and the corresponding graphic area coordinate information located in each partition. Step S2: When it is necessary to draw or update a target train number, determine the corresponding initial graphic area based on the text attribute of the target train number, and determine the initial partition associated with the initial graphic area from the partitions based on the vertical coordinate range of the initial graphic area. Step S3: By indexing the coordinate information of the graphic regions of other train numbers already stored in the initial partition using the cache structure, collision detection is performed between the coordinate information of the initial graphic region and the coordinate information of the graphic regions of other train numbers. Step S4: If the collision detection result indicates a collision has occurred, candidate graphic regions are generated sequentially along the vertical axis in multiple preset offset layers according to the drawing direction of the running line corresponding to the target train number. Collision detection is then performed on the candidate graphic regions sequentially to select a candidate graphic region that has not collided from the multiple candidate graphic regions as the final drawing region. Step S5: Draw the target train number in the final drawing area, and update and store the target train number and the corresponding coordinate information of the final drawing area in the corresponding partition of the cache structure.
[0028] Regarding step S1, the drawing area of the web-based train timetable is divided into multiple consecutive partitions along the vertical axis, and a cache structure associated with the partitions is established. The cache structure is used to store the train number and the corresponding graphic area coordinate information located in each partition.
[0029] Train timetables graphically display key information such as train routes, departure and arrival times, and track occupancy. The drawing area typically refers to the visible space of the web-based train timetable displayed in a browser, serving as the medium for drawing graphic elements such as train lines and train numbers. It should be noted that the web-based train timetable provided in this application runs in a browser environment. Due to browser performance and memory limitations, web-based train timetables struggle to handle the high computational overhead of global traversal and complex tree structure maintenance. This application addresses this by partitioning the collision detection range to a local area and combining it with a lightweight hash table caching structure, significantly reducing computational load and memory consumption, thus preventing browser lag. Furthermore, the web version needs to support real-time interaction across multiple terminals and dynamic addition, deletion, and modification of train numbers. Subsequent steps in this application can flexibly adapt to these requirements without relying on local hardware extensions. Efficient and clear train number drawing can be achieved solely through a browser, perfectly matching the convenient, lightweight, and highly real-time application characteristics of web-based timetables.
[0030] Train number is a text label used to uniquely identify a train. It is usually composed of letters (representing train type, direction of travel, etc.) and numbers (representing specific train numbers). The length of train number may vary between different trains and is bound to a specific operating line.
[0031] Partitioning is the process of dividing the drawing area along the vertical axis (Y-axis) into continuous and non-overlapping intervals according to a preset granularity. Each partition corresponds to a unique partition index in the cache structure, which reduces the global collision detection range to a local interval and reduces the amount of detection computation. The preset granularity of partitioning can be flexibly adjusted according to the balance between performance and detection accuracy.
[0032] In step S1, a cache structure associated with the partition is established, including: establishing a hash table with the partition index as the key as the cache structure, where each key corresponds to a value storing the train number located within the corresponding partition and the coordinate information of the graphic area corresponding to the train number. In the cache structure of this application, the key of the hash table is the partition index, i.e., the unique identifier corresponding to each partition, used for quickly locating the target partition. The value is a set of train number-related information stored within the corresponding partition, specifically including the unique identifier of the train number (generated from the unique identifier of the running line and the original coordinates of the train number) and the coordinate information of the graphic area corresponding to the train number, realizing accurate association and fast query between partition and train number information.
[0033] For example, based on the visualization requirements and performance expectations of the web-based train timetable, a reasonable granularity for the vertical axis partitioning is set (smaller granularity results in more accurate detection but higher resource consumption, while larger granularity offers better performance but slightly lower accuracy). The drawing area is then evenly divided into multiple consecutive partitions along the vertical axis according to this granularity. A hash table is established as a cache structure, using the partition index as the key and the relevant information set for the train number within the corresponding partition as the value. The specific storage format of the value is a mapping relationship between the unique identifier of the train number and the coordinate information of the graphic area for that train number. This ensures that the train number information within each partition can be quickly queried through the partition index. Simultaneously, this cache structure supports dynamic maintenance, providing data storage support for subsequent addition, deletion, and update operations of train numbers.
[0034] Regarding step S2, when it is necessary to draw or update a target train number, the corresponding initial graphic area is determined according to the text attribute of the target train number, and the initial partition associated with the initial graphic area is determined from the partitions based on the vertical coordinate range of the initial graphic area.
[0035] Drawing refers to the initial presentation of a new train number on the train timetable, which requires determining the initial graphic area based on its text attributes and completing the visualization. Updating refers to the operation of recalculating the graphic area, performing collision detection, and re-presenting the train number when its text attributes, associated operating line information, or display position change. Text attributes mainly include font type, font size, and text length, which directly affect the width and height of the rectangular graphic area corresponding to the train number.
[0036] Specifically, based on the range of the ordinates of the initial graphic region, the initial partitions associated with the initial graphic region are determined from the partitions. For example, the initial partitions associated with the top and bottom of the initial graphic region can be determined using the ordinates and height of the initial graphic region, using the following formula:
[0037]
[0038] in, This indicates the initial partition associated with the top of the initial graphics area within the partition. This indicates the initial partition associated with the bottom of the initial graphic area within the partition. Represents the ordinate of the initial graphic region. This indicates the partition granularity set in step S1. Represents the height of the initial graphic area.
[0039] In cases where it is necessary to delete the target train number, the method also includes: removing the target train number and the corresponding graphic area coordinate information from all partitions of the cache structure.
[0040] For example, determining whether the operation type is drawing or updating: If it's a drawing operation to add a train number, a unique identifier needs to be generated based on the unique identifier of the operating line to which the train number belongs and its original coordinates, and the old information corresponding to this identifier in the cache structure (if it exists) needs to be cleared. If it's an update operation, the old graphic region coordinates and index relationships of the train number before the update need to be removed from all partitions of the cache structure (if the corresponding partition is empty, the partition is released). Subsequently, based on the text attributes of the target train number (font type, font size, text length, etc.), the coordinates (including vertex coordinates) and dimensions (width and height) of the rectangular initial graphic region corresponding to the train number are calculated. Based on the ordinates of the initial graphic region (top and bottom ordinates), combined with the partition granularity set in step S1, the maximum partition index corresponding to the top and the minimum partition index corresponding to the bottom of the initial graphic region are calculated. The partitions corresponding to these indices are the initial partitions associated with the initial graphic region (an initial graphic region may span multiple partitions), thereby limiting the query scope of collision detection to these initial partitions and avoiding full image traversal. For example, refer to... Figure 2 Rectangle A is associated with partitions B1 and B2, rectangle B is associated with partitions B2 and B3, and rectangle C is associated with partition B4.
[0041] Regarding step S3, the coordinate information of the graphic area of other train numbers stored in the initial partition is indexed by the cache structure, and collision detection is performed between the coordinate information of the initial graphic area and the coordinate information of the graphic area of other train numbers.
[0042] The process of collision detection of the coordinate information of the initial graphic area with the coordinate information of the graphic areas of other train numbers includes: detecting whether the rectangle corresponding to the coordinate information of the initial graphic area intersects with the rectangle corresponding to the coordinate information of the graphic areas of other train numbers using the rectangle intersection method; and determining that a collision has occurred when the detection result meets the intersection condition corresponding to the rectangle intersection method.
[0043] The rectangle intersection method refers to the intersection judgment rule of axis-aligned bounding boxes (AABB). It judges the intersection based on the boundary relationship of two rectangles in both the horizontal (x-axis) and vertical (y-axis) directions, quickly determining whether they intersect by comparing coordinates. Specifically, in the horizontal direction, the left boundary coordinate of the first rectangle is less than the right boundary coordinate of the second rectangle, and the right boundary coordinate of the first rectangle is greater than the left boundary coordinate of the second rectangle; in the vertical direction, the top boundary coordinate of the first rectangle is less than the bottom boundary coordinate of the second rectangle, and the bottom boundary coordinate of the first rectangle is greater than the top boundary coordinate of the second rectangle. If any of these four conditions are met, a collision is detected; otherwise, no collision is detected. For example, the following formula can be used:
[0044]
[0045]
[0046]
[0047] in, The rectangle corresponding to the coordinate information of the initial graphic area. Represents the x-coordinate of the initial graphic region. Represents the ordinate of the initial graphic region. Indicates the height of the initial graphic area; The rectangles corresponding to the coordinate information of the graphic areas for other train numbers. This represents the width of the rectangle. This represents the height of the rectangle. This represents the x-coordinate of the rectangle. This represents the ordinate of the rectangle.
[0048] For example, the initial partition determined in step S2 is quickly located using the partition index of the cache structure, and the coordinate information of the graphic areas corresponding to all other train numbers stored in that partition is directly obtained. Then, using a rectangle intersection judgment rule, the coordinates of the initial graphic area of the target train number are compared one by one with the obtained coordinate information to determine whether they meet the intersection conditions in the horizontal and vertical directions. If the graphic area of any other train number meets the intersection condition with the initial graphic area, a collision is determined; if all comparison results do not meet the intersection condition, no collision is determined, and the initial graphic area can be directly used as the final drawing area.
[0049] Continue to refer to Figure 2 The green rectangle B represents the rectangle corresponding to the initial graphic area, and its associated partitions are B2 and B3. Through the partition index of the cache structure, it can be seen that partition B3 has no associated train numbers, while partition B2 has associated train numbers. Figure 2 In the image, yellow rectangle A represents the rectangle corresponding to the coordinate information of other train numbers in the graphic area. By detecting the coordinate information of rectangle A and rectangle B using the rectangle intersection method, a collision can be determined.
[0050] Regarding step S4, if the collision detection result indicates a collision has occurred, candidate graphic regions are generated sequentially along the vertical axis in multiple preset offset layers according to the drawing direction of the running line corresponding to the target train number. Collision detection is then performed on the candidate graphic regions sequentially to select a candidate graphic region that has not collided from the multiple candidate graphic regions as the final drawing region.
[0051] Candidate graphic regions are alternative drawing areas generated to avoid collisions with the initial graphic region. Their shapes are identical to the initial graphic region (both are rectangles), with only the vertical coordinate position adjusted according to offset rules. Each candidate graphic region corresponds to a preset offset layer. By sequentially detecting the collision situation of each candidate region, the optimal drawing position without collision can be selected. The method for generating candidate graphic regions includes steps S41-S42.
[0052] Step S41: Determine the offset direction of the initial graphic area based on the drawing direction of the running line corresponding to the target train number; Step S42: Generate candidate graphic regions based on the ordinate of the initial graphic region, the current preset offset layer, and the preset offset step.
[0053] The direction of the train operation line is a drawing rule set by the web version of the train time map to distinguish the direction of train operation. It is mainly divided into two categories: the up direction and the down direction (the specific direction can be determined in conjunction with the railway line planning standards, such as from the branch line to the main line, from south to north, etc., which are the up direction, and vice versa).
[0054] The offset direction is the direction in which the vertical coordinate position of the train number is adjusted when it needs to avoid a collision, and it is uniquely determined by the drawing direction of the train line. When the train line is moving upwards, the offset direction is downwards (the vertical coordinate value increases); when the train line is moving downwards, the offset direction is upwards (the vertical coordinate value decreases). In other words, when the drawing direction is upwards, the candidate graphic area is offset downwards based on the initial graphic area; when the drawing direction is downwards, the candidate graphic area is offset upwards based on the initial graphic area.
[0055] Offset layers are a preset sequence of avoidance layers, representing the maximum number of avoidance adjustments that can be made. Their number is set based on the need to avoid overlapping with other elements on the running line, and is not unlimited. Offset step distance is the ordinate distance between two adjacent offset layers. Its value is set based on the font height of the train number. Too small a step distance may result in overlap after avoidance, while too large a step distance will waste drawing space. A balance must be struck between avoidance effectiveness and space utilization.
[0056] For example, probing layer by layer from top to bottom, if no collision is detected at a certain layer, the process immediately returns to that layer, calculating the direction based on the running line. coordinate offset :
[0057] Where N is the number of offset layers, When the offset step is set for each layer and the running line is drawn in the upward direction, Pick Offset A positive number indicates that the coordinates for drawing the train number should be shifted downwards; when the line of travel is drawn in the downward direction, Pick Offset A negative number indicates that the coordinates for drawing the train number should be shifted upwards.
[0058] For example, when a collision is determined in step S3, the corresponding offset direction (downward or upward) is determined based on the drawing direction (upward or downward) of the operating line to which the target train number belongs. Then, according to the preset offset layer sequence and offset step size, starting from the first offset layer, the candidate graphic region corresponding to each offset layer is calculated sequentially: using the coordinates of the initial graphic region as a reference, the vertical coordinate offset is calculated based on the current offset layer number and offset step size, and the vertical coordinate position of the initial graphic region is adjusted along the determined offset direction to generate a candidate graphic region (with the same width and height as the initial graphic region). Afterward, for each candidate graphic region, its corresponding associated partition is determined, and the coordinate information of other train numbers within that partition is indexed through a cache structure and collision detection is performed. If the detection result for a candidate graphic region is no collision, it is determined as the final drawing region.
[0059] If no collision-free candidate graphic region is found in all preset offset layers, a candidate graphic region is selected from a preset default offset layer as the final drawing region. In other words, if collisions are detected in all candidate graphic regions, a candidate graphic region is selected from the preset default offset layers (usually the first two layers) as the final drawing region to ensure that the train number can be displayed correctly.
[0060] Regarding step S5, the target train number is drawn within the final drawing area, and the coordinate information of the target train number and the corresponding final drawing area is updated and stored in the corresponding partition of the cache structure.
[0061] For example, within the final drawing area determined in step S4, the target train number is visualized. During the drawing process, it must be ensured that the train number maintains visual continuity with the main body of its operating line, so as not to affect the dispatcher's identification of the relationship between the operating line and the train number. Subsequently, the cache structure is updated: if the target train number is added or updated, all the partitions it spans must be determined based on the vertical coordinate range of the final drawing area. The unique identifier of the train number and the coordinate information of the final drawing area are then stored in the value set of the corresponding partition in the cache structure (hash table). That is, if it is an addition operation, an index relationship is directly added; if it is an update operation, the original old data is overwritten. The entire update process ensures that the partition, train number, and coordinate information stored in the cache structure are completely consistent with the actual drawing of the current train timetable, with no old data residue.
[0062] Example 2 Based on the same inventive concept, this application also provides a web-based train timetable number drawing system, which is used to render and display train timetables on a display page, and applies the aforementioned web-based train timetable number drawing method during the display process.
[0063] like Figure 3 and Figure 4 As shown, Figure 3 This is a partial schematic diagram of a train timetable before applying the web-based train timetable number drawing method provided in the embodiments of this application. Figure 4 This is a partial schematic diagram of a train timetable after applying the method for drawing train numbers in a web-based train timetable provided in the embodiments of this application. As can be seen, Figure 3 The train numbers displayed have a large number of overlaps, and Figure 4 The train numbers are clearly and orderly.
[0064] Example 3 Based on the same inventive concept, embodiments of this application also provide, as follows: Figure 5 An electronic device shown includes: Processor 51; Memory 52 is used to store executable instructions of processor 51; The processor 51 is configured to execute a method for drawing train numbers in a web-based train timetable, as described above.
[0065] Example 4 Based on the same inventive concept, this application also provides a non-transitory computer-readable storage medium, which, when the instructions in the storage medium are executed by the processor 51 of the electronic device, enables the electronic device to execute a web-based train timetable number drawing method as described above.
[0066] Since the electronic device described in this embodiment is an electronic device used to implement the information processing method in the embodiments of this application, those skilled in the art can understand the specific implementation methods and various variations of the electronic device in this embodiment based on the information processing method described in the embodiments of this application. Therefore, how the electronic device implements the method in the embodiments of this application will not be described in detail here. Any electronic device used by those skilled in the art to implement the information processing method in the embodiments of this application falls within the scope of protection of this application.
[0067] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0068] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0069] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0070] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0071] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.
[0072] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A method for drawing train number diagrams on a web-based train timetable, characterized in that, include: The drawing area of the web-based train timetable is divided into multiple consecutive partitions along the vertical axis, and a cache structure associated with the partitions is established. The cache structure is used to store the train number and the corresponding graphic area coordinate information located in each partition. When it is necessary to draw or update a target train number, the corresponding initial graphic area is determined according to the text attribute of the target train number, and the initial partition associated with the initial graphic area is determined from the partitions based on the vertical coordinate range of the initial graphic area. The coordinate information of the graphic area of other train numbers stored in the initial partition is indexed by the cache structure, and the coordinate information of the initial graphic area is used to perform collision detection with the coordinate information of the graphic area of other train numbers. If the collision detection result indicates a collision, candidate graphic regions are generated sequentially along the vertical axis in multiple preset offset layers according to the drawing direction of the running line corresponding to the target train number. Collision detection is then performed on the candidate graphic regions sequentially to select a candidate graphic region that has not collided from the multiple candidate graphic regions as the final drawing region. The target train number is drawn within the final drawing area, and the coordinate information of the target train number and the corresponding final drawing area is updated and stored in the corresponding partition of the cache structure.
2. The method for drawing train number diagrams in a web-based train timetable as described in claim 1, characterized in that, The establishment of the cache structure associated with the partition includes: A hash table with partition index as the key is established as the cache structure. The value corresponding to each key stores the train number located in the corresponding partition and the coordinate information of the graphic area corresponding to the train number.
3. The method for drawing train numbers in a web-based train timetable as described in claim 1, characterized in that, When it is necessary to delete the target train number, the method further includes: Remove the target train number and its corresponding graphic area coordinates from all partitions of the cache structure.
4. The method for drawing train number diagrams in a web-based train timetable as described in claim 1, characterized in that, The step of performing collision detection on the coordinate information of the initial graphic region and the coordinate information of the graphic regions of other train numbers includes: The rectangle intersection method is used to detect whether the rectangle corresponding to the coordinate information of the initial graphic area intersects with the rectangle corresponding to the coordinate information of the graphic area of other train numbers. A collision is determined to occur when the detection results meet the intersection conditions corresponding to the rectangle intersection method.
5. The method for drawing train number diagrams in a web-based train timetable as described in claim 1, characterized in that, The method for generating the candidate graphic region includes: Determine the offset direction of the initial graphic area based on the drawing direction of the running line corresponding to the target train number; Candidate graphic regions are generated based on the ordinate of the initial graphic region, the current preset offset layer, and the preset offset step.
6. The method for drawing train number in a web-based train timetable according to claim 5, characterized in that, The step of generating candidate graphic regions based on the ordinate of the initial graphic region, the current preset offset layer, and the preset offset step includes: When the drawing direction is upward, the candidate graphic region is offset downward based on the initial graphic region; When the drawing direction is downward, the candidate graphic region is shifted upward based on the initial graphic region.
7. The method for drawing train number diagrams in a web-based train timetable as described in claim 1, characterized in that, If no non-collision candidate graphic region is found in all preset offset layers, a candidate graphic region is determined from a preset default offset layer as the final drawing region.
8. A web-based train timetable train number drawing system, characterized in that, This method is used to render and display train timetables on a display page, and applies the train number drawing method for web-based train timetables as described in any one of claims 1 to 7 during the display process.
9. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute a method for drawing train numbers in a web-based train timetable as described in any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium, characterized in that, When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is able to execute a method for drawing train numbers in a web-based train timetable as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Method and device for marking beam plate and medium
CN121118196A