CN109145064B - Method, system, terminal and computer equipment for zooming map - Google Patents
Method, system, terminal and computer equipment for zooming map Download PDFInfo
- Publication number
- CN109145064B CN109145064B CN201710462289.2A CN201710462289A CN109145064B CN 109145064 B CN109145064 B CN 109145064B CN 201710462289 A CN201710462289 A CN 201710462289A CN 109145064 B CN109145064 B CN 109145064B
- Authority
- CN
- China
- Prior art keywords
- value
- point
- longitude
- diagonal
- latitude
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/40—Scaling of whole images or parts thereof, e.g. expanding or contracting
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Instructional Devices (AREA)
- Navigation (AREA)
- Processing Or Creating Images (AREA)
- User Interface Of Digital Computer (AREA)
Abstract
The invention provides a method, a system, a terminal and computer equipment for zooming a map, which are applied to the technical field of data processing, and the method for zooming the map comprises the following steps: acquiring coordinates of a fixed point on a map and all coordinates of a group of points; obtaining coordinates of a center point of a first rectangle surrounding a group of points; acquiring a second rectangle according to the coordinates of the central point and the coordinates of the fixed point; the map is zoomed according to the second rectangle. The method and the device can ensure that the position of the fixed point is unchanged when the map is zoomed, well solve the problem that the fixed point can be found only by moving the map after the map is zoomed for one time in the related technology, save the time of the user for zooming the map and improve the use satisfaction of the user.
Description
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a method, a system, a computer device, and a computer-readable storage medium for zooming a map.
Background
When using a taxi taking application or finding a route, all surrounding drivers or routes are contained in a map, and then the map is zoomed, and the position of the point (any point) of the user needs to be kept constant. The map is zoomed according to the longitude and latitude of a group of points and the longitude and latitude of a fixed point, so that all the points are in a visible range and the positions of the fixed points are kept unchanged.
In the related art, to achieve the above object, there are two schemes:
scheme 1: zooming is performed according to a group of points, and after zooming is performed according to the scheme, the positions of the points on the map may be shifted, namely, the goal of keeping the positions of certain fixed points unchanged while zooming cannot be achieved.
Scheme 2: zooming is carried out according to a group of points, the map is moved after zooming is finished, the fixed point is returned to the original position by the scheme, the purpose that the position of the fixed point is kept unchanged can be achieved, and the map is moved once after zooming, so that user experience is poor.
Disclosure of Invention
The present invention is directed to solving at least one of the problems of the prior art or the related art.
To this end, it is an object of the invention to propose a method of zooming a map.
It is another object of the invention to provide a system for zooming a map.
It is a further object of the present invention to provide a terminal.
It is a further object of the invention to propose a computer device.
It is yet another object of the present invention to provide a computer-readable storage medium.
In view of the above, according to an object of the present invention, a method for zooming a map is provided, which is used for a terminal, and the method for zooming the map includes: acquiring coordinates of a fixed point on a map and all coordinates of a group of points; obtaining coordinates of a center point of a first rectangle surrounding a group of points; acquiring a second rectangle according to the coordinates of the central point and the coordinates of the fixed point; the map is zoomed according to the second rectangle.
The invention provides a method for zooming a map, which comprises the steps of determining a point where a user is located on the map as a fixed point, taking a point in a zooming range of the user as a group of points, simultaneously obtaining coordinates of all points marked by the fixed point and contained in the group of points, forming a first rectangle according to the group of points, obtaining a center point coordinate of the first rectangle, comparing the position relation of the center point coordinate of the first rectangle with the coordinates of the fixed point, obtaining a second rectangle, taking the center point of the second rectangle as the fixed point, determining the maximum latitude value, the maximum longitude value point, the minimum latitude value and the minimum longitude value of the second rectangle, determining the coordinates of the maximum latitude value, the maximum longitude value point, the minimum latitude value and the minimum longitude value as position points of fingers when the user zooms the map, and zooming the map according to the two points. The method and the device can ensure that the position of the fixed point (namely the point where the user is) is unchanged when the map is zoomed, well solve the problem that the fixed point can be found only by moving the map after the map is zoomed for one time in the related technology, save the time of the user for zooming the map and improve the use satisfaction degree of the user.
The method for zooming the map according to the present invention may further have the following technical features:
in the above technical solution, preferably, the coordinates include latitude values and longitude values, and the first rectangle includes a first diagonal point and a second diagonal point; the coordinates of the first diagonal point are the maximum latitude values and the maximum longitude values in all coordinates, and the coordinates of the second diagonal point are the minimum latitude values and the minimum longitude values in all coordinates; the center point of the first rectangle is the center point of the connecting line of the first diagonal point and the second diagonal point.
In the technical scheme, a user can obtain a group of points when zooming on a map through a gesture, the longitude and latitude values of coordinates of all the points in the group of points are circularly compared (the coordinates comprise longitude values and latitude values), a first rectangle consisting of the group of points is determined through the longitude and latitude values of the coordinates, and then a first diagonal point and a second diagonal point of the first rectangle are determined, the coordinates of the first diagonal point are the maximum latitude value and the maximum longitude value in all the coordinates, the coordinates of the second diagonal point are the minimum latitude value and the minimum longitude value in all the coordinates, the middle point of diagonal lines of the first diagonal point and the second diagonal point is the central point of the first rectangle, the purpose of ensuring that the position of the fixed point is unchanged is laid down through the determination of the central point of the first rectangle, and the user can directly see the fixed point after performing gesture zooming on any position of the map is ensured, the map does not need to be moved again, and the operation of the user is saved.
In any of the above technical solutions, preferably, the step of obtaining the second rectangle according to the coordinates of the central point and the coordinates of the fixed point specifically includes: calculating a difference value between the longitude value of the fixed point coordinate and the longitude value of the central point coordinate to serve as a longitude difference value; calculating the difference value between the latitude value of the fixed point coordinate and the latitude value of the central point coordinate to be used as a latitude difference value; calculating a third diagonal point and a fourth diagonal point according to the longitude difference and the latitude difference; and taking a rectangle with the third diagonal point as the coordinate point with the maximum latitude value and the maximum longitude value and the fourth diagonal point as the coordinate point with the minimum latitude value and the minimum longitude value as a second rectangle.
In the technical scheme, the coordinates of the fixed point and the coordinates of the center point of the acquired first rectangle are subjected to difference value calculation of longitude values and latitude values respectively to obtain longitude difference values and latitude difference values, and then a third diagonal point coordinate and a fourth diagonal point coordinate of the second rectangle are calculated according to the two difference values and the first diagonal point coordinate and the second diagonal point coordinate of the first rectangle, wherein the third diagonal point is a coordinate point with the maximum latitude value and the maximum longitude value, and the fourth diagonal point is a coordinate point with the minimum latitude value and the minimum longitude value, so that the gesture zooming of the user is performed according to the third diagonal point coordinate and the fourth diagonal point coordinate of the second rectangle, the problem of position change of the fixed point caused by zooming according to the original rectangle is avoided, and the user can see the expected zooming effect through one-time zooming of the map.
In any of the above technical solutions, preferably, the step of calculating a third diagonal point and a fourth diagonal point according to the longitude difference and the latitude difference specifically includes: judging whether the longitude difference is greater than zero; when the longitude difference is larger than zero, calculating the longitude value of the third diagonal point coordinate according to a first preset formula, and taking the longitude value of the second diagonal point coordinate as the longitude value of the fourth diagonal point coordinate; judging whether the latitude difference value is larger than zero; when the latitude difference value is larger than zero, calculating the latitude value of the third diagonal point coordinate according to a second preset formula, and taking the latitude value of the second diagonal point coordinate as the latitude value of the fourth diagonal point coordinate; the first predetermined formula is LAN2=LAN1+2 XDA, wherein, LAN2Longitude value being the third diagonal coordinate, LAN1The longitude value of the first diagonal point coordinate is obtained, and DA is a longitude difference value; the second predetermined formula is LNN2=LNN1+2 XDN, wherein LNN2Latitude value, LNN, being the third diagonal coordinate1And DN is the latitude value of the coordinate of the first diagonal point, and is the latitude difference value.
In the technical scheme, when the calculated longitude difference is greater than zero, the longitude value of the fixed point is greater than the longitude value at the center point of the first rectangle, which means that if the map is zoomed according to the first diagonal point and the second diagonal point of the first rectangle, the position of the fixed point will change, even the fixed point cannot be displayed in the map display range, so the longitude value of the third diagonal point coordinate of the second rectangle is calculated according to the first preset formula, the longitude value of the third diagonal point coordinate is increased by a double longitude difference value on the basis of the longitude value of the first diagonal point coordinate of the first rectangle, and the longitude value of the second diagonal point coordinate of the first rectangle is taken as the longitude value of the fourth diagonal point coordinate of the second rectangle. When the calculated latitude difference value is greater than zero, the latitude value of the fixed point is greater than that of the center point of the first rectangle, and it is also explained that if the map is zoomed according to the first diagonal point and the second diagonal point of the first rectangle, the position of the fixed point will change, even the fixed point cannot be displayed in the map display range, so the latitude value of the third diagonal point coordinate of the second rectangle is calculated according to the second preset formula, and the latitude value of the second diagonal point coordinate of the first rectangle is taken as the latitude of the fourth diagonal point coordinate of the second rectangle, so that the map is zoomed according to the third diagonal point coordinate and the fourth diagonal point coordinate of the second rectangle, and the position of the fixed point is ensured to be unchanged.
In any of the above technical solutions, preferably, the step of calculating a third diagonal point and a fourth diagonal point according to the longitude difference and the latitude difference further includes: when the longitude difference value is not greater than zero, taking the longitude value of the first diagonal point coordinate as the longitude value of a third diagonal point coordinate, and calculating the longitude value of a fourth diagonal point coordinate according to a third preset formula; when the latitude difference value is not more than zero, taking the latitude value of the first diagonal point coordinate as the latitude value of a third diagonal point coordinate, and calculating the latitude value of a fourth diagonal point coordinate according to a fourth preset formula; the third predetermined formula is LAS2=LAS1-2 x DA, wherein LAS2Longitude value, LAS, being the fourth diagonal point coordinate1Longitude values which are coordinates of the second diagonal points; the fourth preset formula is LNS2=LNS1-2 x DN, wherein LNS2Latitude value of fourth diagonal coordinate, LNS1Is the latitude value of the second diagonal point coordinate.
In the technical scheme, when the longitude difference is less than zero, the longitude value of the fixed point is smaller than the longitude value at the center point of the first rectangle, and if the map is zoomed by the first rectangle, the position of the fixed point is changed certainly, so that the longitude value of the first diagonal point coordinate of the first rectangle is used as the longitude value of the third diagonal point coordinate of the second rectangle, and the longitude value of the fourth diagonal point coordinate of the second rectangle is calculated according to a third preset formula. When the latitude difference value is not greater than zero, the latitude value of the fixed point is smaller than that of the center point of the first rectangle, the latitude value of the first diagonal point coordinate of the first rectangle is used as the latitude value of the third diagonal point coordinate of the second rectangle, and the latitude value of the fourth diagonal point coordinate of the second rectangle is calculated according to a fourth preset formula, so that the map is zoomed according to the third diagonal point coordinate and the fourth diagonal point coordinate of the second rectangle, and the situation that the position of the fixed point changes and further inconvenience is brought to the use of the map by a user is avoided.
According to another object of the present invention, there is provided a system for zooming a map, for a terminal, comprising: the first acquisition unit is used for acquiring the coordinates of a fixed point on a map and all the coordinates of a group of points; a second acquisition unit configured to acquire coordinates of a center point of a first rectangle surrounding a group of points; the third acquisition unit is used for acquiring a second rectangle according to the coordinates of the central point and the coordinates of the fixed point; and the execution unit is used for zooming the map according to the second rectangle.
The system for zooming the map determines a point where a user is located on the map as a fixed point through a first acquisition unit, takes the point in the zooming range of the user as a group of points, simultaneously acquires coordinates of all points marked by the fixed point and contained in the group of points, forms a first rectangle according to the group of points, acquires a center point coordinate of the first rectangle through a second acquisition unit, compares the position relation of the center point coordinate of the first rectangle with the coordinates of the fixed point, acquires a second rectangle through a third acquisition unit, the center point of the second rectangle is the fixed point, determines the coordinates of a point with the maximum latitude value, the maximum longitude value and the point with the minimum latitude value and the minimum longitude value of the second rectangle, and the point with the maximum latitude value, the point with the maximum longitude value and the point with the minimum latitude value and the minimum longitude value are the position points of fingers when the user zooms the map, the execution unit zooms the map according to the two points. The method and the device can ensure that the position of the fixed point (namely the point where the user is) is unchanged when the map is zoomed, well solve the problem that the fixed point can be found only by moving the map after the map is zoomed for one time in the related technology, save the time of the user for zooming the map and improve the use satisfaction degree of the user.
The system for zooming the map according to the invention can further have the following technical features:
in the above technical solution, preferably, the coordinates include latitude values and longitude values, and the first rectangle includes a first diagonal point and a second diagonal point; the coordinates of the first diagonal point are the maximum latitude values and the maximum longitude values in all coordinates, and the coordinates of the second diagonal point are the minimum latitude values and the minimum longitude values in all coordinates; the center point of the first rectangle is the center point of the connecting line of the first diagonal point and the second diagonal point.
In the technical scheme, when a user zooms on a map or obtains a group of points through a gesture, a second acquisition unit is used for circularly comparing the longitude and latitude values of coordinates (the coordinates comprise longitude values and latitude values) of all points in the group of points, a first rectangle consisting of the group of points is determined according to the longitude and latitude values of the coordinates, a first diagonal point and a second diagonal point of the first rectangle are further determined, the coordinates of the first diagonal point are the maximum latitude value and the maximum longitude value in all coordinates, the coordinates of the second diagonal point are the minimum latitude value and the minimum longitude value in all coordinates, the middle point of diagonal lines of the first diagonal point and the second diagonal point is the central point of the first rectangle, the determination of the central point of the first rectangle is used for realizing the purpose of ensuring the position of the fixed point to be unchanged, and the user can directly see the fixed point after zooming on any position of the map, the map does not need to be moved again, and the operation of the user is saved.
In any one of the above technical solutions, preferably, the third obtaining unit includes: a first calculation unit that calculates a difference value between the longitude value of the fixed point coordinate and the longitude value of the center point coordinate as a longitude difference value; calculating the difference value between the latitude value of the fixed point coordinate and the latitude value of the central point coordinate to be used as a latitude difference value; the second calculation unit is used for calculating a third diagonal point and a fourth diagonal point according to the longitude difference and the latitude difference; and taking a rectangle with the third diagonal point as the coordinate point with the maximum latitude value and the maximum longitude value and the fourth diagonal point as the coordinate point with the minimum latitude value and the minimum longitude value as a second rectangle.
In the technical scheme, the coordinates of the fixed point and the coordinates of the acquired center point of the first rectangle are subjected to difference value calculation of a longitude value and a latitude value respectively through a first calculating unit to obtain a longitude difference value and a latitude difference value, a second calculating unit calculates a third diagonal coordinate and a fourth diagonal coordinate of a second rectangle according to the two difference values and the first diagonal coordinate and the second diagonal coordinate of the first rectangle, the third diagonal is a coordinate point with the maximum latitude value and the maximum longitude value, the fourth diagonal is a coordinate point with the minimum latitude value and the minimum longitude value, so that the gesture zooming of the user is performed according to the third diagonal coordinate and the fourth diagonal coordinate of the second rectangle, the problem of position change of the fixed point caused by zooming according to the original rectangle is avoided, and the user can see the expected zooming effect through one-time zooming of the map.
In any one of the above technical solutions, preferably, the second calculating unit includes: a judging unit for judging whether the longitude difference is greater than zero; the second calculation unit is specifically configured to calculate a longitude value of the third diagonal point coordinate according to a first preset formula when the longitude difference is greater than zero, and use the longitude value of the second diagonal point coordinate as a longitude value of the fourth diagonal point coordinate; the judging unit is also used for judging whether the latitude difference value is larger than zero; the second calculating unit is specifically used for calculating the latitude value of the third diagonal point coordinate according to a second preset formula when the latitude difference value is greater than zero, and taking the latitude value of the second diagonal point coordinate as the latitude value of the fourth diagonal point coordinate; the first predetermined formula is LAN2=LAN1+2 XDA, wherein, LAN2Longitude value being the third diagonal coordinate, LAN1The longitude value of the first diagonal point coordinate is obtained, and DA is a longitude difference value; the second predetermined formula is LNN2=LNN1+2 XDN, wherein LNN2Is a thirdLatitude value of diagonal coordinates, LNN1And DN is the latitude value of the coordinate of the first diagonal point, and is the latitude difference value.
In the technical scheme, when the calculated longitude difference is greater than zero, the longitude value of the fixed point is greater than the longitude value at the center point of the first rectangle, which means that if the map is zoomed according to the first diagonal point and the second diagonal point of the first rectangle, the position of the fixed point will change, even the fixed point cannot be displayed in the map display range, so the longitude value of the third diagonal point coordinate of the second rectangle is calculated according to the first preset formula, the longitude value of the third diagonal point coordinate is increased by a double longitude difference value on the basis of the longitude value of the first diagonal point coordinate of the first rectangle, and the longitude value of the second diagonal point coordinate of the first rectangle is taken as the longitude value of the fourth diagonal point coordinate of the second rectangle. When the calculated latitude difference value is greater than zero, the latitude value of the fixed point is greater than that of the center point of the first rectangle, and it is also explained that if the map is zoomed according to the first diagonal point and the second diagonal point of the first rectangle, the position of the fixed point will change, even the fixed point cannot be displayed in the map display range, so the latitude value of the third diagonal point coordinate of the second rectangle is calculated according to the second preset formula, and the latitude value of the second diagonal point coordinate of the first rectangle is taken as the latitude of the fourth diagonal point coordinate of the second rectangle, so that the map is zoomed according to the third diagonal point coordinate and the fourth diagonal point coordinate of the second rectangle, and the position of the fixed point is ensured to be unchanged.
In any one of the foregoing technical solutions, preferably, the second calculating unit is further configured to, when the longitude difference is not greater than zero, take the longitude value of the first diagonal point coordinate as the longitude value of a third diagonal point coordinate, and calculate the longitude value of a fourth diagonal point coordinate according to a third preset formula; the second calculating unit is further used for taking the latitude value of the first diagonal point coordinate as the latitude value of a third diagonal point coordinate when the latitude difference value is not more than zero, and calculating the latitude value of a fourth diagonal point coordinate according to a fourth preset formula; the third predetermined formula is LAS2=LAS1-2 x DA, wherein LAS2Longitude value, LAS, being the fourth diagonal point coordinate1Longitude as a second diagonal coordinate(ii) a The fourth preset formula is LNS2=LNS1-2 x DN, wherein LNS2Latitude value of fourth diagonal coordinate, LNS1Is the latitude value of the second diagonal point coordinate.
In the technical scheme, when the longitude difference is less than zero, the longitude value of the fixed point is smaller than the longitude value at the center point of the first rectangle, and if the map is zoomed by the first rectangle, the position of the fixed point is changed certainly, so that the longitude value of the first diagonal point coordinate of the first rectangle is used as the longitude value of the third diagonal point coordinate of the second rectangle, and the longitude value of the fourth diagonal point coordinate of the second rectangle is calculated according to a third preset formula. When the latitude difference value is not greater than zero, the latitude value of the fixed point is smaller than that of the center point of the first rectangle, the latitude value of the first diagonal point coordinate of the first rectangle is used as the latitude value of the third diagonal point coordinate of the second rectangle, and the latitude value of the fourth diagonal point coordinate of the second rectangle is calculated according to a fourth preset formula, so that the map is zoomed according to the third diagonal point coordinate and the fourth diagonal point coordinate of the second rectangle, and the situation that the position of the fixed point changes and further inconvenience is brought to the use of the map by a user is avoided.
According to a further object of the present invention, there is provided a terminal including the system for zooming a map according to any one of the above.
The terminal provided by the invention has all the beneficial effects of the system for zooming the map by adopting any one of the technical schemes, and is not repeated herein.
According to a further object of the invention, a computer device is proposed, comprising a memory, a processor and a computer program stored on said memory and executable on said processor, the processor implementing the steps of the method of zooming a map as described in any one of the above when executing the computer program.
The computer device provided by the invention can determine a point where a user is located on a map as a fixed point when the processor executes the computer program, and using the points in the zooming range of the user as a group of points, and simultaneously obtaining the coordinates of all points marked by the fixed point and contained in the group of points, forming a first rectangle according to the group of points, acquiring the coordinates of the center point of the first rectangle, comparing the position relationship between the coordinates of the center point of the first rectangle and the coordinates of the fixed point, acquiring a second rectangle, the center point of which is the fixed point, and determining the coordinates of the maximum latitude value, the point of the maximum longitude value, the point of the minimum latitude value and the point of the minimum longitude value of the second rectangle, wherein the point of the maximum latitude value, the point of the maximum longitude value, the point of the minimum latitude value and the point of the minimum longitude value are the position points of fingers when the user zooms the map, and the map is zoomed according to the two points. The method and the device can ensure that the position of the fixed point (namely the point where the user is) is unchanged when the map is zoomed, well solve the problem that the fixed point can be found only by moving the map after the map is zoomed for one time in the related technology, save the time of the user for zooming the map and improve the use satisfaction degree of the user.
According to a further object of the invention, a computer-readable storage medium is proposed, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method of zooming a map as claimed in any one of the preceding claims.
The invention provides a computer-readable storage medium, a computer program that, when executed by a processor, implements a determination on a map of a point at which a user is located as a fixed point, and using the points in the zooming range of the user as a group of points, and simultaneously obtaining the coordinates of all points marked by the fixed point and contained in the group of points, forming a first rectangle according to the group of points, acquiring the coordinates of the center point of the first rectangle, comparing the position relationship between the coordinates of the center point of the first rectangle and the coordinates of the fixed point, acquiring a second rectangle, the center point of which is the fixed point, and determining the coordinates of the maximum latitude value, the point of the maximum longitude value, the point of the minimum latitude value and the point of the minimum longitude value of the second rectangle, wherein the point of the maximum latitude value, the point of the maximum longitude value, the point of the minimum latitude value and the point of the minimum longitude value are the position points of fingers when the user zooms the map, and the map is zoomed according to the two points. The method and the device can ensure that the position of the fixed point (namely the point where the user is) is unchanged when the map is zoomed, well solve the problem that the fixed point can be found only by moving the map after the map is zoomed for one time in the related technology, save the time of the user for zooming the map and improve the use satisfaction degree of the user.
Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
The above and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
fig. 1 shows a flow diagram of a method of zooming a map for a terminal according to an embodiment of the invention;
fig. 2 is a flowchart illustrating a method of zooming a map for a terminal according to another embodiment of the present invention;
fig. 3 shows a flowchart of a method of zooming a map for a terminal according to still another embodiment of the present invention;
FIG. 4 is a flowchart illustrating a method of zooming a map for a terminal according to yet another embodiment of the present invention;
FIG. 5 shows a schematic block diagram of a system for zooming a map for a terminal according to an embodiment of the present invention;
FIG. 6 shows a schematic block diagram of a system for zooming a map for a terminal according to another embodiment of the present invention;
FIG. 7 shows a schematic block diagram of a system for zooming a map for a terminal according to yet another embodiment of the present invention;
FIG. 8 shows a schematic block diagram of a computer device of an embodiment of the present invention;
fig. 9 shows a schematic block diagram of a terminal with map related application software according to an embodiment of the present invention.
Detailed Description
In order that the above objects, features and advantages of the present invention can be more clearly understood, a more particular description of the invention will be rendered by reference to the appended drawings. It should be noted that the embodiments and features of the embodiments of the present application may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, however, the present invention may be practiced in other ways than those specifically described herein, and therefore the scope of the present invention is not limited to the specific embodiments disclosed below.
An embodiment of a first aspect of the present invention provides a method for zooming a map, which is used for a terminal, and fig. 1 illustrates a flowchart of the method for zooming the map of the terminal according to an embodiment of the present invention. Wherein, the method comprises the following steps:
102, acquiring coordinates of a fixed point and all coordinates of a group of points on a map;
104, acquiring the coordinates of the center point of a first rectangle surrounding a group of points;
and 108, zooming the map according to the second rectangle.
The invention provides a method for zooming a map, which comprises the steps of determining a point where a user is located on the map as a fixed point, taking a point in a zooming range of the user as a group of points, simultaneously obtaining coordinates of all points marked by the fixed point and contained in the group of points, forming a first rectangle according to the group of points, obtaining a center point coordinate of the first rectangle, comparing the position relation of the center point coordinate of the first rectangle with the coordinates of the fixed point, obtaining a second rectangle, taking the center point of the second rectangle as the fixed point, determining the maximum latitude value, the maximum longitude value point, the minimum latitude value and the minimum longitude value of the second rectangle, determining the coordinates of the maximum latitude value, the maximum longitude value point, the minimum latitude value and the minimum longitude value as position points of fingers when the user zooms the map, and zooming the map according to the two points. The method and the device can ensure that the position of the fixed point (namely the point where the user is) is unchanged when the map is zoomed, well solve the problem that the fixed point can be found only by moving the map after the map is zoomed for one time in the related technology, save the time of the user for zooming the map and improve the use satisfaction degree of the user.
Fig. 2 is a flowchart illustrating a method of zooming a map for a terminal according to another embodiment of the present invention. Wherein, the method comprises the following steps:
the map is zoomed according to the second rectangle, step 210.
The coordinates comprise latitude values and longitude values, and the first rectangle comprises a first diagonal point and a second diagonal point; the coordinates of the first diagonal point are the maximum latitude values and the maximum longitude values in all coordinates, and the coordinates of the second diagonal point are the minimum latitude values and the minimum longitude values in all coordinates; the center point of the first rectangle is the center point of the connecting line of the first diagonal point and the second diagonal point.
In the embodiment, a point where a user is located is determined on a map as a fixed point, the point within a zooming range of the user is taken as a group of points, coordinates of all points marked by the fixed point and contained in the group of points are simultaneously obtained, the latitude and longitude values (the coordinates comprise latitude and longitude values) of the coordinates of all points in the group of points are circularly compared, a first rectangle consisting of the group of points is determined according to the latitude and longitude values of the coordinates, a first diagonal point and a second diagonal point of the first rectangle are further determined, the coordinates of the first diagonal point are the maximum latitude and the maximum longitude values in all coordinates, the coordinates of the second diagonal point are the minimum latitude and the minimum longitude values in all coordinates, the middle point of the first diagonal point and the second diagonal point is the central point of the first rectangle, and the position of the point for achieving the purpose of ensuring the fixation is laid down through the determination of the first central point, the method and the device ensure that the user can directly see the fixed point after gesture zooming is carried out at any position of the map, do not need to move the map again, and save user operation.
Fig. 3 is a flowchart illustrating a method of zooming a map for a terminal according to still another embodiment of the present invention. Wherein, the method comprises the following steps:
at step 314, the map is zoomed according to the second rectangle.
In the embodiment, a point where a user is located is determined on a map as a fixed point, the point in a zooming range of the user is taken as a group of points, coordinates of all points marked by the fixed point and contained in the group of points are simultaneously obtained, the latitude and longitude values of the coordinates of all points in the group of points are circularly compared (the coordinates comprise latitude and longitude values), a first rectangle consisting of the group of points is determined according to the latitude and longitude values of the coordinates, a first diagonal point and a second diagonal point of the first rectangle are further determined, the coordinates of the first diagonal point are the maximum latitude and the maximum longitude values in all the coordinates, the coordinates of the second diagonal point are the minimum latitude and the minimum longitude values in all the coordinates, the middle point of the first diagonal point and the second diagonal point is the center point of the first rectangle, the difference value calculation of the longitude value and the latitude value is respectively carried out on the coordinates of the fixed point and the coordinates of the center point of the first rectangle, and then calculating a third diagonal coordinate and a fourth diagonal coordinate of the second rectangle according to the two differences and the first diagonal coordinate and the second diagonal coordinate of the first rectangle, wherein the third diagonal is a coordinate point with a maximum latitude value and a maximum longitude value, and the fourth diagonal is a coordinate point with a minimum latitude value and a minimum longitude value, so that the gesture zooming of the user is performed according to the third diagonal coordinate and the fourth diagonal coordinate of the second rectangle, the problem of position change of a fixed point caused by zooming according to the original rectangle is avoided, and the user can see an expected zooming effect by zooming the map once.
Fig. 4 is a flowchart illustrating a method of zooming a map for a terminal according to still another embodiment of the present invention. Wherein, the method comprises the following steps:
the map is zoomed according to the second rectangle, step 424.
In the embodiment, a point where a user is located is determined on a map as a fixed point, the point in a zooming range of the user is taken as a group of points, coordinates of all points marked by the fixed point and contained in the group of points are simultaneously obtained, the latitude and longitude values of the coordinates of all points in the group of points are circularly compared (the coordinates comprise latitude and longitude values), a first rectangle consisting of the group of points is determined according to the latitude and longitude values of the coordinates, a first diagonal point and a second diagonal point of the first rectangle are further determined, the coordinates of the first diagonal point are the maximum latitude and the maximum longitude values in all the coordinates, the coordinates of the second diagonal point are the minimum latitude and the minimum longitude values in all the coordinates, the middle point of the first diagonal point and the second diagonal point is the center point of the first rectangle, the difference value calculation of the longitude value and the latitude value is respectively carried out on the coordinates of the fixed point and the coordinates of the center point of the first rectangle, and obtaining a longitude difference value and a latitude difference value, wherein when the calculated longitude difference value is greater than zero, the longitude value of the fixed point is greater than the longitude value at the center point of the first rectangle, which means that if the map is zoomed according to the first diagonal point and the second diagonal point of the first rectangle, the position of the fixed point will change, even the fixed point cannot be displayed in the map display range, so that the longitude value of the third diagonal point coordinate of the second rectangle is calculated according to a first preset formula, the longitude value of the third diagonal point coordinate is increased by a double longitude difference value on the basis of the longitude value of the first diagonal point coordinate of the first rectangle, and the longitude value of the second diagonal point coordinate of the first rectangle is taken as the longitude value of the fourth diagonal point coordinate of the second rectangle. When the calculated latitude difference value is greater than zero, the latitude value of the fixed point is greater than that of the center point of the first rectangle, and it is also explained that if the map is zoomed according to the first diagonal point and the second diagonal point of the first rectangle, the position of the fixed point will change, even the fixed point cannot be displayed in the map display range, so the latitude value of the third diagonal point coordinate of the second rectangle is calculated according to the second preset formula, and the latitude value of the second diagonal point coordinate of the first rectangle is taken as the latitude of the fourth diagonal point coordinate of the second rectangle, so that the map is zoomed according to the third diagonal point coordinate and the fourth diagonal point coordinate of the second rectangle, and the position of the fixed point is ensured to be unchanged.
In this embodiment, when the longitude difference is less than zero, the longitude value of the fixed point is smaller than the longitude value at the center point of the first rectangle, and if the map is zoomed by the first rectangle, the position of the fixed point is changed certainly, so the longitude value of the first diagonal point coordinate of the first rectangle is used as the longitude value of the third diagonal point coordinate of the second rectangle, and the longitude value of the fourth diagonal point coordinate of the second rectangle is calculated according to the third preset formula. When the latitude difference value is not greater than zero, the latitude value of the fixed point is smaller than that of the center point of the first rectangle, the latitude value of the first diagonal point coordinate of the first rectangle is used as the latitude value of the third diagonal point coordinate of the second rectangle, and the latitude value of the fourth diagonal point coordinate of the second rectangle is calculated according to a fourth preset formula, so that the map is zoomed according to the third diagonal point coordinate and the fourth diagonal point coordinate of the second rectangle, and the situation that the position of the fixed point changes and further inconvenience is brought to the use of the map by a user is avoided.
Wherein the first preset formula is LAN2=LAN1+2 XDA, wherein, LAN2Longitude value being the third diagonal coordinate, LAN1The longitude value of the first diagonal point coordinate is obtained, and DA is a longitude difference value; the second predetermined formula is LNN2=LNN1+2 XDN, wherein LNN2Latitude value, LNN, being the third diagonal coordinate1And DN is the latitude value of the coordinate of the first diagonal point, and is the latitude difference value. The third predetermined formula is LAS2=LAS1-2 x DA, wherein LAS2Longitude value, LAS, being the fourth diagonal point coordinate1Longitude values which are coordinates of the second diagonal points; the fourth preset formula is LNS2=LNS1-2 x DN, wherein LNS2Latitude value of fourth diagonal coordinate, LNS1Is the latitude value of the second diagonal point coordinate. .
In a second aspect of the present invention, a system for zooming a map is provided for a terminal, and fig. 5 is a schematic block diagram of a system 500 for zooming a map for a terminal according to an embodiment of the present invention. Wherein, this system includes:
a first obtaining unit 502, configured to obtain coordinates of a fixed point on a map and all coordinates of a group of points;
a second acquisition unit 504 for acquiring coordinates of a center point of a first rectangle surrounding a group of points;
a third obtaining unit 506, configured to obtain a second rectangle according to the coordinates of the central point and the coordinates of the fixed point;
and an executing unit 508, configured to zoom the map according to the second rectangle.
The system 500 for zooming the map determines a point where a user is located on the map as a fixed point through a first obtaining unit 502, takes the point within the zooming range of the user as a group of points, simultaneously obtains coordinates of all points marked by the fixed point and contained in the group of points, forms a first rectangle according to the group of points, obtains a center point coordinate of the first rectangle through a second obtaining unit, compares the position relation of the center point coordinate of the first rectangle with the coordinates of the fixed point, obtains a second rectangle through a third obtaining unit, takes the center point of the second rectangle as the fixed point, determines coordinates of a point with a maximum latitude value, a point with a maximum longitude value, a point with a minimum latitude value and a point with a minimum longitude value of the second rectangle, determines the points with the maximum latitude value, the maximum longitude value and the minimum latitude value, and the point with the minimum longitude value as position points of fingers when the user zooms the map, the execution unit zooms the map according to the two points. The method and the device can ensure that the position of the fixed point (namely the point where the user is) is unchanged when the map is zoomed, well solve the problem that the fixed point can be found only by moving the map after the map is zoomed for one time in the related technology, save the time of the user for zooming the map and improve the use satisfaction degree of the user.
In one embodiment of the present invention, preferably, the coordinates include latitude values and longitude values, and the first rectangle includes a first diagonal point and a second diagonal point; the coordinates of the first diagonal point are the maximum latitude values and the maximum longitude values in all coordinates, and the coordinates of the second diagonal point are the minimum latitude values and the minimum longitude values in all coordinates; the center point of the first rectangle is the center point of the connecting line of the first diagonal point and the second diagonal point.
In the embodiment, when a user zooms or obtains a group of points on a map through a gesture, a second obtaining unit compares the longitude and latitude values of coordinates (the coordinates comprise longitude values and latitude values) of all points in the group of points in a circulating manner, a first rectangle consisting of the group of points is determined according to the longitude and latitude values of the coordinates, a first diagonal point and a second diagonal point of the first rectangle are further determined, the coordinates of the first diagonal point are the maximum latitude value and the maximum longitude value in all coordinates, the coordinates of the second diagonal point are the minimum latitude value and the minimum longitude value in all coordinates, the middle point of diagonal lines of the first diagonal point and the second diagonal point is the central point of the first rectangle, a foundation is laid for realizing the purpose of ensuring that the position of the fixed point is unchanged through the determination of the central point of the first rectangle, and the user can directly see the fixed point after performing gesture zooming on any position of the map is ensured, the map does not need to be moved again, and the operation of the user is saved.
Fig. 6 shows a schematic block diagram of a system 600 for zooming a map for a terminal according to another embodiment of the present invention. Wherein, this system includes:
a first obtaining unit 602, configured to obtain coordinates of a fixed point on a map and all coordinates of a group of points;
a second obtaining unit 604 for obtaining coordinates of a center point of a first rectangle surrounding a group of points;
a third obtaining unit 606, configured to obtain a second rectangle according to the coordinates of the central point and the coordinates of the fixed point;
an execution unit 608, configured to zoom the map according to the second rectangle;
a third obtaining unit 606, including:
a first calculation unit 662 for calculating a difference value of the longitude value of the fixed point coordinate and the longitude value of the center point coordinate as a longitude difference value; calculating the difference value between the latitude value of the fixed point coordinate and the latitude value of the central point coordinate to be used as a latitude difference value;
a second calculating unit 664, configured to calculate a third diagonal point and a fourth diagonal point according to the longitude difference and the latitude difference; and taking a rectangle with the third diagonal point as the coordinate point with the maximum latitude value and the maximum longitude value and the fourth diagonal point as the coordinate point with the minimum latitude value and the minimum longitude value as a second rectangle.
In this embodiment, the coordinates of the fixed point and the coordinates of the acquired center point of the first rectangle are subjected to difference calculation of longitude value and latitude value by the first calculation unit 662, respectively, to obtain longitude difference value and latitude difference value, and then the second calculating unit 664 calculates a third diagonal coordinate and a fourth diagonal coordinate of the second rectangle according to the two differences and the first diagonal coordinate and the second diagonal coordinate of the first rectangle, the third diagonal is a coordinate point with a maximum latitude value and a maximum longitude value, the fourth diagonal is a coordinate point with a minimum latitude value and a minimum longitude value, so that the gesture zooming of the user is performed according to the third diagonal coordinate and the fourth diagonal coordinate of the second rectangle, the problem of position change of a fixed point caused by zooming according to the original rectangle is avoided, and the user can see an expected zooming effect through one-time zooming of the map.
Fig. 7 shows a schematic block diagram of a system 700 for zooming a map for a terminal according to yet another embodiment of the present invention. Wherein, this system includes:
a first obtaining unit 702, configured to obtain coordinates of a fixed point on a map and all coordinates of a group of points;
a second obtaining unit 704 configured to obtain coordinates of a center point of a first rectangle surrounding a group of points;
a third obtaining unit 706, configured to obtain a second rectangle according to the coordinates of the central point and the coordinates of the fixed point;
an execution unit 708 configured to zoom the map according to the second rectangle;
the third obtaining unit 706 includes:
a first calculation unit 762 that calculates a difference value of a longitude value of the fixed point coordinate and a longitude value of the center point coordinate as a longitude difference value; calculating the difference value between the latitude value of the fixed point coordinate and the latitude value of the central point coordinate to be used as a latitude difference value;
a second calculating unit 764 for calculating a third diagonal point and a fourth diagonal point according to the longitude difference and the latitude difference; and taking a rectangle with the third diagonal point as the coordinate point with the maximum latitude value and the maximum longitude value and the fourth diagonal point as the coordinate point with the minimum latitude value and the minimum longitude value as a second rectangle.
The second calculation unit 764 includes: a determining unit 7642, configured to determine whether the longitude difference is greater than zero;
the second calculating unit 764 is specifically configured to calculate, when the longitude difference is greater than zero, a longitude value of the third diagonal point coordinate according to a first preset formula, and use the longitude value of the second diagonal point coordinate as a longitude value of the fourth diagonal point coordinate;
the determining unit 7642 is further configured to determine whether the latitude difference is greater than zero;
the second calculating unit 764 is specifically configured to calculate, when the latitude difference is greater than zero, a latitude value of a third diagonal coordinate according to a second preset formula, and use the latitude value of the second diagonal coordinate as a latitude value of a fourth diagonal coordinate;
the first predetermined formula is LAN2=LAN1+2 XDA, wherein, LAN2Longitude value being the third diagonal coordinate, LAN1The longitude value of the first diagonal point coordinate is obtained, and DA is a longitude difference value; the second predetermined formula is LNN2=LNN1+2 XDN, wherein LNN2Latitude value, LNN, being the third diagonal coordinate1And DN is the latitude value of the coordinate of the first diagonal point, and is the latitude difference value.
In this embodiment, when the calculated longitude difference is greater than zero, the longitude value of the fixed point is greater than the longitude value at the center point of the first rectangle, which means that if the map is zoomed according to the first and second diagonal points of the first rectangle, the position of the fixed point will change, and even the fixed point cannot be displayed within the map display range, so the longitude value of the third diagonal point coordinate of the second rectangle is calculated according to the first preset formula, the longitude value of the third diagonal point coordinate is increased by a double longitude difference value based on the longitude value of the first diagonal point coordinate of the first rectangle, and the longitude value of the second diagonal point coordinate of the first rectangle is taken as the longitude value of the fourth diagonal point coordinate of the second rectangle. When the calculated latitude difference value is greater than zero, the latitude value of the fixed point is greater than that of the center point of the first rectangle, and it is also explained that if the map is zoomed according to the first diagonal point and the second diagonal point of the first rectangle, the position of the fixed point will change, even the fixed point cannot be displayed in the map display range, so the latitude value of the third diagonal point coordinate of the second rectangle is calculated according to the second preset formula, and the latitude value of the second diagonal point coordinate of the first rectangle is taken as the latitude of the fourth diagonal point coordinate of the second rectangle, so that the map is zoomed according to the third diagonal point coordinate and the fourth diagonal point coordinate of the second rectangle, and the position of the fixed point is ensured to be unchanged.
In an embodiment of the present invention, preferably, the second calculating unit 764 is further configured to, when the longitude difference is not greater than zero, take the longitude value of the first diagonal point coordinate as the longitude value of the third diagonal point coordinate, and calculate the longitude value of the fourth diagonal point coordinate according to a third preset formula; second calculating unit 764, when the latitude difference value is not greater than zero, the latitude value of the first diagonal point coordinate is taken as the latitude value of the third diagonal point coordinate, and the latitude value of the fourth diagonal point coordinate is calculated according to a fourth preset formula; the third predetermined formula is LAS2=LAS1-2 x DA, wherein LAS2Longitude value, LAS, being the fourth diagonal point coordinate1Longitude, which is the coordinate of the second diagonal point; the fourth preset formula is LNS2=LNS1-2 x DN, wherein LNS2Latitude value of fourth diagonal coordinate, LNS1Is the latitude value of the second diagonal point coordinate.
In this embodiment, when the longitude difference is less than zero, the longitude value of the fixed point is smaller than the longitude value at the center point of the first rectangle, and if the map is zoomed by the first rectangle, the position of the fixed point is changed certainly, so the longitude value of the first diagonal point coordinate of the first rectangle is used as the longitude value of the third diagonal point coordinate of the second rectangle, and the longitude value of the fourth diagonal point coordinate of the second rectangle is calculated according to the third preset formula. When the latitude difference value is not greater than zero, the latitude value of the fixed point is smaller than that of the center point of the first rectangle, the latitude value of the first diagonal point coordinate of the first rectangle is used as the latitude value of the third diagonal point coordinate of the second rectangle, and the latitude value of the fourth diagonal point coordinate of the second rectangle is calculated according to a fourth preset formula, so that the map is zoomed according to the third diagonal point coordinate and the fourth diagonal point coordinate of the second rectangle, and the situation that the position of the fixed point changes and further inconvenience is brought to the use of the map by a user is avoided.
An embodiment of the third aspect of the present invention provides a terminal, including any one of the above systems for zooming maps.
The terminal provided by the invention has all the beneficial effects of the system for zooming the map by adopting any one of the technical schemes, and is not repeated herein.
In a fourth aspect of the present invention, a computer device is provided, and fig. 8 shows a schematic block diagram of a computer device 800 according to an embodiment of the present invention. Wherein the computer device 800 comprises:
a memory 802, a processor 804 and a computer program stored on the memory 802 and executable on the processor 804, the steps of the method of zooming a map as described in any one of the above being implemented when the computer program is executed by the processor 804.
The present invention provides a computer device 800, wherein the processor 804, when executing the computer program, is capable of determining a point on a map where a user is located as a fixed point, and using the points in the zooming range of the user as a group of points, and simultaneously obtaining the coordinates of all points marked by the fixed point and contained in the group of points, forming a first rectangle according to the group of points, acquiring the coordinates of the center point of the first rectangle, comparing the position relationship between the coordinates of the center point of the first rectangle and the coordinates of the fixed point, acquiring a second rectangle, the center point of which is the fixed point, and determining the coordinates of the maximum latitude value, the point of the maximum longitude value, the point of the minimum latitude value and the point of the minimum longitude value of the second rectangle, wherein the point of the maximum latitude value, the point of the maximum longitude value, the point of the minimum latitude value and the point of the minimum longitude value are the position points of fingers when the user zooms the map, and the map is zoomed according to the two points. The method and the device can ensure that the position of the fixed point (namely the point where the user is) is unchanged when the map is zoomed, well solve the problem that the fixed point can be found only by moving the map after the map is zoomed for one time in the related technology, save the time of the user for zooming the map and improve the use satisfaction degree of the user.
An embodiment of the fifth aspect of the present invention proposes a computer-readable storage medium having stored thereon a computer program which, when being executed by a processor, carries out the steps of the method of zooming a map as defined in any one of the above.
The invention provides a computer-readable storage medium, a computer program that, when executed by a processor, implements a determination on a map of a point at which a user is located as a fixed point, and using the points in the zooming range of the user as a group of points, and simultaneously obtaining the coordinates of all points marked by the fixed point and contained in the group of points, forming a first rectangle according to the group of points, acquiring the coordinates of the center point of the first rectangle, comparing the position relationship between the coordinates of the center point of the first rectangle and the coordinates of the fixed point, acquiring a second rectangle, the center point of which is the fixed point, and determining the coordinates of the maximum latitude value, the point of the maximum longitude value, the point of the minimum latitude value and the point of the minimum longitude value of the second rectangle, wherein the point of the maximum latitude value, the point of the maximum longitude value, the point of the minimum latitude value and the point of the minimum longitude value are the position points of fingers when the user zooms the map, and the map is zoomed according to the two points. The method and the device can ensure that the position of the fixed point (namely the point where the user is) is unchanged when the map is zoomed, well solve the problem that the fixed point can be found only by moving the map after the map is zoomed for one time in the related technology, save the time of the user for zooming the map and improve the use satisfaction degree of the user.
In an embodiment of the sixth aspect of the present invention, a terminal having map-related application software is provided, and fig. 9 shows a schematic block diagram of a terminal 900 having map-related application software according to an embodiment of the present invention. Wherein, this terminal includes:
902 memory, a processor 904, wherein the processor 904 is adapted to perform the steps of the method of zooming a map as described in any of the above by invoking operational instructions stored in the memory 902.
The processor 904 is configured to call an operation instruction stored in the memory, and is configured to determine a point where a user is located on the map as a fixed point, and to use a point within a zooming range of the user as a group of points, and simultaneously obtain coordinates of all points marked by the fixed point and included in the group of points, form a first rectangle according to the group of points, obtain a center point coordinate of the first rectangle, compare a position relationship between the center point coordinate of the first rectangle and the fixed point coordinate, obtain a second rectangle whose center point is the fixed point, and determine a maximum latitude value, a maximum longitude value point, a minimum latitude value, and a minimum longitude value point of the second rectangle, where the maximum latitude value, the maximum longitude value, the minimum latitude value, and the minimum longitude value are the position points of fingers when the user zooms the map, the map is zoomed according to the two points. The method and the device can ensure that the position of the fixed point (namely the point where the user is) is unchanged when the map is zoomed, well solve the problem that the fixed point can be found only by moving the map after the map is zoomed for one time in the related technology, save the time of the user for zooming the map and improve the use satisfaction degree of the user.
In a method for scaling based on a set of points and a fixed point according to an embodiment of the present invention, there are a set of points P1(lat1, long 1), P2(lat2, long 2), P3(lat3, long 3) … Pn (latn, long) and a fixed point P0(lat0, lnt0), where lat and long represent latitude and longitude, respectively.
Firstly, comparing the latitude and longitude of a loop P1(lat1, lng1) and a P2(lat2, lng2) … Pn (latn, lng n), and obtaining the latitude and longitude of a northeast point Pne1(lat-ne1, lng-ne1) and a southwest point Psw1(lat-sw1, lng-sw1) of a rectangle Rect1 surrounded by the two points:
lat-ne1=Max(lat1,lat2…latn);
lng-ne1=Max(lng1,lng2…lngn);
lat-sw1=Min(lat1,lat2…latn);
lng-sw1=Min(lng1,lng2…lngn)。
secondly, obtaining a central point Pc (lat-c, lng-c) of a connecting line of the most northeast Pne1(lat-ne1, lng-ne1) and the most southwest point Psw1(lat-sw1, lng-sw 1):
lat-c=(lat-ne1+lat-sw1)/2;
lng-c=(lng-ne1+lng-sw1)/2。
thirdly, comparing the longitude and latitude differences of the fixed point P0(lat0, lnt0) and the obtained central point Pc (lat-c, lng-c):
longitude difference Dlat 0-lat-c;
the latitude difference Dlng is lng 0-lng-c.
Fourthly, obtaining the latitude and longitude of the latest northeast point Pne2(lat-ne2, lng-ne2) and the latest southwest point Psw2(lat-sw2, lng-sw2) of the rectangle Rect 2:
if Dlat >0, lat-ne2 is lat-ne1+2 XDlat, otherwise lat-ne2 is lat-ne 1;
if Dlat is more than 0, lat-sw2 is lat-sw1, otherwise lat-sw2 is lat-sw1-2 × | Dlat |;
if Dlng >0, lng-ne2 ═ lng-ne1+2 × Dlng, otherwise lng-ne2 ═ lng-ne 1;
if Dlng is greater than 0, lng-sw2 is lng-sw1, otherwise, lng-sw2 is lng-sw1-2 x | Dlng |.
Fifthly, the map is zoomed according to the most northeast point Pne2(lat-ne2, lng-ne2) and the most southwest point Psw2(lat-sw2, lng-sw2) of the latest rectangle Rect 2.
In the description herein, the description of the terms "one embodiment," "some embodiments," "specific embodiments," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (9)
1. A method for zooming a map is used for a terminal, and is characterized in that the method for zooming the map comprises the following steps:
acquiring coordinates of a fixed point on a map and all coordinates of a group of points;
obtaining coordinates of a center point of a first rectangle surrounding the group of points;
acquiring a second rectangle according to the coordinates of the central point and the coordinates of the fixed point;
zooming the map according to the second rectangle;
the group of points are points within the zooming range of the user;
the fixed point coordinates, all coordinates of the group of points and the center point coordinates comprise latitude values and longitude values, and the first rectangle comprises a first diagonal point and a second diagonal point; the coordinates of the first diagonal point are the maximum latitude values and the maximum longitude values in all the coordinates of the group of points, and the coordinates of the second diagonal point are the minimum latitude values and the minimum longitude values in all the coordinates of the group of points; the center point of the first rectangle is the center point of a connecting line of the first diagonal point and the second diagonal point;
the step of obtaining the second rectangle according to the coordinates of the central point and the coordinates of the fixed point specifically includes:
calculating a difference value between the longitude value of the fixed point coordinate and the longitude value of the central point coordinate to be used as a longitude difference value;
calculating the difference value between the latitude value of the fixed point coordinate and the latitude value of the central point coordinate to serve as a latitude difference value;
calculating a third diagonal point and a fourth diagonal point according to the longitude difference value and the latitude difference value;
and taking the third diagonal point as a coordinate point with the maximum latitude value and the maximum longitude value, and taking the fourth diagonal point as a rectangle with the minimum latitude value and the minimum longitude value as the second rectangle.
2. The method of claim 1, wherein the step of calculating the third diagonal point and the fourth diagonal point according to the longitude difference value and the latitude difference value specifically comprises:
judging whether the longitude difference is larger than zero;
when the longitude difference is greater than zero, calculating a longitude value of the third diagonal point coordinate according to a first preset formula, and taking the longitude value of the second diagonal point coordinate as a longitude value of the fourth diagonal point coordinate;
judging whether the latitude difference value is larger than zero;
when the latitude difference value is larger than zero, calculating the latitude value of the third diagonal point coordinate according to a second preset formula, and taking the latitude value of the second diagonal point coordinate as the latitude value of the fourth diagonal point coordinate;
the first preset formula isLAN 2=LAN 1+2×DAWherein the LAN2Is the longitude value of the third diagonal point coordinate,LAN 1is a longitude value of the coordinates of the first pair of corner points,DAis the longitude difference;
the second preset formula isLNN 2=LNN 1+2×DNWherein, in the step (A),LNN 2is the latitude value of the third diagonal point coordinate,LNN 1is a latitude value of the first diagonal coordinates,DNand the latitude difference is obtained.
3. The method of zooming as recited in claim 2, wherein the step of calculating the third diagonal point and the fourth diagonal point according to the longitude difference value and the latitude difference value further comprises:
when the longitude difference value is not greater than zero, taking the longitude value of the first diagonal point coordinate as the longitude value of the third diagonal point coordinate, and calculating the longitude value of the fourth diagonal point coordinate according to a third preset formula;
when the latitude difference value is not greater than zero, taking the latitude value of the first diagonal point coordinate as the latitude value of the third diagonal point coordinate, and calculating the latitude value of the fourth diagonal point coordinate according to a fourth preset formula;
the third preset formula isLAS 2=LAS 1-2×∣DA-wherein, in the step of,LAS 2is the longitude value of the fourth diagonal point coordinate,LAS 1the longitude value is the coordinate of the second diagonal point;
the fourth preset formula isLNS 2=LNS 1-2×∣DN-wherein, in the step of,LNS 2is the latitude value of the fourth diagonal point coordinate,LNS 1is the latitude value of the second diagonal point coordinate.
4. A system for zooming a map, for a terminal, the system for zooming a map comprising:
the first acquisition unit is used for acquiring the coordinates of a fixed point on a map and all the coordinates of a group of points;
a second acquisition unit configured to acquire coordinates of a center point of a first rectangle surrounding the group of points;
a third obtaining unit, configured to obtain a second rectangle according to the coordinates of the central point and the coordinates of the fixed point;
an execution unit, configured to zoom the map according to the second rectangle;
the group of points are points within the zooming range of the user;
the fixed point coordinates, all coordinates of the group of points and the center point coordinates comprise latitude values and longitude values, and the first rectangle comprises a first diagonal point and a second diagonal point; the coordinates of the first diagonal point are the maximum latitude values and the maximum longitude values in all the coordinates of the group of points, and the coordinates of the second diagonal point are the minimum latitude values and the minimum longitude values in all the coordinates of the group of points; the center point of the first rectangle is the center point of a connecting line of the first diagonal point and the second diagonal point;
the third obtaining unit includes:
a first calculation unit configured to calculate a difference between the longitude value of the fixed point coordinate and the longitude value of the center point coordinate as a longitude difference; calculating the difference value between the latitude value of the fixed point coordinate and the latitude value of the central point coordinate to serve as a latitude difference value;
the second calculation unit is used for calculating a third diagonal point and a fourth diagonal point according to the longitude difference value and the latitude difference value; and taking the third diagonal point as a coordinate point with the maximum latitude value and the maximum longitude value, and taking the fourth diagonal point as a rectangle with the minimum latitude value and the minimum longitude value as the second rectangle.
5. The system for zooming the map of claim 4, wherein the second computing unit comprises:
the judging unit is used for judging whether the longitude difference is larger than zero or not;
the second calculating unit is specifically configured to calculate, when the longitude difference is greater than zero, a longitude value of a third diagonal point coordinate according to a first preset formula, and use the longitude value of the second diagonal point coordinate as a longitude value of a fourth diagonal point coordinate;
the judging unit is further configured to judge whether the latitude difference is greater than zero;
the second calculating unit is specifically configured to calculate, when the latitude difference is greater than zero, a latitude value of a third diagonal coordinate according to a second preset formula, and use the latitude value of the second diagonal coordinate as a latitude value of a fourth diagonal coordinate;
the first preset formula isLAN 2=LAN 1+2×DAWherein the LAN2Is the longitude value of the third diagonal point coordinate,LAN 1is a longitude value of the coordinates of the first pair of corner points,DAis the longitude difference;
the second preset formula isLNN 2=LNN 1+2×DNWherein, in the step (A),LNN 2is the latitude value of the third diagonal point coordinate,LNN 1is a latitude value of the first diagonal coordinates,DNand the latitude difference is obtained.
6. The system for zooming the map of claim 5,
the second calculating unit is further configured to, when the longitude difference is not greater than zero, take a longitude value of the first diagonal point coordinate as a longitude value of the third diagonal point coordinate, and calculate a longitude value of the fourth diagonal point coordinate according to a third preset formula;
the second calculating unit is further configured to, when the latitude difference value is not greater than zero, take the latitude value of the first diagonal point coordinate as the latitude value of the third diagonal point coordinate, and calculate the latitude value of the fourth diagonal point coordinate according to a fourth preset formula;
the third preset formula isLAS 2=LAS 1-2×∣DA-wherein, in the step of,LAS 2is the longitude value of the fourth diagonal point coordinate,LAS 1the longitude value is the coordinate of the second diagonal point;
the fourth preset formula isLNS 2=LNS 1-2×∣DN-wherein, in the step of,LNS 2is the latitude value of the fourth diagonal point coordinate,LNS 1is the latitude value of the second diagonal point coordinate.
7. A terminal, comprising:
a system of zooming a map as claimed in any one of claims 4 to 6.
8. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor, when executing the computer program, carries out the steps of the method of zooming a map according to any one of claims 1 to 3.
9. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method of zooming a map as claimed in any one of claims 1 to 3.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110020367.XA CN112801869B (en) | 2017-06-19 | 2017-06-19 | Method, system, terminal and computer equipment for zooming map |
CN201710462289.2A CN109145064B (en) | 2017-06-19 | 2017-06-19 | Method, system, terminal and computer equipment for zooming map |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710462289.2A CN109145064B (en) | 2017-06-19 | 2017-06-19 | Method, system, terminal and computer equipment for zooming map |
Related Child Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110020367.XA Division CN112801869B (en) | 2017-06-19 | 2017-06-19 | Method, system, terminal and computer equipment for zooming map |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109145064A CN109145064A (en) | 2019-01-04 |
CN109145064B true CN109145064B (en) | 2021-02-05 |
Family
ID=64803945
Family Applications (2)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710462289.2A Active CN109145064B (en) | 2017-06-19 | 2017-06-19 | Method, system, terminal and computer equipment for zooming map |
CN202110020367.XA Active CN112801869B (en) | 2017-06-19 | 2017-06-19 | Method, system, terminal and computer equipment for zooming map |
Family Applications After (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110020367.XA Active CN112801869B (en) | 2017-06-19 | 2017-06-19 | Method, system, terminal and computer equipment for zooming map |
Country Status (1)
Country | Link |
---|---|
CN (2) | CN109145064B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116302289A (en) * | 2023-04-04 | 2023-06-23 | 北京火山引擎科技有限公司 | Display interaction method, device and equipment |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103677721A (en) * | 2013-12-27 | 2014-03-26 | 腾讯科技(深圳)有限公司 | Terminal display interface zooming method and terminal device |
CN105701255A (en) * | 2016-03-22 | 2016-06-22 | 西安交通大学 | Regional map coordinate coding method applied to fast position retrieval |
CN105893450A (en) * | 2015-12-31 | 2016-08-24 | 乐卡汽车智能科技(北京)有限公司 | Map displaying method, device and terminal equipment |
CN106485660A (en) * | 2016-09-28 | 2017-03-08 | 北京小米移动软件有限公司 | The Zoom method of electronic chart and device |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP3713696B2 (en) * | 1997-06-02 | 2005-11-09 | ソニー株式会社 | Digital map enlargement / reduction display method, digital map enlargement / reduction display apparatus, and storage medium storing digital map enlargement / reduction display program |
CN102110086B (en) * | 2009-12-28 | 2012-11-28 | 北大方正集团有限公司 | Method and system enabling layout object to be automatically adjusted along with layout |
WO2012001625A1 (en) * | 2010-06-30 | 2012-01-05 | Koninklijke Philips Electronics N.V. | Zooming a displayed image |
-
2017
- 2017-06-19 CN CN201710462289.2A patent/CN109145064B/en active Active
- 2017-06-19 CN CN202110020367.XA patent/CN112801869B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103677721A (en) * | 2013-12-27 | 2014-03-26 | 腾讯科技(深圳)有限公司 | Terminal display interface zooming method and terminal device |
CN105893450A (en) * | 2015-12-31 | 2016-08-24 | 乐卡汽车智能科技(北京)有限公司 | Map displaying method, device and terminal equipment |
CN105701255A (en) * | 2016-03-22 | 2016-06-22 | 西安交通大学 | Regional map coordinate coding method applied to fast position retrieval |
CN106485660A (en) * | 2016-09-28 | 2017-03-08 | 北京小米移动软件有限公司 | The Zoom method of electronic chart and device |
Also Published As
Publication number | Publication date |
---|---|
CN109145064A (en) | 2019-01-04 |
CN112801869B (en) | 2024-09-24 |
CN112801869A (en) | 2021-05-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP2333748A2 (en) | Techniques for drawing geodetic polygons | |
CN107976194B (en) | Environment map adjusting method and device | |
CN110070623B (en) | Guide line drawing prompting method, device, computer equipment and storage medium | |
KR102120966B1 (en) | Indoor navigation method of handheld terminal, handheld terminal and storage medium | |
JP2009171570A (en) | Image data processing method and image data processing system | |
CN111389002B (en) | Game character movement control method, device, equipment and storage medium | |
CN106598289A (en) | Method and system for expanding written page | |
JP2016515276A5 (en) | ||
CN111046117A (en) | Method, system, device and medium for displaying route travelling position on map in real time | |
CN109145064B (en) | Method, system, terminal and computer equipment for zooming map | |
CN105892632A (en) | Method and device for judging the selection of UI (User Interface) widgets of virtual reality application | |
CN111145328A (en) | Three-dimensional character surface texture coordinate calculation method, medium, equipment and device | |
US9568333B2 (en) | Method and system for selectively blending buildings to improve route visibility in a 3D navigation system | |
CN108871350B (en) | Map navigation mode display method, display system and computer device | |
CN110660121B (en) | Three-dimensional font rendering method, medium, device and apparatus | |
WO2006072076B1 (en) | Methods and systems for displaying an enlarged image | |
CN114090707B (en) | Map data display method based on region growing | |
CN111413701A (en) | Method and device for determining distance between obstacles, vehicle-mounted equipment and storage medium | |
JP2013218478A (en) | Plotting quickening method and device | |
US11353333B2 (en) | Dynamic restyling of digital maps | |
CN103678470B (en) | A kind of method and system for showing selection area economic data | |
CN115937007B (en) | Wind shear identification method and device, electronic equipment and medium | |
US20170032496A1 (en) | Display control system and display control method | |
US20210366291A1 (en) | Method for calculating dangerous spot and time, storage medium, and device for calculating dangerous spot | |
CN103813446A (en) | Method and device for estimating coverage of staying area |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |