<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    autoTravel

    ;(function() {
        var MapShare = App.MapShare, mapView= MapShare.mapView,
            detailView= MapShare.detailView,
            searchView= MapShare.searchView,
            // locationModel=MapShare.locationModel,
            searchPathView = MapShare.searchPathView,
            searchPathModel = MapShare.searchPathModel,
            configLan=MapShare.configLan,
            topHeight=MapShare.topHeight;
        var loadingMov = {
            loadingBegin : App.loadingBegin,
            loadingFinish : App.loadingFinish
        };     
        var hasResulted = false;
        var mapObj = mapView.getMapObj(),
            startPos,endPos,info;
            
        var RoutPathView = PackTools.View.extend({
            el: $("#drivepath"),    
            model: searchPathModel,
            initialize : function() {
                this.topbar= this.el.find('.position_box');
                this.topbarback = this.topbar.find('.backArrow');
                this.changeToBusBtn = this.topbar.find('.by_way ul li').eq(0);
                this.busBarPan = this.el.find("#busBarPan");
                this.startPlace = this.busBarPan.find("#startPlace");
                this.endPlace = this.busBarPan.find("#endPlace");
                this.$listWrap = this.el.find("#listWrap");
                this.$busItemContainer = this.$listWrap.find(".drive-path-list");
                this.otherInfo = this.busBarPan.find('.otherInfo');
                this.changeToBusBtn.click(function(){
                    routPathView.el.hide();
                    searchPathView.searchBusLine();
                });
                this.topbarback.tap(function(){
                    // searchPathView.el.show();
                    // routPathView.el.hide();
                    routPathView.showSearchBus();
                });
            },
            showSearchBus : function(){
                routPathView.el.hide();
                //searchPathView.$completeList.empty();
                searchPathView.$busList.hide();
                mapView.el.hide();
                searchPathView.el.show();
                //uPAResizePage();
            },
            showOtherInfo : function() {
                //加載駕車路徑規(guī)劃服務(wù)插件
                var driving;
                mapObj.plugin(["AMap.Driving"],function(){
                    var drivingOptions = {
                        policy:AMap.DrivingPolicy.LEAST_TIME
                    };
                    driving = new AMap.Driving(drivingOptions);
                    AMap.event.addListener(driving, "complete", function(data) {
                        var routes = data.routes;
                        if (routes.length <= 0) {
                            routPathView.otherInfo.hide();
                        } else {
                            var distance = 0;
                            var time = 0;
                            for (var i = 0; i < routes.length; i ++) {
                                distance += routes[i].distance;
                                time += routes[i].time;
                            }
                            routPathView.otherInfo.empty()
                                        .text((time/60).toFixed(2).toString() + "分鐘/" + (distance/1000).toFixed(2).toString() + "公里");
                        }
                    });
                    driving.search(startPos, endPos);
                });
            },
            drawTravelLine : function() {
                var routeSearchOption = {
                    routeType : 1
                };
                loadingMov.loadingBegin();
                routPathView.showOtherInfo();
                var routeSearch = new AMap.RouteSearch(routeSearchOption);            
                routeSearch.getNaviPath([startPos, endPos], function(data){
                    routPathView.showRouteDetails(data);
                    loadingMov.loadingFinish();
                });
            },
            showSearchMap : function(data){
                routPathView.el.css({
                    position:'absolute',
                    'z-index': 501,
                    top: topHeight+'px'
                });    
                
                if(!hasResulted){
                     mapObj.clearMap();
                     routPathView.drawLine(data);
                     hasResulted = true;
                }
                mapView.showCenterMap(true);
                routPathView.$listWrap.hide();
                mapView.el.show();    
                routPathView.busBarPan.css({
                    position:'absolute',
                    'z-index': 501,
                    'margin-top': mapView.el.height()-routPathView.topbar.height()-routPathView.busBarPan.height()+'px'
                });
                //routPathView.busBarPan.css('margin-top', mapView.el.height()-routPathView.topbar.height()-routPathView.busBarPan.height()+'px');
                //162 底部欄高度不知為何得不到
                //uPAResizePage();
            },
            showSearchList : function(){
                routPathView.el.css({
                    position:'relative',
                    top: 'auto'
                });    
                routPathView.$listWrap.show();
                mapView.el.hide();  
                // routPathView.el.show();  
                routPathView.busBarPan.css({
                    position:'relative',
                    'margin-top':'0px'
                });
                //uPAResizePage();
            },
            showRouteDetails : function(data){
                //debugger;
                if(data && data.list.length > 0){
                    var details = '<p>起點:'+info.start.name+'</p>';
                    for(var i = 0,len = data.list.length;i < len;i++){
                        details += '<p>'+data.list[i].textInfo+'</p>';
                    }
                    details += '<p>終點:'+info.end.name+'</p>';
                    this.$busItemContainer.html(details);
                    /* 暫時失效
                    var isInList = true;
                    this.$busItemContainer.click(function (e){
                         isInList = false;
                         routPathView.showSearchMap(data);
                    });
                    */
                    hasResulted = false;  
                    routPathView.showSearchList();
                }
            },        
            drawLine : function(data){
                var coords = [];
                var poi_xy_r = data.coors.split(";");
        
                for (var j = 0, len = poi_xy_r.length; j < len; j++) {
                    var arr_lnglat = new Array();
                    arr_lnglat = poi_xy_r[j].split(",");
                    coords.push(new AMap.LngLat(arr_lnglat[0], arr_lnglat[1]));
                }
                var line = new AMap.Polyline({
                    map: mapObj,
                    path : coords,
                    strokeColor : "#003366",
                    strokeOpacity : 0.8,
                    strokeWeight : 4,
                    strokeDasharray : [10, 5]
                });
        
                var marker1=new AMap.Marker({
                    map: mapObj,
                    draggable: 0,
                    position : startPos,
                    icon : "http://webapi.amap.com/images/qd.png"
                    //offset : new AMap.Pixel(-15, -36)
                });
        
                var marker2=new AMap.Marker({
                    map: mapObj,
                    draggable: 0,
                    position : endPos,
                    icon : "http://webapi.amap.com/images/zd.png"
                    //offset : new AMap.Pixel(-15, -36)
                });
        
                // mapObj.setFitView();
            },
            getRouteDetails : function(_startPos, _endPos, busInfo){
                routPathView.el.css({
                    position:'relative',
                    top: 'auto'
                });    
                routPathView.busBarPan.css({
                    position:'relative',
                    'margin-top':'0px'
                });
                this.el.show();
                info = busInfo;
                startPos = _startPos;
                endPos = _endPos;
                this.startPlace.text(info.start.name);
                this.endPlace.text(info.end.name);
                this.drawTravelLine();
            }
        });
        var routPathView = new RoutPathView();
        App.MapShare.routPathView = routPathView;
    })();

    posted on 2014-04-22 09:45 koradji 閱讀(200) 評論(0)  編輯  收藏


    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導航:
     
    <2025年5月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

    導航

    統(tǒng)計

    常用鏈接

    留言簿(2)

    隨筆分類

    隨筆檔案

    文章分類

    文章檔案

    收藏夾

    db2

    dos

    Groovy

    Hibernate

    java

    WAS

    web application

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 一区免费在线观看| 久久亚洲精品成人无码网站 | 国产AV无码专区亚洲AV麻豆丫| 成年男女男精品免费视频网站| 亚洲最大的黄色网| 免费做爰猛烈吃奶摸视频在线观看| 国产亚洲精品影视在线| 青青草国产免费久久久91| 亚洲av午夜电影在线观看| 亚洲人成人网站在线观看| 巨胸狂喷奶水视频www网站免费| 亚洲色大成网站www永久一区| 国产日韩AV免费无码一区二区 | 中文字幕免费观看视频| 香蕉97碰碰视频免费| 亚洲国产精品久久久天堂| 99免费视频观看| 亚洲 日韩 色 图网站| 亚洲白嫩在线观看| 四虎影视永久免费观看| 99久久免费国产精品热| 亚洲三级视频在线| 亚洲成人影院在线观看| 99re在线免费视频| 无码精品人妻一区二区三区免费看| 亚洲不卡影院午夜在线观看| 亚洲字幕在线观看| 伊人婷婷综合缴情亚洲五月| 精品免费人成视频app| 亚洲av无码兔费综合| 亚洲国产美女精品久久久| 亚洲国产综合无码一区| 精品国产免费观看| 在线观看视频免费国语| 日本免费人成视频在线观看| 国产午夜精品久久久久免费视| 亚洲成a人片在线观看天堂无码| 亚洲日韩一区二区三区| 久久亚洲精精品中文字幕| 亚洲成av人片在线观看天堂无码 | 免费精品国产自产拍在线观看|