jablonka.czprosek.czf

czfgmap

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

 

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']) {
2316simandl case "mapa.jablonka.cz":
24 $GMapKey="ABQIAAAAvGTA14kOdSvtr3t8EjKUdxRhT8UzNgvAgXoUO-qU5L_X_kn6BxRNDeblBDjZ6R9FT2D3RBzuJgriOQ";
25 break;
265simandl case "connected.czf":
27 $GMapKey="ABQIAAAAvGTA14kOdSvtr3t8EjKUdxQ2n1pNbYRLwYPuGT94C-0un95jGhSkgS0a3LnGa2MzRepHicK08lDDmg";
28 break;
2910simandl case "connected.prosek.czf":
30 $GMapKey="ABQIAAAAvGTA14kOdSvtr3t8EjKUdxQmdP92EXlqBtrjj_gSpBHpGjsXLRR7QrpeKaV71OgH6Q-vhhFyEpUxOA";
31 break;
325simandl case "mapa.prosek.czf":
33 $GMapKey="ABQIAAAAlZ9uhPay2OYt2xmaN84g0BTYUdkyQZ68wktXWB9o4y2agzv8zxRyBxtFdIbLe18hmqHTwiWPXl7VxA";
34 break;
35 default:
36 $GMapKey="ABQIAAAAlZ9uhPay2OYt2xmaN84g0BTYUdkyQZ68wktXWB9o4y2agzv8zxRyBxtFdIbLe18hmqHTwiWPXl7VxA";
37}
38 
39echo '
401simandl<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
41 
42 
43<html xmlns="http://www.w3.org/1999/xhtml">
44 <head>
45 <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
463simandl <title>CZFGmap</title>
471simandl <META name="AUTHOR" content="Petr Simandl, www.simandl.cz">
48 <META name="LICENSE" content="GNU General Public License">
49 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
50 <link REL="SHORTCUT ICON" HREF="favicon.ico">
51 <style type="text/css">
52 @import url("http://www.google.com/uds/css/gsearch.css");
53 @import url("http://www.google.com/uds/solutions/localsearch/gmlocalsearch.css");
54 @import "czfgmap.css";
55 }
56 </style>
575simandl <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key='.$GMapKey.'"
581simandl type="text/javascript"></script>
59 <script src="http://www.google.com/uds/api?file=uds.js&amp;v=1.0" type="text/javascript"></script>
609simandl <script src="http://www.google.com/uds/solutions/localsearch/gmlocalsearch.js" type="text/javascript"></script>
611simandl <script type="text/javascript">
62 
639simandl //<![CDATA[
64 
651simandl //### Globalni promenne #################################
66 var CurrentDatabase = "czfmutf";
67 var NodeLimit = "200";
68 var NodeOrder = "ASC";
69 var NodeSortBy = "name";
70 var Where = "";
71 var LoadedNodes = new Array();
729simandl var LoadedLinks = new Array();
731simandl var map;
748simandl var NodeIcon = new Array();
75 var DatabaseNodeTables = new Array();
761simandl var AutoFetchMode = true;
77 var AutoClearMode = true;
78 var NumLoadedNodes = 0;
79 var NumAddedNodes = 0;
80 var NumLoadedLinks = 0;
81 var NumAddedLinks = 0;
82 var NumVisibleLinks = 0;
83 var NumInVisibleLinks = 0;
848simandl var PtA = new Array();
85 var PtB = new Array();
86 var PtC = new Array();
87 var PtPt = 1;
88 var PtNum = 0;
899simandl 
90 var MapSizeX = 800;
91 var MapSizeY = 600;
92 var MapCenterLat = 50.123567;
93 var MapCenterLon = 14.496258;
94 var MapZoom = 15;
95 var MapName = "Mapa";
96 var saved=[];
973simandl 
988simandl var LinkColType = new Array();
994simandl LinkColType["00000001"] = "#00aa00";
1003simandl LinkColType["00000001"] = "#00FF00";
101 var LinkColTypeWifiBackbone = "#fafa00";
102 LinkColType["00000002"] = "#be0000";
103 LinkColType["00000006"] = "#ff5050";
104 LinkColType["00000003"] = "#64c8ff";
105 LinkColType["00000004"] = "#dc00dc";
106 LinkColType["00000007"] = "#c8c8c8";
107 LinkColType["00000008"] = "#ffffff";
108 LinkColType["00000009"] = "#fa8000";
109 LinkColType["00000099"] = "#0000fa";
110 var LinkColTypeNA = "#78783c";
111 LinkColType["00000005"] = "#00fafa";
1121simandl 
113 //nacteni ikon pro nody
114 var NodeType = [0,1,9,10,98,99];
115 var NodeState = [1,9,10,40,79,80,90];
116 for (type in NodeType) {
117 for (state in NodeState) {
118 i = 10000 + NodeType[type]*100 + NodeState[state];
119 NodeIcon[i] = new GIcon();
1205simandl NodeIcon[i].image = "./images/node/node-" + NodeType[type] + "-" + NodeState[state] + ".png";
1211simandl NodeIcon[i].iconSize = new GSize(15,15);
122 NodeIcon[i].iconAnchor = new GPoint(7,7);
123 NodeIcon[i].shadowSize = new GSize(22,20);
124 NodeIcon[i].infoWindowAnchor = new GPoint(5,1);
125 }
126 }
127 
128 //### Uvodni funkce #################################
129 function load() {
1309simandl MapLoad();
131 LoadSettings();
132 }
133 
134 function MapLoad() {
1351simandl if (GBrowserIsCompatible()) {
1365simandl map = new GMap2(document.getElementById("map"),{draggableCursor: \'crosshair\', draggingCursor: \'pointer\'});
1379simandl 
1381simandl map.addControl(new GLargeMapControl());
139 map.addControl(new GMapTypeControl());
1409simandl var MapCenter = new GLatLng(MapCenterLat, MapCenterLon);
141 map.setCenter(MapCenter, MapZoom);
1421simandl map.enableScrollWheelZoom();
143 map.addControl(new GScaleControl());
1449simandl map.addControl(new MDControl());
145 
146 // Selecting map type
147 var MapTypes = map.getMapTypes();
148 for(var i = 0; i < MapTypes.length; i++) {
149 if (MapName == MapTypes[i].getName()) map.setMapType(MapTypes[i]);
150 }
151 
152 map.addControl(new GOverviewMapControl());
1531simandl 
154 map.addControl(new google.maps.LocalSearch(), new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10,20)));
155 //tohle zajisti znovunacteni nodu po presunu
156 GEvent.addListener(map, "moveend", HandleMapMoveEnd);
157 
1582simandl //ziskani souradnic po kliknuti
1598simandl GEvent.addListener(map, \'click\', function(overlay, point) { if(point) { HandleNextPoint(point) }} );
1602simandl 
1611simandl //tohle zajisti vypis pri startu
162 var center = map.getCenter();
1639simandl document.getElementById("SouradniceStredu").innerHTML = CurrentDatabase + "<br>Souradnice stredu:" + center.toString() + "<br>Rozsah: " + map.getBounds()+"<br>Zvetseni: " + map.getZoom();
1641simandl 
165 //tohle zajisti prubezny vypis
166 GEvent.addListener(map, "moveend", function() {
167 var center = map.getCenter();
1689simandl document.getElementById("SouradniceStredu").innerHTML = CurrentDatabase + " " + map.getBounds().getSouthWest().lat() + "<br>Souradnice stredu: " + center.toString() + "<br>Rozsah: " + map.getBounds()+"<br>Zvetseni: " + map.getZoom();
1691simandl });
170 }
171 }
172 
173 //### Ostatni funkce ###########################
174 
175 function NodeLayer() {
176 //body se berou z databaze pomoci php skriptu ktery dela jen inteface a generuje xml
177 Where = "";
178 GDownloadUrl("mapa_genxml.php?db="+CurrentDatabase
179 +"&latmin="+map.getBounds().getSouthWest().lat()
180 +"&latmax="+map.getBounds().getNorthEast().lat()
181 +"&lonmin="+map.getBounds().getSouthWest().lng()
182 +"&lonmax="+map.getBounds().getNorthEast().lng()
183 +"&sortby="+NodeSortBy
184 +"&limit="+NodeLimit
185 +"&order="+NodeOrder
186 +"&where="+Where
187 +"&zoom="+map.getZoom()
188 , function(data) {
189 var xml = GXml.parse(data);
190 var nodes = xml.documentElement.getElementsByTagName("node");
191 for (var i = 0; i < nodes.length; i++) {
192 var id = nodes[i].getAttribute("id");
193 //zobrazime jen nove nody
194 if (! LoadedNodes[id]) {
195 var name = nodes[i].getAttribute("name");
196 var address = nodes[i].getAttribute("address");
197 var type = 10000 + nodes[i].getAttribute("type")*100 + nodes[i].getAttribute("status")*1;
198 var point = new GLatLng(parseFloat(nodes[i].getAttribute("lat")),
199 parseFloat(nodes[i].getAttribute("lng")));
200 var marker = CreateMarker(point, name, address, type, id);
201 map.addOverlay(marker);
202 LoadedNodes[id]=point;
203 NumAddedNodes = NumAddedNodes + 1;
204 }
205 }
206 document.getElementById("NumNodes").innerHTML = "Nacteno " + NumAddedNodes + " nodu";
207 
208 var links = xml.documentElement.getElementsByTagName("link");
209 for (var i = 0; i < links.length; i++) {
210 var id1 = links[i].getAttribute("id1");
211 var id2 = links[i].getAttribute("id2");
212 //nacteme jen pokud jde o novy link
213 if (! LoadedLinks[id1+"x"+id2] && ! LoadedLinks[id2+"x"+id1]) {
214 var backbone = links[i].getAttribute("backbone");
215 var inplanning = links[i].getAttribute("inplanning");
216 var type = links[i].getAttribute("type");
217 var status = links[i].getAttribute("status");
218 
219 //zobrazi se jen pokud jsou k dispozici oba nody
220 if ( LoadedNodes[id1] && LoadedNodes[id2]) {
2213simandl var LinkSize = (backbone * 2);
2224simandl var LinkColBg = "#000000";
2236simandl var LinkColBgOpacity = 1;
224 var LinkColOpacity = 1;
2254simandl var LinkStyle = "solid";
226 
227 if (inplanning == 1) {
228 LinkColBgOpacity = 0.1;
2295simandl LinkColOpacity = 0.2;
2304simandl LinkColBg = "#0000FF";
231 LinkStyle = "dash";
232 }
233// DebugPrint(":"+ inplanning + ":");
234 
2351simandl var polyOptions = {geodesic:false};
2365simandl var polyline = new GPolyline([LoadedNodes[id1],LoadedNodes[id2]], LinkColBg, 3 + LinkSize, LinkColBgOpacity, polyOptions);
237 map.addOverlay(polyline);
2384simandl 
2393simandl var LinkColTypeAct = LinkColTypeNA;
240 if ( LinkColType[type]) {
241 LinkColTypeAct = LinkColType[type];
242 }
2432simandl 
2445simandl LoadedLinks[id1+"x"+id2] = new GPolyline([LoadedNodes[id1],LoadedNodes[id2]], LinkColTypeAct, 1 + LinkSize, LinkColOpacity, polyOptions);
2454simandl map.addOverlay(LoadedLinks[id1+"x"+id2]);
246 
2471simandl NumVisibleLinks = NumVisibleLinks + 1;
248 } else {
249 //zde se pokusime donahrat nod ktery nam chybi
250 
251 
252 NumInVisibleLinks = NumInVisibleLinks + 1;
253 }
254 
2554simandl// LoadedLinks[id1+"x"+id2]=polyline;
256 
2571simandl NumAddedLinks = NumAddedLinks + 1;
258 }
259 }
260 document.getElementById("NumLinks").innerHTML = "Nacteno " + NumAddedLinks + " linku a zobrazeno " + NumVisibleLinks + " linku a " + NumInVisibleLinks + " nezobrazeno.";
261 });
262 }
263 
264 //##############################
2658simandl function HandleNextPoint(point) {
266 
267 document.getElementById("NodeCoordinates").innerHTML = (point.y.toFixed(6)+\'x\'+point.x.toFixed(6));
268 
269 if ( PtPt == 1 ) {
270 document.getElementById("NodeCoordinatesA").innerHTML = (\'A \'+point.y.toFixed(6)+\'x\'+point.x.toFixed(6));
271 PtA = point;
272 }
273 if ( PtPt == 2 ) {
274 document.getElementById("NodeCoordinatesB").innerHTML = (\'B \'+point.y.toFixed(6)+\'x\'+point.x.toFixed(6));
275 PtB = point;
276 }
277 if ( PtPt == 3 ) {
278 document.getElementById("NodeCoordinatesC").innerHTML = (\'C \'+point.y.toFixed(6)+\'x\'+point.x.toFixed(6));
279 PtC = point;
280 }
281 
282 
283 PtPt = PtPt + 1;
284 if ( PtPt > 3 ) { PtPt = 1; }
285 PtNum = PtNum + 1;
286 
287 if ( PtNum > 1 ) {
2889simandl var DistanceAB = Math.round(GetLineLength(PtA, PtB));
289 document.getElementById("NodeDistanceAB").innerHTML = DistanceAB+\'m\';
290 document.getElementById("NodeDistanceBA").innerHTML = DistanceAB+\'m\';
2918simandl }
292 if ( PtNum > 2 ) {
2939simandl var DistanceBC = Math.round(GetLineLength(PtC, PtB));
294 document.getElementById("NodeDistanceBC").innerHTML = DistanceBC+\'m\';
295 document.getElementById("NodeDistanceCB").innerHTML = DistanceBC+\'m\';
296 var DistanceAC = Math.round(GetLineLength(PtC, PtA));
297 document.getElementById("NodeDistanceAC").innerHTML = DistanceAC+\'m\';
298 document.getElementById("NodeDistanceCA").innerHTML = DistanceAC+\'m\';
2998simandl 
3009simandl document.getElementById("NodeAngleACB").innerHTML = Math.round(GetAngle(PtA, PtC, PtB))+\'st\';
301 document.getElementById("NodeAngleBAC").innerHTML = Math.round(GetAngle(PtB, PtC, PtA))+\'st\';
302 document.getElementById("NodeAngleCBA").innerHTML = Math.round(GetAngle(PtC, PtA, PtB))+\'st\';
303 
304 document.getElementById("NodeDistanceBAC").innerHTML = ( DistanceAB + DistanceAC ) +\'m\';
305 document.getElementById("NodeDistanceABC").innerHTML = ( DistanceAB + DistanceBC ) +\'m\';
306 document.getElementById("NodeDistanceBCA").innerHTML = ( DistanceBC + DistanceAC ) +\'m\';
3078simandl }
3089simandl }
3098simandl 
3109simandl //##############################
311 function GetAngle(PA, PB, PC) {
312 var a = GetLineLength(PC, PB);
313 var b = GetLineLength(PC, PA);
314 var c = GetLineLength(PA, PB);
315 var s = ( a + b + c ) / 2;
316 var alfa = (360/Math.PI)*Math.asin(Math.sqrt((s-b)*(s-c)/(b*c)));
317 return alfa;
3188simandl }
319 
320 //##############################
3219simandl function GetLineLength(PA, PB) {
322 var Lat1 = PA.lat();
323 var Lon1 = PA.lng();
324 var Lat2 = PB.lat();
325 var Lon2 = PB.lng();
3264simandl var R = 6371; // km
327 var dLat = (Lat2-Lat1) * Math.PI / 180;
328 var dLon = (Lon2-Lon1) * Math.PI / 180;
329 var a = Math.sin(dLat/2) * Math.sin(dLat/2) +
330 Math.cos(Lat1 * Math.PI / 180) * Math.cos(Lat2 * Math.PI / 180) *
331 Math.sin(dLon/2) * Math.sin(dLon/2);
332 var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
333 var LineLength = 1000 * R * c;
334 return LineLength;
335 }
336 
337 //##############################
3381simandl function HandleMapMoveEnd() {
339 if (AutoFetchMode) {
340 ClearOverlayAndData();
341 FetchOverlayAndData();
342 }
343 document.getElementById("status").innerHTML = "Po presunu mame celkem " + NumAddedNodes + " nodu";
344 }
345 
346 //##############################
347 function CreateMarker(point, name, address, type, id) {
348 var marker = new GMarker(point, {draggable: true, bounce: true, icon: NodeIcon[type]});
349 var html = "<b>" + id + " " + name + "</b> <br/>" + address +" <br/>" + type;
350 GEvent.addListener(marker, "dragstart", function() {
351 map.closeInfoWindow();
352 });
3535simandl GEvent.addListener(marker, \'click\', function() {
3541simandl marker.openInfoWindowHtml(html);
355 });
356 return marker;
357 }
358 
359 //##############################
360 function SwitchDatabase(NewDatabase) {
361 CurrentDatabase = NewDatabase;
3629simandl document.getElementById("SouradniceStredu").innerHTML = CurrentDatabase;
3631simandl ClearOverlayAndData();
364 FetchOverlayAndData();
365 document.getElementById("status").innerHTML = "Databaze zmenena na "+CurrentDatabase;
366 document.getElementById("databaze").innerHTML = CurrentDatabase;
367 }
368 
369 //##############################
370 function ChangeNodeLimit(NewNodeLimit) {
371 NodeLimit = NewNodeLimit;
372 FetchOverlayAndData();
373 document.getElementById("status").innerHTML = "Limit zmenen na "+NewNodeLimit;
3749simandl document.getElementById("NodeLimitSelectBox").value = NodeLimit;
3751simandl }
376 
377 //##############################
3789simandl function ChangeMapSizeX(NewMapSizeX) {
379 MapSizeX = NewMapSizeX;
380 FetchOverlayAndData();
381 document.getElementById("status").innerHTML = "Rozmer X zmenen na "+MapSizeX;
382 document.getElementById("map").style.width = MapSizeX+"px";
38310simandl 
384 MapName = map.getCurrentMapType().getName();
3859simandl ClearOverlayAndData();
386 MapLoad();
387 FetchOverlayAndData();
388 }
389 
390 //##############################
391 function ChangeMapSizeY(NewMapSizeY) {
392 MapSizeY = NewMapSizeY;
393 FetchOverlayAndData();
394 document.getElementById("status").innerHTML = "Rozmer Y zmenen na "+MapSizeY;
395 document.getElementById("map").style.height = MapSizeY+"px";
396 
39710simandl MapName = map.getCurrentMapType().getName();
3989simandl ClearOverlayAndData();
399 MapLoad();
400 FetchOverlayAndData();
401 }
402 
403 //##############################
4044simandl function DebugPrint(Text) {
405 document.getElementById("debug").innerHTML = document.getElementById("debug").innerHTML + Text;
406 }
407 
408 //##############################
4091simandl function Fetch() {
410 NodeLayer();
411 document.getElementById("status").innerHTML = "Nacteno";
412 }
413 
414 //##############################
415 function FetchOverlayAndData() {
416 if (AutoFetchMode) {
417 Fetch();
418 };
419 }
420 
421 //##############################
422 function ClearOverlayAndData() {
423 if (AutoClearMode) {
4249simandl ForceClear();
4251simandl };
426 }
427 
428 //##############################
4299simandl function ForceClear() {
4301simandl document.getElementById("status").innerHTML = "Smazano " + NumAddedNodes + " nodu";
431 map.clearOverlays();
432 LoadedNodes=Array();
433 LoadedLinks=Array();
434 NumAddedNodes=0;
435 document.getElementById("NumNodes").innerHTML = "Nacteno " + NumAddedNodes + " nodu";
436 NumAddedLinks=0;
437 NumVisibleLinks=0;
4385simandl NumInVisibleLinks=0;
4391simandl document.getElementById("NumLinks").innerHTML = "Nacteno " + NumAddedLinks + " linku";
440 }
441 
442 //##############################
443 function ToggleAutoFetchMode(NewAutoFetchMode) {
444 AutoFetchMode = NewAutoFetchMode;
445 if (AutoFetchMode) {
446 document.getElementById("status").innerHTML = "Automaticke nacitani zapnuto.";
447 }
448 else {
449 document.getElementById("status").innerHTML = "Automaticke nacitani vypnuto.";
450 }
4519simandl document.getElementById("AutoFetchModeCheckButton").checked = AutoFetchMode;
4521simandl }
453 
454 //##############################
455 function ToggleAutoClearMode(NewAutoClearMode) {
456 AutoClearMode = NewAutoClearMode;
457 if (AutoClearMode) {
458 document.getElementById("status").innerHTML = "Automaticke mazani zapnuto.";
459 }
460 else {
461 document.getElementById("status").innerHTML = "Automaticke mazani vypnuto.";
4629simandl }
463 document.getElementById("AutoClearModeCheckButton").checked = AutoClearMode;
4641simandl }
465 
4669simandl //##############################
467 function SetCookie(Name, Data, Validity) {
468 var Day = 24 * 3600 * 1000;
469 var Expiration = new Date();
470 Expiration.setTime(Expiration.getTime() + Validity * Day);
471 document.cookie = Name + "=" + escape(Data) + "; expires=" + Expiration.toGMTString() + "; path=/";
472 }
473 
474 //##############################
475 function GetCookie(Name) {
476 var Prefix = Name + "=";
477 var Begin = document.cookie.indexOf(Prefix);
478 if ( Begin == -1 )
479 return "";
480 Begin += Prefix.length;
481 if ( Begin >= document.cookie.length )
482 return "";
483 var End = document.cookie.indexOf(";", Begin);
484 if ( End == -1 )
485 End = document.cookie.length;
486 return unescape(document.cookie.substring(Begin, End));
487 }
488 
489 //##############################
490 function SaveSettingsCookieText() {
491 var Text = "db=" + CurrentDatabase
492 + "&map=" + map.getCurrentMapType().getName()
493 + "&sizex=" + MapSizeX
494 + "&sizey=" + MapSizeY
495 + "&lat=" + map.getCenter().lat()
496 + "&lon=" + map.getCenter().lng()
497 + "&zoom=" + map.getZoom()
498 + "&autofetch=" + AutoFetchMode
499 + "&autoclear=" + AutoClearMode
500 + "&nodelimit=" + NodeLimit
501 + "&";
502 return Text;
503 }
504 
505 //##############################
506 function LoadSettings() {
507 var Text = GetCookie("default");
508 var Begin = 0;
509 var End = 0;
510 
511 End = Text.indexOf("&",Begin);
512 while (End > -1) {
513 var Parameter = Text.substring(Begin,End);
514 var EqualPosition = Parameter.indexOf("=");
515 if ((EqualPosition > -1) && (EqualPosition < Parameter.length)) {
516 var ParameterName = Parameter.substring(0,EqualPosition);
517 var ParameterValue = Parameter.substring(EqualPosition+1,Parameter.length);
518 if (ParameterName == "db") CurrentDatabase = ParameterValue;
519 if (ParameterName == "map") MapName = ParameterValue;
520 if (ParameterName == "sizex") MapSizeX = 1*ParameterValue;
521 if (ParameterName == "sizey") MapSizeY = 1*ParameterValue;
522 if (ParameterName == "lat") MapCenterLat = 1*ParameterValue;
523 if (ParameterName == "lon") MapCenterLon = 1*ParameterValue;
524 if (ParameterName == "zoom") MapZoom = 1*ParameterValue;
525 if ((ParameterName == "autofetch") && ParameterValue == "true" ) ToggleAutoFetchMode(true);
526 if ((ParameterName == "autofetch") && ParameterValue == "false" ) ToggleAutoFetchMode(false);
527 if ((ParameterName == "autoclear") && ParameterValue == "true" ) ToggleAutoClearMode(true);
528 if ((ParameterName == "autoclear") && ParameterValue == "false" ) ToggleAutoClearMode(false);
529 if (ParameterName == "nodelimit") ChangeNodeLimit(ParameterValue);
530 }
531 Begin = End + 1;
532 End = Text.indexOf("&",Begin);
533 }
534 
535 document.getElementById("AutoFetchModeCheckButton").checked = AutoFetchMode;
536 document.getElementById("AutoClearModeCheckButton").checked = AutoClearMode;
537 document.getElementById("NodeLimitSelectBox").value = NodeLimit;
538 document.getElementById("databaze").innerHTML = CurrentDatabase;
539 
540 document.getElementById("MapSizeXSelectBox").value = MapSizeX;
541 document.getElementById("MapSizeYSelectBox").value = MapSizeY;
542 document.getElementById("map").style.width = MapSizeX+"px";
543 document.getElementById("map").style.height = MapSizeY+"px";
544 ForceClear();
545 MapLoad();
546 FetchOverlayAndData();
547 }
548 
549 //##############################
550function MDControl() { }
551 MDControl.prototype = new GControl();
552 MDControl.prototype.initialize = function(map) {
553 var container = document.createElement("div");
554 var savepos= document.createElement("div");
55510simandl savepos.title= "Ulozit aktualni pozici a zoom";
5569simandl savepos.className= "MDbuttons";
557 container.appendChild(savepos);
55810simandl savepos.appendChild(document.createTextNode("Ulozit pozici"));
5599simandl GEvent.addDomListener(savepos, "click", function() {
560 var center = map.getCenter(); var zoom = map.getZoom();
561 saved.splice(0,2,center,zoom);
562// alert("Saved Position: "+center.toUrlValue()+"\nZoomlevel: "+zoom);
563 });
564 
565 var tosaved=document.createElement("div");
56610simandl tosaved.title= "Navrat zpet na ulozenou pozici";
5679simandl tosaved.className= "MDbuttons";
568 container.appendChild(tosaved);
56910simandl tosaved.appendChild(document.createTextNode("Na ulozenou"));
5709simandl GEvent.addDomListener(tosaved, "click", function() {
571 if(saved.length > 0) { map.setZoom(saved[1]); map.panTo(saved[0]); }
572 });
573 map.getContainer().appendChild(container);
574 return container;
575}
576 
577MDControl.prototype.getDefaultPosition = function() {
578 return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7,31));
579}
580 
58110simandl //##############################
582 function ShowMeasuredDistanceAndAngle() {
583 var LineSize = 1;
584 var LineColAB = "#FF0000";
585 var LineColAC = "#FF0000";
586 var LineColBC = "#00FF00";
587 var LineColOpacity = 0.5;
5889simandl 
58910simandl var polyOptions = {geodesic:false};
590 if ( PtNum > 1 ) {
591 var pointA = new GLatLng(parseFloat(PtA.lat()),parseFloat(PtA.lng()));
592 var pointB = new GLatLng(parseFloat(PtB.lat()),parseFloat(PtB.lng()));
593 polylineAB = new GPolyline([pointA,pointB], LineColAB, 3 + LineSize, LineColOpacity, polyOptions);
594 map.addOverlay(polylineAB);
595 }
596 if ( PtNum > 2 ) {
597 var pointC = new GLatLng(parseFloat(PtC.lat()),parseFloat(PtC.lng()));
598 polylineAC = new GPolyline([pointA,pointC], LineColAC, 3 + LineSize, LineColOpacity, polyOptions);
599 map.addOverlay(polylineAC);
600 polylineBC = new GPolyline([pointB,pointC], LineColBC, 3 + LineSize, LineColOpacity, polyOptions);
601 map.addOverlay(polylineBC);
602 }
603}
604 
605 //##############################
606 function HideMeasuredDistanceAndAngle() {
607 if ( PtNum > 1 ) {
608 map.removeOverlay(polylineAB);
609 }
610 if ( PtNum > 2 ) {
611 map.removeOverlay(polylineAB);
612 map.removeOverlay(polylineAC);
613 map.removeOverlay(polylineBC);
614 }
615}
616 
617 //##############################
618 function MakePrintable() {
619 
620 // To make polygons printable...
621 $$("div.gmnoprint").each( function (div, index) {
622 div.removeClassName(\'gmnoprint\');
623 });
624 
625}
626 
6279simandl //]]>
628 </script>
6291simandl </head>
630 
631 <body onload="load()" onunload="GUnload()">
632 <table>
633 <tr>
634 <td>
6359simandl <div id="map" class="gmaparea"></div>
6361simandl </td>
637 
6389simandl <td valign="top" class="controlarea">
63911simandl <div id="UserInfo">
640 ';
64112simandl if ($bbuserinfo['username'] == "Unregistered") {
64213simandl echo "Nejste <a href=\"http://connected.prosek.czf/forum/usercp.php\">prihlasen(a)</a> a nezobrazi se vam obsah databaze czfmutf, ale jen gendb.";
64312simandl } else {
644 echo "<a href=\"http://connected.prosek.czf/forum/usercp.php\">Prihlasen(a)</a> jako:";
645 echo $bbuserinfo['username']."&nbsp;";
646 echo $bbuserinfo['userid']."&nbsp;";
647 echo $bbuserinfo['mapperms']."&nbsp;";
648 }
6495simandl echo '</div>
65010simandl <hr>
651 Databaze:
652 <br>
6535simandl <input type="button" value="czfmutf" onClick="SwitchDatabase(\'czfmutf\');"/>
654 <input type="button" value="gendb" onClick="SwitchDatabase(\'gendb\');"/>
65510simandl <div id="databaze">0</div>
656 <hr>
657 Nody a linky:
6581simandl <br>
65910simandl <input type="button" value="Zobrazit" onClick="Fetch();"/>
660 <input type="button" value="Smazat" onClick="ForceClear();"/>
6611simandl <div id="NumNodes">0</div>
662 <div id="NumLinks">0</div>
663 Automaticke nacitani:
664 <input id="AutoFetchModeCheckButton" type="checkBox" onclick="ToggleAutoFetchMode(this.checked)">
665 <br>
666 Automaticke mazani:
667 <input id="AutoClearModeCheckButton" type="checkBox" onclick="ToggleAutoClearMode(this.checked)">
668 <br>
66910simandl Limit poctu nodu:
6701simandl <select id="NodeLimitSelectBox" onchange="ChangeNodeLimit(this.value)">
671 <option value="0">0</option>
672 <option value="30" selected="selected">30</option>
673 <option value="60">60</option>
674 <option value="200">200</option>
675 <option value="500">500</option>
676 <option value="1000">1000</option>
677 </select>
67810simandl <hr>
679 Nastaveni mapy:
6809simandl <div>
681 <select id="MapSizeXSelectBox" onchange="ChangeMapSizeX(this.value)">
682 <option value="800" selected="selected">800</option>
683 <option value="900">900</option>
684 <option value="1000">1000</option>
685 <option value="1100">1100</option>
686 <option value="1200">1200</option>
687 <option value="1300">1300</option>
688 <option value="1400">1400</option>
689 </select>
690 X
691 <select id="MapSizeYSelectBox" onchange="ChangeMapSizeY(this.value)">
692 <option value="600" selected="selected">600</option>
693 <option value="700">700</option>
694 <option value="800">800</option>
695 <option value="900">900</option>
696 <option value="1000">1000</option>
697 </select>
698 </div>
69910simandl <input type="button" value=\'Ulozit\' onclick=\'SetCookie("default", SaveSettingsCookieText() , 365);\'>
700 <input type="button" value=\'Nahrat\' onclick=\'LoadSettings();\'>
701 <hr>
702 Mereni:
703 <br>
704 <input type="button" value=\'Zobrazit\' onclick=\'ShowMeasuredDistanceAndAngle();\'>
705 <input type="button" value=\'Schovat\' onclick=\'HideMeasuredDistanceAndAngle();\'>
706 <hr>
707 Print:
708 <br>
709 <input type="button" value=\'Print\' onclick=\'MakePrintable();\'>
7101simandl </td>
711 </tr>
712 
713 <tr>
7149simandl <td class="statusarea" >
7151simandl 
7164simandl <div id="debug"></div>
7171simandl <div id="status">Hotovo!</div>
718 <div id="data"></div>
7192simandl <div id="NodeCoordinates">aaa</div>
7209simandl <div id="SouradniceStredu">Souradnice stredu:<br>Rozsah:<br>Zvetseni:</div>
721 <td>
722 <table border="1">
723 <tr>
724 <td>Mereni vzdalenosti a uhlu</td><td>A</td><td>B</td><td>C</td>
725 </tr>
726 <tr>
727 <td><div id="NodeCoordinatesA">A klikni na mapu</div></td><td><div id="NodeAngleACB">ACB</div></td>
728 <td><div id="NodeDistanceAB">AB</div></td><td><div id="NodeDistanceAC">AC</div></td>
729 </tr>
730 <tr>
731 <td><div id="NodeCoordinatesB">B klikni podruhe</div></td><td><div id="NodeDistanceBA">BA</div></td>
732 <td><div id="NodeAngleBAC">BAC</div></td><td><div id="NodeDistanceBC">BC</div></td>
733 </tr>
734 <tr>
735 <td><div id="NodeCoordinatesC">C klikni potreti</div></td><td><div id="NodeDistanceCA">CA</div></td>
736 <td><div id="NodeDistanceCB">CB</div></td><td><div id="NodeAngleCBA">BAC</div></td>
737 </tr>
738 <tr>
73910simandl <td>
740 </td><td><div id="NodeDistanceBAC">B-A-C</div></td>
7419simandl <td><div id="NodeDistanceABC">A-B-C</div></td><td><div id="NodeDistanceBCA">B-C-A</div></td>
742 </tr>
743 </table>
7441simandl </td>
7459simandl 
746 </td>
7471simandl </tr>
748 
749 <tr>
750 <td colspan=2>
751 CZFGmap (c) Petr Simandl - GNU General Public License
752 <a href="http://websvn.prosek.czf/">websvn.prosek.czf</a>
753 </td>
754 </tr>
755 
756 </table>
75710simandl <a href="http://code.google.com/apis/maps/documentation/examples/">http://code.google.com/apis/maps/documentation/examples/</a>
758 <a href="http://code.google.com/apis/kml/documentation/kml_tut.html">http://code.google.com/apis/kml/documentation/kml_tut.html</a>
759 <br>
760 <a href="http://mapki.com/wiki/Knowledge_Base">http://mapki.com/wiki/Knowledge_Base</a>
761 <a href="http://www.bdcc.co.uk/Gmaps/BdccGmapBits.htm">http://www.bdcc.co.uk/Gmaps/BdccGmapBits.htm</a>
762 <br>
763 <a href="http://econym.googlepages.com/custommap.htm">http://econym.googlepages.com/custommap.htm</a>
764 <br>
765 http://www.czfree.net/forum/showthread.php?postid=197732#post197732
76616simandl http://www.gscottolson.com/blackbirdjs/
7671simandl </body>
768</html>
7695simandl';
770?>

Powered by WebSVN 2.2.1