CN107016712A - One kind is based on the automatic Contours Fill method of " chinampa " bubble sort - Google Patents

One kind is based on the automatic Contours Fill method of " chinampa " bubble sort Download PDF

Info

Publication number
CN107016712A
CN107016712A CN201710233428.4A CN201710233428A CN107016712A CN 107016712 A CN107016712 A CN 107016712A CN 201710233428 A CN201710233428 A CN 201710233428A CN 107016712 A CN107016712 A CN 107016712A
Authority
CN
China
Prior art keywords
chinampa
isopleth
numbering
sea
value
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.)
Granted
Application number
CN201710233428.4A
Other languages
Chinese (zh)
Other versions
CN107016712B (en
Inventor
张家璐
张瑞明
张方林
王者风
彭真明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
University of Electronic Science and Technology of China
Original Assignee
University of Electronic Science and Technology of China
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by University of Electronic Science and Technology of China filed Critical University of Electronic Science and Technology of China
Priority to CN201710233428.4A priority Critical patent/CN107016712B/en
Publication of CN107016712A publication Critical patent/CN107016712A/en
Application granted granted Critical
Publication of CN107016712B publication Critical patent/CN107016712B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/203Drawing of straight lines or curves
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/40Filling a planar surface by adding surface attributes, e.g. colour or texture

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention discloses a kind of automatic Contours Fill method for being based on " chinampa " bubble sort, it is related to the data visualization process field in geological prospecting, the specifically related to Research on Automatic Filling technical field of isopleth, when solving in the prior art using benefit relation progress Contours Fill is opened up, open up benefit relation complex, to depend on the acquisition methods of isopleth, it is impossible to needs are implemented separately, so as to cause the problem of charging efficiency is low.The present invention the open up benefit relation interregional to isopleth is carried out abstract and simplified, by the concept for proposing " chinampa " and " sea ", the fill order of choropleth is ranked up with the algorithm similar to bubble sort method, it is possible to achieve fast automatic filling is carried out to a large amount of isopleth that there is complexity to open up benefit relation.The present invention is used for the Fast Filling of isopleth.

Description

One kind is based on the automatic Contours Fill method of " chinampa " bubble sort
Technical field
One kind is based on the automatic Contours Fill method of " chinampa " bubble sort, for the Fast Filling of isopleth, is related to Data visualization process field in geological prospecting, and in particular to the Research on Automatic Filling technical field of isopleth.
Background technology
With the fast development of computer, the data visualization ability of computer software is drawn simultaneously also in fast lifting Isogram has quite varied application as a kind of more basic data visualization means.At present in the acquisition of isopleth Aspect has the algorithm of comparative maturity, for example:Isopleth acquisition methods based on triangular net.But filled out automatically in isopleth Aspect is filled, conventional method has scanning filling and area filling at present.
Scanning filling method is the method that detects by point by point scanning to determine to want the color of filling region, and this method simply may be used Lean on, implement and be relatively easy to.But filling speed is slow, operational efficiency is relatively low, and because scanning filling algorithm is not arrow Computing is measured, needs to re-start Contours Fill after vector scaling is carried out to isogram.These inborn shortcomings, greatly Limit the application of scanning filling algorithm.
Area filling is owned by France in vector filling algorithm, and its common method is 1. to find the connected region in isogram, so Connected region is filled afterwards;2. determine that regional opens up benefit relation, then mend relation pair isopleth and filled out according to opening up Fill, for example:" open up benefit and include Binomial Trees ";3. the inclusion relation of regional is determined, then according to region inclusion relation, with elder generation Fill big region, the principle of rear filling zonule and carry out area filling.Due to isopleth connected region and open up benefit relation more Complexity, thus the algorithm of method 1., 2. be implemented separately it is relatively difficult, when algorithm is realized, the generally acquisition in isopleth During begin to consider isopleth connected region or open up benefit relation, the dependence to isopleth acquisition algorithm is very strong.Method 3. obtained successively generally by recursive method and arrange choropleth from small to large, algorithm is implemented compared with method 1., 2. more To be simple and can independently realize, but when equivalent number of lines to be processed is more, the time complexity of algorithm operation can be big Big lifting, operational efficiency is greatly reduced, therefore, and conventional ranking method is only suitable for determining that the region of the less isopleth of bar number is included Relation.
The content of the invention
The present invention provides a kind of automatic Contours Fill side for being based on " chinampa " bubble sort for above-mentioned weak point Method, is solved in the prior art using when opening up benefit relation and carrying out Contours Fill, it is complex to open up benefit relation, to depend on isopleth Acquisition methods, it is impossible to be implemented separately, so as to cause the problem of charging efficiency is low.
The technical solution adopted by the present invention is as follows:
One kind is based on the automatic Contours Fill method of " chinampa " bubble sort, it is characterised in that following steps:
(1) isopleth is obtained, the information of isopleth to be filled and the boundary information of isogram is inputted;
(2) all isopleth are carried out Seal treatment, obtain multiple " chinampas ", produce by the information inputted according to step (1) To multiple polygonal closed sections being covered on background area;
(3) the upper and lower, left and right four edges circle information on each " chinampa " is calculated respectively;
(4) all " chinampas " is ranked up according to the sequencing of drafting;
(5) color value to be filled each is distributed for " sea " and all " chinampa ", wherein, " sea " refers to the back of the body Scene area;
(6) first " sea " is filled using OpenGL, then to all " chinampa " according to the order arranged according to Secondary filling, the isogram after being filled.
Further, in the step (1), the information for inputting isopleth to be filled is:The total number N of isopleth to be filled; The height value v of every isoplethn;The total number M for the coordinate points that every isopleth is includedn;All coordinate points of every isopleth Information (xnm, ynm)。
Further, the step (2) is the starting point (x according to isoplethn0, yn0) and terminalCoordinate letter Breath, intersects situation according to isopleth and " sea " border, is isopleth addition boundary point, at the progress closing of all isopleth Reason.
Further, according to the specific steps that intersect situation, be isopleth add boundary point of the isopleth with " sea " border It is as follows:
(21) whether the border for judging " sea " is rectangle;
(22), can be by equivalence according to isopleth and the position relationship on " sea " border if the border on " sea " is rectangle Line is divided into following four classes:
Isopleth beginning and end is identical, i.e., when isopleth is closed, without the point that closure is added for isopleth;
Isopleth beginning and end is on the same side on " sea " border, without the point that closure is added for isopleth;
Isopleth beginning and end on two adjacent sides on " sea " border, is selected in four summits of square boundary respectively A point that can close isopleth is taken to be added in equivalent line coordinates;
Isopleth beginning and end is respectively on two opposite side of square boundary, if isopleth is across on " sea " border On the side of two longitudinal directions, two summits on the upside of " sea " border are added in equivalent line coordinates, as the point of closure, if waiting It is worth line on the side in two transverse directions on " sea " border, two summits on the right side of " sea " border are added into isopleth sits In mark, the point of closure is used as;
(23), can be by according to isopleth and the position relationship on border if the border on " sea " is irregular polygon Isopleth is divided into following two class:
Isopleth beginning and end is identical, i.e., when isopleth is closed, without the point that closure is added for isopleth;
When isopleth beginning and end is on " sea " border, " sea " border can be by the company of isopleth beginning and end Line is divided into a parts and b parts, judges whether a parts medium value line coordinates point total number is more than b parts medium value line coordinates point Total number, if it is, " sea " boundary coordinate in b parts is added in equivalent line coordinates, as the point of closure, otherwise, by b " sea " boundary coordinate is added in equivalent line coordinates in part, is used as the point of closure.
Further, the calculation formula of the step (3) is as follows:
leftn=min { xnm,
rightn=max { xnm,
topn=max { ynm,
bottomn=min { ynm,
Wherein, leftnFor left margin, rightnFor right margin, topnFor coboundary, bottomnFor lower boundary, xnmRepresent The abscissa of m-th of coordinate points of the isopleth after nth bar Seal treatment, ynmRepresent the isopleth after nth bar Seal treatment The ordinate of m-th of coordinate points.
Further, the idiographic flow of the step (4) is:
(41) by N number of " chinampa ", according to 0,1,2 ..., N-1 order is numbered, and obtains " chinampa " between each numbering Initial inclusion relation, define three integer variable i, j, k for being used to count when sorting, wherein, i=0,1,2 ... N-1;J=0, 1,2 ... N-1;K=1,2 ... N-1, and make variable i and j initial value all be 0;
(42) whether judgment variable i value is less than N-1, if so, the value for then making variable j is 0, then performs (43), otherwise End step (4);
(43) whether judgment variable j value is less than N-i-1, if so, the value for then making variable k is 1, then performs (44), no Then first the value of variable i is added 1, then perform (42);
(44) whether judgment variable k value is less than N-i-j, if so, then performing (45), otherwise first adds 1 by variable j value, Then (43) are performed;
(45) inclusion relation on " chinampa " that " chinampa " that numbering is j is j+k with numbering is judged, if numbering is the " floating of j The number order on two " chinampas " is then first interchangeable by island " in " chinampa " that numbering is j+k, and adds 1 by j value, then Perform (43);If j value is first added 1, then performed by " chinampa " that numbering is j+k in " chinampa " that numbering is j (43);If not having inclusion relation between " chinampa " that " chinampa " and numbering that two numberings are j are j+k, first k value is added 1, then perform (44);
Wherein, the judgement of the inclusion relation between " chinampa " that " chinampa " and numbering that numbering is j are j+k, it is as follows:
If (a) leftj≤leftj+k&rightj≥rightj+k&bottomj≤bottomj+k&topj≥topj+k, explanation " chinampa " that numbering is j+k is in " chinampa " that numbering is j;
If (b) leftj≥leftj+k&rightj≤rightj+k&bottomj≥bottomj+k&topj≤topj+k, explanation " chinampa " that numbering is j is in " chinampa " that numbering is j+k;
If (c) leftj、leftj+k、rightj、rightj+k、bottomj、bottomj+k、topj、topj+kBetween relation Any one of (a), (b) two kinds of situations are unsatisfactory for, then between " chinampa " that " chinampa " and numbering that numbering is j are j+k mutually Do not include.
Further, the idiographic flow of the step (5) is:
(51) the maximum v in all " chinampa " height values is calculated firstmaxWith minimum value vmin, formula is as follows:
vmax=max { vn},
vmin=min { vn,
(52) according to the result of calculation of step (51), intermediate variable h is then calculated, formula is as follows:
(53) intermediate variable h is turned into integer, calculates each " floating successively according to the numbering of h span and " chinampa " The color value on island ", and the color value of calculating is added to the color attribute on " chinampa ", the color on " chinampa " uses 24 of standard RGBA color representations, if color value is (r, g, b, 255), r, g, b value are calculated using following formula:
(54) the last height value v that " chinampa " a that numbering is 0 is found from sorted " chinampa "1And any one The height value v of " chinampa " b included in " chinampa " a that numbering is 02;If v1>v2, then color ratio " chinampa " a on " sea " is low One color levels;Conversely, the color on " sea " color levels higher than chinampa a.
Further, the idiographic flow of the step (6) is:
(61) by the actual boundary Coordinate Conversion of object to be filled be display screen on coordinate, i.e., basis " sea " or The actual coordinate spacing of " chinampa " boundary point and the proportionate relationship of screen pixels point coordinates spacing, by the reality of object bounds to be filled Border Coordinate Conversion is screen pixels point coordinates;
(62) it is the object to be filled distribution color, that is, calls the glcolor4i functions in OpenGL, and will Glcolor4i function parameters are set to the color value (r, g, b, 255) of the object to be filled obtained in step (53);
(63) polygonal region is created, that is, calls the glbegin functions in OpenGL, and glbegin function parameters are set GL_POLYGON is set to, the object that representing to draw is the polygon to be filled;
(64) the screen pixels point coordinates obtained in step (61) is added in the polygon of step (63) establishment, as GlVertex2i functions in polygonal apex coordinate, i.e., multiple recursive call OpenGL, will rendered object screen picture Vegetarian refreshments coordinate passes to function, obtains complete polygonal region;
(65) the complete polygon area obtained in the glEnd functions in OpenGL and glFlush function pairs (64) is called Domain is filled, and display refreshes.
In summary, by adopting the above-described technical solution, the beneficial effects of the invention are as follows:
1st, the present invention enters with a kind of optimal scheduling algorithm similar to bubble sort method to the fill order of choropleth Row sequence, while the high efficiency of OpenGL area fillings is make use of, independent of the searching mode of isopleth, required parameter letter Single, amount of calculation is small and algorithm can be realized independently, more facilitates when actual use is with safeguarding;
2nd, the present invention uses the interregional simplification for opening up benefit relation progress height of the concept equity value line on " chinampa ", makes equivalence The automatic filling more flexible and convenient of line, accommodation also more extensively, largely has the complicated equivalences for opening up benefit relation in processing It is more efficient during line, while the isogram containing tomography in the isogram and geological analysis of processing irregular obstacle body When also have the advantages that it is very big.
3rd, in terms of processing significantly isogram, the more conventional point by point scanning completion method of the present invention has very on charging efficiency Big lifting, is taken about 37ms for the Contours Fill in accompanying drawing 3 and (is tested using inteli5-4258UCPU, dominant frequency 2.40GHZ), wherein the time-consuming about 25ms of sequence, draw time-consuming about 12ms, and conventional point by point scanning filling algorithm is in processing accompanying drawing During the isogram of 3 sizes, filling is taken in more than 100ms, and when isogram area becomes big, the sequence consumption in this algorithm When be basically unchanged, simply draw it is time-consuming can be increased slightly, and conventional point by point scanning completion method it is time-consuming will with area increasing Big and proportional increase;
4th, in terms of there is complexity to open up the isopleth of benefit relation for processing, because the algorithm structure of this method is simple, fixed, Relatively simple during specific programming, the size of code needed for realizing this algorithm is smaller, and conventional vector Processing Algorithm needs Consider that isopleth opens up the definition of benefit relation, search that the step such as judgement is implemented complex;Conventional isopleth classification is calculated Method is needed in design according to the actual classification situation for considering isopleth, and algorithm structure is not fixed, and adds the difficulty used.
Brief description of the drawings
Fig. 1 is schematic flow sheet of the invention;
The structural representation that Fig. 2 is ranked up for chinampa in the present invention;
Fig. 3 is the automatic filling effect figure of medium value line of the present invention;Wherein (a) be original isopleth, (b) for filling after etc. It is worth line.
Embodiment
In order to make the purpose , technical scheme and advantage of the present invention be clearer, it is right below in conjunction with drawings and Examples The present invention is further elaborated.It should be appreciated that specific embodiment described herein is only to explain the present invention, not For limiting the present invention.
By observing isogram it can be found that all color contours can be by a kind of background area of color And be covered in the polygonal closed sections of different colours on background area and constitute, and there is small polygonal region and be covered in greatly Situation on polygonal region.For more vivid explanation, background area in isogram is named as on " sea " at this, will Polygonal closed section more than background area is covered in be named as on " chinampa ".
Both have the characteristics that:1. the isogram to be filled of every width is all by one " sea " and multiple " chinampa " groups Into;2. each " sea " and " chinampa " has the boundary coordinate of oneself (it is polygon that the isopleth i.e. after Seal treatment is constituted The vertex point coordinate information of shape) and color (color of the filling region determined according to the height value of isopleth) information;3. it is " extra large It can be covered on face " on multiple " chinampas ", " chinampa " of multiple " small " can be covered on " chinampa " of one " big ".
Concept more than having, it is possible to the boundary information on " chinampa " is obtained according to the characteristics of region, then according to border Inclusion relation using one kind " chinampa " is ranked up according to the precedence relationship to be filled based on " chinampa " bubble sort method.Most Afterwards according to the order arranged, " sea " and each " chinampa " is drawn successively, the isogram after just being filled.Specific stream Journey is as follows:
One kind is based on the automatic Contours Fill method of " chinampa " bubble sort, following steps:
(1) isopleth is obtained, the information of isopleth to be filled and the boundary information of isogram is inputted;Input to be filled etc. The information of value line is:The total number N of isopleth to be filled;The height value v of every isoplethn;The seat that every isopleth is included The total number M of punctuaten;All coordinate points information (x of every isoplethnm, ynm)。
(2) all isopleth are carried out Seal treatment, obtain multiple " chinampas ", produce by the information inputted according to step (1) To multiple polygonal closed sections being covered on background area;This step is the starting point of the isopleth in step (1) (xn0, yn0) and terminalCoordinate information, intersect situation according to isopleth and border, be isopleth addition side All isopleth are carried out Seal treatment by boundary's point.Intersect situation according to isopleth and border, be isopleth addition boundary point Comprise the following steps that:
(21) whether the border for judging " sea " is rectangle;
(22), can be by equivalence according to isopleth and the position relationship on " sea " border if the border on " sea " is rectangle Line is divided into following four classes:
Isopleth beginning and end is identical, i.e., when isopleth is closed, without the point that closure is added for isopleth;
Isopleth beginning and end is on the same side on " sea " border, without the point that closure is added for isopleth;
Isopleth beginning and end on two adjacent sides on " sea " border, is selected in four summits of square boundary respectively Take a point that can close isopleth to be added in equivalent line coordinates, be used as the point of closure;
Isopleth beginning and end is respectively on two opposite side of square boundary, if isopleth is across on " sea " border On the side of two longitudinal directions, two summits on the upside of " sea " border are added in equivalent line coordinates, as the point of closure, if waiting It is worth line on the side in two transverse directions on " sea " border, two summits on the right side of " sea " border are added into isopleth sits In mark, the point of closure is used as;
(23), can be by according to isopleth and the position relationship on border if the border on " sea " is irregular polygon Isopleth is divided into following two class:
Isopleth beginning and end is identical, i.e., when isopleth is closed, without the point that closure is added for isopleth;
When isopleth beginning and end is on " sea " border, " sea " border can be by the company of isopleth beginning and end Line is divided into a parts and b parts, judges whether selection a parts medium value line coordinates point total number sits more than b parts medium value line Punctuate total number, if it is, " sea " boundary coordinate in b parts is added in equivalent line coordinates, it is no as the point of closure Then, " sea " boundary coordinate in b parts is added in equivalent line coordinates, is used as the point of closure.
(3) the upper and lower, left and right four edges circle information on each " chinampa " is calculated respectively;Calculation formula is as follows:
leftn=min { xnm,
rightn=max { xnm,
topn=max { ynm,
bottomn=min { ynm,
Wherein, leftnFor left margin, rightnFor right margin, topnFor coboundary, bottomnFor lower boundary, xnmRepresent The abscissa of m-th of coordinate points of the isopleth after nth bar Seal treatment, ynmRepresent the isopleth after nth bar Seal treatment The ordinate of m-th of coordinate points.
(4) all " chinampas " is ranked up according to the sequencing of drafting;Idiographic flow is:
(41) by N number of chinampa according to 0,1,2 ..., N-1 order is numbered, and obtains " chinampa " between each numbering Initial inclusion relation, defines three integer variable i, j, k for being used to count when sorting, wherein, i=0,1,2 ... N-1;J=0,1, 2…N-1;K=1,2 ... N-1, and make variable i and j initial value all be 0,;
(42):Whether judgment variable i value is less than N-1, if so, the value for then making variable j is 0, then performs (43), otherwise End step (4);
(43):Whether judgment variable j value is less than N-i-1, if so, the value for then making variable k is 1, then performs (44), no Then first the value of variable i is added 1, then perform (42);
(44):Whether judgment variable k value is less than N-i-j, if so, then performing (45), otherwise first adds 1 by variable j value, Then (43) are performed;
(45):The inclusion relation on the chinampa that " chinampa " that numbering is j is j+k with numbering is judged, if numbering is the " floating of j The number order on two " chinampas " is then first interchangeable by island " in " chinampa " that numbering is j+k, and adds 1 by j value, then Perform (43);If j value is first added 1, then performed by " chinampa " that numbering is j+k in " chinampa " that numbering is j (43);If not having inclusion relation between " chinampa " that " chinampa " and numbering that two numberings are j are j+k, first k value is added 1, then perform (44);
Wherein, the judgement of the inclusion relation between " chinampa " that " chinampa " and numbering that numbering is j are j+k, it is as follows:
If (a) leftj≤leftj+k&rightj≥rightj+k&bottomj≤bottomj+k&topj≥topj+k, explanation " chinampa " that numbering is j+k is in " chinampa " that numbering is j;
If (b) leftj≥leftj+k&rightj≤rightj+k&bottomj≥bottomj+k&topj≤topj+k, explanation " chinampa " that numbering is j is in " chinampa " that numbering is j+k;
If (c) leftj、leftj+k、rightj、rightj+k、bottomj、bottomj+k、topj、topj+kBetween relation Any one of (a), (b) two kinds of situations are unsatisfactory for, then between " chinampa " that " chinampa " and numbering that numbering is j are j+k mutually Do not include.
Specific implementation is as follows:N=5, the order of the isopleth of input is arranged according to the order of numbering 0,1,2,3,4, is To the numbering on " chinampa ", wherein " chinampa " that numbering is 1 is contained in " chinampa " that numbering is 2, " chinampa " that numbering is 2 is contained in " chinampa " that numbering is 4, " chinampa " that numbering is 0 is contained in " chinampa " that numbering is 3, and " chinampa " that numbering is 1, numbering are 2 " chinampa ", numbering be 4 " chinampa " with numbering be 0 " chinampa ", number be 3 " chinampa " between there is no inclusion relation, this When the arrangement on " chinampa " be out of order, if be simply sequentially filled according to this, it will cause the isopleth quilt of a part Covering, so needing to be ranked up this.It is specific as follows:
Perform (41) and obtain i=0, j=0, k=1;Perform (42), (0<4) i=0, j=0, k=1, are obtained;Perform (43), (0< 4) i=0, j=0, k=1, are obtained;Perform (44), (1<5) i=0, j=0, k=1, are obtained;Perform (45), " chinampa " that numbering is 0 Do not include mutually between " chinampa " for being 1 with numbering, k=2 is jumped to (44);
Perform (44), (2<5) i=0, j=0, k=2, are obtained;Perform (45), " chinampa " that numbering is 0 is 2 with numbering Do not include mutually between " chinampa ", k=3, jump to (44);
Perform (44), (3<5) i=0, j=0, k=3, are obtained;Perform (45), " chinampa " that numbering is 0 is 3 in numbering In " chinampa ", both orders are exchanged, j=1 is jumped to (43);
Perform (43), (1<4) i=0, j=1, k=1, are obtained;Perform (44), (1<3) i=0, j=1, k=1, are obtained;Perform (45) " chinampa " that, numbering is 1 exchanges both orders in " chinampa " that numbering is 2, and j=2 is jumped to (43);
Perform (43), (2<4) i=0, j=2, k=1, are obtained;Perform (44), (1<3) i=0, j=2, k=1, are obtained;Perform (45) do not include mutually between " chinampa " that " chinampa " and numbering that, numbering is 2 are 3, k=2 is jumped to (44).
Perform (44), (2<3) i=0, j=2, k=2, are obtained;Perform (45), " chinampa " that numbering is 2 is 4 in numbering In " chinampa ", both orders are exchanged, j=3 is jumped to (43);
Perform (43), (3<4) i=0, j=3, k=1, are obtained;Perform (44), (1<2) i=0, j=3, k=1, are obtained;Perform (45) do not include mutually between " chinampa " that " chinampa " and numbering that, numbering is 3 are 4, k=2 is jumped to (44);
Perform (44), (2=2), j=4 is jumped to (43);Perform (43), (4=4), i=1 is jumped to (42);Perform (42), (1<4) i=1, j=0, are obtained;Perform (43), (0<3) i=1, j=0, k=1, are obtained;Perform (44), (1<4) i=1, is obtained, J=0, k=1;Perform (45), do not include mutually between " chinampa " that " chinampa " and numbering that numbering is 0 are 1, k=2 is jumped to (44);
Perform (44), (2<4) i=1, j=0, k=2, are obtained;Perform (45), " chinampa " that numbering is 0 is 2 with numbering Do not include mutually between " chinampa ", k=3, jump to (44);
Perform (44), (3<4) i=1, j=0, k=3, are obtained;Perform (45), " chinampa " that numbering is 3 is 0 in numbering In " chinampa ", j=1 is jumped to (43);
Perform (43), (1<3) i=1, j=1, k=1, are obtained;Perform (44), (1<3) i=1, j=1, k=1, are obtained;Perform (45) " chinampa " that, numbering is 1 exchanges both orders in " chinampa " that numbering is 2, and j=2 is jumped to (43);
Perform (43), (2<3) i=1, j=2, k=1, are obtained;Perform (44), (1<2) i=1, j=2, k=1, are obtained;Perform (45) do not include mutually between " chinampa " that " chinampa " and numbering that, numbering is 1 are 2, k=2 is jumped to (44).
Perform (44), (2=2) obtains j=3, jumped to (43);Perform (43), (3=3) obtains i=2, jumped to (42); Perform (42), (2<4) i=2, j=0, are obtained;Perform (43), (0<2) i=2, j=0, k=1, are obtained;Perform (44), (1<3) i, is obtained =2, j=0, k=1;Perform (45), do not include mutually between " chinampa " that " chinampa " and numbering that numbering is 0 are 1, k=2 is redirected To (44);
Perform (44), (2<3) i=2, j=0, k=2, are obtained;Perform (45), " chinampa " that numbering is 0 is 2 with numbering Do not include mutually between " chinampa ", k=3, jump to (44);
Perform (44), (3=3), j=1 is jumped to (43);Perform (43), (1<2) i=2, j=1, k=1, are obtained;Perform (44), (1<2) i=2, j=1, k=1, are obtained;Perform (45), " chinampa " that numbering is 2 is in " chinampa " that numbering is 1, j=2, Jump to (43);
Perform (43), (2=2), i=3 is jumped to (42);Perform (42), (3<4) j=0, is obtained;Perform (43), (0<1), Obtain i=3, j=0, k=1;Perform (44), (1<2) i=3, j=0, k=1, are obtained;Perform (45), " chinampa " that numbering is 0 is with compiling Number for 1 " chinampa " between do not include mutually, k=2 is jumped to (44);
Perform (44), (2=2) obtains j=1, jumped to (43);Perform (43), (1=1) obtains i=4, jumped to (42); Perform (42), (4=4), end step (4).
By above-mentioned steps, after arranging out of order chinampa, according still further to arrangement number order from small to large to floating Island is filled successively, can obtain complete isogram.
(5) color value to be filled each is distributed for " sea " and all " chinampa ", wherein, " sea " refers to the back of the body Scene area;Idiographic flow is:
(51) the maximum v in all " chinampa " height values is calculated firstmaxWith minimum value vmin, formula is as follows:
vmax=max { vn},
vmin=min { vn,
(52) according to the result of calculation of step (51), intermediate variable h is then calculated, formula is as follows:
(53) intermediate variable h is turned into integer, calculates each " floating successively according to the numbering of h span and " chinampa " The color value on island ", and the color value of calculating is added to the color attribute on " chinampa ", the color on " chinampa " uses 24 of standard RGBA color representations, if color value is (r, g, b, 255), r, g, b value are calculated using following formula:
(54) the last height value v that " chinampa " a that numbering is 0 is found from sorted " chinampa "1And any one The height value v of " chinampa " b included in " chinampa " a that numbering is 02.;If v1>v2, then color ratio " chinampa " a on " sea " is low One color levels;Conversely, the color on " sea " color levels higher than chinampa a.
(6) first " sea " is filled using OpenGL, then to all " chinampa " according to the order arranged according to Secondary filling, the isogram after being filled.Idiographic flow is:
(61) by the actual boundary Coordinate Conversion of object to be filled be display screen on coordinate, i.e., basis " sea " or The actual coordinate spacing of " chinampa " boundary point and the proportionate relationship of screen pixels point coordinates spacing, by the reality of object bounds to be filled Border Coordinate Conversion is screen pixels point coordinates;
(62) it is the object to be filled distribution color, that is, calls the glcolor4i functions in OpenGL, and will Glcolor4i function parameters are set to the color value (r, g, b, 255) of the object to be filled obtained in step (53);
(63) polygonal region is created, that is, calls the glbegin functions in OpenGL, and glbegin function parameters are set GL_POLYGON is set to, the object that representing to draw is the polygon to be filled, the polygonal region now obtained is also endless It is whole, also without apex coordinate;
(64) the screen pixels point coordinates obtained in step (61) is added in the polygon of step (63) establishment, as GlVertex2i functions in polygonal apex coordinate, i.e., multiple recursive call OpenGL, will rendered object screen picture Vegetarian refreshments coordinate passes to function, obtains complete polygonal region;
(65) the complete polygon area obtained in the glEnd functions in OpenGL and glFlush function pairs (64) is called Domain is filled, and display refreshes.
The present invention the open up benefit relation interregional to isopleth is carried out abstract and simplified, by proposing on " chinampa " and " sea " Concept, is then ranked up with a kind of algorithm similar to bubble sort method to the fill order of choropleth, it is possible to achieve Fast automatic fillings are carried out to a large amount of isopleth that there is complexity to open up benefit relation, method is simply efficient, size of code is small and can be with It is independent to realize, independent of the acquisition methods of isopleth, a kind of newly simple and effective is provided for the automatic filling of isopleth Method.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present invention Any modifications, equivalent substitutions and improvements made within refreshing and principle etc., should be included in the scope of the protection.

Claims (8)

1. one kind is based on the automatic Contours Fill method of " chinampa " bubble sort, it is characterised in that following steps:
(1) isopleth is obtained, the information of isopleth to be filled and the boundary information of isogram is inputted;
(2) all isopleth are carried out Seal treatment, obtain multiple " chinampas ", that is, obtain many by the information inputted according to step (1) The individual polygonal closed section being covered on background area;
(3) the upper and lower, left and right four edges circle information on each " chinampa " is calculated respectively;
(4) all " chinampas " is ranked up according to the sequencing of drafting;
(5) color value to be filled each is distributed for " sea " and all " chinampa ", wherein, " sea " refers to background area Domain;
(6) first " sea " is filled using OpenGL, then all " chinampa " filled out successively according to the order arranged Fill, the isogram after being filled.
2. a kind of automatic Contours Fill method for being based on " chinampa " bubble sort according to claim 1, its feature exists In in the step (1), the information for inputting isopleth to be filled is:The total number N of isopleth to be filled;Every isopleth Height value vn;The total number M for the coordinate points that every isopleth is includedn;All coordinate points information (x of every isoplethnm, ynm)。
3. a kind of automatic Contours Fill method for being based on " chinampa " bubble sort according to claim 1, its feature exists In the step (2) is the starting point (x according to isoplethn0,yn0) and terminalCoordinate information, according to equivalence Line intersects situation with " sea " border, is isopleth addition boundary point, Seal treatment is carried out to all isopleth.
4. a kind of automatic Contours Fill method for being based on " chinampa " bubble sort according to claim 3, its feature exists In intersecting situation according to isopleth and " sea " border, be comprising the following steps that for isopleth addition boundary point:
(21) whether the border for judging " sea " is rectangle;
(22), can be by isopleth point according to isopleth and the position relationship on " sea " border if the border on " sea " is rectangle For following four classes:
Isopleth beginning and end is identical, i.e., when isopleth is closed, without the point that closure is added for isopleth;
Isopleth beginning and end is on the same side on " sea " border, without the point that closure is added for isopleth;
On two adjacent sides on " sea " border, one is chosen in four summits of square boundary respectively for isopleth beginning and end The individual point that can close isopleth is added in equivalent line coordinates;
Isopleth beginning and end is respectively on two opposite side of square boundary, if isopleth is across at two of " sea " border On the side of longitudinal direction, two summits on the upside of " sea " border are added in equivalent line coordinates, as the point of closure, if isopleth On the side in two transverse directions on " sea " border, two summits on the right side of " sea " border are added to equivalent line coordinates In, it is used as the point of closure;
(23), can be by equivalence according to isopleth and the position relationship on border if the border on " sea " is irregular polygon Line is divided into following two class:
Isopleth beginning and end is identical, i.e., when isopleth is closed, without the point that closure is added for isopleth;
When isopleth beginning and end is on " sea " border, " sea " border can be by the line of isopleth beginning and end point A parts and b parts are cut into, judges whether a parts medium value line coordinates point total number is always individual more than b parts medium value line coordinates point Number, if it is, " sea " boundary coordinate in b parts is added in equivalent line coordinates, as the point of closure, otherwise, by b parts In " sea " boundary coordinate be added in equivalent line coordinates, be used as the point of closure.
5. a kind of automatic Contours Fill method for being based on " chinampa " bubble sort according to claim 1, its feature exists In the calculation formula of the step (3) is as follows:
leftn=min { xnm,
rightn=max { xnm,
topn=max { ynm,
bottomn=min { ynm,
Wherein, leftnFor left margin, rightnFor right margin, topnFor coboundary, bottomnFor lower boundary, xnmRepresent nth bar The abscissa of m-th of coordinate points of the isopleth after Seal treatment, ymnRepresent m-th of the isopleth after nth bar Seal treatment The ordinate of coordinate points.
6. a kind of automatic Contours Fill method for being based on " chinampa " bubble sort according to claim 1, its feature exists In the idiographic flow of the step (4) is:
(41) by N number of " chinampa ", according to 0,1,2 ..., N-1 order is numbered, and obtain " chinampa " between each numbering just Beginning inclusion relation, defines three integer variable i, j, k for being used to count when sorting, wherein, i=0,1,2 ... N-1;J=0,1, 2…N-1;K=1,2 ... N-1, and make variable i and j initial value all be 0;
(42) whether judgment variable i value is less than N-1, if so, the value for then making variable j is 0, then performs (43), otherwise terminates Step (4);
(43) whether judgment variable j value is less than N-i-1, if so, the value for then making variable k is 1, then performs (44), otherwise first The value of variable i is added 1, then (42) are performed;
(44) whether judgment variable k value is less than N-i-j, if so, then performing (45), otherwise first adds 1 by variable j value, then Perform (43);
(45) inclusion relation on " chinampa " that " chinampa " that numbering is j is j+k with numbering is judged, if " chinampa " that numbering is j In " chinampa " that numbering is j+k, then first the number order on two " chinampas " is interchangeable, and j value is added 1, then held Row (43);If j value is first added 1 by " chinampa " that numbering is j+k in " chinampa " that numbering is j, then (43) are performed; If there is no inclusion relation between " chinampa " that " chinampa " and numbering that two numberings are j are j+k, first k value is added 1, so Perform (44) afterwards;
Wherein, the judgement of the inclusion relation between " chinampa " that " chinampa " and numbering that numbering is j are j+k, it is as follows:
If (a) leftj≤leftj+k&rightj≥rightj+k&bottomj≤bottomj+k&topj≥topj+k, illustrate that numbering is J+k " chinampa " is in " chinampa " that numbering is j;
If (b) leftj≥leftj+k&rightj≤rightj+k&bottomj≥bottomj+k&topj≤topj+k, illustrate that numbering is J " chinampa " is in " chinampa " that numbering is j+k;
If (c) leftj、leftj+k、rightj、rightj+k、bottomj、bottomj+k、topj、topj+kBetween relation be discontented with Do not wrapped mutually between any one of foot (a), (b) two kinds of situations, then " chinampa " that " chinampa " and numbering that numbering is j are j+k Contain.
7. a kind of automatic Contours Fill method for being based on " chinampa " bubble sort according to claim 1, its feature exists In the idiographic flow of the step (5) is:
(51) the maximum v in all " chinampa " height values is calculated firstmaxWith minimum value vmin, formula is as follows:
vmax=max { vn},
vmin=min { vn,
(52) according to the result of calculation of step (51), intermediate variable h is then calculated, formula is as follows:
(53) intermediate variable h is turned into integer, calculated successively on each " chinampa " according to the numbering of h span and " chinampa " Color value, and the color value of calculating is added to the color attribute on " chinampa ", the color on " chinampa " uses 24 RGBA of standard Color representation, if color value is (r, g, b, 255), r, g, b value are calculated using following formula:
(54) the last height value v that " chinampa " a that numbering is 0 is found from sorted " chinampa "1And any one is included in The height value v of " chinampa " b in " chinampa " a that numbering is 02;If v1>v2, then the low color of color ratio " chinampa " a on " sea " Color grade;Conversely, the color on " sea " color levels higher than chinampa a.
8. a kind of automatic Contours Fill method for being based on " chinampa " bubble sort according to claim 7, its feature exists In the idiographic flow of the step (6) is:
(61) it is the coordinate on display screen by the actual boundary Coordinate Conversion of object to be filled, i.e., according to " sea " or " chinampa " The actual coordinate spacing of boundary point and the proportionate relationship of screen pixels point coordinates spacing, by the actual coordinate of object bounds to be filled Be converted to screen pixels point coordinates;
(62) it is the object to be filled distribution color, that is, calls the glcolor4i functions in OpenGL, and by glcolor4i letters Number parameter is set to the color value (r, g, b, 255) of the object to be filled obtained in step (53);
(63) polygonal region is created, that is, calls the glbegin functions in OpenGL, and glbegin function parameters are set to GL_POLYGON, the object that representing to draw is the polygon to be filled;
(64) the screen pixels point coordinates obtained in step (61) is added in the polygon of step (63) establishment, as polygon GlVertex2i functions in the apex coordinate of shape, i.e., multiple recursive call OpenGL, will rendered object screen pixels point Coordinate passes to function, obtains complete polygonal region;
(65) the complete polygonal region obtained in the glEnd functions in OpenGL and glFlush function pairs (64) is called to enter Row filling, and display refresh.
CN201710233428.4A 2017-04-11 2017-04-11 One kind being based on the automatic Contours Fill method of " chinampa " bubble sort Active CN107016712B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710233428.4A CN107016712B (en) 2017-04-11 2017-04-11 One kind being based on the automatic Contours Fill method of " chinampa " bubble sort

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710233428.4A CN107016712B (en) 2017-04-11 2017-04-11 One kind being based on the automatic Contours Fill method of " chinampa " bubble sort

Publications (2)

Publication Number Publication Date
CN107016712A true CN107016712A (en) 2017-08-04
CN107016712B CN107016712B (en) 2019-06-11

Family

ID=59445288

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710233428.4A Active CN107016712B (en) 2017-04-11 2017-04-11 One kind being based on the automatic Contours Fill method of " chinampa " bubble sort

Country Status (1)

Country Link
CN (1) CN107016712B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102314711A (en) * 2010-07-01 2012-01-11 中国地质科学院矿产资源研究所 Three-dimensional visualization method and device for mineral resource evaluation information
CN104375211A (en) * 2014-07-08 2015-02-25 宁波绮耘软件有限公司 Weather forecast contour map updating method and system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102314711A (en) * 2010-07-01 2012-01-11 中国地质科学院矿产资源研究所 Three-dimensional visualization method and device for mineral resource evaluation information
CN104375211A (en) * 2014-07-08 2015-02-25 宁波绮耘软件有限公司 Weather forecast contour map updating method and system

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
赵敬和: "基于矩形网格法的不规则区域的等值线生成与填充算法的研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *
韩丽娜: "地质等值线图的生成与绘制", 《中国优秀博硕士学位论文全文数据库 (硕士)》 *
黄鸿飞: "几种经典的排序算法综述", 《电脑编程技巧与维护》 *

Also Published As

Publication number Publication date
CN107016712B (en) 2019-06-11

Similar Documents

Publication Publication Date Title
CN106446899A (en) Text detection method and device and text detection training method and device
CN104268145B (en) A kind of map fast drawing method of complexity vector data
CN109603155A (en) Merge acquisition methods, device, storage medium, processor and the terminal of textures
CN101872244B (en) Method for human-computer interaction based on hand movement and color information of user
CN109920012A (en) Image colorant system and method based on convolutional neural networks
CN110334719A (en) The method and system of object image are built in a kind of extraction remote sensing image
JP2008035475A (en) Document editing support device, program, and storage medium
CN107977605A (en) Ocular Boundary characteristic extraction method and device based on deep learning
AU2020102712A4 (en) Method for making texture symbol of land use classification map
CN103793549B (en) Adopt the computer-aided crewel embroidery production method of fuzzy clustering and random walk
CN109635812A (en) The example dividing method and device of image
CN106873986A (en) Form system and implementation method in a kind of WPF
CN105118076A (en) Image colorization method based on over-segmentation and local and global consistency
CN109903339A (en) A kind of video group personage&#39;s position finding and detection method based on multidimensional fusion feature
CN109344744A (en) The micro- facial expressions and acts unit detecting method of face based on depth convolutional neural networks
CN109740529A (en) A kind of virtual fit method drawn based on neural network
Katsap et al. Ethnomathematics of Negev Bedouins’ existence in forms, symbols and geometric patterns
Greene Shipwrecks as indices of Archaic Mediterranean trade networks
CN105808682A (en) Relational graph display method and apparatus
CN107016712A (en) One kind is based on the automatic Contours Fill method of &#34; chinampa &#34; bubble sort
CN110136262A (en) Water body virtual visualization method and apparatus
CN109829484A (en) A kind of dress ornament classification method, equipment and computer readable storage medium
Fogarty et al. Serious game modeling of caribou behavior across Lake Huron using cultural algorithms and influence maps
JP2004280597A (en) Layout evaluation system and layout evaluation program, and layout evaluation method
CN107146268A (en) The fill method of vector graphics and the filling device of vector graphics

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