反编译 DynamicPlot 的源代码 可能有很多人想要 不过运行有点问题 有能力就解决了 重新发布一下
package com.esrichina.tm.plot { import com.esri.ags.Graphic; import com.esri.ags.Map; import com.esri.ags.events.MapMouseEvent; import com.esri.ags.geometry.MapPoint; import com.esri.ags.geometry.Polygon; import com.esri.ags.geometry.Polyline; import com.esri.ags.layers.GraphicsLayer; import com.esri.ags.symbol.InfoSymbol; import com.esri.ags.symbol.SimpleFillSymbol; import com.esri.ags.symbol.SimpleLineSymbol; import com.esri.ags.symbol.SimpleMarkerSymbol; import com.esri.ags.symbol.Symbol; import com.esri.ags.tasks.FeatureSet; import com.esri.ags.tasks.GeometryService; import flash.display.Shape; import flash.events.MouseEvent; import flash.events.TimerEvent; import flash.geom.Point; import flash.system.System; import flash.utils.Timer; import mx.binding.utils.ChangeWatcher; import mx.controls.Alert; import mx.core.UIComponent; import mx.effects.Zoom; import mx.events.PropertyChangeEvent; import mx.managers.DragManager; import mx.rpc.AsyncResponder; public class DynamicPlot2 extends BaseToolBar { public static const BASE:String="BASE"; public static const CHOOSE:String="CHOOSE"; public static const CIRCLE:String="CRICLE"; public static const Clear:String="Clear"; public static const LARROW:String="LARROW"; public static const PROPEDIT:String="PROPEDIT"; public static const SARROW:String="SARROW"; public static const strcl:String="动态标绘--"; public static const XARROWS:String="XARROWS"; private static const FORMAT:String="Map"; public var hightLineSymbol:Symbol; public var hightPointSymbol:Symbol; public var markerSymbol:Symbol; public var obj:Object; private var _1354750946coords:Array; private var _3059471comp:mx.core.UIComponent; private var _708402683control_points:Array; private var _906467582clicknum:Number=0; private var _active:Boolean; private var _geometryservices:com.esri.ags.tasks.GeometryService; private var _graphicsLayer:com.esri.ags.layers.GraphicsLayer; private var _text_symbol:InfoSymbol; private var choosetool:ChooseTool; private var circle_center_symbol:SimpleMarkerSymbol; private var delete_graphic:com.esri.ags.Graphic; private var displayCenter:Boolean; private var displayRadius:Boolean; private var fillSymbol:Symbol; private var graphic:com.esri.ags.Graphic; private var hightlight_graphic:com.esri.ags.Graphic; private var hightLSymbol:Symbol; private var isdoubleclick:Boolean; private var lineSymbol:Symbol; private var m_center:com.esri.ags.geometry.MapPoint; private var m_drawType:String; private var m_point:com.esri.ags.geometry.MapPoint; private var m_radius:Number; private var numberOfCirclePoints:int=100; private var polygon:com.esri.ags.geometry.Polygon; private var polyline:com.esri.ags.geometry.Polyline; private var startp:Point; private var sum_points:Array; private var t: Timer; private var watcher1: ChangeWatcher; private var watcher2: ChangeWatcher; private var xoffset:Number; private var yoffset:Number; private var zoom: Zoom; public function DynamicPlot2(map: Map) { circle_center_symbol=new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CROSS, 8, 16711935, 0.5); _1354750946coords=new Array(); _3059471comp=new mx.core.UIComponent(); _708402683control_points=new Array(); sum_points=new Array(); startp=new Point(); fillSymbol=new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, 16711680, 0.5); hightLSymbol=new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, 16711680, 0.1); hightLineSymbol=new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, 16711680, 1, 8); hightPointSymbol=new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 10, 16711680, 1); lineSymbol=new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, 16711680, 0.5); hightlight_graphic=new com.esri.ags.Graphic(); t=new flash.utils.Timer(500); choosetool=new ChooseTool(); super(map); } public function activate(drawType:String, enableGraphicsLayerMouseEvents:Boolean=true):void { if (!(map != null)) { throw new Error('地图在这个标绘类中没有定义!'); } if (!(graphicsLayer != null)) { throw new Error('临时层在这个标绘类中没有定义!'); } if (!_active) { deactivateMapTools(true, false, false, true); _active=true; } if (!(watcher1 == null)) { watcher1.unwatch(); watcher2.unwatch(); } choosetool.visible=false; map.panEnabled=false; map.rubberbandZoomEnabled=true; map.openHandCursorVisible=false; map.mapNavigationEnabled=enableGraphicsLayerMouseEvents; m_drawType=drawType; var local0:*=drawType; if (LARROW !== local0) { if (CIRCLE !== local0) { if (SARROW !== local0) { if (XARROWS !== local0) { if (BASE !== local0) { if (CHOOSE !== local0) { if (PROPEDIT !== local0) { if (Clear !== local0) { return; } else { map.addEventListener(com.esri.ags.events.MapMouseEvent.MAP_CLICK, map_mapmouseClickHandler); } } else { edit_mouseMapClickHandler(); } } else { map.addEventListener(com.esri.ags.events.MapMouseEvent.MAP_CLICK, map_mapmouseClickHandler); } } else { map.addEventListener(flash.events.MouseEvent.MOUSE_DOWN, map_mouseDownHandler); } } else { initializeXARROW(); } } else { initializeSARROW(); } } else { map.addEventListener(flash.events.MouseEvent.MOUSE_DOWN, map_mouseDownHandler); } } else { initializeLARROR(); } initializeLARROR(); } public function deactivate():void { if (!(map != null)) { throw new Error('地图在这个标绘类中没有定义!'); } _active=false; map.removeEventListener(flash.events.MouseEvent.CLICK, map_mouseClickHandler); map.removeEventListener(flash.events.MouseEvent.MOUSE_DOWN, map_mouseDownHandler); map.removeEventListener(com.esri.ags.events.MapMouseEvent.MAP_CLICK, map_mapmouseClickHandler); activateMapTools(true, false, false, true); } private function clear_mouseMapClickHandler(event: MapMouseEvent):void { var graphic1:com.esri.ags.Graphic=null; var geometry1:com.esri.ags.geometry.Geometry=null; var mapPoint1:com.esri.ags.geometry.MapPoint=null; var extent1:com.esri.ags.geometry.Extent=null; this.dispatchEvent(new com.esrichina.tm.plot.PlotDrawEvent(com.esrichina.tm.plot.PlotDrawEvent.PLOT_DRAW_START, graphic)); map.removeEventListener(com.esri.ags.events.MapMouseEvent.MAP_CLICK, map_mapmouseClickHandler); var mapPoint2:com.esri.ags.geometry.MapPoint=event.mapPoint; var array1:Array=new Array(new com.esri.ags.Graphic(mapPoint2, new SimpleMarkerSymbol())); var array2:Array=new Array(); var int1:int=0; while (int1 < graphicsLayer.numChildren) { graphic1=com.esri.ags.Graphic(graphicsLayer.getChildAt(int1)); geometry1=graphic1.geometry; geometry1.spatialReference=map.spatialReference; array2.splice(0); array2.push(graphic1); if (com.esri.ags.geometry.Geometry.POLYGON !== geometry1.type) { if (com.esri.ags.geometry.Geometry.EXTENT !== geometry1.type) { if (com.esri.ags.geometry.Geometry.MAPPOINT !== geometry1.type) { if (!(com.esri.ags.geometry.Geometry.POLYLINE !== geometry1.type)) { geometryservices.relation(array1, array2, GeometryService.SPATIAL_REL_WITHIN, null, new AsyncResponder(onResult, onFault)); delete_graphic=graphic1; } } else { mapPoint1=com.esri.ags.geometry.MapPoint(graphic1.geometry); extent1=new com.esri.ags.geometry.Extent(mapPoint1.x - 20, mapPoint1.y - 20, mapPoint1.x + 20, mapPoint1.y + 20); if (extent1.contains(mapPoint2)) { hightLight(graphic1); } } } else { if (graphic1.geometry.extent.contains(mapPoint2)) { hightLight(graphic1); } } } else { geometryservices.relation(array1, array2, com.esri.ags.tasks.GeometryService.SPATIAL_REL_WITHIN, null, new mx.rpc.AsyncResponder(onResult, onFault)); delete_graphic=graphic1; } int1=int(int1) + 1; } if (hightlight_graphic.geometry.extent.contains(mapPoint2)) { graphicsLayer.remove(hightlight_graphic); t.stop(); } this.dispatchEvent(new com.esrichina.tm.plot.PlotDrawEvent(com.esrichina.tm.plot.PlotDrawEvent.PLOT_DRAW_START, graphic)); map.addEventListener(com.esri.ags.events.MapMouseEvent.MAP_CLICK, map_mapmouseClickHandler); } private function onResult(featureset:FeatureSet, token:Object):void { if (featureset.attributes.length > 0) { graphicsLayer.remove(delete_graphic); } } private function onFault(info:Object, token:Object):void { Alert.show(info.toString(), '判断空间关系出现问题!'); } private function hightLight(g:com.esri.ags.Graphic):void { if (graphicsLayer.contains(hightlight_graphic)) { graphicsLayer.remove(hightlight_graphic); } hightlight_graphic.geometry=g.geometry; var toString1:String=g.geometry.type.toString(); if (com.esri.ags.geometry.Geometry.EXTENT !== toString1) { if (com.esri.ags.geometry.Geometry.MAPPOINT !== toString1) { if (com.esri.ags.geometry.Geometry.POLYGON !== toString1) { if (!(com.esri.ags.geometry.Geometry.POLYLINE !== toString1)) { hightlight_graphic.symbol=hightLineSymbol; } } else { hightlight_graphic.symbol=hightLSymbol; SimpleFillSymbol(hightLSymbol).outline=SimpleLineSymbol(hightLineSymbol); } } else { hightlight_graphic.symbol=hightPointSymbol; } } else { hightlight_graphic.symbol=hightLSymbol; SimpleFillSymbol(hightLSymbol).outline=SimpleLineSymbol(hightLineSymbol); } graphicsLayer.add(hightlight_graphic); t.addEventListener(flash.events.TimerEvent.TIMER, addGraphic); t.start(); } private function addGraphic(event: TimerEvent):void { var number1:Number=flash.utils.Timer(event.target).currentCount; if (number1 % 2 != 0) { if (graphicsLayer.contains(hightlight_graphic)) { graphicsLayer.remove(hightlight_graphic); } } else { if (!(!(graphicsLayer.contains(hightlight_graphic)))) { graphicsLayer.add(hightlight_graphic); } } } private function map_mapmouseClickHandler(event:com.esri.ags.events.MapMouseEvent):void { var local0:*=m_drawType; if (CHOOSE !== local0) { if (!(Clear !== local0)) { clear_mouseMapClickHandler(event); } } else { choose_mouseMapClickHandler(event); } } private function choose_mouseMapClickHandler(event:com.esri.ags.events.MapMouseEvent):void { var graphic1:com.esri.ags.Graphic=null; var mapPoint1:com.esri.ags.geometry.MapPoint=null; var extent1:com.esri.ags.geometry.Extent=null; this.dispatchEvent(new com.esrichina.tm.plot.PlotDrawEvent(com.esrichina.tm.plot.PlotDrawEvent.PLOT_DRAW_START, hightlight_graphic)); map.removeEventListener(com.esri.ags.events.MapMouseEvent.MAP_CLICK, map_mapmouseClickHandler); var mapPoint2:com.esri.ags.geometry.MapPoint=event.mapPoint; if (graphicsLayer.contains(hightlight_graphic)) { graphicsLayer.remove(hightlight_graphic); } var number1:Number=graphicsLayer.numGraphics; var spatialReference1:com.esri.ags.SpatialReference=map.spatialReference; var array1:Array=new Array(); array1.push(new com.esri.ags.Graphic(mapPoint2, new SimpleMarkerSymbol())); var array2:Array=new Array(); var number2:Number=0; while (number2 < number1) { graphic1=com.esri.ags.Graphic(graphicsLayer.getChildAt(number2)); array2.splice(0); graphic1.geometry.spatialReference=spatialReference1; array2.push(graphic1); var toString1:String=graphic1.geometry.type.toString(); if (com.esri.ags.geometry.Geometry.POLYGON !== toString1) { if (com.esri.ags.geometry.Geometry.EXTENT !== toString1) { if (com.esri.ags.geometry.Geometry.MAPPOINT !== toString1) { if (!(com.esri.ags.geometry.Geometry.POLYLINE !== toString1)) { geometryservices.relation(array1, array2, com.esri.ags.tasks.GeometryService.SPATIAL_REL_WITHIN, null, new mx.rpc.AsyncResponder(onHResult, onFault)); delete_graphic=graphic1; } } else { mapPoint1=com.esri.ags.geometry.MapPoint(graphic1.geometry); extent1=new com.esri.ags.geometry.Extent(mapPoint1.x - 20, mapPoint1.y - 20, mapPoint1.x + 20, mapPoint1.y + 20); if (extent1.contains(mapPoint2)) { hightLight(graphic1); } } } else { if (graphic1.geometry.extent.contains(mapPoint2)) { hightLight(graphic1); } } } else { geometryservices.relation(array1, array2, com.esri.ags.tasks.GeometryService.SPATIAL_REL_WITHIN, null, new mx.rpc.AsyncResponder(onHResult, onFault)); delete_graphic=graphic1; } number2=number2 + 1; } this.dispatchEvent(new com.esrichina.tm.plot.PlotDrawEvent(com.esrichina.tm.plot.PlotDrawEvent.PLOT_DRAW_END, hightlight_graphic)); map.addEventListener(com.esri.ags.events.MapMouseEvent.MAP_CLICK, map_mapmouseClickHandler); } private function onHResult(featureset:FeatureSet, token:Object):void { if(featureset.attributes.length > 0) { hightLight(delete_graphic); } } private function initializeLARROR():void { map.addChild(comp); coords.splice(0); clicknum=0; map.addEventListener(flash.events.MouseEvent.CLICK, map_mouseClickHandler); } private function initializeSARROW():void { map.addChild(comp); coords.splice(0); clicknum=0; map.addEventListener(flash.events.MouseEvent.CLICK, map_mouseClickHandler); } private function initializeXARROW():void { map.useHandCursor=false; map.addChild(comp); coords.splice(0); sum_points.splice(0); clicknum=0; map.addEventListener(flash.events.MouseEvent.CLICK, map_mouseClickHandler); } private function map_mouseClickHandler(event:MouseEvent):void { var local0:*=m_drawType; if (LARROW !== local0) { if (SARROW !== local0) { if (!(XARROWS !== local0)) { xarrows_mouseClickHandler(event); } } else { sarrow_mouseClickHandler(event); } } else { larrow_mouseClickHandler(event); } } private function larrow_mouseClickHandler(event:MouseEvent):void { if (!(!(map.hasEventListener(MouseEvent.MOUSE_MOVE)))) { map.addEventListener(MouseEvent.MOUSE_MOVE, larrow_mouseMoveHandler); } if (!(!(map.hasEventListener(MouseEvent.DOUBLE_CLICK)))) { map.addEventListener(MouseEvent.DOUBLE_CLICK, larrow_mouseDoubleClickHandler); } this.dispatchEvent(new PlotDrawEvent(PlotDrawEvent.PLOT_DRAW_START, graphic)); var number1:Number=event.stageX; var number2:Number=event.stageY; number1=number1 - map.x; number2=number2 - map.y; coords.push(new Point(number1, number2)); } private function changMapGraphic(comp:mx.core.UIComponent, st_screenpoint:Point, type:String):void { var shape1: Shape=null; var array1:Array=null; var array2:Array=null; var polyline1:com.esri.ags.geometry.Polyline=null; var local6:*=NaN; var mapPoint1:com.esri.ags.geometry.MapPoint=null; var mapPoint2:com.esri.ags.geometry.MapPoint=null; var mapPoint3:com.esri.ags.geometry.MapPoint=null; var array3:Array=null; var array4:Array=null; var mapPoint4:com.esri.ags.geometry.MapPoint=null; var array5:Array=null; var number1:Number=comp.numChildren; if (number1 != 0) { var number2:Number=0; while (number2 < number1) { shape1=flash.display.Shape(comp.getChildAt(number2)); if (shape1 is ScreenPolyline) { array1=ScreenPolyline(shape1).getPoints(); array2=changeScreenToMap(array1, map); polyline1=new Polyline(); if (type != 'LARROW') { polyline1.addPath(array2); } else { local6=array2.length; mapPoint1=array2[local6 - 3]; mapPoint2=array2[local6 - 2]; mapPoint3=array2[local6 - 1]; array2.splice(local6 - 2, 2); polyline1.addPath(array2); polyline1.addPath([mapPoint1, mapPoint2]); polyline1.addPath([mapPoint1, mapPoint3]); } graphic=new com.esri.ags.Graphic(polyline1, lineSymbol); graphicsLayer.add(graphic); if (type != LARROW) { graphic.toolTip=''; } else { graphic.toolTip='larrow'; } this.dispatchEvent(new PlotDrawEvent('drawEnd', graphic)); } else if (shape1 is ScreenCurves) { array3=ScreenCurves(shape1).points; array4=changeScreenToMap(array3, map); mapPoint4=changeScreenTOMap(st_screenpoint, map); array5=new Array(); array4.push(mapPoint4); array5.push(array4); if (SARROW != ScreenCurves(shape1).type_arrow) { if (!(XARROWS != ScreenCurves(shape1).type_arrow)) { polygon=new Polygon(array5); graphic=new Graphic(polygon, fillSymbol); graphic.toolTip='xarrows'; graphicsLayer.add(graphic); this.dispatchEvent(new PlotDrawEvent('drawEnd', graphic)); } } else { polygon=new com.esri.ags.geometry.Polygon(array5); graphic=new com.esri.ags.Graphic(polygon, fillSymbol); graphic.toolTip='sarrow'; graphicsLayer.add(graphic); this.dispatchEvent(new PlotDrawEvent('drawEnd', graphic)); } } number2=number2 + 1; } while (comp.numChildren > 0) { comp.removeChildAt(0); System.gc(); } } else { return; } } private function changeScreenToMap(_screenpoints:Array, map:com.esri.ags.Map):Array { var point1:Point=null; var mapPoint1:com.esri.ags.geometry.MapPoint=null; var array1:Array=new Array(); var number1:Number=0; while (number1 < _screenpoints.length) { point1=Point(_screenpoints[number1]); mapPoint1=map.toMap(point1); array1.push(mapPoint1); number1=number1 + 1; } return array1; } private function changeScreenTOMap(st_point:Point, map: Map): MapPoint { if (Boolean(null == map)) { return null; } else { if (Boolean(null == st_point)) { return null; } else { return map.toMap(st_point); } } } private function larrow_mouseDoubleClickHandler(event:MouseEvent):void { if (Boolean(map.contains(comp))) { if (!(Boolean(!(0 == comp.numChildren)))) { changMapGraphic(comp, coords[0], LARROW); } } else { changMapGraphic(comp, coords[0], LARROW); } map.removeEventListener(MouseEvent.MOUSE_MOVE, larrow_mouseMoveHandler); map.removeEventListener(MouseEvent.CLICK, map_mouseClickHandler); map.removeEventListener(MouseEvent.DOUBLE_CLICK, larrow_mouseDoubleClickHandler); this.dispatchEvent(new PlotDrawEvent(PlotDrawEvent.PLOT_DRAW_END, graphic)); initializeLARROR(); } private function larrow_mouseMoveHandler(event:MouseEvent):void { var shape1:flash.display.Shape=null; if (clicknum <= 0) { return; } else { var number1:Number=event.stageX; var number2:Number=event.stageY; number1=number1 - map.x; number2=number2 - map.y; var number3:Number=comp.numChildren; var screenPolyline1:ScreenPolyline=new ScreenPolyline(); screenPolyline1.graphics.lineStyle(2, 13909462, 1); var point1:Point=Point(coords[clicknum - 1]); screenPolyline1.name=(ScreenPolyline.type_shape + (point1.x.toString())) + (point1.y.toString()); if (!(number3 == 0)) { shape1=flash.display.Shape(comp.getChildAt(number3 - 1)); if (!(shape1.name != screenPolyline1.name)) { comp.removeChild(shape1); } } var point2:Point=new Point(number1, number2); var number4:Number=getDIS(point1, point2); var point3:Point=getThreePoint(point2, point1, Math.PI / 6, number4 / 10, 'right'); var point4:Point=getThreePoint(point2, point1, Math.PI / 6, number4 / 10, 'left'); var array1:Array=new Array(); array1=array1.concat(coords); array1.push(point2); array1.push(point3); array1.push(point4); screenPolyline1.points=array1; screenPolyline1.drawJianTou(); comp.addChild(screenPolyline1); } } private function getThreePoint(st_point:Point, end_point:Point, angle:Number, d:Number, direction:String):Point { var number1:Number=end_point.x; var number2:Number=end_point.y; var number3:Number=st_point.x; var number4:Number=st_point.y; var number5:Number=Math.atan((number2 - number4) / (number1 - number3)); var number6:Number=0; var number7:Number=0; if ('left' != direction) { if (!('right' != direction)) { number8=Math.PI + number8; if (number1 < number3) { number6=number3 + (d * (Math.cos(number5 + number8))); number7=number4 + (d * (Math.sin(number5 + number8))); } else if (number1 >= number3) { number6=number3 - (d * (Math.cos(number5 + number8))); number7=number4 - (d * (Math.sin(number5 + number8))); } } } else { var number8:Number=Math.PI - angle; if (number1 < number3) { number6=number3 + (d * (Math.cos(number5 + number8))); number7=number4 + (d * (Math.sin(number5 + number8))); } else if (number1 >= number3) { number6=number3 - (d * (Math.cos(number5 + number8))); number7=number4 - (d * (Math.sin(number5 + number8))); } } return new Point(number6, number7); } private function getAngle(startpoint:Point, sencodpoint:Point, endpoint:Point):Number { var local0:*=NaN; var number1:Number=(startpoint.y - sencodpoint.y) / (startpoint.x / sencodpoint.x); var number2:Number=(sencodpoint.y - endpoint.y) / (sencodpoint.x - endpoint.x); local0=(Math.atan(number2)) - (Math.atan(number1)); return local0; } private function getDIS(startp:Point, endp:Point):Number { var number1:Number=0; number1=Math.sqrt((Math.pow(endp.x - startp.x, 2)) + (Math.pow(endp.y - startp.y, 2))); return number1; } private function drawMiddleCurves(mx:Number, my:Number):Array { var point1:Point=getMiddlePoint(coords[0], coords[1]); var array1:Array=new Array(); array1.push(point1); var number1:Number=2; while (number1 < coords.length) { array1.push(coords[number1]); number1=number1 + 1; } array1.push(new Point(mx, my)); var array2:Array=makeMiddlePoints(array1, coords[0], coords[1]); return array2; } private function makeMiddlePoints(click_points:Array, st_point:Point, end_point:Point):Array { var number1:Number=click_points.length; var boolean1:Boolean=true; if (!(number1 % 2 != 0)) { boolean1=false; } var array1:Array=new Array(); var number2:Number=(getDIS(st_point, end_point)) / 2; var array2:Array=getzz_geometry(click_points, boolean1); array1=drawLRCurves(array2, number2, st_point, end_point); return array1; } private function drawLRCurves(curvepoints:Array, dis:Number, st_point:Point, end_point:Point):Array { var point1:Point=null; var local13:*=NaN; var local14:*=NaN; var point2:Point=null; var local16:*=NaN; var local17:*=NaN; var local18:*=NaN; var local19:*=NaN; var local20:*=NaN; var local21:*=NaN; var local22:*=NaN; var local23:*=NaN; var point3:Point=null; var local25:*=NaN; var local26:*=NaN; var point4:Point=null; var array1:Array=new Array(); var array2:Array=new Array(); var number1:Number=st_point.x; var number2:Number=end_point.x; var number3:Number=st_point.y; var number4:Number=end_point.y; array1.push(st_point); var number5:Number=curvepoints.length; var number6:Number=1; while (number6 < number5 - 3) { point1=curvepoints[number6]; local13=point1.x; local14=point1.y; point2=curvepoints[number6 - 1]; local16=point2.x; local17=point2.y; local18=(local14 - local17) / (local13 - local16); local19=dis * (1 - ((number6 / number5) * 0.9)); local20=Math.cos((Math.atan(local18)) - (Math.PI / 2)); local21=Math.sin((Math.atan(local18)) - (Math.PI / 2)); local22=0; local23=0; if (Boolean(local16 <= local13)) { if (Boolean(local17 <= local14)) { if (local19 * local20 < 0) { local22=local16 + ((-local19) * local20); } else { local22=local16 + (local19 * local20); } if (local19 * local21 < 0) { local23=local17 - ((-local19) * local21); } else { local23=local17 - (local19 * local21); } } else { if (Boolean(local16 >= local13)) { if (Boolean(local17 >= local14)) { if (local19 * local20 < 0) { local22=local16 - ((-local19) * local20); } else { local22=local16 - (local19 * local20); } if (local19 * local21 < 0) { local23=local17 + ((-local19) * local21); } else { local23=local17 + (local19 * local21); } } } else if (local19 * local20 < 0) { local22=local16 - ((-local19) * local20); } else { local22=local16 - (local19 * local20); } if (local19 * local21 < 0) { local23=local17 + ((-local19) * local21); } else { local23=local17 + (local19 * local21); } } } else if (local19 * local20 < 0) { local22=local16 + ((-local19) * local20); } else { local22=local16 + (local19 * local20); } if (local19 * local21 < 0) { local23=local17 - ((-local19) * local21); } else { local23=local17 - (local19 * local21); } point3=new Point(local22, local23); array1.push(point3); if (Boolean(local16 <= local13)) { if (Boolean(local17 <= local14)) { local25=local16 - ((-local19) * local20); local26=local17 + ((-local19) * local21); } else { if (Boolean(local17 > local14)) { local25=local16 + ((-local19) * local20); local26=local17 + ((-local19) * local21); } else { if (Boolean(local16 >= local13)) { if (Boolean(local17 >= local14)) { local25=local16 + ((-local19) * local20); local26=local17 - ((-local19) * local21); } } else { local25=local16 + ((-local19) * local20); local26=local17 - ((-local19) * local21); } } } } else if (local19 * local20 < 0) { local25=local16 - ((-local19) * local20); } else { local25=local16 - (local19 * local20); } if (local19 * local21 < 0) { local26=local17 + ((-local19) * local21); } else { local26=local17 + (local19 * local21); } point4=new Point(local25, local26); array2.push(point4); number6=number6 + 1; } var point5:Point=sarrowALG(curvepoints[curvepoints.length - 1], array1[array1.length - 2], 'right'); var point6:Point=sarrowALG(curvepoints[curvepoints.length - 1], array2[array2.length - 2], 'left'); array1.push(point5); array1.push(curvepoints[curvepoints.length - 1]); array1.push(point6); var number7:Number=array2.length; var number8:Number=number7 - 1; while (number8 > 0) { array1.push(array2[number8]); number8=number8 - 1; } array1.push(st_point); return array1; } private function sarrowALG(st_point:Point, end_point:Point, direction:String):Point { var array1:Array=new Array(); var number1:Number=Math.PI / 12; var number2:Number=Math.PI / 6; var number3:Number=((getDIS(st_point, end_point)) * 4) / 5; var number4:Number=(number3 * (Math.cos(number1))) + ((number3 * (Math.sin(number1))) / (Math.tan(number2))); var point1:Point=getThreePoint(st_point, end_point, number1, number4, direction); return point1; } private function getzz_geometry(clickarray:Array, jishu:Boolean):Array { var local2:*=0; var local3:*=NaN; var local4:*=NaN; var local5:*=NaN; var point1:Point=null; var point2:Point=null; var point3:Point=null; var point4:Point=null; var point5:Point=null; var local11:*=NaN; var array1:Array=new Array(); var number1:Number=clickarray.length; if (number1 < 3) { mx.controls.Alert.show('你选取的点击数少于3个', 'ERROR TIP'); return null; } else { if (jishu) { local2=0; while (local2 < clickarray.length - 2) { local3=0; while (local3 <= 1) { if (!(Boolean(!(0 == local2)))) { if (!(Boolean(0 == local3))) { local4=(((Math.pow(1 - local3, 2)) * (clickarray[local2].x)) + (((2 * local3) * (1 - local3)) * (clickarray[local2 + 1].x))) + ((Math.pow(local3, 2)) * (clickarray[local2 + 2].x)); local5=(((Math.pow(1 - local3, 2)) * (clickarray[local2].y)) + (((2 * local3) * (1 - local3)) * (clickarray[local2 + 1].y))) + ((Math.pow(local3, 2)) * (clickarray[local2 + 2].y)); point1=new Point(local4, local5); array1.push(point1); } } local3=local3 + 0.025; } local2=local2 + 2; } } if (!jishu) { if (number1 >= 6) { local2=0; while (local2 < clickarray.length - 5) { local3=0; while (local3 <= 1) { if (!(Boolean(!(0 == local2)))) { if (!(Boolean(0 == local3))) { local4=(((Math.pow(1 - local3, 2)) * (clickarray[local2].x)) + (((2 * local3) * (1 - local3)) * (clickarray[local2 + 1].x))) + ((Math.pow(local3, 2)) * (clickarray[local2 + 2].x)); local5=(((Math.pow(1 - local3, 2)) * (clickarray[local2].y)) + (((2 * local3) * (1 - local3)) * (clickarray[local2 + 1].y))) + ((Math.pow(local3, 2)) * (clickarray[local2 + 2].y)); point1=new Point(local4, local5); array1.push(point1); } } local3=local3 + 0.025; } local2=local2 + 2; } point2=clickarray[number1 - 4]; point3=clickarray[number1 - 3]; point4=clickarray[number1 - 2]; point5=clickarray[number1 - 1]; local11=0; while (local11 < 1) { if (local11 != 0) { local4=(((point2.x * (Math.pow(1 - local11, 3))) + (((3 * point3.x) * local11) * (Math.pow(1 - local11, 2)))) + (((3 * point4.x) * (Math.pow(local11, 2))) * (1 - local11))) + (point5.x * (Math.pow(local11, 3))); local5=(((point2.y * (Math.pow(1 - local11, 3))) + (((3 * point3.y) * local11) * (Math.pow(1 - local11, 2)))) + (((3 * point4.y) * (Math.pow(local11, 2))) * (1 - local11))) + (point5.y * (Math.pow(local11, 3))); point1=new Point(local4, local5); array1.push(point1); } local11=local11 + 0.025; } } else { point2=clickarray[0]; point3=clickarray[1]; point4=clickarray[2]; point5=clickarray[3]; local11=0; while (local11 < 1) { local4=(((point2.x * (Math.pow(1 - local11, 3))) + (((3 * point3.x) * local11) * (Math.pow(1 - local11, 2)))) + (((3 * point4.x) * (Math.pow(local11, 2))) * (1 - local11))) + (point5.x * (Math.pow(local11, 3))); local5=(((point2.y * (Math.pow(1 - local11, 3))) + (((3 * point3.y) * local11) * (Math.pow(1 - local11, 2)))) + (((3 * point4.y) * (Math.pow(local11, 2))) * (1 - local11))) + (point5.y * (Math.pow(local11, 3))); point1=new Point(local4, local5); array1.push(point1); local11=local11 + 0.025; } } } return array1; } } private function getMiddlePoint(st_point:Point, end_point:Point):Point { var point1:Point=new Point((end_point.x + st_point.x) / 2, (end_point.y + st_point.y) / 2); return point1; } private function getMidnormal(st_point:Point, end_point:Point):Point { var point1:Point=new Point(); var number1:Number=end_point.x; var number2:Number=(end_point.y - st_point.y) / (end_point.x - st_point.x); var number3:Number=(((-1) * (1 / number2)) * (number1 - ((st_point.x + end_point.x) / 2))) + ((st_point.y + end_point.y) / 2); return new Point(number1, number3); } private function getHeanGBJ(st_point:Point, middle_point:Point, end_point:Point):Array { var point1:Point=null; var point2:Point=null; var array1:Array=new Array(); var number1:Number=getDIS(st_point, end_point); var number2:Number=number1 / 6; var number3:Number=number1 / 5; var number4:Number=Math.PI / 12; var number5:Number=Math.PI / 6; var number6:Number=(((Math.tan(number4)) * number3) / ((Math.tan(number4)) + (Math.tan(number5)))) / (Math.cos(number5)); var point3:Point=new Point(); var point4:Point=new Point(); var point5:Point=new Point(); var point6:Point=new Point(); var point7:Point=new Point(); var point8:Point=new Point(); var point9:Point=new Point(); point3=getThreePoint(st_point, end_point, Math.PI / 2, number2, 'left'); point4=getThreePoint(st_point, end_point, Math.PI / 2, number2, 'right'); if (middle_point != null) { number1=(getDIS(st_point, middle_point)) + ((getDIS(middle_point, end_point)) / 2); number2=number1 / 6; number3=number1 / 5; number6=(((Math.tan(number4)) * number3) / ((Math.tan(number4)) + (Math.tan(number5)))) / (Math.cos(number5)); point1=getThreePoint(middle_point, end_point, Math.PI / 2, number2, 'left'); point2=getThreePoint(middle_point, end_point, Math.PI / 2, number2, 'right'); point5=getThreePoint(end_point, point1, number4, number3, 'right'); point6=getThreePoint(point5, end_point, number5, number6, 'right'); point8=getThreePoint(end_point, point2, number4, number3, 'left'); point9=getThreePoint(point8, end_point, number5, number6, 'left'); } else { point5=getThreePoint(end_point, point3, number4, number3, 'right'); point6=getThreePoint(point5, end_point, number5, number6, 'right'); point8=getThreePoint(end_point, point4, number4, number3, 'left'); point9=getThreePoint(point8, end_point, number5, number6, 'left'); } array1.push(point3); array1.push(point6); array1.push(point5); array1.push(end_point); array1.push(point8); array1.push(point9); array1.push(point4); return array1; } private function useFourBezier(st_1_p:Point, st_2_p:Point, st_3_p:Point, st_4_p:Point):Array { var local2:*=NaN; var local3:*=NaN; var point1:Point=null; var array1:Array=new Array(); var number1:Number=0; while (number1 < 1) { local2=(((st_1_p.x * (Math.pow(1 - number1, 3))) + (((3 * st_2_p.x) * number1) * (Math.pow(1 - number1, 2)))) + (((3 * st_3_p.x) * (Math.pow(number1, 2))) * (1 - number1))) + (st_4_p.x * (Math.pow(number1, 3))); local3=(((st_1_p.y * (Math.pow(1 - number1, 3))) + (((3 * st_2_p.y) * number1) * (Math.pow(1 - number1, 2)))) + (((3 * st_3_p.y) * (Math.pow(number1, 2))) * (1 - number1))) + (st_4_p.y * (Math.pow(number1, 3))); point1=new Point(local2, local3); array1.push(point1); number1=number1 + 0.05; } return array1; } private function drawDMiddleCurves(dx:Number, dy:Number):Array { var local4:*=NaN; var local5:*=NaN; var point1:Point=new Point(dx, dy); var point2:Point=getMiddlePoint(coords[0], coords[1]); var array1:Array=getHeanGBJ(point2, null, point1); var array2:Array=new Array(); if (point2.y >= point1.y) { array2.push(coords[0]); local4=1; while (local4 < array1.length - 1) { array2.push(array1[local4]); local4=local4 + 1; } array2.push(coords[1]); array2.push(coords[0]); } else { array2.push(coords[0]); local5=1; while (local5 < array1.length - 1) { array2.push(array1[(array1.length - 1) - local5]); local5=local5 + 1; } array2.push(coords[1]); array2.push(coords[0]); } return array2; } private function drawXMiddleCurves(dx:Number, dy:Number):Array { var array1:Array=new Array(); var point1:Point=coords[0]; var point2:Point=new Point(dx, dy); var array2:Array=getHeanGBJ(point1, coords[1], point2); var point3:Point=array2[0]; var point4:Point=array2[1]; var point5:Point=array2[2]; var point6:Point=array2[4]; var point7:Point=array2[5]; var point8:Point=array2[6]; var point9:Point=coords[1]; var array3:Array=usebezier(point3, point9, point4); var array4:Array=usebezier(point7, point9, point8); array1.push(point1); var number1:Number=0; while (number1 < array3.length) { array1.push(array3[number1]); number1=number1 + 1; } array1.push(point4); array1.push(point5); array1.push(point2); array1.push(point6); array1.push(point7); var number2:Number=0; while (number2 < array4.length) { array1.push(array4[number2]); number2=number2 + 1; } array1.push(point1); return array1; } private function sarrow_mouseMoveHandler(event:MouseEvent):void { var screenPolyline1:ScreenPolyline=null; var point1:Point=null; var array1:Array=null; var shape1:flash.display.Shape=null; var array2:Array=null; var screenCurves1:ScreenCurves=null; if (clicknum <= 0) { return; } else { var number1:Number=event.stageX; var number2:Number=event.stageY; number1=number1 - map.x; number2=number2 - map.y; var number3:Number=comp.numChildren; if (clicknum != 1) { if (clicknum != 2) { if (clicknum > 2) { array2=drawMiddleCurves(number1, number2); screenCurves1=new ScreenCurves(array2); screenCurves1.type_arrow=SARROW; screenCurves1.name=(ScreenCurves.type_shape + (array2[0].x.toString())) + (array2[0].y.toString()); if (!(number3 == 0)) { shape1=flash.display.Shape(comp.getChildAt(number3 - 1)); if (!(shape1.name != screenCurves1.name)) { comp.removeChild(shape1); } } comp.addChild(screenCurves1); } } else { array2=drawDMiddleCurves(number1, number2); screenCurves1=new ScreenCurves(array2); screenCurves1.type_arrow=SARROW; screenCurves1.name=(ScreenCurves.type_shape + (array2[0].x.toString())) + (array2[0].y.toString()); if (!(number3 == 0)) { shape1=flash.display.Shape(comp.getChildAt(number3 - 1)); comp.removeChild(shape1); } comp.addChild(screenCurves1); } } else { screenPolyline1=new ScreenPolyline(); screenPolyline1.graphics.lineStyle(2, 13909462, 1); point1=Point(coords[0]); screenPolyline1.name=(ScreenPolyline.type_shape + (point1.x.toString())) + (point1.y.toString()); if (!(number3 == 0)) { shape1=flash.display.Shape(comp.getChildAt(number3 - 1)); if (!(shape1.name != screenPolyline1.name)) { comp.removeChild(shape1); } } screenPolyline1.graphics.moveTo(point1.x, point1.y); screenPolyline1.graphics.lineTo(number1, number2); array1=[point1, new Point(number1, number2)]; screenPolyline1.setPoints(array1); comp.addChild(screenPolyline1); } } } private function useFiveBezier(st_1_p:Point, st_2_p:Point, st_3_p:Point, st_4_p:Point, st_5_p:Point):Array { var local2:*=NaN; var local3:*=NaN; var point1:Point=null; var array1:Array=new Array(); var number1:Number=0; while (number1 < 1) { local2=((((st_1_p.x * (Math.pow(1 - number1, 4))) + (((4 * st_2_p.x) * number1) * (Math.pow(1 - number1, 3)))) + (((6 * st_3_p.x) * (Math.pow(number1, 2))) * (Math.pow(1 - number1, 2)))) + (((4 * st_4_p.x) * (Math.pow(number1, 3))) * (1 - number1))) + (st_5_p.x * (Math.pow(number1, 4))); local3=((((st_1_p.y * (Math.pow(1 - number1, 4))) + (((4 * st_2_p.y) * number1) * (Math.pow(1 - number1, 3)))) + (((6 * st_3_p.y) * (Math.pow(number1, 2))) * (Math.pow(1 - number1, 2)))) + (((4 * st_4_p.y) * (Math.pow(number1, 3))) * (1 - number1))) + (st_5_p.y * (Math.pow(number1, 4))); point1=new Point(local2, local3); array1.push(point1); number1=number1 + 0.05; } return array1; } private function usebezier(st_point:Point, middle_point:Point, end_point:Point):Array { var local2:*=NaN; var local3:*=NaN; var point1:Point=null; var array1:Array=new Array(); var number1:Number=0; while (number1 <= 1) { local2=(((Math.pow(1 - number1, 2)) * st_point.x) + (((2 * number1) * (1 - number1)) * middle_point.x)) + ((Math.pow(number1, 2)) * end_point.x); local3=(((Math.pow(1 - number1, 2)) * st_point.y) + (((2 * number1) * (1 - number1)) * middle_point.y)) + ((Math.pow(number1, 2)) * end_point.y); point1=new Point(local2, local3); array1.push(point1); number1=number1 + 0.05; } return array1; } private function sarrow_mouseDoubleClickHandler(event:MouseEvent):void { map.removeEventListener(MouseEvent.MOUSE_MOVE, sarrow_mouseMoveHandler); map.removeEventListener(MouseEvent.CLICK, map_mouseClickHandler); map.removeEventListener(MouseEvent.DOUBLE_CLICK, sarrow_mouseDoubleClickHandler); if (Boolean(map.contains(comp))) { if (!(Boolean(!(0 == comp.numChildren)))) { changMapGraphic(comp, coords[0], 'sarrow'); } } else { changMapGraphic(comp, coords[0], 'sarrow'); } this.dispatchEvent(new PlotDrawEvent(PlotDrawEvent.PLOT_DRAW_END, graphic)); initializeSARROW(); } private function sarrow_mouseClickHandler(event:MouseEvent):void { if (!(!(map.hasEventListener(MouseEvent.MOUSE_MOVE)))) { map.addEventListener(MouseEvent.MOUSE_MOVE, sarrow_mouseMoveHandler); } if (!(!(map.hasEventListener(MouseEvent.DOUBLE_CLICK)))) { map.addEventListener(MouseEvent.DOUBLE_CLICK, sarrow_mouseDoubleClickHandler); } this.dispatchEvent(new PlotDrawEvent(PlotDrawEvent.PLOT_DRAW_START, graphic)); var number1:Number=event.stageX; var number2:Number=event.stageY; number1=number1 - map.x; number2=number2 - map.y; var point1:Point=new Point(number1, number2); coords.push(point1); } private function xarrows_mouseMoveHandler(event:MouseEvent):void { var point1:Point=null; var array1:Array=null; var screenCurves1:ScreenCurves=null; var shape1:flash.display.Shape=null; var array2:Array=null; var screenCurves2:ScreenCurves=null; var point2:Point=null; var screenPolyline1:ScreenPolyline=null; var local12:*=NaN; var point3:Point=null; var point4:Point=null; var point5:Point=null; var array3:Array=null; var point6:Point=null; var point7:Point=null; var point8:Point=null; var array4:Array=null; var array5:Array=null; var local22:*=NaN; var local23:*=NaN; var local24:*=NaN; var local25:*=NaN; var point9:Point=null; var point10:Point=null; var array6:Array=null; var array7:Array=null; var local30:*=NaN; if (clicknum <= 0) { return; } else { var number1:Number=event.stageX; var number2:Number=event.stageY; number1=number1 - map.x; number2=number2 - map.y; var number3:Number=comp.numChildren; var point11:Point=new Point(number1, number2); if (!(clicknum != 1)) { point1=Point(coords[0]); array1=getHeanGBJ(point1, null, point11); screenCurves1=new ScreenCurves(array1); screenCurves1.type_arrow=XARROWS; screenCurves1.graphics.lineStyle(2, 13909462, 1); screenCurves1.name=((ScreenCurves.type_shape + point1.x) + ('')) + point1.y; if (!(number3 == 0)) { shape1=flash.display.Shape(comp.getChildAt(number3 - 1)); if (!(shape1.name != screenCurves1.name)) { comp.removeChild(shape1); } } screenCurves1.graphics.moveTo(point1.x, point1.y); screenCurves1.graphics.lineTo(array1[0].x, array1[0].y); screenCurves1.graphics.lineTo(array1[1].x, array1[1].y); screenCurves1.graphics.lineTo(array1[2].x, array1[2].y); screenCurves1.graphics.lineTo(array1[3].x, array1[3].y); screenCurves1.graphics.lineTo(array1[4].x, array1[4].y); screenCurves1.graphics.lineTo(array1[5].x, array1[5].y); screenCurves1.graphics.lineTo(array1[6].x, array1[6].y); screenCurves1.graphics.lineTo(point1.x, point1.y); comp.addChild(screenCurves1); startp=array1[0]; isdoubleclick=false; } if (!(clicknum != 2)) { array2=drawXMiddleCurves(number1, number2); screenCurves2=new ScreenCurves(array2); screenCurves2.type_arrow=XARROWS; screenCurves2.name=(ScreenCurves.type_shape + (array2[0].x.toString())) + (array2[0].y.toString()); shape1=flash.display.Shape(comp.getChildAt(number3 - 1)); comp.removeChild(shape1); comp.addChild(screenCurves2); startp=array2[1]; isdoubleclick=false; } if (clicknum >= 3) { if (clicknum % 3 != 0) { if ((clicknum - 1) % 3 != 0) { if (!((clicknum - 2) % 3 != 0)) { local12=control_points.length; point3=control_points[local12 - 2]; point4=control_points[local12 - 1]; point5=coords[coords.length - 2]; point9=coords[coords.length - 1]; array3=getHeanGBJ(point5, point9, point11); point6=array3[1]; point7=array3[5]; point10=array3[6]; array6=useFiveBezier(point3, point4, point5, point9, point6); array5=new Array(); local22=0; while (local22 < sum_points.length) { array5.push(sum_points[local22]); local22=local22 + 1; } local23=0; while (local23 < array6.length) { array5.push(array6[local23]); local23=local23 + 1; } local24=1; while (local24 < array3.length - 1) { array5.push(array3[local24]); local24=local24 + 1; } array7=usebezier(point7, point9, point10); local30=0; while (local30 < array7.length) { array5.push(array7[local30]); local30=local30 + 1; } screenCurves2=new ScreenCurves(array5); screenCurves2.type_arrow=XARROWS; screenCurves2.name=(ScreenCurves.type_shape + (array5[0].x.toString())) + (array5[0].y.toString()); local25=0; while (local25 < number3) { shape1=flash.display.Shape(comp.getChildAt(0)); comp.removeChild(shape1); local25=local25 + 1; } comp.addChild(screenCurves2); startp=array5[0]; isdoubleclick=false; } } else { local12=control_points.length; point3=control_points[local12 - 2]; point4=control_points[local12 - 1]; point5=coords[coords.length - 1]; array3=getHeanGBJ(point5, null, point11); point6=array3[1]; point7=array3[5]; point8=array3[6]; array4=useFourBezier(point3, point4, point5, point6); array5=new Array(); local22=0; while (local22 < sum_points.length) { array5.push(sum_points[local22]); local22=local22 + 1; } local23=0; while (local23 < array4.length) { array5.push(array4[local23]); local23=local23 + 1; } local24=1; while (local24 < array3.length - 1) { array5.push(array3[local24]); local24=local24 + 1; } array5.push(point8); screenCurves2=new ScreenCurves(array5); screenCurves2.type_arrow=XARROWS; screenCurves2.name=(ScreenCurves.type_shape + (array5[0].x.toString())) + (array5[0].y.toString()); local25=0; while (local25 < number3) { shape1=flash.display.Shape(comp.getChildAt(0)); comp.removeChild(shape1); local25=local25 + 1; } comp.addChild(screenCurves2); startp=array5[0]; isdoubleclick=false; } } else { point2=coords[coords.length - 3]; screenPolyline1=new ScreenPolyline(); screenPolyline1.graphics.lineStyle(2, 13909462, 1); screenPolyline1.graphics.moveTo(point2.x, point2.y); screenPolyline1.graphics.lineTo(number1, number2); screenPolyline1.name=((ScreenPolyline.type_shape + point2.x) + ('right')) + point2.y; shape1=flash.display.Shape(comp.getChildAt(number3 - 1)); if (!(shape1.name != screenPolyline1.name)) { comp.removeChild(shape1); } comp.addChild(screenPolyline1); startp=sum_points[0]; isdoubleclick=true; } } } } private function xarrows_mouseDoubleClickHandler(event:MouseEvent):void { var local0:*=NaN; var local1:*=NaN; map.removeEventListener(MouseEvent.MOUSE_MOVE, xarrows_mouseMoveHandler); map.removeEventListener(MouseEvent.CLICK, map_mouseClickHandler); map.removeEventListener(MouseEvent.DOUBLE_CLICK, xarrows_mouseDoubleClickHandler); if (Boolean(map.contains(comp))) { if (!(Boolean(!(0 == comp.numChildren)))) { if (!isdoubleclick) { changMapGraphic(comp, startp, 'XARROWS'); } else { local0=comp.numChildren; local1=0; while (local1 < local0) { if (comp.getChildAt(local1) is ScreenPolyline) { comp.removeChild(comp.getChildAt(local1)); local0=local0 - 1; } local1=local1 + 1; } changMapGraphic(comp, startp, 'XARROWS'); } } } else if (!isdoubleclick) { changMapGraphic(comp, startp, 'XARROWS'); } else { local0=comp.numChildren; local1=0; while (local1 < local0) { if (comp.getChildAt(local1) is ScreenPolyline) { comp.removeChild(comp.getChildAt(local1)); local0=local0 - 1; } local1=local1 + 1; } changMapGraphic(comp, startp, 'XARROWS'); } initializeXARROW(); } private function xarrows_mouseClickHandler(event:MouseEvent):void { var point1:Point=null; var point2:Point=null; var point3:Point=null; var array1:Array=null; var point4:Point=null; var point5:Point=null; var point6:Point=null; var point7:Point=null; var point8:Point=null; var point9:Point=null; var array2:Array=null; var local14:*=NaN; var point10:Point=null; var point11:Point=null; var array3:Array=null; var local18:*=NaN; if (!(!(map.hasEventListener(MouseEvent.MOUSE_MOVE)))) { map.addEventListener(MouseEvent.MOUSE_MOVE, xarrows_mouseMoveHandler); } if (!(!(map.hasEventListener(MouseEvent.DOUBLE_CLICK)))) { map.addEventListener(MouseEvent.DOUBLE_CLICK, xarrows_mouseDoubleClickHandler); } this.dispatchEvent(new PlotDrawEvent(PlotDrawEvent.PLOT_DRAW_START, graphic)); var number1:Number=event.stageX; var number2:Number=event.stageY; number1=number1 - map.x; number2=number2 - map.y; var point12:Point=new Point(number1, number2); coords.push(point12); if (Boolean(clicknum >= 3)) { if (Boolean(0 == (clicknum % 3))) { point1=coords[clicknum - 3]; point2=coords[clicknum - 2]; point3=coords[clicknum - 1]; array1=getHeanGBJ(point1, point2, point3); point4=array1[1]; point5=array1[5]; control_points.push(point1); control_points.push(point4); control_points.push(point5); control_points.push(point2); point6=array1[0]; point7=array1[2]; point8=array1[4]; point9=array1[6]; if (clicknum != 3) { point10=control_points[control_points.length - 6]; point11=control_points[control_points.length - 5]; array3=useFiveBezier(point10, point11, point1, point2, point4); local18=1; while (local18 < array3.length) { sum_points.push(array3[local18]); local18=local18 + 1; } sum_points.push(point4); sum_points.push(point7); sum_points.push(point3); sum_points.push(point8); sum_points.push(point5); } else { array2=usebezier(point6, point2, point4); local14=0; while (local14 < array2.length) { sum_points.push(array2[local14]); local14=local14 + 1; } sum_points.push(point4); sum_points.push(point7); sum_points.push(point3); sum_points.push(point8); sum_points.push(point5); } } } else { point1=coords[clicknum - 3]; point2=coords[clicknum - 2]; point3=coords[clicknum - 1]; array1=getHeanGBJ(point1, point2, point3); point4=array1[1]; point5=array1[5]; control_points.push(point1); control_points.push(point4); control_points.push(point5); control_points.push(point2); point6=array1[0]; point7=array1[2]; point8=array1[4]; point9=array1[6]; if (clicknum != 3) { point10=control_points[control_points.length - 6]; point11=control_points[control_points.length - 5]; array3=useFiveBezier(point10, point11, point1, point2, point4); local18=1; while (local18 < array3.length) { sum_points.push(array3[local18]); local18=local18 + 1; } sum_points.push(point4); sum_points.push(point7); sum_points.push(point3); sum_points.push(point8); sum_points.push(point5); } else { array2=usebezier(point6, point2, point4); local14=0; while (local14 < array2.length) { sum_points.push(array2[local14]); local14=local14 + 1; } sum_points.push(point4); sum_points.push(point7); sum_points.push(point3); sum_points.push(point8); sum_points.push(point5); } } } private function map_mouseDownHandler(event:MouseEvent):void { var local0:*=m_drawType; if (CIRCLE !== local0) { if (!(BASE !== local0)) { base_mouseDownHandler(event); } } else { cricle_mouseDownHandler(event); } } private function updateCirclePolygon():void { if (Boolean(!(null == polygon.rings))) { polygon.removeRing(0); } else { if (Boolean(polygon.rings.length > 0)) { polygon.removeRing(0); } } polygon.addRing(createCirclePoints()); } private function createCirclePoints():Array { var local0:*=NaN; var local1:*=NaN; var local2:*=NaN; var local3:*=NaN; var array1:Array=new Array(); var int1:int=0; while (int1 < numberOfCirclePoints) { local1=Math.sin((Math.PI * 2) * (int1 / numberOfCirclePoints)); local0=Math.cos((Math.PI * 2) * (int1 / numberOfCirclePoints)); local2=m_center.x + (m_radius * local0); local3=m_center.y + (m_radius * local1); array1[int1]=new com.esri.ags.geometry.MapPoint(local2, local3); int1=int(int1) + 1; } array1.push(array1[0]); return array1; } private function calculateRadius(stageX:Number, stageY:Number):Number { var mapPoint1:com.esri.ags.geometry.MapPoint=null; mapPoint1=map.toMapFromStage(stageX, stageY); var number1:Number=mapPoint1.x - m_center.x; var number2:Number=mapPoint1.y - m_center.y; return Math.sqrt((number1 * number1) + (number2 * number2)); } private function circle_mouseMoveHandler(event:MouseEvent):void { m_radius=calculateRadius(event.stageX, event.stageY); updateCirclePolygon(); graphic.refresh(); } private function circle_mouseUpHandler(event:MouseEvent):void { if (!(com.esri.ags.geometry.Polygon(graphic.geometry).rings != null)) { graphic=null; } map.removeEventListener(MouseEvent.MOUSE_MOVE, circle_mouseMoveHandler); map.removeEventListener(MouseEvent.MOUSE_UP, circle_mouseUpHandler); this.dispatchEvent(new PlotDrawEvent(PlotDrawEvent.PLOT_DRAW_START, graphic)); initializeCIRCLE(); } private function initializeCIRCLE():void { map.addEventListener(MouseEvent.MOUSE_DOWN, map_mouseDownHandler); } private function cricle_mouseDownHandler(event:MouseEvent):void { map.removeEventListener(MouseEvent.MOUSE_DOWN, map_mouseDownHandler); var mapPoint1:com.esri.ags.geometry.MapPoint=map.toMapFromStage(event.stageX - map.x, event.stageY - map.y); polygon=new com.esri.ags.geometry.Polygon(); m_center=mapPoint1; m_radius=1; graphic=new com.esri.ags.Graphic(); this.dispatchEvent(new PlotDrawEvent(PlotDrawEvent.PLOT_DRAW_START, graphic)); polygon.spatialReference=map.spatialReference; graphic.geometry=polygon; graphic.symbol=fillSymbol; graphic.toolTip='circle'; graphicsLayer.add(graphic); map.addEventListener(MouseEvent.MOUSE_MOVE, circle_mouseMoveHandler); map.addEventListener(MouseEvent.MOUSE_UP, circle_mouseUpHandler); } private function base_mouseDownHandler(event:MouseEvent):void { map.removeEventListener(MouseEvent.MOUSE_DOWN, map_mouseDownHandler); var mapPoint1:com.esri.ags.geometry.MapPoint=map.toMapFromStage(event.stageX - map.x, event.stageY - map.y); polygon=new com.esri.ags.geometry.Polygon(); m_center=mapPoint1; m_radius=1; graphic=new com.esri.ags.Graphic(); this.dispatchEvent(new PlotDrawEvent(PlotDrawEvent.PLOT_DRAW_START, graphic)); polygon.spatialReference=map.spatialReference; graphic.geometry=polygon; graphic.symbol=fillSymbol; graphic.toolTip='base'; graphicsLayer.add(graphic); map.addEventListener(MouseEvent.MOUSE_MOVE, base_mouseMoveHandler); map.addEventListener(MouseEvent.MOUSE_UP, base_mouseUpHandler); } private function base_mouseUpHandler(event:MouseEvent):void { if (!(com.esri.ags.geometry.Polygon(graphic.geometry).rings != null)) { graphic=null; } map.removeEventListener(MouseEvent.MOUSE_MOVE, base_mouseMoveHandler); map.removeEventListener(MouseEvent.MOUSE_UP, base_mouseUpHandler); this.dispatchEvent(new PlotDrawEvent(PlotDrawEvent.PLOT_DRAW_END, graphic)); initializeBASE(); } private function initializeBASE():void { map.addEventListener(MouseEvent.MOUSE_DOWN, map_mouseDownHandler); } private function base_mouseMoveHandler(event:MouseEvent):void { m_radius=calculateRadius(event.stageX, event.stageY); updateBasePolygon(); graphic.refresh(); } private function updateBasePolygon():void { if (Boolean(!(null == polygon.rings))) { polygon.removeRing(0); } else { if (Boolean(polygon.rings.length > 0)) { polygon.removeRing(0); } } polygon.addRing(createBasePoints()); } private function createBasePoints():Array { var local0:*=NaN; var local1:*=NaN; var local2:*=NaN; var local3:*=NaN; var number1:Number=m_center.x + ((m_radius * 3) / 4); var number2:Number=m_center.y; var number3:Number=m_center.x - (m_radius / 4); var number4:Number=m_center.y; var array1:Array=new Array(); var int1:int=0; while (int1 < numberOfCirclePoints) { local1=Math.sin(Math.PI * (int1 / numberOfCirclePoints)); local0=Math.cos(Math.PI * (int1 / numberOfCirclePoints)); local2=m_center.x + (m_radius * local0); local3=m_center.y - ((m_radius * local1) * 0.7); array1[int1]=new com.esri.ags.geometry.MapPoint(local2, local3); int1=int(int1) + 1; } var number5:Number=0; while (number5 < numberOfCirclePoints) { local1=Math.sin(Math.PI * (number5 / numberOfCirclePoints)); local0=Math.cos(Math.PI * (number5 / numberOfCirclePoints)); local2=number3 - (((3 / 4) * m_radius) * local0); local3=number4 + ((((3 / 4) * m_radius) * local1) * 0.7); array1.push(new com.esri.ags.geometry.MapPoint(local2, local3)); number5=number5 + 1; } var number6:Number=0; while (number6 < numberOfCirclePoints) { local1=Math.sin(Math.PI * (number6 / numberOfCirclePoints)); local0=Math.cos(Math.PI * (number6 / numberOfCirclePoints)); local2=number1 - (((1 / 4) * m_radius) * local0); local3=number2 + ((((1 / 4) * m_radius) * local1) * 0.8); array1.push(new com.esri.ags.geometry.MapPoint(local2, local3)); number6=number6 + 1; } array1.push(array1[0]); return array1; } private function choosetool_mouseMoveHandler(event:MouseEvent):void { xoffset=event.localX; yoffset=event.localY; var iUIComponent1:mx.core.IUIComponent=mx.core.IUIComponent(event.currentTarget); var bitmapAsset1:mx.core.BitmapAsset=new mx.core.BitmapAsset(); bitmapAsset1.bitmapData=new flash.display.BitmapData(iUIComponent1.width, iUIComponent1.height); bitmapAsset1.bitmapData.draw(iUIComponent1); var dragSource1:mx.core.DragSource=new mx.core.DragSource(); dragSource1.addData(iUIComponent1, FORMAT); DragManager.doDrag(iUIComponent1, dragSource1, event, bitmapAsset1, 0, 0, 0.5); } private function dragdropHandler(evt:mx.events.DragEvent):void { var uIComponent1:mx.core.UIComponent=mx.core.UIComponent(evt.dragInitiator); uIComponent1.x=evt.localX - xoffset; uIComponent1.y=evt.localY - yoffset; uIComponent1.visible=true; } private function dragEnterHandler(evt:mx.events.DragEvent):void { if (evt.dragSource.hasFormat(FORMAT)) { DragManager.acceptDragDrop(com.esri.ags.Map(evt.currentTarget)); } } private function edit_mouseMapClickHandler():void { var graphic1:com.esri.ags.Graphic=null; var simpleFillSymbol1:SimpleFillSymbol=null; if (!t.running) { mx.controls.Alert.show('您还没有选择要编辑的要素', '温馨提示!!'); return; } else { choosetool.visible=true; choosetool.addEventListener(MouseEvent.MOUSE_MOVE, choosetool_mouseMoveHandler); map.addEventListener(mx.events.DragEvent.DRAG_DROP, dragdropHandler, false, 0, true); map.addEventListener(mx.events.DragEvent.DRAG_ENTER, dragEnterHandler, false, 0, true); map.addChild(choosetool); map.setChildIndex(choosetool, map.numChildren - 1); if (!(watcher1 == null)) { watcher1.unwatch(); watcher2.unwatch(); } t.stop(); if (graphicsLayer.contains(hightlight_graphic)) { graphicsLayer.remove(hightlight_graphic); } var number1:Number=graphicsLayer.numGraphics; var number2:Number=0; if (number2 < number1) { graphic1=com.esri.ags.Graphic(graphicsLayer.getChildAt(number2)); if (graphic1.geometry != hightlight_graphic.geometry) { number2=number2 + 1; } else { watcher1=mx.binding.utils.BindingUtils.bindProperty(graphic1, 'alpha', choosetool.slider, 'value'); simpleFillSymbol1=new SimpleFillSymbol(); watcher2=mx.binding.utils.BindingUtils.bindProperty(simpleFillSymbol1, 'color', choosetool.colorPicker, 'selectedColor'); graphic1.symbol=simpleFillSymbol1; } } } } public function get fill_Symbol():Symbol { return fillSymbol; } public function get geometryservices():com.esri.ags.tasks.GeometryService { return _geometryservices; } public function get graphicsLayer(): GraphicsLayer { return _graphicsLayer; } public function get hight_LSymbol():Symbol { return hightLSymbol; } public function get line_Symbol():Symbol { return lineSymbol; } public function get text_symbol():InfoSymbol { return _text_symbol; } private function get clicknum():Number { return this._906467582clicknum; } private function get comp():mx.core.UIComponent { return this._3059471comp; } private function get control_points():Array { return this._708402683control_points; } private function get coords():Array { return this._1354750946coords; } public function set fill_Symbol(fillSymbol:Symbol):void { this.fillSymbol=fillSymbol; } public function set geometryservices(geometryservices:com.esri.ags.tasks.GeometryService):void { this._geometryservices=geometryservices; } public function set graphicsLayer(graphicsLayer:com.esri.ags.layers.GraphicsLayer):void { this._graphicsLayer=graphicsLayer; } public function set hight_LSymbol(hightLSymbol:Symbol):void { this.hightLSymbol=hightLSymbol; } public function set line_Symbol(lineSymbol:Symbol):void { this.lineSymbol=lineSymbol; } public function set text_symbol(text_symbol:InfoSymbol):void { this._text_symbol=text_symbol; } private function set clicknum(value:Number):void { var object1:Object=this._906467582clicknum; if (!(object1 === value)) { this._906467582clicknum=value; this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, 'clicknum', object1, value)); } } private function set comp(value:mx.core.UIComponent):void { var object1:Object=this._3059471comp; if (!(object1 === value)) { this._3059471comp=value; this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, 'comp', object1, value)); } } private function set control_points(value:Array):void { var object1:Object=this._708402683control_points; if (!(object1 === value)) { this._708402683control_points=value; this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, 'control_points', object1, value)); } } private function set coords(value:Array):void { var object1:Object=this._1354750946coords; if (!(object1 === value)) { this._1354750946coords=value; this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, 'coords', object1, value)); } } } }