<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>起點(diǎn):'+info.start.name+'</p>';
                    for(var i = 0,len = data.list.length;i < len;i++){
                        details += '<p>'+data.list[i].textInfo+'</p>';
                    }
                    details += '<p>終點(diǎn):'+info.end.name+'</p>';
                    this.$busItemContainer.html(details);
                    /* 暫時(shí)失效
                    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 閱讀(201) 評(píng)論(0)  編輯  收藏


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


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

    導(dǎo)航

    統(tǒng)計(jì)

    常用鏈接

    留言簿(2)

    隨筆分類

    隨筆檔案

    文章分類

    文章檔案

    收藏夾

    db2

    dos

    Groovy

    Hibernate

    java

    WAS

    web application

    搜索

    最新評(píng)論

    閱讀排行榜

    評(píng)論排行榜

    主站蜘蛛池模板: 狠狠色伊人亚洲综合成人| 国内永久免费crm系统z在线 | 亚洲男女一区二区三区| 日韩免费观看一级毛片看看| 日本人成在线视频免费播放| 二级毛片免费观看全程| 99亚洲精品高清一二区| 亚洲人成色777777在线观看| 亚洲福利视频一区二区| 女人让男人免费桶爽30分钟| 91黑丝国产线观看免费| 久久国产精品免费视频| 91国内免费在线视频| 色爽黄1000部免费软件下载| 亚洲国产欧美一区二区三区| 亚洲av无码久久忘忧草| 亚洲伦理一二三四| 亚洲熟女少妇一区二区| 免费国产在线观看| 国产婷婷高清在线观看免费| 成年女人午夜毛片免费看| 欧洲一级毛片免费| 猫咪免费人成网站在线观看| 日韩精品极品视频在线观看免费| 好紧我太爽了视频免费国产| 国产精品美女免费视频观看| 乱淫片免费影院观看| 国产99视频精品免费视频76| 特级毛片aaaa免费观看| 四虎精品成人免费视频| 国产精品一区二区三区免费| 国产精品美女久久久免费| CAOPORM国产精品视频免费| 中文字幕版免费电影网站| 国产精品免费αv视频| 中国在线观看免费的www| 中文字幕免费视频精品一| 野花香高清视频在线观看免费| 在线成人精品国产区免费| 99视频在线免费看| 无码人妻一区二区三区免费手机|