$(document).ready(function(){ myprj.models.onload(); myprj.events(); }); myprj = { _map : {}, _mouse : {}, models : { _layer : {}, _layer_surround : {}, _markers : [], _marker_center : {}, _minLat : null, _maxLat : null, _minLon : null, _maxLon : null, onload : function () { myprj._map = new ZdcMap($('#Emap')[0]); myprj._map.setWheelOff(); this._layer = new ZdcUserLayer(); myprj._map.addUserLayer(this._layer); this.setController(); var poi = {}; $($('#PoiDataForm').serializeArray()).each(function (_key, _val) { poi[_val.name] = _val.value; }); /** * 主マーカーを追加 */ poi.point = new ZdcPoint(parseFloat(poi.lon), parseFloat(poi.lat)); poi.icon = this.mkIcon(poi.imgIcon, poi.specialFlg); var marker = this.mkMarker(poi); this._layer.addMarker(marker); /** * マップ移動 */ this._marker_center = marker; myprj._map.saveMapLocation(marker.Point); myprj._map.scrollToCenter(marker.Point); /** * 周辺スポット表示 */ this.getSurroundPoints(poi); }, setController : function () { myprj._map.addMapControl(new ZdcControl(3,'large')); myprj._map.addMapScaleBar(new ZdcScaleBar()); }, mkIcon : function (imgUrl, specialFlg) { var icon = new ZdcIcon(); icon.printimage = icon.image = imgUrl; icon.size = new ZdcSize(30, 30); icon.printsize = new ZdcSize(30, 30); icon.offset = new ZdcPixel(-15,-15); icon.msgoffset = new ZdcPixel(0,-15); icon.shdoffset = new ZdcPixel(-3,-3); if(specialFlg) icon.shadowimage = '/images/map/marker/shadow_special.png'; else icon.shadowimage = '/images/map/marker/shadow_normal.png'; icon.shadowsize = new ZdcSize(40,40); return icon; }, mkMarker : function (poi) { if (typeof(poi.icon) != 'object') { alert('マーカー作成時にアイコンオブジェクトが指定されていません。'); return; } var marker = new ZdcMarker(poi.point, poi.icon); marker.type = 'hands'; marker.poiType = poi.poiType; marker.poiName = poi.poiName; marker.poiCode = poi.poiCode; marker.todCode = poi.todCode; marker.todName = poi.todName; marker.specialFlg = poi.specialFlg; marker.imgIcon = poi.imgIcon; marker.imgThumb = poi.imgThumb; marker.imgOriginal = poi.imgOriginal; marker.point = poi.point; marker.insDate = poi.insDate; ZdcEvent.addListener(marker, 'mouseovermarker', function(){ myprj.models.Tooltip.set(this) }); ZdcEvent.addListener(marker, 'mouseoutmarker', function(){ myprj.models.Tooltip.remove(); }); myprj.models._markers.push(marker); return marker; }, setMarkerClickEvent : function (marker) { ZdcEvent.addListener(marker, 'mouseclickmarker', function(){ window.location.href = '/poi/poi-detail.php?pid=' + marker.poiCode; }); }, getSurroundPoints : function (poi) { $.ajax({ type : "post", url : "/ajax/Poi/GetSurroundPoints.php", data : {json:JSON.stringify(poi)}, dataType : 'jsonp', jsonp : 'jsoncallback', success : function(result){ if (result == undefined) return; var markers = Array(); $(result).each(function (_key, _val) { _val.poiType = 'ClSurroundPoi'; _val.point = new ZdcPoint(parseFloat(_val.lon), parseFloat(_val.lat)); _val.icon = myprj.models.mkIcon(_val.imgIcon, _val.specialFlg); var marker = myprj.models.mkMarker(_val); myprj.models._layer.addMarker(marker); myprj.models.setMarkerClickEvent(marker); markers.push(marker); }); myprj.models.setSurroundPoints(markers); } }); }, setSurroundPoints : function (markers) { var cnt = 0; var tbody = $('
'); var row = $('