jablonka.czprosek.czf

czfgmap

Subversion Repositories:
[/] [index.php] - Rev 16

Compare with Previous - Blame - Download


<?php
//<!-- Copyright (C) 2008  Petr Simandl www.simandl.cz                          -->
//<!-- This file is part of CZFGmap.                                            -->
//<!--                                                                          -->
//<!-- CZFGmap is free software: you can redistribute it and/or modify          -->
//<!-- it under the terms of the GNU General Public License as published by     -->
//<!-- the Free Software Foundation, either version 3 of the License, or        -->
//<!-- (at your option) any later version.                                      -->
//<!--                                                                          -->
//<!-- CZFGmap is distributed in the hope that it will be useful,               -->
//<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of           -->
//<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            -->
//<!-- GNU General Public License for more details.                             -->
//<!--                                                                          -->
//<!-- You should have received a copy of the GNU General Public License        -->
//<!-- along with CZFGmap.  If not, see <http://www.gnu.org/licenses/>.         -->

error_reporting(7);

include("../forum/globalmap.php");

switch (@$_SERVER['SERVER_NAME']) {
    case "mapa.jablonka.cz":
        $GMapKey="ABQIAAAAvGTA14kOdSvtr3t8EjKUdxRhT8UzNgvAgXoUO-qU5L_X_kn6BxRNDeblBDjZ6R9FT2D3RBzuJgriOQ";
        break;
    case "connected.czf":
        $GMapKey="ABQIAAAAvGTA14kOdSvtr3t8EjKUdxQ2n1pNbYRLwYPuGT94C-0un95jGhSkgS0a3LnGa2MzRepHicK08lDDmg";
        break;
    case "connected.prosek.czf":
        $GMapKey="ABQIAAAAvGTA14kOdSvtr3t8EjKUdxQmdP92EXlqBtrjj_gSpBHpGjsXLRR7QrpeKaV71OgH6Q-vhhFyEpUxOA";
        break;
    case "mapa.prosek.czf":
        $GMapKey="ABQIAAAAlZ9uhPay2OYt2xmaN84g0BTYUdkyQZ68wktXWB9o4y2agzv8zxRyBxtFdIbLe18hmqHTwiWPXl7VxA";
        break;
    default:
        $GMapKey="ABQIAAAAlZ9uhPay2OYt2xmaN84g0BTYUdkyQZ68wktXWB9o4y2agzv8zxRyBxtFdIbLe18hmqHTwiWPXl7VxA";
}

echo '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>CZFGmap</title>
    <META name="AUTHOR" content="Petr Simandl, www.simandl.cz">
    <META name="LICENSE" content="GNU General Public License">
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <link REL="SHORTCUT ICON" HREF="favicon.ico">
    <style type="text/css">
      @import url("http://www.google.com/uds/css/gsearch.css");
      @import url("http://www.google.com/uds/solutions/localsearch/gmlocalsearch.css");
      @import "czfgmap.css";
      }
    </style>
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key='.$GMapKey.'"
            type="text/javascript"></script>
    <script src="http://www.google.com/uds/api?file=uds.js&amp;v=1.0" type="text/javascript"></script>
    <script src="http://www.google.com/uds/solutions/localsearch/gmlocalsearch.js" type="text/javascript"></script>
    <script type="text/javascript">

    //<![CDATA[

    //### Globalni promenne #################################
    var CurrentDatabase = "czfmutf";
    var NodeLimit = "200";
    var NodeOrder = "ASC";
    var NodeSortBy = "name";
    var Where = "";
    var LoadedNodes = new Array();
    var LoadedLinks = new Array();
    var map;
    var NodeIcon = new Array();
    var DatabaseNodeTables = new Array();
    var AutoFetchMode = true;
    var AutoClearMode = true;
    var NumLoadedNodes = 0;
    var NumAddedNodes = 0;
    var NumLoadedLinks = 0;
    var NumAddedLinks = 0;
    var NumVisibleLinks = 0;
    var NumInVisibleLinks = 0;
    var PtA = new Array();
    var PtB = new Array();
    var PtC = new Array();
    var PtPt = 1;
    var PtNum = 0;
    
    var MapSizeX = 800;
    var MapSizeY = 600;
    var MapCenterLat = 50.123567;
    var MapCenterLon = 14.496258;
    var MapZoom = 15;
    var MapName = "Mapa";
    var saved=[];

    var LinkColType = new Array();
    LinkColType["00000001"] = "#00aa00";
    LinkColType["00000001"] = "#00FF00";
    var LinkColTypeWifiBackbone = "#fafa00";
    LinkColType["00000002"] = "#be0000";
    LinkColType["00000006"] = "#ff5050";
    LinkColType["00000003"] = "#64c8ff";
    LinkColType["00000004"] = "#dc00dc";
    LinkColType["00000007"] = "#c8c8c8";
    LinkColType["00000008"] = "#ffffff";
    LinkColType["00000009"] = "#fa8000";
    LinkColType["00000099"] = "#0000fa";
    var LinkColTypeNA = "#78783c";
    LinkColType["00000005"] = "#00fafa";
    
    //nacteni ikon pro nody
    var NodeType  = [0,1,9,10,98,99];
    var NodeState = [1,9,10,40,79,80,90];
    for (type in NodeType) {
      for (state in NodeState) {
        i = 10000 + NodeType[type]*100 + NodeState[state];
        NodeIcon[i] = new GIcon();
        NodeIcon[i].image = "./images/node/node-" + NodeType[type] + "-" + NodeState[state] + ".png";
        NodeIcon[i].iconSize = new GSize(15,15);
        NodeIcon[i].iconAnchor = new GPoint(7,7);
        NodeIcon[i].shadowSize = new GSize(22,20);
        NodeIcon[i].infoWindowAnchor = new GPoint(5,1);
      }
    }

    //### Uvodni funkce #################################
    function load() {
        MapLoad();
        LoadSettings();
    }

    function MapLoad() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"),{draggableCursor: \'crosshair\', draggingCursor: \'pointer\'});

        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        var MapCenter = new GLatLng(MapCenterLat, MapCenterLon);
        map.setCenter(MapCenter, MapZoom);
        map.enableScrollWheelZoom();
        map.addControl(new GScaleControl());
        map.addControl(new MDControl());

        // Selecting map type
            var MapTypes = map.getMapTypes();
            for(var i = 0; i < MapTypes.length; i++) {
            if (MapName == MapTypes[i].getName()) map.setMapType(MapTypes[i]);
         }

        map.addControl(new GOverviewMapControl());
        
        map.addControl(new google.maps.LocalSearch(), new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10,20)));
        //tohle zajisti znovunacteni nodu po presunu
        GEvent.addListener(map, "moveend", HandleMapMoveEnd);           
        
        //ziskani souradnic po kliknuti
        GEvent.addListener(map, \'click\', function(overlay, point) { if(point) { HandleNextPoint(point) }} );
        
        //tohle zajisti vypis pri startu
        var center = map.getCenter();
        document.getElementById("SouradniceStredu").innerHTML = CurrentDatabase + "<br>Souradnice stredu:" + center.toString() + "<br>Rozsah: " + map.getBounds()+"<br>Zvetseni: " + map.getZoom();

        //tohle zajisti prubezny vypis
        GEvent.addListener(map, "moveend", function() {
          var center = map.getCenter();
          document.getElementById("SouradniceStredu").innerHTML = CurrentDatabase + " " + map.getBounds().getSouthWest().lat() + "<br>Souradnice stredu: " + center.toString() + "<br>Rozsah: " + map.getBounds()+"<br>Zvetseni: " + map.getZoom();
        });
      }
    }

    //### Ostatni funkce ###########################

    function NodeLayer() {
        //body se berou z databaze pomoci php skriptu ktery dela jen inteface a generuje xml
        Where = "";
        GDownloadUrl("mapa_genxml.php?db="+CurrentDatabase
                            +"&latmin="+map.getBounds().getSouthWest().lat()
                            +"&latmax="+map.getBounds().getNorthEast().lat()
                            +"&lonmin="+map.getBounds().getSouthWest().lng()
                            +"&lonmax="+map.getBounds().getNorthEast().lng()
                            +"&sortby="+NodeSortBy
                            +"&limit="+NodeLimit
                            +"&order="+NodeOrder
                            +"&where="+Where
                            +"&zoom="+map.getZoom()
                            , function(data) {
          var xml = GXml.parse(data);
          var nodes = xml.documentElement.getElementsByTagName("node");
          for (var i = 0; i < nodes.length; i++) {
            var id = nodes[i].getAttribute("id");
            //zobrazime jen nove nody
            if (! LoadedNodes[id]) {
              var name = nodes[i].getAttribute("name");
              var address = nodes[i].getAttribute("address");
              var type = 10000 + nodes[i].getAttribute("type")*100 + nodes[i].getAttribute("status")*1;
              var point = new GLatLng(parseFloat(nodes[i].getAttribute("lat")),
                                      parseFloat(nodes[i].getAttribute("lng")));
              var marker = CreateMarker(point, name, address, type, id);
              map.addOverlay(marker);
              LoadedNodes[id]=point;
              NumAddedNodes = NumAddedNodes + 1;
            }
          }
          document.getElementById("NumNodes").innerHTML = "Nacteno " + NumAddedNodes + " nodu";

          var links = xml.documentElement.getElementsByTagName("link");
          for (var i = 0; i < links.length; i++) {
            var id1 = links[i].getAttribute("id1");
            var id2 = links[i].getAttribute("id2");
            //nacteme jen pokud jde o novy link
            if (! LoadedLinks[id1+"x"+id2] && ! LoadedLinks[id2+"x"+id1]) {
              var backbone = links[i].getAttribute("backbone");
              var inplanning = links[i].getAttribute("inplanning");
              var type = links[i].getAttribute("type");
              var status = links[i].getAttribute("status");

              //zobrazi se jen pokud jsou k dispozici oba nody
              if ( LoadedNodes[id1] && LoadedNodes[id2]) {
                var LinkSize = (backbone * 2);
                var LinkColBg = "#000000";
                var LinkColBgOpacity = 1;
                var LinkColOpacity = 1;
                var LinkStyle = "solid";

                if (inplanning == 1) {
                    LinkColBgOpacity = 0.1;
                    LinkColOpacity = 0.2;
                    LinkColBg = "#0000FF";
                    LinkStyle = "dash";
                }
//              DebugPrint(":"+ inplanning + ":");

                var polyOptions = {geodesic:false};
                var polyline = new GPolyline([LoadedNodes[id1],LoadedNodes[id2]], LinkColBg, 3 + LinkSize, LinkColBgOpacity, polyOptions);
                map.addOverlay(polyline);

                var LinkColTypeAct = LinkColTypeNA;
                if ( LinkColType[type]) {
                    LinkColTypeAct = LinkColType[type];
                }

                LoadedLinks[id1+"x"+id2] = new GPolyline([LoadedNodes[id1],LoadedNodes[id2]], LinkColTypeAct, 1 + LinkSize, LinkColOpacity, polyOptions);
                map.addOverlay(LoadedLinks[id1+"x"+id2]);

                NumVisibleLinks = NumVisibleLinks + 1;
              } else {
                //zde se pokusime donahrat nod ktery nam chybi
                
                
                NumInVisibleLinks = NumInVisibleLinks + 1;
              }

//              LoadedLinks[id1+"x"+id2]=polyline;

              NumAddedLinks = NumAddedLinks + 1;
            }
          }
          document.getElementById("NumLinks").innerHTML = "Nacteno " + NumAddedLinks + " linku a zobrazeno "  + NumVisibleLinks + " linku a " + NumInVisibleLinks + " nezobrazeno.";
        });
    }

    //##############################
    function HandleNextPoint(point) {
        
        document.getElementById("NodeCoordinates").innerHTML = (point.y.toFixed(6)+\'x\'+point.x.toFixed(6));

        if ( PtPt == 1 ) { 
            document.getElementById("NodeCoordinatesA").innerHTML = (\'A \'+point.y.toFixed(6)+\'x\'+point.x.toFixed(6));
            PtA = point;
        }
        if ( PtPt == 2 ) {
            document.getElementById("NodeCoordinatesB").innerHTML = (\'B \'+point.y.toFixed(6)+\'x\'+point.x.toFixed(6));
            PtB = point;
        }
        if ( PtPt == 3 ) {
            document.getElementById("NodeCoordinatesC").innerHTML = (\'C \'+point.y.toFixed(6)+\'x\'+point.x.toFixed(6));
            PtC = point;
        }


        PtPt = PtPt + 1;
        if ( PtPt > 3 ) { PtPt = 1; }
        PtNum = PtNum + 1;

        if ( PtNum > 1 ) {
            var DistanceAB = Math.round(GetLineLength(PtA, PtB));
            document.getElementById("NodeDistanceAB").innerHTML = DistanceAB+\'m\';
            document.getElementById("NodeDistanceBA").innerHTML = DistanceAB+\'m\';
        }
        if ( PtNum > 2 ) {
            var DistanceBC = Math.round(GetLineLength(PtC, PtB));
            document.getElementById("NodeDistanceBC").innerHTML = DistanceBC+\'m\';
            document.getElementById("NodeDistanceCB").innerHTML = DistanceBC+\'m\';
            var DistanceAC = Math.round(GetLineLength(PtC, PtA));
            document.getElementById("NodeDistanceAC").innerHTML = DistanceAC+\'m\';
            document.getElementById("NodeDistanceCA").innerHTML = DistanceAC+\'m\';
            
            document.getElementById("NodeAngleACB").innerHTML = Math.round(GetAngle(PtA, PtC, PtB))+\'st\';
            document.getElementById("NodeAngleBAC").innerHTML = Math.round(GetAngle(PtB, PtC, PtA))+\'st\';
            document.getElementById("NodeAngleCBA").innerHTML = Math.round(GetAngle(PtC, PtA, PtB))+\'st\';

            document.getElementById("NodeDistanceBAC").innerHTML = ( DistanceAB + DistanceAC ) +\'m\';
            document.getElementById("NodeDistanceABC").innerHTML = ( DistanceAB + DistanceBC ) +\'m\';
            document.getElementById("NodeDistanceBCA").innerHTML = ( DistanceBC + DistanceAC ) +\'m\';
        }
    }

    //##############################
    function GetAngle(PA, PB, PC) {
        var a = GetLineLength(PC, PB);
        var b = GetLineLength(PC, PA);
        var c = GetLineLength(PA, PB);
        var s = ( a + b + c ) / 2;
        var alfa = (360/Math.PI)*Math.asin(Math.sqrt((s-b)*(s-c)/(b*c)));
      return alfa;
    }

    //##############################
    function GetLineLength(PA, PB) {
        var Lat1 = PA.lat();
        var Lon1 = PA.lng();
        var Lat2 = PB.lat();
        var Lon2 = PB.lng();
        var R = 6371; // km
        var dLat = (Lat2-Lat1) * Math.PI / 180;
        var dLon = (Lon2-Lon1) * Math.PI / 180; 
        var a = Math.sin(dLat/2) * Math.sin(dLat/2) +
                Math.cos(Lat1 * Math.PI / 180) * Math.cos(Lat2 * Math.PI / 180) * 
            Math.sin(dLon/2) * Math.sin(dLon/2);
        var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 
        var LineLength = 1000 * R * c;
      return LineLength;
    }

    //##############################
    function HandleMapMoveEnd() {
        if (AutoFetchMode) {
          ClearOverlayAndData();
          FetchOverlayAndData();
        }
          document.getElementById("status").innerHTML = "Po presunu mame celkem " + NumAddedNodes + " nodu";
    }

    //##############################
    function CreateMarker(point, name, address, type, id) {
      var marker = new GMarker(point, {draggable: true, bounce: true, icon: NodeIcon[type]});
      var html = "<b>" + id + " " + name + "</b> <br/>" + address +" <br/>" + type;
      GEvent.addListener(marker, "dragstart", function() {
        map.closeInfoWindow();
      });
      GEvent.addListener(marker, \'click\', function() {
        marker.openInfoWindowHtml(html);
      });
      return marker;
    }
    
    //##############################
    function SwitchDatabase(NewDatabase) {
        CurrentDatabase = NewDatabase;
        document.getElementById("SouradniceStredu").innerHTML = CurrentDatabase;
        ClearOverlayAndData();
        FetchOverlayAndData();
        document.getElementById("status").innerHTML = "Databaze zmenena na "+CurrentDatabase;
        document.getElementById("databaze").innerHTML = CurrentDatabase;
    }    
    
    //##############################
    function ChangeNodeLimit(NewNodeLimit) {
        NodeLimit = NewNodeLimit;
        FetchOverlayAndData();
        document.getElementById("status").innerHTML = "Limit zmenen na "+NewNodeLimit;
        document.getElementById("NodeLimitSelectBox").value = NodeLimit;
    }    

    //##############################
    function ChangeMapSizeX(NewMapSizeX) {
        MapSizeX = NewMapSizeX;
        FetchOverlayAndData();
        document.getElementById("status").innerHTML = "Rozmer X zmenen na "+MapSizeX;
        document.getElementById("map").style.width = MapSizeX+"px";
        
        MapName = map.getCurrentMapType().getName();
        ClearOverlayAndData();
        MapLoad();
        FetchOverlayAndData();
    }    

    //##############################
    function ChangeMapSizeY(NewMapSizeY) {
        MapSizeY = NewMapSizeY;
        FetchOverlayAndData();
        document.getElementById("status").innerHTML = "Rozmer Y zmenen na "+MapSizeY;
        document.getElementById("map").style.height = MapSizeY+"px";

        MapName = map.getCurrentMapType().getName();
        ClearOverlayAndData();
        MapLoad();
        FetchOverlayAndData();
    }    

    //##############################
    function DebugPrint(Text) {
        document.getElementById("debug").innerHTML = document.getElementById("debug").innerHTML + Text;
    }    

    //##############################
    function Fetch() {
        NodeLayer();
        document.getElementById("status").innerHTML = "Nacteno";
    }    

    //##############################
    function FetchOverlayAndData() {
        if (AutoFetchMode) {
            Fetch();
        };
    }

    //##############################
    function ClearOverlayAndData() {
        if (AutoClearMode) {
            ForceClear();
        };
    }

    //##############################
    function ForceClear() {
        document.getElementById("status").innerHTML = "Smazano " + NumAddedNodes + " nodu";
        map.clearOverlays();
        LoadedNodes=Array();
        LoadedLinks=Array();
        NumAddedNodes=0;
        document.getElementById("NumNodes").innerHTML = "Nacteno " + NumAddedNodes + " nodu";
        NumAddedLinks=0;
        NumVisibleLinks=0;
        NumInVisibleLinks=0;
        document.getElementById("NumLinks").innerHTML = "Nacteno " + NumAddedLinks + " linku";
    }

    //##############################
    function ToggleAutoFetchMode(NewAutoFetchMode) {
        AutoFetchMode = NewAutoFetchMode;
        if (AutoFetchMode) {
          document.getElementById("status").innerHTML = "Automaticke nacitani zapnuto.";
        }
        else {
          document.getElementById("status").innerHTML = "Automaticke nacitani vypnuto.";
        }    
        document.getElementById("AutoFetchModeCheckButton").checked = AutoFetchMode;
    }    
    
    //##############################
    function ToggleAutoClearMode(NewAutoClearMode) {
        AutoClearMode = NewAutoClearMode;
        if (AutoClearMode) {
          document.getElementById("status").innerHTML = "Automaticke mazani zapnuto.";
        }
        else {
          document.getElementById("status").innerHTML = "Automaticke mazani vypnuto.";
        }
        document.getElementById("AutoClearModeCheckButton").checked = AutoClearMode;
    }    
    
    //##############################
    function SetCookie(Name, Data, Validity) {
        var Day = 24 * 3600 * 1000;
        var Expiration = new Date();
        Expiration.setTime(Expiration.getTime() + Validity * Day);
        document.cookie = Name + "=" + escape(Data) + "; expires=" + Expiration.toGMTString() + "; path=/";
    }

    //##############################
    function GetCookie(Name) {
        var Prefix = Name + "=";
        var Begin = document.cookie.indexOf(Prefix);
        if ( Begin == -1 )
        return "";
        Begin += Prefix.length;
        if ( Begin >= document.cookie.length )
            return "";
        var End = document.cookie.indexOf(";", Begin);
        if ( End == -1 )
            End = document.cookie.length;
        return unescape(document.cookie.substring(Begin, End));
    }

    //##############################
    function SaveSettingsCookieText() {
        var Text = "db=" + CurrentDatabase
                    + "&map=" + map.getCurrentMapType().getName()
                    + "&sizex=" + MapSizeX
                    + "&sizey=" + MapSizeY
                    + "&lat=" + map.getCenter().lat()
                    + "&lon=" + map.getCenter().lng()
                    + "&zoom=" + map.getZoom()
                    + "&autofetch=" + AutoFetchMode
                    + "&autoclear=" + AutoClearMode
                    + "&nodelimit=" + NodeLimit
                    + "&";
      return Text;
    }

    //##############################
    function LoadSettings() {
        var Text = GetCookie("default");
        var Begin = 0;
        var End = 0;

        End = Text.indexOf("&",Begin);
        while (End > -1) {
            var Parameter = Text.substring(Begin,End);              
            var EqualPosition = Parameter.indexOf("=");
            if ((EqualPosition > -1) && (EqualPosition < Parameter.length)) {
                var ParameterName = Parameter.substring(0,EqualPosition);
                var ParameterValue = Parameter.substring(EqualPosition+1,Parameter.length);
                if (ParameterName == "db") CurrentDatabase = ParameterValue;
                if (ParameterName == "map") MapName = ParameterValue;
                if (ParameterName == "sizex") MapSizeX = 1*ParameterValue;
                if (ParameterName == "sizey") MapSizeY = 1*ParameterValue;
                if (ParameterName == "lat") MapCenterLat = 1*ParameterValue;
                if (ParameterName == "lon") MapCenterLon = 1*ParameterValue;
                if (ParameterName == "zoom") MapZoom = 1*ParameterValue;
                if ((ParameterName == "autofetch") && ParameterValue == "true" ) ToggleAutoFetchMode(true);
                if ((ParameterName == "autofetch") && ParameterValue == "false" ) ToggleAutoFetchMode(false);
                if ((ParameterName == "autoclear") && ParameterValue == "true" ) ToggleAutoClearMode(true);
                if ((ParameterName == "autoclear") && ParameterValue == "false" ) ToggleAutoClearMode(false);
                if (ParameterName == "nodelimit") ChangeNodeLimit(ParameterValue);
            }
            Begin = End + 1;
            End = Text.indexOf("&",Begin);
        }

        document.getElementById("AutoFetchModeCheckButton").checked = AutoFetchMode;
        document.getElementById("AutoClearModeCheckButton").checked = AutoClearMode;
        document.getElementById("NodeLimitSelectBox").value = NodeLimit;
        document.getElementById("databaze").innerHTML = CurrentDatabase;

        document.getElementById("MapSizeXSelectBox").value = MapSizeX;
        document.getElementById("MapSizeYSelectBox").value = MapSizeY;
        document.getElementById("map").style.width = MapSizeX+"px";
        document.getElementById("map").style.height = MapSizeY+"px";
        ForceClear();
        MapLoad();
        FetchOverlayAndData();
    }

    //##############################
function MDControl() { }
 MDControl.prototype = new GControl();
 MDControl.prototype.initialize = function(map) {
  var container = document.createElement("div");
 var savepos= document.createElement("div");
 savepos.title= "Ulozit aktualni pozici a zoom";
 savepos.className= "MDbuttons";
 container.appendChild(savepos);
 savepos.appendChild(document.createTextNode("Ulozit pozici"));
  GEvent.addDomListener(savepos, "click", function() {
   var center = map.getCenter(); var zoom = map.getZoom();
   saved.splice(0,2,center,zoom);
//   alert("Saved Position: "+center.toUrlValue()+"\nZoomlevel: "+zoom);
  });

 var tosaved=document.createElement("div");
 tosaved.title= "Navrat zpet na ulozenou pozici";
 tosaved.className= "MDbuttons";
 container.appendChild(tosaved);
 tosaved.appendChild(document.createTextNode("Na ulozenou"));
  GEvent.addDomListener(tosaved, "click", function() {
   if(saved.length > 0) { map.setZoom(saved[1]); map.panTo(saved[0]); }
  });
 map.getContainer().appendChild(container);
 return container;
}

MDControl.prototype.getDefaultPosition = function() {
 return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7,31));
}

    //##############################
    function ShowMeasuredDistanceAndAngle() {
        var LineSize = 1;
        var LineColAB = "#FF0000";
        var LineColAC = "#FF0000";
        var LineColBC = "#00FF00";
        var LineColOpacity = 0.5;

        var polyOptions = {geodesic:false};
        if ( PtNum > 1 ) {
            var pointA = new GLatLng(parseFloat(PtA.lat()),parseFloat(PtA.lng()));
            var pointB = new GLatLng(parseFloat(PtB.lat()),parseFloat(PtB.lng()));
            polylineAB = new GPolyline([pointA,pointB], LineColAB, 3 + LineSize, LineColOpacity, polyOptions);
            map.addOverlay(polylineAB);
        }
        if ( PtNum > 2 ) {
            var pointC = new GLatLng(parseFloat(PtC.lat()),parseFloat(PtC.lng()));
            polylineAC = new GPolyline([pointA,pointC], LineColAC, 3 + LineSize, LineColOpacity, polyOptions);
            map.addOverlay(polylineAC);
            polylineBC = new GPolyline([pointB,pointC], LineColBC, 3 + LineSize, LineColOpacity, polyOptions);
            map.addOverlay(polylineBC);
        }
}

    //##############################
    function HideMeasuredDistanceAndAngle() {
        if ( PtNum > 1 ) {
            map.removeOverlay(polylineAB);
        }
        if ( PtNum > 2 ) {
            map.removeOverlay(polylineAB);
            map.removeOverlay(polylineAC);
            map.removeOverlay(polylineBC);
        }
}

    //##############################
    function MakePrintable() {

        // To make polygons printable...
        $$("div.gmnoprint").each( function (div, index) {
            div.removeClassName(\'gmnoprint\');
        });

}

    //]]>
    </script>
  </head>

  <body onload="load()" onunload="GUnload()">
    <table>
    <tr>
    <td>
      <div id="map" class="gmaparea"></div>
    </td>

    <td valign="top" class="controlarea">
    <div id="UserInfo">
    ';
    if ($bbuserinfo['username'] == "Unregistered") {
      echo "Nejste <a href=\"http://connected.prosek.czf/forum/usercp.php\">prihlasen(a)</a> a nezobrazi se vam obsah databaze czfmutf, ale jen gendb.";
    } else {
      echo "<a href=\"http://connected.prosek.czf/forum/usercp.php\">Prihlasen(a)</a> jako:";
      echo $bbuserinfo['username']."&nbsp;";
      echo $bbuserinfo['userid']."&nbsp;";
      echo $bbuserinfo['mapperms']."&nbsp;";
    }
    echo '</div>
    <hr>
    Databaze:
    <br>
    <input type="button" value="czfmutf" onClick="SwitchDatabase(\'czfmutf\');"/>
    <input type="button" value="gendb" onClick="SwitchDatabase(\'gendb\');"/>
    <div id="databaze">0</div>
    <hr>
    Nody a linky:
    <br>
    <input type="button" value="Zobrazit" onClick="Fetch();"/>
    <input type="button" value="Smazat" onClick="ForceClear();"/>
    <div id="NumNodes">0</div>
    <div id="NumLinks">0</div>
    Automaticke nacitani:
    <input id="AutoFetchModeCheckButton" type="checkBox" onclick="ToggleAutoFetchMode(this.checked)">
    <br>
    Automaticke mazani:
    <input id="AutoClearModeCheckButton" type="checkBox" onclick="ToggleAutoClearMode(this.checked)">
    <br>
    Limit poctu nodu:
    <select id="NodeLimitSelectBox" onchange="ChangeNodeLimit(this.value)">
        <option value="0">0</option>
        <option value="30" selected="selected">30</option>
        <option value="60">60</option>
        <option value="200">200</option>
        <option value="500">500</option>
        <option value="1000">1000</option>
    </select>
    <hr>
    Nastaveni mapy:
    <div>
    <select id="MapSizeXSelectBox" onchange="ChangeMapSizeX(this.value)">
        <option value="800" selected="selected">800</option>
        <option value="900">900</option>
        <option value="1000">1000</option>
        <option value="1100">1100</option>
        <option value="1200">1200</option>
        <option value="1300">1300</option>
        <option value="1400">1400</option>
    </select>
    X
    <select id="MapSizeYSelectBox" onchange="ChangeMapSizeY(this.value)">
        <option value="600" selected="selected">600</option>
        <option value="700">700</option>
        <option value="800">800</option>
        <option value="900">900</option>
        <option value="1000">1000</option>
    </select>
    </div>
    <input type="button" value=\'Ulozit\' onclick=\'SetCookie("default", SaveSettingsCookieText() , 365);\'>
    <input type="button" value=\'Nahrat\' onclick=\'LoadSettings();\'>
    <hr>
    Mereni:
    <br>
    <input type="button" value=\'Zobrazit\' onclick=\'ShowMeasuredDistanceAndAngle();\'>
    <input type="button" value=\'Schovat\' onclick=\'HideMeasuredDistanceAndAngle();\'>
    <hr>
    Print:
    <br>
    <input type="button" value=\'Print\' onclick=\'MakePrintable();\'>
    </td>
    </tr>

    <tr>
    <td class="statusarea" >

    <div id="debug"></div>
    <div id="status">Hotovo!</div>
    <div id="data"></div>
    <div id="NodeCoordinates">aaa</div>
    <div id="SouradniceStredu">Souradnice stredu:<br>Rozsah:<br>Zvetseni:</div>
    <td>
    <table border="1"> 
    <tr>
    <td>Mereni vzdalenosti a uhlu</td><td>A</td><td>B</td><td>C</td>
    </tr>
    <tr>
    <td><div id="NodeCoordinatesA">A klikni na mapu</div></td><td><div id="NodeAngleACB">ACB</div></td>
    <td><div id="NodeDistanceAB">AB</div></td><td><div id="NodeDistanceAC">AC</div></td>
    </tr>
    <tr>
    <td><div id="NodeCoordinatesB">B klikni podruhe</div></td><td><div id="NodeDistanceBA">BA</div></td>
    <td><div id="NodeAngleBAC">BAC</div></td><td><div id="NodeDistanceBC">BC</div></td>
    </tr>
    <tr>
    <td><div id="NodeCoordinatesC">C klikni potreti</div></td><td><div id="NodeDistanceCA">CA</div></td>
    <td><div id="NodeDistanceCB">CB</div></td><td><div id="NodeAngleCBA">BAC</div></td>
    </tr>
    <tr>
    <td>
    </td><td><div id="NodeDistanceBAC">B-A-C</div></td>
    <td><div id="NodeDistanceABC">A-B-C</div></td><td><div id="NodeDistanceBCA">B-C-A</div></td>
    </tr>
    </table>
    </td>

    </td>
    </tr>
    
    <tr>
    <td colspan=2>
    CZFGmap (c) Petr Simandl - GNU General Public License
    <a href="http://websvn.prosek.czf/">websvn.prosek.czf</a>
    </td>
    </tr>
    
    </table>
    <a href="http://code.google.com/apis/maps/documentation/examples/">http://code.google.com/apis/maps/documentation/examples/</a>
    <a href="http://code.google.com/apis/kml/documentation/kml_tut.html">http://code.google.com/apis/kml/documentation/kml_tut.html</a>
    <br>
    <a href="http://mapki.com/wiki/Knowledge_Base">http://mapki.com/wiki/Knowledge_Base</a>
    <a href="http://www.bdcc.co.uk/Gmaps/BdccGmapBits.htm">http://www.bdcc.co.uk/Gmaps/BdccGmapBits.htm</a>
    <br>
    <a href="http://econym.googlepages.com/custommap.htm">http://econym.googlepages.com/custommap.htm</a>
    <br>
    http://www.czfree.net/forum/showthread.php?postid=197732#post197732
    http://www.gscottolson.com/blackbirdjs/
  </body>
</html>
';
?>

Powered by WebSVN 2.2.1