private function sharedDataUpdated(event:AppEvent):void { var data:Object = event.data; if (data.key == "Deactivate_DrawTool"){ lastTool = null; setMapAction(null, null, null, null); if (selectedDrawingIcon){ selectedDrawingIcon.filters = []; selectedDrawingIcon = null; } } }
private function activateIdentifyTool(event:MouseEvent, lTool:String = ""):void { addSharedData("Deactivate_DrawTool", null); // to be able to deactivate drawTool on other widgets // apply glow if(event){ //Allow button to act as toggle buttons if(lastTool == Image(event.currentTarget).name){ clearSelectionFilter(); setMapAction(null, null, null, null); hideInfoWindow(); setMapNavigation(null, null); lastTool = ""; return; }else{ selectedDrawingIcon = Image(event.currentTarget); } }else{ switch(lTool){ case DrawTool.EXTENT :{ selectedDrawingIcon = iDrawExt; break; } case DrawTool.POLYGON :{ selectedDrawingIcon = iDrawPoly; break; } case DrawTool.MAPPOINT :{ selectedDrawingIcon = iDrawPnt; break; } case DrawTool.POLYLINE :{ selectedDrawingIcon = iDrawLine; break; } default:{ selectedDrawingIcon = iDrawPnt; } } } clearSelectionFilter(); selectedDrawingIcon.filters = [ glowFilter ]; var status:String = "Identify"; var value:String = selectedDrawingIcon.name; lastTool = selectedDrawingIcon.name; switch (value){ case DrawTool.MAPPOINT:{ status = pointLabel; setMapAction(DrawTool.MAPPOINT, status, identMarkerSymbol, drawEnd, null, false, true); break; } case DrawTool.POLYLINE:{ status = lineLabel; setMapAction(DrawTool.POLYLINE, status, identLineSymbol, drawEnd, null, false, true); break; } case DrawTool.EXTENT:{ status = rectLabel; setMapAction(DrawTool.EXTENT, status, identFillSymbol, drawEnd, null, false, true); break; } case DrawTool.POLYGON:{ status = polyLabel; setMapAction(DrawTool.POLYGON, status, identFillSymbol, drawEnd, null, false, true); break; } } }
//draw tool clicked private function setMapActionHandler(event:AppEvent):void { var data:Object = event.data; var tool:String = data.tool; var status:String = data.status; var symbol:Symbol = data.symbol; var showDrawTips:Boolean = data.showDrawTips; var enableGraphicsLayerMouseEvents:Boolean = data.enableGraphicsLayerMouseEvents; if (tool) { if(status == "Identify"){ map.addEventListener(MapMouseEvent.MAP_CLICK, onMouseClick); } // make sure there is no custom cursor map.cursorManager.removeAllCursors(); map.removeEventListener(MouseEvent.ROLL_OVER, map_rollOverHandler); map.removeEventListener(MouseEvent.ROLL_OUT, map_rollOutHandler); m_drawEndFunction = data.handler; m_drawUpdateFunction = data.handler2; m_navTool.deactivate(); m_drawTool.activate(tool, enableGraphicsLayerMouseEvents); // showDrawTips m_drawTool.showDrawTips = showDrawTips; // reset symbology m_drawTool.markerSymbol = new SimpleMarkerSymbol; m_drawTool.lineSymbol = new SimpleLineSymbol; m_drawTool.fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, 0, 0.5, new SimpleLineSymbol); if (symbol) { if (symbol is TextSymbol || symbol is SimpleMarkerSymbol || symbol is PictureMarkerSymbol) { m_drawTool.markerSymbol = symbol; } else if (symbol is SimpleLineSymbol) { m_drawTool.lineSymbol = symbol; } else if (symbol is SimpleFillSymbol) { m_drawTool.fillSymbol = symbol; } } //map.zoomSliderVisible = true; AppEvent.setStatus(status); } else { map.removeEventListener(MapMouseEvent.MAP_CLICK, onMouseClick); m_drawTool.deactivate(); restoreNavigation(); } }
private function sharedDataUpdated(event:AppEvent):void { var data:Object = event.data; if (data.key == "Deactivate_DrawTool"){ map.removeEventListener(MapMouseEvent.MAP_CLICK, onMouseClick); setMapAction(null, null, null, null); if (selectedDrawingIcon){ selectedDrawingIcon.filters = []; selectedDrawingIcon = null; } } }
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.