Changes between Version 10 and Version 11 of ZooWebSite/ZOOAPI/Examples


Ignore:
Timestamp:
Nov 10, 2010, 5:02:26 PM (13 years ago)
Author:
djay
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ZooWebSite/ZOOAPI/Examples

    v10 v11  
    99{{{
    1010#!c
    11 var myProcess = new ZOO.Process('http://localhost/cgi-bin-new1/zoo_loader_new1.cgi','Boundary');
    12 var myInputs = {InputPolygon: { type: 'complex', value: '{"type":"Polygon","coordinates":[[[-106.993853,35.998758],[-107.407233,35.997524],[-107.430525,35.997726],[-107.4824,35.99878],[-108.37013,35.999472],[-109.043633,35.996652],[-109.096265,35.997817],[-109.148763,36.001751],[-109.200981,36.008442],[-109.252775,36.017871],[-109.304,36.030014],[-109.354516,36.044835],[-106.468201,35.991497],[-106.855511,35.989504],[-106.90933,35.990676],[-106.963008,35.994743],[-106.993853,35.998758]]]}', mimeType: "application/json"} };
    13 var myExecuteResult=myProcess.Execute(myInputs);
    14 return {result: ZOO.SERVICE_SUCCEEDED, outputs: [ {name:"Result", value: myExecuteResult} ] };
     11function SampleService(conf,inputs,outputs){
     12   var myProcess = new ZOO.Process('http://localhost/cgi-bin-new1/zoo_loader_new1.cgi','Boundary');
     13   var myInputs = {InputPolygon: { type: 'complex', value: '{"type":"Polygon","coordinates":[[[-106.993853,35.998758],[-107.407233,35.997524],[-107.430525,35.997726],[-107.4824,35.99878],[-108.37013,35.999472],[-109.043633,35.996652],[-109.096265,35.997817],[-109.148763,36.001751],[-109.200981,36.008442],[-109.252775,36.017871],[-109.304,36.030014],[-109.354516,36.044835],[-106.468201,35.991497],[-106.855511,35.989504],[-106.90933,35.990676],[-106.963008,35.994743],[-106.993853,35.998758]]]}', mimeType: "application/json"} };
     14   var myExecuteResult=myProcess.Execute(myInputs);
     15   return {result: ZOO.SERVICE_SUCCEEDED, outputs: [ {name:"Result", value: myExecuteResult} ] };
     16}
    1517}}}
    1618
    1719In this really short example you can see how to create {{{ZOO.Process}}} class instance and call the {{{Execute}}} method on such an instance. Then you'll just need to return a JavaScript object  containing the attributes {{{result}}} and  {{{outputs}}}, which I'm sure you already know what is about. The first is about the status of the process (can be {{{ZOO.SERVICE_SUCEEDED}}},{{{ZOO.SERVICE_FAILED}}} ad so on), the last is obviously the resulting maps (take a look at the {{{maps}}} internal data structure used by ZOO Kernel in service.h).
    18  
     20
     21== ZOO.UpdateStatus ==
     22
     23{{{
     24#!c
     25function SampleLongService(conf,inputs,outputs){
     26   var my_i=0;
     27   while(my_i<100){
     28       try{
     29         conf["lenv"]["status"]=my_i;
     30       }
     31       catch(e){
     32       }
     33       ZOOUpdateStatus(conf,my_i);
     34       SampleService(conf,inputs,outputs);
     35       my_i+=10;
     36   }
     37   return SampleService(conf,inputs,outputs);
     38}
     39}}}
     40

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png