导航组件控制逻辑代码

private function doFun(funName:String):void
			{
				if(currentFun==funName){
				return;
				}
				map.infoWindow.hide();
				map.removeLayer(isoSurfaceLayer);//等直面
				map.removeLayer(lineLayer);	//等值线
				bcExport.visible=false;

				switch(funName)
				{
					case "yq":
						flagBj[0]="1";
						flagBj[1]=flagBj[2]=flagBj[3]=flagBj[4]="0";
						this.visible=true;//显示本组件,侧边tab导航栏
						if(currentFun=="sq"){
							map.removeLayer(graBaoJingLayer);
							map.removeLayer(graWaterLayer1);//水情层移除
						}
						else if(currentFun=="db"){
							map.removeLayer(graDaBaLayer);//大坝层移除
						}
						else if(currentFun=="sp"){
							map.removeLayer(graSPLayer);//视频层移除
							
						}else if(currentFun=="zk"){
							map.removeLayer(graZKLayer);//闸控层移除
							
						}
						else if(currentFun=="sz"){
							map.removeLayer(graSZLayer);//水质层移除
			
						}else if(currentFun=="ll"){
							map.removeLayer(graLLLayer);//流量层移除
						}
						else{
							//do nothing
							
						}
						tabNav.removeAll();
						//
						tabNav.addChild(ncShiShiYuQing);
						tabNav.addChild(ncLine);
						tabNav.addChild(ncBaoJing);
						//
						myService.getBaoJing(flagBj.toString());
						break;
					case "sq":
						flagBj[1]="1";
						flagBj[0]=flagBj[2]=flagBj[3]=flagBj[4]="0";
						this.visible=true;//显示本组件,侧边tab导航栏
						if(currentFun=="yq"){
							map.removeLayer(graBaoJingLayer);
							map.removeLayer(graRainLayer1);
							map.removeLayer(graRainLayer2);
							map.removeLayer(graMaxRainLayer);
							map.removeLayer(graPjylLayer);
						}
						else if(currentFun=="db"){
							map.removeLayer(graDaBaLayer);
						}
						else if(currentFun=="sp"){
							map.removeLayer(graSPLayer);//视频层移除
							
						}else if(currentFun=="zk"){
							map.removeLayer(graZKLayer);//闸控层移除
							
						}
						else if(currentFun=="sz"){
							map.removeLayer(graSZLayer);//水质层移除
							
						}else if(currentFun=="ll"){
							map.removeLayer(graLLLayer);//流量层移除
						}else{
						//do nothing
						}
						tabNav.removeAll();
						//
						tabNav.addChild(ncBaoJing);
						tabNav.addChild(ncShiShiShuiQing);//添加
						myService.getBaoJing(flagBj.toString());
						break;
					case "db":
						this.visible=false;//隐藏本组件,侧边tab导航栏
						if(currentFun=="sq"){
							map.removeLayer(graBaoJingLayer);
							map.removeLayer(graWaterLayer1);//水情层移除
						}
						else if(currentFun=="yq"){
							map.removeLayer(graBaoJingLayer);
							map.removeLayer(graRainLayer1);
							map.removeLayer(graRainLayer2);
							map.removeLayer(graMaxRainLayer);
							map.removeLayer(graPjylLayer);
							
						}
						else if(currentFun=="sp"){
							map.removeLayer(graSPLayer);//视频层移除
							
						}
						else if(currentFun=="zk"){
							map.removeLayer(graZKLayer);//闸控层移除
							
						}
						else if(currentFun=="sz"){
							map.removeLayer(graSZLayer);//水质层移除
							
						}
						else if(currentFun=="ll"){
							map.removeLayer(graLLLayer);//流量层移除
						}
						else{
							//do nothing
							
						}
						tabNav.removeAll();
						//
						myService.getDaBaJianCeZhan();
						break;
					case "sp"://视频
						this.visible=true;//显示本组件,侧边tab导航栏
						if(currentFun=="sq"){
							//地图
							map.removeLayer(graWaterLayer1);
							map.removeLayer(graBaoJingLayer);
						}
						else if(currentFun=="yq"){
							map.removeLayer(graRainLayer1);
							map.removeLayer(graRainLayer2);
							map.removeLayer(graMaxRainLayer);
							map.removeLayer(graPjylLayer);
						}
						else if(currentFun=="db"){
							map.removeLayer(graDaBaLayer);//大坝层移除
						}
						else if(currentFun=="zk"){
							map.removeLayer(graZKLayer);//闸控层移除
							
						}
						else if(currentFun=="sz"){
							map.removeLayer(graSZLayer);//水质层移除
							
						}else if(currentFun=="ll"){
							map.removeLayer(graLLLayer);//流量层移除
						}
						tabNav.removeAll();
						//
						tabNav.addChild(tb_sp);//添加视频层
						zkService.getSPInfo();//视频信息
						break;
					case "zk"://闸控
						this.visible=true;//显示本组件,侧边tab导航栏
						if(currentFun=="sq"){
							//地图
							map.removeLayer(graWaterLayer1);
							map.removeLayer(graBaoJingLayer);
						}
						else if(currentFun=="yq"){
							map.removeLayer(graRainLayer1);
							map.removeLayer(graRainLayer2);
							map.removeLayer(graMaxRainLayer);
							map.removeLayer(graPjylLayer);
						}
						else if(currentFun=="db"){
							map.removeLayer(graDaBaLayer);//大坝层移除
						}
						
						else if(currentFun=="sp"){
							map.removeLayer(graSPLayer);//视频层移除
							
						}
						else if(currentFun=="sz"){
							map.removeLayer(graSZLayer);//水质层移除
							
						}else if(currentFun=="ll"){
							map.removeLayer(graLLLayer);//流量层移除
						}
						tabNav.removeAll();
						//
						tabNav.addChild(tb_zk);//添加闸控层
						zkService.getZKInfo();//闸控信息
						break;
					case "sz"://水质
						this.visible=true;//显示本组件,侧边tab导航栏
						if(currentFun=="sq"){
							//地图
							map.removeLayer(graWaterLayer1);
							map.removeLayer(graBaoJingLayer);
						}
						else if(currentFun=="yq"){
							map.removeLayer(graRainLayer1);
							map.removeLayer(graRainLayer2);
							map.removeLayer(graMaxRainLayer);
							map.removeLayer(graPjylLayer);
						}
						else if(currentFun=="db"){
							map.removeLayer(graDaBaLayer);//大坝层移除
						}
						else if(currentFun=="sp"){
							map.removeLayer(graSPLayer);//视频层移除
							
						}else if(currentFun=="zk"){
							map.removeLayer(graZKLayer);//闸控层移除
							
						}
						else if(currentFun=="ll"){
							//Alert.show("if-ll");
							//tab去除流量
							//tabNav.removeChild(tb_ll);
							map.removeLayer(graLLLayer);//流量层移除
						}
						tabNav.removeAll();
						//
						tabNav.addChild(tb_sz);//添加水质层
						zkService.getSZInfo();//水质信息
						break;
					case "ll"://流量
						this.visible=true;//显示本组件,侧边tab导航栏
						if(currentFun=="sq"){
							//地图
							map.removeLayer(graWaterLayer1);
							map.removeLayer(graBaoJingLayer);
						}
						else if(currentFun=="yq"){
							map.removeLayer(graRainLayer1);
							map.removeLayer(graRainLayer2);
							map.removeLayer(graMaxRainLayer);
							map.removeLayer(graPjylLayer);
						}
						else if(currentFun=="db"){
							map.removeLayer(graDaBaLayer);//大坝层移除
						}
						else if(currentFun=="sp"){
							tabNav.removeChild(tb_sp);
							map.removeLayer(graSPLayer);//视频层移除
							
						}else if(currentFun=="zk"){
							map.removeLayer(graZKLayer);//闸控层移除
							
						}
						else if(currentFun=="sz"){
							map.removeLayer(graSZLayer);//水质层移除
							
						}
						tabNav.removeAll();
						//
						tabNav.addChild(tb_ll);//添加流量层
						zkService.getLLInfo();//流量信息
						break;
						
				}
				currentFun=funName;
			}

你可能感兴趣的:(代码)