当前位置: 首页 > Web前端 > vue.js

arcgisforjs绘图表面

时间:2023-04-01 02:12:59 vue.js

绗旇€呰繖閲屼娇鐢ㄧ殑esri鐗堟湰鏄?19锛岄渶瑕佹彁鍓嶅垵濮嬪寲draw鍖?esri/views/draw/Draw"this.$message.success("Startdrawing");vardraw=newDraw({view:this.view})varaction=draw.create("polygon",{mode:"click"//鐐瑰嚮娣诲姞鐐箎);//鑾峰彇鐒︾偣this.view.focus();//椤剁偣娣诲姞浜嬩欢action.on("vertex-add",(evt)=>{this.createPolygon(evt)});//椤剁偣绉婚櫎浜嬩欢action.on("vertex-remove",(evt)=>{this.createPolygon(evt)});//榧犳爣绉诲姩浜嬩欢action.on("cursor-update",(evt)=>{this.createPolygon(evt)});//缁樺埗瀹屾垚浜嬩欢action.on("draw-complete",(evt)=>{this.createPolygon(evt)this.$message.success("鐢诲畬");});杩欓噷浣跨敤浜嗗浘褰㈠拰澶氳竟褰袱涓寘"esri/Graphic""esri/geometry/Polygon"asynccreatePolygon(event){//鑾峰彇鎵€鏈夐《鐐箆arvertices=event.vertices;//鍦ㄦ竻闄や箣鍓嶇粯鍒秚his.view.graphics.removeAll();varGraphic=awaitarcgisPackage.Graphic;varPolygon=awaitarcgisPackage.Polygon;//鐢熸垚缁樺埗鐨勫浘褰argraphic=newGraphic({geometry:newPolygon({hasZ:false,hasM:false,rings:[vertices],spatialReference:this.view.spatialReference}),symbol:{type:"simple-fill",//autocastsasnewSimpleFillSymbol()color:[51,51,204,0.9],style:"solid",outline:{//鑷姩杞崲涓烘柊鐨凷impleLineSymbol()color:"white",width:1}}});this.view.graphics.add锛堝浘褰級锛沜onsole.log(graphic.geometry.toJSON());}鏇村鏂囩珷馃憠鍘熶綔鑰呴摼鎺?/p>