1 | |
---|
2 | |
---|
3 | <!DOCTYPE html> |
---|
4 | <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> |
---|
5 | <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> |
---|
6 | <head> |
---|
7 | <meta charset="utf-8"> |
---|
8 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
---|
9 | |
---|
10 | <title>Example application — ZOO-Project 1.4a0 documentation</title> |
---|
11 | |
---|
12 | <link href="http://fonts.googleapis.com/css?family=Days+One" rel="stylesheet" type="text/css"> |
---|
13 | |
---|
14 | |
---|
15 | |
---|
16 | |
---|
17 | |
---|
18 | |
---|
19 | |
---|
20 | |
---|
21 | <link rel="search" type="application/opensearchdescription+xml" title="Search within ZOO-Project 1.4a0 documentation" href="../_static/opensearch.xml"/> |
---|
22 | |
---|
23 | |
---|
24 | |
---|
25 | |
---|
26 | |
---|
27 | |
---|
28 | <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" /> |
---|
29 | |
---|
30 | |
---|
31 | |
---|
32 | |
---|
33 | |
---|
34 | <link rel="top" title="ZOO-Project 1.4a0 documentation" href="../index.html"/> |
---|
35 | <link rel="up" title="ZOO-Client" href="index.html"/> |
---|
36 | <link rel="next" title="Contributor Guide" href="../contribute/index.html"/> |
---|
37 | <link rel="prev" title="Using ZOO-Client" href="howto.html"/> |
---|
38 | |
---|
39 | |
---|
40 | <script src="_static/js/modernizr.min.js"></script> |
---|
41 | |
---|
42 | </head> |
---|
43 | |
---|
44 | <body class="wy-body-for-nav" role="document"> |
---|
45 | |
---|
46 | <div class="wy-grid-for-nav"> |
---|
47 | |
---|
48 | |
---|
49 | <nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
---|
50 | <div class="wy-side-nav-search"> |
---|
51 | |
---|
52 | |
---|
53 | |
---|
54 | <a class="shrink" href="http://zoo-project.org"><img src="http://zoo-project.org/img/zoo-sun-logo.png" class="img-responsive sun" style="display: inline;"> ZOO</a> |
---|
55 | |
---|
56 | |
---|
57 | |
---|
58 | </a> |
---|
59 | |
---|
60 | |
---|
61 | <div role="search"> |
---|
62 | <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> |
---|
63 | <input type="text" name="q" placeholder="Search docs" /> |
---|
64 | <input type="hidden" name="check_keywords" value="yes" /> |
---|
65 | <input type="hidden" name="area" value="default" /> |
---|
66 | </form> |
---|
67 | </div> |
---|
68 | |
---|
69 | |
---|
70 | </div> |
---|
71 | |
---|
72 | <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> |
---|
73 | |
---|
74 | |
---|
75 | |
---|
76 | <ul class="current"> |
---|
77 | <li class="toctree-l1"><a class="reference internal" href="../intro.html">Introduction</a><ul> |
---|
78 | <li class="toctree-l2"><a class="reference internal" href="../intro.html#what-is-zoo-project">What is ZOO-Project ?</a></li> |
---|
79 | <li class="toctree-l2"><a class="reference internal" href="../intro.html#zoo-project-components">ZOO-Project components</a></li> |
---|
80 | <li class="toctree-l2"><a class="reference internal" href="../intro.html#open-source">Open Source</a></li> |
---|
81 | </ul> |
---|
82 | </li> |
---|
83 | <li class="toctree-l1"><a class="reference internal" href="../install/index.html">ZOO-Project installation</a><ul> |
---|
84 | <li class="toctree-l2"><a class="reference internal" href="../install/install-prerequisites.html">Prerequisites</a></li> |
---|
85 | <li class="toctree-l2"><a class="reference internal" href="../install/install-download.html">Download</a></li> |
---|
86 | <li class="toctree-l2"><a class="reference internal" href="../install/install-confoptions.html">Configure options</a></li> |
---|
87 | <li class="toctree-l2"><a class="reference internal" href="../install/install-installation.html">Installation on Unix/Linux</a></li> |
---|
88 | <li class="toctree-l2"><a class="reference internal" href="../install/install-onwindows.html">Installation on Windows ™</a></li> |
---|
89 | <li class="toctree-l2"><a class="reference internal" href="../install/install-onmacos.html">Installation on MacOSX ™</a></li> |
---|
90 | </ul> |
---|
91 | </li> |
---|
92 | <li class="toctree-l1"><a class="reference internal" href="../kernel/index.html">ZOO-Kernel</a><ul> |
---|
93 | <li class="toctree-l2"><a class="reference internal" href="../kernel/what.html">What is ZOO-Kernel ?</a></li> |
---|
94 | <li class="toctree-l2"><a class="reference internal" href="../kernel/configuration.html">ZOO-Kernel configuration</a></li> |
---|
95 | <li class="toctree-l2"><a class="reference internal" href="../kernel/mapserver.html">Optional MapServer support</a></li> |
---|
96 | <li class="toctree-l2"><a class="reference internal" href="../kernel/orfeotoolbox.html">Optional Orfeo Toolbox support</a></li> |
---|
97 | <li class="toctree-l2"><a class="reference internal" href="../kernel/sagagis.html">Optional SAGA GIS support</a></li> |
---|
98 | </ul> |
---|
99 | </li> |
---|
100 | <li class="toctree-l1"><a class="reference internal" href="../services/index.html">ZOO-Services</a><ul> |
---|
101 | <li class="toctree-l2"><a class="reference internal" href="../services/what.html">What are ZOO-Services ?</a></li> |
---|
102 | <li class="toctree-l2"><a class="reference internal" href="../services/zcfg-reference.html">ZOO-Service configuration file</a></li> |
---|
103 | <li class="toctree-l2"><a class="reference internal" href="../services/process-profiles.html">Process profiles registry</a></li> |
---|
104 | <li class="toctree-l2"><a class="reference internal" href="../services/howtos.html">Create your own ZOO-Services</a></li> |
---|
105 | <li class="toctree-l2"><a class="reference internal" href="../services/status.html">ZOO Status Service</a></li> |
---|
106 | <li class="toctree-l2"><a class="reference internal" href="../services/debug.html">Debugging ZOO Services</a></li> |
---|
107 | <li class="toctree-l2"><a class="reference internal" href="../services/zoo-services.html">Available ZOO-Services</a></li> |
---|
108 | </ul> |
---|
109 | </li> |
---|
110 | <li class="toctree-l1"><a class="reference internal" href="../api/index.html">ZOO-API</a><ul> |
---|
111 | <li class="toctree-l2"><a class="reference internal" href="../api/what.html">What is ZOO-API ?</a></li> |
---|
112 | <li class="toctree-l2"><a class="reference internal" href="../api/howto.html">Using ZOO-API</a></li> |
---|
113 | <li class="toctree-l2"><a class="reference internal" href="../api/classes.html">ZOO-API Classes</a></li> |
---|
114 | <li class="toctree-l2"><a class="reference internal" href="../api/examples.html">Examples</a></li> |
---|
115 | </ul> |
---|
116 | </li> |
---|
117 | <li class="toctree-l1 current"><a class="reference internal" href="index.html">ZOO-Client</a><ul class="current"> |
---|
118 | <li class="toctree-l2"><a class="reference internal" href="what.html">What is ZOO-Client ?</a></li> |
---|
119 | <li class="toctree-l2"><a class="reference internal" href="howto.html">Using ZOO-Client</a></li> |
---|
120 | <li class="toctree-l2 current"><a class="current reference internal" href="">Example application</a></li> |
---|
121 | </ul> |
---|
122 | </li> |
---|
123 | <li class="toctree-l1"><a class="reference internal" href="../contribute/index.html">Contributor Guide</a><ul> |
---|
124 | <li class="toctree-l2"><a class="reference internal" href="../contribute/howto.html">How to contribute ?</a></li> |
---|
125 | <li class="toctree-l2"><a class="reference internal" href="../contribute/code.html">Contribute code</a></li> |
---|
126 | </ul> |
---|
127 | </li> |
---|
128 | </ul> |
---|
129 | |
---|
130 | |
---|
131 | |
---|
132 | </div> |
---|
133 | |
---|
134 | </nav> |
---|
135 | |
---|
136 | <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> |
---|
137 | |
---|
138 | |
---|
139 | <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> |
---|
140 | <i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
---|
141 | <a href="../contents.html">ZOO-Project</a> |
---|
142 | </nav> |
---|
143 | |
---|
144 | |
---|
145 | |
---|
146 | <div class="wy-nav-content"> |
---|
147 | <div class="rst-content"> |
---|
148 | <div role="navigation" aria-label="breadcrumbs navigation"> |
---|
149 | <ul class="wy-breadcrumbs"> |
---|
150 | |
---|
151 | <li><a href="../contents.html"> Docs</a> ∕  </li> |
---|
152 | |
---|
153 | <li><a href="index.html">ZOO-Client</a> ∕  </li> |
---|
154 | |
---|
155 | <li>Example application</li> |
---|
156 | <li class="wy-breadcrumbs-aside"> |
---|
157 | |
---|
158 | <a href="../_sources/client/example.txt" rel="nofollow"> View page source</a> |
---|
159 | |
---|
160 | </li> |
---|
161 | </ul> |
---|
162 | <hr/> |
---|
163 | </div> |
---|
164 | <div role="main" class="document"> |
---|
165 | |
---|
166 | <div class="section" id="example-application"> |
---|
167 | <span id="client-example"></span><h1>Example application<a class="headerlink" href="#example-application" title="Permalink to this headline">¶</a></h1> |
---|
168 | <p>This section gives a detailed example of ZOO-Client based JavaScript appliclation.</p> |
---|
169 | <div class="admonition note"> |
---|
170 | <p class="first admonition-title">Note</p> |
---|
171 | <p class="last">For this example application, first setup a <code class="docutils literal"><span class="pre">/zoo-client-demo</span></code> directory accessible from your web server at <cite>http://localhost/zoo-client-demo</cite>.</p> |
---|
172 | </div> |
---|
173 | <p>The following subdirectories must be created in the <code class="docutils literal"><span class="pre">/zoo-client-demo</span></code> directory:</p> |
---|
174 | <div class="highlight-python"><div class="highlight"><pre><span class="n">assets</span> |
---|
175 | <span class="n">assets</span><span class="o">/</span><span class="n">js</span> |
---|
176 | <span class="n">assets</span><span class="o">/</span><span class="n">js</span><span class="o">/</span><span class="n">lib</span> |
---|
177 | <span class="n">assets</span><span class="o">/</span><span class="n">js</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">hogan</span> |
---|
178 | <span class="n">assets</span><span class="o">/</span><span class="n">js</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">jquery</span> |
---|
179 | <span class="n">assets</span><span class="o">/</span><span class="n">js</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">query</span><span class="o">-</span><span class="n">string</span> |
---|
180 | <span class="n">assets</span><span class="o">/</span><span class="n">js</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">xml2json</span> |
---|
181 | <span class="n">assets</span><span class="o">/</span><span class="n">js</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">zoo</span> |
---|
182 | <span class="n">assets</span><span class="o">/</span><span class="n">tpl</span> |
---|
183 | </pre></div> |
---|
184 | </div> |
---|
185 | <p>You will need to copy your node_modules javascript files copied in the |
---|
186 | <cite>hogan</cite> and <cite>query-string</cite> directories. First, you wil need to install |
---|
187 | query-string.</p> |
---|
188 | <div class="highlight-python"><div class="highlight"><pre>npm install query-string |
---|
189 | </pre></div> |
---|
190 | </div> |
---|
191 | <p>Then you will copy <cite>query-string.js</cite> and <cite>hogan-3.0.2.js</cite> files in |
---|
192 | your <cite>zoo-client-demo</cite> web directory. Those files are located in your |
---|
193 | <cite>~/node_modules</cite> directory.</p> |
---|
194 | <p>For other libraries, you will need to download them from their |
---|
195 | official web sites and uncompress them in the corresponding |
---|
196 | directories.</p> |
---|
197 | <div class="section" id="loading-the-modules-from-your-web-application"> |
---|
198 | <h2>Loading the modules from your web application<a class="headerlink" href="#loading-the-modules-from-your-web-application" title="Permalink to this headline">¶</a></h2> |
---|
199 | <p>Before using the ZOO-Client, you will first have to include the |
---|
200 | javascript files from your web page. With the use of requirejs you |
---|
201 | will need only one line in your HTML page to include everything at |
---|
202 | once. This line will look like the following:</p> |
---|
203 | <div class="highlight-python"><div class="highlight"><pre><script data-main="assets/js/first" src="assets/js/lib/require.js"></script> |
---|
204 | </pre></div> |
---|
205 | </div> |
---|
206 | <p>In this example, we suppose that you have created a <cite>first.js</cite> file |
---|
207 | in the <cite>assets/js</cite> directory containing your main application |
---|
208 | code. First, you define there the required JavaScript libraries and |
---|
209 | potentially their configuration, then you can add any relevant code.</p> |
---|
210 | <div class="highlight-javascript"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1 |
---|
211 | 2 |
---|
212 | 3 |
---|
213 | 4 |
---|
214 | 5 |
---|
215 | 6 |
---|
216 | 7 |
---|
217 | 8 |
---|
218 | 9 |
---|
219 | 10 |
---|
220 | 11 |
---|
221 | 12 |
---|
222 | 13 |
---|
223 | 14 |
---|
224 | 15 |
---|
225 | 16 |
---|
226 | 17 |
---|
227 | 18 |
---|
228 | 19 |
---|
229 | 20 |
---|
230 | 21 |
---|
231 | 22 |
---|
232 | 23 |
---|
233 | 24 |
---|
234 | 25 |
---|
235 | 26 |
---|
236 | 27 |
---|
237 | 28 |
---|
238 | 29 |
---|
239 | 30 |
---|
240 | 31 |
---|
241 | 32 |
---|
242 | 33 |
---|
243 | 34 |
---|
244 | 35 |
---|
245 | 36 |
---|
246 | 37 |
---|
247 | 38 |
---|
248 | 39 |
---|
249 | 40 |
---|
250 | 41 |
---|
251 | 42 |
---|
252 | 43 |
---|
253 | 44 |
---|
254 | 45 |
---|
255 | 46 |
---|
256 | 47 |
---|
257 | 48</pre></div></td><td class="code"><div class="highlight"><pre><span class="nx">requirejs</span><span class="p">.</span><span class="nx">config</span><span class="p">({</span> |
---|
258 | <span class="nx">baseUrl</span><span class="o">:</span> <span class="s1">'assets/js'</span><span class="p">,</span> |
---|
259 | <span class="nx">paths</span><span class="o">:</span> <span class="p">{</span> |
---|
260 | <span class="nx">jquery</span><span class="o">:</span> <span class="s1">'lib/jquery/jquery-1.11.0.min'</span><span class="p">,</span> |
---|
261 | <span class="nx">hogan</span><span class="o">:</span> <span class="s1">'lib/hogan/hogan-3.0.2'</span><span class="p">,</span> |
---|
262 | <span class="nx">xml2json</span><span class="o">:</span> <span class="s1">'lib/xml2json/xml2json.min'</span><span class="p">,</span> |
---|
263 | <span class="nx">queryString</span><span class="o">:</span> <span class="s1">'lib/query-string/query-string'</span><span class="p">,</span> |
---|
264 | <span class="nx">wpsPayloads</span><span class="o">:</span> <span class="s1">'lib/zoo/payloads'</span><span class="p">,</span> |
---|
265 | <span class="nx">wpsPayload</span><span class="o">:</span> <span class="s1">'lib/zoo/wps-payload'</span><span class="p">,</span> |
---|
266 | <span class="nx">utils</span><span class="o">:</span> <span class="s1">'lib/zoo/utils'</span><span class="p">,</span> |
---|
267 | <span class="nx">zoo</span><span class="o">:</span> <span class="s1">'lib/zoo/zoo'</span><span class="p">,</span> |
---|
268 | <span class="nx">domReady</span><span class="o">:</span> <span class="s1">'lib/domReady'</span><span class="p">,</span> |
---|
269 | <span class="nx">app</span><span class="o">:</span> <span class="s1">'first-app'</span><span class="p">,</span> |
---|
270 | <span class="p">},</span> |
---|
271 | <span class="nx">shim</span><span class="o">:</span> <span class="p">{</span> |
---|
272 | <span class="nx">wpsPayloads</span><span class="o">:</span> <span class="p">{</span> |
---|
273 | <span class="nx">deps</span><span class="o">:</span> <span class="p">[</span><span class="s1">'hogan'</span><span class="p">],</span> |
---|
274 | <span class="p">},</span> |
---|
275 | <span class="nx">wpsPayload</span><span class="o">:</span> <span class="p">{</span> |
---|
276 | <span class="nx">deps</span><span class="o">:</span> <span class="p">[</span><span class="s1">'wpsPayloads'</span><span class="p">],</span> |
---|
277 | <span class="nx">exports</span><span class="o">:</span> <span class="s1">'wpsPayload'</span><span class="p">,</span> |
---|
278 | <span class="p">},</span> |
---|
279 | <span class="nx">hogan</span><span class="o">:</span> <span class="p">{</span> |
---|
280 | <span class="nx">exports</span><span class="o">:</span> <span class="s1">'Hogan'</span><span class="p">,</span> |
---|
281 | <span class="p">},</span> |
---|
282 | <span class="nx">xml2json</span><span class="o">:</span> <span class="p">{</span> |
---|
283 | <span class="nx">exports</span><span class="o">:</span> <span class="s2">"X2JS"</span><span class="p">,</span> |
---|
284 | <span class="p">},</span> |
---|
285 | <span class="nx">queryString</span><span class="o">:</span> <span class="p">{</span> |
---|
286 | <span class="nx">exports</span><span class="o">:</span> <span class="s1">'queryString'</span><span class="p">,</span> |
---|
287 | <span class="p">},</span> |
---|
288 | <span class="p">},</span> |
---|
289 | <span class="p">});</span> |
---|
290 | |
---|
291 | <span class="nx">requirejs</span><span class="p">.</span><span class="nx">config</span><span class="p">({</span> |
---|
292 | <span class="nx">config</span><span class="o">:</span> <span class="p">{</span> |
---|
293 | <span class="nx">app</span><span class="o">:</span> <span class="p">{</span> |
---|
294 | <span class="nx">url</span><span class="o">:</span> <span class="s1">'/cgi-bin/zoo_loader.cgi'</span><span class="p">,</span> |
---|
295 | <span class="nx">delay</span><span class="o">:</span> <span class="mi">2000</span><span class="p">,</span> |
---|
296 | <span class="p">}</span> |
---|
297 | <span class="p">}</span> |
---|
298 | <span class="p">});</span> |
---|
299 | |
---|
300 | <span class="nx">require</span><span class="p">([</span><span class="s1">'domReady'</span><span class="p">,</span> <span class="s1">'app'</span><span class="p">],</span> <span class="kd">function</span><span class="p">(</span><span class="nx">domReady</span><span class="p">,</span> <span class="nx">app</span><span class="p">)</span> <span class="p">{</span> |
---|
301 | <span class="nx">domReady</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span> <span class="p">{</span> |
---|
302 | <span class="nx">app</span><span class="p">.</span><span class="nx">initialize</span><span class="p">();</span> |
---|
303 | <span class="p">});</span> |
---|
304 | <span class="p">});</span> |
---|
305 | </pre></div> |
---|
306 | </td></tr></table></div> |
---|
307 | <p>On line 2, you define the url where your files are located on the web |
---|
308 | server, in <cite>assets/js</cite>. From line 3 to 14, you define the JavaScript |
---|
309 | files to be loaded. From line 15 to 21, you configure the dependencies |
---|
310 | and exported symbols. From line 35 to 42, you configure your main |
---|
311 | application.</p> |
---|
312 | <p>In this application, we use the <a class="reference external" href="http://github.com/requirejs/domReady">domReady</a> module to call the |
---|
313 | <cite>initialize</cite> function defined in the <cite>app</cite> module, which is defined in |
---|
314 | the <cite>first-app.js</cite> file as defined on line 13.</p> |
---|
315 | <div class="highlight-javascript"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1 |
---|
316 | 2 |
---|
317 | 3 |
---|
318 | 4 |
---|
319 | 5 |
---|
320 | 6 |
---|
321 | 7 |
---|
322 | 8 |
---|
323 | 9 |
---|
324 | 10 |
---|
325 | 11 |
---|
326 | 12 |
---|
327 | 13 |
---|
328 | 14 |
---|
329 | 15 |
---|
330 | 16 |
---|
331 | 17 |
---|
332 | 18 |
---|
333 | 19 |
---|
334 | 20 |
---|
335 | 21 |
---|
336 | 22 |
---|
337 | 23 |
---|
338 | 24 |
---|
339 | 25 |
---|
340 | 26 |
---|
341 | 27 |
---|
342 | 28 |
---|
343 | 29 |
---|
344 | 30 |
---|
345 | 31 |
---|
346 | 32 |
---|
347 | 33 |
---|
348 | 34 |
---|
349 | 35 |
---|
350 | 36 |
---|
351 | 37 |
---|
352 | 38 |
---|
353 | 39 |
---|
354 | 40 |
---|
355 | 41 |
---|
356 | 42 |
---|
357 | 43 |
---|
358 | 44 |
---|
359 | 45 |
---|
360 | 46</pre></div></td><td class="code"><div class="highlight"><pre><span class="nx">define</span><span class="p">([</span> |
---|
361 | <span class="s1">'module'</span><span class="p">,</span><span class="s1">'zoo'</span><span class="p">,</span><span class="s1">'wpsPayload'</span> |
---|
362 | <span class="p">],</span> <span class="kd">function</span><span class="p">(</span><span class="nx">module</span><span class="p">,</span> <span class="nx">ZooProcess</span><span class="p">,</span> <span class="nx">wpsPayload</span><span class="p">)</span> <span class="p">{</span> |
---|
363 | |
---|
364 | <span class="kd">var</span> <span class="nx">myZooObject</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">ZooProcess</span><span class="p">({</span> |
---|
365 | <span class="nx">url</span><span class="o">:</span> <span class="nx">module</span><span class="p">.</span><span class="nx">config</span><span class="p">().</span><span class="nx">url</span><span class="p">,</span> |
---|
366 | <span class="nx">delay</span><span class="o">:</span> <span class="nx">module</span><span class="p">.</span><span class="nx">config</span><span class="p">().</span><span class="nx">delay</span><span class="p">,</span> |
---|
367 | <span class="p">});</span> |
---|
368 | |
---|
369 | <span class="kd">var</span> <span class="nx">initialize</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span> |
---|
370 | <span class="nx">self</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span> |
---|
371 | <span class="nx">myZooObject</span><span class="p">.</span><span class="nx">getCapabilities</span><span class="p">({</span> |
---|
372 | <span class="nx">type</span><span class="o">:</span> <span class="s1">'POST'</span><span class="p">,</span> |
---|
373 | <span class="nx">success</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">data</span><span class="p">){</span> |
---|
374 | <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">data</span><span class="p">);</span> |
---|
375 | <span class="p">}</span> |
---|
376 | <span class="p">});</span> |
---|
377 | |
---|
378 | <span class="nx">myZooObject</span><span class="p">.</span><span class="nx">describeProcess</span><span class="p">({</span> |
---|
379 | <span class="nx">type</span><span class="o">:</span> <span class="s1">'POST'</span><span class="p">,</span> |
---|
380 | <span class="nx">identifier</span><span class="o">:</span> <span class="s2">"all"</span><span class="p">,</span> |
---|
381 | <span class="nx">success</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">data</span><span class="p">){</span> |
---|
382 | <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">data</span><span class="p">);</span> |
---|
383 | <span class="p">}</span> |
---|
384 | <span class="p">});</span> |
---|
385 | |
---|
386 | <span class="nx">myZooObject</span><span class="p">.</span><span class="nx">execute</span><span class="p">({</span> |
---|
387 | <span class="nx">identifier</span><span class="o">:</span> <span class="s2">"Buffer"</span><span class="p">,</span> |
---|
388 | <span class="nx">dataInputs</span><span class="o">:</span> <span class="p">[{</span><span class="s2">"identifier"</span><span class="o">:</span><span class="s2">"InputPolygon"</span><span class="p">,</span><span class="s2">"href"</span><span class="o">:</span><span class="s2">"XXX"</span><span class="p">,</span><span class="s2">"mimeType"</span><span class="o">:</span><span class="s2">"text/xml"</span><span class="p">}],</span> |
---|
389 | <span class="nx">dataOutputs</span><span class="o">:</span> <span class="p">[{</span><span class="s2">"identifier"</span><span class="o">:</span><span class="s2">"Result"</span><span class="p">,</span><span class="s2">"mimeType"</span><span class="o">:</span><span class="s2">"application/json"</span><span class="p">,</span><span class="s2">"type"</span><span class="o">:</span><span class="s2">"raw"</span><span class="p">}],</span> |
---|
390 | <span class="nx">type</span><span class="o">:</span> <span class="s1">'POST'</span><span class="p">,</span> |
---|
391 | <span class="nx">success</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">data</span><span class="p">)</span> <span class="p">{</span> |
---|
392 | <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">data</span><span class="p">);</span> |
---|
393 | <span class="p">},</span> |
---|
394 | <span class="nx">error</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">data</span><span class="p">){</span> |
---|
395 | <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">data</span><span class="p">);</span> |
---|
396 | <span class="p">}</span> |
---|
397 | <span class="p">});</span> |
---|
398 | <span class="p">}</span> |
---|
399 | |
---|
400 | <span class="c1">// Return public methods</span> |
---|
401 | <span class="k">return</span> <span class="p">{</span> |
---|
402 | <span class="nx">initialize</span><span class="o">:</span> <span class="nx">initialize</span> |
---|
403 | <span class="p">};</span> |
---|
404 | |
---|
405 | <span class="p">});</span> |
---|
406 | </pre></div> |
---|
407 | </td></tr></table></div> |
---|
408 | <p>On line 5 you create a “global” <cite>ZooProcess</cite> instance named |
---|
409 | <cite>myZooObject</cite>, you set the <cite>url</cite> and <cite>delay</cite> to the values defined in |
---|
410 | <cite>first.js</cite> on line 35. From line 10 to 40, you define a simple |
---|
411 | <cite>initialize</cite> function which will invoke the <cite>getCapabilities</cite> (line |
---|
412 | 12 to 18), <cite>describeProcess</cite> (from line 20 to 26) and <cite>execute</cite> (from |
---|
413 | line 28 to 39) methods. For each you define a callback function which |
---|
414 | will simply display the resulting data in the browser’s console.</p> |
---|
415 | </div> |
---|
416 | </div> |
---|
417 | |
---|
418 | |
---|
419 | </div> |
---|
420 | <footer> |
---|
421 | |
---|
422 | <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> |
---|
423 | |
---|
424 | <a href="../contribute/index.html" class="btn btn-neutral float-right" title="Contributor Guide">Next <span class="fa fa-arrow-circle-right"></span></a> |
---|
425 | |
---|
426 | |
---|
427 | <a href="howto.html" class="btn btn-neutral" title="Using ZOO-Client"><span class="fa fa-arrow-circle-left"></span> Previous</a> |
---|
428 | |
---|
429 | </div> |
---|
430 | |
---|
431 | |
---|
432 | <hr/> |
---|
433 | <div class="pfoot"> |
---|
434 | <div role="contentinfo"> |
---|
435 | <p> |
---|
436 | © Copyright 2009-2015, ZOO-Project team. |
---|
437 | </p> |
---|
438 | </div> |
---|
439 | Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> inspired by <a href="https://readthedocs.org">Read the Docs</a>. |
---|
440 | </div> |
---|
441 | </footer> |
---|
442 | |
---|
443 | </div> |
---|
444 | </div> |
---|
445 | |
---|
446 | </section> |
---|
447 | |
---|
448 | </div> |
---|
449 | |
---|
450 | |
---|
451 | |
---|
452 | |
---|
453 | |
---|
454 | <script type="text/javascript"> |
---|
455 | var DOCUMENTATION_OPTIONS = { |
---|
456 | URL_ROOT:'../', |
---|
457 | VERSION:'1.4a0', |
---|
458 | COLLAPSE_INDEX:false, |
---|
459 | FILE_SUFFIX:'.html', |
---|
460 | HAS_SOURCE: true |
---|
461 | }; |
---|
462 | </script> |
---|
463 | <script type="text/javascript" src="../_static/jquery.js"></script> |
---|
464 | <script type="text/javascript" src="../_static/underscore.js"></script> |
---|
465 | <script type="text/javascript" src="../_static/doctools.js"></script> |
---|
466 | |
---|
467 | |
---|
468 | |
---|
469 | |
---|
470 | |
---|
471 | <script type="text/javascript" src="../_static/js/theme.js"></script> |
---|
472 | |
---|
473 | |
---|
474 | |
---|
475 | |
---|
476 | <script type="text/javascript"> |
---|
477 | jQuery(function () { |
---|
478 | SphinxRtdTheme.StickyNav.enable(); |
---|
479 | }); |
---|
480 | </script> |
---|
481 | |
---|
482 | |
---|
483 | </body> |
---|
484 | </html> |
---|