CN111459463A - Algorithm module generation method and linear symbol drawing method - Google Patents
Algorithm module generation method and linear symbol drawing method Download PDFInfo
- Publication number
- CN111459463A CN111459463A CN201910054486.XA CN201910054486A CN111459463A CN 111459463 A CN111459463 A CN 111459463A CN 201910054486 A CN201910054486 A CN 201910054486A CN 111459463 A CN111459463 A CN 111459463A
- Authority
- CN
- China
- Prior art keywords
- algorithm
- library
- linear
- wasm
- linear symbol
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 33
- 238000005516 engineering process Methods 0.000 claims abstract description 11
- 238000004806 packaging method and process Methods 0.000 claims abstract description 6
- 238000009877 rendering Methods 0.000 claims abstract description 4
- 238000004364 calculation method Methods 0.000 abstract description 7
- 238000010276 construction Methods 0.000 abstract description 2
- 230000008901 benefit Effects 0.000 description 4
- 230000008569 process Effects 0.000 description 3
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 229910052792 caesium Inorganic materials 0.000 description 1
- TVFDJXOCXUVLDH-UHFFFAOYSA-N caesium atom Chemical compound [Cs] TVFDJXOCXUVLDH-UHFFFAOYSA-N 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/31—Programming languages or programming paradigms
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Devices For Executing Special Programs (AREA)
Abstract
The invention relates to an algorithm module generation method and a linear symbol drawing method based on a WebAssembly technology. The algorithm module generation method comprises the following steps: creating C/C + + algorithm classes of each linear symbol to generate a C/C + + algorithm library; packaging the input and output of the C/C + + algorithm class by using an Emscript compiling tool to generate a wasm interface; and compiling the C/C + + algorithm library by using an Emscript compiling tool to generate a wasm algorithm library and a js interface library. The invention improves the calculation performance of the Web front end, improves the front-end model construction and rendering efficiency, and meets the requirement of a user on dynamically and rapidly drawing a linear symbol model.
Description
Technical Field
The invention relates to a Web-side geographic information system (WebGIS) technology, in particular to an algorithm module generation method and a linear symbol drawing method based on a WebAssembly technology.
Background
With the continuous development of the Internet technology and the demand of people on Geographic Information Systems (GIS), the trend of displaying geographic information on a Web end by using the Internet is inevitable, and the application field of the WebGIS technology is continuously widened. At present, WebGIS business logic is realized through a JavaScript technology, however, at present, business requirements are more and more complex, development code quantity of a front end is more and more changed, the JavaScript technology has the defects of complex code logic, large code quantity, weak calculation and analysis performance and the like, particularly, when complex linear symbols are dynamically refreshed and drawn, the calculation performance and the real-time performance of the complex linear symbols cannot meet the business requirements, and therefore the running efficiency of GIS WebGIS application is influenced.
Disclosure of Invention
The present invention is directed to solving at least one of the problems of the prior art or the related art.
Therefore, the invention aims to provide an algorithm module generation method and a linear symbol drawing method based on the WebAssembly technology, which can realize efficient complex linear symbol calculation and drawing.
According to a first aspect of the present invention, there is provided a method for generating an algorithm module based on a WebAssembly technique, comprising:
creating C/C + + algorithm classes of each linear symbol to generate a C/C + + algorithm library;
packaging the input and output of the C/C + + algorithm class by using an Emscript compiling tool to generate a wasm interface;
and compiling the C/C + + algorithm library by using an Emscript compiling tool to generate a wasm algorithm library and a js interface library.
Further, the wsm algorithm library is a binary file library with a suffix of.wsm, and the js interface library is an interface library with a suffix of.js.
Further, the compiling the C/C + + algorithm library using an emascript compiling tool includes:
and adding all source files and header files in the C/C + + algorithm library into a compiling module, and adding a wasm export label.
According to a second aspect of the present invention, there is provided a method of rendering a linear symbol using an algorithmic module generated according to the method of the first aspect, comprising:
receiving the linear symbol name and the control point information through a js interface library;
calling a wasm algorithm library;
the linear symbol names and the control point information are transmitted to a C/C + + algorithm library through a wasm interface;
and calculating by corresponding C/C + + algorithm according to the linear symbol name and the control point information, and outputting a basic line for drawing the linear symbol model.
Further, the calculating by the corresponding C/C + + algorithm class according to the linear symbol name and the control point information includes:
searching a corresponding C/C + + algorithm class according to the linear conforming name;
and calculating linear symbols according to the control point information by using the corresponding C/C + + algorithm class.
Further, still include:
and drawing the three-dimensional model of the linear symbol based on the three-dimensional display platform according to the basic line for drawing the linear symbol model.
The algorithm module for realizing the complex linear symbols based on the WebAssembly technology is realized by adopting a C + + efficient language, so that the calculation performance of a Web front end is improved, the front end model construction and rendering efficiency is improved, and the requirement of a user for dynamically and rapidly drawing the linear symbol model is met; the method has the advantage of high C/C + + computing efficiency, can be introduced to the Web front end for JS call, and provides infinite possibility for a complex and dense computing scene of the front end; moreover, the packaged C/C + + complex line symbol algorithm library is compiled into a WASM module library, and the WASM module library has the capability of once compiling and spanning multi-platform application; the WebAssembly code is a binary compilation target and has certain protectiveness to the C/C + + code.
Drawings
The above and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is a flow chart of an algorithm module generation method according to the present invention;
fig. 2 is a schematic diagram of a line symbol drawing process according to the present invention.
Detailed Description
In order that the above objects, features and advantages of the present invention can be more clearly understood, a more particular description of the invention will be rendered by reference to the appended drawings. It should be noted that the embodiments and features of the embodiments of the present application may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, however, the present invention may be practiced in other ways than those specifically described herein, and therefore the scope of the present invention is not limited by the specific embodiments disclosed below.
Referring to fig. 1, there is shown an algorithm module generating method based on WebAssembly technology according to the present invention, including:
s11, creating C/C + + algorithm classes of each linear symbol to generate a C/C + + algorithm library;
the method comprises the steps of creating C/C + + algorithm classes of various linear symbols (such as multiple arrows, clamping and the like), providing a unified factory class interface for uniquely identifying linear symbol classes, receiving control points dynamically input by a user, inputting algorithm logic to finish efficient calculation of the linear symbols, and outputting multiple sections of broken line coordinate points to combine the linear symbols.
S12, packaging the input and output of the C/C + + algorithm class by using an Emscript compiling tool to generate a wasm interface;
and establishing each parameter array (Module) according to the data access requirement of the wasm interface, and then performing matching assignment on the parameter array and the input and output of the C/C + + algorithm class to realize the wasm interface butted with the C/C + + algorithm class.
And S13, compiling the C/C + + algorithm library by using an Emscript compiling tool to generate a wasm algorithm library and a js interface library.
All source files and header files in the C/C + + algorithm library are added into a compiling module, a wasm export label is added, and a wasm algorithm library and a js interface library are generated. The wsm algorithm library is a binary file library with a suffix of.
The invention provides an external module packaging function by logically packaging the C/C + + line symbol algorithm into a WebAssembly module, and the Web front end can be directly loaded, analyzed and operated on a browser through a JavaScript interface, so that the front-end operation and dynamic real-time calculation performance are greatly improved.
Referring to fig. 2, which shows a drawing process of a linear symbol according to the present invention, wherein a platform exhibition 21 is used to implement a WebGIS exhibition, and an algorithm module 22 generated according to the method described with reference to fig. 1 is used to draw the linear symbol. The process comprises the following steps:
receiving the linear symbol name and the control point information through a js interface library;
calling a wasm algorithm library;
the linear symbol names and the control point information are transmitted to a C/C + + algorithm library through a wasm interface;
and according to the linear symbol names and the control point information, calculating by corresponding C/C + + algorithm classes, and outputting basic lines of a WebG L drawn linear symbol model.
Further, according to the basic line for drawing the linear symbol model, a three-dimensional model of the linear symbol is constructed based on a three-dimensional display platform (Cesium), and dynamic drawing of the line plotting symbol of the model on the three-dimensional terrain sphere is realized in WebGIS display.
The method is realized by logically initializing the complex linear symbolic algorithm, compiling the linear symbolic algorithm by adopting C/C + + at the bottom layer and compiling the linear symbolic algorithm into a wap binary file for JS call by an Emscript tool, so that the expansibility and the high efficiency of the front-end WebGIS system are improved, the method has the advantage of high C/C + + computing efficiency, and can be introduced into the Web front end for JS call, thereby providing infinite possibility for a complex and dense computing scene at the front end. Moreover, the packaged C/C + + complex line symbol algorithm library is compiled into a WASM module library, and the WASM module library has the capability of once compiling and spanning multi-platform application; the WebAssembly code is a binary compilation target and has certain protectiveness to the C/C + + code.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium.
The above is only a preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes will occur to those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (6)
1. An algorithm module generation method based on a WebAssembly technology is characterized by comprising the following steps:
creating C/C + + algorithm classes of each linear symbol to generate a C/C + + algorithm library;
packaging the input and output of the C/C + + algorithm class by using an Emscript compiling tool to generate a wasm interface;
and compiling the C/C + + algorithm library by using an Emscript compiling tool to generate a wasm algorithm library and a js interface library.
2. The method of claim 1, wherein the wsm algorithm library is a binary file library suffixed with.wsm, and wherein the js interface library is an interface library suffixed with.js.
3. The method according to claim 1 or 2, wherein compiling the C/C + + algorithm library using an emscript compilation tool comprises:
and adding all source files and header files in the C/C + + algorithm library into a compiling module, and adding a wasm export label.
4. A method of rendering a line symbol using an algorithmic module generated according to the method of any of claims 1 to 3, comprising:
receiving the linear symbol name and the control point information through a js interface library;
calling a wasm algorithm library;
the linear symbol names and the control point information are transmitted to a C/C + + algorithm library through a wasm interface;
and calculating by corresponding C/C + + algorithm according to the linear symbol name and the control point information, and outputting a basic line for drawing the linear symbol model.
5. The method according to claim 4, wherein said calculating by a respective C/C + + algorithm class based on said line symbol names and control point information comprises:
searching a corresponding C/C + + algorithm class according to the linear symbol name;
and calculating linear symbols according to the control point information by using the corresponding C/C + + algorithm class.
6. The method of claim 4 or 5, further comprising:
and drawing the three-dimensional model of the linear symbol based on the three-dimensional display platform according to the basic line for drawing the linear symbol model.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910054486.XA CN111459463A (en) | 2019-01-21 | 2019-01-21 | Algorithm module generation method and linear symbol drawing method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910054486.XA CN111459463A (en) | 2019-01-21 | 2019-01-21 | Algorithm module generation method and linear symbol drawing method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111459463A true CN111459463A (en) | 2020-07-28 |
Family
ID=71679096
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910054486.XA Pending CN111459463A (en) | 2019-01-21 | 2019-01-21 | Algorithm module generation method and linear symbol drawing method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111459463A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112269602A (en) * | 2020-11-10 | 2021-01-26 | 深圳晶泰科技有限公司 | WebAssembly loading method and device and storage medium |
CN113254002A (en) * | 2021-07-08 | 2021-08-13 | 企查查科技有限公司 | Component, medium and equipment for improving webpage performance and supporting cross-platform calling |
CN113660208A (en) * | 2021-07-16 | 2021-11-16 | 北京一砂信息技术有限公司 | Browser-based security password authentication service system and method |
WO2022099459A1 (en) * | 2020-11-10 | 2022-05-19 | 深圳晶泰科技有限公司 | Webassembly loading method and apparatus, and storage medium |
CN116643727A (en) * | 2023-05-11 | 2023-08-25 | 北京秒如科技有限公司 | Method and system for detecting programming language and automatically compiling programming language into WASM byte code |
-
2019
- 2019-01-21 CN CN201910054486.XA patent/CN111459463A/en active Pending
Non-Patent Citations (1)
Title |
---|
小枪向前冲: "浅谈WebAssmebly,在浏览器上进行图像处理", pages 1 - 15, Retrieved from the Internet <URL:https://blog.csdn.net/liubiggun/article/details/79848948> * |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112269602A (en) * | 2020-11-10 | 2021-01-26 | 深圳晶泰科技有限公司 | WebAssembly loading method and device and storage medium |
WO2022099459A1 (en) * | 2020-11-10 | 2022-05-19 | 深圳晶泰科技有限公司 | Webassembly loading method and apparatus, and storage medium |
CN112269602B (en) * | 2020-11-10 | 2023-12-29 | 深圳晶泰科技有限公司 | WebAssemble loading method, device and storage medium |
CN113254002A (en) * | 2021-07-08 | 2021-08-13 | 企查查科技有限公司 | Component, medium and equipment for improving webpage performance and supporting cross-platform calling |
CN113660208A (en) * | 2021-07-16 | 2021-11-16 | 北京一砂信息技术有限公司 | Browser-based security password authentication service system and method |
CN113660208B (en) * | 2021-07-16 | 2023-04-07 | 北京一砂信息技术有限公司 | Browser-based security password authentication service system and method |
CN116643727A (en) * | 2023-05-11 | 2023-08-25 | 北京秒如科技有限公司 | Method and system for detecting programming language and automatically compiling programming language into WASM byte code |
CN116643727B (en) * | 2023-05-11 | 2024-02-06 | 北京秒如科技有限公司 | Method and system for detecting programming language and automatically compiling programming language into WASM byte code |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111459463A (en) | Algorithm module generation method and linear symbol drawing method | |
CN111506387B (en) | Page prerendering method and device, electronic equipment and storage medium | |
CN113126990B (en) | Page development method, device, equipment and storage medium | |
CN112527374B (en) | Marking tool generation method, marking device, marking equipment and storage medium | |
CN111428451B (en) | Text online editing method and device, electronic equipment and storage medium | |
CN109144619A (en) | Icon font information processing method, apparatus and system | |
US9507568B2 (en) | Nested communication operator | |
CN116483319A (en) | Operator processing method, device, equipment and medium for software defined chip | |
CN113434147B (en) | Method and device for analyzing message based on ProtoBuf protocol | |
SE533322C2 (en) | Method, module and apparatus for displaying graphical information | |
CN114356962A (en) | Data query method and device, electronic equipment and storage medium | |
CN114398282A (en) | Test script generation method, device, equipment and storage medium | |
CN113934957A (en) | Method and system for generating rendering sketch file from webpage | |
CN111949312B (en) | Packaging method and device for data module, computer equipment and storage medium | |
CN105335141A (en) | Image processing method and apparatus | |
CN107730572A (en) | A kind of chart rendering intent and device | |
CN109446295B (en) | Svg data map editing tool, editing method and computer readable medium | |
CN114897664A (en) | Graph model deployment method and device, GPU (graphics processing Unit) and storage medium | |
CN114047919A (en) | Compiling method based on file difference, storage medium and electronic equipment | |
CN111190581B (en) | Visual flowsheet machine learning and artificial intelligence system | |
CN114222317A (en) | Data processing method and device, electronic equipment and storage medium | |
CN113961279A (en) | Page rendering method, device, server and storage medium | |
CN103455311A (en) | Drawing code generation system and method | |
CN112988397B (en) | Rapid analysis method and conversion server for water conservancy model file | |
CN115546356A (en) | Animation generation method and device, computer equipment and storage medium |
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 |