<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() {
                //加載駕車路徑規劃服務插件
                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 閱讀(203) 評論(0)  編輯  收藏


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


    網站導航:
     
    <2025年7月>
    293012345
    6789101112
    13141516171819
    20212223242526
    272829303112
    3456789

    導航

    統計

    常用鏈接

    留言簿(2)

    隨筆分類

    隨筆檔案

    文章分類

    文章檔案

    收藏夾

    db2

    dos

    Groovy

    Hibernate

    java

    WAS

    web application

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲国产欧美日韩精品一区二区三区| 成在线人永久免费视频播放| 中国亚洲女人69内射少妇| 久久亚洲AV成人无码国产最大| 最近中文字幕mv免费高清视频7 | 亚洲理论片中文字幕电影| 国产精品网站在线观看免费传媒 | 亚洲欧洲精品一区二区三区| 99视频在线免费看| 亚洲国产精品午夜电影| 日本在线高清免费爱做网站| 亚洲色一区二区三区四区| 日韩激情无码免费毛片| 国产精品亚洲小说专区| 亚洲国产精品毛片av不卡在线| 国产精品免费久久久久影院| 久久久久久久综合日本亚洲| 久久国产精品成人片免费| 亚洲一级片在线观看| 午夜小视频免费观看| 一级毛片a免费播放王色电影 | 大地影院MV在线观看视频免费| 亚洲国产一区二区a毛片| 免费福利在线播放| 亚洲狠狠色丁香婷婷综合| 亚洲A丁香五香天堂网| 国产精品免费大片| 亚洲免费闲人蜜桃| 免费一级黄色毛片| 暖暖免费日本在线中文| 国产99在线|亚洲| 亚洲国产精品人人做人人爽| 免费在线观影网站| 亚洲黄色在线网站| 国产美女无遮挡免费视频网站 | 午夜肉伦伦影院久久精品免费看国产一区二区三区 | 国产成人综合亚洲绿色| 久久精品国产亚洲AV麻豆王友容| 国产免费毛不卡片| 久久久久久久久久久免费精品| 亚洲视频中文字幕在线|