-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrmMain.frm
2384 lines (2197 loc) · 68.5 KB
/
frmMain.frm
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
VERSION 5.00
Object = "{EFAB76C0-9F63-11CF-A48A-A0AC34F4689F}#2.0#0"; "Pwstrv2.ocx"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmMain
Caption = "Digital Tidal Stream Atlas"
ClientHeight = 6120
ClientLeft = 2235
ClientTop = 2310
ClientWidth = 10260
Icon = "frmMain.frx":0000
LinkTopic = "Form1"
ScaleHeight = 6120
ScaleWidth = 10260
Begin VB.Timer Timer2
Enabled = 0 'False
Interval = 300
Left = 8400
Top = 720
End
Begin VB.PictureBox Picture1
AutoRedraw = -1 'True
Height = 975
Left = 9360
ScaleHeight = 915
ScaleWidth = 1155
TabIndex = 2
Top = 1800
Visible = 0 'False
Width = 1215
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 7680
Top = 2760
_ExtentX = 847
_ExtentY = 847
_Version = 393216
CancelError = -1 'True
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 3000
Left = 9000
Top = 480
End
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 255
Left = 0
TabIndex = 1
Top = 5865
Width = 10260
_ExtentX = 18098
_ExtentY = 450
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 7
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 2505
MinWidth = 2505
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 2963
MinWidth = 2963
EndProperty
BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 2275
MinWidth = 2275
EndProperty
BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 2275
MinWidth = 2275
EndProperty
BeginProperty Panel5 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 3087
MinWidth = 3087
EndProperty
BeginProperty Panel6 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 3263
MinWidth = 3263
EndProperty
BeginProperty Panel7 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 3969
MinWidth = 3969
EndProperty
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin PWSTREETLib.Pwstreet Pwstreet1
Height = 5295
Left = 120
TabIndex = 0
Top = 480
Width = 5655
_Version = 131072
_ExtentX = 9975
_ExtentY = 9340
_StockProps = 32
RightMouseMenu = 0 'False
ScrollBars = 0 'False
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 420
Left = 0
TabIndex = 3
Top = 0
Width = 10260
_ExtentX = 18098
_ExtentY = 741
ButtonWidth = 609
ButtonHeight = 582
Appearance = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 19
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "zoom"
Object.ToolTipText = "Zoom/Point"
ImageIndex = 1
Value = 1
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "pan"
Object.ToolTipText = "Pan"
ImageIndex = 20
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "play"
Object.ToolTipText = "Start Animation"
ImageIndex = 3
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Enabled = 0 'False
Key = "pause"
Object.ToolTipText = "Pause"
ImageIndex = 4
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Enabled = 0 'False
Key = "stop"
Object.ToolTipText = "Stop"
ImageIndex = 5
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Enabled = 0 'False
Key = "forward"
Object.ToolTipText = "Step Forward"
ImageIndex = 16
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "open"
Object.ToolTipText = "Load View"
ImageIndex = 19
EndProperty
BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "save"
Object.ToolTipText = "Save View"
ImageIndex = 13
EndProperty
BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "print"
Object.ToolTipText = "Print"
ImageIndex = 14
EndProperty
BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "measure"
Object.ToolTipText = "Measure Distance"
ImageIndex = 8
EndProperty
BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "setting"
Object.ToolTipText = "Set Control Point Conditions"
ImageIndex = 9
EndProperty
BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "SettingAn"
Object.ToolTipText = "Set Animation Conditions"
ImageIndex = 15
EndProperty
BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "ShowTide"
Object.ToolTipText = "Show Tide Graph"
ImageIndex = 17
EndProperty
BeginProperty Button15 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "overview"
Object.ToolTipText = "View Overview"
ImageIndex = 21
EndProperty
BeginProperty Button16 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button17 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "zoomin"
Object.ToolTipText = "Zoom In"
ImageIndex = 10
EndProperty
BeginProperty Button18 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "zoomout"
Object.ToolTipText = "Zoom Out"
ImageIndex = 11
EndProperty
BeginProperty Button19 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "globe"
Object.ToolTipText = "Full Extent"
ImageIndex = 12
EndProperty
EndProperty
BorderStyle = 1
Begin VB.Frame Frame2
BorderStyle = 0 'None
Height = 375
Left = 6170
TabIndex = 7
Top = 0
Width = 1695
Begin VB.ComboBox cboKnotMS
Height = 315
Left = 550
Style = 2 'Dropdown List
TabIndex = 8
Top = 40
Width = 1095
End
Begin VB.Label Label2
Caption = "Speed"
Height = 255
Left = 30
TabIndex = 9
Top = 100
Width = 495
End
End
Begin VB.Frame Frame1
BorderStyle = 0 'None
Height = 375
Left = 7860
TabIndex = 4
Top = 0
Width = 3250
Begin VB.Label Label1
Caption = "500m"
Height = 255
Index = 1
Left = 1680
TabIndex = 6
Top = 100
Width = 400
End
Begin VB.Label Label1
Caption = "0"
Height = 255
Index = 0
Left = 0
TabIndex = 5
Top = 100
Width = 100
End
Begin VB.Shape Shape1
Height = 135
Index = 1
Left = 1200
Top = 130
Width = 375
End
Begin VB.Shape Shape1
FillStyle = 0 'Solid
Height = 135
Index = 0
Left = 120
Top = 130
Width = 375
End
End
Begin MSComctlLib.ImageList ImageList1
Left = 10860
Top = -120
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 21
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":030A
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":08A4
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":0E3E
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":0F98
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":1532
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":1ACC
Key = ""
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":1DE6
Key = ""
EndProperty
BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":2380
Key = ""
EndProperty
BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":291A
Key = ""
EndProperty
BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":2EB4
Key = ""
EndProperty
BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":344E
Key = ""
EndProperty
BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":39E8
Key = ""
EndProperty
BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":3D02
Key = ""
EndProperty
BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":429C
Key = ""
EndProperty
BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":4B76
Key = ""
EndProperty
BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":5110
Key = ""
EndProperty
BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":526A
Key = ""
EndProperty
BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":5804
Key = ""
EndProperty
BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":595E
Key = ""
EndProperty
BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":5AB8
Key = ""
EndProperty
BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":6052
Key = ""
EndProperty
EndProperty
End
End
Begin VB.Menu mnuFile
Caption = "&File"
Begin VB.Menu mnuLoadZoom
Caption = "&Load View"
End
Begin VB.Menu mnuSaveZoom
Caption = "&Save View"
End
Begin VB.Menu mnuPrint
Caption = "&Print"
End
Begin VB.Menu mnuExportMapToFile
Caption = "&Export Map to File"
End
Begin VB.Menu mnuExit
Caption = "E&xit"
End
End
Begin VB.Menu mnuAction
Caption = "&Action"
Begin VB.Menu mnuDateStart
Caption = "Set Animation Conditions"
End
Begin VB.Menu mnuSinglePoint
Caption = "Set Control Point Conditions"
End
Begin VB.Menu mnuSept2
Caption = "-"
End
Begin VB.Menu mnuStartAnimation
Caption = "Start Animation"
End
Begin VB.Menu mnuStopAnimation
Caption = "Stop Animation"
Enabled = 0 'False
End
Begin VB.Menu mnuPause
Caption = "Pause"
Enabled = 0 'False
End
Begin VB.Menu mnuStepForward
Caption = "Step Forward"
Enabled = 0 'False
End
Begin VB.Menu mnuSept
Caption = "-"
End
Begin VB.Menu mnuMeasureDistance
Caption = "Measure Distance"
End
End
Begin VB.Menu mnuView
Caption = "&View"
Begin VB.Menu mnuZoomIn
Caption = "Zoom &In (+)"
End
Begin VB.Menu mnuZoomOut
Caption = "Zoom &Out (-)"
End
Begin VB.Menu mnuFullExtent
Caption = "Full Extent (F11)"
End
Begin VB.Menu mnuSept3
Caption = "-"
End
Begin VB.Menu mnuShowTide
Caption = "View Tide Graph"
End
Begin VB.Menu mnuViewOverView
Caption = "View Overview"
End
End
Begin VB.Menu mnuOption
Caption = "&Layer"
Begin VB.Menu mnuShowPlaceLabel
Caption = "Show Place Label"
Checked = -1 'True
End
Begin VB.Menu mnuShowGridlines
Caption = "Show Gridlines"
End
Begin VB.Menu mnuFairway
Caption = "Show Fairway"
Checked = -1 'True
End
Begin VB.Menu mnuShowAnchorage
Caption = "Show Anchorage"
Checked = -1 'True
End
End
Begin VB.Menu mnuHelp
Caption = "&Help"
Begin VB.Menu mnuTemp
Caption = "Temp"
End
Begin VB.Menu mnuAboutTidalStreamAtlas
Caption = "&About Digital Tidal Stream Atlas"
End
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim n As Long
Dim nrow As Integer
Dim filename As String
Dim Layer As Long
Dim zLayer As Long
Dim xtop As Long
Dim xleft As Long
Dim xbottom As Long
Dim xright As Long
Dim resumeIndex As Integer
Dim ScaleWidihZoom As Long
Dim ScaleHeightZoom As Long
Dim MapCenterLat As Long
Dim MapCenterLong As Long
Dim tmpScaleFactor As Double
Dim ScaleFactorLX As Double
Dim ScaleFactorLY As Double
Dim xCurrentLat As Long
Dim yCurrentLong As Long
'Flag
Dim MeasureCheck As Boolean
Dim NoControlPointFound As Boolean
Dim CachedStateLabelWhenConfigurationSetting As Long
Dim clickToolButton As Integer
Dim noPoint As Boolean
'User Define Line
Dim ln As UserDefinedLine 'Arrow
Dim lnLegend As UserDefinedLine 'Legend
Dim lnGrid As UserDefinedLine 'Grid
Dim lnMeasure As UserDefinedLine 'Measure
Dim lnRegion As UserDefinedLine 'Region
Dim ll(1 To 2, 1 To 9) As Long 'Arrow Line Array
Dim llg(1 To 2, 1 To 5) As Long 'Legend Line Array
Dim llGrid(1 To 2, 1 To 3) As Long 'Grid Line Array
Dim llMeasure(1 To 2, 1 To 2) As Long 'Measure Line Array
Dim llRegion(1 To 2, 1 To 5) As Long 'Region Line Array
Private Sub cboKnotMS_Click()
clearNautical
End Sub
Private Sub cboKnotMS_KeyDown(KeyCode As Integer, Shift As Integer)
clearNautical
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyAdd Then
mnuZoomIn_Click
End If
If KeyCode = vbKeySubtract Then
mnuZoomOut_Click
End If
End Sub
Private Sub Form_Load()
'Location Map Center
centerMap
'Load Layer
Me.MousePointer = vbHourglass
DefaultPath = App.Path
filename = DefaultPath & "\map\fairway_polygon.pwc"
lyrVFair = AttachData(filename)
DrawLayer lyrVFair, 5
filename = DefaultPath & "\map\fwy_l_wgs84.pwc"
lyrFair = AttachData(filename)
DrawLayer lyrFair, 4
filename = DefaultPath & "\map\anch_a_wgs84.pwc"
lyrAnor = AttachData(filename)
DrawLayer lyrAnor, 2
filename = DefaultPath & "\map\land_a.pwc"
Layer = AttachData(filename)
DrawLayer Layer, 3
filename = DefaultPath & "\map\land_l.pwc"
Layer = AttachData(filename)
DrawLayer Layer, 0
renderLabel Layer, "LEGEND"
filename = DefaultPath & "\map\sar_l_wgs84.pwc"
zLayer = AttachData(filename)
DrawLayer zLayer, 1
ZoomLayer zLayer
'Init Legend Length
LegendWidth = 300
'Init Database Connection
InitDB
'Show Place Name
InitPlaceName
showPlaceName
'Init Flag
MeasureCheck = False
'Set Background Color and left mouse pan
With Me.Pwstreet1
.Feature = pwVoidPolygon
.Value = RGB(255, 255, 255)
.Attribute = pwFillColor
.Action = pwSetConfig
'Disable Measure
.Feature = pwLeftMouseButton
.Attribute = pwPlusShiftKey
.MouseBehavior = pwMouseDisabled
'Show Anch
.Value = lyrAnor
.Picture = "OBJNAM"
.Action = pwSetAttachedEnumAttribute
.Value = lyrVFair
.Picture = "NAME"
.Action = pwSetAttachedEnumAttribute
End With
'Set properties for layer easier to see
SetConfig pwState, pwLabelWhen, pwNever
SetConfig pwState, pwFillWhen, pwNever
SetConfig pwMapCursor, pwDrawWhen, pwNever
SetConfig pwSearchHighlight, pwDrawWhen, pwNever 'don't highlight Nipp St
SetConfig pwStructureNumber, pwLabelWhen, pwNever ' and don't show street numbers either
'Set Default Zoon Margin
xOrgtop = xtop
xOrgleft = xleft
xOrgbottom = xbottom
xOrgright = xright
'Initialize Meterics Nautical ComboBox
defaultNautical = 0
Me.cboKnotMS.AddItem "Knots", 0
Me.cboKnotMS.AddItem "m/s", 1
Me.cboKnotMS.ListIndex = defaultNautical
MagScaleFactor = 1
Dim i As Integer
'Draw Grid
'DrawGrid
With Pwstreet1
.Value = 249989
.Action = pwSetMaxScaleFactor
.Value = 12000
.Action = pwSetMinScaleFactor
End With
'Temp Init Date
' If Year(Date) <> LimitedYear Then
' DateCal = CDate("2003-Jan-01")
' PointDateCal = CDate("2003-Jan-01")
' Else
' DateCal = CDate(LimitedYear & " " & Format(Date, "mmm dd"))
' PointDateCal = CDate(LimitedYear & " " & Format(Date, "mmm dd"))
' End If
startLimitYear = CDate("Jan 1, 1995 00:00:00")
endLimitYear = CDate("Dec 31, 2015 12:59:59")
DateCal = Now
PointDateCal = Now
DateWeatherDefault
timeInterVal = 1
timePointInterVal = 1
duration = 48
'Init Record Count
recordCnt = 0
strSDString = "D"
strPointSDString = "D"
SliderBarValue = 0
varAddFactor = 5
Me.WindowState = 2
Me.MousePointer = vbDefault
clickToolButton = 0
End Sub
Private Sub DrawLayer(Layer As Long, c1 As Integer)
With Pwstreet1
.Select Layer
.EndSelect
n = Pwstreet1.Value
Select Case c1
Case 0:
.SetSelectedObjectsRenderingAttr pwBlack, 0, 1, pwBlack, pwSolidFill
Case 1:
.SetSelectedObjectsRenderingAttr pwRed, 0, 1, pwRed, pwSolidFill
Case 2:
.SetSelectedObjectsRenderingAttr pwBlue, 0, 1, RGB(239, 255, 255), pwSolidFill
Case 3:
.SetSelectedObjectsRenderingAttr RGB(255, 251, 165), 0, 1, pwLightYellow, pwSolidFill
Case 4:
.SetSelectedObjectsRenderingAttr pwBlue, 0, 1, pwBlue, pwSolidFill
Case 5:
.SetSelectedObjectsRenderingAttr RGB(255, 255, 255), 0, 1, RGB(255, 255, 255), pwSolidFill
Case 99:
.SetSelectedObjectsRenderingAttr RGB(255, 255, 255), 0, 1, RGB(255, 255, 255), pwSolidFill
End Select
.Action = pwDraw
'ZoomLayer Layer
End With
End Sub
Private Sub Form_Resize()
centerMap
End Sub
Private Sub Form_Unload(Cancel As Integer)
endApp
End Sub
Private Sub mnuAboutTidalStreamAtlas_Click()
If mnuStartAnimation.Checked Then
mnuStopAnimation_Click
End If
diaAbout.Show
End Sub
Private Sub mnuDateStart_Click()
If mnuStartAnimation.Checked Or mnuPause.Checked Then
mnuStopAnimation_Click
End If
DialogDate.Show
End Sub
Public Sub mnuExit_Click()
endApp
End Sub
Private Sub mnuExportMapToFile_Click()
If mnuStartAnimation.Checked Then
mnuStopAnimation_Click
End If
'unloadAllForm
Dim frm As Form
For Each frm In Forms
If frm.Name <> "frmMain" Then
Unload frm
End If
Next
Timer2.Enabled = True
End Sub
Private Sub mnuFullExtent_Click()
If mnuStartAnimation.Checked Then
mnuStopAnimation_Click
End If
With Pwstreet1
.Latitude = xOrgtop
.Longitude = xOrgleft
.ID = xOrgbottom
.Value = xOrgright
.Action = 997
End With
End Sub
Private Sub mnuLoadZoom_Click()
If mnuStartAnimation.Checked Then
mnuStopAnimation_Click
End If
Dim expFileName As String
CommonDialog1.CancelError = True
Me.CommonDialog1.DialogTitle = "Load View"
Me.CommonDialog1.Filter = "Viw File (*.viw)|*.viw"
On Error GoTo exitLoadZoom
Me.CommonDialog1.ShowOpen
If Len(Me.CommonDialog1.filename) = 0 Then
Exit Sub
End If
expFileName = Me.CommonDialog1.filename
Dim fs As New FileSystemObject
If Not fs.FileExists(expFileName) Then
ErrorMsg "File does not exists !!"
Exit Sub
End If
Dim f As TextStream
Set f = fs.OpenTextFile(expFileName, ForReading)
Dim tmpLat1 As Long, tmpLong1 As Long, tmpScaleFactor1 As Long
On Error Resume Next
tmpLat1 = CLng(f.ReadLine)
tmpLong1 = CLng(f.ReadLine)
tmpScaleFactor1 = CLng(f.ReadLine)
If Err <> 0 Then
ErrorMsg "Invalid View File"
Exit Sub
End If
On Error GoTo 0
'Add Check Data
With Pwstreet1
.Latitude = tmpLat1
.Longitude = tmpLong1
.ScaleFactor = tmpScaleFactor1
End With
exitLoadZoom:
End Sub
Private Sub mnuMeasureDistance_Click()
If mnuStartAnimation.Checked Then
mnuStopAnimation_Click
End If
With Me.mnuMeasureDistance
If .Checked Then
.Checked = False
clearPoint
strClickPoint = ""
clickToolButton = 0
setPressButton
Else
With Pwstreet1
.Feature = pwLeftMouseButton
.Attribute = pwPlusNoKey
.MouseBehavior = pwMouseV1LeftButton
End With
MeasureCheck = False
.Checked = True
clickToolButton = 2
setPressButton
unloadAllForm
End If
End With
End Sub
Private Sub mnuPrint_Click()
DisableAllForm
If mnuStartAnimation.Checked Then
mnuStopAnimation_Click
End If
frmPrint.Show
End Sub
Private Sub mnuFairway_Click()
If Me.mnuFairway.Checked Then
' With Me.Pwstreet1
' .Value = lyrFair
' .Action = pwDetachFile
' .Action = pwDraw
' .Value = lyrVFair
' .Action = pwDetachFile
' .Action = pwDraw
' End With
DrawLayer lyrFair, 99
'DrawLayer lyrFair, 99
With Me.Pwstreet1
.Value = lyrVFair
.Picture = ""
.Action = pwSetAttachedEnumAttribute
End With
Me.mnuFairway.Checked = False
Else
' filename = DefaultPath & "\map\fairway_polygon.pwc"
' lyrFair = AttachData(filename)
' DrawLayer lyrFair, 5
' filename = DefaultPath & "\map\fwy_l_wgs84.pwc"
' lyrFair = AttachData(filename)
DrawLayer lyrFair, 4
With Me.Pwstreet1
.Value = lyrVFair
.Picture = "NAME"
.Action = pwSetAttachedEnumAttribute
End With
Me.mnuFairway.Checked = True
End If
End Sub
Private Sub mnuSaveZoom_Click()
If mnuStartAnimation.Checked Then
mnuStopAnimation_Click
End If
unloadAllForm
Dim expFileName As String
Me.CommonDialog1.filename = ""
Me.CommonDialog1.DialogTitle = "Save View"
Me.CommonDialog1.Filter = "View File (*.viw)|*.viw"
On Error GoTo exitSaveZoom
Me.CommonDialog1.ShowSave
If Len(Me.CommonDialog1.filename) = 0 Then
Exit Sub
End If
If Len(Me.CommonDialog1.filename) > 4 Then
If Format(Right(Me.CommonDialog1.filename, 4), ">") = ".VIW" Then
expFileName = Me.CommonDialog1.filename
Else
expFileName = Me.CommonDialog1.filename & ".VIW"
End If
End If
Dim fs As New FileSystemObject
Dim f As TextStream
If fs.FileExists(expFileName) Then
DisableAllForm
If MsgBox("File exists Overwrite it", vbYesNo) = vbNo Then
EnableAllForm
Exit Sub
End If
EnableAllForm
End If
Set f = fs.CreateTextFile(expFileName, True)
f.WriteLine MapCenterLat
f.WriteLine MapCenterLong
f.WriteLine tmpScaleFactor
f.Close
Set fs = Nothing
exitSaveZoom:
End Sub
Private Sub mnuShowAnchorage_Click()
If Me.mnuShowAnchorage.Checked Then
' With Me.Pwstreet1
' .Value = lyrAnor
' .Picture = ""
' .Action = pwSetAttachedEnumAttribute
' End With
' DrawLayer lyrAnor, 99
With Me.Pwstreet1
.Value = lyrAnor
.Action = pwDetachFile
.Action = pwDraw
End With
mnuShowAnchorage.Checked = False
Else
filename = DefaultPath & "\map\anch_a_wgs84.pwc"
lyrAnor = AttachData(filename)
DrawLayer lyrAnor, 2
With Me.Pwstreet1
.Value = lyrAnor
.Picture = "OBJNAM"
.Action = pwSetAttachedEnumAttribute
End With
mnuShowAnchorage.Checked = True
End If
End Sub
Private Sub mnuShowGridlines_Click()
If Me.mnuShowGridlines.Checked Then
Me.mnuShowGridlines.Checked = False
clearGrid
Else
Me.mnuShowGridlines.Checked = True
DrawGrid
End If
End Sub
Private Sub mnuShowPlaceLabel_Click()
If mnuShowPlaceLabel.Checked Then
mnuShowPlaceLabel.Checked = False
clearPlaceName
Else
mnuShowPlaceLabel.Checked = True
showPlaceName
End If
End Sub
Private Sub mnuShowTide_Click()
If Me.mnuShowTide.Checked Then
Me.mnuShowTide.Checked = False
setPressButton
Unload frmTide
Else
Me.mnuShowTide.Checked = True
setPressButton
frmTide.Show
End If
End Sub
Private Sub mnuSinglePoint_Click()
If mnuStartAnimation.Checked Then
mnuStopAnimation_Click
End If
If Me.mnuMeasureDistance.Checked Or strClickPoint = "" Then
Me.mnuMeasureDistance.Checked = False
clearPoint
resumeIndex = 0
errorFormCall = "frmMain"
ErrorMsg "Please Select One Control Point"
strClickPoint = ""
clearPoint
With Pwstreet1
.Feature = pwLeftMouseButton
.Attribute = pwPlusNoKey
.MouseBehavior = pwMouseV1LeftButton
End With
clearPoint
clickToolButton = 0
setPressButton
Exit Sub
End If
DialogPoint.Show
End Sub
Private Sub mnuStartAnimation_Click()
If Not IsNull(DateCal) Then
If Not mnuPause.Checked Then