最近几年来,地理信息系统无论是在理论上还是应用上都处在一个飞速发展的阶段。 GIS被应用于多个领域的建模和决策支持,如城市管理、区划、环境整治等等,地理信息成为信息时代重要的组成部分之一; “数字地球”概念的提出,更进一步推动了作为其技术支撑的GIS的发展。 与此同时,一些学者致力于相关的理论研究,如空间感知、空间数据误差、空间关系的形式化等等。 这恰好说明了地理信息系统作为应用技术和学科的两个方面,并且这两个方面构成了相互促进的发展过程。
Web worker is a JavaScript that runs in the background and does not affect the performance of the page. When a script is executed in a HTML page, the state of the page is unresponsive until the script is complete. Web worker is a JavaScript that runs in the background, independent of other scripts, and does not affect the performance of the page. You can continue to do whatever you want: click, select, and so on, while web worker is running in the background. Internet Explorer 10, Firefox, Chrome, Safari and Opera all support Web workers. The following example creates a simple web worker that counts in the background: Count: Start Worker Stop Worker Before you create a web worker, check if the user’s browser supports it: Now, let’s create our web worker in an external JavaScript. Here, we create a count script. The script is stored in the “demo_workers.js” file: The important part of the above code is Note: web worker is not usually used for such simple scripts, but for tasks that consume more CPU resources. We already have the web worker file, and now we need to call it from the HTML page. The following code detects whether worker exists, and if not,-it creates a new web worker object and then runs the code in “demo_workers.js”: Then we can generate and receive messages from web worker. Add a “onmessage” event listener to web worker: When we create the web worker object, it continues to listen to the message (even after the external script completes) until it is terminated. To terminate web worker and release browser / computer resources, use the We’ve already seen it. count: Note: Internet Explorer 9 and earlier versions of IE browsers do not support Web Workers Because web worker is in an external file, they cannot access the following JavaScript objects: 11.47.1. What is Web Worker? ¶
11.47.2. Browser support ¶
11.47.3. HTML5 Web Workers instance ¶
Example ¶
demo_workers.js file code ¶ var i=0; function timedCount() { i=i+1; postMessage(i); setTimeout("timedCount()",500); } timedCount();
11.47.4. Check whether the browser supports Web Worker ¶
if(typeof(Worker)!=="undefined") { // Yes! Web worker support! // Some code..... } else { //Sorry! Web Worker does not support } 11.47.5. Create a web worker file ¶
var i=0; function timedCount() { i=i+1; postMessage(i); setTimeout("timedCount()",500); } timedCount();
postMessage() method-it is used to return a message to the HTML page. 11.47.6. Create a Web Worker object ¶
if(typeof(w)=="undefined") { w=new Worker("demo_workers.js"); }
w.onmessage=function(event){ document.getElementById("result").innerHTML=event.data; };
11.47.7. Terminating Web Worker ¶
terminate() methods:w.terminate();
11.47.8. Complete Web Worker instance code ¶
.js the Worker code in the file. Here is the code for the HTML page:Example ¶
11.47.9. Web Workers and DOM ¶
window object document object parent object