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. 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:4326"),
  124. protocol: new OpenLayers.Protocol.WFS({
  125. version: "1.1.0",
  126. srsName: "EPSG:4326",
  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 gphy = new OpenLayers.Layer.OSM("Mapa", null, {
  257. resolutions: [156543.03390625, 78271.516953125, 39135.7584765625,
  258. 19567.87923828125, 9783.939619140625, 4891.9698095703125,
  259. 2445.9849047851562, 1222.9924523925781, 611.4962261962891,
  260. 305.74811309814453, 152.87405654907226, 76.43702827453613,
  261. 38.218514137268066, 19.109257068634033, 9.554628534317017,
  262. 4.777314267158508, 2.388657133579254, 1.194328566789627,
  263. 0.5971642833948135, 0.25, 0.1, 0.05],
  264. serverResolutions: [156543.03390625, 78271.516953125, 39135.7584765625,
  265. 19567.87923828125, 9783.939619140625,
  266. 4891.9698095703125, 2445.9849047851562,
  267. 1222.9924523925781, 611.4962261962891,
  268. 305.74811309814453, 152.87405654907226,
  269. 76.43702827453613, 38.218514137268066,
  270. 19.109257068634033, 9.554628534317017,
  271. 4.777314267158508, 2.388657133579254,
  272. 1.194328566789627, 0.5971642833948135],
  273. transitionEffect: 'resize'
  274. });
  275. /* NOTE: map is in projection EPSG:900913 even if projection and displayProjection is set to EPSG:4326
  276. * _map.getProjectionObject(); returns EPSG:900913
  277. * restrictedExtent should be set in EPSG:900913
  278. * zoomToExtent should use EPSG:900913 - need to transform from EPSG:4326 to EPSG:900913
  279. */
  280. _map = new OpenLayers.Map(_nodeMapId, {
  281. projection: new OpenLayers.Projection("EPSG:4326"),
  282. displayProjection: new OpenLayers.Projection("EPSG:4326"),
  283. restrictedExtent: new OpenLayers.Bounds(
  284. 2035059.4410645328, 7200979.560689885, 2113330.958028555, 7279251.0776539035
  285. //18.281250002544773, 54.16243397333987, 18.984375002642665, 54.57206166093501
  286. ),
  287. controls: [
  288. toolbar,
  289. new OpenLayers.Control.ZoomPanel(),
  290. new OpenLayers.Control.PanPanel(),
  291. new OpenLayers.Control.LayerSwitcher(),
  292. new OpenLayers.Control.ScaleLine(),
  293. new OpenLayers.Control.KeyboardDefaults()
  294. ],
  295. layers: [gphy,_layer]
  296. });
  297. _map.zoomToMaxExtent();
  298. };
  299. priv.updateState = function() {
  300. // TODO: update state view
  301. //console.log('updateState: _selectedFeature:', _selectedFeature, ' _selectedRecordId:', _selectedRecordId);
  302. if (_selectedFeature || _selectedRecordId) {
  303. } else {
  304. }
  305. };
  306. priv.setSelectedFeature = function(feature) {
  307. _selectedFeature = feature;
  308. priv.updateState();
  309. };
  310. priv.setSelectedRecordId = function(id) {
  311. _selectedRecordId = id;
  312. priv.updateState();
  313. };
  314. priv.getSelectedRecordId = function() {
  315. return _selectedRecordId;
  316. };
  317. priv.isSelectedRecordId = function() {
  318. return _selectedRecordId > 0;
  319. };
  320. priv.isSelectedFeature = function() {
  321. console.log('_selectedFeature:', _selectedFeature);
  322. return (_selectedFeature)? true : false;
  323. };
  324. priv.cancelSelectedFeatureModifications = function() {
  325. if (!_selectedFeature) return false;
  326. if (_selectedFeature.attributes._newRecordId) {
  327. delete _selectedFeature.attributes._newRecordId;
  328. }
  329. if (_selectedFeature.attributes._modified) {
  330. delete _selectedFeature.attributes._modified;
  331. }
  332. };
  333. priv.isSelectedFeatureModified = function() {
  334. if (!_selectedFeature) return false;
  335. if (_selectedFeature.attributes) {
  336. if (_selectedFeature.attributes._newRecordId) {
  337. return true;
  338. }
  339. if (_selectedFeature.attributes._modified) {
  340. return true;
  341. }
  342. }
  343. };
  344. priv.saveSelectedFeature = function() {
  345. if (priv.isSelectedFeatureModified()) {
  346. if (typeof priv.options.onSaveFeature == "function") {
  347. var selFeatureExtent = new OpenLayers.Format.WKT().write(_selectedFeature);
  348. priv.options.onSaveFeature.call(this, _selectedRecordId, selFeatureExtent);
  349. }
  350. }
  351. }
  352. priv.checkSelectedFeatureModifications = function(when) {
  353. if (priv.isSelectedFeatureModified()) {
  354. if (confirm('Czy zapisać zmiany wprowadzone dla zaznaczonego elementu?')) {
  355. // _layer.refresh();
  356. priv.saveSelectedFeature();
  357. priv.cancelSelectedFeatureModifications();
  358. }
  359. else {
  360. priv.cancelSelectedFeatureModifications();
  361. _layer.refresh({force:true});
  362. }
  363. }
  364. };
  365. // using OpenLayers.Format.WPSCapabilities to read the capabilities
  366. priv.getCapabilities = function() {
  367. OpenLayers.Request.GET({
  368. url: priv.options.wpsUrl,
  369. params: {
  370. "SERVICE": "WPS",
  371. "REQUEST": "GetCapabilities"
  372. },
  373. success: function(response){
  374. _capabilities = new OpenLayers.Format.WPSCapabilities().read(
  375. response.responseText
  376. );
  377. var dropdown = _nodeProcesses;
  378. var offerings = _capabilities.processOfferings, option;
  379. // populate the dropdown
  380. for (var p in offerings) {
  381. option = document.createElement("option");
  382. option.innerHTML = offerings[p].identifier;
  383. option.value = p;
  384. dropdown.append(option);
  385. }
  386. }
  387. });
  388. };
  389. priv.buildForm = function() {
  390. _nodeAbstract.html(_process["abstract"]);
  391. _nodeInput.html("<h3>Input:</h3>");
  392. _nodeOutput.html('');
  393. var inputs = _process.dataInputs, supported = true,
  394. sld = "text/xml; subtype=sld/1.0.0",
  395. input;
  396. for (var i = 0, ii = inputs.length; i < ii; ++i) {
  397. input = inputs[i];
  398. if (input.complexData) {
  399. var formats = input.complexData.supported.formats;
  400. if (formats["application/wkt"]) {
  401. priv.addWKTInput(input);
  402. } else if (formats["text/xml; subtype=wfs-collection/1.0"]) {
  403. priv.addWFSCollectionInput(input);
  404. } else if (formats["image/tiff"]) {
  405. //priv.addRasterInput(input);
  406. } else if (formats[sld]) {
  407. priv.addXMLInput(input, sld);
  408. } else {
  409. supported = false;
  410. }
  411. } else if (input.boundingBoxData) {
  412. priv.addBoundingBoxInput(input);
  413. } else if (input.literalData) {
  414. priv.addLiteralInput(input);
  415. } else {
  416. supported = false;
  417. }
  418. if (input.minOccurs > 0) {
  419. _nodeInput.append(document.createTextNode("* "));
  420. }
  421. }
  422. if (supported) {
  423. var executeButton = document.createElement("button");
  424. executeButton.innerHTML = "Execute";
  425. _nodeInput.append(executeButton);
  426. executeButton.onclick = priv.execute;
  427. } else {
  428. _nodeInput.html('<span class="notsupported">' +
  429. "Sorry, the WPS builder does not support the selected process." +
  430. "</span>");
  431. }
  432. };
  433. // helper function to dynamically create a textarea for geometry (WKT) data
  434. // input
  435. priv.addWKTInput = function(input, previousSibling) {
  436. var name = input.identifier;
  437. var container = _nodeInput.get(0);
  438. var label = document.createElement("label");
  439. label["for"] = name;
  440. label.title = input["abstract"];
  441. label.innerHTML = name + " (select feature, then click field):";
  442. previousSibling && previousSibling.nextSibling ?
  443. container.insertBefore(label, previousSibling.nextSibling) :
  444. container.appendChild(label);
  445. var field = document.createElement("textarea");
  446. field.onclick = function () {
  447. if (_layer.selectedFeatures.length) {
  448. this.innerHTML = new OpenLayers.Format.WKT().write(
  449. _layer.selectedFeatures[0]
  450. );
  451. console.log('_layer.selectedFeatures[0]: ', _layer.selectedFeatures[0]);
  452. }
  453. priv.createCopy(input, this, priv.addWKTInput);
  454. };
  455. field.onblur = function() {
  456. input.data = field.value ? {
  457. complexData: {
  458. mimeType: "application/wkt",
  459. value: this.value
  460. }
  461. } : undefined;
  462. };
  463. field.title = input["abstract"];
  464. field.id = name;
  465. previousSibling && previousSibling.nextSibling ?
  466. container.insertBefore(field, previousSibling.nextSibling.nextSibling) :
  467. container.appendChild(field);
  468. };
  469. // helper function for xml input
  470. priv.addXMLInput = function(input, type) {
  471. var name = input.identifier;
  472. var field = document.createElement("input");
  473. field.title = input["abstract"];
  474. field.value = name + " (" + type + ")";
  475. field.onblur = function() {
  476. input.data = field.value ? {
  477. complexData: {
  478. mimeType: type,
  479. value: this.value
  480. }
  481. } : undefined;
  482. };
  483. _nodeInput.append(field);
  484. };
  485. // helper function to dynamically create a WFS collection reference input
  486. priv.addWFSCollectionInput = function(input) {
  487. var name = input.identifier;
  488. var field = document.createElement("input");
  489. field.title = input["abstract"];
  490. field.value = name + " (layer on demo server)";
  491. priv.addValueHandlers(field, function() {
  492. input.reference = field.value ? {
  493. mimeType: "text/xml; subtype=wfs-collection/1.0",
  494. href: "http://geoserver/wfs",
  495. method: "POST",
  496. body: {
  497. wfs: {
  498. version: "1.0.0",
  499. outputFormat: "GML2",
  500. featureType: field.value
  501. }
  502. }
  503. } : undefined;
  504. });
  505. _nodeInput.append(field);
  506. };
  507. // helper function to dynamically create a raster (GeoTIFF) url input
  508. priv.addRasterInput = function(input) {
  509. var name = input.identifier;
  510. var field = document.createElement("input");
  511. field.title = input["abstract"];
  512. var url = window.location.href.split("?")[0];
  513. field.value = url.substr(0, url.lastIndexOf("/")+1) + "data/tazdem.tiff";// TODO: file path to options
  514. document.getElementById("input").appendChild(field);
  515. (field.onblur = function() {
  516. input.reference = {
  517. mimeType: "image/tiff",
  518. href: field.value,
  519. method: "GET"
  520. };
  521. })();
  522. };
  523. // helper function to dynamically create a bounding box input
  524. priv.addBoundingBoxInput = function(input) {
  525. var name = input.identifier;
  526. var field = document.createElement("input");
  527. field.title = input["abstract"];
  528. field.value = "left,bottom,right,top (EPSG:4326)";
  529. _nodeInput.append(field);
  530. priv.addValueHandlers(field, function() {
  531. input.boundingBoxData = {
  532. projection: "EPSG:4326",
  533. bounds: OpenLayers.Bounds.fromString(field.value)
  534. };
  535. });
  536. };
  537. // helper function to create a literal input textfield or dropdown
  538. priv.addLiteralInput = function(input, previousSibling) {
  539. var name = input.identifier;
  540. var container = _nodeInput.get(0);
  541. var anyValue = input.literalData.anyValue;
  542. // anyValue means textfield, otherwise we create a dropdown
  543. var field = document.createElement(anyValue ? "input" : "select");
  544. field.id = name;
  545. field.title = input["abstract"];
  546. previousSibling && previousSibling.nextSibling ?
  547. container.insertBefore(field, previousSibling.nextSibling) :
  548. container.appendChild(field);
  549. if (anyValue) {
  550. var dataType = input.literalData.dataType;
  551. field.value = name + (dataType ? " (" + dataType + ")" : "");
  552. priv.addValueHandlers(field, function() {
  553. input.data = field.value ? {
  554. literalData: {
  555. value: field.value
  556. }
  557. } : undefined;
  558. priv.createCopy(input, field, priv.addLiteralInput);
  559. });
  560. } else {
  561. var option;
  562. option = document.createElement("option");
  563. option.innerHTML = name;
  564. field.appendChild(option);
  565. for (var v in input.literalData.allowedValues) {
  566. option = document.createElement("option");
  567. option.value = v;
  568. option.innerHTML = v;
  569. field.appendChild(option);
  570. }
  571. field.onchange = function() {
  572. priv.createCopy(input, field, priv.addLiteralInput);
  573. input.data = this.selectedIndex ? {
  574. literalData: {
  575. value: this.options[this.selectedIndex].value
  576. }
  577. } : undefined;
  578. };
  579. }
  580. };
  581. // if maxOccurs is > 1, this will add a copy of the field
  582. priv.createCopy = function(input, field, fn) {
  583. if (input.maxOccurs && input.maxOccurs > 1 && !field.userSelected) {
  584. // add another copy of the field - we don't check maxOccurs
  585. field.userSelected = true;
  586. var newInput = OpenLayers.Util.extend({}, input);
  587. // we recognize copies by the occurrence property
  588. newInput.occurrence = (input.occurrence || 0) + 1;
  589. _process.dataInputs.push(newInput);
  590. fn(newInput, field);
  591. }
  592. };
  593. // helper function for adding events to form fields
  594. priv.addValueHandlers = function(field, onblur) {
  595. field.onclick = function() {
  596. if (!this.initialValue) {
  597. this.initialValue = this.value;
  598. this.value = "";
  599. }
  600. };
  601. field.onblur = function() {
  602. if (!this.value) {
  603. this.value = this.initialValue;
  604. delete this.initialValue;
  605. }
  606. onblur.apply(this, arguments);
  607. };
  608. };
  609. // execute the process
  610. priv.execute = function() {
  611. var output = _process.processOutputs[0];
  612. var input;
  613. // remove occurrences that the user has not filled out
  614. for (var i = _process.dataInputs.length - 1; i >= 0; --i) {
  615. input = _process.dataInputs[i];
  616. if ((input.minOccurs === 0 || input.occurrence) && !input.data && !input.reference) {
  617. OpenLayers.Util.removeItem(_process.dataInputs, input);
  618. }
  619. }
  620. _process.responseForm = {
  621. rawDataOutput: {
  622. identifier: output.identifier
  623. }
  624. };
  625. if (output.complexOutput && output.complexOutput.supported.formats["application/wkt"]) {
  626. _process.responseForm.rawDataOutput.mimeType = "application/wkt";
  627. }
  628. OpenLayers.Request.POST({
  629. url: priv.options.wpsUrl,
  630. data: new OpenLayers.Format.WPSExecute().write(_process),
  631. success: priv.showOutput
  632. });
  633. }
  634. // add the process's output to the page
  635. priv.showOutput = function(response) {
  636. var result = _nodeOutput.get(0);
  637. result.innerHTML = "<h3>Output:</h3>";
  638. var features;
  639. var contentType = response.getResponseHeader("Content-Type");
  640. if (contentType == "application/wkt") {
  641. features = new OpenLayers.Format.WKT().read(response.responseText);
  642. } else if (contentType == "text/xml; subtype=wfs-collection/1.0") {
  643. features = new OpenLayers.Format.WFST.v1_0_0().read(response.responseText);
  644. }
  645. if (features && (features instanceof OpenLayers.Feature.Vector || features.length)) {
  646. _layer.addFeatures(features);
  647. result.innerHTML += "The result should also be visible on the map.";
  648. }
  649. result.innerHTML += "<textarea>" + response.responseText + "</textarea>";
  650. }
  651. publ.updateSize = function() {
  652. _map.updateSize();
  653. };
  654. publ.zoomToExtent = function(extent) {
  655. if (!extent) return;
  656. var sourceProj = new OpenLayers.Projection("EPSG:4326");
  657. var targetProj = _map.getProjectionObject();
  658. var extentBounds = OpenLayers.Geometry.fromWKT(extent).transform(sourceProj, targetProj).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#4326">
  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. }