-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOverlayC2IP.clw
More file actions
2095 lines (1741 loc) · 72.1 KB
/
Copy pathOverlayC2IP.clw
File metadata and controls
2095 lines (1741 loc) · 72.1 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
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
MEMBER('learnMil')
OMIT('***')
* Created with Clarion 10.0
* User: mihai.palade
* Date: 16.01.2019
* Time: 19:57
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
***
MAP
END
INCLUDE('Equates.CLW'),ONCE
INCLUDE('pmC2IPLibrary.INC'),ONCE
! Local objects
! JSON objects
json CLASS(JSONClass)
reference &UnitsQueue
!AddByReference PROCEDURE (StringTheory pName,JSONClass pJson),VIRTUAL
AddByReference PROCEDURE (StringTheory pName,JSONClass pJson)
Construct PROCEDURE()
Destruct PROCEDURE(), VIRTUAL
END
collection &JSONClass
subItem &JSONClass
ActionsJSON CLASS(JSONClass)
!AssignValue PROCEDURE (JSONClass pJson,StringTheory pName,|
! *Group pGroup,*Long pIndex,Long pColumnOffset),VIRTUAL
END
! string theory objects
sst stringtheory
json.Construct PROCEDURE
CODE
PARENT.Construct
self.reference &= NEW(UnitsQueue)
json.Destruct PROCEDURE
CODE
DISPOSE(self.reference)
PARENT.Destruct()
OverlayC2IP.SelectByMouse PROCEDURE(LONG nXPos, LONG nYPos)
CODE
sst.Trace('OverlayC2IP.SelectByMouse BEGIN')
IF PARENT.SelectByMouse(nXPos, nYPos) = TRUE THEN
! BSO found
sst.Trace(' OverlayC2IP.SelectByMouse : BSO found')
sst.Trace(' OverlayC2IP.SelectByMouse = ' & TRUE)
ret# = TRUE
ELSE
! verify the Actions
sst.Trace(' OverlayC2IP.SelectByMouse : verify for Action')
actionFoundPos# = SELF.al.CheckByMouse(nXPos, nYPos)
MESSAGE('actionFoundPos# = ' & actionFoundPos#)
IF actionFoundPos# > 0 THEN
MESSAGE('found Action = ' & actionFoundPos#)
IF SELF.prevActionSelection <> 0 THEN
SELF.DisplayUnselection(SELF.prevActionSelection)
END
SELF.DisplaySelection(actionFoundPos#)
SELF.prevActionSelection = actionFoundPos#
END
IF actionFoundPos# > 0 THEN
ret# = TRUE
ELSE
ret# = FALSE
END
END
sst.Trace(' OverlayC2IP.SelectByMouse : actionFoundPos# = ' & actionFoundPos#)
sst.Trace('OverlayC2IP.SelectByMouse BEGIN')
RETURN ret#
OverlayC2IP.SelectDrawingByMouse PROCEDURE(LONG nXPos, LONG nYPos)
CODE
actionFoundPos# = SELF.al.CheckByMouse(nXPos, nYPos)
!MESSAGE('actionFoundPos# = ' & actionFoundPos#)
IF actionFoundPos# > 0 THEN
!MESSAGE('found Action = ' & actionFoundPos#)
IF SELF.prevActionSelection <> 0 THEN
SELF.DisplayUnselection(SELF.prevActionSelection)
END
SELF.DisplaySelection(actionFoundPos#)
SELF.prevActionSelection = actionFoundPos#
RETURN TRUE
END
RETURN FALSE
OverlayC2IP.CheckByMouse PROCEDURE(LONG nXPos, LONG nYPos)
CODE
sst.Trace('OverlayC2IP.CheckByMouse BEGIN')
ret# = PARENT.CheckByMouse(nXPos, nYPos)
sst.Trace(' OverlayC2IP.CheckByMouse : parent.CheckByMouse = ' & ret#)
sst.Trace('OverlayC2IP.CheckByMouse END')
RETURN ret#
OverlayC2IP.CheckDrawingByMouse PROCEDURE(LONG nXPos, LONG nYPos)
CODE
RETURN SELF.al.CheckByMouse(nXPos, nYPos)
OverlayC2IP.MoveTo PROCEDURE(LONG nXPos, LONG nYPos)
CODE
PARENT.MoveTo(nXPos, nYPos)
SELF.Redraw()
RETURN TRUE
OverlayC2IP.MoveDrawingTo PROCEDURE(LONG nXPos, LONG nYPos)
movingAction GROUP(ActionBasicRecord)
END
CODE
sst.Trace('OverlayC2IP.MoveDrawingTo BEGIN')
!something
! move with dx & dy
dx# = nXPos - SELF.refSelectedXPos
dy# = nYPos - SELF.refSelectedYPos
sst.Trace(' OverlayC2IP.MoveDrawingTo translate(' & dx# & ',' & dy# & ')')
SELF.al.ChangeActionPos(SELF.selectedDrawingPos, dx#, dy#)
SELF.Redraw()
sst.Trace('OverlayC2IP.MoveDrawingTo END')
RETURN TRUE
OverlayC2IP.Construct PROCEDURE()
CODE
PARENT.Construct()
! the selected BSO is moved, default = FALSE
SELF.isBSOMoved = FALSE
SELF.isDrawingMoved = FALSE
SELF.PolyPoints = 0
SELF.pp &= NEW(PosList)
SELF.al &= NEW(ActionsCollection)
SELF.isDrawingSelection = FALSE
SELF.prevActionSelection = 0
SELF.textBuffer = ''
SELF.selectedDrawingClass &= NEW(Action)
OverlayC2IP.Destruct PROCEDURE()
CODE
DISPOSE(SELF.selectedDrawingClass)
DISPOSE(SELF.pp)
DISPOSE(SELF.al)
PARENT.Destruct()
OverlayC2IP.Redraw PROCEDURE()
CODE
PARENT.Redraw()
SELF.drwImg.Setpencolor(COLOR:Black)
SELF.drwImg.SetPenWidth(1)
! background map
IF LEN(CLIP(SELF.map)) > 0 THEN
SELF.drwImg.Image(1, 1, , , SELF.map)
END
! draw Units
!MESSAGE('units = ' & RECORDS(SELF.ul.ul))
LOOP i# = 1 TO RECORDS(SELF.ul.ul)
GET(SELF.ul.ul, i#)
IF NOT ERRORCODE() THEN
! Draw Main Symbol
SELF.DrawNode_MainSymbol()
! Draw Echelon
SELF.DrawNode_Echelon()
! Draw HQ
SELF.DrawNode_HQ()
END
END
! draw actions
!MESSAGE('actions = ' & RECORDS(SELF.al.al))
LOOP i# = 1 TO RECORDS(SELF.al.al)
GET(SELF.al.al, i#)
IF NOT ERRORCODE() THEN
! draw action
SELF.DrawAction()
END
END
SELF.drwImg.Display()
!MESSAGE('Finish Overlay Redraw')
OverlayC2IP.DeployBSO PROCEDURE(*UnitBasicRecord pUrec, LONG nXPos, LONG nYPos)
CODE
!sst.Trace('BEGIN:OverlayC2IP.DeployBSO')
!sst.Trace('nXPos = ' & nXPos & ', nYPos = ' & nYPos)
pUrec.xPos = nXPos
pUrec.yPos = nYPos
errCode# = SELF.ul.AddNode(pUrec)
IF errCode# = TRUE THEN
SELF.Redraw()
SELF.DisplaySelection()
END
!sst.Trace('END:OverlayC2IP.DeployBSO')
RETURN TRUE
OverlayC2IP.AttachC2IP PROCEDURE(STRING sFileName)
jsonItem &JSONClass
sC2IPName STRING(100)
CODE
! do something
json.LoadFile(sFileName)
i# = json.Records()
! C2IP Name
jsonItem &= json.GetByName('C2IPName')
IF NOT jsonItem &= Null THEN
sC2IPName = json.GetValueByName('C2IPName')
SELF.refC2IPs.C2IPPath = sFileName
SELF.refC2IPs.C2IPName = sC2IPName
ADD(SELF.refC2IPs)
RETURN TRUE
ELSE
RETURN FALSE
END
OverlayC2IP.AttachMap PROCEDURE(STRING sFileName)
CODE
SELF.map = sFileName
!SELF.drwImg.Image(1, 1, , , sFileName)
SELF.Redraw()
RETURN TRUE
OverlayC2IP.SetGeometry PROCEDURE(LONG nGeometry)
CODE
SELF.geometry = nGeometry
RETURN TRUE
OverlayC2IP.SetActionTypeCode PROCEDURE(STRING sActionTypeCode)
CODE
SELF.actionTypeCode = CLIP(sActionTypeCode)
RETURN TRUE
OverlayC2IP.SetAction PROCEDURE(STRING sActionTypeCode, LONG nGeometry)
CODE
SELF.actionTypeCode = CLIP(sActionTypeCode)
SELF.geometry = nGeometry
SELF.isDrawingSelection = TRUE
SELF.isPointsCollection = TRUE
SELF.isMouseDown = FALSE
RETURN TRUE
OverlayC2IP.TakeNodeAction PROCEDURE(LONG nOption)
startPos GROUP(PosRecord)
END
endPos GROUP(PosRecord)
END
CODE
! do something
SELF.isDrawingSelection = FALSE
CASE nOption
OF 1
! Advance to contact
SELF.actionTypeCode = aTpy:AdvanceToContact
SELF.geometry = g:AxisAdvance
SELF.isPointsCollection = TRUE
SELF.isMouseDown = FALSE
OF 2
! Ambush
SELF.actionTypeCode = aTpy:Ambush
SELF.geometry = g:Ambush
SELF.isPointsCollection = TRUE
SELF.isMouseDown = FALSE
OF 3
! Arrest
SELF.actionTypeCode = aTpy:CAI_Arrest
SELF.geometry = g:Circle
SELF.isPointsCollection = TRUE
SELF.isMouseDown = FALSE
OF 4
! Attack
SELF.actionTypeCode = aTpy:AxisOfAdvance_SupportingAttack
SELF.geometry = g:AxisAdvance
SELF.isPointsCollection = TRUE
SELF.isMouseDown = FALSE
OF 5
! Attack By Fire
SELF.actionTypeCode = aTpy:AttackByFirePosition
SELF.geometry = g:LineWithBase
SELF.isPointsCollection = TRUE
SELF.isMouseDown = FALSE
OF 6
! Block
SELF.actionTypeCode = aTpy:Block
SELF.geometry = g:LineWithHeader
SELF.isPointsCollection = TRUE
SELF.isMouseDown = FALSE
OF 7
! Breach
SELF.actionTypeCode = aTpy:Breach
SELF.geometry = g:Breach
SELF.isPointsCollection = TRUE
SELF.isMouseDown = FALSE
OF 8
! Bypass
OF 9
! Canalize
OF 10
! Capture
OF 11
! Clear
OF 12
! Contain
OF 13
! Control
OF 14
! Counterattack
OF 15
! Counterattack By Fire
OF 16
! Cover
OF 17
! Conduct Deception
OF 18
! Delay
OF 19
! Demonstrate
OF 20
! Deny
OF 21
! Disengage
OF 22
! Disrupt
OF 23
! Envelop
OF 24
! Escort
OF 25
! Exfiltrate
OF 26
! Conduct Exploitation
OF 27
! Feint
OF 28
! Fix
OF 29
! Follow and Assume
OF 30
! Follow and Support
OF 31
! Guard
OF 32
! Infiltrate
OF 33
! Interdict
OF 34
! Isolate
OF 35
! Locate
OF 36
! Neutralize
OF 37
! Occupy
OF 38
! Penetrate
OF 39
! Pursue
OF 40
! Recover
OF 41
! Relief In Place
OF 42
! Retain
OF 43
! Retire
OF 44
! Screen
OF 45
! Secure
OF 46
! Seize
OF 47
! Support By Fire
OF 48
! Suppress
OF 49
! Turn
OF 50
! Withdraw
OF 51
! Withdraw Under Pressure
END
RETURN TRUE
OverlayC2IP.NodeActionsMenuOptions PROCEDURE()
actMenuOpt STRING(1000)
CODE
! do something
actMenuOpt = 'Advance To Contact'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Ambush'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Arrest'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Attack'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Attack By Fire'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Block'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Breach'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Bypass'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Canalize'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Capture'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Clear'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Contain'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Control'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Counterattack'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Counterattack By Fire'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Cover'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Conduct Deception'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Delay'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Demonstrate'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Deny'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Disengage'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Disrupt'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Envelop'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Escort'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Exfiltrate'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Conduct Exploitation'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Feint'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Fix'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Follow and Assume'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Follow and Support'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Guard'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Infiltrate'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Interdict'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Isolate'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Locate'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Neutralize'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Occupy'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Penetrate'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Pursue'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Recover'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Relief In Place'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Retain'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Retire'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Screen'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Secure'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Seize'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Support By Fire'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Suppress'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Turn'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Withdraw'
actMenuOpt = CLIP(actMenuOpt) & '| ' & 'Withdraw Under Pressure'
RETURN actMenuOpt
OverlayC2IP.DA_SupportingAttack PROCEDURE(PosRecord startPos, PosRecord endPos)
CODE
dX# = endPos.xPos - startPos.xPos
dY# = endPos.yPos - startPos.yPos
i# = SQRT(dX#*dX# + dY#*dY#)
SELF.drwImg.Line(startPos.xPos, startPos.yPos, dX#, dY#)
SELF.drwImg.Line(endPos.xPos, endPos.yPos, -(0.15*i#), -(0.15*i#))
SELF.drwImg.Line(endPos.xPos, endPos.yPos, -(0.15*i#), +(0.15*i#))
!SELF.drwImg.Display()
!MESSAGE('DA_SupportingAttack')
OverlayC2IP.DA_AxisOfAdvance PROCEDURE(PosRecord startPos, PosRecord endPos)
CODE
SELF.drwImg.Line(startPos.xPos, startPos.yPos, endPos.xPos - startPos.xPos, endPos.yPos - startPos.yPos)
dx# = endPos.xPos - startPos.xPos
dy# = endPos.yPos - startPos.yPos
L# = SQRT(dx#*dx# + dy#*dy#)
wdth# = 20
lx# = dy#*wdth#/L#
ly# = dx#*wdth#/L#
SELF.drwImg.Line(startPos.xPos - lx#, startPos.yPos + ly#, dx#, dy#)
SELF.drwImg.Line(startPos.xPos + lx#, startPos.yPos - ly#, dx#, dy#)
llx# = dy#*2*wdth#/L#
lly# = dx#*2*wdth#/L#
SELF.drwImg.Line(endPos.xPos, endPos.yPos, -llx#, lly#)
SELF.drwImg.Line(endPos.xPos, endPos.yPos, llx#, -lly#)
hght# = 20
hx# = hght#*dx#/L#
hy# = hght#*dy#/L#
SELF.drwImg.Line(endPos.xPos, endPos.yPos, hx#, hy#)
SELF.drwImg.SetPenStyle(PEN:solid)
SELF.drwImg.Display()
!OverlayC2IP.DA_AxisOfAdvance PROCEDURE(PosRecord startPos, PostRecord endPos)
! CODE
! SELF.drwImg.Line(startPos.xPos, startPos.yPos, endPos.xPos - startPos.xPos, endPos.yPos - startPos.yPos)
!
!
! dx# = endPos.xPos - startPos.xPos
! dy# = endPos.yPos - startPos.yPos
! L# = SQRT(dx#*dx# + dy#*dy#)
! wdth# = 20
!
! lx# = dy#*wdth#/L#
! ly# = dx#*wdth#/L#
!
! SELF.drwImg.Line(startPos.xPos - lx#, startPos.yPos + ly#, dx#, dy#)
! SELF.drwImg.Line(startPos.xPos + lx#, startPos.yPos - ly#, dx#, dy#)
!
! llx# = dy#*2*wdth#/L#
! lly# = dx#*2*wdth#/L#
!
! SELF.drwImg.Line(endPos.xPos, endPos.yPos, -llx#, lly#)
! SELF.drwImg.Line(endPos.xPos, endPos.yPos, llx#, -lly#)
!
! hght# = 20
!
! hx# = hght#*dx#/L#
! hy# = hght#*dy#/L#
!
! SELF.drwImg.Line(endPos.xPos, endPos.yPos, hx#, hy#)
!
! SELF.drwImg.SetPenStyle(PEN:solid)
! SELF.drwImg.Display()
OverlayC2IP.DA_Ambush PROCEDURE(PosRecord startPos, PosRecord endPos)
CODE
dx# = endPos.xPos - startPos.xPos
dy# = endPos.yPos - startPos.yPos
! median line
SELF.drwImg.Line(startPos.xPos, startPos.yPos, dx#, dy#)
! arrow cup
! base arc
SELF.drwImg.Arc(startPos.xPos - 10, startPos.yPos - 10, 10, 10, 0, 90)
SELF.drwImg.Arc(startPos.xPos, startPos.yPos, 10, 10, 0, 90)
! display preview
SELF.drwImg.SetPenStyle(PEN:solid)
SELF.drwImg.Display()
OverlayC2IP.DA_Arrest PROCEDURE(PosRecord startPos, PosRecord endPos)
CODE
dx# = endPos.xPos - startPos.xPos
dy# = endPos.yPos - startPos.yPos
! circle
SELF.drwImg.Arc(startPos.xPos -dx#/2, startPos.yPos -dy#/2, dx#, dy#, 0, 3599)
! display preview
SELF.drwImg.SetPenStyle(PEN:solid)
SELF.drwImg.Display()
OverlayC2IP.DA_Block PROCEDURE(PosRecord startPos, PosRecord endPos)
CODE
dx# = endPos.xPos - startPos.xPos
dy# = endPos.yPos - startPos.yPos
L# = SQRT(dx#*dx# + dy#*dy#)
wdth# = 20
lx# = dy#*wdth#/L#
ly# = dx#*wdth#/L#
! median line
SELF.drwImg.Line(startPos.xPos, startPos.yPos, dx#, dy#)
! small header line
SELF.drwImg.Line(endPos.xPos, endPos.yPos, -lx#, -ly#)
SELF.drwImg.Line(endPos.xPos, endPos.yPos, lx#, ly#)
! display preview
SELF.drwImg.SetPenStyle(PEN:solid)
SELF.drwImg.Display()
OverlayC2IP.DA_Breach PROCEDURE(PosRecord startPos, PosRecord endPos)
CODE
dx# = endPos.xPos - startPos.xPos
dy# = endPos.yPos - startPos.yPos
L# = SQRT(dx#*dx# + dy#*dy#)
wdth# = 20
lx# = dy#*wdth#/L#
ly# = dx#*wdth#/L#
! main symbol
! corridor lines
SELF.drwImg.Line(startPos.xPos - lx#, startPos.yPos + ly#, dx#, dy#)
SELF.drwImg.Line(startPos.xPos + lx#, startPos.yPos - ly#, dx#, dy#)
! base line
SELF.drwImg.Line(startPos.xPos - lx#, startPos.yPos + ly#, ABS(2*lx#), ABS(2*ly#))
! display preview
SELF.drwImg.SetPenStyle(PEN:solid)
SELF.drwImg.Display()
OverlayC2IP.TakePoints PROCEDURE(PosRecord startPos, PosRecord endPos)
CODE
startPos.xPos = SELF.ul.xPos()
startPos.yPos = SELF.ul.yPos()
endPos.xPos = startPos.xPos + 50
endPos.yPos = startPos.yPos - 30
OverlayC2IP.InsertAction PROCEDURE()
actionRec GROUP(ActionBasicRecord)
END
selBSO GROUP(UnitBasicRecord)
END
targetBSO GROUP(UnitBasicRecord)
END
targetAction GROUP(ActionBasicRecord)
END
CODE
sst.Trace('OverlayC2IP.InsertAction BEGIN')
ASSERT(SELF.ul.GetNode(selBSO), 'UnitsCollection.GetNode() error')
CASE CLIP(SELF.actionTypeCode)
OF aTpy:notDefined
! not Defined
actionRec.ActionName = 'aTpy:notDefined'
actionRec.ActionType = 0
actionRec.ActionTypeCode = aTpy:notDefined
! action Points
actionRec.ActionPointsNumber = 2
actionRec.ActionPoints &= NEW(PosList)
actionRec.ActionPoints.xPos = SELF.p1x
actionRec.ActionPoints.yPos = SELF.p1y
ADD(actionRec.ActionPoints)
actionRec.ActionPoints.xPos = SELF.drwImg.MouseX()
actionRec.ActionPoints.yPos = SELF.drwImg.MouseY()
ADD(actionRec.ActionPoints)
OF aTpy:notDef_Line
! a generic Line
actionRec.ActionName = 'aTpy:notDef_Line'
actionRec.ActionType = 0
actionRec.ActionTypeCode = aTpy:notDef_Line
! action points
actionRec.ActionPointsNumber = 2
actionRec.ActionPoints &= NEW(PosList)
actionRec.ActionPoints.xPos = SELF.p1x
actionRec.ActionPoints.yPos = SELF.p1y
ADD(actionRec.ActionPoints)
actionRec.ActionPoints.xPos = SELF.drwImg.MouseX()
actionRec.ActionPoints.yPos = SELF.drwImg.MouseY()
ADD(actionRec.ActionPoints)
OF aTpy:notDef_Rectangle
! a generic Rectangle
actionRec.ActionName = 'aTpy:notDef_Rectangle'
actionRec.ActionType = 0
actionRec.ActionTypeCode = aTpy:notDef_Rectangle
! action points
actionRec.ActionPointsNumber = 2
actionRec.ActionPoints &= NEW(PosList)
actionRec.ActionPoints.xPos = SELF.p1x
actionRec.ActionPoints.yPos = SELF.p1y
ADD(actionRec.ActionPoints)
actionRec.ActionPoints.xPos = SELF.drwImg.MouseX()
actionRec.ActionPoints.yPos = SELF.drwImg.MouseY()
ADD(actionRec.ActionPoints)
OF aTpy:notDef_Polygon
! a generic Polygon
actionRec.ActionName = 'aTpy:notDef_Polygon'
actionRec.ActionType = 0
actionRec.ActionTypeCode = aTpy:notDef_Polygon
! action points
actionRec.ActionPointsNumber = 2
actionRec.ActionPoints &= NEW(PosList)
actionRec.ActionPoints.xPos = SELF.p1x
actionRec.ActionPoints.yPos = SELF.p1y
ADD(actionRec.ActionPoints)
actionRec.ActionPoints.xPos = SELF.drwImg.MouseX()
actionRec.ActionPoints.yPos = SELF.drwImg.MouseY()
ADD(actionRec.ActionPoints)
OF aTpy:notDef_FreeHand
! a generic Free Hand
actionRec.ActionName = 'aTpy:notDef_FreeHand'
actionRec.ActionType = 0
actionRec.ActionTypeCode = aTpy:notDef_FreeHand
! action points
actionRec.ActionPointsNumber = SELF.PolyPoints
actionRec.ActionPoints &= NEW(PosList)
LOOP i# = 1 TO SELF.PolyPoints
GET(SELF.pp, i#)
IF NOT ERRORCODE() THEN
actionRec.ActionPoints.xPos = SELF.pp.xPos
actionRec.ActionPoints.yPos = SELF.pp.yPos
ADD(actionRec.ActionPoints)
END
END
OF aTpy:AdvanceToContact
! Advance to contact
OF aTpy:Ambush
! Ambush
actionRec.ActionName = 'aTpy:Ambush'
actionRec.ActionType = 0
actionRec.ActionTypeCode = aTpy:Ambush
! action points
actionRec.ActionPointsNumber = 2
actionRec.ActionPoints &= NEW(PosList)
actionRec.ActionPoints.xPos = SELF.p1x
actionRec.ActionPoints.yPos = SELF.p1y
ADD(actionRec.ActionPoints)
actionRec.ActionPoints.xPos = SELF.drwImg.MouseX()
actionRec.ActionPoints.yPos = SELF.drwImg.MouseY()
ADD(actionRec.ActionPoints)
OF aTpy:CAI_Arrest
! Arrest
actionRec.ActionName = 'aTpy:CAI_Arrest'
actionRec.ActionType = 0
actionRec.ActionTypeCode = aTpy:CAI_Arrest
! action points
actionRec.ActionPointsNumber = 2
actionRec.ActionPoints &= NEW(PosList)
actionRec.ActionPoints.xPos = SELF.p1x
actionRec.ActionPoints.yPos = SELF.p1y
ADD(actionRec.ActionPoints)
actionRec.ActionPoints.xPos = SELF.drwImg.MouseX()
actionRec.ActionPoints.yPos = SELF.drwImg.MouseY()
ADD(actionRec.ActionPoints)
OF aTpy:AxisOfAdvance_SupportingAttack
! Attack
actionRec.ActionName = 'aTpy:AxisOfAdvance_SupportingAttack'
actionRec.ActionType = 0
actionRec.ActionTypeCode = aTpy:AxisOfAdvance_SupportingAttack
! action points
actionRec.ActionPointsNumber = 2
actionRec.ActionPoints &= NEW(PosList)
actionRec.ActionPoints.xPos = SELF.p1x
actionRec.ActionPoints.yPos = SELF.p1y
ADD(actionRec.ActionPoints)
actionRec.ActionPoints.xPos = SELF.drwImg.MouseX()
actionRec.ActionPoints.yPos = SELF.drwImg.MouseY()
ADD(actionRec.ActionPoints)
OF aTpy:AttackByFirePosition
! Attack By Fire
OF aTpy:Block
! Block
actionRec.ActionName = 'aTpy:Block'
actionRec.ActionType = 0
actionRec.ActionTypeCode = aTpy:Block
! action points
actionRec.ActionPointsNumber = 2
actionRec.ActionPoints &= NEW(PosList)
actionRec.ActionPoints.xPos = SELF.p1x
actionRec.ActionPoints.yPos = SELF.p1y
ADD(actionRec.ActionPoints)
actionRec.ActionPoints.xPos = SELF.drwImg.MouseX()
actionRec.ActionPoints.yPos = SELF.drwImg.MouseY()
ADD(actionRec.ActionPoints)
OF aTpy:Breach
! Breach
actionRec.ActionName = 'aTpy:Breach'
actionRec.ActionType = 0
actionRec.ActionTypeCode = aTpy:Breach
! action points
actionRec.ActionPointsNumber = 2
actionRec.ActionPoints &= NEW(PosList)
actionRec.ActionPoints.xPos = SELF.p1x
actionRec.ActionPoints.yPos = SELF.p1y
ADD(actionRec.ActionPoints)
actionRec.ActionPoints.xPos = SELF.drwImg.MouseX()
actionRec.ActionPoints.yPos = SELF.drwImg.MouseY()
ADD(actionRec.ActionPoints)
END
! check for Unit Target
foundUnitTarget# = SELF.CheckByMouse(SELF.drwImg.MouseX(), SELF.drwImg.MouseY())
sst.Trace(' OverlayC2IP.InsertAction : foundUnitTarget# = ' & foundUnitTarget#)
IF foundUnitTarget# > 0 THEN
! Unit Target found
ASSERT(SELF.ul.GetNode(foundUnitTarget#, targetBSO), 'UnitsCollection.GetNode() error')
sst.Trace(' OverlayC2IP.InsertAction : InsertAction(action, resource, target-Unit)')
SELF.al.InsertAction(actionRec, selBSO, targetBSO)
SELF.lastOperation = (CLIP(selBSO.UnitName) & ' ' & CLIP(actionRec.ActionName) & ' on target ' & CLIP(targetBSO.UnitName))
ELSE
! check for Action Target
foundActionTarget# = SELF.CheckDrawingByMouse(SELF.drwImg.MouseX(), SELF.drwImg.MouseY())
sst.Trace(' OverlayC2IP.InsertAction : foundActionTarget# = ' & foundActionTarget#)
IF foundActionTarget# > 0 THEN
! Action Target found
ASSERT(SELF.al.GetAction(foundActionTarget#, targetAction), 'ActionCollection.GetAction() error')
sst.Trace(' OverlayC2IP.InsertAction : InsertAction(action, resource, target-Action)')
SELF.al.InsertAction(actionRec, selBSO, targetAction)
SELF.lastOperation = (CLIP(selBSO.UnitName) & ' ' & CLIP(actionRec.ActionName) & ' on target ' & CLIP(targetAction.ActionName))
ELSE
! no target found
sst.Trace(' OverlayC2IP.InsertAction : InsertAction(action, resource)')
SELF.al.InsertAction(actionRec, selBSO)
SELF.lastOperation = (CLIP(selBSO.UnitName) & ' ' & CLIP(actionRec.ActionName))
END
END
SELF.Redraw()
sst.Trace('OverlayC2IP.InsertAction END')
OverlayC2IP.TakeMouseDown PROCEDURE()
sMessage STRING(100)
CODE
sst.Trace('OverlayC2IP.TakeMouseDown BEGIN')
selXPos# = SELF.drwImg.MouseX()
selYPos# = SELF.drwImg.MouseY()
! Check the status of BSO selection
sst.Trace(' OverlayC2IP.TakeMouseDown : check BSO selection')
IF (SELF.isSelection = FALSE) AND (SELF.isPointsCollection = FALSE) THEN
! check if it is a new BSO selection on the Overlay
IF SELF.CheckByMouse(selXPos#, selYPos#) > 0 THEN
SELF.SelectByMouse(selXPos#, selYPos#)
SELF.isSelection = TRUE
SELF.refSelectedXPos = selXPos#
SELF.refSelectedYPos = selYPos#
sst.Trace(' OverlayC2IP.TakeMouseDown : BSO reference(' & SELF.refSelectedXPos & ',' & |
SELF.refSelectedYPos & ')')
SELF.isBSOMoved = FALSE
ELSE
SELF.isSelection = FALSE
END
END
sst.Trace(' OverlayC2IP.TakeMouseDown : isBSOSelection = ' & SELF.isSelection)
! Check the status of Generic Drawings selection
sst.Trace(' OverlayC2IP.TakeMouseDown : check generic drawing selection')
SELF.selectedDrawingPos = SELF.CheckDrawingByMouse(selXPos#, selYPos#)
IF SELF.selectedDrawingPos > 0 THEN
! validate the Drawing selection, only if a BSO was not selected
IF SELF.isSelection = FALSE THEN
SELF.SelectDrawingByMouse(selXPos#, selYPos#)
SELF.isDrawingSelection = TRUE
SELF.refSelectedXPos = selXPos#
SELF.refSelectedYPos = selYPos#
sst.Trace(' OverlayC2IP.TakeMouseDown : Drawing reference(' & SELF.refSelectedXPos & ',' & |
SELF.refSelectedYPos & ')')
! memorize the selected Drawing
ASSERT(SELF.al.GetAction(SELF.selectedDrawingPos, SELF.selectedDrawing), 'ActionCollection.GetAction() error')
ASSERT(SELF.al.GetAction(SELF.selectedDrawingPos, SELF.selectedDrawingClass), 'ActionCollection.GetAction() error')
SELF.isDrawingMoved = FALSE
ELSE
SELF.isDrawingSelection = FALSE
!SELF.isDrawingMoved = FALSE
END
ELSE
! check if is a generic drawing
IF SELF.geometry <> g:NotDefined THEN
SELF.isPointsCollection = TRUE
END
END
sst.Trace(' OverlayC2IP.TakeMouseDown : isDrawingSelection = ' & SELF.isDrawingSelection)
! double click
CASE KEYCODE()
OF MouseLeft2
! read keyboard
LOOP UNTIL KEYBOARD()
ASK
IF KEYCODE() = EnterKey THEN
BREAK
END
SELF.textBuffer = CLIP(SELF.textBuffer) & CHR(KEYCHAR())
END
SELF.drwImg.Show(selXPos#, selYPos#, CLIP(SELF.textBuffer))
SELF.drwImg.Display()
IF SELF.isDrawingSelection THEN
! set editable to the selected Action
SELF.selectedDrawingClass.SetText(SELF.textBuffer)
END
SELF.textBuffer = ''
END
! Check the status of Actions selection
! check if it is about to collect points for Action drawing / generic drawing
IF SELF.isPointsCollection = TRUE THEN
IF SELF.isMouseDown = FALSE THEN
! collect points
SELF.p1x = selXPos#
SELF.p1y = selYPos#
SELF.isMouseDown = TRUE
ELSE
! nothing
END
END
sst.Trace('OverlayC2IP.TakeMouseDown END')
OverlayC2IP.TakeMouseMove PROCEDURE()
CODE
!sst.Trace('OverlayC2IP.TakeMouseMove BEGIN')
! check if the current selected BSO is moved
IF SELF.isSelection = TRUE THEN
SELF.isBSOMoved = TRUE
END
! check if the current selected Drawing is moved
IF SELF.isDrawingSelection = TRUE THEN
SELF.isDrawingMoved = TRUE
END
! check if it is points selection
IF SELF.isPointsCollection = TRUE THEN
IF SELF.isMouseDown = TRUE THEN
! previewing = TRUE
CASE SELF.geometry
OF g:Point
! Point
OF g:Line
! Line
SELF.Draw_Line(SELF.drwImg.MouseX(), SELF.drwImg.MouseY(), TRUE)
!SELF.PreviewArrow(SELF.drwImg.MouseX(), SELF.drwImg.MouseY())
OF g:FreeLine
SELF.Preview_FreeLine(SELF.drwImg.MouseX(), SELF.drwImg.MouseY())
OF g:Rectangle
SELF.Draw_Rectangle(SELF.drwImg.MouseX(), SELF.drwImg.MouseY(), TRUE)
OF g:Polygon
SELF.Draw_Polygon(SELF.drwImg.MouseX(), SELF.drwImg.MouseY(), TRUE)
OF g:FreeHand