TableAjaxMap.php 38 KB

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