Disclosure of Invention
The embodiment of the invention aims to provide a method, a device and equipment for displaying a POI label, which do not need to select the position of the POI label manually, simplify the position marking of the POI label, improve disordered labels on a map and bring better user experience.
In order to achieve the above object, an embodiment of the present invention provides a POI tag display method, including:
calculating position information of a first central point of the POI label and a POI display area;
calculating the position information of a second central point projected on a display interface by the POI label;
calculating an object projection area of an object corresponding to the POI label projected on the display interface;
judging whether the POI label meets a preset display condition or not according to the position information of the first central point, the position information of the second central point, the POI display area and the object projection area;
and when the POI label meets the preset display condition, displaying the POI label on the display interface.
Compared with the prior art, the POI label display method disclosed by the embodiment of the invention is suitable for a two-dimensional map or a three-dimensional map, the display rule is formulated by calculating the position relationship between the POI label and the corresponding object, the type of the POI label is not required to be marked manually, but the position to be presented by the POI label is calculated automatically, so that the position marking of the POI label is greatly simplified, in addition, the display rule is not required to be determined by the resolution of a display interface, but is determined based on the position relationship between the POI label and the corresponding object, so that the judgment rule is more rigorous, the disordered label on the map can be improved, and better user experience is brought.
As an improvement of the above scheme, the preset display condition includes that the object projection area is greater than a preset area threshold, the second center point is within the display interface, the object projection area includes the POI display area, and the first center point is not occluded.
As an improvement of the above, the method further comprises:
judging the type of the POI label; the types of the POI labels comprise a POI label consisting of one character string and a POI label consisting of at least two character strings;
then, when the POI tag meets the preset display condition, displaying the POI tag on the display interface, specifically including:
when the POI label meets the preset display condition and the type of the POI label is the POI label consisting of a character string, displaying the POI label on the display interface;
and when the POI label meets the preset display condition, the type of the POI label is a POI label consisting of at least two character strings, and the projection of each character string is not overlapped on the display interface, displaying the POI label on the display interface.
As an improvement of the above scheme, the POI display area is represented by a rectangular area formed by a lower left corner vertex and an upper right corner vertex of the POI label projected on the display interface.
As an improvement of the above scheme, the object projection area is represented by an area formed by an upper left corner vertex, a lower left corner vertex, an upper right corner vertex and a lower right corner vertex of the object projected on the display interface.
As an improvement of the above scheme, the displaying the POI tag on the display interface specifically includes:
aligning a center point of the POI tag with a center point of the object, and displaying the POI tag directly above the object.
In order to achieve the above object, an embodiment of the present invention further provides a POI tag display apparatus, including:
the calculation module is used for calculating the position information of the first central point of the POI label and the POI display area; calculating the position information of a second central point projected on a display interface by the POI label; calculating an object projection area of an object corresponding to the POI label projected on the display interface;
the judgment module is used for judging whether the POI label meets a preset display condition or not according to the position information of the first central point, the position information of the second central point, the POI display area and the object projection area;
and the display module is used for displaying the POI label on the display interface when the POI label meets the preset display condition.
As an improvement of the above scheme, the preset display condition includes that the object projection area is greater than a preset area threshold, the second center point is within the display interface, the object projection area includes the POI display area, and the first center point is not occluded.
As an improvement of the above scheme, the determining module is further configured to determine the type of the POI tag; the types of the POI labels comprise a POI label consisting of one character string and a POI label consisting of at least two character strings;
then, the display module is specifically configured to:
when the POI label meets the preset display condition and the type of the POI label is the POI label consisting of a character string, displaying the POI label on the display interface;
and when the POI label meets the preset display condition, the type of the POI label is a POI label consisting of at least two character strings, and the projection of each character string is not overlapped on the display interface, displaying the POI label on the display interface.
In order to achieve the above object, an embodiment of the present invention further provides a POI tag display apparatus, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, where the processor implements the POI tag display method according to any one of the above embodiments when executing the computer program.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example one
Referring to fig. 1, fig. 1 is a flowchart of a POI tag display method according to an embodiment of the present invention; the method comprises the following steps:
s1, calculating the position information of the first central point of the POI label and the POI display area;
s2, calculating the position information of a second central point of the POI label projected on the display interface;
s3, calculating an object projection area of the object corresponding to the POI label projected on the display interface;
s4, judging whether the POI label meets a preset display condition or not according to the position information of the first central point, the position information of the second central point, the POI display area and the object projection area;
and S5, when the POI label meets the preset display condition, displaying the POI label on the display interface.
It should be noted that the POI tag display method according to the embodiment of the present invention may be implemented by a client, and the client may be a mobile phone, a computer, or the like. The POI label display method is suitable for a two-dimensional map or a three-dimensional map. Referring to fig. 2, fig. 2 is a schematic diagram of a POI tag and an object on a display interface in a POI tag display method according to an embodiment of the present invention; the POI tag, i.e. the text "267" in the figure, and the like, in the above figure, "267" represents an object identified as 267, which is represented in the form of a geometric body in the embodiment of the present invention, and in other embodiments, the object may be directly represented by the outer contour of the object, which is within the protection scope of the present invention.
Specifically, in step S1, position information of a first center point of the POI tag is calculated; regardless of the height of the POI tag, the fixed point coordinates of one of the POI tags can be expressed as an ordered structure as follows: [ P0, P1, P2 … ], wherein P0 represents the point with sequence number 0, and so on. P0 is a two-dimensional coordinate denoted [ x0, y0 ].
The method of calculating the first center point is as follows: respectively calculating the maximum value and the minimum value of the POI label in the x dimension and the y dimension, and respectively recording the maximum value and the minimum value as follows: minX, minY, maxX, maxY then the coordinates of the first center point are: [ (minX + maxX)/2, (minY + maxY)/2], is recorded as center, which is the display coordinate of the POI tag.
Setting the two-dimensional size of the POI tag as follows: width w, height h; the vertex coordinates of the POI tag on the display interface may be expressed as follows:
lower left corner, [ cents [0] -w/2, cents [1] -h/2 ];
in the upper right corner, [ centerS S [0] + w/2, centerS [1] + h/2 ].
Referring to fig. 3, fig. 3 is a schematic diagram of a POI display area in a POI tag display method according to an embodiment of the present invention; preferably, the POI display area is represented by a rectangular area formed by a vertex at the lower left corner and a vertex at the upper right corner of the POI tag on the display interface.
Specifically, in step S2, the position information of the second center point projected on the display interface and the POI display area of the POI tag are calculated. And calculating a second central point of the projection of the display coordinate center of the POI label on the display interface, and recording the second central point as center S.
Specifically, in step S3, an object projection area of the object corresponding to the POI tag projected on the display interface is calculated. Firstly, the projection of the object on the display screen is calculated, and the calculation method of the projection is as follows:
let the vertex sequence of the geometry be:
[v0,v1,v2…];
the vertex coordinates can be two-dimensional, corresponding to a two-dimensional map, or three-dimensional, corresponding to a three-dimensional map, and the projection sequence of each corresponding vertex on the display interface is as follows:
[vs0,vs1,vs2…];
the projection sequences are two-dimensional fixed points, and the minimum maximum values of the projection sequences on the x axis and the y axis are respectively calculated and recorded as: minX, minY, maxX, maxY, then the four vertices that make up the projection region (i.e., the object projection region) are as follows:
the upper left corner: [ minX, maxY ];
lower left corner: [ minX, minY ];
the upper right corner: [ maxX, maxY ];
lower right corner: [ maxX, minY ].
Preferably, referring to fig. 4, fig. 4 is a schematic diagram of an object projection area of an object in a POI tag display method according to an embodiment of the present invention; the object projection area is represented by an area formed by the top left corner vertex, the bottom left corner vertex, the top right corner vertex and the bottom right corner vertex of the object projected on the display interface.
Specifically, in steps S4 to S5, it is determined whether the POI tag satisfies a preset display condition according to the position information of the first center point, the position information of the second center point, the POI display area, and the object projection area; and when the POI label meets the preset display condition, displaying the POI label on the display interface.
Preferably, the preset display condition includes that the object projection area is larger than a preset area threshold, the second central point is in the display interface, the object projection area includes the POI display area, and the first central point is not blocked, the preset display condition is specifically described below, the POI tag is displayed only when the following four rules are simultaneously satisfied, and the rule of the specific preset display condition is as follows:
rule one is as follows: if the two-dimensional projection area (namely the object projection area) of the object corresponding to the POI tag is larger than a preset pixel value, the POI tag can be displayed, otherwise, the POI tag is not displayed, and the preset pixel value can be customized according to specific conditions;
rule two: if the center point (i.e., the second center point) of the object corresponding to the POI tag is within the range of the projection screen, the POI tag can be displayed, otherwise, the POI tag is not displayed;
rule three: if the two-dimensional projection area (i.e., the object projection area) of the object corresponding to the POI tag includes the two-dimensional projection area (i.e., the POI display area) of the POI tag, the POI tag can be displayed, otherwise, the POI tag is not displayed;
rule four: if the POI tag center point position (i.e. the first center point) is not occluded by other geometric objects, it can be displayed, otherwise, it is not displayed.
Further, the method further comprises:
judging the type of the POI label; the types of the POI labels comprise a POI label consisting of one character string and a POI label consisting of at least two character strings;
then, when the POI tag meets the preset display condition, displaying the POI tag on the display interface, specifically including:
when the POI label meets the preset display condition and the type of the POI label is the POI label consisting of a character string, displaying the POI label on the display interface;
and when the POI label meets the preset display condition, the type of the POI label is a POI label consisting of at least two character strings, and the projection of each character string is not overlapped on the display interface, displaying the POI label on the display interface.
At this time, the condition that whether the POI tag is displayed needs to be determined includes five conditions, and the POI tag can be displayed only when five rules are simultaneously satisfied.
Further, the displaying the POI tag on the display interface specifically includes:
aligning a center point of the POI tag with a center point of the object, and displaying the POI tag directly above the object.
The present solution is further illustrated below with reference to specific examples:
s1, taking the electronic map in fig. 1 as an example, selecting geometric body "267", where the corresponding vertex coordinates are expressed in the world coordinate system as follows:
[ [12563180.14,3276702.68], [12563182.46,3276702.68], [12563182.46,3276697.73], [12563180.14,3276697.73], [12563180.14,3276702.68] ]; wherein the last vertex and the first vertex coincide and represent a closure, in accordance with the specification definition of polygon of geojson.
Calculating the first center point: minimum value along x axis minX:12563180.14, maximum value maxX: 12563182.46; the minimum along the y-axis is minY 3276697.73, the maximum is maxY: 3276702.68, respectively; the first center point center is: [12563181.3,3276700.205 ]; this step may be an online real-time calculation or an offline pre-processing.
Setting the two-dimensional size of the POI label: width w: 16pix, height h: 8 pix; the vertex coordinates of the POI tag on the screen are: bottom left corner [377,60 ]; upper right corner [393,68 ]; the POI display area is composed of the lower left corner vertex and the upper right corner vertex.
S2, projecting the center calculated in S1 on the screen, and recording the center as a center S (namely the second center point), wherein the center S is a coordinate which takes the screen as a reference coordinate system and takes a pixel as a unit, and the center S is [385,64] when the screen is viewed at a certain angle;
s3, projecting 4 vertexes [ v0, v1, v2, v3] into a screen coordinate system to obtain four vertexes [ vs0, vs1, vs2, vs3] of the screen coordinate system, calculating the minimum maximum value of x-axis and y-axis components of the 4 vertexes to obtain: minX:373, maxX:400, minY:50, and maxY: 70.
The object projection area, which consists of these four values, is: the upper left corner: [373,70 ]; lower left corner: [373,50 ]; the upper right corner: [400,70 ]; lower right corner: [400,50].
S4: judging whether the POI label should be displayed according to five rules:
rule one is as follows: calculating the area of the object projection area:
the width is: 400-; the height is as follows: 70-50 ═ 20; its area is 27 x 20-540. If the preset pixel value customized by the user is greater than 540, the POI tag is not displayed, otherwise, the POI tag may be displayed, in the embodiment of the present invention, the value x is 500, so that rule one is satisfied.
Rule two: and judging whether the second center point centerS calculated in the second step is within the screen, wherein in the embodiment of the invention, the second center point centerS is within the screen, so that the rule two is satisfied.
Rule three: the POI display area is described as: lower left corner: [377,60], upper right corner: [393,68 ]. The object projection area is described as: the upper left corner: [373,70 ]; lower left corner: [373,50 ]; the upper right corner: [400,70 ]; lower right corner: [400,50]. Fig. 5 is a schematic diagram illustrating a screen coordinate system in an intuitive manner, where fig. 5 is a schematic diagram illustrating a relationship between a POI display area and an object projection area in a POI tag display method according to an embodiment of the present invention. Obviously, the projection area of the POI tag on the screen is within the projection area of the geometry corresponding to the POI tag on the screen, so that rule three is satisfied.
Rule four: if the first central point of the POI tag is not occluded, it may be displayed, and if it is occluded, the first central point of the POI tag is not occluded in the scene of the embodiment of the present invention, so that rule four is satisfied.
Rule five: since the POI tag in the embodiment of the present invention belongs to a POI tag composed of one character string, rule five is satisfied.
In summary of the first to fifth rules, the POI tags in the embodiments of the present invention all satisfy the first to fifth rules, so that the POI tags can be displayed on the object.
Compared with the prior art, the POI label display method disclosed by the embodiment of the invention is suitable for a two-dimensional map or a three-dimensional map, the display rule is formulated by calculating the position relationship between the POI label and the corresponding object, the type of the POI label is not required to be marked manually, but the position to be presented by the POI label is calculated automatically, so that the position marking of the POI label is greatly simplified, in addition, the display rule is not required to be determined by the resolution of a display interface, but is determined based on the position relationship between the POI label and the corresponding object, so that the judgment rule is more rigorous, the disordered label on the map can be improved, and better user experience is brought.
Example two
Referring to fig. 6, fig. 6 is a schematic structural diagram of a POI label display apparatus 10 according to an embodiment of the present invention; the method comprises the following steps:
the calculation module 11 is configured to calculate position information of a first central point of the POI tag; calculating position information of a second central point projected on a display interface of the POI label and a POI display area; calculating an object projection area of an object corresponding to the POI label projected on the display interface;
the judging module 12 is configured to judge whether the POI tag meets a preset display condition according to the position information of the first central point, the position information of the second central point, the POI display area, and the object projection area;
and the display module 13 is configured to display the POI tag on the display interface when the POI tag meets the preset display condition.
Preferably, the judging module 12 is further configured to judge the type of the POI tag; the types of the POI labels comprise a POI label consisting of one character string and a POI label consisting of at least two character strings;
then, the display module 13 is specifically configured to:
when the POI label meets the preset display condition and the type of the POI label is the POI label consisting of a character string, displaying the POI label on the display interface;
and when the POI label meets the preset display condition, the type of the POI label is a POI label consisting of at least two character strings, and the projection of each character string is not overlapped on the display interface, displaying the POI label on the display interface.
Preferably, the POI display area is represented by a rectangular area formed by a lower left corner vertex and an upper right corner vertex of the POI tag projected on the display interface. The object projection area is represented by an area formed by the top left corner vertex, the bottom left corner vertex, the top right corner vertex and the bottom right corner vertex of the object projected on the display interface.
Further, the displaying the POI tag on the display interface specifically includes:
aligning a center point of the POI tag with a center point of the object, and displaying the POI tag directly above the object.
For the specific working process of each module, please refer to the specific working process of the POI tag display method in the first embodiment, which is not described herein again.
Compared with the prior art, the POI label display device 10 disclosed in the embodiment of the invention is suitable for a two-dimensional map or a three-dimensional map, and the display rule is formulated by calculating the position relationship between the POI label and the corresponding object, and the position to be presented by the POI label is automatically calculated without manually marking the type of the POI label, so that the position marking of the POI label is greatly simplified.
EXAMPLE III
Referring to fig. 7, fig. 7 is a schematic structural diagram of a POI label display device 20 according to an embodiment of the present invention; the POI tag display device 20 of this embodiment includes: a processor 21, a memory 22 and a computer program stored in said memory 22 and executable on said processor 21. The processor 21, when executing the computer program, implements the steps in the foregoing embodiments of the POI label displaying method, such as step S1 shown in fig. 1. Alternatively, the processor 21, when executing the computer program, implements the functions of the modules/units in the above-mentioned device embodiments, such as the computing module 11.
Illustratively, the computer program may be divided into one or more modules/units, which are stored in the memory 22 and executed by the processor 21 to accomplish the present invention. The one or more modules/elements may be a series of computer program instruction segments capable of performing specific functions that describe the execution of the computer program in the POI tag display device 20. For example, the computer program may be divided into a calculating module 11, a determining module 12 and a displaying module 13, and for the specific functions of each module, reference is made to the specific working process of the POI tag displaying apparatus 10 described in the second embodiment, which is not described herein again.
The POI tag display device 20 may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices. The POI tag display device 20 may include, but is not limited to, a processor 21, a memory 22. Those skilled in the art will appreciate that the schematic diagram is merely an example of the POI tag display device 20 and does not constitute a limitation of the POI tag display device 20 and may include more or less components than those shown, or some components in combination, or different components, for example, the POI tag display device 20 may also include input and output devices, network access devices, buses, etc.
The Processor 21 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. The general purpose processor may be a microprocessor or the processor 21 may be any conventional processor or the like, the processor 21 being the control center for the POI tag display device 20, with various interfaces and wiring connecting the various parts of the overall POI tag display device 20.
The memory 22 may be used to store the computer programs and/or modules, and the processor 21 may implement the various functions of the POI tag display device 20 by operating or executing the computer programs and/or modules stored in the memory 22 and calling data stored in the memory 22. The memory 22 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. In addition, the memory 22 may include high speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
Wherein the integrated modules/units of the POI label display device 20, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the method according to the above embodiments may be implemented by a computer program, which may be stored in a computer readable storage medium and used by the processor 21 to implement the steps of the above embodiments of the method. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
It should be noted that the above-described device embodiments are merely illustrative, where the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. In addition, in the drawings of the embodiment of the apparatus provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, and may be specifically implemented as one or more communication buses or signal lines. One of ordinary skill in the art can understand and implement it without inventive effort.
While the foregoing is directed to the preferred embodiment of the present invention, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention.