jablonka.czprosek.czf

czfgmap

Subversion Repositories:
[/] [index.php] - Blame information for rev 15

 

Line No. Rev Author Line
15simandl<?php
2//<!-- Copyright (C) 2008 Petr Simandl www.simandl.cz -->
3//<!-- This file is part of CZFGmap. -->
4//<!-- -->
5//<!-- CZFGmap is free software: you can redistribute it and/or modify -->
6//<!-- it under the terms of the GNU General Public License as published by -->
7//<!-- the Free Software Foundation, either version 3 of the License, or -->
8//<!-- (at your option) any later version. -->
9//<!-- -->
10//<!-- CZFGmap is distributed in the hope that it will be useful, -->
11//<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
12//<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
13//<!-- GNU General Public License for more details. -->
14//<!-- -->
15//<!-- You should have received a copy of the GNU General Public License -->
16//<!-- along with CZFGmap. If not, see <http://www.gnu.org/licenses/>. -->
17 
18error_reporting(7);
19 
20include("../forum/globalmap.php");
21 
22switch (@$_SERVER['SERVER_NAME']) {
23 case "connected.czf":
24 $GMapKey="ABQIAAAAvGTA14kOdSvtr3t8EjKUdxQ2n1pNbYRLwYPuGT94C-0un95jGhSkgS0a3LnGa2MzRepHicK08lDDmg";
25 break;
2610simandl case "connected.prosek.czf":
27 $GMapKey="ABQIAAAAvGTA14kOdSvtr3t8EjKUdxQmdP92EXlqBtrjj_gSpBHpGjsXLRR7QrpeKaV71OgH6Q-vhhFyEpUxOA";
28 break;
295simandl case "mapa.prosek.czf":
30 $GMapKey="ABQIAAAAlZ9uhPay2OYt2xmaN84g0BTYUdkyQZ68wktXWB9o4y2agzv8zxRyBxtFdIbLe18hmqHTwiWPXl7VxA";
31 break;
32 default:
33 $GMapKey="ABQIAAAAlZ9uhPay2OYt2xmaN84g0BTYUdkyQZ68wktXWB9o4y2agzv8zxRyBxtFdIbLe18hmqHTwiWPXl7VxA";
34}
35 
36echo '
371simandl<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
38 
39 
40<html xmlns="http://www.w3.org/1999/xhtml">
41 <head>
42 <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
433simandl <title>CZFGmap</title>
441simandl <META name="AUTHOR" content="Petr Simandl, www.simandl.cz">
45 <META name="LICENSE" content="GNU General Public License">
46 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
47 <link REL="SHORTCUT ICON" HREF="favicon.ico">
48 <style type="text/css">
49 @import url("http://www.google.com/uds/css/gsearch.css");
50 @import url("http://www.google.com/uds/solutions/localsearch/gmlocalsearch.css");
51 @import "czfgmap.css";
52 }
53 </style>
545simandl <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key='.$GMapKey.'"
551simandl type="text/javascript"></script>
56 <script src="http://www.google.com/uds/api?file=uds.js&amp;v=1.0" type="text/javascript"></script>
579simandl <script src="http://www.google.com/uds/solutions/localsearch/gmlocalsearch.js" type="text/javascript"></script>
581simandl <script type="text/javascript">
59 
609simandl //<![CDATA[
61 
621simandl //### Globalni promenne #################################
63 var CurrentDatabase = "czfmutf";
64 var NodeLimit = "200";
65 var NodeOrder = "ASC";
66 var NodeSortBy = "name";
67 var Where = "";
68 var LoadedNodes = new Array();
699simandl var LoadedLinks = new Array();
701simandl var map;
718simandl var NodeIcon = new Array();
72 var DatabaseNodeTables = new Array();
731simandl var AutoFetchMode = true;
74 var AutoClearMode = true;
75 var NumLoadedNodes = 0;
76 var NumAddedNodes = 0;
77 var NumLoadedLinks = 0;
78 var NumAddedLinks = 0;
79 var NumVisibleLinks = 0;
80 var NumInVisibleLinks = 0;
818simandl var PtA = new Array();
82 var PtB = new Array();
83 var PtC = new Array();
84 var PtPt = 1;
85 var PtNum = 0;
869simandl 
87 var MapSizeX = 800;
88 var MapSizeY = 600;
89 var MapCenterLat = 50.123567;
90 var MapCenterLon = 14.496258;
91 var MapZoom = 15;
92 var MapName = "Mapa";
93 var saved=[];
943simandl 
958simandl var LinkColType = new Array();
964simandl LinkColType["00000001"] = "#00aa00";
973simandl LinkColType["00000001"] = "#00FF00";
98 var LinkColTypeWifiBackbone = "#fafa00";
99 LinkColType["00000002"] = "#be0000";
100 LinkColType["00000006"] = "#ff5050";
101 LinkColType["00000003"] = "#64c8ff";
102 LinkColType["00000004"] = "#dc00dc";
103 LinkColType["00000007"] = "#c8c8c8";
104 LinkColType["00000008"] = "#ffffff";
105 LinkColType["00000009"] = "#fa8000";
106 LinkColType["00000099"] = "#0000fa";
107 var LinkColTypeNA = "#78783c";
108 LinkColType["00000005"] = "#00fafa";
1091simandl 
110 //nacteni ikon pro nody
111 var NodeType = [0,1,9,10,98,99];
112 var NodeState = [1,9,10,40,79,80,90];
113 for (type in NodeType) {
114 for (state in NodeState) {
115 i = 10000 + NodeType[type]*100 + NodeState[state];
116 NodeIcon[i] = new GIcon();
1175simandl NodeIcon[i].image = "./images/node/node-" + NodeType[type] + "-" + NodeState[state] + ".png";
1181simandl NodeIcon[i].iconSize = new GSize(15,15);
119 NodeIcon[i].iconAnchor = new GPoint(7,7);
120 NodeIcon[i].shadowSize = new GSize(22,20);
121 NodeIcon[i].infoWindowAnchor = new GPoint(5,1);
122 }
123 }
124 
125 //### Uvodni funkce #################################
126 function load() {
1279simandl MapLoad();
128 LoadSettings();
129 }
130 
131 function MapLoad() {
1321simandl if (GBrowserIsCompatible()) {
1335simandl map = new GMap2(document.getElementById("map"),{draggableCursor: \'crosshair\', draggingCursor: \'pointer\'});
1349simandl 
1351simandl map.addControl(new GLargeMapControl());
136 map.addControl(new GMapTypeControl());
1379simandl var MapCenter = new GLatLng(MapCenterLat, MapCenterLon);
138 map.setCenter(MapCenter, MapZoom);
1391simandl map.enableScrollWheelZoom();
140 map.addControl(new GScaleControl());
1419simandl map.addControl(new MDControl());
142 
143 // Selecting map type
144 var MapTypes = map.getMapTypes();
145 for(var i = 0; i < MapTypes.length; i++) {
146 if (MapName == MapTypes[i].getName()) map.setMapType(MapTypes[i]);
147 }
148 
149 map.addControl(new GOverviewMapControl());
1501simandl 
151 map.addControl(new google.maps.LocalSearch(), new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10,20)));
152 //tohle zajisti znovunacteni nodu po presunu
153 GEvent.addListener(map, "moveend", HandleMapMoveEnd);
154 
1552simandl //ziskani souradnic po kliknuti
1568simandl GEvent.addListener(map, \'click\', function(overlay, point) { if(point) { HandleNextPoint(point) }} );
1572simandl 
1581simandl //tohle zajisti vypis pri startu
159 var center = map.getCenter();
1609simandl document.getElementById("SouradniceStredu").innerHTML = CurrentDatabase + "<br>Souradnice stredu:" + center.toString() + "<br>Rozsah: " + map.getBounds()+"<br>Zvetseni: " + map.getZoom();
1611simandl 
162 //tohle zajisti prubezny vypis
163 GEvent.addListener(map, "moveend", function() {
164 var center = map.getCenter();
1659simandl document.getElementById("SouradniceStredu").innerHTML = CurrentDatabase + " " + map.getBounds().getSouthWest().lat() + "<br>Souradnice stredu: " + center.toString() + "<br>Rozsah: " + map.getBounds()+"<br>Zvetseni: " + map.getZoom();
1661simandl });
167 }
168 }
169 
170 //### Ostatni funkce ###########################
171 
172 function NodeLayer() {
173 //body se berou z databaze pomoci php skriptu ktery dela jen inteface a generuje xml
174 Where = "";
175 GDownloadUrl("mapa_genxml.php?db="+CurrentDatabase
176 +"&latmin="+map.getBounds().getSouthWest().lat()
177 +"&latmax="+map.getBounds().getNorthEast().lat()
178 +"&lonmin="+map.getBounds().getSouthWest().lng()
179 +"&lonmax="+map.getBounds().getNorthEast().lng()
180 +"&sortby="+NodeSortBy
181 +"&limit="+NodeLimit
182 +"&order="+NodeOrder
183 +"&where="+Where
184 +"&zoom="+map.getZoom()
185 , function(data) {
186 var xml = GXml.parse(data);
187 var nodes = xml.documentElement.getElementsByTagName("node");
188 for (var i = 0; i < nodes.length; i++) {
189 var id = nodes[i].getAttribute("id");
190 //zobrazime jen nove nody
191 if (! LoadedNodes[id]) {
192 var name = nodes[i].getAttribute("name");
193 var address = nodes[i].getAttribute("address");
194 var type = 10000 + nodes[i].getAttribute("type")*100 + nodes[i].getAttribute("status")*1;
195 var point = new GLatLng(parseFloat(nodes[i].getAttribute("lat")),
196 parseFloat(nodes[i].getAttribute("lng")));
197 var marker = CreateMarker(point, name, address, type, id);
198 map.addOverlay(marker);
199 LoadedNodes[id]=point;
200 NumAddedNodes = NumAddedNodes + 1;
201 }
202 }
203 document.getElementById("NumNodes").innerHTML = "Nacteno " + NumAddedNodes + " nodu";
204 
205 var links = xml.documentElement.getElementsByTagName("link");
206 for (var i = 0; i < links.length; i++) {
207 var id1 = links[i].getAttribute("id1");
208 var id2 = links[i].getAttribute("id2");
209 //nacteme jen pokud jde o novy link
210 if (! LoadedLinks[id1+"x"+id2] && ! LoadedLinks[id2+"x"+id1]) {
211 var backbone = links[i].getAttribute("backbone");
212 var inplanning = links[i].getAttribute("inplanning");
213 var type = links[i].getAttribute("type");
214 var status = links[i].getAttribute("status");
215 
216 //zobrazi se jen pokud jsou k dispozici oba nody
217 if ( LoadedNodes[id1] && LoadedNodes[id2]) {
2183simandl var LinkSize = (backbone * 2);
2194simandl var LinkColBg = "#000000";
2206simandl var LinkColBgOpacity = 1;
221 var LinkColOpacity = 1;
2224simandl var LinkStyle = "solid";
223 
224 if (inplanning == 1) {
225 LinkColBgOpacity = 0.1;
2265simandl LinkColOpacity = 0.2;
2274simandl LinkColBg = "#0000FF";
228 LinkStyle = "dash";
229 }
230// DebugPrint(":"+ inplanning + ":");
231 
2321simandl var polyOptions = {geodesic:false};
2335simandl var polyline = new GPolyline([LoadedNodes[id1],LoadedNodes[id2]], LinkColBg, 3 + LinkSize, LinkColBgOpacity, polyOptions);
234 map.addOverlay(polyline);
2354simandl 
2363simandl var LinkColTypeAct = LinkColTypeNA;
237 if ( LinkColType[type]) {
238 LinkColTypeAct = LinkColType[type];
239 }
2402simandl 
2415simandl LoadedLinks[id1+"x"+id2] = new GPolyline([LoadedNodes[id1],LoadedNodes[id2]], LinkColTypeAct, 1 + LinkSize, LinkColOpacity, polyOptions);
2424simandl map.addOverlay(LoadedLinks[id1+"x"+id2]);
243 
2441simandl NumVisibleLinks = NumVisibleLinks + 1;
245 } else {
246 //zde se pokusime donahrat nod ktery nam chybi
247 
248 
249 NumInVisibleLinks = NumInVisibleLinks + 1;
250 }
251 
2524simandl// LoadedLinks[id1+"x"+id2]=polyline;
253 
2541simandl NumAddedLinks = NumAddedLinks + 1;
255 }
256 }
257 document.getElementById("NumLinks").innerHTML = "Nacteno " + NumAddedLinks + " linku a zobrazeno " + NumVisibleLinks + " linku a " + NumInVisibleLinks + " nezobrazeno.";
258 });
259 }
260 
261 //##############################
2628simandl function HandleNextPoint(point) {
263 
264 document.getElementById("NodeCoordinates").innerHTML = (point.y.toFixed(6)+\'x\'+point.x.toFixed(6));
265 
266 if ( PtPt == 1 ) {
267 document.getElementById("NodeCoordinatesA").innerHTML = (\'A \'+point.y.toFixed(6)+\'x\'+point.x.toFixed(6));
268 PtA = point;
269 }
270 if ( PtPt == 2 ) {
271 document.getElementById("NodeCoordinatesB").innerHTML = (\'B \'+point.y.toFixed(6)+\'x\'+point.x.toFixed(6));
272 PtB = point;
273 }
274 if ( PtPt == 3 ) {
275 document.getElementById("NodeCoordinatesC").innerHTML = (\'C \'+point.y.toFixed(6)+\'x\'+point.x.toFixed(6));
276 PtC = point;
277 }
278 
279 
280 PtPt = PtPt + 1;
281 if ( PtPt > 3 ) { PtPt = 1; }
282 PtNum = PtNum + 1;
283 
284 if ( PtNum > 1 ) {
2859simandl var DistanceAB = Math.round(GetLineLength(PtA, PtB));
286 document.getElementById("NodeDistanceAB").innerHTML = DistanceAB+\'m\';
287 document.getElementById("NodeDistanceBA").innerHTML = DistanceAB+\'m\';
2888simandl }
289 if ( PtNum > 2 ) {
2909simandl var DistanceBC = Math.round(GetLineLength(PtC, PtB));
291 document.getElementById("NodeDistanceBC").innerHTML = DistanceBC+\'m\';
292 document.getElementById("NodeDistanceCB").innerHTML = DistanceBC+\'m\';
293 var DistanceAC = Math.round(GetLineLength(PtC, PtA));
294 document.getElementById("NodeDistanceAC").innerHTML = DistanceAC+\'m\';
295 document.getElementById("NodeDistanceCA").innerHTML = DistanceAC+\'m\';
2968simandl 
2979simandl document.getElementById("NodeAngleACB").innerHTML = Math.round(GetAngle(PtA, PtC, PtB))+\'st\';
298 document.getElementById("NodeAngleBAC").innerHTML = Math.round(GetAngle(PtB, PtC, PtA))+\'st\';
299 document.getElementById("NodeAngleCBA").innerHTML = Math.round(GetAngle(PtC, PtA, PtB))+\'st\';
300 
301 document.getElementById("NodeDistanceBAC").innerHTML = ( DistanceAB + DistanceAC ) +\'m\';
302 document.getElementById("NodeDistanceABC").innerHTML = ( DistanceAB + DistanceBC ) +\'m\';
303 document.getElementById("NodeDistanceBCA").innerHTML = ( DistanceBC + DistanceAC ) +\'m\';
3048simandl }
3059simandl }
3068simandl 
3079simandl //##############################
308 function GetAngle(PA, PB, PC) {
309 var a = GetLineLength(PC, PB);
310 var b = GetLineLength(PC, PA);
311 var c = GetLineLength(PA, PB);
312 var s = ( a + b + c ) / 2;
313 var alfa = (360/Math.PI)*Math.asin(Math.sqrt((s-b)*(s-c)/(b*c)));
314 return alfa;
3158simandl }
316 
317 //##############################
3189simandl function GetLineLength(PA, PB) {
319 var Lat1 = PA.lat();
320 var Lon1 = PA.lng();
321 var Lat2 = PB.lat();
322 var Lon2 = PB.lng();
3234simandl var R = 6371; // km
324 var dLat = (Lat2-Lat1) * Math.PI / 180;
325 var dLon = (Lon2-Lon1) * Math.PI / 180;
326 var a = Math.sin(dLat/2) * Math.sin(dLat/2) +
327 Math.cos(Lat1 * Math.PI / 180) * Math.cos(Lat2 * Math.PI / 180) *
328 Math.sin(dLon/2) * Math.sin(dLon/2);
329 var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
330 var LineLength = 1000 * R * c;
331 return LineLength;
332 }
333 
334 //##############################
3351simandl function HandleMapMoveEnd() {
336 if (AutoFetchMode) {
337 ClearOverlayAndData();
338 FetchOverlayAndData();
339 }
340 document.getElementById("status").innerHTML = "Po presunu mame celkem " + NumAddedNodes + " nodu";
341 }
342 
343 //##############################
344 function CreateMarker(point, name, address, type, id) {
345 var marker = new GMarker(point, {draggable: true, bounce: true, icon: NodeIcon[type]});
346 var html = "<b>" + id + " " + name + "</b> <br/>" + address +" <br/>" + type;
347 GEvent.addListener(marker, "dragstart", function() {
348 map.closeInfoWindow();
349 });
3505simandl GEvent.addListener(marker, \'click\', function() {
3511simandl marker.openInfoWindowHtml(html);
352 });
353 return marker;
354 }
355 
356 //##############################
357 function SwitchDatabase(NewDatabase) {
358 CurrentDatabase = NewDatabase;
3599simandl document.getElementById("SouradniceStredu").innerHTML = CurrentDatabase;
3601simandl ClearOverlayAndData();
361 FetchOverlayAndData();
362 document.getElementById("status").innerHTML = "Databaze zmenena na "+CurrentDatabase;
363 document.getElementById("databaze").innerHTML = CurrentDatabase;
364 }
365 
366 //##############################
367 function ChangeNodeLimit(NewNodeLimit) {
368 NodeLimit = NewNodeLimit;
369 FetchOverlayAndData();
370 document.getElementById("status").innerHTML = "Limit zmenen na "+NewNodeLimit;
3719simandl document.getElementById("NodeLimitSelectBox").value = NodeLimit;
3721simandl }
373 
374 //##############################
3759simandl function ChangeMapSizeX(NewMapSizeX) {
376 MapSizeX = NewMapSizeX;
377 FetchOverlayAndData();
378 document.getElementById("status").innerHTML = "Rozmer X zmenen na "+MapSizeX;
379 document.getElementById("map").style.width = MapSizeX+"px";
38010simandl 
381 MapName = map.getCurrentMapType().getName();
3829simandl ClearOverlayAndData();
383 MapLoad();
384 FetchOverlayAndData();
385 }
386 
387 //##############################
388 function ChangeMapSizeY(NewMapSizeY) {
389 MapSizeY = NewMapSizeY;
390 FetchOverlayAndData();
391 document.getElementById("status").innerHTML = "Rozmer Y zmenen na "+MapSizeY;
392 document.getElementById("map").style.height = MapSizeY+"px";
393 
39410simandl MapName = map.getCurrentMapType().getName();
3959simandl ClearOverlayAndData();
396 MapLoad();
397 FetchOverlayAndData();
398 }
399 
400 //##############################
4014simandl function DebugPrint(Text) {
402 document.getElementById("debug").innerHTML = document.getElementById("debug").innerHTML + Text;
403 }
404 
405 //##############################
4061simandl function Fetch() {
407 NodeLayer();
408 document.getElementById("status").innerHTML = "Nacteno";
409 }
410 
411 //##############################
412 function FetchOverlayAndData() {
413 if (AutoFetchMode) {
414 Fetch();
415 };
416 }
417 
418 //##############################
419 function ClearOverlayAndData() {
420 if (AutoClearMode) {
4219simandl ForceClear();
4221simandl };
423 }
424 
425 //##############################
4269simandl function ForceClear() {
4271simandl document.getElementById("status").innerHTML = "Smazano " + NumAddedNodes + " nodu";
428 map.clearOverlays();
429 LoadedNodes=Array();
430 LoadedLinks=Array();
431 NumAddedNodes=0;
432 document.getElementById("NumNodes").innerHTML = "Nacteno " + NumAddedNodes + " nodu";
433 NumAddedLinks=0;
434 NumVisibleLinks=0;
4355simandl NumInVisibleLinks=0;
4361simandl document.getElementById("NumLinks").innerHTML = "Nacteno " + NumAddedLinks + " linku";
437 }
438 
439 //##############################
440 function ToggleAutoFetchMode(NewAutoFetchMode) {
441 AutoFetchMode = NewAutoFetchMode;
442 if (AutoFetchMode) {
443 document.getElementById("status").innerHTML = "Automaticke nacitani zapnuto.";
444 }
445 else {
446 document.getElementById("status").innerHTML = "Automaticke nacitani vypnuto.";
447 }
4489simandl document.getElementById("AutoFetchModeCheckButton").checked = AutoFetchMode;
4491simandl }
450 
451 //##############################
452 function ToggleAutoClearMode(NewAutoClearMode) {
453 AutoClearMode = NewAutoClearMode;
454 if (AutoClearMode) {
455 document.getElementById("status").innerHTML = "Automaticke mazani zapnuto.";
456 }
457 else {
458 document.getElementById("status").innerHTML = "Automaticke mazani vypnuto.";
4599simandl }
460 document.getElementById("AutoClearModeCheckButton").checked = AutoClearMode;
4611simandl }
462 
4639simandl //##############################
464 function SetCookie(Name, Data, Validity) {
465 var Day = 24 * 3600 * 1000;
466 var Expiration = new Date();
467 Expiration.setTime(Expiration.getTime() + Validity * Day);
468 document.cookie = Name + "=" + escape(Data) + "; expires=" + Expiration.toGMTString() + "; path=/";
469 }
470 
471 //##############################
472 function GetCookie(Name) {
473 var Prefix = Name + "=";
474 var Begin = document.cookie.indexOf(Prefix);
475 if ( Begin == -1 )
476 return "";
477 Begin += Prefix.length;
478 if ( Begin >= document.cookie.length )
479 return "";
480 var End = document.cookie.indexOf(";", Begin);
481 if ( End == -1 )
482 End = document.cookie.length;
483 return unescape(document.cookie.substring(Begin, End));
484 }
485 
486 //##############################
487 function SaveSettingsCookieText() {
488 var Text = "db=" + CurrentDatabase
489 + "&map=" + map.getCurrentMapType().getName()
490 + "&sizex=" + MapSizeX
491 + "&sizey=" + MapSizeY
492 + "&lat=" + map.getCenter().lat()
493 + "&lon=" + map.getCenter().lng()
494 + "&zoom=" + map.getZoom()
495 + "&autofetch=" + AutoFetchMode
496 + "&autoclear=" + AutoClearMode
497 + "&nodelimit=" + NodeLimit
498 + "&";
499 return Text;
500 }
501 
502 //##############################
503 function LoadSettings() {
504 var Text = GetCookie("default");
505 var Begin = 0;
506 var End = 0;
507 
508 End = Text.indexOf("&",Begin);
509 while (End > -1) {
510 var Parameter = Text.substring(Begin,End);
511 var EqualPosition = Parameter.indexOf("=");
512 if ((EqualPosition > -1) && (EqualPosition < Parameter.length)) {
513 var ParameterName = Parameter.substring(0,EqualPosition);
514 var ParameterValue = Parameter.substring(EqualPosition+1,Parameter.length);
515 if (ParameterName == "db") CurrentDatabase = ParameterValue;
516 if (ParameterName == "map") MapName = ParameterValue;
517 if (ParameterName == "sizex") MapSizeX = 1*ParameterValue;
518 if (ParameterName == "sizey") MapSizeY = 1*ParameterValue;
519 if (ParameterName == "lat") MapCenterLat = 1*ParameterValue;
520 if (ParameterName == "lon") MapCenterLon = 1*ParameterValue;
521 if (ParameterName == "zoom") MapZoom = 1*ParameterValue;
522 if ((ParameterName == "autofetch") && ParameterValue == "true" ) ToggleAutoFetchMode(true);
523 if ((ParameterName == "autofetch") && ParameterValue == "false" ) ToggleAutoFetchMode(false);
524 if ((ParameterName == "autoclear") && ParameterValue == "true" ) ToggleAutoClearMode(true);
525 if ((ParameterName == "autoclear") && ParameterValue == "false" ) ToggleAutoClearMode(false);
526 if (ParameterName == "nodelimit") ChangeNodeLimit(ParameterValue);
527 }
528 Begin = End + 1;
529 End = Text.indexOf("&",Begin);
530 }
531 
532 document.getElementById("AutoFetchModeCheckButton").checked = AutoFetchMode;
533 document.getElementById("AutoClearModeCheckButton").checked = AutoClearMode;
534 document.getElementById("NodeLimitSelectBox").value = NodeLimit;
535 document.getElementById("databaze").innerHTML = CurrentDatabase;
536 
537 document.getElementById("MapSizeXSelectBox").value = MapSizeX;
538 document.getElementById("MapSizeYSelectBox").value = MapSizeY;
539 document.getElementById("map").style.width = MapSizeX+"px";
540 document.getElementById("map").style.height = MapSizeY+"px";
541 ForceClear();
542 MapLoad();
543 FetchOverlayAndData();
544 }
545 
546 //##############################
547function MDControl() { }
548 MDControl.prototype = new GControl();
549 MDControl.prototype.initialize = function(map) {
550 var container = document.createElement("div");
551 var savepos= document.createElement("div");
55210simandl savepos.title= "Ulozit aktualni pozici a zoom";
5539simandl savepos.className= "MDbuttons";
554 container.appendChild(savepos);
55510simandl savepos.appendChild(document.createTextNode("Ulozit pozici"));
5569simandl GEvent.addDomListener(savepos, "click", function() {
557 var center = map.getCenter(); var zoom = map.getZoom();
558 saved.splice(0,2,center,zoom);
559// alert("Saved Position: "+center.toUrlValue()+"\nZoomlevel: "+zoom);
560 });
561 
562 var tosaved=document.createElement("div");
56310simandl tosaved.title= "Navrat zpet na ulozenou pozici";
5649simandl tosaved.className= "MDbuttons";
565 container.appendChild(tosaved);
56610simandl tosaved.appendChild(document.createTextNode("Na ulozenou"));
5679simandl GEvent.addDomListener(tosaved, "click", function() {
568 if(saved.length > 0) { map.setZoom(saved[1]); map.panTo(saved[0]); }
569 });
570 map.getContainer().appendChild(container);
571 return container;
572}
573 
574MDControl.prototype.getDefaultPosition = function() {
575 return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7,31));
576}
577 
57810simandl //##############################
579 function ShowMeasuredDistanceAndAngle() {
580 var LineSize = 1;
581 var LineColAB = "#FF0000";
582 var LineColAC = "#FF0000";
583 var LineColBC = "#00FF00";
584 var LineColOpacity = 0.5;
5859simandl 
58610simandl var polyOptions = {geodesic:false};
587 if ( PtNum > 1 ) {
588 var pointA = new GLatLng(parseFloat(PtA.lat()),parseFloat(PtA.lng()));
589 var pointB = new GLatLng(parseFloat(PtB.lat()),parseFloat(PtB.lng()));
590 polylineAB = new GPolyline([pointA,pointB], LineColAB, 3 + LineSize, LineColOpacity, polyOptions);
591 map.addOverlay(polylineAB);
592 }
593 if ( PtNum > 2 ) {
594 var pointC = new GLatLng(parseFloat(PtC.lat()),parseFloat(PtC.lng()));
595 polylineAC = new GPolyline([pointA,pointC], LineColAC, 3 + LineSize, LineColOpacity, polyOptions);
596 map.addOverlay(polylineAC);
597 polylineBC = new GPolyline([pointB,pointC], LineColBC, 3 + LineSize, LineColOpacity, polyOptions);
598 map.addOverlay(polylineBC);
599 }
600}
601 
602 //##############################
603 function HideMeasuredDistanceAndAngle() {
604 if ( PtNum > 1 ) {
605 map.removeOverlay(polylineAB);
606 }
607 if ( PtNum > 2 ) {
608 map.removeOverlay(polylineAB);
609 map.removeOverlay(polylineAC);
610 map.removeOverlay(polylineBC);
611 }
612}
613 
614 //##############################
615 function MakePrintable() {
616 
617 // To make polygons printable...
618 $$("div.gmnoprint").each( function (div, index) {
619 div.removeClassName(\'gmnoprint\');
620 });
621 
622}
623 
6249simandl //]]>
625 </script>
6261simandl </head>
627 
628 <body onload="load()" onunload="GUnload()">
629 <table>
630 <tr>
631 <td>
6329simandl <div id="map" class="gmaparea"></div>
6331simandl </td>
634 
6359simandl <td valign="top" class="controlarea">
63611simandl <div id="UserInfo">
637 ';
63812simandl if ($bbuserinfo['username'] == "Unregistered") {
63913simandl echo "Nejste <a href=\"http://connected.prosek.czf/forum/usercp.php\">prihlasen(a)</a> a nezobrazi se vam obsah databaze czfmutf, ale jen gendb.";
64012simandl } else {
641 echo "<a href=\"http://connected.prosek.czf/forum/usercp.php\">Prihlasen(a)</a> jako:";
642 echo $bbuserinfo['username']."&nbsp;";
643 echo $bbuserinfo['userid']."&nbsp;";
644 echo $bbuserinfo['mapperms']."&nbsp;";
645 }
6465simandl echo '</div>
64710simandl <hr>
648 Databaze:
649 <br>
6505simandl <input type="button" value="czfmutf" onClick="SwitchDatabase(\'czfmutf\');"/>
651 <input type="button" value="gendb" onClick="SwitchDatabase(\'gendb\');"/>
65210simandl <div id="databaze">0</div>
653 <hr>
654 Nody a linky:
6551simandl <br>
65610simandl <input type="button" value="Zobrazit" onClick="Fetch();"/>
657 <input type="button" value="Smazat" onClick="ForceClear();"/>
6581simandl <div id="NumNodes">0</div>
659 <div id="NumLinks">0</div>
660 Automaticke nacitani:
661 <input id="AutoFetchModeCheckButton" type="checkBox" onclick="ToggleAutoFetchMode(this.checked)">
662 <br>
663 Automaticke mazani:
664 <input id="AutoClearModeCheckButton" type="checkBox" onclick="ToggleAutoClearMode(this.checked)">
665 <br>
66610simandl Limit poctu nodu:
6671simandl <select id="NodeLimitSelectBox" onchange="ChangeNodeLimit(this.value)">
668 <option value="0">0</option>
669 <option value="30" selected="selected">30</option>
670 <option value="60">60</option>
671 <option value="200">200</option>
672 <option value="500">500</option>
673 <option value="1000">1000</option>
674 </select>
67510simandl <hr>
676 Nastaveni mapy:
6779simandl <div>
678 <select id="MapSizeXSelectBox" onchange="ChangeMapSizeX(this.value)">
679 <option value="800" selected="selected">800</option>
680 <option value="900">900</option>
681 <option value="1000">1000</option>
682 <option value="1100">1100</option>
683 <option value="1200">1200</option>
684 <option value="1300">1300</option>
685 <option value="1400">1400</option>
686 </select>
687 X
688 <select id="MapSizeYSelectBox" onchange="ChangeMapSizeY(this.value)">
689 <option value="600" selected="selected">600</option>
690 <option value="700">700</option>
691 <option value="800">800</option>
692 <option value="900">900</option>
693 <option value="1000">1000</option>
694 </select>
695 </div>
69610simandl <input type="button" value=\'Ulozit\' onclick=\'SetCookie("default", SaveSettingsCookieText() , 365);\'>
697 <input type="button" value=\'Nahrat\' onclick=\'LoadSettings();\'>
698 <hr>
699 Mereni:
700 <br>
701 <input type="button" value=\'Zobrazit\' onclick=\'ShowMeasuredDistanceAndAngle();\'>
702 <input type="button" value=\'Schovat\' onclick=\'HideMeasuredDistanceAndAngle();\'>
703 <hr>
704 Print:
705 <br>
706 <input type="button" value=\'Print\' onclick=\'MakePrintable();\'>
7071simandl </td>
708 </tr>
709 
710 <tr>
7119simandl <td class="statusarea" >
7121simandl 
7134simandl <div id="debug"></div>
7141simandl <div id="status">Hotovo!</div>
715 <div id="data"></div>
7162simandl <div id="NodeCoordinates">aaa</div>
7179simandl <div id="SouradniceStredu">Souradnice stredu:<br>Rozsah:<br>Zvetseni:</div>
718 <td>
719 <table border="1">
720 <tr>
721 <td>Mereni vzdalenosti a uhlu</td><td>A</td><td>B</td><td>C</td>
722 </tr>
723 <tr>
724 <td><div id="NodeCoordinatesA">A klikni na mapu</div></td><td><div id="NodeAngleACB">ACB</div></td>
725 <td><div id="NodeDistanceAB">AB</div></td><td><div id="NodeDistanceAC">AC</div></td>
726 </tr>
727 <tr>
728 <td><div id="NodeCoordinatesB">B klikni podruhe</div></td><td><div id="NodeDistanceBA">BA</div></td>
729 <td><div id="NodeAngleBAC">BAC</div></td><td><div id="NodeDistanceBC">BC</div></td>
730 </tr>
731 <tr>
732 <td><div id="NodeCoordinatesC">C klikni potreti</div></td><td><div id="NodeDistanceCA">CA</div></td>
733 <td><div id="NodeDistanceCB">CB</div></td><td><div id="NodeAngleCBA">BAC</div></td>
734 </tr>
735 <tr>
73610simandl <td>
737 </td><td><div id="NodeDistanceBAC">B-A-C</div></td>
7389simandl <td><div id="NodeDistanceABC">A-B-C</div></td><td><div id="NodeDistanceBCA">B-C-A</div></td>
739 </tr>
740 </table>
7411simandl </td>
7429simandl 
743 </td>
7441simandl </tr>
745 
746 <tr>
747 <td colspan=2>
748 CZFGmap (c) Petr Simandl - GNU General Public License
749 <a href="http://websvn.prosek.czf/">websvn.prosek.czf</a>
750 </td>
751 </tr>
752 
753 </table>
75410simandl <a href="http://code.google.com/apis/maps/documentation/examples/">http://code.google.com/apis/maps/documentation/examples/</a>
755 <a href="http://code.google.com/apis/kml/documentation/kml_tut.html">http://code.google.com/apis/kml/documentation/kml_tut.html</a>
756 <br>
757 <a href="http://mapki.com/wiki/Knowledge_Base">http://mapki.com/wiki/Knowledge_Base</a>
758 <a href="http://www.bdcc.co.uk/Gmaps/BdccGmapBits.htm">http://www.bdcc.co.uk/Gmaps/BdccGmapBits.htm</a>
759 <br>
760 <a href="http://econym.googlepages.com/custommap.htm">http://econym.googlepages.com/custommap.htm</a>
761 <br>
762 http://www.czfree.net/forum/showthread.php?postid=197732#post197732
7631simandl </body>
764</html>
7655simandl';
766?>

Powered by WebSVN 2.2.1