var streeViewObject={
	pano : null,
	pano_service : null,
	radius : undefined,
	tencMap : null,
	curVechileId : null,
	isnoStreeView : false,
	open : function(vechileId,lat,lng,direction,latlng_type_){//转换谷歌坐标为腾讯坐标  参数3为百度 5为谷歌
							
				if(streeViewObject.pano_service == null ){
					streeViewObject.pano_service = new qq.maps.PanoramaService();//pano service方法，添加click事件 点击路网 返回街景	
				}
				
				qq.maps.convertor.translate(new qq.maps.LatLng(lat,lng), 
													       latlng_type_,
													        function(res){												
																				
																			streeViewObject.pano_service.getPano(res[0], streeViewObject.radius, function (result){           
																					
																					streeViewObject.curVechileId = vechileId;
																					
																					streeViewObject.initStyle({isOpen:true,lat:lat,lng:lng});
																					
																					if(result == null){																																										
																						if(!streeViewObject.isnoStreeView){																						
																							$("#pano_container").html("<div style='height:100%; background:url(gpsonline/image/tool/no_jiejing.jpg) center no-repeat;text-align: center;'><span style='display: block;padding-top: 35%;font-weight:normal;font-size:14px; color :#7d7d7d;'>抱歉,该处无街景!<span></div>");																							
																							
																							streeViewObject.isnoStreeView = true;
																							
																							if(streeViewObject.pano != null){
																								streeViewObject.pano.setVisible(false);	
																								
																								streeViewObject.pano = null;
																							}
																						}
																						
																					}else{
																						
																						if(streeViewObject.isnoStreeView){
																							$("#pano_container").html("");
																						}
																
																						if(streeViewObject.pano == null){
																							streeViewObject.pano = new qq.maps.Panorama(document.getElementById('pano_container'), {// 创建街景——初始街景画面（由ID号取，可用坐标方法取）
																													pano: result.svid,
																													disableMove: false,																											
																													disableFullScreen: true,
																													pov:{
																														heading:direction,
																														pitch:0
																													},
																													zoom:1,
																													visable: true
																												});	
																						}else{
																							streeViewObject.pano.setPano(result.svid);
																							//设置新街景的方向和水平视角
																							streeViewObject.pano.setPov({heading : direction,pitch : 15});
																							//由resultID取得街景																			
																							streeViewObject.pano.setVisible(true);
																						}
																						
																						streeViewObject.isnoStreeView = false;																							
																					}
														       			 	});
       			 													});
	},
	close : function(){
				
				streeViewObject.curVechileId = null;
				
				if(streeViewObject.pano != null){
					streeViewObject.pano.setVisible(false);	
					
					streeViewObject.pano = null;
				}
				
				streeViewObject.initStyle({isOpen:false});
				
	},
	update : function (){
		if(streeViewObject.curVechileId != null){
			if(typeof carList == "undefined"){
				return;
			}
			for(var i=0;i<carList.data.length;i++){
				
				if(streeViewObject.curVechileId == carList.data[i].id){
					if(mapType == 2){
						streeViewObject.open(carList.data[i].id,carList.data[i].positionLast.lat,carList.data[i].positionLast.lng,parseInt(carList.data[i].positionLast.direct),5);
					}else{
						streeViewObject.open(carList.data[i].id,carList.data[i].positionLast.blat,carList.data[i].positionLast.blng,parseInt(carList.data[i].positionLast.direct),3);
					}
					break;
				}
			
			}
		
		}
	},
	show : function (vechileId,lat,lng,direction,latlng_type_){
			if(!$("#pano_container").is(":hidden")){
				streeViewObject.open(vechileId,lat,lng,direction,latlng_type_);
			}
	},
	initTencMap : function (){
	
			/*
			streeViewObject.tencMap = new qq.maps.Map(document.getElementById("tencMap"),{
		        center:  new qq.maps.LatLng(lat,lng),
		        zoomLevel: 13
		    });
		    
			new qq.maps.PanoramaLayer().setMap(streeViewObject.tencMap);//设置路网图层——蓝色区域提示
			*/
			/*																	 
			streeViewObject.pano = new qq.maps.Panorama(document.getElementById('pano_container'), {// 创建街景——初始街景画面（由ID号取，可用坐标方法取）
				pano: '10051001111220105028000',
				disableMove: true,
				pov:{
					heading:20,
					pitch:15
				},
				zoom:1,
				visable: true
			});
			*/
			
			
			streeViewObject.pano_service = new qq.maps.PanoramaService();//pano service方法，添加click事件 点击路网 返回街景	
			
			/*
			qq.maps.event.addListener(streeViewObject.map, 'click', function (evt){
		            streeViewObject.pano_service.getPano(evt.latLng,streeViewObject.radius, function (result){
		                streeViewObject.pano.setPano(result.svid);
		            });
		    });*/
	},
	initStyle : function(object){
	
		if(object.isOpen){
			
				
			
			if(!$("#pano_container").is(":visible")){
			
				//$("#pano_container").html("");
				$("#map_canvas").css("width","50%");
				$("#map_canvas").css("max-width","50%");
				$("#traffic-switcher").css("marginRight","49%");
				$("#traffic-switcher").css("marginTop","5px");
				$("#pano_container").show();
				$("#close_stree").show();
				
				if(mapType ==2 && map != undefined){
					google.maps.event.trigger(map, 'resize');
					map.setZoom(13);
					
					/*for(var i=0;i<vehicles.length;i++){
						vehicles[i].infowindow.close();
					}*/
					
					map.setCenter(new google.maps.LatLng(object.lat, object.lng));
					
					
				}else{
					baidMap.setZoom(13);
					
					/*baidMap.closeInfoWindow();*/
					
					baidMap.addEventListener('resize', function(){
						
						baidMap.setCenter(new BMap.Point(object.lng,object.lat));
					});
					
																										
				}
			}
			
		}else{
				
				$("#pano_container").html("");
				$("#pano_container").hide();
				$("#close_stree").hide();
				$("#map_canvas").css("width","100%");
				$("#map_canvas").css("max-width","100%");
				$("#traffic-switcher").css("marginRight","");
				$("#traffic-switcher").css("marginTop","");
				if(mapType ==2 && map != undefined){
					google.maps.event.trigger(map, 'resize');
				}
		}
	}
}

