DrawTool.js
46.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
/*eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('4T("1w/2q/4M 1w/2q/4L 1w/2q/4K 1w/2F-4J 1w/2F 1w/4I 1w/4H 1w/4G 1w/4E/4D 1d/4C/4B 1d/22/4A 1d/22/4y 1d/22/4w 1d/22/4r 1d/4q 1d/1U/4p 1d/1U/4o 1d/1U/4m 1d/1U/4l 1d/1U/4k 1d/22/4j 4h/4g".4f(" "),O(x,d,D,y,E,F,G,v,H,z,q,t,l,h,f,u,A,B,C,w,n,g){X p=M,r;r=x(M,{1G:M,L:M,2r:!1,I:M,1L:"",T:"#1G",U:[],3r:O(c,b,e){7.L=c;7.1G=b;7.1O=e;7.1O||(7.1O={},7.1O.2L=9 w({2M:"2O/2S/2T/4a.2U",1C:"45",2W:"44",2u:0,2t:"43"}));7.1P=9 C({1j:"41",40:"3Z",3Y:"3W",1V:"\\27\\2n:3V.2\\29\\2b",2u:0,2t:8,2k:{2c:10,3U:"\\3T\\3S\\3R\\3Q",3P:"3O"}});7.2i=9 A({1D:"3N",1j:[1F,0,0,1],2c:5,2j:{1j:[1F,0,0,1],1C:2}});7.23=9 u({1j:[0,0,0,.1],1D:"24",2j:{1j:[1F,0,0,1],1C:0}});7.15=9 B({1j:[1F,0,0,1],1C:2,1D:"24"});7.1p=9 u({1j:[0,0,0,.1],1D:"24",2j:{1j:[1F,0,0,1],1C:2}});7.3M=9 u({1j:[0,0,0,.1],1D:"24",2j:{1j:[0,1F,1F,.6],1C:1}});7.J=9 z({3L:"3I"});7.1G.S(7.J);7.37=\'<38 3H="3a-3b-3c"><38>\';y.3G(7.37,7.T.3F("#",""),"3E");7.Z=$(".3a-3b-3c");7.3j()},3j:O(){},3D:O(c,b){7.2r=!0;7.1L=c.3C();7.1q=b;7.U=[];7.W=0;v.3o("3p-3q",!1);7.1G.3z(7.J,7.1G.3y.1a-1);3x(7.1L){1v"3v":7.V=9 l;7.V.N=7.L.N;7.s=9 l;7.s.N=7.L.N;7.s.o.i([[],[]]);7.K=M;7.1i=[];7.U.i(g.Y(7.T,"1s",d.R(7,O(e){X a=9 1I,c=a.1t()-(7.19?7.19.1t():-1);7.19=a;7.K&&(7.J.17(7.K),a=9 l,a.N=7.L.N,a.o.i([7.s.o[0][0],7.s.o[0][1]]),a=9 f(a,7.15),7.J.S(a),7.1i.i(a));7.K=9 f(7.s,7.15);a=9 h(e.P,e.Q);a=7.L.18(a);7.s.o[0][0]=[a.x,a.y];7.s.o[0][1]=[a.x,a.y];7.J.S(7.K);0==7.W&&7.1i.i(7.K);0==7.V.o.1a?7.V.o.i([[a.x,a.y]]):7.V.o[0].i([a.x,a.y]);a=9 f(a,7.2i,M);7.J.S(a);7.1i.i(a);1e(1H>=c||2==7.W){7.j=9 f(7.V,7.15,M);1e(2<7.V.o[0].1a){X c=7.V.o[0][0],k=7.V.o[0][1],b=7.V.o[0][2],a=[(k[0]+b[0])/2,(k[1]+b[1])/2],c=(1S/13.1R*13.3u((13.1k(k[0]-c[0],2)+13.1k(k[1]-c[1],2)+13.1k(b[0]-k[0],2)+13.1k(b[1]-k[1],2)-13.1k(b[0]-c[0],2)-13.1k(b[1]-c[1],2))/(13.2o(13.1k(k[0]-c[0],2)+13.1k(k[1]-c[1],2))*13.2o(13.1k(b[0]-k[0],2)+13.1k(b[1]-k[1],2))*2))).1m(2),d=b[0]-k[0],b=b[1]-k[1];0>d&&0>b&&(d=0-d,b=0-b);k=1S/13.1R*13.2e(b,d);0>d&&0<b&&(k=-1S/13.1R*-13.2e(0-b,0-d));a=9 t(a[0],a[1],7.L.N);d=7.1P.1J();d.1V=c+"\\3s";d.3d=-k;d.2k.2c="3e";c=9 f(a,d,M);7.J.S(c);7.1i.i(c)}7.1q(7.j?7.j:9 f(7.V,7.15,M));7.1o()}7.W++;e.14()})));7.U.i(g.Y(7.T,"1r",d.R(7,O(e){X a=9 h(e.P,e.Q),a=7.L.18(a);0==7.W?(7.16("\\1n\\1f\\1h\\1z\\1y\\1c\\1b",e.P,e.Q),7.Z.1u()):(1==7.W?7.16("\\1n\\1f\\1c\\1b\\2m\\2s",e.P,e.Q):7.16("\\1n\\1f\\1c\\1b\\4b\\3t",e.P,e.Q),7.Z.1l(),7.K&&7.J.17(7.K),7.K=9 f(7.s,7.15),7.s.o[0][1]=[a.x,a.y],7.J.S(7.K),e.14())})));1x;1v"3w":7.I=9 q;7.I.N=7.L.N;7.s=9 l;7.s.N=7.L.N;7.s.o.i([[],[]]);7.K=M;7.1T=[];7.U.i(g.Y(7.T,"1s",d.R(7,O(e){1e(7.K){7.J.17(7.K);X a=9 l;a.N=7.L.N;a.o.i([7.s.o[0][0],7.s.o[0][1]]);a=9 f(a,7.15);7.J.S(a);7.1T.i(a)}7.K=9 f(7.s,7.15);a=9 h(e.P,e.Q);a=7.L.18(a);7.s.o[0][0]=[a.x,a.y];7.s.o[0][1]=[a.x,a.y];7.J.S(7.K);0==7.I.11.1a?(7.I.11.i([[a.x,a.y]]),7.1T.i(7.K)):7.I.11[0].i([a.x,a.y]);3<=7.I.11[0].1a&&(7.j&&7.J.17(7.j),7.j=9 f(7.I,7.23,M),7.J.S(7.j));X a=9 1I,c=a.1t()-(7.19?7.19.1t():-1);7.19=a;1e(1H>=c){7.I.11[0].i(7.I.11[0][0]);7.j&&7.J.17(7.j);7.j=9 f(7.I,7.1p,M);7.J.S(7.j);7.1T.i(7.j);X a=7.I.3A.3B,b=n.3l(7.I,3k),b=13.3h(b);2d<b?(b=(b/2d).1m(1),c="3f\\2f"):(b=b.1m(1),c="m\\2f");1e("0.0"!=b){X d=7.1P.1J();d.1V="\\27\\3J\\3K:"+b+c;d.2k.2c="3e";d.34="2w";a=9 f(a,d,M);7.J.S(a);7.1T.i(a)}7.1q(7.j?7.j:9 f(7.I,7.1p,M));7.1o()}7.W++;e.14()})));7.U.i(g.Y(7.T,"1r",d.R(7,O(e){X a=9 h(e.P,e.Q),a=7.L.18(a);1e(0==7.W)7.16("\\1n\\1f\\1h\\1z\\1y\\1c\\1b",e.P,e.Q),1Q(d.R(7,O(){7.Z.1l()}),1Y);1E{1e(1==7.W)7.16("\\1n\\1f\\1h\\2m\\2s\\1c\\1b",e.P,e.Q);1E{X b=7.I.1J();b.11[0].i([a.x,a.y]);X c=n.3l(b,3k),c=13.3h(c);2d<c?(c=(c/2d).1m(1),b="3f\\2f"):(c=c.1m(1),b="m\\2f");7.16(\'<2h 1D="1j:2R(0, 2Q, 2P);">&1K;\'+c+"&1K;</2h>"+b+"<2N>\\2g\\1f\\1A\\1B\\28\\26",e.P,e.Q);7.Z.1l()}7.K&&7.J.17(7.K);7.K=9 f(7.s,7.15);7.s.o[0][1]=[a.x,a.y];7.J.S(7.K);e.14()}})));1x;1v"3X":7.V=9 l;7.V.N=7.L.N;7.s=9 l;7.s.N=7.L.N;7.s.o.i([[],[]]);7.K=M;7.1i=[];7.U.i(g.Y(7.T,"1s",d.R(7,O(c){X a=9 1I,b=a.1t()-(7.19?7.19.1t():-1);7.19=a;1e(7.K){7.J.17(7.K);a=9 l;a.N=7.L.N;a.o.i([7.s.o[0][0],7.s.o[0][1]]);X e=9 f(a,7.15);7.J.S(e);7.1i.i(e);1e(1H<b){X d=a.o[0][0],g=a.o[0][1],e=[(d[0]+g[0])/2,(d[1]+g[1])/2],m=g[0]-d[0],g=g[1]-d[1];0>m&&0>g&&(m=0-m,g=0-g);d=1S/13.1R*13.2e(g,m);0>m&&0<g&&(d=-1S/13.1R*-13.2e(0-g,0-m));m=9 t(e[0],e[1],7.L.N);e=7.1P.1J();a=n.2l(a,25);0!=a&&(a=1N<a?(a/1N).1m(1)+"\\29\\2b":a.1m(1)+"\\2p",e.1V=a,e.3d=-d,a=9 f(m,e,M),7.J.S(a),7.1i.i(a))}}7.K=9 f(7.s,7.15);a=9 h(c.P,c.Q);a=7.L.18(a);7.s.o[0][0]=[a.x,a.y];7.s.o[0][1]=[a.x,a.y];7.J.S(7.K);0==7.W&&7.1i.i(7.K);0==7.V.o.1a?7.V.o.i([[a.x,a.y]]):7.V.o[0].i([a.x,a.y]);a=9 f(a,7.2i,M);7.J.S(a);7.1i.i(a);1H>=b&&(7.j=9 f(7.V,7.15,M),7.1q(7.j?7.j:9 f(7.V,7.15,M)),7.V.o[0]&&1<7.V.o[0].1a&&(a=9 w({2M:"2O/2S/2T/42.2U",1C:"31",2W:"31",2u:12,2t:0}),e=7.V.o[0][7.V.o[0].1a-1],b=9 t(e[0],e[1],7.L.N),d=9 f(b,a,{}),7.J.S(d),7.1i.i(d),e=7.1P.1J(),a=n.2l(7.V,25),0!=a&&(a=1N<a?(a/1N).1m(1)+"\\29\\2b":a.1m(1)+"\\2p",e.1V="\\27\\2n:"+a,e.34="2w",b=9 f(b,e,M),7.J.S(b),7.1i.i(b)),d.2a.2E=[],d.2a.2E=d.2a.2E.46(7.1i),d.2a.47="48"),7.1o());7.W++;c.14()})));7.U.i(g.Y(7.T,"1r",d.R(7,O(e){X a=9 h(e.P,e.Q),a=7.L.18(a);1e(0==7.W)7.16("\\1n\\1f\\1h\\1z\\1y\\1c\\1b",e.P,e.Q),7.Z.1u();1E{X b=7.V.1J();b.o[0].i([a.x,a.y]);X c=n.2l(b,25);1N<c?(c=(c/1N).1m(1),b="\\29\\2b"):(c=c.1m(1),b="\\2p");7.16(\'\\27\\2n:<2h 1D="1j:2R(0, 2Q, 2P);">&1K;&1K;\'+c+"&1K;&1K;</2h>"+b+"<2N>\\2g\\1f\\1A\\1B\\28\\26",e.P,e.Q);7.Z.1l();7.K&&7.J.17(7.K);7.K=9 f(7.s,7.15);7.s.o[0][1]=[a.x,a.y];7.J.S(7.K);e.14()}})));1x;1v"49":7.W=0;7.U.i(g.Y(7.T,"1s",d.R(7,O(b){X a=9 h(b.P,b.Q),a=7.L.18(a);7.j=9 f(a,7.1O.2L,M);7.J.S(7.j);b.14()})));7.U.i(g.Y(7.T,"1r",d.R(7,O(b){0==7.W?(7.16("",b.P,b.Q),7.Z.1u(),7.W++):(7.16("\\1n\\1f\\21\\1M\\3n\\3i\\1M\\4c",b.P,b.Q),7.Z.1l());b.14()})));7.U.i(g.Y(7.T,"1Z",d.R(7,O(b){7.1q(7.j);7.1o();b.14()})));1x;1v"4d":7.I=9 q;7.I.N=7.L.N;7.s=9 l;7.s.N=7.L.N;7.s.o.i([[],[]]);7.K=M;7.19=9 1I;7.U.i(g.Y(7.T,"1s",d.R(7,7.39)));7.U.i(g.Y(7.T,"1r",d.R(7,7.35)));1x;1v"4e":7.I=9 q;7.I.N=7.L.N;7.I.11.i([]);7.s=9 l;7.s.N=7.L.N;7.s.o.i([]);7.K=M;7.U.i(g.Y(7.T,"1s",d.R(7,7.2Z)));7.U.i(g.Y(7.T,"1r",d.R(7,7.2Y)));7.U.i(g.Y(7.T,"1Z",d.R(7,7.2X)));1x;1v"4i":7.I=9 q;7.I.N=7.L.N;7.W=0;7.I.11.i([[],[],[],[],[]]);7.1g=M;7.U.i(g.Y(7.T,"1s",d.R(7,7.2K)));7.U.i(g.Y(7.T,"1r",d.R(7,7.2J)));7.U.i(g.Y(7.T,"1Z",d.R(7,7.2I)));1x;1v"4n":7.I=9 q;7.I.N=7.L.N;7.1X=7.1g=M;7.U.i(g.Y(7.T,"1s",d.R(7,7.2G)));7.U.i(g.Y(7.T,"1r",d.R(7,7.3m)));7.U.i(g.Y(7.T,"1Z",d.R(7,7.3g)));1x;1v"4s":7.W=0;7.U.i(g.Y(7.T,"1s",d.R(7,O(b){X a=9 h(b.P,b.Q),a=7.L.18(a);7.j=9 f(a,7.2i,M);7.J.S(7.j);b.14()})));7.U.i(g.Y(7.T,"1r",d.R(7,O(b){0==7.W?(7.16("",b.P,b.Q),7.Z.1u(),7.W++):(7.16("\\1n\\1f\\21\\1M\\3n\\3i\\4t",b.P,b.Q),7.Z.1l());b.14()})));7.U.i(g.Y(7.T,"1Z",d.R(7,O(b){7.1q(7.j);7.1o();b.14()})));1x;1v"4u":7.V=9 l,7.V.N=7.L.N,7.s=9 l,7.s.N=7.L.N,7.s.o.i([[],[]]),7.K=M,7.U.i(g.Y(7.T,"1s",d.R(7,O(b){X a=9 1I,c=a.1t()-(7.19?7.19.1t():-1);7.19=a;7.K&&(7.J.17(7.K),a=9 l,a.N=7.L.N,a.o.i([7.s.o[0][0],7.s.o[0][1]]),a=9 f(a,7.15),7.J.S(a));7.K=9 f(7.s,7.15);a=9 h(b.P,b.Q);a=7.L.18(a);7.s.o[0][0]=[a.x,a.y];7.s.o[0][1]=[a.x,a.y];7.J.S(7.K);0==7.V.o.1a?7.V.o.i([[a.x,a.y]]):7.V.o[0].i([a.x,a.y]);1H>=c&&(7.j=9 f(7.V,7.15,M),7.1q(7.j?7.j:9 f(7.V,7.15,M)),7.1o());7.W++;b.14()}))),7.U.i(g.Y(7.T,"1r",d.R(7,O(b){X a=9 h(b.P,b.Q),a=7.L.18(a);0==7.W?(7.16("\\1n\\1f\\1h\\1z\\1y\\1c\\1b",b.P,b.Q),7.Z.1u()):(7.16("\\2g\\1f\\1A\\1B\\28\\26",b.P,b.Q),7.Z.1l(),7.K&&7.J.17(7.K),7.K=9 f(7.s,7.15),7.s.o[0][1]=[a.x,a.y],7.J.S(7.K),b.14())})))}7.U.i(g.Y(7.T,"4v",d.R(7,7.36)));7.U.i(g.Y(7.T,"4x",d.R(7,7.33)));7.U.i(g.Y(7.T,"4z",d.R(7,O(){$(".1d-L-2v").1W("2x-2y","30")})));7.U.i(g.Y(7.T,"4F",d.R(7,O(){$(".1d-L-2v").1W("2x-2y","30")})))},36:O(c){""!=7.1L&&7.Z.2V(":2H")&&7.Z.1l()},33:O(c){""==7.1L||7.Z.2V(":2H")||7.Z.1u()},39:O(c){7.W++;1e(7.K){7.J.17(7.K);X b=9 l;b.N=7.L.N;b.o.i([7.s.o[0][0],7.s.o[0][1]]);7.J.S(9 f(b,7.15))}7.K=9 f(7.s,7.15);b=9 h(c.P,c.Q);b=7.L.18(b);7.s.o[0][0]=[b.x,b.y];7.s.o[0][1]=[b.x,b.y];7.J.S(7.K);0==7.I.11.1a?7.I.11.i([[b.x,b.y]]):7.I.11[0].i([b.x,b.y]);3<=7.I.11[0].1a&&(7.j&&7.J.17(7.j),7.j=9 f(7.I,7.23,M),7.J.S(7.j));X b=9 1I,d=b.1t()-7.19.1t();7.19=b;1H>=d&&(7.I.11[0].i(7.I.11[0][0]),7.j&&7.J.17(7.j),7.j=9 f(7.I,7.1p,M),7.J.S(7.j),7.1q(7.j?7.j:9 f(7.I,7.1p,M)),7.1o());c.14()},35:O(c){1e(0==7.W)7.16("\\1n\\1f\\1h\\1z\\1y\\1c\\1b",c.P,c.Q),1Q(d.R(7,O(){7.Z.1l()}),1Y);1E{1==7.W?7.16("\\1n\\1f\\1h\\2m\\2s\\1c\\1b",c.P,c.Q):7.16("\\2g\\1f\\1A\\1B\\28\\26",c.P,c.Q);7.K&&7.J.17(7.K);7.K=9 f(7.s,7.15);X b=9 h(c.P,c.Q),b=7.L.18(b);7.s.o[0][1]=[b.x,b.y];7.J.S(7.K);c.14()}},2Z:O(c){7.W++;c.14()},2Y:O(c){1e(0==7.W)7.16("\\2z\\2A\\21\\1M\\1h\\1z\\1y\\1c\\1b\\2B\\2C\\2D\\1h\\1A\\1B\\1c\\1b",c.P,c.Q),1Q(d.R(7,O(){7.Z.1l()}),1Y);1E{7.Z.1u();X b=9 h(c.P,c.Q),b=7.L.18(b);7.I.11[0].i([b.x,b.y]);7.s.o[0].i([b.x,b.y]);3<=7.I.11[0].1a&&(7.j&&7.J.17(7.j),7.j=9 f(7.I,7.23,M),7.J.S(7.j));2<=7.s.o[0].1a&&(7.K&&7.J.17(7.K),7.K=9 f(7.s,7.15,M),7.J.S(7.K));c.14()}},2X:O(c){0<7.I.11[0].1a&&(7.I.11[0].i(7.I.11[0][0]),7.j&&7.J.17(7.j),7.j=9 f(7.I,7.1p,M),7.J.S(7.j));7.1q(7.j?7.j:9 f(7.I,7.1p,M));7.1o();c.14()},2K:O(c){X b=9 h(c.P,c.Q);7.1g=7.L.18(b);7.I.11[0][0]=[7.1g.x,7.1g.y];7.I.11[0][4]=[7.1g.x,7.1g.y];7.W++;c.14()},2J:O(c){1e(0==7.W)7.16("\\2z\\2A\\21\\1M\\1h\\1z\\1y\\1c\\1b\\2B\\2C\\2D\\1h\\1A\\1B\\1c\\1b",c.P,c.Q),1Q(d.R(7,O(){7.Z.1l()}),1Y);1E{7.Z.1u();X b=9 h(c.P,c.Q),b=7.L.18(b);7.I.11[0][1]=[7.1g.x,b.y];7.I.11[0][3]=[b.x,7.1g.y];7.I.11[0][2]=[b.x,b.y];3<=7.I.11[0].1a&&(7.j&&7.J.17(7.j),7.j=9 f(7.I,7.1p,M),7.J.S(7.j));c.14()}},2I:O(c){7.1q(7.j?7.j:9 f(7.I,7.1p,M));7.1o();c.14()},2G:O(c){X b=9 h(c.P,c.Q);7.1g=7.L.18(b);7.W++;c.14()},3m:O(c){1e(0==7.W)7.16("\\2z\\2A\\21\\1M\\1h\\1z\\1y\\1c\\1b\\2B\\2C\\2D\\1h\\1A\\1B\\1c\\1b",c.P,c.Q),1Q(d.R(7,O(){7.Z.1l()}),1Y);1E{7.Z.1u();X b=9 h(c.P,c.Q);7.1X=7.L.18(b);(7.I=n.4N(7.1g,13.2o(13.1k(7.1X.x-7.1g.x,2)+13.1k(7.1X.y-7.1g.y,2)),25))&&3<=7.I.11[0].1a&&(7.j&&7.J.17(7.j),7.j=9 f(7.I,7.1p,M),7.J.S(7.j));c.14()}},3g:O(c){7.1q(7.j?7.j:9 f(7.I,7.1p,M));7.1o();c.14()},1o:O(){g.4O(7.T,7.U);$(".1d-L-2v").1W("2x-2y","4P");v.3o("3p-3q",!0);7.2r=!1;7.1L="";7.1X=7.1g=7.19=7.j=7.K=7.s=7.V=7.I=M;7.W=0;7.Z.1u()},16:O(c,b,d){7.Z.4Q(c);7.Z.1W("4R",d);7.Z.1W("2w",b+20)}});r.4S=O(c,b,d){M===p?p=9 r(c,b,d):(p.L=c,p.1G=b,p.1O=d);32 p};32 r});',62,304,'|||||||this||new|||||||||push|graphic|||||paths||||changePolyLine||||||||||||||||polygon|graphicsLayer|changeLineGraphic|view|null|spatialReference|function|offsetX|offsetY|hitch|add|viewId|guids|polyline|downCount|var|addEvent|tip||rings||Math|stopPropagation|sls|setTips|remove|toMap|fistDate|length|u5236|u7ed8|esri|if|u51fb|startPoint|u4ee5|lengthGraphics|color|pow|show|toFixed|u5355|deactivate|sfs_last|callback|mousemove|mousedown|getTime|hide|case|dojo|break|u59cb|u5f00|u5b8c|u6210|width|style|else|255|map|300|Date|clone|nbsp|drawType|u6807|1E3|options|tx|setTimeout|PI|180|areaGraphics|symbols|text|css|endPoint|50|mouseup||u9f20|geometry|sfs|solid|9001|u4f5c|u603b|u64cd|u516c|attributes|u91cc|size|1E6|atan2|u00b2|u53cc|span|sms|outline|font|planarLength|u7ee7|u957f|sqrt|u7c73|_base|active|u7eed|yoffset|xoffset|surface|left|pointer|events|u6309|u4e0b|u5e76|u91ca|u653e|graphics|dom|mouseDown_cirle|hidden|mouseUp_extent|mouseMove_extent|mouseDown_extent|pm|url|br|widgets|234|145|rgb|MapTool|images|png|is|height|mouseUp_freePolygon|mouseMove_freePolygon|mouseDown_freePolygon|none|12px|return|mouseover_tool|horizontalAlignment|mouseMove_PolyLineAndPolygon|mouseout_tool|tipHMTL|div|mouseDown_PolyLineAndPolygon|jimu|widget|tipforsp|angle|15px|km|mouseUp_cirle|abs|u52a0|listenBuilderEvents|109404|planarArea|mouseMove_cirle|u6dfb|publish|atts|open|constructor|u00b0|u675f|acos|ANGLE|AREA|switch|allLayers|reorder|extent|center|toUpperCase|activate|last|replace|place|class|drawtool|u9762|u79ef|id|sfs_buff|circle|bolder|weight|u9ed1|u96c5|u8f6f|u5fae|family|80|3px|LENGTH|haloSize|white|haloColor|black|measure_clear|16px|32px|24px|concat|graphicType|clear|POINT|icon_mark|u7ed3|u6ce8|POLYGON|FREEHAND_POLYGON|split|EventUtils|lib|EXTENT|geometryEngine|PictureMarkerSymbol|TextSymbol|SimpleLineSymbol|CIRCLE|SimpleMarkerSymbol|SimpleFillSymbol|Graphic|ScreenPoint|POINT_S|u70b9|LINE_S|mouseout|Polyline|mouseover|Point|pointerdown|Polygon|GraphicsLayer|layers|xhr|request|pointermove|topic|json|on|construct|array|lang|declare|buffer|removeEvents|auto|html|top|getInstance|define'.split('|'),0,{}))*/
define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/dom-construct dojo/dom dojo/on dojo/json dojo/topic dojo/request/xhr esri/layers/GraphicsLayer esri/geometry/Polygon esri/geometry/Point esri/geometry/Polyline esri/geometry/ScreenPoint esri/Graphic esri/symbols/SimpleFillSymbol esri/symbols/SimpleMarkerSymbol esri/symbols/SimpleLineSymbol esri/symbols/TextSymbol esri/symbols/PictureMarkerSymbol esri/geometry/geometryEngine lib/EventUtils".split(" "), function(x, d, D, y, E, F, G, v, H, z, q, t, l, h, f, u, A, B, C, w, n, g) {
var p = null,
r;
r = x(null, {
map: null,
view: null,
active: !1,
polygon: null,
drawType: "",
viewId: "#mapDiv",
guids: [],
constructor: function(c, b, e) {
this.view = c;
this.map = b;
this.options = e;
this.options || (this.options = {}, this.options.pm = new w({
url: "images/icon_mark.png",
width: "24px",
height: "32px",
xoffset: 0,
yoffset: "16px"
}));
this.options1 || (this.options1 = {}, this.options1.pm = new w({
url: "",
width: "",
height: "",
xoffset: 0,
yoffset: 0
}));
this.tx = new C({
color: "black",
haloColor: "white",
haloSize: "3px",
//text: "总长:80.2公里",
xoffset: 0,
yoffset: 8,
font: {
size: 10,
family: "微软雅黑",
weight: "bolder"
}
});
this.sms = new A({
style: "circle",
color: [255, 0, 0, 1],
size: 5,
outline: {
color: [255, 0, 0, 1],
width: 2
}
});
this.sfs = new u({
color: [0, 0, 0, .1],
style: "solid",
outline: {
color: [255, 0, 0, 1],
width: 0
}
});
this.sls = new B({
color: [255, 0, 0, 1],
width: 2,
style: "solid"
});
this.sfs_last = new u({
color: [0, 0, 0, .1],
style: "solid",
outline: {
color: [255, 0, 0, 1],
width: 2
}
});
this.sfs_buff = new u({
color: [0, 0, 0, .1],
style: "solid",
outline: {
color: [0, 255, 255, .6],
width: 1
}
});
this.graphicsLayer = new z({
id: "drawtool"
});
this.map.add(this.graphicsLayer);
this.tipHMTL = '<div class="jimu-widget-tipforsp"><div>';
y.place(this.tipHMTL, this.viewId.replace("#", ""), "last");
this.tip = $(".jimu-widget-tipforsp");
this.listenBuilderEvents()
},
listenBuilderEvents: function() {},
activate: function(c, b) {
clickShowAttribute=false;
this.active = !0;
this.drawType = c.toUpperCase();
this.callback = b;
this.guids = [];
this.downCount = 0;
v.publish("atts-open", !1);
this.map.reorder(this.graphicsLayer, this.map.allLayers.length - 1);
switch (this.drawType) {
case "ANGLE":
this.polyline = new l;
this.polyline.spatialReference = this.view.spatialReference;
this.changePolyLine = new l;
this.changePolyLine.spatialReference = this.view.spatialReference;
this.changePolyLine.paths.push([
[],
[]
]);
this.changeLineGraphic = null;
this.lengthGraphics = [];
this.guids.push(g.addEvent(this.viewId, "mousedown", d.hitch(this, function(e) {
var e1=e;
var a = new Date,
c = a.getTime() - (this.fistDate ? this.fistDate.getTime() : -1);
this.fistDate = a;
this.changeLineGraphic && (this.graphicsLayer.remove(this.changeLineGraphic), a = new l, a.spatialReference = this.view.spatialReference, a.paths.push([this.changePolyLine.paths[0][0], this.changePolyLine.paths[0][1]]), a = new f(a, this.sls), this.graphicsLayer.add(a), this.lengthGraphics.push(a));
this.changeLineGraphic = new f(this.changePolyLine, this.sls);
a = new h(e.offsetX, e.offsetY);
a = this.view.toMap(a);
this.changePolyLine.paths[0][0] = [a.x, a.y];
this.changePolyLine.paths[0][1] = [a.x, a.y];
this.graphicsLayer.add(this.changeLineGraphic);
0 == this.downCount && this.lengthGraphics.push(this.changeLineGraphic);
0 == this.polyline.paths.length ? this.polyline.paths.push([
[a.x, a.y]
]) : this.polyline.paths[0].push([a.x, a.y]);
a = new f(a, this.sms, null);
this.graphicsLayer.add(a);
this.lengthGraphics.push(a);
if (300 >= c || 2 == this.downCount) {
this.graphic = new f(this.polyline, this.sls, null);
if (2 < this.polyline.paths[0].length) {
var c = this.polyline.paths[0][0],
k = this.polyline.paths[0][1],
b = this.polyline.paths[0][2],
a = [(k[0] + b[0]) / 2, (k[1] + b[1]) / 2],
c = (180 / Math.PI * Math.acos((Math.pow(k[0] - c[0], 2) + Math.pow(k[1] - c[1], 2) + Math.pow(b[0] - k[0], 2) + Math.pow(b[1] - k[1], 2) - Math.pow(b[0] - c[0], 2) - Math.pow(b[1] - c[1], 2)) / (Math.sqrt(Math.pow(k[0] - c[0], 2) + Math.pow(k[1] - c[1], 2)) * Math.sqrt(Math.pow(b[0] - k[0], 2) + Math.pow(b[1] - k[1], 2)) * 2))).toFixed(2),
d = b[0] - k[0],
b = b[1] - k[1];
0 > d && 0 > b && (d = 0 - d, b = 0 - b);
k = 180 / Math.PI * Math.atan2(b, d);
0 > d && 0 < b && (k = -180 / Math.PI * -Math.atan2(0 - b, 0 - d));
a = new t(a[0], a[1], this.view.spatialReference);
d = this.tx.clone();
d.text = c + "°";
d.angle = -k;
d.font.size = "15px";
c = new f(a, d, null);
this.graphicsLayer.add(c);
this.lengthGraphics.push(c)
}
/*this.callback(this.graphic ? this.graphic : new f(this.polyline, this.sls, null));
this.deactivate()*/
this.graphic = new f(this.polyline, this.sls, null), this.callback(this.graphic ? this.graphic : new f(this.polyline, this.sls, null)), this.polyline.paths[0] && 1 < this.polyline.paths[0].length && (a = new w({
url: "images/measure_clear.png",
width: "12px",
height: "12px",
xoffset: 12,
yoffset: 0
}), e = this.polyline.paths[0][this.polyline.paths[0].length - 1], b = new t(e[0], e[1], this.view.spatialReference), d = new f(b, a, {}), this.graphicsLayer.add(d), this.lengthGraphics.push(d), e = this.tx.clone(), a = n.planarLength(this.polyline, 9001), 0 != a && ( b = new f(b, e, null), this.graphicsLayer.add(b), this.lengthGraphics.push(b)), d.attributes.graphics = [], d.attributes.graphics = d.attributes.graphics.concat(this.lengthGraphics), d.attributes.graphicType = "clear"), this.deactivate()
}
this.downCount++;
e1.stopPropagation();
})));
this.guids.push(g.addEvent(this.viewId, "mousemove", d.hitch(this, function(e) {
var a = new h(e.offsetX, e.offsetY),
a = this.view.toMap(a);
0 == this.downCount ? (this.setTips("单击以开始绘制", e.offsetX, e.offsetY), this.tip.hide()) : (1 == this.downCount ? this.setTips("单击绘制继续", e.offsetX, e.offsetY) : this.setTips("单击绘制结束", e.offsetX, e.offsetY), this.tip.show(), this.changeLineGraphic && this.graphicsLayer.remove(this.changeLineGraphic), this.changeLineGraphic = new f(this.changePolyLine, this.sls), this.changePolyLine.paths[0][1] = [a.x, a.y], this.graphicsLayer.add(this.changeLineGraphic), e.stopPropagation())
})));
break;
case "AREA":
this.polygon = new q;
this.polygon.spatialReference = this.view.spatialReference;
this.changePolyLine = new l;
this.changePolyLine.spatialReference = this.view.spatialReference;
this.changePolyLine.paths.push([
[],
[]
]);
this.changeLineGraphic = null;
this.areaGraphics = [];
this.guids.push(g.addEvent(this.viewId, "mousedown", d.hitch(this, function(e) {
var e1=e;
if (this.changeLineGraphic) {
this.graphicsLayer.remove(this.changeLineGraphic);
var a = new l;
a.spatialReference = this.view.spatialReference;
a.paths.push([this.changePolyLine.paths[0][0], this.changePolyLine.paths[0][1]]);
a = new f(a, this.sls);
this.graphicsLayer.add(a);
this.areaGraphics.push(a)
}
this.changeLineGraphic = new f(this.changePolyLine, this.sls);
a = new h(e.offsetX, e.offsetY);
a = this.view.toMap(a);
this.changePolyLine.paths[0][0] = [a.x, a.y];
this.changePolyLine.paths[0][1] = [a.x, a.y];
this.graphicsLayer.add(this.changeLineGraphic);
0 == this.polygon.rings.length ? (this.polygon.rings.push([
[a.x, a.y]
]), this.areaGraphics.push(this.changeLineGraphic)) : this.polygon.rings[0].push([a.x, a.y]);
3 <= this.polygon.rings[0].length && (this.graphic && this.graphicsLayer.remove(this.graphic), this.graphic = new f(this.polygon, this.sfs, null), this.graphicsLayer.add(this.graphic));
var a = new Date,
c = a.getTime() - (this.fistDate ? this.fistDate.getTime() : -1);
this.fistDate = a;
if (300 >= c) {
this.polygon.rings[0].push(this.polygon.rings[0][0]);
this.graphic && this.graphicsLayer.remove(this.graphic);
this.graphic = new f(this.polygon, this.sfs_last, null);
this.graphicsLayer.add(this.graphic);
this.areaGraphics.push(this.graphic);
var a = this.polygon.extent.center,
b = n.planarArea(this.polygon, 109404),
b = Math.abs(b);
1E6 < b ? (b = (b / 1E6).toFixed(1), c = "km²") : (b = b.toFixed(1), c = "m²");
if ("0.0" != b) {
var d = this.tx.clone();
d.text = "总面积:" + b + c;
d.font.size = "15px";
d.horizontalAlignment = "left";
a = new f(a, d, null);
this.graphicsLayer.add(a);
this.areaGraphics.push(a)
}
/*this.callback(this.graphic ? this.graphic : new f(this.polygon, this.sfs_last, null));
this.deactivate()*/
this.callback(this.graphic ? this.graphic : new f(this.polygon, this.sfs_last, null)), this.polygon.rings[0] && 1 < this.polygon.rings[0].length && (a = new w({
url: "images/measure_clear.png",
width: "12px",
height: "12px",
xoffset: 12,
yoffset: 0
}), e = this.polygon.rings[0][this.polygon.rings[0].length - 1], b = new t(e[0], e[1], this.view.spatialReference), d = new f(b, a, {}), this.graphicsLayer.add(d), d.attributes.graphics = [], d.attributes.graphics = d.attributes.graphics.concat(this.areaGraphics), d.attributes.graphicType = "clear"), this.deactivate();
}
this.downCount++;
e1.stopPropagation()
})));
this.guids.push(g.addEvent(this.viewId, "mousemove", d.hitch(this, function(e) {
var a = new h(e.offsetX, e.offsetY),
a = this.view.toMap(a);
if (0 == this.downCount) this.setTips("单击以开始绘制", e.offsetX, e.offsetY), setTimeout(d.hitch(this, function() {
this.tip.show()
}), 50);
else {
if (1 == this.downCount) this.setTips("单击以继续绘制", e.offsetX, e.offsetY);
else {
var b = this.polygon.clone();
b.rings[0].push([a.x, a.y]);
var c = n.planarArea(b, 109404),
c = Math.abs(c);
1E6 < c ? (c = (c / 1E6).toFixed(1), b = "km²") : (c = c.toFixed(1), b = "m²");
this.setTips('<span style="color:rgb(0, 145, 234);"> ' + c + " </span>" + b + "<br>双击完成操作", e.offsetX, e.offsetY);
this.tip.show()
}
this.changeLineGraphic && this.graphicsLayer.remove(this.changeLineGraphic);
this.changeLineGraphic = new f(this.changePolyLine, this.sls);
this.changePolyLine.paths[0][1] = [a.x, a.y];
this.graphicsLayer.add(this.changeLineGraphic);
e.stopPropagation()
}
})));
break;
case "AREA1":
this.polygon = new q;
this.polygon.spatialReference = this.view.spatialReference;
this.changePolyLine = new l;
this.changePolyLine.spatialReference = this.view.spatialReference;
this.changePolyLine.paths.push([
[],
[]
]);
this.changeLineGraphic = null;
this.areaGraphics = [];
this.guids.push(g.addEvent(this.viewId, "mousedown", d.hitch(this, function(e) {
var e1=e;
if (this.changeLineGraphic) {
this.graphicsLayer.remove(this.changeLineGraphic);
var a = new l;
a.spatialReference = this.view.spatialReference;
a.paths.push([this.changePolyLine.paths[0][0], this.changePolyLine.paths[0][1]]);
a = new f(a, this.sls);
this.graphicsLayer.add(a);
this.areaGraphics.push(a)
}
this.changeLineGraphic = new f(this.changePolyLine, this.sls);
a = new h(e.offsetX, e.offsetY);
a = this.view.toMap(a);
this.changePolyLine.paths[0][0] = [a.x, a.y];
this.changePolyLine.paths[0][1] = [a.x, a.y];
this.graphicsLayer.add(this.changeLineGraphic);
0 == this.polygon.rings.length ? (this.polygon.rings.push([
[a.x, a.y]
]), this.areaGraphics.push(this.changeLineGraphic)) : this.polygon.rings[0].push([a.x, a.y]);
3 <= this.polygon.rings[0].length && (this.graphic && this.graphicsLayer.remove(this.graphic), this.graphic = new f(this.polygon, this.sfs, null), this.graphicsLayer.add(this.graphic));
var a = new Date,
c = a.getTime() - (this.fistDate ? this.fistDate.getTime() : -1);
this.fistDate = a;
if (300 >= c) {
this.polygon.rings[0].push(this.polygon.rings[0][0]);
this.graphic && this.graphicsLayer.remove(this.graphic);
this.graphic = new f(this.polygon, this.sfs_last, null);
this.graphicsLayer.add(this.graphic);
this.areaGraphics.push(this.graphic);
var a = this.polygon.extent.center,
b = n.planarArea(this.polygon, 109404),
b = Math.abs(b);
1E6 < b ? (b = (b / 1E6).toFixed(1), c = "km²") : (b = b.toFixed(1), c = "m²");
if ("0.0" != b) {
var d = this.tx.clone();
//d.text = "总面积:" + b + c;
d.font.size = "15px";
d.horizontalAlignment = "left";
a = new f(a, d, null);
this.graphicsLayer.add(a);
this.areaGraphics.push(a)
}
/*this.callback(this.graphic ? this.graphic : new f(this.polygon, this.sfs_last, null));
this.deactivate()*/
this.callback(this.graphic ? this.graphic : new f(this.polygon, this.sfs_last, null)), this.polygon.rings[0] && 1 < this.polygon.rings[0].length && (a = new w({
url: "images/measure_clear.png",
width: "12px",
height: "12px",
xoffset: 12,
yoffset: 0
}), e = this.polygon.rings[0][this.polygon.rings[0].length - 1], b = new t(e[0], e[1], this.view.spatialReference), d = new f(b, a, {}), this.graphicsLayer.add(d), d.attributes.graphics = [], d.attributes.graphics = d.attributes.graphics.concat(this.areaGraphics), d.attributes.graphicType = "clear"), this.deactivate();
}
this.downCount++;
e1.stopPropagation();
})));
this.guids.push(g.addEvent(this.viewId, "mousemove", d.hitch(this, function(e) {
var a = new h(e.offsetX, e.offsetY),
a = this.view.toMap(a);
if (0 == this.downCount) this.setTips("单击以开始绘制", e.offsetX, e.offsetY), setTimeout(d.hitch(this, function() {
this.tip.show()
}), 50);
else {
if (1 == this.downCount) this.setTips("单击以继续绘制", e.offsetX, e.offsetY);
else {
var b = this.polygon.clone();
b.rings[0].push([a.x, a.y]);
var c = n.planarArea(b, 109404),
c = Math.abs(c);
1E6 < c ? (c = (c / 1E6).toFixed(1), b = "km²") : (c = c.toFixed(1), b = "m²");
this.setTips('<span style="color:rgb(0, 145, 234);"> ' + " </span>" + "双击完成操作", e.offsetX, e.offsetY);
this.tip.show()
}
this.changeLineGraphic && this.graphicsLayer.remove(this.changeLineGraphic);
this.changeLineGraphic = new f(this.changePolyLine, this.sls);
this.changePolyLine.paths[0][1] = [a.x, a.y];
this.graphicsLayer.add(this.changeLineGraphic);
e.stopPropagation()
}
})));
break;
case "LENGTH":
this.polyline = new l;
this.polyline.spatialReference = this.view.spatialReference;
this.changePolyLine = new l;
this.changePolyLine.spatialReference = this.view.spatialReference;
this.changePolyLine.paths.push([
[],
[]
]);
this.changeLineGraphic = null;
this.lengthGraphics = [];
this.guids.push(g.addEvent(this.viewId, "mousedown", d.hitch(this, function(c) {
var a = new Date,
b = a.getTime() - (this.fistDate ? this.fistDate.getTime() : -1);
this.fistDate = a;
if (this.changeLineGraphic) {
this.graphicsLayer.remove(this.changeLineGraphic);
a = new l;
a.spatialReference = this.view.spatialReference;
a.paths.push([this.changePolyLine.paths[0][0], this.changePolyLine.paths[0][1]]);
var e = new f(a, this.sls);
this.graphicsLayer.add(e);
this.lengthGraphics.push(e);
if (300 < b) {
var d = a.paths[0][0],
g = a.paths[0][1],
e = [(d[0] + g[0]) / 2, (d[1] + g[1]) / 2],
m = g[0] - d[0],
g = g[1] - d[1];
0 > m && 0 > g && (m = 0 - m, g = 0 - g);
d = 180 / Math.PI * Math.atan2(g, m);
0 > m && 0 < g && (d = -180 / Math.PI * -Math.atan2(0 - g, 0 - m));
m = new t(e[0], e[1], this.view.spatialReference);
e = this.tx.clone();
a = n.planarLength(a, 9001);
0 != a && (a = 1E3 < a ? (a / 1E3).toFixed(1) + "公里" : a.toFixed(1) + "米", e.text = a, e.angle = -d, a = new f(m, e, null), this.graphicsLayer.add(a), this.lengthGraphics.push(a))
}
}
this.changeLineGraphic = new f(this.changePolyLine, this.sls);
a = new h(c.offsetX, c.offsetY);
a = this.view.toMap(a);
this.changePolyLine.paths[0][0] = [a.x, a.y];
this.changePolyLine.paths[0][1] = [a.x, a.y];
this.graphicsLayer.add(this.changeLineGraphic);
0 == this.downCount && this.lengthGraphics.push(this.changeLineGraphic);
0 == this.polyline.paths.length ? this.polyline.paths.push([
[a.x, a.y]
]) : this.polyline.paths[0].push([a.x, a.y]);
a = new f(a, this.sms, null);
this.graphicsLayer.add(a);
this.lengthGraphics.push(a);
300 >= b && (this.graphic = new f(this.polyline, this.sls, null), this.callback(this.graphic ? this.graphic : new f(this.polyline, this.sls, null)), this.polyline.paths[0] && 1 < this.polyline.paths[0].length && (a = new w({
url: "images/measure_clear.png",
width: "12px",
height: "12px",
xoffset: 12,
yoffset: 0
}), e = this.polyline.paths[0][this.polyline.paths[0].length - 1], b = new t(e[0], e[1], this.view.spatialReference), d = new f(b, a, {}), this.graphicsLayer.add(d), this.lengthGraphics.push(d), e = this.tx.clone(), a = n.planarLength(this.polyline, 9001), 0 != a && (a = 1E3 < a ? (a / 1E3).toFixed(1) + "公里" : a.toFixed(1) + "米", e.text = "总长:" + a, e.horizontalAlignment = "left", b = new f(b, e, null), this.graphicsLayer.add(b), this.lengthGraphics.push(b)), d.attributes.graphics = [], d.attributes.graphics = d.attributes.graphics.concat(this.lengthGraphics), d.attributes.graphicType = "clear"), this.deactivate());
this.downCount++;
c.stopPropagation()
})));
this.guids.push(g.addEvent(this.viewId, "mousemove", d.hitch(this, function(e) {
var a = new h(e.offsetX, e.offsetY),
a = this.view.toMap(a);
// if (0 == this.downCount) this.setTips("单击以开始绘制", e.offsetX, e.offsetY), this.tip.hide();
// else {
var b = this.polyline.clone();
b.paths[0].push([a.x, a.y]);
var c = n.planarLength(b, 9001);
1E3 < c ? (c = (c / 1E3).toFixed(1), b = "公里") : (c = c.toFixed(1), b = "米");
// this.setTips('总长:<span style="color:rgb(0, 145, 234);"> ' + c + " </span>" + b + "<br>双击完成操作", e.offsetX, e.offsetY);
this.tip.show();
this.changeLineGraphic && this.graphicsLayer.remove(this.changeLineGraphic);
this.changeLineGraphic = new f(this.changePolyLine, this.sls);
this.changePolyLine.paths[0][1] = [a.x, a.y];
this.graphicsLayer.add(this.changeLineGraphic);
e.stopPropagation()
// }
})));
break;
case "POINT":
this.downCount = 0;
this.guids.push(g.addEvent(this.viewId, "mousedown", d.hitch(this, function(b) {
var a = new h(b.offsetX, b.offsetY),
a = this.view.toMap(a);
this.graphic = new f(a, this.options.pm, null);
this.graphicsLayer.add(this.graphic);
b.stopPropagation()
})));
this.guids.push(g.addEvent(this.viewId, "mousemove", d.hitch(this, function(b) {
0 == this.downCount ? (this.setTips("", b.offsetX, b.offsetY), this.tip.hide(), this.downCount++) : (this.setTips("单击鼠标添加标记", b.offsetX, b.offsetY), this.tip.show());
b.stopPropagation()
})));
this.guids.push(g.addEvent(this.viewId, "mouseup", d.hitch(this, function(b) {
this.callback(this.graphic);
this.deactivate();
b.stopPropagation()
})));
break;
case "POINT1":
this.downCount = 0;
this.guids.push(g.addEvent(this.viewId, "mousedown", d.hitch(this, function(b) {
var a = new h(b.offsetX, b.offsetY),
a = this.view.toMap(a);
this.graphic = new f(a, this.options1.pm,null);
this.graphicsLayer.add(this.graphic);
b.stopPropagation()
})));
this.guids.push(g.addEvent(this.viewId, "mousemove", d.hitch(this, function(b) {
var a = new h(b.offsetX, b.offsetY),
a = this.view.toMap(a);
0 == this.downCount ? (this.setTips("", b.offsetX, b.offsetY), this.tip.hide(), this.downCount++) : (this.setTips('坐标:<br><span style="color:rgb(0, 145, 234);">X:' +a.x.toFixed(2) + " <br>Y:"+a.y.toFixed(2)+"</span>" + "<br>单击完成操作", b.offsetX, b.offsetY), this.tip.show());
b.stopPropagation()
})));
this.guids.push(g.addEvent(this.viewId, "mouseup", d.hitch(this, function(b) {
this.callback(this.graphic);
this.deactivate();
b.stopPropagation()
})));
break;
case "POLYGON":
this.polygon = new q;
this.polygon.spatialReference = this.view.spatialReference;
this.changePolyLine = new l;
this.changePolyLine.spatialReference = this.view.spatialReference;
this.changePolyLine.paths.push([
[],
[]
]);
this.changeLineGraphic = null;
this.fistDate = new Date;
this.guids.push(g.addEvent(this.viewId, "mousedown", d.hitch(this, this.mouseDown_PolyLineAndPolygon)));
this.guids.push(g.addEvent(this.viewId, "mousemove", d.hitch(this, this.mouseMove_PolyLineAndPolygon)));
break;
case "FREEHAND_POLYGON":
this.polygon = new q;
this.polygon.spatialReference = this.view.spatialReference;
this.polygon.rings.push([]);
this.changePolyLine = new l;
this.changePolyLine.spatialReference = this.view.spatialReference;
this.changePolyLine.paths.push([]);
this.changeLineGraphic = null;
this.guids.push(g.addEvent(this.viewId, "mousedown", d.hitch(this, this.mouseDown_freePolygon)));
this.guids.push(g.addEvent(this.viewId, "mousemove", d.hitch(this, this.mouseMove_freePolygon)));
this.guids.push(g.addEvent(this.viewId, "mouseup", d.hitch(this, this.mouseUp_freePolygon)));
break;
case "EXTENT":
this.polygon = new q;
this.polygon.spatialReference = this.view.spatialReference;
this.downCount = 0;
this.polygon.rings.push([
[],
[],
[],
[],
[]
]);
this.startPoint = null;
this.guids.push(g.addEvent(this.viewId, "mousedown", d.hitch(this, this.mouseDown_extent)));
this.guids.push(g.addEvent(this.viewId, "mousemove", d.hitch(this, this.mouseMove_extent)));
this.guids.push(g.addEvent(this.viewId, "mouseup", d.hitch(this, this.mouseUp_extent)));
break;
case "CIRCLE":
this.polygon = new q;
this.polygon.spatialReference = this.view.spatialReference;
this.endPoint = this.startPoint = null;
this.guids.push(g.addEvent(this.viewId, "mousedown", d.hitch(this, this.mouseDown_cirle)));
this.guids.push(g.addEvent(this.viewId, "mousemove", d.hitch(this, this.mouseMove_cirle)));
this.guids.push(g.addEvent(this.viewId, "mouseup", d.hitch(this, this.mouseUp_cirle)));
break;
case "POINT_S":
this.downCount = 0;
this.guids.push(g.addEvent(this.viewId, "mousedown", d.hitch(this, function(b) {
var a = new h(b.offsetX, b.offsetY),
a = this.view.toMap(a);
this.graphic = new f(a, this.sms, null);
this.graphicsLayer.add(this.graphic);
b.stopPropagation()
})));
this.guids.push(g.addEvent(this.viewId, "mousemove", d.hitch(this, function(b) {
0 == this.downCount ? (this.setTips("", b.offsetX, b.offsetY), this.tip.hide(), this.downCount++) : (this.setTips("单击鼠标添加点", b.offsetX, b.offsetY), this.tip.show());
b.stopPropagation()
})));
this.guids.push(g.addEvent(this.viewId, "mouseup", d.hitch(this, function(b) {
this.callback(this.graphic);
this.deactivate();
b.stopPropagation()
})));
break;
case "LINE_S":
this.polyline = new l, this.polyline.spatialReference = this.view.spatialReference, this.changePolyLine = new l, this.changePolyLine.spatialReference = this.view.spatialReference, this.changePolyLine.paths.push([
[],
[]
]), this.changeLineGraphic = null, this.guids.push(g.addEvent(this.viewId, "mousedown", d.hitch(this, function(b) {
var a = new Date,
c = a.getTime() - (this.fistDate ? this.fistDate.getTime() : -1);
this.fistDate = a;
this.changeLineGraphic && (this.graphicsLayer.remove(this.changeLineGraphic), a = new l, a.spatialReference = this.view.spatialReference, a.paths.push([this.changePolyLine.paths[0][0], this.changePolyLine.paths[0][1]]), a = new f(a, this.sls), this.graphicsLayer.add(a));
this.changeLineGraphic = new f(this.changePolyLine, this.sls);
a = new h(b.offsetX, b.offsetY);
a = this.view.toMap(a);
this.changePolyLine.paths[0][0] = [a.x, a.y];
this.changePolyLine.paths[0][1] = [a.x, a.y];
this.graphicsLayer.add(this.changeLineGraphic);
0 == this.polyline.paths.length ? this.polyline.paths.push([
[a.x, a.y]
]) : this.polyline.paths[0].push([a.x, a.y]);
300 >= c && (this.graphic = new f(this.polyline, this.sls, null), this.callback(this.graphic ? this.graphic : new f(this.polyline, this.sls, null)), this.deactivate());
this.downCount++;
b.stopPropagation()
}))), this.guids.push(g.addEvent(this.viewId, "mousemove", d.hitch(this, function(b) {
var a = new h(b.offsetX, b.offsetY),
a = this.view.toMap(a);
0 == this.downCount ? (this.setTips("单击以开始绘制", b.offsetX, b.offsetY), this.tip.hide()) : (this.setTips("双击完成操作", b.offsetX, b.offsetY), this.tip.show(), this.changeLineGraphic && this.graphicsLayer.remove(this.changeLineGraphic), this.changeLineGraphic = new f(this.changePolyLine, this.sls), this.changePolyLine.paths[0][1] = [a.x, a.y], this.graphicsLayer.add(this.changeLineGraphic), b.stopPropagation())
})))
}
this.view.on('double-click',function(e){
e.stopPropagation()
});
this.guids.push(g.addEvent(this.viewId, "mouseout", d.hitch(this, this.mouseout_tool)));
this.guids.push(g.addEvent(this.viewId, "mouseover", d.hitch(this, this.mouseover_tool)));
this.guids.push(g.addEvent(this.viewId, "pointerdown", d.hitch(this, function() {
if(this.drawType=='EXTENT'||this.drawType=='CIRCLE'||this.drawType=='FREEHAND_POLYGON'){
$(".esri-view-surface").css("pointer-events", "none")
}else{
$(".esri-view-surface").css("pointer-events", "auto")
}
})));
this.guids.push(g.addEvent(this.viewId, "pointermove", d.hitch(this, function() {
if(this.drawType=='EXTENT'||this.drawType=='CIRCLE'||this.drawType=='FREEHAND_POLYGON'){
$(".esri-view-surface").css("pointer-events", "none")
}else{
$(".esri-view-surface").css("pointer-events", "auto")
}
})))
},
mouseout_tool: function(c) {
"" != this.drawType && this.tip.is(":hidden") && this.tip.show()
},
mouseover_tool: function(c) {
"" == this.drawType || this.tip.is(":hidden") || this.tip.hide()
},
mouseDown_PolyLineAndPolygon: function(c) {
this.downCount++;
if (this.changeLineGraphic) {
this.graphicsLayer.remove(this.changeLineGraphic);
var b = new l;
b.spatialReference = this.view.spatialReference;
b.paths.push([this.changePolyLine.paths[0][0], this.changePolyLine.paths[0][1]]);
this.graphicsLayer.add(new f(b, this.sls))
}
this.changeLineGraphic = new f(this.changePolyLine, this.sls);
b = new h(c.offsetX, c.offsetY);
b = this.view.toMap(b);
this.changePolyLine.paths[0][0] = [b.x, b.y];
this.changePolyLine.paths[0][1] = [b.x, b.y];
this.graphicsLayer.add(this.changeLineGraphic);
0 == this.polygon.rings.length ? this.polygon.rings.push([
[b.x, b.y]
]) : this.polygon.rings[0].push([b.x, b.y]);
3 <= this.polygon.rings[0].length && (this.graphic && this.graphicsLayer.remove(this.graphic), this.graphic = new f(this.polygon, this.sfs, null), this.graphicsLayer.add(this.graphic));
var b = new Date,
d = b.getTime() - this.fistDate.getTime();
this.fistDate = b;
300 >= d && (this.polygon.rings[0].push(this.polygon.rings[0][0]), this.graphic && this.graphicsLayer.remove(this.graphic), this.graphic = new f(this.polygon, this.sfs_last, null), this.graphicsLayer.add(this.graphic), this.callback(this.graphic ? this.graphic : new f(this.polygon, this.sfs_last, null)), this.deactivate());
c.stopPropagation()
},
mouseMove_PolyLineAndPolygon: function(c) {
if (0 == this.downCount) this.setTips("单击以开始绘制", c.offsetX, c.offsetY), setTimeout(d.hitch(this, function() {
this.tip.show()
}), 50);
else {
1 == this.downCount ? this.setTips("单击以继续绘制", c.offsetX, c.offsetY) : this.setTips("双击完成操作", c.offsetX, c.offsetY);
this.changeLineGraphic && this.graphicsLayer.remove(this.changeLineGraphic);
this.changeLineGraphic = new f(this.changePolyLine, this.sls);
var b = new h(c.offsetX, c.offsetY),
b = this.view.toMap(b);
this.changePolyLine.paths[0][1] = [b.x, b.y];
this.graphicsLayer.add(this.changeLineGraphic);
c.stopPropagation()
}
},
mouseDown_freePolygon: function(c) {
this.downCount++;
c.stopPropagation()
},
mouseMove_freePolygon: function(c) {
if (0 == this.downCount) this.setTips("按下鼠标以开始绘制并释放以完成绘制", c.offsetX, c.offsetY), setTimeout(d.hitch(this, function() {
this.tip.show()
}), 50);
else {
this.tip.hide();
var b = new h(c.offsetX, c.offsetY),
b = this.view.toMap(b);
this.polygon.rings[0].push([b.x, b.y]);
this.changePolyLine.paths[0].push([b.x, b.y]);
3 <= this.polygon.rings[0].length && (this.graphic && this.graphicsLayer.remove(this.graphic), this.graphic = new f(this.polygon, this.sfs, null), this.graphicsLayer.add(this.graphic));
2 <= this.changePolyLine.paths[0].length && (this.changeLineGraphic && this.graphicsLayer.remove(this.changeLineGraphic), this.changeLineGraphic = new f(this.changePolyLine, this.sls, null), this.graphicsLayer.add(this.changeLineGraphic));
c.stopPropagation()
}
},
mouseUp_freePolygon: function(c) {
0 < this.polygon.rings[0].length && (this.polygon.rings[0].push(this.polygon.rings[0][0]), this.graphic && this.graphicsLayer.remove(this.graphic), this.graphic = new f(this.polygon, this.sfs_last, null), this.graphicsLayer.add(this.graphic));
this.callback(this.graphic ? this.graphic : new f(this.polygon, this.sfs_last, null));
this.deactivate();
c.stopPropagation()
},
mouseDown_extent: function(c) {
var b = new h(c.offsetX, c.offsetY);
this.startPoint = this.view.toMap(b);
this.polygon.rings[0][0] = [this.startPoint.x, this.startPoint.y];
this.polygon.rings[0][4] = [this.startPoint.x, this.startPoint.y];
this.downCount++;
c.stopPropagation()
},
mouseMove_extent: function(c) {
if (0 == this.downCount) this.setTips("按下鼠标以开始绘制并释放以完成绘制", c.offsetX, c.offsetY), setTimeout(d.hitch(this, function() {
this.tip.show()
}), 50);
else {
this.tip.hide();
var b = new h(c.offsetX, c.offsetY),
b = this.view.toMap(b);
this.polygon.rings[0][1] = [this.startPoint.x, b.y];
this.polygon.rings[0][3] = [b.x, this.startPoint.y];
this.polygon.rings[0][2] = [b.x, b.y];
3 <= this.polygon.rings[0].length && (this.graphic && this.graphicsLayer.remove(this.graphic), this.graphic = new f(this.polygon, this.sfs_last, null), this.graphicsLayer.add(this.graphic));
c.stopPropagation()
}
},
mouseUp_extent: function(c) {
this.callback(this.graphic ? this.graphic : new f(this.polygon, this.sfs_last, null));
this.deactivate();
c.stopPropagation()
},
mouseDown_cirle: function(c) {
var b = new h(c.offsetX, c.offsetY);
this.startPoint = this.view.toMap(b);
this.downCount++;
c.stopPropagation()
},
mouseMove_cirle: function(c) {
if (0 == this.downCount) this.setTips("按下鼠标以开始绘制并释放以完成绘制", c.offsetX, c.offsetY), setTimeout(d.hitch(this, function() {
this.tip.show()
}), 50);
else {
this.tip.hide();
var b = new h(c.offsetX, c.offsetY);
this.endPoint = this.view.toMap(b);
(this.polygon = n.buffer(this.startPoint, Math.sqrt(Math.pow(this.endPoint.x - this.startPoint.x, 2) + Math.pow(this.endPoint.y - this.startPoint.y, 2)), 9001)) && 3 <= this.polygon.rings[0].length && (this.graphic && this.graphicsLayer.remove(this.graphic), this.graphic = new f(this.polygon, this.sfs_last, null), this.graphicsLayer.add(this.graphic));
c.stopPropagation()
}
},
mouseUp_cirle: function(c) {
this.callback(this.graphic ? this.graphic : new f(this.polygon, this.sfs_last, null));
this.deactivate();
c.stopPropagation()
},
deactivate: function() {
g.removeEvents(this.viewId, this.guids);
$(".esri-view-surface").css("pointer-events", "auto");
v.publish("atts-open", !0);
this.active = !1;
this.drawType = "";
this.endPoint = this.startPoint = this.fistDate = this.graphic = this.changeLineGraphic = this.changePolyLine = this.polyline = this.polygon = null;
this.downCount = 0;
this.tip.hide()
},
setTips: function(c, b, d) {
this.tip.html(c);
this.tip.css("top", d);
this.tip.css("left", b + 20)
}
});
r.getInstance = function(c, b, d) {
null === p ? p = new r(c, b, d) : (p.view = c, p.map = b, p.options = d);
return p
};
return r
});