freenetis-github/application/views/js/address_points_show.php @ 08e5d0ad
c6b00989 | Ondřej Fibich | <?php
|
|
/**
|
|||
9d291dae | Ondřej Fibich | * Map in address point detail, coordinate loaded from data attributes.
|
|
c6b00989 | Ondřej Fibich | *
|
|
* @author Ondřej Fibich
|
|||
*/
|
|||
// IDE complementation
|
|||
if (FALSE): ?><script type="text/javascript"><?php endif
|
|||
?>
|
|||
9d291dae | Ondřej Fibich | ||
$(document).ready(function ()
|
|||
c6b00989 | Ondřej Fibich | {
|
|
9d291dae | Ondřej Fibich | function mapycz_addr(divId, gpsx, gpsy)
|
|
{
|
|||
var center = SMap.Coords.fromWGS84(gpsy, gpsx);
|
|||
var m = new SMap(JAK.gel(divId), center, 17);
|
|||
m.addDefaultLayer(SMap.DEF_OPHOTO);
|
|||
m.addDefaultLayer(SMap.DEF_BASE).enable();
|
|||
var layerSwitch = new SMap.Control.Layer();
|
|||
layerSwitch.addDefaultLayer(SMap.DEF_BASE);
|
|||
layerSwitch.addDefaultLayer(SMap.DEF_OPHOTO);
|
|||
m.addControl(layerSwitch, {left: "8px", top: "9px"});
|
|||
m.addControl(new SMap.Control.Sync());
|
|||
m.addDefaultControls();
|
|||
c6b00989 | Ondřej Fibich | ||
9d291dae | Ondřej Fibich | var markerLayer = new SMap.Layer.Marker();
|
|
markerLayer.addMarker(new SMap.Marker(center, "myMarker", {}));
|
|||
m.addLayer(markerLayer);
|
|||
markerLayer.enable();
|
|||
};
|
|||
c6b00989 | Ondřej Fibich | ||
c9e95e38 | Ondřej Fibich | (function map_async_loader() {
|
|
if ('Loader' in window) {
|
|||
Loader.async = true;
|
|||
Loader.load(null, null, function () {
|
|||
var $map = $('#ap_gmap');
|
|||
mapycz_addr('ap_gmap', $map.data('gpsx'), $map.data('gpsy'));
|
|||
});
|
|||
} else {
|
|||
setTimeout(map_async_loader, 1000);
|
|||
}
|
|||
})();
|
|||
9d291dae | Ondřej Fibich | });
|
|
c6b00989 | Ondřej Fibich |