Mapabc는 마우스로 점선면을 그려 원소 좌표를 얻습니다.

2586 단어 map
 
private function tbb_itemClickHandler(event:ItemClickEvent):void
			{
				if (_HuiZhiGongJuUI.tbb.selectedIndex < 0)
				{
					//this.mapObj.();
				}
				else
				{
					//mapObj.addEventListener(MMapMouseEvent.MOUSE_CLICK,mouseClickCallback); // 
					//mapObj.addEventListener(MMapMouseEvent.MOUSE_DBCLICK,mousedbClickCallback); // 
				
						
					
					switch (event.item.label)
					{
						case " ":
							Types="P";
					mapObj.addEventListener(MMapEvent.ADD_OVERLAY ,mouseClickCallback); // 
							mapObj.setCurrentMouseTool(MMapMouseTools.ADD_MARKER); 
									break;
						case " ":
							Types="L";
					mapObj.addEventListener(MMapEvent.ADD_OVERLAY,mouseClickCallback); // 
							mapObj.setCurrentMouseTool(MMapMouseTools.DRAW_LINE);
																				break;
						case " ":
							Types="M";
					mapObj.addEventListener(MMapEvent.ADD_OVERLAY,mouseClickCallback); // 
							mapObj.setCurrentMouseTool(MMapMouseTools.DRAW_POLYGON);
														break;
					}
				}
			}
			
			function mouseClickCallback(evt:MMapEvent):void {  
				if(Types=="P")
				{
					
					try{
						var marker:MMarker=mapObj.getOverlayById(evt.overlayId) as MMarker;
			                            zubiaomodeP.x=marker.lnglat.lngX.toString();
						zubiaomodeP.y=marker.lnglat.latY.toString();
												}
					
										
				}
				if(Types=="L")
				{
					var line:MPolyline=mapObj.getOverlayById(evt.overlayId) as MPolyline;
                                              zubiaomodeL.x=mlnL.lngX.toString();
                                              zubiaomodeL.y=mlnL.latY.toString();//
										}
					
								}
				if(Types=="M")
				{
					  var polygon:MPolygon=mapObj.getOverlayById(evt.overlayId) as MPolygon;
                                                 zubiaomodeM.x=mlnM.lngX.toString();
                                                zubiaomodeM.y=mlnM.latY.toString();//
										}
					
				mapObj.setCurrentMouseTool(MMapMouseTools.PAN_WHEELZOOM);		
							
			}

좋은 웹페이지 즐겨찾기