Disclosure of Invention
The invention provides a map drawing method, a map drawing device, terminal equipment and a readable storage medium, which can automatically form a graph on a map according to information input by a user to finish map drawing.
Additional features and advantages of the invention will be set forth in the detailed description which follows, or may be learned by practice of the invention.
According to an aspect of the present invention, there is provided a map drawing method, including: acquiring screen coordinates of a first input point, a second input point and a third input point; determining screen coordinates of the first intermediate point and the second intermediate point according to the screen coordinates of the first input point, the second input point and the third input point; determining screen coordinates of the first output point and the second output point according to the screen coordinates of the third input point and the second intermediate point; forming and displaying a plotting graph consisting of a first input point, a second input point, a third input point, a first output point and a second output point in the map; the first input point and the second input point are any two advancing starting points in the area where the group is located, the third input point is any one point in the advancing direction of the group, and the plotting graph is used for representing the advancing trend of the group.
According to an embodiment of the present invention, determining the screen coordinates of the first intermediate point and the second intermediate point according to the screen coordinates of the first input point, the second input point, and the third input point includes: according to the screen coordinates of the first input point and the second input point, determining the coordinates of the first intermediate point as follows:
according to the screen coordinates of the first intermediate point and the third input point, determining the coordinates of the second intermediate point as follows:
wherein, (P1.x, P1.y), (P2.x, P2.y), (P3.x, P3.y), (Pa.x, Pa.y) and (Pb.x, Pb.y) are x-coordinate and y-coordinate of the first input point, the second input point, the third input point, the first intermediate point and the second intermediate point, respectively.
According to an embodiment of the present invention, determining the screen coordinates of the first output point and the second output point according to the screen coordinates of the third input point and the second intermediate point includes: determining a distance C between the third input point and the second intermediate point as:
determining the inclination angle S of a connecting line between the third input point and the second intermediate point; and determining the screen coordinates of the first output point and the second output point to be respectively:
wherein, (p4.x, p4.y), (p5.x, p5.y) are x coordinates and y coordinates of the first output point and the second output point, respectively.
According to an embodiment of the present invention, a plot graph formed and displayed on a map and including a first input point, a second input point, a third input point, a first output point, and a second output point includes: forming a first Bezier curve between the first input point and the third input point by taking the first input point as a starting point, the third input point as an end point and the first intermediate point as a closing control point; forming a second Bezier curve between the second input point and the third input point by taking the second input point as a starting point, the third input point as an end point and the first middle point as a closing control point; respectively forming a first connecting line, a second connecting line and a third connecting line between the first output point and the third input point, between the second output point and the third input point and between the first output point and the second output point; and forming a plotting graph according to the first Bezier curve, the second Bezier curve, the third Bezier curve, the first connecting line, the second connecting line and the third connecting line.
According to an embodiment of the present invention, the method further includes: when the screen coordinates of the first input point, the second input point or the third input point are changed, updating the coordinates of the first intermediate point, the second intermediate point, the first output point and the second output point according to the changed screen coordinates of the first input point, the second input point or the third input point; and forming and displaying an updated plotting graph consisting of the changed first input point, the changed second input point, the changed third input point, the updated first output point and the updated second output point in the map.
According to an embodiment of the present invention, the first input point, the second input point, and the third input point are touch points or mouse click points on the screen, and the acquiring the screen coordinates of the first input point, the second input point, and the third input point includes: and detecting the screen coordinates of the touch point or the mouse click point to acquire the screen coordinates of the first input point, the second input point and the third input point.
According to an embodiment of the present invention, acquiring the screen coordinates of the first input point, the second input point and the third input point includes: receiving map geographic coordinates of a first input point, a second input point and a third input point input by a user; and converting the map geographic coordinates of the first input point, the second input point and the third input point into corresponding screen coordinates.
According to still another aspect of the present invention, there is provided a map drawing apparatus including: the input point coordinate acquisition module is used for acquiring screen coordinates of the first input point, the second input point and the third input point; the intermediate point coordinate determination module is used for determining the screen coordinates of the first intermediate point and the second intermediate point according to the screen coordinates of the first input point, the second input point and the third input point; the output point coordinate determination module is used for determining the screen coordinates of the first output point and the second output point according to the screen coordinates of the third input point and the second intermediate point; the plotting graph forming module is used for forming and displaying a plotting graph formed by a first input point, a second input point, a third input point, a first output point and a second output point in a map; the first input point and the second input point are any two advancing starting points in the area where the group is located, the third input point is any one point in the advancing direction of the group, and the plotting graph is used for representing the advancing trend of the group.
According to still another aspect of the present invention, there is provided a terminal device including: a memory, a processor, and executable instructions stored in the memory and executable in the processor, the processor implementing any of the methods described above when executing the executable instructions.
According to yet another aspect of the invention, there is provided a readable storage medium having stored thereon computer-executable instructions which, when executed by a processor, implement any of the methods described above.
According to the map marking method, the moving trend of group traveling can be automatically formed only by acquiring the screen coordinates of the three points input by the user, the inconvenience of manual drawing of a graph in a screen by the user is avoided, the automatically formed graph is more attractive, and better experience is brought to the user.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention, as claimed.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The drawings are merely schematic illustrations of the invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to provide a thorough understanding of embodiments of the invention. One skilled in the relevant art will recognize, however, that the invention may be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known structures, methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the invention.
When a group needs to travel collectively, a graph needs to be drawn in the map for representing a travel trend of the group. The map-marking method of the embodiment of the invention can automatically form the graph through simple input of a user so as to indicate the moving situation of group traveling.
FIG. 1 is a flow chart illustrating a method of depicting a map according to an exemplary embodiment. As shown in fig. 1, the method 10 includes:
in step S102, screen coordinates of the first input point, the second input point, and the third input point are obtained.
The first input point and the second input point are any two traveling starting points in the area where the group is located. For example, when the population is large, and the coverage of the gathering area is large, two travel starting points on the edge of the area can be selected in.
The third input point is any point in the direction of travel of the population. If it is desired to proceed in the current southeast direction, then an optional point in its southeast direction is taken as the third input point.
In step S104, screen coordinates of the first intermediate point and the second intermediate point are determined according to the screen coordinates of the first input point, the second input point, and the third input point.
In step S106, screen coordinates of the first output point and the second output point are determined according to the screen coordinates of the third input point and the second intermediate point.
In step S108, a plot graph including the first input point, the second input point, the third input point, the first output point, and the second output point is formed and displayed on the map.
According to the map marking method, the moving trend of group traveling can be automatically formed only by acquiring the screen coordinates of the three points input by the user, the inconvenience of manual drawing of a graph in a screen by the user is avoided, the automatically formed graph is more attractive, and better experience is brought to the user.
It should be clearly understood that the present disclosure describes how to make and use particular examples, but the principles of the present disclosure are not limited to any details of these examples. Rather, these principles can be applied to many other embodiments based on the teachings of the present disclosure.
FIG. 2 is a flow chart illustrating another map plotting method according to an exemplary embodiment. As shown in fig. 2, the method 20 includes:
in step S202, screen coordinates of the first input point, the second input point, and the third input point are obtained.
The first input point and the second input point are any two traveling starting points in the area where the group is located. For example, when the population is large, and the coverage of the gathering area is large, two travel starting points on the edge of the area can be selected in.
The third input point is any point in the direction of travel of the population. If it is desired to proceed in the current southeast direction, then an optional point in its southeast direction is taken as the third input point.
FIG. 3 is a diagram illustrating a first input point, a second input point, and a third input point according to an example, as shown in FIG. 3, the first input point, the second input point, and the third input point may be respectively represented as a point ①, a point ②, and a point ③.
In some embodiments, the user may use a finger or a stylus to perform input by touching or clicking on the touch screen, or the user may use a mouse to click on the screen of the display to perform input, that is, the first input point, the second input point, and the third input point are touch points or mouse click points on the screen. Under the condition, the screen coordinates of the touch point or the mouse click point are directly detected, and the screen coordinates of the first input point, the second input point and the third input point can be obtained.
In some embodiments, the user may input the map geographic coordinates (e.g., longitude and latitude, etc.) of the first input point, the second input point, and the third input point through input boxes provided in the map software, or the like. In this case, after receiving the map geographic coordinates of the first input point, the second input point, and the third input point input by the user, the map geographic coordinates are converted into screen coordinates of the first input point, the second input point, and the third input point.
In step S204, the coordinates of the first intermediate point are determined according to the screen coordinates of the first input point and the second input point.
For example, if x and y coordinates of the first input point, the second input point, and the first intermediate point are represented by (p1.x, p1.y), (p2.x, p2.y), and (pa.x, pa.y), respectively, the coordinates of the first intermediate point are:
in step S206, the coordinates of the second intermediate point are determined according to the screen coordinates of the first intermediate point and the third input point.
For example, if the x coordinate and the y coordinate of the third input point and the second intermediate point are represented by (p3.x, p3.y) and (pb.x, pb.y), respectively, the coordinates of the second intermediate point are:
FIG. 4 is a schematic diagram illustrating a first input point, a second input point, a third input point, a first intermediate point, and a second intermediate point according to an example, in FIG. 4, the first input point, the second input point, and the third input point can be respectively represented as point ①, point ②, and point ③, and the first intermediate point and the second intermediate point determined according to the above formula can be respectively represented as point A and point B.
In step S208, the distance between the third input point and the second intermediate point is determined.
The distance is denoted by C, then
In step S210, the tilt angle of the line between the third input point and the second intermediate point is determined.
The inclination angle S can be calculated by means of the function atan2(x, y), i.e. S ═ atan2((p3.y-pb.y), (p 3.x-pb.x)).
In step S212, the screen coordinates of the first output point and the second output point are determined according to the coordinates of the third input point, the distance and the tilt angle.
For example, if (p4.x, p4.y) and (p5.x, p5.y) are x coordinates and y coordinates of the first output point and the second output point, respectively, the coordinates of the first output point and the second output point are:
FIG. 5 is a schematic diagram illustrating a first input point, a second input point, a third input point, a first intermediate point, a second intermediate point, a first output point, and a second output point according to an example, where the first input point, the second input point, the third input point, the first intermediate point, and the second intermediate point are respectively represented as point ①, point ②, point ③, point A, and point B, and the first output point and the second output point determined according to the above formula are respectively represented as point ④ and point ⑤, as shown in FIG. 5.
In step S214, a first bezier curve between the first input point and the third input point is formed by using the first input point as a starting point, the third input point as an ending point, and the first intermediate point as a close control point.
In practical implementation, the first bezier curve may be generated by a bezier curve function, for example.
In step S216, a second bezier curve between the second input point and the third input point is formed by using the second input point as a starting point, the third input point as an ending point, and the first intermediate point as a closing control point.
Likewise, in actual implementation, the second bezier curve may be generated by a bezier curve function, for example.
In step S218, a first connection, a second connection and a third connection between the first output point and the third input point, the second output point and the third input point, and the first output point and the second output point are formed, respectively.
The first, second and third links may be common segments between the two endpoints.
Fig. 6 is a schematic diagram illustrating a first bezier curve, a second bezier curve, a third bezier curve, a first wire, a second wire, and a third wire, according to an example.
In step S220, the plot graph is formed from the first bezier curve, the second bezier curve, the third bezier curve, the first connection line, the second connection line, and the third connection line.
FIG. 7 is a schematic diagram of plotted graphics in a map shown according to an example. After the triangle formed by the first, second, and third links in fig. 6 is filled with colors, for example, red may be filled for highlighting, and an arrow indicating the group movement tendency is formed as shown in fig. 7.
In addition, in some embodiments, after the plot graph is formed, if the screen coordinates of the first input point, the second input point, or the third input point are changed, for example, in a dragging manner, the screen coordinates of the first intermediate point, the second intermediate point, the first output point, and the second output point may be updated again by the above method, and a new plot graph may be formed and displayed again in the map. Therefore, 360-degree dragging and stretching of the plotting graph can be realized.
Those skilled in the art will appreciate that all or part of the steps implementing the above embodiments are implemented as computer programs executed by a CPU. The computer program, when executed by the CPU, performs the functions defined by the method provided by the present invention. The program may be stored in a computer readable storage medium, which may be a read-only memory, a magnetic or optical disk, or the like.
Furthermore, it should be noted that the above-mentioned figures are only schematic illustrations of the processes involved in the method according to exemplary embodiments of the invention, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
The following are embodiments of the apparatus of the present invention that may be used to perform embodiments of the method of the present invention. For details which are not disclosed in the embodiments of the apparatus of the present invention, reference is made to the embodiments of the method of the present invention.
FIG. 8 is a block diagram illustrating a terrain rendering apparatus according to an exemplary embodiment. As shown in fig. 8, the apparatus 30 includes: an input point coordinate acquisition module 302, an intermediate point coordinate determination module 304, an output point coordinate determination module 306, and a plot graph formation module 308.
The input point coordinate obtaining module 302 is configured to obtain screen coordinates of a first input point, a second input point, and a third input point.
The first input point and the second input point are any two advancing starting points in the area where the group is located, the third input point is any one point in the advancing direction of the group, and the plotting graph is used for representing the advancing trend of the group.
In some embodiments, the first input point, the second input point, and the third input point are touch points or mouse click points on the screen, and the input point coordinate obtaining module 302 includes: and the coordinate detection submodule is used for detecting the screen coordinates of the touch point or the mouse click point so as to acquire the screen coordinates of the first input point, the second input point and the third input point.
In some embodiments, the input point coordinate acquisition module 302 includes: a coordinate receiving submodule and a coordinate conversion submodule. The coordinate receiving submodule is used for receiving the map geographic coordinates of the first input point, the second input point and the third input point input by the user. And the coordinate conversion submodule is used for converting the map geographic coordinates of the first input point, the second input point and the third input point into corresponding screen coordinates.
The middle point coordinate determination module 304 is configured to determine the screen coordinates of the first middle point and the second middle point according to the screen coordinates of the first input point, the second input point, and the third input point.
In some embodiments, the intermediate point coordinate
determination module 304 comprises: a first intermediate point coordinate determination submodule and a second intermediate point coordinate determination submodule. The first intermediate point coordinate determination submodule is used for determining the coordinates of the first intermediate point according to the screen coordinates of the first input point and the second input point as follows:
second intermediate point coordinate determination submoduleAnd determining the coordinates of the second intermediate point as follows according to the screen coordinates of the first intermediate point and the third input point:
wherein, (P1.x, P1.y), (P2.x, P2.y), (P3.x, P3.y), (Pa.x, Pa.y) and (Pb.x, Pb.y) are x-coordinate and y-coordinate of the first input point, the second input point, the third input point, the first intermediate point and the second intermediate point, respectively.
The output point coordinate determination module 306 is configured to determine the screen coordinates of the first output point and the second output point according to the screen coordinates of the third input point and the second intermediate point.
In some embodiments, the output point coordinate
determination module 306 includes: the device comprises a distance determining submodule, a tilt angle determining submodule and an output point determining submodule. The distance determining submodule is used for determining the distance C between the third input point and the second middle point as follows:
the tilt angle determination submodule is used for determining a tilt angle S of a line between the third input point and the second intermediate point. The output point determining submodule is used for determining screen coordinates of the first output point and the second output point according to the coordinate, the distance C and the inclination angle S of the third input point, and respectively comprises:
wherein, (p4.x, p4.y), (p5.x, p5.y) are x coordinates and y coordinates of the first output point and the second output point, respectively.
The plot graph forming module 308 is configured to form and display a plot graph composed of the first input point, the second input point, the third input point, the first output point, and the second output point in the map.
In some embodiments, the plot formation module 308 includes: the first curve forming submodule, the second curve forming submodule, the connecting line forming submodule and the graph forming submodule. The first curve forming submodule is used for forming a first Bezier curve between the first input point and the third input point by taking the first input point as a starting point, the third input point as an end point and the first middle point as a closing control point. The second curve forming submodule is used for forming a second Bezier curve between the second input point and the third input point by taking the second input point as a starting point, taking the third input point as an end point and taking the first middle point as a closing control point. The connecting line forming submodule is used for respectively forming a first connecting line, a second connecting line and a third connecting line between the first output point and the third input point, between the second output point and the third input point and between the first output point and the second output point. The graph forming submodule is used for forming a plotting graph according to the first Bezier curve, the second Bezier curve, the third Bezier curve, the first connecting line, the second connecting line and the third connecting line.
In some embodiments, the apparatus 30 further comprises: a plot graph changing module 310, configured to update coordinates of the first intermediate point, the second intermediate point, the first output point, and the second output point according to the changed screen coordinates of the first input point, the second input point, or the third input point when the screen coordinates of the first input point, the second input point, or the third input point are changed; and forming and displaying an updated plotting graph consisting of the changed first input point, the changed second input point, the changed third input point, the updated first output point and the updated second output point in the map.
It is noted that the block diagrams shown in the above figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware.
For example, in some possible embodiments, aspects of the invention may be implemented in the form of a terminal device. A terminal device according to embodiments of the present invention may include at least one processor and at least one memory. Wherein the memory has executable instructions that, when executed by the processor, cause the processor to perform steps in a map plotting method according to various exemplary embodiments of the present invention. Such as steps S102 to S108 in the method 10 shown in fig. 1 and steps S202 to S220 in the method 20 shown in fig. 2.
Furthermore, in some possible embodiments, aspects of the present invention may also be implemented in the form of a program product, which may be stored in a non-volatile readable storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, comprising executable instructions, which when run on a terminal device, are adapted to cause the terminal device to perform the steps in the map plotting method according to various exemplary embodiments of the present invention. Such as steps S102 to S108 in the method 10 shown in fig. 1 and steps S202 to S220 in the method 20 shown in fig. 2.
Exemplary embodiments of the present invention are specifically illustrated and described above. It is to be understood that the invention is not limited to the precise construction, arrangements, or instrumentalities described herein; on the contrary, the invention is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.