Method for quickly calculating topographic earth volume on Beidou satellite land leveling instrument

By converting the terrain data into vertex coordinate data processed by the GPU rendering pipeline and using the graphics card to calculate the earthwork volume, the problems of weak computing power and insufficient memory of the Beidou satellite terractor are solved, and rapid earthwork volume calculation is achieved.

CN119046002APending Publication Date: 2024-11-29SHENZHEN GLACIER NAVIGATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411147833.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-20
Publication Date
2024-11-29

AI Technical Summary

Technical Problem

When calculating the earthwork, the existing Beidou satellite meter has poor CPU computing power and insufficient memory, resulting in a long calculation time and cannot effectively meet engineering needs.

Method used

By converting terrain data into vertex coordinate data that the GPU rendering pipeline can process, using the graphics card for pseudo-color encoding and area and volume calculation, reducing CPU intervention, using the graphics card to process parallel and store intermediate results, reducing the host CPU and memory burden.

Benefits of technology

It realizes the rapid calculation of the terrain earthwork on the Beidou satellite terrameter, solves the problems of weak computing power and insufficient memory, significantly speeds up processing speed, and reduces CPU and memory overhead.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119046002A_ABST
    Figure CN119046002A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of earthwork volume calculation, in particular to a method for quickly calculating the topographic earthwork volume on a Beidou satellite ground leveling instrument, which comprises the following steps of: collecting topographic measurement data by using a satellite navigation RTK (Real Time Kinematic) module, and collecting the longitude, latitude and altitude of a data point; converting the topographic data points into vertex coordinate data which can be processed by a GPU rendering pipeline; the GPU rendering pipeline encodes the terrain height value into a false color to form a height value picture; and carrying out area and volume calculation by using the height value picture. According to the method, the Beidou satellite ground leveling instrument display card is used for processing, the topographic data are converted into the virtual color bitmap, and the volume earthwork volume and the area are calculated according to the virtual color bitmap, so that the CPU burden is reduced, the processing speed is increased, rapid calculation is facilitated, and the intermediate result in the processing process is stored by using the display memory of the display card, so that the processing efficiency is improved. The memory overhead of the host can be saved, and the terrain earth volume can be rapidly calculated on the Beidou satellite ground leveling instrument.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of earthwork volume calculation, and in particular to a method for quickly calculating terrain earthwork volume on a Beidou satellite land leveler. Background Art

[0002] The Beidou satellite leveler is a control device that uses high-precision positioning technology to achieve land leveling. It is equipped with a Beidou satellite intelligent leveling system and uses Beidou satellite navigation technology to perform high-precision leveling mechanical control for land leveling. When leveling, evaluating the amount of earthwork in the operating area is an important step, which is related to the cost budget of engineering costs such as operation time and fuel consumption, as well as the preparation of specific operation plans. There are usually five earthwork calculation methods in engineering, including irregular triangulated network method (DTM method), grid method, contour method, average elevation method, and average section method. The selection of points and lines in the triangulated network can be coordinated with the characteristics of the surface, and the original data can be directly used as grid nodes. Topographic lines can be inserted to preserve the original key terrain features, and can adapt to complex and irregular terrain, so as to better suit the terrain characteristics of the site.

[0003] In existing engineering practice, calculating earthwork volume requires sending staff to the construction site for surveying and mapping, collecting three-dimensional coordinates of data points, and then using computer software for data processing, such as Autodesk Revit, Rhino, ArcGis, etc., to finally obtain the earthwork data of filling and excavation, and then transmit the earthwork data to the Beidou satellite intelligent leveling system of the Beidou satellite leveler, and control the leveling work through the Beidou satellite intelligent leveling system. Although these computer software have the advantages of strong processing power, diverse computing functions, and high data processing accuracy, they have relatively high requirements for computer hardware, and CPU, memory, hard disk and other computing resources must be sufficient. Since the Beidou satellite leveler equipped with the Beidou satellite intelligent leveling system is generally a mobile portable device, the CPU computing power of the Beidou satellite leveler is relatively poor, the memory is small, and the hard disk storage is relatively small. When the earthwork volume calculation method is transplanted to the Beidou satellite leveler, it is easy to have insufficient memory, fewer data points that can be processed, and slow CPU processing speed, which makes the calculation time relatively long, which is not ideal in actual engineering operations. Summary of the invention

[0004] The object of the present invention is to provide a method for quickly calculating terrain earthwork volume on a Beidou satellite leveler to solve the problems raised in the above-mentioned background technology.

[0005] To achieve the above object, the present invention provides the following technical solutions:

[0006] A method for quickly calculating terrain earthwork volume on a Beidou satellite leveler comprises the following steps:

[0007] Use the satellite navigation RTK module to collect topographic survey data and collect the latitude, longitude and altitude of the data points;

[0008] Convert terrain data points into vertex coordinate data that can be processed by the GPU rendering pipeline;

[0009] The GPU rendering pipeline encodes the terrain height value into false color to form a height value image;

[0010] Use height value images to perform area and volume calculations to calculate cut and fill quantities.

[0011] The further step is: before collecting terrain measurement data, the GPU rendering pipeline is initialized, a buffer is applied, and a vertex shader and a fragment shader are created.

[0012] Furthermore, in the process of converting terrain data points into vertex coordinate data that can be processed by the rendering pipeline, the longitude, latitude and altitude of the terrain data points are first converted into the ENU coordinate system, the first data point is used as the origin, the longitude, latitude and altitude are converted into ENU coordinates XYZ relative to the origin, and then the discrete measurement point data are used to generate an irregular triangulated network, and the triangulated network is converted into a format that can be processed by the graphics card GPU rendering pipeline.

[0013] Furthermore, in the process of encoding the terrain height value into a pseudo color, after the vertex data is input into the GPU rendering pipeline, the color value of the final pixel is generated according to the rules through the fragment shader of the GPU.

[0014] The invention further comprises: after the vertex data is generated into pixel color values, linear interpolation processing is performed on the vertices through the rasterization process of the GPU rendering pipeline, that is, a fragment shader is executed on each pixel between the vertices, and the fragment shader determines the color of each pixel through the interpolation variable transmitted by the vertex shader, and outputs it to the color buffer, and the height value of the vertex and the height value of each pixel after interpolation between vertices are output to the frame buffer as color values, and then the data in the frame buffer is read to obtain a height data value image in which each pixel is a height value.

[0015] Furthermore, when using the height value image to calculate the area and volume, the pixel unit area is first determined, wherein the pixel unit area is the measured terrain area divided by the product of the length and width of the GPU frame buffer.

[0016] Furthermore, in the cross-sectional area calculation, if you want to calculate the cross-sectional area of ​​height A1, compare the value Ax of each point in the height data. If Ax is greater than or equal to A1, add 1; if it is less than A1, do not add. After traversing all points, the product of the accumulated value and the unit area of ​​the pixel is the cross-sectional area.

[0017] Preferably: during the earthwork volume calculation process, the earthwork volume value when the statistical target base height is A2 is set, the height value Ax of all points is traversed, and the difference between the two is calculated as Ad=Ax-A2. If Ad is greater than 0, it is excavation here, and if Ad is less than 0, it is filling here.

[0018] Furthermore, when Ad is greater than 0, Ad is accumulated into the excavation elevation, and after traversing the height data, the final excavation volume is the product of the accumulated excavation elevation and the pixel unit area.

[0019] Preferably: when Ad is less than 0, the absolute value of Ad is taken and accumulated into the fill elevation. After traversing the height data, the final fill volume is the product of the accumulated fill elevation and the unit area of ​​the pixel.

[0020] Compared with the prior art, the present invention has the following beneficial effects:

[0021] 1. By converting the collected terrain data into a 3D model vertex array that can be recognized and processed by the graphics card on the Beidou satellite leveler, the terrain data is converted by using the graphics card equipped with the Beidou satellite leveler, and then the data is input into the graphics card GPU rendering pipeline for processing, and finally the earthwork volume and area are calculated. The terrain data is converted into a virtual color bitmap by using the Beidou satellite leveler graphics card, and the volume earthwork volume and area are calculated according to the virtual color bitmap. In this process, the host CPU does not need to intervene, and the graphics card can be processed in parallel, thereby saving the CPU time overhead of the host, which is conducive to reducing the CPU burden, speeding up the processing speed, and facilitating fast calculations. The graphics card's video memory is used to store the intermediate results in the processing process, which is conducive to saving the host's memory overhead, and can better solve the problems of weak computing power and insufficient memory of the Beidou satellite leveler, and the terrain earthwork volume calculation can be performed relatively quickly on the Beidou satellite leveler. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 It is a workflow diagram of the programmable rendering pipeline;

[0023] Figure 2 It is a schematic diagram of the working process of the rendering pipeline in the present invention;

[0024] Figure 3 It is a schematic flow chart of the method of the present invention;

[0025] Figure 4 It is a schematic diagram of the process of converting terrain data into an array of height values ​​in the present invention;

[0026] Figure 5 It is a schematic diagram of the flow of calculating earthwork volume in the present invention. DETAILED DESCRIPTION

[0027] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0028] See also Figure 3 In an embodiment of the present invention, a method for quickly calculating terrain earthwork volume on a Beidou satellite leveler comprises the following steps:

[0029] Use the satellite navigation RTK module to collect topographic survey data and collect the latitude, longitude and altitude of the data points;

[0030] Convert terrain data points into vertex coordinate data that can be processed by the GPU rendering pipeline;

[0031] The GPU rendering pipeline encodes the terrain height value into false color to form a height value image;

[0032] Use height value images to perform area and volume calculations to calculate cut and fill quantities.

[0033] Specifically, by utilizing the graphics card equipped with the Android device, the terrain data is converted, and then the data is input into the graphics card GPU rendering pipeline for processing, and then the earthwork volume and area are calculated. By utilizing the graphics card processing of the Beidou satellite leveler, the terrain data is converted into a virtual pseudo-color image to form a height value image, and then the volume earthwork volume and area are calculated based on the image. In the above process, the CPU does not need to intervene, and the graphics card can process in parallel, which can save the CPU time overhead of the host, help reduce the CPU burden, speed up the processing speed, and facilitate fast calculations. The graphics card's video memory can be used to store intermediate results in the processing process, which is beneficial to saving the host's memory overhead, and can better solve the problems of weak computing power and insufficient memory of the Beidou satellite leveler, and the terrain earthwork volume calculation can be performed relatively quickly on the Beidou satellite leveler.

[0034] Embodiment 1

[0035] See also Figure 1-2 As shown, in this embodiment, before collecting terrain measurement data, the GPU rendering pipeline is initialized, a buffer is applied, and a vertex shader and a fragment shader are created.

[0036] In specific implementation, the graphics card equipped with mainstream Beidou satellite levelers supports OpenGL ES2.0 and above standards, and the graphics card graphics processing unit (GPU) supports programmable rendering pipeline in hardware, among which the vertex shader (Vertex Shader) and fragment shader (Fragment Shader) are the key modules that constitute the programmable function of the 3D rendering processing pipeline:

[0037] The input of the Vertex shader is vertex-related information data, and the output is divided into two parts. The required output part is the coordinate information of the vertex that will eventually be displayed on the screen, and the optional output is other information corresponding to the vertex (such as color, texture coordinates, etc.). The Vertex shader can only operate one vertex at a time;

[0038] The input of the fragment shader is the pixel information on the screen (coordinates and the color and texture coordinates of the corresponding pixels from the vertex shader). The fragment shader cannot modify the position of a pixel. When operating a pixel, it cannot access the adjacent pixels. The fragment shader operates on the vertex information and outputs the color of each pixel. The output value is used to update the color buffer in the drawing buffer or other target buffers.

[0039] These two shaders support the GLSL (OpenGL Shading Language) programming language, which can be used to write programs to control the operation functions of the shaders.

[0040] Generating an image using the rendering pipeline generally includes the following steps:

[0041] (1) First, decompose the object to be drawn into basic geometric primitives (points, lines, triangles), and store the position coordinates and color of the vertices in an array;

[0042] (2) Through the programming interface API, the vertex array is input into the rendering pipeline, and the vertices can be geometrically transformed in the vertex shader, such as translation and rotation;

[0043] (3) The processed data then enters the fragment shader, where rasterization is performed. That is, the blank pixels between vertices are filled with colors according to the vertex colors. The logic of coloring can be programmed in the fragment shader.

[0044] (4) The final pixel information is output to the frame buffer. The result of this processing is an image that can be displayed on the screen or saved as a picture file after compression.

[0045] See also Figure 4 As shown, in this embodiment, in the process of converting terrain data points into vertex coordinate data that can be processed by the rendering pipeline, the longitude, latitude and altitude of the terrain data points are first converted into the ENU coordinate system, the first data point is used as the origin, the longitude, latitude and altitude are converted into ENU coordinates XYZ relative to the origin, and then the discrete measurement point data are used to generate an irregular triangulated network, and the triangulated network is converted into a format that can be processed by the graphics card GPU rendering pipeline.

[0046] In specific implementation, the data points collected during terrain measurement contain latitude, longitude and altitude information. The latitude and longitude output from the satellite positioning system are usually the angle values ​​of the WGS84 coordinate system, in degrees, and the altitude value is the elevation of the reference surface, in meters. The vertices of the graphics card rendering pipeline use the local coordinate system, and the three-dimensional coordinates XYZ of the vertex are equivalent to the distance from the origin, in meters. The origin is generally defined as the center of the viewport. The viewport can be understood as a cubic space, and the vertices are distributed in this visible space.

[0047] Before calculation, the coordinate values ​​of the terrain data points are converted into the ENU coordinate system, and the longitude, latitude and altitude are converted into the ENU coordinate XYZ relative to the origin. The origin is usually selected near the collection site, and the first point collected can be used as the origin;

[0048] The calculation method for converting GS84 longitude and latitude into ENU coordinates can refer to existing open source codes and function libraries. For example, the pymap3d module of the Python language can be used directly for bidirectional conversion. The sample Python code is as follows:

[0049] import pymap3d as pm

[0050] #lat, lon, alt are the coordinates of the currently collected data points

[0051] #origin is the origin coordinate

[0052] #e, n, u are the converted x, y, z coordinates

[0053] e,n,u=pm.geodetic2enu(lat,lon,alt,originLat,originLon,originAlt,deg=True)

[0054] Cache the converted ENU coordinates in an array variable or a database table.

[0055] When using the DTM method to calculate earthwork volume, first generate an irregular triangulated network from discrete measurement point data. Delaunay triangulated network is a commonly used triangulated network generation method. The calculation method of generating Delaunay triangulated network coordinates from ENU data can refer to the existing open source code and function library. The sample code is as follows:

[0056]

[0057]

[0058]

[0059] Convert the triangulated network into a format that can be processed by the GPU rendering pipeline of the graphics card. The code is as follows:

[0060] getGLDataFromTIN(int npoints,double*xAry,double*yAry,double*zAry){

[0061] / / First find the boundaries of the collected data points X and Y, that is, the maximum and minimum values

[0062] double xmax=DBL_MIN,xmin=DBL_MAX;

[0063] double ymax=DBL_MIN,ymin=DBL_MAX;

[0064] for(int i=0; i <npoints;i++){

[0065] if(xAry[i]>xmax)xmax=xAry[i];

[0066] if(xAry[i] <xmin)xmin=xAry[i];

[0067] if(yAry[i]>ymax)ymax=yAry[i];

[0068] if(yAry[i] <ymin)ymin=yAry[i];

[0069] }

[0070] / / Put the sampling point data into the array pvertices in the format of XYZ, and convert X and Y into relative values ​​relative to the boundary.

[0071] float*pvertices=malloc(npoints*sizeof(float)*3);

[0072] for(int i=0; i <npoints;i++){

[0073] pvertices[i*3]=(float)(xAry[i]-xmin);

[0074] pvertices[i*3+1]=(float)(yAry[i]-ymin);

[0075] pvertices[i*3+2]=(float)zAry[i];

[0076] }

[0077] / / Put the triangulated network index into the array pindices

[0078] std::vector <std::vector <int>>triangles=delaunay_impl(npoints,xAry,yAry);

[0079] int nTri=triangles.size();

[0080] float*pindices=malloc(nTri*sizeof(float)*3);

[0081] for(int i=0; i <nTri;i++){

[0082] pindices[i*3]=triangles[i][0];

[0083] pindices[i*3+1]=triangles[i][1];

[0084] pindices[i*3+2]=triangles[i][2];

[0085] }

[0086] / / Put the XY boundary values ​​into the array pbound

[0087] float*pbound=malloc(4*sizeof(float));

[0088] pbound[0] = (float)xmin;

[0089] pbound[1] = (float)xmax;

[0090] pbound[2] = (float)ymin;

[0091] pbound[3] = (float)ymax;

[0092] }

[0093] Through the above steps, the coordinate data is converted into data that can be processed by the GPU rendering pipeline.

[0094] Based on Example 1, please refer to Figure 4 As shown, in this embodiment, in the process of encoding the terrain height value into a pseudo color, after the vertex data is input into the GPU rendering pipeline, the color value of the final pixel is generated according to the rule by the fragment shader of the GPU. After the vertex data generates the pixel color value, the vertex is subjected to linear interpolation processing through the rasterization process of the GPU rendering pipeline, that is, the fragment shader is executed on each pixel between the vertices, and the fragment shader determines the color of each pixel through the interpolation variable transmitted by the vertex shader, and outputs it to the color buffer. The height value of the vertex and the height value of each pixel after interpolation between vertices are output to the frame buffer as color values, and then the data in the frame buffer is read to obtain a height data value image in which each pixel is a height value.

[0095] In specific implementation, the steps of processing data using the graphics card rendering pipeline are as follows:

[0096] Step (1) Create a Vertex Shader

[0097] #version 300es

[0098] / / vPosition is the input coordinate

[0099] layout(location=0)in vec4 vPosition;

[0100] / / v_z output to the fragment shader

[0101] smooth out float v_z;

[0102] void main()

[0103] {

[0104] / / gl_Position is the coordinate output by the vertex shader

[0105] gl_Position = vPosition;

[0106] / / For each pixel, the rendering pipeline performs linear interpolation on the z height. Before interpolation, z is displaced and enlarged to improve the accuracy after interpolation. The opposite operation is performed when the height value of the processed result is read later.

[0107] v_z=(vPosition.z+1000.)*100.;

[0108] };

[0109] Step (2) Create a Fragment Shader

[0110] #version 300es

[0111] / / Interpolated z height output by the vertex shader

[0112] smooth in float v_z;

[0113] out vec4 fragColor;

[0114] void main()

[0115] {

[0116] / / Split v_z into 3 bytes

[0117] int iR = int(v_z)%256;

[0118] int m1 = int(v_z / 256.);

[0119] int iG = m1%256;

[0120] int iB = m1 / 256;

[0121] / / Convert the byte into a floating point number between 0 and 1

[0122] float r = float(iR) / 255.;

[0123] float g = float(iG) / 255.;

[0124] float b = float(iB) / 255.;

[0125] / / Output the rgb floating point number as the color value

[0126] fragColor=vec4(r,g,b,1.0);

[0127] };

[0128] Step (3) Apply for video memory frame buffer

[0129] / / Create a 2D texture for connecting to the FBO color attachment. This 2D texture is used to store the RGBA pixel data of the frame buffer

[0130] int[]_textureId=new int[1];

[0131] GLES30.glGenTextures(1,_textureId,0);

[0132] GLES30.glBindTexture(GLES30.GL_TEXTURE_2D,_textureId[0]);

[0133] / / Create and initialize FBO frame buffer

[0134] int[]_fboId = new int[1];

[0135] GLES30.glGenFramebuffers(1,_fboId,0);

[0136] GLES30.glBindFramebuffer(GLES30.GL_FRAMEBUFFER,_fboId[0]);

[0137] / / Attach 2D texture to FBO framebuffer

[0138] GLES30.glFramebufferTexture2D(GLES30.GL_FRAMEBUFFER,GLES30.GL_COLOR_ATTAC HMENT0,GLES30.GL_TEXTURE_2D,_textureId[0],0);

[0139] / / Set the size of the 2D texture texWidth, texHeight, pixel format RGBA

[0140] GLES30.glTexImage2D(GLES30.GL_TEXTURE_2D,0,GLES30.GL_RGBA,texWidth,texHeight,0,GLES30.GL_RGBA,GLES30.GL_UNSIGNED_BYTE,null);

[0141] Step (4) Apply for PIXEL_PACK_BUFFER for reading the frame buffer.

[0142] / / The frame buffer of the rendering pipeline cannot be read directly. You need to copy the pixel RGBA data to pixel_pack_buffer first, and then read it from pixel_pack_buffer. This is a mechanism to ensure the efficiency of the rendering pipeline.

[0143] int[]_pboIds = new int[1];

[0144] GLES30.glGenBuffers(1,_pboIds,0);

[0145] GLES30.glBindBuffer(GLES30.GL_PIXEL_PACK_BUFFER,_pboIds[0]);

[0146] / / Set the buffer size

[0147] _imgBufferSize=texWidth*texHeight*4

[0148] GLES30.glBufferData(GLES30.GL_PIXEL_PACK_BUFFER,_imgBufferSize,null,GLES30.GL_STATIC_READ);

[0149] Step (5) Apply for a buffer to store vertex data

[0150] / / A vertex data buffer, a triangle index buffer

[0151] int[]_vboIds = new int[2];

[0152] GLES30.glGenBuffers(2,_vboIds,0);

[0153] Step (6) Input the vertex data into the rendering pipeline and render it to the FBO frame buffer after processing

[0154] / / bound is the pbound calculated in the program "Convert the triangulated network into a format that can be processed by the GPU rendering pipeline"

[0155] void RenderTrianglesToFBO(Bound bound,float[]vVertices,short[]indices){

[0156] / / Input the vertex array vVertices, which is the pvertices calculated in the program "Convert the triangulated network into a format that the GPU rendering pipeline can handle"

[0157] GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER,_vboIds[0]);

[0158] GLES30.glBufferData(GLES30.GL_ARRAY_BUFFER,vVertices.length*Float.BYTES,FloatBuffer.wrap(vVertices),GLES30.GL_STATIC_DRAW);

[0159] / / Input the triangle index array indices, which is the pindices calculated in the "Convert the triangulated network into a format that can be processed by the GPU rendering pipeline" program

[0160] GLES30.glBindBuffer(GLES30.GL_ELEMENT_ARRAY_BUFFER,_vboIds[1]);

[0161] GLES30.glBufferData(GLES30.GL_ELEMENT_ARRAY_BUFFER,indices.length*Short.BYTES,ShortBuffer.wrap(indices),GLES30.GL_STATIC_DRAW);

[0162] / / Specify the output frame buffer

[0163] GLES30.glBindFramebuffer(GLES30.GL_FRAMEBUFFER,_fboId[0]);

[0164] / / Set the viewport size to texWidth, texHeight

[0165] GLES30.glViewport(0,0,_texWidth,_texHeight);

[0166] / / Render output to FBO

[0167] GLES30.glDrawElements(GLES30.GL_TRIANGLES,indices.length,GLES30.GL_UNSIGN ED_SHORT,0);

[0168] }

[0169] Step (7) Read the rendering result and return the RGBA array of pixels

[0170] int[]ReadRGBAPixelsFromFBO(){

[0171] / / Specify the frame buffer to read

[0172] GLES30.glBindFramebuffer(GLES30.GL_FRAMEBUFFER,_fboId[0]);

[0173] / / Specify the target buffer pixel_pack_buffer to copy to

[0174] GLES30.glBindBuffer(GLES30.GL_PIXEL_PACK_BUFFER,_pboIds[0]);

[0175] / / Perform the read operation

[0176] glReadPixels(0,0,_texWidth,_texHeight,GLES30.GL_RGBA,GLES30.GL_UNSIGNED_BYTE);

[0177] / / Map the entire contents of pixel_pack_buffer to ByteBuffer

[0178] ByteBuffer buf=(ByteBuffer)GLES30.glMapBufferRange(GLES30.GL_PIXEL_PACK_BU FFER,0,_imgBufferSize,GLES30.GL_MAP_READ_BIT);

[0179] / / Finally read intBuf as the function return value

[0180] int[]intBuf=new int[_imgBufferSize / Integer.BYTES];

[0181] buf.order(ByteOrder.LITTLE_ENDIAN).asIntBuffer().get(intBuf);

[0182] return intBuf;

[0183] }

[0184] Step (8) Convert the pixel RGBA array into a height value array

[0185] / / Convert pixel RGBA into height value array

[0186] float[]rgbaPixelsToAltArray(int[]intBuf){

[0187] int np=intBuf.size();

[0188] float[]altMap=new ArrayList <float>();

[0189] for(int i=0; i <np;i++){

[0190] int pixel = intBuf[i];

[0191] / / If the pixel has no color, it means that the point is not within the range of the terrain collection point.

[0192] if(pixel&0xff000000){

[0193] / / Perform the reverse operation on RGB in step (1) to get the floating point height value

[0194] float altitude=((float)(pixel&0xffffff)) / 100.0f-1000.0f;

[0195] altMap.add(altigude);

[0196] }

[0197] }

[0198] / / You only need to save the height value within the terrain range, and do not need to keep the location information of each terrain point; to count the area and volume, you only need to accumulate the number of terrain points that meet the height value.

[0199] return altMap;

[0200] }

[0201] After the above steps, a height data value image in which each pixel is a height value is obtained.

[0202] Embodiment 2

[0203] Based on Example 1, please refer to Figure 5 As shown, in this embodiment, when using the height value picture for area and volume calculation, first determine the pixel unit area, where the pixel unit area is the measured terrain area divided by the product of the length and width of the GPU frame buffer. In the calculation of the cross-sectional area, if you want to calculate the cross-sectional area at height A1, compare the value Ax of each point in the height data. If Ax is greater than or equal to A1, accumulate 1; if it is less than A1, do not accumulate. After traversing all points, the product of the accumulated value and the pixel unit area is the cross-sectional area. In the calculation process of the earthwork volume, set the earthwork volume value when the statistical target reference height is A2. Traverse the height values Ax of all points, and calculate the difference Ad = Ax - A2. If Ad is greater than 0, this is an excavation; if Ad is less than 0, this is a fill. When Ad is greater than 0, accumulate Ad into the excavation elevation. After traversing the height data, the final excavation volume is the product of the accumulated excavation elevation and the pixel unit area. When Ad is less than 0, take the absolute value of Ad and accumulate it into the fill elevation. After traversing the height data, the final fill volume is the product of the accumulated fill elevation and the pixel unit area.

[0204] During specific implementation, when calculating, first determine the pixel unit area. The pixel unit area = the area of the measured terrain / the product of the length and width of the GPU frame buffer. Then record the target height A1 as T, read a value Ax from the height value group into C. If C > T, accumulate the overexcavation by (C - T) * the pixel unit area; if C < T, accumulate the underfill by (T - C) * the pixel unit area. After one accumulation calculation is completed, if there are still uncalculated values in the height value group, read the next value Ax from the height value group into C, and then repeat to judge the size relationship between C and T and accumulate the overexcavation or underfill. If all the values in the height value group are calculated, the traversal of the values in the height value group is completed, and the calculation ends. At this time, the excavation earthwork volume is the accumulated overexcavation, and the fill earthwork volume is the accumulated underfill. The example code is as follows:

[0205] First, calculate the unit area of each terrain pixel point:

[0206] / / imgWidth * imgHeight is the size of the measured terrain, in meters

[0207] long totalsize = imgWidth * imgHeight;

[0208] / / 1024 * 1024 is the size of the applied frame buffer

[0209] long bufferLimit = 1024 * 1024;

[0210] / / The area of each pixel point is defaulted to 1 square meter

[0211] double pixelRatio = 1;

[0212] / / If the terrain size exceeds the frame buffer, the unit area of ​​each pixel needs to be adjusted

[0213] if (totalsize > bufferLimit) {

[0214] double approximateRatio=Math.sqrt((double)(bufferLimit) / totalsize);

[0215] imgWidth=(int)(imgWidth*approximateRatio)&0xfffffff0;

[0216] imgHeight=(int)(imgHeight*approximateRatio)&0xfffffff0;

[0217] pixelRatio=(double)totalsize / (double)(imgWidth*imgHeight);

[0218] }

[0219] Next, calculate the volume and area from the array of height values:

[0220]

[0221]

[0222] Calculate the earthwork volume after the above steps.

[0223] In the present invention, in the process of calculating the earthwork volume, if the designed ground is a slope, after converting the terrain data into ENU coordinate data, the surface equation of the designed ground in the ENU coordinate system can be obtained according to the design requirements, so that in the subsequent calculation process, the vertex XY data can be compared first, and the vertex XY coordinate data can be substituted into the equation of the designed ground to obtain the difference between the vertex and the target design height, and then the earthwork volume is calculated by the difference;

[0224] When calculating earthwork volume, three calculation modes can be set: calculating only the excavation volume, calculating only the filling volume, and calculating both excavation and filling. When calculating only the excavation volume, directly subtract the value Ax in the height value group from the target height A1, and multiply the accumulated difference by the pixel unit area to directly obtain the excavation volume. When calculating only the filling volume, subtract the value Ax in the height value group from the target height A1, and multiply the accumulated difference by the pixel unit area to directly obtain the filling volume. In this way, when only the excavation or filling calculation is performed, there is no need to compare Ax and A1, which is conducive to speeding up the calculation.

[0225] When the calculation process of only calculating the amount of excavation or only calculating the amount of filling is completed and the calculated amount of excavation or filling is displayed for the staff to view, the correctness of the calculation result can be checked. The maximum value Amax and the minimum value Amin in several Ax can be taken, and the maximum value Amax and the minimum value Amin are compared with the height A1. In the calculation of only excavation, if the target height A1 is less than the minimum value Amin, the selected calculation mode is correct and the calculation result is correct. If the target height A1 is greater than the minimum value Amin, the selected calculation mode is wrong, there is an area that needs to be filled, and the calculation result is wrong; in the calculation of only filling, if the target height A1 is greater than the maximum value Amax, the selected calculation mode is correct and the calculation result is correct. If the target height is less than the maximum value Amax, the selected calculation mode is wrong, there is an area that needs to be excavated, and the calculation result is wrong. In this way, the earthwork calculation result can be checked and the calculation can be performed when the staff views the calculation result, thereby reducing the time for the staff to wait for the earthwork calculation result.

[0226] It will be apparent to those skilled in the art that the invention is not limited to the details of the exemplary embodiments described above and that the invention can be implemented in other specific forms without departing from the spirit or essential features of the invention. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description, and it is intended that all variations falling within the meaning and scope of the equivalent elements of the claims be included in the invention. Any reference numeral in a claim should not be considered as limiting the claim to which it relates.

[0227] In addition, it should be understood that although the present specification is described according to implementation modes, not every implementation mode contains only one independent technical solution. This description of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art.< / float> < / int>

Claims

1. A method for quickly calculating terrain earthwork volume on Beidou satellite leveler. It is characterized in that The following steps are involved: Use the satellite navigation RTK module to collect topographic survey data and collect the latitude, longitude and altitude of the data points; Convert terrain data points into vertex coordinate data that can be processed by the GPU rendering pipeline; The GPU rendering pipeline encodes the terrain height value into false color to form a height value image; Use height value images to perform area and volume calculations to calculate cut and fill quantities.

2. A method for quickly calculating terrain earthwork volume on a Beidou satellite leveler according to claim 1, It is characterized in that Before collecting terrain measurement data, initialize the GPU rendering pipeline, apply for buffers, and create vertex shaders and fragment shaders.

3. A method for quickly calculating terrain earthwork volume on a Beidou satellite leveler according to claim 1, It is characterized in that In the process of converting terrain data points into vertex coordinate data that can be processed by the rendering pipeline, the longitude, latitude and altitude of the terrain data points are first converted into the ENU coordinate system, the first data point is used as the origin, the longitude, latitude and altitude are converted into ENU coordinates XYZ relative to the origin, and then the discrete measurement point data is used to generate an irregular triangulated network, and the triangulated network is converted into a format that can be processed by the graphics card GPU rendering pipeline.

4. A method for quickly calculating terrain earthwork volume on a Beidou satellite leveler according to claim 1, It is characterized in that In the process of encoding the terrain height value into pseudo color, after the vertex data is input into the GPU rendering pipeline, the GPU fragment shader is used to generate the final pixel color value according to the rules.

5. A method for quickly calculating terrain earthwork volume on a Beidou satellite leveler according to claim 4, It is characterized in that After generating pixel color values ​​from vertex data, linear interpolation is performed on the vertices through the rasterization process of the GPU rendering pipeline, that is, the fragment shader is executed on each pixel between the vertices. The fragment shader determines the color of each pixel through the interpolation variable passed by the vertex shader, and outputs it to the color buffer. The height value of the vertex and the height value of each pixel after interpolation between vertices are output to the frame buffer as color values, and then the data in the frame buffer is read to obtain a height data value image in which each pixel is a height value.

6. A method for quickly calculating terrain earthwork volume on a Beidou satellite leveler according to claim 1, It is characterized in that When using height value images for area and volume calculations, first determine the pixel unit area, where the pixel unit area is the measured terrain area divided by the product of the length and width of the GPU frame buffer.

7. A method for quickly calculating terrain earthwork volume on a Beidou satellite leveler according to claim 6, It is characterized in that In the cross-sectional area calculation, if you want to calculate the cross-sectional area of ​​height A1, compare the value Ax of each point in the height data. If Ax is greater than or equal to A1, add 1; if it is less than A1, do not add. After traversing all points, the product of the accumulated value and the unit area of ​​the pixel is the cross-sectional area.

8. A method for quickly calculating terrain earthwork volume on a Beidou satellite leveler according to claim 6, It is characterized in that During the earthwork volume calculation process, the earthwork volume value when the statistical target base height is A2 is set, the height value Ax of all points is traversed, and the difference between the two is calculated as Ad=Ax-A2. If Ad is greater than 0, this is excavation, and if Ad is less than 0, this is filling.

9. A method for quickly calculating terrain earthwork volume on a Beidou satellite leveler according to claim 8, It is characterized in that When Ad is greater than 0, Ad is accumulated into the excavation elevation. After traversing the height data, the final excavation volume is the product of the accumulated excavation elevation and the pixel unit area.

10. A method for quickly calculating terrain earthwork volume on a Beidou satellite leveler according to claim 8, It is characterized in that When Ad is less than 0, take the absolute value of Ad and accumulate it into the fill elevation. After traversing the height data, the final fill volume is the product of the accumulated fill elevation and the unit area of ​​pixels.