Web UI for ARGUS server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1261 lines
37 KiB

​
​
​
6 years ago
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
4 years ago
​
​
4 years ago
​
​
4 years ago
​
​
4 years ago
​
​
4 years ago
​
​
​
4 years ago
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
​
​
​
​
6 years ago
​
​
​
​
​
​
​
​
6 years ago
​
6 years ago
​
​
​
​
​
6 years ago
​
​
​
​
​
​
​
​
6 years ago
​
6 years ago
​
​
​
​
​
​
6 years ago
​
​
​
​
​
​
​
​
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
​
​
​
​
​
4 years ago
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
​
​
​
6 years ago
  1. //<?php require_once('../../js_asm.php');
  2. $QS="SELECT * FROM sites WHERE id={$SiteID}";
  3. $RV = $DATABASE->Query( $QS );
  4. ?>
  5. var SiteLat=<?=$RV[0]['anchor_lat'];?>;
  6. var SiteLon=<?=$RV[0]['anchor_lon'];?>;
  7. var SiteAlt=<?=$RV[0]['anchor_alt'];?>;
  8. var map = null;
  9. var markers = [];
  10. function Events() {
  11. this.events = { };
  12. }
  13. Events.prototype.on = function(name, fn) {
  14. var events = this.events[name];
  15. if (events == undefined) {
  16. this.events[name] = [ fn ];
  17. this.emit('event:on', fn);
  18. } else {
  19. if (events.indexOf(fn) == -1) {
  20. events.push(fn);
  21. this.emit('event:on', fn);
  22. }
  23. }
  24. return this;
  25. }
  26. Events.prototype.once = function(name, fn) {
  27. var events = this.events[name];
  28. fn.once = true;
  29. if (!events) {
  30. this.events[name] = [ fn ];
  31. this.emit('event:once', fn);
  32. } else {
  33. if (events.indexOf(fn) == -1) {
  34. events.push(fn);
  35. this.emit('event:once', fn);
  36. }
  37. }
  38. return this;
  39. }
  40. Events.prototype.emit = function(name, args) {
  41. var events = this.events[name];
  42. if (events) {
  43. var i = events.length;
  44. while(i--) {
  45. if (events[i]) {
  46. events[i].call(this, args);
  47. if (events[i].once) {
  48. delete events[i];
  49. }
  50. }
  51. }
  52. }
  53. return this;
  54. }
  55. Events.prototype.unbind = function(name, fn) {
  56. if (name) {
  57. var events = this.events[name];
  58. if (events) {
  59. if (fn) {
  60. var i = events.indexOf(fn);
  61. if (i != -1) {
  62. delete events[i];
  63. }
  64. } else {
  65. delete this.events[name];
  66. }
  67. }
  68. } else {
  69. delete this.events;
  70. this.events = { };
  71. }
  72. return this;
  73. }
  74. var userPrefix;
  75. var prefix = (function () {
  76. var styles = window.getComputedStyle(document.documentElement, ''),
  77. pre = (Array.prototype.slice
  78. .call(styles)
  79. .join('')
  80. .match(/-(moz|webkit|ms)-/) || (styles.OLink === '' && ['', 'o'])
  81. )[1],
  82. dom = ('WebKit|Moz|MS|O').match(new RegExp('(' + pre + ')', 'i'))[1];
  83. userPrefix = {
  84. dom: dom,
  85. lowercase: pre,
  86. css: '-' + pre + '-',
  87. js: pre[0].toUpperCase() + pre.substr(1)
  88. };
  89. })();
  90. function bindEvent(element, type, handler) {
  91. if(element.addEventListener) {
  92. element.addEventListener(type, handler, false);
  93. } else {
  94. element.attachEvent('on' + type, handler);
  95. }
  96. }
  97. function Viewport(data) {
  98. events.add( this );
  99. var self = this;
  100. this.element = data.element;
  101. this.fps = data.fps;
  102. this.sensivity = data.sensivity;
  103. this.sensivityFade = data.sensivityFade;
  104. this.touchSensivity = data.touchSensivity;
  105. this.speed = data.speed;
  106. this.lastX = 0;
  107. this.lastY = 0;
  108. this.mouseX = 0;
  109. this.mouseY = 0;
  110. this.distanceX = 0;
  111. this.distanceY = 0;
  112. this.positionX = 0;
  113. this.positionY = 0;
  114. this.positionZ = 0;
  115. this.torqueX = 0;
  116. this.torqueY = 0;
  117. this.down = false;
  118. this.upsideDown = false;
  119. this.previousPositionX = 0;
  120. this.previousPositionY = 0;
  121. this.previousPositionZ = 0;
  122. this.currentSide = 0;
  123. this.calculatedSide = 0;
  124. bindEvent(data.element /*document*/, 'mousedown', function() { self.down = true; });
  125. bindEvent(data.element, 'mouseup', function() { self.down = false; });
  126. bindEvent(data.element, 'keyup', function() { self.down = false; });
  127. bindEvent(data.element, 'mousemove', function(e) { self.mouseX = e.pageX; self.mouseY = e.pageY; });
  128. bindEvent(data.element, 'touchstart', function(e) {
  129. self.down = true;
  130. e.touches ? e = e.touches[0] : null;
  131. self.mouseX = e.pageX / self.touchSensivity;
  132. self.mouseY = e.pageY / self.touchSensivity;
  133. self.lastX = self.mouseX;
  134. self.lastY = self.mouseY;
  135. });
  136. bindEvent(data.element, 'touchmove', function(e) {
  137. if(e.preventDefault) {
  138. e.preventDefault();
  139. }
  140. if(e.touches.length == 1) {
  141. e.touches ? e = e.touches[0] : null;
  142. self.mouseX = e.pageX / self.touchSensivity;
  143. self.mouseY = e.pageY / self.touchSensivity;
  144. }
  145. });
  146. bindEvent(data.element, 'touchend', function(e) {
  147. self.down = false;
  148. });
  149. setInterval(this.animate.bind(this), this.fps);
  150. }
  151. var events = new Events();
  152. events.add = function(obj) {
  153. obj.events = { };
  154. }
  155. events.implement = function(fn) {
  156. fn.prototype = Object.create(Events.prototype);
  157. }
  158. events.implement(Viewport);
  159. Viewport.prototype.animate = function() {
  160. this.distanceX = (this.mouseX - this.lastX);
  161. this.distanceY = (this.mouseY - this.lastY);
  162. this.lastX = this.mouseX;
  163. this.lastY = this.mouseY;
  164. if(this.down) {
  165. this.torqueX = this.torqueX * this.sensivityFade + (this.distanceX * this.speed - this.torqueX) * this.sensivity;
  166. this.torqueY = this.torqueY * this.sensivityFade + (this.distanceY * this.speed - this.torqueY) * this.sensivity;
  167. }
  168. if(Math.abs(this.torqueX) > 1.0 || Math.abs(this.torqueY) > 1.0) {
  169. if(!this.down) {
  170. this.torqueX *= this.sensivityFade;
  171. this.torqueY *= this.sensivityFade;
  172. }
  173. this.positionY -= this.torqueY;
  174. if(this.positionY > 360) {
  175. this.positionY -= 360;
  176. } else if(this.positionY < 0) {
  177. this.positionY += 360;
  178. }
  179. if(this.positionY > 90 && this.positionY < 270) {
  180. this.positionX -= this.torqueX;
  181. if(!this.upsideDown) {
  182. this.upsideDown = true;
  183. this.emit('upsideDown', { upsideDown: this.upsideDown });
  184. }
  185. } else {
  186. this.positionX += this.torqueX;
  187. if(this.upsideDown) {
  188. this.upsideDown = false;
  189. this.emit('upsideDown', { upsideDown: this.upsideDown });
  190. }
  191. }
  192. if(this.positionX > 360) {
  193. this.positionX -= 360;
  194. } else if(this.positionX < 0) {
  195. this.positionX += 360;
  196. }
  197. if(!(this.positionY >= 46 && this.positionY <= 130) && !(this.positionY >= 220 && this.positionY <= 308)) {
  198. if(this.upsideDown) {
  199. if(this.positionX >= 42 && this.positionX <= 130) {
  200. this.calculatedSide = 3;
  201. } else if(this.positionX >= 131 && this.positionX <= 223) {
  202. this.calculatedSide = 2;
  203. } else if(this.positionX >= 224 && this.positionX <= 314) {
  204. this.calculatedSide = 5;
  205. } else {
  206. this.calculatedSide = 4;
  207. }
  208. } else {
  209. if(this.positionX >= 42 && this.positionX <= 130) {
  210. this.calculatedSide = 5;
  211. } else if(this.positionX >= 131 && this.positionX <= 223) {
  212. this.calculatedSide = 4;
  213. } else if(this.positionX >= 224 && this.positionX <= 314) {
  214. this.calculatedSide = 3;
  215. } else {
  216. this.calculatedSide = 2;
  217. }
  218. }
  219. } else {
  220. if(this.positionY >= 46 && this.positionY <= 130) {
  221. this.calculatedSide = 6;
  222. }
  223. if(this.positionY >= 220 && this.positionY <= 308) {
  224. this.calculatedSide = 1;
  225. }
  226. }
  227. if(this.calculatedSide !== this.currentSide) {
  228. this.currentSide = this.calculatedSide;
  229. this.emit('sideChange');
  230. }
  231. }
  232. this.element.style[userPrefix.js + 'Transform'] = 'rotateX(' + this.positionY + 'deg) rotateY(' + this.positionX + 'deg) rotateZ('+this.positionZ + 'deg)';
  233. if(this.positionY != this.previousPositionY || this.positionX != this.previousPositionX || this.positionZ != this.previousPositionZ ) {
  234. this.previousPositionY = this.positionY;
  235. this.previousPositionX = this.positionX;
  236. this.previousPositionZ = this.positionZ;
  237. this.emit('rotate');
  238. }
  239. }
  240. Viewport.prototype.setDirect = function( A, B, C ) {
  241. if( 1 ) {
  242. this.positionX = A;
  243. this.positionY = B;
  244. this.positionZ = C;
  245. if(this.positionY > 360) {
  246. this.positionY -= 360;
  247. } else if(this.positionY < 0) {
  248. this.positionY += 360;
  249. }
  250. if(this.positionY > 90 && this.positionY < 270) {
  251. if(!this.upsideDown) {
  252. this.upsideDown = true;
  253. this.emit('upsideDown', { upsideDown: this.upsideDown });
  254. }
  255. } else {
  256. if(this.upsideDown) {
  257. this.upsideDown = false;
  258. this.emit('upsideDown', { upsideDown: this.upsideDown });
  259. }
  260. }
  261. if(this.positionX > 360) {
  262. this.positionX -= 360;
  263. } else if(this.positionX < 0) {
  264. this.positionX += 360;
  265. }
  266. if(!(this.positionY >= 46 && this.positionY <= 130) && !(this.positionY >= 220 && this.positionY <= 308)) {
  267. if(this.upsideDown) {
  268. if(this.positionX >= 42 && this.positionX <= 130) {
  269. this.calculatedSide = 3;
  270. } else if(this.positionX >= 131 && this.positionX <= 223) {
  271. this.calculatedSide = 2;
  272. } else if(this.positionX >= 224 && this.positionX <= 314) {
  273. this.calculatedSide = 5;
  274. } else {
  275. this.calculatedSide = 4;
  276. }
  277. } else {
  278. if(this.positionX >= 42 && this.positionX <= 130) {
  279. this.calculatedSide = 5;
  280. } else if(this.positionX >= 131 && this.positionX <= 223) {
  281. this.calculatedSide = 4;
  282. } else if(this.positionX >= 224 && this.positionX <= 314) {
  283. this.calculatedSide = 3;
  284. } else {
  285. this.calculatedSide = 2;
  286. }
  287. }
  288. } else {
  289. if(this.positionY >= 46 && this.positionY <= 130) {
  290. this.calculatedSide = 6;
  291. }
  292. if(this.positionY >= 220 && this.positionY <= 308) {
  293. this.calculatedSide = 1;
  294. }
  295. }
  296. if(this.calculatedSide !== this.currentSide) {
  297. this.currentSide = this.calculatedSide;
  298. this.emit('sideChange');
  299. }
  300. }
  301. this.element.style[userPrefix.js + 'Transform'] = 'rotateX(' + this.positionY + 'deg) rotateY(' + this.positionX + 'deg) rotateZ('+this.positionZ + 'deg)';
  302. if(this.positionY != this.previousPositionY || this.positionX != this.previousPositionX || this.positionZ != this.previousPositionZ ) {
  303. this.previousPositionY = this.positionY;
  304. this.previousPositionX = this.positionX;
  305. this.previousPositionZ = this.positionZ;
  306. this.emit('rotate');
  307. }
  308. }
  309. function Cube(data) {
  310. var self = this;
  311. this.element = data.element;
  312. this.sides = this.element.getElementsByClassName('side');
  313. this.viewport = data.viewport;
  314. this.viewport.on('rotate', function() {
  315. self.rotateSides();
  316. });
  317. this.viewport.on('upsideDown', function(obj) {
  318. self.upsideDown(obj);
  319. });
  320. this.viewport.on('sideChange', function() {
  321. self.sideChange();
  322. });
  323. }
  324. Cube.prototype.rotateSides = function() {
  325. var viewport = this.viewport;
  326. if(viewport.positionY > 90 && viewport.positionY < 270) {
  327. this.sides[0].getElementsByClassName('cube-image')[0].style[userPrefix.js + 'Transform'] = 'rotate(' + (viewport.positionX + viewport.torqueX) + 'deg)';
  328. this.sides[5].getElementsByClassName('cube-image')[0].style[userPrefix.js + 'Transform'] = 'rotate(' + -(viewport.positionX + 180 + viewport.torqueX) + 'deg)';
  329. } else {
  330. this.sides[0].getElementsByClassName('cube-image')[0].style[userPrefix.js + 'Transform'] = 'rotate(' + (viewport.positionX - viewport.torqueX) + 'deg)';
  331. this.sides[5].getElementsByClassName('cube-image')[0].style[userPrefix.js + 'Transform'] = 'rotate(' + -(viewport.positionX + 180 - viewport.torqueX) + 'deg)';
  332. }
  333. }
  334. Cube.prototype.upsideDown = function(obj) {
  335. var deg = (obj.upsideDown == true) ? '180deg' : '0deg';
  336. var i = 5;
  337. while(i > 0 && --i) {
  338. this.sides[i].getElementsByClassName('cube-image')[0].style[userPrefix.js + 'Transform'] = 'rotate(' + deg + ')';
  339. }
  340. }
  341. Cube.prototype.sideChange = function() {
  342. for(var i = 0; i < this.sides.length; ++i) {
  343. this.sides[i].getElementsByClassName('cube-image')[0].className = 'cube-image';
  344. }
  345. this.sides[this.viewport.currentSide - 1].getElementsByClassName('cube-image')[0].className = 'cube-image active';
  346. }
  347. Cube.prototype.set = function( A, B, C ) {
  348. //C = C + 90.0;
  349. this.viewport.setDirect( A, B, C );
  350. }
  351. //var viewport = new Viewport({
  352. // element: document.getElementsByClassName('cube')[0],
  353. // fps: 20,
  354. // sensivity: .1,
  355. // sensivityFade: .93,
  356. // speed: 2,
  357. // touchSensivity: 1.5
  358. //});
  359. //new Cube({
  360. // viewport: viewport,
  361. // element: document.getElementsByClassName('cube')[0]
  362. //});
  363. var LRF3D_Icon = L.icon({
  364. iconUrl: '/style/assets/5_node.png',
  365. //shadowUrl: 'leaf-shadow.png',
  366. iconSize: [64, 64], // size of the icon
  367. //shadowSize: [50, 64], // size of the shadow
  368. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  369. //shadowAnchor: [4, 62], // the same for the shadow
  370. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  371. });
  372. var LFS_Icon = L.icon({
  373. iconUrl: '/style/assets/2_node.png',
  374. //shadowUrl: 'leaf-shadow.png',
  375. iconSize: [64, 64], // size of the icon
  376. //shadowSize: [50, 64], // size of the shadow
  377. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  378. //shadowAnchor: [4, 62], // the same for the shadow
  379. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  380. });
  381. var PLS200_Icon = L.icon({
  382. iconUrl: '/style/assets/3_node.png',
  383. //shadowUrl: 'leaf-shadow.png',
  384. iconSize: [64, 64], // size of the icon
  385. //shadowSize: [50, 64], // size of the shadow
  386. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  387. //shadowAnchor: [4, 62], // the same for the shadow
  388. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  389. });
  390. var PLSNET200_Icon = L.icon({
  391. iconUrl: '/style/assets/6_node.png',
  392. //shadowUrl: 'leaf-shadow.png',
  393. iconSize: [64, 64], // size of the icon
  394. //shadowSize: [50, 64], // size of the shadow
  395. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  396. //shadowAnchor: [4, 62], // the same for the shadow
  397. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  398. });
  399. var PLS360_Icon = L.icon({
  400. iconUrl: '/style/assets/4_node.png',
  401. //shadowUrl: 'leaf-shadow.png',
  402. iconSize: [64, 64], // size of the icon
  403. //shadowSize: [50, 64], // size of the shadow
  404. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  405. //shadowAnchor: [4, 62], // the same for the shadow
  406. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  407. });
  408. var ALS_Icon = L.icon({
  409. iconUrl: '/style/assets/1_node.png',
  410. //shadowUrl: 'leaf-shadow.png',
  411. iconSize: [64, 64], // size of the icon
  412. //shadowSize: [50, 64], // size of the shadow
  413. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  414. //shadowAnchor: [4, 62], // the same for the shadow
  415. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  416. });
  417. var PTZCAM_Icon = L.icon({
  418. iconUrl: '/style/assets/12_node.png',
  419. //shadowUrl: 'leaf-shadow.png',
  420. iconSize: [64, 64], // size of the icon
  421. //shadowSize: [50, 64], // size of the shadow
  422. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  423. //shadowAnchor: [4, 62], // the same for the shadow
  424. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  425. });
  426. var FIXCAM_Icon = L.icon({
  427. iconUrl: '/style/assets/11_node.png',
  428. //shadowUrl: 'leaf-shadow.png',
  429. iconSize: [64, 64], // size of the icon
  430. //shadowSize: [50, 64], // size of the shadow
  431. iconAnchor: [32, 32], // point of the icon which will correspond to marker's location
  432. //shadowAnchor: [4, 62], // the same for the shadow
  433. popupAnchor: [0, -30] // point from which the popup should open relative to the iconAnchor
  434. });
  435. var SITEZ_Icon = L.icon({
  436. iconUrl: '/style/assets/centre_1.png',
  437. //shadowUrl: 'leaf-shadow.png',
  438. iconSize: [32, 32], // size of the icon
  439. //shadowSize: [50, 64], // size of the shadow
  440. iconAnchor: [16, 16], // point of the icon which will correspond to marker's location
  441. //shadowAnchor: [4, 62], // the same for the shadow
  442. popupAnchor: [0, -15] // point from which the popup should open relative to the iconAnchor
  443. });
  444. var SNAPE_Icon = L.icon({
  445. iconUrl: '/style/assets/cursor.png',
  446. //shadowUrl: 'leaf-shadow.png',
  447. iconSize: [32, 32], // size of the icon
  448. //shadowSize: [50, 64], // size of the shadow
  449. iconAnchor: [16, 16], // point of the icon which will correspond to marker's location
  450. //shadowAnchor: [4, 62], // the same for the shadow
  451. popupAnchor: [0, -15] // point from which the popup should open relative to the iconAnchor
  452. });
  453. var locationSelectedNode = 0;
  454. function loadLoactionProps( e ){
  455. if( typeof e == 'number' ){
  456. locationSelectedNode = e;
  457. } else {
  458. locationSelectedNode = e.sourceTarget.options.mycustomid;
  459. }
  460. loadNodeLocationProps( locationSelectedNode );
  461. };
  462. function updateSiteAnchor(){
  463. SiteLat = Ext.getCmp('siteLat').getValue();
  464. SiteLon = Ext.getCmp('siteLon').getValue();
  465. SiteAlt = Ext.getCmp('siteAlt').getValue();
  466. Ext.Ajax.request({
  467. url: '/lib/controller/updateLocation.php',
  468. params: {
  469. SITE: <?=$SiteID;?>,
  470. UID: <?=$UserID;?>,
  471. TYPE: 1,
  472. SID: '<?=$Session;?>',
  473. LAT: SiteLat,
  474. LON: SiteLon,
  475. ALT: SiteAlt
  476. },
  477. failure: failureAJAXFunction
  478. });
  479. };
  480. function updateLocationOrientation(){
  481. var tLat = Ext.getCmp('slat').getValue();
  482. var tLon = Ext.getCmp('slon').getValue();
  483. var tAlt = Ext.getCmp('salt').getValue();
  484. var tRoll = Ext.getCmp('sroll').getValue();
  485. var tPitch = Ext.getCmp('spitch').getValue();
  486. var tYaw = Ext.getCmp('syaw').getValue();
  487. Ext.Ajax.request({
  488. url: '/lib/controller/updateLocation.php',
  489. params: {
  490. NODE: locationSelectedNode,
  491. UID: <?=$UserID;?>,
  492. TYPE: 2,
  493. SID: '<?=$Session;?>',
  494. LAT: tLat,
  495. LON: tLon,
  496. ALT: tAlt,
  497. YAW: tYaw,
  498. ROLL: tRoll,
  499. PITCH: tPitch
  500. },
  501. failure: failureAJAXFunction
  502. });
  503. };
  504. var iconSaver = null;
  505. var markerSaver = null;
  506. function updateLocation( e ){
  507. locationSelectedNode = e.target.options.mycustomid;
  508. Ext.Ajax.request({
  509. url: '/lib/controller/updateLocation.php',
  510. params: {
  511. NODE: locationSelectedNode,
  512. SITE: <?=$SiteID;?>,
  513. UID: <?=$UserID;?>,
  514. TYPE: 0,
  515. SID: '<?=$Session;?>',
  516. LAT: e.target._latlng.lat,
  517. LON: e.target._latlng.lng
  518. },
  519. success: function( response, opts ){
  520. loadNodeLocationProps( locationSelectedNode );
  521. },
  522. failure: failureAJAXFunction
  523. });
  524. };
  525. function markerDblClick( e ){
  526. if( iconSaver == null ){
  527. iconSaver = e.target.options.icon;
  528. markerSaver = e.target;
  529. e.target.setIcon( SNAPE_Icon );
  530. for( i=0; i< markers.length; i++){
  531. if( markers[i].options.mycustomid != e.target.options.mycustomid ){
  532. markers[i].setOpacity( 0.1 );
  533. } else {
  534. markers[i].setOpacity( 1.0 );
  535. }
  536. };
  537. } else {
  538. if( e.target.options.mycustomid == markerSaver.options.mycustomid ){
  539. e.target.setIcon( iconSaver );
  540. iconSaver = null;
  541. markerSaver = null;
  542. for( i=0; i< markers.length; i++){
  543. markers[i].setOpacity( 1.0 );
  544. };
  545. } else {
  546. markerSaver.setIcon( iconSaver );
  547. iconSaver = e.target.options.icon;
  548. markerSaver = e.target;
  549. e.target.setIcon( SNAPE_Icon );
  550. for( i=0; i< markers.length; i++){
  551. if( markers[i].options.mycustomid != e.target.options.mycustomid ){
  552. markers[i].setOpacity( 0.1 );
  553. } else {
  554. markers[i].setOpacity( 1.0 );
  555. }
  556. };
  557. };
  558. };
  559. };
  560. function setNodeLocationToAnchor(){
  561. Ext.Ajax.request({
  562. url: '/lib/controller/updateLocation.php',
  563. params: {
  564. NODE: locationSelectedNode,
  565. SITE: <?=$SiteID;?>,
  566. UID: <?=$UserID;?>,
  567. TYPE: 0,
  568. SID: '<?=$Session;?>',
  569. LAT: SiteLat,
  570. LON: SiteLon,
  571. ALT: SiteAlt
  572. },
  573. success: function( response, opts ){
  574. loadLocationEditor();
  575. },
  576. failure: failureAJAXFunction
  577. });
  578. };
  579. function setNodeLocationByDelta(){
  580. var dx = Ext.getCmp('dx').getValue();
  581. var dy = Ext.getCmp('dy').getValue();
  582. var dz = Ext.getCmp('dz').getValue();
  583. Ext.Ajax.request({
  584. url: '/lib/controller/updateLocation.php',
  585. params: {
  586. NODE: locationSelectedNode,
  587. SITE: <?=$SiteID;?>,
  588. UID: <?=$UserID;?>,
  589. TYPE: 3,
  590. SID: '<?=$Session;?>',
  591. LAT: dx,
  592. LON: dy,
  593. ALT: dz
  594. },
  595. success: function( response, opts ){
  596. loadLocationEditor();
  597. },
  598. failure: failureAJAXFunction
  599. });
  600. };
  601. function loadLocationNodes(){
  602. Ext.Ajax.request({
  603. url: '/lib/controller/getLocationItems.php',
  604. params: {
  605. SITE: <?=$SiteID;?>,
  606. UID: <?=$UserID;?>,
  607. SID: '<?=$Session;?>'
  608. },
  609. success: function( response, opts ){
  610. var data = Ext.decode(response.responseText);
  611. for( i=0; i < data.length; i++){
  612. switch( data[i].type ){
  613. case 1:{
  614. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: ALS_Icon, mycustomid:data[i].id } ).addTo(map).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  615. break;
  616. };
  617. case 2:{
  618. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: LFS_Icon, mycustomid:data[i].id } ).addTo(map).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  619. break;
  620. };
  621. case 3:{
  622. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: PLS200_Icon, mycustomid:data[i].id } ).addTo(map).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  623. break;
  624. };
  625. case 4:{
  626. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: PLS360_Icon, mycustomid:data[i].id } ).addTo(map).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  627. break;
  628. };
  629. case 5:{
  630. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: LRF3D_Icon, mycustomid:data[i].id } ).addTo(map).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  631. break;
  632. };
  633. case 6:{
  634. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: PLSNET200_Icon, mycustomid:data[i].id } ).addTo(map).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  635. break;
  636. };
  637. case 10:
  638. case 12:{
  639. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: FIXCAM_Icon, mycustomid:data[i].id } ).addTo(map).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  640. break;
  641. };
  642. case 11:
  643. case 13:{
  644. markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: PTZCAM_Icon, mycustomid:data[i].id } ).addTo(map).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
  645. break;
  646. };
  647. };
  648. //bindPopup('A pretty CSS3 popup.<br> Easily customizable.');//.openPopup();
  649. };
  650. },
  651. failure: function( response, opts ) {
  652. var tPanel = Ext.getCmp('main_portal');
  653. tPanel.remove(0);
  654. tPanel.add( { html: 'Failed to load dashboard!' } );
  655. tPanel.doLayout();
  656. }
  657. });
  658. };
  659. var orientationEditorWindow = null;
  660. var cubeViewport = null;
  661. var cube = null;
  662. var curX = 0;
  663. var curY = 0;
  664. var curZ = 0;
  665. var bk_upd = false;
  666. function setCubeOrientation( A, B, C ){
  667. if( bk_upd ) return;
  668. bk_upd = true;
  669. curX = A;
  670. curY = B;
  671. curZ = C;
  672. var t = Ext.getCmp('roll_sld');
  673. t.setValue( A );
  674. t = Ext.getCmp('roll');
  675. t.setValue( A );
  676. t = Ext.getCmp('pitch_sld');
  677. t.setValue( B );
  678. t = Ext.getCmp('pitch');
  679. t.setValue( B );
  680. t = Ext.getCmp('yaw_sld');
  681. t.setValue( C );
  682. t = Ext.getCmp('yaw');
  683. t.setValue( C );
  684. if( cube != null ) cube.set( curX, curY, curZ );
  685. bk_upd = false;
  686. };
  687. function orientationEditor(){
  688. if( orientationEditorWindow == null ){
  689. orientationEditorWindow = new Ext.Window({
  690. modal: true,
  691. title: 'Orientation',
  692. closeAction: 'hide',
  693. width: 640,
  694. height: 500,
  695. items:[{
  696. layout: 'table',
  697. defaults: {
  698. bodyStyle:'padding:5px'
  699. },
  700. layoutConfig: {
  701. columns: 3
  702. },
  703. items:[{
  704. html: 'Roll:'
  705. },{
  706. xtype: 'textfield',
  707. id: 'roll',
  708. name: 'roll',
  709. value: 30.0029,
  710. listeners:{
  711. change: function( sl, nv, tt ){
  712. setCubeOrientation( nv / 1.0, curY, curZ );
  713. }
  714. }
  715. },{
  716. xtype: 'slider',
  717. id: 'roll_sld',
  718. width: 200,
  719. value: 30.0029,
  720. minValue: -180.0,
  721. maxValue: 180.0,
  722. listeners:{
  723. change: function( sl, nv, tt ){
  724. setCubeOrientation( nv, curY, curZ );
  725. }
  726. }
  727. },{
  728. html: 'Pitch:'
  729. },{
  730. xtype: 'textfield',
  731. id: 'pitch',
  732. name: 'pitch',
  733. value: 30.0029,
  734. listeners:{
  735. change: function( sl, nv, tt ){
  736. setCubeOrientation( curX, nv / 1.0, curZ );
  737. }
  738. }
  739. },{
  740. xtype: 'slider',
  741. id: 'pitch_sld',
  742. width: 200,
  743. value: 30.0029,
  744. minValue: -180.0,
  745. maxValue: 180.0,
  746. listeners:{
  747. change: function( sl, nv, tt ){
  748. setCubeOrientation( curX, nv, curZ );
  749. }
  750. }
  751. },{
  752. html: 'Yaw:'
  753. },{
  754. xtype: 'textfield',
  755. id: 'yaw',
  756. name: 'yaw',
  757. value: 30.0029,
  758. listeners:{
  759. change: function( sl, nv, tt ){
  760. //alert( nv );
  761. setCubeOrientation( curX, curY, nv / 1.0 );
  762. }
  763. }
  764. },{
  765. xtype: 'slider',
  766. id: 'yaw_sld',
  767. width: 200,
  768. value: 30.0029,
  769. minValue: -180.0,
  770. maxValue: 180.0,
  771. listeners:{
  772. change: function( sl, nv, tt ){
  773. setCubeOrientation( curX, curY, nv );
  774. }
  775. }
  776. }]
  777. },{
  778. html: '<div id="wrapper"><div class="viewport"><div class="cube"><div class="side"><div class="cube-image top">FRONT</div></div><div class="side"><div class="cube-image">TOP</div></div><div class="side"><div class="cube-image">RIGHT</div></div><div class="side"><div class="cube-image">BOTTOM</div></div><div class="side"><div class="cube-image">LEFT</div></div><div class="side"><div class="cube-image active">BACK</div></div></div></div></div>'
  779. }],
  780. buttons:[{
  781. text: 'Cancel',
  782. width: 200,
  783. handler: function(){
  784. orientationEditorWindow.hide();
  785. }
  786. },{
  787. text: 'Apply',
  788. width: 200,
  789. handler: function(){
  790. Ext.getCmp('sroll').setValue( Ext.getCmp('roll').getValue() );
  791. Ext.getCmp('spitch').setValue( Ext.getCmp('pitch').getValue() );
  792. Ext.getCmp('syaw').setValue( Ext.getCmp('yaw').getValue() );
  793. orientationEditorWindow.hide();
  794. }
  795. }]
  796. });
  797. orientationEditorWindow.show();
  798. cubeViewport = new Viewport({
  799. element: document.getElementsByClassName('cube')[0],
  800. fps: 20,
  801. sensivity: .1,
  802. sensivityFade: .93,
  803. speed: 2,
  804. touchSensivity: 1.5
  805. });
  806. cube = new Cube({
  807. viewport: cubeViewport,
  808. element: document.getElementsByClassName('cube')[0]
  809. });
  810. } else {
  811. orientationEditorWindow.show();
  812. };
  813. setCubeOrientation( Ext.getCmp('sroll').getValue(), Ext.getCmp('spitch').getValue(), Ext.getCmp('syaw').getValue() );
  814. };
  815. function loadNodeLocationProps( NodeID ){
  816. //alert( 'Node: ' + NodeID );
  817. Ext.Ajax.request({
  818. url: '/lib/controller/getLocationNodeProps.php',
  819. params: {
  820. NID: <?=$SiteID;?>,
  821. UID: <?=$UserID;?>,
  822. SID: '<?=$Session;?>',
  823. NODE: NodeID
  824. },
  825. success: function( response, opts ){
  826. // If the response is JSON, you have to decode it
  827. var data = Ext.decode(response.responseText);
  828. var tPanel = Ext.getCmp('prop_content');
  829. tPanel.remove(0);
  830. tPanel.add( data );
  831. tPanel.doLayout();
  832. },
  833. failure: failureAJAXFunction
  834. });
  835. };
  836. function LoadNodesList(){
  837. Ext.Ajax.request({
  838. url: '/lib/controller/getLocationNodes.php',
  839. params: {
  840. SITE: <?=$SiteID;?>,
  841. UID: <?=$UserID;?>,
  842. SID: '<?=$Session;?>'
  843. },
  844. success: function( response, opts ){
  845. // If the response is JSON, you have to decode it
  846. var data = Ext.decode(response.responseText);
  847. var tPanel = Ext.getCmp('prop_content');
  848. tPanel.remove(0);
  849. tPanel.add( data );
  850. tPanel.doLayout();
  851. },
  852. failure: failureAJAXFunction
  853. });
  854. };
  855. function loadLocationEditor(){
  856. if( tlInterval!= null ){
  857. window.clearInterval( tlInterval );
  858. tlInterval = null;
  859. timelineObj = null;
  860. };
  861. var tPanel = Ext.getCmp('main_portal');
  862. tPanel.removeAll( true );
  863. Ext.getCmp('main_content').setTitle( '<?=$Labels->GetLabel('_LOC_MAP_LBL_');?>' );
  864. tPanel.add({
  865. columnWidth: 0.83,
  866. frame: false,
  867. border: false,
  868. items: [{
  869. layout: 'fit',
  870. height: PanelH-150,
  871. flex: 1,
  872. //border: true,
  873. items:{
  874. id: 'location_map'
  875. }
  876. },{
  877. layout: 'table',
  878. title: '<?=$Labels->GetLabel('_SITE_PROP_LBL_');?>',
  879. flex: 1,
  880. defaults: {
  881. bodyStyle:'padding:20px'
  882. },
  883. layoutConfig: {
  884. // The total column count must be specified here
  885. columns: 7,
  886. textAlign: 'center'
  887. },
  888. items:[{
  889. html: '<?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?> <?=$Labels->GetLabel('_LAT_SHORT_LBL_');?>:'
  890. },{
  891. xtype: 'textfield',
  892. id: 'siteLat',
  893. value: SiteLat
  894. },{
  895. html: '<?=$Labels->GetLabel('_LON_SHORT_LBL_');?>:'
  896. },{
  897. xtype: 'textfield',
  898. id: 'siteLon',
  899. value: SiteLon
  900. },{
  901. html: '<?=$Labels->GetLabel('_ALT_SHORT_LBL_');?>:'
  902. },{
  903. xtype: 'textfield',
  904. id: 'siteAlt',
  905. value: SiteAlt
  906. },{
  907. xtype: 'button',
  908. text: '<?=$Labels->GetLabel('_UPDATE_LBL_');?>',
  909. handler: updateSiteAnchor
  910. },{
  911. html: '<?=$Labels->GetLabel('_MAP_TYP_LBL_');?>:'
  912. },{
  913. xtype: 'radio',
  914. name: 'map_type',
  915. boxLabel: '<?=$Labels->GetLabel('_MAP_REG_LBL_');?>',
  916. checked: true,
  917. value: 0
  918. },{
  919. xtype: 'radio',
  920. name: 'map_type',
  921. boxLabel: '<?=$Labels->GetLabel('_MAP_CUST_LBL_');?>',
  922. colspan: 2,
  923. value: 1
  924. },{
  925. xtype: 'combo',
  926. disabled: true,
  927. typeAhead: true,
  928. triggerAction: 'all',
  929. lazyRender:true,
  930. colspan: 2,
  931. mode: 'local',
  932. store: new Ext.data.ArrayStore({
  933. id: 0,
  934. fields: ['myId', 'displayText' ],
  935. data: [[1, 'item1'], [2, 'item2']]
  936. }),
  937. valueField: 'myId',
  938. displayField: 'displayText'
  939. },{
  940. xtype: 'button',
  941. id: 'add-c_map-btn',
  942. disabled: true,
  943. text: '<?=$Labels->GetLabel('_CREATE_NEW_LBL_');?>'
  944. }]
  945. }]
  946. });
  947. tPanel.add({
  948. title: 'Properties',
  949. xtype: 'panel',
  950. flex: 1,
  951. height: 700,
  952. columnWidth: 0.17,
  953. layout: 'fit',
  954. id: 'prop_content',
  955. items:[{
  956. html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>'
  957. }]
  958. });
  959. tPanel.doLayout();
  960. map = L.map('location_map',{
  961. attributionControl: true,
  962. //preferCanvas: true,
  963. zoomControl: true,
  964. center: [SiteLat, SiteLon],
  965. /*zoomControl: false,
  966. zoom: 17,
  967. minZoom: 17,
  968. maxZoom: 17,*/
  969. keyboard: false
  970. }).setView([SiteLat, SiteLon], 17);
  971. L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon, zIndexOffset: 1000 } ).addTo(map).on('click', LoadNodesList ).bindPopup("<b><?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?></b>");//.openPopup();
  972. var mapLayers = [];
  973. mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  974. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  975. maxNativeZoom: 18,
  976. maxZoom: 24,
  977. })
  978. // https://leaflet-extras.github.io/leaflet-providers/preview/
  979. mapLayers["EsriStreet"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
  980. attribution: 'Tiles &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012',
  981. maxZoom: 19
  982. });
  983. mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
  984. attribution: 'Tiles &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community',
  985. maxZoom: 19
  986. });
  987. mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
  988. attribution: 'Tiles &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community',
  989. maxZoom: 24
  990. });
  991. mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde
  992. attribution: 'Map data &copy; <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors',
  993. maxZoom: 19
  994. });
  995. mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
  996. attribution: 'Kartendaten: &copy; <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>-Mitwirkende, SRTM | Kartendarstellung: &copy; <a href="http://opentopomap.org/" target="_blank">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/" target="_blank">CC-BY-SA</a>) ',
  997. maxZoom: 19
  998. });
  999. /*
  1000. mapLayers["Cycle"] = L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1001. attribution: 'Maps &copy; <a href="https://www.thunderforest.com" target="_blank">Thunderforest</a>, Data © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors</a>',
  1002. maxZoom: 22
  1003. });
  1004. mapLayers["Landscape"] = L.tileLayer('https://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1005. attribution: 'Maps &copy; <a href="https://www.thunderforest.com" target="_blank">Thunderforest</a>, Data © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors</a>',
  1006. maxZoom: 22
  1007. });
  1008. mapLayers["Outdoor"] = L.tileLayer('https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1009. attribution: 'Maps &copy; <a href="https://www.thunderforest.com" target="_blank">Thunderforest</a>, Data © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors</a>',
  1010. maxZoom: 22
  1011. });
  1012. */
  1013. var baseMaps = {
  1014. "MyMap": mapLayers["MyMap"],
  1015. "OpenStreetMap": mapLayers["OpenStreetMap"],
  1016. "OpenTopoMap": mapLayers["OpenTopoMap"],
  1017. "EsriSat": mapLayers["EsriSat"],
  1018. "EsriStreet": mapLayers["EsriStreet"],
  1019. "EsriTopo": mapLayers["EsriTopo"],
  1020. //"Bing": mapLayers["Bing"],
  1021. //"OSM-Cycle": mapLayers["Cycle"],
  1022. //"Landscape": mapLayers["Landscape"],
  1023. //"Outdoor": mapLayers["Outdoor"],
  1024. };
  1025. L.control.layers( baseMaps ).addTo(map);
  1026. mapLayers["MyMap"].addTo(map);
  1027. /*
  1028. Ext.Ajax.request({
  1029. url: '/lib/controller/getNetwork.php',
  1030. params: {
  1031. NID: selectedSite,
  1032. UID: <?=$UserID;?>,
  1033. SID: '<?=$Session;?>'
  1034. },
  1035. success: function( response, opts ){
  1036. /*
  1037. layout: { improvedLayout: false }
  1038. physics: { enabled: true}
  1039. For the node, set a property called fixed:
  1040. fixed: { x: true , y: true }
  1041. Here is the son of the node:
  1042. {id: 1, value: 2, label: 'xx' , x: 320, y:170 , fixed: { x: true , y: true } }
  1043. // If the response is JSON, you have to decode it
  1044. var data = Ext.decode(response.responseText);
  1045. netwodkData.nodes = new vis.DataSet( data.nodes );
  1046. netwodkData.edges = new vis.DataSet( data.edges );
  1047. //map.createPane( 'my_network' );
  1048. //map.getPane('my_network').style.zIndex = 1650;
  1049. //map.getPane('my_network').style.pointerEvents = 'none';
  1050. //map.getPane('my_network').innerHTML = "<div id=\"net_cont\" style=\"width: 640px; height: 500px;\"></div>";
  1051. //var container = document.getElementById(Ext.getCmp('net_cont').body.id);
  1052. //var container = document.getElementById( 'net_cont' );
  1053. var container =map.getPane('markerPane');
  1054. networkObj = new vis.Network( container, netwodkData, networkOpts );
  1055. },
  1056. failure: function( response, opts ) {
  1057. //Ext.fly('some_div').update('Fail!');
  1058. }
  1059. });
  1060. */
  1061. /*
  1062. var map = L.map('map', {
  1063. crs: L.CRS.Simple
  1064. });
  1065. var map = L.map('map', {
  1066. crs: L.CRS.Simple,
  1067. minZoom: -5
  1068. });
  1069. var bounds = [[0,0], [1000,1000]];
  1070. var image = L.imageOverlay('uqm_map_full.png', bounds).addTo(map);
  1071. var bounds = [[-26.5,-25], [1021.5,1023]];
  1072. var image = L.imageOverlay('uqm_map_full.png', bounds).addTo(map);
  1073. map.fitBounds(bounds);
  1074. var sol = L.latLng([ 145, 175.2 ]);
  1075. L.marker(sol).addTo(map);
  1076. map.setView( [70, 120], 1);
  1077. var travel = L.polyline([sol, deneb]).addTo(map);
  1078. L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
  1079. attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
  1080. maxZoom: 18,
  1081. id: 'mapbox/streets-v11',
  1082. tileSize: 512,
  1083. zoomOffset: -1,
  1084. accessToken: 'your.mapbox.access.token'
  1085. }).addTo(mymap);
  1086. var circle = L.circle([51.508, -0.11], {
  1087. color: 'red',
  1088. fillColor: '#f03',
  1089. fillOpacity: 0.5,
  1090. radius: 500
  1091. }).addTo(mymap);
  1092. var polygon = L.polygon([
  1093. [51.509, -0.08],
  1094. [51.503, -0.06],
  1095. [51.51, -0.047]
  1096. ]).addTo(mymap);
  1097. marker.bindPopup("<b>Hello world!</b><br>I am a popup.").openPopup();
  1098. circle.bindPopup("I am a circle.");
  1099. polygon.bindPopup("I am a polygon.");
  1100. function onMapClick(e) {
  1101. alert("You clicked the map at " + e.latlng);
  1102. }
  1103. mymap.on('click', onMapClick);
  1104. */
  1105. L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  1106. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
  1107. }).addTo(map);
  1108. loadLocationNodes();
  1109. };