Map aggregation point line expansion method, apparatus and device, and medium
By obtaining and classifying the collection of overlapping points, using alternating beads and concentric circle layout technology, the problem of superposition of network element icons on the map is solved, and the clear display of network element and fiber connection positions on the map is realized and the user-friendly operation experience is achieved.
Patent Information
- Application Number
- CN202411727649.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-03-21
AI Technical Summary
In the prior art, network element icons on the map are easily superimposed, resulting in the inability to clearly display the location of network elements and fiber-connected fibers, making it difficult for users to accurately locate and select the required network elements or fiber-connected fibers.
By obtaining the set of overlapping points, classifying them according to the node connection relationship, and using the horizontal and vertical axis alternate fill layout and concentric circle layout, expanding the overlapping points and lines to ensure that the connections between points do not overlap.
The effective expansion of overlapping points and lines on the map is realized, and users can clearly see the specific location and direction of network elements and fibers, improving the convenience and accuracy of operation.
Smart Images

Figure CN119672170A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of map processing technology, and in particular to a method, device, equipment and medium for expanding map aggregation points and lines. Background Art
[0002] In the field of communications, there are many scenarios where network elements and fiber connections between network elements are displayed on maps. Network element icons on maps usually cannot be dragged because network element devices are generally deployed in specific locations such as computer rooms or sites. Unless the network element devices are relocated elsewhere, the administrator can modify the longitude and latitude of the network element icons.
[0003] There may be multiple network element devices at a site, and multiple network element icons will be superimposed at the location of the site on the map. Specifically, if the distance between two sites is very short, such as two computer rooms in a building, or two buildings in a park, the locations of the two sites on the map will almost overlap, and all the network element icons on the site will also be superimposed. Accordingly, the fiber connections between the network elements will not be visible on the map.
[0004] In the existing technology, many business scenarios require selecting network elements or fiber links before proceeding, such as checking the network element port usage rate, checking the optimal fiber link path, etc. If you click on the map to select a network element, you can only click on the top network element of the overlap. The covered network elements cannot be clicked, and the fiber links between the overlapping network elements cannot be selected. Figure 1 Generally, a node tree is provided to load all network elements on the map into the tree. The corresponding network element on the map can be located by clicking the tree node. A global search component is also provided to filter out the fiber connection list by entering the name of the fiber connection or the name of the source and sink network element. The corresponding fiber connection on the map can be located by clicking the list row.
[0005] The above method mainly has the following problems:
[0006] You must know the name of the network element or fiber optic cable. Some network element or fiber optic cable names are too long to remember accurately. Fuzzy matching results in too many search results, making it difficult to locate accurately.
[0007] For users who are used to selecting locations on maps, the operation is very unfriendly;
[0008] It is impossible to confirm which network elements overlap, to distinguish the fiber connections between overlapping network elements, and to have a good grasp of the overall picture of the network.
[0009] In summary, there is an urgent need for a technical solution for expanding map aggregation points and lines. Summary of the invention
[0010] In view of the above problems, the present disclosure provides a method, device, equipment and medium for expanding map aggregation points and lines, which are used to solve the problem of expanding map aggregation points and lines.
[0011] In a first aspect, a method for expanding a map aggregation point line is provided, the method comprising:
[0012] When there are coincident points, obtain the coincident point set;
[0013] Classify the coincident points in the coincident point set according to the node-line relationship to obtain a node-line relationship classification set;
[0014] The subsets in the node connection relationship classification set are arranged alternately along the horizontal and vertical axes to obtain a first layout; wherein the horizontal and vertical axes are arranged alternately in alternate positions as follows: starting from x=1, y=1, the number of arranged subsets is N, and each time a subset is arranged, N increases by 1; when N=k*k, x starts from k+1, the next subset is placed at [k+1,1], and the next subset is placed at [1, k+1], and so on, until the set is placed at [k+1,k+1], x starts from k+2 again, until all sets are arranged, x is the horizontal axis coordinate, y is the vertical axis coordinate, and k is a positive integer;
[0015] Arrange the subset objects, horizontal axis positions and vertical axis positions in the first layout in concentric circles to obtain a second layout;
[0016] For the line between any two points selected in the second layout, if there are multiple lines between the two points, divide the vertical distance from the center of the virtual concentric circle where the two points are located to the line between the two points into equal parts, and draw arcs with the segmentation points as the new center of the circle in turn, and repeat until all the overlapping lines are unfolded.
[0017] Furthermore, the existence of overlapping points includes:
[0018] Any two points are considered to have coincident points if they meet any of the following conditions:
[0019] The two points completely overlap, that is, the distance between the centers of the two points is 0;
[0020] The two points partially overlap, that is, the distance between the centers of the two points is greater than 0 and less than 2r, where r is the radius of the point;
[0021] Two points are adjacent, that is, the distance between the centers of the two points is equal to 2r;
[0022] There is a line between two points, and the distance between the centers of the two points is greater than 2r and less than 2r+k, where k is the length threshold of the line between the two points.
[0023] Furthermore, obtaining the set of coincident points includes:
[0024] Select one of the coincident points, node N1, on the map, obtain the set list1 of all nodes that coincide with point N1, and then remove point N1 from list1 to obtain the set tempList1;
[0025] Get the first node N2 in the set tempList1, get all the nodes set2 that overlap with N2, then take the union with list1 to get the node list list2, and then remove N1 and N2 from list2 to get the set tempList2;
[0026] Repeat until the set tempListN is empty. At this time, the obtained listN is the set of coincident points of point N1.
[0027] Furthermore, the categorizing of the coincident points in the coincident point set according to the node-line relationship to obtain the node-line relationship categorized set includes:
[0028] Get the set of nodes and corresponding links in the coincident point set, where the link object contains the source node id and sink node id fields;
[0029] Initialize a Map structure for caching connections, where the key is a string format of "source node id-destination node id" and the value is a connection object; traverse the connection set returned by the interface, concatenate the source node id and the destination node id of each connection data structure into a string of "source node id-destination node id" or "destination node id-source node id", and determine whether the Map structure contains the string. If it does not contain it, use "source node id-destination node id" as the key and the connection object as the value to store it in the Map structure;
[0030] Initialize a classification set classifyList, traverse all the keys of the Map structure, obtain the source node id and the sink node id, and determine whether the obtained set of coincident points coincidentPointSet contains the source node id or the sink node id;
[0031] If coincidentPointSet contains both the source node id and the sink node id, traverse classifyList. If classifyList[i] contains the source node id or the sink node id, add the source node id and the sink node id to classifyList[i], and assign index to i. After the loop ends, if index is null, create a new Set object, add the source node id and the sink node id to the Set object, and add the Set object to classifyList.
[0032] If coincidentPointSet only contains the source node id, traverse classifyList. If classifyList[i] contains the source node id, assign index to i. After the loop ends, if index is null, create a new Set object, add the source node id to the Set object, and add the Set object to classifyList.
[0033] If coincidentPointSet only contains the sink node id, traverse classifyList. If classifyList[i] contains the sink node id, assign index to i. After the loop ends, if index is null, create a new Set object, add the sink node id to the Set object, and add the Set object to classifyList.
[0034] classifyList is a collection of node-link relationship classifications.
[0035] Furthermore, the step of arranging the subsets in the node connection relationship classification set in alternating positions along the horizontal and vertical axes includes:
[0036] Initialize variables k, x, and y, assign an initial value of 1 to k, x is the horizontal axis coordinate, y is the vertical axis coordinate, and set the spacing parameter distance;
[0037] Traverse the node connection relationship classification set classifyList, i is the traversal index, when (i+1)<=k*k, execute the following steps:
[0038] Get the difference res = (i+1)-(k-1)*(k-1). If res is an even number, place the current subset at x = res / 2, y = k; if res is an odd number, place the current subset at x = k, y = (res+1) / 2.
[0039] When the values of x and y are equal, k is incremented by 1.
[0040] Furthermore, the step of performing concentric circle layout of the subset objects, the horizontal axis positions, and the vertical axis positions in the first layout includes:
[0041] When the number of objects in the subset object subList is 1, the node object is placed at [xAxis, yAxis], where xAxis is the horizontal axis position and yAxis is the vertical axis position;
[0042] When the number of objects in the subset object subList is 2, two nodes are placed at [xAxis-r, yAxis] and [xAxis+r, yAxis] respectively, and the two points are connected by a straight line;
[0043] When the number of objects in the subset object subList is greater than or equal to 3, a virtual circle is drawn with the position [xAxis, yAxis] as the center and r as the radius, where r < distance / 2, distance is the spacing parameter, and r is the radius of the point;
[0044] Calculate the equally divided angle 360 / N of the virtual circle, where N is the number of objects in subList; calculate the center point circleCenter; traverse the subset object subList, and calculate the position of the current node layout according to the current node sequence i and the equally divided angle; connect the two points with a connection relationship with a straight line.
[0045] Further, for the connection between any two points selected in the second layout, if there are multiple connections between the two points, equally divide the perpendicular distance from the center of the virtual concentric circle where the two points are located to the connection between the two points, and draw arcs with the segmentation points as the new centers in turn to realize the expansion of the overlapping connections between the two points, including:
[0046] According to the connection Map structure, first splice the ids of the two points into a key, and then obtain the connection list lineList from the Map structure according to the key. The number of connections between the two points is N = lineList.length;
[0047] Calculate the center point coordinates between the two points centerAxis = [(x1 + x2) / 2, (y1 + y2) / 2], where x1 and y1 are the coordinate values of the first point, and x2 and y2 are the coordinate values of the second point;
[0048] Equally divide the distance from centerAxis to the center circleCenter in the concentric circle layout into N parts. The position of the first point is centerAxis, and the coordinates of the i-th point are [xi, yi]. Calculate the horizontal axis coordinate value xi of the i-th point according to the formula ((x1 + x2) / 2 - xAxis) / (xi - xAxis) = N / (N - i), and calculate the vertical axis coordinate value yi of the i-th point according to the formula ((y1 + y2) / 2 - yAxis) / (yi - yAxis) = N / (N - i);
[0049] Through the tripartite framework turf, the offset angle between the first point and point i is calculated bearing1 = turf.bearing([x1,y1],[xi,yi]), the offset angle between the second point and point i is calculated bearing2 = turf.bearing([x2,y2],[xi,yi]), the first point object point1 = turf.point([x1,y1]), the i-th point object pointi = turf.point([xi,yi]), the distance from point i to the first point is calculated, that is, the radius of the new circle r = turf.distance(point1,pointi), and finally the arc arc = turf.lineArc([(x1+x2) / 2,(y1+y2) / 2], r, bearing1, bearing2).
[0050] In a second aspect, a device for expanding map aggregation points and lines includes: a collection acquisition unit, a collection classification unit, a first layout unit, a second layout unit, and a line expansion unit;
[0051] A set acquisition unit, used for acquiring a set of coincident points when there are coincident points;
[0052] A set classification unit is used to classify the coincident points in the coincident point set according to the node-line relationship to obtain a node-line relationship classification set;
[0053] The first layout unit is used to layout the subsets in the node connection relationship classification set in an alternating manner along the horizontal and vertical axes to obtain a first layout; wherein the horizontal and vertical axes are arranged in an alternating manner as follows: starting from x=1, y=1, the number of laid out subsets is N, and each time a subset is laid out, N increases by 1; when N=k*k, x starts from k+1, the next subset is placed at [k+1,1], and the next subset is placed at [1, k+1], and so on, alternating in sequence until the set is placed at [k+1,k+1], and x starts from k+2 again, until all sets are laid out, x is the horizontal axis coordinate, y is the vertical axis coordinate, and k is a positive integer;
[0054] A second layout unit is used to arrange the subset objects, horizontal axis positions and vertical axis positions in the first layout in concentric circles to obtain a second layout;
[0055] The line expansion unit is used to select a line between any two points in the second layout. If there are multiple lines between the two points, the vertical distance from the center of the virtual concentric circle where the two points are located to the line between the two points is equally divided, and arcs are drawn with the segmentation points as the new center of the circle in turn, and this is repeated until all the overlapping lines are expanded.
[0056] In a third aspect, an electronic device includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;
[0057] a memory storing a computer program;
[0058] The processor is used to implement the above-mentioned method of expanding map aggregation points and lines when executing the computer program stored in the memory.
[0059] In a fourth aspect, a computer-readable storage medium stores a computer program, which, when executed by a processor, implements the above-mentioned method for expanding map aggregation points and lines.
[0060] The present disclosure has at least the following beneficial effects:
[0061] The present invention constructs a method for intelligently unfolding overlapping points and lines on a map based on the relationship between nodes and lines between points; the method realizes the scattered distribution of overlapping points and the non-overlapping of lines between points by associating sets of overlapping points, classifying by line relationship, alternating horizontal and vertical axis substitute layout, concentric circle layout and other algorithms; the method realizes the unfolding of overlapping lines between two points by equally dividing the straight-line distance from the center of the concentric circle to the line and drawing arcs with the segmentation points as the new center in turn; and the method does not overlap with lines between other points.
[0062] The present disclosure significantly improves the user experience, allowing users to see the full picture of overlapping points and lines and clarify the direction of the connecting lines; the layout reasonably and fully utilizes the space, allowing users to select the desired nodes or connecting lines with less dragging and zooming; the layout coordinate spacing is adjustable, which improves the flexibility of coping with different scenarios.
[0063] The present invention is based on mathematical modeling and plane geometry, has reliable theoretical knowledge, is not restricted by programming languages, can be used for any application in corresponding scenarios, has good compatibility, and is widely used.
[0064] Other features and advantages of the present disclosure will be described in the following description, and partly become apparent from the description, or be understood by implementing the present disclosure. The purpose and other advantages of the present disclosure can be realized and obtained by the structures indicated in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0066] Figure 1 A schematic diagram of a method flow chart for an embodiment of the present disclosure;
[0067] Figure 2 This is a schematic diagram of the structure of the device for the embodiment of the present disclosure;
[0068] Figure 3 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure;
[0069] Figure 4 It is a principle flow chart of the embodiment of the present disclosure;
[0070] Figure 5 This is a schematic diagram of classifying the embodiments of the present disclosure according to the node connection relationship;
[0071] Figure 6 This is a schematic diagram of a layout of alternate positions with horizontal and vertical axes alternating in accordance with an embodiment of the present disclosure;
[0072] Figure 7 It is a schematic diagram of the concentric circle layout of an embodiment of the present disclosure;
[0073] Figure 8 The following is a schematic diagram of overlapping lines in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0074] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0075] like Figure 1 As shown, a method for expanding map aggregation points and lines, the method comprising:
[0076] 101SS, when there are coincident points, obtain the coincident point set;
[0077] 102SS, classify the coincident points in the coincident point set according to the node-line relationship to obtain a node-line relationship classification set;
[0078] 103SS, the subsets in the node connection relationship classification set are arranged alternately along the horizontal and vertical axes to obtain the first layout; wherein, the horizontal and vertical axes are arranged alternately in alternate positions as follows: starting from x=1, y=1, the number of arranged subsets is N, and each time a subset is arranged, N increases by 1; when N=k*k, x starts from k+1, the next subset is placed at [k+1,1], and the next subset is placed at [1, k+1], alternating in sequence until the set is placed at [k+1,k+1], and x starts from k+2 again until all sets are arranged, x is the horizontal axis coordinate, y is the vertical axis coordinate, and k is a positive integer;
[0079] 104SS, the subset objects, the horizontal axis positions and the vertical axis positions in the first layout are laid out in concentric circles to obtain a second layout;
[0080] 105SS, for the line between any two points selected in the second layout, if there are multiple lines between the two points, divide the vertical distance from the center of the virtual concentric circle where the two points are located to the line between the two points into equal parts, and draw arcs with the segmentation points as the new center of the circle in turn, and repeat until all the overlapping lines are unfolded.
[0081] The specific implementation is as follows:
[0082] S101, determine whether two points coincide. There are the following situations:
[0083] The two points completely overlap, that is, the distance between the centers of the two points is 0;
[0084] The two points partially overlap, that is, the distance between the centers of the two points is greater than 0 and less than 2r (r is the radius of the point);
[0085] Two points are adjacent, that is, the distance between the centers of the two points is equal to 2r;
[0086] If there is a line between two points and the length of the line is too short, the mouse may not be able to click on the line. In this case, the two points are also considered to be coincident, that is, the distance between the centers of the two points is greater than 2r and less than 2r+k (k is the length threshold of the line between the two points).
[0087] Get the set of coincident points. For example, there are three points A, B, and C. Point A coincides with point B but not with point C. At the same time, point B coincides with point C. In this case, points A, B, and C are considered as a set. The steps to get the set of coincident points are as follows:
[0088] Click a node N1 on the map, and obtain the set list1 of all nodes that coincide with point N1 by judging the coincidence of two points. Then remove point N1 from list1 to obtain the set tempList1.
[0089] Get the first node N2 in the set tempList1, get all the nodes set2 that overlap with N2, then take the union with list1 to get the node list list2, and then remove N1 and N2 from list2 to get the set tempList2;
[0090] Repeat the process until the set tempListN is empty. At this time, the obtained listN is the set of coincident points of point N1.
[0091] 102SS, classification by node-line relationship: If a point is reachable from another point, that is, a point can reach another point through one or more lines between nodes, then the two points can be classified into one category. For example, there is a line between point A and point B, there is a line between point B and point C, there is no line between point A and point C, but point A can reach point C through point B, then points A, B, and C can be classified into one category. The steps of the algorithm are as follows:
[0092] When loading a map, obtain a collection of nodes and links from the backend through the interface that queries topology data, where the link object contains the source node id and sink node id fields; initialize a Map structure for caching links, where the key is a string format of "source node id-sink node id" and the value is the link object; traverse the link collection returned by the interface, concatenate the source node id and sink node id of each link data structure into a string of "source node id-sink node id" or "sink node id-source node id", and determine whether the Map structure contains these two strings. If neither is included, use "source node id-sink node id" as the key and the link object as the value to store it in the Map structure;
[0093] First, initialize a classification set classifyList, then traverse all the keys of the Map structure, get srcId (source node id) and dstId (destination node id) through split('-'), and determine whether the obtained coincident point set coincidentPointSet contains srcId or dstId:
[0094] If coincidentPointSet contains both the source node id and the sink node id, first initialize an object index, then for loop classifyList, if classifyList[i] contains srcId or dstId, then add srcId and dstId to classifyList[i], and assign index to i; after the loop ends, if index is null, it means that srcId and dstId do not exist in any subset of classifyList, then create a new Set object, add srcId and dstId to the Set object, and then add the Set object to classifyList;
[0095] If coincidentPointSet only contains the source node id, first initialize an object index, then for loop classifyList, if classifyList[i] contains srcId, assign index to i; after the loop ends, if index is null, it means that srcId does not exist in any subset of classifyList, then create a new Set object, add srcId to the Set object, and then add the Set object to classifyList;
[0096] If coincidentPointSet only contains the sink node id, first initialize an object index, then loop classifyList, if classifyList[i] contains dstId, assign index to i; after the loop ends, if index is null, it means that dstId does not exist in any subset of classifyList, then create a new Set object, add dstId to the Set object, and then add the Set object to classifyList;
[0097] The obtained classifyList is a classification set of node-link relationships.
[0098] 103SS, horizontal and vertical axis alternate layout: take the upper left corner of the expanded area as the origin of the coordinate axis, the first subset classifyList[0] of the node connection relationship classification set classifyList is placed at [1,1], the second subset classifyList[1] is placed at [2,1], the third subset classifyList[2] is placed at [1,2], the fourth subset classifyList[3] is placed at [2,2], the fifth subset classifyList[4] is placed at [3,1], the sixth subset classifyList[5] is placed at [1,3], and so on. That is, starting from x=1, y=1, the number of subsets that have been laid out is N, and each time a subset is laid out, N increases by 1; when N=k*k, x starts from k+1, the next subset is placed at [k+1,1], and the next subset is placed at [1, k+1], alternating in sequence until the set is placed at [k+1,k+1], and x starts from k+2 again until all sets are laid out. The algorithm steps are as follows:
[0099] Initialize variables k, x, and y, assign an initial value of 1 to k, x is the horizontal axis coordinate, y is the vertical axis coordinate, and then set a spacing parameter distance;
[0100] Traverse the node connection relationship classification set classifyList, i is the traversal index, when (i+1)<=k*k, execute the following steps:
[0101] First, obtain the difference res = (i+1)-(k-1)*(k-1). If res is an even number, the current subset is arranged at x = res / 2, y = k; if res is an odd number, the current subset is arranged at x = k, y = (res+1) / 2;
[0102] Execute concentric circle layout, passing the current subset object classifyList[i], x*distance, y*distance as input parameters to the concentric circle layout method;
[0103] Finally, when the values of x and y are equal, k is incremented by 1.
[0104] 104SS, concentric circle layout: Get the three input parameters passed in: subset object subList, horizontal axis position xAxis, vertical axis position yAxis, and layout according to the following three situations:
[0105] If the number of objects in subList is 1, then the node object is placed at [xAxis, yAxis];
[0106] If the number of objects in the subList is 2, then the two nodes are placed at [xAxis - r, yAxis] and [xAxis + r, yAxis] respectively (r < distance / 2), and a straight line is drawn between the two points;
[0107] If the number of objects in the subList is greater than or equal to 3, then a virtual circle is drawn with the position [xAxis, yAxis] as the center and r as the radius (r < distance / 2, otherwise adjacent concentric circles will intersect);
[0108] Calculate the equal division angle of the circle, that is, 360 / N, where N is the number of objects in the subList;
[0109] Use the third-party framework turf to get the center point of the circle circleCenter = turf.point([xAxis, yAxis]);
[0110] Traverse the subList, and according to the current node sequence i and the equal division angle, calculate the position where the current node should be laid out destination = turf.destination(circleCenter, r, i * 360 / N);
[0111] Connect the two points with a connection relationship with a straight line.
[0112] 105SS, expand the overlapping connections between two points: Click on the connection between any two points. If there are multiple connections between the two points, then divide the perpendicular distance from the center of the virtual concentric circle where the two points are located to the connection between the two points equally, and draw arcs with the segmentation points as the new centers in turn to achieve the effect of expanding the overlapping connections between the two points. The specific steps are as follows:
[0113] According to the connection Map structure, first splice the ids of the two points into a key, and then obtain the connection list lineList from the Map structure according to the key. Then the number of connections between the two points is N = lineList.length;
[0114] Calculate the center point coordinates between the two points centerAxis = [(x1 + x2) / 2, (y1 + y2) / 2], where x1 and y1 are the horizontal axis coordinate values of the first point, and x2 and y2 are the horizontal axis coordinate values of the second point;
[0115] Divide the distance from centerAxis to circleCenter into N equal parts. The position of the first point is centerAxis. Then the coordinates of the i-th point are [xi,yi]. According to the formula ((x1+x2) / 2-xAxis) / (xi-xAxis)=N / (Ni), the horizontal axis coordinate value xi of the i-th point can be calculated. According to the formula ((y1+y2) / 2-yAxis) / (yi-yAxis)=N / (Ni), the vertical axis coordinate value yi of the i-th point can be calculated.
[0116] Calculate the offset angle between the first point and point i bearing1 = turf.bearing([x1, y1], [xi, yi]), calculate the offset angle between the second point and point i bearing2 = turf.bearing([x2, y2], [xi, yi]), calculate the first point point1 = turf.point([x1, y1]), calculate point i pointi = turf.point([xi, yi]), calculate the distance from point i to the first point, that is, the radius of the new circle r = turf.distance(point1, pointi), and finally get the arc arc = turf.lineArc([(x1+x2) / 2,(y1+y2) / 2], r, bearing1, bearing2). Through the third-party tool turf, instantiate a point object according to the horizontal and vertical coordinate values, and use the point object as the input parameter of the turf algorithm to quickly calculate the distance between the two points.
[0117] The overlapping points and lines between points on the map are distributed in a scattered manner and the lines between points do not overlap by associating the overlapping point set, classifying by line relationship, horizontal and vertical axis alternating stand-in layout, concentric circle layout and other algorithms. By dividing the straight line distance from the center of the concentric circle to the line equally, and drawing arcs with the segment points as the new center of the circle, the overlapping lines between two points are expanded and do not overlap with the lines between other points. This layout method is currently used in the field of web development and can also be applied to other programming languages, supporting Gis maps, topology maps and other usage scenarios.
[0118] like Figure 2 As shown, a device for expanding map aggregation points and lines includes: a set acquisition unit 201, a set classification unit 202, a first layout unit 203, a second layout unit 204 and a line expansion unit 205;
[0119] A set acquisition unit 201, used for acquiring a set of coincident points when there are coincident points;
[0120] A set classification unit 202 is used to classify the coincident points in the coincident point set according to the node-line relationship to obtain a node-line relationship classification set;
[0121] The first layout unit 203 is used to layout the subsets in the node connection relationship classification set in an alternating manner along the horizontal and vertical axes to obtain a first layout; wherein the alternating arrangement along the horizontal and vertical axes is as follows: starting from x=1, y=1, the number of laid out subsets is N, and each time a subset is laid out, N increases by 1; when N=k*k, x starts from k+1, the next subset is placed at [k+1,1], and the next subset is placed at [1,k+1], and so on, alternating in sequence until the set is placed at [k+1,k+1], and x starts from k+2 again, until all sets are laid out, x is the horizontal axis coordinate, y is the vertical axis coordinate, and k is a positive integer;
[0122] A second layout unit 204 is used to perform concentric circle layout on the subset objects, horizontal axis positions and vertical axis positions in the first layout to obtain a second layout;
[0123] The line expansion unit 205 is used to select a line between any two points in the second layout. If there are multiple lines between the two points, the vertical distance from the center of the virtual concentric circle where the two points are located to the line between the two points is equally divided, and arcs are drawn with the segmentation points as the new center of the circle in turn to expand the overlapping lines between the two points, and repeat until all the overlapping lines are expanded.
[0124] The present invention achieves the effect of scattered distribution of overlapping points and non-overlapping lines between points by associating sets of overlapping points, classifying according to line relationships, alternating horizontal and vertical axis substitute layouts, concentric circle layouts and other algorithms. By dividing the straight-line distance from the center of the concentric circle to the line into equal parts, and drawing arcs with the segment points as the new center of the circle, the effect of expanding the overlapping lines between two points and not overlapping the lines between other points is achieved.
[0125] like Figure 3 As shown, the present disclosure provides an electronic device, including a processor 301, a communication interface 302, a memory 303 and a communication bus 304, wherein the processor 301, the communication interface 302 and the memory 303 communicate with each other through the communication bus 304;
[0126] Memory 303, storing computer programs;
[0127] The processor 301 is configured to implement the above method when executing the computer program stored in the memory 303 .
[0128] The present disclosure provides a computer-readable storage medium storing a computer program, wherein the computer program implements the above method when executed by a processor.
[0129] The computer-readable storage medium may be included in the device / apparatus described in the above embodiment; or it may exist independently without being assembled into the device / apparatus. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0130] According to an embodiment of the present disclosure, a computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, including but not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0131] In order to enable those skilled in the art to better understand the present disclosure, the principles of the present disclosure are described as follows in conjunction with the accompanying drawings:
[0132] Principle Figure 4 As shown in the figure, when you click a point on the map, you get the set of coincident points of that point. For example, when you click point A, you get the set of coincident points [A, B, C, D, E, F, G, H, J, K, L].
[0133] like Figure 4 As shown in the figure, according to the connection relationship of the nodes, the set of coincident points is reclassified. For example, there is a connection between A and B, a connection between C and D, a connection between A and E, a connection between B and F, a connection between F and G, a connection between D and H, and a connection between J and K. Then after classification, four subsets are obtained, namely [A, B, E, F, G], [C, D, H], [J, K], and [L].
[0134] like Figure 6 As shown, the classified sets are laid out in alternating positions along the horizontal and vertical axes, and the spacing parameter distance is set to 100. Then the first subset [A, B, E, F, G] is placed at [100, 100], the second subset [C, D, H] is placed at [200, 100], the third subset [J, K] is placed at [100, 200], and the fourth subset [L] is placed at [200, 200].
[0135] like Figure 7As shown, each subset is laid out in concentric circles. Since distance = 100, the radius of the concentric circle must be less than distance / 2, that is, 50. Let the radius of the concentric circle r = 40. The first subset [A, B, E, F, G] contains 5 nodes. Then the angles are equally divided, and the angle of A is 0, the angle of B is 72°, the angle of E is 144°, the angle of F is 216°, and the angle of G is 288°. According to the formula sinX = (x2-x1) / r and cosX = (y2-y1) / r, the coordinates of A, B, E, F, and G can be obtained as [100, 140], [138.044, 111.696], [139.66, 69.36], [60.34, 88.304], and [61.956, 111.696], respectively. Similarly, the coordinates of the three points in the second subset [C, D, H] can be obtained as [200, 140], [234.64, 80], and [165.36, 80]. The third subset [J, K] has only two nodes, with the coordinates of point J at [60, 200] and point K at [140, 200]. The fourth subset [L] has only one node, with the coordinates of L at [200, 200].
[0136] like Figure 8 As shown, expand the coincident lines between the two points. Assume that there are 4 lines between point A and point B, and the center point of point A and point B is [119.022, 125.848]. Divide the distance from the virtual center [100, 100] to the center point into 4 equal parts. According to the formulas (x-100) / (119.022-100)=i / 4 and (y-100) / (125.848-100)=i / 4, the coordinates of the 4 center points can be obtained as [104.7555, 106.462], [109.511, 112.924], [114.2665, 119.386], and [119.022, 125.848]. Then, based on these four center points and points A and B, 4 non-intersecting arc lines are calculated in turn.
[0137] Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure.
Claims
1. A method for expanding map aggregation points and lines, characterized in that: The method comprises: When there are coincident points, obtain the coincident point set; Classify the coincident points in the coincident point set according to the node-line relationship to obtain a node-line relationship classification set; The subsets in the node connection relationship classification set are arranged alternately along the horizontal and vertical axes to obtain a first layout; wherein the horizontal and vertical axes are arranged alternately in alternate positions as follows: starting from x=1, y=1, the number of arranged subsets is N, and each time a subset is arranged, N increases by 1; when N=k*k, x starts from k+1, the next subset is placed at [k+1,1], and the next subset is placed at [1, k+1], and so on, until the set is placed at [k+1,k+1], x starts from k+2 again, until all sets are arranged, x is the horizontal axis coordinate, y is the vertical axis coordinate, and k is a positive integer; Arrange the subset objects, horizontal axis positions and vertical axis positions in the first layout in concentric circles to obtain a second layout; For the line between any two points selected in the second layout, if there are multiple lines between the two points, divide the vertical distance from the center of the virtual concentric circle where the two points are located to the line between the two points into equal parts, and draw arcs with the segmentation points as the new center of the circle in turn, and repeat until all the overlapping lines are unfolded.
2. A method for expanding map aggregation points and lines according to claim 1, characterized in that: The overlapping points include: Any two points are considered to have coincident points if they meet any of the following conditions: The two points completely overlap, that is, the distance between the centers of the two points is 0; The two points partially overlap, that is, the distance between the centers of the two points is greater than 0 and less than 2r, where r is the radius of the point; Two points are adjacent, that is, the distance between the centers of the two points is equal to 2r; There is a line between two points, and the distance between the centers of the two points is greater than 2r and less than 2r+k, where k is the length threshold of the line between the two points.
3. A method for expanding map aggregation points and lines according to claim 1, characterized in that: The obtaining of the set of coincident points includes: Select one of the coincident points, node N1, on the map, obtain the set list1 of all nodes that coincide with point N1, and then remove point N1 from list1 to obtain the set tempList1; Get the first node N2 in the set tempList1, get all the nodes set2 that overlap with N2, then take the union with list1 to get the node list list2, and then remove N1 and N2 from list2 to get the set tempList2; Repeat until the set tempListN is empty, and then the obtained listN is the set of coincident points of point N1.
4. A method for expanding map aggregation points and lines according to claim 1, characterized in that: The step of classifying the coincident points in the coincident point set according to the node-line relationship to obtain the node-line relationship classification set includes: Get the set of nodes and corresponding links in the coincident point set, where the link object contains the source node id and sink node id fields; Initialize a Map structure for caching connections, where the key is a string format of "source node id-destination node id" and the value is a connection object; traverse the connection set returned by the interface, concatenate the source node id and the destination node id of each connection data structure into a string of "source node id-destination node id" or "destination node id-source node id", and determine whether the Map structure contains the string. If it does not contain it, use "source node id-destination node id" as the key and the connection object as the value to store it in the Map structure; Initialize a classification set classifyList, traverse all the keys of the Map structure, obtain the source node id and the sink node id, and determine whether the obtained set of coincident points coincidentPointSet contains the source node id or the sink node id; If coincidentPointSet contains both the source node id and the sink node id, traverse classifyList. If classifyList[i] contains the source node id or the sink node id, add the source node id and the sink node id to classifyList[i], and assign index to i. After the loop ends, if index is null, create a new Set object, add the source node id and the sink node id to the Set object, and add the Set object to classifyList. If coincidentPointSet only contains the source node id, traverse classifyList. If classifyList[i] contains the source node id, assign index to i. After the loop ends, if index is null, create a new Set object, add the source node id to the Set object, and add the Set object to classifyList. If coincidentPointSet only contains the sink node id, traverse classifyList. If classifyList[i] contains the sink node id, assign index to i. After the loop ends, if index is null, create a new Set object, add the sink node id to the Set object, and add the Set object to classifyList. classifyList is a collection of node-link relationship classifications.
5. A method for expanding map aggregation points and lines according to claim 1, characterized in that: The step of arranging the subsets in the node connection relationship classification set in alternating positions along the horizontal and vertical axes includes: Initialize variables k, x, and y, assign an initial value of 1 to k, x is the horizontal axis coordinate, y is the vertical axis coordinate, and set the spacing parameter distance; Traverse the node connection relationship classification set classifyList, i is the traversal index, when (i+1)<=k*k, execute the following steps: Obtain the difference res = (i + 1) - (k - 1) * (k - 1). If res is even, layout the current subset at x = res / 2, y = k; if res is odd, layout the current subset at x = k, y = (res + 1) / 2. When the x and y values are equal, increment k by 1.
6. The method for expanding map aggregation points and lines according to claim 1, characterized in that The concentric circle layout of the subset object, horizontal axis position, and vertical axis position in the first layout includes: When the number of objects in the subset object subList is 1, place the current node object at [xAxis, yAxis], where xAxis is the horizontal axis position and yAxis is the vertical axis position; When the number of objects in the subset object subList is 2, place the two nodes at [xAxis - r, yAxis] and [xAxis + r, yAxis] respectively, and connect the two points with a straight line; When the number of objects in the subset object subList is greater than or equal to 3, draw a virtual circle with [xAxis, yAxis] as the center and r as the radius, where r < distance / 2, distance is the spacing parameter, and r is the radius of the point; Calculate the equally divided angle 360 / N of the virtual circle, where N is the number of objects in subList; calculate the center point circleCenter; traverse the subset object subList, and calculate the layout position of the current node according to the current node sequence i and the equally divided angle; connect the two points with a connection relationship with a straight line.
7. The method for expanding map aggregation points and lines according to claim 1, characterized in that For the connection between any two points selected in the second layout, if there are multiple connections between the two points, equally divide the perpendicular distance from the center of the virtual concentric circle where the two points are located to the connection between the two points, and draw arcs with the segmented points as new centers in turn to realize the expansion of the overlapping connection between the two points, including: According to the connection Map structure, first splice the ids of the two points into a key, and then obtain the connection list lineList from the Map structure according to the key. The number of connections between the two points is N = lineList.length; Calculate the center point coordinates between the two points centerAxis = [(x1 + x2) / 2, (y1 + y2) / 2], where x1, y1 are the coordinate values of the first point, and x2, y2 are the coordinate values of the second point; Equally divide the distance from centerAxis to the center circleCenter in the concentric circle layout into N parts. The position of the first point is centerAxis, and the coordinates of the i-th point are [xi, yi]. Calculate the horizontal axis coordinate value xi of the i-th point according to the formula ((x1 + x2) / 2 - xAxis) / (xi - xAxis) = N / (N - i), and calculate the vertical axis coordinate value yi of the i-th point according to the formula ((y1 + y2) / 2 - yAxis) / (yi - yAxis) = N / (N - i); Through the tripartite framework turf, the offset angle between the first point and point i is calculated bearing1 = turf.bearing([x1,y1],[xi,yi]), the offset angle between the second point and point i is calculated bearing2 = turf.bearing([x2,y2],[xi,yi]), the first point object point1 = turf.point([x1,y1]), the i-th point object pointi = turf.point([xi,yi]), the distance from point i to the first point is calculated, that is, the radius of the new circle r = turf.distance(point1,pointi), and finally the arc arc = turf.lineArc([(x1+x2) / 2,(y1+y2) / 2], r, bearing1, bearing2).
8. A device for expanding map aggregation points and lines, characterized in that: include: A collection acquisition unit, a collection classification unit, a first layout unit, a second layout unit and a connection expansion unit; A set acquisition unit, used for acquiring a set of coincident points when there are coincident points; A set classification unit is used to classify the coincident points in the coincident point set according to the node-line relationship to obtain a node-line relationship classification set; The first layout unit is used to layout the subsets in the node connection relationship classification set in an alternating manner along the horizontal and vertical axes to obtain a first layout; wherein the horizontal and vertical axes are arranged in an alternating manner as follows: starting from x=1, y=1, the number of laid out subsets is N, and each time a subset is laid out, N increases by 1; when N=k*k, x starts from k+1, the next subset is placed at [k+1,1], and the next subset is placed at [1, k+1], and so on, alternating in sequence until the set is placed at [k+1,k+1], and x starts from k+2 again, until all sets are laid out, x is the horizontal axis coordinate, y is the vertical axis coordinate, and k is a positive integer; A second layout unit is used to arrange the subset objects, horizontal axis positions and vertical axis positions in the first layout in concentric circles to obtain a second layout; The line expansion unit is used to select a line between any two points in the second layout. If there are multiple lines between the two points, the vertical distance from the center of the virtual concentric circle where the two points are located to the line between the two points is equally divided, and arcs are drawn with the segmentation points as the new center of the circle in turn, and this is repeated until all the overlapping lines are expanded.
9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; a memory storing a computer program; A processor is used to implement a method for expanding map aggregation points and lines as described in any one of claims 1 to 7 when executing a computer program stored in a memory.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, a method for expanding map aggregation points and lines according to any one of claims 1 to 7 is implemented.