Summary of the invention
In view of this, this application provides a kind of pel indexing means and device, for solving existing QuadTree algorithm institute
The problem of existing index waste of storage space.
To achieve the goals above, it is proposed that scheme it is as follows:
A kind of pel indexing means, comprising:
Electronic map is divided into several layers, every layer of electronic map carries out grid dividing, wherein according to level by up to
Under sequence, the size of the unit grids in each layer electronic map is gradually successively decreased, also, the list in top layer's electronic map
Size of the size of position grid at least more than pel maximum in the electronic map;
According to the size of unit grids in the size of pel in the electronic map and each layer electronic map, determine described in
The level of the corresponding electronic map of pel;
According to the position of pel in the electronic map, determine that the pel is corresponding in the electronic map of corresponding level
Grid;
The pel is inserted into the node array of corresponding grid, wherein according to pel insertion in the node array of grid
Sequencing is successively stored with several pels.
Preferably, it is described according in the size of pel in the electronic map and each layer electronic map unit grids it is big
It is small, determine the level of the corresponding electronic map of the pel, comprising:
According to each apex coordinate of pel in the electronic map, the minimum boundary rectangle of the pel is calculated;
Determine that the side length of unit grids is greater than level locating for the unit grids of the longest edge of the minimum boundary rectangle;
The smallest level of side length that unit grids are chosen from determining level, as the corresponding electronic map of the pel
Level.
Preferably, the position according to pel in the electronic map determines the pel in the electronics of corresponding level
Corresponding grid in map, comprising:
Calculate the centre coordinate of the pel;
In the electronic map of pel corresponding level, determines grid belonging to the centre coordinate of the pel, determined
For the corresponding grid of the pel.
A kind of pel detection method, based on above-mentioned pel indexing means, the figure wherein stored in the node array of grid
Member has z-order value, and the z-order value for the pel being inserted into afterwards is greater than the z-order value for the pel being first inserted into, pel detection
Method includes:
Determine the striking point of user on the electronic map;
It determines striking point grid corresponding in each layer electronic map, obtains multiple grids;
Determine the maximum pel of z-order value in the node array of each grid;
The maximum pel of z-order value in determining multiple pels is determined as the pel that user chooses.
Preferably, determination striking point grid corresponding in each layer electronic map, comprising:
According to the coordinate of the striking point, grid belonging to the coordinate is determined in each layer electronic map, it will be determining
Grid is added in the corresponding grid set of the striking point;
Determine the coordinate of striking point quadrant affiliated in the grid;
By in same level, the corresponding grid set of the striking point is added to three adjacent grids of the quadrant
In.
A kind of pel indexing unit, comprising:
Electronic map delaminating units, for electronic map to be divided into several layers, every layer of electronic map carries out grid and draws
Point, wherein according to the sequence of level from top to bottom, the size of the unit grids in each layer electronic map is gradually successively decreased, also, is located
Size of the size of unit grids in top layer's electronic map at least more than pel maximum in the electronic map;
Pel level corresponding unit, for according to single in the size of pel in the electronic map and each layer electronic map
The size of position grid, determines the level of the corresponding electronic map of the pel;
Pel grid corresponding unit determines the pel in correspondence for the position according to pel in the electronic map
Corresponding grid in the electronic map of level;
Pel is inserted into unit, for the pel to be inserted into the node array of corresponding grid, the wherein number of nodes of grid
The sequencing being inserted into group according to pel, is successively stored with several pels.
Preferably, the pel level corresponding unit includes:
Pel size computing unit, for calculating the pel according to each apex coordinate of pel in the electronic map
Minimum boundary rectangle;
Pel level screening unit, for determining that the side length of unit grids is greater than the longest edge of the minimum boundary rectangle
Level locating for unit grids;
Pel level determination unit, for choosing the smallest level of side length of unit grids from determining level, as
The level of the corresponding electronic map of the pel.
Preferably, the pel grid corresponding unit includes:
Pel centre coordinate computing unit, for calculating the centre coordinate of the pel;
Pel grid determination unit, in the electronic map of pel corresponding level, determining that the center of the pel is sat
Grid belonging to mark, determines it as the corresponding grid of the pel.
A kind of pel detection device, based on above-mentioned pel indexing unit, the figure wherein stored in the node array of grid
Member has z-order value, and the z-order value for the pel being inserted into afterwards is greater than the z-order value for the pel being first inserted into, pel detection
Device includes:
Striking point determination unit, for determining the striking point of user on the electronic map;
Striking dot grid corresponding unit is obtained for determining striking point grid corresponding in each layer electronic map
To multiple grids;
First pel screening unit, the maximum pel of z-order value in the node array for determining each grid;
Second pel screening unit, for the maximum pel of z-order value in the multiple pels determined to be determined as user
The pel chosen.
Preferably, the striking dot grid corresponding unit includes:
First striking dot grid corresponds to subelement, for the coordinate according to the striking point, in each layer electronic map really
Grid belonging to the fixed coordinate, determining grid is added in the corresponding grid set of the striking point;
Second striking dot grid corresponds to subelement, for belonging to determining the coordinate of the striking point in the grid as
Limit;
Third striking dot grid corresponds to subelement, for by same level, three grids adjacent with the quadrant to add
It adds in the corresponding grid set of the striking point.
It can be seen from the above technical scheme that pel indexing means provided by the embodiments of the present application, electronic map is drawn
It is divided into several layers, every layer of electronic map carries out grid dividing, wherein according to the sequence of level from top to bottom, each layer is electronically
The size of unit grids in figure is gradually successively decreased, also, in top layer's electronic map unit grids size at least more than
The size of maximum pel in the electronic map, according to single in the size of pel in the electronic map and each layer electronic map
The size of position grid, determines the level of the corresponding electronic map of the pel, further according to the position of pel in electronic map,
It determines pel grid corresponding in the electronic map of corresponding level, pel is inserted into the node array of corresponding grid,
In, the sequencing being inserted into the node array of grid according to pel is successively stored with several pels.According to the figure of the application
First indexing means, no matter pel size, be merely stored in node array corresponding to some grid of some level, Bu Huiduo
It is secondary to repeat to store, save memory space.
Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present application, technical solutions in the embodiments of the present application carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of embodiments of the present application, instead of all the embodiments.It is based on
Embodiment in the application, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall in the protection scope of this application.
Referring to Fig. 1, Fig. 1 is a kind of pel indexing means flow chart disclosed in the embodiment of the present application.
As shown in Figure 1, this method comprises:
Step S100, electronic map is divided into several layers, every layer of electronic map carries out grid dividing;
Wherein, the size of the sequence according to level from top to bottom, the unit grids in each layer electronic map is gradually successively decreased, and
And the size of the unit grids in top layer's electronic map is at least more than the size of pel maximum in the electronic map.
Specifically, total number of levels can be pre-set, is arranged simultaneously according to pel quantity and size in electronic map
The sizing grid W of top layer0, W0At least more than the size of pel maximum in electronic map.The size for the grid that every layer below of top layer
Ratio of successively decreasing S.
Step S110, according in the size of pel in the electronic map and each layer electronic map unit grids it is big
It is small, determine the level of the corresponding electronic map of the pel;
After the level for completing electronic map divides, grid is of different sizes in different levels.According to the size of pel, choosing
Select suitable level.Here, in selected level unit grids size at least more than pel size.
Step S120, according to the position of pel in the electronic map, determine the pel corresponding level electronically
Corresponding grid in figure;
Specifically, pel is identified with location information in electronic map, determines it in corresponding level according to the location information
Corresponding grid in electronic map.Grid belonging to being determined according to the position coordinates of pel when specifically to correspondence.
Step S130, the pel is inserted into the node array of corresponding grid.
The sequencing being wherein inserted into the node array of grid according to pel, is successively stored with several pels.Each
Grid is corresponding with node array, and node array is for storing pel.Since possible multiple pels correspond to same grid,
The sequencing that can be inserted into according to pel in the node array of grid stores pel.
In order to clearly identify storage mode of multiple pels in the node array of same grid, the present embodiment introduces z-
The concept of order.The pel stored in the node array of grid has z-order value, and the z-order for the pel being inserted into afterwards
Value is greater than the z-order value for the pel being first inserted into.It lifts for example, the z-order value of the pel of first insertion is 1, second is inserted
The z-order value of the pel entered is 2, subsequent gradually to add 1.
Electronic map is divided into several layers by pel indexing means provided by the embodiments of the present application, and every layer of electronic map is equal
Carry out grid dividing, wherein according to the sequence of level from top to bottom, the size of the unit grids in each layer electronic map is gradually passed
Subtract, also, the size of the unit grids in top layer's electronic map is big at least more than pel maximum in the electronic map
It is small, according to the size of unit grids in the size of pel in the electronic map and each layer electronic map, determine the pel
The level of corresponding electronic map determines pel in the electronics of corresponding level further according to the position of pel in electronic map
Pel is inserted into the node array of corresponding grid, wherein according to figure in the node array of grid by corresponding grid in map
The sequencing of member insertion, is successively stored with several pels.According to the pel indexing means of the application, no matter pel size,
It is merely stored in node array corresponding to some grid of some level, and storage will not be repeated several times, and it is empty to save storage
Between.
Referring to fig. 2, Fig. 2 is another kind pel search method flow chart disclosed in the embodiment of the present application.
As shown in Fig. 2, this method comprises:
Step S200, electronic map is divided into several layers, every layer of electronic map carries out grid dividing;
Wherein, the size of the sequence according to level from top to bottom, the unit grids in each layer electronic map is gradually successively decreased, and
And the size of the unit grids in top layer's electronic map is at least more than the size of pel maximum in the electronic map.
Specifically, total number of levels can be pre-set, is arranged simultaneously according to pel quantity and size in electronic map
The sizing grid W of top layer0, W0At least more than the size of pel maximum in electronic map.The size for the grid that every layer below of top layer
Ratio of successively decreasing S.
Step S210, according to each apex coordinate of pel in the electronic map, the minimum boundary rectangle of the pel is calculated;
Here the concept of minimum boundary rectangle is the maximum magnitude of several two-dimensional shapes indicated with two-dimensional coordinate, i.e., to give
Maximum abscissa, minimum abscissa, maximum ordinate, minimum ordinate in each vertex of fixed two-dimensional shapes fix the square on boundary
Shape.
Step S220, determine that the side length of unit grids is greater than locating for the unit grids of the longest edge of the minimum boundary rectangle
Level;
Specifically, the minimum boundary rectangle of pel is calculated in previous step, and then can determine minimum boundary rectangle
Longest edge length.
Further, for the unit grids of each level electronic map, the side length for selecting unit grids is greater than above-mentioned determination
Minimum boundary rectangle longest edge length unit grids, and determine level locating for such unit grids.
Step S230, the smallest level of side length of unit grids is chosen from determining level, it is corresponding as the pel
Electronic map level;
Due to the level of above-mentioned determination may have it is multiple, it is in this step that the side length of unit grids in multiple levels is the smallest
Level is determined as the level of the corresponding electronic map of pel.
Step S240, according to the position of pel in the electronic map, determine the pel corresponding level electronically
Corresponding grid in figure;
Specifically, pel is identified with location information in electronic map, determines it in corresponding level according to the location information
Corresponding grid in electronic map.Grid belonging to being determined according to the position coordinates of pel when specifically to correspondence.
Step S250, the pel is inserted into the node array of corresponding grid.
The sequencing being wherein inserted into the node array of grid according to pel, is successively stored with several pels.Each
Grid is corresponding with node array, and node array is for storing pel.Since possible multiple pels correspond to same grid,
The sequencing that can be inserted into according to pel in the node array of grid stores pel.
In the present embodiment, a kind of specific embodiment mode of the level of the corresponding electronic map of determining pel is described,
I.e. with reference to the size of unit grids in the minimum boundary rectangle and each level electronic map of pel, the corresponding layer of pel is determined
Grade.
In order to make it easy to understand, we are introduced with the process that a specific example determines pel level.
Assuming that the length and width of the minimum boundary rectangle of substation's pel are respectively 3 centimetres and 2 centimetres.Each level is electronically
The side length of the unit grids of figure is as follows:
The side length of the unit grids of first layer: 10 centimetres;
The side length of the unit grids of the second layer: 8 centimetres;
The side length of the unit grids of third layer: 6 centimetres;
The side length of 4th layer of unit grids: 4 centimetres;
The side length of the unit grids of layer 5: 2 centimetres.
Therefore, level locating for unit grids of the unit grids side length greater than 3 centimetres is chosen, obtains first layer to the 4th
Layer.Further, the smallest level of unit grids side length is therefrom chosen, the 4th level is obtained, is i.e. the 4th level is substation's pel
Corresponding level.
In another embodiment of the application, another pel indexing means is disclosed.It is the application referring to Fig. 3, Fig. 3
Another pel indexing means flow chart disclosed in embodiment.
As shown in figure 3, this method comprises:
Step S300, electronic map is divided into several layers, every layer of electronic map carries out grid dividing;
Wherein, the size of the sequence according to level from top to bottom, the unit grids in each layer electronic map is gradually successively decreased, and
And the size of the unit grids in top layer's electronic map is at least more than the size of pel maximum in the electronic map.
Step S310, according in the size of pel in the electronic map and each layer electronic map unit grids it is big
It is small, determine the level of the corresponding electronic map of the pel;
After the level for completing electronic map divides, grid is of different sizes in different levels.According to the size of pel, choosing
Select suitable level.Here, in selected level unit grids size at least more than pel size.
Step S320, the centre coordinate of the pel is calculated;
Pel is a graphic element in electronic map, can calculate pel most when calculating the centre coordinate of pel
The centre coordinate of small bounding rectangles.
Step S330, in the electronic map of pel corresponding level, grid belonging to the centre coordinate of the pel is determined,
Determine it as the corresponding grid of the pel;
Since the grid of each level is identified with coordinate information, thus may determine that centre coordinate fall in which grid it
It is interior, and then the grid is determined as the corresponding grid of pel.
Step S340, the pel is inserted into the node array of corresponding grid.
The sequencing being wherein inserted into the node array of grid according to pel, is successively stored with several pels.Each
Grid is corresponding with node array, and node array is for storing pel.Since possible multiple pels correspond to same grid,
The sequencing that can be inserted into according to pel in the node array of grid stores pel.
In the present embodiment, the specific embodiment mode for describing a kind of corresponding grid of determining pel, i.e., according to pel
Centre coordinate, judge which grid it belongs within the scope of, and then the grid is determined as the corresponding grid of pel.
It is introduced in above-described embodiment by the process of pel insertion node array, cancels the process and pel of index for pel
Index process it is similar, unique difference is exactly that final step removes pel from the node array of grid.
In the another embodiment of the application, a kind of pel detection method is introduced.Pel detection method, that is, user is clicking
When pel on electronic map, the process for the pel that system detection is chosen.Pel detection method is indexed based on above-mentioned pel
Method.Referring to fig. 4, Fig. 4 is a kind of pel detection method flow chart disclosed in the embodiment of the present application.
As shown in figure 4, this method comprises:
Step S400, the striking point of user on the electronic map is determined;
Step S410, it determines striking point grid corresponding in each layer electronic map, obtains multiple grids;
Specifically, since the electronic map after layering includes vertical multilayer electronic map, the striking point of user is at every layer
Mapping point is all corresponding on electronic map, this step determines striking point net corresponding to the mapping point on each layer electronic map
Lattice.
Step S420, the maximum pel of z-order value in the node array of each grid is determined;
Step S430, the maximum pel of z-order value in determining multiple pels is determined as the pel that user chooses.
Pel detection method provided by the embodiments of the present application, when user clicks on the electronic map, according to the touching of user
The grid determined in each level is hit, and chooses the maximum pel of z-order value in the node array of grid, finally by selection
The maximum pel of z-order value is determined as the pel that user chooses in pel.Wherein, the big pel of z-order value is covered on z-
On the small pel of order value, therefore the maximum pel of z-order value chosen is the pel to be chosen of user.
In another embodiment of the application, it is contemplated that pel occupies a certain range in electronic map, and user clicks
It may be clicked on when pel on each position of pel, and different striking points are possible to fall in different grids.With Fig. 5 example
In case where, wherein oval pel A is in the position in certain layer of electronic map as shown in figure 5, it is in grid 1,2,4,5
With graphic element.And the centre coordinate of pel A is located in grid 1, therefore in pel index by pel A interpenetration network 1
In corresponding node array.At this point, if user exactly clicks on 5 part of grid when clicking pel A, if only in grid
If searching pel in 5 node array, it will be unable to provide the true pel to be chosen of user.
For this purpose, this application discloses another pel detection method, referring to Fig. 6, Fig. 6 be disclosed in the embodiment of the present application again
A kind of pel detection method flow chart.
As shown in fig. 6, this method comprises:
Step S600, the striking point of user on the electronic map is determined;
Step S610, according to the coordinate of the striking point, grid belonging to the coordinate is determined in each layer electronic map,
Determining grid is added in the corresponding grid set of the striking point;
Specifically, which grid the coordinate of striking point falls in each layer electronic map, grid can be added in the grid
In set.It is understood that a coordinate points only belong to a grid (in net boundary in one layer of electronic map
Point can be drawn according to setting rule into some grid in adjacent mesh).
Step S620, the coordinate of striking point quadrant affiliated in the grid is determined;
Specifically, for each grid, four quadrants can be divided into, it is shown in Figure 5, wherein in grid 5
Cross hairs is divided into four quadrants.
Step S630, by same level, it is corresponding that the striking point is added to three adjacent grids of the quadrant
In grid set;
For quadrant belonging to striking point coordinate, its three adjacent grid is also added in grid set.This step
Mainly be possible to be covered on multiple grids in view of pel, in order to avoid due to user's striking point and the affiliated grid of pel not
With and generation the case where cause error detection, adjacent three grids of the affiliated quadrant of striking point are also added to grid in the present embodiment
In set, and then subsequent pel can be chosen from grid set.
Step S640, the maximum pel of z-order value in the node array of each grid is determined in grid set;
Step S650, the maximum pel of z-order value in determining multiple pels is determined as the pel that user chooses.
In the present embodiment, the mistake for determining striking point grid corresponding in each layer electronic map is described in detail
Journey.During being somebody's turn to do, not only using grid belonging to striking point as the corresponding grid of striking point, also by the phase of the affiliated quadrant of striking point
Adjacent three grids are also used as the corresponding grid of striking point, avoid the occurrence of missing inspection, improve the accuracy of pel detection.
Pel indexing unit provided by the embodiments of the present application is described below, pel indexing unit described below with
Above-described pel indexing means can correspond to each other reference.
Referring to Fig. 7, Fig. 7 is a kind of pel indexing unit structural schematic diagram disclosed in the embodiment of the present application.
As shown in fig. 7, the device includes:
Electronic map delaminating units 71, for electronic map to be divided into several layers, every layer of electronic map carries out grid
It divides, wherein according to the sequence of level from top to bottom, the size of the unit grids in each layer electronic map is gradually successively decreased, also,
Size of the size of unit grids in top layer's electronic map at least more than pel maximum in the electronic map;
Pel level corresponding unit 72, for according in the size of pel in the electronic map and each layer electronic map
The size of unit grids determines the level of the corresponding electronic map of the pel;
Pel grid corresponding unit 73 determines the pel right for the position according to pel in the electronic map
Answer grid corresponding in the electronic map of level;
Pel is inserted into unit 74, for the pel to be inserted into the node array of corresponding grid, the wherein node of grid
The sequencing being inserted into array according to pel, is successively stored with several pels.
Electronic map is divided into several layers by pel indexing unit provided by the embodiments of the present application, and every layer of electronic map is equal
Carry out grid dividing, wherein according to the sequence of level from top to bottom, the size of the unit grids in each layer electronic map is gradually passed
Subtract, also, the size of the unit grids in top layer's electronic map is big at least more than pel maximum in the electronic map
It is small, according to the size of unit grids in the size of pel in the electronic map and each layer electronic map, determine the pel
The level of corresponding electronic map determines pel in the electronics of corresponding level further according to the position of pel in electronic map
Pel is inserted into the node array of corresponding grid, wherein according to figure in the node array of grid by corresponding grid in map
The sequencing of member insertion, is successively stored with several pels.According to the pel indexing means of the application, no matter pel size,
It is merely stored in node array corresponding to some grid of some level, and storage will not be repeated several times, and it is empty to save storage
Between.
Optionally, pel level corresponding unit described above may include:
Pel size computing unit, for calculating the pel according to each apex coordinate of pel in the electronic map
Minimum boundary rectangle;
Pel level screening unit, for determining that the side length of unit grids is greater than the longest edge of the minimum boundary rectangle
Level locating for unit grids;
Pel level determination unit, for choosing the smallest level of side length of unit grids from determining level, as
The level of the corresponding electronic map of the pel.
Optionally, pel grid corresponding unit described above may include:
Pel centre coordinate computing unit, for calculating the centre coordinate of the pel;
Pel grid determination unit, in the electronic map of pel corresponding level, determining that the center of the pel is sat
Grid belonging to mark, determines it as the corresponding grid of the pel.
Pel detection device provided by the embodiments of the present application is described below, pel detection device described below with
Above-described pel detection method can correspond to each other reference.
The pel detection device of the present embodiment is the application implementation referring to Fig. 8, Fig. 8 based on above-mentioned pel indexing unit
A kind of pel structure of the detecting device schematic diagram disclosed in example.
As shown in figure 8, the device includes:
Striking point determination unit 81, for determining the striking point of user on the electronic map;
Striking dot grid corresponding unit 82, for determining striking point grid corresponding in each layer electronic map,
Obtain multiple grids;
First pel screening unit 83, the maximum figure of z-order value in the node array for determining each grid
Member;
Second pel screening unit 84, for the maximum pel of z-order value in the multiple pels determined to be determined as using
The pel that family is chosen.
Pel detection device provided by the embodiments of the present application, when user clicks on the electronic map, according to the touching of user
The grid determined in each level is hit, and chooses the maximum pel of z-order value in the node array of grid, finally by selection
The maximum pel of z-order value is determined as the pel that user chooses in pel.Wherein, the big pel of z-order value is covered on z-
On the small pel of order value, therefore the maximum pel of z-order value chosen is the pel to be chosen of user.
Optionally, striking dot grid corresponding unit described above may include:
First striking dot grid corresponds to subelement, for the coordinate according to the striking point, in each layer electronic map really
Grid belonging to the fixed coordinate, determining grid is added in the corresponding grid set of the striking point;
Second striking dot grid corresponds to subelement, for belonging to determining the coordinate of the striking point in the grid as
Limit;
Third striking dot grid corresponds to subelement, for by same level, three grids adjacent with the quadrant to add
It adds in the corresponding grid set of the striking point.
Finally, it is to be noted that, herein, relational terms such as first and second and the like be used merely to by
One entity or operation are distinguished with another entity or operation, without necessarily requiring or implying these entities or operation
Between there are any actual relationship or orders.Moreover, the terms "include", "comprise" or its any other variant meaning
Covering non-exclusive inclusion, so that the process, method, article or equipment for including a series of elements not only includes that
A little elements, but also including other elements that are not explicitly listed, or further include for this process, method, article or
The intrinsic element of equipment.In the absence of more restrictions, the element limited by sentence "including a ...", is not arranged
Except there is also other identical elements in the process, method, article or apparatus that includes the element.
Each embodiment in this specification is described in a progressive manner, the highlights of each of the examples are with other
The difference of embodiment, the same or similar parts in each embodiment may refer to each other.
The foregoing description of the disclosed embodiments makes professional and technical personnel in the field can be realized or use the application.
Various modifications to these embodiments will be readily apparent to those skilled in the art, as defined herein
General Principle can be realized in other embodiments without departing from the spirit or scope of the application.Therefore, the application
It is not intended to be limited to the embodiments shown herein, and is to fit to and the principles and novel features disclosed herein phase one
The widest scope of cause.