TableAjaxMap.php 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206
  1. <?php
  2. /**
  3. * usage:
  4. *
  5. <script>
  6. jQuery('#TreeTableMap').TableAjaxMap({
  7. wpsUrl: 'http://biuro.biall-net.pl/wps',
  8. wfsUrl: 'http://biuro.biall-net.pl/wps'
  9. });
  10. </script>
  11. *
  12. */
  13. class TableAjaxMap {
  14. private $_acl;
  15. private $_zasobID;
  16. private $_width;
  17. private $_height;
  18. public function __construct($tblAcl, $width = 512, $height = 256) {
  19. $this->_acl = $tblAcl;
  20. $this->_zasobID = $tblAcl->getID();
  21. $this->_width = $width;
  22. $this->_height = $height;
  23. }
  24. public function printCSS() {
  25. // <link rel="stylesheet" href="stuff/open-layers/theme/default/style.css" type="text/css">
  26. // <link rel="stylesheet" href="stuff/open-layers/style.css" type="text/css">
  27. ?>
  28. <style type="text/css">
  29. .TableAjaxMap { width:100%; height:<?php echo $this->_height; ?>px; }
  30. .olControlEditingToolbar .olControlModifyFeatureItemInactive { background-image:url(stuff/open-layers/theme/default/img/draw_point_off.png); }
  31. .olControlEditingToolbar .olControlModifyFeatureItemActive { background-image:url(stuff/open-layers/theme/default/img/draw_point_on.png); }
  32. .olControlEditingToolbar .olControlRefreshItemInactive { background-image: url(stuff/open-layers/theme/default/img/refresh_feature_off.png); }
  33. .olControlEditingToolbar .olControlRefreshItemActive { background-image: url(stuff/open-layers/theme/default/img/refresh_feature_on.png); }
  34. .olControlEditingToolbar .olControlSaveItemInactive { background-image: url(stuff/open-layers/theme/default/img/save_features_off.png); }
  35. .olControlEditingToolbar .olControlSaveItemActive { background-image: url(stuff/open-layers/theme/default/img/save_features_on.png); }
  36. .olControlLayerSwitcher .layersDiv { border-radius:10px 0 0 10px; opacity:0.75; filter:alpha(opacity=75); }
  37. .notsupported { color:red; }
  38. .TableAjaxMap .layersDiv input { margin:0; }
  39. .TableAjaxMap .layersDiv label { display:inline; }
  40. </style>
  41. <?php
  42. }
  43. public function printJS() {
  44. ?>
  45. <script src="stuff/open-layers/OpenLayers.js"></script>
  46. <script>
  47. OpenLayers.ProxyHost = "index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_cls=<?php echo __CLASS__; ?>&_task=PROXY&url=";
  48. (function( $ ) {
  49. var TableAjaxMap = function() {
  50. var priv = {}; //private api
  51. var publ = {}; //public api
  52. priv.options = {};
  53. var defaults = {
  54. wpsUrl: '',
  55. wfsUrl: '',
  56. layerName: 'Warstwa rysowania',
  57. onfeatureselect: null,
  58. onfeatureunselect: null,
  59. debug: false
  60. };
  61. var _nodeMapId;
  62. var _nodeMap;
  63. var _nodeProcesses;
  64. var _nodeAbstract;
  65. var _nodeInput;
  66. var _nodeOutput;
  67. var _capabilities;
  68. var _process;
  69. var _layer;
  70. var _map;
  71. /*
  72. initialize the plugin.
  73. */
  74. priv.init = function() {
  75. console.log('test jQuery plugin init...', priv);
  76. // create dom:
  77. /*
  78. <div id="map" class="TableAjaxMap"></div>
  79. <div>
  80. <select id="processes"><option>Select a process</option></select>
  81. <p id="abstract"></p>
  82. <div id="input"></div>
  83. <div id="output"></div>
  84. </div>
  85. */
  86. _nodeMapId = 'Map-' + Math.random(1).toString().substr(2);
  87. _nodeMap = $('<div id="' + _nodeMapId + '" class="TableAjaxMap"></div>');
  88. _nodeProcesses = $('<select></select>');
  89. _nodeProcesses.append('<option>Wybierz funkcję</option>');
  90. _nodeAbstract = $('<p></p>');
  91. _nodeInput = $('<div></div>');
  92. _nodeOutput = $('<div></div>');
  93. _selectedFeature = null;
  94. _selectedRecordId = 0;
  95. var div = $('<div></div>');
  96. div.append(_nodeProcesses);
  97. div.append(_nodeAbstract);
  98. div.append(_nodeInput);
  99. div.append(_nodeOutput);
  100. $(priv.options.id).append(_nodeMap);
  101. $(priv.options.id).append(div);
  102. _nodeProcesses.on('change', function() {
  103. console.log("onchange this:", this, this.selectedIndex, this.options);
  104. var selection = this.options[this.selectedIndex].value;
  105. if (this.selectedIndex > 0) {
  106. OpenLayers.Request.GET({
  107. url: priv.options.wpsUrl,
  108. params: {
  109. "SERVICE": "WPS",
  110. "REQUEST": "DescribeProcess",
  111. "VERSION": _capabilities.version,
  112. "IDENTIFIER": selection
  113. },
  114. success: function(response) {
  115. _process = new OpenLayers.Format.WPSDescribeProcess().read(
  116. response.responseText
  117. ).processDescriptions[selection];
  118. console.log("Process:", _process);
  119. priv.buildForm();
  120. }
  121. });
  122. }
  123. });
  124. priv.getCapabilities();
  125. _layer = new OpenLayers.Layer.Vector(priv.options.layerName, {
  126. strategies: [new OpenLayers.Strategy.BBOX()],
  127. projection: new OpenLayers.Projection("EPSG:900913"),
  128. protocol: new OpenLayers.Protocol.WFS({
  129. version: "1.1.0",
  130. srsName: "EPSG:900913",
  131. url: priv.options.wfsUrl,
  132. featureNS : "http://opengeo.org",
  133. featureType: "restricted",
  134. geometryName: "the_geom",
  135. schema: "http://demo.opengeo.org/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=og:restricted"
  136. }),
  137. styleMap: new OpenLayers.StyleMap({
  138. 'default': new OpenLayers.Style(null, {
  139. rules: [
  140. new OpenLayers.Rule({
  141. symbolizer: {
  142. stroke: true,
  143. fill: true,
  144. fillColor: "#90EE90",
  145. strokeColor: "#90EE90",
  146. }
  147. })
  148. , new OpenLayers.Rule({
  149. symbolizer: {
  150. stroke: true,
  151. fill: true,
  152. fillColor: "#ee9900",
  153. strokeColor: "#ee9900",
  154. },
  155. filter: new OpenLayers.Filter.Comparison({
  156. type: OpenLayers.Filter.Comparison.GREATER_THAN,
  157. property: "recordId",
  158. value: 0
  159. })
  160. })
  161. , new OpenLayers.Rule({
  162. symbolizer: {
  163. stroke: true,
  164. fill: true,
  165. fillColor: "#ff0000",
  166. strokeColor: "#ff0000",
  167. },
  168. filter: new OpenLayers.Filter.Comparison({
  169. type: OpenLayers.Filter.Comparison.GREATER_THAN,
  170. property: "_newRecordId",
  171. value: 0
  172. })
  173. })
  174. , new OpenLayers.Rule({
  175. symbolizer: {
  176. stroke: true,
  177. fill: true,
  178. fillColor: "#ff0000",
  179. strokeColor: "#ff0000",
  180. },
  181. filter: new OpenLayers.Filter.Comparison({
  182. type: OpenLayers.Filter.Comparison.GREATER_THAN,
  183. property: "_modified",
  184. value: 0
  185. })
  186. })
  187. ]
  188. })
  189. })
  190. });
  191. _layer.events.on({
  192. 'featureselected': function(feature) {
  193. console.log('_layer onfeatureselect (',this.selectedFeatures.length,'): ', this);
  194. //document.getElementById('counter').innerHTML = this.selectedFeatures.length;
  195. if (typeof priv.options.onfeatureselect == "function") {
  196. priv.options.onfeatureselect.apply(this);
  197. }
  198. },
  199. 'featureunselected': function(feature) {
  200. console.log('_layer onfeatureselect (',this.selectedFeatures.length,'): ', this);
  201. if (typeof priv.options.onfeatureunselect == "function") {
  202. priv.options.onfeatureunselect.apply(this);
  203. }
  204. }
  205. });
  206. _layer.events.on({
  207. 'beforefeaturemodified': function(e) {
  208. console.log('Event: beforefeaturemodified modified(', e.feature.attributes._modified, ')', e.feature.attributes, ' selAttras', (_selectedFeature)? _selectedFeature.attributes : 'null');// TODO: DBG
  209. // NOTE: beforefeaturemodified from new node is fired before afterfeaturemodified from old node when click from one shape to enother
  210. priv.checkSelectedFeatureModifications('before');
  211. priv.setSelectedFeature(e.feature);
  212. },
  213. 'featuremodified': function(e) {
  214. console.log('Event: featuremodified modified(', e.feature.attributes._modified, ') ', e.feature.attributes, ' selAttras', (_selectedFeature)? _selectedFeature.attributes : 'null');// TODO: DBG
  215. _selectedFeature.attributes._modified = 1;
  216. },
  217. 'afterfeaturemodified': function(e) {
  218. console.log('Event: afterfeaturemodified fid('+e.feature.fid+'/'+(_selectedFeature ? _selectedFeature.fid : 'null')+') modified(', e.feature.attributes._modified, ') ', e.feature.attributes, ' selAttras', (_selectedFeature)? _selectedFeature.attributes : 'null');// TODO: DBG
  219. if (_selectedFeature && _selectedFeature.fid != e.feature.fid) {
  220. console.log('Event: afterfeaturemodified pomiń check!');
  221. } else {
  222. priv.checkSelectedFeatureModifications('after');
  223. priv.setSelectedFeature(null);
  224. }
  225. }
  226. });
  227. var toolbar = new OpenLayers.Control.EditingToolbar(_layer);
  228. toolbar.addControls([
  229. new OpenLayers.Control.ModifyFeature(_layer, {
  230. title: "Edytuj"
  231. , mode: OpenLayers.Control.ModifyFeature.DRAG | OpenLayers.Control.ModifyFeature.RESHAPE
  232. })
  233. ]);
  234. toolbar.addControls([
  235. new OpenLayers.Control.SelectFeature(_layer, {
  236. title: "Select Test",
  237. clickout: false,
  238. toggle: false,
  239. multiple: false,
  240. hover: false,
  241. toggleKey: "ctrlKey", // ctrl key removes from selection
  242. multipleKey: "shiftKey", // shift key adds to selection
  243. box: true
  244. })
  245. ]);
  246. toolbar.addControls([
  247. new OpenLayers.Control.Button({
  248. title: "Refresh",
  249. displayClass: "olControlRefresh",
  250. trigger: function() {
  251. _layer.refresh({force: true});
  252. }
  253. })
  254. ]);
  255. toolbar.addControls([
  256. new OpenLayers.Control.Button({
  257. title: "Test mark as recordId 999",
  258. displayClass: "olControlSave",
  259. trigger: function() {
  260. if (_selectedFeature) {
  261. if (!_selectedRecordId) {
  262. alert('Select Record from table');
  263. }
  264. else {
  265. _selectedFeature.attributes['tblId'] = <?php echo $this->_zasobID; ?>;
  266. _selectedFeature.attributes['recordId'] = _selectedRecordId;
  267. }
  268. }
  269. else {
  270. alert('Select feature')
  271. }
  272. }
  273. })
  274. ]);
  275. var extent = new OpenLayers.Bounds(
  276. 2035059.4410645328, 7200979.560689885, 2113330.958028555, 7279251.0776539035
  277. );
  278. var gphy = new OpenLayers.Layer.OSM("Mapa", null, {
  279. resolutions: [156543.03390625, 78271.516953125, 39135.7584765625,
  280. 19567.87923828125, 9783.939619140625, 4891.9698095703125,
  281. 2445.9849047851562, 1222.9924523925781, 611.4962261962891,
  282. 305.74811309814453, 152.87405654907226, 76.43702827453613,
  283. 38.218514137268066, 19.109257068634033, 9.554628534317017,
  284. 4.777314267158508, 2.388657133579254, 1.194328566789627,
  285. 0.5971642833948135, 0.25, 0.1, 0.05],
  286. serverResolutions: [156543.03390625, 78271.516953125, 39135.7584765625,
  287. 19567.87923828125, 9783.939619140625,
  288. 4891.9698095703125, 2445.9849047851562,
  289. 1222.9924523925781, 611.4962261962891,
  290. 305.74811309814453, 152.87405654907226,
  291. 76.43702827453613, 38.218514137268066,
  292. 19.109257068634033, 9.554628534317017,
  293. 4.777314267158508, 2.388657133579254,
  294. 1.194328566789627, 0.5971642833948135],
  295. transitionEffect: 'resize'
  296. });
  297. _map = new OpenLayers.Map(_nodeMapId, {
  298. projection: new OpenLayers.Projection("EPSG:900913"),
  299. displayProjection: new OpenLayers.Projection("EPSG:4326"),
  300. restrictedExtent: extent,
  301. controls: [
  302. toolbar,
  303. new OpenLayers.Control.ZoomPanel(),
  304. new OpenLayers.Control.PanPanel(),
  305. new OpenLayers.Control.LayerSwitcher(),
  306. new OpenLayers.Control.ScaleLine(),
  307. new OpenLayers.Control.KeyboardDefaults()
  308. ],
  309. layers: [gphy,_layer]
  310. });
  311. _map.zoomToMaxExtent();
  312. };
  313. priv.updateState = function() {
  314. // TODO: update state view
  315. //console.log('updateState: _selectedFeature:', _selectedFeature, ' _selectedRecordId:', _selectedRecordId);
  316. if (_selectedFeature || _selectedRecordId) {
  317. } else {
  318. }
  319. };
  320. priv.setSelectedFeature = function(feature) {
  321. _selectedFeature = feature;
  322. priv.updateState();
  323. };
  324. priv.setSelectedRecordId = function(id) {
  325. _selectedRecordId = id;
  326. priv.updateState();
  327. };
  328. priv.getSelectedRecordId = function() {
  329. return _selectedRecordId;
  330. };
  331. priv.isSelectedRecordId = function() {
  332. return _selectedRecordId > 0;
  333. };
  334. priv.isSelectedFeature = function() {
  335. return !!_selectedFeature;
  336. };
  337. priv.cancelSelectedFeatureModifications = function() {
  338. if (!_selectedFeature) return false;
  339. if (_selectedFeature.attributes._newRecordId) {
  340. delete _selectedFeature.attributes._newRecordId;
  341. }
  342. if (_selectedFeature.attributes._modified) {
  343. delete _selectedFeature.attributes._modified;
  344. }
  345. };
  346. priv.isSelectedFeatureModified = function() {
  347. if (!_selectedFeature) return false;
  348. if (_selectedFeature.attributes) {
  349. if (_selectedFeature.attributes._newRecordId) {
  350. return true;
  351. }
  352. if (_selectedFeature.attributes._modified) {
  353. return true;
  354. }
  355. }
  356. };
  357. priv.checkSelectedFeatureModifications = function(when) {
  358. if (priv.isSelectedFeatureModified()) {
  359. if (confirm('Anulować zmiany wprowadzone dla zaznaczonego elementu?' + when)) {
  360. priv.cancelSelectedFeatureModifications();
  361. _layer.refresh({force:true});
  362. }
  363. else {
  364. // _layer.refresh();
  365. }
  366. }
  367. };
  368. // using OpenLayers.Format.WPSCapabilities to read the capabilities
  369. priv.getCapabilities = function() {
  370. OpenLayers.Request.GET({
  371. url: priv.options.wpsUrl,
  372. params: {
  373. "SERVICE": "WPS",
  374. "REQUEST": "GetCapabilities"
  375. },
  376. success: function(response){
  377. _capabilities = new OpenLayers.Format.WPSCapabilities().read(
  378. response.responseText
  379. );
  380. var dropdown = _nodeProcesses;
  381. var offerings = _capabilities.processOfferings, option;
  382. // populate the dropdown
  383. for (var p in offerings) {
  384. option = document.createElement("option");
  385. option.innerHTML = offerings[p].identifier;
  386. option.value = p;
  387. dropdown.append(option);
  388. }
  389. }
  390. });
  391. };
  392. priv.buildForm = function() {
  393. _nodeAbstract.html(_process["abstract"]);
  394. _nodeInput.html("<h3>Input:</h3>");
  395. _nodeOutput.html('');
  396. var inputs = _process.dataInputs, supported = true,
  397. sld = "text/xml; subtype=sld/1.0.0",
  398. input;
  399. for (var i = 0, ii = inputs.length; i < ii; ++i) {
  400. input = inputs[i];
  401. if (input.complexData) {
  402. var formats = input.complexData.supported.formats;
  403. if (formats["application/wkt"]) {
  404. priv.addWKTInput(input);
  405. } else if (formats["text/xml; subtype=wfs-collection/1.0"]) {
  406. priv.addWFSCollectionInput(input);
  407. } else if (formats["image/tiff"]) {
  408. //priv.addRasterInput(input);
  409. } else if (formats[sld]) {
  410. priv.addXMLInput(input, sld);
  411. } else {
  412. supported = false;
  413. }
  414. } else if (input.boundingBoxData) {
  415. priv.addBoundingBoxInput(input);
  416. } else if (input.literalData) {
  417. priv.addLiteralInput(input);
  418. } else {
  419. supported = false;
  420. }
  421. if (input.minOccurs > 0) {
  422. _nodeInput.append(document.createTextNode("* "));
  423. }
  424. }
  425. if (supported) {
  426. var executeButton = document.createElement("button");
  427. executeButton.innerHTML = "Execute";
  428. _nodeInput.append(executeButton);
  429. executeButton.onclick = priv.execute;
  430. } else {
  431. _nodeInput.html('<span class="notsupported">' +
  432. "Sorry, the WPS builder does not support the selected process." +
  433. "</span>");
  434. }
  435. };
  436. // helper function to dynamically create a textarea for geometry (WKT) data
  437. // input
  438. priv.addWKTInput = function(input, previousSibling) {
  439. var name = input.identifier;
  440. var container = _nodeInput.get(0);
  441. var label = document.createElement("label");
  442. label["for"] = name;
  443. label.title = input["abstract"];
  444. label.innerHTML = name + " (select feature, then click field):";
  445. previousSibling && previousSibling.nextSibling ?
  446. container.insertBefore(label, previousSibling.nextSibling) :
  447. container.appendChild(label);
  448. var field = document.createElement("textarea");
  449. field.onclick = function () {
  450. if (_layer.selectedFeatures.length) {
  451. this.innerHTML = new OpenLayers.Format.WKT().write(
  452. _layer.selectedFeatures[0]
  453. );
  454. console.log('_layer.selectedFeatures[0]: ', _layer.selectedFeatures[0]);
  455. }
  456. priv.createCopy(input, this, priv.addWKTInput);
  457. };
  458. field.onblur = function() {
  459. input.data = field.value ? {
  460. complexData: {
  461. mimeType: "application/wkt",
  462. value: this.value
  463. }
  464. } : undefined;
  465. };
  466. field.title = input["abstract"];
  467. field.id = name;
  468. previousSibling && previousSibling.nextSibling ?
  469. container.insertBefore(field, previousSibling.nextSibling.nextSibling) :
  470. container.appendChild(field);
  471. };
  472. // helper function for xml input
  473. priv.addXMLInput = function(input, type) {
  474. var name = input.identifier;
  475. var field = document.createElement("input");
  476. field.title = input["abstract"];
  477. field.value = name + " (" + type + ")";
  478. field.onblur = function() {
  479. input.data = field.value ? {
  480. complexData: {
  481. mimeType: type,
  482. value: this.value
  483. }
  484. } : undefined;
  485. };
  486. _nodeInput.append(field);
  487. };
  488. // helper function to dynamically create a WFS collection reference input
  489. priv.addWFSCollectionInput = function(input) {
  490. var name = input.identifier;
  491. var field = document.createElement("input");
  492. field.title = input["abstract"];
  493. field.value = name + " (layer on demo server)";
  494. priv.addValueHandlers(field, function() {
  495. input.reference = field.value ? {
  496. mimeType: "text/xml; subtype=wfs-collection/1.0",
  497. href: "http://geoserver/wfs",
  498. method: "POST",
  499. body: {
  500. wfs: {
  501. version: "1.0.0",
  502. outputFormat: "GML2",
  503. featureType: field.value
  504. }
  505. }
  506. } : undefined;
  507. });
  508. _nodeInput.append(field);
  509. };
  510. // helper function to dynamically create a raster (GeoTIFF) url input
  511. priv.addRasterInput = function(input) {
  512. var name = input.identifier;
  513. var field = document.createElement("input");
  514. field.title = input["abstract"];
  515. var url = window.location.href.split("?")[0];
  516. field.value = url.substr(0, url.lastIndexOf("/")+1) + "data/tazdem.tiff";// TODO: file path to options
  517. document.getElementById("input").appendChild(field);
  518. (field.onblur = function() {
  519. input.reference = {
  520. mimeType: "image/tiff",
  521. href: field.value,
  522. method: "GET"
  523. };
  524. })();
  525. };
  526. // helper function to dynamically create a bounding box input
  527. priv.addBoundingBoxInput = function(input) {
  528. var name = input.identifier;
  529. var field = document.createElement("input");
  530. field.title = input["abstract"];
  531. field.value = "left,bottom,right,top (EPSG:4326)";
  532. _nodeInput.append(field);
  533. priv.addValueHandlers(field, function() {
  534. input.boundingBoxData = {
  535. projection: "EPSG:4326",
  536. bounds: OpenLayers.Bounds.fromString(field.value)
  537. };
  538. });
  539. };
  540. // helper function to create a literal input textfield or dropdown
  541. priv.addLiteralInput = function(input, previousSibling) {
  542. var name = input.identifier;
  543. var container = _nodeInput.get(0);
  544. var anyValue = input.literalData.anyValue;
  545. // anyValue means textfield, otherwise we create a dropdown
  546. var field = document.createElement(anyValue ? "input" : "select");
  547. field.id = name;
  548. field.title = input["abstract"];
  549. previousSibling && previousSibling.nextSibling ?
  550. container.insertBefore(field, previousSibling.nextSibling) :
  551. container.appendChild(field);
  552. if (anyValue) {
  553. var dataType = input.literalData.dataType;
  554. field.value = name + (dataType ? " (" + dataType + ")" : "");
  555. priv.addValueHandlers(field, function() {
  556. input.data = field.value ? {
  557. literalData: {
  558. value: field.value
  559. }
  560. } : undefined;
  561. priv.createCopy(input, field, priv.addLiteralInput);
  562. });
  563. } else {
  564. var option;
  565. option = document.createElement("option");
  566. option.innerHTML = name;
  567. field.appendChild(option);
  568. for (var v in input.literalData.allowedValues) {
  569. option = document.createElement("option");
  570. option.value = v;
  571. option.innerHTML = v;
  572. field.appendChild(option);
  573. }
  574. field.onchange = function() {
  575. priv.createCopy(input, field, priv.addLiteralInput);
  576. input.data = this.selectedIndex ? {
  577. literalData: {
  578. value: this.options[this.selectedIndex].value
  579. }
  580. } : undefined;
  581. };
  582. }
  583. };
  584. // if maxOccurs is > 1, this will add a copy of the field
  585. priv.createCopy = function(input, field, fn) {
  586. if (input.maxOccurs && input.maxOccurs > 1 && !field.userSelected) {
  587. // add another copy of the field - we don't check maxOccurs
  588. field.userSelected = true;
  589. var newInput = OpenLayers.Util.extend({}, input);
  590. // we recognize copies by the occurrence property
  591. newInput.occurrence = (input.occurrence || 0) + 1;
  592. _process.dataInputs.push(newInput);
  593. fn(newInput, field);
  594. }
  595. };
  596. // helper function for adding events to form fields
  597. priv.addValueHandlers = function(field, onblur) {
  598. field.onclick = function() {
  599. if (!this.initialValue) {
  600. this.initialValue = this.value;
  601. this.value = "";
  602. }
  603. };
  604. field.onblur = function() {
  605. if (!this.value) {
  606. this.value = this.initialValue;
  607. delete this.initialValue;
  608. }
  609. onblur.apply(this, arguments);
  610. };
  611. };
  612. // execute the process
  613. priv.execute = function() {
  614. var output = _process.processOutputs[0];
  615. var input;
  616. // remove occurrences that the user has not filled out
  617. for (var i = _process.dataInputs.length - 1; i >= 0; --i) {
  618. input = _process.dataInputs[i];
  619. if ((input.minOccurs === 0 || input.occurrence) && !input.data && !input.reference) {
  620. OpenLayers.Util.removeItem(_process.dataInputs, input);
  621. }
  622. }
  623. _process.responseForm = {
  624. rawDataOutput: {
  625. identifier: output.identifier
  626. }
  627. };
  628. if (output.complexOutput && output.complexOutput.supported.formats["application/wkt"]) {
  629. _process.responseForm.rawDataOutput.mimeType = "application/wkt";
  630. }
  631. OpenLayers.Request.POST({
  632. url: priv.options.wpsUrl,
  633. data: new OpenLayers.Format.WPSExecute().write(_process),
  634. success: priv.showOutput
  635. });
  636. }
  637. // add the process's output to the page
  638. priv.showOutput = function(response) {
  639. var result = _nodeOutput.get(0);
  640. result.innerHTML = "<h3>Output:</h3>";
  641. var features;
  642. var contentType = response.getResponseHeader("Content-Type");
  643. if (contentType == "application/wkt") {
  644. features = new OpenLayers.Format.WKT().read(response.responseText);
  645. } else if (contentType == "text/xml; subtype=wfs-collection/1.0") {
  646. features = new OpenLayers.Format.WFST.v1_0_0().read(response.responseText);
  647. }
  648. if (features && (features instanceof OpenLayers.Feature.Vector || features.length)) {
  649. _layer.addFeatures(features);
  650. result.innerHTML += "The result should also be visible on the map.";
  651. }
  652. result.innerHTML += "<textarea>" + response.responseText + "</textarea>";
  653. }
  654. publ.updateSize = function() {
  655. _map.updateSize();
  656. };
  657. publ.zoomToExtent = function(extent) {
  658. var extentBounds = OpenLayers.Geometry.fromWKT(extent).getBounds();
  659. _map.zoomToExtent(extentBounds);
  660. };
  661. publ.selectRecord = function(recordId, extent) {
  662. if (priv.isSelectedRecordId()) {
  663. if (priv.getSelectedRecordId() != recordId) {
  664. if (priv.isSelectedFeature()) {
  665. if (confirm('Aktualnie przypisany rekord to ' + priv.getSelectedRecordId() + ' czy zmienić na ' + recordId + '?')) {
  666. priv.setSelectedRecordId(recordId);
  667. }
  668. } else {
  669. priv.setSelectedRecordId(recordId);
  670. publ.zoomToExtent(extent);
  671. }
  672. } else {
  673. publ.zoomToExtent(extent);
  674. }
  675. }
  676. else {
  677. priv.setSelectedRecordId(recordId);
  678. publ.zoomToExtent(extent);
  679. }
  680. };
  681. publ.init = function(options) {
  682. if (priv.options.debug) console.log('TableAjaxMap initialization...', options);
  683. //merge supplied options with defaults
  684. $.extend(priv.options, defaults, options);
  685. priv.init();
  686. return publ;
  687. };
  688. return publ;
  689. };
  690. $.fn.TableAjaxMapUpdateSize = function(options) {
  691. options = options || {};
  692. return this.each(function() {
  693. var tblAjaxMap = $(this).data('TableAjaxMap');
  694. if (tblAjaxMap) {
  695. tblAjaxMap.updateSize();
  696. }
  697. });
  698. return this;
  699. };
  700. $.fn.TableAjaxMapZoomToExtent = function(extent) {
  701. if (!extent) return;
  702. return this.each(function() {
  703. var tblAjaxMap = $(this).data('TableAjaxMap');
  704. if (tblAjaxMap) {
  705. tblAjaxMap.zoomToExtent(extent);
  706. }
  707. });
  708. return this;
  709. };
  710. $.fn.TableAjaxMapSelectRecord = function(recordId, extent) {
  711. if (!recordId) return;
  712. return this.each(function() {
  713. var tblAjaxMap = $(this).data('TableAjaxMap');
  714. if (tblAjaxMap) {
  715. tblAjaxMap.selectRecord(recordId, extent);
  716. }
  717. });
  718. return this;
  719. };
  720. $.fn.TableAjaxMap = function(options) {
  721. options = options || {};
  722. return this.each(function() {
  723. options.id = this;
  724. if (!$(this).data('TableAjaxMap')) {
  725. $(this).data('TableAjaxMap', new TableAjaxMap().init(options));
  726. }
  727. });
  728. return this;
  729. };
  730. }(jQuery));
  731. </script>
  732. <?php
  733. }
  734. public function ajaxTask($task) {
  735. switch ($task) {
  736. case 'PROXY': {
  737. $this->sendAjaxProxy($_REQUEST);
  738. break;
  739. }
  740. default:
  741. //$this->sendAjaxData($_REQUEST);
  742. }
  743. }
  744. public function sendAjaxProxy($args) {
  745. $url = V::get('url', '', $args);
  746. // 1. http%3A%2F%2Fbiuro.biall-net.pl%2Fwps%3FSERVICE%3DWPS%26REQUEST%3DGetCapabilities
  747. // 2. http%3A%2F%2Fbiuro.biall-net.pl%2Fwps%3FSERVICE%3DWPS%26REQUEST%3DDescribeProcess%26VERSION%3D1.0.0%26IDENTIFIER%3Dpozdrawiam
  748. header('Content-Type: application/xml; charset=utf-8');
  749. $urlParts = parse_url($url);
  750. $urlQuery = array();
  751. $urlQueryTmp = V::get('query', '', $urlParts);
  752. $urlQueryTmp = explode('&', $urlQueryTmp);
  753. foreach ($urlQueryTmp as $vQuery) {
  754. $parts = explode('=', $vQuery, 2);
  755. $urlQuery[$parts[0]] = $parts[1];
  756. }
  757. $wpsServer = new TableAjaxMapWpsServer($this->_zasobID);
  758. if ('WPS' == V::get('SERVICE', '', $urlQuery)) {
  759. $req = V::get('REQUEST', '', $urlQuery);
  760. $methodName = "{$req}Action";
  761. if (method_exists($wpsServer, $methodName)) {
  762. $wpsServer->$methodName($urlQuery);
  763. }
  764. }
  765. else {
  766. $wpsServer->parseXMLRequest();
  767. }
  768. exit;
  769. }
  770. }
  771. class TableAjaxMapWfsAction {
  772. private $_zasobID;
  773. public function __construct($zasobID) {
  774. $this->_zasobID = $zasobID;
  775. }
  776. /**
  777. * example: MULTIPOLYGON(((2072016.74395199 7234076.79293037,2072016.74395199 7234115.01144451,2072131.3994944 7234115.01144451,2072131.3994944 7234076.79293037,2072016.74395199 7234076.79293037)))
  778. */
  779. public function generateGmlFromWKT($wkt) {
  780. $gml = '';
  781. $wktParts = explode('(', $wkt, 2);
  782. ob_start();
  783. switch ($wktParts[0]) {
  784. case 'MULTIPOLYGON':
  785. case 'POLYGON': {
  786. $points = trim($wktParts[1], '() ');
  787. $points = str_replace(',', "\n", $points);
  788. ?>
  789. <gml:boundedBy>
  790. <gml:Envelope srsDimension="2" srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
  791. <gml:lowerCorner>-180 -90</gml:lowerCorner>
  792. <gml:upperCorner>180 90</gml:upperCorner>
  793. </gml:Envelope>
  794. </gml:boundedBy>
  795. <og:the_geom>
  796. <gml:MultiSurface srsDimension="2" srsName="http://www.opengis.net/gml/srs/epsg.xml#900913">
  797. <gml:surfaceMember>
  798. <gml:Polygon srsDimension="2">
  799. <gml:exterior>
  800. <gml:LinearRing srsDimension="2">
  801. <gml:posList>
  802. <?php echo $points; ?>
  803. </gml:posList>
  804. </gml:LinearRing>
  805. </gml:exterior>
  806. </gml:Polygon>
  807. </gml:surfaceMember>
  808. </gml:MultiSurface>
  809. </og:the_geom>
  810. <?php
  811. }
  812. break;
  813. default:
  814. }
  815. $gml = ob_get_contents();
  816. ob_clean();
  817. return $gml;
  818. }
  819. public function execute($args) {
  820. /*
  821. * Mapa odczytywanie punktów: http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/
  822. *
  823. * CI50:
  824. 18.613243103027344 54.33614429135817
  825. 18.613243103027344 54.33634445792519
  826. 18.614273071289062 54.33634445792519
  827. 18.614273071289062 54.33614429135817
  828. */
  829. $buildingsGml = array();
  830. $db = DB::getDB();
  831. if ($this->_zasobID == 16) {// TODO: read by TableAcl from Data_Source?
  832. $sql = "select b.`ID`, AsWKT(b.`the_geom`) as the_geom
  833. from `BUILDINGS` as b
  834. where b.`the_geom` is not null and b.`the_geom`!=''
  835. limit 10;
  836. ";
  837. $res = $db->query($sql);
  838. while ($r = $db->fetch($res)) {
  839. $buildingsGml[$r->ID] = $this->generateGmlFromWKT($r->the_geom);
  840. }
  841. }
  842. /**
  843. * <og:recordId><?php echo $kId; ?></og:recordId>
  844. * <og:tblId><?php echo $tblId; ?></og:tblId>
  845. *
  846. * goes to js: @see priv.addWKTInput _layer.selectedFeatures[0]
  847. *
  848. * attributes: Object
  849. recordId: "1130"
  850. tblId: "16"
  851. */
  852. echo '<?xml version="1.0" encoding="UTF-8"?>';
  853. ?>
  854. <wfs:FeatureCollection xmlns:nasa="http://nasa.gov" xmlns:topp="http://www.openplans.org/topp" xmlns:usgs="http://www.usgs.gov/" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ows="http://www.opengis.net/ows" xmlns:ne="http://naturalearthdata.com" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:gml="http://www.opengis.net/gml" xmlns:osm="http://openstreemap.org" xmlns:nurc="http://www.nurc.nato.int" xmlns:og="http://opengeo.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" numberOfFeatures="4" timeStamp="2014-07-16T13:22:43.307Z" xsi:schemaLocation="http://opengeo.org http://demo.opengeo.org:80/geoserver/wfs?service=WFS&amp;version=1.1.0&amp;request=DescribeFeatureType&amp;typeName=og%3Arestricted http://www.opengis.net/wfs http://demo.opengeo.org:80/geoserver/schemas/wfs/1.1.0/wfs.xsd">
  855. <!--
  856. <?php echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;"> (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($this->_zasobID);echo'</pre>'; ?>
  857. <?php echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;"> (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($buildingsGml);echo'</pre>'; ?>
  858. -->
  859. <gml:boundedBy>
  860. <gml:Envelope srsDimension="2" srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
  861. <gml:lowerCorner>-180 -90</gml:lowerCorner>
  862. <gml:upperCorner>180 90</gml:upperCorner>
  863. </gml:Envelope>
  864. </gml:boundedBy>
  865. <gml:featureMembers>
  866. <?php foreach ($buildingsGml as $kId => $vGml) : ?>
  867. <og:restricted gml:id="restricted.<?php echo $kId; ?>">
  868. <?php echo $vGml; ?>
  869. <og:recordId><?php echo $kId; ?></og:recordId>
  870. <og:tblId><?php echo $this->_zasobID; ?></og:tblId>
  871. </og:restricted>
  872. <?php endforeach; ?>
  873. </gml:featureMembers>
  874. </wfs:FeatureCollection>
  875. <?php
  876. }
  877. }
  878. class WpsActionBase {
  879. public $title = '';
  880. public $description = '';
  881. public $dataInputs = array();
  882. public function execute($args) {
  883. var_dump($args);
  884. }
  885. }
  886. class WpsActionPrzypiszDoRekordu extends WpsActionBase {
  887. public function __construct() {
  888. $this->title = 'Przypisz';
  889. $this->description = 'Przypisuje położenie do wybranego rekordu w tabeli.';
  890. $this->dataInputs['geom'] = new stdClass();
  891. $this->dataInputs['geom']->title = 'geom';
  892. $this->dataInputs['geom']->description = 'Input geometry';
  893. $this->dataInputs['geom']->type = 'geom';// CoomplexData
  894. $this->dataInputs['idTable'] = new stdClass();
  895. $this->dataInputs['idTable']->title = 'geom';
  896. $this->dataInputs['idTable']->description = 'Table ID';
  897. $this->dataInputs['idTable']->type = 'integer';// LiteralData: xs:integer
  898. $this->dataInputs['idRecord'] = new stdClass();
  899. $this->dataInputs['idRecord']->title = 'idRecord';
  900. $this->dataInputs['idRecord']->description = 'Record ID';
  901. $this->dataInputs['idRecord']->type = 'integer';// LiteralData: xs:integer
  902. }
  903. }
  904. class TableAjaxMapWpsServer {
  905. private $_fun;// config for identifiers
  906. private $_wfsAction;
  907. private $_zasobID;
  908. public function __construct($zasobID) {
  909. $this->_fun['przypiszDoRekordu'] = new WpsActionPrzypiszDoRekordu();
  910. $this->_wfsAction = new TableAjaxMapWfsAction($zasobID);
  911. $this->_zasobID = $zasobID;
  912. }
  913. public function parseXMLRequest() {
  914. $data = array();
  915. $reqContent = file_get_contents('php://input');
  916. $xml = new SimpleXMLElement($reqContent);
  917. if ('GetFeature' == $xml->getName()) {
  918. // TODO: parse xml and set query params
  919. $this->_wfsAction->execute($data);
  920. }
  921. else if (isset($xml->children('ows', TRUE)->Identifier)) {
  922. $identifier = (string)$xml->children('ows', TRUE)->Identifier;
  923. if (array_key_exists($identifier, $this->_fun)) {
  924. foreach ($xml->children('wps', TRUE)->DataInputs->children('wps', TRUE) as $input) {
  925. $inputIdentifier = (string)$input->children('ows', TRUE)->Identifier;
  926. if (array_key_exists($inputIdentifier, $this->_fun[$identifier]->dataInputs)) {
  927. $inputType = (string)$this->_fun[$identifier]->dataInputs[$inputIdentifier]->type;
  928. switch ($inputType) {
  929. case 'integer':
  930. $data[$inputIdentifier] = (string)$input->children('wps', TRUE)->Data->LiteralData;
  931. break;
  932. case 'geom':
  933. $data[$inputIdentifier] = (string)$input->children('wps', TRUE)->Data->ComplexData;
  934. break;
  935. default:
  936. }
  937. } else {
  938. // brak zdefiniowanego inputa
  939. }
  940. }
  941. $this->_fun['przypiszDoRekordu']->execute($data);
  942. } else {
  943. echo "TODO: brak zdefiniowanej funkcji '{$identifier}'";
  944. var_dump($identifier);
  945. }
  946. }
  947. else {
  948. echo "TODO: '" . $xml->getName() . "' ...";
  949. }
  950. }
  951. public function getCapabilitiesAction() {
  952. echo '<?xml version="1.0" encoding="UTF-8"?>';
  953. ?>
  954. <wps:Capabilities xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="en" service="WPS" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
  955. <ows:ServiceIdentification>
  956. <ows:Title>Prototype GeoServer WPS</ows:Title>
  957. <ows:Abstract />
  958. <ows:Keywords>
  959. <ows:Keyword>wps</ows:Keyword>
  960. <ows:Keyword>geoserver</ows:Keyword>
  961. </ows:Keywords>
  962. <ows:ServiceType>WPS</ows:ServiceType>
  963. <ows:ServiceTypeVersion>1.0.0</ows:ServiceTypeVersion>
  964. <ows:Fees>NONE</ows:Fees>
  965. <ows:AccessConstraints>NONE</ows:AccessConstraints>
  966. </ows:ServiceIdentification>
  967. <ows:ServiceProvider>
  968. <ows:ProviderName>GeoServer</ows:ProviderName>
  969. <ows:ProviderSite />
  970. <ows:ServiceContact />
  971. </ows:ServiceProvider>
  972. <ows:OperationsMetadata>
  973. <ows:Operation name="GetCapabilities">
  974. <ows:DCP>
  975. <ows:HTTP>
  976. <ows:Get xlink:href="http://demo.opengeo.org:80/geoserver/wps" />
  977. <ows:Post xlink:href="http://demo.opengeo.org:80/geoserver/wps" />
  978. </ows:HTTP>
  979. </ows:DCP>
  980. </ows:Operation>
  981. <ows:Operation name="DescribeProcess">
  982. <ows:DCP>
  983. <ows:HTTP>
  984. <ows:Get xlink:href="http://demo.opengeo.org:80/geoserver/wps" />
  985. <ows:Post xlink:href="http://demo.opengeo.org:80/geoserver/wps" />
  986. </ows:HTTP>
  987. </ows:DCP>
  988. </ows:Operation>
  989. <ows:Operation name="Execute">
  990. <ows:DCP>
  991. <ows:HTTP>
  992. <ows:Get xlink:href="http://demo.opengeo.org:80/geoserver/wps" />
  993. <ows:Post xlink:href="http://demo.opengeo.org:80/geoserver/wps" />
  994. </ows:HTTP>
  995. </ows:DCP>
  996. </ows:Operation>
  997. </ows:OperationsMetadata>
  998. <wps:ProcessOfferings>
  999. <?php foreach($this->_fun as $kFun => $vFun) : ?>
  1000. <wps:Process wps:processVersion="1.0.0">
  1001. <ows:Identifier><?php echo $kFun; ?></ows:Identifier>
  1002. <ows:Title><?php echo $vFun->title; ?></ows:Title>
  1003. <ows:Abstract><?php echo $vFun->description; ?></ows:Abstract>
  1004. </wps:Process>
  1005. <?php endforeach; ?>
  1006. </wps:ProcessOfferings>
  1007. <wps:Languages>
  1008. <wps:Default>
  1009. <ows:Language>en-US</ows:Language>
  1010. </wps:Default>
  1011. <wps:Supported>
  1012. <ows:Language>en-US</ows:Language>
  1013. </wps:Supported>
  1014. </wps:Languages>
  1015. </wps:Capabilities>
  1016. <?php
  1017. }
  1018. public function describeProcessAction($args) {
  1019. // TODO: xml z opiesem procese $args['IDENTIFIER']
  1020. /**
  1021. * should work like JTS:densify - geom field (map object) and integer field (record ID)
  1022. * http://openlayers.org/dev/examples/proxy.cgi?url=http%3A%2F%2Fdemo.opengeo.org%2Fgeoserver%2Fwps%3FSERVICE%3DWPS%26REQUEST%3DDescribeProcess%26VERSION%3D1.0.0%26IDENTIFIER%3DJTS%253Adensify
  1023. * http://demo.opengeo.org/geoserver/wps?SERVICE=WPS&REQUEST=DescribeProcess&VERSION=1.0.0&IDENTIFIER=JTS%3Adensify
  1024. */
  1025. echo '<?xml version="1.0" encoding="UTF-8"?>';
  1026. if (array_key_exists($args['IDENTIFIER'], $this->_fun)) {
  1027. $identifier = $this->_fun[$args['IDENTIFIER']];
  1028. ?>
  1029. <wps:ProcessDescriptions xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="en" service="WPS" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
  1030. <ProcessDescription wps:processVersion="1.0.0" statusSupported="true" storeSupported="true">
  1031. <ows:Identifier><?php echo $args['IDENTIFIER']; ?></ows:Identifier>
  1032. <ows:Title><?php echo $identifier->title; ?></ows:Title>
  1033. <ows:Abstract><?php echo $identifier->description; ?></ows:Abstract>
  1034. <DataInputs>
  1035. <?php foreach ($identifier->dataInputs as $kInput => $vInput) : ?>
  1036. <Input maxOccurs="1" minOccurs="1">
  1037. <ows:Identifier><?php echo $kInput; ?></ows:Identifier>
  1038. <ows:Title><?php echo $vInput->title; ?></ows:Title>
  1039. <ows:Abstract><?php echo $vInput->description; ?></ows:Abstract>
  1040. <?php if ($vInput->type == 'geom') : ?>
  1041. <ComplexData>
  1042. <Default>
  1043. <Format>
  1044. <MimeType>text/xml; subtype=gml/3.1.1</MimeType>
  1045. </Format>
  1046. </Default>
  1047. <Supported>
  1048. <Format>
  1049. <MimeType>text/xml; subtype=gml/3.1.1</MimeType>
  1050. </Format>
  1051. <Format>
  1052. <MimeType>text/xml; subtype=gml/2.1.2</MimeType>
  1053. </Format>
  1054. <Format>
  1055. <MimeType>application/wkt</MimeType>
  1056. </Format>
  1057. <Format>
  1058. <MimeType>application/gml-3.1.1</MimeType>
  1059. </Format>
  1060. <Format>
  1061. <MimeType>application/gml-2.1.2</MimeType>
  1062. </Format>
  1063. </Supported>
  1064. </ComplexData>
  1065. <?php elseif ($vInput->type == 'integer') : ?>
  1066. <LiteralData>
  1067. <ows:DataType>xs:integer</ows:DataType>
  1068. <ows:AnyValue />
  1069. </LiteralData>
  1070. <?php else : ?>
  1071. <?php endif; ?>
  1072. </Input>
  1073. <?php endforeach; ?>
  1074. </DataInputs>
  1075. <ProcessOutputs>
  1076. <Output>
  1077. <ows:Identifier>result</ows:Identifier>
  1078. <ows:Title>result</ows:Title>
  1079. <ComplexOutput>
  1080. <Default>
  1081. <Format>
  1082. <MimeType>text/xml; subtype=gml/3.1.1</MimeType>
  1083. </Format>
  1084. </Default>
  1085. <Supported>
  1086. <Format>
  1087. <MimeType>text/xml; subtype=gml/3.1.1</MimeType>
  1088. </Format>
  1089. <Format>
  1090. <MimeType>text/xml; subtype=gml/2.1.2</MimeType>
  1091. </Format>
  1092. <Format>
  1093. <MimeType>application/wkt</MimeType>
  1094. </Format>
  1095. <Format>
  1096. <MimeType>application/gml-3.1.1</MimeType>
  1097. </Format>
  1098. <Format>
  1099. <MimeType>application/gml-2.1.2</MimeType>
  1100. </Format>
  1101. </Supported>
  1102. </ComplexOutput>
  1103. </Output>
  1104. </ProcessOutputs>
  1105. </ProcessDescription>
  1106. </wps:ProcessDescriptions>
  1107. <?php
  1108. } else {
  1109. echo 'TODO: brak funkcji';
  1110. }
  1111. }
  1112. }