// joyzoom control function NewCtrlJoyZoom(map, ctrlJoyZoom) { var ctrl = this; var imageThis = this; ctrl.hndzoomend = null; ctrl.hndgradend = null; ctrl.map = map; ctrl.mapi = null; ctrl.zoommin = 5; ctrl.zoommax = 19; ctrl.isongps = false; ctrl.poslat = '-'; ctrl.poslng = '-'; ctrl.posh = '-'; ctrl.mapclicklistener = null; ctrl.node = ctrlJoyZoom; ctrl.node.style.position = "absolute"; ctrl.node.style.left = '0px'; ctrl.nodebkg = document.createElement('div'); ctrl.nodebkg.style.position = "absolute"; ctrl.nodebkg.style.cursor = "default"; ctrl.nodebkg.style.backgroundAttachment = 'scroll'; ctrl.nodebkg.style.backgroundClip = ''; ctrl.nodebkg.style.backgroundColor = 'transparent'; ctrl.nodebkg.style.backgroundImage = 'url("http://www.kamennimuzici.cz/images/bg_tools.png")'; ctrl.nodebkg.style.backgroundOrigin = ''; ctrl.nodebkg.style.backgroundPosition = '0% 0%'; ctrl.nodebkg.style.backgroundRepeat = 'repeat'; ctrl.nodebkg.style.backgroundSize = ''; ctrl.nodebkg.style.marginTop = "0px"; ctrl.nodebkg.style.marginLeft = "0px"; ctrl.nodebkg.style.width = "296px"; ctrl.nodebkg.style.height = (85)+"px"; ctrl.node.appendChild(ctrl.nodebkg); ctrl.nodebtncenter = document.createElement('div'); ctrl.nodebtncenter.style.position = "absolute"; ctrl.nodebtncenter.style.width = "22px"; ctrl.nodebtncenter.style.height = "23px"; ctrl.nodebtncenter.style.marginTop = "31px"; ctrl.nodebtncenter.style.marginLeft = "31px"; ctrl.nodebtncenter.style.backgroundColor = "#FFFFFF"; ctrl.nodebtncenter.style.cursor = "default"; ctrl.node.appendChild(ctrl.nodebtncenter); ctrl.nodebtnup = document.createElement('div'); ctrl.nodebtnup.style.position = "absolute"; ctrl.nodebtnup.style.width = "22px"; ctrl.nodebtnup.style.height = "21px"; ctrl.nodebtnup.style.marginTop = "10px"; ctrl.nodebtnup.style.marginLeft = "32px"; ctrl.nodebtnup.style.background = "url('http://www.kamennimuzici.cz/images/nav_up.png')"; ctrl.nodebtnup.style.cursor = "pointer"; ctrl.node.appendChild(ctrl.nodebtnup); ctrl.nodebtnleft = document.createElement('div'); ctrl.nodebtnleft.style.position = "absolute"; ctrl.nodebtnleft.style.width = "22px"; ctrl.nodebtnleft.style.height = "23px"; ctrl.nodebtnleft.style.marginTop = "31px"; ctrl.nodebtnleft.style.marginLeft = "10px"; ctrl.nodebtnleft.style.background = "url('http://www.kamennimuzici.cz/images/nav_left.png')"; ctrl.nodebtnleft.style.cursor = "pointer"; ctrl.node.appendChild(ctrl.nodebtnleft); ctrl.nodebtnright = document.createElement('div'); ctrl.nodebtnright.style.position = "absolute"; ctrl.nodebtnright.style.width = "22px"; ctrl.nodebtnright.style.height = "23px"; ctrl.nodebtnright.style.marginTop = "31px"; ctrl.nodebtnright.style.marginLeft = "53px"; ctrl.nodebtnright.style.background = "url('http://www.kamennimuzici.cz/images/nav_right.png')"; ctrl.nodebtnright.style.cursor = "pointer"; ctrl.node.appendChild(ctrl.nodebtnright); ctrl.nodebtndown = document.createElement('div'); ctrl.nodebtndown.style.position = "absolute"; ctrl.nodebtndown.style.width = "22px"; ctrl.nodebtndown.style.height = "23px"; ctrl.nodebtndown.style.marginTop = "52px"; ctrl.nodebtndown.style.marginLeft = "32px"; ctrl.nodebtndown.style.background = "url('http://www.kamennimuzici.cz/images/nav_down.png')"; ctrl.nodebtndown.style.cursor = "pointer"; ctrl.node.appendChild(ctrl.nodebtndown); ctrl.nodebtnzoomtop = document.createElement('div'); ctrl.nodebtnzoomtop.style.position = "absolute"; ctrl.nodebtnzoomtop.style.width = "18px"; ctrl.nodebtnzoomtop.style.height = "7px"; ctrl.nodebtnzoomtop.style.marginTop = "107px"; ctrl.nodebtnzoomtop.style.marginLeft = "34px"; ctrl.nodebtnzoomtop.style.background = "url('http://www.kamennimuzici.cz/images/nav_zoomtop.png')"; //ctrl.node.appendChild(ctrl.nodebtnzoomtop); ctrl.nodebtnzoomin = document.createElement('div'); ctrl.nodebtnzoomin.style.position = "absolute"; ctrl.nodebtnzoomin.style.width = "23px"; ctrl.nodebtnzoomin.style.height = "22px"; ctrl.nodebtnzoomin.style.marginTop = "10px"; ctrl.nodebtnzoomin.style.marginLeft = "90px"; ctrl.nodebtnzoomin.style.background = "url('http://www.kamennimuzici.cz/images/nav_zoomin.png')"; ctrl.nodebtnzoomin.style.cursor = "pointer"; ctrl.node.appendChild(ctrl.nodebtnzoomin); ctrl.nodebtnzoomlvl = new Array(); for (var ti = ctrl.zoommin; ti <= ctrl.zoommax; ti++) { var ti2 = ctrl.nodebtnzoomlvl.length; ctrl.nodebtnzoomlvl[ti2] = document.createElement('div'); ctrl.nodebtnzoomlvl[ti2].style.position = "absolute"; ctrl.nodebtnzoomlvl[ti2].style.width = "18px"; ctrl.nodebtnzoomlvl[ti2].style.height = "9px"; ctrl.nodebtnzoomlvl[ti2].style.marginTop = (113 + ti2 * 9)+"px"; ctrl.nodebtnzoomlvl[ti2].style.marginLeft = "34px"; ctrl.nodebtnzoomlvl[ti2].style.background = "url('http://www.kamennimuzici.cz/images/nav_zoomi.png')"; //ctrl.node.appendChild(ctrl.nodebtnzoomlvl[ti2]); } ctrl.nodebtnzoombottom = document.createElement('div'); ctrl.nodebtnzoombottom.style.position = "absolute"; ctrl.nodebtnzoombottom.style.width = "18px"; ctrl.nodebtnzoombottom.style.height = "7px"; ctrl.nodebtnzoombottom.style.marginTop = (113 + (ctrl.zoommax - ctrl.zoommin + 1) * 9)+"px"; ctrl.nodebtnzoombottom.style.marginLeft = "34px"; ctrl.nodebtnzoombottom.style.background = "url('http://www.kamennimuzici.cz/images/nav_zoombot.png')"; //ctrl.node.appendChild(ctrl.nodebtnzoombottom); ctrl.nodebtnzoomout = document.createElement('div'); ctrl.nodebtnzoomout.style.position = "absolute"; ctrl.nodebtnzoomout.style.width = "23px"; ctrl.nodebtnzoomout.style.height = "22px"; ctrl.nodebtnzoomout.style.marginTop = (55)+"px"; ctrl.nodebtnzoomout.style.marginLeft = "90px"; ctrl.nodebtnzoomout.style.background = "url('http://www.kamennimuzici.cz/images/nav_zoomout.png')"; ctrl.nodebtnzoomout.style.cursor = "pointer"; ctrl.node.appendChild(ctrl.nodebtnzoomout); ctrl.nodebtnzoomsliderbound = document.createElement('div'); ctrl.nodebtnzoomsliderbound.style.position = "absolute"; ctrl.nodebtnzoomsliderbound.style.width = "25px"; ctrl.nodebtnzoomsliderbound.style.height = ((ctrl.zoommax - ctrl.zoommin + 1) * 9)+"px"; ctrl.nodebtnzoomsliderbound.style.marginTop = "113px"; ctrl.nodebtnzoomsliderbound.style.marginLeft = "30px"; ctrl.nodebtnzoomsliderbound.style.cursor = "pointer"; //ctrl.node.appendChild(ctrl.nodebtnzoomsliderbound); ctrl.nodebtnzoomslider = document.createElement('div'); ctrl.nodebtnzoomslider.style.position = "absolute"; ctrl.nodebtnzoomslider.style.width = "28px"; ctrl.nodebtnzoomslider.style.height = "13px"; ctrl.nodebtnzoomslider.style.background = "url('http://www.kamennimuzici.cz/images/nav_zoomact.png')"; //ctrl.nodebtnzoomsliderbound.appendChild(ctrl.nodebtnzoomslider); ctrl.nodebtngps = document.createElement('div'); ctrl.nodebtngps.style.position = "absolute"; ctrl.nodebtngps.style.width = "52px"; ctrl.nodebtngps.style.height = "33px"; ctrl.nodebtngps.style.background = "url('http://www.kamennimuzici.cz/images/gps.png')"; ctrl.nodebtngps.style.marginTop = (10) + 'px'; ctrl.nodebtngps.style.marginLeft = "150px"; ctrl.nodebtngps.style.cursor = "pointer"; ctrl.node.appendChild(ctrl.nodebtngps); ctrl.nodebtnpos = document.createElement('div'); ctrl.nodebtnpos.style.position = "absolute"; ctrl.nodebtnpos.style.display = "none"; ctrl.nodebtnpos.style.color = "#F0F0FF"; ctrl.nodebtnpos.style.backgroundColor = "#729332"; ctrl.nodebtnpos.style.border = "1px solid #FFFFFF"; ctrl.nodebtnpos.style.padding = "3px"; ctrl.nodebtnpos.style.marginTop = (50) + 'px'; ctrl.nodebtnpos.style.marginLeft = (150) + 'px'; ctrl.nodebtnpos.style.whiteSpace = 'nowrap'; ctrl.nodebtnpos.innerHTML = 'Klikněte na pozici v mapě'; ctrl.node.appendChild(ctrl.nodebtnpos); ctrl.nodebtncenterZoom = document.createElement('div'); ctrl.nodebtncenterZoom.style.position = "absolute"; ctrl.nodebtncenterZoom.style.width = "22px"; ctrl.nodebtncenterZoom.style.height = "22px"; ctrl.nodebtncenterZoom.style.marginTop = "32px"; ctrl.nodebtncenterZoom.style.marginLeft = "90px"; ctrl.nodebtncenterZoom.style.backgroundColor = "#FFFFFF"; ctrl.nodebtncenterZoom.style.cursor = "default"; ctrl.nodebtncenterZoom.style.textAlign = "center"; ctrl.nodebtncenterZoom.style.verticalAlign = "center"; ctrl.nodebtncenterZoom.style.fontWeight = "bolder"; ctrl.nodebtncenterZoom.innerHTML = this.map.gmap.getZoom();; ctrl.node.appendChild(ctrl.nodebtncenterZoom); ctrl.printable = function() { return false; } ctrl.selectable = function() { return false; } ctrl.zoomend = function() { this.nodebtncenterZoom.innerHTML = this.map.gmap.getZoom(); //var zl = nl; //if (this.zoommax < zl) zl = this.zoommax; //if (this.zoommin > zl) zl = this.zoommin; //this.nodebtnzoomsliderdrg.moveTo(new GPoint(0, (ctrl.zoommax - zl) * 9)); } ctrl.dragend = function() { var h = this.nodebtnzoomslider.style.top.replace(/px/g, ""); var zl = this.zoommax - Math.round(h / 9); if (this.zoommax < zl) zl = this.zoommax; if (this.zoommin > zl) zl = this.zoommin; this.map.gmap.setZoom(zl); return true; } ctrl.zoomclick = function(a, b) { var h = (a.layerY?a.layerY:a.offsetY) - 5; var zl = this.zoommax - Math.round(h / 9); if (this.zoommax < zl) zl = this.zoommax; if (this.zoommin > zl) zl = this.zoommin; this.map.gmap.setZoom(zl); } ctrl.panDirectionUp = function() { this.map.gmap.panBy(0, 10); } ctrl.panDirectionDown = function() { this.map.gmap.panBy(0, -10); } ctrl.panDirectionLeft = function() { this.map.gmap.panBy(10, 0); } ctrl.panDirectionRight = function() { this.map.gmap.panBy(-10, 0) } ctrl.zoomout = function() { zl = this.map.gmap.getZoom(); if (this.zoommin < zl) this.map.gmap.setZoom(zl-1); } ctrl.zoomin = function() { zl = this.map.gmap.getZoom(); if (this.zoommax > zl) this.map.gmap.setZoom(zl+1); } ctrl.flipGPS = function() { if (this.isongps) { this.hideGPS(); } else { this.showGPS(); } } ctrl.hideGPS = function() { this.nodebtnpos.style.display = 'none'; this.isongps = false; } ctrl.showGPS = function() { this.nodebtnpos.style.display = 'block'; this.isongps = true; } ctrl.updateGPS = function() { var pos = 'Klikněte na pozici v mapě'; if (this.poslat != '-') { var pos = DtoDMS(this.poslat) + ', ' + DtoDMS(this.poslng); if (this.posh != '-') pos+= ' (' + this.posh + 'm)'; } this.nodebtnpos.innerHTML = pos; } ctrl.onMapClick = function(e) { latlng = e.latLng; //PJ if (latlng) { this.poslat = latlng.lat(); this.poslng = latlng.lng(); this.updateGPS(); this.updateGPSHeight(); } } ctrl.foundGPSHeight = function(data) { if (data.charAt(0) == 'H') { this.posh = data.substr(1); } else { this.posh = '-'; } this.updateGPS(); } ctrl.errorGPSHeight = function() { this.posh = '-'; this.updateGPS(); } ctrl.completeGPSHeight = function() { } ctrl.updateGPSHeight = function() { addCallback(callbacktype.gpsheightsuccess, this, this.foundGPSHeight); addCallback(callbacktype.gpsheightcomplete, this, this.completeGPSHeight); addCallback(callbacktype.gpsheighterror, this, this.errorGPSHeight); var url = 'getpointheight.php?lat=' + this.poslat + '&lng=' + this.poslng; jQuery.ajax({cache:false, error:function() { runCallback(callbacktype.gpsheighterror, ''); }, success:function(data) { runCallback(callbacktype.gpsheightsuccess, data); }, complete:function() { runCallback(callbacktype.gpsheightcomplete, ''); }, url:url}); } if (ctrl.mapclicklistener) google.maps.event.removeListener(ctrl.mapclicklistener); ctrl.mapclicklistener = google.maps.event.addListener(this.map.gmap, "click", function(e) {ctrl.onMapClick(e);}); google.maps.event.clearInstanceListeners(ctrl.nodebtnup); google.maps.event.addDomListener(ctrl.nodebtnup, "click", function() {ctrl.panDirectionUp();}); google.maps.event.clearInstanceListeners(ctrl.nodebtnleft); google.maps.event.addDomListener(ctrl.nodebtnleft, "click", function() {ctrl.panDirectionLeft();}); google.maps.event.clearInstanceListeners(ctrl.nodebtnright); google.maps.event.addDomListener(ctrl.nodebtnright, "click", function() {ctrl.panDirectionRight();}); google.maps.event.clearInstanceListeners(ctrl.nodebtndown); google.maps.event.addDomListener(ctrl.nodebtndown, "click", function() {ctrl.panDirectionDown();}); google.maps.event.clearInstanceListeners(ctrl.nodebtnzoomin); google.maps.event.addDomListener(ctrl.nodebtnzoomin, "click", function() {ctrl.zoomin();}); google.maps.event.clearInstanceListeners(ctrl.nodebtnzoomout); google.maps.event.addDomListener(ctrl.nodebtnzoomout, "click", function() {ctrl.zoomout();}); //google.maps.event.clearInstanceListeners(ctrl.nodebtnzoomsliderbound); //google.maps.event.addDomListener(ctrl.nodebtnzoomsliderbound, "mousedown", function() {ctrl.zoomclick();}); google.maps.event.clearInstanceListeners(ctrl.nodebtngps); google.maps.event.addDomListener(ctrl.nodebtngps, "click", function() {ctrl.flipGPS();}); //this.nodebtnzoomsliderdrg = new GDraggableObject(this.nodebtnzoomslider, {left: 0, top: 0, container: this.nodebtnzoomsliderbound}); //this.hndgradend = GEvent.bind(this.nodebtnzoomsliderdrg, "dragend", this, this.dragend); if (ctrl.hndzoomend != null) google.maps.event.removeListener(ctrl.hndzoomend); ctrl.hndzoomend = google.maps.event.bind(map.gmap, "zoom_changed", this, function() {this.zoomend();} ); //var zl = ctrl.map.getZoom(); //if (this.zoommax < zl) zl = this.zoommax; //if (this.zoommin > zl) zl = this.zoommin; //this.nodebtnzoomsliderdrg.moveTo(new GPoint(0, (ctrl.zoommax - zl) * 9)); return ctrl; } // menu item function MenuItem(name, callback) { var names = ["KRESLENÍ TRASY","DETAILY TRASY","ZÁJMOVÉ BODY","VRSTVY MAPY","HLEDÁNÍ V MAPĚ","HLEDÁNÍ TRAS"]; this.name = names[name]; this.callback = callback; this.select = function () { this.node.getElementsByTagName('a')[0].className = 'active'; } this.unSelect = function () { this.node.getElementsByTagName('a')[0].className = ''; } } // menu control function NewCtrlMenu(map) { var ctrl = this; var imageThis = this; ctrl.map = map; ctrl.mapi = null; ctrl.items = new Array(); ctrl.node = document.createElement('div'); ctrl.node.style.position = "absolute"; ctrl.node.style.left = "0px"; ctrl.node.style.right = "0px"; ctrl.nodebkg = document.createElement('div'); ctrl.nodebkg.id = 'menu'; ctrl.node.appendChild(ctrl.nodebkg); ctrl.nodecontainer = document.createElement('ul'); ctrl.nodebkg.appendChild(ctrl.nodecontainer); ctrl.nodehome = document.createElement('li'); ctrl.nodehome.className = 'm0'; ctrl.nodehome.innerHTML = 'Kamenní mužíci'; ctrl.nodecontainer.appendChild(ctrl.nodehome); google.maps.event.addDomListener(ctrl.nodehome, "click", function(e) { if (confirm('Opravdu si přejte opustit mapovou aplikaci? Všechny neuložené změny budou ztraceny.')) { return true; } else { try { e.preventDefault(); } catch (ex) { } return false; } }); ctrl.nodeprint = document.createElement('span'); ctrl.nodeprint.id = 'print'; ctrl.nodeprint.style.cursor = 'pointer'; ctrl.nodebkg.appendChild(ctrl.nodeprint); ctrl.nodehr = document.createElement('hr'); ctrl.nodebkg.appendChild(ctrl.nodehr); ctrl.printable = function() { return false; } ctrl.selectable = function() { return false; } //initialize google.maps.event.clearInstanceListeners(this.nodeprint); google.maps.event.addDomListener(this.nodeprint, "mousedown", function() {imageThis.mapi.print.call(imageThis);}); //end init ctrl.addItem = function(item) { item.node = document.createElement('li'); item.node.innerHTML = '' + item.name + ''; ctrl.nodecontainer.appendChild(item.node); google.maps.event.clearInstanceListeners(item.node); google.maps.event.addDomListener(item.node, 'click', item.click); ctrl.items.push(item); } return ctrl; } // CONTROL PANEL function NewCtrlPanel(map) { var ctrl = new Object(); ctrl.map = map; ctrl.mapi = null; ctrl.visible = true; ctrl.activetool = null; ctrl.defaulttool = null; ctrl.toolbanner = null; ctrl.items = new Array(); try { ctrl.node = document.createElement('
'); } catch (e) { ctrl.node = document.createElement('form'); ctrl.node.id = 'controlpanel'; ctrl.node.enctype = 'multipart/form-data'; } ctrl.nodeheader = document.createElement('h2'); ctrl.nodeheader.style.cursor = 'pointer'; ctrl.node.appendChild(ctrl.nodeheader); ctrl.nodeheadertext = document.createElement('span'); ctrl.nodeheadertext.innerHTML = '   '; ctrl.nodeheader.appendChild(ctrl.nodeheadertext); ctrl.nodefieldset = document.createElement('fieldset'); ctrl.nodefieldset.style.left = '0px'; ctrl.nodefieldset.style.right = '0px'; ctrl.nodefieldset.style.top = '2.5em'; ctrl.nodefieldset.style.bottom = '0px'; ctrl.node.appendChild(ctrl.nodefieldset); ctrl.nodecontainer = document.createElement('div'); ctrl.nodecontainer.style.position = "absolute"; ctrl.nodecontainer.style.left = '5px'; ctrl.nodecontainer.style.right = '5px'; ctrl.nodecontainer.style.top = '5px'; ctrl.nodecontainer.style.bottom = '5px'; ctrl.nodecontainer.style.overflowY = 'scroll'; ctrl.nodefieldset.appendChild(ctrl.nodecontainer); ctrl.printable = function() { return false; } ctrl.selectable = function() { return true; } ctrl.hide = function() { if (this.activetool.onPanelHide()) { this.visible = false; this.nodefieldset.style.display = 'none'; this.node.style.height = '2.5em'; this.nodeheadertext.style.backgroundImage = 'url("http://www.kamennimuzici.cz/images/bg_search_arrow_rev.gif")'; } } ctrl.show = function() { if (this.activetool.onPanelShow()) { this.visible = true; this.nodefieldset.style.display = 'block'; this.node.style.height = ''; this.nodeheadertext.style.backgroundImage = 'url("http://www.kamennimuzici.cz/images/bg_search_arrow.gif")'; } } ctrl.flipView = function() { if (this.visible) { this.hide(); } else { this.show(); } } ctrl.registerTool = function(tool) { tool.map = ctrl.map; tool.mapi = ctrl.mapi; tool.panel = this; tool.active = false; tool.onRegister(); } ctrl.setDefaultTool = function(tool) { this.activetool = tool; this.defaulttool = tool; this.activetool.active = true; this.activetool.activate(); this.activetool.onPanelActivated(); } ctrl.setName = function(name) { this.nodeheadertext.innerHTML = name; } ctrl.activateTool = function(tool) { if (this.activetool.onPanelClear()) { this.activetool.deactivate(); this.activetool.active = false; try { ctrl.nodecontainer.removeChild(this.toolbanner); } catch(e) { } try { this.activetool.menuitem.unSelect(); } catch(e) { } this.activetool = tool; this.activetool.activate(); this.activetool.active = true; this.activetool.onPanelActivated(); try { ctrl.nodecontainer.appendChild(this.toolbanner); } catch(e) { } try { this.activetool.menuitem.select(); } catch(e) { } } } ctrl.onMouseWheel = function(e) { if (!e) var e = window.event; e.cancelBubble = true; try { e.stopPropagation(); } catch(ex) { } } //initialize google.maps.event.clearInstanceListeners(ctrl.nodeheader); google.maps.event.addDomListener(ctrl.nodeheader, "click", function() { ctrl.flipView();} ); google.maps.event.addDomListener(ctrl.node, "submit", cancelAction); if (document.attachEvent) { google.maps.event.addDomListener(ctrl.node, "mousewheel", function (event) { ctrl.onMouseWheel(event); }); } else { google.maps.event.addDomListener(ctrl.node, "DOMMouseScroll", function (event) { ctrl.onMouseWheel(event); }); } try { var b = document.getElementsByTagName('body')[0]; this.toolbanner = b.removeChild(document.getElementById('oxtoolbottom')); this.toolbanner.style.display = 'block'; } catch(e) { } return ctrl; } // control panel tool function CtrlPanelTool() { this.map = null; this.mapi = null; this.panel = null; this.active = false; this.toolname = 'Žádný nástroj'; this.activate = activate; function activate() { this.panel.setName(this.toolname); return true; } this.deactivate = deactivate; function deactivate() { return true; } this.onRegister = onRegister; function onRegister() { return true; } this.onPanelShow = onPanelShow; function onPanelShow() { return true; } this.onPanelHide = onPanelHide; function onPanelHide() { return true; } this.onPanelActivated = onPanelActivated; function onPanelActivated() { return true; } this.onPanelClear = onPanelClear; function onPanelClear() { return true; } } // control panel tool - DEFAULT function CtrlPanelToolDefault() { this.node = null; this.banner = null; this.activate = activate; function activate() { this.panel.setName(this.toolname); this.panel.nodecontainer.appendChild(this.node); return true; } this.deactivate = deactivate; function deactivate() { this.panel.setName('   '); this.panel.nodecontainer.removeChild(this.node); return true; } this.onRegister = onRegister; function onRegister() { this.node = document.createElement('div'); this.node.className = 'tool'; try { var b = document.getElementsByTagName('body')[0]; this.banner = b.removeChild(document.getElementById('oxtooldefault')); this.banner.style.display = 'block'; this.node.appendChild(this.banner); } catch(e) { } return true; } this.onPanelShow = onPanelShow; function onPanelShow() { //alert('Nejprve zvolte nástroj, který si přejete použít.'); //return false; return true; } } CtrlPanelToolDefault.prototype = new CtrlPanelTool; // control panel tool - layers function CtrlPanelToolLayers() { this.toolname = 'Vrstvy'; var imageThis = this; this.mgnormal = 0; this.mgsatellite = 1; this.mghybrid = 2; this.mgturist = 3; this.actualmap = -1; this.maptype = new Array(); this.maptype[0] = {name:'Běžná', ref:google.maps.MapTypeId.ROADMAP}; this.maptype[1] = {name:'Satelitní', ref:google.maps.MapTypeId.SATELLITE}; this.maptype[2] = {name:'Hybridní', ref:google.maps.MapTypeId.HYBRID}; this.maptype[3] = {name:'Stínovaná', ref:google.maps.MapTypeId.TERRAIN}; this.maptype[4] = {name:'Turistická & cykloturistická', ref:'MapTurist'}; //this.maptype[5] = {name:'Turistická & cyklotrasy', ref:map.gmap.maptypeturistcyklo}; this.maptype[6] = {name:'Turistická bez cyklo a tur. značení', ref:'MapTuristTM'}; this.maptype[7] = {name:'Turistická & cykloturistická s reliéfem', ref:'MapTurist'}; //this.maptype[8] = {name:'Turistická & cyklotrasy s reliéfem', ref:map.gmap.maptypeturistcyklo}; this.maptype[9] = {name:'Turistická bez cyklo a tur. značení s reliéfem', ref:'MapTuristTM'}; this.maptype[10] = {name:'Hybridní s ČR cyklo a tur. stezkami', ref:google.maps.MapTypeId.HYBRID}; this.maptype[11] = {name:'Zobrazit cyklostezky', ref:google.maps.MapTypeId.ROADMAP}; this.maptype[12] = {name:'Open Street Map', ref:'OSM'}; this.node = null; this.nodemaptype = null; this.activate = activate; function activate() { this.panel.setName(this.toolname); this.panel.nodecontainer.appendChild(this.node); return true; } this.deactivate = deactivate; function deactivate() { this.panel.setName('   '); this.panel.nodecontainer.removeChild(this.node); return true; } this.onRegister = onRegister; function onRegister() { this.node = document.createElement('div'); this.node.className = 'tool'; this.node.appendChild(document.createTextNode('Zvolte typ mapy:')); this.node.appendChild(document.createElement('br')); this.node.appendChild(document.createElement('br')); this.node.appendChild(document.createTextNode('Celý svět')); this.node.appendChild(document.createElement('br')); this.nodemaptype = new Array(); this.nodemaptypelbl = new Array(); //---OSM--- try { this.nodemaptype[12] = document.createElement(''); } catch (e) { this.nodemaptype[12] = document.createElement('input'); this.nodemaptype[12].type = 'radio'; this.nodemaptype[12].name = 'maptype'; this.nodemaptype[12].value = '12'; } this.node.appendChild(this.nodemaptype[12]); this.nodemaptypelbl[12] = document.createElement('label'); this.nodemaptype[12].id = "maptype12" + (Math.floor(Math.random() * 1000000)).toString(); this.nodemaptypelbl[12].htmlFor = this.nodemaptype[12].id; this.nodemaptypelbl[12].appendChild(document.createTextNode(' ' + this.maptype[12].name)); this.node.appendChild(this.nodemaptypelbl[12]); this.node.appendChild(document.createElement('br')); google.maps.event.addDomListener(this.nodemaptype[12], 'click', function() { imageThis.setMap.call(imageThis, 12); }); //---end OSM--- try { this.nodemaptype[0] = document.createElement(''); } catch (e) { this.nodemaptype[0] = document.createElement('input'); this.nodemaptype[0].type = 'radio'; this.nodemaptype[0].name = 'maptype'; this.nodemaptype[0].value = '0'; } this.node.appendChild(this.nodemaptype[0]); this.nodemaptypelbl[0] = document.createElement('label'); this.nodemaptype[0].id = "maptype0" + (Math.floor(Math.random() * 1000000)).toString(); this.nodemaptypelbl[0].htmlFor = this.nodemaptype[0].id; this.nodemaptypelbl[0].appendChild(document.createTextNode(' ' + this.maptype[0].name)); this.node.appendChild(this.nodemaptypelbl[0]); this.node.appendChild(document.createElement('br')); //GEvent.bindDom(this.nodemaptype[0], 'click', this, function() { this.setMap(0); }); google.maps.event.addDomListener(this.nodemaptype[0], 'click', function() { imageThis.setMap.call(imageThis, 0); }); try { this.nodemaptype[1] = document.createElement(''); } catch (e) { this.nodemaptype[1] = document.createElement('input'); this.nodemaptype[1].type = 'radio'; this.nodemaptype[1].name = 'maptype'; this.nodemaptype[1].value = '1'; } this.node.appendChild(this.nodemaptype[1]); this.nodemaptypelbl[1] = document.createElement('label'); this.nodemaptype[1].id = "maptype1" + (Math.floor(Math.random() * 1000000)).toString(); this.nodemaptypelbl[1].htmlFor = this.nodemaptype[1].id; this.nodemaptypelbl[1].appendChild(document.createTextNode(' ' + this.maptype[1].name)); this.node.appendChild(this.nodemaptypelbl[1]); this.node.appendChild(document.createElement('br')); //GEvent.bindDom(this.nodemaptype[1], 'click', this, function() { this.setMap(1); }); google.maps.event.addDomListener(this.nodemaptype[1], 'click', function() { imageThis.setMap.call(imageThis, 1); }); try { this.nodemaptype[2] = document.createElement(''); } catch (e) { this.nodemaptype[2] = document.createElement('input'); this.nodemaptype[2].type = 'radio'; this.nodemaptype[2].name = 'maptype'; this.nodemaptype[2].value = '2'; } this.node.appendChild(this.nodemaptype[2]); this.nodemaptypelbl[2] = document.createElement('label'); this.nodemaptype[2].id = "maptype2" + (Math.floor(Math.random() * 1000000)).toString(); this.nodemaptypelbl[2].htmlFor = this.nodemaptype[2].id; this.nodemaptypelbl[2].appendChild(document.createTextNode(' ' + this.maptype[2].name)); this.node.appendChild(this.nodemaptypelbl[2]); this.node.appendChild(document.createElement('br')); //GEvent.bindDom(this.nodemaptype[2], 'click', this, function() { this.setMap(2); }); google.maps.event.addDomListener(this.nodemaptype[2], 'click', function() { imageThis.setMap.call(imageThis, 2); }); // service removal /*try { this.nodemaptype[10] = document.createElement(''); } catch (e) { this.nodemaptype[10] = document.createElement('input'); this.nodemaptype[10].type = 'radio'; this.nodemaptype[10].name = 'maptype'; this.nodemaptype[10].value = '10'; } this.node.appendChild(this.nodemaptype[10]); this.nodemaptypelbl[10] = document.createElement('label'); this.nodemaptype[10].id = "maptype10" + (Math.floor(Math.random() * 1000000)).toString(); this.nodemaptypelbl[10].htmlFor = this.nodemaptype[10].id; this.nodemaptypelbl[10].appendChild(document.createTextNode(' ' + this.maptype[10].name)); this.node.appendChild(this.nodemaptypelbl[10]); this.node.appendChild(document.createElement('br')); //GEvent.bindDom(this.nodemaptype[10], 'click', this, function() { this.setMap(10); });*/ //google.maps.event.addDomListener(this.nodemaptype[10], 'click', function() { imageThis.setMap.call(imageThis, 10); }); try { this.nodemaptype[3] = document.createElement(''); } catch (e) { this.nodemaptype[3] = document.createElement('input'); this.nodemaptype[3].type = 'radio'; this.nodemaptype[3].name = 'maptype'; this.nodemaptype[3].value = '3'; } this.node.appendChild(this.nodemaptype[3]); this.nodemaptypelbl[3] = document.createElement('label'); this.nodemaptype[3].id = "maptype3" + (Math.floor(Math.random() * 1000000)).toString(); this.nodemaptypelbl[3].htmlFor = this.nodemaptype[3].id; this.nodemaptypelbl[3].appendChild(document.createTextNode(' ' + this.maptype[3].name)); this.node.appendChild(this.nodemaptypelbl[3]); this.node.appendChild(document.createElement('br')); //GEvent.bindDom(this.nodemaptype[3], 'click', this, function() { this.setMap(3); }); google.maps.event.addDomListener(this.nodemaptype[3], 'click', function() { imageThis.setMap.call(imageThis, 3); }); this.node.appendChild(document.createElement('br')); try { this.nodemapcheck = document.createElement(''); } catch (e) { this.nodemapcheck = document.createElement('input'); this.nodemapcheck.type = 'checkbox'; this.nodemapcheck.name = 'bikeLayer'; this.nodemapcheck.value = 'A'; } this.nodemapcheck.id = "bikeLayer"; this.nodemapcheck.disabled = true; this.node.appendChild(this.nodemapcheck); var bikeLayer = new google.maps.BicyclingLayer(); google.maps.event.addDomListener(this.nodemapcheck, 'click', function() { var check = document.getElementById("bikeLayer").value; if(check == "A") { bikeLayer.setMap(imageThis.panel.map.gmap); document.getElementById("bikeLayer").value = 'N'; } else { bikeLayer.setMap(null); document.getElementById("bikeLayer").value = 'A'; } }); this.node.appendChild(document.createTextNode(' Zobrazit cyklostezky')); this.node.appendChild(document.createElement('br')); this.node.appendChild(document.createElement('br')); this.node.appendChild(document.createElement('br')); this.node.appendChild(document.createTextNode('Česká republika a Slovensko')); this.node.appendChild(document.createElement('br')); try { this.nodemaptype[4] = document.createElement(''); } catch (e) { this.nodemaptype[4] = document.createElement('input'); this.nodemaptype[4].type = 'radio'; this.nodemaptype[4].name = 'maptype'; this.nodemaptype[4].value = '4'; } this.nodemaptype[4].disabled = true; this.node.appendChild(this.nodemaptype[4]); this.nodemaptypelbl[4] = document.createElement('label'); this.nodemaptype[4].id = "maptype4" + (Math.floor(Math.random() * 1000000)).toString(); this.nodemaptypelbl[4].htmlFor = this.nodemaptype[4].id; this.nodemaptypelbl[4].appendChild(document.createTextNode(' ' + this.maptype[4].name)); this.node.appendChild(this.nodemaptypelbl[4]); this.node.appendChild(document.createElement('br')); //GEvent.bindDom(this.nodemaptype[4], 'click', this, function() { this.setMap(4); }); google.maps.event.addDomListener(this.nodemaptype[4], 'click', function() { imageThis.setMap.call(imageThis, 4); }); try { this.nodemaptype[7] = document.createElement(''); } catch (e) { this.nodemaptype[7] = document.createElement('input'); this.nodemaptype[7].type = 'radio'; this.nodemaptype[7].name = 'maptype'; this.nodemaptype[7].value = '7'; } this.nodemaptype[7].disabled = true; this.node.appendChild(this.nodemaptype[7]); this.nodemaptypelbl[7] = document.createElement('label'); this.nodemaptype[7].id = "maptype7" + (Math.floor(Math.random() * 1000000)).toString(); this.nodemaptypelbl[7].htmlFor = this.nodemaptype[7].id; this.nodemaptypelbl[7].appendChild(document.createTextNode(' ' + this.maptype[7].name)); this.node.appendChild(this.nodemaptypelbl[7]); this.node.appendChild(document.createElement('br')); //GEvent.bindDom(this.nodemaptype[7], 'click', this, function() { this.setMap(7); }); google.maps.event.addDomListener(this.nodemaptype[7], 'click', function() { imageThis.setMap.call(imageThis, 7); }); /*try { this.nodemaptype[5] = document.createElement(''); } catch (e) { this.nodemaptype[5] = document.createElement('input'); this.nodemaptype[5].type = 'radio'; this.nodemaptype[5].name = 'maptype'; this.nodemaptype[5].value = '5'; } this.nodemaptype[5].disabled = true; this.node.appendChild(this.nodemaptype[5]); this.nodemaptypelbl[5] = document.createElement('label'); this.nodemaptype[5].id = "maptype5" + (Math.floor(Math.random() * 1000000)).toString(); this.nodemaptypelbl[5].htmlFor = this.nodemaptype[5].id; this.nodemaptypelbl[5].appendChild(document.createTextNode(' ' + this.maptype[5].name)); this.node.appendChild(this.nodemaptypelbl[5]); this.node.appendChild(document.createElement('br')); //GEvent.bindDom(this.nodemaptype[5], 'click', this, function() { this.setMap(5); });*/ //google.maps.event.addDomListener(this.nodemaptype[5], 'click', function() { imageThis.setMap.call(imageThis, 5); }); /*try { this.nodemaptype[8] = document.createElement(''); } catch (e) { this.nodemaptype[8] = document.createElement('input'); this.nodemaptype[8].type = 'radio'; this.nodemaptype[8].name = 'maptype'; this.nodemaptype[8].value = '8'; } this.nodemaptype[8].disabled = true; this.node.appendChild(this.nodemaptype[8]); this.nodemaptypelbl[8] = document.createElement('label'); this.nodemaptype[8].id = "maptype8" + (Math.floor(Math.random() * 1000000)).toString(); this.nodemaptypelbl[8].htmlFor = this.nodemaptype[8].id; this.nodemaptypelbl[8].appendChild(document.createTextNode(' ' + this.maptype[8].name)); this.node.appendChild(this.nodemaptypelbl[8]); this.node.appendChild(document.createElement('br')); //GEvent.bindDom(this.nodemaptype[8], 'click', this, function() { this.setMap(8); });*/ //google.maps.event.addDomListener(this.nodemaptype[8], 'click', function() { imageThis.setMap.call(imageThis, 8); }); try { this.nodemaptype[6] = document.createElement(''); } catch (e) { this.nodemaptype[6] = document.createElement('input'); this.nodemaptype[6].type = 'radio'; this.nodemaptype[6].name = 'maptype'; this.nodemaptype[6].value = '6'; } this.nodemaptype[6].disabled = true; this.node.appendChild(this.nodemaptype[6]); this.nodemaptypelbl[6] = document.createElement('label'); this.nodemaptype[6].id = "maptype6" + (Math.floor(Math.random() * 1000000)).toString(); this.nodemaptypelbl[6].htmlFor = this.nodemaptype[6].id; this.nodemaptypelbl[6].appendChild(document.createTextNode(' ' + this.maptype[6].name)); this.node.appendChild(this.nodemaptypelbl[6]); this.node.appendChild(document.createElement('br')); //GEvent.bindDom(this.nodemaptype[6], 'click', this, function() { this.setMap(6); }); google.maps.event.addDomListener(this.nodemaptype[6], 'click', function() { imageThis.setMap.call(imageThis, 6); }); try { this.nodemaptype[9] = document.createElement(''); } catch (e) { this.nodemaptype[9] = document.createElement('input'); this.nodemaptype[9].type = 'radio'; this.nodemaptype[9].name = 'maptype'; this.nodemaptype[9].value = '9'; } this.nodemaptype[9].disabled = true; this.node.appendChild(this.nodemaptype[9]); this.nodemaptypelbl[9] = document.createElement('label'); this.nodemaptype[9].id = "maptype7" + (Math.floor(Math.random() * 1000000)).toString(); this.nodemaptypelbl[9].htmlFor = this.nodemaptype[9].id; this.nodemaptypelbl[9].appendChild(document.createTextNode(' ' + this.maptype[9].name)); this.node.appendChild(this.nodemaptypelbl[9]); this.node.appendChild(document.createElement('br')); //GEvent.bindDom(this.nodemaptype[9], 'click', this, function() { this.setMap(9); }); google.maps.event.addDomListener(this.nodemaptype[9], 'click', function() { imageThis.setMap.call(imageThis, 9); }); this.node.appendChild(document.createElement('br')); this.node.appendChild(document.createTextNode('Sponzorované odkazy')); this.node.appendChild(document.createElement('br')); try { this.nodemapplacesyes = document.createElement(''); } catch (e) { this.nodemapplacesyes = document.createElement('input'); this.nodemapplacesyes.type = 'radio'; this.nodemapplacesyes.name = 'mapplaces'; this.nodemapplacesyes.value = '1'; } this.node.appendChild(this.nodemapplacesyes); this.nodemapplacesyeslbl = document.createElement('label'); this.nodemapplacesyes.id = "mapplacesyes" + (Math.floor(Math.random() * 1000000)).toString(); this.nodemapplacesyeslbl.htmlFor = this.nodemapplacesyes.id; this.nodemapplacesyeslbl.appendChild(document.createTextNode(' zobrazovat')); this.node.appendChild(this.nodemapplacesyeslbl); //GEvent.bindDom(this.nodemapplacesyes, 'click', this, function() { this.setMapPlaces(1); }); google.maps.event.addDomListener(this.nodemapplacesyes, 'click', function() { imageThis.setMapPlaces.call(imageThis, 1); }); this.node.appendChild(document.createTextNode(' ')); try { this.nodemapplacesno = document.createElement(''); } catch (e) { this.nodemapplacesno = document.createElement('input'); this.nodemapplacesno.type = 'radio'; this.nodemapplacesno.name = 'mapplaces'; this.nodemapplacesno.value = '0'; } this.node.appendChild(this.nodemapplacesno); this.nodemapplacesnolbl = document.createElement('label'); this.nodemapplacesno.id = "mapplacesno" + (Math.floor(Math.random() * 1000000)).toString(); this.nodemapplacesnolbl.htmlFor = this.nodemapplacesno.id; this.nodemapplacesnolbl.appendChild(document.createTextNode(' nezobrazovat')); this.node.appendChild(this.nodemapplacesnolbl); //GEvent.bindDom(this.nodemapplacesno, 'click', this, function() { this.setMapPlaces(0); }); google.maps.event.addDomListener(this.nodemapplacesno, 'click', function() { imageThis.setMapPlaces.call(imageThis, 0); }); return true; } this.onPanelActivated = onPanelActivated; function onPanelActivated() { this.nodemaptype[this.actualmap].checked = true; this.panel.show(); }; this.setMap = setMap; function setMap(map) { if ((this.actualmap >=7) && (this.actualmap <= 9)) { this.panel.map.gmap.overlayMapTypes.removeAt(0); } // service removal //if (this.actualmap == 10) this.panel.map.removeOverlay(this.panel.mapi.mapowms); if ((map >= 0) && (map <= 6)) { this.panel.map.gmap.setMapTypeId(this.maptype[map].ref); //this.panel.map.gmap.overlayMapTypes.removeAt(0); this.actualmap = map; } if ((map >= 7) && (map <= 9)) { this.panel.map.gmap.setMapTypeId(this.maptype[map - 3].ref); //this.panel.map.gmap.overlayMapTypes.insertAt(0, this.maptype[map - 3].ref); //this.panel.map.gmap.addOverlay(this.panel.mapi.maporelief); this.panel.map.gmap.overlayMapTypes.push(this.panel.mapi.maporelief); this.actualmap = map; } if (map == 10) { this.panel.map.gmap.setMapTypeId(this.maptype[map].ref); // service removal //this.panel.map.addOverlay(this.panel.mapi.mapowms); this.actualmap = map; } if (map == 12) { this.panel.map.gmap.setMapTypeId(this.maptype[map].ref); // service removal //this.panel.map.addOverlay(this.panel.mapi.mapowms); this.actualmap = map; } }; this.setMapPlaces = setMapPlaces; function setMapPlaces(mapplaces) { if (mapplaces == 1) { this.panel.mapi.places.showPlaces(); } else { this.panel.mapi.places.hidePlaces(); } }; } CtrlPanelToolLayers.prototype = new CtrlPanelTool; // control panel tool - SEARCH function CtrlPanelToolSearch() { } CtrlPanelToolSearch.prototype = new CtrlPanelTool; // control panel tool - POIS function CtrlPanelToolPois() { this.toolname = 'Zájmové body'; var imageThis = this; this.mapClickHandler = null; this.selectedPois = new Array(); this.editItem = null; this.editActive = false; this.poiInfos = new Array(); this.activate = activate; function activate() { this.panel.setName(this.toolname); this.panel.nodecontainer.appendChild(this.node); this.mapClickHandler = google.maps.event.bind(this.map.gmap, "click", this, function(e) { this.mapClick(e);}); return true; } this.deactivate = deactivate; function deactivate() { if (this.mapClickHandler) google.maps.event.removeListener(this.mapClickHandler); this.panel.setName('   '); this.panel.nodecontainer.removeChild(this.node); return true; } this.onRegister = onRegister; function onRegister() { this.node = document.createElement('div'); this.node.className = 'tool'; this.nodeedit = document.createElement('div'); this.nodeedit.style.marginBottom = '5px'; this.nodeedit.style.padding = '5px 0px 5px 5px'; this.nodeedit.style.borderBottom = '1px solid #E0E0E0'; this.nodeedit.style.backgroundColor = '#202020'; this.nodeedit.style.display = 'none'; this.node.appendChild(this.nodeedit); this.nodeedit.appendChild(document.createTextNode('Název:')); this.nodeedit.appendChild(document.createElement('br')); this.nodeeditname = document.createElement('input'); this.nodeeditname.style.display = 'block'; this.nodeeditname.style.width = '220px'; this.nodeeditname.style.border = '1px solid #D0D0D0'; this.nodeeditname.style.marginBottom = '5px'; this.nodeedit.appendChild(this.nodeeditname); this.nodeedit.appendChild(document.createTextNode('Popis:')); this.nodeedit.appendChild(document.createElement('br')); this.nodeeditdesc = document.createElement('textarea'); this.nodeeditdesc.style.display = 'block'; this.nodeeditdesc.style.width = '220px'; this.nodeeditdesc.style.height = '120px'; this.nodeeditdesc.style.border = '1px solid #D0D0D0'; this.nodeeditdesc.style.marginBottom = '5px'; this.nodeedit.appendChild(this.nodeeditdesc); this.nodeeditconfirm = document.createElement('button'); this.nodeeditconfirm.appendChild(document.createTextNode('Změnit')); //GEvent.bindDom(this.nodeeditconfirm, 'click', this, this.poiEditConfirm); google.maps.event.addDomListener(this.nodeeditconfirm, 'click', function() { imageThis.poiEditConfirm.call(imageThis); }); this.nodeedit.appendChild(this.nodeeditconfirm); this.nodeeditconfirm = document.createElement('button'); this.nodeeditconfirm.style.marginLeft = '5px'; this.nodeeditconfirm.appendChild(document.createTextNode('Zrušit')); //GEvent.bindDom(this.nodeeditconfirm, 'click', this, this.poiEditCancel); google.maps.event.addDomListener(this.nodeeditconfirm, 'click', function() { imageThis.poiEditCancel.call(imageThis); }); this.nodeedit.appendChild(this.nodeeditconfirm); this.nodedelete = document.createElement('button'); this.nodedelete.style.width = '200px'; this.nodedelete.appendChild(document.createTextNode('Odstranit zvolený bod / body')); //GEvent.bindDom(this.nodedelete, 'click', this, this.deleteSelected); google.maps.event.addDomListener(this.nodedelete, 'click', function() { imageThis.deleteSelected.call(imageThis); }); this.node.appendChild(this.nodedelete); this.node.appendChild(document.createElement('br')); this.nodedeleteall = document.createElement('button'); this.nodedeleteall.style.width = '200px'; this.nodedeleteall.style.marginTop = '5px'; this.nodedeleteall.appendChild(document.createTextNode('Odstranit všechny body')); //GEvent.bindDom(this.nodedeleteall, 'click', this, this.deleteAll); google.maps.event.addDomListener(this.nodedeleteall, 'click', function() { imageThis.deleteAll.call(imageThis); }); this.node.appendChild(this.nodedeleteall); this.node.appendChild(document.createElement('br')); this.nodelist = document.createElement('select'); this.nodelist.style.width = '200px'; this.nodelist.style.marginTop = '5px'; this.nodelist.multiple = true; this.nodelist.size = 15; //GEvent.bindDom(this.nodelist, 'change', this, this.listChange); google.maps.event.addDomListener(this.nodelist, 'change', function() { imageThis.listChange.call(imageThis); }); this.node.appendChild(this.nodelist); return true; } this.onPanelActivated = onPanelActivated; function onPanelActivated() { this.panel.show(); }; this.deleteSelected = deleteSelected; function deleteSelected() { while (this.selectedPois.length > 0) { poi = this.selectedPois.pop(); if (poi.idmarker == this.editItem.idmarker) this.poiEditCancel(); this.mapi.tour.removePoi(poi, true); } this.refreshList(); } this.deleteAll = deleteAll; function deleteAll() { this.poiEditCancel(); this.selectedPois = new Array(); this.mapi.tour.clearPois(); this.refreshList(); } this.mapClick = mapClick; function mapClick(e) { var latlng = e.latLng; if (latlng) { this.mapi.tour.addPoi(latlng, this); this.poiEditOpen(this.mapi.tour.pois[this.mapi.tour.pois.length - 1]); this.refreshList(); } } this.onPoiClick = onPoiClick; function onPoiClick(marker) { if (isShiftPressed) { if (this.selectedPois.length > 0) { var found = false; for (var ti = 0; ti < this.selectedPois.length; ti++) { if (this.selectedPois[ti].idmarker == marker.idarray) found = true; } if (!found) { this.selectedPois.push(marker.item); var ico = marker.getIcon(); //marker.setImage(ico.imageSelected); marker.setIcon(marker.icoSel); } } else { this.selectedPois = new Array(marker.item); var ico = marker.getIcon(); //marker.setImage(ico.imageSelected); marker.setIcon(marker.icoSel); } } else { while (this.selectedPois.length > 0) { poi = this.selectedPois.pop(); var ico = this.mapi.markers.markers[poi.idmarker]; this.mapi.markers.markers[poi.idmarker].setIcon(ico.ico); } this.selectedPois = new Array(marker.item); var ico = marker.getIcon(); //marker.setImage(ico.imageSelected); marker.setIcon(marker.icoSel); this.poiEditOpen(marker.item); if (this.panel.activetool != marker.item.tool) this.panel.activateTool(marker.item.tool); } this.refreshList(); } this.refreshList = refreshList; function refreshList() { while (this.nodelist.options.length > 0) { this.nodelist.remove(0); } if (this.mapi.tour.pois.length > 0) { var sels = new Array(); if (this.selectedPois.length > 0) for (var ti = 0; ti < this.selectedPois.length; ti++) { sels[this.selectedPois[ti].idmarker] = true; } for (var ti = 0; ti < this.mapi.tour.pois.length; ti++) { var o = document.createElement('option'); o.text = this.mapi.tour.pois[ti].name; if (sels[this.mapi.tour.pois[ti].idmarker]) o.selected = true; try { this.nodelist.add(o, null); } catch (e) { this.nodelist.add(o); } } } } this.listChange = listChange; function listChange() { this.refreshFromList(); if (this.nodelist.selectedIndex > -1) { this.poiEditOpen(this.mapi.tour.pois[this.nodelist.selectedIndex]); } } this.refreshFromList = refreshFromList; function refreshFromList() { this.selectedPois = new Array(); if (this.nodelist.options.length > 0) { for (var ti = 0; ti < this.nodelist.options.length; ti++) { var ico = this.mapi.markers.markers[this.mapi.tour.pois[ti].idmarker]; if (this.nodelist.options[ti].selected) { this.selectedPois.push(this.mapi.tour.pois[ti]); this.mapi.markers.markers[this.mapi.tour.pois[ti].idmarker].setIcon(ico.icoSel); } else { this.mapi.markers.markers[this.mapi.tour.pois[ti].idmarker].setIcon(ico.ico); } } } } this.poiEditOpen = poiEditOpen; function poiEditOpen(item) { this.editItem = item; this.nodeeditname.value = this.editItem.name; this.nodeeditdesc.value = this.editItem.desc; this.editActive = false; this.nodeedit.style.display = 'block'; } this.poiEditConfirm = poiEditConfirm; function poiEditConfirm() { if (this.editItem) { this.editItem.name = this.nodeeditname.value; this.editItem.desc = this.nodeeditdesc.value; this.refreshList(); } this.nodeedit.style.display = 'none'; this.editActive = false; this.nodeeditname.value = ''; this.nodeeditdesc.value = ''; this.editItem = null; } this.poiEditCancel = poiEditCancel; function poiEditCancel() { this.nodeedit.style.display = 'none'; this.editActive = false; this.nodeeditname.value = ''; this.nodeeditdesc.value = ''; this.editItem = null; } this.showInfo = showInfo; function showInfo (item) { var i = new PoiItemDesc(item.pos, item, this.mapi.gmap); this.poiInfos.push(i); //this.mapi.gmap.addOverlay(i); i.setMap(this.mapi.gmap); } this.clearInfos = clearInfos; function clearInfos () { while (this.poiInfos.length > 0) { var item = this.poiInfos.pop(); //this.mapi.gmap.removeOverlay(item); item.setMap(null); } } } CtrlPanelToolPois.prototype = new CtrlPanelTool; // control panel tool - TRACK function CtrlPanelToolTrack() { this.toolname = 'Kreslení trasy'; this.mapClickHandler = null; this.mapPokusHandler = null; this.selectedPoints = new Array(); this.editItem = null; this.editActive = false; this.pointInfos = new Array(); var imageThis = this; this.activate = activate; function activate() { this.panel.setName(this.toolname); this.panel.nodecontainer.appendChild(this.node); this.clearInfos(); for (var ti = 0; ti < colortype.length; ti++) if (('#' + colortype[ti].code) == this.mapi.tour.trackcolor) { this.nodecolorselectorsel.style.backgroundColor = '#' + colortype[ti].code; this.nodecolorselectorsel.selectedIndex = ti; } for (var ti = 0; ti < transptype.length; ti++) if (transptype[ti].value == this.mapi.tour.tracktrans) this.nodetranspselectorsel.selectedIndex = ti; for (var ti = 0; ti < widthtype.length; ti++) if (widthtype[ti].value == this.mapi.tour.trackwidth) this.nodewidthselectorsel.selectedIndex = ti; this.mapClickHandler = google.maps.event.bind(this.map.gmap, "click", this, function(event) {this.mapClick(event.overlay, event.latLng, event.overlayLatLng);}); if (this.mapi.tour.points.length > 1) { var ti = this.mapi.tour.points.length - 1; var id = this.mapi.tour.points[ti].idmarker; if (this.mapi.tour.points[ti].name.length > 0) { this.mapi.markers.CreatePointMarker(this, this.mapi.tour.points[ti], true); } else { this.mapi.markers.CreatePointMarker(this, this.mapi.tour.points[ti], false); } this.mapi.markers.removeMarker(id); } return true; } this.deactivate = deactivate; function deactivate() { if (this.mapClickHandler) new google.maps.event.removeListener(this.mapClickHandler); this.panel.setName('   '); this.panel.nodecontainer.removeChild(this.node); this.closeProfile(); if (this.mapi.tour.points.length > 1) { var ti = this.mapi.tour.points.length - 1; var id = this.mapi.tour.points[ti].idmarker; this.mapi.markers.CreatePointMarkerEnd(this, this.mapi.tour.points[ti], difftype[this.mapi.tour.difficulty].ico); this.mapi.markers.removeMarker(id); } return true; } this.onRegister = onRegister; function onRegister() { this.node = document.createElement('div'); this.node.className = 'tool'; this.nodeedit = document.createElement('div'); this.nodeedit.style.marginBottom = '5px'; this.nodeedit.style.padding = '5px 0px 5px 5px'; this.nodeedit.style.borderBottom = '1px solid #E0E0E0'; this.nodeedit.style.backgroundColor = '#202020'; this.nodeedit.style.display = 'none'; this.node.appendChild(this.nodeedit); this.nodeedit.appendChild(document.createTextNode('Název bodu:')); this.nodeedit.appendChild(document.createElement('br')); this.nodeeditname = document.createElement('input'); this.nodeeditname.style.display = 'block'; this.nodeeditname.style.width = '220px'; this.nodeeditname.style.border = '1px solid #D0D0D0'; this.nodeeditname.style.marginBottom = '5px'; this.nodeedit.appendChild(this.nodeeditname); this.nodeeditconfirm = document.createElement('button'); this.nodeeditconfirm.appendChild(document.createTextNode('Změnit')); //google.maps.event.addDomListener.bind(this.nodeeditconfirm, 'click', this, this.pointEditConfirm); google.maps.event.addDomListener(this.nodeeditconfirm, 'click', function() { imageThis.pointEditConfirm.call(imageThis); }); this.nodeedit.appendChild(this.nodeeditconfirm); this.nodeeditconfirm2 = document.createElement('button'); this.nodeeditconfirm2.style.marginLeft = '5px'; this.nodeeditconfirm2.appendChild(document.createTextNode('Zrušit')); //google.maps.event.addDomListener.bind(this.nodeeditconfirm2, 'click', this, this.pointEditConfirm); google.maps.event.addDomListener(this.nodeeditconfirm2, 'click', function() { imageThis.pointEditConfirm.call(imageThis); }); this.nodeedit.appendChild(this.nodeeditconfirm2); this.nodedelete = document.createElement('button'); this.nodedelete.style.width = '200px'; this.nodedelete.appendChild(document.createTextNode('Odstranit zvolený bod / body')); //google.maps.event.bind(this.nodedelete, 'click', this, this.deleteSelected); google.maps.event.addDomListener(this.nodedelete, 'click', function() { imageThis.deleteSelected.call(imageThis); }); this.node.appendChild(this.nodedelete); this.node.appendChild(document.createElement('br')); this.nodeprofile = document.createElement('button'); this.nodeprofile.style.width = '200px'; this.nodeprofile.style.marginTop = '5px'; this.nodeprofile.appendChild(document.createTextNode('Zobrazit výškový profil')); //google.maps.event.addDomListener.bind(this.nodeprofile, 'click', this, this.showProfile); google.maps.event.addDomListener(this.nodeprofile, 'click', function() { imageThis.showProfile.call(imageThis); }); this.node.appendChild(this.nodeprofile); this.node.appendChild(document.createElement('br')); this.nodeprofilerev = document.createElement('button'); this.nodeprofilerev.style.width = '200px'; this.nodeprofilerev.style.marginTop = '5px'; this.nodeprofilerev.appendChild(document.createTextNode('Zobrazit výškový profil z cíle')); //google.maps.event.addDomListener.bind(this.nodeprofilerev, 'click', this, this.showProfileRev); google.maps.event.addDomListener(this.nodeprofilerev, 'click', function() { imageThis.showProfileRev.call(imageThis); }); this.node.appendChild(this.nodeprofilerev); this.node.appendChild(document.createElement('br')); this.nodeflippoly = document.createElement('button'); this.nodeflippoly.style.width = '200px'; this.nodeflippoly.style.marginTop = '5px'; this.nodeflippoly.appendChild(document.createTextNode('Skrýt linii')); //google.maps.event.addDomListener.bind(this.nodeflippoly, 'click', this, this.flipPolyDisplay); google.maps.event.addDomListener(this.nodeflippoly, 'click', function() { imageThis.flipPolyDisplay.call(imageThis); }); this.node.appendChild(this.nodeflippoly); this.node.appendChild(document.createElement('br')); this.nodeimport = document.createElement('button'); this.nodeimport.style.width = '200px'; this.nodeimport.style.marginTop = '5px'; this.nodeimport.appendChild(document.createTextNode('Import')); //google.maps.event.addDomListener.bind(this.nodeimport, 'click', this, this.openImport); google.maps.event.addDomListener(this.nodeimport, 'click', function() { imageThis.openImport.call(imageThis); }); this.node.appendChild(this.nodeimport); this.node.appendChild(document.createElement('br')); this.nodedeleteall = document.createElement('button'); this.nodedeleteall.style.width = '200px'; this.nodedeleteall.style.marginTop = '5px'; this.nodedeleteall.appendChild(document.createTextNode('Smazat trasu')); //google.maps.event.addDomListener.bind(this.nodedeleteall, 'click', this, this.deleteAll); google.maps.event.addDomListener(this.nodedeleteall, 'click', function() { imageThis.deleteAll.call(imageThis); }); this.node.appendChild(this.nodedeleteall); this.node.appendChild(document.createElement('br')); this.nodetosave = document.createElement('button'); this.nodetosave.style.width = '200px'; this.nodetosave.style.marginTop = '5px'; this.nodetosave.appendChild(document.createTextNode('Přejít k detailům / uložení')); //google.maps.event.addDomListener.bind(this.nodetosave, 'click', this, this.toSave); google.maps.event.addDomListener(this.nodetosave, 'click', function() { imageThis.toSave.call(imageThis); }); this.node.appendChild(this.nodetosave); this.node.appendChild(document.createElement('br')); this.nodelist = document.createElement('select'); this.nodelist.style.width = '200px'; this.nodelist.style.marginTop = '5px'; this.nodelist.style.marginBottom = '5px'; this.nodelist.multiple = true; this.nodelist.size = 15; //google.maps.event.addDomListener.bind(this.nodelist, 'change', this, this.listChange); google.maps.event.addDomListener(this.nodelist, 'change', function() { imageThis.listChange.call(imageThis); }); this.node.appendChild(this.nodelist); this.node.appendChild(document.createElement('br')); this.node.appendChild(document.createTextNode('Barva linie:')); this.node.appendChild(document.createElement('br')); this.nodecolorselectorsel = document.createElement('select'); this.nodecolorselectorsel.style.marginBottom = '5px'; for (var ti = 0; ti < colortype.length; ti++) { var o = document.createElement('option'); o.text = ' '; o.style.backgroundColor = '#' + colortype[ti].code; try { this.nodecolorselectorsel.add(o, null); } catch (e) { this.nodecolorselectorsel.add(o); } } //google.maps.event.addDomListener.bind(this.nodecolorselectorsel, 'change', this, this.colorChange); google.maps.event.addDomListener(this.nodecolorselectorsel, 'change', function() { imageThis.colorChange.call(imageThis); }); this.node.appendChild(this.nodecolorselectorsel); this.node.appendChild(document.createElement('br')); this.node.appendChild(document.createTextNode('Průhlednost linie:')); this.node.appendChild(document.createElement('br')); this.nodetranspselectorsel = document.createElement('select'); this.nodetranspselectorsel.style.width = '50px'; this.nodetranspselectorsel.style.marginBottom = '5px'; for (var ti = 0; ti < transptype.length; ti++) { var o = document.createElement('option'); o.text = transptype[ti].value; try { this.nodetranspselectorsel.add(o, null); } catch (e) { this.nodetranspselectorsel.add(o); } } //google.maps.event.addDomListener.bind(this.nodetranspselectorsel, 'change', this, this.transpChange); google.maps.event.addDomListener(this.nodetranspselectorsel, 'change', function() { imageThis.transpChange.call(imageThis); }); this.node.appendChild(this.nodetranspselectorsel); this.node.appendChild(document.createElement('br')); this.node.appendChild(document.createTextNode('Tloušťka linie:')); this.node.appendChild(document.createElement('br')); this.nodewidthselectorsel = document.createElement('select'); this.nodewidthselectorsel.style.width = '50px'; this.nodewidthselectorsel.style.marginBottom = '5px'; for (var ti = 0; ti < widthtype.length; ti++) { var o = document.createElement('option'); o.text = widthtype[ti].value; try { this.nodewidthselectorsel.add(o, null); } catch (e) { this.nodewidthselectorsel.add(o); } } //google.maps.event.addDomListener.bind(this.nodewidthselectorsel, 'change', this, this.widthChange); google.maps.event.addDomListener(this.nodewidthselectorsel, 'change', function() { imageThis.widthChange.call(imageThis); }); this.node.appendChild(this.nodewidthselectorsel); return true; } this.onPanelActivated = onPanelActivated; function onPanelActivated() { this.panel.show(); }; this.deleteSelected = deleteSelected; function deleteSelected() { while (this.selectedPoints.length > 0) { point = this.selectedPoints.pop(); if (point.idmarker == this.editItem.idmarker) this.pointEditCancel(); this.mapi.tour.removePoint(point, true); } this.refreshList(); this.mapi.tour.refreshPoly(); } this.flipPolyDisplay = flipPolyDisplay; function flipPolyDisplay() { while (this.nodeflippoly.hasChildNodes()) this.nodeflippoly.removeChild(this.nodeflippoly.lastChild); if (this.mapi.tour.trackvisible) { this.mapi.tour.hidePoly(); this.nodeflippoly.appendChild(document.createTextNode('Zobrazit linii')); } else { this.mapi.tour.showPoly(); this.nodeflippoly.appendChild(document.createTextNode('Skrýt linii')); } } this.openImport = openImport; function openImport() { this.panel.activateTool(this.mapi.ctrlPanelToolImport); } this.deleteAll = deleteAll; function deleteAll() { this.pointEditCancel(); this.selectedPoints = new Array(); this.mapi.tour.clearTrack(); this.refreshList(); this.mapi.tour.refreshPoly(); } this.mapClick = mapClick; function mapClick(overlay, latlng, overlaylatlng) { //alert(transptype[0].value); //alert(overlay); if ((overlay == this.mapi.tour.polyline) && (overlay != null) && (!isShiftPressed)) { var lastlat = this.mapi.tour.points[0].pos.lat(); var lastlng = this.mapi.tour.points[0].pos.lng(); var minx, maxx, miny, maxy; var susp = -1; var suspd = 1000; for (var ti = 1; ti < this.mapi.tour.points.length; ti++) { if (this.mapi.tour.points[ti].pos.lng() < lastlng) { minx = this.mapi.tour.points[ti].pos.lng(); maxx = lastlng; } else { minx = lastlng; maxx = this.mapi.tour.points[ti].pos.lng(); } if (this.mapi.tour.points[ti].pos.lat() < lastlat) { miny = this.mapi.tour.points[ti].pos.lat(); maxy = lastlat; } else { miny = lastlat; maxy = this.mapi.tour.points[ti].pos.lat(); } if ((overlaylatlng.lat() >= miny) && (overlaylatlng.lat() <= maxy) && (overlaylatlng.lng() >= minx) && (overlaylatlng.lng() <= maxx)) { var a = -1 * (this.mapi.tour.points[ti].pos.lat() - lastlat); var b = this.mapi.tour.points[ti].pos.lng() - lastlng; var c = -1 * (a * lastlng + b * lastlat); var d = Math.abs(a * overlaylatlng.lng() + b * overlaylatlng.lat() + c) / Math.sqrt(a * a + b * b); if (d < suspd) { susp = ti; suspd = d; } } var lastlat = this.mapi.tour.points[ti].pos.lat(); var lastlng = this.mapi.tour.points[ti].pos.lng(); } this.mapi.tour.addPointBefore(overlaylatlng, this, susp); //this.pointEditOpen(this.mapi.tour.points[this.mapi.tour.points.length - 1]); this.refreshList(); this.mapi.tour.refreshPoly(); } else if (latlng) { this.mapi.tour.addPoint(latlng, this); //this.pointEditOpen(this.mapi.tour.points[this.mapi.tour.points.length - 1]); this.refreshList(); this.mapi.tour.refreshPoly(); } } this.onPointClick = onPointClick; function onPointClick(marker) { if (isShiftPressed) { if (this.selectedPoints.length > 0) { var found = false; for (var ti = 0; ti < this.selectedPoints.length; ti++) { if (this.selectedPoints[ti].idmarker == marker.idarray) found = true; } if (!found) { this.selectedPoints.push(marker.item); var ico = marker; marker.setIcon(ico.icoSel); } } else { this.selectedPoints = new Array(marker.item); var ico = marker; marker.setIcon(ico.icoSel); } } else { while (this.selectedPoints.length > 0) { point = this.selectedPoints.pop(); var ico = this.mapi.markers.markers[point.idmarker]; this.mapi.markers.markers[point.idmarker].setIcon(ico.ico); } this.selectedPoints = new Array(marker.item); var ico = marker; marker.setIcon(ico.icoSel); this.pointEditOpen(marker.item); if (this.panel.activetool != marker.item.tool) this.panel.activateTool(marker.item.tool); } this.refreshList(); } this.refreshList = refreshList; function refreshList() { while (this.nodelist.options.length > 0) { this.nodelist.remove(0); } if (this.mapi.tour.points.length > 0) { var sels = new Array(); if (this.selectedPoints.length > 0) for (var ti = 0; ti < this.selectedPoints.length; ti++) { sels[this.selectedPoints[ti].idmarker] = true; } for (var ti = 0; ti < this.mapi.tour.points.length; ti++) { var o = document.createElement('option'); o.text = '(' + (ti + 1) + '.) ' + this.mapi.tour.points[ti].name; if (sels[this.mapi.tour.points[ti].idmarker]) o.selected = true; try { this.nodelist.add(o, null); } catch (e) { this.nodelist.add(o); } } } } this.listChange = listChange; function listChange() { this.refreshFromList(); if (this.nodelist.selectedIndex > -1) { this.pointEditOpen(this.mapi.tour.points[this.nodelist.selectedIndex]); this.map.gmap.panTo(this.mapi.tour.points[this.nodelist.selectedIndex].pos); } } this.refreshFromList = refreshFromList; function refreshFromList() { this.selectedPoints = new Array(); if (this.nodelist.options.length > 0) { for (var ti = 0; ti < this.nodelist.options.length; ti++) { var ico = this.mapi.markers.markers[this.mapi.tour.points[ti].idmarker]; if (this.nodelist.options[ti].selected) { this.selectedPoints.push(this.mapi.tour.points[ti]); this.mapi.markers.markers[this.mapi.tour.points[ti].idmarker].setIcon(ico.icoSel); } else { this.mapi.markers.markers[this.mapi.tour.points[ti].idmarker].setIcon(ico.ico); } } } } this.pointEditOpen = pointEditOpen; function pointEditOpen(item) { this.editItem = item; this.nodeeditname.value = this.editItem.name; this.editActive = false; this.nodeedit.style.display = 'block'; } this.pointEditConfirm = pointEditConfirm; function pointEditConfirm() { if (this.editItem) { this.editItem.name = this.nodeeditname.value; this.refreshList(); } this.nodeedit.style.display = 'none'; this.editActive = false; this.nodeeditname.value = ''; if (this.editItem.idmarker != this.mapi.tour.points[0].idmarker) { if (this.editItem.name.length > 0) { var id = this.editItem.idmarker; this.mapi.markers.CreatePointMarker(this.editItem.tool, this.editItem, true); this.mapi.markers.removeMarker(id); } else { var id = this.editItem.idmarker; this.mapi.markers.CreatePointMarker(this.editItem.tool, this.editItem, false); this.mapi.markers.removeMarker(id); } } this.editItem = null; } this.pointEditCancel = pointEditCancel; function pointEditCancel() { this.nodeedit.style.display = 'none'; this.editActive = false; this.nodeeditname.value = ''; this.editItem = null; } this.showProfile = showProfile; function showProfile() { this.showProfileStart(false); } this.showProfileRev = showProfileRev; function showProfileRev() { this.showProfileStart(true); } this.showProfileStart = showProfileStart; function showProfileStart(rev) { if (this.mapi.tour.points.length > 1) { var param = 'coords='; if (rev){ for (var ti = this.mapi.tour.points.length - 1; ti >= 0; ti--) { if (param.length > 0) param+= '|'; param+= this.mapi.tour.points[ti].pos.lng() + ':' + this.mapi.tour.points[ti].pos.lat(); if (this.mapi.tour.points[ti].name.length > 0) { var name = this.mapi.tour.points[ti].name.replace(/#/g, ' ').replace(/\|/g, ' ').replace(/\?/g, ' ').replace(/\&/g, ' ').replace(/:/g, ' '); //param+= ':' + name; } } } else { for (var ti = 0; ti < this.mapi.tour.points.length; ti++) { if (param.length > 0) param+= '|'; param+= this.mapi.tour.points[ti].pos.lng() + ':' + this.mapi.tour.points[ti].pos.lat(); if (this.mapi.tour.points[ti].name.length > 0) { var name = this.mapi.tour.points[ti].name.replace(/#/g, ' ').replace(/\|/g, ' ').replace(/\?/g, ' ').replace(/\&/g, ' ').replace(/:/g, ' '); //param+= ':' + name; //param+= ':' + '.'; } } } var url = 'processprofile.php'; addCallback(callbacktype.profilesuccess, this, this.foundProfile); addCallback(callbacktype.profilecomplete, this, this.completeProfile); addCallback(callbacktype.profileerror, this, this.errorProfile); jQuery.ajax({cache:false, data:param, error:function() { runCallback(callbacktype.profileerror, ''); }, success:function(data) { runCallback(callbacktype.profilesuccess, data); }, complete:function() { runCallback(callbacktype.profilecomplete, ''); }, url:url, type:'POST'}); } else { alert('Pro zobrazení výškového profilu musí trasa obsahovat alespoň dva body.'); } } this.foundProfile = foundProfile; function foundProfile(data) { try { if (data.getElementsByTagName("error")[0].lastChild.nodeValue != 0) { alert('Profil nemohl být získán. Tvorba profilů je dostupná pouze pro oblast České republiky a Slovenska.'); } else { var url = 'processprofile.php?img=1'; addCallback(callbacktype.profileresultsuccess, this, this.foundProfileResult); addCallback(callbacktype.profileresultcomplete, this, this.completeProfileResult); addCallback(callbacktype.profileresulterror, this, this.errorProfileResult); jQuery.ajax({cache:false, error:function() { runCallback(callbacktype.profileresulterror, ''); }, success:function(data) { runCallback(callbacktype.profileresultsuccess, data); }, complete:function() { runCallback(callbacktype.profileresultcomplete, ''); }, url:url}); } } catch (e) { alert('Profil nemohl být získán. Tvorba profilů je dostupná pouze pro oblast České republiky a Slovenska.'); } } this.errorProfile = errorProfile; function errorProfile() { alert('Profil nemohl být získán. Tvorba profilů je dostupná pouze pro oblast České republiky a Slovenska.'); } this.completeProfile = completeProfile; function completeProfile() { } this.foundProfileResult = foundProfileResult; function foundProfileResult(data) { try { if (data.getElementsByTagName("error")[0].lastChild.nodeValue != 0) { alert('Profil nemohl být získán. Tvorba profilů je dostupná pouze pro oblast České republiky a Slovenska.'); } else { this.closeProfile(); this.nodeprofilecont = document.createElement('div'); this.nodeprofilecont.style.position = "absolute"; this.nodeprofilecont.style.padding = "8px"; this.nodeprofilecont.style.border = "1px solid #F0F0F0"; this.nodeprofilecont.style.left = "305px"; this.nodeprofilecont.style.top = "0px"; this.nodeprofilecont.style.backgroundColor = "#505050"; //google.maps.event.addDomListener(this.nodeprofilecont, "click", this.closeProfile); google.maps.event.addDomListener(this.nodeprofilecont, 'click', function() { imageThis.closeProfile(imageThis); }); this.nodeprofileimg = document.createElement('img'); this.nodeprofileimg.src = 'processprofile.php?img=2&rnd=' + (Math.random() * 1000000).toString(); this.nodeprofileimg.title = 'Kliknutím zavřete profil.'; this.nodeprofilecont.appendChild(this.nodeprofileimg); this.panel.node.appendChild(this.nodeprofilecont); } } catch (e) { alert('Profil nemohl být získán. Tvorba profilů je dostupná pouze pro oblast České republiky a Slovenska.'); } } this.errorProfileResult = errorProfileResult; function errorProfileResult() { alert('Profil nemohl být získán. Tvorba profilů je dostupná pouze pro oblast České republiky a Slovenska.'); } this.completeProfileResult = completeProfileResult; function completeProfileResult() { } this.closeProfile = closeProfile; function closeProfile() { try { google.maps.event.clearInstanceListeners(this.nodeprofilecont); this.panel.node.removeChild(this.nodeprofilecont); } catch (e) { } } this.colorChange = colorChange; function colorChange () { this.nodecolorselectorsel.style.backgroundColor = '#' + colortype[this.nodecolorselectorsel.selectedIndex].code; this.mapi.tour.trackcolor = '#' + colortype[this.nodecolorselectorsel.selectedIndex].code; this.mapi.tour.refreshPoly(); } this.transpChange = transpChange; function transpChange () { this.mapi.tour.tracktrans = transptype[this.nodetranspselectorsel.selectedIndex].value; this.mapi.tour.refreshPoly(); } this.widthChange = widthChange; function widthChange () { this.mapi.tour.trackwidth = widthtype[this.nodewidthselectorsel.selectedIndex].value; this.mapi.tour.refreshPoly(); } this.showInfo = showInfo; function showInfo (item) { var i = new PointItemDesc(item.pos, item, this.mapi.gmap); this.pointInfos.push(i); //this.mapi.gmap.addOverlay(i); i.setMap(this.mapi.gmap); } this.clearInfos = clearInfos; function clearInfos () { while (this.pointInfos.length > 0) { var item = this.pointInfos.pop(); //this.mapi.gmap.removeOverlay(item); item.setMap(null); } } this.toSave = toSave; function toSave () { this.panel.activateTool(this.mapi.ctrlPanelToolDetails); } } CtrlPanelToolTrack.prototype = new CtrlPanelTool; // control panel tool - IMPORT function CtrlPanelToolImport() { this.toolname = 'Import tracklogu'; this.activate = activate; function activate() { addCallback(callbacktype.importresult, this, this.importResult); this.panel.setName(this.toolname); this.panel.nodecontainer.appendChild(this.node); this.nodeimportlimit2.checked = true; this.nodeimportwptlimit2.checked = true; //GEvent.clearListeners(this.panel.node, "submit"); google.maps.event.clearListeners(this.panel.node, "submit"); //this.panel.node.target = '_blank'; this.panel.node.target = this.nodeimportframe.name; this.panel.node.method = 'post'; this.panel.node.action = 'import.php'; this.panel.node.enctype = 'multipart/form-data'; return true; } this.deactivate = deactivate; function deactivate() { //GEvent.clearListeners(this.panel.node, "submit"); google.maps.event.clearListeners(this.panel.node, "submit"); //GEvent.addDomListener(this.panel.node, "submit", cancelAction); google.maps.event.addDomListener(this.panel.node, "submit", cancelAction); this.panel.node.target = ''; this.panel.node.action = ''; this.panel.node.enctype = ''; this.panel.setName('   '); this.panel.nodecontainer.removeChild(this.node); return true; } this.onRegister = onRegister; function onRegister() { this.node = document.createElement('div'); this.node.className = 'tool'; this.node.appendChild(document.createTextNode('Zvolte soubor pro import:')); this.node.appendChild(document.createElement('br')); try { this.nodeimportfile = document.createElement(''); } catch (e) { this.nodeimportfile = document.createElement('input'); this.nodeimportfile.type = 'file'; this.nodeimportfile.name = 'importfile'; } this.node.appendChild(this.nodeimportfile); this.node.appendChild(document.createElement('br')); this.node.appendChild(document.createElement('br')); this.node.appendChild(document.createTextNode('Zjednodušit import na:')); this.node.appendChild(document.createElement('br')); try { this.nodeimportlimit1 = document.createElement(''); } catch (e) { this.nodeimportlimit1 = document.createElement('input'); this.nodeimportlimit1.type = 'radio'; this.nodeimportlimit1.name = 'importlimit'; this.nodeimportlimit1.id = 'importlimit1_' + (Math.floor(Math.random() * 1000000)).toString(); this.nodeimportlimit1.value = '300'; } this.node.appendChild(this.nodeimportlimit1); this.nodeimportlimit1lbl = document.createElement('label'); this.nodeimportlimit1lbl.htmlFor = this.nodeimportlimit1.id; this.nodeimportlimit1lbl.appendChild(document.createTextNode(' 300 bodů')); this.node.appendChild(this.nodeimportlimit1lbl); this.node.appendChild(document.createElement('br')); try { this.nodeimportlimit2 = document.createElement(''); } catch (e) { this.nodeimportlimit2 = document.createElement('input'); this.nodeimportlimit2.type = 'radio'; this.nodeimportlimit2.name = 'importlimit'; this.nodeimportlimit2.id = 'importlimit2_' + (Math.floor(Math.random() * 1000000)).toString(); this.nodeimportlimit2.value = '400'; } this.node.appendChild(this.nodeimportlimit2); this.nodeimportlimit2lbl = document.createElement('label'); this.nodeimportlimit2lbl.htmlFor = this.nodeimportlimit2.id; this.nodeimportlimit2lbl.appendChild(document.createTextNode(' 400 bodů')); this.node.appendChild(this.nodeimportlimit2lbl); this.node.appendChild(document.createElement('br')); try { this.nodeimportlimit3 = document.createElement(''); } catch (e) { this.nodeimportlimit3 = document.createElement('input'); this.nodeimportlimit3.type = 'radio'; this.nodeimportlimit3.name = 'importlimit'; this.nodeimportlimit3.id = 'importlimit3_' + (Math.floor(Math.random() * 1000000)).toString(); this.nodeimportlimit3.value = '500'; } this.node.appendChild(this.nodeimportlimit3); this.nodeimportlimit3lbl = document.createElement('label'); this.nodeimportlimit3lbl.htmlFor = this.nodeimportlimit3.id; this.nodeimportlimit3lbl.appendChild(document.createTextNode(' 500 bodů')); this.node.appendChild(this.nodeimportlimit3lbl); this.node.appendChild(document.createElement('br')); try { this.nodeimportlimit4 = document.createElement(''); } catch (e) { this.nodeimportlimit4 = document.createElement('input'); this.nodeimportlimit4.type = 'radio'; this.nodeimportlimit4.name = 'importlimit'; this.nodeimportlimit4.id = 'importlimit4_' + (Math.floor(Math.random() * 1000000)).toString(); this.nodeimportlimit4.value = '600'; } this.node.appendChild(this.nodeimportlimit4); this.nodeimportlimit4lbl = document.createElement('label'); this.nodeimportlimit4lbl.htmlFor = this.nodeimportlimit4.id; this.nodeimportlimit4lbl.appendChild(document.createTextNode(' 600 bodů')); this.node.appendChild(this.nodeimportlimit4lbl); this.node.appendChild(document.createElement('br')); this.node.appendChild(document.createElement('br')); this.node.appendChild(document.createTextNode('Importovat WPT jako zájmové body:')); this.node.appendChild(document.createElement('br')); try { this.nodeimportwptlimit1 = document.createElement(''); } catch (e) { this.nodeimportwptlimit1 = document.createElement('input'); this.nodeimportwptlimit1.type = 'radio'; this.nodeimportwptlimit1.name = 'importwptlimit'; this.nodeimportwptlimit1.id = 'importwptlimit1_' + (Math.floor(Math.random() * 1000000)).toString(); this.nodeimportwptlimit1.value = '0'; } this.node.appendChild(this.nodeimportwptlimit1); this.nodeimportwptlimit1lbl = document.createElement('label'); this.nodeimportwptlimit1lbl.htmlFor = this.nodeimportwptlimit1.id; this.nodeimportwptlimit1lbl.appendChild(document.createTextNode(' Ne')); this.node.appendChild(this.nodeimportwptlimit1lbl); this.node.appendChild(document.createElement('br')); try { this.nodeimportwptlimit2 = document.createElement(''); } catch (e) { this.nodeimportwptlimit2 = document.createElement('input'); this.nodeimportwptlimit2.type = 'radio'; this.nodeimportwptlimit2.name = 'importwptlimit'; this.nodeimportwptlimit2.id = 'importwptlimit2_' + (Math.floor(Math.random() * 1000000)).toString(); this.nodeimportwptlimit2.value = '15'; } this.node.appendChild(this.nodeimportwptlimit2); this.nodeimportwptlimit2lbl = document.createElement('label'); this.nodeimportwptlimit2lbl.htmlFor = this.nodeimportwptlimit2.id; this.nodeimportwptlimit2lbl.appendChild(document.createTextNode(' Ano (limit 15)')); this.node.appendChild(this.nodeimportwptlimit2lbl); this.node.appendChild(document.createElement('br')); try { this.nodeimportwptlimit3 = document.createElement(''); } catch (e) { this.nodeimportwptlimit3 = document.createElement('input'); this.nodeimportwptlimit3.type = 'radio'; this.nodeimportwptlimit3.name = 'importwptlimit'; this.nodeimportwptlimit3.id = 'importwptlimit3_' + (Math.floor(Math.random() * 1000000)).toString(); this.nodeimportwptlimit3.value = '30'; } this.node.appendChild(this.nodeimportwptlimit3); this.nodeimportwptlimit3lbl = document.createElement('label'); this.nodeimportwptlimit3lbl.htmlFor = this.nodeimportwptlimit3.id; this.nodeimportwptlimit3lbl.appendChild(document.createTextNode(' Ano (limit 30)')); this.node.appendChild(this.nodeimportwptlimit3lbl); this.node.appendChild(document.createElement('br')); this.node.appendChild(document.createElement('br')); try { this.nodeimportsubmit = document.createElement(''); } catch (e) { this.nodeimportsubmit = document.createElement('input'); this.nodeimportsubmit.type = 'submit'; this.nodeimportsubmit.name = 'importsubmit'; this.nodeimportsubmit.value = 'Importovat'; } this.node.appendChild(this.nodeimportsubmit); try { this.nodeimportframe = document.createElement('