Map information card drawing methods, electronic devices and software products
By pre-drawing and force-directed simulation of map information cards, the problem of spatial overlap of map information cards in non-interactive scenarios is solved, realizing automated layout optimization and improving the accuracy of geospatial data expression and the readability of the layout.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- KE COM (BEIJING) TECHNOLOGY CO LTD
- Filing Date
- 2026-04-28
- Publication Date
- 2026-07-31
AI Technical Summary
In non-interactive scenarios, spatial overlap conflicts between map information cards are difficult to resolve automatically, affecting the accuracy of geospatial data representation and the readability of the layout.
By pre-drawing the map information card, determining its initial center point coordinates and size information in the screen coordinate system, and mapping it to nodes, force-guided simulation is used to make the nodes repel each other to achieve uniform spatial distribution. Finally, the target position of the node is used as the center point coordinate of the map information card for drawing.
Without requiring user interaction, it automatically resolves spatial conflicts between map information cards and outputs a visually coherent and unobstructed layout, improving the accuracy of geospatial data representation and the readability of the layout.
Smart Images

Figure CN122492887A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to a method for drawing map information cards, an electronic device, and a program product. Background Technology
[0002] In geographic information visualization systems, it is often necessary to draw multiple information cards (such as real estate information tags, competitor comparison icons, etc.) on a geographic base map. When there are a large number of information cards, spatial overlap and visual interference are common problems. Current technical solutions typically use map hierarchy partitioning and element spatial clustering algorithms to present information cards. The above methods alleviate the overlap phenomenon by dynamically adjusting the map zoom level or aggregating adjacent spatial points. Users need to use drag, zoom, and other operations to explore obscured details.
[0003] However, in static scenarios such as poster generation and report presentation, users cannot resolve overlaps through interactive operations, causing information cards to obscure each other, reducing the accuracy of geospatial data representation and the readability of the layout. Summary of the Invention
[0004] This disclosure provides a method for drawing map information cards, an electronic device, and a program product.
[0005] According to one aspect of this disclosure, a method for drawing map information cards is provided, comprising: Based on the latitude and longitude of each map information card and the custom display information, each map information card is pre-drawn on the geographic base map, and based on the pre-drawing results, the initial center point coordinates and size information of each map information card in the screen coordinate system are determined. Each of the map information cards is mapped to a node, the initial position of the node is the initial center point coordinate of the corresponding map information card, and the radius of the node is determined based on the size information of the corresponding map information card. Based on the initial position and radius of each node, force-guided simulation is performed on multiple nodes to make the nodes repel each other, thereby obtaining the target position of each node; The target location of each node is used as the target center point coordinate of the corresponding map information card, and the corresponding map information card is drawn on the geographic base map according to the target center point coordinate.
[0006] According to one technical solution, by pre-drawing the map information cards, the initial center point coordinates and size information of each map information card in the screen coordinate system are determined, and each map information card is mapped to a node with a corresponding radius, accurately restoring the actual spatial position of each map information card in the screen coordinate system, and providing accurate geometric parameters for subsequent force-directed simulation.
[0007] Next, based on the initial position and radius of each node, force-directed simulation is performed on multiple nodes to induce mutual repulsion between them, achieving a uniform spatial distribution. This allows for the automatic and efficient resolution of spatial conflicts between map information cards without relying on user interaction. The target positions of each node obtained from the force-directed simulation are used as the target center point coordinates of the corresponding map information card and drawn on the geographic base map. This enables the output of a well-coordinated and non-obstructing visual composition in non-interactive scenarios, completely avoiding map information card occlusion and improving the accuracy of geospatial data representation and layout readability.
[0008] According to at least one embodiment of the map information card drawing method of this disclosure, the force-directed simulation includes multiple iterations until each node reaches a force equilibrium state, wherein in each iteration, the center distance between any two nodes is determined based on the current position of each node, the simulated repulsive force and collision force between the any two nodes are determined based on the center distance, the nodes are driven to move based on the simulated repulsive force or collision force experienced by each node, and the current position of each node is updated.
[0009] According to the technical solution of this embodiment, by simulating the synergistic mechanism of repulsive force and collision force, the simulated repulsive force is responsible for dispersing dense nodes in the global range to achieve uniform distribution, while the collision force provides strong repulsive intervention in the micro-overlapping area. The combination of the two can efficiently and automatically solve the spatial conflict between complex geographical cover.
[0010] According to at least one embodiment of the map information card drawing method of this disclosure, determining the simulated repulsive force between any two nodes based on the center distance includes: Based on the preset target repulsion force intensity and the center distance between any two nodes, the magnitude of the simulated repulsion force between any two nodes is determined. The magnitude of the simulated repulsion force is negatively correlated with the center distance. The direction of the simulated repulsion force on each node in any two nodes is along the line connecting their centers away from the other node, thereby achieving mutual repulsion between the nodes.
[0011] According to the technical solution of this embodiment, by introducing simulated repulsive force, the nodes can be evenly distributed globally.
[0012] A map information card drawing method according to at least one embodiment of the present disclosure, which determines the collision force between any two nodes based on the center distance, includes: When the center distance is less than the sum of the radii of any two nodes, the overlap between any two nodes is determined based on the center distance and the sum of the radii. The magnitude of the collision force between any two nodes is determined based on the preset target collision force intensity and the overlap. The magnitude of the collision force is positively correlated with the overlap. The direction of the collision force on each of the two nodes is along the line connecting their centers away from the other node.
[0013] According to the technical solution of this embodiment, by introducing collision force, a strong local repulsive effect can be generated to forcefully separate the overlapping areas of nodes, thereby completely eliminating the geometric overlap between nodes.
[0014] A method for drawing map information cards according to at least one embodiment of the present disclosure, wherein the nodes are driven to move based on simulated repulsive or collision forces acting on each node, includes: For each node, the magnitude and direction of the simulated repulsive force and collision force acting on the node are vector-superimposed to determine the magnitude and direction of the resultant force acting on the node. The node's moving speed is updated based on the magnitude of the resultant force acting on it, and the node is driven to move along the direction of the resultant force based on the updated moving speed. During the node's movement, the moving speed of the node continuously decreases according to the target speed decay rate.
[0015] According to the technical solution of this embodiment, all simulated repulsive and collision forces on the node are combined into a resultant force by vector superposition, which accurately reflects the comprehensive force situation of the node, provides a correct physical basis for subsequent velocity updates, and avoids motion distortion that may be caused by processing each force separately.
[0016] According to the map information card drawing method of at least one embodiment of the present disclosure, the force-directed simulation further includes: After each iteration, the current energy value is updated based on the initial energy value, the energy decay rate, and the current iteration number. When the updated current energy value is less than the energy convergence threshold, it is determined that each node has reached a force balance state, the iteration stops, and the current position of each node is determined as the target position.
[0017] According to the technical solution of this embodiment, by introducing an energy decay mechanism and an energy convergence threshold determination, a controllable automatic termination condition is provided for force-directed simulation, avoiding the problem of suboptimal node layout caused by infinite iteration or premature termination.
[0018] According to at least one embodiment of the map information card drawing method of this disclosure, after updating the current position of each node, the map information card drawing method further includes: Detect whether the current position of each node exceeds the target canvas boundary, which is determined based on the width, height and inner margin of the target canvas; If the current position of the node exceeds the target canvas boundary, the current position of the node is corrected to the target canvas boundary.
[0019] According to the technical solution of this embodiment, nodes are effectively prevented from drifting infinitely or leaving the effective visible area under the action of physical forces (such as simulated repulsive force and collision force), thus ensuring the integrity and layout standardization of geographic information visualization when outputting statically.
[0020] According to at least one embodiment of the map information card drawing method of this disclosure, correcting the current position of the node to the boundary of the target canvas includes: If the x-coordinate of the current position of the node exceeds the left or right boundary value of the target canvas, the x-coordinate of the current position of the node is updated to the corresponding left or right boundary value; if the y-coordinate of the current position of the node exceeds the upper or lower boundary value of the target canvas, the y-coordinate of the current position of the node is updated to the corresponding upper or lower boundary value.
[0021] According to the technical solution of this embodiment, by detecting and correcting the horizontal and vertical coordinates of the current position of the node respectively, a precise rectangular boundary constraint is achieved, ensuring that the node is always restricted within the effective area of the canvas (i.e., the target canvas boundary), thus avoiding the problem that the map information card cannot be displayed due to moving out of the visible range.
[0022] A method for drawing map information cards according to at least one embodiment of this disclosure, comprising drawing the corresponding map information card on the geographic base map according to the coordinates of the target center point, including: For each map information card, based on the target center point coordinates and size information of the map information card, determine the anchor point coordinates of multiple candidate anchor points at the edge of the map information card; Based on the distance between the source point coordinates of the source point that needs to establish a connection with the map information card and the anchor point coordinates of each of the candidate anchor points, the target anchor point is determined from the multiple candidate anchor points. The map information card is drawn on the geographic base map according to the coordinates of the target center point, and a connecting line connecting the source point and the map information card is generated on the geographic base map with the source point coordinates as the starting point and the target anchor point coordinates as the ending point.
[0023] According to the technical solution of this embodiment, by determining multiple candidate anchor points at the edge of the map information card and performing dynamic matching based on the shortest path principle, the candidate anchor point with the closest spatial distance can be automatically selected as the connection endpoint, i.e., the target anchor point. This effectively avoids the problem of connecting lines crossing the main body of the map information card, generating long broken lines, or intersecting with other elements, and significantly improves the geometric rationality and visual simplicity of the connection layout.
[0024] A map information card drawing method according to at least one embodiment of the present disclosure, comprising generating a connecting line on the geographic base map connecting the source point and the map information card, with the source point coordinates as the starting point and the target anchor point coordinates as the ending point, including: The anchor point coordinates of the target anchor point are compared with the target center point coordinates of the corresponding map information card to determine the anchor point type of the target anchor point. The anchor point type includes top anchor point, bottom anchor point, left anchor point, or right anchor point. The tangent direction of the connecting line at the target anchor point is determined based on the anchor point type of the target anchor point. Based on the tangent direction, with the source point coordinates as the starting point and the target anchor point coordinates as the ending point, a connecting line is generated on the geographic base map to connect the source point and the map information card.
[0025] According to the technical solution of this embodiment, the tangent direction of the connecting line at its endpoint is adaptively determined according to the anchor point type of the target anchor point, so that the connecting line is naturally perpendicular to the edge when it approaches the edge of the map information card, avoiding the visual abruptness caused by the connecting line being inserted into the card at an angle.
[0026] According to another aspect of this disclosure, an electronic device is provided, comprising: a memory storing execution instructions; and a processor executing the execution instructions stored in the memory, causing the processor to perform a map information card drawing method according to any embodiment of this disclosure.
[0027] According to another aspect of this disclosure, a readable storage medium is provided, wherein the readable storage medium stores execution instructions, which, when executed by a processor, are used to implement a map information card drawing method according to any embodiment of this disclosure.
[0028] According to another aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements a method for drawing map information cards according to any embodiment of this disclosure. Attached Figure Description
[0029] The accompanying drawings illustrate exemplary embodiments of the present disclosure and, together with the description thereof, serve to explain the principles of the present disclosure. These drawings are included to provide a further understanding of the present disclosure and are incorporated in and constitute a part of this specification.
[0030] Figure 1 This is a flowchart illustrating a method for drawing map information cards according to one embodiment of the present disclosure.
[0031] Figure 2 This is a schematic diagram of the process of driving node movement in a map information card drawing method according to one embodiment of the present disclosure.
[0032] Figure 3 This is a schematic flowchart of the energy value detection process in a map information card drawing method according to one embodiment of the present disclosure.
[0033] Figure 4 This is a flowchart illustrating the process of detecting whether a node exceeds the target canvas boundary in a map information card drawing method according to one embodiment of the present disclosure.
[0034] Figure 5 This is a schematic diagram of the target anchor point matching process in a map information card drawing method according to one embodiment of the present disclosure.
[0035] Figure 6 This is a flowchart illustrating the process of determining the tangent direction in a map information card drawing method according to one embodiment of the present disclosure.
[0036] Figure 7 This is a flowchart illustrating a method for drawing map information cards according to another embodiment of the present disclosure.
[0037] Figure 8 This is a schematic diagram illustrating the drawing effect of a map information card drawing method according to one embodiment of the present disclosure.
[0038] Figure 9 This is a schematic structural block diagram of a map information card drawing apparatus according to one embodiment of the present disclosure.
[0039] Figure 10 This is a schematic structural block diagram of an electronic device according to one embodiment of the present disclosure. Detailed Implementation
[0040] The present disclosure will now be described in further detail with reference to the accompanying drawings and examples. It should be understood that the specific examples described herein are for illustrative purposes only and are not intended to limit the scope of the disclosure. Furthermore, it should be noted that, for ease of description, only the parts relevant to the present disclosure are shown in the accompanying drawings.
[0041] It should be noted that, where there is no conflict, the embodiments and features described in this disclosure can be combined with each other. The technical solutions of this disclosure will now be described in detail with reference to the accompanying drawings and embodiments.
[0042] Existing technologies struggle to automatically resolve spatial overlap conflicts between map information cards in non-interactive scenarios, impacting the accuracy of geospatial data representation and the readability of the layout.
[0043] To this end, the present disclosure proposes the following technical solution, wherein the initial center point coordinates and size information of each map information card in the screen coordinate system are determined by pre-drawing the map information cards, and each map information card is mapped to a node with a corresponding radius, so as to accurately restore the actual spatial position of each map information card in the screen coordinate system and provide accurate geometric parameters for subsequent force-directed simulation.
[0044] Next, based on the initial position and radius of each node, force-directed simulation is performed on multiple nodes to induce mutual repulsion between them, achieving a uniform spatial distribution. This allows for the automatic and efficient resolution of spatial conflicts between map information cards without relying on user interaction. The target positions of each node obtained from the force-directed simulation are used as the target center point coordinates of the corresponding map information card and drawn on the geographic base map. This enables the output of a well-coordinated and non-obstructing visual composition in non-interactive scenarios, completely avoiding map information card occlusion and improving the accuracy of geospatial data representation and layout readability.
[0045] Figure 1 This is a flowchart illustrating a method for drawing a map information card according to one embodiment of the present disclosure. This method for drawing a map information card can be applied to a terminal device or a server, wherein the terminal device includes, but is not limited to, one or more electronic devices such as smartphones, tablets, laptops, and desktop computers.
[0046] like Figure 1 As shown, the method for drawing the map information card preferably includes steps S110 to S140.
[0047] In step S110, each map information card is pre-drawn on the geographic base map according to the latitude and longitude of each map information card and the custom display information. Based on the pre-drawing results, the initial center point coordinates and size information of each map information card in the screen coordinate system are determined.
[0048] The geographic base map is a digital map layer that provides basic spatial reference, including but not limited to geographic elements such as administrative divisions, road networks, and building outlines.
[0049] In this implementation, the relevant data of all map information cards to be drawn are obtained from the local cache space or third-party storage space, including the latitude and longitude corresponding to the map information cards and the custom display information to be displayed (i.e., custom added card content, such as building name, price, tags, etc.).
[0050] To determine the actual location of map information cards on the geographic base map, a pre-drawing operation is performed at the corresponding location on the geographic base map based on the latitude and longitude of the map information card and its custom display information. During pre-drawing, the latitude and longitude of the map information card are converted to pixel coordinates in the screen coordinate system, which become the initial center point coordinates of the map information card. Then, the map information card is rendered according to its custom display information. Next, the HTML element corresponding to each map information card is accessed through the Document Object Model (DOM) interface, and its Cascading Style Sheets (CSS) properties are read to extract the width and height of the rendered map information card as its size information.
[0051] It should be understood that at this stage, the map information cards will appear naturally superimposed or staggered due to the lack of spatial conflict optimization. Through pre-drawing and coordinate transformation mechanisms, the actual spatial position and pixel-level boundaries of the map information cards in the actual screen rendering environment can be accurately restored.
[0052] In step S120, each of the map information cards is mapped to a node, the initial position of the node is the initial center point coordinate of the corresponding map information card, and the radius of the node is determined based on the size information of the corresponding map information card.
[0053] In this implementation, a corresponding node object is created for each map information card. The initial position of the node is directly assigned to the initial center point coordinates of the map information card, so that the position of the node at the start of the subsequent force-guided simulation is consistent with the original position of the map information card on the geographic base map.
[0054] Next, the radius of the node is determined based on the size information of the map information card. Preferably, the radius is half of the larger of the width and height of the map information card. This ensures that the node completely contains the map information card, guaranteeing that in subsequent force-directed simulation iterations, physical repulsion in any direction can effectively cover the actual visual outline of the map information card, fundamentally avoiding the problem of missed detection of local overlap caused by differences in aspect ratio or rotation.
[0055] In step S130, force-guided simulation is performed on the multiple nodes according to their initial positions and radii, so that the nodes repel each other, and the target positions of the nodes are obtained.
[0056] Force-directed simulation involves applying simulated physical forces (such as simulated repulsive forces and collision forces) to nodes, causing them to repel each other and move continuously until a stable layout state of force equilibrium is achieved.
[0057] In this implementation, after node mapping is completed, all nodes are in their initial positions, at which point there may be significant overlap between nodes. Therefore, based on the initial positions and radii of each node, force-directed simulations are performed on multiple nodes to induce mutual repulsion, thereby determining the target positions of each node in a state of force equilibrium.
[0058] In step S140, the target location of each node is used as the target center point coordinate of the corresponding map information card, and the corresponding map information card is drawn on the geographic base map according to the target center point coordinate.
[0059] In this implementation, after the force-directed simulation is completed and the target positions of all nodes are output, the target positions of each node are directly assigned to the target center point coordinates of the corresponding map information card. Then, using the target center point coordinates of each map information card as its geometric center, and combining the corresponding size information and custom display information, the final map information card is rendered on the geographic base map. Since the target center point coordinates have been optimized by the force-directed simulation, the map information cards no longer overlap each other, resulting in a uniform layout.
[0060] Therefore, according to the map information card drawing method provided in this disclosure, by pre-drawing the map information cards, the initial center point coordinates and size information of each map information card in the screen coordinate system are determined, and each map information card is mapped to a node with a corresponding radius, accurately restoring the actual spatial position of each map information card in the screen coordinate system, and providing accurate geometric parameters for subsequent force-directed simulation.
[0061] Next, based on the initial position and radius of each node, force-directed simulation is performed on multiple nodes to induce mutual repulsion between them, achieving a uniform spatial distribution. This allows for the automatic and efficient resolution of spatial conflicts between map information cards without relying on user interaction. The target positions of each node obtained from the force-directed simulation are used as the target center point coordinates of the corresponding map information card and drawn on the geographic base map. This enables the output of a well-coordinated and non-obstructing visual composition in non-interactive scenarios, completely avoiding map information card occlusion and improving the accuracy of geospatial data representation and layout readability.
[0062] In some embodiments of this disclosure, the force-directed simulation includes multiple iterations until each node reaches a force equilibrium state. In each iteration, the center distance between any two nodes is determined based on the current position of each node. Based on the center distance, the simulated repulsive force and collision force between the two nodes are determined. The nodes are driven to move based on the simulated repulsive force or collision force acting on each node, and the current position of each node is updated.
[0063] In this implementation, before the first iteration, a force-directed simulation environment is constructed, including setting or defining the following parameters: target repulsive force strength, target collision force strength, initial energy value, energy decay rate, velocity decay rate, and energy convergence threshold. These parameters are used to control the convergence speed and stability of the force-directed simulation.
[0064] In each iteration, based on the current position of each node, the center distance between any two nodes is calculated, and the simulated repulsive force between these two nodes is determined based on this center distance. Simultaneously, this center distance is compared to the sum of the radii of the two nodes. If the center distance is less than the sum of the radii, it indicates that the two nodes overlap, resulting in a collision force. The collision force between the two nodes is determined based on the sum of the center distance and the radii.
[0065] It should be understood that each node may be subject to simulated repulsive and collision forces from multiple nodes. Based on the simulated repulsive and collision forces acting on each node, the node is driven to move along the direction of the force. After the movement is completed, the node's current position is updated to the new position. When the force-guided simulation is completed (e.g., after a predetermined number of iterations or when the node state is stable), the target position of each node (i.e., the final coordinates of the node in the screen coordinate system) can be determined.
[0066] Therefore, by simulating the synergistic mechanism of repulsive and collision forces, the repulsive force is responsible for dispersing dense nodes globally to achieve uniform distribution, while the collision force provides strong repulsive intervention in microscopic overlapping areas. The combination of the two can efficiently and automatically solve spatial conflicts between complex geographical covers.
[0067] In some embodiments of this disclosure, determining the simulated repulsive force between any two nodes based on the center distance preferably includes: determining the magnitude of the simulated repulsive force between any two nodes based on a preset target repulsive force intensity and the center distance between the two nodes, wherein the magnitude of the simulated repulsive force is negatively correlated with the center distance, and the direction of the simulated repulsive force experienced by each node in any two nodes is along the line connecting their centers away from the other node, thereby achieving mutual repulsion between the nodes.
[0068] In this implementation, in each iteration of the force-guided simulation, the center distance between any two nodes (i.e., the straight-line distance between their current position coordinates) is calculated based on their current positions.
[0069] Next, the target repulsive force intensity (used to control the strength of the simulated repulsive force) preset when constructing the force-guided simulation environment is read. Based on this target repulsive force intensity and the center distance, the magnitude of the simulated repulsive force between any two nodes is determined. Preferably, the magnitude of the simulated repulsive force is the ratio between the target repulsive force intensity and the square of the center distance, i.e., simulated repulsive force = target repulsive force intensity / (center distance). 2 The simulated repulsive force experienced by each of the two nodes is directed along the line connecting their centers, pointing away from the other node.
[0070] Therefore, by introducing simulated repulsive force, a uniform distribution of nodes can be achieved globally.
[0071] In some embodiments of this disclosure, determining the collision force between any two nodes based on the center distance preferably includes: when the center distance is less than the sum of the radii of the two nodes, determining the overlap between the two nodes based on the center distance and the sum of the radii, determining the magnitude of the collision force between the two nodes based on a preset target collision force intensity and the overlap, wherein the magnitude of the collision force is positively correlated with the overlap, and the direction of the collision force experienced by each node in the two nodes is along the line connecting their centers away from the other node.
[0072] In this embodiment, after determining the center distance between any two nodes, the sum of the radii of the two nodes is calculated, and the center distance is compared with the sum of the radii. If the center distance is less than the sum of the radii, it indicates that there is overlap between the two nodes, and a collision force exists between them. In this case, the amount of overlap between the two nodes is determined based on the center distance and the sum of the radii. Preferably, the amount of overlap is the difference between the sum of the radii and the center distance.
[0073] Next, the target collision force intensity (used to control the strength of the collision force) preset when constructing the force-oriented simulation environment is read. Based on this overlap and the target collision force intensity, the magnitude of the collision force between the two nodes is calculated. The magnitude of the collision force is positively correlated with the overlap; that is, the greater the overlap, the greater the corresponding collision force. Preferably, the magnitude of the collision force is the product of the overlap and the target collision force intensity. Furthermore, the direction of the collision force experienced by each of the two nodes is along the line connecting their centers, pointing away from the other node.
[0074] Therefore, by introducing collision force, a strong local repulsive effect can be generated to forcibly separate the overlapping areas of nodes, thus completely eliminating the geometric overlap between nodes.
[0075] In some embodiments of this disclosure, the nodes are driven to move based on simulated repulsive or collision forces acting on each node, preferably including steps S210 to S220. Please refer to [link / reference needed]. Figure 2 .
[0076] In step S210, for each node, the magnitude and direction of the simulated repulsive force and collision force acting on the node are vector-superimposed to determine the magnitude and direction of the resultant force acting on the node.
[0077] In step S220, the moving speed of the node is updated according to the magnitude of the resultant force on the node, and the node is driven to move along the direction of the resultant force according to the updated moving speed. During the movement of the node, the moving speed of the node continues to decrease according to the target speed decay rate.
[0078] In this implementation, in each iteration, each node may be simultaneously subjected to simulated repulsive forces and collision forces from multiple other nodes. In order to accurately calculate the motion state of each node, the simulated repulsive forces and collision forces subjected to the node are vector-superimposed item by item according to the magnitude and direction of the simulated repulsive forces and collision forces subjected to the node, thereby determining the magnitude and direction of the resultant force subjected to the node.
[0079] In physics simulations, force is the cause of changes in an object's state of motion. According to F=ma, where F is the net force acting on each node, and the mass of each node is m=1, the acceleration a=F. At the current velocity of the node... v current When the velocity is 0 (meaning the node's movement speed decays to 0 before the next round of force-directed simulation begins), the resultant force F can be directly used as the updated movement speed of that node. v new ,Right now v new = v current +F.
[0080] Based on the updated moving speed of the node, the node is driven to move along the direction of the resultant force, completing the change in node position. Furthermore, to prevent continuous oscillation and instability during node movement, a target velocity decay rate (set during the construction of the force-directed simulation environment) is introduced to perform a damping decay calculation on the updated moving speed. This updated moving speed is multiplied by a damping coefficient determined by the target velocity decay rate (e.g., the damping coefficient is (1-velocityDecay), where velocityDecay is the target velocity decay rate), causing the moving speed to decrease proportionally until it decays to 0, at which point the node stops moving.
[0081] Once the node stops moving, its new position can be determined and updated to its current position, thus completing this round of force-guided simulation iteration.
[0082] Therefore, by combining all simulated repulsive and collision forces acting on a node into a resultant force through vector superposition, the overall force situation of the node is accurately reflected, providing a correct physical basis for subsequent velocity updates and avoiding motion distortion that might result from handling each force separately. Furthermore, by introducing a velocity attenuation coefficient to simulate the damping effect in the real world, the oscillation of the node in the force field is effectively suppressed, ensuring that the force-directed simulation can converge smoothly and quickly to a stable state, avoiding infinite node motion or bouncing back and forth.
[0083] In some embodiments of this disclosure, the force-directed simulation preferably further includes steps S310 to S320, please refer to... Figure 3 .
[0084] In step S310, after each iteration, the current energy value is updated based on the initial energy value, the energy decay rate, and the current iteration number.
[0085] In step S320, when the updated current energy value is less than the energy convergence threshold, it is determined that each node has reached a force balance state, the iteration is stopped, and the current position of each node is determined as the target position.
[0086] In this implementation, the initial energy value, energy decay rate, and energy convergence threshold are read when the force-directed simulation environment is constructed. The initial energy value is the global activity baseline set when the force-directed simulation starts; the energy decay rate is a proportional parameter used to specify the magnitude of energy loss after each round of force-directed simulation; and the energy convergence threshold is an energy critical value. When the current energy value decays below this energy convergence threshold, it indicates that the relative positional change between nodes is small, satisfying the force-directed simulation termination condition.
[0087] At the end of each iteration (e.g., after updating the current position of a node), the number of completed iterations (i.e., the current iteration number) is obtained. Based on the decay mapping relationship between the initial energy value, the energy decay rate, and the current iteration number, the current energy value is decreased round by round. Preferably, the current energy value alpha... c =alpha o ×(1-alphaDecay) L , where alpha o Let be the initial energy value, alphaDecay be the energy decay rate, and L be the current iteration number. As the current iteration number continues to accumulate, the current energy value shows a monotonically decreasing trend.
[0088] After updating the current energy value, compare the updated current energy value with the preset energy convergence threshold. If the updated current energy value is still greater than or equal to the energy convergence threshold, it is determined that the node has not yet reached a stable configuration and there are still space conflicts that can be optimized, and the next round of iteration can begin.
[0089] When the updated current energy value is less than the energy convergence threshold for the first time, it is determined that each node has reached a state of force equilibrium. At this time, the force-directed simulation is terminated, and the current position of each node is determined as the target position.
[0090] Therefore, by introducing an energy decay mechanism and an energy convergence threshold determination, controllable and automated termination conditions are provided for force-directed simulation, avoiding the problem of suboptimal node layout caused by infinite iteration or premature termination.
[0091] In some embodiments of this disclosure, after updating the current position of each node, the method for drawing the map information card preferably further includes steps S410 to S420. Please refer to [link / reference needed]. Figure 4 .
[0092] In step S410, it is detected whether the current position of each node exceeds the target canvas boundary, which is determined based on the width, height and inner margin of the target canvas.
[0093] In step S420, if the current position of the node exceeds the target canvas boundary, the current position of the node is corrected to the target canvas boundary.
[0094] The target canvas boundary is the allowed coordinate range (including the left boundary value (minimum x-coordinate), right boundary value (maximum x-coordinate), top boundary value (maximum y-coordinate), and bottom boundary value (minimum y-coordinate)) set within the visualization rendering area (i.e., the target canvas). This target canvas boundary is calculated from the width, height, and reserved inner margins of the target canvas and is used to limit the maximum activity space of nodes during the force-guided simulation process. The inner margin is a parameter representing the blank area reserved at the edge of the target canvas, used to prevent map information cards from being too close to the physical boundary of the canvas, improving the visual aesthetics and layout standardization of the static layout.
[0095] In this embodiment, the width, height, and preset inner margin of the target canvas, which are pre-set when constructing the force-guided simulation environment, are read. A two-dimensional screen coordinate system is established with the upper left corner of the target canvas as the origin. Based on this, the left and right boundary values of the horizontal effective range, as well as the upper and lower boundary values of the vertical effective range, are calculated. The left and upper boundary values are equal to the inner margin, the right boundary value is equal to the target canvas width minus the inner margin, and the lower boundary value is equal to the target canvas height minus the inner margin. This clearly defines the allowable coordinate range of the target canvas boundary.
[0096] Next, after updating the node positions in each iteration, the horizontal and vertical coordinates of each node are compared with the allowed coordinate range of the target canvas boundary based on the updated current position (including horizontal and vertical coordinates) of each node to determine whether the horizontal and vertical coordinates of the node are both within the allowed coordinate range of the target canvas boundary.
[0097] If not, it means that the node has exceeded the target canvas boundary. In this case, the current position of the node is corrected to the target canvas boundary.
[0098] This effectively prevents nodes from drifting indefinitely or leaving the effective visible area under the action of physical forces (such as simulated repulsive forces and collision forces), ensuring the integrity and layout standardization of geographic information visualization when outputting statically.
[0099] In some embodiments of this disclosure, correcting the current position of the node to the target canvas boundary preferably includes: updating the horizontal coordinate of the node's current position to the corresponding left or right boundary value when the horizontal coordinate of the node's current position exceeds the left or right boundary value of the target canvas boundary; and updating the vertical coordinate of the node's current position to the corresponding upper or lower boundary value when the vertical coordinate of the node's current position exceeds the upper or lower boundary value of the target canvas boundary.
[0100] In this embodiment, for each node, it is respectively detected whether the abscissa of its current position is less than the left boundary value or greater than the right boundary value, and whether the ordinate is less than the upper boundary value or greater than the lower boundary value; if the abscissa exceeds (that is, less than the left boundary value or greater than the right boundary value), it is set to the corresponding left boundary value or right boundary value; if the ordinate exceeds (that is, less than the upper boundary value or greater than the lower boundary value), it is set to the corresponding upper boundary value or lower boundary value; if neither exceeds, the original coordinates remain unchanged.
[0101] For example, let the abscissa of the current position of the node be x and the ordinate be y.
[0102] For the abscissa x, if x < leftBound (left boundary value), it means the node exceeds the left boundary. At this time, the abscissa of the current position of the node is set to leftBound; if x > rightBound (right boundary value), it means the node exceeds the right boundary. At this time, the abscissa of the current position of the node is set to rightBound; if leftBound ≤ x ≤ rightBound, it means the abscissa x is within the valid range and no correction is made.
[0103] For the ordinate y, if y < topBound (upper boundary value), it means the node exceeds the upper boundary. At this time, the ordinate of the node is set to topBound; if y > bottomBound (lower boundary value), it means the node exceeds the lower boundary. At this time, the ordinate of the node is set to bottomBound; if topBound ≤ y ≤ bottomBound, it means the ordinate is within the valid range and no correction is made.
[0104] Thus, by respectively detecting and correcting the abscissa and ordinate of the current position of the node, precise rectangular boundary constraints are achieved, ensuring that the node is always restricted within the valid area of the canvas (i.e., the target canvas boundary), and avoiding the problem that the map information card cannot be displayed due to being moved out of the visible range.
[0105] In some embodiments of the present disclosure, the corresponding map information card is drawn on the geographic base map according to the target center point coordinates, preferably including steps S510 to S530. Please refer to Figure 5 .
[0106] In step S510, for each map information card, according to the target center point coordinates and size information of the map information card, the anchor point coordinates of multiple candidate anchor points on the edge position of the map information card are determined.
[0107] In step S520, the target anchor point is determined from the multiple candidate anchor points by the distance between the source point coordinates of the source point that needs to establish a connection with the map information card and the anchor point coordinates of each candidate anchor point.
[0108] In step S530, the map information card is drawn on the geographic base map according to the coordinates of the target center point, and a connecting line connecting the source point and the map information card is generated on the geographic base map with the source point coordinates as the starting point and the target anchor point coordinates as the ending point.
[0109] In this implementation, for each map information card that needs to be drawn, based on the target center point coordinates (x... c ,y c The system uses the data and size information (including width w and height h) to determine the anchor coordinates of multiple candidate anchor points (i.e., candidate connection points of connecting lines) at the edge of the map information card.
[0110] Preferably, the midpoints of the four edges of the map information card are determined as candidate anchor points, namely the top anchor point, bottom anchor point, left anchor point, and right anchor point. The top anchor point is the midpoint of the top edge of the map information card, with coordinates (x...). c ,y c -h / 2); the bottom anchor point is the midpoint of the bottom edge of the map information card, with coordinates (x - h / 2); c ,y c +h / 2); The left anchor point is the midpoint of the left edge of the map information card, with coordinates (x... c −w / 2,y c The right anchor point is the midpoint of the right edge of the map information card, with coordinates (x...). c +w / 2,y c Four candidate anchor points are distributed around the map information card, which can accommodate the connection needs of the source point (i.e., the starting point that needs to establish a connection with the corresponding map information card, which can be the center point of another map information card, a point of interest marker on the geographic base map, or any screen coordinate point specified by the user) in different locations.
[0111] After determining the anchor coordinates of each candidate anchor point, obtain the source coordinates of the source point that needs to be connected to the map information card, and calculate the distance (e.g., Euclidean distance) between the source point and each candidate anchor point. Then, determine the candidate anchor point with the smallest corresponding distance as the target anchor point to ensure that the connection path is the shortest in spatial geometry.
[0112] After determining the target anchor point, the map information card is formally drawn on the geographic base map according to the coordinates of the target center point, ensuring that the content of the map information card (text, icons, etc.) is fully displayed. Then, a connecting line is generated with the source point coordinates as the starting point and the target anchor point coordinates as the ending point. This connecting line is then overlaid on the geographic base map to form a clear visual direction from the source point to the map information card. Preferably, this connecting line is a cubic Bézier curve.
[0113] In this way, by determining multiple candidate anchor points at the edge of the map information card and dynamically matching them using the shortest path principle, the candidate anchor point with the closest spatial distance can be automatically selected as the connection endpoint, i.e., the target anchor point. This effectively avoids the problem of connecting lines crossing the main body of the map information card, generating long broken lines, or intersecting with other elements, and significantly improves the geometric rationality and visual simplicity of the connection layout.
[0114] In some embodiments of this disclosure, a connecting line is generated on the geographic base map, using the source point coordinates as the starting point and the target anchor point coordinates as the ending point, connecting the source point and the map information card. Preferably, this includes steps S610 to S630. Please refer to [link / reference]. Figure 6 .
[0115] In step S610, the anchor coordinates of the target anchor point are compared with the target center point coordinates of the corresponding map information card to determine the anchor type of the target anchor point. The anchor type includes top anchor point, bottom anchor point, left anchor point, or right anchor point.
[0116] In step S620, the tangent direction of the connecting line at the target anchor point is determined according to the anchor point type of the target anchor point.
[0117] In step S630, based on the tangent direction, a connecting line is generated on the geographic base map, starting from the source point coordinates and ending at the target anchor point coordinates. This line connects the source point and the map information card.
[0118] In this implementation, the anchor point type is determined by comparing the numerical relationship between the anchor point coordinates of the target anchor point and the target center point coordinates of the corresponding map information card: if the ordinate of the target center point coordinates is greater than the ordinate of the target anchor point, the target anchor point is located at the top edge of the map information card, and the anchor point type is top anchor point; if the ordinate of the target center point coordinates is less than the ordinate of the target anchor point, the target anchor point is located at the bottom edge of the map information card, and the anchor point type is bottom anchor point; if the abscissa of the target center point coordinates is greater than the abscissa of the target anchor point, the target anchor point is located at the left edge of the map information card, and the anchor point type is left anchor point; if the abscissa of the target center point coordinates is less than the abscissa of the target anchor point, the target anchor point is located at the right edge of the map information card, and the anchor point type is right anchor point.
[0119] After determining the anchor type of the target anchor point, in order to achieve a visually smooth connection effect, the connecting line should be perpendicular to the edge when it reaches the target anchor point (i.e., when it reaches the edge of the map information card). Therefore, the tangent direction of the connecting line at the target anchor point is determined according to the anchor type of the target anchor point.
[0120] Specifically, when the anchor point type is a top anchor point or a bottom anchor point, the top or bottom edge of the map information card is horizontal. Therefore, the tangent direction of the connecting line at the target anchor point is vertical, meaning the connecting line should reach the edge of the map information card from top to bottom or from bottom to top. When the anchor point type is a left anchor point or a right anchor point, the left or right edge of the map information card is vertical. Therefore, the tangent direction of the connecting line at the target anchor point is horizontal, meaning the connecting line should reach the edge of the map information card from left to right or from right to left.
[0121] Preferably, after determining the tangent direction, a cubic Bézier curve generation algorithm is invoked, using the source point coordinates as the curve's starting point and the target anchor point coordinates as the curve's ending point. During the curve control point calculation stage, control points are adaptively generated based on the aforementioned determined tangent direction: if the tangent direction is vertical, the first and second control points are generated by offsetting a preset control distance along the vertical axis, using the ordinates of the target anchor point and the source point as a reference; if the tangent direction is horizontal, the corresponding control points are generated by offsetting a preset control distance along the horizontal axis, using the abscissas of the target anchor point and the source point as a reference. Next, based on the starting point, ending point, and adaptively generated intermediate control points, a smooth connection path satisfying the endpoint tangent direction constraint is fitted and generated. This path data is then transmitted to the vector graphics rendering engine, where the connection line is overlaid on the geographic base map, completing the visual directional pointing from the source point to the map information card.
[0122] Therefore, the tangent direction of the connecting line at its endpoint is adaptively determined according to the anchor point type of the target anchor point, so that the connecting line is naturally perpendicular to the edge when it approaches the edge of the map information card, avoiding the visual abruptness caused by the connecting line being inserted into the card at an angle, and significantly improving the professionalism and aesthetics of the graphics.
[0123] Figure 7 This is a flowchart illustrating a method for drawing map information cards according to another embodiment of the present disclosure.
[0124] like Figure 7 As shown, the system first acquires geographic data containing the latitude and longitude of each map information card and its custom display information, and then performs a card pre-drawing operation within the map container. During the pre-drawing process, the underlying map coordinate transformation tool is called to map the latitude and longitude to screen coordinates (i.e., the initial center point coordinates of the map information cards). At the same time, the card size (i.e., size information, including width and height) is extracted by reading the Cascading Style Sheet attribute information of each map information card.
[0125] Next, each map information card is abstracted as a circular simulated node, with its screen coordinates as the initial position of the node, and half of the larger value of the card size (width and height) as the radius of the node, thus completing the node instantiation.
[0126] Then, the simulated node array (containing the initial position and radius of each node) is input into the force-directed simulator to start multiple rounds of force-directed simulation. In each round of force-directed simulation, the node updates its current position under the combined action of simulated repulsive and collision forces. Simultaneously, boundary checks are performed to determine if the node's current position exceeds the effective area of the canvas (i.e., the target canvas boundary). If so, a forced return to the canvas is performed, correcting the out-of-bounds coordinates to the boundary value of the target canvas boundary. The stability of the node layout is determined based on whether the energy value is less than the energy convergence threshold. If it is not stable (i.e., the energy value is greater than or equal to the energy convergence threshold), the iteration continues (i.e., the next round of force-directed simulation is executed). If it is stable (i.e., the energy value is less than the energy convergence threshold), the loop terminates and the simulated coordinates (i.e., the target position of the node) are output.
[0127] After obtaining the simulated coordinates, the process moves to the backend rendering and connection generation stage. On one hand, the simulated coordinates are mapped to the corresponding locations on the geographic base map (that is, the simulated coordinates are converted into corresponding latitude and longitude information to obtain simulated geographic coordinates), so that the map information cards are translated and redrawn according to a new layout without overlap.
[0128] On the other hand, anchor point matching is performed based on the simulated coordinates. The anchor point coordinates of each candidate anchor point on the map information card are calculated based on the coordinates of the target center point of the map information card. The target anchor point is then selected based on the shortest path principle according to the distance from the source point to each candidate anchor point. Subsequently, arrow direction matching is performed. The tangent direction of the corresponding connecting line at the target anchor point is determined according to the anchor point type. A cubic Bézier curve model is used to generate a smooth connecting path, ensuring that the tangent direction is perpendicular to the edge when the path touches the edge of the map information card, and SVG arrow markers are bound to it.
[0129] Finally, the redrawn map information cards are overlaid and merged with the generated Bezier arrows onto the geographic base map to obtain the final drawing result, forming a static geographic visualization composition with a uniform layout, no obstruction, and clear directional relationships.
[0130] Figure 8 This is a schematic diagram illustrating the drawing effect of a map information card drawing method according to one embodiment of the present disclosure.
[0131] like Figure 8 As shown, in the "Pre-drawn" image on the left, based on the latitude and longitude of each map information card and the customized display information, each map information card (such as A, B, C, D, and E) is temporarily rendered onto the geographic base map. Due to the dense distribution of the original points, the map information cards appear to overlap and key information is obscured in the screen coordinate system.
[0132] In the middle “Constructing Simulation Nodes” diagram, starting from the initial center point coordinates of the pre-drawn map information card, the rectangular map information card (taking map information card E as an example) is mapped into a circular simulation node, and half of the larger value between its width and height is extracted as the radius r of the simulation node, thereby establishing a unified geometric occupancy benchmark for the subsequent simulation of repulsive and collision force interactions.
[0133] In the "Final Drawing Result" image on the right, after force-directed simulation, the map information cards and connecting lines are output collaboratively: under the constraint of the target canvas boundary, each simulated node reaches a stable state of force equilibrium after multiple rounds of force-directed simulation iterations. Then, the target center point coordinates of the stabilized map information card are used to redraw it, completely eliminating spatial overlap; simultaneously, based on the shortest path principle, the optimal anchor point on the edge of the map information card, i.e., the target anchor point, is automatically matched, and a smooth red arrow connecting line is generated using a cubic Bézier curve to clearly associate the source point with the corresponding map information card. The final drawing result presents a static geographic information map with a uniform layout, no interference between elements, and clear logical direction, effectively solving the technical problem of automatically resolving spatial conflicts of dense elements in static output scenarios.
[0134] Figure 9This is a schematic structural block diagram of a map information card drawing apparatus according to one embodiment of the present disclosure.
[0135] like Figure 9 As shown, the drawing device for the map information card preferably includes a pre-drawing module 910, a mapping module 920, a simulation module 930, and a processing module 940.
[0136] The pre-drawing module 910 is used to pre-draw each map information card on the geographic base map according to the latitude and longitude of each map information card and the customized display information, and to determine the initial center point coordinates and size information of each map information card in the screen coordinate system according to the pre-drawing results; the mapping module 920 is used to map each map information card into a node, the initial position of the node is the initial center point coordinates of the corresponding map information card, and the radius of the node is determined based on the size information of the corresponding map information card; the simulation module 930 is used to perform force-directed simulation on multiple nodes according to the initial position and radius of each node, so that the nodes repel each other to obtain the target position of each node; and the processing module 940 is used to use the target position of each node as the target center point coordinates of the corresponding map information card, and to draw the corresponding map information card on the geographic base map according to the target center point coordinates.
[0137] In some embodiments of this disclosure, after updating the current position of each node to the moved position, the simulation module 930 is further configured to: detect whether the current position of each node exceeds the target canvas boundary, the target canvas boundary being determined based on the width, height, and inner margin of the target canvas; and if the current position of a node exceeds the target canvas boundary, correct the current position of the node to the target canvas boundary.
[0138] In some embodiments of this disclosure, the simulation module 930 is further configured to: after each iteration, update the current energy value based on the initial energy value, the energy decay rate, and the current iteration number; when the updated current energy value is less than the energy convergence threshold, determine that each node has reached a force balance state, stop the iteration, and determine the current position of each node as the target position.
[0139] Figure 10 This is a schematic structural block diagram of an electronic device according to one embodiment of the present disclosure.
[0140] like Figure 10As shown, the hardware structure of electronic device 1000 can be implemented using a bus architecture. The bus architecture can include any number of interconnect buses and bridges, depending on the specific application and overall design constraints of the hardware. Bus 1100 connects various circuits including one or more processors 1200, memory 1300, and / or hardware modules. Bus 1100 can also connect various other circuits 1400 such as peripherals, voltage regulators, power management circuits, external antennas, etc. Bus 1100 can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, only one connection line is used in this figure, but this does not indicate that there is only one bus or one type of bus.
[0141] This disclosure also provides a readable storage medium storing a computer program that, when executed by a processor, is used to implement the methods described above. A "readable storage medium" can be any means that can contain a program for storage, communication, propagation, or transmission for use by or in conjunction with an instruction execution system, apparatus, or device. More specific examples of a readable storage medium include: an electrical connection with one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and programmable read-only memory (EPROM or flash memory), fiber optic devices, and portable read-only memory (CDROM), etc.
[0142] This disclosure also provides a computer program product, the methods of which can be implemented wholly or partially through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented wholly or partially as a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed, all or part of the processes or functions of this disclosure are performed.
[0143] Computer programs or instructions can be stored in a readable storage medium or transferred from one readable storage medium to another. For example, the computer program or instructions can be transferred from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The readable storage medium can be any available medium capable of access, or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, hard disk, or magnetic tape; an optical medium, such as a digital video optical disc; or a semiconductor medium, such as a solid-state drive. The computer-readable storage medium can be a volatile or non-volatile storage medium, or it can include both volatile and non-volatile types of storage media.
[0144] Those skilled in the art will understand that embodiments of this disclosure can be provided as methods, systems, or computer program products. Therefore, this disclosure can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this disclosure 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.
[0145] This disclosure is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus, and computer program products according to this disclosure. 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. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0146] 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.
[0147] 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.
[0148] In the description of this specification, the references to terms such as "one embodiment / mode," "some embodiments / modes," "example," "specific example," or "some examples," etc., refer to specific features, structures, or characteristics described in connection with that embodiment / mode or example, which are included in at least one embodiment / mode or example of this disclosure. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment / mode or example. Moreover, the specific features, structures, or characteristics described may be combined in any suitable manner in one or more embodiments / modes or examples. Furthermore, without contradiction, those skilled in the art can combine and integrate the different embodiments / modes or examples described in this specification, as well as the features of different embodiments / modes or examples.
[0149] Those skilled in the art should understand that the above embodiments are merely for illustrating the present disclosure and are not intended to limit the scope of the disclosure. Those skilled in the art can make other changes or modifications based on the above disclosure, and these changes or modifications still fall within the scope of the present disclosure.
Claims
1. A method of plotting a map information card, characterized by, include: Based on the latitude and longitude of each map information card and the custom display information, each map information card is pre-drawn on the geographic base map, and based on the pre-drawing results, the initial center point coordinates and size information of each map information card in the screen coordinate system are determined. Each of the map information cards is mapped to a node, the initial position of the node is the initial center point coordinate of the corresponding map information card, and the radius of the node is determined based on the size information of the corresponding map information card. Based on the initial position and radius of each node, force-guided simulation is performed on multiple nodes to make the nodes repel each other, thereby obtaining the target position of each node; as well as The target location of each node is used as the target center point coordinate of the corresponding map information card, and the corresponding map information card is drawn on the geographic base map according to the target center point coordinate.
2. The map information card drawing method of claim 1, wherein, The force-guided simulation includes multiple iterations until each node reaches a force equilibrium state. In each iteration, the center distance between any two nodes is determined based on the current position of each node. Based on the center distance, the simulated repulsive force and collision force between the two nodes are determined. The nodes are driven to move based on the simulated repulsive force or collision force they experience, and the current position of each node is updated.
3. The map information card drawing method of claim 2, wherein, Based on the center distance, the simulated repulsive force between any two nodes is determined, including: Based on the preset target repulsion force intensity and the center distance between any two nodes, the magnitude of the simulated repulsion force between any two nodes is determined. The magnitude of the simulated repulsion force is negatively correlated with the center distance. The direction of the simulated repulsion force on each node in any two nodes is along the line connecting their centers away from the other node, thereby achieving mutual repulsion between the nodes.
4. The map information card drawing method of claim 2, wherein, Based on the center distance, the collision force between any two nodes is determined, including: When the center distance is less than the sum of the radii of any two nodes, the overlap between any two nodes is determined based on the center distance and the sum of the radii. The magnitude of the collision force between any two nodes is determined based on the preset target collision force intensity and the overlap. The magnitude of the collision force is positively correlated with the overlap. The direction of the collision force on each of the two nodes is along the line connecting their centers away from the other node.
5. The map information card rendering method of claim 2, wherein, The nodes are moved based on simulated repulsive or collision forces acting on them, including: For each node, the magnitude and direction of the simulated repulsive and collision forces acting on the node are vector-superimposed to determine the magnitude and direction of the resultant force acting on the node; and The node's moving speed is updated based on the magnitude of the resultant force acting on it, and the node is driven to move along the direction of the resultant force based on the updated moving speed. During the node's movement, the moving speed of the node continuously decreases according to the target speed decay rate.
6. The map information card rendering method of claim 2, wherein, After updating the current positions of each node, the method for drawing the map information card further includes: Detect whether the current position of each node exceeds the target canvas boundary, the target canvas boundary being determined based on the target canvas's width, height, and inner margins; and If the current position of the node exceeds the target canvas boundary, the current position of the node is corrected to the target canvas boundary.
7. The map information card rendering method of claim 1, wherein, Based on the coordinates of the target center point, the corresponding map information card is drawn on the geographic base map, including: For each map information card, based on the target center point coordinates and size information of the map information card, determine the anchor point coordinates of multiple candidate anchor points at the edge of the map information card; Based on the distance between the source point coordinates of the source points that need to be connected to the map information card and the anchor point coordinates of each of the candidate anchor points, a target anchor point is determined from a plurality of candidate anchor points; and The map information card is drawn on the geographic base map according to the coordinates of the target center point, and a connecting line connecting the source point and the map information card is generated on the geographic base map with the source point coordinates as the starting point and the target anchor point coordinates as the ending point.
8. The map information card drawing method of claim 7, wherein, Using the source point coordinates as the starting point and the target anchor point coordinates as the ending point, a connecting line is generated on the geographic base map connecting the source point and the map information card, including: The anchor point coordinates of the target anchor point are compared with the target center point coordinates of the corresponding map information card to determine the anchor point type of the target anchor point. The anchor point type includes top anchor point, bottom anchor point, left anchor point, or right anchor point. Based on the anchor point type of the target anchor point, determine the tangent direction of the connecting line at the target anchor point; and Based on the tangent direction, with the source point coordinates as the starting point and the target anchor point coordinates as the ending point, a connecting line is generated on the geographic base map to connect the source point and the map information card.
9. An electronic device, comprising: include: The memory stores execution instructions; as well as A processor that executes the execution instructions stored in the memory, causing the processor to perform the map information card drawing method according to any one of claims 1 to 8.
10. A computer program product comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the method for drawing map information cards according to any one of claims 1 to 8.