[Linpha-cvs] SF.net SVN: linpha: [4764] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2007-08-19 14:48:17
|
Revision: 4764 http://linpha.svn.sourceforge.net/linpha/?rev=4764&view=rev Author: fangehrn Date: 2007-08-19 07:47:57 -0700 (Sun, 19 Aug 2007) Log Message: ----------- 2007-08-19 flo * adding google maps support - modified gmapper class: increased the number of paragraphs "no image at this zoomlevel" used to auto zoom out - show thumbnails on google maps Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/docs/dev/external_libraries.txt trunk/linpha2/lib/plugins/maps/gmapper1/bodyjs.js trunk/linpha2/lib/plugins/maps/module.exampleMap.php trunk/linpha2/templates/default/map.head.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-08-18 17:37:12 UTC (rev 4763) +++ trunk/linpha2/ChangeLog 2007-08-19 14:47:57 UTC (rev 4764) @@ -1,3 +1,9 @@ +2007-08-19 flo + * adding google maps support + - modified gmapper class: increased the number of paragraphs "no image at this zoomlevel" + used to auto zoom out + - show thumbnails on google maps + 2007-08-18 flo * adding google maps support - added gmapper class (http://gmapper.ajax-info.de/) Modified: trunk/linpha2/docs/dev/external_libraries.txt =================================================================== --- trunk/linpha2/docs/dev/external_libraries.txt 2007-08-18 17:37:12 UTC (rev 4763) +++ trunk/linpha2/docs/dev/external_libraries.txt 2007-08-19 14:47:57 UTC (rev 4764) @@ -20,7 +20,7 @@ - ptviewer 3.1.2 (http://webuser.hs-furtwangen.de/~dersch/) - gmapper 1.0 - to avoid relative path problems: + - to avoid relative path problems: marker(), otherMarker(), tabMarker(), linkMarker(), mapMarker(), directions(), geocode(): replaced all marker( ... , $img = "143.png" , ... ) @@ -29,7 +29,7 @@ with marker( ... , $markerImage , ... ) echo "var image = new Array(\"$markerImage[0]\",$markerImage[1],$markerImage[2]);\n"; - + - increased the number of paragraphs "no image at this zoomlevel" used to auto zoom out - PHP_JPEG_Metadata_Toolkit_1.11 Modified: trunk/linpha2/lib/plugins/maps/gmapper1/bodyjs.js =================================================================== --- trunk/linpha2/lib/plugins/maps/gmapper1/bodyjs.js 2007-08-18 17:37:12 UTC (rev 4763) +++ trunk/linpha2/lib/plugins/maps/gmapper1/bodyjs.js 2007-08-19 14:47:57 UTC (rev 4764) @@ -1 +1 @@ -function createMarker(_1,_2){var _3=new GIcon();_3.image=_2[0];_3.iconSize=new GSize(_2[1],_2[2]);subt=_2[2]/100*11;subt=Math.ceil(subt);var _4=_2[2]-subt;_3.iconAnchor=new GPoint(10,_4);var _5=new GMarker(_1,_3);return _5;}function createMapMarker(_6,_7){var _8=new GIcon();_8.image=_7[0];_8.iconSize=new GSize(_7[1],_7[2]);subt=_7[2]/100*11;subt=Math.ceil(subt);var _9=_7[2]-subt;_8.iconAnchor=new GPoint(10,_9);var _a=_7[2]/3;_a=Math.floor(_a);_8.infoWindowAnchor=new GPoint(_a,2);var _b=new GMarker(_6,_8);GEvent.addListener(_b,"click",function(){map.showMapBlowup(_b.getPoint());});return _b;}function createTabMarker(_c,_d,_e){var _f=new GIcon();_f.image=_e[0];_f.iconSize=new GSize(_e[1],_e[2]);subt=_e[2]/100*11;subt=Math.ceil(subt);var _10=_e[2]-subt;_f.iconAnchor=new GPoint(10,_10);var _11=_e[2]/3;_f.infoWindowAnchor=new GPoint(_11,2);var _12=new GMarker(_c,_f);GEvent.addListener(_12,"click",function(){_12.openInfoWindowTabsHtml(_d);});return _12;}function createLinkMarker(_13,_14,_15){var _16=new GIcon();_16.image=_15[0];_16.iconSize=new GSize(_15[1],_15[2]);subt=_15[2]/100*11;subt=Math.ceil(subt);var _17=_15[2]-subt;_16.iconAnchor=new GPoint(10,_17);var _18=_15[2]/3;_16.infoWindowAnchor=new GPoint(_18,2);var _19=new GMarker(_13,_16);GEvent.addListener(_19,"click",function(){window.location.href=_14;});return _19;}function createOtherMarker(_1a,_1b,_1c){var _1d=new GIcon();_1d.image=_1c[0];_1d.iconSize=new GSize(_1c[1],_1c[2]);subt=_1c[2]/100*11;subt=Math.ceil(subt);var _1e=_1c[2]-subt;_1d.iconAnchor=new GPoint(10,_1e);var _1f=_1c[2]/3;_1f=Math.floor(_1f);_1d.infoWindowAnchor=new GPoint(_1f,2);var _20=new GMarker(_1a,_1d);var _21=_1b;GEvent.addListener(_20,"click",function(){_20.openInfoWindowHtml(_21);});return _20;}var arrowIcon=new GIcon();arrowIcon.iconSize=new GSize(24,24);arrowIcon.shadowSize=new GSize(1,1);arrowIcon.iconAnchor=new GPoint(12,12);arrowIcon.infoWindowAnchor=new GPoint(0,0);var degreesPerRadian=180/Math.PI;function bearing(_22,to){var _24=_22.latRadians();var _25=_22.lngRadians();var _26=to.latRadians();var _27=to.lngRadians();var _28=-Math.atan2(Math.sin(_25-_27)*Math.cos(_26),Math.cos(_24)*Math.sin(_26)-Math.sin(_24)*Math.cos(_26)*Math.cos(_25-_27));if(_28<0){_28+=Math.PI*2;}_28=_28*degreesPerRadian;_28=_28.toFixed(1);return _28;}function arrowHead(_29){var p1=_29[_29.length-1];var p2=_29[_29.length-2];var dir=bearing(p2,p1);var dir=Math.round(dir/3)*3;while(dir>=120){dir-=120;}arrowIcon.image="/img/dir_"+dir+".png";map.addOverlay(new GMarker(p1,arrowIcon));}function midArrows(_2e){for(var i=1;i<_2e.length-1;i++){var p1=_2e[i-1];var p2=_2e[i+1];var dir=bearing(p1,p2);var dir=Math.round(dir/3)*3;while(dir>=120){dir-=120;}arrowIcon.image="/img/dir_"+dir+".png";map.addOverlay(new GMarker(_2e[i],arrowIcon));}}function geocodeAddress(_34,typ,_36,_37){geocoder.getLatLng(_34,function(_38){if(!_38){alert(_34+" nicht gefunden");}else{var lat=_38.lat();var lng=_38.lng();map.setCenter(_38,_37);if(typ=="otherMarker"){_36=createOtherMarker(_38,_34,_36);}else{if(typ=="marker"){_36=createMarker(_38,_36);}else{if(typ=="mapMarker"){_36=createMapMarker(_38,_36);}}}map.addOverlay(_36);}});}function getAdress(){var _3b=document.getElementById("adresse").value;return _3b;}function tilechk(){paragraphs=map.getContainer().getElementsByTagName("p").length;if(paragraphs>4){map.zoomOut(false,true);}}function wheelevent(e){if(!e){e=window.event;}if(e.preventDefault){e.preventDefault();}e.returnValue=false;} \ No newline at end of file +function createMarker(_1,_2){var _3=new GIcon();_3.image=_2[0];_3.iconSize=new GSize(_2[1],_2[2]);subt=_2[2]/100*11;subt=Math.ceil(subt);var _4=_2[2]-subt;_3.iconAnchor=new GPoint(10,_4);var _5=new GMarker(_1,_3);return _5;}function createMapMarker(_6,_7){var _8=new GIcon();_8.image=_7[0];_8.iconSize=new GSize(_7[1],_7[2]);subt=_7[2]/100*11;subt=Math.ceil(subt);var _9=_7[2]-subt;_8.iconAnchor=new GPoint(10,_9);var _a=_7[2]/3;_a=Math.floor(_a);_8.infoWindowAnchor=new GPoint(_a,2);var _b=new GMarker(_6,_8);GEvent.addListener(_b,"click",function(){map.showMapBlowup(_b.getPoint());});return _b;}function createTabMarker(_c,_d,_e){var _f=new GIcon();_f.image=_e[0];_f.iconSize=new GSize(_e[1],_e[2]);subt=_e[2]/100*11;subt=Math.ceil(subt);var _10=_e[2]-subt;_f.iconAnchor=new GPoint(10,_10);var _11=_e[2]/3;_f.infoWindowAnchor=new GPoint(_11,2);var _12=new GMarker(_c,_f);GEvent.addListener(_12,"click",function(){_12.openInfoWindowTabsHtml(_d);});return _12;}function createLinkMarker(_13,_14,_15){var _16=new GIcon();_16.image=_15[0];_16.iconSize=new GSize(_15[1],_15[2]);subt=_15[2]/100*11;subt=Math.ceil(subt);var _17=_15[2]-subt;_16.iconAnchor=new GPoint(10,_17);var _18=_15[2]/3;_16.infoWindowAnchor=new GPoint(_18,2);var _19=new GMarker(_13,_16);GEvent.addListener(_19,"click",function(){window.location.href=_14;});return _19;}function createOtherMarker(_1a,_1b,_1c){var _1d=new GIcon();_1d.image=_1c[0];_1d.iconSize=new GSize(_1c[1],_1c[2]);subt=_1c[2]/100*11;subt=Math.ceil(subt);var _1e=_1c[2]-subt;_1d.iconAnchor=new GPoint(10,_1e);var _1f=_1c[2]/3;_1f=Math.floor(_1f);_1d.infoWindowAnchor=new GPoint(_1f,2);var _20=new GMarker(_1a,_1d);var _21=_1b;GEvent.addListener(_20,"click",function(){_20.openInfoWindowHtml(_21);});return _20;}var arrowIcon=new GIcon();arrowIcon.iconSize=new GSize(24,24);arrowIcon.shadowSize=new GSize(1,1);arrowIcon.iconAnchor=new GPoint(12,12);arrowIcon.infoWindowAnchor=new GPoint(0,0);var degreesPerRadian=180/Math.PI;function bearing(_22,to){var _24=_22.latRadians();var _25=_22.lngRadians();var _26=to.latRadians();var _27=to.lngRadians();var _28=-Math.atan2(Math.sin(_25-_27)*Math.cos(_26),Math.cos(_24)*Math.sin(_26)-Math.sin(_24)*Math.cos(_26)*Math.cos(_25-_27));if(_28<0){_28+=Math.PI*2;}_28=_28*degreesPerRadian;_28=_28.toFixed(1);return _28;}function arrowHead(_29){var p1=_29[_29.length-1];var p2=_29[_29.length-2];var dir=bearing(p2,p1);var dir=Math.round(dir/3)*3;while(dir>=120){dir-=120;}arrowIcon.image="/img/dir_"+dir+".png";map.addOverlay(new GMarker(p1,arrowIcon));}function midArrows(_2e){for(var i=1;i<_2e.length-1;i++){var p1=_2e[i-1];var p2=_2e[i+1];var dir=bearing(p1,p2);var dir=Math.round(dir/3)*3;while(dir>=120){dir-=120;}arrowIcon.image="/img/dir_"+dir+".png";map.addOverlay(new GMarker(_2e[i],arrowIcon));}}function geocodeAddress(_34,typ,_36,_37){geocoder.getLatLng(_34,function(_38){if(!_38){alert(_34+" nicht gefunden");}else{var lat=_38.lat();var lng=_38.lng();map.setCenter(_38,_37);if(typ=="otherMarker"){_36=createOtherMarker(_38,_34,_36);}else{if(typ=="marker"){_36=createMarker(_38,_36);}else{if(typ=="mapMarker"){_36=createMapMarker(_38,_36);}}}map.addOverlay(_36);}});}function getAdress(){var _3b=document.getElementById("adresse").value;return _3b;}function tilechk(){paragraphs=map.getContainer().getElementsByTagName("p").length;if(paragraphs>10){map.zoomOut(false,true);}}function wheelevent(e){if(!e){e=window.event;}if(e.preventDefault){e.preventDefault();}e.returnValue=false;} \ No newline at end of file Modified: trunk/linpha2/lib/plugins/maps/module.exampleMap.php =================================================================== --- trunk/linpha2/lib/plugins/maps/module.exampleMap.php 2007-08-18 17:37:12 UTC (rev 4763) +++ trunk/linpha2/lib/plugins/maps/module.exampleMap.php 2007-08-19 14:47:57 UTC (rev 4764) @@ -5,17 +5,23 @@ $GLOBALS['linpha']->template->output['googleMap'] = new gmap($key); ob_start(); + ?> <div id="gmapper_map" style="height: 800px;"></div> <input type="text" id="adresse" size="30"> -<input type="button" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode("getAdress()", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/dash.png",32,32)); ?>" value="Geocode"> <br> +<input type="button" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( + "getAdress()", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/dash.png",32,32)); ?>" value="Geocode"> <br> <br /><br /> -<a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode("Berlin", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/143.png",20,34)); ?>">Berlin</a><br> -<a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode("Muenchen", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/rot.png",20,34), 10); ?>">München</a><br> -<a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode("Koelner Dom", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gruen.png",20,34), 17); ?>">Kölner Dom</a> +<a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( + "Berlin", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/143.png",20,34)); ?>">Berlin</a><br> +<a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( + "Muenchen", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/rot.png",20,34), 10); ?>">München</a><br> +<a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( + "Koelner Dom", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gruen.png",20,34), 17); ?>">Kölner Dom</a> <?php + $GLOBALS['linpha']->template->output['googleMap']->map( $zoom = 4, $lat = '49.980067', @@ -30,15 +36,42 @@ ); $GLOBALS['linpha']->template->output['googleMap']->markstart(); + $tabs = array( array('Tab 1', 'Content1'), array('Tab 2', 'Lorem Ipsum Dolor sit amet Lorem Ipsum <br>Lorem Ispum'), array('Tab 3', 'Lorem Ipsum Dolor sit amet Lorem Ipsum ') ); $GLOBALS['linpha']->template->output['googleMap']->tabMarker('52.6', '11.9' , $tabs, array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gruen.png",20,34)); + + + + +$query = $GLOBALS['linpha']->db->Execute("SELECT id, gpslatituderef,gpslatitude,gpslongituderef,gpslongitude " . + "FROM ".LIN_PREFIX."meta_exif E INNER JOIN ".LIN_PREFIX."photos P on E.md5sum = P.md5sum " . + "WHERE gpslatituderef IS NOT NULL " . + "AND gpslatitude IS NOT NULL " . + "AND gpslongituderef IS NOT NULL " . + "AND gpslongitude IS NOT NULL"); +while($data = $query->FetchRow()) +{ + $latlon = parsePJMTLatLon($data); + $GLOBALS['linpha']->template->output['googleMap']->otherMarker( + $latlon['gpslatitude'], + $latlon['gpslongitude'] , + '<img src="'.LINPHA_CLIENT.'/get_thumb.php?linId='.$data['id'].'" />', + array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gelb.png",20,34) + ); +} + + + + $GLOBALS['linpha']->template->output['googleMap']->markend(); + + /*$gpoint = $GLOBALS['linpha']->template->output['googleMap']->getGeoPoint("Saarbr\xFCcken Saarland Deutschland"); // Wir f\xFCgen einige Marker hinzu $GLOBALS['linpha']->template->output['googleMap']->markstart(); @@ -84,4 +117,32 @@ $linpha->template->URL_full = LINPHA_LINK.'&linCat=map'; $linpha->template->output['title'] = i18n("Google Maps"); include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); + +function parsePJMTLatLon(&$LatLon) +{ + /*Array + ( + [md5sum] => 084a9633ae7544e35ff1faad6cb05564 + [gpslatituderef] => N + [gpslatitude] => 469762048/16777216 (28),285212672/16777216 (17),820803480/16777216 (48.9236998558) (Degrees Minutes Seconds North or South) + [gpslongituderef] => W + [gpslongitude] => 1879048192/134217728 (14),1207959552/134217728 (9),472055494/16777216 (28.1367000341) (Degrees Minutes Seconds East or West) + )*/ + + // use '?' to be \x84non-greedy\x93 (http://de.wikipedia.org/wiki/Regul%C3%A4rer_Ausdruck#Gieriges_Verhalten) + + + foreach(array('gpslatitude','gpslongitude') as $value) + { + $arrHits = array(); + preg_match_all('/\((.*?)\)/', $LatLon[ $value ], $arrHits); + + $return[ $value ] = $arrHits[1][0] + ($arrHits[1][1] * 1/60) + ($arrHits[1][2] * 1/60 * 1/60); + if( $LatLon[ $value.'ref'] == 'S' OR $LatLon[ $value.'ref'] == 'W' ) + { + $return[ $value ] *= -1; + } + } + return $return; +} ?> \ No newline at end of file Modified: trunk/linpha2/templates/default/map.head.php =================================================================== --- trunk/linpha2/templates/default/map.head.php 2007-08-18 17:37:12 UTC (rev 4763) +++ trunk/linpha2/templates/default/map.head.php 2007-08-19 14:47:57 UTC (rev 4764) @@ -2,5 +2,6 @@ $linTpl->output['googleMap']->headjs(); // <body onunload="GUnload()"> +// window.addEventListener("resize", function() {showZooms()}, false); ?> <script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/gmapper1/bodyjs.js"></script> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |