CN111145297B - Vector map line symbol diamond arrow drawing method considering line width consistency - Google Patents

Vector map line symbol diamond arrow drawing method considering line width consistency Download PDF

Info

Publication number
CN111145297B
CN111145297B CN201911363772.0A CN201911363772A CN111145297B CN 111145297 B CN111145297 B CN 111145297B CN 201911363772 A CN201911363772 A CN 201911363772A CN 111145297 B CN111145297 B CN 111145297B
Authority
CN
China
Prior art keywords
value
line
line width
vector
point
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911363772.0A
Other languages
Chinese (zh)
Other versions
CN111145297A (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.)
Nanjing Normal University
Original Assignee
Nanjing Normal University
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 Nanjing Normal University filed Critical Nanjing Normal University
Priority to CN201911363772.0A priority Critical patent/CN111145297B/en
Publication of CN111145297A publication Critical patent/CN111145297A/en
Application granted granted Critical
Publication of CN111145297B publication Critical patent/CN111145297B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/206Drawing of charts or graphs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/20Processor architectures; Processor configuration, e.g. pipelining
    • 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
    • GPHYSICS
    • G09EDUCATION; CRYPTOGRAPHY; DISPLAY; ADVERTISING; SEALS
    • G09BEDUCATIONAL OR DEMONSTRATION APPLIANCES; APPLIANCES FOR TEACHING, OR COMMUNICATING WITH, THE BLIND, DEAF OR MUTE; MODELS; PLANETARIA; GLOBES; MAPS; DIAGRAMS
    • G09B29/00Maps; Plans; Charts; Diagrams, e.g. route diagram
    • G09B29/003Maps
    • G09B29/004Map manufacture or repair; Tear or ink or water resistant maps; Long-life maps
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Business, Economics & Management (AREA)
  • Educational Administration (AREA)
  • Educational Technology (AREA)
  • Image Generation (AREA)

Abstract

The invention relates to a vector map line symbol diamond-shaped arrow drawing method considering line width consistency, which comprises the following steps: initializing vector line elements, designating a screen coordinate system line width, designating whether diamond arrows are drawn at a starting point and an ending point, then converting the screen line width into a line width of a world coordinate system according to a coordinate conversion rule, performing triangularization operation on the vector line elements, and performing expansion operation at the starting point and the ending point. Then, a GPU state protocol is constructed to take line width consistency into account, protocol content is assembled in the CPU and transferred to the GPU. Finally, a state protocol is acquired from the GPU, and diamond arrow corrosion operation is carried out at the starting point and the end point, so that drawing keeping consistent line width is realized. According to the invention, by constructing the state protocol for drawing the diamond arrow line symbols and utilizing the structured state protocol, the diamond arrow drawing at the start point and the end point of the line element is completed without changing the line width and re-triangulating in the map scaling process.

Description

Vector map line symbol diamond arrow drawing method considering line width consistency
Technical Field
The invention relates to a vector map line symbol diamond-shaped arrow drawing method in the digital map drawing field and the geographic information system field, in particular to a vector map line symbol diamond-shaped arrow drawing method considering line width consistency.
Background
Digital map drawing is to present various spatial information in the real world in a map mode, and point, line and surface elements are three expression structures which are the most basic in the map, so that a point, line and surface symbolization method is dominant. Through various different point symbols, line symbols and surface symbols, the information such as the distribution status, the association relation, the interaction and the like of the space entities can be visualized and transmitted to a graph reader. In order to support the reader to quickly understand the map and accurately acquire the space information, the drawing of the map symbol is the most critical factor. In the real geographic world, there are widely existing "directional" spatial information such as the direction of wind blowing, the direction of a river, the direction of travel of a road, and the like. To be able to convey such directional information to the reader, a line symbol with diamond-shaped arrows is a common method.
In order to be able to draw line symbols with diamond arrows, there are currently mainly two methods: one is a software-based rendering method, and one is a GPU hardware-based method. The former is widely applied to various existing two-dimensional map platforms, pixel coloring is mainly operated by a pure software mode, and a typical method is GDI+, cairo, AGG and the like. For example, paper research on GIS-oriented vector linear symbol filling algorithms (Zhang Haiquan, pan, wu Huanping, etc.) discloses a pure software drawing method based on GDI+ to express vector line elements. The method strictly depends on the screen coordinates and the screen width of the vector line, and when the map is scaled, the recalculation and the drawing are required to be continuously carried out, so that the efficiency of map display is seriously reduced. For this inefficiency, the subsequent research is mostly focused on how to implement vector line symbol drawing by using a hardware acceleration method, i.e. a GPU hardware-based method.
The GPU hardware rendering-based approach is mainly to study how line symbols are rendered by a GPU Shader (loader). Representative methods are described in paper A function-based linear map symbol building and rendering method using Shader language (Yue SS, yang JS, chen M, et al International Journal of Geographical Information Science, 2016,30 (2): 143-16) which propose the use of OpenGL Shader to construct line symbols and draw them with a GPU. The method relies on a color two-dimensional array to express a symbol structure, and although a dotted line symbol can be expressed and drawn through array marks, the whole method only aims at drawing a fixed map scale, and the problem of line width consistency is not involved at all; the paper approach is also only for line symbols without arrows, and there is no reference to how to treat line symbols with diamond arrows.
Paper (Liu Junyan, chen Yaqian, high and far, etc.) states that vector line elements are mapped into texture data, and lines are drawn by the texture data; the method is mainly aimed at the fusion of the line elements and the topography, and the line width processing of the line elements is obviously changed along with the scaling of the map. In addition, chinese patent entitled "GPU-based map line-shaped symbol drawing method and system" (application No. 201310125110.6), chinese patent entitled "GPU-based width gradient line-shaped map symbol drawing method" (application No. 201610015703.0), entitled "GPU-based color gradient line-shaped map symbol drawing method" (application No. 2016016561. X), propose a method of drawing line symbols with a loader Shader on the basis of analyzing the difficulty of drawing vector line elements by the GPU. However, these methods are directed to line symbol drawing at a fixed scale, and when the map scale is changed, the aforementioned methods all require re-triangularization and drawing in order to keep the line width unchanged. Repeated and continuous triangularization has a significant impact on the rendering efficiency, thereby creating a map scaling interaction that still presents an efficiency bottleneck. And because of the specificity of diamond arrows, no explicit solution has been proposed by the existing GPU hardware rendering methods.
In the whole, the existing method is mainly oriented to static linewidth drawing, and when the map scale is scaled, recalculation and drawing are needed; in addition, line element drawing with diamond arrows based on GPU hardware acceleration is not disclosed. The invention provides a vector map line element diamond-shaped arrow drawing method considering line width consistency, which can be realized by the following steps: (1) line widths remain consistent as map scales scale, (2) vector line elements do not need to be re-triangulated, and (3) diamond-shaped arrows can be drawn with line elements. Because the drawing of the GPU relies on triangle patches, after a vector line is triangulated into a triangle sequence, the GPU can only take coordinates and colors and the entire drawing is stateless (i.e., it is not possible to distinguish where it is a starting point, where it is an ending point, where it is an arrow, etc.). In order to draw diamond arrows in the GPU, the core of the method is to construct a unique GPU state protocol, so that the CPU-GPU is driven to work cooperatively, and the diamond arrow drawing which keeps consistent with the line width of the map zoom is realized.
Disclosure of Invention
The invention aims at solving the problem that the traditional method is free from line width consistency or repeated triangularization in the GPU drawing environment, and provides a vector map line symbol diamond-shaped arrow drawing method which can realize line width consistency-considered diamond-shaped arrow drawing at the starting point and the end point of line elements without changing line width and re-triangularization in the map scaling process.
The technical scheme is as follows: a vector map line symbol diamond-shaped arrow drawing method considering line width consistency comprises the following steps:
step 1, initializing a coordinate sequence of vector line elements, setting a screen line width taking pixels as a unit, and setting whether diamond arrows are drawn at a starting point and an ending point;
step 2, constructing a conversion rule between a world coordinate system of vector line elements and a screen coordinate system, converting the line width of the screen into the line width of the world coordinate system according to the rule, and according to the line width of the world coordinate system: sequentially traversing each coordinate of the vector line elements, generating a triangle set from the lines, wherein each vertex of each triangle has a U value running along the line and a V value running along the vertical line, and each vertex also has a scaling direction vector D value; respectively performing expansion operation and protocol marking on the starting point and the ending point of the vector line element;
step 3, assembling a state protocol of the GPU shader: the state protocol comprises two layers, wherein one layer is a U value, a V value and a scaling direction D value of a vertex layer, and the other layer is a maximum line width M value, a map scaling S value, a starting point mark CB and an end point mark CE of a structural layer;
and 4, acquiring an initial world coordinate system line width and map scale scaling factor in a CPU, and transmitting the initial world coordinate system line width and map scale scaling factor to the GPU according to an M value, an S value, a CB value and a CE value in a state protocol respectively, so that a U, V, D, M, S, CB, CE value in the state protocol is analyzed in a GPU shader, the pixel position of the current diamond arrow needing to be drawn is calculated dynamically, and finally drawing is completed.
Further, in the step 2:
u value along line: the U value is calculated according to the distance of each vertex along the line element, wherein the U values of the two vertexes expanded from the starting point are 0, the U values of the two vertexes expanded from the end point are the length of the whole line divided by the line width, and the U values of the two vertexes expanded from other points are obtained according to the length accumulated value divided by the line width;
v value of vertical line trend: the V value is calculated according to the expanding distance of each vertex to two sides, and each point on the line element is provided with V, wherein the V of the two expanded vertexes positioned on the left side of the line is 1, and the V of the two expanded vertexes positioned on the right side is 0;
d value of vertex scaling direction: the D value is a two-dimensional vector indicating the connection direction between each of the expanded vertices and the original point and is not a normalized vector, and the length of the D value two-dimensional vector is calculated based on the distance between the expanded vertices and the original point;
further, in the step 2:
starting point expansion operation of vector line elements: the starting point of the vector line element expands a line width against the line trend, and then expands a line width to two sides respectively perpendicular to the line trend, thereby forming two points; the starting point of the vector line element expands one line width along the line trend, and then expands one line width to two sides respectively perpendicular to the line trend, so that two points are formed; the four points form a square with two line widths as side lengths, namely an expanded square at the starting point;
end point expansion operation of vector line element: the end point of the vector line element expands one line width against the line trend, and then expands one line width to two sides respectively perpendicular to the line trend, thereby forming two points; the end points of the vector line elements expand a line width along the line direction, and then expand a line width to two sides respectively perpendicular to the line direction, so that two points are formed; the four points form a square with two line widths as side lengths, namely an expanded square at the end point;
further, in the step 2:
the start point of the vector line element is marked: two points of the starting point expansion square which expand out against the linear direction have U values of-2.0; two points of the starting point expansion square which expand along the linear direction have U values of-1.0; two points V on the right side of the line in the starting point expansion square are 0, and two points V on the left side are 1;
end point marking of vector line elements: two points of the end point expansion square which expand out against the linear direction have U values of-10.0; two points in the end point expansion square, which expand along the linear direction, have U values of 11.0 below zero; two points V on the right side of the line in the end point expansion square have values of 0, and two points V on the left side have values of 1;
distinguishing between start and end points: the U value of the line element, which is neither the starting point nor the ending point, is greater than or equal to 0, the U values of the expansion squares of the starting point and the ending point are smaller than 0, wherein the U value at the starting point is greater than or equal to-2.0, and the U value at the ending point is smaller than-2.0;
further, the maximum line width M value in the step 3 is the line width of the world coordinate system obtained by calculation in the step 2; the map scaling S value is a dynamically updated scaling value as the map scale scales; the start point mark CB value and the end point mark CE value are floating point values corresponding to whether to draw a diamond arrow, wherein, if the floating point values are smaller than 0, the diamond arrow is not drawn, and if the floating point values are larger than or equal to 0, the diamond arrow is drawn; the state protocol is organized according to U value, V value, D value, M value, S value, CB value and CE value, wherein U value and V value are one-dimensional floating point number, D value is two-dimensional floating point number, M value and S value are one-dimensional floating point number, CB value and CE value are one-dimensional floating point number, U value, V value and D value are organized into four-dimensional vector in sequence, M value, S value, CB value and CE value are organized into four-dimensional vector in sequence, and finally the formed state protocol is composed of two vectors: the U-V-D four-dimensional vector and the M-S-CB-CE four-dimensional vector, the vector map line symbol diamond arrow drawing taking line width consistency into account must strictly follow this protocol, and message assembly must also be performed strictly in accordance with this protocol when message passing between the CPU and GPU.
Further, in the step 4, diamond arrow etching operations are performed on the starting point and the ending point:
A. at the starting point, the U values of four points of the expansion square are uniformly added with 1.0 to form a section from 0.0 to-1.0; at the end point, the U values of four points of the expansion square are uniformly added with 10.0 to form a zone from 0.0 to-1.0;
B. dividing the expansion square of the starting point/the ending point into four parts according to the U value and the V value; if the V value is less than or equal to 0.5 and the U value is greater than-0.5, the left upper part is positioned; in the lower left part if the V value is equal to or less than 0.5 and the U value is equal to or less than-0.5; in the upper right part if the V value is greater than 0.5 and the U value is greater than-0.5; in the lower right part if the V value is greater than 0.5 and the U value is equal to or less than-0.5;
B1. for the upper left and lower right portions, according to a slope of 0.5, if the V value is less than the U value multiplied by the slope, then the corrosion occurs;
B2. for the lower left and upper right portions, according to a slope of-0.5, if the V value is less than the U value multiplied by the slope, then corrosion occurs;
from the remaining area, a diamond-shaped arrow is drawn.
Compared with the prior art, the invention has the following remarkable advantages: the invention can fully utilize the drawing performance of GPU hardware acceleration, break through GPU and rely on the stateless drawing limitation of the coordinate and color only, through customizing the reasonable state agreement, transfer the trend information, line width information, start point and end point information, map scaling information, diamond arrow information of the vector line between CPU and GPU. Through the combination of two four-dimensional vectors, the state protocol can be effectively assembled; according to the structure of the U-V-D-M-S-CB-CE, the acquisition of state contents can be conveniently realized, so that diamond-shaped arrow drawing keeping consistent line width is performed in a shader of the GPU. Compared with the traditional method, the method can customize a clear state protocol on the basis of not repeating triangularization, and realize diamond-shaped arrow drawing with consistent line width along with scaling of map scale, so that drawing efficiency and effect of a map are improved.
Drawings
FIG. 1 is a schematic flow chart of the method of the present invention;
FIG. 2 is a basic structure of a state protocol;
FIG. 3 is an illustration of U, V, and D values, and a state protocol based vector line element triangularization method illustration;
FIG. 4 is an illustration of the expansion method at the start and end of a line element;
FIG. 5 is an illustration of an etching process at the endpoint that illustrates how diamond arrows are performed at the GPU;
FIG. 6 is an illustration of M and S values, and a method illustration of line width processing after map scaling, wherein the dark filled portion is the true drawn line width and the outer dashed portion is the drawn region before original no processing (i.e., the result of initial triangularization);
FIG. 7 is a schematic representation of the results of a method according to the present invention, (a) is a small scale bi-directional diamond arrow, (b) is a large scale bi-directional diamond arrow tip, (c) is a small scale end point diamond arrow, (d) is a large scale end point diamond arrow tip, (e) is a small scale start point diamond arrow, and (f) is a large scale start point diamond arrow tip.
Detailed Description
Further description is provided below with reference to the drawings and examples.
FIG. 1 is a flow chart of the method of the present invention. The method comprises the following steps: firstly, initializing vector line elements to be drawn, designating line widths (pixel units) to be displayed on a screen, designating whether diamond arrows are drawn at a starting point and an ending point, and determining conversion rules between a world coordinate system of the vector line elements and a screen coordinate system. Then, the screen line width is converted into the line width of the world coordinate system according to the coordinate conversion rule, and the vector line elements are triangulated under the world coordinate system, and simultaneously the expansion operation is performed at the start point and the end point. And then, according to the constructed GPU state protocol considering the line width consistency, obtaining information such as a map scaling factor, an initial line width size, a starting point and end point diamond arrow mark and the like from a CPU, and transmitting the information to the GPU by using the state protocol. Finally, the state protocol content is obtained from the GPU, and diamond arrow corrosion operation is carried out at the starting point and the end point, so that diamond arrow drawing keeping consistent line width is realized.
In the GPU rendering environment, triangularization is a key to line symbolizing the vector line elements. The GPU shader obtains a sequence of triangles, which render the object to be drawn on the screen by coordinates and color of the triangle. Essentially, the GPU's rendering pipeline is a stateless process, and the line width related information of the vector lines cannot be directly transferred from the CPU to the GPU. For a line symbol with diamond-shaped arrows, it is necessary to draw along the line trend, according to a determined line width. Based on the requirement, the invention designs a state protocol for line symbol consistent drawing with diamond arrows. The CPU needs to organize information according to the state protocol, and the GPU needs to analyze information according to the state protocol.
The state protocol comprises two layers, one is the U value, the V value and the D value of the vertex layer, and the other is the M value, the S value, the CB value and the CE value of the structure layer, as shown in FIG. 2; connotation and calculation methods of the U value, the V value, the D value, the M value, the S value, the CB value and the CE value are described in the following paragraphs. The U and V values are two floating point values, respectively, and the D value is a two-dimensional vector having components D (X) and D (Y) in the X and Y directions. The M value, S value, CB value and CE value are four floating point type values. The three values of U-V-D are assembled into a four-dimensional vector and the four values of M, S, CB, CE are assembled into a four-dimensional vector. Thus, the transfer of information between the CPU and the GPU depends on the combination of these two four-dimensional vectors, facing the line width consistency plot of diamond arrows. The U-V-D is assembled into a four-dimensional vector, and the M-S-CB-CE is assembled into a three-dimensional vector, so that the number of information interaction times is reduced as much as possible in the CPU-GPU information transmission process, and the information interaction times are transmitted in batches.
For the U-V-D values, the relevant calculation method is given in FIG. 3. The U-V-D value is appended to each extended vertex. The extended vertex is a vertex obtained by expanding the vector line element to two sides according to any point on the vector line element and the direction of the vertical and line trend; wherein the expansion distance is half of the line width (line width of world coordinate system). The expansion vertex can be divided into a left side point and a right side point (determined from the along-line trend). As shown in fig. 3, the V values of all right vertices are 0 and the V values of all left vertices are 1. The U value of any dilated vertex is obtained by calculating the distance between the point with which it is associated and the starting point. The U values of both expansion vertices of the starting point are 0 and the U values of both expansion vertices of the ending point are the length of the entire vector line divided by the line width. Any point between the start point and the end point is obtained by dividing the cumulative distance by the line width. The D value is a two-dimensional vector indicating the direction of the dilated vertex, which is obtained from the dilated vertex and the associated point. It should be noted that the D vector cannot be normalized, and its vector length is the length between the dilated vertex and the associated point.
In particular, for the U-V-D values of the two end points of the vector line element, expansion processing is required at both the start point and the end point, as shown in FIG. 4. In the left half of fig. 4, i.e. at the starting point position: firstly, expanding a line width against the line trend, and then expanding a line width to two sides respectively perpendicular to the line trend to form two corresponding expansion points (a left side point 1 and a right side point 1); then, a line width is expanded along the line direction, and then a line width is expanded to two sides respectively perpendicular to the line direction, so that two corresponding expansion points (a left side point 2 and a right side point 2) are formed. The expanded square at the starting point is constituted by four points, left point 1, right point 1, left point 2 and right point 2. Dividing by the diagonal of the square to form two triangles, and transmitting the two triangles to the GPU. Similarly, the expansion method at the end point is also given in fig. 4, the expanded squares of the start and end points being symmetrical:
(1) The left side point 1 and the right side point 1 of the expansion square at the starting point have U values of-2.0; the left and right points 2 and 2 of the expanded square at the starting point have U values of-1.0. The V values of the left side point 1 and the left side point 2 are 1, and the V values of the right side point 1 and the right side point 2 are 0. The D values of the four points are each a connection vector to the starting point.
(2) The U values of the left side point 1 and the right side point 1 of the expansion square at the end point are 11.0 below zero; the left and right points 2 and 2 of the expanded square at the end point have U values of-12.0. The V values of the left side point 1 and the left side point 2 are 1, and the V values of the right side point 1 and the right side point 2 are 0. The D values of the four points are each a connection vector to the starting point.
The positions of the start point and the end point can be judged through the U-V-D values in the GPU state protocol. U value which is neither the start nor the end is 0 or more; the U value of the starting point is less than or equal to-1.0 and more than or equal to-2.0; the U value of the end point is less than or equal to-10.0 and greater than or equal to-11.0.
On the basis of being able to determine where to start and where to end, FIG. 5 shows the diamond arrow erosion method at the end based on the GPU state protocol. First, the four points U of the expanded square are uniformly added with 10.0, thereby forming a zone of 0.0 to-1.0. And dividing the expansion square into four parts of upper left, upper right, lower left and lower right according to the U value and the V value. In the lower right part if the V value is equal to or less than 0.5 and the U value is greater than-0.5; in the lower left part if the V value is equal to or less than 0.5 and the U value is equal to or less than-0.5; in the upper right part if the V value is greater than 0.5 and the U value is greater than-0.5; if the V value is greater than 0.5 and the U value is equal to or less than-0.5, it is in the upper left portion.
For the lower right portion, according to a slope of 0.5, if the V value is less than the U value multiplied by the slope then erodes (i.e., region 3 in fig. 5); for the lower left portion, according to a slope of-0.5, if the V value is less than the U value multiplied by the slope then erodes (i.e., region 4 in FIG. 5); for the upper right portion, according to a slope of-0.5, if the V value is less than the U value multiplied by the slope then erodes (i.e., region 2 in FIG. 5); for the upper left portion, according to a 0.5 slope, if the V value is less than the U value multiplied by the slope then erodes (i.e., region 1 in fig. 5); the final remaining areas 5, 6, 7 and 8 are the areas where the diamonds are drawn. The process at the end point is shown in fig. 5, and is similar to the process at the beginning point, except that the U value needs to be uniformly added with 1.0, thereby also forming a 0.0 to-1.0 interval.
For the M-S-CB-CE values, the M value is the value of the maximum line width displayed at the initial map scale, the S value is the scaling factor relative to the initial map scale, and the CB and CE values refer to whether the start and end points draw diamond arrows. If the CB value is less than 0, the diamond-shaped arrow is not drawn at the starting point, and if the CB value is greater than or equal to 0, the diamond-shaped arrow is drawn at the starting point. Likewise, if the CE value is less than 0, no diamond arrow is drawn at the end point, and if the CE value is equal to or greater than 0, a diamond arrow is drawn at the end point.
As shown in fig. 6, M-S-CB-CE values within the state protocol are resolved in the GPU, and the coordinates of any dilated vertex are recalculated using the following formula: x=d (X) M (1.0-S)/2.0, y=d (y) M (1.0-S)/2.0. D (X) and D (Y) represent the X and Y components of the vertex direction vector, respectively. And combining the D value, the M value and the S value in the GPU, and dynamically calculating the position actually needed to be drawn of each point. The outer dotted line portion in fig. 6 is an area to be drawn at the initial scale, and the middle dark filled portion is an area to be drawn after scaling. It can be seen that the initial area is large and the large scale area is small; because the expansion vertex of the vector line element is directly converted into the screen coordinates under the large scale and then is larger than the initial scale, the inward contraction of the expansion vertex is controlled by the D vector and the M-S value, so that the drawing effect of consistent line width is achieved.
In fig. 7, two different map scales are shown, the effect of drawing different diamond-shaped arrows. (a) is a small scale bi-directional diamond arrow, (b) is a large scale bi-directional diamond arrow tip, (c) is a small scale end point diamond arrow, (d) is a large scale end point diamond arrow tip, (e) is a small scale start point diamond arrow, and (f) is a large scale start point diamond arrow tip; wherein, the figures (a), (c) and (e) are drawn with small scale, and the figures (b), (d) and (f) are drawn with large scale; (a) and (b) are the drawing effects of the bi-directional diamond arrows, (c) and (d) are the drawing effects of the end point diamond arrows, and (e) and (f) are the drawing effects of the start point diamond arrows. The cross contrast can show that the drawing effect of the small scale and the large scale is consistent in line width.
Examples:
diamond-shaped arrow symbols in mapping need to take into account changes in map scale compared to line mapping in the traditional computer visualization field. In the GPU drawing environment, the drawing process is controlled only by the coordinates and the colors of the triangle set, and the requirement of keeping the line width consistency cannot be met. Therefore, the invention designs a GPU state protocol, the information related to the line width is packed and transmitted to the GPU through the protocol, and the information can be analyzed in order in the GPU; meanwhile, unique expansion and corrosion modes are customized at the starting point and the end point, so that vector map line symbol diamond-shaped arrow drawing considering line width consistency is achieved.
The following is an example of the present invention given by using OpenGL loader:
(1) GPU state protocol structure
Figure BDA0002337864480000081
/>
Figure BDA0002337864480000091
(2) CPU status protocol structure
Figure BDA0002337864480000092
/>
Figure BDA0002337864480000101
/>

Claims (4)

1. A vector map line symbol diamond-shaped arrow drawing method considering line width consistency is characterized by comprising the following steps:
step 1, initializing a coordinate sequence of vector line elements, setting a screen line width taking pixels as a unit, and setting whether diamond arrows are drawn at a starting point and an ending point;
step 2, constructing a conversion rule between a world coordinate system of vector line elements and a screen coordinate system, converting the line width of the screen into the line width of the world coordinate system according to the rule, and according to the line width of the world coordinate system: sequentially traversing each coordinate of the vector line elements, generating a triangle set from the lines, wherein each vertex of each triangle has a U value running along the line and a V value running along the vertical line, and each vertex also has a scaling direction D value; respectively performing expansion operation and protocol marking on the starting point and the ending point of the vector line element;
starting point expansion operation of the vector line element: the starting point of the vector line element expands one line width against the line trend, and then expands one line width to two sides respectively perpendicular to the line trend, thereby forming two points; the starting point of the vector line element expands one line width along the line trend, and then expands one line width to two sides respectively perpendicular to the line trend, so that two points are formed; the four points form a square with two line widths as side lengths, namely an expanded square at the starting point;
end point expansion operation of the vector line element: the end point of the vector line element expands one line width against the line trend, and then expands one line width to two sides respectively perpendicular to the line trend, thereby forming two points; the end points of the vector line elements expand a line width along the line direction, and then expand a line width to two sides respectively perpendicular to the line direction, so that two points are formed; the four points form a square with two line widths as side lengths, namely an expanded square at the end point;
starting point protocol label of the vector line element: two points of the starting point expansion square which expand out against the linear direction have U values of-2.0; two points of the starting point expansion square which expand along the linear direction have U values of-1.0; two points V on the right side of the line in the starting point expansion square are 0, and two points V on the left side are 1;
endpoint protocol labeling of the vector line elements: two points of the end point expansion square which expand out against the linear direction have U values of-10.0; two points in the end point expansion square, which expand along the linear direction, have U values of 11.0 below zero; two points V on the right side of the line in the end point expansion square have values of 0, and two points V on the left side have values of 1;
distinguishing between start and end points: the U value of the line element, which is neither the starting point nor the ending point, is greater than or equal to 0, the U values of the expansion squares of the starting point and the ending point are smaller than 0, wherein the U value at the starting point is greater than or equal to-2.0, and the U value at the ending point is smaller than-2.0;
step 3, assembling a state protocol of the GPU shader: the state protocol comprises two layers, wherein one layer is a U value, a V value and a scaling direction D value of a vertex layer, and the other layer is a maximum line width M value, a map scaling S value, a starting point marking CB value and an end point marking CE value of a structural layer;
A. the maximum line width M value is the line width of the world coordinate system;
B. the map scaling S value is a dynamically updated scaling value as the map scale scales;
C. start marker CB value and end marker CE value: a floating point value corresponding to whether to draw the diamond arrow, wherein a value smaller than 0 indicates that the diamond arrow is not drawn, and a value larger than or equal to 0 indicates that the diamond arrow is drawn;
D. state protocol: the method comprises the steps of organizing a U value, a V value, a D value, an M value, an S value, a CB value and a CE value according to the U value, the V value, the D value, the M value, the CE value and the S value, wherein the U value, the V value, the CB value and the CE value are one-dimensional floating points, the D value, the M value, the S value, the CB value and the CE value are one-dimensional floating points, the U value, the V value and the D value are sequentially organized into four-dimensional vectors, the M value, the S value, the CB value and the CE value are sequentially organized into four-dimensional vectors, and a finally formed state protocol consists of two vectors: the U-V-D four-dimensional vector and the M-S-CB-CE four-dimensional vector, the vector map line symbol diamond arrow drawing taking line width consistency into consideration must strictly follow the protocol, and message assembly must also be strictly carried out according to the protocol when message transmission is carried out between the CPU and the GPU;
step 4, acquiring an initial world coordinate system line width and a map scale scaling factor in a CPU, respectively transmitting the initial world coordinate system line width and the map scale scaling factor to a GPU according to an M value, an S value, a CB value and a CE value in a state protocol, analyzing the U value, the V value, the D value, the M value, the S value, the CB value and the CE value in the state protocol in a GPU shader, dynamically calculating the pixel positions required to be drawn by the current diamond arrow, performing diamond arrow corrosion operation on a starting point and an end point, and finishing drawing:
A. uniformly adding 1.0 to the U values of four points of the expansion square at the starting point to form a section of 0.0 to-1.0; uniformly adding 10.0 to the U values of four points of the expansion square at the end point to form a zone from 0.0 to-1.0;
B. dividing the expansion square of the starting point/the ending point into four parts according to the U value and the V value; if the V value is less than or equal to 0.5 and the U value is greater than-0.5, the left upper part is positioned; in the lower left part if the V value is equal to or less than 0.5 and the U value is equal to or less than-0.5; in the upper right part if the V value is greater than 0.5 and the U value is greater than-0.5; in the lower right part if the V value is greater than 0.5 and the U value is equal to or less than-0.5;
B1. for the upper left and lower right portions, according to a 0.5 slope, if V <0.5U then erodes;
B2. for the lower left and upper right portions, according to a slope of-0.5, if V < -0.5U, then erode;
and according to the corrosion operation, completing the drawing of diamond arrows.
2. The method for drawing diamond-shaped arrow of vector map line symbol in consideration of line width consistency according to claim 1, wherein in the step 2, U values along the line trend are calculated according to the distance between each vertex and line element, wherein the two vertex U values expanded by the starting point are both 0, the two vertex U values expanded by the ending point are both the length divided by the line width of the whole line, and the two vertex U values expanded by the other points are both the length accumulated value divided by the line width.
3. The diamond arrow drawing method of vector map line sign considering line width consistency according to claim 1, wherein in the step 2, V values of vertical line trend are calculated according to the distance that each vertex expands to two sides, and V values of two expanded vertexes at each point on line element are 1 at left side and 0 at right side.
4. The method of drawing a diamond-shaped arrow of a vector map line in consideration of line width consistency according to claim 1, wherein the D value of the vertex scaling direction in the step 2 is a two-dimensional vector whose length is calculated according to the distance between the expanded vertex and the original point.
CN201911363772.0A 2019-12-26 2019-12-26 Vector map line symbol diamond arrow drawing method considering line width consistency Active CN111145297B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911363772.0A CN111145297B (en) 2019-12-26 2019-12-26 Vector map line symbol diamond arrow drawing method considering line width consistency

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911363772.0A CN111145297B (en) 2019-12-26 2019-12-26 Vector map line symbol diamond arrow drawing method considering line width consistency

Publications (2)

Publication Number Publication Date
CN111145297A CN111145297A (en) 2020-05-12
CN111145297B true CN111145297B (en) 2023-04-21

Family

ID=70520269

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911363772.0A Active CN111145297B (en) 2019-12-26 2019-12-26 Vector map line symbol diamond arrow drawing method considering line width consistency

Country Status (1)

Country Link
CN (1) CN111145297B (en)

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101159065A (en) * 2007-11-08 2008-04-09 武汉大学 Computer automatic drafting method of complicated map symbol
CN105701759B (en) * 2016-01-11 2018-08-10 南京师范大学 Map vector line feature turning reasonability method for drafting based on GPU
CN105513110A (en) * 2016-01-11 2016-04-20 南京师范大学 GPU-based method for drawing linetype map symbol with gradually-varied width
CN109685901B (en) * 2018-12-10 2022-07-22 西北工业大学 Dynamic arrow plotting method in military standard mark plotting

Also Published As

Publication number Publication date
CN111145297A (en) 2020-05-12

Similar Documents

Publication Publication Date Title
US8237745B1 (en) Label positioning technique to reduce crawling during zoom activities
CN105513110A (en) GPU-based method for drawing linetype map symbol with gradually-varied width
CN101751682B (en) Preparation method of universal map
US20130215120A1 (en) Rendering a text image following a line
KR102001191B1 (en) Rendering a text image following a line
CN102255873B (en) Method for transmission of vector data on the basis of pixel non-destructive compression of ordered point set
KR101552827B1 (en) Method Of Dividing Three-dimensional Object Model
CN106408626A (en) Graphics processing systems
US8760451B2 (en) Rendering a text image using texture map character center encoding with character reference encoding
CN111145296B (en) Vector map line symbol circular arrow drawing method considering line width consistency
CN111028353B (en) Vector map line symbol dovetail arrow drawing method considering line width consistency
CN111028352B (en) Vector map line symbol open pointed arrow drawing method considering line width consistency
CN111145303B (en) Vector map line symbol pointed arrow drawing method considering line width consistency
CN111145297B (en) Vector map line symbol diamond arrow drawing method considering line width consistency
CN111127297B (en) Vector map solid line symbol drawing method considering line width consistency
CN111028351B (en) Vector map line symbol half-sharp angle arrow drawing method considering line width consistency
CN111145302B (en) Vector map square dotted line symbol drawing method considering line width consistency
CN111080744B (en) Vector map line symbol half-open pointed arrow drawing method considering line width consistency
CN111145301B (en) Vector map solid line symbol end drawing method considering line width consistency
CN111145295B (en) Vector map line symbol half-dovetail arrow drawing method considering line width consistency
KR101517465B1 (en) 3 asterization Engine and three-dimension graphics system for rasterizing by order adapted characteristic of polygon
CN111145298B (en) Vector map fence dotted line symbol drawing method considering line width consistency
CN111431953B (en) Data processing method, terminal, server and storage medium
CN111127589B (en) Vector map circular dotted line symbol drawing method considering line width consistency
CN109829962A (en) A kind of object space blanking line computation accelerated method using OPENGL

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