/3.2
(Extension.1
	Name:	"HEC-GeoRAS 3.0"
	Dependencies:	"$AVBIN/avdlog.dll\n$AVEXT/3d.avx\n"
	FirstRootClassName:	"PMenu"
	Roots:	2
	Roots:	27
	Roots:	37
	Roots:	47
	Roots:	48
	Roots:	49
	Roots:	51
	Roots:	53
	Roots:	55
	Roots:	57
	Roots:	116
	Roots:	160
	Roots:	189
	Roots:	190
	Roots:	191
	Roots:	192
	Roots:	193
	Roots:	193
	Roots:	194
	Roots:	194
	Roots:	195
	Roots:	195
	Roots:	196
	Roots:	196
	Roots:	197
	Roots:	197
	Roots:	198
	Roots:	198
	Roots:	199
	Roots:	199
	Roots:	200
	Roots:	200
	Roots:	201
	Roots:	201
	Roots:	202
	Roots:	202
	Roots:	203
	Roots:	203
	Roots:	204
	Roots:	204
	Roots:	205
	Roots:	205
	Roots:	206
	Roots:	206
	Roots:	207
	Roots:	207
	Roots:	208
	Roots:	208
	Roots:	209
	Roots:	209
	Roots:	210
	Roots:	210
	Roots:	211
	Roots:	211
	Roots:	212
	Roots:	212
	Roots:	213
	Roots:	213
	Roots:	214
	Roots:	214
	Roots:	215
	Roots:	215
	Roots:	216
	Roots:	216
	Roots:	217
	Roots:	217
	Roots:	218
	Roots:	218
	Roots:	219
	Roots:	219
	Roots:	220
	Roots:	220
	Roots:	221
	Roots:	221
	Roots:	222
	Roots:	222
	Roots:	223
	Roots:	223
	Roots:	224
	Roots:	225
	Roots:	226
	Roots:	227
	Roots:	228
	Roots:	229
	Roots:	230
	Roots:	231
	Roots:	232
	Roots:	233
	Roots:	234
	Roots:	235
	Roots:	236
	Roots:	237
	Roots:	238
	Roots:	239
	Roots:	240
	Roots:	241
	Roots:	242
	Roots:	243
	Roots:	244
	Roots:	245
	Roots:	246
	Roots:	247
	Roots:	248
	Roots:	249
	Roots:	250
	Roots:	251
	Roots:	252
	Roots:	253
	Roots:	254
	Roots:	255
	Roots:	256
	Roots:	257
	Roots:	258
	Roots:	259
	Roots:	260
	Roots:	261
	Roots:	262
	Roots:	263
	Roots:	264
	Roots:	265
	Roots:	266
	Roots:	267
	Roots:	268
	Roots:	269
	Roots:	270
	Roots:	271
	Roots:	272
	Roots:	273
	Roots:	274
	Roots:	275
	Roots:	276
	Roots:	277
	Roots:	278
	Roots:	279
	Roots:	280
	Roots:	281
	Roots:	282
	Roots:	283
	Roots:	284
	Roots:	285
	Roots:	286
	Roots:	287
	Roots:	288
	Roots:	289
	Roots:	290
	Version:	32
	About:	"HEC-GeoRAS 3.0 Extension.\nPre- and post-processing for HEC-RAS\n\nHydrologic Engineering Center"
	InstallScript:	190
	UninstallScript:	192
	ExtVersion:	1
)

(PMenu.2
	Help:	"RAS input preparation"
	HelpTopic:	"AV_Ras_Menu@avras.hlp"
	Child:	3
	Child:	4
	Child:	5
	Child:	6
	Child:	7
	Child:	8
	Child:	9
	Child:	10
	Child:	11
	Child:	12
	Child:	13
	Child:	14
	Child:	15
	Child:	16
	Child:	17
	Child:	18
	Child:	19
	Child:	20
	Child:	21
	Child:	22
	Child:	23
	Child:	24
	Child:	25
	Child:	26
	Label:	"preRAS"
)

(Choice.3
	Help:	"Create empty Centerline Theme with correct structure"
	HelpTopic:	"Create_Centerline_Theme@avras.hlp"
	Label:	"Create Stream Centerline"
	Click:	"RAS.UTL.CreateCenterline"
	Shortcut:	"Keys.None"
)

(Choice.4
	Help:	"Create empty Main Channel Banks Theme"
	Label:	"Create Banks"
	Click:	"RAS.UTL.CreateBanks"
	Shortcut:	"Keys.None"
)

(Choice.5
	Help:	"Create empty Flow Path Centerlines Theme"
	HelpTopic:	"Label_Flowpaths@avras.hlp"
	Label:	"Create Flowpaths"
	Click:	"RAS.UTL.CreateFlowpath"
	Shortcut:	"Keys.None"
)

(Choice.6
	Help:	"Create empty Cross Section Cut Lines Theme"
	Label:	"Create XS Cut Lines"
	Click:	"RAS.UTL.CreateCutLines"
	Shortcut:	"Keys.None"
)

(Space.7
)

(Choice.8
	Help:	"Definition of themes for use in ArcView to RAS interface"
	HelpTopic:	"Theme_Setup_preprocessor@avras.hlp"
	Label:	"Theme Setup..."
	Click:	"RAS.PRE.InputDialogShow"
	Shortcut:	"Keys.None"
)

(Space.9
)

(Choice.10
	Label:	"Centerline Completion"
	Click:	"RAS.PRE.CenterlineComplete"
	Shortcut:	"Keys.None"
)

(Choice.11
	Help:	"Compute (stream) arc lengths and stations"
	HelpTopic:	"Length_Station_Comp_@avras.hlp"
	Label:	"     Lengths/Stations "
	Click:	"RAS.PRE.LengthCLAttributes"
	Shortcut:	"Keys.None"
)

(Choice.12
	Help:	"Define stream centerline topology"
	HelpTopic:	"Centerline_Topology@avras.hlp"
	Label:	"     Centerline Topology"
	Click:	"RAS.PRE.CLTopo"
	Shortcut:	"Keys.None"
)

(Choice.13
	Help:	"Extraction of elevations for the stream centerlines"
	HelpTopic:	"Centerline_Z_Extract@avras.hlp"
	Label:	"     Centerline Z Extract"
	Click:	"RAS.PRE.CL2DToCL3D"
	Shortcut:	"Keys.None"
)

(Space.14
)

(Choice.15
	Label:	"XS Attributing"
	Click:	"RAS.PRE.AttributeXSAll"
	Shortcut:	"Keys.None"
)

(Choice.16
	Help:	"Attribution of cross-sections with Stream_ID and Reach_ID"
	HelpTopic:	"Basic_CS_Attributing@avras.hlp"
	Label:	"     Stream/Reach Names"
	Click:	"RAS.PRE.BasicCSAttributes"
	Shortcut:	"Keys.None"
)

(Choice.17
	Help:	"Attribution of cross-sections with Station"
	HelpTopic:	"Station_CS_Attributing@avras.hlp"
	Label:	"     Stationing"
	Click:	"RAS.PRE.StationCSAttributes"
	Shortcut:	"Keys.None"
)

(Choice.18
	Help:	"Attribution of cross-sections with L_BankP and R_BankP"
	HelpTopic:	"Bank_CS_Attributing@avras.hlp"
	Label:	"     Bank Stations"
	Click:	"RAS.PRE.BankCSAttributes"
	Shortcut:	"Keys.None"
)

(Choice.19
	Help:	"Attribution of cross-sections with L_ReachL, M_ReachL, and R_ReachL"
	HelpTopic:	"Distance_CS_Attributing@avras.hlp"
	Label:	"     Reach Lengths"
	Click:	"RAS.PRE.DistanceCSAttributes"
	Shortcut:	"Keys.None"
)

(Choice.20
	Label:	"     Manning's n values"
	Click:	"RAS.PRE.ManningExtract"
	Shortcut:	"Keys.None"
)

(Choice.21
	Help:	"Extraction of elevations for the cross-sections"
	HelpTopic:	"CS_Z_Extract@avras.hlp"
	Label:	"XS Elevations"
	Click:	"RAS.PRE.CS2DToCS3D"
	Shortcut:	"Keys.None"
)

(Space.22
)

(Choice.23
	Label:	"Generate RAS GIS Import File"
	Click:	"RAS.PRE.InputAll"
	Shortcut:	"Keys.None"
)

(Choice.24
	Help:	"Creation of RAS GIS input file header section"
	HelpTopic:	"Header_Export@avras.hlp"
	Label:	"     Header Export"
	Click:	"RAS.PRE.ExtractHeader"
	Shortcut:	"Keys.None"
)

(Choice.25
	Help:	"Creation of RAS GIS input file stream centerline section"
	HelpTopic:	"Centerline_Export@avras.hlp"
	Label:	"     Centerline Export"
	Click:	"RAS.PRE.Extract3DCL"
	Shortcut:	"Keys.None"
)

(Choice.26
	Help:	"Creation of RAS GIS input file cross-section section"
	HelpTopic:	"CS_Export@avras.hlp"
	Label:	"     XS Export"
	Click:	"RAS.PRE.Extract3DCS"
	Shortcut:	"Keys.None"
)

(PMenu.27
	Help:	"Floodplain delineation based on RAS model output"
	HelpTopic:	"Ras_AV_Menu@avras.hlp"
	Child:	28
	Child:	29
	Child:	30
	Child:	31
	Child:	32
	Child:	33
	Child:	34
	Child:	35
	Child:	36
	Label:	"postRAS"
)

(Choice.28
	Help:	"Definition of themes for use in RAS to ArcView interface"
	HelpTopic:	"Theme_Setup_postprocessor_@avras.hlp"
	Label:	"Theme Setup..."
	Click:	"RAS.PST.OutputDialogShow"
	Shortcut:	"Keys.None"
)

(Space.29
)

(Choice.30
	Help:	"Generation of cross-sections based on RAS output."
	HelpTopic:	"CS_BP_Generation@avras.hlp"
	Label:	"Read RAS GIS Export File"
	Click:	"RAS.PST.CSGeneration"
	Shortcut:	"Keys.None"
)

(Space.31
)

(Choice.32
	Help:	"Generation of water surface TIN(s) based on RAS output."
	HelpTopic:	"WS_TIN_Generation@avras.hlp"
	Label:	"WS TIN Generation"
	Click:	"RAS.PST.WSTINGeneration"
	Shortcut:	"Keys.None"
)

(Choice.33
	Help:	"Generation of floodplain polygons based on water surface TIN(s) and terrain TIN."
	HelpTopic:	"Floodplain_Delineation@avras.hlp"
	Label:	"Floodplain Delineation"
	Click:	"RAS.PST.FloodDelineation"
	Shortcut:	"Keys.None"
)

(Space.34
)

(Choice.35
	Label:	"Velocity TIN Generation"
	Click:	"RAS.PST.VelTINGeneration"
	Shortcut:	"Keys.None"
)

(Choice.36
	Label:	"Velocity Grid Generation"
	Click:	"RAS.PST.VelGridGeneration"
	Shortcut:	"Keys.None"
)

(PMenu.37
	Help:	"GeoRAS utility functions"
	HelpTopic:	"AVRas_Util_Menu@avras.hlp"
	Child:	38
	Child:	39
	Child:	40
	Child:	41
	Child:	42
	Child:	43
	Child:	44
	Child:	45
	Child:	46
	Label:	"GeoRAS_Util"
)

(Choice.38
	Invisible:	1
	Help:	"Define flowpath type for selected flowpath features."
	HelpTopic:	"Label_Flowpaths@avras.hlp"
	Label:	"Label Flowpaths"
	Click:	"RAS.UTL.EditFlowpathType"
	Shortcut:	"Keys.None"
)

(Choice.39
	Label:	"Create LU-Manning table"
	Click:	"RAS.UTL.CreateLUtab"
	Shortcut:	"Keys.None"
)

(Space.40
)

(Choice.41
	Invisible:	1
	Help:	"Compute (stream) arc lengths and stations"
	HelpTopic:	"Length_Station_Comp_@avras.hlp"
	Label:	"Length/Station Comp."
	Click:	"RAS.PRE.LengthCLAttributes"
	Shortcut:	"Keys.None"
)

(Choice.42
	Help:	"Flip direction of selected polylines"
	HelpTopic:	"Flip_Polyline@avras.hlp"
	Label:	"Flip Polyline"
	Click:	"RAS.UTL.FlipMe"
	Shortcut:	"Keys.None"
)

(Space.43
)

(Choice.44
	Help:	"Display theme tags for all themes and views"
	HelpTopic:	"Check_Theme_Tags@avras.hlp"
	Label:	"Check Tags"
	Click:	"RAS.FRM.ChkThmTags"
	Shortcut:	"Keys.None"
)

(Choice.45
	Help:	"Set a value for a tag pair in the dictionary."
	HelpTopic:	"Set_Tag_Values@avras.hlp"
	Tag:	"SetValue"
	Label:	"Set Tag Values"
	Click:	"RAS.FRM.ViewThmTagMgrMenu"
	Shortcut:	"Keys.None"
)

(Choice.46
	Help:	"Remove a Key from a Tag Dictionary."
	HelpTopic:	"Remove_Tag_Entry@avras.hlp"
	Tag:	"Remove"
	Label:	"Remove Tag Entry"
	Click:	"RAS.FRM.ViewThmTagMgrMenu"
	Shortcut:	"Keys.None"
)

(Choice.47
	Disabled:	1
	Invisible:	1
	Help:	"Start help system for HEC-GeoRAS"
	Label:	"HEC-GeoRAS Help..."
	Click:	"RAS.UTL.Help"
	Shortcut:	"Keys.None"
)

(Choice.48
	Help:	"Provides information about HEC-GeoRAS version"
	Label:	"About HEC-GeoRAS"
	Click:	"RAS.UTL.AboutGeoRas"
	Shortcut:	"Keys.None"
)

(Butn.49
	Help:	"RAS GIS Input Generation//Generate RAS GIS Input file from 3D centerline and 3D Cross-sections"
	HelpTopic:	"Ras_In_Button@avras.hlp"
	Icon:	50
	Click:	"RAS.PRE.InputAll"
)

(AVIcon.50
	Name:	"rasing.bmp"
	Data:	4e442049 6d616765 00010010 00100000 
	Data:	00808888 89888888 88888888 99988888 
	Data:	88888888 89998888 88888888 88999898 
	Data:	88888888 88899998 88888888 88889998 
	Data:	88888888 88899998 88888888 88888888 
	Data:	8888c88c 8c888c8c ccc8c88c 8c888c88 
	Data:	88c8c8c8 8ccccc88 88c8cccc 88c8c88c 
	Data:	ccc8c88c 88c8c88c 8888c88c 88ccc88c 
	Data:	8888cccc 888c888c ccc88888 88888888 
	Data:	88880000 00400000 00000000 80000080 
	Data:	00000080 80008000 00008000 80008080 
	Data:	00008080 8000c0c0 c0000000 ff0000ff 
	Data:	000000ff ff00ff00 0000ff00 ff00ffff 
	Data:	0000ffff ff000002 00040007 00200001 
	Data:	00020000 00000000 0000
)

(Butn.51
	Help:	"RAS Postprocessing//Generate Floodplains from RAS GIS Output"
	HelpTopic:	"Ras_Out_Button@avras.hlp"
	Icon:	52
	Click:	"RAS.PST.OutputAll"
)

(AVIcon.52
	Name:	"rasoutg.bmp"
	Data:	4e442049 6d616765 00010010 00100000 
	Data:	00808888 88899998 88888888 88889998 
	Data:	88888888 88899998 88888888 88999898 
	Data:	88888888 89998888 88888888 99988888 
	Data:	88888888 89888888 88888888 88888888 
	Data:	8888c88c 8c888c8c ccc8c88c 8c888c88 
	Data:	88c8c8c8 8ccccc88 88c8cccc 88c8c88c 
	Data:	ccc8c88c 88c8c88c 8888c88c 88ccc88c 
	Data:	8888cccc 888c888c ccc88888 88888888 
	Data:	88880000 00400000 00000000 80000080 
	Data:	00000080 80008000 00008000 80008080 
	Data:	00008080 8000c0c0 c0000000 ff0000ff 
	Data:	000000ff ff00ff00 0000ff00 ff00ffff 
	Data:	0000ffff ff000002 00040007 00200001 
	Data:	00020000 00000000 0000
)

(Tool.53
	Help:	"River ID//Edit Stream and Reach IDs."
	HelpTopic:	"River_ID_Tool@avras.hlp"
	Icon:	54
	Cursor:	"Cursors.Tag"
	Apply:	"RAS.UTL.EditIDApply"
	Click:	"RAS.UTL.EditIDClick"
)

(AVIcon.54
	Name:	"R"
	Res:	"Icons.R"

)

(Tool.55
	Help:	"Label Flowpaths//Label Flow path lines: Left, Middle, or Right"
	Icon:	56
	Cursor:	"Cursors.Tag"
	Apply:	"RAS.UTL.LabelFlowpathsApply"
	Click:	"RAS.UTL.LabelFlowPathsClick"
)

(AVIcon.56
	Name:	"F"
	Res:	"Icons.F"

)

(AVDLog.57
	Name:	"RASIn"
	X:	30
	Y:	100
	W:	339
	H:	346
	ConstrainedControlNames:	58
	ConstrainedControlNames:	59
	Constraints:	60
	Constraints:	61
	Server:	62
	ControlPanel:	63
	Title:	"GeoRAS Theme Selection for RAS Pre-processing"
	EscapeEnabled:	1
	Modal:	1
	Resizable:	1
	AlwaysOnTop:	1
	HasTitleBar:	1
	Closeable:	1
	DefaultButton:	115
)

(AVStr.58
	S:	"lblOK"
)

(AVStr.59
	S:	"lblCancel"
)

(Numb.60
	N:	85.00000000000000
)

(Numb.61
	N:	85.00000000000000
)

(Nil.62
)

(CPanel.63
	Child:	64
	ResBox:	114
	Listening:	1
)

(CPanel.64
	InternalName:	"aControlPanel1"
	Child:	65
	Child:	75
	Child:	98
	Child:	99
	Child:	100
	Child:	101
	Child:	103
	Child:	104
	Constraints:	0x55
	ResBox:	106
	ResBox:	107
	ResBox:	108
	ResBox:	109
	ResBox:	110
	ResBox:	111
	ResBox:	112
	ResBox:	113
	Label:	"Background"
	VisibleBorder:	1
	Listening:	1
)

(CPanel.65
	InternalName:	"aControlPanel3"
	Child:	66
	Child:	67
	Child:	69
	Child:	70
	Constraints:	0x55
	ResBox:	71
	ResBox:	72
	ResBox:	73
	ResBox:	74
	Label:	"Intermediate Data"
	VisibleBorder:	1
	Listening:	1
)

(TextLabel.66
	InternalName:	"aTextLabel3"
	Constraints:	0x55
	Label:	"XS Surface Line (3D)"
	Listening:	1
)

(AVCBBox.67
	InternalName:	"cb3DCS"
	NextControl:	62
	ContentKind:	4
	Value:	68
	Constraints:	0x55
	Listening:	1
)

(AVStr.68
	S:	"Null"
)

(TextLabel.69
	InternalName:	"aTL1"
	Constraints:	0x55
	Label:	"Stream Centerline (3D)"
	Listening:	1
)

(AVCBBox.70
	InternalName:	"cb3DSC"
	NextControl:	62
	ContentKind:	4
	Value:	68
	Constraints:	0x55
	Listening:	1
)

(RectD.71
	Left:	13.00000000000000
	Top:	61.00000000000000
	Right:	133.00000000000000
	Bottom:	42.00000000000000
)

(RectD.72
	Left:	145.00000000000000
	Top:	113.00000000000000
	Right:	313.00000000000000
	Bottom:	41.00000000000000
)

(RectD.73
	Left:	13.00000000000000
	Top:	41.00000000000000
	Right:	133.00000000000000
	Bottom:	22.00000000000000
)

(RectD.74
	Left:	145.00000000000000
	Top:	92.00000000000000
	Right:	313.00000000000000
	Bottom:	20.00000000000000
)

(CPanel.75
	InternalName:	"aControlPanel2"
	Child:	76
	Child:	77
	Child:	78
	Child:	79
	Child:	80
	Child:	82
	Child:	83
	Child:	84
	Child:	85
	Child:	86
	Constraints:	0x55
	ResBox:	88
	ResBox:	89
	ResBox:	90
	ResBox:	91
	ResBox:	92
	ResBox:	93
	ResBox:	94
	ResBox:	95
	ResBox:	96
	ResBox:	97
	Label:	"Input Data"
	VisibleBorder:	1
	Listening:	1
)

(TextLabel.76
	InternalName:	"aTextLabel5"
	Constraints:	0x55
	Label:	"XS Cut Lines (2D)"
	Listening:	1
)

(TextLabel.77
	InternalName:	"aTextLabel6"
	Constraints:	0x55
	Label:	"Stream Centerline (2D)"
	Listening:	1
)

(TextLabel.78
	InternalName:	"aTextLabel7"
	Constraints:	0x55
	Label:	"Main Channel Banks"
	Listening:	1
)

(TextLabel.79
	InternalName:	"aTextLabel8"
	Constraints:	0x55
	Label:	"Flow Path Centerlines"
	Listening:	1
)

(AVCBBox.80
	InternalName:	"cbCS"
	NextControl:	62
	ContentKind:	4
	Value:	81
	Constraints:	0x55
	Listening:	1
)

(AVStr.81
	S:	"Null"
)

(AVCBBox.82
	InternalName:	"cbSC"
	NextControl:	62
	ContentKind:	4
	Value:	81
	Constraints:	0x55
	Listening:	1
)

(AVCBBox.83
	InternalName:	"cbBanks"
	NextControl:	62
	ContentKind:	4
	Value:	81
	Constraints:	0x55
	Listening:	1
)

(AVCBBox.84
	InternalName:	"cbFC"
	NextControl:	62
	ContentKind:	4
	Value:	81
	Constraints:	0x55
	Listening:	1
)

(TextLabel.85
	InternalName:	"aTextLabel9"
	Constraints:	0x55
	Label:	"Land use"
	Listening:	1
)

(AVCBBox.86
	InternalName:	"cbLandUse"
	NextControl:	62
	ContentKind:	4
	Value:	87
	Constraints:	0x55
	Listening:	1
)

(AVStr.87
	S:	"Null"
)

(RectD.88
	Left:	15.00000000000000
	Top:	62.00000000000000
	Right:	135.00000000000000
	Bottom:	42.00000000000000
)

(RectD.89
	Left:	15.00000000000000
	Top:	41.00000000000000
	Right:	135.00000000000000
	Bottom:	22.00000000000000
)

(RectD.90
	Left:	15.00000000000000
	Top:	82.00000000000000
	Right:	135.00000000000000
	Bottom:	62.00000000000000
)

(RectD.91
	Left:	15.00000000000000
	Top:	102.00000000000000
	Right:	135.00000000000000
	Bottom:	83.00000000000000
)

(RectD.92
	Left:	147.00000000000000
	Top:	112.00000000000000
	Right:	315.00000000000000
	Bottom:	40.00000000000000
)

(RectD.93
	Left:	147.00000000000000
	Top:	90.00000000000000
	Right:	315.00000000000000
	Bottom:	18.00000000000000
)

(RectD.94
	Left:	147.00000000000000
	Top:	132.00000000000000
	Right:	315.00000000000000
	Bottom:	60.00000000000000
)

(RectD.95
	Left:	147.00000000000000
	Top:	153.00000000000000
	Right:	315.00000000000000
	Bottom:	81.00000000000000
)

(RectD.96
	Left:	15.00000000000000
	Top:	122.00000000000000
	Right:	135.00000000000000
	Bottom:	103.00000000000000
)

(RectD.97
	Left:	147.00000000000000
	Top:	174.00000000000000
	Right:	315.00000000000000
	Bottom:	102.00000000000000
)

(TextLabel.98
	InternalName:	"aTextLabel4"
	Constraints:	0x55
	Label:	"Terrain TIN"
	Listening:	1
)

(LButn.99
	InternalName:	"lblOK"
	Label:	"OK"
	Click:	"RAS.PRE.InputDialogOK"
)

(LButn.100
	InternalName:	"lblCancel"
	Label:	"Cancel"
	Click:	"RAS.PRE.InputDialogCancel"
)

(AVCBBox.101
	InternalName:	"cbTIN"
	NextControl:	62
	ContentKind:	4
	Value:	102
	Constraints:	0x55
	Listening:	1
)

(AVStr.102
	S:	"Null"
)

(TextLabel.103
	InternalName:	"aTextLabel1"
	Constraints:	0x55
	Label:	"RAS GIS Import File"
	Listening:	1
)

(TextLine.104
	InternalName:	"txtFileOut"
	Constraints:	0x55
	Listening:	1
	TextType:	105
	NextControl:	62
)

(AVEnum.105
	Name:	"TEXTLINE_TYPE_ALL"
)

(RectD.106
	Left:	33.00000000000000
	Top:	293.00000000000000
	Right:	358.00000000000000
	Bottom:	225.00000000000000
)

(RectD.107
	Left:	31.00000000000000
	Top:	211.00000000000000
	Right:	357.00000000000000
	Bottom:	82.00000000000000
)

(RectD.108
	Left:	46.00000000000000
	Top:	74.00000000000000
	Right:	166.00000000000000
	Bottom:	55.00000000000000
)

(RectD.109
	Left:	250.00000000000000
	Top:	374.00000000000000
	Right:	298.00000000000000
	Bottom:	350.00000000000000
)

(RectD.110
	Left:	305.00000000000000
	Top:	374.00000000000000
	Right:	353.00000000000000
	Bottom:	350.00000000000000
)

(RectD.111
	Left:	178.00000000000000
	Top:	125.00000000000000
	Right:	346.00000000000000
	Bottom:	53.00000000000000
)

(RectD.112
	Left:	46.00000000000000
	Top:	334.00000000000000
	Right:	166.00000000000000
	Bottom:	315.00000000000000
)

(RectD.113
	Left:	170.00000000000000
	Top:	331.00000000000000
	Right:	350.00000000000000
	Bottom:	311.00000000000000
)

(RectD.114
	Left:	-25.00000000000000
	Top:	414.00000000000000
	Right:	358.00000000000000
	Bottom:	-39.00000000000000
)

(Nil.115
)

(AVDLog.116
	Name:	"RASOut"
	X:	36
	Y:	78
	W:	407
	H:	197
	ConstrainedControlNames:	117
	ConstrainedControlNames:	118
	ConstrainedControlNames:	119
	ConstrainedControlNames:	120
	Constraints:	121
	Constraints:	122
	Constraints:	123
	Constraints:	124
	Server:	125
	ControlPanel:	126
	Title:	"GeoRAS Setup for RAS Post-processor"
	EscapeEnabled:	1
	Modal:	1
	AlwaysOnTop:	1
	HasTitleBar:	1
	Closeable:	1
	DefaultButton:	159
)

(AVStr.117
	S:	"lblPostOK"
)

(AVStr.118
	S:	"lblPostCancel"
)

(AVStr.119
	S:	"lblSelFile"
)

(AVStr.120
	S:	"lblSelTin"
)

(Numb.121
)

(Numb.122
	N:	85.00000000000000
)

(Numb.123
	N:	85.00000000000000
)

(Numb.124
	N:	85.00000000000000
)

(Nil.125
)

(CPanel.126
	Child:	127
	ResBox:	158
	Listening:	1
)

(CPanel.127
	InternalName:	"aControlPanel4"
	Child:	128
	Child:	129
	Child:	130
	Child:	132
	Child:	133
	Child:	134
	Child:	135
	Child:	137
	Child:	138
	Child:	139
	Child:	140
	Child:	142
	Child:	144
	Constraints:	0x55
	ResBox:	145
	ResBox:	146
	ResBox:	147
	ResBox:	148
	ResBox:	149
	ResBox:	150
	ResBox:	151
	ResBox:	152
	ResBox:	153
	ResBox:	154
	ResBox:	155
	ResBox:	156
	ResBox:	157
	Label:	"Background"
	VisibleBorder:	1
	Listening:	1
)

(TextLabel.128
	InternalName:	"lblRASExport"
	Constraints:	0x55
	Label:	"RAS GIS Export File"
	Listening:	1
)

(TextLabel.129
	InternalName:	"aTextLabel2"
	Constraints:	0x55
	Label:	"Output Directory"
	Listening:	1
)

(TextLine.130
	InternalName:	"txtOutDir"
	Constraints:	0x55
	Listening:	1
	TextType:	131
	NextControl:	125
)

(AVEnum.131
	Name:	"TEXTLINE_TYPE_ALL"
)

(LButn.132
	InternalName:	"lblPostOK"
	Label:	"OK"
	Click:	"RAS.PST.OutputDialogOK"
)

(LButn.133
	InternalName:	"lblPostCancel"
	Label:	"Cancel"
	Click:	"RAS.PST.OutputDialogCancel"
)

(LButn.134
	InternalName:	"lblSelFile"
	Label:	"Select File"
	Click:	"RAS.PST.OutputSelFile"
)

(TextLine.135
	InternalName:	"txtFileIn"
	Constraints:	0x55
	Listening:	1
	TextType:	136
	NextControl:	125
)

(AVEnum.136
	Name:	"TEXTLINE_TYPE_ALL"
)

(TextLabel.137
	InternalName:	"aTextLabel1"
	Constraints:	0x55
	Label:	"Terrain TIN"
	Listening:	1
)

(TextLabel.138
	InternalName:	"aTextLabel7"
	Constraints:	0x55
	Label:	"Rasterization cell size"
	Listening:	1
)

(TextLabel.139
	InternalName:	"aTextLabel8"
	Constraints:	0x55
	Label:	"(map units)"
	Listening:	1
)

(TextLine.140
	InternalName:	"txtTinIn"
	Constraints:	0x55
	Listening:	1
	TextType:	141
	NextControl:	125
)

(AVEnum.141
	Name:	"TEXTLINE_TYPE_ALL"
)

(TextLine.142
	InternalName:	"txtCellSize"
	Constraints:	0x55
	Listening:	1
	TextType:	143
	NextControl:	125
)

(AVEnum.143
	Name:	"TEXTLINE_TYPE_ALL"
)

(LButn.144
	InternalName:	"lblSelTin"
	Label:	"Select TIN"
	Click:	"RAS.PST.OutputSelTin"
)

(RectD.145
	Left:	39.00000000000000
	Top:	93.00000000000000
	Right:	174.00000000000000
	Bottom:	71.00000000000000
)

(RectD.146
	Left:	39.00000000000000
	Top:	155.00000000000000
	Right:	174.00000000000000
	Bottom:	134.00000000000000
)

(RectD.147
	Left:	166.00000000000000
	Top:	152.00000000000000
	Right:	351.00000000000000
	Bottom:	132.00000000000000
)

(RectD.148
	Left:	309.00000000000000
	Top:	226.00000000000000
	Right:	357.00000000000000
	Bottom:	202.00000000000000
)

(RectD.149
	Left:	364.00000000000000
	Top:	226.00000000000000
	Right:	412.00000000000000
	Bottom:	202.00000000000000
)

(RectD.150
	Left:	352.00000000000000
	Top:	88.00000000000000
	Right:	421.00000000000000
	Bottom:	69.00000000000000
)

(RectD.151
	Left:	166.00000000000000
	Top:	90.00000000000000
	Right:	351.00000000000000
	Bottom:	70.00000000000000
)

(RectD.152
	Left:	39.00000000000000
	Top:	123.00000000000000
	Right:	174.00000000000000
	Bottom:	102.00000000000000
)

(RectD.153
	Left:	39.00000000000000
	Top:	180.00000000000000
	Right:	174.00000000000000
	Bottom:	159.00000000000000
)

(RectD.154
	Left:	39.00000000000000
	Top:	196.00000000000000
	Right:	140.00000000000000
	Bottom:	175.00000000000000
)

(RectD.155
	Left:	166.00000000000000
	Top:	121.00000000000000
	Right:	351.00000000000000
	Bottom:	101.00000000000000
)

(RectD.156
	Left:	166.00000000000000
	Top:	182.00000000000000
	Right:	351.00000000000000
	Bottom:	162.00000000000000
)

(RectD.157
	Left:	353.00000000000000
	Top:	120.00000000000000
	Right:	421.00000000000000
	Bottom:	101.00000000000000
)

(RectD.158
	Left:	-15.00000000000000
	Top:	245.00000000000000
	Right:	438.00000000000000
	Bottom:	-41.00000000000000
)

(Nil.159
)

(AVDLog.160
	Name:	"RR_Id"
	X:	79
	Y:	93
	W:	221
	H:	171
	ConstrainedControlNames:	161
	ConstrainedControlNames:	162
	Constraints:	163
	Constraints:	164
	Server:	125
	ControlPanel:	165
	ObjectTag:	186
	Title:	"River and Reach Identification"
	EscapeEnabled:	1
	Modal:	1
	Resizable:	1
	AlwaysOnTop:	1
	HasTitleBar:	1
	Closeable:	1
	Open:	"RAS.UTL.RRIdDialogOpen"
	DefaultButton:	188
)

(AVStr.161
	S:	"lblOK"
)

(AVStr.162
	S:	"lblCancel"
)

(Numb.163
	N:	85.00000000000000
)

(Numb.164
	N:	85.00000000000000
)

(CPanel.165
	Child:	166
	ResBox:	185
	Listening:	1
)

(CPanel.166
	InternalName:	"aControlPanel7"
	Child:	167
	Child:	168
	Child:	169
	Child:	170
	Child:	171
	Child:	175
	Child:	176
	Child:	173
	Constraints:	0x55
	ResBox:	177
	ResBox:	178
	ResBox:	179
	ResBox:	180
	ResBox:	181
	ResBox:	182
	ResBox:	183
	ResBox:	184
	Label:	"Background"
	VisibleBorder:	1
	Listening:	1
)

(TextBox.167
	InternalName:	"aTextBox3"
	Listening:	1
	ReadOnly:	1
	Text:	" Enter or select River name and enter Reach name (16 char max)."
	NextControl:	125
)

(AVCBBox.168
	InternalName:	"cbRiver"
	NextControl:	125
	ContentKind:	4
	Constraints:	0x55
	Listening:	1
	Select:	"RAS.UTL.RRIdListSelect"
)

(TextLabel.169
	InternalName:	"aTextLabel6"
	Constraints:	0x55
	Label:	"River:"
	Listening:	1
)

(TextLabel.170
	InternalName:	"aTextLabel7"
	Constraints:	0x55
	Label:	"Reach:"
	Listening:	1
)

(TextLine.171
	InternalName:	"txtReach"
	Label:	" "
	Constraints:	0x55
	Listening:	1
	TextType:	172
	NextControl:	173
)

(AVEnum.172
	Name:	"TEXTLINE_TYPE_ALL"
)

(TextLine.173
	InternalName:	"txtRiver"
	Label:	" "
	Constraints:	0x55
	Listening:	1
	TextType:	174
	NextControl:	171
)

(AVEnum.174
	Name:	"TEXTLINE_TYPE_ALL"
)

(LButn.175
	InternalName:	"lblOK"
	Label:	"OK"
	Click:	"RAS.UTL.RRIdDialogOK"
)

(LButn.176
	InternalName:	"lblCancel"
	Label:	"Cancel"
	Click:	"RAS.UTL.RRIdDialogCancel"
)

(RectD.177
	Left:	86.00000000000000
	Top:	108.00000000000000
	Right:	263.00000000000000
	Bottom:	56.00000000000000
)

(RectD.178
	Left:	143.00000000000000
	Top:	239.00000000000000
	Right:	263.00000000000000
	Bottom:	124.00000000000000
)

(RectD.179
	Left:	91.00000000000000
	Top:	150.00000000000000
	Right:	134.00000000000000
	Bottom:	126.00000000000000
)

(RectD.180
	Left:	92.00000000000000
	Top:	179.00000000000000
	Right:	151.00000000000000
	Bottom:	157.00000000000000
)

(RectD.181
	Left:	135.00000000000000
	Top:	175.00000000000000
	Right:	245.00000000000000
	Bottom:	155.00000000000000
)

(RectD.182
	Left:	165.00000000000000
	Top:	218.00000000000000
	Right:	213.00000000000000
	Bottom:	194.00000000000000
)

(RectD.183
	Left:	221.00000000000000
	Top:	218.00000000000000
	Right:	269.00000000000000
	Bottom:	194.00000000000000
)

(RectD.184
	Left:	136.00000000000000
	Top:	144.00000000000000
	Right:	245.00000000000000
	Bottom:	124.00000000000000
)

(RectD.185
	Left:	-62.00000000000000
	Top:	216.00000000000000
	Right:	285.00000000000000
	Bottom:	-52.00000000000000
)

(List.186
	Child:	187
)

(Bitmap.187
	NumBits:	3
	NumBitsSet:	1
	Bits:	00000001 
)

(Nil.188
)

(Script.189
	Name:	"avras.ResetObj"
	SourceCode:	"' Name: avras.ResetObj\n'***********************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'***********************************************\n' Name: avras.ResetObj\n' Headline: \n' Self:\n' Returns: \n' Description: Removes object-tags \n' Topics:\n' Search Keys:\n' Requires:\n' History: 12/27/96  (TNRCC - as hydro.ResetObj)\n'***********************************************\n'--reset objectTag Associated with the Projec
t\nNObj=0\nTheProject=av.getProject\n'TheProject.SetObjectTag(nil)\n\n'reset objectTag assoicated with the View\nTheViewGui=TheProject.FindGui(\"View\")\nif(TheViewGui.GetObjectTag<>nil)then\n  TheViewGui.SetObjectTag(nil)\n  Nobj=Nobj+1\nend\nif(TheViewGui<>nil)then\n  if(TheViewGui.GetToolBar.GetObjectTag<>nil)then\n    TheViewGui.GetToolBar.SetObjectTag(nil)\n    Nobj=Nobj+1\n  end\n  for each m in TheViewGui.GetToolBar\n    av.showMsg(\"Number of ObjectTag Cleaned=\"+Nobj.AsString)\n    if(m.Is(Space).not)then      \n       i
f(m.getObjectTag<>nil)then\n         m.SetObjectTag(nil)\n         Nobj=Nobj+1        \n       end\n      if(m.Is(ToolMenu)) then\n        for each i in m\n          if(i.GetObjectTag<>nil)then\n            i.SetObjectTag(nil)\n            Nobj=Nobj+1\n          end\n        end\n      end\n    end 'if(m.Is(Space).not)\n  end  ' for each m in TheViewGui.GetToolBar\n  \n  if(TheViewGUI.getButtonBar.GetObjectTag<>nil)then\n    TheViewGui.GetButtonBar.SetObjectTag(nil)\n    Nobj=Nobj+1\n  end\n  \n  for each m in TheViewGui.GetBu
ttonBar\n    av.ShowMsg(\"Number of ObjectTag Cleaned=\"+Nobj.AsSTring)\n    if(m.Is(Space).not)then\n      if(m.getObjectTag<>nil)then\n        m.setObjectTag(nil)\n        Nobj=Nobj+1\n      end\n    end\n  end   'for each m in TheViewGui.GetButtonBar\n  \n  if(TheViewGui.GetMenuBar.GetObjectTag<>nil)then\n    TheViewGui.GetMenuBar.SetObjectTag(nil)\n    Nobj=Nobj+1\n  end\n  \n  for each m in TheViewGui.GetMenuBar\n    for each i in m\n      if(i.Is(SPACE).not)then   \n        if(m.getObjectTag<>nil)then\n          m.setObje
ctTag(nil)\n          Nobj=Nobj+1  \n        end  \n      end\n    end  \n  end   'for each m in TheViewGui.GetMenuBar\nend 'if(TheViewGui<>nil) \n\nTheScriptGui=TheProject.FindGui(\"Script\")  'Script\nif(TheScriptGui<>nil)then\n  for each m in TheScriptGui.GetToolBar\n    av.showMsg(\"Number of ObjectTag Cleaned=\"+Nobj.AsString)\n    if(m.Is(Space).not)then      \n       if(m.getObjectTag<>nil)then\n         m.SetObjectTag(nil)\n         Nobj=Nobj+1        \n       end\n      if(m.Is(ToolMenu)) then\n        for each i in m\n 
         if(i.GetObjectTag<>nil)then\n            i.SetObjectTag(nil)\n            Nobj=Nobj+1\n          end\n        end\n      end\n    end 'if(m.Is(Space).not)\n  end  ' for each m in TheScriptGui.GetToolBar\n  for each m in TheScriptGui.GetButtonBar\n    av.ShowMsg(\"Number of ObjectTag Cleaned=\"+Nobj.AsSTring)\n    if(m.Is(Space).not)then\n      if(m.getObjectTag<>nil)then\n        m.setObjectTag(nil)\n        Nobj=Nobj+1\n      end\n    end\n  end   'for each m in TheScriptGui.GetButtonBar\n  for each m in TheScriptGu
i.GetMenuBar\n    for each i in m\n      if(i.Is(SPACE).not)then   \n        if(m.getObjectTag<>nil)then\n          m.setObjectTag(nil)\n          Nobj=Nobj+1  \n        end  \n      end\n    end  \n  end   'for each m in TheScriptGui.GetMenuBar   \nend 'if(TheScriptGui<>nil)\n\nTheChartGui=TheProject.FindGui(\"Chart\")  'Chart\nif(TheChartGui<>nil)then\n  for each m in TheChartGui.GetToolBar\n    av.showMsg(\"Number of ObjectTag Cleaned=\"+Nobj.AsString)\n    if(m.Is(Space).not)then      \n       if(m.getObjectTag<>nil)then\n  
       m.SetObjectTag(nil)\n         Nobj=Nobj+1        \n       end\n      if(m.Is(ToolMenu)) then\n        for each i in m\n          if(i.GetObjectTag<>nil)then\n            i.SetObjectTag(nil)\n            Nobj=Nobj+1\n          end\n        end\n      end\n    end 'if(m.Is(Space).not)\n  end  ' for each m in TheChartGui.GetToolBar\n  for each m in TheViewGui.GetButtonBar\n    av.ShowMsg(\"Number of ObjectTag Cleaned=\"+Nobj.AsSTring)\n    if(m.Is(Space).not)then\n      if(m.getObjectTag<>nil)then\n        m.setObjectTag(
nil)\n        Nobj=Nobj+1\n      end\n    end\n  end   'for each m in TheChartGui.GetButtonBar\n  for each m in TheViewGui.GetMenuBar\n    for each i in m\n      if(i.Is(SPACE).not)then   \n        if(m.getObjectTag<>nil)then\n          m.setObjectTag(nil)\n          Nobj=Nobj+1  \n        end  \n      end\n    end  \n  end   'for each m in TheChartGui.GetMenuBar   \nend 'if(TheChartGui<>nil)\n  \nTheTableGui=TheProject.FindGui(\"Table\")\nif(TheTableGui<>nil)then\n  for each m in TheTableGui.GetToolBar\n    av.showMsg(\"Number o
f ObjectTag Cleaned=\"+Nobj.AsString)\n    if(m.Is(Space).not)then      \n       if(m.getObjectTag<>nil)then\n         m.SetObjectTag(nil)\n         Nobj=Nobj+1        \n       end\n      if(m.Is(ToolMenu)) then\n        for each i in m\n          if(i.GetObjectTag<>nil)then\n            i.SetObjectTag(nil)\n            Nobj=Nobj+1\n          end\n        end\n      end\n    end 'if(m.Is(Space).not)\n  end  ' for each m in TheTableGui.GetToolBar\n  for each m in TheTableGui.GetButtonBar\n    av.ShowMsg(\"Number of ObjectTag C
leaned=\"+Nobj.AsSTring)\n    if(m.Is(Space).not)then\n      if(m.getObjectTag<>nil)then\n        m.setObjectTag(nil)\n        Nobj=Nobj+1\n      end\n    end\n  end   'for each m in TheTableGui.GetButtonBar\n  for each m in TheTableGui.GetMenuBar\n    for each i in m\n      if(i.Is(SPACE).not)then   \n        if(m.getObjectTag<>nil)then\n          m.setObjectTag(nil)\n          Nobj=Nobj+1  \n        end  \n      end\n    end  \n  end   'for each m in TheTableGui.GetMenuBar   \nend 'if(TheTableGui<>nil)\n\nTheLayOutGui=TheProj
ect.FindGui(\"LayOut\")\nif(TheLayOutGui<>nil)then\n  if(TheLayOutGui.GetObjectTag<>nil)then\n    TheLayoutGui.SetOBjectTag(nil)\n    Nobj=Nobj+1\n  end\n  for each m in TheLayOutGui.GetToolBar\n    av.showMsg(\"Number of ObjectTag Cleaned=\"+Nobj.AsString)\n    if(m.Is(Space).not)then      \n       if(m.getObjectTag<>nil)then\n         m.SetObjectTag(nil)\n         Nobj=Nobj+1        \n       end\n      if(m.Is(ToolMenu)) then\n        for each i in m\n          if(i.GetObjectTag<>nil)then\n            i.SetObjectTag(nil)\n   
         Nobj=Nobj+1\n          end\n        end\n      end\n    end 'if(m.Is(Space).not)\n  end  ' for each m in TheLayOutGui.GetToolBar\n  for each m in TheLayOutGui.GetButtonBar\n    av.ShowMsg(\"Number of ObjectTag Cleaned=\"+Nobj.AsSTring)\n    if(m.Is(Space).not)then\n      if(m.getObjectTag<>nil)then\n        m.setObjectTag(nil)\n        Nobj=Nobj+1\n      end\n    end\n  end   'for each m in TheLayOutGui.GetButtonBar\n  for each m in TheLayOutGui.GetMenuBar\n    for each i in m\n      if(i.Is(SPACE).not)then   \n      
  if(m.getObjectTag<>nil)then\n          m.setObjectTag(nil)\n          Nobj=Nobj+1  \n        end  \n      end\n    end  \n  end   'for each m in TheLayOutGui.GetMenuBar   \nend 'if(TheLayOutGui<>nil)\n\nThePrjGui=TheProject.FindGui(\"Project\")\nif(ThePrjGui<>nil)then\n  if(ThePrjGui.GetObjectTag<>nil)then\n    ThePrjGui.SetObjectTag(nil)\n    NObj=Nobj+1\n  end\n  if(ThePrjGui.GetToolBar.GetObjectTag<>nil)then\n    ThePRJGui.GetToolBar.SetObjectTag(nil)\n    Nobj=Nobj+1\n  end\n  for each m in ThePrjGui.GetToolBar\n    av.sho
wMsg(\"Number of ObjectTag Cleaned=\"+Nobj.AsString)\n    if(m.Is(Space).not)then      \n       if(m.getObjectTag<>nil)then\n         m.SetObjectTag(nil)\n         Nobj=Nobj+1        \n       end\n      if(m.Is(ToolMenu)) then\n        for each i in m\n          if(i.GetObjectTag<>nil)then\n            i.SetObjectTag(nil)\n            Nobj=Nobj+1\n          end\n        end\n      end\n    end 'if(m.Is(Space).not)\n  end  ' for each m in ThePrjGui.GetToolBar\n  for each m in ThePrjGui.GetButtonBar\n    av.ShowMsg(\"Number of O
bjectTag Cleaned=\"+Nobj.AsSTring)\n    if(m.Is(Space).not)then\n      if(m.getObjectTag<>nil)then\n        m.setObjectTag(nil)\n        Nobj=Nobj+1\n      end\n    end\n  end   'for each m in ThePrjGui.GetButtonBar\n  for each m in ThePrjGui.GetMenuBar\n    for each i in m\n      if(i.Is(SPACE).not)then   \n        if(m.getObjectTag<>nil)then\n          m.setObjectTag(nil)\n          Nobj=Nobj+1  \n        end  \n      end\n    end  \n  end   'for each m in ThePrjGui.GetMenuBar   \nend 'if(ThePrjGui<>nil)\n\nTheDocs=TheProject
.GetDocs\n  For each d in TheDocs\n    if(d.GetObjectTag<>nil)then\n      d.SetObjectTag(nil)\n      Nobj=Nobj+1\n    end\n    if(d.Is(View))then\n      for each thm in d.GetThemes\n        if(thm.getObjectTag<>nil)then\n          thm.SetObjectTag(nil)\n          Nobj=Nobj+1\n        end\n      end\n      for each grf in d.GetGraphics\n        if(Grf.GetObjectTag<>nil)then\n          Grf.SetObjectTag(nil)\n          Nobj=Nobj+1\n        end\n      end  \n    end\n  end\n \nav.showMsg(\"Number of ObjectTag Cleaned=\"+Nobj.AsString)
\n\n"
)

(Script.190
	Name:	"RAS.EXT.InstallExt"
	SourceCode:	"' Name: RAS.EXT.InstallExt\n'******************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'******************************************************************\n' Name:         RAS.EXT.InstallExt\n' Usage:        Automatic when installing the HEC-GeoRAS extension\n' Returns:      none\n' Description:  Installs the components of HEC-GeoRAS extension.\n' Assumption: \n' Calling: \n' Comments:    
 Based on AVRas work\n'\n' History:      DDJ; 5/5/98\n'               DDJ; 3/99 - upgrade for HEC-GeoRAS\n'                CTA 10.22.99 - add labe Flowpath tool (object 8)\n'******************************************************************\n' SELF contains a number of objects that need to be added to\n' the user interface through the extension.  The order of\n' elements in the SELF is critical and is governed by the\n' script that created the extension (RAS.EXT.MakeExt).\n' In this case:\n' AV->Ras menu           is 
object (0)\n' Ras->AV menu           is (1)\n' GeoRAS_Util menu       is (2)\n' HEC-GeoRAS Help menu   is (3)\n' About HEC-GeoRAS menu  is (4)\n' Ras_In button          is (5)\n' Ras_Out button         is (6)\n' Label (R) tool         is (7)\n' Label Flowpath tool (F)is (8)\n' Ras_In dialog          is (8)\n' Ras_Out dialog         is (9)\n' RR_Id dialog           is (10)\n\nTheProject=av.GetProject\n\ntString = \"HEC-GeoRAS extension loader\"\n\n' Check if AVRas extension is installed.  If yes, give a message.\n'-------------
---------------------------------------------------------------------\noTestExtension1 = Extension.Find(\"$AVEXT/avras.avx\".AsFileName)\nif (oTestExtension1 <> NIL) then\n  ' AVRas extension loaded\n  tMessage = \"AVRAS extension is loaded!\"\n  tMessage = tMessage + nl + \"Unload AVRas before running HEC-GeoRAS.\"\n  MsgBox.Warning(tMessage,tString)\nend\n\n\n' Install Menu bar elements before the Window menu entry\nTheViewGUI=TheProject.FindGui(\"View\")\nViewMenuBar=TheViewGUI.GetMenuBar\n\nm=ViewMenuBar.FindByLabel(\"Window\"
)              ' find location of Window menu entry\n\n\n' Install the three top menu entries\nif(m<>nil)then\n  ViewMenuBar.Add(SELF.Get(0),ViewMenuBar.GetControls.Find(m)-1)\n  ViewMenuBar.Add(SELF.Get(1),ViewMenuBar.GetControls.Find(m)-1)\n  ViewMenuBar.Add(SELF.Get(2),ViewMenuBar.GetControls.Find(m)-1)\nelse\n  ViewMenuBar.Add(SELF.Get(0),999)\n  ViewMenuBar.Add(SELF.Get(1),999)\n  ViewMenuBar.Add(SELF.Get(2),999)\nend  \n\n\n' Install the AVRas help menu entries\ntheHelpMenu = TheViewGUI.GetMenuBar.FindByLabel(\"Help\")
        ' define the help menu item\ntheHelpMenu.Add(SELF.Get(3),theHelpMenu.GetControls.Count-2)   ' add two places before end\ntheHelpMenu.Add(SELF.Get(4),theHelpMenu.GetControls.Count-2)   ' add two places before end\ntheSpace = Space.Make                                          ' make a space object (line separator)\ntheHelpMenu.Add(theSpace,theHelpMenu.GetControls.Count-2)      ' add the line separator\n\n\n' Install ButtonBar Buttons at the end of all the buttons\nViewBBar=TheViewGUI.GetButtonBar\nViewBBar.Ad
d(SELF.Get(5),999)\nViewBBar.Add(SELF.Get(6),999)\n\n\n' Install ToolBar Tools at the end of all the tools\nViewTBar=TheViewGUI.GetToolBar\nViewTBar.Add(SELF.Get(7),999)\nViewTBar.Add(SELF.Get(8),999)\n\n' The dialogs do not have to be specifically attached.  They will be\n' directly loaded.  Same goes for the scripts.\n\n"
)

(Script.191
	Name:	"RAS.EXT.MakeExt"
	SourceCode:	"' Name: RAS.EXT.MakeExt\n'*******************************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'*******************************************************************************\n' Name:         RAS.EXT.MakeExt\n' Usage:        nil\n' Returns:      nil\n' Description:  Create HEC-GeoRAS Extension \n'                  These 3 programs are related: \n'                  RAS.EXT.MakeExt, RAS.
EXT.InstallExt, and RAS.EXT.UnInstallExt\n' Requires:     RAS.EXT.InstallExt, RAS.EXT.UnInstallExt\n' Comments:     Based on AVRas work\n'\n' History:      DDJ; 5/5/98 - original coding\n'               DDJ; 8/6/98 - removed dependency on Spatial Analyst\n'                            (AVRas 1.1)\n'               DDJ; 9/28/98 - fixed few minor issues (AVRas 1.2)\n'               DDJ; 3/99 - move to HEC-GeoRAS 1.0\n'                         - added one element from the tool bar\n'                         - change in na
mes\n'               CTA; 9/23/99 - change exension name to georas.avx\n'                CTA 10.22.99 - add labe Flowpath tool (object 8)\n'                cta 11.10.99 - move to extension 3.0\n'********************************************************************************\n\ndz=34.asChar\n\nTheProject=av.GetProject\nThePrjDir=TheProject.GetFileName.ReturnDir\nUserExt=system.GetEnvVar(\"AVExt\")\nif(UserExt=nil)then                  'UserExt=nil indicates $USEREXT is not set for the system\n  TheDir=theProject.GetWorkD
ir       'Use project's working directory instead\nelse\n  TheDir=UserExt\nend  \n\n' define extension name and loading and unloading scripts\nextName=FN.Merge(TheDir.AsString,\"HECGeoRAS.avx\")                 ' define extension's file name\n'extName=FN.Merge(TheDir.AsString,\"georas_dev.avx\")                 ' define extension's file name\nsDesc=\"HEC-GeoRAS 3.0\" \n'sDesc=\"HEC-GeoRAS BETA\"                                                ' define extension's help line\nscInstall=TheProject.FindScript(\"RAS.EXT.InstallExt\"
)          ' define install script\nscUnInstall=TheProject.FindScript(\"RAS.EXT.UnInstallExt\")      ' define uninstall script\n\n' define a list of dependencies (dialog designer, 3D analyst)\nlDep=List.Make\nlDep.Add((\"$AVBIN/avdlog.dll\").AsFileName)\n' lDep.Add((\"$AVEXT/Spatial.avx\").AsFileName)        ' (no need in AVRas 1.1 or higher)\nlDep.Add((\"$AVEXT/3d.avx\").AsFileName)\n\n' initiate making of the extension\navras=Extension.Make(extName,sDesc,scInstall,scUninstall,lDep)\n\nTheViewGUI=TheProject.FindGUI(\"View\")   
         ' define the View GUI\n\n\n'***************************************************************************\n' Adding the AVRAS Menu components (only the top menu needs to be added -\n' the submenus will be added automatically)\n'***************************************************************************\navras.Add(TheViewGUI.GetMenuBar.FindByLabel(\"preRas\"))        ' object 0\navras.Add(TheViewGUI.GetMenuBar.FindByLabel(\"postRAS\"))        ' object 1\navras.Add(TheViewGUI.GetMenuBar.FindByLabel(\"GeoRAS_Util\")) 
   ' object 2\n\n\n'***************************************************************************\n' Adding the AVRas Help Menu components - add to the existing Help menu\n'***************************************************************************\ntheHelpMenu = TheViewGUI.GetMenuBar.FindByLabel(\"Help\")        ' define the help menu item\ntheChoice = theHelpMenu.FindByLabel(\"HEC-GeoRAS Help...\")      ' define the AVRas Help item\navras.Add(theChoice.Clone)                                     ' add to the object cont
ainer - object 3\ntheChoice = theHelpMenu.FindByLabel(\"About HEC-GeoRAS\")        ' define the AVRas Help item\navras.Add(theChoice.Clone)                                     ' add to the object container - object 4\n\n\n'************************************************\n' Adding View Button Items\n'************************************************\nViewBBar=TheViewGUI.GetButtonBar                    ' define the button bar\navras.Add(ViewBBar.FindByScript(\"RAS.PRE.InputAll\"))           ' object 5\navras.Add(ViewBBar.F
indByScript(\"RAS.PST.OutputAll\"))          ' object 6\n\n\n'************************************************\n' Adding View Tool Items\n'************************************************\nViewTBar=TheViewGUI.GetToolBar                      ' define the tool bar\navras.Add(ViewTBar.FindByScript(\"RAS.UTL.EditIDApply\"))        ' object 7\navras.Add(ViewTBar.FindByScript(\"RAS.UTL.LabelFlowpathsApply\"))' object 8\n\n'************************************************\n' Adding Dialogs\n'****************************************
********\navras.Add(TheProject.FindDialog(\"RasIn\"))                      ' object 9\navras.Add(TheProject.FindDialog(\"RasOut\"))                     ' object 10\navras.Add(TheProject.FindDialog(\"RR_Id\"))                      ' object 11\n\n\n'************************************************\n' Adding Scripts\n'************************************************\n'i=1\nfor each prg in TheProject.getDocs                ' loop through all the scripts\n  if(prg.is(SEd))then\n\n    ' add RAS.* code\n    if (prg.GetName.Contains(\"
RAS\")) then         ' use only those scripts that are RAS\n      if(prg.IsCompiled.Not)then\n        prg.Compile                               ' compile the script if necessary\n      end\n      avras.Add(prg.GetScript)                    ' add the script to the container\n'      i=i+1\n    end\n\n    ' add framework (RAS.FRM.*) code\n    if (prg.GetName.Contains(\"RAS.FRM\")) then     ' use only those scripts that are framework\n      if(prg.IsCompiled.Not)then\n        prg.Compile                               ' compi
le the script if necessary\n      end\n      avras.Add(prg.GetScript)                    ' add the script to the container\n'      i=i+1\n    end\n\n  end  \nend                                               ' end looping through programs\n\nTheAuthor=TheProject.GetCreator\ncurTime=date.now.asString\nInfoStr=\"HEC-GeoRAS 3.0 Extension.\"+nl+\"Pre- and post-processing for HEC-RAS\"\n'InfoStr=\"HEC-GeoRAS 3.0 BETA Extension.\"+nl+\"Pre- and post-processing for HEC-RAS\"\n'InfoStr = InfoStr+nl+\"Constructed on\"++curTime++\"by\"++TheA
uthor+nl+\"Hydrologic Engineering Center\"\nInfoStr = InfoStr+nl+nl+\"Hydrologic Engineering Center\"\navras.SetAbout(InfoStr)                           ' about string\navras.SetExtVersion(1)                            ' define version number\navras.Commit                                      ' commit the extension creation\n\nMsgbox.Info(avras.GetFileName.GetBaseName.AsString+nl+\"is written to:\"++TheDir.AsString,\"HEC-GeoRAS Extension Creation\")\n\n"
)

(Script.192
	Name:	"RAS.EXT.UnInstallExt"
	SourceCode:	"' Name: RAS.EXT.UnInstallExt\n'************************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'************************************************************************\n' Name:         RAS.EXT.UnInstallExt\n' Usage:        Automatic when un-installing the HEC-GeoRAS extension\n' Returns:      none\n' Description:  Uninstalls the components of HEC-GeoRAS extension.\n' Assumption: \n' Call
ing: \n' Comments:     Based on AVRas work\n'\n' History:      DDJ; 5/5/98 - original coding\n'               DDJ; 3/99 - upgrade for HEC-GeoRAS\n'                CTA 10.22.99 - add label Flowpath tool remove \n'************************************************************************\n\nTheProject=av.GetProject\n\n' Unistall menu entries\nTheViewGUI=TheProject.FindGUI(\"View\")\nViewMenuBar=TheViewGUI.GetMenuBar\nViewMenuBar.Remove(ViewMenuBar.FindByLabel(\"preRas\"))\nViewMenuBar.Remove(ViewMenuBar.FindByLabel(\"postRAS\"))\nV
iewMenuBar.Remove(ViewMenuBar.FindByLabel(\"GeoRAS_Util\"))\n\n' Unistall help menu entries\ntheHelpMenu = TheViewGUI.GetMenuBar.FindByLabel(\"Help\")              ' define the help menu item\ntheHelpMenu.Remove(theHelpMenu.FindByLabel(\"HEC-GeoRAS Help...\"))    ' remove it\ntheHelpMenu.Remove(theHelpMenu.FindByLabel(\"About HEC-GeoRAS\"))      ' remove it\n\n' Uninstall buttons\nViewBBar=TheViewGUI.GetButtonBar\nViewBBar.Remove(ViewBBar.FindByScript(\"RAS.PRE.InputAll\"))\nViewBBar.Remove(ViewBBar.FindByScript(\"RAS.PST.Outpu
tAll\"))\n\n' Uninstall tools\nViewTBar=TheViewGUI.GetToolBar\nViewTBar.Remove(ViewTBar.FindByScript(\"RAS.UTL.EditIDApply\"))\nViewTBar.Remove(ViewTBar.FindByScript(\"RAS.UTL.LabelFlowpathsApply\"))\n\n\n' Uninstall dialogs\nDialog.DetachFromExtension(SELF)\n\n"
)

(Script.193
	Name:	"RAS.FRM.AddFThmToView"
	SourceCode:	"' Name: RAS.FRM.AddFThmToView\n' ***************************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:         RAS.FRM.AddFThmToView\n' USAGE:        av.run(\"RAS.FRM.AddFThmToView\",{oFtab,OutName,sTag,oView})\n'      where:   oFtab     - oFtab to save\n'               OutName    - default name of the the
me to be saved\n'               sTag       - string tag to tag the new theme with\n'               oView      - view to which to attache the theme            \n' Returns:      FThm / or nil if creation failed. zye \n' Description:  Attach the grid to the view and tag it with its tag.\n' CalledBy:     HMS.PRE.*\n' Requires:     none\n' History:  Modified from AddGThmToView.    \n'           Zye 2/2/99\n' ***************************************************************************\noFtab=SELF.Get(0)\nOutName=SELF.Get(1)\n
sTag=SELF.Get(2)\noView=SELF.Get(3)\n\nFThm=FTheme.Make(oFtab)                        ' create a theme \nFThm.SetName(OutName)                          ' set name of theme\n\ndTag=Dictionary.Make(1)                        ' create a tag dictionary\ndTag.Set(\"sName\",sTag)                         ' define the tag dictionary\n\nFThm.SetObjectTag(dTag)                        ' set the dictionary for the newly generated theme\noView.AddTheme(FThm)                           \n\nreturn FThm                                    
' exit sub\n"
)

(Script.194
	Name:	"RAS.FRM.AddGThmToView"
	SourceCode:	"' Name: RAS.FRM.AddGThmToView\n' ***************************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:         RAS.FRM.AddGThmToView\n' USAGE:        av.run(\"RAS.FRM.AddGThmToView\",{rGrid,OutName,sTag,oView})\n'      where:   rGrid     - Grid to save\n'               OutName    - default name of the them
e to be saved\n'               sTag       - string tag to tag the new theme with\n'               oView      - view to which to attache the theme            \n' Returns:      gThm / or nil if creation failed. zye \n' Description:  Attach the grid to the view and tag it with its tag.\n' CalledBy:     HMS.PRE.*\n' Requires:     none\n' History:      DDJ 12/98\n' ***************************************************************************\nrGrid=SELF.Get(0)\nOutName=SELF.Get(1)\nsTag=SELF.Get(2)\noView=SELF.Get(3)\n\ngthm=GT
heme.Make(rGrid)                        ' create a theme \ngthm.SetName(OutName)                          ' set name of theme\n\ndTag=Dictionary.Make(1)                        ' create a tag dictionary\ndTag.Set(\"sName\",sTag)                         ' define the tag dictionary\n\ngthm.SetObjectTag(dTag)                        ' set the dictionary for the newly generated theme\noView.AddTheme(gthm)                           ' add the GRID to the view\n\nreturn gThm                                     ' exit sub\n"
)

(Script.195
	Name:	"RAS.FRM.BackupShpFile"
	SourceCode:	"' Name: RAS.FRM.BackupShpFile\n' ***************************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name: RAS.FRM.BackupShpFile\n' USAGE: av.run(\"RAS.FRM.BackupShpFile\",{oThm,sTitle,SelRec})\n'     oThm     - the theme to be backed-up\n'     sTitle   - title to display on the message box\n'     SelRec   - in
dicator whether to backup the selected records only\n'\n' Returns:     nil\n' Description: Check if a backup of a shape file is required, and if it is, do it. \n' CalledBy:    RAS.FRM.GetThmsByTagR\n' Requires:    none\n' History:     12/98 DDJ (based on hydro.BackupFile for TNRCC)\n' ***************************************************************************\n\noThm  =SELF.Get(0)\nsTitle=SELF.Get(1)\nSelRec=SELF.Get(2)\n\n' Ask the user whether to make the backup file or not\nsText = \"The operation may modify \"+oThm.Get
Name+\" theme !\"+nl+\"Would you like to backup the file ?\"\nbFile=MsgBox.LongYesNo(sText,sTitle,False)\n\nif(bFile)then\n\n  ' do action for shape backup\n  TheProject=av.GetProject                  ' get the project\n  Rdir=TheProject.GetFileName.returnDir     '-> Rdir is the directory that the project file is in\n  WkDir=FN.Merge(Rdir.AsString,\"tmp\")       '-> holds the tmp files\n  TheProject.SetWorkDir(WkDir)              ' get the current working directory\n  TheName=oThm.GetName\n  oFtab=oThm.GetFtab\n  def=\"BK\"+Th
eName                          ' define default backup name\n  def=FN.Merge(WkDir.AsString,def)\n  def=FileDialog.Put(def, \"*.shp\", \"Backup \" + TheName + \" to:\")\n  \n  if(def=NIL) then\n    ' the user cancelled after saying that they want to make a backup - the user is assumed\n    ' confused and the overall operation will be cancelled.\n    sText = \"The operation is cancelled !\"\n    MsgBox.Warning(sText,sTitle)\n    exit\n  end\n\n  anFTab=oFtab.Export(def,Shape,SelRec)     ' save the backup shape\n\nend\n\nreturn nil  
                                ' exit sub telling we did what user asked us to do\n\n"
)

(Script.196
	Name:	"RAS.FRM.ChkThms"
	SourceCode:	"' Name: RAS.FRM.ChkThms\n' ***************************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name: RAS.FRM.ChkThms  \n' USAGE: av.run(\"RAS.FRM.ChkThms\",{sThmName,lThms,iIndex})\n' Returns: true/false (found/notfound) \n' Description:  Chk to see if the themename is used for other purposes.\n' CalledBy: HMS.
FRM.DiaThms\n' Requires:\n' History: Zye 12/21/98\n' ***************************************************************************\nsThmName=SELF.Get(0)\nlThms=SELF.Get(1)\niIndex=SELF.Get(2)\n\nbFound=false\nfor each i in 0..(lThms.Count-1)\n  if(i=iIndex)then\n    continue\n  else\n    sThm=lThms.Get(i)\n    if(sThm=sThmName)then\n      bFound=true\n      break\n    end\n  end\nend\n\nreturn bFound\n\n"
)

(Script.197
	Name:	"RAS.FRM.ChkThmTags"
	SourceCode:	"' Name: RAS.FRM.ChkThmTags\n' ***************************************************************************\n'              (c) Copyright, 1997\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name: RAS.FRM.ChkThmTags\n' USAGE: av.run(\"RAS.FRM.ChkThmTags\",nil)\n' Returns:\n' Description: Chk the theme tags in a given view\n' CalledBy:\n' Requires:\n' History: zye 1/4/99\n' ********************************
*******************************************\nTheView=av.GetActiveDoc\nav.run(\"RAS.FRM.ThmTagMgr\",{\"SHOW\",TheView})\nav.run(\"RAS.FRM.ViewTagMgr\",{\"SHOW\"})\n\n"
)

(Script.198
	Name:	"RAS.FRM.DiaThms"
	SourceCode:	"' Name: RAS.FRM.DiaThms\n' ***************************************************************************\n'              (c) Copyright, 1997\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' FileName: RAS.FRM.DiaThms \n' Name: diaThms.TNC\n'\n' Usage:  Called by River/Lake's Editing Tools.\n'  KeyRequests: \"Make\"\n'\n'  av.run(\"diaThms.TNC\",{\"Make\",sTitle,oView,dThms,lThms,lTags,lThmTypes,lShpTypes})\n'\n' 
Description: Create dialog for Lake, River attributes editing.\n'\n' Requires: RAS.FRM.GetThms, RAS.FRM.ThmTagMgr, RAS.FRM.VerifyThmType\n'\n'  dProps    key                value\n'            \"bOK\"              false\n'            \"dThms\"            dThms       'Key=Tag,Value=oThm\n'            \"lThms\"            lThms       'List of thm names. if a thm with the tag is found\n'                                           'lThms will have its name, otherwise, a nil.\n'            \"lTags\"            lTags       'List o
f Tags\n'            \"lThmTypes\"        lThmTypes   'List of Thm Types\n'            \"lShpTypes\"        lShpTypes   'List of Shp Types              \n'            \"lPurposes\"        lPurposes   'List of Thm Purposes, \"I\"=Input,\"O\"=Output\n'            \"lOverWrts\"        lOverWrts   '0=Delete(GThm)/Clear(Fthm),1=ChangeName,2=Append.\n'            \"sTitle\"           sTitle      'Title to be used for all the msgbox\n'            \"dThmNames\",       dThmNames   'Key=Tag,Value=ListOfCandidateThemes,\n'            \"sWork
PanelName\"   sWorkPanelName 'PanelName, used to id the cboboxes.\n'            \"nInThms\"          nInThms     'number of input themes\n'            \"nOutThms\"         nOutThms    'number of output themes\n'            \"iOthers\"          iOthers     'int-switch that allows different setup on the \n'                                            dialog. e.g., iOthers=1, will allow a NULL to \n'                                            added to the Input List.\n'\n' History: Zye 12/15\n' ...............................
...........................................\n'..All the sMsgs are grouped here to make it easier to modify.\nsUsedMsg=\"is used by a\"\nsInstMsg=\"Please use a different name.\"\nsUsedAsMsg=\"is used as\"\nsOverWrtMsg=\"Over write it with\"\nsThmNameDup=\"is already been used by another theme.\"+nl+\"Please select a new one\"+nl+Script.The.GetName\nsBlankMsg=\"is blank.\"+nl+\"Reenter the theme name.\"+nl+Script.The.GetName\nsTxtHelp=\"Enter a theme name for the output.\"\nsDefault=\"NULL\"     'indicating to take a default/Create the 
shape.\nsCboHelp=\"Select \"+sDefault\nTheView=av.GetActiveDoc\nif(SELF.is(Control))then\n  ctlSelf=SELF\n  sRequest=SELF.GetObjectTag\n  diaSelf=SELF.GetDialog\n  dProps=diaSelf.GetObjectTag\n  sWorkPanelName=dProps.Get(\"sWorkPanelName\")\n  sTitle=dProps.Get(\"sTitle\")\nelse \n  ctlSelf=nil   \n  sRequest = SELF.Get(0)\nend  \n'..Make -> Create a dialog to manage dFields\nif(sRequest=\"Make\")then\n  oView    =SELF.Get(1)\n  dThms    =SELF.Get(2)\n  lThms    =SELF.Get(3)\n  lTags    =SELF.Get(4)\n  lThmTypes=SELF.Get(5)\n  lShpType
s=SELF.Get(6)\n  lDefNames=SELF.Get(7)\n  lPurposes=SELF.Get(8)\n  lOverWrts=SELF.Get(9)\n  iOthers  =SELF.Get(10)\n  sTitle   =SELF.Get(11)\n  sHelpTopic=SELF.Get(12)\n        \n  sDiaName=\"diaThmsD\"\n  sDiaScript=Script.The.GetName\n  sWorkPanelName=\"WorkPanel\"\n  sDefault=\"NULL\"    'For the themes that don't exist and need to be added manually.\n  \n  '... figure out where 10,10 inside the doc frame is in whole screen coords\n  pntOrigin = av.ReturnOrigin\n  \n  nMargin = 15\n  \n  nThms   =dThms.Count\n  nRows   =nThms\n  
nInThms =0   'Number of CboBoxes\n  nOutThms=0   'Number of TxtBoxes\n  for each i in 0..(nThms-1)\n    sType=lPurposes.Get(i)\n    if(sType.Ucase=\"I\")then\n      nInThms=nInThms+1\n    else\n      nOutThms=nOutThms+1    \n    end\n  end\n  \n    \n  nRowY=25  \n  nWorkHeight=nRowY*(nRows+2)\n  nControlHeight=90\n  \n  '... initialize sizes and extents\n  nDiaWidth =350\n  nDiaHeight=(nWorkHeight+nControlHeight)\n\n  rcDialog      = Rect.Make(pntOrigin.Move(20,110),  nDiaWidth@nDiaHeight)\n  rcCpnlLine    = Rect.Make(nMargin@(n
WorkHeight+15),  (nDiaWidth-(2.5*nMargin))@4)\n  rcDescription = Rect.Make(150@2,   300@140)\n  rcWork        = Rect.Make(10@10,   nDiaWidth@nWorkHeight)\n  ptLbtSize     = Point.Make(60, 22)\n  ptRbtSize     = Point.Make(250,25)\n'  ptCboSize     = Point.Make(nDiaWidth-(4*nMargin),80)\n'  ptTxtSize     = Point.Make(250,25)\n'  ptLblSize     = Point.Make((nDiaWidth-(3*nMargin)-ptCboSize.GetX),20)\n  ptInputSize   = Point.Make((nDiaWidth-(2*nMargin)),nMargin)\n  \n  '..Set the size for the input/output theme's name co
ntrols.\n  dx            = (ptInputSize.GetX-nMargin)/4\n  dy            = nMargin*1.5\n  ptLblCtlSize  = Point.Make((dx),dy)   'Label for the Cbo/TxtControls.\n  ptCboSize     = Point.Make((3*dx),(3*dy))   'Don't use the label of CBO/TXT box\n  ptTxtSize     = Point.Make((3*dx),dy)   'so that the txt/cbo boxes will line up.\n  \n  '... standard button extents\n  nXOffset      = 10\n  nLowerY       = nWorkHeight+30\n  nCancelX      = (nDiaWidth   - ptLbtSize.GetX - (nMargin*1.5))\n  nHelpX        = nCancelX- ptLbtSize
.GetX - (nMargin/2)\n  nOkX          = nHelpX - ptLbtSize.GetX - (nMargin/2)\n  rcOK          = Rect.Make(Point.Make(nOkX, nLowerY),ptLbtSize)\n  rcCancel      = Rect.Make(Point.Make(nCancelX, nLowerY),ptLbtSize)\n  rcHelp        = Rect.Make(Point.Make(nHelpX,   nLowerY),ptLbtSize)\n  \n  '... build the dialog property dictionary\n  dThmNames=Dictionary.Make(1) 'Key=Tag,Value=ListOfThmNamesAsCandidates\n  dProps = Dictionary.Make(10)\n  dProps.Set(\"bOK\",false)\n  dProps.Set(\"oView\",oView)\n  dProps.Set(\"lThms\",lThms)\n
  dProps.Set(\"lTags\",lTags)\n  dProps.Set(\"dThms\",dThms)\n  dProps.Set(\"sTitle\",sTitle)\n  dProps.Set(\"lThmTypes\",lThmTypes)\n  dProps.Set(\"lShpTypes\",lShpTypes)\n  dProps.Set(\"dThmNames\",dThmNames)\n  dProps.Set(\"lDefNames\",lDefNames)\n  dProps.Set(\"lPurposes\",lPurposes)\n  dProps.Set(\"lOverWrts\",lOverWrts)\n  dProps.Set(\"nInThms\"  ,nInThms)\n  dProps.Set(\"nOutThms\" ,nOutThms)\n  dProps.Set(\"sWorkPanelName\",sWorkPanelName)\n  dProps.Set(\"iOthers\"  ,iOthers)     'iOthers configures the dialog for different purposes.  \n
  \n  \n  '... dialog\n  diaThms = Dialog.Make(true,false,true,true,true)\n  diaThms.SetName(sDiaName)\n  diaThms.SetTitle(sTitle)\n  diaThms.SetExtent(rcDialog)\n  diaThms.SetObjectTag(dProps)\n  diaThms.SetEscapeEnabled(false)\n  cpnlMain = diaThms.GetControlPanel\n  \n  '... dialog delimeter control panel (single line)\n  cpnlLine = ControlPanel.Make\n  cpnlMain.Add(cpnlLine,rcCpnlLine)\n  cpnlLine.SetName(\"cpnlLine\")\n  cpnlLine.SetVisibleBorder(true)\n  \n  '... Ok button\n  lbtOK = LabelButton.Make\n  cpnlMain.Add(lbtOK
,rcOk)\n  lbtOK.SetObjectTag(\"Ok\")\n  lbtOK.SetLabel(\"OK\")\n  lbtOK.SetName(\"lbtOk\")\n  lbtOK.SetClick(sDiaScript)\n\n  '... help button\n  lbtCur = LabelButton.Make\n  cpnlMain.Add(lbtCur,rcHelp)\n  lbtCur.SetObjectTag(\"Help\")\n  lbtCur.SetLabel(\"Help\")\n  lbtCur.SetName(\"lbtHelp\")\n  lbtCur.SetClick(sDiaScript)\n\n  '... cancel button\n  lbtCur = LabelButton.Make\n  cpnlMain.Add(lbtCur,rcCancel)\n  lbtCur.SetObjectTag(\"Cancel\")\n  lbtCur.SetLabel(\"Cancel\")\n  lbtCur.SetName(\"lbtCancel\")\n  lbtCur.SetClick(sDiaScript)\n    \n  
'..Adding Control panels\n  cpnlWork   = ControlPanel.Make\n  diaThms.GetControlPanel.Add(cpnlWork,rcWork)\n  cpnlWork.SetName(sWorkPanelName)\n  cpnlWork.SetVisibleBorder(false)\n\n  diaThms.SetDefaultButton(lbtOK)  \n    \n  nCurrentY=nMargin\n  nCurrentX=nMargin\n  nCboTxtX =nCurrentX+(ptlblCtlSize.GetX)\n  \n  lThmNames=List.Make\n  '***************************************************************************\n  '..Adding Input themes\n  '***************************************************************************\n  if(
nInThms>0)then\n    for each i in 0..(nInThms-1) by 1\n      sTag=lTags.Get(i)\n      sThm=lThms.Get(i)\n      \n      if(sThm.Is(String))then\n        oThm=oView.FindTheme(sThm)\n      else\n        oThm=nil\n      end\n      sShpType=lShpTypes.Get(i)\n      sThmType=lThmTypes.Get(i)\n      \n      '..Add the lblText\n      rcLblTxt=Rect.Make(nCurrentX@nCurrentY,ptLblCtlSize)\n      lblNew=TextLabel.Make\n      lblNew.SetLabel(sTag)\n      cpnlWork.Add(lblNew,rcLblTxt)\n      \n      '..Add the ComboBox.\n      cboNew=ComboBo
x.Make\n      rcCboCtrl=Rect.Make(nCboTxtX@nCurrentY,ptCboSize)\n      'cboNew.SetLabel(sTag)\n      cboNew.SetName(sTag)\n      cboNew.SetObjectTag(sWorkPanelName+\"_\"+sTag)\n      cboNew.SetSelect(sDiaScript)\n      cpnlWork.Add(cboNew,rcCboCtrl)  \n      nCurrentY=nCurrentY+(nMargin*2)\n      lTmpThms=av.run(\"RAS.FRM.GetThms\",{oView,false,sThmType,sShpType})\n      lThmNames.Empty\n      \n      if(lTmpThms.is(List))then\n        for each oTmpThm in lTmpThms\n          lThmNames.Add(oTmpThm.GetName)\n        end\n      
end\n      \n      '..iOthers>0, add NULL to the system.  \n      if(iOthers=1)then\n        lThmNames.Add(sDefault)   'Add the default entry\n      end\n      '..If no specified thm found, give an error message and exit.\n      if(lThmNames.Count=0)then\n        msgbox.info(\"Required Theme:\"++sTag++\"not found.\"+nl+\"Add the required theme before continuing.\"+nl+Script.The.GetName,sTitle)\n        Return (nil)\n      else  \n        dThmNames.Set(sTag,lThmNames)\n        cboNew.DefineFromList(dThmNames.Get(sTag))\n      
  if(iOthers=1)then\n          cboNew.SetHelp(sCboHelp+\" if \"+sTag+\" theme is not available.//\"+sCboHelp+\" if \"+sTag+\" theme is not available.\")\n        else\n          cboNew.SetHelp(\"Select a theme to be used as\"++sTag+\".//Select a theme to be used as\"++sTag+\".\")        \n        end\n        if(oThm.Is(Theme))then\n          cboNew.FindByValue(oThm.GetName) \n          cboNew.SelectCurrent      \n        else\n          if(iOthers=1)then\n            cboNew.FindByValue(sDefault)\n            cboNew.SelectCurrent\n 
         end  \n        end\n        'Sync the lThms' element with cbo's current value\n        lThms.Set(i,cboNew.GetCurrentValue)   \n      end   \n    end\n  end  'if(nInThms>0)\n\n  '*************************************************************************** \n  '..Add OutThemes TextBox      \n  '***************************************************************************\n  if(nOutThms>0)then\n    for each i in nInThms..(nThms-1) by 1\n      sTag=lTags.Get(i)\n      sDef=lDefNames.Get(i)\n      \n      '..Create the La
ble for the textbox\n      rcLblTxt=Rect.Make(nCurrentX@nCurrentY,ptTxtSize)\n      lblNew=TextLabel.Make\n      lblNew.SetLabel(sTag)\n      cpnlWork.Add(lblNew,rcLblTxt)\n      \n      'if a thm is already tagged with sTag, then used it.\n      lTmpThms=av.run(\"RAS.FRM.ThmTagMgr\",{\"Get\",oView,sTag})\n      if(lTmpThms.Count>0)then\n        sDef=lTmpThms.Get(0).GetName\n      end\n      '..Create the Textbox for the default output file name\n      rcTxtBox=Rect.Make(nCboTxtX@nCurrentY,ptTxtSize)\n      txtNew=TextBox.M
ake\n      txtNew.SetText(sDef)\n      txtNew.SetName(sTag)\n      txtNew.SetVerticalScroll(False)\n      txtNew.SetSize(50)\n      txtNew.SetObjectTag(sWorkPanelName+\"_\"+sTag)\n      txtNew.SetChanged(sDiaScript)\n      txtNew.SetHelp(sTxtHelp+\"//\"+sTxtHelp)\n      cpnlWork.Add(txtNew,rcTxtBox)   \n      lThms.Set(i,txtNew.GetText)\n      nCurrentY=nCurrentY+(2*nMargin)\n    end \n  end   \n  Return (diaThms)\nend  'make ends\n'***************************************************************************\n'  Handles OK/Canc
el Click Action\n'***************************************************************************\nif(sRequest=\"OK\")then\n  oView=dProps.Get(\"oView\")\n  lThms=dProps.Get(\"lThms\")\n  lTags=dProps.Get(\"lTags\")\n  dThms=dProps.Get(\"dThms\")\n  sTitle=dProps.Get(\"sTitle\")\n  nInThms=dProps.Get(\"nInThms\")\n  nOutThms=dProps.Get(\"nOutThms\")\n  lDefNames=dProps.Get(\"lDefNames\")\n  lOverWrts=dProps.Get(\"lOverWrts\")\n  lThmTypes=dProps.Get(\"lThmTypes\")\n  lShpTypes=dProps.Get(\"lShpTypes\")\n\n  bOK=true\n  '..Collect the input themes\n  i
f(nInThms>0)then\n    for each i in 0..(nInThms-1)\n      sTag=lTags.Get(i)\n      oCtrl=diaSELF.FindByName(sTag)\n      sName=oCtrl.GetCurrentValue\n      \n      if(sName.Trim.Count=0)then\n        Msgbox.info(oCtrl.GetName++sBlankMsg,sTitle)\n        bOK=false\n        break\n      end\n      \n      '..chk duplicates\n      bFound=av.run(\"RAS.FRM.ChkThms\",{sName,lThms,i})\n      if((bFound) and (sName<>sDefault))then\n        msgbox.info(sName++sThmNameDup,sTitle)\n        bOk=false\n        break\n      end\n\n      lThms
.Set(i,oCtrl.GetCurrentValue)\n      \n      '..Handles sName=sDefault situation\n      if(sName=sDefault)then\n        '..Remove the sTag that might have been tagged on to a theme.\n        lTmpThms=av.run(\"RAS.FRM.ThmTagMgr\", {\"Get\",oView,sTag})\n        if(lTmpThms.Is(List))then\n          for each oTmpThm in lTmpThms\n            aThm=oView.FindTheme(oTmpThm.GetName)\n            dThmTag=aThm.GetObjectTag\n            if(dThmTag.Is(Dictionary))then\n              dThmTag.Set(\"sName\",nil)\n            end\n          
end\n        end\n        dThms.Set(sTag,nil)\n      else\n        dThms.Set(sTag,oView.FindTheme(sName))\n      end\n    end\n  end\n  '..Collect the output themes\n  '..Chk the oThm found, chk to see if the theme is good before adding it to the\n  '..dThms.  If everything is ok, then dThms.Get(sTag) will return either the\n  '..thm intended for the purpose or nil.\n  '..The calling program will make sure that:\n  '..(1) for othm=nil of FTheme type, an FTheme will be created.\n  '..(2) for othm=nil of GTheme type, \n  ' 
     in both cases, remove the possible existing tag from a FTheme/GTheme.\n  \n  if((nOutThms>0) and (bOk=true))then\n    for each i in nInThms..(lTags.Count-1) by 1\n      '..Chk to see if the Thm Exist, if it does, chk the value of lOverWrts\n      '..if lOverWrts(i)=1 or 2 for Gtheme or lOverWrts(i)=1 for FTheme, Prompt\n      '..a message for a new name.\n      sTag=lTags.Get(i)\n      iIndex=i\n      oCtrl=diaSELF.FindByName(sTag)\n      sText=oCtrl.GetText\n      '..Chk duplicates\n      bFound=av.run(\"RAS.FRM.C
hkThms\",{sText,lThms,i})\n      if(bFound)then\n        msgbox.info(sText++sThmNameDup,sTitle)\n        bOk=false\n        break\n      end\n\n\n      sFileName=sText.AsFileName.GetBaseName.AsString\n      if((sFileName.Trim.Count=0) or (sText.Trim.Count=0))then\n        bOK=false\n        Msgbox.info(oCtrl.GetName++sBlankMsg,sTitle)\n        break\n      end\n      oThm=oView.FindTheme(sFileName)\n      if(oThm=nil)then\n        oThm=oView.FindTheme(sFileName+\".Shp\")\n      end\n      '..if oThm=nil, we need to do nothing. 
else, a lot of work.\n      if(oThm<>nil)then\n        \n        ThmType=lThmTypes.Get(iIndex)\n        ShpType=lShpTypes.Get(iIndex)\n        \n        '..Chk if the theme's type or shp type is not the same as the specified theme,\n        '..Notify the name conflict and ask user to enter a new name.\n        bChk=av.run(\"RAS.FRM.VerifyThmType\",{oThm,ThmType,ShpType})\n        if(bChk=false)then\n          Msgbox.Info(sFileName++sUsedMsg++oThm.GetClass.GetClassName+nl\n            ++sInstMsg,sTitle)\n          'ctlSEL
F.SetText(\"\")\n          Return nil       \n        end      \n        \n        '..If it reached here, oThm is of the same ThmType and ShpType requested\n        dTag=oThm.GetObjectTag\n        if(dTag.Is(Dictionary))then\n          sName=dTag.Get(\"sName\")\n          if(sName<>sTag)then\n            bChk=MsgBox.YesNo(oThm.GetName++sUsedAsMsg++sName.AsString+nl+sOverWrtMsg++sTag+\"?\",\n                 sTitle,false)\n            if(bChk=false)then\n              return nil\n            end\n          end\n        end\n     
   iOverWrite=lOverWrts.Get(iIndex)\n        \n        if(iOverWrite>0)then\n          if(oThm.Is(GTheme))then\n            msgbox.info(oThm.GetName++sUsedMsg++oThm.GetClass.GetClassName+nl+nl+sInstMsg,\n              sTitle)\n          'ctlSELF.SetText(\"\")          \n            return nil\n          end\n          if(oThm.Is(FTheme))then\n            if(iOverWrite=1)then\n              msgbox.info(oThm.GetName++sUsedMsg++oThm.GetClass.GetClassName+nl+nl+sInstMsg,\n                sTitle)\n              'ctlSELF.SetTex
t(\"\")\n              return nil\n            end\n          end\n        end   'OverWrt>0\n      end  'oThm<>0      \n      \n      '..Make sure .shp is the extension of the shpfile.\n      sThmType=lThmTypes.Get(iIndex)\n      if(sThmType.GetClassName=\"FTheme\")then\n        if(sFileName.Contains(\".Shp\").not)then\n          sFileName=sFileName+\".Shp\"\n        end  \n      else\n        sFileName=sFileName.AsTokens(\".\").Get(0)\n      end\n      lThms.Set(iIndex,sFileName)\n      dThms.Set(sTag,oThm)\n      lDefNames.Set(iInde
x,sFileName)\n    end  'for each i in nInThms..(lTags.Count-1)\n  end  '(nOutThms>0)\n  \n  if(bOK=true)then\n    dProps.Set(\"bOk\",bOK)\n    diaSelf.close\n  end\n\nend\n\nif(sRequest=\"CANCEL\")then\n  dProps.Set(\"bOK\",false)\n  diaSelf.Close\nend\n  \n'*****************************************************************************\n'  Handles the comboboxes cboBoxName = sTag, and cboBox's ObjectTag=PanelName+\"_\"+sTag\n'  Only CboBox and TxtBox contains sWorkPanelName in its objectTag.\n'  Other controls don't.\n'****************
*************************************************************\nif(sRequest.Contains(sWorkPanelName))then\n  oView=dProps.Get(\"oView\")\n  bFound=false\n  lTags=dProps.Get(\"lTags\")\n  lThms=dProps.Get(\"lThms\")\n  dThms=dProps.Get(\"dThms\")\n\n  sTag=ctlSELF.GetName\n  iIndex=lTags.FindByValue(sTag)        \n  if(iIndex>(-1))then  'sTagValue has to be found in the lTags.\n    sLastThmName=lThms.Get(iIndex)\n    '..For the Input Themes\n    if(ctlSELF.is(ComboBox))then\n      sThmName=ctlSELF.GetCurrentValue      \n      \n    
  if(sThmName<>sDefault)then\n        '..Chk duplicates\n        bFound=av.run(\"RAS.FRM.ChkThms\",{sThmName,lThms,iIndex})\n        if(bFound)then\n          msgbox.info(sThmName++sThmNameDup,sTitle)\n          ctlSELF.FindByValue(sLastThmName)\n          ctlSELF.SelectCurrent\n          return nil\n        end\n        \n        oThm=oView.FindTheme(sThmName)\n        dTag=oThm.GetObjectTag\n        bSetOK=true\n        if(dTag.is(Dictionary))then\n          sName=dTag.Get(\"sName\")\n          if(sName<>sTag)then\n         
   bChk=Msgbox.YesNo(oThm.GetName++sUsedAsMsg++sName+nl++sOverWrtMsg++sTag+\"?\"+nl+Script.The.GetName,\n              sTitle,true)\n            if(bChk.Not)then\n              bSetOk=false\n              ctlSELF.SetCurrentValue(sLastThmName)\n              ctlSELF.SelectCurrent\n            else\n              dThms.Set(sTag,oThm)\n            end  \n          end\n        else\n          dThms.Set(sTag,oThm)\n        end\n        if(bSetOK)then\n          lThms.Set(iIndex,ctlSELF.GetCurrentValue)\n        else\n          l
Thms.Set(iIndex,sLastThmName)\n        end\n      end\n    else  'TextBox for the Output Themes\n      '..Chk to see if the Thm Exist, if it does, chk the value of lOverWrts\n      '..if lOverWrts(i)=1 or 2 for Gtheme or lOverWrts(i)=1 for FTheme, Prompt\n      '..a message for a new name.\n      sThmName=ctlSELF.GetText\n      \n      '..Chk duplicates\n      bFound=av.run(\"RAS.FRM.ChkThms\",{sThmName,lThms,iIndex})\n      if(bFound)then\n        msgbox.info(sThmName++sThmNameDup,sTitle)\n        ctlSELF.SetText(sLastTh
mName)\n        return nil\n      end\n      \n      sName=sThmName.AsFileName.GetBaseName\n      oThm=oView.FindTheme(sName)\n      if(oThm=nil)then\n        oThm=oView.FindTheme(sName+\".Shp\")\n      end\n      '..if oThm=nil, we need to do nothing. else, a lot of work.\n      if(oThm<>nil)then\n        lOverWrts=dProps.Get(\"lOverWrts\")\n        lThmTypes=dProps.Get(\"lThmTypes\")\n        lShpTypes=dProps.Get(\"lShpTypes\")\n        \n        sTag=ctlSELF.GetName\n        iIndex=lTags.FindByValue(sTag)\n        \n        ThmTy
pe=lThmTypes.Get(iIndex)\n        ShpType=lShpTypes.Get(iIndex)\n        \n        '..Chk if the theme's type or shp type is not the same as the specified theme,\n        '..Notify the name conflict and ask user to enter a new name.\n        bChk=av.run(\"RAS.FRM.VerifyThmType\",{oThm,ThmType,ShpType})\n        if(bChk=false)then\n          Msgbox.Info(sName++sUsedMsg++oThm.GetClass.GetClassName+nl\n            ++sInstMsg,sTitle)\n          'ctlSELF.SetText(\"\")\n          Return nil       \n        end      \n        \n  
      '..If it reached here, oThm is of the same ThmType and ShpType requested\n        dTag=oThm.GetObjectTag\n        if(dTag.Is(Dictionary))then\n          sName=dTag.Get(\"sName\")\n          if(sName<>sTag)then\n            bChk=MsgBox.YesNo(oThm.GetName++sUsedAsMsg++sName+nl+sOverWrtMsg++sTag+\"?\",\n                 sTitle,false)\n            if(bChk=false)then\n              return nil\n            end\n          end\n        end\n        \n        iOverWrite=lOverWrts.Get(iIndex)\n        \n        if(iOverWrite>0)th
en\n          if(oThm.Is(GTheme))then\n            msgbox.info(oThm.GetName++sUsedMsg++oThm.GetClass.GetClassName+nl+nl+sInstMsg,\n              sTitle)\n          'ctlSELF.SetText(\"\")          \n            return nil\n          end\n          if(oThm.Is(FTheme))then\n            if(iOverWrite=1)then\n              msgbox.info(oThm.GetName++sUsedMsg++oThm.GetClass.GetClassName+nl+nl+sInstMsg,\n                sTitle)\n              'ctlSELF.SetText(\"\")\n              return nil\n            end\n          end\n        en
d   'OverWrt>0\n      end  'oThm<>0\n      lThms.Set(iIndex,ctlSELF.GetText)\n      \n    end  'ctlSELF.is(ComboBox)  \n  end\nend \n\n\n'' 4.  c:\\avefiles\\cedfiles\\CED_diaThms of 163 lines,\n\n"
)

(Script.199
	Name:	"RAS.FRM.GetdFields"
	SourceCode:	"' Name: RAS.FRM.GetdFields\n' ***************************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:  RAS.FRM.GetdFields \n' Self/USAGE: {TheView,ThmAct,ThmType,ShpType}\n\n' Returns: list of themes of the type specified.\n' Description: GetdFields by its Tags.\n' Requires:\n' History: zye 12/19/98\n'        
  DDJ 12/98    - definition of additional dictionaries for watershed\n'                         and river themes.\n' ***************************************************************************\n'..TagSummary: List of all the sName tags used in this project.\n'..All tags appeared here should be UNIQUE and should not exist in RAS.FRM.GetFields1\n' For Themes:\n' sName (Tag)         Desc\n'	ProjPnts             Holds new project's definition points.\n' POURWSH             Holds point delineation results\n' POURPNT     
        Holds points for point delineation.\n' PreMergedWatershed  Premerged watershed polygon\n' RiverMg             Merged River Line (MgRiver1Ln)\n' River               River line Ftheme, After RiverMg is created, River Thm will\n'                     be dropped and MergedRiverLine will tagged with River.\n' Watershed           Watershed polygons (FTheme)\n' WaterGrid           Watershed DEM (GTheme)\n' LinkGrid            LinkRiverGrid (GTheme)\n' StreamGrid          Stream Grid   (GTheme)\n' FlowAccGrid        
 FlowAcc Grid  (GTheme)\n' FlowDirGrid         FlowDir Grid  (GTheme)\n' FilledDEM           Filled Grid   (GTheme)\n\n' ***************************************************************************\nlTags=SELF.Get(0)\n'..Create the Field descriptions of the required fields.\n\n' The last digit indicates whether the field has to be existent or not.\n' If that value is 0, then the field does not have to be already present in the\n' table - it will be created.  If the value is 1, then the field needs to be \n' present in 
the table - if it is not, the code will return an error message and \n' the operation will stop with execution.\n\nWaterDict=Dictionary.Make(3)\n  WaterDict.Add(\"Grid_Code\",\"#FIELD_DECIMAL,10,0,1\")\n  WaterDict.Add(\"Id\",\"#FIELD_DECIMAL,10,0,1\")\n  WaterDict.Add(\"PIsDone\",\"#FIELD_SHORT,4,0,0\")\n\nRiverDict=Dictionary.Make(10)\n  RiverDict.Add(\"ArcId\",\"#FIELD_DECIMAL,6,0,1\")\n  RiverDict.Add(\"Grid_Code\",\"#FIELD_DECIMAL,6,0,1\")\n  RiverDict.Add(\"From_Node\",\"#FIELD_DECIMAL,6,0,1\")\n  RiverDict.Add(\"To_Node\",\"#FIELD_DECIMAL
,6,0,1\")\n  RiverDict.Add(\"LIsDone\",\"#FIELD_SHORT,4,0,0\")\n  RiverDict.Add(\"IsHead\",\"#FIELD_SHORT,4,0,0\")\n  RiverDict.Add(\"IsOutlet\",\"#FIELD_SHORT,4,0,0\")\n  RiverDict.Add(\"IsDone\",\"#FIELD_SHORT,4,0,0\")\n  RiverDict.Add(\"IsJnct\",\"#FIELD_SHORT,4,0,0\")          ' modified by DDJ\n'  RiverDict.Add(\"IsJnct\",\"#FIELD_Decimal,12,1,0\")      ' original by ZYE\n  RiverDict.Add(\"Length\",\"#FIELD_DECIMAL,14,11,0\")\n'  RiverDict.Add(\"EditType\",\"#FIELD_SHORT,4,0\")  '0=original river, 1=Point-To-River,2=Extended.\n\nRiverMgDict=Dic
tionary.Make(10)\n  RiverMgDict.Add(\"ArcId\",\"#FIELD_DECIMAL,6,0,0\")\n  RiverMgDict.Add(\"Grid_Code\",\"#FIELD_DECIMAL,6,0,0\")\n  RiverMgDict.Add(\"From_Node\",\"#FIELD_DECIMAL,6,0,0\")\n  RiverMgDict.Add(\"To_Node\",\"#FIELD_DECIMAL,6,0,0\")\n  RiverMgDict.Add(\"LIsDone\",\"#FIELD_SHORT,4,0,0\")\n  RiverMgDict.Add(\"IsHead\",\"#FIELD_SHORT,4,0,0\")\n  RiverMgDict.Add(\"IsOutlet\",\"#FIELD_SHORT,4,0,0\")\n  RiverMgDict.Add(\"IsDone\",\"#FIELD_SHORT,4,0,0\")\n  RiverMgDict.Add(\"IsJnct\",\"#FIELD_SHORT,4,0,0\")          ' modified by DDJ\n  RiverMgD
ict.Add(\"Length\",\"#FIELD_DECIMAL,14,11,0\")\n'  RiverMgDict.Add(\"EditType\",\"#FIELD_SHORT,4,0\")  '0=original river, 1=Point-To-River,2=Extended.\n\n  \n\nWaterMgDict=Dictionary.Make(3)\n  WaterMgDict.Add(\"Grid_Code\",\"#FIELD_DECIMAL,10,0,0\")\n  WaterMgDict.Add(\"Id\",\"#FIELD_DECIMAL,10,0,0\")\n  WaterMgDict.Add(\"PIsDone\",\"#FIELD_SHORT,4,0,0\")\n\n\n'  FldDict.Add(\"PntId\",\"#FIELD_Short,4,0\")\n'  FldDict.Add(\"PntName\",\"#FIELD_CHAR,25,0\")\n'  FldDict.Add(\"OnRiver\",\"#FIELD_Short,4,0\")\n'  FldDict.Add(\"IsDone\",\"#FIELD_SHORT,4,0\")\n' 
 FldDict.Add(\"Percent\",\"#FIELD_DECIMAL,6,4\")\n'  FldDict.Add(\"Length\",\"#FIELD_DECIMAL,14,11\")\n'..Fields definition for PNT/WSH that used to store the \n'..Point and Watershed delineation result.\n\n'for point delineation.\nPOURPNTDict=Dictionary.Make(1)\n  POURPNTDict.Add(\"PntId\",\"#FIELD_Short,4,0\")\n  POURPNTDict.Add(\"PntName\",\"#FIELD_CHAR,25,0\")\n  POURPNTDict.Add(\"OnRiver\",\"#FIELD_Short,4,0\")\n  POURPNTDict.Add(\"IsDone\",\"#FIELD_SHORT,4,0\")\n  POURPNTDict.Add(\"Percent\",\"#FIELD_DECIMAL,6,4\")\n  POURPNTDict.Add(\"Lengt
h\",\"#FIELD_DECIMAL,14,11\")\n\nPOURWSHDict=Dictionary.Make(1)\n  POURWSHDict.Add(\"WshId\",\"#FIELD_Short,4,0\")\n  POURWSHDict.Add(\"WshName\",\"#FIELD_CHAR,25,0\")\n  POURWSHDict.Add(\"PntId\",\"#FIELD_Short,4,0\")\n  POURWSHDict.Add(\"Area\",\"#FIELD_DECIMAL,14,11\")\n  POURWSHDict.Add(\"Perimeter\",\"#FIELD_DECIMAL,14,11\")\n\n'..ProjPnts Fields definition\nProjPntsDict=Dictionary.Make(1)\n  ProjPntsDict.Add(\"PntID\",\"#FIELD_Short,4,0\")\n  ProjPntsDict.Add(\"PntTYPE\",\"#FIELD_SHORT,4,0\")  '0=OutLet,1=Inlet,2=MidPoint,3=InterPoint,4=StartP
oint\n  ProjPntsDict.Add(\"PntNAME\",\"#FIELD_CHAR,25,0\")  'Appears on the legend.,\"POURPOINT\",\"INLETPOINT\",\"MIDPOINT\",\"INTERPOINT\",\"STARTPOINT\"       \n  ProjPntsDict.Add(\"PntDesc\",\"#FIELD_CHAR,25,0\")  'User entered desc.\n  ProjPntsDict.Add(\"Interact\",\"#FIELD_SHORT,4,0\")\n  ProjPntsDict.Add(\"SnapOn\",\"#FIELD_SHORT,4,0\")\n  ProjPntsDict.Add(\"ProjName\",\"#FIELD_CHAR,10,0\") \n  ProjPntsDict.Add(\"ProjDone\",\"#FIELD_SHORT,4,0\") 'indicates if the defined by the point has been transfered.\n  \n'..ProjArea Fields Definition\nPr
ojAreaDict=Dictionary.Make(1)\n  ProjAreaDict.Add(\"sWorkDir\",\"#FIELD_CHAR,10,0\")\n  ProjAreaDict.Add(\"Area\"    ,\"#FIELD_DECIMAL,14,11\")\n  ProjAreaDict.Add(\"Perimeter\",\"#FIELD_DECIMAL,14,11\")\n  ProjAreaDict.Add(\"Description\",\"#FIELD_CHAR,50,0\")\n\ndFTabFields=Dictionary.Make(1)\n\ndFtabFields.Add(\"WaterShed\",WaterDict)\ndFtabFields.Add(\"River\",RiverDict)\ndFtabFields.Add(\"RiverMg\",RiverMgDict)\ndFtabFields.Add(\"PreMergedWatershed\",WaterMgDict)\ndFtabFields.Add(\"POURPNT\",POURPNTDict)\ndFtabFields.Add(\"POURWSH\",POURWSHDi
ct)\ndFtabFields.Add(\"ProjPnts\",ProjPntsDict)\ndFtabFields.Add(\"ProjArea\",ProjAreaDict)\ndFtabFields.Add(\"VIPoints\",ProjPntsDict)\n\n\ndFieldsReturn=Dictionary.Make(1)\n\nfor each sTag in lTags\n  dFieldsReturn.Add(sTag,dFtabFields.Get(sTag))\nend\n\nreturn dFieldsReturn \n\n\n"
)

(Script.200
	Name:	"RAS.FRM.GetdFields1"
	SourceCode:	"' Name: RAS.FRM.GetdFields1\n' ***************************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:  RAS.FRM.GetdFields1\n' Self/USAGE: {TheView,ThmAct,ThmType,ShpType}\n\n' Returns: list of themes of the type specified.\n' Description: GetdFields by its Tags.\n'              !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n'              !    These fields are to be used when all the watershed     !\n'              !    and river themes have already been defined.  That is   !\n'              !    why all the items need to be present (last number      !\n'              !    is 1).                                                 !\n'              !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n' Requires:\n' History: zye 12/19/98\n'          DDJ 12/98    - definition of additional diction
aries for watershed\n'                         and river themes.\n'          Zye again, 2/2/99  for the thms created by the Grid2Ftab functions.\n' ***************************************************************************\nlTags=SELF.Get(0)\n' ***************************************************************************\n'..the following section are created to handle the fields defined for the \n'  FTABs that are created by the Grid2Ftab functions such as:\n'  StreamToPolyLineFTab, and AsPolygonFtab. and other oFta
bs whose dFields\n'  if handled by RAS.FRM.GetdFields will produced a problem in RAS.FRM.DiaThms\n'  and RAS.FRM.GetThmsByTagR (because in the program dField has to be nil for\n'  the Ftabs to be created by the Grid2Ftab functions.  Zye\n' ***************************************************************************\n'..All tags appeared here should be UNIQUE and should not exist in RAS.FRM.GetFields1\nsRivTag=\"RiverLink\"\nsWshTag=\"SubBasin\"\n\ndWshFields=Dictionary.Make(1)\n  dWshFields.Add(\"Area\",\"#FIELD_DECIMAL,11,1
0\")\n  dWshFields.Add(\"Perimeter\",\"#FIELD_DECIMAL,11,10\")\n  dWshFields.Add(\"TopoDone\",\"#FIELD_SHORT,4,0\")   '1=TopoCharsExtractionDone,0=NotDone\n\ndStrFields=Dictionary.Make(1)\n  dStrFields.Add(\"Length\",\"#FIELD_LONG,10,0\")\n  dStrFields.Add(\"EditType\",\"#FIELD_SHORT,4,0\")  '0=original river, 1=Point-To-River,2=Extended.\n\ndFTabFields=Dictionary.Make(1)\n  dFTabFields.Add(sRivTag,dStrFields)\n  dFtabFields.Add(sWshTag,dWshFields)\n\n\n'dFtabFields.Add(\"WaterShed\",WaterDict)\n'dFtabFields.Add(\"RiverMg\",RiverMgDict)\n'dFt
abFields.Add(\"PreMergedWatershed\",WaterMgDict)\n\n\ndFieldsReturn=Dictionary.Make(1)\n\n\nfor each sTag in lTags\n  dFieldsReturn.Add(sTag,dFtabFields.Get(sTag))\nend\n\n\nreturn dFieldsReturn \n\n\n"
)

(Script.201
	Name:	"RAS.FRM.GetThms"
	SourceCode:	"' Name: RAS.FRM.GetThms\n' ***************************************************************************\n'              (c) Copyright, 1997\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:  RAS.FRM.GetThms Active or All.\n' Self/USAGE: {TheView,ThmAct,ThmType,ShpType}\n'  ThmAct=True, for active thms, False, all thms.\n'  ThmType=[FTheme,GTheme,DbTheme]\n'  ShpType=[Polygon,POLYLine,Point,Mpoint
]\n' Returns: list of themes of the type specified.\n' Description: Get Thms of specified type.  \n' Requires:\n' History: hydro.GetThms, 4/1/97, 1/13/98\n' ***************************************************************************\nTheView=SELF.Get(0)\nThmAct=SELF.Get(1)  'ActiveOnly (true)/All (false), Boolean.\nThmType=SELF.Get(2) 'GTheme,FTheme or others.\nInfoTitle=\"Get Themes\"\nsScriptName=nl+Script.The.GetName\n\nIsFThm=False\nThmTypeName=ThmType.GetClassName\nif(ThmTypeName=\"FTheme\")then\n  ShpType=SELF.Get(3)  \n
  IsFThm=True\n'  if(ShpType=\"POLYGON\")then\n'    ShpTypeEnum=\"#FIELD_SHAPEPOLY\".AsEnum\n'  elseif(ShpType=\"POLYLINE\")then\n'    ShpTypeEnum=\"#FIELD_SHAPELINE\".AsEnum\n'  elseif(ShpType=\"POINT\")then\n'    ShptypeEnum=\"#FIELD_SHAPEPOINT\".AsEnum \n'  elseif(ShpType=\"MPOINT\")then\n'    ShpTypeEnum=\"#FIELD_SHAPEMULTIPOINT\".AsEnum \n'  else    \n'    msgbox.info(\"Use POLY,LINE,POINT or MPOINT as 3rd argument\"+sScriptName,InfoTitle)\n'    return nil    \n'  end  \nend\nif(ThmAct)then\n  TheThms=TheView.GetActiveThemes\nelse \n  T
heThms=TheView.GetThemes\nend  \nif(theThms.Count=0)then\n  msgbox.info(\"No active themes found in the view:\"++TheView.GetName,InfoTitle)\n  Exit\nend\nThmList=List.Make\nfor each Thm in TheThms\n  if(Thm.Is(ThmType))then\n    if(IsFthm)then  'for an FTheme, further chk its shape type\n      'FType=Thm.GetFtab.FindField(\"Shape\").GetType\n      FType=Thm.GetFtab.GetShapeClass.GetClassName\n      if(FType.UCASE=ShpType.UCASE)then\n        ThmList.Add(Thm)\n      end      \n    else\n      ThmList.Add(Thm)\n    end  \n  end\nend
 \nif(ThmList.Count=0)then\n  if(ThmAct)then\n    msgbox.info(\"No Active\"++ThmTypeName++\"theme is found in the view:\"++TheView.GetName,InfoTitle)\n  else\n    if(ThmTypeName=\"FTheme\")then\n      msgbox.info(\"No\"++ShpType++ThmTypeName++\"is found in the view:\"++TheView.GetName,InfoTitle)\n    else\n      msgbox.info(\"No\"++ThmTypeName++\"is found in the view:\"++TheView.GetName,InfoTitle)      \n    end\n  end\n  return nil\nelse\n  return ThmList  'Normal return\nend\n \n\n"
)

(Script.202
	Name:	"RAS.FRM.GetThmsByTag"
	SourceCode:	"' Name: RAS.FRM.GetThmsByTag\n' ***************************************************************************\n'              (c) Copyright, 1997\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name: RAS.FRM.GetThmsByTag \n' USAGE: av.run(\"RAS.FRM.GetThmsByTag\",{oView,lTags,lThmTypes,lShpTypes})->dThms\n'   lTags     = List of tags identifying the themes {River,Watershed,FlowDir}\n'   lThmTypes = Lis
t of theme types {FTheme,FTheme,GTheme}\n'   lShpTypes = List of shape types {Line,Polygon,nil}\n' Returns: dThms keyed on lTags.\n' Description:  \n' CalledBy:\n' Requires: RAS.FRM.ThmTagMgr.\n' History: zye 98-12-2\n' ***************************************************************************\noView    =SELF.Get(0)\nlTags    =SELF.Get(1)\nlThmTypes=SELF.Get(2)\nlShpTypes=SELF.Get(3)\n\nnTags=lTags.Count\n\ndThms=Dictionary.Make(1)\nbAllFound=true\nfor each i in 0..(nTags-1)\n  sTag=lTags.Get(i)\n  sThmType=lThmTypes.Get(i)\n
  sShpType=lShpTypes.Get(i)\n  lThms=av.run(\"RAS.FRM.ThmTagMgr\",{\"Get\",oView,sTag})\n  if(lThms.is(List))then\n    if(lThms.Count>1)then\n      oThm=msgbox.ChoiceAsString(lThms,lThms.Count.AsString++\"themes are tagged with\"++sTag+nl+Script.the.GetName,\"Select one\")\n    else\n      if(lThms.Count>0)then\n        oThm=lThms.Get(0)        \n      else\n        oThm=nil\n      end\n    end\n  else\n    oTag=nil\n    bAllFound=false\n  end\n  dThms.Add(sTag,oThm)\n  \nend \n\n'..Create the dialog.\n\nreturn (dThms)\n"
)

(Script.203
	Name:	"RAS.FRM.GetThmsByTagR"
	SourceCode:	"' Name: RAS.FRM.GetThmsByTagR\n' ***************************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name: RAS.FRM.GetThmsByTagR  \n' USAGE: av.run(\"RAS.FRM.GetThmsByTagR\",{oView,lTags,lThmTypes,lShpTypes,dFields,\n'        lDefaultNames,sTitle,bVerify})\n'  oView     -View Handle\n'  lTags     -list of tags 
(a tag indicates the id of a theme to the program\n'  lThmTypes -list of thmTypes (GTheme,FTheme,DBTheme etc.), use class name\n'  lShpTypes -list of shpTypes, for Ftheme, \n'             ShpType=[\"Poly\",\"Line\",\"Point\",\"Mpoint\"], for others, blank quote \"\".\n'  ldFields  -list dFields, one dFields for each FThemeType, for others, nil\n'    ..dFields-dict of flds, key=Name,value=string defines the field, \n'              e.g.,\"#FIELD_SHORT,4,0\"\n'  lDefNames -Default file names.\n'  lPurposes -Purpose the thm will b
e served (\"I\"=Input,\"O\"=Output)\n'  lOverWrts -Specify the action of the program in case the Thm specified exists.\n'\n'    lDefault,lThmTypes,lTags,lShpTypes,ldFields,lPurposes, and lOverWrts all have\n'     the same number of elements.\n\n'  sTitle    -Title to be used by the msgboxes.\n'  bVerify   -true=bring up the theme dialog, false=bring up the dialog only when\n'             a least one theme did not exist or did not passed the verification.\n' Returns: dThms/nil \n' Description: chk to ensure all the themes
 for a program exist. \n' CalledBy:\n' Requires: RAS.FRM.GetThmsByTag\n'           RAS.FRM.DiaThms\n'           RAS.FRM.MakeShpFile\n'           RAS.FRM.ThmTagMgr\n'           RAS.FRM.VFFields\n'           RAS.FRM.BackupShpFile\n' History: 12/98 zye\n' ***************************************************************************\nsScriptName=nl+\"from:\"+Script.The.GetName\noView    =SELF.Get(0)\nlTags    =SELF.Get(1)\nlThmTypes=SELF.Get(2)\nlShpTypes=SELF.Get(3)\nldFields =SELF.Get(4)\nlDefNames=SELF.Get(5)\nlPurposes=SELF.Get
(6)\nlOverWrts=SELF.Get(7)\nbVerify  =SELF.Get(8)\nif(SELF.Count>9)then\n  sTitle =SELF.Get(9)\nelse\n  sTitle =\"Setup Theme List\"\nend\n\n'..NULL will be added to the CboBox for iOthers=1\nif(SELF.Count>10)then\n  iOthers=SELF.Get(10)\nelse\n  iOthers=0\nend\n\nif(SELF.Count>11)then\n  sHelpTopic=SELF.Get(11)\nelse\n  sHelpTopic=\"DiaThmHELP\"\nend\n\n\nsDefault=\"DEFAULT\"\n\nlThms=List.Make\ndThms=av.run(\"RAS.FRM.GetThmsByTag\",{oView,lTags,lThmTypes,lShpTypes})\nbHasNil=false\nnInThms=0\nnOutThms=0\nfor each i in 0..(lTags.Count-1)\n  sTa
g=lTags.Get(i)\n  oThm=dThms.Get(sTag)\n  if(oThm.is(Theme))then\n    lThms.Add(oThm.GetName)\n  else\n    lThms.Add(nil)\n    bHasNil=true\n  end\n  \n  '..Counting nInThms and nOutThms .Added 12/31/98\n  sPurpose=lPurposes.Get(i)\n  if(sPurpose=\"I\")then\n    nInThms=nInThms+1\n  end\n  if(sPurpose=\"O\")then\n    if(oThm.Is(Theme))then\n      iOverWrite=lOverWrts.Get(i)\n      if(iOverWrite=1)then\n        bHasNil=True          'GTheme as output can't be overwritten, Activate the Dialog.\n      end\n    end\n    nOutThms=nOutTh
ms+1\n  end\nend\n\n'..Modified 12/31/98 so that when bVerify=false, it will process the datasets even though\n'..if will not have the dialog showed up when bHasNil=false.\nif((bHasNil=true) or (bVerify=true))then\n  diaThms=av.run(\"RAS.FRM.DiaThms\",{\"Make\",oView,dThms,lThms,lTags,lThmTypes,lShpTypes,lDefNames,lPurposes,lOverWrts,iOthers,sTitle,sHelpTopic})\n  if(diaThms.is(Dialog).Not)then\n    Return nil\n  end  \n  diaThms.Open\n  dProps=diaThms.GetObjectTag\n  bOk=dProps.Get(\"bOk\")\n  \n  if(bOK)then\n    '..Remove the
 tags that is not the same as the one listed in the lthms\n    '..to prevent the same tag been put on different themes.\n    lThms=dProps.Get(\"lThms\")\n    lTags=dProps.Get(\"lTags\")\n    dThms=dProps.Get(\"dThms\")\n    nInThms=dProps.Get(\"nInThms\")\n    nOutThms=dProps.Get(\"nOutThms\")\n    bHasNil=false\n  else\n    dThms=nil\n  end\nend\n\n'..Adding the logic bHasNil=false so that even when bVerify=false, this section will \n'..also be executed to verify the fields,thms etc.\nif((dThms.Is(Dictionary)) and (bHasNil=false))
then\n  '..Handles the input themes\n  if(nInThms>0)then\n    for each i in 0..(nInThms-1)\n      sTag=lTags.Get(i)\n      sThmName=lThms.Get(i)\n      if(sThmName<>sDefault)then\n        oThm=oView.FindTheme(sThmName)      \n      end\n      lTmpThms=av.run(\"RAS.FRM.ThmTagMgr\", {\"Get\",oView,sTag})\n      if(lTmpThms.Is(List))then\n        for each oTmpThm in lTmpThms\n          if(oTmpThm.GetName<>sThmName)then\n            aThm=oView.FindTheme(oTmpThm.GetName)\n            dThmTag=aThm.GetObjectTag\n            if(dThmT
ag.Is(Dictionary))then\n              dThmTag.Set(\"sName\",nil)\n            end\n          end\n        end\n      end\n\n      '..For sThmName<>sDefault, the theme exist, then just tag it.\n      '..Otherwise, create the theme and then tag it.\n      oThm=oView.FindTheme(sThmName)\n      '..oThm=nil is true only when sThmName=NULL\n      if(oThm<>nil)then\n        dTag=oThm.GetObjectTag\n        if(dTag.Is(Dictionary).Not)then\n          dTag=Dictionary.Make(1)\n        end\n        \n        '..Chk to see if a backup file
 is needed.\n        if(oThm.is(FTheme))then                    ' check if a feature theme (shape file)\n          iOverWrt=lOverWrts.Get(i)                ' get the overwrite indicator\n          if(iOverWrt=1)then                       ' see if we need a backup of it\n            chk=av.run(\"RAS.FRM.BackupShpFile\",{oThm,sTitle,False})     ' do a backup if needed\n          end\n        end\n        dTag.Set(\"sName\",sTag)\n        oThm.SetObjectTag(dTag.Clone) \n        dThms.Set(sTag,oThm) \n      end\n    end  'for
 each i in 0..(lTags.Count-1)\n  end  'if(nInThms>0)\n \n  '..Handles the output themes\n  if(nOutThms>0)then\n    for each i in nInThms..(lTags.Count-1) by 1\n      sTag=lTags.Get(i)\n      ThmType=lThmTypes.Get(i)\n      ShpType=lShpTypes.Get(i)\n      Purpose=lPurposes.Get(i)\n      OverWrt=lOverWrts.Get(i)\n      oThm=dThms.Get(sTag)\n      if(oThm<>nil)then\n        '..Remove the current the tag from other possible previously tagged themes.\n        sThmName=oThm.GetName\n        lTmpThms=av.run(\"RAS.FRM.ThmTagMgr\", 
{\"Get\",oView,sTag})\n        if(lTmpThms.Is(List))then\n          for each oTmpThm in lTmpThms\n            if(oTmpThm.GetName<>sThmName)then\n              aThm=oView.FindTheme(oTmpThm.GetName)\n              dThmTag=aThm.GetObjectTag\n              if(dThmTag.Is(Dictionary))then\n                dThmTag.Set(\"sName\",nil)\n              end\n            end\n          end\n        end\n        if(oThm.Is(GTheme))then\n          oView.DeleteTheme(oThm)\n        elseif(oThm.Is(FTheme))then\n          '..0=Clear,1=Enter a ne
w name (will never get to this point),2=append (do nothing)\n          if(OverWrt=0)then   \n            oFtab=oThm.GetFtab\n            av.run(\"RAS.FRM.RmvRecsAll\",{oFtab,false})\n          end\n        end\n        dTag=oThm.GetObjectTag\n        if(dTag.Is(Dictionary))then\n          dTag.Set(\"sName\",sTag)\n        else\n          dTag=Dictionary.Make(1)\n          dTag.Set(\"sName\",sTag)\n        end\n        oThm.SetObjectTag(dTag)\n      else  'Handles the situation when oThm=nil\n \n       '..Remove the dTag (with sN
ame=sTag) from other Themes, if exist.\n        lTmpThms=av.run(\"RAS.FRM.ThmTagMgr\", {\"Get\",oView,sTag})\n        dField=ldFields.Get(i) \n        if(lTmpThms.Is(List))then\n          for each oTmpThm in lTmpThms\n            aThm=oView.FindTheme(oTmpThm.GetName)\n            dThmTag=aThm.GetObjectTag\n            if(dThmTag.Is(Dictionary))then\n              dThmTag.Set(\"sName\",nil)\n            end\n          end\n        end\n        '..dField=nil indicates the FTheme can not be created at this time because\n        
'..Info for creating the FTheme maynot exist. e.g., FTheme be created by\n        '..StreamFtab, or MergeShape.\n        if((ThmType.GetClassName=\"GTheme\"))then\n          'do nothing\n        else\n          if(ThmType.GetClassName=\"FTheme\")then\n            sDef=lDefNames.Get(i)\n            if(dField=nil)then\n              '.info(sDef+\" tagged with \"+sTag+nl+\"has no Fields\"+sScriptName,sTitle)\n            else\n              oFtab=av.run(\"RAS.FRM.MakeShpFile\",{ShpType,sDef,av.GetProject.GetWorkDir})\n            
  oThm=FTheme.Make(oFtab)\n              oThm.SetName(sDef)\n              dTag=Dictionary.Make(1)\n              dTag.Set(\"sName\",sTag)\n              oThm.SetObjectTag(dTag.Clone)\n              oView.AddTheme(oThm)\n              dThms.Set(sTag,oThm)\n            end  \n          end  \n        end      \n      end  'oThm<>nil\n    end\n  end  '(nOutThms>0)  \nend\n\n'..Verify the fields.\nif(dThms.is(Dictionary))then\n  for each i in 0..(lTags.Count-1)\n    sTag=lTags.Get(i)\n    oThm=dThms.Get(sTag)\n    if(oThm.Is(Ftheme
))then\n      oFtab=oThm.GetFtab\n      dFields=ldFields.Get(i)\n      bChk=av.run(\"RAS.FRM.VerifyFields\",{oFtab,dFields,False})\n    else\n      'do nothing\n      'Because only Ftheme has fields to be verified.\n    end   \n  end\nend\n\nreturn dThms\n\n\n\n\n\n"
)

(Script.204
	Name:	"RAS.FRM.GetThmsByTagRun"
	SourceCode:	"' Name: RAS.FRM.GetThmsByTagRun\n' ***************************************************************************\n'              (c) Copyright, 1997\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name: RAS.FRM.GetThmsByTagRun \n' USAGE: \n' Returns:\n' Description: Test the RAS.FRM.GetThmsByTagR program. \n'  This program can serve as an example of using the GetThmsByTagR. \n'  All the lists have the 
same length,\n'  Input Elements are in the first part of the list and Output Elements \n'  on the second parts of the list.\n' CalledBy:\n' Requires: RAS.FRM.GetThmsByTagR\n' History: Zye 98/12/15\n' ***************************************************************************\nTheProject=av.GetProject\nRdir=TheProject.GetFileName.ReturnDir.AsString\nWkDir=FN.Merge(Rdir,\"Tmp\")\n\n'..Get the ViewHandle\noView=av.GetProject.FindDoc(\"View1\")     'ViewHandle\n\n'..Provide the lists of Tags, ThmTypes, and ShpTypes\nlTags={\"GAAA\"
,\"GBBB\",\"AAA\",\"BBB\",\"CCC\"}                'Tags\nlThmTypes={GTheme,GTheme,FTheme,FTheme,FTheme}         'ThmTypes\nlShpTypes={\"GRID\",\"GRID\",\"Polygon\",\"Point\",\"PolyLine\"}        'ShpTypes POLYGON,POLYLINE,POINT,MultiPoint.\n\n\n''..Create the Field descriptions of the required fields.\n'PlyDict=Dictionary.Make(1)\n'  PlyDict.Add(\"PolyId\",\"#FIELD_SHORT,4,0,0\")\n'  PlyDict.Add(\"PolyName\",\"#FIELD_CHAR,25,0,0\")\n'  PlyDict.Add(\"WshName\",\"#FIELD_CHAR,25,0,0\")\n'  PlyDict.Add(\"IsDone\",\"#FIELD_SHORT,4,0,0\")\n'\n'PntDict=Dictio
nary.Make(1)\n'  PntDict.Add(\"PntId\",\"#FIELD_Short,4,0\")\n'  PntDict.Add(\"PntName\",\"#FIELD_CHAR,25,0\")\n'  PntDict.Add(\"OnRiver\",\"#FIELD_Short,4,0\")\n'  PntDict.Add(\"IsDone\",\"#FIELD_SHORT,4,0\")\n'  PntDict.Add(\"Percent\",\"#FIELD_DECIMAL,6,4\")\n'  PntDict.Add(\"Length\",\"#FIELD_DECIMAL,14,11\")\n'\n'LineDict=Dictionary.Make(1)\n'  LineDict.Add(\"ArcId\",\"#FIELD_LONG,8,0\")\n'  LineDict.Add(\"ArcName\",\"#FIELD_CHAR,25,0\")\n'  LineDict.Add(\"WshName\",\"#FIELD_CHAR,25,0\")\n'  LineDict.Add(\"OnRiver\",\"#FIELD_SHORT,4,0\")\n'  LineDict.Add
(\"IsDone\",\"#FIELD_SHORT,4,0\")\n'  LineDict.Add(\"Length\",\"#FIELD_DECIMAL,14,11\")\n\n\n'ldFields={nil,nil,PlyDict,PntDict,LineDict}\ndFields=av.run(\"RAS.FRM.GetdFields\",{lTags})\nldFields=List.Make\nfor each sTag in lTags\n  ldFields.Add(dFields.Get(sTag))  \nend\n\n\nlDefNames={\"GRD\",\"GRD1\",\"PlyTest\",\"PntTest\",\"LineTest\"}\n\nlPurposes={\"I\",\"I\",\"I\",\"O\",\"O\"}\n'..Incase the thm specified exists in the view, lOverWrt guides the operation.\nlOverWrts={0,0,2,2,2}    'For GTheme, 0=OverWrite,1,2=Prompt for a new name because overw
rite is not an option.\n                         'For FTheme, 0=Clear, 1=Ask For a new Name, 2=Append.\n\nfor each i in 0..(lDefNames.Count-1)\n  sName=lDefNames.Get(i)\n  sFileName=FN.Merge(WkDir.AsString,sName).AsString\n  lDefNames.Set(i,sFileName)\nend\n'msgbox.choiceAsString(lDefNames,\"\",\"\")\n\nsTitle=\"Required themes verification\"\nbVerify=true\n\ndThms=av.run(\"RAS.FRM.GetThmsByTagR\",{oView,lTags,lThmTypes,lShpTypes,ldFields,lDefNames,lPurposes,lOverWrts,bVerify,sTitle})\nsLongStr=\"\"\nif(dThms.is(Dictionary))then\n  
for each i in 0..(lTags.Count-1)\n    sTag=lTags.Get(i)\n    oThm=dThms.Get(sTag)\n    if(oThm<>nil)then\n      dTag=oThm.GetObjectTag\n      sLongStr=sLongStr+sTag+nl+oThm.GetName++oThm.GetClass.GetClassName+nl+dTag.Get(\"sName\")++dTag.GetClass.GetClassName+nl+nl\n      if(oThm.is(Ftheme))then\n        oFtab=oThm.GetFtab\n        for each fld in oFtab.GetFields\n          sLongStr=sLongStr+Tab+Tab+fld.GetName+\", \"+fld.GetType.asString+\", \"+fld.GetWidth.AsString+\", \"+fld.GetPrecision.AsString+nl\n        end\n      end
\n    else\n      sLongStr=sLongStr+sTag+\", \"+oThm.GetClass.GetClassName+nl\n    end      \n  end\n  msgbox.Report(sLongStr,lTags.Count.AsString)\nend\n\n\n"
)

(Script.205
	Name:	"RAS.FRM.GetUniqueID"
	SourceCode:	"' Name: RAS.FRM.GetUniqueID\n' ***************************************************************************\n'              (c) Copyright, 1997\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name: RAS.FRM.GetUniqueID \n' USAGE: av.run(\"RAS.FRM.GetUniqueID\",{Vtab,Fld})\n' Returns: UniqNumber.\n' Description: Create a uniq number based on a give field.\n' Requires: \n' History: GetUniqId.JPL 7/20/98 Zy
e\n'          RAS.FRM.GetUniqID\n' ***************************************************************************\nTheVtab=SELF.Get(0)\nTheFld=SELf.Get(1)\nnUniq=0\nfor each rec in TheVtab\n  TheV=TheVtab.ReturnValue(TheFld,rec)\n  if(TheV>nUniq)then\n    nUniq=TheV.clone\n  end  \nend\nreturn (nUniq+1)\n\n"
)

(Script.206
	Name:	"RAS.FRM.GrfAddLinePoint"
	SourceCode:	"' Name: RAS.FRM.GrfAddLinePoint\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name: RAS.FRM.GrfAddLinePoint\n' Usage: av.run(\"RAS.FRM.GrfAddLinePoint\",{oView,pnt,Color.GetRed,2})\n' Returns: GShpV\n' Description: Add a Grf line to TheView  \n' Requires:\n' History: RAS.FRM.GrfAddLinePo
int, 3/30/97\n'          HMS.DLN.GrfAddLinePoint, 2/18/99  \n' ***************************************************************************\nTheView=SELF.Get(0)\nTheShapeV=SELF.Get(1)\nTheColor=SELF.Get(2)\nTheSize=SELF.Get(3)\n\nGShpV=GraphicShape.Make(TheShapeV)\nAsym=GShpV.GetSymbol\nAsym.SetSize(TheSize)\nAsym.SetColor(TheColor)\nTheView.GetGraphics.Add(GShpV)\nReturn GShpV  \n"
)

(Script.207
	Name:	"RAS.FRM.GrfAddPoly"
	SourceCode:	"' Name: RAS.FRM.GrfAddPoly\n'*****************************************\n' Name: RAS.FRM.GrfAddPoly\n' Self: {View,ShapeV,PolySymBol}\n' Returns: GPolyShpV\n' Description: Adding a polygon Grf to theView\n' Requires:\n' History: 3/31/97\n'*****************************************\nTheView=SELF.Get(0)\nTheShapeV=SELF.Get(1)\nTheSmybol=SELF.Get(2)\nGshpV=GraphicShape.Make(TheShapeV)\nGshpV.SetSymbol(TheSmybol)\nTheView.GetGraphics.add(GshpV)\n'..These two lines are moved to the calling program.\n'TheView.GetDisplay.Invalidate
(true)\n'TheView.GetDisplay.Flush\nReturn GShpV\n"
)

(Script.208
	Name:	"RAS.FRM.GrfRemove"
	SourceCode:	"' Name: RAS.FRM.GrfRemove\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name: RAS.FRM.GrfRemove \n' USAGE: av.run(\"RAS.FRM.GrfRemove\",{oView,GCnt})\n'  GCnt=the min Index of the graphics to be removed \n' Returns:\n' Description:  Remove the graphics whose index in the graphics is >= 
GCnt.\n' CalledBy:\n' Requires:\n' History: 3/15/99 (RAS.FRM.GrfRemove 3/30/97.)\n' ***************************************************************************\nTheView=SELF.Get(0)\nGCnt=SELF.Get(1)\nMGlist=TheView.GetGraphics\nGFcnt=MGlist.count-1\nif(GFcnt>=Gcnt)then\n  for each g in Gcnt..GFcnt\n    MGList.Get(g).SetSelected(True)\n  end\n  MGlist.ClearSelected\nend\n"
)

(Script.209
	Name:	"RAS.FRM.GridExtByShp"
	SourceCode:	"' Name: RAS.FRM.GridExtByShp\n'***************************************************************************\n'              (c) Copyright, 1997\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name: RAS.FRM.GridExtByShp \n' USAGE: av.run(\"RAS.FRM.GridExtByShp\",{oView,oShpV,oGThmOrg})->oGrid.\n' Returns:  GridExtracted.\n' Description: Extract Grid by Shp.\n' CalledBy: HMS.PRO.NewProjectSet\n' Requires:
 \n' History: 2/6/99 \n'***************************************************************************\noView=SELF.Get(0)\noShpV=SELF.Get(1)\noGThm=SELF.Get(2)\n\nSouceGrid=oGThm.GetGrid\n\n'--set the extent before extracting\nae = oView.GetExtension(AnalysisEnvironment)\nae.SetExtent(#ANALYSISENV_VALUE,oShpv.ReturnExtent)\nae.Activate\n\nCutGrid=SouceGrid.ExtractByPolygon(oShpV,prj.makeNull,False)\nCutFN=av.GetProject.GetWorkDir.MakeTmp(oGThm.GetName,\"\")\nCutGrid.ReName(CutFN)\n\nReturn CutGrid\n\n\n"
)

(Script.210
	Name:	"RAS.FRM.MakeShpFile"
	SourceCode:	"' Name: RAS.FRM.MakeShpFile\n' ***************************************************************************\n'              (c) Copyright, 1997\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name: RAS.FRM.MakeShpFile\n' USAGE: av.run(\"RAS.FRM.MakeShpFile\",{sShpType,ShpFileName,sDir})\n'   sShpType    =\"Polygon\",\"Point\",Line\" etc.\n'   sShpFileName=File Name.\n'   sDir        =Default directory. Opti
onal.\n'   when sDir does not exit, sDir will be created by the program.\n'\n' Returns: Ftab\n' Description: Make a shape file. \n' CalledBy: \n' Requires: RAS.FRM.SetWorkDir.\n' History: zye 12/15/98\n' ***************************************************************************\nsShpType    =SELF.Get(0)\nsShpFileName=SELF.Get(1)\nif(SELF.Count=3)then\n  bHasDir=True\n  sDir=SELF.Get(2).AsString\nelse  \n  bHasDir=False\nend\nif((sShpType.UCase=\"POINT\") or (sShpType=\"Pnt\"))then\n  ShpType=POINT\nelseif((sShpType=\"POLY\") or (s
ShpType=\"POLYGON\"))then\n  ShpType=POLYGON\nelseif((sShpType=\"LINE\") or (sShpType=\"POLYLINE\"))then\n  ShpType=POLYLINE\nelseif((sShpType=\"MultiPoint\") or (sShpType.UCase=\"MPOINT\"))then\n  ShpType=MultiPoint\nend      \nif(bHasDir)then\n  if(sDir.AsString.AsFileName.IsDir.Not)then\n    sDir=av.run(\"RAS.FRM.SetWorkDir\",{sDir.AsString.AsFileName.GetBaseName})\n    '..This msgbox is necessary to buy the time for the newly created Dir so that\n    '..the following Ftab can be created.  Can't delete this line. Zye\n    msgbo
x.info(sDir.AsString++\"is created.\",Script.The.GetName)\n  else\n    sDir=av.run(\"RAS.FRM.SetWorkDir\",{sDir.AsString.AsFileName.GetBaseName})  \n  end\n  oFileName=FN.Merge(sDir,sShpFileName.AsFileName.GetBaseName)\nelse\n  oFileName=sShpFileName.AsFileName\nend\n\noFtab=Ftab.MakeNew(oFileName.GetFullName.asFileName,ShpType)\n\nreturn oFtab\n\n"
)

(Script.211
	Name:	"RAS.FRM.MakeTopo"
	SourceCode:	"' Name: RAS.FRM.MakeTopo\n' ***************************************************************************\n'              (c) Copyright, 1997\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' FileName: RAS.FRM.MakeTopo\n' Name: RAS.FRM.MakeTopo\n' USAGE: \n' Returns: nil\n' Description: Construct topology of a line theme.  \n' Requires: \n' History: MakeTopo.tnc, 1/23/98\n' ********************************
*******************************************\nsMsg=\"Build Topology\" \noView=av.GetActiveDoc\nLineThms=av.run(\"RAS.FRM.GetThms\",{oView,false,FTheme,\"POLYLINE\"})\nif(LineThms.is(List).not)then\n  Exit\nelseif(LineThms.Count=0)then\n  Msgbox.Info(\"No river line themes exist in View:\"++oView.GetName,sMsg)\n  Exit\nend\nLineThm=Msgbox.ChoiceAsString(LineThms,\"Select a theme to build topology.\",sMsg)\nif(LineThm=nil)then\n  Exit\nend\nLineFtab=LineThm.GetFtab\nFNodeFld=LineFtab.FindField(\"From_Node\")\nTNodeFld=LineFtab.FindField(
\"To_Node\")\nif(FNodeFld=nil)then\n  FNodeFld=LineFtab.FindField(\"From-Node\")\n  TNodeFld=LineFtab.FindField(\"To-Node\")\nend\nif(FNodeFld=nil)then\n  dFields=Dictionary.Make(2)\n  dFields.Add(\"FNode_\",\"#FIELD_LONG,8,0\")\n  dFields.Add(\"TNode_\",\"#FIELD_LONG,8,0\")\n  bFldOk=av.run(\"RAS.FRM.VerifyFields\",{LineFtab,dFields,True})\n  FNodeFld=LineFtab.FindField(\"FNode_\")\n  TNodeFld=LineFtab.FindField(\"TNode_\")\nend\nShpFld=LineFtab.FindField(\"Shape\")\nLineFtab.SetEditable(true)\nNodeList=List.Make\nnFNode=nil\nnTNode=nil\nnCurren
t=0\nav.ShowStopButton\nnLines=LineFtab.GetNumRecords\nfor each rec in LineFtab\n  av.ShowMsg(sMsg++\"for\"++LineThm.GetName++\". FNode/TNode/TotalNode\"++nFnode.AsString+\"/\"+nTnode.AsString+\"/\"+nCurrent.AsString)\n  bStop=av.setStatus(rec/nLines*100).not\n  if(bStop)then\n    LineFtab.SetEditable(false)\n    exit\n  end\n  \n  ShpV=LineFtab.ReturnValue(ShpFld,rec)\n  lPnts=ShpV.AsMultiPoint.AsList\n  nPnts=lPnts.Count\n  if(nPnts<2)then\n    continue\n  end\n  oPnt0=lPnts.Get(0)\n  oPntn=lPnts.Get(nPnts-1)\n  nCurrent=NodeList.C
ount\n  \n  if(NodeList.IsEmpty)then\n    NodeList.Add(oPnt0.Clone)\n    nFNode=1\n    NodeList.Add(oPntn.Clone)\n    nTNode=2\n  else\n    nFNode=nil\n    nTNode=nil\n    for each i in 0..(nCurrent-1)\n      oPnt=NodeList.Get(i)\n      if(nFNode=nil)then\n        if(oPnt.Intersects(oPnt0))then\n          nFNode=(i+1).Clone\n        end\n      end  \n      if(nTNode=nil)then\n        if(oPnt.Intersects(oPntn))then\n          nTNode=(i+1).Clone\n        end\n      end\n      if((nFNode<>nil) and (nTNode<>nil))then\n        break\n 
     end\n    end\n    if(nFNode=nil)then\n      NodeList.Add(oPnt0.Clone)\n      nFNode=NodeList.Count\n    end\n    if(nTNode=nil)then\n      NodeList.Add(oPntn.Clone)\n      nTNode=NodeList.Count\n    end  \n  end\n  LineFtab.SetValue(FNodeFld,rec,nFNode.Clone)\n  LineFtab.SetValue(TNodeFld,rec,nTNode.Clone)\nend   \nav.setStatus(100)\nLineFtab.SetEditable(false)\n  \n\n"
)

(Script.212
	Name:	"RAS.FRM.RmvRecsAll"
	SourceCode:	"' Name: RAS.FRM.RmvRecsAll\n' ***************************************************************************\n'              (c) Copyright, 1997\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name: RAS.FRM.RmvRecsAll\n' Headline: RAS.FRM.RmvRecsAll,{aFtab,True}\n' Self: {Ftab,RemainEditable}\n' Returns: \n' Description: remove All records  \n' Requires:\n' History: 3/25/97 Zye\n'          RAS.FRM.RmvRecs
All 2/1/99\n' ***************************************************************************\nTheFtab=SELF.Get(0)\nRemainEditable=SELF.Get(1)  'R=True\n\nif(TheFtab.CanEdit)then\n  TheFtab.SetEditable(True)\nelse\n  msgbox.info(\"Can't Edit\"++TheFtab.GetName,Script.The.GetName)\n  return nil\nend\nTheFtab.AddRecord\nTheFtab.GetSelection.SetAll\nTheFtab.UpdateSelection\nTheFtab.RemoveRecords(TheFtab.GetSelection.Clone)\n\nTheFtab.SetEditable(RemainEditable)\n\n"
)

(Script.213
	Name:	"RAS.FRM.RmvRecsLst"
	SourceCode:	"' Name: RAS.FRM.RmvRecsLst\n' ***************************************************************************\n'              (c) Copyright, 1997\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name: RAS.FRM.RmvRecsLst\n' Self: {aVtab,RecList,RemainEditabl}\n' Returns: nil\n' Description: Remove Records specified in a list.\n' Requires:\n' History: RAS.FRM.RmvRecsLst Zye 4/3/97\n'          RAS.FRM.RmvRecs
Lst 2/3/99\n' ***************************************************************************\nTheFtab=SELF.Get(0)\nTheList=SELF.Get(1)\nRemainEditable=SELF.Get(2)\nif(TheFtab.CanEdit)then\n  TheFtab.SetEditable(True)\nelse\n  Msgbox.info(\"Can't Edit\"++TheFtab.getName,Script.The.GetName)\n  return nil\nend\nif(TheList.Is(List))then\n  TheBitMap=TheFtab.GetSelection\n  TheBitMap.ClearAll\n  TheFtab.UpdateSelection\n  TheBitMap=TheFtab.GetSelection\n  For each i in TheList\n    TheBitMap.Set(i.Clone)\n  end\n  TheFtab.RemoveRecords
(TheBitMap)\nelse  \n  if(TheList.is(Bitmap))then\n    TheFtab.RemoveRecords(TheList)\n  end\nend  \n\nTheFtab.SetEditable(RemainEditable)\n\n"
)

(Script.214
	Name:	"RAS.FRM.SaveGThms"
	SourceCode:	"' Name: RAS.FRM.SaveGThms\n' ***************************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:         RAS.FRM.SaveGThms  \n' USAGE:        av.run(\"RAS.FRM.SaveGThms\",{OutName,sTitle,rGrid})\n'      where:   OutName    - name of the theme to be saved\n'               sTitle     - title to display on 
the fail warning message box\n'               rGrid      - theme to save\n' Returns:      true/false (saved/not saved) \n' Description:  Save the grid.\n' CalledBy:     HMS.PRE.*\n' Requires:     none\n' History:      DDJ 12/98\n' ***************************************************************************\nOutName=SELF.Get(0)\nsTitle=SELF.Get(1)\nrGrid=SELF.Get(2)       \n\n' Check for errors in the GRID\nif(rGrid.HasError)then                                                  ' check if output is ok\n  MsgBox.Warning(\"Th
e newly generated Grid has errors\",sTitle)\n  return false                                                           ' quit from sub\nend   \n\n' Save the data set\naFN=FN.Merge(av.GetProject.GetWorkDir.AsString,OutName)                  ' specify file name\nif(aFN=nil)then                                                          ' check for Cancel\n  MsgBox.Warning(\"Problem with GRID name\",sTitle)\n  return false                                                           ' quit from sub\nelse\n  rGrid.Rename(aFN)    
                                                 ' save the temporary GRID\nend\n\nreturn true                                                              ' exit sub\n"
)

(Script.215
	Name:	"RAS.FRM.SetBaseDir"
	SourceCode:	"' Name: RAS.FRM.SetBaseDir\n' ***************************************************************************\n'              (c) Copyright, 1997\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name: RAS.FRM.SetBaseDir \n' USAGE: av.run(\"RAS.FRM.SetBaseDir\",nil)\n' Returns:\n' Description:  Set the workdir to the BaseDir.\n' CalledBy:  \n' Requires: RAS.FRM.SetWorkDir\n' History: 99/1/28 zye\n' ***********
****************************************************************\nsWorkDirName=\"BaseData\"\n\noView=SELF.Get(0)\n\nsWorkDir=sWorkDirName\ndTag=oView.GetObjectTag\nif(dTag<>nil)then\n  if(dTag.Is(Dictionary))then\n    sWorkDir=dTag.Get(\"sWorkDir\")\n    if(sWorkDir=nil)then\n      sWorkDir=sWorkDirName\n    end\n  end    \nend\nav.run(\"RAS.FRM.SetWorkDir\",{sWorkDir})\n"
)

(Script.216
	Name:	"RAS.FRM.SetSymbol"
	SourceCode:	"' Name: RAS.FRM.SetSymbol\n'*************************************\n' Name: RAS.FRM.SetSymbol\n' Self: \n' Returns: Symbol\n' Description: av.run(\"RAS.FRM.SetSymbol\",{\"TYPE\",PARAMETERS})  \n' Requires:\n' History: RAS.FRM.SetSymbol, SetSymbl.atl 2/6/96\n'**************************************\nSType=SELF.get(0).UCase\n  ColorDict=Dictionary.make(18)\n  ColorDict.add(\"BLACK\",Color.getBlack)\n  ColorDict.add(\"BLUE\",Color.getBlue)\n  ColorDict.add(\"CYAN\",Color.getCyan)\n  ColorDict.add(\"GREEN\",Color.getGreen)\n  ColorDict.add
(\"GRAY\",Color.getGray)\n  ColorDict.add(\"MAGENTA\",Color.getMagenta)\n  ColorDict.add(\"RED\",Color.GetRed)\n  ColorDict.add(\"WHITE\",Color.getWhite)\n  ColorDict.add(\"YELLOW\",Color.getYellow)\n  ColorDict.add(0,Color.getRed)\n  ColorDict.add(1,Color.getBlue)\n  ColorDict.add(2,Color.getGreen)\n  ColorDict.add(3,Color.getBlack)\n  ColorDict.add(4,Color.getGray)\n  ColorDict.add(5,Color.getMagenta)\n  ColorDict.add(6,Color.GetCyan)\n  ColorDict.add(7,Color.getWhite)\n  ColorDict.add(8,Color.getYellow)\nif(SType=\"TEXT\")then\n  
ASym=textsymbol.make\n  ASym.setcolor(colorDict.get(SELF.Get(1)))\n  txfont=font.make(SELF.get(2))  '\"Times New Roman\",\"Normal\"\n  ASym.setfont(txfont)\n  ASym.setSize(SELF.get(3))\n  return Asym\nelseif(SType=\"POLYR\")then  '{\"POLYR\",\"RED\",\"BLUE\",#RasterFill_Style_solid}\n  ASym=RasterFill.Make  \n  Asym.SetColor(ColorDict.Get(SELF.get(1)))  \n  Asym.SetOLColor(ColorDict.Get(SELF.get(2))) \n  Asym.setStyle(SELF.get(3))\n  Return ASym    \nelseif(SType=\"POLYC\")then  'CompositFill\n \nelseif(SType=\"POLYV\")then  'VectorFill
\n\nelseif(SType=\"LINE\")then   'Line symbol\n    \nelseif(SType=\"POINT\")Then  'Point symbol\n  \nelseif(SType=\"COLOR\")then\n  TheColor=ColorDict.Get(SELF.Get(1))\n  Return TheColor\nelse  \n  Msgbox.report(\"USAGE: av.run(\"+Script.The.GetName+\",{POLY,LINE,or POINT,or TEXT})\",\n  \"From:\"+Script.The.GetName)\n  return nil\nend\n\n"
)

(Script.217
	Name:	"RAS.FRM.SetWorkDir"
	SourceCode:	"' Name: RAS.FRM.SetWorkDir\n'***************************************************************************\n'              (c) Copyright, 1997\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name: RAS.FRM.SetWorkDir \n' USAGE: av.run(\"RAS.FRM.SetWorkDir\",{\"DirName\"})\n' Returns:\n' Description: Set the work Directory to the \"DirName\" under the \n'  current project.\n' CalledBy:\n' Requires:\n' History: Z
ye 99/1/6\n'***************************************************************************\n'msgbox.info(\"Watershed Delineator\"+nl+\"Copyright\"+169.Aschar++\"1997\"+nl+\"Environmental Systems Research Institute, Inc. and\"+nl+\"Texas Natural Resources Conservation Commission.\",\"  \")\nif(SELF.Is(List))then\n  TheDir=SELF.Get(0).AsString\nelse\n  TheDir=\"Tmp\"\nend\n\nTheProject=av.GetProject\nif(TheProject.is(Project))then\n  TheFileName=TheProject.GetFileName\n  if(TheFileName=nil)then\n    Msgbox.info(\"Save the Project and run t
he program again\",Script.The.GetName)\n    Exit\n  end\n  Rdir=TheFileName.ReturnDir\n  TheWkDir=FN.Merge(Rdir.AsString,TheDir)  ' 'use merge to ensure cross-platform compatible\n  if(TheWkDir.IsDir.Not)then\n    OSType=System.GetOSVariant\n    if(OSType=#SYSTEM_OSVARIANT_MSWNT)then \n      system.execute(\"Cmd /c MkDir\"++TheWkDir.AsString)\n      TheProject.SetWorkDir(TheWkDir)\n    elseif(OSType=#SYSTEM_OSVARIANT_MSW95) then\n      system.execute(\"command.com /c Mkdir\"++TheWkDir.AsString)\n      TheProject.SetWorkDir(
TheWkDir)\n    else\n      Msgbox.Info(TheWkDir.AsString++\"does not exist.\"+nl+\"You need to create\"++TheDir,Script.The.GetName)    \n    end  \n  else\n    if (File.IsWritable(TheWkDir).Not) then\n      MsgBox.Info( TheWkDir.GetFullName++\"is not writable to\"++TheProject.GetCreator, Script.The.GetName)\n    else\n      TheProject.SetWorkDir(TheWkDir)\n    end  \n  end\nend  \n\nreturn (TheWkDir.AsString)\n"
)

(Script.218
	Name:	"RAS.FRM.ThmTagMgr"
	SourceCode:	"' Name: RAS.FRM.ThmTagMgr\n' ***************************************************************************\n'              (c) Copyright, 1997\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name: RAS.FRM.ThmTagMgr \n' USAGE:\n'       av.run(\"RAS.FRM.ThmTagMgr\", {\"Set\",oView,sTag,ThmType,ShpType}) ->oThm/nil (if not set)\n'             \"Set\"   - trigs the set tag action.\n'             oView   - view 
handle\n'             sTag   - the Tag value (indicates the id of the thm to a program.\n'             ThmType - theme type specified by theme class name:[FTheme,GTheme,DBTheme]\n'             ShpType - for Ftheme, ShpType=[Polygon,PolyLine,Point,Multipoint,PolyLineZ], for others, nil.\n'             ThmType and ShpType are optional.\n'\n'       av.run(\"RAS.FRM.ThmTagMgr\", {\"Get\",oView,sTag}) ->lThms/nil (if not found)\n'         Note, lThms should have only 0 or 1 member, but it is up to the calling\n'           p
rograms to handle the situation if more than one theme is tagged with \n'           the same tag.\n'\n'       av.run(\"RAS.FRM.ThmTagMgr\", {\"GetByKey\",oView,sKey,sTag}) ->lThms/nil (if not found)\n'         GetByKey pairs with SetByKey.\n'         sKey=The Key value whose value identifies the Thm\n'         sTag=The Value that ID the thm.\n'\n'       av.run(\"RAS.FRM.ThmTagMgr\", {\"SetByKey\",oView,sKey,sTag}) \n'         sKey=The Key value whose value identifies the Thm, allows many thms to be tagged with the same valu
e.\n'         sTag=The Value that ID the thm.\n'           ThmType - theme type specified by theme class name:[FTheme,GTheme,DBTheme]\n'           ShpType - for Ftheme, ShpType=[Polygon,PolyLine,Point,Multipoint,PolyLineZ], for others, nil.\n'           ThmType and ShpType are optional.\n\n'       av.run(\"RAS.FRM.ThmTagMgr\", {\"SetThm\",oView,oThm,sName}) -> dDThmTags(key=ThmTag,value=Dict)\n'         \"SETTHM\" = Set sTag to the Thm passed in, and remove the sTag from other themes that\n'                    may have i
t as a tag.\n'         \"oThm\"   = The Thm to set the tag to.\n'         \"sName\"   = The Tag to set.\n'                             \n'       av.run(\"RAS.FRM.ThmTagMgr\", {\"SHOW\",oView}) -> dDThmTags(key=ThmName,value=Dict)\n'         MainPurpose of this program is to display the ObjTags of themes in a view,\n'         dDThmTags=dict of ThmTags is returned to the calling program in case needed.\n'    \n'       ..Added 1/30/99 Zye\n'       av.run(\"RAS.FRM.ThmTagMgr\", {\"REMOVE\",oView,sName}) -> nTagsRemoved\n'         Re
mvoe the sTag from any themes taged with sName, sName is used to Id the Theme.\n'         nTagsRemove=The Number of tages removed.  \n'\n'       av.run(\"RAS.FRM.ThmTagMgr\", {\"GetONE\",oView,sName}) ->oThm/nil (if not found)\n'         Retruns the Thm Tagged with sName or Nil.\n'\n'       av.run(\"RAS.FRM.ThmTagMgr\", {\"SetValue\",oThm,sKey,oValue}) -> nil\n'         Set dTag's sKey to oValue\n'       av.run(\"RAS.FRM.ThmTagMgr\", {\"GetValue\",oThm,sKey}) -> oValue \n'         Get dTag's oValue base on the key supplied.\n'\n'
       av.run(\"RAS.FRM.ThmTagMgr\", {\"SetValueMenu\",oView,oThm (optional})         \n'         Set a keyed value.  The program will prompt user with the format of entry:\n'         Key=Value pair. The action is applied on the ActiveThm. or ActiveThms.Get(0)\n'         if oThm is supplied, The action is applied to the oThm\n'         if oThm is not supplied, TheAction is applied to the ActiveThemes.Get(0)\n'         Program normally called from the menu.\n'         \n'         The diff. between SetValueMenu and SetV
alue is that:\n'           SetValue's calling program will provide sKey and oValue while\n'           SetValueMenu will prompt user to enter the sKey=sValue pair.\n'\n'         Returns lInputs={Key,Value} if set, nil, if not set.\n'         3/5/99         \n'\n'       av.run(\"RAS.FRM.ThmTagMgr\", {\"RemoveKey\",oView,oThm (optional)})\n'         Remove a Key from the dTag (ObjectTag) of a Theme.\n'         if oThm is supplied, Remove the Key from oThm's ObjectTag,\n'         if oThm is not supplied, remove the key from 
the ActiveTheme\n'         Program normally called from the menu.\n'         3/5/99\n'\n'         Returns True is the Key is remove, False, if Key is not found.\n' Returns:\n' Description: Manages thm tags.   \n' CalledBy:\n' Requires: RAS.FRM.GetThms, \n' History: zye 98-12-2\n' ***************************************************************************\nsTitle = \"Set Theme Tag\"\nsMsg1  = \"Select a theme to tag with\"\nsAction=SELF.Get(0)\n\noReturn=nil\n\n' ******************************************************************
*********\n'..Set: Set sName value to the dTag of a theme.\n' ***************************************************************************\nif(sAction=\"Set\")then\n  oView=SELF.Get(1)\n  sName=SELF.Get(2)\n  '..If ThmType and ShpType are specified, then use RAS.FRM.GetThms to get the thms.\n  if(SELF.Count>3)then\n    ThmType=SELF.Get(3)\n    ShpType=SELF.Get(4)\n    lThms=av.run(\"RAS.FRM.GetThms\",{oView,false,ThmType,ShpType})\n  else  \n    lThms=oView.GetThemes\n  end\n  if(lThms<>nil)then\n    if(lThms.Count>0)then  \n  
    oThm=Msgbox.ChoiceAsString(lThms,sMsg1++sName,sTitle)\n      if(oThm<>nil)then\n        dTag=oThm.GetObjectTag\n        if(dTag.is(Dictionary))then\n          sTagName=dTag.Get(\"sName\")\n          if(sTagName<>nil)then\n            if((sTagName.Is(String)) or (sTagName.Is(Number)) or (sTagName.Is(Date)))then\n              bChk=Msgbox.YesNo(oThm.GetName++\"is tagged with \"+sTagName.AsString+nl+\"Overwrite it ?\",sTitle,true)\n            else\n              bChk=Msgbox.YesNo(oThm.GetName++\"is tagged with a \"+sTagNa
me.GetClass.GetClassName+nl+\"Overwrite it ?\",sTitle,true)\n            end  \n            if(bChk)then\n              bOK=true\n            else\n              bOK=false\n            end  \n          else\n            bOK=true    \n          end\n        else\n          dTag=Dictionary.Make(1)\n          bOK=true\n        end\n        \n        '..If ok, then set the sName\n        if(bOK)then\n          dTag.Set(\"sName\",sName)\n          oThm.SetObjectTag(dTag)\n          oReturn=oThm\n        end\n      end      \n    end  \n  
end\n  return (oReturn)\nend\n\n' ***************************************************************************\n'..Get: Given a sName (tagName), find and return the theme that it tags to.\n' ***************************************************************************\nif(sAction=\"Get\")then\n  oView=SELF.Get(1)\n  sName=SELF.Get(2)\n  lReturns=List.Make\n  lThms=oView.GetThemes\n  if(lThms.Count>0)then\n    for each oThm in lThms\n      dTag=oThm.GetObjectTag\n      if(dTag.is(Dictionary))then\n        sTag=dTag.Get(\"sName\")\n
        if(sTag=sName)then\n          lReturns.Add(oThm)\n          break\n        end\n      end\n    end\n  end\n  return (lReturns)\nend\n' ***************************************************************************\n'..SETTHM: Set the thm tag to a thm provided.\n' ***************************************************************************\n\nif(sAction=\"SETTHM\")then\n  oView=SELF.Get(1)\n  oThm=SELF.Get(2)\n  sTag=SELF.Get(3)\n  \n  '..remove the sTag from the Themes that may have it tagged to.\n  lThms=oView.GetThemes\n  
for each thm in lThms\n    if(oThm.GetName=thm.GetName)then\n      continue\n    else\n      dTag=thm.GetObjectTag\n      if(dTag.Is(Dictionary))then\n        sName=dTag.Get(\"sName\")\n        if(sName=sTag)then\n          dTag.Set(\"sName\",nil)\n        end\n      end\n    end\n  end\n  \n  dTag=oThm.GetObjectTag\n  if(dTag.Is(Dictionary))then\n    dTag.Set(\"sName\",sTag)\n  else\n    dTag=Dictionary.Make(1)\n    dTag.Set(\"sName\",sTag)\n  end\n  oThm.SetObjectTag(dTag)  \nend\n\n' ****************************************************
***********************\n'..SHOW: show the objTags of themes in a view.\n' ***************************************************************************\nif(sAction=\"SHOW\")then\n  oView=SELF.Get(1)\n  lThms=oView.GetThemes\n  dReturn=Dictionary.Make(1)\n  sLongMsg=\"\"\n  if(lThms.Count>0)then\n    for each oThm in lThms\n      dTag=oThm.GetObjectTag\n      dReturn.Add(oThm.GetName,dTag)\n      sLongMsg=sLongMsg+oThm.GetName+\"->\"+dTag.GetClass.GetClassName+nl\n      if(dTag<>nil)then\n        if(dTag.is(Dictionary))then\n    
      sLongMsg=sLongMsg+tab+\"sName=\"+dTag.Get(\"sName\").AsString+nl\n          for each k in dTag.ReturnKeys\n            if(k<>\"sName\")then\n              oValue=dTag.Get(k)\n              if((oValue.is(String)) or (oValue.is(Number)) or (oValue.is(Date)))then\n                sLongMsg=sLongMsg+Tab+k.AsString+\"=\"+oValue.AsString+nl\n              else\n                sLongMsg=sLongMsg+Tab+k.AsString+\"=\"+oValue.GetClass.GetClassName+nl\n              end\n            end\n          end\n        else\n          if((dTag
.is(String)) or (dTag.is(Number)) or (dTag.is(Date)))then\n            sLongMsg=sLongMsg+Tab+dTag.AsString+nl\n          end  \n        end\n      else\n        sLongMsg=sLongMsg+Tab+dTag.AsString+nl\n      end\n    end  \n  end\n  msgbox.report(sLongMsg,Script.The.GetName)\nend\n\n' ***************************************************************************\n'..REMOVE: REMOVE sTag from themes in a view.\n' ***************************************************************************\nif(sAction=\"REMOVE\")then\n  oView=SELF.G
et(1)\n  sTag=SELF.Get(2)\n  lThms=oView.GetThemes\n  nTagsRemoved=0\n  if(lThms.Count>0)then\n    for each oThm in lThms\n      dTag=oThm.GetObjectTag\n      if(dTag.is(Dictionary))then\n        sName=dTag.Get(\"sName\")\n        if(sName=sTag)then\n          dTag.Set(\"sName\",nil)\n          nTagsRemoved=nTagsRemoved+1\n        end\n      end\n    end\n  end\n  \n  return nTagsRemoved\nend\n\n' ***************************************************************************\n'..GetONE: GetONE sTag Theme\n' ****************************
***********************************************\nif(sAction.UCASE=\"GETONE\")then\n  oView=SELF.Get(1)\n  sTag=SELF.Get(2)\n  oThmReturn=nil\n  lThms=oView.GetThemes\n  if(lThms.Count>0)then\n    for each oThm in lThms\n      dTag=oThm.GetObjectTag\n      if(dTag.is(Dictionary))then\n        sName=dTag.Get(\"sName\")\n        if(sTag=sName)then\n          oThmReturn=oThm\n          Break\n        end\n      end\n    end\n  end\n  return (oThmReturn)\nend\n\n' *************************************************************************
**\n'..SetValue Set the oValue\n' ***************************************************************************\nif(sAction.UCASE=\"SETVALUE\")then\n  oThm  =SELF.Get(1)\n  sKey  =SELF.Get(2)\n  oValue=SELF.Get(3)\n  \n  dTag=oThm.GetObjectTag\n  if(dTag.Is(Dictionary).Not)then\n    dTag=Dictionary.Make(1)\n  end\n  dTag.Set(sKey,oValue)\n  oThm.SetObjectTag(dTag)\n  \nend\n\n\n' ***************************************************************************\n'..GetValue Get the oValue\n' **********************************************
*****************************\nif(sAction.UCASE=\"GETVALUE\")then\n  oThm=SELF.Get(1)\n  sKey=SELF.Get(2)\n  \n  dTag=oThm.GetObjectTag\n  oValue=nil\n  dTag=oThm.GetObjectTag\n  if(dTag.Is(Dictionary))then\n    oValue=dTag.Get(sKey)\n  end\n  \n  return oValue\n  \nend\n\n' ***************************************************************************\n'..GetByKey: Get Thms based on the value of sKey on its ObjectTag. zye 2/18 \n' ***************************************************************************\nif(sAction=\"GetByKey\")t
hen\n  oView=SELF.Get(1)\n  sKey =SELF.Get(2)\n  sTag =SELF.Get(3)\n  lReturns=List.Make\n  lThms=oView.GetThemes\n  if(lThms.Count>0)then\n    for each oThm in lThms\n      dTag=oThm.GetObjectTag\n      if(dTag.is(Dictionary))then\n        sKeyTag=dTag.Get(sKey)\n        if(sTag=sKeyTag)then\n          lReturns.Add(oThm)\n        end\n      end\n    end\n  end\n  return (lReturns)\nend\n\n\n' ***************************************************************************\n'..SetByKey: Set sKey value to the dTag of a theme that will
 be used later\n'..to Identify the Thm.\n' ***************************************************************************\nif(sAction=\"SetByKey\")then\n  oView=SELF.Get(1)\n  sKey =SELF.Get(2)\n  sTag =SELF.Get(3)\n  '..If ThmType and ShpType are specified, then use RAS.FRM.GetThms to get the thms.\n  if(SELF.Count>4)then\n    ThmType=SELF.Get(4)\n    ShpType=SELF.Get(5)\n    lThms=av.run(\"RAS.FRM.GetThms\",{oView,false,ThmType,ShpType})\n  else  \n    lThms=oView.GetThemes\n  end\n  if(lThms<>nil)then\n    if(lThms.Count>0)the
n  \n      oThm=Msgbox.ChoiceAsString(lThms,sMsg1++sTag,sTitle)\n      if(oThm<>nil)then\n        dTag=oThm.GetObjectTag\n        if(dTag.is(Dictionary))then\n          sTagName=dTag.Get(sKey)\n          if(sTagName<>nil)then\n            if((sTagName.Is(String)) or (sTagName.Is(Number)) or (sTagName.Is(Date)))then\n              bChk=Msgbox.YesNo(oThm.GetName++\"is tagged with \"+sTagName.AsString+nl+\"Overwrite it ?\",sTitle,true)\n            else\n              bChk=Msgbox.YesNo(oThm.GetName++\"is tagged with a \"+sTag
Name.GetClass.GetClassName+nl+\"Overwrite it ?\",sTitle,true)\n            end  \n            if(bChk)then\n              bOK=true\n            else\n              bOK=false\n            end  \n          else\n            bOK=true    \n          end\n        else\n          dTag=Dictionary.Make(1)\n          bOK=true\n        end\n        \n        '..If ok, then set the sName\n        if(bOK)then\n          dTag.Set(sKey,sTag)\n          oThm.SetObjectTag(dTag)\n          oReturn=oThm\n        end\n      end      \n    end  \n  en
d\n  return (oReturn)\nend\n\n' ***************************************************************************\n'..\"SetValueMenu\": Set sValue to an SKey (sKey=sValue) 3/5/99\n' ***************************************************************************\nif(sAction=\"SetValueMenu\")then\n\n  oView=SELF.Get(1)\n  sMsg=\"Existing Key=Value (s):\"\n  sMsgTitle=\"Enter Key=Vale pair to tag Theme:\" \n  sTitle=\"Set Theme Tag Value\"\n  lInputs=nil   'Return list.\n\n  if(SELF.Count>2)then\n    oThm=SELF.Get(2)\n  else\n    lThms=oView.GetAc
tiveThemes\n    if(lThms.Count=0)then\n      Msgbox.info(\"No Active Theme exists in \"+oView.GetName,sTitle)\n      exit\n    end\n    \n    oThm=lThms.Get(0)\n  end  \n  dTag=oThm.GetObjectTag\n  if(dTag.Is(Dictionary).not)then\n    dTag=Dictionary.Make(1)\n  end\n  \n  for each sKey in dTag.ReturnKeys\n    if((sKey.Is(String)) or (sKey.Is(Number)) or (sKey.Is(Date)))then\n      sValue=dTag.Get(sKey)\n      if((sValue.Is(String)) or (sKey.Is(Number)) or (sKey.Is(Date)))then\n        sMsg=sMsg+sKey.AsString+\"=\"+sValue.AsStri
ng+\" | \"\n      end\n    end\n  end\n  \n  sMsgTitle=sMsgTitle++oThm.GetName\n  sInput=Msgbox.Input(sMsg,sMsgTitle,\"\")\n  \n  if(sInput.Is(String))then\n    lInputs=sInput.AsTokens(\"=\")\n    if(lInputs.Count=2)then\n      sKey=lInputs.Get(0)\n      sValue=lInputs.Get(1)\n      if(sKey.IsNumber)then\n        sKey=sKey.AsNumber\n        lInputs.Set(0,sKey)\n      end\n      if(sValue.IsNumber)then\n        sValue=sValue.AsNumber\n        lInputs.Set(1,sValue)\n      end\n      dTag.Set(sKey,sValue)\n      oThm.SetObjectTag(dTag)\n 
   end\n  end\n  \n  return lInputs\n\nend  'if(sAction=\"SetValueFromMenu\")\n\n' ***************************************************************************\n'..\"RemoveKey\": Set sValue to an SKey (sKey=sValue) 3/5/99\n' ***************************************************************************\nif(sAction=\"RemoveKey\")then\n  oView=SELF.Get(1)\n  sTitle=\"Remove an ObjectTag Key for \"\n  bReturn=false\n  \n  if(SELF.Count>2)then\n    oThm=SELF.Get(2)\n  else\n    lThms=oView.GetActiveThemes\n    if(lThms.Count=0)then\n      Msg
box.info(\"No Active Theme exists in \"+oView.GetName,sTitle)\n      exit\n    end  \n    oThm=lThms.Get(0)\n  end  \n  \n  dTag=oThm.GetObjectTag\n  if(dTag.Is(Dictionary))then\n    lRemoveKeys=List.Make   'The Keys in the dTag\n    lDisplays  =List.Make   'The Strings to be displayed.\n    i=0\n    for each sKey in dTag.ReturnKeys\n      sDisplay=i.AsString+\": \"\n      sValue=dTag.Get(sKey)\n      if((sKey.Is(String)) or (sKey.Is(Number)) or (sKey.Is(Date)))then\n        bKeyIsString=true\n      else\n        bKeyIsString=f
alse      \n      end\n      if((sValue.Is(String)) or (sValue.Is(Number)) or (sValue.Is(Date)))then\n        bValueIsString=true\n      else\n        bValueIsString=false\n      end\n      \n      if(bKeyIsString)then\n        sDisplay=sDisplay+sKey.AsString\n      else\n        sDisplay=sDisplay+sKey.GetClass.GetClassName\n      end\n      \n      if(bValueIsString)then\n        sDisplay=sDisplay+\"=\"+sValue.AsString\n      else\n        sDisplay=sDisplay+\"=\"+sValue.GetClass.GetClassName\n      end\n      \n      lDisplays.Ad
d(sDisplay.Clone)\n      lRemoveKeys.Add(sKey.Clone)\n      i=i+1\n    end\n  \n    sMsgTitle=sTitle+oThm.GetName\n    sInput=Msgbox.ChoiceAsString(lDisplays,\"Select a Key Remove.\",sMsgTitle)\n    \n    if(sInput.Is(String))then\n      lInputs=sInput.AsTokens(\":\")\n      iIndex=lInputs.Get(0).AsNumber\n      oKey=lRemoveKeys.Get(iIndex)\n      bReturn=dTag.Remove(oKey)\n    else  'If Cancel button is pressed.\n      bReturn=false\n    end\n  \n  end  'if(dTag.Is(Dictionary))\n  \n  return bReturn\n\nend  \n"
)

(Script.219
	Name:	"RAS.FRM.ThmTagMgrR"
	SourceCode:	"' Name: RAS.FRM.ThmTagMgrR\n'.This program is only for testing purpose.\n'\nTheProject=av.GetProject\nsTag=\"River\"\noView=av.GetActiveDoc\noThm=av.run(\"RAS.FRM.ThmTagMgr\", {\"Get\",oView,sTag})\nif(oThm.is(Theme))then\n  bOk=msgbox.YesNoCancel(oThm.GetName++\"is currently tagged with\"++sTag+nl+\"Would like to Reset the Tag ?\",Script.The.GetName,true)\n  if(bOk=true)then\n    oThm.SetObjectTag(nil)\n  else\n    exit\n  end    \nend\noThm=av.run(\"RAS.FRM.ThmTagMgr\", {\"Set\",oView,\"River\",FTheme,\"Polygon\"})\n'msgbox.info(oThm.GetC
lass.GetClassName,\"\")\noThm=av.run(\"RAS.FRM.ThmTagMgr\", {\"Get\",oView,\"Testing\"})\nmsgbox.info(oThm.GetClass.GetClassName,oThm.GetName)\nav.run(\"RAS.FRM.ThmTagMgr\", {\"SHOW\",oView})\n\n"
)

(Script.220
	Name:	"RAS.FRM.VerifyFields"
	SourceCode:	"' Name: RAS.FRM.VerifyFields\n' ***************************************************************************\n'              (c) Copyright, 1997\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' FileName: RAS.FRM.VerifyFields  \n' Name: RAS.FRM.VerifyFields \n' Usage: av.run(\"RAS.FRM.VerifyFields\",{FTab,dFields,RemainEditable})\n'  dFields[sFldName,\"sFldDesc\"] or dFields[sFldName,oField]\n'  sFldDesc=\"
FldEnum,FldLeng,FldDeci\"\n' Returns: False if failed to create the fields specified in dFields, True otherwise.\n' Description: chk to see if fields in dFields exists in Ftab, if not, add them.  \n' Requires: \n' History: modified from hydro.VfFlds,4/4/97\n'          modified 1/22/98, so that Value of dFields can be a Field object.\n'          12/15/98 for the frame work.\n' ***************************************************************************\nTheFtab=SELF.Get(0)\ndFields=SELF.Get(1)\nRemainEditable=SELF.Get(2
)\nsTitle=\"Required pre-existing field is not found.\"\nif(dFields=nil)then\n  return false\nend\n\n\nbFldCanAdd=True\nif(theFtab.CanEdit)then\n  TheFtab.SetEditable(True)\nelse\n  msgbox.info(\"Can'tEdit:\"++TheFtab.GetName,Script.the.GetName)\n  bFldCanAdd=False\nend\n\nif(bFldCanAdd)then\n\n  lFields=List.Make\n\n  for each FldName in dFields.ReturnKeys\n    TheFld=TheFtab.FindField(FldName)\n    if(TheFld=nil)then\n      av.showMsg(\"adding\"++FldName++\"to\"++TheFTab.GetName++\"...\")\n      oField=dFields.Get(FldName)\n      if(oFiel
d.is(Field))then\n        NewFld=Field.Make(oField.GetName,oField.GetType,oField.GetWidth,oField.GetPrecision)\n      else\n        FldSp=oField.AsTokens(\",\")\n\n        if(FldSp.Count>3)then\n          if(FldSp.Get(3)<>\"0\")then\n            '..If the field is designated as pre-existing required, exit the routine, and\n            '..ask the user to create the field and filled it with the required values.\n            msgbox.info(FldName++\"does not exist in\"++TheFtab.GetName+nl+\n                        Script.The.Ge
tName,sTitle)\n            lFields.Empty\n            bFldCanAdd=False\n            Exit    'if the field is absolutely needed and it is not there, terminate the program.zye\n          end\n        end  \n        FldEnum=FldSp.Get(0).AsEnum\n        FldLeng=FldSp.Get(1).AsNumber\n        FldDeci=FldSp.Get(2).AsNumber\n        NewFld=Field.Make(FldName,FldEnum,FldLeng,FldDeci)\n        lFields.Add(NewFld)\n      end\n    end\n  end\n  if(lFields.Count>0)then\n    TheFtab.AddFields(lFields)\n  end    \nend     \n\nTheFtab.SetEd
itable(RemainEditable)\nreturn (bFldCanAdd)\n\n"
)

(Script.221
	Name:	"RAS.FRM.VerifyThmType"
	SourceCode:	"' Name: RAS.FRM.VerifyThmType\n' ***************************************************************************\n'              (c) Copyright, 1997\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name: RAS.FRM.VerifyThmType \n' USAGE: av.run(\"RAS.FRM.VerifyThmType\",{oThm,ThmType,sShpType}) -> true/false\n'   oThm=ThemeHandle\n'   ThmType=ThemeType [GTHEME,FTHEME] etc\n'   ShpType=ShapeType [\"POLYGON\",\"
POLYLINE\",\"POINT\",\"MultiPoint\"] etc\n'\n' Returns: true if they match, false if not.\n' Description:  \n' CalledBy:\n' Requires:\n' History: zye 12/17/98\n' ***************************************************************************\noThm=SELF.Get(0)\nThmType=SELF.Get(1)\nsShpType=SELF.Get(2)\nbReturn=true\nif(oThm.Is(ThmType).Not)then\n  bReturn=false\nelse\n  if(oThm.is(Ftheme))then\n    ThmShpType=oThm.GetFtab.GetShapeClass.GetClassName\n    if(ThmShpType<>sShpType)then\n      bReturn=false     \n    end\n  end\nend\n\nreturn 
bReturn\n\n"
)

(Script.222
	Name:	"RAS.FRM.ViewTagMgr"
	SourceCode:	"' Name: RAS.FRM.ViewTagMgr\n' ***************************************************************************\n'              (c) Copyright, 1997\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name: RAS.FRM.ViewTagMgr \n' USAGE:\n'\n'       av.run(\"RAS.FRM.ViewTagMgr\", {\"GetValue\",oView,sKey}) ->oValue/nil (if not found)\n'         oView = Viewhandle\n'         sKey  = Key         \n'\n'       av.run(\"HMS
.FRM.ViewTagMgr\", {\"SetValue\",oView,sKey,oValue}) -> dDThmTags(key=ThmTag,value=Dict)\n'         \"SETValue\"= Set sTag to the Thm passed in, and remove the sTag from other themes that\n'                    may have it as a tag.\n'          oView    = The View to set the tag to.\n'          sKey     = The Key.\n'          oValue   = The Value.\n'                   \n'       av.run(\"RAS.FRM.ViewTagMgr\", {\"SHOW\"}) -> nil\n'          Displays the Tags associated with a view.\n'    \n'       ..Added 1/30/99 Zye\n'       av.
run(\"RAS.FRM.ViewTagMgr\", {\"REMOVE\",oView,sTag}) -> nTagsRemoved\n'         Remvoe the sTag from any themes taged with sTag.\n'         nTagsRemove=The Number of tages removed.  \n'\n'     \n'       av.run(\"RAS.FRM.ViewTagMgr\", {\"GetViewByWorkDir\",sWorkDir}) -> oView\n'         Get the View has sWorkDirTag = sWorkDir. \n'       \n'       av.run(\"RAS.FRM.ViewTagMgr\", {\"SetValueMenu\",oView})         \n'         Set a keyed value.  The program will prompt user with the format of entry:\n'         Key=Value pair. The act
ion is applied on the ActiveView.\n'         Program normally called from the menu.\n'\n'         The diff. between SetValueMenu and SetValue is that:\n'           SetValue's calling program will provide sKey and oValue while\n'           SetValueMenu will prompt user to enter the sKey=sValue pair.\n'\n'       av.run(\"RAS.FRM.ViewTagMgr\", {\"RemoveKey\",oView})\n'         Remove a Key from the dTag (ObjectTag) of a View.\n'         Program normally called from the menu.\n'       \n'     \n'     RemoveKey and SetValueMenu
 are CalledBy: MENU, \n'     the MenuItem need to be Tagged (StringTag) with the REMOVE and SETVALUE Key words.\n'\n' Returns:\n' Description: Manages thm tags.   \n' CalledBy:\n' Requires: RAS.FRM.GetThms, \n' History: zye 98-12-2\n' ***************************************************************************\nsTitle = \"Set View Tag\"\nsMsg1  = \"Select a theme to tag with\"\nsAction=SELF.Get(0)\n\noReturn=nil\n\n' ***************************************************************************\n'..Set: Set sName value to the dTag
 of a theme.\n' ***************************************************************************\nif(sAction=\"SetValue\")then\n  oView =SELF.Get(1)\n  sKey  =SELF.Get(2)\n  oValue=SELF.Get(3)\n  \n  dTag=oView.GetObjectTag\n  if(dTag.Is(Dictionary).Not)then\n    dTag=Dictionary.Make(1)\n  end    \n  dTag.Set(sKey,oValue)\n  oView.SetObjectTag(dTag)\nend\n\n' ***************************************************************************\n'..GetValue: Given the oValue by sKey\n' ********************************************************
*******************\nif(sAction=\"GetValue\")then\n  oView =SELF.Get(1)\n  sKey  =SELF.Get(2)\n  oReturn=nil\n  \n  dTag=oView.GetObjectTag\n  if(dTag.Is(Dictionary))then\n    oReturn=dTag.Get(sKey)\n  end    \n  return (oReturn)\n\nend\n' ***************************************************************************\n'..SHOW: show the objTags of oView\n' ***************************************************************************\nif(sAction=\"SHOW\")then\n  oProject=av.GetProject  \n  sLongMsg=\"\"\n  \n  lDocs=oProject.GetDocs\n  for 
each oDoc in lDocs\n    if(oDoc.Is(View))then\n      sLongMsg=sLongMsg+nl+nl+\"View:\"+oDoc.GetName\n      dTag=oDoc.GetObjectTag\n      sLongMsg=sLongMsg+nl+tab+dTag.GetClass.GetClassName\n      if(dTag.Is(Dictionary))then\n        for each sKey in dTag.ReturnKeys\n          oValue=dTag.Get(sKey)\n          if((oValue.Is(String)) or (oValue.Is(Number)) or (oValue.Is(Date)))then\n            sLongMsg=sLongMsg+nl+Tab+Tab+\"K/V=\"+sKey.AsString+\"/\"+oValue\n          else\n            sLongMsg=sLongMsg+nl+Tab+Tab+\"K/V=\"+sKey
.AsString+\"/\"+oValue.GetClass.GetClassName\n          end  \n        end\n      end\n    end\n  end\n  \n  msgbox.report(sLongMsg,Script.The.GetName)\nend\n\n' ***************************************************************************\n'..REMOVE: REMOVE sTag from themes in a view.\n' ***************************************************************************\nif(sAction=\"REMOVE\")then\n  sTag=SELF.Get(2)\n  lThms=oView.GetThemes\n  nTagsRemoved=0\n  if(lThms.Count>0)then\n    for each oThm in lThms\n      dTag=oThm.GetObjectT
ag\n      if(dTag.is(Dictionary))then\n        sName=dTag.Get(\"sName\")\n        if(sName=sTag)then\n          oThm.SetObjectTag(nil)\n          nTagsRemoved=nTagsRemoved+1\n        end\n      end\n    end\n  end\n  \n  return nTagsRemoved\nend\n\n' ***************************************************************************\n'..GetONE: GetONE sTag Theme\n' ***************************************************************************\nif(sAction.UCASE=\"GETONE\")then\n  sTag=SELF.Get(2)\n  oThmReturn=nil\n  lThms=oView.GetThemes\n  i
f(lThms.Count>0)then\n    for each oThm in lThms\n      dTag=oThm.GetObjectTag\n      if(dTag.is(Dictionary))then\n        sName=dTag.Get(\"sName\")\n        if(sTag=sName)then\n          oThmReturn=oThm\n          Break\n        end\n      end\n    end\n  end\n  return (oThmReturn)\nend\n\n' ***************************************************************************\n' GetViewByWorkDir  Get the View tagged with sWorkDir.\n' ***************************************************************************\nif(sAction.UCASE=\"GETVIEWB
YWORKDIR\")then\n  sTag=SELF.Get(1)\n  oReturnView=nil\n  oProject=av.GetProject\n  lDocs=oProject.GetDocs\n  for each oDoc in ldocs\n    if(oDoc.Is(View))then\n      dTag=oDoc.GetObjectTag\n      if(dTag.is(Dictionary))then\n        sWorkDir=dTag.Get(\"sWorkDir\")\n        if(sWorkDir=sTag)then\n          oReturnView=oDoc\n          Break\n        end\n      end\n    end  \n  end\n  \n  return oReturnView\nend\n\n' ***************************************************************************\n' av.run(\"RAS.FRM.ViewTagMgr\", {\"SetValu
eMenu\",oView})         \n' ***************************************************************************\nif(sAction.UCASE=\"SETVALUEMENU\")then\n  oView=SELF.Get(1)\n  sMsg=\"Existing Key=Value (s):\"\n  sMsgTitle=\"Enter Key=Vale pair to tag VIEW:\" \n  sTitle=\"Set VIEW Tag Value\"\n  lInputs=nil   'Return list.\n\n  dTag=oView.GetObjectTag\n  if(dTag.Is(Dictionary).not)then\n    dTag=Dictionary.Make(1)\n  end\n  \n  for each sKey in dTag.ReturnKeys\n    if((sKey.Is(String)) or (sKey.Is(Number)) or (sKey.Is(Date)))then\n      sVa
lue=dTag.Get(sKey)\n      if((sValue.Is(String)) or (sKey.Is(Number)) or (sKey.Is(Date)))then\n        sMsg=sMsg+sKey.AsString+\"=\"+sValue.AsString+\" | \"\n      end\n    end\n  end\n  \n  sMsgTitle=sMsgTitle++oView.GetName\n  sInput=Msgbox.Input(sMsg,sMsgTitle,\"\")\n  \n  if(sInput.Is(String))then\n    lInputs=sInput.AsTokens(\"=\")\n    if(lInputs.Count=2)then\n      sKey=lInputs.Get(0)\n      sValue=lInputs.Get(1)\n      if(sKey.IsNumber)then\n        sKey=sKey.AsNumber\n        lInputs.Set(0,sKey)\n      end\n      if(sValue.I
sNumber)then\n        sValue=sValue.AsNumber\n        lInputs.Set(1,sValue)\n      end\n      dTag.Set(sKey,sValue)\n      oView.SetObjectTag(dTag)\n    end\n  end\n  \n  return lInputs\n\nend\n\n\n' ***************************************************************************\n'..\"RemoveKey\": Set sValue to an SKey (sKey=sValue) 3/5/99\n' ***************************************************************************\nif(sAction=\"RemoveKey\")then\n  oView=SELF.Get(1)\n  sTitle=\"Remove an ObjectTag Key for \"\n  bReturn=false\n    \n  dT
ag=oView.GetObjectTag\n  if(dTag.Is(Dictionary))then\n    lRemoveKeys=List.Make   'The Keys in the dTag\n    lDisplays  =List.Make   'The Strings to be displayed.\n    i=0\n    for each sKey in dTag.ReturnKeys\n      sDisplay=i.AsString+\": \"\n      sValue=dTag.Get(sKey)\n      if((sKey.Is(String)) or (sKey.Is(Number)) or (sKey.Is(Date)))then\n        bKeyIsString=true\n      else\n        bKeyIsString=false      \n      end\n      if((sValue.Is(String)) or (sValue.Is(Number)) or (sValue.Is(Date)))then\n        bValueIsSt
ring=true\n      else\n        bValueIsString=false\n      end\n      \n      if(bKeyIsString)then\n        sDisplay=sDisplay+sKey.AsString\n      else\n        sDisplay=sDisplay+sKey.GetClass.GetClassName\n      end\n      \n      if(bValueIsString)then\n        sDisplay=sDisplay+\"=\"+sValue.AsString\n      else\n        sDisplay=sDisplay+\"=\"+sValue.GetClass.GetClassName\n      end\n      \n      lDisplays.Add(sDisplay.Clone)\n      lRemoveKeys.Add(sKey.Clone)\n      i=i+1\n    end\n  \n    sMsgTitle=sTitle+oView.GetName\n    sIn
put=Msgbox.ChoiceAsString(lDisplays,\"Select a Key Remove.\",sMsgTitle)\n    \n    if(sInput.Is(String))then\n      lInputs=sInput.AsTokens(\":\")\n      iIndex=lInputs.Get(0).AsNumber\n      oKey=lRemoveKeys.Get(iIndex)\n      bReturn=dTag.Remove(oKey)\n    else  'If Cancel button is pressed.\n      bReturn=false\n    end\n  \n  end  'if(dTag.Is(Dictionary))\n  \n  return bReturn\n\nend  \n"
)

(Script.223
	Name:	"RAS.FRM.ViewThmTagMgrMenu"
	SourceCode:	"' Name: RAS.FRM.ViewThmTagMgrMenu\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name: RAS.FRM.ViewThmTagMgrMenu \n' USAGE: av.run(\"RAS.FRM.ViewThmTagMgrMenu\",nil) \n' Returns: \n' Description: Manages View/Theme ObjectTag through menu.\n'  Set a Key's value and Remove a Key from the d
Tag (Dictionary ObjectTag) \n'\n' CalledBy: MENU, the MenuItem need to be Tagged (StringTag) with\n'   the REMOVE and SETVALUE Key words.\n' Requires:\n' History: Zye 3/4/99\n' ***************************************************************************\noView=av.GetActiveDoc\nif(oView.Is(View))then\n  iInput=MsgBox.Input(\"0=Set tag value for the active theme\"+nl+\"1=Set tag value for the active View\",Script.The.GetName,\"0\")\n  if(iInput=nil)then\n    Exit\n  else\n    if((iInput<>\"0\") and (iInput<>\"1\"))then\n      Exit\n  
  end\n  end\n  if(iInput=\"0\")then\n    if(SELF.GetTag=\"REMOVE\")then\n      av.run(\"RAS.FRM.ThmTagMgr\",{\"RemoveKey\",oView})\n    else\n      av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValueMenu\",oView})\n    end\n  else\n    if(SELF.GetTag=\"REMOVE\")then\n      av.run(\"RAS.FRM.ViewTagMgr\",{\"RemoveKey\",oView})\n    else   \n      av.run(\"RAS.FRM.ViewTagMgr\",{\"SetValueMenu\",oView})\n    end\n  end  \nend  \n\n\n"
)

(Script.224
	Name:	"RAS.PRE.AttributeXSAll"
	SourceCode:	"' Name: RAS.PRE.AttributeXSAll\n'**************************************************************\n'**************************************************************\n' Name:        RAS.PRE.AttributeXSAll\n' Usage:       from the menu \"XS Attributing\"\n' Returns:     none\n' Description: Attribute the Cut Lines\n'              \n'              Steps:  Reach and River names\n'                      Stations\n'                      Manning's n values \n'                      Banks\n'                      Distance\n'\n' Requireme
nts: XS Cutline theme\n'                Stream Centerline Theme (2D)\n'                Banks theme\n'                Flowpath theme\n'                Landuse poly\n'\n' History:      CTA; 11.5.99 - original\n'**************************************************************\n'will leave theme checks to other scripts for now\n\nmyResult = av.run(\"RAS.PRE.BasicCSAttributes\",{\"NoAlert\"})\nif (myresult.not) then exit\nend\n\nmyResult = av.run(\"RAS.PRE.StationCSAttributes\",{\"NoAlert\"})\nif (myresult.not) then exit\nend\n\nmyResult =
 av.run(\"RAS.PRE.ManningExtract\",{\"NoAlert\"})\nif (myresult.not) then exit\nend\n\nmyResult = av.run(\"RAS.PRE.BankCSAttributes\",{\"NoAlert\"})\nif (myresult.not) then exit\nend\n\nmyResult = av.run(\"RAS.PRE.DistanceCSAttributes\",{\"NoAlert\"})\nif (myresult.not) then exit\nend\n\nreturn nil\n\n"
)

(Script.225
	Name:	"RAS.PRE.BankCSAttributes"
	SourceCode:	"' Name: RAS.PRE.BankCSAttributes\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:          RAS.PRE.BankCSAttributes \n' USAGE:         Called from menu\n' Returns:       true  - when operation terminated successfully\n'                false - failed due to the theme setup (framewo
rk)\n'                nil   - failed in some aspect\n' Description:   Setup parameters for computation of bank\n'                percentages at cross-sections.  The computations\n'                are done in RAS.PRE.CalcBankCSAtt.\n' Calling:       RAS.PRE.CalcBankCSAtt\n' CalledBy:      none\n' Requires:      Framework (RAS.FRM.GetThmsByTagR, etc.)\n' History:       DDJ 2/99\n' ***************************************************************************\n\n'check to see if if the call is summary of singular\n' if it is
 the summary call, we don't want ot alert the\n'user until completion AlertYou=False\nif (self.is(list).Not) then\n  AlertYou = True\n  else \n  if (self.get(0) = \"NoAlert\") then\n    AlertYou = False\n  end\nend\n\n\n'-------------------------------------------------------------------------\n' Setup of working directory, title in the message boxes, and working view\n'-------------------------------------------------------------------------\n\n' Define the parent directory and the working (tmp) subdirectory\nTheProject=av.
GetProject\n' Get the View to work with\noView=av.GetActiveDoc                                 'ViewHandle\n\n'..Set the workDir to BaseMap.\n'av.run(\"RAS.FRM.SetBaseDir\",{oView})\n\n\n' Title for message box for these operations\nsTitle=\"Bank percentage computations\"                 ' title text for message boxes\nbVerify=false                                         ' to force display of theme selection dialog\n\n\n'---------------------------------------------------------------------\n' Setup of required lists for use
 with the framework\n'---------------------------------------------------------------------\n\n' Provide the lists of Tags, ThmTypes, and ShpTypes.\nlTags={\"banks\",\"cross2D\"}                'Tags\nlThmTypes={FTheme,FTheme}                'ThmTypes\nlShpTypes={\"PolyLine\",\"PolyLine\"}        'ShpTypes POLYGON,POLYLINE,POINT,MultiPoint.\n\n\n' Create the Field descriptions of the required fields.  They are all listed in RAS.PRE.GetdFields2\n' script.  This section just loads it from there.  GetdFields2\n' Needs to be ther
e even if none are used.\nlTags1={\"cross2D\"}\ndFields=av.run(\"RAS.PRE.GetdFields2\",{lTags1})\nldFields=List.Make\nfor each sTag in lTags\n  ldFields.Add(dFields.Get(sTag))  \nend\n\n\n' Define the default names.\nlDefNames={\"Banks\",\"CSect\"}            'Default names\n\n' Define the theme purpose type (input/output)\nlPurposes={\"I\",\"I\"}\n\n' Overwrite options when the specified thm exists in the view, lOverWrt guides the operation.\n'For GTheme, 0=OverWrite,1,2=Prompt for a new name because overwrite is not an option.\n'For 
FTheme, 0=Clear, 1=Ask For a new Name, 2=Append.\n'lOverWrts is extented to be used for InputThms (used as the output Thm) as well.\n'if 0 then don't ask for a backup, overwrite the input theme with the output theme.\n'if 1 then ask if a backup should be made.\nlOverWrts={0,0}\n\n  \n' Use the framework to check on the themes and items\n'---------------------------------------------------\ndThms=av.run(\"RAS.FRM.GetThmsByTagR\",{oView,lTags,lThmTypes,lShpTypes,ldFields,lDefNames,lPurposes,lOverWrts,bVerify,sTitle})\nif
(dThms.is(Dictionary))then\n\n  '-----------------------------------------------------------------\n  ' Successfully returned the required themes, so we can do the work\n  '-----------------------------------------------------------------\n  '**          Bank percentage computations start here            **\n\n  BankTag=lTags.Get(0)                                 ' get the centerline tag\n  theBankThemeRet=dThms.Get(BankTag)                   ' get the centerline theme to use\n  theBankFtab = theBankThemeRet.getFTa
b                ' get the centerline FTab\n\n  CSTag=lTags.Get(1)                                     ' get the CS tag\n  theCSThemeRet=dThms.Get(CSTag)                         ' get the CS theme to use\n  theCSFTab = theCSThemeRet.getFTab                      ' get the CS FTab\n\n\n  ' Call RAS.PRE.CalcBankCSAtt to perform the computations\n  '-------------------------------------------------------\n  theRunRet = av.run(\"RAS.PRE.CalcBankCSAtt\",{theCSFTab,theBankFTab})\n  \n  if (theRunRet) then\n      ' successfull e
nd -\n      if (AlertYou) then \n        MsgBox.Info(\"Cross-section bank percentages computed successfully!\",sTitle)\n      end\n    else\n      ' unsuccessfull end - stop editing (since that was not done in the sub)\n      theCSFTab.Flush\n      theCSFTab.SetEditable(FALSE)\n      tMessage = \"Cross-section bank percentages computed UNSUCCESSFULLY!\"\n      tMessage = tMessage + nl + \"The cross-section theme is not valid (but can be used for debugging)!\"\n      MsgBox.Warning(tMessage,sTitle)\n  end\n  \n\n  '**          
  End of Bank percentage computations              **\n  '-----------------------------------------------------------------\n\nelse\n\n  ' Problem in returning from checking the themes\n    sText = \"Problem with input themes.  Operation cancelled\"\n    MsgBox.Warning(sText,sTitle)\n    return false\n    \nend\n\nreturn true\n"
)

(Script.226
	Name:	"RAS.PRE.BasicCSAtt"
	SourceCode:	"' Name: RAS.PRE.BasicCSAtt\n'*****************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'*****************************************************************\n' Name:         RAS.PRE.BasicCSAtt\n' Usage:        av.run(\"RAS.PRE.BasicCSAtt\",{the2DCSFTab,theFlowFTab})\n'   where:      the2DCSFTab - 2D cross-section FTab\n'               theFlowFTab - centerline FTab\n'\n' Returns:      true - suc
essfully assigned Stream_ID and Reach_ID\n'               false - not sucessfully assigned Stream_ID and Reach_ID\n' Description:  Assign to each cross-section Stream_ID and Reach_ID\n'               attributes from the centerline on which the cross-section\n'               resides.\n' Called by:    RAS.PRE.BasicCSAttributes\n'\n' History:      DDJ; 4/22/98\n'               DDJ; 2/99      Modified name.  Modified header.\n'               DM3; 8/99      Added XS_ID value populating\n'**********************************
********************************\n\nthe2DCSFTab = SELF.Get(0)                   ' retreive the cross-section FTab\ntheFlowFTab = SELF.Get(1)                   ' retreive the centerline FTab\n\n\nstrMessageTitle = \"Cross-section stream and reach attributing\"\n\n\n' Define the fields in the 2D CS and flowpaths attribute tables\n'--------------------------------------------------------------\nCSshapeField = the2DCSFTab.FindField(\"Shape\")            ' shape\nCSStreamField = the2DCSFTab.FindField(\"Stream_ID\")       ' stream
 ID\nCSReachField = the2DCSFTab.FindField(\"Reach_ID\")         ' reach ID\nCSXSIDField = the2DCSFTab.FindField(\"XS_ID\")             ' cross section ID\n\nshapeField = theFlowFTab.FindField(\"Shape\")              ' shape\nStreamField = theFlowFTab.FindField(\"Stream_ID\")         ' stream ID\nReachField = theFlowFTab.FindField(\"Reach_ID\")           ' reach ID\n\n\n' Start editing the cross-section FTab\n'-------------------------------------\nthe2DCSFTab.SetEditable(TRUE)\n\n' Initiate the initial and dummy objects\n'--------
-------------------------------\ntheShape = the2DCSFTab.GetShapeClass.MakeNull        ' create a NULL 2D CS shape\ntheFlowShape = theFlowFTab.GetShapeClass.MakeNull    ' create a NULL centerline shape\nthePrj = Prj.MakeNull                                ' create a dummy projection object\n\n\n' Set the initial loop parameters\n'--------------------------------\ntheBitMap = the2DCSFTab.GetSelection                 ' define the CS bitmap to loop through\nif (theBitMap.Count = 0) then                        ' if nothi
ng has been selected - go through all\n    theBitMap.SetAll                                 ' select all records for processing\n    unsetBitmap = TRUE                               ' set the flag to unselect at end of processing\n  else\n    unsetBitmap = FALSE                              ' leave the original selected CS set as it is\nend\n\n\n' Select all the centerlines as potential candidates\n'---------------------------------------------------\ntheFlowBitMap = theFlowFTab.GetSelection             ' get the cen
terline bitmap\ntheFlowBitMap.SetAll                                 ' always use all the centerlines\n\n\nnoOfCSToProcess = theBitMap.Count                    ' define the number of selected CS to process\ncurCount = 0                                         ' set the record counter to zero\n\ndone = FALSE                                         ' define the initial loop condition\noffset = -1                                          ' starting point in the bitmap\n\nav.ShowStopButton                                
    ' show the stop button so you can interrupt the process\ncancelled = FALSE                                    ' define the intital stop button condition\n\n\n'-------------------------------------------------------------\n' Loop through the CS shapes and assign Stream_ID and Reach_ID\n'-------------------------------------------------------------\nwhile (not done)\n  curCount = curCount + 1\n  recNum = theBitMap.GetNextSet(offset)\n  offset = recNum\n  if (recNum <> -1) then                             ' check if 
a valid record\n      ' a valid CS record has been selected\n      ' show the message on what is going on\n\n      av.ShowMsg(\"Processing cross-section at record number: \"+recNum.AsString)  ' display status\n      cancelled = av.SetStatus(curCount/noOfCSToProcess*100).not                 ' display % process bar\n      if (cancelled) then\n        ' the computations have been cancelled.  Stop editing and give a warning\n        av.SetStatus(100)\n        MsgBox.Warning(\"The cross-section attribution terminated by the
 user!\",strMessageTitle)\n        return false                                                             ' exit with false\n      end\n      \n      ' get the CS geometric data and put it in theShape\n'      the2DCSFTab.QueryShape(recNum, thePrj, theShape)\n      theShape = the2DCSFTab.ReturnValue(CSshapeField, recNum)\n\n      ' Find the centerline intersecting the CS shape\n      '----------------------------------------------\n      theFlowBitMap.SetAll                                     ' make sure you test on
 all the centerlines\n      theFlowFTab.SelectByPolyline(theShape,#VTAB_SELTYPE_NEW) ' select the centerline intersecting the CS\n      theFlowBitMap = theFlowFTab.GetSelection                 ' get the selected centerline bitmap\n \n      ' if not exactly one centerline there is an error - give a message and quit\n      if (theFlowBitMap.Count <> 1) then\n        tMessage = \"There is not exactly one centerline intersecting a single cross-section!\"\n        tMessage = tMessage + nl + \"Stream_ID and Reach_ID assign
ment FAILED.\"\n        MsgBox.Warning(tMessage, strMessageTitle)\n        return false                                           ' exit the routine with error\n      end      \n\n      ' get the record number of the intersected centerline element\n      recNumb = theFlowBitMap.GetNextSet(-1)\n\n      ' get the Stream_ID and Reach_ID fields for the intersected record\n      Stream_ID = theFlowFTab.ReturnValue(StreamField, recNumb)         ' get station as ID (number)\n      Reach_ID = theFlowFTab.ReturnValue(ReachFiel
d, recNumb)         ' get station as ID (number)\n\n\n      ' save the stream_ID and reach_ID onto the cross-section theme      \n      the2DCSFTab.SetValue(CSStreamField, recNum, Stream_ID)   ' set the Stream_ID\n      the2DCSFTab.SetValue(CSReachField, recNum, Reach_ID)     ' set the Reach_ID\n      the2DCSFTab.SetValue(CSXSIDField, recNum, recNum)        ' set the XS_ID to some arbitrary number\n      \n    else\n      ' no more records to process (eof)\n      done = TRUE\n  end\nend\n\n\n\n' Clean up\n'-----------\n\n' Sa
ve and stop editing\n'----------------------\nthe2DCSFTab.Flush\nthe2DCSFTab.SetEditable(FALSE)\n\n\nif (unsetBitmap) then                      ' clear the bitmap if necessary\n  theBitmap.ClearAll                       ' unselect everything (since nothing has been selected)\nend\n\ntheFlowBitMap.ClearAll                     ' clear the banks selection\n\n\nav.ClearMsg                                ' clear the message\nav.SetStatus(100)                          ' reset the status bar\n\n\nreturn true\n"
)

(Script.227
	Name:	"RAS.PRE.BasicCSAttributes"
	SourceCode:	"' Name: RAS.PRE.BasicCSAttributes\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:          RAS.PRE.BasicCSAttributes \n' USAGE:         Called from menu\n' Returns:       true  - when operation terminated successfully\n'                false - failed due to the theme setup (frame
work)\n'                nil   - failed in some aspect\n' Description:   Setup parameters for attributing the cross-sections \n'                with Stream_ID and Reach_ID.  The computations\n'                are done in RAS.PRE.BasicCSAtt.\n' Calling:       RAS.PRE.BasicCSAtt\n' CalledBy:      none\n' Requires:      Framework (RAS.FRM.GetThmsByTagR, etc.)\n' History:       DDJ 2/99\n' ***************************************************************************\n'check to see if if the call is summary or singular\n' if 
it is the summary call, we don't want ot alert the\n'user until completion AlertYou=False\nif (self.is(list).Not) then\n  AlertYou = True\n  else \n  if (self.get(0) = \"NoAlert\") then\n    AlertYou = False\n  end\nend\n\n'-------------------------------------------------------------------------\n' Setup of working directory, title in the message boxes, and working view\n'-------------------------------------------------------------------------\n\n' Define the parent directory and the working (tmp) subdirectory\nTheProject
=av.GetProject\n' Get the View to work with\noView=av.GetActiveDoc                                 'ViewHandle\n\n'..Set the workDir to BaseMap.\n'av.run(\"RAS.FRM.SetBaseDir\",{oView})\n\n\n' Title for message box for these operations\nsTitle=\"Cross-section stream and reach attributing\"   ' title text for message boxes\nbVerify=false                                         ' to force display of theme selection dialog\n\n\n'---------------------------------------------------------------------\n' Setup of required lists for
 use with the framework\n'---------------------------------------------------------------------\n\n' Provide the lists of Tags, ThmTypes, and ShpTypes.\nlTags={\"centerline\",\"cross2D\"}           'Tags\nlThmTypes={FTheme,FTheme}                'ThmTypes\nlShpTypes={\"PolyLine\",\"PolyLine\"}        'ShpTypes POLYGON,POLYLINE,POINT,MultiPoint.\n\n\n' Create the Field descriptions of the required fields.  They are all listed in RAS.PRE.GetdFields\n' script.  This section just loads it from there.\n' Needs to be there even if 
none are used.\ndFields=av.run(\"RAS.PRE.GetdFields\",{lTags})\n\nldFields=List.Make\nfor each sTag in lTags\n  ldFields.Add(dFields.Get(sTag)) \nend\n\n\n' Define the default names.\nlDefNames={\"CLine\",\"CSect\"}            'Default names\n\n' Define the theme purpose type (input/output)\nlPurposes={\"I\",\"I\"}\n\n' Overwrite options when the specified thm exists in the view, lOverWrt guides the operation.\n'For GTheme, 0=OverWrite,1,2=Prompt for a new name because overwrite is not an option.\n'For FTheme, 0=Clear, 1=Ask For a ne
w Name, 2=Append.\n'lOverWrts is extented to be used for InputThms (used as the output Thm) as well.\n'if 0 then don't ask for a backup, overwrite the input theme with the output theme.\n'if 1 then ask if a backup should be made.\nlOverWrts={0,0}\n\n  \n' Use the framework to check on the themes and items\n'---------------------------------------------------\ndThms=av.run(\"RAS.FRM.GetThmsByTagR\",{oView,lTags,lThmTypes,lShpTypes,ldFields,lDefNames,lPurposes,lOverWrts,bVerify,sTitle})\nif(dThms.is(Dictionary))then\n\n  '
-----------------------------------------------------------------\n  ' Successfully returned the required themes, so we can do the work\n  '-----------------------------------------------------------------\n  '**  Cross-section stream and reach attributing starts here     **\n\n  CenterTag=lTags.Get(0)                                 ' get the centerline tag\n  the2DCSThemeRet=dThms.Get(CenterTag)                   ' get the centerline theme to use\n  theCLFtab = the2DCSThemeRet.getFTab                    ' get th
e centerline FTab\n\n  CSTag=lTags.Get(1)                                     ' get the CS tag\n  theCSThemeRet=dThms.Get(CSTag)                         ' get the CS theme to use\n  theCSFTab = theCSThemeRet.getFTab                      ' get the CS FTab\n\n\n  ' Call RAS.PRE.BasicCSAtt to perform the computations\n  '-----------------------------------------------------\n  theRunRet = av.run(\"RAS.PRE.BasicCSAtt\",{theCSFTab,theCLFTab})\n  \n  if (theRunRet) then\n      ' successfull end -\n      'don't tell the user if 
the process is done in summary AlertYou=False if summary call\n    if (AlertYou) then \n        MsgBox.Info(\"Stream_ID and Reach_ID successfully assigned to cross-sections!\",sTitle)\n    end \n    else\n      ' unsuccessfull end - stop editing (since that was not done in the sub)\n      theCSFTab.Flush\n      theCSFTab.SetEditable(FALSE)\n      tMessage = \"Assignment of Stream_ID and Reach_ID to cross-sections UNSUCCESSFULL!\"\n      tMessage = tMessage + nl + \"The cross-section theme is not valid (but can be used fo
r debugging)!\"\n      MsgBox.Warning(tMessage,sTitle)\n  end\n \n  '**     End of Cross-section stream and reach attributing       **\n  '-----------------------------------------------------------------\n\nelse\n\n  ' Problem in returning from checking the themes\n    sText = \"Problem with input themes.  Operation cancelled\"\n    MsgBox.Warning(sText,sTitle)\n    return false\n    \nend\n\nreturn true\n\n"
)

(Script.228
	Name:	"RAS.PRE.Build3DCLtoRASout"
	SourceCode:	"' Name: RAS.PRE.Build3DCLtoRASout\n'******************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'******************************************************************\n' Name:         RAS.PRE.Build3DCLtoRASout\n' USAGE:        av.run(\"RAS.PRE.BuildCLTopo\",{RasOutFile, 3DCLFTab})\n'   where:      RasOutFile - Name of the RAS GIS output file in which\n'                            to store the 
data (ASCII)\n'               3DCLFTab - 3D stream centerline theme FTab (for x,y,z coordinates)\n' Returns:      true - sucessfully created the ASCII file\n'               false - ASCII file not created sucessfully\n' Description:  Export the centerline information stored in a\n'               3D centerline theme into RAS GIS format.  This\n'               deals with centerline data only.  The cross-section and\n'               header component are generated elsewhere.\n' Called by:    RAS.PRE.Extract3DCL\n'\n' Hist
ory:      DDJ; 4/28/98.   Coded as avras.Build3DCLtoRASout\n'               DDJ; 2/99.      Modified name and header.\n'\n' Comment:      X,Y,Z export based largely on the 3DtoGenerate routine\n'               developed by software development.\n'******************************************************************\n\ntheRasOutName = SELF.Get(0)                 ' retreive the RAS out ASCII file name\ntheFTab = SELF.Get(1)                       ' retreive the 3D centerline theme FTab\n\n\nstrMessageTitle = \"Extracting str
eam centerline\"\n\n' All the checking for the theme is done in the calling script, so we\n' can just do the work here.\n\n\n' Define the 3D centerline theme to use\n'-----------------------------------------\ntheTheme = FTheme.Make(theFTab)                      ' specify the CL theme\n\n\n' Initiate the initial and dummy objects\n'---------------------------------------\ntheShape = theFTab.GetShapeClass.MakeNull            ' create a NULL 3D shape\ntheClass = theFTab.GetShapeClass.GetClassName        ' get the themes cla
ss name\nthePrj = Prj.MakeNull                                ' create a dummy project object\ntheOldFormat = Number.GetDefFormat                   ' get the current number format\nNumber.SetDefFormat(\"d.ddd\")                         ' specify 3 decimal places for floats\nnodeList = {}                                        ' create an empty list for node collection\n\n' Define the fields in the 3D CL attribute table to be exported\n'--------------------------------------------------------------\nshapeField = theFT
ab.FindField(\"Shape\")              ' shape\nstreamField = theFTab.FindField(\"Stream_ID\")         ' stream ID\nreachField = theFTab.FindField(\"Reach_ID\")           ' reach ID\nfrom_STField = theFTab.FindField(\"from_ST\")          ' from station\nto_STField = theFTab.FindField(\"to_ST\")              ' to station\nfrom_NField = theFTab.FindField(\"from_Node\")         ' from node\nto_NField = theFTab.FindField(\"to_Node\")             ' to node\nis_OutletField = theFTab.FindField(\"is_Outlet\")      ' is Outlet indicator\nALF
ield = theFTab.FindField(\"ArcLength\")             ' arc length for station computation\n\n\n' Specify the file to use to store the data.  If the file with\n' that name already exists, append to it.  Otherwise, create the\n' file (#FILE_PERM_APPEND will take care of that).\n'----------------------------------------------------------------\ngenFN = theRasOutName.AsFileName                     ' assign the file name\ngenFile = LineFile.Make(genFN, #FILE_PERM_APPEND)    ' open the file with append\n\n\n' Set the loop thro
ugh all the centerline arcs\n'------------------------------------------------\n' get all the records that identify the outlet arc for each stream\ntheBitMap = theFTab.GetSelection                     ' initialize the selection bitmap\ntheBitMap.SetAll                                     ' set all the arcs\n\nnoOfCLToProcess = theBitMap.Count                    ' define the number of selected CL outlets to process\ncurCount = 0                                         ' set the record counter to zero\n\nav.ShowStopBu
tton                                    ' show the stop button so you can interrupt the process\ncancelled = FALSE                                    ' define the intital stop button condition\n\ngenFile.WriteElt(\"\")\ngenFile.WriteElt(\"BEGIN STREAM NETWORK:\")            ' write to the file the centerline header\ngenFile.WriteElt(\"\")\n\n\n'--------------------------------------------------------------\n' Loop through the shapes and do the export - end nodes only.\n'-----------------------------------------------------
---------\nav.ShowMsg(\"Exporting end point coordinates\")        ' display status\n\nfor each recNum in theBitMap\n\n  curCount = curCount + 1                            ' increase the arc counter\n  ' extract the arc info\n  streamID = theFTab.ReturnValue(streamField, recNum)\n  reachID = theFTab.ReturnValue(reachField, recNum)\n  fromN = theFTab.ReturnValueNumber(from_NField, recNum)\n  toN = theFTab.ReturnValueNumber(to_NField, recNum)\n'  theFTab.QueryShape(recNum, thePrj, theShape)       ' get the shape\n  theShape
 = theFTab.ReturnValue(shapeField, recNum) ' get the shape\n\n  ' show the message on what is going on\n  av.ShowMsg(\"Extracting endpoints for Station_ID: \"+streamID+\", Reach_ID: \"+reachID)   ' display status\n  cancelled = av.SetStatus(curCount/noOfCLToProcess*100).not              ' display % process bar\n  if (cancelled) then\n    ' the export has been cancelled.  Close the file and give a warning\n    av.ClearMsg                                                           ' clear the message\n    av.SetStatus(100
)\n    genFile.Close                                                         ' close the ASCII file\n    MsgBox.Warning(\"The 3D centerline export terminated by the user!\",strMessageTitle)\n    return false                                                          ' exit with false\n  end\n\n  ' form the point list\n  partList = theShape.AsList                         ' get the list of 2D shape components (one only)\n  thePart = partList.Get(0)                          ' get the first part (line) in the shape\n  noOfP
oints = thePart.Count                         ' define the number of points in the shape\n\n  ' check if the from node of the current arc is in the nodeList\n  if (nodeList.FindByValue(fromN) = -1) then\n    ' this node is not in the list yet - export the x,y,z,ID, and add to the list\n    thePt = thePart.Get(0)                             ' get the upstream point (from node)\n    x = thePt.GetX.AsString\n    y = thePt.GetY.AsString\n    z = thePt.GetZ.AsString\n  \n    theWriteString = \"  ENDPOINT: \"                
    ' define the initial endpoint line text\n    theWriteString = theWriteString+x+\", \"+y+\", \"+z+\", \"+fromN.SetFormat(\"d\").AsString   ' define endpoint data\n    genFile.WriteElt(theWriteString)\n\n    nodeList.Add(fromN)\n  end\n\n  ' check if the to node of the current arc is in the nodeList\n  if (nodeList.FindByValue(toN) = -1) then\n    ' this node is not in the list yet - export the x,y,z,ID, and add to the list\n    thePt = thePart.Get(noOfPoints-1)                  ' get the downstream point (to node)\n    x =
 thePt.GetX.AsString\n    y = thePt.GetY.AsString\n    z = thePt.GetZ.AsString\n  \n    theWriteString = \"  ENDPOINT: \"                    ' define the initial endpoint line text\n    theWriteString = theWriteString+x+\", \"+y+\", \"+z+\", \"+toN.SetFormat(\"d\").AsString   ' define endpoint data\n    genFile.WriteElt(theWriteString)\n\n    nodeList.Add(toN)\n  end\n\nend                                                  ' end loop through the centerline arcs\n'-------------------------------------------------------------------
-----------------------------\n\n\n'-------------------------------------------------------------------\n' Loop through the shapes and do the export - individual reach data\n'-------------------------------------------------------------------\nav.ShowMsg(\"Exporting reach data\")                   ' display status\ncurCount = 0                                         ' set the record counter to zero\n\nfor each recNum in theBitMap\n\n  curCount = curCount + 1                            ' increase the arc counter\n  ' ext
ract the arc info\n  streamID = theFTab.ReturnValue(streamField, recNum)\n  reachID = theFTab.ReturnValue(reachField, recNum)\n  fromST = theFTab.ReturnValueNumber(from_STField, recNum)\n  toST = theFTab.ReturnValueNumber(to_STField, recNum)\n  fromN = theFTab.ReturnValueNumber(from_NField, recNum)\n  toN = theFTab.ReturnValueNumber(to_NField, recNum)\n  theLength = theFTab.ReturnValueNumber(ALField, recNum).AsString\n'  theFTab.QueryShape(recNum, thePrj, theShape)       ' get the shape\n  theShape = theFTab.ReturnV
alue(shapeField, recNum) ' get the shape\n\n  ' show the message on what is going on\n  av.ShowMsg(\"Extracting data for Station_ID: \"+streamID+\", Reach_ID: \"+reachID)   ' display status\n  cancelled = av.SetStatus(curCount/noOfCLToProcess*100).not              ' display % process bar\n  if (cancelled) then\n    ' the export has been cancelled.  Close the file and give a warning\n    av.ClearMsg                                                           ' clear the message\n    av.SetStatus(100)\n    genFile.Close    
                                                     ' close the ASCII file\n    MsgBox.Warning(\"The 3D centerline export terminated by the user!\",strMessageTitle)\n    return false                                                          ' exit with false\n  end\n\n  ' write out the reach header\n  '---------------------------\n  genFile.WriteElt(\"\")\n  genFile.WriteElt(\"  REACH:\")\n  theWriteString = \"    STREAM ID: \"+streamID        ' define the stream ID line\n  genFile.WriteElt(theWriteString)\n  theWriteString =
 \"    REACH ID: \"+reachID          ' define the reach ID line\n  genFile.WriteElt(theWriteString)\n  theWriteString = \"    FROM POINT: \"+fromN.SetFormat(\"d\").AsString ' define the from node line\n  genFile.WriteElt(theWriteString)\n  theWriteString = \"    TO POINT: \"+toN.SetFormat(\"d\").AsString     ' define the to node line\n  genFile.WriteElt(theWriteString)\n\n  ' export the 3D line (centerline)\n  '----------------------------------\n  genFile.WriteElt(\"    CENTERLINE:\")              ' write the beginning of surf
ace line\n\n  ' form the part list\n  partList = theShape.AsList                       ' get the list of shape components (one only)\n\n  if (partList.Count > 1) then                     ' test if there is more than one part\n    ' more than one part.  The 3D reach is not in one piece.  Error!!!\n    av.SetStatus(100)\n    genFile.Close                                  ' close the ASCII file\n    MsgBox.Warning(\"DATA ERROR - The 3D reach has more than one segment!\",strMessageTitle)\n    return false                  
                 ' return with error\n  end\n  \n  for each i in 0 .. (partList.Count - 1)          ' unneccessary loop since we know there\n                                                   ' is only one part - kept for generality\n    thePart = partList.Get(i)\n    for each j in 0 .. (thePart.Count - 1)         ' loop through points\n      thePt = thePart.Get(j)\n      x = thePt.GetX.AsString\n      y = thePt.GetY.AsString\n      z = thePt.GetZ.AsString\n      pntPer = theShape.PointPosition(thePt)       ' find per
centage location along reach\n      compST = toST - ((toST-fromST)/100*pntPer)   ' compute the station by linear interpolation\n\n      thePTStr = x + \", \" + y + \", \" + z + \", \" + compST.AsString\n\n      theWriteString = \"      \"+thePTStr           ' pad the leading blanks\n      genFile.WriteElt(theWriteString)\n      genFile.GotoEnd                              ' make sure it is at the end of file \n    end                                            ' end of loop through points\n    \n    genFile.WriteElt(\"  END:\"
)                     ' write out the end of individual reach\n  end                                              ' end of loop through parts\n\nend                                                ' end of reach data output\n'----------------------------------------------------------------------------\n\ngenFile.WriteElt(\"\")\ngenFile.WriteElt(\"END STREAM NETWORK:\")            ' write to the file the end of stream network section\ngenFile.WriteElt(\"\")\n\n\n' Clean up\n'-----------\n\nif (theOldFormat = nil) then\n    ' use 
default formatting\n    Number.SetDefFormat(\"\")                ' restore default number format\n  else\n    Number.SetDefFormat(theOldFormat)      ' restore the old number format\nend\n\ntheBitmap.ClearAll                         ' unselect everything\n\nav.ClearMsg                                ' clear the message\nav.SetStatus(100)                          ' reset the status bar\ngenFile.Close                              ' close the ASCII file\n\nreturn true\n\n\n"
)

(Script.229
	Name:	"RAS.PRE.Build3DCStoRASout"
	SourceCode:	"' Name: RAS.PRE.Build3DCStoRASout\n'*****************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'*****************************************************************\n' Name:         RAS.PRE.Build3DCStoRASout\n' USAGE:        av.run(\"RAS.PRE.Build3DCStoRASout\",{RasOutFile, 2DCSTheme, 3DCSTheme})\n'   where:      RasOutFile - Name of the RAS GIS output file in which\n'                         
   to store the data (ASCII)\n'               2DCSTheme - 2D cross-section theme name (for cut lines)\n'               3DCSTheme - 3D cross-section theme name (for x,y,z coordinates)\n' Returns:      true - sucessfully created the ASCII file\n'               false - ASCII file not created sucessfully\n' Description:  Export the cross-section information stored in a\n'               3D cross-section theme into RAS GIS format.  This\n'               deals with cross-section data only.  The reach and\n'               
header component are generated elsewhere.\n' Called by:    RAS.PRE.Extract3DCS\n'\n' History:      DDJ; 4/15/98 - original coding\n'               DDJ; 8/3/98 - fix for duplicated points (based on Nan Shi's comments)\n'                             fix for more than 500 points (not implemented)\n'               DDJ; 2/99.      Modified name and header.\n'\n' Comment:      X,Y,Z export based largely on the 3DtoGenerate routine\n'               developed by software development.\n'***************************************
***************************\n\ntheRasOutName = SELF.Get(0)                 ' retreive the RAS out ASCII file name\nthe2DFTab = SELF.Get(1)                     ' retreive the 2D cross-section theme FTab\ntheFTab = SELF.Get(2)                       ' retreive the 3D cross-section theme FTab\n\nstrMessageTitle = \"Extracting cross-sections\"\n\n' All the checking for the theme is done in the calling script, so we\n' can just do the work here.\n\n\n' Define the 2D & 3D cross-section themes to use\n'---------------------------
--------------------\nthe2DTheme = FTheme.Make(the2DFTab)                  ' specify the 2D CS theme\ntheTheme = FTheme.Make(theFTab)                      ' specify the 3D CS theme\n\n\n' Initiate the initial and dummy objects\n'---------------------------------------\ntheShape = theFTab.GetShapeClass.MakeNull            ' create a NULL 3D shape\nthe2DShape = the2DFTab.GetShapeClass.MakeNull        ' create a NULL 2D shape\ntheClass = theFTab.GetShapeClass.GetClassName        ' get the themes class name\nthePrj = Prj
.MakeNull                                ' create a dummy project object\ntheOldFormat = Number.GetDefFormat                   ' get the current number format\nNumber.SetDefFormat(\"d.ddd\")                         ' specify 3 decimal places for floats\n\n\n' Define the fields in the 3D CS attribute table to be exported\n' (it is possible that some of the fields will not be there,\n' so we need to skip them during the export if non-existent)\n'--------------------------------------------------------------\nshapeField 
= theFTab.FindField(\"Shape\")              ' shape\nstationField = theFTab.FindField(\"Station\")          ' station\nstreamIdField = theFTab.FindField(\"Stream_ID\")       ' stream ID\nreachIdField = theFTab.FindField(\"Reach_ID\")         ' reach ID\nLBPField = theFTab.FindField(\"L_BankP\")              ' left bank percentage\nRBPField = theFTab.FindField(\"R_BankP\")              ' right bank percentage\nLRLField = theFTab.FindField(\"L_ReachL\")             ' left reach length\nRRLField = theFTab.FindField(\"R_ReachL\")    
         ' right reach length\nMRLField = theFTab.FindField(\"M_ReachL\")             ' middle reach length\nXSIDField = theFTab.FindField(\"Xs_id\")               ' cross sec ID (for Manning)\n\n' Define the shape field in the 2D CS attribute table to be exported\nshape2DField = the2DFTab.FindField(\"Shape\")          ' 2D shape field\n\n' Locate the Manning's n data table\n' ---------------------------------\ntheNdoc = av.FindDoc(\"Manning\")\nif (theNdoc <> nil) then\n  theNtable = theNdoc.GetVTab\n  theXSfield = theNtable.
FindField(\"Xs_id\")\n  theNfield = theNtable.FindField(\"N_value\")\n  theFractField = theNtable.FindField(\"Fraction\")\n  \n  ' Read them in to a dictionary\n  ' ----------------------------\n  nvalueDict = Dictionary.Make( 100)\n  for each r in theNtable\n    xsID = theNtable.ReturnValue( theXSfield, r)\n    fract = theNtable.ReturnValue( theFractField, r)\n    n = theNtable.ReturnValueNumber( theNField, r)\n    if (n.IsNull) then\n      n = 0                                         ' handle cases where no N value was as
signed\n    end     \n\n    lst = nValueDict.Get( xsID)\n    if (lst = nil) then                             ' add a xs key to the dictionary\n      lst = { {fract, n} }\n      nValueDict.Set( xsID, lst)\n    else\n      lst.Add( {fract,n})                           ' xs was already there; add another fraction\n    end\n  end\nelse\n  nvalueDict = nil\nend\n\n\n' Specify the file to use to store the data.  If the file with\n' that name already exists, append to it.  Otherwise, create the\n' file (#FILE_PERM_APPEND will take 
care of that).\n'----------------------------------------------------------------\ngenFN = theRasOutName.AsFileName                     ' assign the file name\ngenFile = LineFile.Make(genFN, #FILE_PERM_APPEND)    ' open the file with append\n\n\n' Set the initial loop parameters\n'--------------------------------\ntheBitMap = theFTab.GetSelection                     ' define the bitmap to loop through\nif (theBitMap.Count = 0) then                        ' if nothing has been selected - go through all\n    theBitMap.
SetAll                                 ' select all records for processing\n    unsetBitmap = TRUE                               ' set the flag to unselect at end of processing\n  else\n    unsetBitmap = FALSE                              ' leave the original selected CS set as it is\nend\n\nnoOfCSToProcess = theBitMap.Count                    ' define the number of selected CS to process\ncurCount = 0                                         ' set the record counter to zero\n\ndone = FALSE                           
              ' define the initial loop condition\noffset = -1                                          ' starting point in the bitmap\n\nav.ShowStopButton                                    ' show the stop button so you can interrupt the process\ncancelled = FALSE                                    ' define the intital stop button condition\n\ngenFile.WriteElt(\"\")\ngenFile.WriteElt(\"BEGIN CROSS-SECTIONS:\")            ' write to the file the cross-section header\ngenFile.WriteElt(\"\")\n\n' Loop through the shapes and 
do the export\n'------------------------------------------\nwhile (not done)\n  curCount = curCount + 1\n  recNum = theBitMap.GetNextSet(offset)\n  offset = recNum\n  if (recNum <> -1) then                             ' check if a valid record\n      ' a valid record has been selected - extract the info\n      ' get the attribute data & show the message on what is going on\n      statID = theFTab.ReturnValueNumber(stationField, recNum)             ' get station as ID (number)\n      station = statID.AsString         
                                   ' convert to a string\n\n      av.ShowMsg(\"Extracting cross-section at station: \"+station)          ' display status\n      cancelled = av.SetStatus(curCount/noOfCSToProcess*100).not          ' display % process bar\n      if (cancelled) then\n        ' the export has been cancelled.  Close the file and give a warning\n        av.ClearMsg                                                        ' clear the message\n        av.SetStatus(100)\n        genFile.Close                    
                                  ' close the ASCII file\n        MsgBox.Warning(\"The 3D cross-section export terminated by the user!\",strMessageTitle)\n        return false                                                       ' exit with false\n      end\n      \n      streamID = theFTab.ReturnValue(streamIdField, recNum)\n      reachID = theFTab.ReturnValue(reachIdField, recNum)\n      'to all of the following 6 add\n      'if (lbp <> nil) then\n      'and Initialize variables\n      lbp = nil\n      rbp = nil\n    
  lrl = nil\n      rrl = nil\n      mrl = nil\n\n      if (lbpfield <> nil) then lbp = theFTab.ReturnValueNumber(LBPField, recNum).AsString end\n      if (rbpfield <> nil) then rbp = theFTab.ReturnValueNumber(RBPField, recNum).AsString end\n      if (lrlfield <> nil) then lrl = theFTab.ReturnValueNumber(LRLField, recNum).AsString end\n      if (rrlfield <> nil) then rrl = theFTab.ReturnValueNumber(RRLField, recNum).AsString end\n      if (mrlfield <> nil) then mrl = theFTab.ReturnValueNumber(MRLField, recNum).AsStr
ing end\n\n      ' get the geometric data and put it in theShape\n'      theFTab.QueryShape(recNum, thePrj, theShape)\n      theShape = theFTab.ReturnValue(shapeField, recNum)\n\n      ' write out the cross-section header\n      genFile.WriteElt(\"  CROSS-SECTION:\")\n      theWriteString = \"    STREAM ID: \"+streamID      ' define the stream ID line\n      genFile.WriteElt(theWriteString)\n      theWriteString = \"    REACH ID: \"+reachID        ' define the reach ID line\n      genFile.WriteElt(theWriteString)\n      theW
riteString = \"    STATION: \"+station         ' define the station line\n      genFile.WriteElt(theWriteString)\n\n      theWriteString = \"    BANK POSITIONS: \"          ' define the bank line\n      if ((lbp <> nil) and (rbp <> nil)) then          ' check if the bank info is there\n        theWriteString = theWriteString+lbp+\", \"+rbp   ' define additional bank line\n      end\n      genFile.WriteElt(theWriteString)\n\n      theWriteString = \"    REACH LENGTHS: \"                    ' define the reach length line\n    
  if ((lrl <> nil) and (rrl <> nil) and (mrl <> nil)) then        ' check if the reach length info is there\n        theWriteString = theWriteString+lrl+\", \"+mrl+\", \"+rrl   ' define additional reach length line\n      end\n      genFile.WriteElt(theWriteString)\n\n      ' Export Manning's N value field (if available)\n      ' ---------------------------------------------\n      if (nvalueDict <> nil) then\n        xsID = theFTab.ReturnValue( xsIDfield, recNum)\n        lstNvals = nvalueDict.Get( xsID)               
' this is a list of 2-element lists\n        if ((lstNvals <> nil) and (lstNvals.Count > 0)) then\n          genFile.WriteElt( \"    NVALUES:\")\n          for each l in lstNvals\n            theFract = l.Get(0)\n            theFract.SetFormat( \".dd\")\n            theNval = l.Get(1)\n            theNval.SetFormat( \".ddd\")\n            \n            genFile.WriteElt( \"      \" + theFract.AsString + \",\" + theNval.AsString)\n          end\n        end\n      end\n\n      ' export the 2D line (cut line)\n      '-----------------
-------------\n      theShapeList = {}                                ' create an empty list\n      theShapeList.Add(theShape)                       ' add to the list the selected 3D shape\n      \n      ' select the 2D CS correponding to the selected 3D CS\n      the2DFTab.SelectByShapes(theShapeList,#VTAB_SELTYPE_NEW)\n      the2DBitMap = the2DFTab.GetSelection             ' define the 2D bitmap to loop through\n      if (the2DBitMap.Count = 0) then\n        ' there is no 2D shape that corresponds to the 3D one -
 we have a problem\n        av.SetStatus(100)\n        genFile.Close                                                      ' close the ASCII file\n        MsgBox.Warning(\"There is not a matching 2D cross-section to the 3D one\",strMessageTitle)\n        return false                                   ' exit the routine with error\n      end\n\n      rec2DNum = the2DBitMap.GetNextSet(-1)                      ' identify the first (and only) selected record\n      the2DShape = the2DFTab.ReturnValue(shape2DField,rec2DNum)
  ' get the shape\n\n      genFile.WriteElt(\"    CUT LINE:\")                ' write the beginning of cut line\n\n      ' write out the cut line co-ordinates\n      partList = the2DShape.AsList                     ' get the list of 2D shape components\n\n      for each i in 0 .. (partList.Count - 1)          ' for each component\n        thePart = partList.Get(i)                      ' get the list of (x,y)s for each component\n        for each j in 0 .. (thePart.Count - 1)         ' for each point \n          thePt =
 thePart.Get(j)\n          x = thePt.GetX.AsString\n          y = thePt.GetY.AsString\n          thePTStr = x + \", \" + y\n  \n          theWriteString = \"      \"+thePTStr          ' pad the leading blanks\n          genFile.WriteElt(theWriteString)\n        end\n      end\n\n      the2DBitMap.ClearAll                            ' clear selection on 2D cross-section\n      \n      ' export the 3D line (surface line)\n      '----------------------------------\n      genFile.WriteElt(\"    SURFACE LINE:\")            ' write 
the beginning of surface line\n\n      ' write out the surface line co-ordinates\n      partList = theShape.AsList                       ' define cross-section parts as a list\n      \n      if (partList.Count > 1) then                     ' test if there is more than one part\n        ' more than one part.  The 3D cross-section is not in one piece.  Error!!!\n        av.SetStatus(100)\n        genFile.Close                                  ' close the ASCII file\n        MsgBox.Warning(\"DATA ERROR - The 3D cross-se
ction has more than one segment!\",strMessageTitle)\n        return false                                   ' return with error\n      end\n\n      \n      for each i in 0 .. (partList.Count - 1)          ' loop through shape parts (only one)\n        ' initial point coordinates for overlap check\n        prevX = 0.0\n        prevY = 0.0\n        prevZ = 0.0\n        thePart = partList.Get(i)\n        \n        for each j in 0 .. (thePart.Count - 1)         ' loop through the points in the shape part\n          thePt = t
hePart.Get(j)\n          currX = thePt.GetX                           ' X coordinate of the point\n          currY = thePt.GetY                           ' Y coordinate of the point\n          currZ = thePt.GetZ                           ' Z coordinate of the point\n          \n          ' find the distance between the previous and current point to see if they are overlapping\n'''''''''''''''''' this is the tolerance between elevation points???\n          dl = (((prevX - currX)^2)+((prevY - currY)^2)+((prevZ - cur
rZ)^2)).Sqrt          \n          if (dl > 0.01) then\n            ' distance between the points (x,y,z) large enough to save them\n            x = thePt.GetX.AsString\n            y = thePt.GetY.AsString\n            z = thePt.GetZ.AsString\n            thePTStr = x + \", \" + y + \", \" + z\n    \n            theWriteString = \"      \"+thePTStr           ' pad the leading blanks\n            genFile.WriteElt(theWriteString)\n            genFile.GotoEnd                              ' make sure it is at the end of file \n 
         end\n\n          prevX = currX\n          prevY = currY\n          prevZ = currZ\n\n        end                                            ' end of looping through points\n        \n        genFile.WriteElt(\"  END:\")                     ' write out the end of individual cross-section\n        genFile.WriteElt(\"\")\n      end                                              ' end of looping through shape parts\n    else\n      ' no more records to process (eof)\n      done = TRUE\n  end\nend\n\ngenFile.WriteElt(\"END CROS
S-SECTIONS:\")            ' write to the file the end of cross-section section\ngenFile.WriteElt(\"\")\n\n\n' Clean up\n'-----------\n\nif (theOldFormat = nil) then\n    ' use default formatting\n    Number.SetDefFormat(\"\")                ' restore default number format\n  else\n    Number.SetDefFormat(theOldFormat)      ' restore the old number format\nend\n\nif (unsetBitmap) then                      ' clear the bitmap if necessary\n  theBitmap.ClearAll                       ' unselect everything (since nothing has been se
lected)\nend\n\nav.ClearMsg                                ' clear the message\nav.SetStatus(100)                          ' reset the status bar\ngenFile.Close                              ' close the ASCII file\n\nreturn true\n\n\n\n"
)

(Script.230
	Name:	"RAS.PRE.BuildCLTopo"
	SourceCode:	"' Name: RAS.PRE.BuildCLTopo\n'*****************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'*****************************************************************\n' Name:         RAS.PRE.BuildCLTopo\n' USAGE:        av.run(\"RAS.PRE.BuildCLTopo\",{theFTab})\n'    where:     theFTab - Centerline FTab\n'        \n' Returns:      true - sucessfully computed the arc topology\n'               false - no
t sucessfull in computations of arc topology\n' Description:  Define for each arc the from/to node topology and store \n'               it in the shape file.\n' Assumptions:  The arcs are pointing downstream, and are connected.\n'               Each arc is made of only one part (arc).\n' Called by:    RAS.PRE.CLTopo\n'\n' History:      DDJ; 4/28/98.  Based heavily on the algorithm developed\n'                              for TNC (ZY).\n'               DDJ; 2/99.     Modified name.  Modified header.\n'\n'*************
*****************************************************\n\ntheFTab = SELF.Get(0)                   ' retreive the centerline FTab\n\nstrMessageTitle = \"Stream centerline topology definition\"\n\n\n' Define the fields of interest in the CL attribute table\n'--------------------------------------------------------------\nFNodeFld=theFTab.FindField(\"from_Node\")          ' from node field\nTNodeFld=theFTab.FindField(\"to_Node\")            ' to node field\nShpFld=theFTab.FindField(\"Shape\")                ' the shape\n\n\n' Start 
editing the centerline FTab\n'-------------------------------------\ntheFTab.SetEditable(TRUE)\n\n\n' Setup the initial list and elelments\n'--------------------------------------\nNodeList=List.Make\nnFNode=nil\nnTNode=nil\nnCurrent=0\nav.ShowStopButton\nnLines=theFTab.GetNumRecords\n\n\n' Start processing the arcs (TNC code)\n'-------------------------------------\nfor each rec in theFTab\n  av.ShowMsg(\"Generating from/to node topology for arc: \"+rec.AsString)\n  bStop=av.setStatus(rec/nLines*100).not\n  if(bStop)then\n    th
eFTab.SetEditable(false)\n    exit\n  end\n  \n  ShpV=theFTab.ReturnValue(ShpFld,rec)\n  lPnts=ShpV.AsMultiPoint.AsList\n  nPnts=lPnts.Count\n  if(nPnts<2)then\n    continue\n  end\n  oPnt0=lPnts.Get(0)\n  oPntn=lPnts.Get(nPnts-1)\n  nCurrent=NodeList.Count\n  \n  if(NodeList.IsEmpty)then\n    NodeList.Add(oPnt0.Clone)\n    nFNode=1\n    NodeList.Add(oPntn.Clone)\n    nTNode=2\n  else\n    nFNode=nil\n    nTNode=nil\n    for each i in 0..(nCurrent-1)\n      oPnt=NodeList.Get(i)\n      if(nFNode=nil)then\n        if(oPnt.Intersects(
oPnt0))then\n          nFNode=(i+1).Clone\n        end\n      end  \n      if(nTNode=nil)then\n        if(oPnt.Intersects(oPntn))then\n          nTNode=(i+1).Clone\n        end\n      end\n      if((nFNode<>nil) and (nTNode<>nil))then\n        break\n      end\n    end\n    if(nFNode=nil)then\n      NodeList.Add(oPnt0.Clone)\n      nFNode=NodeList.Count\n    end\n    if(nTNode=nil)then\n      NodeList.Add(oPntn.Clone)\n      nTNode=NodeList.Count\n    end  \n  end\n  theFTab.SetValue(FNodeFld,rec,nFNode.Clone)\n  theFTab.SetValue
(TNodeFld,rec,nTNode.Clone)\nend   \nav.setStatus(100)\ntheFTab.SetEditable(false)\n\n\nreturn true\n"
)

(Script.231
	Name:	"RAS.PRE.CalcBankCSAtt"
	SourceCode:	"' Name: RAS.PRE.CalcBankCSAtt\n'*****************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'*****************************************************************\n' Name:         RAS.PRE.CalcBankCSAtt\n' Usage:        av.run(\"RAS.PRE.CalcBankCSAtt\",{the2DCSFTab,theBankFTab}\n'   where:      the2DCSFTab - 2D cross-section FTab\n'               theBankFTab - banks FTab\n'\n' Returns:      true - 
sucessfully computed the bank percentage\n'               false - not sucessfull computation og bank percentages\n' Description:  Compute for each cross-section the percentage of\n'               cross-section length the intersection with left and\n'               right bank.  It is assumed that the first intersection \n'               is the left bank and the other the right bank.\n' Called by:    RAS.PRE.BankCSAttributes\n'\n' History:      DDJ; 4/18/98\n'               DDJ; 2/99      Modified name and header.\n'\n'
******************************************************************\n\nthe2DCSFTab = SELF.Get(0)                   ' retreive the cross-section FTab\ntheBankFTab = SELF.Get(1)                   ' retreive the bank FTab\n\n\nstrMessageTitle = \"Bank percentage computations\"\n\n\n' Define the fields in the 2D CS and banks attribute tables\n'--------------------------------------------------------------\nshapeField = the2DCSFTab.FindField(\"Shape\")          ' 2D CS shape\nstationField = the2DCSFTab.FindField(\"Station\")      
' station\nLBPField = the2DCSFTab.FindField(\"L_BankP\")          ' left bank percentage\nRBPField = the2DCSFTab.FindField(\"R_BankP\")          ' right bank percentage\nshapeBankField = theBankFTab.FindField(\"Shape\")      ' bank shape\n\n\n' Start editing the cross-section FTab\n'-------------------------------------\nthe2DCSFTab.SetEditable(TRUE)\n\n' Initiate the initial and dummy objects\n'---------------------------------------\ntheShape = the2DCSFTab.GetShapeClass.MakeNull        ' create a NULL 2D CS shape\ntheBankSh
ape = theBankFTab.GetShapeClass.MakeNull    ' create a NULL 2D bank shape\nthePrj = Prj.MakeNull                                ' create a dummy projection object\ntheOldFormat = Number.GetDefFormat                   ' get the current number format\nNumber.SetDefFormat(\"d.dddd\")                        ' specify 4 decimal places for floats\n\n\n' Set the initial loop parameters\n'--------------------------------\ntheBitMap = the2DCSFTab.GetSelection                 ' define the CS bitmap to loop through\nif (theBitMa
p.Count = 0) then                        ' if nothing has been selected - go through all\n    theBitMap.SetAll                                 ' select all records for processing\n    unsetBitmap = TRUE                               ' set the flag to unselect at end of processing\n  else\n    unsetBitmap = FALSE                              ' leave the original selected CS set as it is\nend\n\ntheBankBitMap = theBankFTab.GetSelection             ' get the banks bitmap\ntheBankBitMap.SetAll                          
       ' always use all the banks\n\nnoOfCSToProcess = theBitMap.Count                    ' define the number of selected CS to process\ncurCount = 0                                         ' set the record counter to zero\n\ndone = FALSE                                         ' define the initial loop condition\noffset = -1                                          ' starting point in the bitmap\n\nav.ShowStopButton                                    ' show the stop button so you can interrupt the process\ncancelle
d = FALSE                                    ' define the intital stop button condition\n\n\n' Loop through the CS shapes and compute the bank percentages\n'------------------------------------------------------------\nwhile (not done)\n  curCount = curCount + 1\n  recNum = theBitMap.GetNextSet(offset)\n  offset = recNum\n  if (recNum <> -1) then                             ' check if a valid record\n      ' a valid CS record has been selected\n      ' get the attribute data & show the message on what is going on\n    
  statID = the2DCSFTab.ReturnValueNumber(stationField, recNum)         ' get station as ID (number)\n      station = statID.AsString                                            ' convert to a string\n\n      av.ShowMsg(\"Computing bank percentages for cross-section at station: \"+station) ' display status\n      cancelled = av.SetStatus(curCount/noOfCSToProcess*100).not          ' display % process bar\n      if (cancelled) then\n        ' the computations have been cancelled.  Stop editing and give a warning\n      
  av.SetStatus(100)\n        MsgBox.Warning(\"The bank computations terminated by the user!\",strMessageTitle)\n        return false                                                       ' exit with false\n      end\n      \n      ' get the CS geometric data and put it in theShape\n'      the2DCSFTab.QueryShape(recNum, thePrj, theShape)\n      theShape = the2DCSFTab.ReturnValue(shapeField, recNum)\n\n\n      ' Find the bank lines intersecting the CS shape\n      '----------------------------------------------\n      theB
ankBitMap.SetAll                                     ' make sure you test on all the banks\n      theBankFTab.SelectByPolyline(theShape,#VTAB_SELTYPE_NEW) ' select the banks intersecting the CS\n      theBankBitMap = theBankFTab.GetSelection                 ' get the selected banks bitmap\n \n      ' if not exactly two bank liness there is an error - give a message and quit\n      if (theBankBitMap.Count <> 2) then\n        tMessage = \"There are not exactly 2 bank lines intersecting a single cross-section!\"\n     
   tMessage = tMessage + nl + \"Bank percentage calculations FAILED.\"\n        MsgBox.Warning(tMessage, strMessageTitle)\n        return false                                   ' exit the routine with error\n      end      \n\n      ' get the first bank intersection\n      offsetb = -1                                             ' starting point in the banks bitmap\n\n      recNumb = theBankBitMap.GetNextSet(offsetb)\n      offsetb = recNumb\n      ' get the bank geometric data and put it in theBankShape\n'      theBan
kFTab.QueryShape(recNumb, thePrj, theBankShape)\n      theBankShape = theBankFTab.ReturnValue(shapeBankField, recNumb)\n      pnt1 = theShape.PointIntersection(theBankShape)        ' get the multipoint intersection\n\n      if (pnt1.Count <> 1) then                              ' check if more than one intersection - problem\n        ' there should be only one intersection - give a message and quit\n        tMessage = \"There are multiple intersections of a single bank and cross-section\"\n        tMessage = tMessag
e + nl + \"line!  Bank percentage calculations FAILED.\"\n        MsgBox.Warning(tMessage, strMessageTitle)\n        return false\n      end\n\n      partList = pnt1.AsList                                 ' define multipoint as a list\n      thePart = partList.Get(0)                              ' get first part (point)\n'      thePt = thePart.Get(0)\n'          x = thePart.GetX.AsString\n'          y = thePart.GetY.AsString\n'          thePTStr = x + \", \" + y\n\n'msgbox.info(\"The first intersection is at: (\"+thePTStr+\")
\",\"\")\n\n      pnt1Distance = theShape.PointPosition(thePart)\n\n      ' get the second bank intersection\n      recNumb = theBankBitMap.GetNextSet(offsetb)\n      offsetb = recNumb\n      \n      ' get the bank geometric data and put it in theBankShape\n'      theBankFTab.QueryShape(recNumb, thePrj, theBankShape)\n      theBankShape = theBankFTab.ReturnValue(shapeBankField, recNumb)\n      pnt2 = theShape.PointIntersection(theBankShape)        ' get the multipoint intersection\n\n      if (pnt2.Count <> 1) then        
                      ' check if more than one intersection - problem\n        ' there should be only one intersection - give a message (same as before) and quit\n        MsgBox.Warning(tMessage, strMessageTitle)\n        return false\n      end\n\n      partList = pnt2.AsList                                 ' define multipoint as a list\n      thePart = partList.Get(0)                              ' get first part\n\n      pnt2Distance = theShape.PointPosition(thePart)\n\n      ' Check which percentage is smaller - t
hat is left bank - and set them\n      '---------------------------------------------------------------------\n      if (pnt1Distance > pnt2Distance) then\n          lbankp = pnt2Distance / 100\n          rbankp = pnt1Distance / 100\n        else\n          lbankp = pnt1Distance / 100\n          rbankp = pnt2Distance / 100\n      end\n      \n      the2DCSFTab.SetValue(LBPField, recNum, lbankp)   ' set the left bank percent value\n      the2DCSFTab.SetValue(RBPField, recNum, rbankp)   ' set the right bank percent valu
e\n\n    else\n      ' no more records to process (eof)\n      done = TRUE\n  end\nend\n\n\n' Clean up\n'-----------\n\n' Save and stop editing\n'----------------------\nthe2DCSFTab.Flush\nthe2DCSFTab.SetEditable(FALSE)\n\n\nif (theOldFormat = nil) then\n    ' use default formatting\n    Number.SetDefFormat(\"\")                ' restore default number format\n  else\n    Number.SetDefFormat(theOldFormat)      ' restore the old number format\nend\n\nif (unsetBitmap) then                      ' clear the bitmap if necessary\n  theBitma
p.ClearAll                       ' unselect everything (since nothing has been selected)\nend\n\ntheBankBitMap.ClearAll                     ' clear the banks selection\n\n\nav.ClearMsg                                ' clear the message\nav.SetStatus(100)                          ' reset the status bar\n\n\nreturn true\n"
)

(Script.232
	Name:	"RAS.PRE.CalcCLLength"
	SourceCode:	"' Name: RAS.PRE.CalcCLLength\n'*****************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'*****************************************************************\n' Name:         RAS.PRE.CalcCLLength\n' Usage:        av.run(\"RAS.PRE.CalcCLLength\",{theFTab})\n'   where:      theFTab - Centerline FTab\n'\n' Returns:      true - sucessfully computed the arc distances / stations\n'               fal
se - not sucessfull in computations of arc distances / stations\n' Description:  Compute for each arc in the centerline theme its length and\n'               going upstream, the cummulative length along each Stream.\n'               Update the values for length, downstream and upstream station.\n' Assumptions:  The arcs are pointing downstream, and are connected.\n'               Each arc is made of only one part (arc).\n' Called by:    RAS.PRE.LengthCLAttributes\n'\n' History:      DDJ; 4/23/98\n'               DDJ
; 2/99      Modified name and header.\n'\n'******************************************************************\n\ntheFTab = SELF.Get(0)                   ' retreive the centerline FTab\n\n\nstrMessageTitle = \"Stream centerline length and cummulative distance computations\"\n\n\n' Define the fields of interest in the CL attribute table\n'--------------------------------------------------------------\nshapeField = theFTab.FindField(\"Shape\")              ' shape\nstreamField = theFTab.FindField(\"Stream_ID\")         ' stream 
ID\nlengthField = theFTab.FindField(\"ArcLength\")         ' arcs length\nfromSTField = theFTab.FindField(\"from_ST\")           ' from station for the arc\ntoSTField = theFTab.FindField(\"to_ST\")               ' to station for the arc\n'isOutField = theFTab.FindField(\"is_Outlet\")          ' is outlet arc identifier\n\n\n' Start editing the centerline FTab\n'-------------------------------------\ntheFTab.SetEditable(TRUE)\n\n' Initiate the initial and dummy objects\n'---------------------------------------\ntheShape = theFTa
b.GetShapeClass.MakeNull            ' create a NULL CL shape\nthePrj = Prj.MakeNull                                ' create a dummy projection object\ntheOldFormat = Number.GetDefFormat                   ' get the current number format\nNumber.SetDefFormat(\"d.ddd\")                         ' specify 3 decimal places for floats\n\n' Generate a bitmap indicating all the records that are the most-downstream reach of a\n' stream (stream outlets).  This replaces the need for is_Outlet item used in AVRas.\n' To do this, 
loop through all the arcs, find its downstream node and all the arcs \n' connected to that node, and check if any of the connected arcs has the same Stream_ID.\n'---------------------------------------------------------------------------------------\ntheBitMap1 = theFTab.GetSelection.Clone              ' create a reach bitmap\ntheBitMap1.ClearAll                                  ' reset the bitmap to not set\nfor each rec in theFTab\n  streamID = theFTab.ReturnValue(streamField, rec)   ' get reach's Stream_ID\n  t
heShape = theFTab.ReturnValue(shapeField, rec)    ' get reach's shape\n  oPartPLine = theShape.AsList.Get(0)                ' get the reach as a list of points\n  nPoints = oPartPLine.Count                         ' get the number of points in the reach\n  oToNode = oPartPLine.Get(nPoints-1)                ' get the to node\n\n  ' find all the lines connected to the to_node\n  theFTab.SelectByPoint(oToNode, 0, #VTAB_SELTYPE_NEW)\n  oSelBitMap = theFTab.GetSelection                  ' specify the bitmap of selected
 features\n\n  if ((oSelBitMap.Count = 1) or (oSelBitMap.Count = 0)) then\n      ' the most downstream segment of all - reset the bit and move on to the next reach\n      theBitMap1.Set(rec)\n    else\n      ' more than one line connected at the node.  check if there is one that is a different stream\n      nConn = 1\n      for each rec1 in oSelBitMap\n        if (rec1 <> rec) then                        ' action if the record is different\n          streamID1 = theFTab.ReturnValue(streamField,rec1)   ' get connected
 reach Stream_ID\n          if (streamID1 = streamID) then\n              ' the IDs are the same - not an outlet segment\n              continue                                 ' skip looping through the connected reaches\n            else\n              nConn = nConn + 1          \n          end                                        ' end of checking for different stream_ID\n        end                                          ' end of checking for different reach\n      end                                       
     ' end of looping through the connected reaches\n      ' check if all the arcs have been processed\n      if (nConn = oSelBitMap.Count) then\n        ' all reaches processed - no ID match on the Stream_ID - it's an outlet\n        theBitMap1.Set(rec)\n      end  \n  end                                                ' end of checking for final outlet\nend                                                  ' end of looping through all the reaches\n\n' Set the loop through all the stream outlet arcs\n'---------------
---------------------------------\n' get all the records that identify the outlet arc for each stream\n'theBitMap1 = theFTab.GetSelection                    ' initialize the selection bitmap\n'theQuery = \"([is_Outlet] = 1)\"                       ' build a query string\n\n'theFTab.Query(theQuery, theBitMap1, #VTAB_SELTYPE_NEW) ' query the ftab for outlets\n\ntheBitMap = theBitMap1.Clone                         ' clone the ftab (independent from further selections)\n\nnoOfCLToProcess = theBitMap.Count                 
   ' define the number of selected CL outlets to process\ncurCount = 0                                         ' set the record counter to zero\n\nav.ShowStopButton                                    ' show the stop button so you can interrupt the process\ncancelled = FALSE                                    ' define the intital stop button condition\n\n' Loop through the stream outlets (streams)\n'------------------------------------------\ndone = FALSE                                         ' define the initial 
loop condition\noffset = -1                                          ' starting point in the bitmap\n\nwhile (not done)\n  curCount = curCount + 1                            ' increase the CL counter\n  recNum = theBitMap.GetNextSet(offset)              ' recNum to check\n  offset = recNum\n  if (recNum <> -1) then                             ' check if a valid record\n      ' a valid stream outlet record has been selected\n      streamID = theFTab.ReturnValue(streamField, recNum)      ' get stream ID\n\n      av.Show
Msg(\"Computing lengths and stations for stream ID: \"+streamID)    ' display status\n      cancelled = av.SetStatus(curCount/noOfCLToProcess*100).not               ' display % process bar\n      if (cancelled) then\n        ' the computations have been cancelled.  Stop editing and give a warning\n        av.SetStatus(100)\n        MsgBox.Warning(\"The distance computations terminated by the user!\",strMessageTitle)\n        return false                                                           ' exit with false\n    
  end\n\n'      theFTab.QueryShape(recNum, thePrj, theShape)             ' get the shape - inefficient way\n      theShape = theFTab.ReturnValue(shapeField, recNum)       ' get reach's shape\n      arcLen = theShape.ReturnLength                           ' get the shape's length\n      downStation = 0                                          ' set the downstream station\n      upStation = arcLen                                       ' set the upstream station\n      theFTab.SetValue(lengthField, recNum, arcLen)   
         ' store the arc length\n      theFTab.SetValue(fromSTField, recNum, downStation)       ' store the downstream station\n      theFTab.SetValue(toSTField, recNum, upStation)           ' store the upstream station\n      \n      ' set the bitmap for upstream connection looping\n      theStrBitMap = theFTab.GetSelection                      ' initiate a stream bitmap \n      theStrBitMap.SetAll                                      ' pick from all the streams\n\n      ' Loop through the upstream arcs for that S
tream ID\n      '--------------------------------------------------\n      dones = FALSE                                            ' set the loop break condition\n      theShapeC = theShape                                     ' set the initial shape to start with\n\n      while (not dones)\n        ' find the upstream (from) node of the current shape\n        partList = theShapeC.AsList                    ' get the list of 2D shape components\n                                                       ' (there should 
be only one)\n        thePart = partList.Get(0)                      ' get the first part (line) in the shape\n        thePt = thePart.Get(0)                         ' get the initial point (from node)\n'        x = thePt.GetX.AsString\n'        y = thePt.GetY.AsString\n\n        ' find the arcs connected to the from node of the current selection\n        theStrBitMap.SetAll                                    ' pick from all the streams\n        theFTab.SelectByPoint(thePt, 0 ,#VTAB_SELTYPE_NEW)     ' select the li
nes connected at the point\n        theStrBitMap = theFTab.GetSelection                    ' get the connected centerlines bitmap\n        theFTab.UpdateSelection                                ' display selected set\n        \n        ' loop through the connected set\n        connCount = 0                                          ' reset the connection counter\n        for each rec in theStrBitMap                           ' loop through the active records\n          streamIDC = theFTab.ReturnValue(streamField, r
ec)    ' get stream ID of connected arc\n          if (streamIDC = streamID) then                       ' see if it is the same stream ID\n            ' the current arc matches the downstream stream ID\n            if (rec <> recNum) then                            ' check if not the same record as downstream\n              ' same ID but different record - this is the one to process further\n'              theFTab.QueryShape(rec, thePrj, theShapeC)       ' get the shape (of the next upstream arc)\n              t
heShapeC = theFTab.ReturnValue(shapeField, rec) ' get the shape (of the next upstream arc)\n              connCount = connCount + 1                        ' increase the conncetion counter\n              if (connCount > 1) then                          ' check for more than 1 connection - error\n                  tMessage = \"There is more than one upstream arc with the same Stream ID!\"\n                  tMessage = tMessage + \"Stream centerline length calculations FAILED.\"\n                  MsgBox.Warning(tMess
age, strMessageTitle)\n                  return false\n                else\n                  ' pick this as the next shape - get its values and compute the sums (but do not save yet)\n                  recSave = rec.clone                          ' define the record number (clone) to save to\n                  arcLenC = theShapeC.ReturnLength             ' get the shape's length\n                  downStation = upStation                      ' compute the downstream station\n                  upStation = upStati
on + arcLenC              ' compute the upstream station\n              end                                              ' end of checking if connCount > 1\n            end                                                ' end of checking if the same shape\n          end                                                  ' end of checking for same Stream ID arcs\n        end                                                    ' end of looping through upstream arcs\n\n        ' check if we had 1 connection (the other 
option is to have zero connections)\n        if (connCount = 1) then\n            ' have one connection exactly.  Save the parameters and move on to the next upstream arc\n            theFTab.SetValue(lengthField, recSave, arcLenC)                ' store the arc length\n            theFTab.SetValue(fromSTField, recSave, downStation)            ' store the downstream station\n            theFTab.SetValue(toSTField, recSave, upStation)                ' store the upstream station\n         else\n            ' connCou
nt = 0, otherwise we would not be here\n            ' no more upstream connections with the same Stream ID.  Move to the next Stream ID\n            dones = TRUE\n            recSave = recNum.clone                             ' define the recSave if first is also the last reach\n        end\n\n        recNum = recSave                                       ' set the record number to be the one just finished\n\n      end                                                      ' end of looping through a stream ID\n\n    el
se      \n      ' no more stream IDs to process\n      done = TRUE\n  end                                                          ' end of if for stream ID\nend                                                            ' end of looping through the stream outlets (ID)\n      \n      \n' Clean up\n'-----------\n\n' Save and stop editing\n'----------------------\ntheFTab.Flush\ntheFTab.SetEditable(FALSE)\n\n\nif (theOldFormat = nil) then\n    ' use default formatting\n    Number.SetDefFormat(\"\")                ' restore defau
lt number format\n  else\n    Number.SetDefFormat(theOldFormat)      ' restore the old number format\nend\n\n\ntheStrBitMap.ClearAll                      ' clear the CL selection\n\n\nav.ClearMsg                                ' clear the message\nav.SetStatus(100)                          ' reset the status bar\n\n\nreturn true\n"
)

(Script.233
	Name:	"RAS.PRE.CalcDistCSAtt"
	SourceCode:	"' Name: RAS.PRE.CalcDistCSAtt\n'*****************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'*****************************************************************\n' Name:         RAS.PRE.CalcDistCSAtt\n' Usage:        av.run(\"RAS.PRE.CalcBankCSAtt\",{the2DCSFTab,theFlowFTab})\n'   where:      the2DCSFTab - 2D cross-section FTab\n'               theFlowFTab - Flowpaths FTab\n' Returns:      true
 - sucessfully computed the distances between the cross-sections\n'               false - not sucessfull computation of cross-section distances\n' Description:  Compute for each cross-section the distance to the next\n'               upstream cross-section. \n'               The left, right, and Channel flow path lines are marked so\n'               by the LineType item in the theFlowFTab.\n' Called by:    RAS.PRE.DistanceCSAttributes\n'\n' History:      DDJ; 4/20/98\n'               DDJ; 2/99      Modified name and
 header\n'               CTA; 3/23/99   Change LineType from l,m,r to Left, Channel, Right.\n'\n'******************************************************************\n\nthe2DCSFTab = SELF.Get(0)                   ' retreive the cross-section FTab\ntheFlowFTab = SELF.Get(1)                   ' retreive the Flow FTab\n\n\nstrMessageTitle = \"Cross-section distance computations\"\n\n\n' Define the fields in the 2D CS and flowpaths attribute tables\n'--------------------------------------------------------------\nshapeField = th
e2DCSFTab.FindField(\"Shape\")          ' 2D CS shape\nstationField = the2DCSFTab.FindField(\"Station\")      ' station\nstreamField = the2DCSFTab.FindField(\"Stream_ID\")     ' stream ID\nLRLField = the2DCSFTab.FindField(\"L_ReachL\")         ' left distance\nRRLField = the2DCSFTab.FindField(\"R_ReachL\")         ' right distance\nMRLField = the2DCSFTab.FindField(\"M_ReachL\")         ' Channel distance\nshapeFlowField = theFlowFTab.FindField(\"Shape\")      ' flowpath shape\nltypeField = theFlowFTab.FindField(\"LineType\")     
  ' flowpath line type\n\n' Start editing the cross-section FTab\n'-------------------------------------\nthe2DCSFTab.SetEditable(TRUE)\n\n' Initiate the initial and dummy objects\n'---------------------------------------\ntheShape = the2DCSFTab.GetShapeClass.MakeNull        ' create a NULL 2D CS shape\ntheFlowShape = theFlowFTab.GetShapeClass.MakeNull    ' create a NULL Flow shape\nthePrj = Prj.MakeNull                                ' create a dummy projection object\ntheOldFormat = Number.GetDefFormat              
     ' get the current number format\nNumber.SetDefFormat(\"d.ddd\")                         ' specify 3 decimal places for floats\n\n' Set the bit maps\n'--------------------------------\ntheBitMap = the2DCSFTab.GetSelection                 ' define the CS bitmap to loop through\ntheBitMap.SetAll                                     ' select all records for processing\ntheFlowBitMap = theFlowFTab.GetSelection             ' get the Flows bitmap\ntheFlowBitMap.SetAll                                 ' always use all the
 Flows\n\n\n' Create a list of unique Station_ID's\n'-------------------------------------\nstationList = {}                                               ' make an empty list\nfor each rec in theBitMap                                      ' loop through all the records\n  streamID = the2DCSFTab.ReturnValue(streamField, rec)         ' get stream_ID\n  stationList.Add(streamID)                                    ' add it to the list\nend                                                            ' end the record loop
\nstationList.RemoveDuplicates                                   ' make the list of unique elements\n\n\nstatDict = Dictionary.Make(300)                      ' initiate the station dictionary (300 is arbitrary)\n\n' Loop through the unique Stream_ID's found in the dictionary.  For each generate a dictionary\n' with cross-section and station that we will loop through and identify distances\n'---------------------------------------------------------------------------------------------\nfor each id in stationList\n  ' g
et all the records that identify the same Stream_ID\n  theBitMap.SetAll                                     ' select all records for processing\n  theQuery = \"([Stream_ID] = \"+id.AsString.Quote+\")\"                 ' build a query string\n'  msgbox.info(\"The query string = \"+theQuery,\"\")\n  the2DCSFTab.Query(theQuery, theBitMap, #VTAB_SELTYPE_NEW)   ' query the ftab for Stream_ID\n  \n  ' Create a dictionary of stations/record numbers that we will sort and then loop through\n  ' !!! make sure that you clone the rec
Num, otherwise it is a pointer when put in the dict.!!!\n  '--------------------------------------------------------------------------------------------\n  statDict.Empty                                                      ' empty the dictionay\n  for each recNum in theBitMap\n    statID = the2DCSFTab.ReturnValueNumber(stationField, recNum)      ' get station as ID (number)\n    statDict.Add(statID,recNum.Clone)                                 ' add the station and its record number\n  end\n\n  ' Define the statio
ns as a list and sort them\n  '--------------------------------------------\n  statList = statDict.ReturnKeys                      ' create the station list\n  statList.Sort(TRUE)                                 ' sort the list in ascending order\n  \n  \n  ' Select all the flowpaths as potential candidates\n  '-------------------------------------------------\n  theFlowBitMap.SetAll                                 ' always use all the Flows\n  \n  \n  noOfCSToProcess = theBitMap.Count                    ' define the 
number of selected CS to process\n  curCount = 1                                         ' set the record counter to one\n\n  done = FALSE                                         ' define the initial loop condition\n  offset = -1                                          ' starting point in the bitmap\n\n  av.ShowStopButton                                    ' show the stop button so you can interrupt the process\n  cancelled = FALSE                                    ' define the intital stop button condition\n\n\n  
'-----------------------------------------------\n  ' Specify the intial intersection point measures\n  '-----------------------------------------------\n  statID = statList.Get(0)                               ' get the initial station from the station list\n  recNum = statDict.Get(statID)                          ' get the record number from station dictionary\n'  the2DCSFTab.QueryShape(recNum, thePrj, theShape)       ' get the CS geometric data and put it in theShape\n  theShape = the2DCSFTab.ReturnValue(shape
Field, recNum) ' get the CS geometric data and put it in theShape\n  \n  ' Find the flowpath lines intersecting the CS shape\n  theFlowBitMap.SetAll                                     ' make sure you test on all the Flows\n  theFlowFTab.SelectByPolyline(theShape,#VTAB_SELTYPE_NEW) ' select the flowpaths intersecting the CS\n  theFlowBitMap = theFlowFTab.GetSelection                 ' get the selected Flows bitmap\n  \n  ' Loop through the flowpaths and find the intersection points\n  doneb = FALSE\n  offsetb = -1  
                                             ' starting point in the Flows bitmap\n\n  while (not doneb)\n    recNumb = theFlowBitMap.GetNextSet(offsetb)                ' get the record number of next selected record\n    offsetb = recNumb\n    if (recNumb <> -1) then                                    ' check if a valid record\n        ' a valid flowpath record has been selected\n        pathID = theFlowFTab.ReturnValue(ltypeField, recNumb)           ' get the line type\n'        theFlowFTab.QueryShape(recNumb, th
ePrj, theFlowShape)           ' get the shape\n        theFlowShape = theFlowFTab.ReturnValue(shapeFlowField, recNumb) ' get the shape\n        pathLength = theFlowShape.ReturnLength                          ' get the total flowpath length\n        pnt1 = theShape.PointIntersection(theFlowShape)                 ' get the multipoint intersection\n  \n        if (pnt1.Count <> 1) then                              ' check if more than one intersection - problem\n          ' there should be only one intersection - gi
ve a message and quit\n          tMessage = \"There are multiple intersections of a single flowpath and cross-section\"\n          tMessage = tMessage + nl + \"line!  Cross-section distance calculations FAILED.\"\n          MsgBox.Warning(tMessage, strMessageTitle)\n          return false\n        end\n    \n        partList = pnt1.AsList                                 ' define multipoint as a list\n        thePart = partList.Get(0)                              ' get first part (point)\n        pnt1Distance = theFlowSh
ape.PointPosition(thePart)     ' % length along flowpath\n    \n        ' classify the point and compute the distance along the path\n        ' assign the distance as upstream one, since we'll move it to \n        ' downstream one in the loop through other cross-sections\n        if (pathID = \"Left\") then                           ' point is on the left flowpath\n            distLu = pnt1Distance * pathLength / 100\n            recLu = recNumb\n            pathLu = pathLength\n        end\n        if (pathID = \"Chann
el\") then                           ' point is on the Channel flowpath\n            distMu = pnt1Distance * pathLength / 100\n            recMu = recNumb\n            pathMu = pathLength\n        end\n        if (pathID = \"Right\") then                           ' point is on the right flowpath\n            distRu = pnt1Distance * pathLength / 100\n            recRu = recNumb\n            pathRu = pathLength\n        end\n    \n      else\n        ' end of flowpaths loop\n        doneb = TRUE\n    end                     
       ' end of if statement on validity of the record\n  end                              ' end of while loop through flowpaths\n  \n  \n  '--------------------------------------------------------------------------------\n  ' Save the distances for the first cross-section (distance to the downstream end)\n  '--------------------------------------------------------------------------------\n  distSave = pathLu - distLu\n  the2DCSFTab.SetValue(LRLField, recNum, distSave)           ' set the left distance\n  distSave =
 pathRu - distRu\n  the2DCSFTab.SetValue(RRLField, recNum, distSave)           ' set the right distance\n  distSave = pathMu - distMu\n  the2DCSFTab.SetValue(MRLField, recNum, distSave)           ' set the Channel distance\n  \n  \n  '---------------------------------------------------------------------------\n  ' Loop through the rest of CS shapes and compute the cross-section distances\n  '---------------------------------------------------------------------------\n  for each ii in 1..(noOfCSToProcess-1)          
    ' do all CS except the first and last one\n    statID = statList.Get(ii)                        ' get the station from the station list\n    curCount = curCount + 1                          ' increase the CS counter\n    recNum = statDict.Get(statID)                    ' get the record number from station dictionary\n\n'msgbox.info(\"Cross-section at station: \"+statID.AsString,\"Record number = \"+recNum.AsString)\n\n  \n    ' get the attribute data & show the message on what is going on\n    station = statID.AsStr
ing                                            ' convert to a string\n  \n    av.ShowMsg(\"Computing upstream distance for cross-section at station: \"+station) ' display status\n    cancelled = av.SetStatus(curCount/noOfCSToProcess*100).not          ' display % process bar\n    if (cancelled) then\n      ' the computations have been cancelled.  Stop editing and give a warning\n      av.SetStatus(100)\n      MsgBox.Warning(\"The Flow computations terminated by the user!\",strMessageTitle)\n      return false           
                                            ' exit with false\n    end\n    \n    ' get the CS geometric data and put it in theShape\n'    the2DCSFTab.QueryShape(recNum, thePrj, theShape)\n    theShape = the2DCSFTab.ReturnValue(shapeField, recNum)   ' get the CS geometric data\n  \n  'crossLen = theShape.returnlength\n  'msgbox.info(\"Cross-section length = \"+crossLen.asstring,\"\")\n  \n  \n    ' Find the flowpath lines intersecting the CS shape\n    '----------------------------------------------\n    theFlowBitMap.SetAl
l                                     ' make sure you test on all the Flows\n    theFlowFTab.SelectByPolyline(theShape,#VTAB_SELTYPE_NEW) ' select the flowpaths intersecting the CS\n    theFlowBitMap = theFlowFTab.GetSelection                 ' get the selected Flows bitmap\n   \n  \n  'msgbox.info(\"Number of Flow/cs intersections =  \"+theFlowBitMap.Count.Asstring,\"\")\n  \n  \n  '  if ((theFlowBitMap.Count <> 1) and (theFlowBitMap.Count <> 3) then\n  '    tMessage = \"The flowpath lines are not correctly defined (eit
her all or just center)!\"\n  '    tMessage = tMessage + nl + \"Cross-section distance calculations FAILED.\"\n  '    MsgBox.Warning(tMessage, strMessageTitle)\n  '    return false                                   ' exit the routine with error\n  '  end      \n  \n    ' Assign the upstream lengths and records to downstream lengths and records\n    distLd = distLu\n    distMd = distMu\n    distRd = distRu\n    recLd = recLu\n    recMd = recMu\n    recRd = recRu\n    pathLd = pathLu\n    pathMd = pathMu\n    pathRd = pathRu\n 
   \n    ' Loop through the flopaths and find the intersection points\n    doneb = FALSE\n    offsetb = -1                                               ' starting point in the Flows bitmap\n    \n    while (not doneb)\n      recNumb = theFlowBitMap.GetNextSet(offsetb)                ' get the record number of next selected record\n      offsetb = recNumb\n      if (recNumb <> -1) then                                    ' check if a valid record\n          ' a valid flowpath record has been selected\n          pathID
 = theFlowFTab.ReturnValue(ltypeField, recNumb)           ' get the line type\n'          theFlowFTab.QueryShape(recNumb, thePrj, theFlowShape)           ' get the shape\n          theFlowShape = theFlowFTab.ReturnValue(shapeFlowField, recNumb) ' get the shape\n          pathLength = theFlowShape.ReturnLength                          ' get the flowpath length\n          pnt1 = theShape.PointIntersection(theFlowShape)                 ' get the multipoint intersection\n  \n'  msgbox.info(\"PathID = \"+pathID,\"Cross-s
ection being processed: \"+station)\n'  msgbox.info(\"Path length = \"+pathLength.asstring,\"Path type = \"+pathID)\n    \n          if (pnt1.Count <> 1) then                              ' check if more than one intersection - problem\n            ' there should be only one intersection - give a message and quit\n            tMessage = \"There are multiple intersections of a single flowpath and cross-section\"\n            tMessage = tMessage + nl + \"line!  Cross-section distance calculations FAILED.\"\n            MsgBo
x.Warning(tMessage, strMessageTitle)\n            return false\n          end\n    \n          partList = pnt1.AsList                                 ' define multipoint as a list\n          thePart = partList.Get(0)                              ' get first part (point)\n          pnt1Distance = theFlowShape.PointPosition(thePart)     ' % length along flowpath\n    \n  '        pnt1Length = pnt1Distance * pathLength /100            ' distance along the path\n    \n          ' classify the point and compute the distan
ce between cross-sections\n          '-------------------------------------------------------------------\n          if (pathID = \"Left\") then                                   ' point is on the left flowpath\n            distLu = pnt1Distance * pathLength / 100\n            recLu = recNumb\n            pathLu = pathLength\n            if (recLu = recLd) then                     \n                ' points on the same path\n                lDistance = distLd - distLu\n              else\n                ' points on se
parate paths\n                lDistance = pathLu - distLu + distLd\n            end\n          end\n          \n          if (pathID = \"Channel\") then                                   ' point is on the Channel flowpath\n            distMu = pnt1Distance * pathLength / 100\n            recMu = recNumb\n            pathMu = pathLength\n            if (recMu = recMd) then                     \n                ' points on the same path\n                mDistance = distMd - distMu\n              else\n                ' poin
ts on separate paths\n                mDistance = pathMu - distMu + distMd\n            end\n          end\n          \n          if (pathID = \"Right\") then                                   ' point is on the right flowpath\n            distRu = pnt1Distance * pathLength / 100\n            recRu = recNumb\n            pathRu = pathLength\n            if (recRu = recRd) then                     \n                ' points on the same path\n                rDistance = distRd - distRu\n              else\n                ' 
points on separate paths\n                rDistance = pathRu - distRu + distRd\n            end\n          end\n          \n        else\n          ' no more flowpath records to process for a given cross-section\n          doneb = TRUE\n          ' save the distances\n          the2DCSFTab.SetValue(LRLField, recNum, lDistance)   ' set the left distance\n          the2DCSFTab.SetValue(MRLField, recNum, mDistance)   ' set the Channel distance\n          the2DCSFTab.SetValue(RRLField, recNum, rDistance)   ' set the right
 distance\n          \n      end                      ' end of if statement on validity of flowpaths\n  \n    end                        ' end of while loop trough paths\n  \n  end                          ' end of for loop through cross-sections\n\nend                            ' end of the loop through Stream_ID's\n\n\n' Clean up\n'-----------\n\n' Save and stop editing\n'----------------------\nthe2DCSFTab.Flush\nthe2DCSFTab.SetEditable(FALSE)\n\n\nif (theOldFormat = nil) then\n    ' use default formatting\n    Number.SetDef
Format(\"\")                ' restore default number format\n  else\n    Number.SetDefFormat(theOldFormat)      ' restore the old number format\nend\n\ntheBitmap.ClearAll                         ' unselect all cross-sections\n\ntheFlowBitMap.ClearAll                     ' unselect all Flows selection\n\n\nav.ClearMsg                                ' clear the message\nav.SetStatus(100)                          ' reset the status bar\n\n\nreturn true\n"
)

(Script.234
	Name:	"RAS.PRE.CalcStatCSAtt"
	SourceCode:	"' Name: RAS.PRE.CalcStatCSAtt\n'*****************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'*****************************************************************\n' Name:         RAS.PRE.CalcStatCSAtt\n' Usage:        av.run(\"RAS.PRE.CalcStatCSAtt\",{the2DCSFTab,theCLFTab}\n'   where:      the2DCSFTab - 2D cross-section FTab\n'               theCLFTab - centerline FTab\n'\n' Returns:      true -
 sucessfully computed stations\n'               false - not sucessfully computed station\n' Description:  Compute and assign to each cross-section a station.\n'               The station is computed by linear interpolation \n'               based on the stream centerline's length field, the\n'               location of the cross-section/centeline intersection,\n'               and from_ST and to_ST fields.\n' Called by:    RAS.PRE.StationCSAttributes\n'\n' History:      DDJ; 4/24/98\n'               DDJ; 2/99      Mo
dified name and header.\n'\n'******************************************************************\n\nthe2DCSFTab = SELF.Get(0)                 ' retreive the cross-section FTab\ntheCLFTab = SELF.Get(1)                   ' retreive the centerline FTab\n\n\nstrMessageTitle = \"Cross-section stream and reach attributing\"\n\n\n' Define the fields in the 2D CS and CLpaths attribute tables\n'--------------------------------------------------------------\nCSshapeField = the2DCSFTab.FindField(\"Shape\")        ' CS shape\nstationFiel
d = the2DCSFTab.FindField(\"Station\")      ' station\nshapeCLField = theCLFTab.FindField(\"Shape\")          ' CL shape\nfromSTField = theCLFTab.FindField(\"from_ST\")         ' from station for the arc\ntoSTField = theCLFTab.FindField(\"to_ST\")             ' to station for the arc\n\n\n' Start editing the cross-section FTab\n'-------------------------------------\nthe2DCSFTab.SetEditable(TRUE)\n\n' Initiate the initial and dummy objects\n'---------------------------------------\ntheShape = the2DCSFTab.GetShapeClass.MakeNull
        ' create a NULL 2D CS shape\ntheCLShape = theCLFTab.GetShapeClass.MakeNull        ' create a NULL centerline shape\nthePrj = Prj.MakeNull                                ' create a dummy projection object\ntheOldFormat = Number.GetDefFormat                   ' get the current number format\nNumber.SetDefFormat(\"d.ddd\")                         ' specify 3 decimal places for floats\n\n\n' Set the initial loop parameters\n'--------------------------------\ntheBitMap = the2DCSFTab.GetSelection                 ' d
efine the CS bitmap to loop through\nif (theBitMap.Count = 0) then                        ' if nothing has been selected - go through all\n    theBitMap.SetAll                                 ' select all records for processing\n    unsetBitmap = TRUE                               ' set the flag to unselect at end of processing\n  else\n    unsetBitmap = FALSE                              ' leave the original selected CS set as it is\nend\n\n\n' Select all the centerlines as potential candidates\n'-------------------
--------------------------------\ntheCLBitMap = theCLFTab.GetSelection                 ' get the centerline bitmap\ntheCLBitMap.SetAll                                   ' always use all the centerlines\n\n\nnoOfCSToProcess = theBitMap.Count                    ' define the number of selected CS to process\ncurCount = 0                                         ' set the record counter to zero\n\ndone = FALSE                                         ' define the initial loop condition\noffset = -1                        
                  ' starting point in the bitmap\n\nav.ShowStopButton                                    ' show the stop button so you can interrupt the process\ncancelled = FALSE                                    ' define the intital stop button condition\n\n\n'-------------------------------------------------------------\n' Loop through the CS shapes, compute and assign stations\n'-------------------------------------------------------------\nwhile (not done)\n  curCount = curCount + 1\n  recNum = theBitMap.GetNext
Set(offset)\n  offset = recNum\n  if (recNum <> -1) then                             ' check if a valid record\n      ' a valid CS record has been selected\n      ' get the attribute data & show the message on what is going on\n\n      av.ShowMsg(\"Processing cross-section at record number: \"+recNum.AsString) ' display status\n      cancelled = av.SetStatus(curCount/noOfCSToProcess*100).not          ' display % process bar\n      if (cancelled) then\n        ' the computations have been cancelled.  Stop editing and g
ive a warning\n        av.SetStatus(100)\n        MsgBox.Warning(\"The cross-section attribution terminated by the user!\",strMessageTitle)\n        return false                                                       ' exit with false\n      end\n      \n      ' get the CS geometric data and put it in theShape\n'      the2DCSFTab.QueryShape(recNum, thePrj, theShape)\n      theShape = the2DCSFTab.ReturnValue(CSshapeField, recNum) ' get the CS geometric data and put it in theShape\n\n      ' Find the centerline intersecti
ng the CS shape\n      '----------------------------------------------\n      theCLBitMap.SetAll                                       ' make sure you test on all the centerlines\n      theCLFTab.SelectByPolyline(theShape,#VTAB_SELTYPE_NEW)   ' select the centerline intersecting the CS\n      theCLBitMap = theCLFTab.GetSelection                     ' get the selected centerline bitmap\n \n      ' if not exactly one centerline there is an error - give a message and quit\n      if (theCLBitMap.Count <> 1) then\n     
   tMessage = \"There is not exactly one centerline intersecting a single cross-section!\"\n        tMessage = tMessage + nl + \"Station assignment FAILED.\"\n        MsgBox.Warning(tMessage, strMessageTitle)\n        return false                                           ' exit the routine with error\n      end      \n\n      ' get the record number of the intersected centerline element\n      recNumb = theCLBitMap.GetNextSet(-1)\n\n      ' get the CL geometric and attribute data\n'      theCLFTab.QueryShape(recNumb, th
ePrj, theCLShape)\n      theCLShape = theCLFTab.ReturnValue(shapeCLField, recNumb)  ' get the CL geometric\n      fromST = theCLFTab.ReturnValue(fromSTField, recNumb)       ' get from_ST\n      toST = theCLFTab.ReturnValue(toSTField, recNumb)           ' get to_ST\n      theLength = theCLShape.ReturnLength                        ' get shape's length\n      \n      \n      ' find the intersection of the two shapes\n      pnt1 = theShape.PointIntersection(theCLShape)            ' get the multipoint intersection\n\n    
  if (pnt1.Count <> 1) then                                ' check if more than one intersection - problem\n        ' there should be only one intersection - give a message and quit\n        tMessage = \"There are multiple intersections of a single bank and cross-section\"\n        tMessage = tMessage + nl + \"line!  Station calculations FAILED.\"\n        MsgBox.Warning(tMessage, strMessageTitle)\n        return false\n      end\n\n      partList = pnt1.AsList                                   ' define multipoint as a
 list\n      thePart = partList.Get(0)                                ' get first part (point)\n'          x = thePart.GetX.AsString\n'          y = thePart.GetY.AsString\n'          thePTStr = x + \", \" + y\n\n'msgbox.info(\"The first intersection is at: (\"+thePTStr+\")\",\"\")\n\n      pnt1Per = theCLShape.PointPosition(thePart)              ' find percentage location along CL\n\n      ' compute the station by linear interpolation\n      compST = toST - ((toST-fromST)/100*pnt1Per)\n\n      ' save the station value onto the 
cross-section theme\n      the2DCSFTab.SetValue(stationField, recNum, CompST)       ' set the Station\n\n    else\n      ' no more records to process (eof)\n      done = TRUE\n  end\nend\n\n\n\n' Clean up\n'-----------\n\n' Save and stop editing\n'----------------------\nthe2DCSFTab.Flush\nthe2DCSFTab.SetEditable(FALSE)\n\n\nif (theOldFormat = nil) then\n    ' use default formatting\n    Number.SetDefFormat(\"\")                ' restore default number format\n  else\n    Number.SetDefFormat(theOldFormat)      ' restore the old numb
er format\nend\n\nif (unsetBitmap) then                      ' clear the bitmap if necessary\n  theBitmap.ClearAll                       ' unselect everything (since nothing has been selected)\nend\n\ntheCLBitMap.ClearAll                       ' clear the CL selection\n\n\nav.ClearMsg                                ' clear the message\nav.SetStatus(100)                          ' reset the status bar\n\n\nreturn true\n"
)

(Script.235
	Name:	"RAS.PRE.CenterlineComplete"
	SourceCode:	"' Name: RAS.PRE.CenterlineComplete\n'**************************************************************\n'**************************************************************\n' Name:        RAS.PRE.CenterlineComplete\n' Usage:       from the menu \"Centerline Complete\"\n' Returns:     none\n' Description: Build the centerline Topology and\n'                  the 3D Centerline theme\n'              \n'              Steps:  Centerline Topology\n'                      3D Centerline theme generation\n'\n' Requirements: 2D stream cen
terline theme\n'               Terrain TIN\n'\n' History:      CTA; 10.5.99 - original\n'**************************************************************\n\nmyResult = av.run(\"RAS.PRE.LengthCLAttributes\",{\"NoAlert\"})\nif (myresult.not) then exit\nend\n\nmyResult = av.run(\"RAS.PRE.CLTopo\",{\"NoAlert\"})\nif (myresult.not) then exit\nend\n\nmyResult = av.run(\"RAS.PRE.CL2DToCL3D\",{\"NoAlert\"})\nif (myresult = nil) then exit\nend\n\n\nreturn nil\n\n"
)

(Script.236
	Name:	"RAS.PRE.CL2DToCL3D"
	SourceCode:	"' Name: RAS.PRE.CL2DToCL3D\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:          RAS.PRE.CL2DToCL3D \n' USAGE:         Called from menu\n' Returns:       true  - when operation terminated successfully\n'                false - failed due to the theme setup (framework)\n'       
         nil   - failed in some aspect\n' Description:   Convert a 2D centerline to 3D centerline\n'                using the specified TIN.\n'                The themes to be processed are defined by their tags.\n' Calling:       none\n' CalledBy:      none\n' Requires:      Framework (RAS.FRM.GetThmsByTagR, etc.)\n' History:       DDJ 2/99\n' ***************************************************************************\n\n'check to see if if the call is summary of singular\n' if it is the summary call, we don't want o
t alert the\n'user until completion AlertYou=False\nif (self.is(list).Not) then\n  AlertYou = True\n  else \n  if (self.get(0) = \"NoAlert\") then\n    AlertYou = False\n  end\nend\n\n'-------------------------------------------------------------------------\n' Setup of working directory, title in the message boxes, and working view\n'-------------------------------------------------------------------------\n\n' Define the parent directory and the working (tmp) subdirectory\nTheProject=av.GetProject\n' Get the View to work w
ith\noView=av.GetActiveDoc                                 'ViewHandle\n\n'..Set the workDir to BaseMap.\n'av.run(\"RAS.FRM.SetBaseDir\",{oView})\n\n\n' Title for message box for these operations\nsTitle=\"2D centerline to 3D centerline conversion\"    ' title text for message boxes\nbVerify=false                                         ' to force display of theme selection dialog\n\n\n'---------------------------------------------------------------------\n' Setup of required lists for use with the framework\n'--------------
-------------------------------------------------------\n\n' Provide the lists of Tags, ThmTypes, and ShpTypes.\nlTags={\"centerline\",\"terrain\"}           'Tags\nlThmTypes={FTheme,STheme}                'ThmTypes\nlShpTypes={\"PolyLine\",\"TIN\"}             'ShpTypes POLYGON,POLYLINE,POINT,MultiPoint.\n\n' Create the Field descriptions of the required fields.\n' Needs to be there even if none are used.\nldFields={nil,nil}\n\n\n' Define the default names.\nlDefNames={\"CLine\",\"TerrTIN\"}            'Default names\n\n' Define the
 theme purpose type (input/output)\nlPurposes={\"I\",\"I\"}\n\n' Overwrite options when the specified thm exists in the view, lOverWrt guides the operation.\n'For GTheme, 0=OverWrite,1,2=Prompt for a new name because overwrite is not an option.\n'For FTheme, 0=Clear, 1=Ask For a new Name, 2=Append.\n'lOverWrts is extented to be used for InputThms (used as the output Thm) as well.\n'if 0 then don't ask for a backup, overwrite the input theme with the output theme.\n'if 1 then ask if a backup should be made.\nlOverWrts={0
,0}\n\n  \n' Use the framework to check on the themes and items\n'---------------------------------------------------\ndThms=av.run(\"RAS.FRM.GetThmsByTagR\",{oView,lTags,lThmTypes,lShpTypes,ldFields,lDefNames,lPurposes,lOverWrts,bVerify,sTitle})\nif(dThms.is(Dictionary))then\n\n  '-----------------------------------------------------------------\n  ' Successfully returned the required themes, so we can do the work\n  '-----------------------------------------------------------------\n  '**  2D centerline to 3D centerli
ne conversion starts here      **\n\n  CenterTag=lTags.Get(0)                                 ' get the centerline tag\n  the2DCSThemeRet=dThms.Get(CenterTag)                   ' get the centerline theme to use\n  the2DFtab = the2DCSThemeRet.getFTab                    ' get the centerline FTab\n\n  TINTag=lTags.Get(1)                                    ' get the TIN tag\n  theTINThemeRet=dThms.Get(TINTag)                       ' get the TIN theme to use\n  theSurface = theTINThemeRet.GetSurface                 ' de
fine the surface from TIN\n\n\n  ' Get the name of the 3D shape file to create\n  '--------------------------------------------\n  the2DCSFileName = the2DCSThemeRet.GetSrcName.GetFileName    ' get the 2D source file name\n  aDirName = the2DCSFileName.ReturnDir\n  theNameString = the2DCSFileName.GetName.AsString\n  thePropString = theNameString.AsTokens(\".\").Get(0)+\"3D.shp\"\n  new3DFN = thePropString.AsFileName\n  \n  the3DShapeName = FileDialog.Put(new3DFN,\"*.shp\",\"Specify the name of a 3D centerline shape file to cre
ate\")\n  if (the3DShapeName = nil) then\n    ' the selection has not been made.  Give a message and quit\n    tMessage = \"The 3D centerline theme name has not been selected!\"\n    tMessage = tMessage + nl + \"3D centerline extraction has not been performed.\"\n    MsgBox.Warning(tMessage, sTitle)\n    return nil    \n  end  \n  \n  \n  ' Create the 3D shape file from the 2D shape file\n  '------------------------------------------------\n  thePrj = Prj.MakeNull                                        ' define a null prjec
tion (no projection on thefly)\n  the3DFTab = theSurface.InterpolateAsFTab(the2DFTab,the3DShapeName,thePrj,0)\n  the3DFTab.Flush                                              ' save on disk\n  the3DFTab.SetEditable(FALSE)                                 ' stop editing\n  \n  \n  ' Add the 3D centerline theme to the view\n  '-------------------------------------------\n  the3DTheme = FTheme.Make(the3DFTab)                          ' create the theme\n  oView.AddTheme(the3DTheme)                                  ' add 
the theme to the view\n  \n  \n  ' Set the centerline3d tag. If the view already contains the 3D centerline \n  ' theme, that theme will no longer be tagged - the new one will.\n  '--------------------------------------------------------------------------------\n  av.run(\"RAS.FRM.ThmTagMgr\", {\"SetThm\",oView,the3DTheme,\"centerline3d\"})  \n  \n  if (AlertYou) then\n    tMessage = \"3D centerline theme generation completed successfully!\"\n    MsgBox.Info(tMessage, sTitle)\n  end\n \n  '**     End of 2D centerline to 3D cent
erline conversion        **\n  '-----------------------------------------------------------------\n\nelse\n\n  ' Problem in returning from checking the themes\n    sText = \"Problem with input themes.  Operation cancelled\"\n    MsgBox.Warning(sText,sTitle)\n    return false\n    \nend\n\nreturn true\n"
)

(Script.237
	Name:	"RAS.PRE.CLTopo"
	SourceCode:	"' Name: RAS.PRE.CLTopo\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:          RAS.PRE.CLTopo \n' USAGE:         Called from menu\n' Returns:       true  - when operation terminated successfully\n'                false - failed due to the theme setup (framework)\n'               
 nil   - failed in some aspect\n' Description:   Setup themes for generating the centerline topology.\n'                The generation is done in RAS.PRE.BuildCLTopo.\n'                The themes to be processed are defined by their tags.\n' Calling:       RAS.PRE.BuildCLTopo\n' CalledBy:      none\n' Requires:      Framework (RAS.FRM.GetThmsByTagR, etc.)\n' History:       DDJ 2/99\n' ***************************************************************************\n\n'check to see if if the call is summary of singular\n' i
f it is the summary call, we don't want ot alert the\n'user until completion AlertYou=False\nif (self.is(list).Not) then\n  AlertYou = True\n  else \n  if (self.get(0) = \"NoAlert\") then\n    AlertYou = False\n  end\nend\n\n'-------------------------------------------------------------------------\n' Setup of working directory, title in the message boxes, and working view\n'-------------------------------------------------------------------------\n\n' Define the parent directory and the working (tmp) subdirectory\nTheProje
ct=av.GetProject\n' Get the View to work with\noView=av.GetActiveDoc                                 'ViewHandle\n\n'..Set the workDir to BaseMap.\n'av.run(\"RAS.FRM.SetBaseDir\",{oView})\n\n\n' Title for message box for these operations\nsTitle=\"Stream Centerline Topology Building\"          ' title text for message boxes\nbVerify=false                                         ' to force display of theme selection dialog\n\n\n'---------------------------------------------------------------------\n' Setup of required lists f
or use with the framework\n'---------------------------------------------------------------------\n\n' Provide the lists of Tags, ThmTypes, and ShpTypes.\nlTags={\"centerline\"}                     'Tags\nlThmTypes={FTheme}                       'ThmTypes\nlShpTypes={\"PolyLine\"}                   'ShpTypes POLYGON,POLYLINE,POINT,MultiPoint.\n\n' Create the Field descriptions of the required fields.  They are all listed in RAS.PRE.GetdFields\n' script.  This section just loads it from there.\n' Needs to be there even if
 none are used.\ndFields=av.run(\"RAS.PRE.GetdFields\",{lTags})\nldFields=List.Make\nfor each sTag in lTags\n  ldFields.Add(dFields.Get(sTag))  \nend\n\n\n' Define the default names.\nlDefNames={\"CLine\"}                    'Default names\n\n' Define the theme purpose type (input/output)\nlPurposes={\"I\"}\n\n' Overwrite options when the specified thm exists in the view, lOverWrt guides the operation.\n'For GTheme, 0=OverWrite,1,2=Prompt for a new name because overwrite is not an option.\n'For FTheme, 0=Clear, 1=Ask For a new N
ame, 2=Append.\n'lOverWrts is extented to be used for InputThms (used as the output Thm) as well.\n'if 0 then don't ask for a backup, overwrite the input theme with the output theme.\n'if 1 then ask if a backup should be made.\nlOverWrts={0}\n\n  \n' Use the framework to check on the themes and items\n'---------------------------------------------------\ndThms=av.run(\"RAS.FRM.GetThmsByTagR\",{oView,lTags,lThmTypes,lShpTypes,ldFields,lDefNames,lPurposes,lOverWrts,bVerify,sTitle})\nif(dThms.is(Dictionary))then\n\n  '-----
------------------------------------------------------------\n  ' Successfully returned the required themes, so we can do the work\n  '-----------------------------------------------------------------\n  '**     Stream Centerline Topology Building starts here         **\n\n  CenterTag=lTags.Get(0)                                 ' get the centerline tag\n  theCLTheme=dThms.Get(CenterTag)                        ' get the centerline theme to use\n  theCLFTab = theCLTheme.getFTab                         ' get the cen
terline FTab\n\n  theRunRet = av.run(\"RAS.PRE.BuildCLTopo\",{theCLFTab})  ' run the actual topology builder\n  \n  if (theRunRet) then\n      ' successfull end\n      if (AlertYou) then\n         MsgBox.Info(\"Centerline topology generation completed successfully\",sTitle)\n      end\n    else\n      ' unsuccessfull end\n      theCLFTab.Flush\n      theCLFTab.SetEditable(FALSE)\n      tMessage = \"Centerline topology generation completed UNSUCCESSFULLY!\"\n      MsgBox.Warning(tMessage,sTitle)\n  end\n\n\n  \n  '**        End of S
tream Centerline Topology Building           **\n  '-----------------------------------------------------------------\n\nelse\n\n  ' Problem in returning from checking the themes\n    sText = \"Problem with input themes.  Operation cancelled\"\n    MsgBox.Warning(sText,sTitle)\n    return false\n    \nend\n\nreturn true\n"
)

(Script.238
	Name:	"RAS.PRE.CS2DToCS3D"
	SourceCode:	"' Name: RAS.PRE.CS2DToCS3D\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:          RAS.PRE.CS2DToCS3D \n' USAGE:         Called from menu\n' Returns:       true  - when operation terminated successfully\n'                false - failed due to the theme setup (framework)\n'       
         nil   - failed in some aspect\n' Description:   Convert a 2D cross-section to 3D cross-section\n'                using the specified TIN.\n'                The themes to be processed are defined by their tags.\n' Calling:       none\n' CalledBy:      none\n' Requires:      Framework (RAS.FRM.GetThmsByTagR, etc.)\n' History:       DDJ 2/99\n' ***************************************************************************\n\n'-------------------------------------------------------------------------\n' Setup of work
ing directory, title in the message boxes, and working view\n'-------------------------------------------------------------------------\n\n' Define the parent directory and the working (tmp) subdirectory\nTheProject=av.GetProject\n' Get the View to work with\noView=av.GetActiveDoc                                 'ViewHandle\n\n'..Set the workDir to BaseMap.\n'av.run(\"RAS.FRM.SetBaseDir\",{oView})\n\n\n' Title for message box for these operations\nsTitle=\"2D cross-section to 3D cross-section conversion\"    ' title text fo
r message boxes\nbVerify=false                                               ' to force display of theme selection dialog\n\n\n'---------------------------------------------------------------------\n' Setup of required lists for use with the framework\n'---------------------------------------------------------------------\n\n' Provide the lists of Tags, ThmTypes, and ShpTypes.\nlTags={\"cross2d\",\"terrain\"}              'Tags\nlThmTypes={FTheme,STheme}                'ThmTypes\nlShpTypes={\"PolyLine\",\"TIN\"}             '
ShpTypes POLYGON,POLYLINE,POINT,MultiPoint.\n\n' Create the Field descriptions of the required fields.\n' Needs to be there even if none are used.\nldFields={nil,nil}\n\n\n' Define the default names.\nlDefNames={\"CSect\",\"TerrTIN\"}            'Default names\n\n' Define the theme purpose type (input/output)\nlPurposes={\"I\",\"I\"}\n\n' Overwrite options when the specified thm exists in the view, lOverWrt guides the operation.\n'For GTheme, 0=OverWrite,1,2=Prompt for a new name because overwrite is not an option.\n'For FTheme, 
0=Clear, 1=Ask For a new Name, 2=Append.\n'lOverWrts is extented to be used for InputThms (used as the output Thm) as well.\n'if 0 then don't ask for a backup, overwrite the input theme with the output theme.\n'if 1 then ask if a backup should be made.\nlOverWrts={0,0}\n\n  \n' Use the framework to check on the themes and items\n'---------------------------------------------------\ndThms=av.run(\"RAS.FRM.GetThmsByTagR\",{oView,lTags,lThmTypes,lShpTypes,ldFields,lDefNames,lPurposes,lOverWrts,bVerify,sTitle})\nif(dThms.i
s(Dictionary))then\n\n  '--------------------------------------------------------------------\n  ' Successfully returned the required themes, so we can do the work\n  '--------------------------------------------------------------------\n  '**  2D cross-section to 3D cross-section conversion starts here   **\n\n  CSTag=lTags.Get(0)                                     ' get the cross-section tag\n  the2DCSThemeRet=dThms.Get(CSTag)                       ' get the cross-section theme to use\n  the2DFtab = the2DCSThemeR
et.getFTab                    ' get the cross-section FTab\n\n  TINTag=lTags.Get(1)                                    ' get the TIN tag\n  theTINThemeRet=dThms.Get(TINTag)                       ' get the TIN theme to use\n  theSurface = theTINThemeRet.GetSurface                 ' define the surface from TIN\n\n\n  ' Get the name of the 3D shape file to create\n  '--------------------------------------------\n  the2DCSFileName = the2DCSThemeRet.GetSrcName.GetFileName    ' get the 2D source file name\n  aDirName = the
2DCSFileName.ReturnDir\n  theNameString = the2DCSFileName.GetName.AsString\n  thePropString = theNameString.AsTokens(\".\").Get(0)+\"3D.shp\"\n  new3DFN = thePropString.AsFileName\n  \n  the3DShapeName = FileDialog.Put(new3DFN,\"*.shp\",\"Specify the name of a 3D cross-section shape file to create\")\n  if (the3DShapeName = nil) then\n    ' the selection has not been made.  Give a message and quit\n    tMessage = \"The 3D cross-section theme name has not been selected!\"\n    tMessage = tMessage + nl + \"3D cross-section extra
ction has not been performed.\"\n    MsgBox.Warning(tMessage, sTitle)\n    return nil    \n  end  \n  \n  \n  ' Create the 3D shape file from the 2D shape file\n  '------------------------------------------------\n  thePrj = Prj.MakeNull                                        ' define a null prjection (no projection on thefly)\n  the3DFTab = theSurface.InterpolateAsFTab(the2DFTab,the3DShapeName,thePrj,0)\n  the3DFTab.Flush                                              ' save on disk\n  the3DFTab.SetEditable(FALSE)      
                           ' stop editing\n  \n  \n  ' Add the 3D centerline theme to the view\n  '-------------------------------------------\n  the3DTheme = FTheme.Make(the3DFTab)                          ' create the theme\n  oView.AddTheme(the3DTheme)                                  ' add the theme to the view\n  \n  \n  ' Set the cross3d tag. If the view already contains the 3D cross-section \n  ' theme, that theme will no longer be tagged - the new one will.\n  '-------------------------------------------------
-------------------------------\n  av.run(\"RAS.FRM.ThmTagMgr\", {\"SetThm\",oView,the3DTheme,\"cross3d\"})  \n  \n  tMessage = \"3D cross-section theme generation completed successfully!\"\n  MsgBox.Info(tMessage, sTitle)\n\n \n  '**   End of 2D cross-section to 3D cross-section conversion    **\n  '-----------------------------------------------------------------\n\nelse\n\n  ' Problem in returning from checking the themes\n    sText = \"Problem with input themes.  Operation cancelled\"\n    MsgBox.Warning(sText,sTitle)\n    retu
rn false\n    \nend\n\nreturn true\n"
)

(Script.239
	Name:	"RAS.PRE.DistanceCSAttributes"
	SourceCode:	"' Name: RAS.PRE.DistanceCSAttributes\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:          RAS.PRE.DistanceCSAttributes \n' USAGE:         Called from menu\n' Returns:       true  - when operation terminated successfully\n'                false - failed due to the theme setup 
(framework)\n'                nil   - failed in some aspect\n' Description:   Setup parameters for computation of distances\n'                between the cross-sections.  The computations\n'                are done in RAS.PRE.CalcDistCSAtt.\n' Calling:       RAS.PRE.CalcDistCSAtt\n' CalledBy:      none\n' Requires:      Framework (RAS.FRM.GetThmsByTagR, etc.)\n' History:       DDJ 2/99\n' ***************************************************************************\n\n'check to see if if the call is summary of singular\n
' if it is the summary call, we don't want ot alert the\n'user until completion AlertYou=False\nif (self.is(list).Not) then\n  AlertYou = True\n  else \n  if (self.get(0) = \"NoAlert\") then\n    AlertYou = False\n  end\nend\n\n\n'-------------------------------------------------------------------------\n' Setup of working directory, title in the message boxes, and working view\n'-------------------------------------------------------------------------\n\n' Define the parent directory and the working (tmp) subdirectory\nTheP
roject=av.GetProject\n' Get the View to work with\noView=av.GetActiveDoc                                 'ViewHandle\n\n'..Set the workDir to BaseMap.\n'av.run(\"RAS.FRM.SetBaseDir\",{oView})\n\n\n' Title for message box for these operations\nsTitle=\"Cross-section distance computations\"          ' title text for message boxes\nbVerify=false                                         ' to force display of theme selection dialog\n\n\n'---------------------------------------------------------------------\n' Setup of required lis
ts for use with the framework\n'---------------------------------------------------------------------\n\n' Provide the lists of Tags, ThmTypes, and ShpTypes.\nlTags={\"flowpaths\",\"cross2D\"}            'Tags\nlThmTypes={FTheme,FTheme}                'ThmTypes\nlShpTypes={\"PolyLine\",\"PolyLine\"}        'ShpTypes POLYGON,POLYLINE,POINT,MultiPoint.\n\n\n' Create the Field descriptions of the required fields.  They are all listed in RAS.PRE.GetdFields3\n' script.  This section just loads it from there.  GetdFields3\n' Needs 
to be there even if none are used.\nlTags1={\"cross2D\"}\ndFields=av.run(\"RAS.PRE.GetdFields3\",{lTags1})\nldFields=List.Make\nfor each sTag in lTags\n  ldFields.Add(dFields.Get(sTag))  \nend\n\n\n' Define the default names.\nlDefNames={\"Banks\",\"CSect\"}            'Default names\n\n' Define the theme purpose type (input/output)\nlPurposes={\"I\",\"I\"}\n\n' Overwrite options when the specified thm exists in the view, lOverWrt guides the operation.\n'For GTheme, 0=OverWrite,1,2=Prompt for a new name because overwrite is not an opt
ion.\n'For FTheme, 0=Clear, 1=Ask For a new Name, 2=Append.\n'lOverWrts is extented to be used for InputThms (used as the output Thm) as well.\n'if 0 then don't ask for a backup, overwrite the input theme with the output theme.\n'if 1 then ask if a backup should be made.\nlOverWrts={0,0}\n\n  \n' Use the framework to check on the themes and items\n'---------------------------------------------------\ndThms=av.run(\"RAS.FRM.GetThmsByTagR\",{oView,lTags,lThmTypes,lShpTypes,ldFields,lDefNames,lPurposes,lOverWrts,bVerify,s
Title})\nif(dThms.is(Dictionary))then\n\n  '-----------------------------------------------------------------\n  ' Successfully returned the required themes, so we can do the work\n  '-----------------------------------------------------------------\n  '**       Cross-section distance computations start here        **\n\n  FlowTag=lTags.Get(0)                                  ' get the centerline tag\n  theFlowThemeRet=dThms.Get(FlowTag)                    ' get the centerline theme to use\n  theFlowFtab = theFlowThe
meRet.getFTab                 ' get the centerline FTab\n\n  CSTag=lTags.Get(1)                                     ' get the CS tag\n  theCSThemeRet=dThms.Get(CSTag)                         ' get the CS theme to use\n  theCSFTab = theCSThemeRet.getFTab                      ' get the CS FTab\n\n\n  ' Call RAS.PRE.CalcDistCSAtt to perform the computations\n  '-----------------------------------------------------\n  theRunRet = av.run(\"RAS.PRE.CalcDistCSAtt\",{theCSFTab,theFlowFTab})\n  \n  if (theRunRet) then\n      ' su
ccessfull end - \n      if (AlertYou) then\n        MsgBox.Info(\"Distances between cross-sections computed successfully!\",sTitle)\n      end\n    else\n      ' unsuccessfull end - stop editing (since that was not done in the sub)\n      theCSFTab.Flush\n      theCSFTab.SetEditable(FALSE)\n      tMessage = \"Distances between cross-sections computed UNSUCCESSFULLY!\"\n      tMessage = tMessage + nl + \"The cross-section theme is not valid (but can be used for debugging)!\"\n      MsgBox.Warning(tMessage,sTitle)\n  end\n\n\n  
'**         End of Cross-section distance computations          **\n  '-----------------------------------------------------------------\n\nelse\n\n  ' Problem in returning from checking the themes\n    sText = \"Problem with input themes.  Operation cancelled\"\n    MsgBox.Warning(sText,sTitle)\n    return false\n    \nend\n\nreturn true\n"
)

(Script.240
	Name:	"RAS.PRE.Extract3DCL"
	SourceCode:	"' Name: RAS.PRE.Extract3DCL\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:          RAS.PRE.Extract3DCL \n' USAGE:         Called from menu\n' Returns:       true  - when operation terminated successfully\n'                false - failed due to the theme setup (framework)\n'     
           nil   - failed in some aspect\n' Description:   Setup themes for generating the RAS GIS import \n'                file section for stream centerlines.  The generation\n'                is done in RAS.PRE.Build3DCLtoRASout.\n'                The themes to be processed are defined by their tags.\n' Calling:       RAS.PRE.Build3DCLtoRASout\n' CalledBy:      none\n' Requires:      Framework (RAS.FRM.GetThmsByTagR, etc.)\n' History:       DDJ 2/99\n'                CTA 12.7.99 - Implemented NoAlert\n' *********
******************************************************************\n\n'-------------------------------------------------------------------------\n' Setup of working directory, title in the message boxes, and working view\n'-------------------------------------------------------------------------\n\n'check to see if if the call is summary of singular\n' if it is the summary call, we don't want ot alert the\n'user until completion AlertYou=False\nif (self.is(list).Not) then\n  AlertYou = True\n  else \n  if (self.get(0) 
= \"NoAlert\") then\n    AlertYou = False\n  end\nend\n\n\n' Define the parent directory and the working (tmp) subdirectory\nTheProject=av.GetProject\n' Get the View to work with\noView=av.GetActiveDoc                                 'ViewHandle\n\n'..Set the workDir to BaseMap.\n'av.run(\"RAS.FRM.SetBaseDir\",{oView})\n\n\n' Title for message box for these operations\nsTitle=\"RAS GIS: Import File Generation - Stream Centerlines\"   ' title text for message boxes\nbVerify=false                                                   '
 to force display of theme selection dialog\n\n\n'--------------------------------------------------------------------------\n' Test if the export file name is defined.  Bring up the entry form if not.\n'--------------------------------------------------------------------------\nsExportFileName = av.run(\"RAS.FRM.ViewTagMgr\", {\"GetValue\",oView,\"sExportFileName\"})\nif (sExportFileName = nil) Then\n  ' the file name has not been defined.  Provide a message and quit.\n  sMessage = \"The current View does not contain a va
lid reference to\"\n  sMessage = sMessage + nl + \"the RAS GIS input file!\"\n  MsgBox.Warning (sMessage,sTitle)\n'  av.run(\"RAS.PRE.InputDialogShow\",nil)\n  return nil\nend\n\n\n'---------------------------------------------------------------------\n' Setup of required lists for use with the framework\n'---------------------------------------------------------------------\n\n' Provide the lists of Tags, ThmTypes, and ShpTypes.\nlTags={\"centerline3d\"}                   'Tags\nlThmTypes={FTheme}                       'ThmTyp
es\nlShpTypes={\"PolyLineZ\"}                  'ShpTypes POLYGON,POLYLINE,POINT,MultiPoint.\n\n' Create the Field descriptions of the required fields.  They are all listed in RAS.PRE.GetdFields\n' script.  This section just loads it from there.\n' Needs to be there even if none are used.\ndFields=av.run(\"RAS.PRE.GetdFields\",{lTags})\nldFields=List.Make\nfor each sTag in lTags\n  ldFields.Add(dFields.Get(sTag))  \nend\n\n\n' Define the default names.\nlDefNames={\"3DCLine\"}                    'Default names\n\n' Define the the
me purpose type (input/output)\nlPurposes={\"I\"}\n\n' Overwrite options when the specified thm exists in the view, lOverWrt guides the operation.\n'For GTheme, 0=OverWrite,1,2=Prompt for a new name because overwrite is not an option.\n'For FTheme, 0=Clear, 1=Ask For a new Name, 2=Append.\n'lOverWrts is extented to be used for InputThms (used as the output Thm) as well.\n'if 0 then don't ask for a backup, overwrite the input theme with the output theme.\n'if 1 then ask if a backup should be made.\nlOverWrts={0}\n\n  \n' 
Use the framework to check on the themes and items\n'---------------------------------------------------\ndThms=av.run(\"RAS.FRM.GetThmsByTagR\",{oView,lTags,lThmTypes,lShpTypes,ldFields,lDefNames,lPurposes,lOverWrts,bVerify,sTitle})\nif(dThms.is(Dictionary))then\n\n  '----------------------------------------------------------------------\n  ' Successfully returned the required themes, so we can do the work\n  '----------------------------------------------------------------------\n  '** RAS GIS: Import File Generati
on - Stream Centerlines starts here **\n\n  CenterTag=lTags.Get(0)                                 ' get the centerline tag\n  theCLTheme=dThms.Get(CenterTag)                        ' get the centerline theme to use\n  theCLFTab = theCLTheme.getFTab                         ' get the centerline FTab\n\n\n  ' Run the actual code to generate the RAS GIS Input file\n  '-------------------------------------------------------\n  theExportFileName = sExportFileName                                        ' set the export fi
le name\n  \n  ' Call the routine for exporting the data (pass file name and the CL FTab)\n  theRunRet = av.run(\"RAS.PRE.Build3DCLtoRASout\",{theExportFileName,theCLFTab})\n  \n  if (theRunRet) then\n      ' successfull end\n      'don't tell the user if the process is done in summary AlertYou=False if summary call\n      if (AlertYou) then\n        MsgBox.Info(\"RAS GIS Input file centerline generation completed successfully\",sTitle)\n      end\n    else\n      ' unsuccessfull end\n      tMessage = \"RAS GIS Input file ce
nterline generation completed UNSUCCESSFULLY!\"\n      tMessage = tMessage + nl + \"RAS GIS Input file is not valid (but can be used for debugging)!\"\n      MsgBox.Warning(tMessage,sTitle)\n  end\n  \n  '**  End of RAS GIS: Import File Generation - Stream Centerlines    **\n  '---------------------------------------------------------------------\n\nelse\n\n  ' Problem in returning from checking the themes\n    sText = \"Problem with input themes.  Operation cancelled\"\n    MsgBox.Warning(sText,sTitle)\n    return false\n   
 \nend\n\nreturn true\n"
)

(Script.241
	Name:	"RAS.PRE.Extract3DCS"
	SourceCode:	"' Name: RAS.PRE.Extract3DCS\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:          RAS.PRE.Extract3DCS \n' USAGE:         Called from menu\n' Returns:       true  - when operation terminated successfully\n'                false - failed due to the theme setup (framework)\n'     
           nil   - failed in some aspect\n' Description:   Setup themes for generating the RAS GIS import \n'                file from existing cross-sections.  The generation\n'                is done in RAS.PRE.Build3DCStoRASout.\n'                The themes to be processed are defined by their tags.\n' Calling:       RAS.PRE.Build3DCStoRASout\n' CalledBy:      none\n' Requires:      Framework (RAS.FRM.GetThmsByTagR, etc.)\n' History:       DDJ 2/99\n'                CTA 12.7.99 - Implemented NoAlert\n' ***********
****************************************************************\n\n'check to see if if the call is summary of singular\n' if it is the summary call, we don't want ot alert the\n'user until completion AlertYou=False\nif (self.is(list).Not) then\n  AlertYou = True\n  else \n  if (self.get(0) = \"NoAlert\") then\n    AlertYou = False\n  end\nend\n\n\n'-------------------------------------------------------------------------\n' Setup of working directory, title in the message boxes, and working view\n'--------------------------
-----------------------------------------------\n\n' Define the parent directory and the working (tmp) subdirectory\nTheProject=av.GetProject\n' Get the View to work with\noView=av.GetActiveDoc                                 'ViewHandle\n\n'..Set the workDir to BaseMap.\n'av.run(\"RAS.FRM.SetBaseDir\",{oView})\n\n\n' Title for message box for these operations\nsTitle=\"RAS GIS: Import File Generation - Cross-sections\"      ' title text for message boxes\nbVerify=false                                                  ' to 
force display of theme selection dialog\n\n\n'--------------------------------------------------------------------------\n' Test if the export file name is defined.  Bring up the entry form if not.\n'--------------------------------------------------------------------------\nsExportFileName = av.run(\"RAS.FRM.ViewTagMgr\", {\"GetValue\",oView,\"sExportFileName\"})\nif (sExportFileName = nil) Then\n  ' the file name has not been defined.  Provide a message and quit.\n  sMessage = \"The current View does not contain a valid 
reference to\"\n  sMessage = sMessage + nl + \"the RAS GIS input file!\"\n  MsgBox.Warning (sMessage,sTitle)\n'  av.run(\"RAS.PRE.InputDialogShow\",nil)\n  return nil\nend\n\n\n'---------------------------------------------------------------------\n' Setup of required lists for use with the framework\n'---------------------------------------------------------------------\n\n' Provide the lists of Tags, ThmTypes, and ShpTypes.\nlTags={\"cross2d\",\"cross3d\"}              'Tags\nlThmTypes={FTheme,FTheme}                'ThmTypes\nl
ShpTypes={\"PolyLine\",\"PolyLineZ\"}        'ShpTypes POLYGON,POLYLINE,POINT,MultiPoint.\n\n' Create the Field descriptions of the required fields.  They are all listed in RAS.PRE.GetdFields\n' script.  This section just loads it from there.  We need to check only the 3D theme.\n' Needs to be there even if none are used.\nlTags1={\"cross3d\"}\ndFields=av.run(\"RAS.PRE.GetdFields\",{lTags1})\nldFields=List.Make\nfor each sTag in lTags\n  ldFields.Add(dFields.Get(sTag))  \nend\n\n\n' Define the default names.\nlDefNames={\"2DCLine
\",\"3DCLine\"}                    'Default names\n\n' Define the theme purpose type (input/output)\nlPurposes={\"I\",\"I\"}\n\n' Overwrite options when the specified thm exists in the view, lOverWrt guides the operation.\n'For GTheme, 0=OverWrite,1,2=Prompt for a new name because overwrite is not an option.\n'For FTheme, 0=Clear, 1=Ask For a new Name, 2=Append.\n'lOverWrts is extented to be used for InputThms (used as the output Thm) as well.\n'if 0 then don't ask for a backup, overwrite the input theme with the output th
eme.\n'if 1 then ask if a backup should be made.\nlOverWrts={0,0}\n\n  \n' Use the framework to check on the themes and items\n'---------------------------------------------------\ndThms=av.run(\"RAS.FRM.GetThmsByTagR\",{oView,lTags,lThmTypes,lShpTypes,ldFields,lDefNames,lPurposes,lOverWrts,bVerify,sTitle})\nif(dThms.is(Dictionary))then\n\n  '--------------------------------------------------------------------\n  ' Successfully returned the required themes, so we can do the work\n  '--------------------------------------
------------------------------\n  '**  RAS GIS: Import File Generation - Cross-sections starts here  **\n\n  CSTag=lTags.Get(0)                                 ' get the 2D cross-section tag\n  the2DCSTheme=dThms.Get(CSTag)                      ' get the 2D cross-section theme to use\n  the2DCSFTab = the2DCSTheme.getFTab                 ' get the 2D cross-section FTab\n\n  CS3DTag=lTags.Get(1)                               ' get the 3D cross-section tag\n  theCSTheme=dThms.Get(CS3DTag)                      ' get th
e 3D cross-section theme to use\n  theCSFTab = theCSTheme.getFTab                     ' get the 3D cross-section FTab\n\n\n  ' Run the actual code to generate the RAS GIS Input file\n  '-------------------------------------------------------\n  theExportFileName = sExportFileName                                        ' set the export file name\n  \n  ' Call the routine for exporting the data (pass file name and the 2D and 3D CS FTabs)\n  theRunRet = av.run(\"RAS.PRE.Build3DCStoRASout\",{theExportFileName,the2DCSFTab,
theCSFTab})\n  \n  if (theRunRet) then\n      ' successfull end\n      'don't tell the user if the process is done in summary AlertYou=False if summary call\n      if (AlertYou) then\n        MsgBox.Info(\"RAS GIS Import File: cross-section generation completed successfully\",sTitle)\n      end\n    else\n      ' unsuccessfull end\n      tMessage = \"RAS GIS Input file cross-section generation completed UNSUCCESSFULLY!\"\n      tMessage = tMessage + nl + \"RAS GIS Import File: is not valid (but can be used for debugging)!\"
\n      MsgBox.Warning(tMessage,sTitle)\n  end\n  \n  '**   End of RAS GIS: Import File Generation - Cross-sections     **\n  '-------------------------------------------------------------------\n\nelse\n\n  ' Problem in returning from checking the themes\n    sText = \"Problem with input themes.  Operation cancelled\"\n    MsgBox.Warning(sText,sTitle)\n    return false\n    \nend\n\nreturn true\n"
)

(Script.242
	Name:	"RAS.PRE.ExtractHeader"
	SourceCode:	"' Name: RAS.PRE.ExtractHeader\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:          RAS.PRE.ExtractHeader \n' USAGE:         Called from menu\n' Returns:       true  - when operation terminated successfully\n'                false - failed due to the theme setup (framework)\n' 
               nil   - failed in some aspect\n' Description:   Setup themes for generating the RAS GIS import \n'                file header section.  Extract the values and store them in\n'                the export file.  Use the View's tag dictionary to get the\n'                export file name (instead of global variable).\n'                The themes to be processed are defined by their tags.\n' Calling:       none\n' CalledBy:      none\n' Requires:      Framework (RAS.FRM.GetThmsByTagR, etc.)\n' History:    
   DDJ 3/99\n'                CTA; 12.7.99 - implemented NoAlert feature\n' ***************************************************************************\n'\n'check to see if if the call is summary or singular\n' if it is the summary call, we don't want ot alert the\n'user until completion AlertYou=False\nif (self.is(list).Not) then\n  AlertYou = True\n  else \n  if (self.get(0) = \"NoAlert\") then\n    AlertYou = False\n  end\nend\n'-------------------------------------------------------------------------\n' Setup of working
 directory, title in the message boxes, and working view\n'-------------------------------------------------------------------------\n\n' Define the parent directory and the working (tmp) subdirectory\nTheProject=av.GetProject\n' Get the View to work with\noView=av.GetActiveDoc                                 'ViewHandle\n\n'..Set the workDir to BaseMap.\n'av.run(\"RAS.FRM.SetBaseDir\",{oView})\n\n\n' Title for message box for these operations\nsTitle=\"RAS GIS: Import File Generation - Header\"      ' title text for messag
e boxes\nbVerify=false                                          ' to force display of theme selection dialog\n\n\n'--------------------------------------------------------------------------\n' Test if the export file name is defined.  Bring up the entry form if not.\n'--------------------------------------------------------------------------\n' Check if the input parameters are set correctly in the View's tag dictionary\n'-----------------------------------------------------------------------------\n\nsExportFileName
 = av.run(\"RAS.FRM.ViewTagMgr\", {\"GetValue\",oView,\"sExportFileName\"})\nif (sExportFileName = nil) Then\n  ' the file name has not been defined.  Provide a message and quit.\n  sMessage = \"The current View does not contain a valid reference to\"\n  sMessage = sMessage + nl + \"the RAS GIS input file!\"\n  MsgBox.Warning (sMessage,sTitle)\n'  av.run(\"RAS.PRE.InputDialogShow\",nil)\n  return nil\nend\n\n\n'---------------------------------------------------------------------\n' Setup of required lists for use with the framewo
rk\n'---------------------------------------------------------------------\n\n' Provide the lists of Tags, ThmTypes, and ShpTypes.\nlTags={\"centerline3d\",\"cross3d\",\"terrain\"}              'Tags\nlThmTypes={FTheme,FTheme,STheme}                        'ThmTypes\nlShpTypes={\"PolyLineZ\",\"PolyLineZ\",\"TIN\"}               'ShpTypes POLYGON,POLYLINE,POINT,MultiPoint.\n\n' Create the Field descriptions of the required fields.\n' Needs to be there even if none are used.\nldFields={nil,nil,nil}\n\n\n' Define the default names.\nlD
efNames={\"CL3D\",\"CSect\",\"TerrTIN\"}            'Default names\n\n' Define the theme purpose type (input/output)\nlPurposes={\"I\",\"I\",\"I\"}\n\n' Overwrite options when the specified thm exists in the view, lOverWrt guides the operation.\n'For GTheme, 0=OverWrite,1,2=Prompt for a new name because overwrite is not an option.\n'For FTheme, 0=Clear, 1=Ask For a new Name, 2=Append.\n'lOverWrts is extented to be used for InputThms (used as the output Thm) as well.\n'if 0 then don't ask for a backup, overwrite the input theme 
with the output theme.\n'if 1 then ask if a backup should be made.\nlOverWrts={0,0,0}\n\n  \n' Use the framework to check on the themes and items\n'---------------------------------------------------\ndThms=av.run(\"RAS.FRM.GetThmsByTagR\",{oView,lTags,lThmTypes,lShpTypes,ldFields,lDefNames,lPurposes,lOverWrts,bVerify,sTitle})\nif(dThms.is(Dictionary))then\n\n  '-----------------------------------------------------------------\n  ' Successfully returned the required themes, so we can do the work\n  '---------------------
--------------------------------------------\n  '**    RAS GIS: Import File Generation - Header starts here     **\n\n  CLTag=lTags.Get(0)                                ' get the 3D centerline tag\n  theCLTheme=dThms.Get(CLTag)                       ' get the 3D centerline theme to use\n  theCLFtab = theCLTheme.getFTab                    ' get the 3D centerline FTab\n\n  CSTag=lTags.Get(1)                                ' get the cross-section tag\n  theCSTheme=dThms.Get(CSTag)                       ' get the cros
s-section theme to use\n  theCSFtab = theCSTheme.getFTab                    ' get the cross-section FTab\n\n  TINTag=lTags.Get(2)                               ' get the TIN tag\n  theDEMTheme=dThms.Get(TINTag)                     ' get the TIN theme to use\n'  theSurface = theDEMTheme.GetSurface               ' define the surface from TIN\n\n\n  ' Specify the file to use to store the data.  Start with a new file.\n  '----------------------------------------------------------------\n  genFN = sExportFileName.AsFileNa
me                        ' assign the file name\n  genFile = LineFile.Make(genFN, #FILE_PERM_WRITE)          ' open the file with overwrite\n  \n  myDate = Date.Now                                         ' get current date\n  \n  \n  ' Write out the comments and intro lines\n  '---------------------------------------\n  theWriteString = \"# RAS input file created on \"+myDate.AsString\n  genFile.WriteElt(theWriteString)\n  genFile.WriteElt(\"# by ArcView extension HEC-GeoRAS Version 3.0\")\n  genFile.WriteElt(\"\")\n  genF
ile.WriteElt(\"BEGIN HEADER:\")\n  genFile.WriteElt(\"\")\n  \n\n  ' Find out if there is a projection file associated with the TIN and use it\n  ' if there is one.  Otherwise store nills for projection parameters and give \n  ' a message about it.\n  '---------------------------------------------------------------------------\n  myDirStr = theDEMTheme.GetSrcName.GetDataSource      ' get the directory where the TIN is\n  theRasOutName=myDirStr+\"\\prj.adf\"                    ' specify the projection file\n  \n  genFNPrj = t
heRasOutName.AsFileName                  ' assign the projection file name\n  \n  if (genFNPrj.IsFile) then                  ' check if the file name exists\n      ' the projection file exists.  Use it to extract the values\n      genFilePrj = LineFile.Make(genFNPrj, #FILE_PERM_READ)   ' open the file with read\n      prjList = {}                                     ' define the blank list for prj parameters\n      for each i in 0..4                               ' for first 5 lines\n        myString = genFilePrj.
ReadElt                  ' read the line in\n        lineList = myString.AsTokens(\" \")              ' tokenize the line\n        prjParam = lineList.Get(1)                     ' get the second token (parameter value)\n        prjList.Add(prjParam)                          ' add the parameter to the list\n      end\n      genFilePrj.Close                                 ' close the projection file\n    else\n      ' there is no projection file.  Save \"null\" as parameters and provide message\n      prjList = {\"null\",
\"null\",\"null\",\"null\",\"null\"}\n      theMsgStr = \"The TIN does not contain the projection file!\"\n      theMsgStr = theMsgStr + nl + \"Null values will be stored as projection parameters\"\n      theMsgStr = theMsgStr + nl + \"in the RAS GIS file.  You can modify those values\"\n      theMsgStr = theMsgStr + nl + \"manually after the file is written out (if necessary).\"\n      MsgBox.Warning(theMsgStr,sTitle)\n  end\n\n\n  ' Ask the user whether the units are metric or english if\n  ' that info can not be automatically ide
ntified.\n  '--------------------------------------------------------\n  if (prjList.Get(4).Ucase = \"METERS\") then\n      ' the tin units are in meters - use METRIC for UNITS\n      prjList.Remove(4)\n      prjList.Add(\"METRIC\")\n    elseif (prjList.Get(4).Ucase = \"FEET\") then\n      ' the tin units are in feet - use ENGLISH for UNITS\n      prjList.Remove(4)\n      prjList.Add(\"ENGLISH\")\n    else\n      ' unusable units for automated extraction - ask the user\n      theStr = \"Define the units of the analysis\"\n      t
heBoxList = {\"METRIC\",\"ENGLISH\"}\n      theAnswer = MsgBox.ListAsString(theBoxList,theStr,sTitle)\n      ' check if cancel has been pressed\n      if (theAnswer = nil) then\n        ' cancell pressed - give a message and quit\n        theStr = \"The UNITS parameter needs to be set\"\n        theStr = theStr + nl + \"RAS GIS Import File Generation Stopped!\"\n        MsgBox.Warning(theStr,sTitle)\n        exit\n      end  \n      prjList.Remove(4)\n      prjList.Add(theAnswer.AsString)\n  end\n  \n\n  ' Write out the theme's i
nfo\n  '---------------------------------------\n  'theCSTheme = the3DCSThemeRet.Get(0)                       ' specify the cross-section theme\n  'theCLTheme = the3DCLThemeRet.Get(0)                       ' specify the centerline theme\n  \n  genFile.WriteElt(\"  DTM TYPE: TIN\")                       ' currently only TIN is supported\n  theWriteString = \"  DTM: \"+theDEMTheme.GetSrcName.GetDataSource\n  genFile.WriteElt(theWriteString)\n  \n  theWriteString = \"  STREAM LAYER: \"+theCLTheme.GetSrcName.GetDataSource\n  g
enFile.WriteElt(theWriteString)\n  \n  'theCLFtab = theCLTheme.GetFTab\n  theBitMap = theCLFtab.GetSelection\n  theBitMap.SetAll\n  clCount = theBitMap.Count\n  theWriteString = \"  NUMBER OF REACHES: \"+clCount.AsString\n  genFile.WriteElt(theWriteString)\n  theBitMap.ClearAll\n  \n  theWriteString = \"  CROSS-SECTION LAYER: \"+theCSTheme.GetSrcName.GetDataSource\n  genFile.WriteElt(theWriteString)\n  \n  'theCSFtab = theCSTheme.GetFTab\n  theBitMap = theCSFtab.GetSelection\n  theBitMap.SetAll\n  clCount = theBitMap.Count\n  t
heWriteString = \"  NUMBER OF CROSS-SECTIONS: \"+clCount.AsString\n  genFile.WriteElt(theWriteString)\n  theBitMap.ClearAll\n\n\n  ' Write out the projection's info\n  '--------------------------------\n  ' define the list with text for projection parameters\n  prjTxtList = {\"  MAP PROJECTION: \",\"  PROJECTION ZONE: \",\"  DATUM: \",\"\",\"  UNITS: \"}\n  \n  ' write out the projection parameters (skip 4th element in the list)\n  for each i in 0..2\n    theWriteString = prjTxtList.Get(i)+prjList.Get(i)\n    genFile.WriteElt(theWr
iteString)\n  end\n  \n  theWriteString = prjTxtList.Get(4)+prjList.Get(4)     ' print out the UNITS\n  genFile.WriteElt(theWriteString)\n  \n  genFile.WriteElt(\"\")\n  genFile.WriteElt(\"END HEADER:\")                       ' write to the file the header end line\n  genFile.WriteElt(\"\")\n  \n  genFile.Close                                         ' close the ASCII file\n  \n  ' successfull end\n  'don't tell the user if the process is done in summary AlertYou=False if summary call\n  if (AlertYou) then\n    sText = \"RAS GIS
 Input file header generation completed successfully\"\n    MsgBox.Info(sText,sTitle)\n  end\n  \n  '**     End of RAS GIS: Import File Generation - Header      **\n  '--------------------------------------------------------------\n\nelse\n\n  ' Problem in returning from checking the themes\n    sText = \"Problem with input themes.  Operation cancelled\"\n    MsgBox.Warning(sText,sTitle)\n    return false\n    \nend\nreturn true\n"
)

(Script.243
	Name:	"RAS.PRE.GetdFields"
	SourceCode:	"' Name: RAS.PRE.GetdFields\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:  RAS.PRE.GetdFields \n' Self/USAGE: {TheView,ThmAct,ThmType,ShpType}\n\n' Returns: list of themes of the type specified.\n' Description: GetdFields by its Tags.\n' Requires:\n' History: zye 12/19/98\n'        
  DDJ 2/99    - implementation for RAS preprocessing.\n' ***************************************************************************\n'..TagSummary: List of all the sName tags used in this project.\n' For Themes:\n' sName (Tag)         Desc\n'\n'	centerline          2D stream centerline (FTheme).\n'\n' ***************************************************************************\n\nlTags=SELF.Get(0)\n'..Create the Field descriptions of the required fields.\n\n' The last digit indicates whether the field has to be existent
 or not.\n' If that value is 0, then the field does not have to be already present in the\n' table - it will be created.  If the value is 1, then the field needs to be \n' present in the table - if it is not, the code will return an error message and \n' the operation will stop with execution.\n\nCenterDict=Dictionary.Make(3)\n  CenterDict.Add(\"Stream_ID\",\"#FIELD_CHAR,16,0,1\")\n  CenterDict.Add(\"Reach_ID\",\"#FIELD_CHAR,16,0,1\")\n'  CenterDict.Add(\"is_Outlet\",\"#FIELD_SHORT,2,0,1\")\n  CenterDict.Add(\"from_Node\",\"#FIELD_
LONG,8,0,0\")\n  CenterDict.Add(\"to_Node\",\"#FIELD_LONG,8,0,0\")\n  CenterDict.Add(\"ArcLength\",\"#FIELD_DECIMAL,12,3,0\")\n  CenterDict.Add(\"from_ST\",\"#FIELD_DECIMAL,12,3,0\")\n  CenterDict.Add(\"to_ST\",\"#FIELD_DECIMAL,12,3,0\")\n\nCSDict=Dictionary.Make(3)\n  CSDict.Add(\"Stream_ID\",\"#FIELD_CHAR,16,0,0\")\n  CSDict.Add(\"Reach_ID\",\"#FIELD_CHAR,16,0,0\")\n  CSDict.Add(\"XS_ID\",\"#FIELD_SHORT,5,0,0\")\n\nCenter3DDict=Dictionary.Make(3)\n  Center3DDict.Add(\"Stream_ID\",\"#FIELD_CHAR,16,0,1\")\n  Center3DDict.Add(\"Reach_ID\",\"#FIELD_CHAR,16,
0,1\")\n'  Center3DDict.Add(\"is_Outlet\",\"#FIELD_SHORT,2,0,1\")\n  Center3DDict.Add(\"from_Node\",\"#FIELD_LONG,8,0,1\")\n  Center3DDict.Add(\"to_Node\",\"#FIELD_LONG,8,0,1\")\n  Center3DDict.Add(\"ArcLength\",\"#FIELD_DECIMAL,12,3,1\")\n  Center3DDict.Add(\"from_ST\",\"#FIELD_DECIMAL,12,3,1\")\n  Center3DDict.Add(\"to_ST\",\"#FIELD_DECIMAL,12,3,1\")\n\nCS3DDict=Dictionary.Make(4)\n  CS3DDict.Add(\"Stream_ID\",\"#FIELD_CHAR,16,0,1\")\n  CS3DDict.Add(\"Reach_ID\",\"#FIELD_CHAR,16,0,1\")\n  CS3DDict.Add(\"Station\",\"#FIELD_DECIMAL,11,4,1\")\n  CS3DDict.A
dd(\"XS_ID\",\"#FIELD_SHORT,5,0,0\")\n\nLUDict=Dictionary.Make(1)\n  LUDict.Add(\"N_value\",\"#FIELD_FLOAT,6,3,1\")\n\n\ndFTabFields=Dictionary.Make(1)\n\n  dFtabFields.Add(\"centerline\",CenterDict)\n  dFtabFields.Add(\"cross2d\",CSDict)\n  dFtabFields.Add(\"centerline3d\",Center3DDict)\n  dFtabFields.Add(\"cross3d\",CS3DDict)\n  dFtabFields.Add(\"landuse\",LUDict)\n\n\n  \n\ndFieldsReturn=Dictionary.Make(1)\n\nfor each sTag in lTags\n  dFieldsReturn.Add(sTag,dFtabFields.Get(sTag))\nend\n\nreturn dFieldsReturn \n\n\n\n"
)

(Script.244
	Name:	"RAS.PRE.GetdFields1"
	SourceCode:	"' Name: RAS.PRE.GetdFields1\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:  RAS.PRE.GetdFields1 \n' Self/USAGE: {TheView,ThmAct,ThmType,ShpType}\n\n' Returns: list of themes of the type specified.\n' Description: GetdFields by its Tags.  This set is used to define\n'              
the fields that are required before processing can be\n'              accomplished, so not fields will be generated if they\n'              are not present.\n' Requires:\n' History: zye 12/19/98\n'          DDJ 2/99    - implementation for RAS preprocessing.\n' ***************************************************************************\n'..TagSummary: List of all the sName tags used in this project.\n' For Themes:\n' sName (Tag)         Desc\n'\n'	centerline          2D stream centerline (FTheme).\n'\n' ****************
***********************************************************\n\n\nlTags=SELF.Get(0)\n'..Create the Field descriptions of the required fields.\n\n' The last digit indicates whether the field has to be existent or not.\n' If that value is 0, then the field does not have to be already present in the\n' table - it will be created.  If the value is 1, then the field needs to be \n' present in the table - if it is not, the code will return an error message and \n' the operation will stop with execution.\n\nCenterDict=Dictiona
ry.Make(3)\n'  CenterDict.Add(\"Stream_ID\",\"#FIELD_CHAR,16,0,1\")\n'  CenterDict.Add(\"Reach_ID\",\"#FIELD_CHAR,16,0,1\")\n'  CenterDict.Add(\"is_Outlet\",\"#FIELD_SHORT,2,0,1\")\n'  CenterDict.Add(\"from_Node\",\"#FIELD_LONG,8,0,0\")\n'  CenterDict.Add(\"to_Node\",\"#FIELD_LONG,8,0,0\")\n'  CenterDict.Add(\"ArcLength\",\"#FIELD_DECIMAL,12,3,0\")\n  CenterDict.Add(\"from_ST\",\"#FIELD_DECIMAL,12,3,1\")\n  CenterDict.Add(\"to_ST\",\"#FIELD_DECIMAL,12,3,1\")\n\nCSDict=Dictionary.Make(3)\n'  CSDict.Add(\"Stream_ID\",\"#FIELD_CHAR,16,0,0\")\n'  CSDict.Add(
\"Reach_ID\",\"#FIELD_CHAR,16,0,0\")\n  CSDict.Add(\"Station\",\"#FIELD_DECIMAL,11,4,0\")\ndFTabFields=Dictionary.Make(1)\n\ndFtabFields.Add(\"centerline\",CenterDict)\ndFtabFields.Add(\"cross2D\",CSDict)\n'dFtabFields.Add(\"RiverMg\",RiverMgDict)\n'dFtabFields.Add(\"PreMergedWatershed\",WaterMgDict)\n'dFtabFields.Add(\"POURPNT\",POURPNTDict)\n'dFtabFields.Add(\"POURWSH\",POURWSHDict)\n'dFtabFields.Add(\"NewProj\",NewProjDict)\n'dFtabFields.Add(\"ProjMgr\",ProjMgrDict)\n\n\ndFieldsReturn=Dictionary.Make(1)\n\nfor each sTag in lTags\n  dFieldsRetur
n.Add(sTag,dFtabFields.Get(sTag))\nend\n\nreturn dFieldsReturn \n\n\n"
)

(Script.245
	Name:	"RAS.PRE.GetdFields2"
	SourceCode:	"' Name: RAS.PRE.GetdFields2\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:  RAS.PRE.GetdFields2 \n' Self/USAGE: {TheView,ThmAct,ThmType,ShpType}\n\n' Returns: list of themes of the type specified.\n' Description: GetdFields by its Tags.  This set is used to define\n'              
the fields that are required before bank processing can be\n'              accomplished.\n' Requires:\n' History: zye 12/19/98\n'          DDJ 2/99    - implementation for RAS preprocessing.\n' ***************************************************************************\n'..TagSummary: List of all the sName tags used in this project.\n' For Themes:\n' sName (Tag)         Desc\n'\n'	centerline          2D stream centerline (FTheme).\n'\n' ***************************************************************************\n\n\nlTags
=SELF.Get(0)\n'..Create the Field descriptions of the required fields.\n\n' The last digit indicates whether the field has to be existent or not.\n' If that value is 0, then the field does not have to be already present in the\n' table - it will be created.  If the value is 1, then the field needs to be \n' present in the table - if it is not, the code will return an error message and \n' the operation will stop with execution.\n\n'CenterDict=Dictionary.Make(3)\n'  CenterDict.Add(\"Stream_ID\",\"#FIELD_CHAR,16,0,1\")\n'  
CenterDict.Add(\"Reach_ID\",\"#FIELD_CHAR,16,0,1\")\n'  CenterDict.Add(\"is_Outlet\",\"#FIELD_SHORT,2,0,1\")\n'  CenterDict.Add(\"from_Node\",\"#FIELD_LONG,8,0,0\")\n'  CenterDict.Add(\"to_Node\",\"#FIELD_LONG,8,0,0\")\n'  CenterDict.Add(\"ArcLength\",\"#FIELD_DECIMAL,12,3,0\")\n'  CenterDict.Add(\"from_ST\",\"#FIELD_DECIMAL,12,3,1\")\n'  CenterDict.Add(\"to_ST\",\"#FIELD_DECIMAL,12,3,1\")\n\nCSDict=Dictionary.Make(3)\n'  CSDict.Add(\"Stream_ID\",\"#FIELD_CHAR,16,0,0\")\n'  CSDict.Add(\"Reach_ID\",\"#FIELD_CHAR,16,0,0\")\n  CSDict.Add(\"Station\",\"#FIELD_
DECIMAL,11,4,1\")\n  CSDict.Add(\"L_BankP\",\"#FIELD_DECIMAL,8,5,0\")\n  CSDict.Add(\"R_BankP\",\"#FIELD_DECIMAL,8,5,0\")\n\ndFTabFields=Dictionary.Make(1)\n\n'dFtabFields.Add(\"centerline\",CenterDict)\ndFtabFields.Add(\"cross2D\",CSDict)\n'dFtabFields.Add(\"RiverMg\",RiverMgDict)\n'dFtabFields.Add(\"PreMergedWatershed\",WaterMgDict)\n'dFtabFields.Add(\"POURPNT\",POURPNTDict)\n'dFtabFields.Add(\"POURWSH\",POURWSHDict)\n'dFtabFields.Add(\"NewProj\",NewProjDict)\n'dFtabFields.Add(\"ProjMgr\",ProjMgrDict)\n\n\ndFieldsReturn=Dictionary.Make(1)\n\nfor e
ach sTag in lTags\n  dFieldsReturn.Add(sTag,dFtabFields.Get(sTag))\nend\n\nreturn dFieldsReturn \n\n\n"
)

(Script.246
	Name:	"RAS.PRE.GetdFields3"
	SourceCode:	"' Name: RAS.PRE.GetdFields3\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:  RAS.PRE.GetdFields3 \n' Self/USAGE: {TheView,ThmAct,ThmType,ShpType}\n\n' Returns: list of themes of the type specified.\n' Description: GetdFields by its Tags.  This set is used to define\n'              
the fields that are required before bank processing can be\n'              accomplished.\n' Requires:\n' History: zye 12/19/98\n'          DDJ 2/99    - implementation for RAS preprocessing.\n' ***************************************************************************\n'..TagSummary: List of all the sName tags used in this project.\n' For Themes:\n' sName (Tag)         Desc\n'\n'	centerline          2D stream centerline (FTheme).\n'\n' ***************************************************************************\n\n\nlTags
=SELF.Get(0)\n'..Create the Field descriptions of the required fields.\n\n' The last digit indicates whether the field has to be existent or not.\n' If that value is 0, then the field does not have to be already present in the\n' table - it will be created.  If the value is 1, then the field needs to be \n' present in the table - if it is not, the code will return an error message and \n' the operation will stop with execution.\n\n'CenterDict=Dictionary.Make(3)\n'  CenterDict.Add(\"Stream_ID\",\"#FIELD_CHAR,16,0,1\")\n'  
CenterDict.Add(\"Reach_ID\",\"#FIELD_CHAR,16,0,1\")\n'  CenterDict.Add(\"is_Outlet\",\"#FIELD_SHORT,2,0,1\")\n'  CenterDict.Add(\"from_Node\",\"#FIELD_LONG,8,0,0\")\n'  CenterDict.Add(\"to_Node\",\"#FIELD_LONG,8,0,0\")\n'  CenterDict.Add(\"ArcLength\",\"#FIELD_DECIMAL,12,3,0\")\n'  CenterDict.Add(\"from_ST\",\"#FIELD_DECIMAL,12,3,1\")\n'  CenterDict.Add(\"to_ST\",\"#FIELD_DECIMAL,12,3,1\")\n\nCSDict=Dictionary.Make(3)\n  CSDict.Add(\"Stream_ID\",\"#FIELD_CHAR,16,0,1\")\n'  CSDict.Add(\"Reach_ID\",\"#FIELD_CHAR,16,0,0\")\n  CSDict.Add(\"Station\",\"#FIELD_D
ECIMAL,11,4,1\")\n'  CSDict.Add(\"L_BankP\",\"#FIELD_DECIMAL,8,5,0\")\n'  CSDict.Add(\"R_BankP\",\"#FIELD_DECIMAL,8,5,0\")\n  CSDict.Add(\"L_ReachL\",\"#FIELD_DECIMAL,10,3,0\")\n  CSDict.Add(\"M_ReachL\",\"#FIELD_DECIMAL,10,3,0\")\n  CSDict.Add(\"R_ReachL\",\"#FIELD_DECIMAL,10,3,0\")\n\ndFTabFields=Dictionary.Make(1)\n\n'dFtabFields.Add(\"centerline\",CenterDict)\ndFtabFields.Add(\"cross2D\",CSDict)\n'dFtabFields.Add(\"RiverMg\",RiverMgDict)\n'dFtabFields.Add(\"PreMergedWatershed\",WaterMgDict)\n'dFtabFields.Add(\"POURPNT\",POURPNTDict)\n'dFtabFields.
Add(\"POURWSH\",POURWSHDict)\n'dFtabFields.Add(\"NewProj\",NewProjDict)\n'dFtabFields.Add(\"ProjMgr\",ProjMgrDict)\n\n\ndFieldsReturn=Dictionary.Make(1)\n\nfor each sTag in lTags\n  dFieldsReturn.Add(sTag,dFtabFields.Get(sTag))\nend\n\nreturn dFieldsReturn \n\n\n"
)

(Script.247
	Name:	"RAS.PRE.InputAll"
	SourceCode:	"' Name: RAS.PRE.InputAll\n'**************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'**************************************************************\n' Name:        RAS.PRE.InputAll\n' Usage:       from the button\n' Returns:     none\n' Description: Perform the full RAS Input file generation.\n'              It basically sequences the three export\n'              operations defined through t
he menu entries.\n'              \n'              Steps:  Export header\n'                      Export stream centerline data\n'                      Export cross-section data\n'\n' Requirements: 3D stream ceneterline theme\n'               3D cross-section theme\n'               terrain TIN\n'               output file name\n'\n' History:      DDJ; 4/29/98 - original coding\n'               DDJ; 3/99 - Change in name and header\n'               CTA; 12.7.99 - Make the call to scripts \n'                          without
 forcing the \"im successful\" dialog\n'**************************************************************\nEndResult = True\nmyResult = av.run(\"RAS.PRE.ExtractHeader\",{\"NoAlert\"})\nif (myResult) then one = \"two\"\n  else EndResult = False\n    sTitle = \"Attempting to write Header\"\n    MsgBox.Info(\"RAS GIS Import File is not valid\",sTitle)\n    exit\nend\n\nmyResult = av.run(\"RAS.PRE.Extract3DCL\",{\"NoAlert\"})\nif ((myResult).Not Or (EndResult).Not) then\n  EndResult = False\n  sTitle = \"Attempting to write Stream Centerline\"\n 
 MsgBox.Info(\"RAS GIS Import File is not valid\",sTitle)\n  exit\nend\n\nmyResult = av.run(\"RAS.PRE.Extract3DCS\",{\"NoAlert\"})\nif ((myResult).Not Or (EndResult).Not) then\n  EndResult = False\n  sTitle = \"Attempting to write Cross Sections\"\n  MsgBox.Info(\"RAS GIS Import File is not valid\",sTitle)\n  exit\nend\n  \nif (EndResult) then\n  sTitle = \"RAS GIS Import File Generation\"\n  MsgBox.Info(\"RAS GIS Import File created successfully\",sTitle)\n else\n  sTitle = \"RAS GIS Import File Generation\"\n  MsgBox.Info(\"RAS GIS Import
 File is not valid\",sTitle)\nend\n\nreturn nil\n\n"
)

(Script.248
	Name:	"RAS.PRE.InputDialog"
	SourceCode:	"' Name: RAS.PRE.InputDialog\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:          RAS.PRE.InputDialog \n' USAGE:         Called from menu entry\n' Returns:       None\n' Description:   Defines the themes to be used in RAS preprocessing.\n' CalledBy:      None\n' Requires:      F
ramework code (RAS.FRM.GetThmsByTagR, etc.)\n' History:       DDJ 2/99.\n'                DM3 8/99, Added support for land use theme\n' ***************************************************************************\n\n'-------------------------------------------------------------------------\n' Initial Setup \n'-------------------------------------------------------------------------\n\n' Get the View and Display to work with\noView=av.GetActiveDoc                                 ' View handle\nTheDisplay=oView.GetDispla
y                           ' Display handle\n\n' Title for message box for these operations\nsTitle=\"Theme Selection for RAS Preprocessor\"         ' title text for message boxes\nbVerify=true                                          ' to force display of theme selection dialog\n\n'---------------------------------------------------------------------\n' Setup of required lists for use with the framework\n'---------------------------------------------------------------------\n\n' Provide the lists of Tags, ThmTypes, a
nd ShpTypes.\nlTags={\"terrain\",\"cross2D\",\"cross3D\",\"centeline\",\"centerline3D\",\"banks\",\"flowpaths\",\"landuse\"}\n'ThmTypes\nlThmTypes={STheme,FTheme,FTheme,FTheme,FTheme,FTheme,FTheme,FTheme}\n'ShpTypes POLYGON,POLYLINE,POINT,MultiPoint.\nlShpTypes={\"TIN\",\"PolyLine\",\"PolyLine\",\"PolyLine\",\"PolyLine\",\"PolyLine\",\"PolyLine\",\"Polygon\"}\n\n' Create the Field descriptions of the required fields.\n' Needs to be there even if none are used.\nldFields={nil,nil,nil,nil,nil,nil,nil,\"lucode\"}                         'List of fields
\n\n\n' Define the default theme names.\nlDefNames={\"GRD\",\"GRD\",\"GRD\",\"GRD\",\"GRD\",\"GRD\",\"GRD\",\"GRD\"}    'Default theme names\n\n' Define the theme purpose type (input/output)\nlPurposes={\"I\",\"I\",\"I\",\"I\",\"I\",\"I\",\"I\",\"I\"}\n\n' Overwrite options when the specified thm exists in the view, lOverWrts guides the operation.\nlOverWrts={1,1,1,1,1,1,0,1}    'For GTheme, 0=OverWrite,1,2=Prompt for a new name because overwrite is not an option.\n                       'For FTheme, 0=Clear, 1=Ask For a new Name, 2=Append.\n        
               'lOverWrts is extented to be used for InputThms (used as the output Thm) as well.\n                       'if 0 then don't ask for a backup, overwrite the input theme with the output theme.\n                       'if 1 then ask if a backup should be made.\n\n' Use the framework to check on the themes and items\n'---------------------------------------------------\niOthers=1\nsHelp=Script.The.GetName\ndThms=av.run(\"RAS.FRM.GetThmsByTagR\",{oView,lTags,lThmTypes,lShpTypes,ldFields,lDefNames,lPurposes,l
OverWrts,bVerify,sTitle,iOthers,sHelp})\nif(dThms.is(Dictionary))then\n\n\n  '**                    End of flow direction work               **\n  '-----------------------------------------------------------------\n\nelse\n\n  ' Problem in returning from checking the themes\n  sText = \"Problem with input themes.  Operation cancelled\"\n  MsgBox.Warning(sText,sTitle)\n    \nend\n\n\n\n"
)

(Script.249
	Name:	"RAS.PRE.InputDialogCancel"
	SourceCode:	"' Name: RAS.PRE.InputDialogCancel\n'****************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'****************************************************************\n' Name:         RAS.PRE.InputDialogCancel\n' Self:         none\n' Returns:      none\n' Description:  Act on Cancel button in the RAS Input Theme Form.\n' History:      DDJ; 3/18/98 - original coding\n'               DDJ; 3/99 - Ch
ange in header and name.\n'****************************************************************\n\n' Close the form without doing anything\nav.FindDialog(\"RASIn\").Close\n\n"
)

(Script.250
	Name:	"RAS.PRE.InputDialogOK"
	SourceCode:	"' Name: RAS.PRE.InputDialogOK\n'**********************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'************************************************************************\n' Name:        RAS.PRE.InputDialogOK\n' Usage:       Called from the menu\n' Returns:     none\n' Description: Act on OK button in the RAS Input Theme Form.\n'              Set the theme tags and close the form.\n' Require
s:    Framework.\n' History:     DDJ; 3/18/98 - original coding\n'              DDJ; 8/3/98 - saving RAS output file where the *.apr\n'                            is (AVRas 1.1)\n'              DDJ; 9/25/98 - check if the project is saved before\n'                             pointing the geo file to it (AVRas 1.2)\n'              DDJ; 3/99    - Change in name and header\n'                           - Making it work with the Framework.\n'                           - Remove the use of global variable to define\n'    
                         the output file name - instead use a View\n'                             tag.\n'************************************************************************\n\nstrErrorTitle = \"RAS Preprocessor\"\n\noView = av.GetActiveDoc                          ' define the view\n\n' Identify the combo box objects\ncmbbTIN = av.FindDialog(\"RASIn\").FindByName(\"cbTIN\")\ncmbbCS = av.FindDialog(\"RASIn\").FindByName(\"cbCS\")\ncmbb3DCS = av.FindDialog(\"RASIn\").FindByName(\"cb3DCS\")\ncmbbSC = av.FindDialog(\"RASIn\").FindByN
ame(\"cbSC\")\ncmbb3DSC = av.FindDialog(\"RASIn\").FindByName(\"cb3DSC\")\ncmbbBanks = av.FindDialog(\"RASIn\").FindByName(\"cbBanks\")\ncmbbFC = av.FindDialog(\"RASIn\").FindByName(\"cbFC\")\ncmbbLU = av.FindDialog(\"RASIn\").FindByName(\"cbLandUse\")      ' added DM3 8/99\n\n' Identify the selected themes\nthmTIN = cmbbTIN.GetCurrentValue.AsString\nthmCS = cmbbCS.GetCurrentValue.AsString\nthm3DCS = cmbb3DCS.GetCurrentValue.AsString\nthmSC = cmbbSC.GetCurrentValue.AsString\nthm3DSC = cmbb3DSC.GetCurrentValue.AsString\nthmBanks = cmbbBa
nks.GetCurrentValue.AsString\nthmFC = cmbbFC.GetCurrentValue.AsString\nthmLU = cmbbLU.GetCurrentValue.AsString                       ' added DM3 8/99\n\n' Generate the list of all the candidate themes (in the View)\nlstThemes = av.GetActiveDoc.GetThemes\n\n\n' Set the tags for the selected themes.  The following tags are used:\n' terrain, cross2d, cross3d, centerline, centerline3d, banks, flowpaths\n'----------------------------------------------------------------------\n\nlstTags = {\"terrain\",\"cross2d\",\"cross3d\",\"cent
erline\",\"centerline3d\",\"banks\",\"flowpaths\",\"landuse\"}    ' tag list\n\n' Set all tags to nil\nfor each currenttag in lstTags\n  tmpthm = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetOne\",oView,currenttag})\n  if (tmpthm<>nil) Then                                             ' there is a tagged theme\n    av.run(\"RAS.FRM.ThmTagMgr\",{\"REMOVE\",oView,currenttag})       ' reset that theme's tag to nil\n  end\nend\n\n' Set the TIN tag\nif (thmTIN=\"Null\") Then\n    ' TIN not defined - warn the user\n    MsgBox.Warning (\"TIN theme is not de
fined.\"+nl+\"Preprocessing functions will not operate\",strErrorTitle)\n  else\n    av.run(\"RAS.FRM.ThmTagMgr\", {\"SetThm\",oView,av.GetActiveDoc.FindTheme(thmTIN),\"terrain\"})\n'    av.GetActiveDoc.FindTheme(thmTIN).SetObjectTag(\"terrain\")    'set TIN tag\nend\n\n' Set the CENTERLINE tag\nif (thmSC=\"Null\") Then\n    ' Stream centerline not defined - warn the user\n    MsgBox.Warning (\"Stream centerline theme is not defined.\"+nl+\"Preprocessing functions will not operate\",strErrorTitle)\n  else\n    av.run(\"RAS.FRM.ThmTagMg
r\", {\"SetThm\",oView,av.GetActiveDoc.FindTheme(thmSC),\"centerline\"})\n'    av.GetActiveDoc.FindTheme(thmSC).SetObjectTag(\"centerline\")    'set cross-section tag\nend\n\n' Set the CROSS2D tag\nif (thmCS=\"Null\") Then\n    ' 2D Cross-sections not defined - warn the user\n    MsgBox.Warning (\"2D Cross-section theme is not defined.\"+nl+\"Preprocessing functions will not operate\",strErrorTitle)\n  else\n    av.run(\"RAS.FRM.ThmTagMgr\", {\"SetThm\",oView,av.GetActiveDoc.FindTheme(thmCS),\"cross2d\"})\n'    av.GetActiveDoc.FindThem
e(thmCS).SetObjectTag(\"cross2d\")    'set cross-section tag\nend\n\n' Set the CROSS3D tag - no warning since the preprocessor can work without it.\nif (thm3DCS=\"Null\") Then\n    ' Cross-sections not defined - warn the user\n'    MsgBox.Warning (\"3D Cross-section theme is not defined.\"+nl+\"Preprocessing functions will not operate\",strErrorTitle)\n  else\n    av.run(\"RAS.FRM.ThmTagMgr\", {\"SetThm\",oView,av.GetActiveDoc.FindTheme(thm3DCS),\"cross3d\"})\n'    av.GetActiveDoc.FindTheme(thm3DCS).SetObjectTag(\"cross3d\")    'se
t cross-section tag\nend\n\n' Set the CENTERLINE3D tag - no warning since the preprocessor can work without it.\nif (thm3DSC=\"Null\") Then\n    ' Cross-sections not defined - warn the user\n'    MsgBox.Warning (\"3D Centerline theme is not defined.\"+nl+\"Preprocessing functions will not operate\",strErrorTitle)\n  else\n    av.run(\"RAS.FRM.ThmTagMgr\", {\"SetThm\",oView,av.GetActiveDoc.FindTheme(thm3DSC),\"centerline3d\"})\n'    av.GetActiveDoc.FindTheme(thm3DSC).SetObjectTag(\"centerline3d\")    'set cross-section tag\nend\n\n' 
Set the BANKS tag - no warning since the preprocessor can work without it.\nif (thmBanks=\"Null\") Then\n    ' Banks not defined - warn the user\n'    MsgBox.info (\"Banks theme is not defined.\"+nl+\"Not all preprocessing functions will not operate\",strErrorTitle)\n  else\n    av.run(\"RAS.FRM.ThmTagMgr\", {\"SetThm\",oView,av.GetActiveDoc.FindTheme(thmBanks),\"banks\"})\n'    av.GetActiveDoc.FindTheme(thmBanks).SetObjectTag(\"banks\")    'set banks tag\nend\n    \n' Set the FLOWPATHS tag - no warning since the preprocessor can
 work without it.\nif (thmFC=\"Null\") Then\n    ' Flowpaths not defined - warn the user\n'    MsgBox.info (\"Flow paths theme is not defined.\"+nl+\"Not all preprocessing functions will not operate\",strErrorTitle)\n  else\n    av.run(\"RAS.FRM.ThmTagMgr\", {\"SetThm\",oView,av.GetActiveDoc.FindTheme(thmFC),\"flowpaths\"})\n'    av.GetActiveDoc.FindTheme(thmFC).SetObjectTag(\"flowpaths\")    'set banks tag\nend\n\n' Set the LANDUSE tag - warning, but the preprocessor can work without it.\nif (thmLU=\"Null\") Then\n    ' Land use the
me not defined - warn the user\n'    MsgBox.Warning (\"Land use theme is not defined.\"+nl+\"Manning's n functions will not operate\",strErrorTitle)\n  else\n    av.run(\"RAS.FRM.ThmTagMgr\", {\"SetThm\",oView,av.GetActiveDoc.FindTheme(thmLU),\"landuse\"})\n'    av.GetActiveDoc.FindTheme(thmLU).SetObjectTag(\"landuse\")    'set cross-section tag\n    \nend\n\n' identify the project directory path\n' first check if the project is defined and if not provide a message\n'--------------------------------------------------------------
-----\nif (av.GetProject.GetFileName = Nil) then\n  MsgBox.Info(\"A project is not defined.  Save the project and repeate the operation\",strErrorTitle)\n  av.FindDialog(\"RASIn\").Close\n  return nil\nend\n\n' set the variable sExportFileName with export file name\n' provide full path to the project directory\n'------------------------------------------------------------------\nsDir = av.GetProject.GetFileName.ReturnDir.AsString\nsFileName = av.FindDialog(\"RASIn\").FindByName(\"txtFileOut\").GetText\nsExportFileName = FileNa
me.Merge( sDir, sFileName).AsString\n\n\n' Check if the import file actually exists.  If it does not, provide\n' an error message and do not exit the dialog.  \nif (sFileName = \"\") Then\n    ' nothing set - complain and return to the form\n    MsgBox.Warning (\"You have to specify the RAS GIS import file!\",strErrorTitle)\n    return nil\n  else\n    ' test if the file is valid\n    inFile = FileName.Make(sExportFileName)\n    if (File.Exists(inFile)) Then\n      tMessage = \"The entered file already exists !\"+nl\n      tMe
ssage = tMessage + nl + \"This may produce incompatible RAS input file.\"\n      tMessage = tMessage + nl + \"Do you want to select a different RAS GIS import file?\"\n      bResponse = MsgBox.YesNo(tMessage,strErrorTitle,TRUE)\n      if (bResponse) then\n        ' the user wants to select a different file name - return to the dialog\n        return nil\n      end\n    end\nend\n\n' Set the View tag dictionary\n'----------------------------\nav.run(\"RAS.FRM.ViewTagMgr\", {\"SetValue\",oView,\"sType\",\"RAS Input\"})\nav.run(\"RAS.F
RM.ViewTagMgr\", {\"SetValue\",oView,\"sExportFileName\",sExportFileName})\n\n\n' Close the form\nav.FindDialog(\"RASIn\").Close\n\nreturn nil\n"
)

(Script.251
	Name:	"RAS.PRE.InputDialogShow"
	SourceCode:	"' Name: RAS.PRE.InputDialogShow\n'********************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'********************************************************************\n' Name:         RAS.PRE.InputDialogShow\n' Usage:        Called from the menu\n' Returns:      none\n' Description:  Display the RAS Input Theme Form and populate it with\n'               valid theme names.  If tags exist, us
e those files as\n'               default items to display in the form.\n' Requires:     Framework.\n' History:      DDJ; 3/18/98\n'               DDJ; 9/28/98 - Fix the problem when GRIDs or Images were \n'                              in the view.  It ignores them now instead\n'                              of generating an error message (AVRas 1.2).\n'               DDJ; 3/99 - Change in name and header.\n'                         - Use of Framework for tagging.\n'*************************************************
*******************\n\n' Identify the dialog and view object\ntheView = av.GetActiveDoc\ndialogName = av.FindDialog(\"RASIn\")\n\n' Create a list of all the themes in the view\nlstThemes = list.Make\nlstThemes = theView.GetThemes\n\n\n' Generate a list of TINs and line and polygon themes \n'----------------------------------------------------\n\n' Create the empty lists\nlstLineThemes = list.Make\nlstTins = list.Make\nlst3DLineThemes = list.Make\nlstPolyThemes = list.Make\n\n' Loop through the theme list and add to the TIN and l
ine\n' lists when such theme type is identified.\nfor each i in lstThemes\n  thmToCheck = theView.FindTheme(i.AsString)                       ' define the theme\n  \n  if (thmToCheck.Is(FTheme)) then                                  ' test if feature theme\n    strThemeType = thmToCheck.GetFtab.GetShapeClass.GetClassName   ' define its type\n    \n    if (strThemeType = \"PolyLine\") then                            ' test if polyline\n      lstLineThemes.add(thmToCheck)                                ' add to the line
 list\n    end\n    if (strThemeType = \"PolyLineZ\") then                           ' test if 3D polyline\n      lst3DLineThemes.add(thmToCheck)                              ' add to the 3D line list   \n    end\n    if (strThemeType = \"Polygon\") then                             ' test if polygon\n      lstPolyThemes.add(thmToCheck)                                ' add to polygon list   \n    end\n  end\n\n  if (thmToCheck.Is(Stheme)) then                                  ' test if surface\n    lstTins.add(thmToCheck) 
                                       ' add to the tin list\n  end\n\nend\n\n' Add a \"Null\" to the list so \"nothing\" can be selected\nlstLineThemes.add(\"Null\")\nlstTins.add(\"Null\")\nlst3DLineThemes.add(\"Null\")\nlstPolyThemes.add(\"Null\")\n\n'---------------------------------------\n' Populate the combo boxes\n'---------------------------------------\n' Identify the combo box object\ncmbbTIN = dialogName.FindByName(\"cbTIN\")\ncmbbCS = dialogName.FindByName(\"cbCS\")\ncmbb3DCS = dialogName.FindByName(\"cb3DCS\")\ncmbbSC = dialogNam
e.FindByName(\"cbSC\")\ncmbb3DSC = dialogName.FindByName(\"cb3DSC\")\ncmbbBanks = dialogName.FindByName(\"cbBanks\")\ncmbbFC = dialogName.FindByName(\"cbFC\")\ncmbbLU = dialogName.FindByName(\"cbLandUse\")\n\n' define the combo box entries\ncmbbTIN.DefineFromList( lstTins )\ncmbbCS.DefineFromList( lstLineThemes )\ncmbb3DCS.DefineFromList( lst3DLineThemes )\ncmbbSC.DefineFromList( lstLineThemes )\ncmbb3DSC.DefineFromList( lst3DLineThemes )\ncmbbBanks.DefineFromList( lstLineThemes )\ncmbbFC.DefineFromList( lstLineThemes )\ncmbbLU.De
fineFromList( lstPolyThemes)\n\n' specify the default combo box entry if a tag exists\nlstTags = {\"terrain\",\"cross2d\",\"cross3d\",\"centerline\",\"centerline3d\",\"banks\",  \"flowpaths\",\"landuse\"}    ' tag list\nlstCmbs = {\"cbTIN\",  \"cbCS\",   \"cb3DCS\", \"cbSC\",      \"cb3DSC\",      \"cbBanks\",\"cbFC\",     \"cbLandUse\"}                   ' combo box list\n\n' set combo box to display a tagged theme\nfor each cmbBox in lstCmbs                                        ' loop through combo boxes\n  iTagOrder = lstCmbs.FindByValue(cmb
Box)                         ' combo's and tag's order\n  currenttag = lstTags.Get(iTagOrder)                             ' get the tag matching the combo\n  cmbbToUse = dialogName.FindByName(cmbBox)                       ' identify the combo box to use\n\n  tmpthm = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetOne\",theView,currenttag})       ' get a theme with a tag\n  if (tmpthm=nil) Then                                            ' check for a tagged theme\n      ' a tagged theme not found - use null as default\n      cmbbT
oUse.FindByValue(\"Null\")                               ' find the Null\n    else\n      ' a tagged theme found - select it\n      'msgbox.info (\"iTagOrder = \"+iTagOrder.AsString,strr)\n      cmbbToUse.FindByValue(tmpthm)                               ' find the theme in the list\n  end\n\n  cmbbToUse.SelectCurrent                                         ' make the selection current\nend\n\n\ndialogName.Open\n\nreturn nil\n\n\n"
)

(Script.252
	Name:	"RAS.PRE.LanduseCutlineIntersect"
	SourceCode:	"' Name: RAS.PRE.LanduseCutlineIntersect\n'**************************************************************************************************\n'              (c) Copyright, 1999\n'      David Ford Consulting Engineers\n'              All Rights Reserved\n'**************************************************************************************************\n' Name:         RAS.PRE.LanduseCutlineIntersect\n' USAGE:        av.run(\"RAS.PRE.LanduseCutlineIntersect, { see parameters below })\n'   where:      (parameters are 
described in the body of the script)\n'\n' Returns:      thePtTab (third parameter) populated with intersection data\n'               Fields in this table are created by this script.\n' Description:  Goes through each cross section cutline, and identifies the land use\n'               polygons that it intersects. From that set of polygons, the script identifies\n'               the points along the cutline where the land use changes. It determines the land\n'               use polygon that lies between each pair o
f points, determines the land use\n'               code, and assigns it to that segment. \n' Called by:    RAS.PRE.ManningExtract\n'\n' History:      DM3; 7/29/99   Algorithm developed\n'               DM3; 9/20/99   The second and subsequent XS segments having the same n value will\n'                              not be included in the RAS import file\n'**************************************************************************************************\n\ntheXS = SELF.Get(0)                             ' A theme cons
isting of cross-section polylines. Input only.\ntheLU = SELF.Get(1)                             ' A theme consisting of land use polygons.  Input only.\nthePtTab = SELF.Get(2)                          ' An open, empty VTAB for the results. Modified by this script.\ntheLandUseFieldName = SELF.Get(3)               ' Name of a numeric Field in the land use attribute table.  Input only.\n                                                ' A new Field of the same name will be made in thePtTab\n\ntheXStable = theXS.GetFT
ab\ntheLUtable = theLU.GetFTab\n\nalongF = Field.Make( \"Fraction\", #FIELD_FLOAT, 5, 2)\nlandUseF = theLUtable.FindField(theLandUseFieldName).Clone\nxsidF = Field.Make( \"Xs_id\", #FIELD_SHORT, 5, 0)\nthePtTab.AddFields( {xsidF, alongF, landUseF})\n\nav.ShowMsg( \"Collecting Manning's n values\")\nav.ShowStopButton\n\nfor each aXS in theXStable\n\n  ' Update the progress bar\n  if (av.SetStatus( aXS / (theXStable.GetNumRecords) * 100).Not) then\n   ' User pressed the CANCEL button\n   return false\n  end\n\n  thePolyLine = theXSta
ble.ReturnValue( theXStable.FindField( \"shape\"), aXS)\n  theXsID = theXStable.ReturnValue( theXStable.FindField( \"XS_ID\"), aXS)\n\n  ' First, find all of the land use polygons that this cut line intersects\n  ' This way, we don't hunt through everything looking for applicable polygons\n  ' --------------------------------------------------------------------------\n  theLU.SelectByPolyLine( thePolyLine, #VTAB_SELTYPE_NEW)\n\n  if (theLUtable.GetSelection.Count > 0) then\n  \n    ' Make a new Dictionary to hold the poi
nts that we find to be intersecting\n    ' They're indexed by their position along the line, expressed as a percentage\n    ' ---------------------------------------------------------------------------\n    pDict = Dictionary.Make( theLUtable.GetSelection.Count + 3)\n    pDict.Add( 0, thePolyLine.Along(0))                 ' Add the left end of the line\n    pDict.Add( 100, thePolyLine.Along(100))             ' Add the right end of the line\n  \n    for each r in theLUtable.GetSelection\n\n      ' For this land use p
olygon (r), locate the one or two points where its boundaries\n      ' intersect this cut line. Add them to the dictionary\n      ' ---------------------------------------------------\n      oneLandUse = theLUtable.ReturnValue( theLUtable.FindField( \"shape\"), r)\n      pList = oneLandUse.PointIntersection( thePolyLine).AsList\n  \n      for each p in pList\n         pDict.Add( thePolyLine.PointPosition( p), p)\n      end\n  \n    end\n  \n    ' Next, sort the dictionary so that the points are ordered from the left bank
\n    ' to the right bank\n    ' -----------------\n    pctList = pDict.ReturnKeys\n    pctList.Sort( TRUE)\n  \n    ' Retrieve the current selection bitmap. We're going to modify it several times below,\n    ' and rather than clearing it out and starting anew each time, it will be faster to just\n    ' make a subselection (a.k.a. a filter) from that existing selection.\n    ' -------------------------------------------------\n    savedSelection = theLUtable.GetSelection.Clone\n  \n    ' Initialize the land use list an
d prior land use code variables. Permit both numeric and\n    ' string land use fields.\n    ' ------------------------------------------------\n    luList = {}\n    if (landUseF.IsTypeNumber) then\n      priorLandUse = -901\n    else\n      priorLandUse = \"\"\n    end\n    \n    for each i in 1..(pctList.Count-1)\n      pctFirst = pctList.Get( i - 1)\n      pctLast = pctList.Get( i)\n\n      ' Find the point along the cut line that is midway between each pair of intersection\n      ' points. This point will be located wit
hin exactly one of the polygons\n      ' ---------------------------------------------------------------------\n      ptMiddle = thePolyLine.Along( (pctFirst + pctLast)/2)\n  \n      theLUTable.SelectByPoint( ptMiddle, 0, #VTAB_SELTYPE_AND)  ' should be EXACTLY ONE record selected\n                                                                  'use to have a 1 instead of 0, didn't work for data < 1 unit big\n      ' Check for the problem of deficient extent of the land use theme\n      ' -----------------------
----------------------------------------\n      if (theLUTable.GetSelection.Count = 0) then\n        'REMOVED    theXsID.SetFormat( \"dddd\")\n        'REMOVED    MsgBox.Warning( \"Cross section ID\"++theXsID.AsString++\"has a portion outside of the land use theme\",\n        'REMOVED                   SELF.GetName)\n        break\n      end\n        \n      ' Find the land use code from the land use attribute table\n      ' --------------------------------------------------------\n      r =theLUTable.GetSelection.GetNextS
et( -1)\n      oneLandUse = theLUtable.ReturnValue( theLUtable.FindField( theLandUseFieldName), r)\n\n      if (oneLandUse <> priorLandUse) then\n\n        ' Add an entry in the cross table\n        ' -------------------------------\n        r = thePtTab.AddRecord\n        thePtTab.SetValue( xsidF, r, theXsID)\n        thePtTab.SetValue( alongF, r, pctFirst/100)\n        thePtTab.SetValue( landUseF, r, oneLandUse)\n      end\n    \n      ' Revert back to the saved selection, so we start anew in the next iteration\n      
' --------------------------------------------------------------------------\n      theLUTable.SetSelection( savedSelection)\n      theLUTable.UpdateSelection\n\n      priorLandUse = oneLandUse\n    end\n  \n  end\n\nend\n\nthePtTab.SetEditable( FALSE)\n\nreturn true\n\n\n\n\n\n\n"
)

(Script.253
	Name:	"RAS.PRE.LengthCLAttributes"
	SourceCode:	"' Name: RAS.PRE.LengthCLAttributes\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:          RAS.PRE.LengthCLAttributes \n' USAGE:         Called from menu\n' Returns:       true  - when operation terminated successfully\n'                false - failed due to the theme setup (fra
mework)\n'                nil   - failed in some aspect\n' Description:   Setup parameters for computation of length\n'                and cummulative length along arcs in the\n'                stream centerline theme.  The computations\n'                are done in RAS.PRE.CalcCLLength.\n' Calling:       RAS.PRE.CalcCLLength\n' CalledBy:      none\n' Requires:      Framework (RAS.FRM.GetThmsByTagR, etc.)\n' History:       DDJ 2/99\n' ***************************************************************************\n\n'check
 to see if if the call is summary of singular\n' if it is the summary call, we don't want ot alert the\n'user until completion AlertYou=False\nif (self.is(list).Not) then\n  AlertYou = True\n  else \n  if (self.get(0) = \"NoAlert\") then\n    AlertYou = False\n  end\nend\n\n'-------------------------------------------------------------------------\n' Setup of working directory, title in the message boxes, and working view\n'-------------------------------------------------------------------------\n\n' Define the parent dire
ctory and the working (tmp) subdirectory\nTheProject=av.GetProject\n' Get the View to work with\noView=av.GetActiveDoc                                 'ViewHandle\n\n'..Set the workDir to BaseMap.\n'av.run(\"RAS.FRM.SetBaseDir\",{oView})\n\n\n' Title for message box for these operations\nsTitle=\"Stream centerline length and cummulative distance computations\"     ' title text for message boxes\nbVerify=false                                                               ' to force display of theme selection dialog\n\n\n'----
-----------------------------------------------------------------\n' Setup of required lists for use with the framework\n'---------------------------------------------------------------------\n\n' Provide the lists of Tags, ThmTypes, and ShpTypes.\nlTags={\"centerline\"}                     'Tags\nlThmTypes={FTheme}                       'ThmTypes\nlShpTypes={\"PolyLine\"}                   'ShpTypes POLYGON,POLYLINE,POINT,MultiPoint.\n\n' Create the Field descriptions of the required fields.  They are all listed in RAS
.PRE.GetdFields\n' script.  This section just loads it from there.\n' Needs to be there even if none are used.\ndFields=av.run(\"RAS.PRE.GetdFields\",{lTags})\nldFields=List.Make\nfor each sTag in lTags\n  ldFields.Add(dFields.Get(sTag))  \nend\n\n\n' Define the default names.\nlDefNames={\"CLine\"}                    'Default names\n\n' Define the theme purpose type (input/output)\nlPurposes={\"I\"}\n\n' Overwrite options when the specified thm exists in the view, lOverWrt guides the operation.\n'For GTheme, 0=OverWrite,1,2=Prom
pt for a new name because overwrite is not an option.\n'For FTheme, 0=Clear, 1=Ask For a new Name, 2=Append.\n'lOverWrts is extented to be used for InputThms (used as the output Thm) as well.\n'if 0 then don't ask for a backup, overwrite the input theme with the output theme.\n'if 1 then ask if a backup should be made.\nlOverWrts={0}\n\n  \n' Use the framework to check on the themes and items\n'---------------------------------------------------\ndThms=av.run(\"RAS.FRM.GetThmsByTagR\",{oView,lTags,lThmTypes,lShpTypes,l
dFields,lDefNames,lPurposes,lOverWrts,bVerify,sTitle})\nif(dThms.is(Dictionary))then\n\n  '---------------------------------------------------------------------------------\n  ' Successfully returned the required themes, so we can do the work\n  '---------------------------------------------------------------------------------\n  '** Stream centerline length and cummulative distance computations start here   **\n\n  CenterTag=lTags.Get(0)                                 ' get the centerline tag\n  theCLTheme=dThms.G
et(CenterTag)                        ' get the centerline theme to use\n  theCLFTab = theCLTheme.getFTab                         ' get the centerline FTab\n\n\n  ' Call RAS.PRE.CalcCLLength to perform the computations\n  '------------------------------------------------------\n  theRunRet = av.run(\"RAS.PRE.CalcCLLength\",{theCLFTab})\n  \n  if (theRunRet) then\n      ' successfull end - \n      if (AlertYou) then\n        MsgBox.Info(\"Centerline length and cummulative lengths computed successfully!\",sTitle)\n      end\n 
   else\n      ' unsuccessfull end - stop editing (since that was not done in the sub)\n      theCLFTab.Flush\n      theCLFTab.SetEditable(FALSE)\n      tMessage = \"Centerline lengths computed UNSUCCESSFULLY!\"\n      tMessage = tMessage + nl + \"The centerline theme is not valid (but can be used for debugging)!\"\n      MsgBox.Warning(tMessage,sTitle)\n  end\n\n  \n  '**   End of Stream centerline length and cummulative distance computations    **\n  '---------------------------------------------------------------------
-----------\n\nelse\n\n  ' Problem in returning from checking the themes\n    sText = \"Problem with input themes.  Operation cancelled\"\n    MsgBox.Warning(sText,sTitle)\n    return false\n    \nend\n\nreturn true\n"
)

(Script.254
	Name:	"RAS.PRE.ManningExtract"
	SourceCode:	"' Name: RAS.PRE.ManningExtract\n' ***************************************************************************\n'              (c) Copyright, 1999\n'         David Ford Consulting Engineers\n'              All Rights Reserved\n' ***************************************************************************\n' Name:          RAS.PRE.ManningExtract \n' USAGE:         Called from menu\n' Returns:       true  - when operation terminated successfully\n'                false - failed due to the theme setup (framework)\n'      
          nil   - failed in some other aspect\n' Description:   Setup parameters for computation of \n' Calling:       RAS.PRE.LanduseCutlineIntersect\n' CalledBy:      none\n' Requires:      Framework (RAS.FRM.GetThmsByTagR, etc.)\n' History:       DM3 8/99\n' ***************************************************************************\n\n'check to see if if the call is summary of singular\n' if it is the summary call, we don't want ot alert the\n'user until completion AlertYou=False\nif (self.is(list).Not) then\n  Ale
rtYou = True\n  else \n  if (self.get(0) = \"NoAlert\") then\n    AlertYou = False\n  end\nend\n\n\n'-------------------------------------------------------------------------\n' Setup of working directory, title in the message boxes, and working view\n'-------------------------------------------------------------------------\n\n' Define the parent directory and the working (tmp) subdirectory\nTheProject=av.GetProject\n' Get the View to work with\noView=av.GetActiveDoc                                 'ViewHandle\n\n\n'---------
--------------------------------------------------------\n' Manning's n value extraction is optional.\n' If summary call, bail out now if no land use theme was specified\n'-----------------------------------------------------------------\nif (AlertYou.Not) then\n  ' See if there is a land use theme defined\n  dThemes = av.run(\"RAS.FRM.GetThmsByTag\", {oView,{\"landuse\"},{FTheme},{\"Polygon\"}})\n  if (dThemes.Get(\"landuse\") = nil) then\n      ' No land use. That's okay; just skip the Manning n-value extraction.\n      r
eturn true\n  end\nend\n\n\n\n' Output table name and ObjectTag\nmyName = \"Manning\"\nmyOtag = \"GeoRAS\"\ntheNvalField = \"N_value\"\n\n'..Set the workDir to BaseMap.\n'av.run(\"RAS.FRM.SetBaseDir\",{oView})\n\n\n' Title for message box for these operations\nsTitle=\"Manning's n extraction\"                       ' title text for message boxes\nbVerify=false                                         ' to force display of theme selection dialog\n\n\n'-------------------------------------------------\n' Set up required lists for use with t
he framework\n'-------------------------------------------------\n\n' Provide the lists of Tags, ThmTypes, and ShpTypes.\nlTags={\"cross2d\",\"landuse\"}                       'Tags\nlThmTypes={FTheme,FTheme}                          'ThmTypes\nlShpTypes={\"PolyLine\",\"Polygon\"}                   'ShpTypes POLYGON,POLYLINE,POINT,MultiPoint.\n\n' Create the Field descriptions of the required fields.  They are all listed in RAS.PRE.GetdFields\n' script.  This section just loads it from there.\n' Needs to be there even if non
e are used.\ndFields=av.run(\"RAS.PRE.GetdFields\",{lTags})\nldFields=List.Make\nfor each sTag in lTags\n  ldFields.Add(dFields.Get(sTag))  \nend\n\n\n' Define the default names.\nlDefNames={\"crossras\",\"landuse\"}                    'Default names\n\n' Define the theme purpose type (input/output)\nlPurposes={\"I\",\"I\"}\n\n' Overwrite options when the specified thm exists in the view, lOverWrt guides the operation.\n'For GTheme, 0=OverWrite,1,2=Prompt for a new name because overwrite is not an option.\n'For FTheme, 0=Clear, 1=As
k For a new Name, 2=Append.\n'lOverWrts is extented to be used for InputThms (used as the output Thm) as well.\n'if 0 then don't ask for a backup, overwrite the input theme with the output theme.\n'if 1 then ask if a backup should be made.\nlOverWrts={0,0}\n\n  \n' Use the framework to check on the themes and items\n'---------------------------------------------------\ndThms=av.run(\"RAS.FRM.GetThmsByTagR\",{oView,lTags,lThmTypes,lShpTypes,ldFields,lDefNames,lPurposes,lOverWrts,bVerify,sTitle})\nif(dThms.is(Dictionary)
)then\n\n  '---------------------------------------------------------------------------------\n  ' Successfully returned the required themes, so we can do the work\n  '---------------------------------------------------------------------------------\n\n  ' Remove the old Manning table, if it exists\n  ' Ask permission if we didn't create it earlier\n  ' ---------------------------------------------\n  while (TRUE)\n    tabDoc = av.FindDoc( myName)\n    if (tabDoc = nil) then break end                    ' table doesn'
t exist\n    if (tabDoc.GetObjectTag <> nil) then                ' might not be ours\n      if (tabDoc.GetObjectTag.Is( String)) then         ' might not be ours\n        if (tabDoc.GetObjectTag = myOTag) then          ' actually, it is ours\n          av.GetProject.RemoveDoc( tabDoc)              ' silently remove it\n          break\n        end\n      end\n    end                                                 ' otherwise, it's not ours\n\n    ' Ask permission to remove old one first\n    overwriteOK = MsgBox.yesn
o( \"Overwrite existing table \"\"\" + tabDoc.GetName +\"\"\"?\", \"\", TRUE)\n    if (overwriteOK.Not) then\n      return false\n    end\n  \n    av.GetProject.RemoveDoc( tabDoc)\n    break\n  end\n \n  theXStheme=dThms.Get( lTags.Get(0))                    ' get the cross-section theme to use\n  theXSFTab = theXStheme.getFTab                         ' get the cross-section FTab\n\n  theLUTheme=dThms.Get( lTags.Get(1))                    ' get the land use theme to use\n  theLUFTab = theLUTheme.getFTab                         ' 
get the land use FTab\n\n  ' Create an LU code table\n  ' -----------------------\n  'chang GetTmpDir to GetWorkDir\n  luIntName = FileName.Merge( av.GetProject.GetWorkDir.AsString, myName)\n  'luIntName = FileName.Merge( FileName.GetTmpDir.AsString, myName)\n  luIntVTab = VTab.MakeNew( luIntName, dBase)  ' create the VTab\n\n  ' Call another script to populate the table\n  '------------------------------------------\n  theRunRet = av.run(\"RAS.PRE.LanduseCutlineIntersect\",{theXStheme,theLUtheme,luIntVTab,theNvalField}
)\n  luIntVTab.SetEditable(FALSE)\n  \n    if (theRunRet) then\n      ' successful end - \n      if (AlertYou) then\n        MsgBox.Info(\"Manning's n computed successfully!\",sTitle)\n      end\n    else\n      ' unsuccessful end - \n      tMessage = \"Manning's n computed UNSUCCESSFULLY!\"\n      tMessage = tMessage + nl + \"The Manning's n table is not valid (but can be used for debugging)!\"\n      MsgBox.Warning(tMessage,sTitle)\n  end\n  \n  ' Load in the table\n  ' -----------------\n  theNdocTab = Table.Make( luIntVTab)\n 
 theNdocTab.SetName( myName)\n  'theNdocTab.GetWin.Open\n  theNdocTab.SetObjectTag( myOTag)\n  \n  ' Join the cross section FTab to it\n  ' ---------------------------------\n  luIntVTab.Join( luIntVTab.FindField( \"Xs_id\"),\n                  theXSFtab,\n                  theXSFtab.FindField( \"Xs_id\"))                \n  \nelse\n\n  ' Problem in returning from checking the themes\n    sText = \"Problem with input themes.  Operation cancelled\"\n    MsgBox.Warning(sText,sTitle)\n    return false\n    \nend\n\ntheLUtheme.ClearSel
ection\nreturn true\n\n\n"
)

(Script.255
	Name:	"RAS.PRE.StationCSAttributes"
	SourceCode:	"' Name: RAS.PRE.StationCSAttributes\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:          RAS.PRE.StationCSAttributes \n' USAGE:         Called from menu\n' Returns:       true  - when operation terminated successfully\n'                false - failed due to the theme setup (f
ramework)\n'                nil   - failed in some aspect\n' Description:   Setup parameters for computation of station\n'                for the cross-sections.  The computations\n'                are done in RAS.PRE.CalcStatCSAtt.\n' Calling:       RAS.PRE.CalcStatCSAtt\n' CalledBy:      none\n' Requires:      Framework (RAS.FRM.GetThmsByTagR, etc.)\n' History:       DDJ 2/99\n' ***************************************************************************\n\n'check to see if if the call is summary of singular\n' if it 
is the summary call, we don't want ot alert the\n'user until completion AlertYou=False\nif (self.is(list).Not) then\n  AlertYou = True\n  else \n  if (self.get(0) = \"NoAlert\") then\n    AlertYou = False\n  end\nend\n\n\n'-------------------------------------------------------------------------\n' Setup of working directory, title in the message boxes, and working view\n'-------------------------------------------------------------------------\n\n' Define the parent directory and the working (tmp) subdirectory\nTheProject=a
v.GetProject\n' Get the View to work with\noView=av.GetActiveDoc                                 'ViewHandle\n\n'..Set the workDir to BaseMap.\n'av.run(\"RAS.FRM.SetBaseDir\",{oView})\n\n\n' Title for message box for these operations\nsTitle=\"Cross-section station computations\"           ' title text for message boxes\nbVerify=false                                         ' to force display of theme selection dialog\n\n\n'---------------------------------------------------------------------\n' Setup of required lists for u
se with the framework\n'---------------------------------------------------------------------\n\n' Provide the lists of Tags, ThmTypes, and ShpTypes.\nlTags={\"centerline\",\"cross2D\"}           'Tags\nlThmTypes={FTheme,FTheme}                'ThmTypes\nlShpTypes={\"PolyLine\",\"PolyLine\"}        'ShpTypes POLYGON,POLYLINE,POINT,MultiPoint.\n\n\n' Create the Field descriptions of the required fields.  They are all listed in RAS.PRE.GetdFields1\n' script.  This section just loads it from there.  GetdFields1\n' Needs to be th
ere even if none are used.\ndFields=av.run(\"RAS.PRE.GetdFields1\",{lTags})\nldFields=List.Make\nfor each sTag in lTags\n  ldFields.Add(dFields.Get(sTag))  \nend\n\n\n' Define the default names.\nlDefNames={\"CLine\",\"CSect\"}            'Default names\n\n' Define the theme purpose type (input/output)\nlPurposes={\"I\",\"I\"}\n\n' Overwrite options when the specified thm exists in the view, lOverWrt guides the operation.\n'For GTheme, 0=OverWrite,1,2=Prompt for a new name because overwrite is not an option.\n'For FTheme, 0=Clear, 1
=Ask For a new Name, 2=Append.\n'lOverWrts is extented to be used for InputThms (used as the output Thm) as well.\n'if 0 then don't ask for a backup, overwrite the input theme with the output theme.\n'if 1 then ask if a backup should be made.\nlOverWrts={0,0}\n\n  \n' Use the framework to check on the themes and items\n'---------------------------------------------------\ndThms=av.run(\"RAS.FRM.GetThmsByTagR\",{oView,lTags,lThmTypes,lShpTypes,ldFields,lDefNames,lPurposes,lOverWrts,bVerify,sTitle})\nif(dThms.is(Dictiona
ry))then\n\n  '-----------------------------------------------------------------\n  ' Successfully returned the required themes, so we can do the work\n  '-----------------------------------------------------------------\n  '**       Cross-section station computations start here         **\n\n  CenterTag=lTags.Get(0)                                 ' get the centerline tag\n  the2DCSThemeRet=dThms.Get(CenterTag)                   ' get the centerline theme to use\n  theCLFtab = the2DCSThemeRet.getFTab               
     ' get the centerline FTab\n\n  CSTag=lTags.Get(1)                                     ' get the CS tag\n  theCSThemeRet=dThms.Get(CSTag)                         ' get the CS theme to use\n  theCSFTab = theCSThemeRet.getFTab                      ' get the CS FTab\n\n\n  ' Call RAS.PRE.CalcStatCSAtt to perform the computations\n  '-------------------------------------------------------\n  theRunRet = av.run(\"RAS.PRE.CalcStatCSAtt\",{theCSFTab,theCLFTab})\n  \n  if (theRunRet) then\n      ' successfull end - \n      if
 (AlertYou) then\n            MsgBox.Info(\"Stations for cross-sections computed successfully!\",sTitle)\n      end\n    else\n      ' unsuccessfull end - stop editing (since that was not done in the sub)\n      theCSFTab.Flush\n      theCSFTab.SetEditable(FALSE)\n      tMessage = \"Stations for cross-sections computed UNSUCCESSFULLY!\"\n      tMessage = tMessage + nl + \"The cross-section theme is not valid (but can be used for debugging)!\"\n      MsgBox.Warning(tMessage,sTitle)\n  end\n\n  \n\n  '**         End of Cross-sec
tion station computations           **\n  '-----------------------------------------------------------------\n\nelse\n\n  ' Problem in returning from checking the themes\n    sText = \"Problem with input themes.  Operation cancelled\"\n    MsgBox.Warning(sText,sTitle)\n    return false\n    \nend\n\nreturn true\n"
)

(Nil.256
)

(Script.257
	Name:	"RAS.PST.BuildTinIntersect"
	SourceCode:	"' Name: RAS.PST.BuildTinIntersect\n'**************************************************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'**************************************************************************************************\n' Name:         RAS.PST.BuildTinIntersect\n' USAGE:        av.run(\"RAS.PST.BuildTinIntersect\",{TinName1,TinName2,IntersectTheme,CellSize,\n'                     
                              PointDepthThemeName,GridDepthThemeName})\n'   where:      TinName1 - Input TIN name 1 (terrain)\n'               TinName2 - Input TIN name 2 (water surface)\n'               IntersectTheme - Intersection polygon theme name\n'               CellSize - size of the cell to use for TIN rasterization\n'               PointDepthThemeName - Point theme name for water depth\n'               GridDepthThemeName - Grid theme name for water depth\n' Returns:      true - sucessfully created the su
rface\n'               false (or nil) - surface not created sucessfully\n' Description:  Build an intersection of two tins.  Do it by \n'               converting the two tins into lattices and then\n'               subtracting them.  The intersection is where the\n'               result is = 0.  Convert that grid into a polygon.\n'               Construct a GRID of water depths.\n' Called by:    RAS.PST.FloodDelineation\n'\n' History:      DDJ; 3/27/98 - original coding (AVRas 1.0)\n'               DDJ; 8/6/98 - cod
ing implementaing 3D analyst solution only\n'                             (AVRas 1.1)\n'               DDJ; 2/99 - name and header change.\n'                         - adding definition of water depth grid and point shape (interface\n'                           modified to allow for that).  The point shape file for water depth\n'                           is a 2D point shape with water depth in item \"Depth\".  2D + field\n'                           is easier to use than real 3D shape for GRID construction.\n'     
                    - use Spatial Analyst functionality if the extension is available.\n'**************************************************************************************************\n\ntheTinName1 = SELF.Get(0)                           ' retreive the first TIN name\ntheTinName2 = SELF.Get(1)                           ' retreive the second TIN name\ntheIntsctName = SELF.Get(2)                         ' retreive the resulting polygon theme name\ntheCellSize = SELF.Get(3)                           ' retreive 
the cell size for tin rasterization\nthePointDName = SELF.Get(4)                         ' retreive the point depth theme name\ntheGridDName = SELF.Get(5)                          ' retreive the grid depth theme name\n\naPrj = Prj.MakeNull                                 ' create an empty projection object for later use\n\nmyView = av.GetActiveDoc                            'get the active view\n\nstrMessageTitle = \"HEC-GeoRAS GIS Export: Floodplain Polygon Generation\"\n\ntheSrcName = SrcName.Make(theTinName1.AsStrin
g)\ntheTin1 = Tin.Make(theSrcName)                      ' define the first TIN\n\ntheSrcName = SrcName.Make(theTinName2.AsString)\ntheTin2 = Tin.Make(theSrcName)                      ' define the second TIN\n\n' generate a box with extent of water TIN\ntheBox = Rect.MakeEmpty\n'theBox = theBox.UnionWith(theTin1.ReturnMapExtent)  ' use this to have the extent of both\ntheBox = theBox.UnionWith(theTin2.ReturnMapExtent)\n\n' round the box coordinates to use for GRID conversion\nxmin = theBox.GetLeft.Truncate\nxmax = theBox
.GetRight\nymin = theBox.GetBottom.Truncate\nymax = theBox.GetTop\n\nxCellCount = ((xmax-xmin)/theCellSize).Truncate + 1\nyCellCount = ((ymax-ymin)/theCellSize).Truncate + 1\n\n' check for the number of grid cells.  If more than 10,000,000 bail out with a\n' message that the user should reduce the grid size\nif ((xCellCount * yCellCount) > 10000000) Then\n  strMessage = \"Number of cells for rasterization is too big.  Increase the cell\" +nl\n  strMessage = strMessage + \"size so that the total number of cells is less th
an 10,000,000!\" +nl+nl\n  strMessage = strMessage + \"Number of cells in x direction = \"+xCellCount.AsString+nl\n  strMessage = strMessage + \"Number of cells in y direction = \"+yCellCount.AsString\n  MsgBox.Warning(strMessage, strMessageTitle)\n  return false\nend\n\n' convert the the two tins into grids with same origin (as in the box)\n'---------------------------------------------------------------------\n' define the box for use in rasterization\nxmaxb = xmin + ( xCellCount * theCellSize )\nymaxb = ymin + ( yCellCo
unt * theCellSize )\n\ntheGridBox = Rect.MakeXY(xmin,ymin,xmaxb,ymaxb)\n\n'this next function causes the\n'*********************Vatbuild Error in STA********************\n'*********************and reading errror of STA***************\n' convert the Tins into GRIDS\ntheGrid1 = theTin1.AsGrid(theCellSize, theGridBox)\n'**********************************************************************\nav.ShowMsg(\"Converting terrain TIN into a GRID\")             ' show the message on what is going on\ntheGrid2 = theTin2.AsGrid(theCe
llSize, theGridBox)\nav.ShowMsg(\"Converting water surface TIN into a GRID\")       ' show the message on what is going on\n\n' Define point and grid depth data names and themes\n'--------------------------------------------------\noPntDFN = thePointDName.AsFileName                          ' define the 3D point depth shape file name \n                                                            ' (will not be used if Spatial analyst is present)\noGrdDFN = theGridDName.AsFileName                           ' define th
e depth grid file name \n\n\n'*************************************************************************************\n' Two implementations of delineation and grid of depths determination are implemented.\n'\n' One is if Spatial Analyst is present, using the Spatial Analyst functionality,\n' namely, the subtration of two grids and the CON statement.\n'\n' The second implementation is using 3D Analyst only.\n'\n' Using Spatial Analyst will provide a faster execution and will not create the point\n' theme with depths. \n'*
************************************************************************************\n\noSptExt = Extension.Find(\"Spatial Analyst\")                ' look for Spatial Analyst extension\nif (oSptExt<>NIL)then\n\n'    msgbox.info(\"Spatial Analyst loaded\",\"\")\n    '************************************************************************\n    '******  FLOODPLAIN DELINEATION METHODOLOGY USING SPATIAL ANALYST  ******\n    \n    ' create a GRID of 1 where GRID2 (water) is higher than GRID1 (terrain)\n    ' otherwise assign t
he cell a NO_VALUE\n    theConGrid = (theGrid1 > theGrid2).Con(1.AsGrid, 0.AsGrid)   ' dry is set to 1, wet is 0\n    oWDGrid = theConGrid.SetNull(theGrid2 - theGrid1)            ' dry is set to NULL, while wet is set to the difference  \n    ' convert the water depth grid into a polygon (perform weeding - second paramater is TRUE)\n    av.ShowMsg(\"Generating floodplain polygon\")                 ' show the message on what is going on\n'********error message may be from this line\n'********vatBuild in STA\n    theF
loodFTab = theConGrid.SetNull(1.AsGrid).AsPolygonFTab(theIntsctName.AsFileName, TRUE, aPrj)\n    theFloodFTab.Flush                                           ' save the theme on the disk\n    theFloodFTab.StopEditingWithRecovery(TRUE)                   ' stop editing \n    '******               END OF SPATIAL ANALYST METHODOLOGY           *******\n    '*************************************************************************\n\n  else\n    \n'    msgbox.info(\"Spatial Analyst NOT loaded\",\"\")\n    '*******************
******************************************************\n    '******             DELINEATION USING 3D ANALYST ONLY               ******\n\n    '-----------------------------------------\n    ' Implementation of floodplain delineation\n    '-----------------------------------------\n    ' use cut-fill to get a grid of cut-fills\n    cfGrid = theGrid1.CutFill(theGrid2,1)\n    \n    ' rename temporary data set\n    resultDirectory = av.GetProject.GetFileName.ReturnDir       ' get current project directory\n'    resultDire
ctory.MergePath(_theResultDirectory)              ' attach the result subdirectory path\n    aFN = resultDirectory.MakeTmp(\"cutfil\",\"\")                  ' define the cut-fill grid name \n    cfGrid.Rename(aFN)                                          ' save the cut-fill grid\n    \n    ' check if output is ok\n    if (cfGrid.HasError) then \n      return false\n    end\n    \n    ' create a theme and get its VTab\n    gthm = GTheme.Make(cfGrid)  \n    theGridVTab = gthm.GetVTab                                   ' get 
the grid's VTab to merge\n    theGridVTab.Flush\n    \n    theGValueField = theGridVTab.FindField(\"Value\")              ' get the field on which to merge\n    \n    ' set the cut-fill GRID name and add it to the view - not by default\n    'gthm.SetName(\"Cut-Fill\")\n    'myView.AddTheme(gthm)\n    \n    ' convert the cut-fill grid (cfGrid) into a polygon (perform weeding - second paramater is TRUE)\n    av.ShowMsg(\"Generating floodplain polygon\")                  ' show the message on what is going on\n    theFloodFTab
 = cfGrid.AsPolygonFTab(theIntsctName.AsFileName, TRUE, aPrj)\n    \n    theBitmap = theFloodFTab.GetSelection                        ' specify the flood polygon bitmap\n    theFloodFTab.StartEditingWithRecovery                        ' start editing the flood polygon shape\n    \n    theFGridCodeField = theFloodFTab.FindField(\"Gridcode\")              ' specify the GRID VAT item to join on\n    theFloodFTab.Join(theFGridCodeField, theGridVTab, theGValueField)   ' join the grid's VAT to poly's PAT\n    \n    ' build
 a clause to select elements to be delete and delete them from the flood poly theme\n    theQuery = \"[Volume] > 0.0\"                                  ' setup the query string\n    theFloodFTab.Query(theQuery, theBitmap, #VTAB_SELTYPE_NEW)   ' do a query\n    theFloodFTab.UpdateSelection                                 ' make the selection active\n    theFloodFTab.RemoveRecords(theBitmap)                        ' delete the selected records\n    \n    theFloodFTab.Flush                                           ' 
save the changes to the disk  \n    theFloodFTab.StopEditingWithRecovery(TRUE)                   ' stop editing\n    \n    '------------------------------------\n    ' Implementation of depth computation\n    '------------------------------------\n    oPntTmpFN = resultDirectory.MakeTmp(\"pDepth\",\"shp\")   ' define the 2D temporary point shape name   \n    oPntTmpFTab = theGrid2.AsPointFTab(oPntTmpFN,aPrj)    ' create a point FTab from the grid data\n    oShape2DField = oPntTmpFTab.FindField(\"Shape\")        ' define 
field holder for point shape field\n    \n    oPntDFTab = FTab.MakeNew(oPntDFN, Point)              ' create the FTab for 3D water depth point shape file\n    oShape3DField = oPntDFTab.FindField(\"Shape\")          ' define field holder for shape field\n    \n    ' add id field - one has to be there\n    '-----------------------------------\n    f1 = Field.Make(\"Point_ID\",#FIELD_CHAR,8,0)\n    fd = Field.Make(\"Depth\",#FIELD_DOUBLE,12,3)\n    oPntDFTab.AddFields({f1,fd})                          ' add the id and depth 
fields to the 3D table\n    \n    thePntBitMap = oPntTmpFTab.GetSelection               ' get the preliminary point bitmap\n    thePntBitMap.SetAll                                   ' select all points for count\n    nNoPoints =  thePntBitMap.Count                       ' get total number of points\n    nCount = 0                                            ' initiate the counter variable\n    \n    av.ShowStopButton                                     ' show the stop button so you can interrupt the process\n    can
celled = FALSE                                     ' define the intital stop button condition\n    av.ShowMsg(\"Generating water depths at points ...\")   ' display status\n    av.SetStatus(0)                                       ' reset the status bar\n    \n    ' For each point, get its terrain and water surface elevations.  \n    ' Take the difference and when positive use it as z value for the point,\n    ' otherwise skip it.  Save the pointZ in the point depth shape.\n    '-------------------------------------
---------------------------------\n    for each pntrec in oPntTmpFTab\n      nCount = nCount + 1\n      cancelled = av.SetStatus(nCount/nNoPoints*100).not                   ' display % process bar\n      if (cancelled) then\n        ' the export has been cancelled.  Close the file and give a warning\n        av.ClearMsg                                                        ' clear the message\n        av.SetStatus(100)\n        oPntDFTab.Flush                                          ' save 3D points to disk\n     
   oPntDFTab.SetEditable(false)                             ' stop editing 3D points\n        MsgBox.Warning(\"The flood polygon determination terminated by the user!\",strMessageTitle)\n        return false                                                       ' exit with false\n      end\n    \n      oTmpPnt = oPntTmpFTab.ReturnValue(oShape2DField,pntrec)    ' return the point\n      nTerrElev = theTin1.Elevation(oTmpPnt)                     ' return terrain elevation at the point\n      nWatrElev = theTin2.Elevat
ion(oTmpPnt)                     ' return water surface elevation at the point\n      'check if either of the numbers in null - if it is, do not save it\n      if ((nTerrElev.IsNull) or (nWatrElev.IsNull)) then\n          ' there is a null value - skip the point\n        else\n          ' valid point (this expression is true when both IsNull statements are false,\n          ' meaning the data are present for both surfaces).  \n          ' Get the difference in the values and save it as 3D\n          xcoord = oTmpPn
t.GetX\n          ycoord = oTmpPnt.GetY\n          \n          ' define the z value (depth)\n          if (nWatrElev>nTerrElev) then\n              zcoord = nWatrElev - nTerrElev\n              newPoint3D = Point.Make(xcoord,ycoord)\n              \n              ' save the point\n              newRecNum = oPntDFTab.AddRecord                             ' create a new record and get a new record number          \n              oPntDFTab.SetValue(oShape3DField, newRecNum, newPoint3D)    ' save the new point shape\n    
          oPntDFTab.SetValue(f1, newRecNum, newRecNum.AsString)       ' define the ID of the point as rec number\n              oPntDFTab.SetValue(fd, newRecNum, zcoord)                   ' define the depth of the point\n            else\n              ' there is a null value - skip the point\n              ' zcoord = 0\n          end\n      end\n    end\n    \n    oPntDFTab.Flush                                          ' save 3D points to disk\n    oPntDFTab.SetEditable(false)                             ' stop edi
ting 3D points\n    \n    ' Take the 3D points and convert them into a water depth grid\n    oWDGrid = Grid.MakeFromFTab(oPntDFTab,aPrj,fd,{theCellSize,theGrid2.GetExtent})\n    \n    ' Delete the temporary point shape file\n    oPntTmpFTab.DeActivate\n    av.PurgeObjects\n    File.Delete(oPntTmpFN)\n    oPntTmpFN.SetExtension(\"dbf\")\n    File.Delete(oPntTmpFN)\n    oPntTmpFN.SetExtension(\"shx\")\n    File.Delete(oPntTmpFN)\n\n    '******         END OF DELINEATION USING 3D ANALYST ONLY            ******\n    '************
*************************************************************\n    \nend                                                               ' end of selection of the method\n\n\noWDGrid.SaveDataSet(oGrdDFN)                                      ' save the water depth grid\n\n\nreturn true\n\n"
)

(Script.258
	Name:	"RAS.PST.BuildVelTin"
	SourceCode:	"' Name: RAS.PST.BuildVelTin\n'*********************************************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'*********************************************************************************************\n' Name:         RAS.PST.BuildVelTin\n' USAGE:        av.run(\"RAS.PRE.BuildVelTin\", { parameters })\n'   where:      parameters are described in the body of the script\n' Returns:
      true - sucessfully created the tin\n' Description:  Build a TIN of the RAS velocity data for one RAS profile\n'               Uses the bounding polygon as a clip feature.\n' Called by:    RAS.PST.VelTINGeneration\n' History:      DM3; 7/26/99\n'*********************************************************************************************\n'* this routine should be replaced to just create the TIN from mass points\n'* followed by grid calculations to find out if the velocities fall where\n'* there is water (next
 version)\n'***************************************************************************\n\n\ntheTinFileName = SELF.Get(0)                               ' TIN file name\nthmCS = SELF.Get(1)                                        ' RAS cross-sections theme \nthmBanks = SELF.Get(2)                                     ' PolyLines representing stream banks\nthmVelocity = SELF.Get(3)                                  ' Velocity mass point theme (PointZ)\nthmBound = SELF.Get(4)                                     ' Boundin
g polygon theme (water surface)\n \nfldDummy = Field.Make( \"NO_DATA\", #FIELD_FLOAT, 5, 4)      ' dummy field holder for AddShapesFromFTab request\nfldZero = Field.Make(\" \", #FIELD_FLOAT, 5, 4)              ' dummy field holder for AddShapesFromFTab request\n \n' Create empty tin extending over the floodplain bounding area\n' ------------------------------------------------------------\ntheTin = TIN.MakeNew( theTinFileName, thmBound.ReturnExtent)           \n \n' Make the tin from the velocity mass points\n' ---------
---------------------------------\ntheTin = theTin.AddShapesFromFTab( thmVelocity.GetFTab,\n                                   thmVelocity.GetFTab.FindField( \"shape\"),\n                                   #SURFACEFEATURE_TYPE_MASS,\n                                   fldZero,\n                                   Prj.MakeNull)\n\n' Masks all triangles connected to the four outer nodes\n' -----------------------------------------------------\ntheTin.UpdateMask\n\n' Create a PolygonZ for clipping the edges\n' --------------
--------------------------\n'av.ShowMsg( \"Creating boundary clipping polygon\")\n'eTab = thmBound.GetFTab\n'theWS = PolygonZ.MakeEmpty\n'for each r in eTab\n'  aPoly = eTab.ReturnValue( eTab.FindField(\"shape\"), r)\n'  theWS = theWS.ReturnUnion( aPoly)\n'end\n\n'theOutside = thmBound.ReturnExtent.AsPolygon                   ' Rectangle surrounding all the polygons\n'theClipShape = theOutside.ReturnDifference( theWS)\n\n'theTin = theTin.AddPolygonZ( theClipShape@0, #SURFACEFEATURE_TYPE_HARDREPLACE, 0)\n\n' clip the tin to t
he outside boundary polygon\n' --------------------------------------------\n'theTin = theTin.AddShapesFromFTab( thmBound.GetFTab,\n'                                   fldDummy,\n'                                   #SURFACEFEATURE_TYPE_ZLESS_HARDCLIP,\n'                                   fldZero,\n'                                   Prj.MakeNull)\n\n'****************Removed the BANKS and XS as breaklines******************\n'*' would be correct if we interpolated up to downstream only\n'   but delauney criterion force
s lateral interpolation\n'   (floodplain to channel) which is poor methodology\n'*\n'*' Include the banks\n'*' -----------------\n'* theTin = theTin.AddShapesFromFTab( thmBanks.GetFTab,\n'*                                     fldDummy,\n'*                                     #SURFACEFEATURE_TYPE_HARDLINE,\n'*                                     fldZero,\n'*                                     Prj.MakeNull)\n'*' Include the cross sections\n'*' --------------------------\n'*  theTin = theTin.AddShapesFromFTab( thmCS.GetF
Tab,\n'*                                     fldDummy,\n'*                                     #SURFACEFEATURE_TYPE_SOFTLINE,\n'*                                     fldZero,\n'*                                     Prj.MakeNull)\n'*\n'**************************************************************************\n\n' save the changes to disk\ntheTin.StopEditing(TRUE)\n \nreturn true\n \n\n\n\n\n\n"
)

(Script.259
	Name:	"RAS.PST.BuildWaterTin"
	SourceCode:	"' Name: RAS.PST.BuildWaterTin\n'*********************************************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'*********************************************************************************************\n' Name:         RAS.PST.BuildWaterTin\n' USAGE:        av.run(\"RAS.PRE.BuildWaterTin\",{TinName,CSTheme,WSItem,BndThem})\n'   where:      TinName - TIN name to create\n'        
       CSTheme - cross-section theme to use\n'               WSItem - water surface elevation item to use (in the cross-section theme)\n'               BndTheme - water surface boundary theme to use as clip of water surface\n' Returns:      true - sucessfully created the tin\n'               false - tin not created sucessfully\n' Description:  Build a water surface tin from cross-sections\n'               as breaklines and water surface elevations as\n'               an item.  Use the bounding polygon as a clip fe
ature.\n' Called by:    RAS.PST.WSTINGeneration\n'\n' History:      DDJ; 3/24/98\n'               DDJ; 2/99    Update for work with framework and renaming\n'*********************************************************************************************\n\ntheTinName = SELF.Get(0)                                   ' retreive the TIN name\ntheCSTheme = SELF.Get(1)                                    ' retreive the cross-section theme\ntheWSItem = SELF.Get(2)                                    ' retreive the WS elevation 
item in C-S theme\ntheBndName = SELF.Get(3)                                   ' retreive the bounding polygon theme name\n\n'theView = av.GetActiveDoc                                  ' identify the View\nthePrj = Prj.MakeNull                                      ' do not project since the CS is already projected\n\nCSFTab = theCSTheme.GetFTab\n\ntheSrcName = SrcName.Make(theBndName.AsString)             ' specify the name for the boundary theme\nBndFTab = FTab.Make(theSrcName)                            ' specify t
he boundary  FTab\ntheBndTheme = FTheme.Make(BndFTab)                         ' specify the CS theme\n\naHeightField = CSFTab.FindField(theWSItem.AsString)        ' define field holder for water surface elevation\n\nvFld = Field.Make(\" \", #FIELD_FLOAT, 5, 4)                 ' dummy field holder for AddShapesFromFTab request\naEmptyFld = Field.Make(\"NO_DATA\", #FIELD_FLOAT, 5, 4)      ' dummy field holder for AddShapesFromFTab request\n\n' Get the extent of CS theme to define a rect for the Tin.MakeNew request.\ntheBo
x = Rect.MakeEmpty\ntheBox = theBox.UnionWith(theCSTheme.ReturnExtent)\n\n\n'---------------------------\n' TIN creation\n'---------------------------\n' make the initial empty tin\ntheTin = TIN.MakeNew(theTinName.AsFileName, theBox)           \n\n' make the tin by using the data from the cross-section shape file as soft breaklines\ntheTin = theTin.AddShapesFromFTab(CSFTab, aHeightField, #SURFACEFEATURE_TYPE_SOFTLINE, vFld, thePrj)\n\n' clip the tin to the outside boundary polygon\ntheTin = theTin.AddShapesFromFTab(BndFT
ab, aEmptyFld, #SURFACEFEATURE_TYPE_ZLESS_HARDCLIP, vFld, thePrj)\n\n\n' save the changes to disk\ntheTin.StopEditing(TRUE)\n\nreturn true\n\n"
)

(Script.260
	Name:	"RAS.PST.CSGeneration"
	SourceCode:	"' Name: RAS.PST.CSGeneration\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'*******************************************************************************************\n' Name:        RAS.PST.CSGeneration\n' Usage:       Called from the menu\n' Returns:     none\n' Description: Generate cross-section (line) theme from a RAS GIS export file.  The theme tag \n'              contains (beside the identifier) the names of items containing the wa
ter surface elevation.\n' Called by:   None\n' Calling:     Framework.\n' Requires:    Framework.\n' History:     DDJ; 3/20-24/98 - original coding\n'              DDJ; 8/3/98 - fixing problem with replacement of . in water surface profile\n'                            name and with discrepancy in tags and bp names when a number\n'                            was the initial character (per Nan Shi's comments).\n'              DDJ; 8/6/98 - Reordering themes added to the postprocessing view\n'              DDJ; 2/99  
 - Modifying the theme tag structure (use dictionary and the framework).\n'                              The following dictionary structure is defined:\n'                                For 2D cross-sections:  \n'                                    Theme name:              sName = \"crossras\"\n'                                    Field list in the FTab:  sField = \"field1=field2=field3=...=fieldN\"\n'                                For 3D cross-sections:  \n'                                    Theme name:           
   sName = \"cross3Dras\"\n'                                For each bounding polygon:  \n'                                    Theme name:              sName = nil\n'                                    Field for its creation:  sField = \"fieldI\"  (I=1..N)\n'                                    Theme type:              sType = \"wsbounds\"\n'                          - Use of View tag dictionary instead of global variables for\n'                            definition of postprocessing parameters.\n'                      
    - Made compatible with RAS 2.2 (generating 3D crosssection theme,\n'                            managing stream network, etc.).\n'              DM3; 7/99   - Added capability to read in velocity mass points for multiple profiles\n'              DM3; 8/99   - Modified structure of script somewhat. Expanded the role of \"caseSection.\"\n'                            Script is now more flexible as to the export file format, regarding the\n'                            ordering of its sections.  Not 100% tolerant, h
owever!\n'              DM3; 1/00   - Can correctly handle both RAS 2.2 and RAS 3.0 CROSS-SECTION sections.\n'                            We're trying to balance complexity and capability.\n'              DM3; 4/00   - Added support for levees\n'*******************************************************************************************\n\n'check to see if if the call is summary of singular\n' if it is the summary call, we don't want ot alert the\n'user until completion AlertYou=False\nif (self.is(list).Not) then\n  A
lertYou = True\n  else \n  if (self.get(0) = \"NoAlert\") then\n    AlertYou = False\n  end\nend\n\n\n\n\noView = av.GetActiveDoc                     ' get current view handle\n\nstrMessageTitle = \"RAS GIS Export: Cross-section and Bounding Polygon Extraction\"\n\n' Check if the input parameters are set correctly in the View's tag dictionary\n'-----------------------------------------------------------------------------\n\nsImportFileName = av.run(\"RAS.FRM.ViewTagMgr\", {\"GetValue\",oView,\"sImportFileName\"})\nif (sImportFileName 
= nil) Then\n  ' the file name has not been defined.  Provide a message and quit.\n  sMessage = \"The current View does not contain a valid reference to\"\n  sMessage = sMessage + nl + \"the RAS GIS output file!\"\n  MsgBox.Warning (sMessage,strMessageTitle)\n  return nil\nend\n\nsResultDirectory = av.run(\"RAS.FRM.ViewTagMgr\", {\"GetValue\",oView,\"sResultDirectory\"})\nif (sResultDirectory = nil) Then\n  ' the result directory has not been defined.  Provide a message and quit.\n  sMessage = \"The current View does not contain
 a valid reference to\"\n  sMessage = sMessage + nl + \"the result directory!\"\n  MsgBox.Warning (sMessage,strMessageTitle)\n  return nil\nend\n\nsCamsResDir = sResultDirectory             'this is for the new Themenames\noResDirectory = av.GetProject.GetFileName.ReturnDir              ' get current project directory\noResDirectory.MergePath(sResultDirectory)                     ' attach the result subdirectory path\nsResultDirectory = oResDirectory.AsString\n\n' Determine what they specified for the terrain TIN\n' -----
--------------------------------------------\nsTerrainTinOut = av.run(\"RAS.FRM.ViewTagMgr\", {\"GetValue\",oView,\"sTerrainTinOut\"})\nif (sTerrainTinOut = nil) Then\n  ' the result path has not been defined.  Provide a message and quit.\n  sMessage = \"The current View does not contain a valid reference to\"\n  sMessage = sMessage + nl + \"the terrain TIN!\"\n  MsgBox.Warning (sMessage,strMessageTitle)\n  return nil\nend\n\n' Define the RAS GIS export file\n'----------------------------------\n\ninFileName = sImportFileName.AsF
ileName                     ' create name\ninFile = LineFile.Make(inFileName,#FILE_PERM_READ)             ' create a file handler\n\n' Start processing the RAS GIS export file\n'-----------------------------------------\n\ncaseSection = \"HEADER\"                                         ' start by processing the header\nav.ShowMsg(\"Reading the file's header\")                        ' show the message on what is going on\ncsrasTag = \"\"                                                  ' specify the tag with theme type 
(empty)\nbCreate3DCS =  TRUE                                            ' boolean defining if the 3D CS theme needs to be created\n\n\n'-------------------------------------------------------------------------------\n' The file processing is performed in the following manner:\n' 1) Read in the line until end of file is reached (this should never happen\n'    unless there is an error in the input file since the app will exit first).\n' 2) Skip blank line(s)\n' 3) Parse the line to obtain the keyword\n' 4) Define the c
aseSection if needed (for out of order input objects)\n' 5) Perform the action for each caseSection\n'-------------------------------------------------------------------------------\n\nWhile(inFile.IsAtEnd.Not)                                      ' loop through the whole file\n\n  theString = inFile.ReadElt                                   ' read in the line from the file\n  while (theString=\"\")                                         ' check for a blank line and keep skipping it\n    theString = inFile.ReadElt  
                               ' read in the line from the file\n  end                                                          ' end of loop through blank line\n  \n  inList = theString.AsTokens(\":\")                             ' parse using :\n  check0 = inList.Get(0).AsString.Trim                         ' get the keyword (trim the blanks)\n\n  if (check0 = \"BEGINSTREAMNETWORK\") Then\n    ' accomodates for compatibility with RAS 2.1\n    ' create a theme to hold the 2D stream network\n    '-----------------------
---------------------------------------------\n    av.ShowMsg(\"Creating stream network shape file\")      ' show the message on what is going on\n    'shapeSNName = (sResultDirectory + \"_SN\"+\".shp\").AsFileName ' define the stream network shape name\n    'shapeSNName = FileName.Merge( sResultDirectory, \"Results_SN.shp\")    ' define the stream network shape name\n    shapeSNName = FileName.Merge( sResultDirectory, (sCamsResDir + \"_SN\"+\".shp\").asstring)    ' define the stream network shape name\n\n\n    \n    SNFTab = 
FTab.MakeNew(shapeSNName, Polyline)          ' create the FTab for the cross-section shape file\n    shapeField1 = SNFTab.FindField(\"Shape\")               ' define field holder for shape field\n\n    ' add standard fields\n    '---------------------                                ' define standard items for each cross-section\n    f21=Field.Make(\"Stream_ID\",#FIELD_CHAR,16,0)\n    f22=Field.Make(\"Reach_ID\",#FIELD_CHAR,16,0)\n    f23=Field.Make(\"SR_ID\",#FIELD_SHORT,5,0)\n    SNFTab.AddFields({f21,f22,f23})           
            ' add the fields to the table\n\n    ' Create a dictionary to obtain SR_ID's given a Stream_ID and a Reach_ID\n    dictSR = Dictionary.Make( 10)\n\n    caseSection = \"SN\"                                    ' define the case\n  end\n\n  if (check0 = \"BEGIN CROSS-SECTIONS\") Then \n    av.ShowMsg(\"Generating cross-sections\")               ' show the message on what is going on\n    caseSection = \"CS\"                                    ' define the case\n  end\n\n\n\n\n\n  '******************************************
********************************************************\n  if (caseSection = \"HEADER\") Then                             ' processing the HEADER section  \n  '-------------------------------------------------------------------------------\n  ' Process the file header (read in the values first, then create the shape file)\n  '-------------------------------------------------------------------------------  \n\n    if (check0 = \"UNITS\") Then                              ' check if UNITS\n      if (inList.count > 1) t
hen                            ' check if information available\n          sUnits = inList.Get(1).AsString.Trim              ' save the value\n        else\n          sUnits = nil                                      ' give it a nil\n      end\n    end                                                     ' end of checking for UNITS\n  \n    if (check0 = \"MAP PROJECTION\") Then                     ' check if MAP PROJECTION\n      if (inList.count > 1) then                            ' check if information available\n  
        sMapProjection = inList.Get(1).AsString.Trim      ' save the value\n        else\n          sMapProjection = nil                              ' give it a nil\n      end\n    end                                                     ' end of checking for MAP PROJECTION\n  \n    if (check0 = \"PROJECTION ZONE\") Then                    ' check if PROJECTION ZONE\n      if (inList.count > 1) then                            ' check if information available\n          sProjectionZone = inList.Get(1).AsString.Trim   
  ' save the value\n        else\n          sProjectionZone = nil                             ' give it a nil\n      end\n    end                                                     ' end of checking for PROJECTION ZONE\n  \n    if (check0 = \"DATUM\") Then                              ' check if DATUM\n      if (inList.count > 1) then                            ' check if information available\n          sDatum = inList.Get(1).AsString.Trim              ' save the value\n        else\n          sDatum = nil           
                           ' give it a nil\n      end\n    end                                                     ' end of checking for DATUM\n  \n    if (check0 = \"VERTICAL DATUM\") Then                     ' check if VERTICAL DATUM\n      if (inList.count > 1) then                            ' check if information available\n          sVDatum = inList.Get(1).AsString.Trim             ' save the value\n        else\n          sVDatum = nil                                     ' give it a nil\n      end\n    end      
                                               ' end of checking for VERTICAL DATUM\n  \n    if (check0 = \"NUMBER OF PROFILES\") Then                 ' check if NUMBER OF PROFILES\n      if (inList.count > 1) then                            ' check if information available\n          iNoProfiles = inList.Get(1).AsString.Trim.AsNumber     ' save the value\n\n          theString = inFile.ReadElt                        ' skip the line containing \"profile names:\"\n          lProfileNames = {}                           
     ' create a blank list to contain profile names\n          for each i in 1..iNoProfiles                      ' loop to get the profile names\n            theString = inFile.ReadElt                      ' read in the line with the profile name\n            theString = theString.Trim                      ' trim the leading and trailing blanks\n  \n            ' replace \"bad\" characters (\"#\",  \",\", \" \", \".\")\n            if (theString.contains(\"#\")) then               ' check if there is a # in the name\n        
      theString = theString.Substitute (\"#\", \"_\")   ' replace # with _\n            end\n            if (theString.contains(\" \")) then               ' check if there is an internal space in the name\n              theString = theString.Substitute (\" \", \"_\")   ' replace \" \" with \"_\"\n            end\n            if (theString.contains(\",\")) then               ' check if there is a , in the name\n              theString = theString.Substitute (\",\", \"_\")   ' replace , with _\n            end\n            if (theString
.contains(\".\")) then               ' check if there is a . in the name\n              theString = theString.Substitute (\".\", \"_\")   ' replace . with _\n            end\n  \n            ' check if the first character is a number\n            if (theString.Left(1).IsNumber) then\n              ' the first character is a number - have to add \"w\" to the beginning of the name\n              theString = \"w\"+theString\n            end\n            \n            theString = theString.Left(9)                  ' limit the fiel
d name to the first 9 characters\n            \n            lProfileNames.Add(theString)                    ' add the profile name to the list of names\n            csrasTag = csrasTag+\"=\"+theString               ' add to the theme tag the WS item name (= as separator)\n          end                                               ' end the profile name loop \n        else\n          iNoProfiles = nil                                 ' give it a nil\n      end\n    end                                                  
   ' end of checking for NUMBER OF PROFILES\n  \n    if (check0 = \"NUMBER OF REACHES\") Then                  ' check if NUMBER OF REACHES\n      if (inList.count > 1) then                            ' check if information available\n          iNoReaches = inList.Get(1).AsString.Trim.AsNumber          ' save the value\n        else\n          iNoReaches = nil                                  ' give it a nil\n      end\n    end                                                     ' end of checking for NUMBER OF REACHE
S\n  \n    if (check0 = \"NUMBER OF CROSS-SECTIONS\") Then           ' check if NUMBER OF CROSS-SECTIONS\n      if (inList.count > 1) then                            ' check if information available\n          iNoCS = inList.Get(1).AsString.Trim.AsNumber      ' save the value\n        else\n          iNoCS = nil                                       ' give it a nil\n      end\n    end                                                     ' end of checking for NUMBER OF CROSS-SECTIONS\n  \n    if (check0 = \"END HEADER\") T
hen                         ' check if END HEADER\n  \n      ' create a theme to hold the 2D cross-sections and WS elevation items\n      '--------------------------------------------------------------------\n      av.ShowMsg(\"Creating cross-section shape file\")       ' show the message on what is going on\n      'shapeCSName = (sResultDirectory + \"_XS\"+\".shp\").AsFileName ' define the cross section shape name\n      'shapeCSName = FileName.Merge( sResultDirectory, \"Results_xs.shp\")   ' define the cross-section sh
ape name\n      shapeCSName = FileName.Merge( sResultDirectory, (sCamsResDir + \"_XS\"+\".shp\").asstring)\n      CSFTab = FTab.MakeNew(shapeCSName, Polyline)          ' create the FTab for the cross-section shape file\n  \n      ' add standard fields\n      '---------------------                                ' define standard items for each cross-section\n      f5=Field.Make(\"Stream_ID\",#FIELD_CHAR,16,0)\n      f6=Field.Make(\"Reach_ID\",#FIELD_CHAR,16,0)\n      f2=Field.Make(\"SR_ID\",#FIELD_SHORT,5,0)\n      f3=Field.M
ake(\"Station\",#FIELD_DECIMAL,11,4)\n      f4=Field.Make(\"Interp\",#FIELD_CHAR,1,0)\n      CSFTab.AddFields({f5,f6,f2,f3,f4})                       ' add the fields to the table\n\n      ' add  water surface profile items\n      '----------------------------------\n      iLoop = iNoProfiles - 1\n      for each i in 0..iLoop                                ' loop through the list of profiles\n        sItem = lProfileNames.Get(i).AsString\n        sFieldToAdd = Field.Make(sItem,#FIELD_DECIMAL,11,4) ' specify the profile 
item to add\n        CSFTab.AddFields({sFieldToAdd})                     ' add the profile item\n      end                                                   ' end adding the WS profile items\n      \n      ' Prepare for levee data. Create an empty Dictionary.\n      ' Levees are stored as Dictionaries of Dictionaries within this Dictionary.\n      ' It is not as confusing as it sounds. For each levee, a Dictionary will be created within this Dictionary,\n      ' having the Levee_ID as its key. The items in that Di
ctionary will be Dictionaries of points, keyed by station.\n      '\n      ' We're NOT assuming that a given Levee (identified by a Levee_ID) will extend on only one stream/reach.\n      ' If there are no levees in this export file, then dictLevee will have zero elements, and there's no need\n      ' to make a levee shapefile.\n      ' --------------------------------------------------\n      dictLevee = Dictionary.Make( 50)\n      \n      ' Added by DM3 21 July 1999\n\n      ' Create Shapefiles to contain the bank p
oints. These will eventually be used to make breaklines in the TIN.\n      ' --------------------------------------------------\n      BankPtName = FileName.GetTmpDir.MakeTmp( \"bank\", \"shp\")\n      BankPtFTab = FTab.MakeNew( BankPtName, Point)  ' create the FTab\n      \n      ' Create a new Dictionary to hold the FTabs of the velocity points\n      ' ----------------------------------------------------------------\n      VeloTabDict = Dictionary.Make(5)\n\n      ' Add SR_ID field. Is the SR_ID of this stream and re
ach.  Also add field for CS station.\n      ' -------------------------------------------------\n      bf1=Field.Make(\"SR_ID\",#FIELD_SHORT,5,0)\n      bf2=Field.Make(\"Station\",#FIELD_FLOAT,7,2)\n      bf3=Field.Make(\"Side\",#FIELD_CHAR,1,0)\n      BankPtFTab.AddFields({bf1,bf2,bf3})\n\n\n      ' end of additions by DM3 21 July 1999\n\n      ' set the case to nothing since we are not sure what will follow (compatibility with 2.1)\n      caseSection = \"AAA\"\n\n    end                                                     ' e
nd of checking for END HEADER\n\n  '------------------------------\n  ' End of file header processing\n  '------------------------------\n  end                                                        ' end of HEADER section\n  '********************************************************************************************************\n\n\n  '********************************************************************************************************\n  if (caseSection = \"SN\") Then                               ' processing th
e stream network (SN) section\n  '-----------------------------------------------\n  ' Process the stream network export file section\n  ' Currently just skip the whole section.\n  '-----------------------------------------------\n\n    ' skip the ENDPOINT: and blank lines\n    while ((theString.Trim <> \"REACH:\") and (theString.Trim <> \"ENDSTREAMNETWORK:\"))\n      theString = inFile.ReadElt                            ' skip the line\n    end\n\n    if (theString.Trim = \"REACH:\") Then                     ' check if REA
CH\n    '--------------------------------\n    ' process the whole rach (there are no blanks between the start and end of single reach)\n    '---------------------------------------------------------------------------------------\n\n      ' read in the standard ids for the cross-section\n      '-----------------------------------------------\n      theString = inFile.ReadElt                            ' first is STREAM_ID\n      inList = theString.AsTokens(\":\")\n      sStreamId = inList.Get(1).AsString.Trim         
      ' define its value\n      \n      theString = inFile.ReadElt                            ' second is REACH_ID\n      inList = theString.AsTokens(\":\")\n      sReachId = inList.Get(1).AsString.Trim                ' define its value\n\n      ' skip the next three lines (FROM POINT, TO POINT, CENTERLINE)\n      theString = inFile.ReadElt                            ' skip line\n      theString = inFile.ReadElt                            ' skip line\n      theString = inFile.ReadElt                            ' skip 
line\n\n      theString = inFile.ReadElt                            ' read-in the first pair of reach coordinates\n\n      \n      ' read in and put together the REACH polyline as a list of points\n      '---------------------------------------------------------\n      reachLine = {}                                        ' create an empty list with coordinates\n      while (theString.Trim.UCase <> \"END:\")\n        listCoords = theString.AsTokens(\",\")\n        xcoord = listCoords.Get(0).AsString.Trim.AsNumber\n       
 ycoord = listCoords.Get(1).AsString.Trim.AsNumber\n        reachLine.Add(xcoord@ycoord)\n        theString = inFile.ReadElt                          ' read in the next pair of coordinates\n      end                                                   ' end of reach line generation\n\n      ' generate the new polyline record in the reach theme\n      '----------------------------------------------------\n      newRecNum = SNFTab.AddRecord                          ' create a new record and get a new record number    
      \n      SNFTab.SetValue(SNFTab.FindField(\"Shape\"), newRecNum, Polyline.Make({reachLine}))    ' set the new shape\n      SNFTab.SetValue(f21, newRecNum, sStreamId.AsString)   ' set the new shape's Stream_ID\n      SNFTab.SetValue(f22, newRecNum, sReachId.AsString)    ' set the new shape's Reach_ID\n      SNFTab.SetValue(f23, newRecNum, newRecNum)            ' set the new shape's SR_ID\n\n      ' Add an entry into the ID dictionary for this reach\n      ' ----------------------------------- \n      strKey = (sS
treamID.AsString + sReachID.AsString).Trim.UCase\n      dictSR.Add( strKey, newRecNum.Clone)\n\n      '------------------------------ \n      ' done saving the reach\n      '------------------------------\n    end                                                     ' end of checking for individual REACH\n\n\n    if (theString.Trim = \"ENDSTREAMNETWORK:\") Then          ' check if end of STREAM NETWORK\n\n      av.ShowMsg(\"Saving stream network\")                   ' show the message on what is going on\n      SNFTab.Flush
                                          ' save theme to disk\n      SNFTab.SetEditable(false)                             ' stop editing theme\n\n      ' open the reach theme\n      '---------------------\n      theSNSrcName = SrcName.Make(shapeSNName.AsString)\n      theSNTheme = Theme.Make(theSNSrcName)\n\n      ' tag the reach shape file with \"centerlineras\" tag\n      '---------------------------------------------\n      av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theSNTheme,\"sName\",\"reachras\"})    ' define the them
e tag\n      \n      ' add the stream network theme to the flood analysis view and make it visible\n      '----------------------------------------------------------------------------\n      oView.AddTheme(theSNTheme)\n      theSNTheme.SetVisible(true)\n'      theSNTheme.Invalidate(true)\n      \n      caseSection = \"CS\"                                    ' set the case for cross-section processing\n      av.ShowMsg(\"Generating cross-sections\")               ' show the message on what is going on\n      iCSprogress =
 0\n      \n    end                                                     ' end of checking for end of the STREAM NETWORK\n\n  '---------------------------------\n  ' End of stream network processing\n  '---------------------------------\n  end                                                           ' end of STREAM NETWORK section\n  '********************************************************************************************************\n\n\n  '*************************************************************************
*******************************\n  if (caseSection = \"CS\") Then                               ' processing the cross-section (CS) section\n    '----------------------------------------------\n    ' Process the cross-section export file section\n    '----------------------------------------------\n\n    theString = inFile.ReadElt.Trim                              ' read in the line from the file\n    while (theString=\"\")                                         ' check for a blank line and keep skipping it\n      the
String = inFile.ReadElt.Trim                            ' read in the line from the file\n    end                                                          ' end of loop through blank line\n\n    while (inFile.IsAtEnd.Not)      ' loop until a \"break\" statement or end-file\n\n        'DEBUG if (MsgBox.YesNo( theString,\"quit?\",true).not) then exit end\n        \n        if (theString.Left(8).UCase = \"CROSS-SE\") Then ' check if CROSS-SECTION starting\n\n          ' read in the header for the cross-section\n          '---
--------------------------------------------\n          theString = inFile.ReadElt                            ' first is STREAM_ID\n          inList = theString.AsTokens(\":\")\n          sStreamId = inList.Get(1).AsString.Trim               ' define its value\n          \n          theString = inFile.ReadElt                            ' second is REACH_ID\n          inList = theString.AsTokens(\":\")\n          sReachId = inList.Get(1).AsString.Trim                ' define its value\n\n          theString = inFile.Read
Elt                            ' third is STATION\n          inList = theString.AsTokens(\":\")\n          sStation = inList.Get(1).AsString.Trim                ' define its value\n          if (sStation.Contains(\"*\")) then                      ' check if it is an interpolated CS\n            sInterp = \"y\"                                       ' interpolated is true\n            inList = sStation.AsTokens(\"*\")\n            sStation = inList.Get(0).AsString.Trim              ' extract the number only\n          else\n
            sInterp = \"n\"                                       ' CS is not interpolated\n          end\n          \n          if (iNoCS <> NIL) then\n              iCSprogress = iCSProgress + 1\n              av.SetStatus( iCSprogress / iNoCS * 100)\n          end\n          \n          av.ShowMsg( \"Generating cross sections (\" + SStreamId ++ sReachId++sStation+\")\")\n             \n          csPolyLine = NIL                                      ' Reset the PolyLine for this cross-section\n          csRecNum = CSFTab.
AddRecord                          ' create a new record and get a new record number          \n          CSFTab.SetValue(CSFTab.FindField(\"Shape\"), csRecNum, PolyLine.MakeEmpty)    ' set the new shape to nothing\n\n        end\n\n        if (theString.Left(6).UCase = \"CUT LI\") then\n          ' read in and put together the CUT LINE polyline as a list\n          '---------------------------------------------------------\n          strikeLine = {}                                       ' create an empty list with coo
rdinates\n          ' loop until reaching the end of the CUT LINE specification\n          theString = inFile.ReadElt.Trim\n          while (theString.Left(1).IsNumber)                    ' loop until encounter non-numeric line\n            listCoords = theString.AsTokens(\",\")\n            xcoord = listCoords.Get(0).AsString.Trim.AsNumber\n            ycoord = listCoords.Get(1).AsString.Trim.AsNumber\n            strikeLine.Add(xcoord@ycoord)\n            theString = inFile.ReadElt.Trim                     ' read i
n the next pair of coordinates\n          end                                                   ' end of strike line generation\n\n          ' Determine the ID number of this stream and reach\n          '-------------------------------------------------\n          strKey = (sStreamID.AsString + sReachID.AsString).Trim.UCase\n          theID = dictSR.Get( strKey)\n          if (theID = NIL) then\n              strErrorMsg = \"RAS export file\"\n                            ++ inFile.GetName\n                            +
+ \"is bad at line number\"\n                            ++ (inFile.GetPos + 1).AsString\n                            ++ \": No stream/reach defined:\"\n                            ++ sStreamID.AsString ++ sReachID.AsString\n              MsgBox.Error( strErrorMsg, strMessageTitle)\n              exit\n          end\n\n          ' generate the new polyline record in the cross-section theme\n          '------------------------------------------------------------\n          csPolyLine = Polyline.Make({strikeLine})\n        
  CSFTab.SetValue(CSFTab.FindField(\"Shape\"), csRecNum, csPolyLine)    ' set the new shape\n          CSFTab.SetValue(f2, csRecNum, theID)                 ' set the new shape's Stream/Reach ID\n          CSFTab.SetValue(f3, csRecNum, sStation.AsNumber)     ' set the new shape's Station\n          CSFTab.SetValue(f4, csRecNum, sInterp) \n          CSFTab.SetValue(f5, csRecNum, sStreamID)\n          CSFTab.SetValue(f6, csRecNum, sReachID) \n          continue         ' no need to read next line yet\n        end  ' of
 CUT LINE processing\n\n\n        if (theString.Left(4).UCase = \"BANK\") then\n\n          if (csPolyLine = NIL) then\n            strErrorMsg = \"RAS export file\"\n                          ++ inFile.GetName\n                          ++ \"is bad at line number\"\n                          ++ (inFile.GetPos + 1).AsString\n                          ++ \": BANK POSITION field must be after CUT LINE field\"\n            MsgBox.Error( strErrorMsg, strMessageTitle)\n            exit\n          end\n\n          inList = theString.As
Tokens(\":\")\n          lstBankPosns = inList.Get(1).AsString.AsTokens(\",\")   ' create a list with left and right b.p. values\n\n          ' Add a point to the left bank and the right bank Point table corresponding to this stream and reach\n          '--------------------------------------------------------\n\n          for each i in 0..1\n              p = csPolyLine.Along( lstBankPosns.Get(i).AsNumber * 100 )      ' Retrieve point along the CS of the left bank\n              r = BankPtFTab.AddRecord\n              
BankPtFTab.SetValue( BankPtFTab.FindField( \"shape\"), r, p)\n              BankPtFTab.SetValue( BankPtFTab.FindField( \"Station\"), r, sStation.AsNumber)\n              BankPtFTab.SetValue( BankPtFTab.FindField( \"SR_ID\"), r, theID)\n              BankPtFTab.SetValue( BankPtFTab.FindField( \"Side\"), r, {\"l\",\"r\"}.Get(i))\n          end\n        end  ' of bank position parsing\n\n\n        if (theString.Left(8).Ucase = \"WATER EL\") then\n          inList = theString.AsTokens(\":\")\n          lstProfiles = inList.Get(1).AsStri
ng.AsTokens(\",\")    ' create a list of elevation values.\n\n          ' Add the water elevations to the corresponding columns in the CS table\n          ' ---------------------------------------------------------------------\n          for each i in 0..iLoop                                ' loop through the list of profiles\n            sItem = lProfileNames.Get(i).asString               ' get the profile name\n            profField = CSFTab.FindField(sItem)                 ' create the items field holder\n       
     profValue = lstProfiles.Get(i).AsNumber             ' extract the single profile value from the list\n            CSFTab.SetValue(profField, csRecNum, profValue)    ' add the profile item\n          end                                                   ' end adding the WS profile values\n        end\n\n\n        if (theString.Left(8).Ucase = \"WATER SU\") then\n          ' skip the section \"WATER SURFACE EXTENTS:\"\n          ' -----------------------------------------\n          theString = inFile.ReadElt.Trim\n  
        while (theString.Left(1).IsNumber)\n            theString = inFile.ReadElt.Trim\n          end\n          continue         ' no need to read next line yet\n        end\n\n        \n        ' Following added by DM3 4/00\n        if (theString.Left(5).Ucase = \"LEVEE\") then\n          ' Found one or some levees. We'll store them by SR_ID and station, and put them in the right order later\n          ' Format of the stream/reach dictionaries within dictLevee is:  key = SR_ID, value = Dictionary( station, point)\n  
        ' Format of the levee point dictionaries within the stream/reach dictionaries is:  key = station, value = point\n          ' ------------------------------------------------------------------------------------------------------\n          theString = inFile.ReadElt.Trim\n          while (theString.Left(1).IsNumber)\n            inList = theString.AsTokens(\",\")\n            LeveeID = inList.Get(0)\n            pt = csPolyLine.Along( inList.Get(1).AsNumber * 100 )      ' Retrieve point along the CS\n\n       
     ' First, find the stream/reach Dictionary for this LeveeID\n            dictLeveeSR = dictLevee.Get( LeveeID)                       ' Retrieve the dictionary of streams/reaches for this levee\n            if (dictLeveeSR = NIL) then\n              ' New levee; create entry in dictLevee for it\n              dictLeveeSR = Dictionary.Make( 5)\n              dictLevee.Add( LeveeID, dictLeveeSR)\n            end\n            \n            ' Next, find the point Dictionary for this stream/reach\n            dictPoin
t = dictLeveeSR.Get( theID)\n            if (dictPoint = NIL) then\n              ' New stream/reach\n              dictPoint = Dictionary.Make( 10)\n              dictLeveeSR.Add( theID, dictPoint)\n            end\n\n            ' Add the point to the point dictionary, indexed by station\n            dictPoint.Add( sStation.AsNumber, pt)\n\n            ' Go to the next line, if any\n            theString = inFile.ReadElt.Trim\n          end\n          continue        ' no need to read next line yet\n        end\n       
 ' End of items added by DM3 4/00\n\n\n        if (theString.Left(6).Ucase = \"PROFIL\") then\n\n          ' Import velocities for each profile\n          ' ----------------------------------\n          while ((theString.Left(4).UCase <> \"SURF\") and (theString.UCase <> \"END:\"))\n            inList = theString.AsTokens(\":\")\n            sProfile = inList.Get(1).AsString.Trim            ' get the profile id and remove illegal characters\n            for each c in {\"#\", \" \", \",\", \".\"}\n              sProfile = sProfile.Sub
stitute(c, \"_\")\n            end\n        \n            ' check if the first character is a number - have to add \"w\" to the beginning of the name\n            if (sProfile.Left(1).IsNumber) then\n              sProfile = \"w\"+sProfile\n            end\n            sProfile = sProfile.Left(9)                       ' limit the unique field name to the \n                                                              ' first 9 characters\n\n            theString = inFile.ReadElt.Trim\n            if (theString = \"VELOCITIES
:\") then\n\n              ' Locate the velocity mass point table for this profile.  Might have to create it.\n              ' ------------------------------------------------------------\n              aList = VeloTabDict.Get( sProfile)\n              if (aList = NIL) then\n\n                ' Create a table to contain the velocity mass points\n                ' --------------------------------------------------\n                'VeloName = (sResultDirectory + \"vp\"+sProfile+\".shp\").AsFilename\n                'VeloNa
me = FileName.Merge(sResultDirectory, \"vp\"+sProfile+\".shp\")\n                VeloName = FileName.Merge( sResultDirectory, (sCamsResDir + \"vp\"+sProfile+\".shp\").asstring)\n                VeloFTab = FTab.MakeNew( VeloName, PointZ)  ' create the FTab\n                VeloFTab.AddFields({Field.Make(\"Velocity\",#FIELD_FLOAT,6,2)})\n\n                VeloTabDict.Add( sProfile, {VeloFTab, VeloName})\n              else\n                VeloFTab = aList.Get( 0)\n              end\n            \n              thePoint = PointM
.MakeNull\n\n              ' Loop through all of the velocity data\n              ' --------------------------------\n              theString = inFile.ReadElt.Trim\n              while (theString.Left(1).IsNumber)\n                lstItems = theString.AsTokens( \",\")         ' Parse out the centroid and the velocity\n                thePoint = csPolyLine.Along(lstItems.Get(0).AsNumber * 100)\n\n                if (lstItems.Get(1).IsNumber) then            ' If it is a correct number, use it\n                  theVeloc
ity = lstItems.Get(1).AsNumber\n                  if (theVelocity > 10000000.0) then          ' Check for huge numbers, which are invalid\n                    theVelocity = -1\n                  end\n                else\n                    theVelocity = -1\n                end\n                \n                r = VeloFTab.AddRecord                      ' Add a new point to the table\n                VeloFTab.SetValue( VeloFTab.FindField( \"shape\"), r, thePoint@theVelocity)\n                VeloFTab.SetValue( VeloF
Tab.FindField( \"Velocity\"), r, theVelocity)\n\n                theString = inFile.ReadElt.Trim\n              end                                             ' End of loop to read in velocities\n            end\n          end                                                 ' End of loop to read profile ID's\n          continue         ' no need to read next line yet\n        end                      ' end of section to import velocity data\n\n\n        if (theString = \"SURFACE LINE:\") then\n          ' check to see if
 the cross-sections contain the surface line.\n          '-------------------------------------------------------------\n\n          ' first check to see if we need to create the 3D cross-section shape.\n          if (bCreate3DCS) then\n            ' create a theme to hold the 3D cross-sections (no WS elevation items)\n            'shapeCS3DName = (sResultDirectory + \"_XS3D\"+\".shp\").AsFileName ' define the 3D cross section shape name\n            'shapeCS3DName = FileName.Merge( sResultDirectory, \"Result_XS_3D.shp
\") ' define the 3D cross-section shape name\n            shapeCS3DName = FileName.Merge( sResultDirectory, (sCamsResDir + \"_XS3D\"+\".shp\").asstring)\n            CS3DFTab = FTab.MakeNew(shapeCS3DName, PolylineZ)     ' create the FTab for the 3D cross-section shape file\n            shape3DField = CS3DFTab.FindField(\"Shape\")            ' define field holder for shape field\n\n            ' add standard fields\n            '---------------------                                ' define standard items for each cross-s
ection\n            f11=Field.Make(\"Stream_ID\",#FIELD_CHAR,16,0)\n            f12=Field.Make(\"Reach_ID\",#FIELD_CHAR,16,0)\n            f13=Field.Make(\"Station\",#FIELD_DECIMAL,11,4)\n            f14=Field.Make(\"Interp\",#FIELD_CHAR,1,0)\n            CS3DFTab.AddFields({f11,f12,f13,f14})                 ' add the standard fields to the 3D table\n\n            bCreate3DCS =  FALSE                                  ' reset the boolean for theme creation\n          end\n\n          ' read in and put together the SURFACE LIN
E 3D polyline as a list\n          '----------------------------------------------------------------\n          theString = inFile.ReadElt.Trim                 ' read-in the first pair of coordinates for SURFACE LINE\n          strikeLine3D = {}                               ' create an empty list with coordinates\n          while (theString.Left(1).IsNumber)              ' loop until reaching the END:\n            listCoords = theString.AsTokens(\",\")\n            xcoord = listCoords.Get(0).AsString.Trim.AsNumber
\n            ycoord = listCoords.Get(1).AsString.Trim.AsNumber\n            zcoord = listCoords.Get(2).AsString.Trim.AsNumber\n            strikeLine3D.Add(PointZ.Make(xcoord,ycoord,zcoord))\n            theString = inFile.ReadElt.Trim                     ' read in the next pair of coordinates\n          end                                                   ' end of strike line generation\n\n          \n          ' generate the new 3D polyline record in the 3D cross-section theme.\n          ' The cross-sections in
 3D theme contain only the base info, not the water\n          ' surface elevation form the model (that is in the cut-line theme).\n          '-------------------------------------------------------------------------\n          newRecNum3D = CS3DFTab.AddRecord                           ' create a new record and get a new record number          \n          CS3DFTab.SetValue(CSFTab.FindField(\"Shape\"), newRecNum3D, PolylineZ.Make({strikeLine3D}))\n          CS3DFTab.SetValue(f11, newRecNum3D, sStreamId.AsString)   
 ' set the new shape's Stream_ID\n          CS3DFTab.SetValue(f12, newRecNum3D, sReachId.AsString)     ' set the new shape's Reach_ID\n          CS3DFTab.SetValue(f13, newRecNum3D, sStation.AsNumber)     ' set the new shape's Station\n          CS3DFTab.SetValue(f14, newRecNum3D, sInterp)               ' set the Interp to sInterp\n\n          continue         ' no need to read next line yet\n        end                                                   ' end of checking for SURFACE LINE: section\n\n        if (theS
tring.Left(5) = \"NVALU\") then\n          ' Manning's N values. Skip.\n          ' -------------------------\n          theString = inFile.ReadElt.Trim\n          while (theString.Left(1).IsNumber)\n            theString = inFile.ReadElt.Trim\n          end\n          continue         ' no need to read next line yet\n        end\n\n        if (theString.Left(10) = \"END CROSS-\") Then                 ' check if END CROSS-SECTIONS\n          ' Here is where we tidy up the cross-section data, because we're about to move on
 to another section\n\n          ' Create the Levee shapefile, if necessary\n          ' ----------------------------------------\n          if (dictLevee.Count > 0) then\n            ' Make the Levee shapefile\n            av.ShowMsg(\"Creating levee shape file\")    ' show the message on what is going on\n            'leveeFilename = (sResultDirectory + \"_levees\"+\".shp\").AsFileName\n            leveeFilename = FileName.Merge( sResultDirectory, (sCamsResDir + \"_levees\"+\".shp\").asstring)\n\n            ftLevee = FTab.M
akeNew( leveeFilename, PolyLine)\n            ftLevee.AddFields( {Field.Make(\"Levee_ID\",#FIELD_SHORT,5,0)})\n            ftLevee.StartEditingWithRecovery\n\n            for each LeveeID in dictLevee.ReturnKeys\n              dictLeveeSR = dictLevee.Get( LeveeID)\n\n              for each srid in dictLeveeSR.ReturnKeys\n                ' For each stream/reach, create a list of points, then a polyline from those\n                dictPoints = dictLeveeSR.Get( srid)\n                lstStation = dictPoints.ReturnKeys\n   
             lstStation.Sort(FALSE)                ' Sort the points in downstream (descending station) order\n                lstPoints = {}\n                for each sta in lstStation\n                   lstPoints.Add( dictPoints.Get( sta))\n                end\n                aLeveeLine = PolyLine.Make( {lstPoints})\n                r = ftLevee.AddRecord\n                ftLevee.SetValue( ftLevee.FindField( \"Levee_ID\"), r, LeveeID)\n                ftLevee.SetValue( ftLevee.FindField( \"Shape\"), r, aLeveeLine)\n 
             end\n            end\n\n            ' Free up some memory\n            dictLevee = NIL\n            dictLeveeSR = NIL\n            ftLevee.StopEditingWithRecovery( TRUE)\n            ftLevee.Flush\n\n            ' Tag it\n            theLeveeTheme = Theme.Make( SrcName.Make(leveeFileName.AsString))\n            av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theLeveeTheme,\"sName\",\"leveeout\"})    ' define the theme tag\n            av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theLeveeTheme,\"sType\",NIL})\n            av.run
(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theLeveeTheme,\"sField\",NIL})\n          else\n            theLeveeTheme = NIL\n          end\n\n          ' save the 2D cross-section FTab to disk and make a theme out of it\n          '------------------------------------------------------------------\n          av.ShowMsg(\"Saving cross-section shape files\")        ' show the message on what is going on\n          CSFTab.Flush                                          ' save 2D to disk\n          CSFTab.SetEditable(false)            
                 ' stop editing 2D\n          theSrcName = SrcName.Make(shapeCSName.AsString)\n          theCSTheme = Theme.Make(theSrcName)\n\n          ' tag the CS shape file with \"crossras\" tag and \n          ' the WS profile list (separated by = sign)\n          '-----------------------------------------------------\n          av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theCSTheme,\"sName\",\"crossras\"})    ' define the theme tag\n          av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theCSTheme,\"sField\",csrasTag})     ' d
efine the elevation items tag\n\n\n          ' save the velocity mass point FTab and the bank lines FTab, and make themes of them, if needed\n          '--------------------------------------------------------------------------------------------\n\n          av.ShowMsg(\"Saving velocity profile shape files\")        ' show the message on what is going on\n          for each sProfileID in VeloTabDict.ReturnKeys\n            VeloFTab = VeloTabDict.Get( sProfileID).Get(0)\n            if (VeloFTab.GetNumRecords > 0) then
                     ' check to see if there's anything in it\n\n                ' Save the Velocity point theme, and tag it with VelPoints\n                ' --------------------------------------------------------\n                VeloFTab.Flush                                          ' save to disk\n                VeloFTab.SetEditable(false)                             ' stop editing \n                theVeloTheme = Theme.Make( SrcName.Make(VeloTabDict.Get( sProfileID).Get( 1).AsString))\n                oVie
w.AddTheme(theVeloTheme)\n                av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theVeloTheme,\"sType\",\"VelPoints\"})    ' define the theme tag\n                av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theVeloTheme,\"sField\",sProfileID})\n            end\n          end\n\n          if (BankPtFTab.GetNumRecords > 0 ) then\n              ' Save the Bank point theme\n              ' --------------------------------------------------\n              BankPtFTab.Flush                                          ' save to disk\n    
          BankPtFTab.SetEditable(false)                             ' stop editing \n\n              ' Make a Banks PolyLine theme from the bank points\n              ' ---------------------------\n              'BankLineName = (sResultDirectory + \"_Banks\"+\".shp\").AsFileName ' define the bank lines shape name\n              'BankLineName = FileName.Merge( sResultDirectory, \"Results_Banks.shp\")\n              BankLineName = FileName.Merge( sResultDirectory, (sCamsResDir + \"_Banks\"+\".shp\").asstring)\n\n              
BankLineFTab = FTab.MakeNew( BankLineName, PolyLine)  ' create the FTab\n              fSRID = Field.Make(\"SR_ID\",#FIELD_SHORT,5,0)\n              BankLineFTab.AddFields( {fSRID})\n\n              for each i in 0..(SNFtab.GetNumRecords-1)\n                BankPtFTab.Query( \"([SR_ID]=\" + i.AsString + \")\",\n                              BankPtFTab.GetSelection,\n                              #VTAB_SELTYPE_NEW)\n\n                leftDict = Dictionary.Make( BankPtFTab.GetSelection.Count)\n                rightDict = Dic
tionary.Make( BankPtFTab.GetSelection.Count)\n\n                ' Retrieve all the points that are in this Stream and Reach\n                ' ---------------------------------------------------------\n                for each r in BankPtFTab.GetSelection\n      \n                  theStation = BankPtFTab.ReturnValue( BankPtFTab.FindField(\"Station\"), r)\n                  thePoint = BankPtFTab.ReturnValue( BankPtFTab.FindField(\"shape\"), r)\n\n                  theSide = BankPtFTab.ReturnValue( BankPtFTab.FindField(\"
Side\"), r)\n                  if (theSide.LCase = \"l\") then\n                    leftDict.Add( theStation.Clone, thePoint)\n                  else\n                    rightDict.Add( theStation.Clone, thePoint)\n                  end\n                end\n\n                leftPointList = {}\n                leftKeys = leftDict.ReturnKeys\n                leftKeys.Sort(FALSE)\n                for each theKey in leftKeys\n                   leftPointList.Add( leftDict.Get( theKey))\n                end\n\n                r
ightPointList = {}\n                rightKeys = rightDict.ReturnKeys\n                rightKeys.Sort(FALSE)\n                for each theKey in rightKeys\n                   rightPointList.Add( rightDict.Get( theKey))\n                end\n\n                ' Add the two banks to the polyline table\n                ' ---------------------------------------\n                for each pl in {leftPointList, rightPointList}\n                  r = BankLineFTab.AddRecord\n                  BankLineFTab.SetValue( BankLineFTab
.FindField( \"shape\"), r, PolyLine.Make( {pl}))\n                  BankLineFTab.SetValue( fSRID, r, i)\n                end\n\n              end ' of loop through each reach\n\n              ' Save the Bank line theme, and tag it\n              ' ------------------------------------\n              BankLineFTab.Flush\n              BankLineFTab.SetEditable(false)\n\n              theBankLineTheme = Theme.Make( SrcName.Make(BankLineName.AsString))\n              av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theBankLineTheme,\"sNa
me\",\"VelBanks\"})    ' define the theme tag\n\n              ' All done with the bank point shapefile. Delete it.\n              ' --------------------------------------------------\n              BankPtFTab.Deactivate\n              BankPtFTab = nil\n              av.PurgeObjects\n              File.Delete( BankPtName)\n\n              NeedToShowBanksThemes = TRUE\n          else                                                       ' The export file had no banks station data\n              NeedToShowBanksThemes = FAL
SE\n          end\n\n          ' save the 3D cross-section FTab to disk and make a theme out of it\n          ' if that theme has been created.\n          '------------------------------------------------------------------\n          if (not bCreate3DCS) then\n            CS3DFTab.Flush                                        ' save 3D to disk\n            CS3DFTab.SetEditable(false)                           ' stop editing 3D\n\n            ' open the 3D cross-section theme and tag it with \"cross3Dras\"\n            '-
------------------------------------------------------------\n            theSrcName = SrcName.Make(shapeCS3DName.AsString)\n            theCS3DTheme = Theme.Make(theSrcName)\n            av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theCS3DTheme,\"sName\",\"cross3Dras\"})    ' define the theme tag\n          end\n\n          caseSection = \"BOUNDS\"                                ' set the case for cross-section processing\n          av.ShowMsg(\"Generating flood bounds\")                 ' show the message on what is going on\n
          break                                                 ' exit the cross-section processing loop\n\n        end                                                     ' end of checking for END CROSS-SECTIONS\n        \n        ' Control goes here if an unidentified token came through\n        theString = inFile.ReadElt.Trim.Ucase                   ' read in the next item\n\n    end                                                         ' end of cross-section processing loop\n\n\n  '-----------------------------
---\n  ' End of cross-section processing\n  '--------------------------------\n  end                                                           ' end of CROSS-SECTION section\n  '********************************************************************************************************\n  \n\n  '********************************************************************************************************\n  if (caseSection = \"BOUNDS\") Then                              ' processing the bounds (BOUNDS) section\n  '-------------
---------------------------------\n  ' Process the bounds export file section\n  '----------------------------------------------\n\n    if (check0 = \"PROFILE LIMITS\") Then                     ' check if PROFILE LIMITS\n    '-------------------------------------------------------------\n    ' process the whole bounding polygon, each as a separate theme\n    '-------------------------------------------------------------\n\n      ' read in the standard ids for the cross-section\n      '----------------------------------
-------------\n      theString = inFile.ReadElt                            ' first is PROFILE_ID\n      inList = theString.AsTokens(\":\")\n      sProfileId = inList.Get(1).AsString.Trim              ' define its value\n\n      ' replace \"bad\" characters (\"#\",  \",\", \" \")\n      if (sProfileId.contains(\"#\")) then                    ' check if there is a # in the name\n        sProfileId = sProfileId.Substitute (\"#\", \"_\")       ' replace # with _\n      end\n      if (sProfileId.contains(\" \")) then                    ' 
check if there is an internal space in the name\n        sProfileId = sProfileId.Substitute (\" \", \"_\")       ' replace \" \" with \"_\"\n      end\n      if (sProfileId.contains(\",\")) then                    ' check if there is a , in the name\n        sProfileId = sProfileId.Substitute (\",\", \"_\")       ' replace , with _\n      end\n      if (sProfileId.contains(\".\")) then                    ' check if there is a . in the name\n        sProfileId = sProfileId.Substitute (\".\", \"_\")       ' replace . with _\n      end\n\n
      ' check if the first character is a number\n      if (sProfileID.Left(1).IsNumber) then\n        ' the first character is a number - have to add \"w\" to the beginning of the name\n        sProfileID = \"w\"+sProfileID\n      end\n \n      sProfileId = sProfileId.Left(9)                       ' limit the unique field name to the \n                                                            ' first 9 characters\n\n      ' create a theme to hold the bounding polygon\n      '-------------------------------------------
-\n      av.ShowMsg(\"Creating bounding polygon shape file\")    ' show the message on what is going on\n      shapeBndPlyName = (\"bp\"+sProfileID+\".shp\").AsFileName ' define the bounding polygon shape name\n      BPFTab = FTab.MakeNew(shapeBndPlyName, Polygon)       ' create the FTab for the cross-section shape file\n\n      ' add standard fields\n      '---------------------       \n                              ' define standard items for each bounding polygon\n      f1=Field.Make(\"Profile_ID\",#FIELD_CHAR,16,0)\n   
   BPFTab.AddFields({f1})                                ' add the fields to the table\n      \n\n      theString = inFile.ReadElt                            ' skip the POLYGON: line\n      cc = 0                                                ' start the reach counter\n      \n      ' read in and put together the polygon as a list\n      '-----------------------------------------------\n      while (theString.Trim <> \"END:\")                      ' loop until reaching the END:\n        strikeLine = {}               
                      ' create an empty list with coordinates\n        theString = inFile.ReadElt                          ' read-in the first pair of coordinates\n\n        cc = cc + 1                                         ' increase the reach counter\n\n        ' loop until reaching the END: or POLYGON: (one reach's worth of BP)\n        while ((theString.Trim <> \"POLYGON:\") and (theString.Trim <> \"END:\"))   \n          listCoords = theString.AsTokens(\",\")\n          xcoord = listCoords.Get(0).AsString.Trim.AsN
umber\n          ycoord = listCoords.Get(1).AsString.Trim.AsNumber\n          newPoint = Point.Make(xcoord,ycoord)\n          strikeLine.Add(newPoint)\n          theString = inFile.ReadElt                          ' read in the next pair of coordinates\n        end                                                   ' end of reach bounding poly generation\n\n        listOfList = {}                                       ' create a list of lists for polygon creation\n        listOfList.Add(strikeLine)\n        bpPolyLin
e = Polygon.Make(listOfList)                 ' create the reach bounding polygon\n\n        ' build the compound polygon for the whole area (for a given profile)\n        if (cc = 1) then\n            ' generate the intial summary polygon\n            theBPoly = bpPolyLine.Clone\n          else\n          ' merge the existing bounding polygon with new reach component\n          theBPoly = theBPoly.ReturnUnion(bpPolyLine).Clone\n        end\n\n      end                                                     ' end of profi
le bounding poly generation\n\n      ' generate the new polygon record in the bounding polygon theme\n      '--------------------------------------------------------------\n      newRecNum = BPFTab.AddRecord                          ' create a new record and get a new record number          \n      BPFTab.SetValue(BPFTab.FindField(\"Shape\"), newRecNum, theBPoly)      ' set the new shape\n      BPFTab.SetValue(f1, newRecNum, sProfileId.AsString)   ' set the new shape's Profile_ID\n\n      \n      ' save the bounding p
olygon theme to disk\n      '------------------------------------------\n      av.ShowMsg(\"Saving bounding polygon shape file\")      ' show the message on what is going on\n      BPFTab.Flush                                          ' save on disk\n      BPFTab.SetEditable(false)                             ' stop editing\n\n\n      ' open the bounds theme\n      '-----------------------------\n      theSrcName = SrcName.Make(shapeBndPlyName.AsString)\n      theBPTheme = Theme.Make(theSrcName)\n\n      ' tag the BP sha
pe file with \"wsbounds\" tag and \n      ' the WS item that was generated by (separated by = sign)\n      '--------------------------------------------------------\n      av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theBPTheme,\"sType\",\"wsbounds\"})    ' define the theme tag\n      av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theBPTheme,\"sField\",sProfileID})   ' define the elevation items tag\n\n      theBPTheme.StopEditing(true)                          ' stop editing\n      oView.AddTheme(theBPTheme)                           
 ' add the bounding poly to the view\n\n      '------------------------------------ \n      ' done saving the bounding poly theme\n      '------------------------------------\n    end                                                     ' end of checking for individual PROFILE LIMITS\n\n\n    if (check0 = \"END BOUNDS\") Then                         ' check if END BOUNDS\n       break                                                ' exit from the while loop reading the file\n    end                                      
               ' end of checking for END BOUNDS\n\n  '--------------------------------\n  ' End of bounds processing\n  '--------------------------------\n  end                                                           ' end of BOUNDS section\n  '********************************************************************************************************\n  \nend                                                          ' end going through the file (While loop)\n\n'----------------------------------------------\n' Cleanup s
ection\n'----------------------------------------------\n\ninFile.Close                                                 ' close the RAS GIS export file\n\n\n\n' Add the TIN to the View\n'------------------------\n'  theSrcName = SrcName.Make(sTerrainTinOut.AsString)\ntheSrcName = SrcName.Make(sTerrainTinOut)\ntheTinTheme = Theme.Make(theSrcName)\n\n' tag the TIN with \"terrainout\" tag\n'----------------------------------\nav.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theTinTheme,\"sName\",\"terrainout\"})    ' define the theme tag\n\n'
 add the TIN theme to the flood analysis view and make it visible\n'-----------------------------------------------------------------\noView.AddTheme(theTinTheme)\n' theTinTheme.SetVisible(true)              ' uncomment if you want to display TIN immediately\n\n' add the cross-section theme to the flood analysis view and make it visible\n'----------------------------------------------------------------------------\noView.AddTheme(theCSTheme)\ntheCSTheme.SetVisible(true)\n\n' add the bank, velocity, and levee themes t
o the flood analysis view, if they're present\n' ---------------------------------------------------------------------------------------\nif (NeedToShowBanksThemes) then\n    oView.AddTheme(theBankLineTheme)\nend\n\nif (theLeveeTheme <> NIL) then\n    oView.AddTheme( theLeveeTheme)\nend\n\n' add the 3D cross-section theme (if it exists) to the flood analysis view and make it visible\n'---------------------------------------------------------------------------------------------\nif (not bCreate3DCS) then\n  oView.AddThem
e(theCS3DTheme)\n  ' theCS3DTheme.SetVisible(true)              ' uncomment if you want to display 3D CS immediately\n  'theCS3DTheme.Invalidate(true)\nend\n\noView.Invalidate                                             ' display (refresh) the view\n\nif (AlertYou) then \n  MsgBox.Info(\"Extraction completed successfully\",strMessageTitle)\nend\n\nreturn true                                                   ' return from the script\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
)

(Script.261
	Name:	"RAS.PST.FloodDelineation"
	SourceCode:	"' Name: RAS.PST.FloodDelineation\n'********************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'********************************************************************\n' Name:        RAS.PST.FloodDelineation\n' Usage:       Called from the menu\n' Returns:     none.\n' Description: Setup parameters for building a floodplain \n'              polygon.  The building is done in\n'              
RAS.PST.BuildTinIntersect.\n' Called by:   None\n' Calling:     RAS.PST.BuildTinIntersect\n' Requires:    Framework.\n'\n' History:     DDJ; 3/27/98 - original coding\n'              DDJ; 2/99  - update to work with framework.\n'                         - selective processing of floodplain polys\n'                         - generation of flood depth points and grid\n'                           (if Spatial Analyst is present the points\n'                            will not be created).\n'******************************
**************************************\n\n'check to see if if the call is summary of singular\n' if it is the summary call, we don't want ot alert the\n'user until completion AlertYou=False\nif (self.is(list).Not) then\n  AlertYou = True\n  else \n  if (self.get(0) = \"NoAlert\") then\n    AlertYou = False\n  end\nend\n\n\n\n' Title for message box for these operations\nsTitle = \"RAS GIS Export: Floodplain Polygon Generation\"\n\n\n' Use the active view as the place to process\n'--------------------------------------------\noView 
= av.GetActiveDoc                                              'get the active view\nif (oView = nil) then\n  ' the view does not exist - give a message and bail out\n  tMessage = \"The view has not been selected!\"\n  tMessage = tMessage + nl + \"Select a view containing the TINs to intersect.\"\n  MsgBox.Warning (tMessage,sTitle)\n  return nil\nend\n\n\n' Check if the input parameters are set correctly in the View's tag dictionary\n'-----------------------------------------------------------------------------\nsCellSize 
= av.run(\"RAS.FRM.ViewTagMgr\", {\"GetValue\",oView,\"sCellSize\"})\nif (sCellSize = nil) Then\n  ' the file name has not been defined.  Provide a message and quit.\n  sMessage = \"The current View does not contain a valid reference to\"\n  sMessage = sMessage + nl + \"the rasterization cell size!\"\n  MsgBox.Warning (sMessage,sTitle)\n  return nil\nend\n\n'theThemes = oView.GetThemes.Clone                                'get the list of themes in the view\n                                                                  'cl
one to ensure consistency in the list\n\n' Test if the view contains the TIN theme\n'--------------------------------------------------\ntheTinThemeRet = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetONE\",oView,\"terrainout\"})   'return the terrain TIN theme\nif (theTinThemeRet=nil) then                                                 'check not OK return\n  ' the tag is not there - provide error message and quit\n  tMessage = \"The selected view does not contain a valid terrain theme!\"\n  tMessage = tMessage + nl + \"Define the te
rrain TIN from the Theme Setup ... menu.\"\n  MsgBox.Warning(tMessage, sTitle)\n  return nil    \nend\n\ntheTerrainTin = theTinThemeRet.GetSrcName.GetDataSource.AsString           ' identify the terrain tin theme\n\n\n' Create a list of WS TINs that need to be processed.  The logic is to create a list\n' of all the WS TINs and compare that to the list of all the floodplain polygons.  The\n' non-matching elements are put into the list to be processed.\n'-------------------------------------------------------------------
------------------\ntheTinList = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetByKey\",oView,\"sType\",\"wstin\"})\nif (theTINList = nil) then\n  ' no WS TINs are found.  Provide message and quit.\n  tMessage = \"No water surface TINs to process!\"\n  tMessage = tMessage + nl + \"Operation cancelled.\"\n  MsgBox.Warning(tMessage, sTitle)\n  return nil\nend\n'oTest = msgbox.listasstring(theTINList,\"List of WS TINs\",sTitle)\n\ntheFPList = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetByKey\",oView,\"sType\",\"floodplain\"})\n'oTest = msgbox.listasstring(theFPLis
t,\"List of flood polys\",sTitle)\n\nif (theFPList.Count = 0) then\n    ' no floodplain polygon themes are found.  Process all WS TINs.\n    'msgbox.info(\"All TINs should be processed\",\"sTitle\")\n    theProcList = theTINList.Clone\n  else\n    ' some floodplain polygons exist.  Build the processing list by cross-referencing.\n    theProcList = {}                                ' initiate the list\n    for each oWSTINTheme in theTINList              ' loop through all the WS TINs\n      ' get the WS TINs item value\n    
  sWSItemTag = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetValue\",oWSTINTheme,\"sField\"})\n      ' loop through the floodplain list to see if there is a match for it\n      nMatch = 0                                ' set match variable to 0\n      for each oFPTheme in theFPList\n        sFPItemTag = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetValue\",oFPTheme,\"sField\"})\n        if (sWSItemTag = sFPItemTag) then\n            ' there is a match - WS TIN has been processed.  Do not update the processing list\n            ' and exit the loop.
\n            nMatch = 0\n            break                          ' exit the loop through existing floodplain polys\n          else\n            ' WS TIN needs to be processed.  Add it to the processing list.\n            nMatch = 1\n        end\n      end                                  ' end of looping through floodplain themes\n\n      ' check to see if there was a match and add to the list if there was\n      if (nMatch = 1) then\n        theProcList.Add(oWSTINTheme)\n      end\n\n    end                         
           ' end of looping through WS TIN themes\nend                                        ' end of list generation\n\n' check to see if there is anything to process\n'---------------------------------------------\nif (theProcList.Count = 0) then\n  ' no WS TINs to process are found.  Provide message and quit.\n  tMessage = \"All water surface TINs have a matching floodplain polygon!\"\n  tMessage = tMessage + nl + \"No processing is required.\"\n  MsgBox.Warning(tMessage, sTitle)\n  return nil\nend\n\n'oTest = msgbox.li
st(theProcList,\"List of WS TINs to be processed\",sTitle)\n\n\n' Loop through all the themes in the processing list.\n'----------------------------------------------------\n\nfor each chkTheme in theProcList\n  ' perform the analysis\n  itemName = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetValue\",chkTheme,\"sField\"})     ' get the item name from the tag\n  theWSTin = chkTheme.GetSrcName.GetDataSource.AsString                     ' identify the water TIN\n  theIntsctName = \"fp\"+itemName+\".shp\"                                      
' set the name of the floodplain poly\n  thePointDName = \"pd\"+itemName+\".shp\"                                      ' set the name of the depth points\n  theGridDName = \"gd\"+itemName                                              ' set the name of the depth grid\n  theCellSize = sCellSize.AsNumber\n  myResult = av.run(\"RAS.PST.BuildTinIntersect\",{theTerrainTin,theWSTin,theIntsctName,theCellSize,thePointDName,theGridDName})\n\n  if (myResult=nil) then\n    ' floodplain not generated correctly - user terminated - this 
should not happen\n    MsgBox.Warning(\"The flood polygon determination terminated by the user!\",sTitle)\n    return false\n  end\n\n  if (myResult) then\n    ' the TIN intersection finished successfully - add the resulting themes to the view\n\n    ' add water depth points only if Spatial Analyst is not present\n    oSptExt = Extension.Find(\"Spatial Analyst\")\n    if (oSptExt=NIL)then\n      thePDSrcName = SrcName.Make(thePointDName)\n      thePDTheme = Theme.Make(thePDSrcName)\n      av.run(\"RAS.FRM.ThmTagMgr\",{\"SetVal
ue\",thePDTheme,\"sType\",\"dpthpoints\"})   ' define the theme tag\n      av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",thePDTheme,\"sField\",itemName})      ' define the elevation items tag\n      oView.AddTheme(thePDTheme)                                                 ' add the theme to the view\n'      thePDThemeSetVisible(true)                          ' by default do not display\n'      thePDTheme.Invalidate(true)                          ' by default do not display\n    end\n\n    ' add the water depth grid\n    theGDSr
cName = Grid.MakeSrcName(theGridDName)\n    theGDGrid = Grid.Make(theGDSrcName)\n    theGDTheme = GTheme.Make(theGDGrid)\n    av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theGDTheme,\"sType\",\"dpthgrid\"})     ' define the theme tag\n    av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theGDTheme,\"sField\",itemName})      ' define the elevation items tag\n    oView.AddTheme(theGDTheme)                                                 ' add the theme to the view\n'    theGDTheme.SetVisible(true)                          ' by default d
o not display\n'    theGDTheme.Invalidate(true)                          ' by default do not display\n\n    ' add the flood polygon\n    theSrcName = SrcName.Make(theIntsctName)\n    theFPTheme = Theme.Make(theSrcName)\n    av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theFPTheme,\"sType\",\"floodplain\"})   ' define the theme tag\n    av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theFPTheme,\"sField\",itemName})      ' define the elevation items tag\n    oView.AddTheme(theFPTheme)                                                 ' add
 the tin to the view\n    'theFPTheme.SetVisible(true)\n    'theFPTheme.Invalidate(true)\n\n  else\n    ' floodplain not generated correctly\n    MsgBox.Warning(\"The flood polygon determination terminated by the user!\",sTitle)\n    return false\n  end\nend\n\n\noView.Invalidate                                             ' display (refresh) the view\n   \nif (AlertYou) then\nMsgBox.Info(\"Delineating floodplain polygons is completed\",sTitle)\nend\n\nreturn true\n\n"
)

(Script.262
	Name:	"RAS.PST.OutputAll"
	SourceCode:	"' Name: RAS.PST.OutputAll\n'**************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'**************************************************************\n' Name:        RAS.PST.OutputAll\n' Usage:       From the button\n' Returns:     none\n' Description: Perform the full RAS postprocessing.\n'              It basically sequences the four\n'              individual operations defined through\n'  
            the menu entries.\n'              Steps:  Fill in the main menu\n'                      Create cross-section file\n'                      Create water surface TINs\n'                      Intersect the TINs to get the floodplain\n'\n' History:     DDJ; 4/14/98\n'              CTA; 12.7.99 add velocity porcessing\n'**************************************************************\n\nmyResult = av.run(\"RAS.PST.OutputDialogShow\",{})\n\nmyResult = av.run(\"RAS.PST.CSGeneration\",{\"NoAlert\"})\nif (myResult = nil) then
\n  myResult = False\nend\nif ((myResult).Not) then \n    sTitle = \"RAS GIS Export File processing\"\n    MsgBox.Info(\"Error Importing Results Data\",sTitle)\n    exit\nend\n\nmyResult = av.run(\"RAS.PST.WSTINGeneration\",{\"NoAlert\"})\nif (myResult = nil) then\n  myResult = False\nend\nif ((myResult).Not) then \n    sTitle = \"RAS GIS Export File processing\"\n    MsgBox.Info(\"Error generating Water Surface TIN(s)\",sTitle)\n    exit\nend\n\nmyResult = av.run(\"RAS.PST.FloodDelineation\",{\"NoAlert\"})\nif (myResult = nil) then\n  myResul
t = False\nend\nif ((myResult).Not) then \n    sTitle = \"RAS GIS Export File processing\"\n    MsgBox.Info(\"Error Delineating Floodplain\",sTitle)\n    exit\nend\n\nmyResult = av.run(\"RAS.PST.VelTINGeneration\",{\"NoAlert\"})\nif (myResult = nil) then\n  myResult = False\nend\nif ((myResult).Not) then \n    sTitle = \"RAS GIS Export File processing\"\n    MsgBox.Info(\"Error creating Velocity TIN(s)\",sTitle)\n    exit\nend\n\nmyResult = av.run(\"RAS.PST.VelGridGeneration\",{\"NoAlert\"})\nif (myResult = nil) then\n  myResult = False\nend\ni
f ((myResult).Not) then \n    sTitle = \"RAS GIS Export File processing\"\n    MsgBox.Info(\"Error creating Velocity Grid(s)\",sTitle)\n    exit\nend\n\nsTitle = \"RAS GIS Export File Processing\"\nMsgBox.Info(\"RAS post-processing succesfully completed\", sTitle)\n\nreturn nil\n"
)

(Script.263
	Name:	"RAS.PST.OutputDialogCancel"
	SourceCode:	"' Name: RAS.PST.OutputDialogCancel\n'**********************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'**********************************************************************\n' Name:         RAS.PST.OutputDialogCancel\n' Usage:        Called from the button on the RASOut dialog desg. menu\n' Returns:      none\n' Description:  Act on Cancel button in the RAS Output Theme Form.\n' History:  
    DDJ; 3/18/98 - original coding\n'               DDJ; 3/99    - change in name and header.\n'                            - remove dependency on global variables.\n'**********************************************************************\n\n' set the return value to NIL and close the dialog.\n\nself.GetDialog.SetModalResult(NIL)\nav.FindDialog(\"RASOut\").Close\n\n"
)

(Script.264
	Name:	"RAS.PST.OutputDialogOK"
	SourceCode:	"' Name: RAS.PST.OutputDialogOK\n'***************************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'***************************************************************************\n' Name:         RAS.PST.OutputDialogOK\n' Usage:        Called from the button on the RASOut dialog desg. menu\n' Returns:      none\n' Description:  Act on OK button in the RAS Output Theme Form.\n' History:    
  DDJ; 3/20/98 - original coding\n'               DDJ; 8/3/98 - saving all results in the user specified directory\n'                             (AVRas 1.1)\n'               DDJ; 8/6/98 - checking whether the project exists before setting\n'                             up the post-processor directory.\n'               DDJ; 3/99    - change in name and header.\n'                            - replacement of use of global variables with \n'                              dictionary attached to the view.\n'*************
**************************************************************\n\n'oView = av.GetActiveDoc                                 ' get view handler\noDisplay = av.GetActiveDoc.GetDisplay                    ' get display handler\noProject = av.GetProject                                 ' get project handler\n\nstrErrorTitle = \"RAS Postprocessor File Definition\"      ' set the warning message title\n\n                                                         \n' check if import file name is OK\n'------------------------------
------------------------------------\nsImportFileName = av.FindDialog(\"RASOut\").FindByName(\"txtFileIn\").GetText\n\n' Check if the import file actually exists.  If it does not, provide\n' an error message and do not exit the dialog.  \nif (sImportFileName = \"\") Then\n    ' nothing set - complain and return to the form\n    MsgBox.Warning (\"You have to specify the RAS GIS export file!\",strErrorTitle)\n    return nil\n  else\n    ' test if the file is valid\n    inFile = FileName.Make(sImportFileName)\n    if (File.Exists
(inFile).Not) Then\n        MsgBox.Warning (\"The entered file name is not valid !\"+nl+\"Select a valid RAS GIS export file!\",strErrorTitle)\n        return nil\n    end    \nend\n\n\n' check if rasterization cell size is correct\n'-------------------------------------------------------------------\nsCellSize = av.FindDialog(\"RASOut\").FindByName(\"txtCellSize\").GetText\n\n' Check if the variable is a number.  If it is not, provide\n' an error message and do not exit the dialog.  \nif (sCellSize = \"\") Then\n    ' nothing set
 - complain and return to the form\n    MsgBox.Warning (\"You have to specify the cell size!\",strErrorTitle)\n    return nil\n  else\n    ' test if the cell size is valid\n    if (sCellSize.IsNumber.Not) Then\n        MsgBox.Warning (\"The entered cell size is not valid !\"+nl+\"Select a number!\",strErrorTitle)\n        return nil\n    end    \nend\n\n\n' check if terrain name is correct\n'-------------------------------------------------------------\nsTerrainTinOut = av.FindDialog(\"RASOut\").FindByName(\"txtTinIn\").GetText\n\n'
 Check if the TIN file actually exists.  If it does not, provide\n' an error message and do not exit the dialog.  \nif (sTerrainTinOut = \"\") Then\n    ' nothing set - complain and return to the form\n    MsgBox.Warning (\"You have to specify the terrain TIN!\",strErrorTitle)\n    return nil\n  else\n    ' test if the TIN is valid\n    if (TIN.Exists(sTerrainTinOut.AsFilename).Not) Then\n        MsgBox.Warning (\"The entered TIN name is not valid !\"+nl+\"Select a valid terrain TIN!\",strErrorTitle)\n        return nil\n    
end    \nend\n\n\n' set the View tag with directory name\n' (this directory will be created from the project directory)\n'-----------------------------------------------------------------\nsResultDirectory = av.FindDialog(\"RASOut\").FindByName(\"txtOutDir\").GetText\n\n' identify the project directory path\n' first check if the project is defined\nif (av.GetProject.GetFileName = Nil) then\n  MsgBox.Info(\"A project is not defined.  Save the project and repeate the operation\",strErrorTitle)\n  av.FindDialog(\"RASOut\").Close\n 
 return nil\nend\n  \noResDirectory = av.GetProject.GetFileName.ReturnDir              ' get current project directory\noResDirectory.MergePath(sResultDirectory)                     ' attach the result subdirectory path\n\n' Check if the result directory already exists.  If it does, provide\n' an error message and do not exit the dialog.  Otherwise create the\n' directory and set it to be the current working directory.\nif (sResultDirectory = \"\") Then\n    ' nothing set - complain and quit the macro\n    MsgBox.Warnin
g (\"You have to specify the result directory!\",strErrorTitle)\n    return nil\n  else\n    'check if the directory already exists\n    if (oResDirectory.IsDir) Then                         ' test if it already exists\n        MsgBox.Warning (oResDirectory.asstring++\"The entered subdirectory already exists !\"+nl+\"Select a new directory name to contain the RAS results!\",strErrorTitle)\n        return nil\n      else\n        ' create a new directory by generating the createDir.bat file on the fly and executing it\n   
     projDirectory = av.GetProject.GetFileName.ReturnDir             ' get project file directory\n        projDirectory.SetCWD                                            ' define it as a current work directory\n        cmdFileName = \"createDir.bat\".AsFileName                        'create name\n        cmdFile = LineFile.Make(cmdFileName,#FILE_PERM_WRITE)           'crate a file\n        cmdFile.WriteElt(\"mkdir \"+oResDirectory.AsString)             'write the command to be executed\n        cmdFile.Close      
                                             'close the file\n        system.executeSynchronous(\"createDir.bat\")                      'run the system execute to run the batch file\n        File.Delete(cmdFileName)                                        'delete the file\n        oResDirectory.SetCWD                                          'set the current directory to the new directory\n        MsgBox.Info(\"The results from the RAS analysis will be stored in directory:\"+nl+oResDirectory.AsString,strErrorTitle)\n
    end  \nend\n\n\n' Create a new view to contain the floodplain analysis themes\n' Tag it with the necessary information.\n'------------------------------------------------------------\noView = View.Make                                      ' create a new View\noView.SetName(sResultDirectory)                        ' define view's name to be the same as the directory\n\nav.run(\"RAS.FRM.ViewTagMgr\", {\"SetValue\",oView,\"sType\",\"RAS Output\"})\nav.run(\"RAS.FRM.ViewTagMgr\", {\"SetValue\",oView,\"sImportFileName\",sImportFileN
ame})\nav.run(\"RAS.FRM.ViewTagMgr\", {\"SetValue\",oView,\"sCellSize\",sCellSize})\nav.run(\"RAS.FRM.ViewTagMgr\", {\"SetValue\",oView,\"sTerrainTinOut\",sTerrainTinOut})\nav.run(\"RAS.FRM.ViewTagMgr\", {\"SetValue\",oView,\"sResultDirectory\",sResultDirectory})\n\n\n' Define the return object and close the dialog\nself.GetDialog.SetModalResult(sResultDirectory)\nav.FindDialog(\"RASOut\").Close\n\n\nreturn true\n\n"
)

(Script.265
	Name:	"RAS.PST.OutputDialogShow"
	SourceCode:	"' Name: RAS.PST.OutputDialogShow\n'******************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'******************************************************************\n' Name:         RAS.PST.OutputDialogShow\n' Usage:        Called from the menu\n' Returns:      none\n' Description:  Display the RAS Output Theme Form.  Once the form\n'               is closed, build the View if all the data w
ere\n'               provided.\n' History:      DDJ; 3/18/98 - Original coding\n'               DDJ; 2/99    - Change name and header\n'                            - Functionality for building the View.\n'******************************************************************\n\n' Identify the dialog and open it.  The returned value (sName) is\n' the name of the created View (if all the data were correctly provided)\n' or nil (if cancelled form the dialog)\nsName = av.FindDialog(\"RASOut\").Open\n\nif (sName<>NIL)then\n  ' a n
ew View has been created.  Display it.\n  oView = av.GetProject.FindDoc(sName)\n  if (oView<>NIL) then oView.GetWin.Open end\nend\n\nreturn nil\n\n"
)

(Script.266
	Name:	"RAS.PST.OutputSelFile"
	SourceCode:	"' Name: RAS.PST.OutputSelFile\n'*********************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'*********************************************************************\n' Name:         RAS.PST.OutputSelFile\n' Usage:        Called from the button on the RASOut dialog desg. menu\n' Returns:      none\n' Description:  Act on SELECT FILE button in the RAS Output Form.\n'               Fill the 
textbox in the dialog with the file name. \n' History:      DDJ; 3/20/98 - original coding\n'               DDJ; 3/99    - change in name and header\n'*********************************************************************\n\ntheFile = FileDialog.Show(\"*\", \"Text File\", \"Select HEC-RAS GIS export file\")\nif (theFile = nil) then\n  return nil\nend\n\n' the next line will return only the file name without the path\n'av.FindDialog(\"RASOut\").FindByName(\"txtFileIn\").SetText(theFile.GetBaseName)\n\n' disply the full file name in
 the text box\nav.FindDialog(\"RASOut\").FindByName(\"txtFileIn\").SetText(theFile.AsString)\n\n\n"
)

(Script.267
	Name:	"RAS.PST.OutputSelTin"
	SourceCode:	"' Name: RAS.PST.OutputSelTin\n'***********************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'***********************************************************************\n' Name:         RAS.PST.OutputSelTin\n' Usage:        Called from the button on the RASOut dialog desg. menu\n' Returns:      none\n' Description:  Act on SELECT TIN button in the RAS Output Form.\n'               Fill the
 textbox in the dialog with the Tin name. \n' History:      DDJ; 3/31/98 - original coding\n'               DDJ; 3/99    - change in name and header\n'***********************************************************************\n\n'theTinList = SourceDialog.ShowClass(\"Select TIN for terrain representation\", FSrc)\n'if (theTinList.Count = 0) then\n ' return nil\n'end\n\n'Dialog to get TIN - TIN Source as default     CTA 10/4/00\ntheTin = sourcemanager.getdataset(TinSrc, \"Select TIN for terrain representation\")\nif (theTin = 
nil) then\n  return nil\nend\n\n' find the full path to the selected Tin\n'theTin = theTinList.Get(0)\n'theTinName = theTin.GetFileName.GetFullName\ntheTinName =theTin\n\n' disply the Tin in the dialog\nav.FindDialog(\"RASOut\").FindByName(\"txtTinIn\").SetText(theTinName.AsString)\n\n\nreturn nil\n"
)

(Script.268
	Name:	"RAS.PST.VelGridGeneration"
	SourceCode:	"' Name: RAS.PST.VelGridGeneration\n'*******************************************************************************************\n'              (c) Copyright, 1999\n'         David Ford Consulting Engineers.\n'              All Rights Reserved\n'*******************************************************************************************\n' Name:        RAS.PST.VelPointGeneration\n' Usage:       Called from the menu\n' Returns:     none\n' Description: Builds a velocity grid from the velocity TIN\n' Called by:   None.\n
' Calling:     \n' Requires:    Framework.\n' History:     DM3 7/26/99; Copied RAS.WSTINGeneration as foundation for this script\n'              DM3 12/6/99; The velocity grid is now masked by its floodplain \n'*******************************************************************************************  \n\n\n'check to see if if the call is summary of singular\n' if it is the summary call, we don't want ot alert the\n'user until completion AlertYou=False\nif (self.is(list).Not) then\n  AlertYou = True\n  else \n  if (sel
f.get(0) = \"NoAlert\") then\n    AlertYou = False\n  end\nend\n\n\n\n' Title for message box for these operations\nsTitle = \"RAS GIS Export: Velocity Grid Generation\"\n\n\n' Use the active view as the place to process\n'--------------------------------------------\noView = av.GetActiveDoc                                              'get the active view\nif (oView = nil) then\n  ' the view does not exist - give a message and bail out\n  tMessage = \"The view has not been selected!\"\n  tMessage = tMessage + nl + \"Select a view
 containing the generated RAS cross-sections.\"\n  MsgBox.Warning (tMessage,sTitle)\n  return nil\nend\n\n\n' Verify that they set the result directory\n' -----------------------------------------\nsResultDirectory = av.run(\"RAS.FRM.ViewTagMgr\", {\"GetValue\",oView,\"sResultDirectory\"})\nif (sResultDirectory = nil) Then\n  ' the result directory has not been defined.  Provide a message and quit.\n  sMessage = \"The current View does not contain a valid reference to\"\n  sMessage = sMessage + nl + \"the result directory!\"\n  Ms
gBox.Warning (sMessage,sTitle)\n  return nil\nend\n\n\n' Check if the input parameters are set correctly in the View's tag dictionary\n'-----------------------------------------------------------------------------\nsCellSize = av.run(\"RAS.FRM.ViewTagMgr\", {\"GetValue\",oView,\"sCellSize\"})\nif (sCellSize = nil) Then\n  ' the cell size has not been defined.  Provide a message and quit.\n  sMessage = \"The current View does not contain a valid reference to\"\n  sMessage = sMessage + nl + \"the rasterization cell size!\"\n  MsgB
ox.Warning (sMessage,sTitle)\n  return nil\nend\nnCellSize = sCellSize.AsNumber\n\n\n' Make a Dictionary of all velocity TIN, keyed by profile name\n'-------------------------------------------------------------\ndictVelTin = Dictionary.Make( 10) \ntheTINList = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetByKey\",oView,\"sType\",\"veltin\"})\nfor each t in theTinList\n  sProfileName = av.run(\"RAS.FRM.ThmTagMgr\", {\"GetValue\",t,\"sField\"}) ' get its object tag\n  if (sProfileName <> NIL) then\n    dictVelTin.Add( sProfileName, t)\n  end\nend\n
\nif (dictVelTin.Count = 0) then\n  ' no TINs found\n  tMessage = \"Must generate velocity TINs first!\"\n  MsgBox.Error( tMessage, sTitle)\n  return nil\nend\n\n\n' Generate the list of potential Vel Grids to generate.\n' Remove existing Vel Grids from the dictVelTin\n'------------------------------------------------------\ntheGridList = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetByKey\",oView,\"sType\",\"velgrid\"})\nfor each t in theGridList\n    sItemTag = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetValue\",t,\"sField\"})\n    dictVelTin.Remove( sIte
mTag)\nend\n\n' See if there is anything to do\nif (dictVelTin.Count = 0) then\n  tMessage = \"All profile TIN have a matching velocity Grid!\"\n  tMessage = tMessage + nl + \"No processing is required.\"\n  MsgBox.Warning(tMessage, sTitle)\n  return nil\nend\n   \n\n' Make a Dictionary of flood plain themes, indexed by profile name\n' ----------------------------------------------------------------\nlThemes = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetByKey\",oView,\"sType\",\"floodplain\"})\ndictFPThemes = Dictionary.Make( lThemes.Count)\nf
or each t in lThemes\n    sItemTag = av.run( \"RAS.FRM.ThmTagMgr\",{\"GetValue\",t,\"sField\"})\n    dictFPThemes.Add( sItemTag, t)\nend\n\n\n' Loop through the available velocity profiles\n'--------------------------------------------- \nfor each itemName in dictVelTin.ReturnKeys\n\n    ' Mask out all cells outside of the floodplain\n    theFPtheme = dictFPThemes.Get( itemName)\n    if (theFPtheme = nil) then\n        tMessage = \"Missing floodplain for profile\" ++ itemName ++\"!\"\n        tMessage = tMessage + nl + \"Skipping t
his profile.\"\n        MsgBox.Warning(tMessage, sTitle)\n    end\n    \n    ' Make the velocity point grid, masked by the floodplain\n    ' Two ways to do this -- will use spatial analyst if available because it's faster\n    anSTheme = dictVelTin.Get( itemName)\n    if (Extension.Find( \"Spatial Analyst\") <> nil) then\n'************VatBuild and Error REading STA *******************\n        theMaskGrid = Grid.MakeFromFTab( theFPtheme.GetFTab, oView.GetProjection, nil, {nCellSize, theFPTheme.ReturnExtent})\n'*********
**\n        theGrid = anSTheme.GetSurface.AsGrid( nCellSize, theFPTheme.ReturnExtent) * theMaskGrid\n    else\n        tempFileName = FileName.GetTmpDir.MakeTmp( \"vgp\",\"shp\")\n        thePoints = anSTheme.GetSurface.AsGrid( nCellSize, theFPTheme.ReturnExtent)\n                           .AsPointFTab( tempFileName, prj.MakeNull)\n        thePoints.SelectByFTab( theFPTheme.GetFTab, #FTAB_RELTYPE_INTERSECTS, 0, #VTAB_SELTYPE_NEW)\n        theGrid = Grid.MakeFromFTab( thePoints, prj.MakeNull,  thePoints.FindField( \"Gr
id_code\"), {nCellSize, theFPTheme.ReturnExtent})\n    end\n\n    ' Save the grid\n    theVelGridName = (\"Vgd\" + itemName).AsFileName\n    if (theGrid.SaveDataSet( theVelGridName)) then\n        ' the Vel Grid generation finished successfully - add the Grid to the view\n        theGridTheme = GTheme.Make(theGrid)\n        ' tag the Vel Grid with \"velgrid\" tag and the item that was generated by\n        av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theGridTheme,\"sName\",NIL})         ' define the name tag\n        av.run(\"RAS.
FRM.ThmTagMgr\",{\"SetValue\",theGridTheme,\"sType\",\"velgrid\"})    ' define the theme tag\n        av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theGridTheme,\"sField\",itemName})   ' define the profile tag\n        oView.AddTheme(theGridTheme)                      ' add the Grid to the view\n        theGridTheme.Invalidate(true)                     ' force redraw/update\n    else\n        tMessage = \"Problem saving grid\" ++ theVelGridName.AsString ++\"!\"\n        tMessage = tMessage + nl + \"Skipping this profile.\"\n        Msg
Box.Warning(tMessage, sTitle)\n    end\n\nend                            ' end of looping through the list of selected items\n\n\noView.Invalidate                                             ' display (refresh) the view\n\nif (AlertYou) then\n  MsgBox.Info(\"Velocity Grid completed successfully\",sTitle)\nend\n\nreturn true\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
)

(Script.269
	Name:	"RAS.PST.VelPointGenerationOLD"
	SourceCode:	"' Name: RAS.PST.VelPointGeneration\n'*******************************************************************************************\n'              (c) Copyright, 1999\n'         David Ford Consulting Engineers.\n'              All Rights Reserved\n'*******************************************************************************************\n' Name:        RAS.PST.VelPointGeneration\n' Usage:       Called from the menu\n' Returns:     none\n' Description: Builds a velocity grid from the velocity TIN\n' Called by:   None.
\n' Calling:     \n' Requires:    Framework.\n' History:     DM3 7/26/99; Copied RAS.WSTINGeneration as foundation for this script\n'\n'*******************************************************************************************  \n\n' Title for message box for these operations\nsTitle = \"RAS GIS Export: Velocity grid Generation\"\nbVerify=false                                                 ' to force display of theme selection dialog\n\n\n' Use the active view as the place to process\n'---------------------------------
-----------\noView = av.GetActiveDoc                                              'get the active view\nif (oView = nil) then\n  ' the view does not exist - give a message and bail out\n  tMessage = \"The view has not been selected!\"\n  tMessage = tMessage + nl + \"Select a view containing the generated RAS cross-sections.\"\n  MsgBox.Warning (tMessage,sTitle)\n  return nil\nend\n\n\nsResultDirectory = av.run(\"RAS.FRM.ViewTagMgr\", {\"GetValue\",oView,\"sResultDirectory\"})\nif (sResultDirectory = nil) Then\n  ' the result dire
ctory has not been defined.  Provide a message and quit.\n  sMessage = \"The current View does not contain a valid reference to\"\n  sMessage = sMessage + nl + \"the result directory!\"\n  MsgBox.Warning (sMessage,sTitle)\n  return nil\nend\n\n\n'---------------------------------------------------------------------\n' Setup of required lists for use with the framework\n'---------------------------------------------------------------------\n\n' Provide the lists of Tags, ThmTypes, and ShpTypes.\nlTags={\"crossras\"}           
                        'Tags\nlThmTypes={FTheme}                                   'ThmTypes\nlShpTypes={\"PolyLine\"}                               'ShpTypes POLYGON,POLYLINE,POINT,MultiPoint.\n\n' Create the Field descriptions of the required fields.\n' Needs to be there even if none are used.\nldFields={nil}\n\n' Define the default names.\nlDefNames={\"CSect\"}            'Default names\n\n' Define the theme purpose type (input/output)\nlPurposes={\"I\"}\n\n' Overwrite options when the specified thm exists in the view, lOv
erWrt guides the operation.\n'For GTheme, 0=OverWrite,1,2=Prompt for a new name because overwrite is not an option.\n'For FTheme, 0=Clear, 1=Ask For a new Name, 2=Append.\n'lOverWrts is extented to be used for InputThms (used as the output Thm) as well.\n'if 0 then don't ask for a backup, overwrite the input theme with the output theme.\n'if 1 then ask if a backup should be made.\nlOverWrts={0,0}\n\n  \n' Use the framework to check on the themes and items\n'---------------------------------------------------\ndThms=av
.run(\"RAS.FRM.GetThmsByTagR\",{oView,lTags,lThmTypes,lShpTypes,ldFields,lDefNames,lPurposes,lOverWrts,bVerify,sTitle})\n\nif(dThms.is(Dictionary))then\n\n  '--------------------------------------------------------------------\n  ' Successfully returned the required themes, so we can do the work\n  '--------------------------------------------------------------------\n\n\n\n  ' Check for existence of  velocity TINs\n  '--------------------------------------\n  theTagCollection = {}\n\n  theTINList = av.run(\"RAS.FRM.ThmTagM
gr\",{\"GetByKey\",oView,\"sType\",\"veltin\"})\n  for each t in theTinList\n    theTag = av.run(\"RAS.FRM.ThmTagMgr\", {\"GetValue\",t,\"sField\"}) ' get its object tag\n    if (theTag <> NIL) then\n      theTagCollection.Add( theTag)\n    end\n  end\n\n  if (theTagCollection.Count = 0) then\n    ' no TINs found\n    tMessage = \"Must generate velocity TINs first!\"\n    MsgBox.Error( tMessage, sTitle)\n    return nil\n  end\n\n\n  '**             Velocity grid Generation starts here           **\n\n  ' Check if the input parameters are s
et correctly in the View's tag dictionary\n  '-----------------------------------------------------------------------------\n  sCellSize = av.run(\"RAS.FRM.ViewTagMgr\", {\"GetValue\",oView,\"sCellSize\"})\n  if (sCellSize = nil) Then\n    ' the cell size has not been defined.  Provide a message and quit.\n    sMessage = \"The current View does not contain a valid reference to\"\n    sMessage = sMessage + nl + \"the rasterization cell size!\"\n    MsgBox.Warning (sMessage,sTitle)\n    return nil\n  end\n  nCellSize = sCellSize
.AsNumber\n  \n\n  ' Generate the list of potential Vel Grids to generate, by cross-sreferencing any\n  ' existing Vel Grids to the list in theTagCollection\n  '------------------------------------------------------------------------------\n  theGridList = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetByKey\",oView,\"sType\",\"velgrid\"})\n  if (theGridList = nil) then\n      ' no Vel Grid are found.  Offer all the items.\n      lOfferItems = theTagCollection.Clone\n    else\n      ' there is at least one existing Vel Grid.  Build the l
ist to offer.\n      lOfferItems = theTagCollection.Clone            ' initial list\n      ' loop through Vel TIN list and get its sField - remove that from\n      ' the offered list.\n      for each oTheme in theGridList\n        sItemTag = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetValue\",oTheme,\"sField\"})\n        nListOrder = theTagCollection.FindByValue(sItemTag)\n        if (nListOrder <> -1) then\n          ' the Vel Grid field is in the existing list - remove it.\n          nListRemove = lOfferItems.FindByValue(sItemTa
g)\n          lOfferItems.Remove(nListRemove)\n        end\n      end                          ' end of looping through Vel Grids\n  end\n\n  ' See if there is anything to do\n  if (lOfferItems.Count = 0) then\n    tMessage = \"All profile TIN have a matching velocity Grid!\"\n    tMessage = tMessage + nl + \"No processing is required.\"\n    MsgBox.Warning(tMessage, sTitle)\n    return nil\n  end\n     \n  \n  ' Ask the user to select the items to be used for extraction,\n  ' check for valid input and get the number of select
ed items.\n  '------------------------------------------------------------\n  tMessage = \"Select velocity profiles for which to generate the velocity Grid\"\n  lSelList = MsgBox.MultiListAsString(lOfferItems,tMessage,sTitle)\n  if (lSelList = nil) then\n    ' cancelled from the selection process\n    return nil\n  end\n  if (lSelList.Count < 1) then\n    ' the tag does not contain item information - provide error message and quit\n    tMessage = \"No velocity profiles were selected!\"\n    tMessage = tMessage + nl + \" Op
eration cancelled.\"\n    MsgBox.Warning(tMessage, sTitle)\n    return nil\n  end\n  \n  \n  ' Loop through the item tags and perform the analysis for valid item names\n  '------------------------------------------------------------------------- \n  for each itemName in lSelList\n  \n    for each anSTheme in theTINlist\n\n      sItemTag = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetValue\",anSTheme,\"sField\"})\n      if (sItemTag = itemName) then\n  \n        ' First, make the Grid\n        ' --------------------\n        theVelGridName =
 (sResultDirectory+\"/Vgd\" + itemName).AsFileName\n  \n        theGrid = anSTheme.GetSurface.AsGrid( nCellSize, anSTheme.ReturnExtent)\n        myResult = theGrid.SaveDataSet( theVelGridName)\n        \n        if (myResult) then\n          ' the Vel Grid generation finished successfully - add the Grid to the view\n          theGridTheme = GTheme.Make(theGrid)\n          ' tag the Vel Grid with \"velgrid\" tag and the item that was generated by\n          av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theGridTheme,\"sName\",NIL}
)         ' define the name tag\n          av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theGridTheme,\"sType\",\"velgrid\"})    ' define the theme tag\n          av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theGridTheme,\"sField\",itemName})   ' define the profile tag\n          oView.AddTheme(theGridTheme)                      ' add the Grid to the view\n          'theGridTheme.SetVisible(true)                     ' ...and visible\n          theGridTheme.Invalidate(true)                     ' force redraw/update of screen\n      
  end\n        \n        ' Next, make the Point FTab\n        ' -------------------------\n        \n        ' ************** COMMENTED OUT PART BEGINS HERE! ***************************\n        ' ** myResult = MsgBox.YesNo( \"Create an array of points that match the velocity grid?\",\n        ' **               sTitle, TRUE)\n        ' ** if (myResult) then\n        ' ** \n        ' **   av.ShowMsg( \"Generating Point theme\")\n        ' **   fnPoints = (\"pv\" + itemName).AsFileName\n        ' **   ftPoints = FTab.MakeNew(
 fnPoints, PointZ)  ' create the FTab\n        ' **   ftPoints.AddFields( {Field.Make( \"ID\", #FIELD_SHORT, 5, 0)})\n        ' **   \n        ' **   ' Go through every point and get the value there\n        ' **   aRect = anSTheme.ReturnExtent.InsetBy( nCellSize/2)     ' Rectangle covering the range\n        ' **   \n        ' **   ' Set up the number of points for the progress indicator\n        ' **   nTotal = aRect.GetWidth / nCellSize * aRect.GetHeight / nCellSize\n        ' **   nProgress = 0\n        ' **   av.
ShowStopButton              ' permit the user to cancel the point generation\n        ' **   \n        ' **   ' Step through the entire TIN, grabbing \"elevations\" at each point\n        ' **   ' ----------------------------------------------------------------\n        ' **   for each y in (aRect.GetBottom)..(aRect.GetTop) by nCellSize\n        ' **     for each x in (aRect.GetLeft)..(aRect.GetRight) by nCellSize\n        ' **       nProgress = nProgress + 1                           ' Update the progress bar\n    
    ' **       blnContinue = av.SetStatus( nProgress/nTotal * 100)\n        ' **       \n        ' **       if (blnContinue.Not) then\n        ' **         ftPoints.SetEditable( FALSE)\n        ' **         return nil\n        ' **       end\n        ' ** \n        ' **       z = anSTheme.GetSurface.Elevation( x@y)\n        ' **       if (z.IsNull.Not) then\n        ' **         newRec = ftPoints.AddRecord\n        ' **         ftPoints.SetValue( ftPoints.FindField( \"shape\"), newRec, x@y@z)\n        ' **       end\n   
     ' **     end\n        ' **   end\n        ' **   ftPoints.Flush\n        ' **   ftPoints.SetEditable( FALSE)\n          \n        ' **   ' Add the point theme to the view, and tag it\n        ' **   '--------------------------------------------\n        ' **   thePointTheme = FTheme.Make( ftPoints)\n        ' **   av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",thePointTheme,\"sName\",NIL})         ' define the name tag\n        ' **   av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",thePointTheme,\"sType\",\"velpoints\"})    ' define 
the theme tag\n        ' **   av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",thePointTheme,\"sField\",itemName})   ' define the profile tag\n        ' **   oView.AddTheme( thePointTheme)\n        ' ** end                      ' end of point theme creation\n        ' **************** END OF COMMENTED OUT PART **************************************\n\n      end\n    end\n  end                            ' end of looping through the list of selected items\n  \n  oView.Invalidate                                             ' displ
ay (refresh) the view\n  MsgBox.Info(\"Velocity Grid completed successfully\",sTitle)\n\nelse\n\n  ' Problem in returning from checking the themes\n    sText = \"Problem with input themes.  Operation cancelled\"\n    MsgBox.Warning(sText,sTitle)\n    return false\n    \nend\n\nreturn true\n\n\n\n\n\n\n\n\n\n"
)

(Script.270
	Name:	"RAS.PST.VelTINGeneration"
	SourceCode:	"' Name: RAS.PST.VelTINGeneration\n'*******************************************************************************************\n'              (c) Copyright, 1999\n'         David Ford Consulting Engineers.\n'              All Rights Reserved\n'*******************************************************************************************\n' Name:        RAS.PST.VelTINGeneration\n' Usage:       Called from the menu\n' Returns:     none\n' Description: Setup parameters for building a velocity tin. The building is done in
\n'              RAS.PST.BuildVelTin.  Using framework.\n' Called by:   None.\n' Calling:     RAS.PST.buildVelTin.\n' Requires:    Framework.\n' History:     DM3 7/23/99; Copied RAS.WSTINGeneration as foundation for this script\n'              DM3 11/23/99; Improved checking for all required themes before proceeding\n'\n'*******************************************************************************************  \n\n'check to see if if the call is summary of singular\n' if it is the summary call, we don't want ot aler
t the\n'user until completion AlertYou=False\nif (self.is(list).Not) then\n  AlertYou = True\n  else \n  if (self.get(0) = \"NoAlert\") then\n    AlertYou = False\n  end\nend\n\n\n\n' Title for message box for these operations\nsTitle = \"RAS GIS Export: Velocity TIN Generation\"\ntSkipMessage = \"Velocity TIN generation skipped.\"\nbVerify=false                                  ' to force display of theme selection dialog\n\n\n' Use the active view as the place to process\n'--------------------------------------------\noView = av.G
etActiveDoc                                              'get the active view\nif (oView = nil) then\n    ' the view does not exist - give a message and bail out\n    tMessage = \"The view has not been selected!\"\n    tMessage = tMessage + nl + \"Select a view containing the generated RAS cross-sections.\"\n    MsgBox.Warning (tMessage,sTitle)\n    return nil\nend\n\n\n'---------------------------------------------------------------------\n' Setup of required lists for use with the framework\n'----------------------------
-----------------------------------------\n\n' Provide the lists of Tags, ThmTypes, and ShpTypes.\nlTags={\"crossras\",\"VelBanks\"}                         'Tags\nlThmTypes={FTheme,FTheme}                                  'ThmTypes\nlShpTypes={\"PolyLine\",\"PolyLine\"}                        'ShpTypes POLYGON,POLYLINE,POINT,MultiPoint.\n\n' Create the Field descriptions of the required fields.\n' Needs to be there even if none are used.\nldFields={nil,nil}\n\n' Define the default names.\nlDefNames={\"CSect\",\"Banks\"}          
  'Default names\n\n' Define the theme purpose type (input/output)\nlPurposes={\"I\",\"I\"}\n\n' Overwrite options when the specified thm exists in the view, lOverWrt guides the operation.\n'For GTheme, 0=OverWrite,1,2=Prompt for a new name because overwrite is not an option.\n'For FTheme, 0=Clear, 1=Ask For a new Name, 2=Append.\n'lOverWrts is extented to be used for InputThms (used as the output Thm) as well.\n'if 0 then don't ask for a backup, overwrite the input theme with the output theme.\n'if 1 then ask if a backu
p should be made.\nlOverWrts={0,0}\n  \n' Use the framework to check on the themes and items\n'---------------------------------------------------\ndThms=av.run(\"RAS.FRM.GetThmsByTagR\",{oView,lTags,lThmTypes,lShpTypes,ldFields,lDefNames,lPurposes,lOverWrts,bVerify,sTitle})\n\nif (dThms.is(Dictionary).Not) then\n    ' Problem in returning from checking the themes\n    sText = \"Problem with input themes.  Operation cancelled\"\n    MsgBox.Warning(sText,sTitle)\n    return false\nend\n    \n' Successfully returned the requir
ed themes, so we can do the work\n'--------------------------------------------------------------------\ntheCSTheme=dThms.Get( lTags.Get(0))              ' get the cross-section theme to use\ntheBankTheme=dThms.Get( lTags.Get(1))            ' get the bank line theme to use\n\n\n' Get CS' sField tag and see if there are valid profiles\n'--------------------------------------------------------------\nthesFieldTag = av.run(\"RAS.FRM.ThmTagMgr\", {\"GetValue\",theCSTheme,\"sField\"})     ' get its object tag\ntheTagCollection
 = thesFieldTag.AsTokens(\"=\")                                    ' create a collection of tag tokens\n\nif (theTagCollection.Count < 1) then\n  ' the tag does not contain item information - provide error message and quit\n  tMessage = \"The cross-section theme sField tag does not list any profiles!\"\n  tMessage = tMessage + nl + \"Either tag the theme manually, or re-run the\"\n  tMessage = tMessage + nl + \"cross-section generation process!\"\n  MsgBox.Warning(tMessage, sTitle)\n  return nil\nend\n\n\n' Generate dictionary
 of floodplain themes, indexed by the profile name\n' ---------------------------------------------------------------------\nlThemes = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetByKey\",oView,\"sType\",\"floodplain\"})\ndictFPThemes = Dictionary.Make( lThemes.Count)\nfor each t in lThemes\n    sItemTag = av.run( \"RAS.FRM.ThmTagMgr\",{\"GetValue\",t,\"sField\"})\n    dictFPThemes.Add( sItemTag, t)\nend\n\n\n' Generate dictionary of velocity point themes, indexed by the profile name\n' -------------------------------------------------------
--------------\nlThemes = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetByKey\",oView,\"sType\",\"VelPoints\"})\ndictVMThemes = Dictionary.Make( lThemes.Count)\nfor each t in lThemes\n    sItemTag = av.run( \"RAS.FRM.ThmTagMgr\",{\"GetValue\",t,\"sField\"})\n    dictVMThemes.Add( sItemTag, t)\nend\n\n\n' Make a list of profiles to offer to the user. Remove those that\n' already have a velocity TIN generated\n' -----------------------------------------------------------------\nlOfferItems = theTagCollection.Clone\nlstExistingVelTIN = av.run(\"RAS
.FRM.ThmTagMgr\",{\"GetByKey\",oView,\"sType\",\"veltin\"})\nfor each oTINTheme in lstExistingVelTIN\n    sTINItemTag = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetValue\",oTINTheme,\"sField\"})\n    if (theTagCollection.FindByValue(sTINItemTag) <> -1) then\n        lOfferItems.Remove( lOfferItems.FindByValue(sTINItemTag))\n    end\nend\n\nif (lOfferItems.Count = 0) then\n    tMessage = \"All profiles already have a matching velocity TIN!\" + nl + \"No further processing required.\"\n    tMessage = tMessage + nl + tSkipMessage\n    MsgBox.Warn
ing( tMessage, sTitle)\n    return nil\nend\n\n\n' Refine the list by removing those profile that lack either floodplains or velocity mass points\n' ----------------------------------------------------------------------------------------------\nfor each sItemTag in lOfferItems.Clone\n    if ((dictFPthemes.Get( sItemTag) = nil) or (dictVMthemes.Get( sItemTag) = nil)) then\n        lOfferItems.RemoveObj( sItemTag)\n    end\nend \n    \n   \n' Check to see how many (if any) profiles remain\n' --------------------------------
--------------\nif (lOfferItems.Count = 0) then\n    tMessage = \"First, generate floodplain polygons for profiles of interest. Also, be sure HEC-RAS exported velocities.\"\n    tMessage = tMessage + nl + tSkipMessage\n    MsgBox.Warning( tMessage, sTitle)\n    return nil\nelseif (lOfferItems.Count = 1) then\n    ' Only one -- no need to ask which one to process\n    lSelList = lOfferItems\nelse\n    ' More than one -- ask the user to select from available profiles\n    tMessage = \"Select velocity profiles for which to 
generate a velocity TIN.\"\n    lSelList = MsgBox.MultiListAsString(lOfferItems,tMessage,sTitle)\n    if (lSelList = nil) then return nil end                       ' cancelled from the selection process\n    if (lSelList.Count < 1) then return nil end                   ' none selected\nend\n\n    \n' Loop through the selected profiles and generate Velocity TIN\n'------------------------------------------------------------- \nfor each sProfile in lSelList\n\n    theVelTinName = \"veltin\"+sProfile\n    blnSuccessful = av.r
un(\"RAS.PST.BuildVelTin\",{\n                           theVelTinName.AsFileName,\n                           theCSTheme,\n                           theBankTheme,\n                           dictVMthemes.Get( sProfile),\n                           dictFPthemes.Get( sProfile)\n                           })\n    if (blnSuccessful) then\n        theTinTheme = Theme.Make( SrcName.Make( theVelTinName))\n        av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theTinTheme,\"sName\",NIL})         ' define the name tag\n        av.run(\"
RAS.FRM.ThmTagMgr\",{\"SetValue\",theTinTheme,\"sType\",\"veltin\"})    ' define the type tag\n        av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theTinTheme,\"sField\",sProfile})   ' define the profile tag\n        ' add the TIN to the view\n        oView.AddTheme( theTinTheme)                                             ' add the tin to the view\n    end\n\nend                                                 ' end of looping through the list of selected items\n\n' ** End of TIN Generation **\n\noView.Invalidate                 
                            ' display (refresh) the view\n\nif (AlertYou) then\n  MsgBox.Info(\"Velocity TIN generation completed.\",sTitle)\nend\n  \nreturn true\n\n\n\n\n\n\n\n"
)

(Script.271
	Name:	"RAS.PST.VelTINGenerationOLD"
	SourceCode:	"' Name: RAS.PST.VelTINGeneration\n'*******************************************************************************************\n'              (c) Copyright, 1999\n'         David Ford Consulting Engineers.\n'              All Rights Reserved\n'*******************************************************************************************\n' Name:        RAS.PST.VelTINGeneration\n' Usage:       Called from the menu\n' Returns:     none\n' Description: Setup parameters for building a velocity tin \n'              The buil
ding is done in\n'              RAS.PST.BuildVelTin.  Using framework.\n' Called by:   None.\n' Calling:     RAS.PST.buildVelTin.\n' Requires:    Framework.\n' History:     DM3 7/23/99; Copied RAS.WSTINGeneration as foundation for this script\n'\n'*******************************************************************************************  \n\n' Title for message box for these operations\nsTitle = \"RAS GIS Export: Velocity TIN Generation\"\nbVerify=false                                                 ' to force display
 of theme selection dialog\n\n\n' Use the active view as the place to process\n'--------------------------------------------\noView = av.GetActiveDoc                                              'get the active view\nif (oView = nil) then\n  ' the view does not exist - give a message and bail out\n  tMessage = \"The view has not been selected!\"\n  tMessage = tMessage + nl + \"Select a view containing the generated RAS cross-sections.\"\n  MsgBox.Warning (tMessage,sTitle)\n  return nil\nend\n\n\n'-----------------------------
----------------------------------------\n' Setup of required lists for use with the framework\n'---------------------------------------------------------------------\n\n' Provide the lists of Tags, ThmTypes, and ShpTypes.\nlTags={\"crossras\",\"VelBanks\"}                         'Tags\nlThmTypes={FTheme,FTheme}                                  'ThmTypes\nlShpTypes={\"PolyLine\",\"PolyLine\"}                        'ShpTypes POLYGON,POLYLINE,POINT,MultiPoint.\n\n' Create the Field descriptions of the required fields.\n' Nee
ds to be there even if none are used.\nldFields={nil,nil}\n\n' Define the default names.\nlDefNames={\"CSect\",\"Banks\"}            'Default names\n\n' Define the theme purpose type (input/output)\nlPurposes={\"I\",\"I\"}\n\n' Overwrite options when the specified thm exists in the view, lOverWrt guides the operation.\n'For GTheme, 0=OverWrite,1,2=Prompt for a new name because overwrite is not an option.\n'For FTheme, 0=Clear, 1=Ask For a new Name, 2=Append.\n'lOverWrts is extented to be used for InputThms (used as the output 
Thm) as well.\n'if 0 then don't ask for a backup, overwrite the input theme with the output theme.\n'if 1 then ask if a backup should be made.\nlOverWrts={0,0}\n\n  \n' Use the framework to check on the themes and items\n'---------------------------------------------------\ndThms=av.run(\"RAS.FRM.GetThmsByTagR\",{oView,lTags,lThmTypes,lShpTypes,ldFields,lDefNames,lPurposes,lOverWrts,bVerify,sTitle})\n\nif(dThms.is(Dictionary))then\n\n  '--------------------------------------------------------------------\n  ' Successfully
 returned the required themes, so we can do the work\n  '--------------------------------------------------------------------\n  '**             Velocity TIN Generation starts here           **\n\n  theCSTheme=dThms.Get( lTags.Get(0))              ' get the cross-section theme to use\n  theBankTheme=dThms.Get( lTags.Get(1))            ' get the bank line theme to use\n\n\n  ' Get CS' sField tag and see if there are valid elevation items\n  '--------------------------------------------------------------\n  thesFieldTa
g = av.run(\"RAS.FRM.ThmTagMgr\", {\"GetValue\",theCSTheme,\"sField\"})     ' get its object tag\n  'msgbox.info(\"The tag: \"+thesFieldTag.AsString,\"Tag check\")                      ' display the tag\n  theTagCollection = thesFieldTag.AsTokens(\"=\")                                    ' create a collection of tag tokens\n  theTagNo = theTagCollection.Count                                                ' count the tag elements\n  'msgbox.info(\"Number of tag elements = \"+theTagNo.AsString,\"Tag check\")\n  \n  if (theTagNo <
 1) then\n    ' the tag does not contain item information - provide error message and quit\n    tMessage = \"The cross-section theme sField tag does not contain any elevation\"\n    tMessage = tMessage + nl + \" items!  Either tag the theme manually, or re-run the\"\n    tMessage = tMessage + nl + \"cross-section generation process!\"\n    MsgBox.Warning(tMessage, sTitle)\n    return nil\n  end\n  \n  ' Generate the list of potential Vel TINs to generate, by cross-sreferencing any\n  ' existing Vel TINs to the list in theT
agCollection\n  '------------------------------------------------------------------------------\n  theTinList = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetByKey\",oView,\"sType\",\"veltin\"})\n  if (theTINList = nil) then\n      ' no Vel TINs are found.  Offer all the items.\n      lOfferItems = theTagCollection.Clone\n    else\n      ' there is at least one existing Vel TIN.  Build the list to offer.\n      lOfferItems = theTagCollection.Clone            ' initial list\n      ' loop through Vel TIN list and get its sField - remove
 that from\n      ' the offered list.\n      for each oTINTheme in theTINList\n        sTINItemTag = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetValue\",oTINTheme,\"sField\"})\n        nListOrder = theTagCollection.FindByValue(sTINItemTag)\n        if (nListOrder <> -1) then\n          ' the Vel TIN field is in the existing list - remove it.\n          nListRemove = lOfferItems.FindByValue(sTINItemTag)\n          lOfferItems.Remove(nListRemove)\n        end\n      end                          ' end of looping through Vel TINs\n  end
\n\n  ' See if there is anything to do\n  if (lOfferItems.Count = 0) then\n    tMessage = \"All velocity items have a matching velocity TIN!\"\n    tMessage = tMessage + nl + \"No processing is required.\"\n    MsgBox.Warning(tMessage, sTitle)\n    return nil\n  end\n  \n  ' Ask the user to select the items to be used for extraction,\n  ' check for valid input and get the number of selected items.\n  '------------------------------------------------------------\n  tMessage = \"Select velocity profiles for which to generate t
he velocity TIN.\"\n  lSelList = MsgBox.MultiListAsString(lOfferItems,tMessage,sTitle)\n  if (lSelList = nil) then\n    ' cancelled from the selection process\n    return nil\n  end\n  theSelNo = lSelList.Count                ' count the selected items\n  if (theSelNo < 1) then\n    ' the tag does not contain item information - provide error message and quit\n    tMessage = \"No velocity profiles were selected!\"\n    tMessage = tMessage + nl + \" Operation cancelled.\"\n    MsgBox.Warning(tMessage, sTitle)\n    return nil\n
  end\n  \n  \n  ' Loop through the item tags and perform the analysis for valid item names\n  '------------------------------------------------------------------------- \n  for each itemName in lSelList\n  '  msgbox.info(\"The item: \"+itemName.AsString,\"Tag check\")      ' display the tag\n    testItem = theCSTheme.GetFTab.FindField(itemName.AsString)\n    if (testItem = nil) then\n      ' the velocity item does not exist - give a message and quit\n      tMessage = \"The tagged velocity item: \"+itemName.AsString\n      
tMessage = tMessage + nl + \"does not exist in the attribute table.\"\n      tMessage = tMessage + nl + \"Velocity TIN generation skipped for this item.\"\n      MsgBox.Warning(tMessage, sTitle)\n      return nil\n    end\n    \n    ' tag exists - check if the accompanying floodplain polygon is there.\n    ' get the list of floodplain polygons, and then loop through them to\n    ' see if there is a matching one to the item.  If there is, generate\n    ' the water surface TIN.\n    theFPthemeList = av.run(\"RAS.FRM.ThmTagM
gr\",{\"GetByKey\",oView,\"sType\",\"floodplain\"})\n    theVMthemeList = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetByKey\",oView,\"sType\",\"VelPoints\"})\n    if ((theVMthemeList = nil) or (theFPthemeList = nil)) then\n      tMessage = \"No required floodplain polygons or velocity points were found!\"\n      tMessage = tMessage + nl + \"Water surface TIN generation skipped.\"\n      MsgBox.Warning(tMessage, sTitle)\n      return nil\n    end\n        \n    theFPTheme = nil\n    for each t in theFPthemeList\n      sItemTag = av.run(\"RAS.FRM.T
hmTagMgr\",{\"GetValue\",t,\"sField\"})\n      if (sItemTag = itemName) then\n        theFPTheme = t\n        break\n      end\n    end \n\n    theVMTheme = nil\n    for each t in theVMthemeList\n      sItemTag = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetValue\",t,\"sField\"})\n      if (sItemTag = itemName) then\n        theVMTheme = t\n        break\n      end\n    end \n\n    if ((theFPTheme = nil) or (theVMTheme = nil)) then\n       tMessage = \"No floodplain or velocity point theme(s) for\"++itemName+\"!\"\n       tMessage = tMessage + nl + 
\"(\" + theFPTheme.AsString ++ theVMTheme.AsString + \")\"\n       tMessage = tMessage + nl + \"Water surface TIN generation skipped.\"\n       MsgBox.Warning(tMessage, sTitle)\n       return nil\n    end\n\n    ' found the required themes. Next, generate velocity TIN.\n    theVelTinName = \"veltin\"+itemName\n    myResult = av.run(\"RAS.PST.BuildVelTin\",{theVelTinName.AsFileName,\n                                             theCSTheme, theBankTheme,\n                                             theVMTheme, theFpTheme})\n    
if (myResult) then\n      ' the Vel TIN generation finished successfully - add the TIN to the view\n      theSrcName = SrcName.Make(theVelTinName)\n      theTinTheme = Theme.Make(theSrcName)\n      ' tag the Vel TIN with \"veltin\" tag and the item that was generated by\n      av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theTinTheme,\"sName\",NIL})         ' define the name tag\n      av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theTinTheme,\"sType\",\"veltin\"})    ' define the theme tag\n      av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\"
,theTinTheme,\"sField\",itemName})   ' define the profile tag\n      oView.AddTheme(theTinTheme)                      ' add the tin to the view\n    end\n\n  end                            ' end of looping through the list of selected items\n  \n  \n  oView.Invalidate                                             ' display (refresh) the view\n     \n  MsgBox.Info(\"Velocity TIN generation completed.\",sTitle)\n\n\n \n  '**              End of TIN Generation               **\n  '-------------------------------------------------
-----\n\nelse\n\n  ' Problem in returning from checking the themes\n    sText = \"Problem with input themes.  Operation cancelled\"\n    MsgBox.Warning(sText,sTitle)\n    return false\n    \nend\n\nreturn true\n\n\n\n\n\n\n\n\n\n\n\n"
)

(Script.272
	Name:	"RAS.PST.WSTINGeneration"
	SourceCode:	"' Name: RAS.PST.WSTINGeneration\n'*******************************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'*******************************************************************************************\n' Name:        RAS.PST.WSTINGeneration\n' Usage:       Called from the menu\n' Returns:     none\n' Description: Setup parameters for building a water surface tin \n'             
 from cross-sections.  The building is done in\n'              RAS.PST.BuildWaterTin.  Using framework.\n' Called by:   None.\n' Calling:     RAS.PST.buildWaterTin.\n' Requires:    Framework.\n' History:     DDJ; 3/20-24/98 - original coding\n'              DDJ; 8/3/98 - fixing problem with replacement of . in water surface profile\n'                            name and with discrepancy in tags and bp names when a number\n'                            was the initial character (per Nan Shi's comments).\n'            
  DDJ; 8/6/98 - Reordering themes added to the postprocessing view\n'              DDJ; 2/99   - Modifying the tag structure (use dictionary and the framework).\n'                          - Made compatible with RAS 2.2 (generating 3D crosssection theme,\n'                            managing stream network, etc.).\n'                          - Added selection of which water surface profiles to build\n'                            TIN for.\n'*************************************************************************
******************  \n\n'check to see if if the call is summary of singular\n' if it is the summary call, we don't want ot alert the\n'user until completion AlertYou=False\nif (self.is(list).Not) then\n  AlertYou = True\n  else \n  if (self.get(0) = \"NoAlert\") then\n    AlertYou = False\n  end\nend\n\n\n\n' Title for message box for these operations\nsTitle = \"RAS GIS Export: Water Surface TIN Generation\"\nbVerify=false                                                 ' to force display of theme selection dialog\n\n\n' Use the 
active view as the place to process\n'--------------------------------------------\noView = av.GetActiveDoc                                              'get the active view\nif (oView = nil) then\n  ' the view does not exist - give a message and bail out\n  tMessage = \"The view has not been selected!\"\n  tMessage = tMessage + nl + \"Select a view containing the generated RAS cross-sections.\"\n  MsgBox.Warning (tMessage,sTitle)\n  return nil\nend\n\n\n'--------------------------------------------------------------------
-\n' Setup of required lists for use with the framework\n'---------------------------------------------------------------------\n\n' Provide the lists of Tags, ThmTypes, and ShpTypes.\nlTags={\"crossras\",\"terrainout\"}              'Tags\nlThmTypes={FTheme,STheme}                'ThmTypes\nlShpTypes={\"PolyLine\",\"TIN\"}             'ShpTypes POLYGON,POLYLINE,POINT,MultiPoint.\n\n' Create the Field descriptions of the required fields.\n' Needs to be there even if none are used.\nldFields={nil,nil}\n\n' Define the default nam
es.\nlDefNames={\"CSect\",\"TerrTIN\"}            'Default names\n\n' Define the theme purpose type (input/output)\nlPurposes={\"I\",\"I\"}\n\n' Overwrite options when the specified thm exists in the view, lOverWrt guides the operation.\n'For GTheme, 0=OverWrite,1,2=Prompt for a new name because overwrite is not an option.\n'For FTheme, 0=Clear, 1=Ask For a new Name, 2=Append.\n'lOverWrts is extented to be used for InputThms (used as the output Thm) as well.\n'if 0 then don't ask for a backup, overwrite the input theme with 
the output theme.\n'if 1 then ask if a backup should be made.\nlOverWrts={0,0}\n\n  \n' Use the framework to check on the themes and items\n'---------------------------------------------------\ndThms=av.run(\"RAS.FRM.GetThmsByTagR\",{oView,lTags,lThmTypes,lShpTypes,ldFields,lDefNames,lPurposes,lOverWrts,bVerify,sTitle})\nif(dThms.is(Dictionary))then\n\n  '--------------------------------------------------------------------\n  ' Successfully returned the required themes, so we can do the work\n  '-------------------------
-------------------------------------------\n  '**             Water Surface TIN Generation starts here           **\n\n  CSTag=lTags.Get(0)                                     ' get the cross-section tag\n  theCSTheme=dThms.Get(CSTag)                            ' get the cross-section theme to use\n  theFtab = theCSTheme.getFTab                           ' get the cross-section FTab\n\n  TINTag=lTags.Get(1)                                    ' get the TIN tag\n  theTINThemeRet=dThms.Get(TINTag)                    
   ' get the TIN theme to use\n'  theSurface = theTINThemeRet.GetSurface                 ' define the surface from TIN\n\n  ' Get CS' sField tag and see if there are valid elevation items\n  '--------------------------------------------------------------\n  thesFieldTag = av.run(\"RAS.FRM.ThmTagMgr\", {\"GetValue\",theCSTheme,\"sField\"})                                      ' get its object tag\n  'msgbox.info(\"The tag: \"+thesFieldTag.AsString,\"Tag check\")                 ' display the tag\n  theTagCollection = thesFie
ldTag.AsTokens(\"=\")                                ' create a collection of tag tokens\n  theTagNo = theTagCollection.Count                                     ' count the tag elements\n  'msgbox.info(\"Number of tag elements = \"+theTagNo.AsString,\"Tag check\")\n  \n  if (theTagNo < 1) then\n    ' the tag does not contain item information - provide error message and quit\n    tMessage = \"The cross-section theme sField tag does not contain any elevation\"\n    tMessage = tMessage + nl + \" items!  Either tag the theme 
manually, or re-run the\"\n    tMessage = tMessage + nl + \"cross-section generation process!\"\n    MsgBox.Warning(tMessage, sTitle)\n    return nil\n  end\n  \n  ' Generate the list of potential WS TINs to generate, by cross-referencing any\n  ' existing WS TINs to the list in theTagCollection\n  '------------------------------------------------------------------------------\n  theTinList = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetByKey\",oView,\"sType\",\"wstin\"})\n  if (theTINList = nil) then\n      ' no WS TINs are found.  Offer
 all the items.\n      lOfferItems = theTagCollection.Clone\n    else\n      ' there is at least one existing WS TIN.  Build the list to offer.\n      lOfferItems = theTagCollection.Clone            ' initial list\n      ' loop through WS TIN list and get its sField - remove that from\n      ' the offered list.\n      for each oTINTheme in theTINList\n        sTINItemTag = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetValue\",oTINTheme,\"sField\"})\n        nListOrder = theTagCollection.FindByValue(sTINItemTag)\n        if (nListOrde
r <> -1) then\n          ' the WS TIN field is in the existing list - remove it.\n          nListRemove = lOfferItems.FindByValue(sTINItemTag)\n          lOfferItems.Remove(nListRemove)\n        end\n      end                          ' end of looping through WS TINs\n  end\n\n  ' See if there is anything to do\n  if (lOfferItems.Count = 0) then\n    tMessage = \"All water surface items have a matching water surface TIN!\"\n    tMessage = tMessage + nl + \"No processing is required.\"\n    MsgBox.Warning(tMessage, sTitle)\n
    return nil\n  end\n  \n  ' Ask the user to select the items to be used for extraction,\n  ' check for valid input and get the number of selected items.\n  '------------------------------------------------------------\n  tMessage = \"Select water surface elevations for which to generate the water TIN.\"\n  lSelList = MsgBox.MultiListAsString(lOfferItems,tMessage,sTitle)\n  if (lSelList = nil) then\n    ' cancelled from the selection process\n    return nil\n  end\n  theSelNo = lSelList.Count                ' count the
 selected items\n  if (theSelNo < 1) then\n    ' the tag does not contain item information - provide error message and quit\n    tMessage = \"No water surface profiles were selected!\"\n    tMessage = tMessage + nl + \" Operation cancelled.\"\n    MsgBox.Warning(tMessage, sTitle)\n    return nil\n  end\n  \n  \n  ' Loop through the item tags and perform the analysis for valid item names\n  '------------------------------------------------------------------------- \n  for each itemName in lSelList\n  '  msgbox.info(\"The item
: \"+itemName.AsString,\"Tag check\")      ' display the tag\n    testItem = theFTab.FindField(itemName.AsString)\n    if (testItem = nil) then\n      ' the water surface item does not exist - give a message and quit\n      tMessage = \"The tagged water surface elevation item: \"+itemName.AsString\n      tMessage = tMessage + nl + \"does not exist in the attribute table.\"\n      tMessage = tMessage + nl + \"Water surface TIN generation skipped for this item.\"\n      MsgBox.Warning(tMessage, sTitle)\n      return nil\n    e
nd\n    \n    ' tag exists - check if the accompanying bounding polygon is there.\n    ' get the list of bounding polygons, and then loop through them to\n    ' see if there is a matching one to the item.  If there is, generate\n    ' the water surface TIN.\n    theBPList = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetByKey\",oView,\"sType\",\"wsbounds\"})\n    if (theBPList = nil) then\n      ' no bounding polygons are found.  Provide message and quit.\n      tMessage = \"No bounding polygons were not found!\"\n      tMessage = tMessag
e + nl + \"Water surface TIN generation skipped.\"\n      MsgBox.Warning(tMessage, sTitle)\n      return nil\n    end\n        \n    for each bpTheme in theBPList\n    sItemTag = av.run(\"RAS.FRM.ThmTagMgr\",{\"GetValue\",bpTheme,\"sField\"})\n      if (sItemTag <> itemName) then             ' not a matching bounding polygon.  Skip it.\n        else\n          ' found the bounding polygon matching the item of interest.  Generate WS TIN.\n          theWSTinName = \"wstin\"+itemName\n          myResult = av.run(\"RAS.PST.BuildWate
rTin\",{theWSTinName,theCSTheme,itemName,bpTheme})\n          if (myResult) then\n            ' the WS TIN generation finished successfully - add the TIN to the view\n            theSrcName = SrcName.Make(theWSTinName)\n            theTinTheme = Theme.Make(theSrcName)\n            ' tag the WS TIN with \"wstin\" tag and the item that was generated by\n            av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theTinTheme,\"sType\",\"wstin\"})       ' define the theme tag\n            av.run(\"RAS.FRM.ThmTagMgr\",{\"SetValue\",theTin
Theme,\"sField\",itemName})   ' define the elevation items tag\n            oView.AddTheme(theTinTheme)                      ' add the tin to the view\n            'theTinTheme.SetVisible(true)\n            'theTinTheme.Invalidate(true)\n          end\n      end                        ' end of checking if the item was matched with a bp\n    end                          ' end of loop through all the bps in the bplist\n  \n  end                            ' end of looping through the list of selected items\n  \n  \n  oVie
w.Invalidate                                             ' display (refresh) the view\n  \n  'if this is run as a summary processd don't tell the user about each TIN\n  ' AlertYou = TRUE if called separately\n  if (AlertYou) then   \n    MsgBox.Info(\"Water surface TIN completed successfully\",sTitle)\n  end\n\n \n  '**              End of Water Surface TIN Generation               **\n  '--------------------------------------------------------------------\n\nelse\n\n  ' Problem in returning from checking the themes\n    sT
ext = \"Problem with input themes.  Operation cancelled\"\n    MsgBox.Warning(sText,sTitle)\n    return false\n    \nend\n\nreturn true\n\n\n\n"
)

(Script.273
	Name:	"RAS.UTL.AboutGeoRas"
	SourceCode:	"' Name: RAS.UTL.AboutGeoRas\n'*****************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'*****************************************************************\n' Name:         RAS.UTL.AboutAVRas\n' Usage:        Call from the menu\n' Returns:      none\n' Description:  About HEC-GeoRAS info.\n'\n' History:      DDJ; 4/29/98 - original coding\n'               DDJ; 8/7/98 - update for AVRas 1.1\n'
               DDJ; 9/28/98 - update for AVRas 1.2\n'               DDJ; 2/18/99 - update for HEC-GeoRAS AV1.0\n'               CTA; 10.5.99 - update for GeoRAS 3.0\n'*****************************************************************\ntheString = \"HEC-GeoRAS 3.0 - ArcView Extension for HEC-RAS\"\n'theString = theString+nl+\"Copyright\"+169.Aschar++\"1999\"\n'theString = theString+nl+\"Environmental Systems Research Institute, Inc.\"\ntheString = theString+nl+\"Hydrologic Engineering Center.  US Army Corps of Engineers.\"\nMs
gBox.Info(theString,\"HEC-GeoRAS\")\n\nreturn nil\n\n"
)

(Script.274
	Name:	"RAS.UTL.CreateBanks"
	SourceCode:	"' Name: RAS.UTL.CreateBanks\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:          RAS.UTL.CreateBanks \n' USAGE:         Called from menu\n' Returns:       true  - when operation terminated successfully\n'                false - failed due to the theme setup (framework)\n'     
           nil   - failed in some aspect\n' Description:   Create an empty shape file and tag it as a banks theme.\n' Calling:       none\n' CalledBy:      none\n' Requires:      Framework (RAS.FRM.GetThmsByTagR, etc.)\n' History:       CTA 9/99\n' ***************************************************************************\n\noView = av.GetActiveDoc\nsTitle = \"HEC-GeoRAS: Creating banks theme\"\n\n' Check if there is a stream centerline already in the view\n'----------------------------------------------------------\nlSt
reamTheme = av.run(\"RAS.FRM.ThmTagMgr\", {\"Get\",oView,\"banks\"})\nbResponse = TRUE\nif (lStreamTheme.Count > 0) then\n  ' there is at least one theme taged with \"banks\".  Ask the user if\n  ' they want to replace the tag.\n  tMessage = \"There is at least one theme already defined as a banks\"\n  tMessage = tMessage + nl + \"theme.  Do you want to tag the newly\"\n  tMessage = tMessage + nl + \"created theme as the banks theme?\"\n  bResponse = MsgBox.YesNoCancel(tMessage,sTitle,TRUE)\n  if (bResponse = nil) then\n    ' canc
eled from the menu.  Quit operation.\n    return nil\n  end\nend\n\n' define the initial name\n'------------------------\nthePropString=\"Banks.shp\"\nnewFN = thePropString.AsFileName\nshapeBKName = FileDialog.Put(newFN,\"*.shp\",\"Specify the name of the banks shape file to create\")\nif (shapeBKName = nil) then\n  ' the selection has not been made.  Give a message and quit\n  tMessage = \"The banks name has not been selected!\"\n  tMessage = tMessage + nl + \"Banks theme creation has not been performed.\"\n  MsgBox.Warning(tMess
age, sTitle)\n  return nil    \nend\n  \n' create the shapefile\n'---------------------\nBKFTab = FTab.MakeNew(shapeBKName, Polyline)          ' create the FTab for the banks shape file\nshapeField = BKFTab.FindField(\"Shape\")                ' define field holder for shape field\nf1=Field.Make(\"ID\",#FIELD_DECIMAL,8,0)\nBKFTab.AddFields({f1})                          ' add the fields to the table\nBKFTab.Flush\nBKFTab.SetEditable(false)\n\n' add it to the view\n'-------------------\nBKTheme = FTheme.Make(BKFTab)\noView.AddTh
eme(BKTheme)\n\n' and make it active- and the only active theme   CTA;9.27.99\n'-------------------------------------------------\ntheThemeList = oView.GetActiveThemes\nfor each ActiveTheme in theThemeList\n  ActiveTheme.SetActive(false)\nend\nBKTheme.SetActive(true)\n\n' make it editable             CTA; 9.27.99\n'-------------------------------\nBKTheme.SetVisible(true)         'have it ready to draw to the screen upon digitizing\noView.SetEditableTheme(BKTheme)\n\n\n' make the Stream Centerline color Red        CTA;9.27
.99\n'----------------------------------------------\nnewLegend = Legend.Make(#SYMBOL_PEN)\nnewLegend.GetSymbols.Get(0).SetColor(Color.GetRed)\nBKTheme.SetLegend(newLegend)\nBKTheme.UpdateLegend                                      ' Redraw\n\n' tag the theme with \"banks\" if necessary\n'---------------------------------------------\nif (bResponse) then\n  ' put the \"centerline\" tag to the newly created theme.\n  av.run(\"RAS.FRM.ThmTagMgr\", {\"SetThm\",oView,BKTheme,\"banks\"})\nend\n\n\nreturn true\n\n"
)

(Script.275
	Name:	"RAS.UTL.CreateCenterline"
	SourceCode:	"' Name: RAS.UTL.CreateCenterline\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:          RAS.UTL.CreateCenterline \n' USAGE:         Called from menu\n' Returns:       true  - when operation terminated successfully\n'                false - failed due to the theme setup (framewo
rk)\n'                nil   - failed in some aspect\n' Description:   Create an empty shape file and tag it as a stream\n'                centerline.\n' Calling:       none\n' CalledBy:      none\n' Requires:      Framework (RAS.FRM.GetThmsByTagR, etc.)\n' History:       DDJ 2/99\n' ***************************************************************************\n\noView = av.GetActiveDoc\nsTitle = \"HEC-GeoRAS: Creating stream centerline theme\"\n\n' Check if there is a stream centerline already in the view\n'-----------------
-----------------------------------------\nlStreamTheme = av.run(\"RAS.FRM.ThmTagMgr\", {\"Get\",oView,\"centerline\"})\nbResponse = TRUE\nif (lStreamTheme.Count > 0) then\n  ' there is at least one theme taged with \"centerline\".  Ask the user if\n  ' they want to replace the tag.\n  tMessage = \"There is at least one theme already defined as a stream\"\n  tMessage = tMessage + nl + \"centerline theme.  Do you want to tag the newly\"\n  tMessage = tMessage + nl + \"created theme as the stream centerline theme?\"\n  bResponse = 
MsgBox.YesNoCancel(tMessage,sTitle,TRUE)\n  if (bResponse = nil) then\n    ' canceled from the menu.  Quit operation.\n    return nil\n  end\nend\n\n' define the initial name\n'------------------------\nthePropString=\"Stream.shp\"\nnew3DFN = thePropString.AsFileName\nshapeCLName = FileDialog.Put(new3DFN,\"*.shp\",\"Specify the name of the centerline shape file to create\")\nif (shapeCLName = nil) then\n  ' the selection has not been made.  Give a message and quit\n  tMessage = \"The centerline theme name has not been selected!
\"\n  tMessage = tMessage + nl + \"Centerline theme creation has not been performed.\"\n  MsgBox.Warning(tMessage, sTitle)\n  return nil    \nend\n  \n' create the shapefile\n'---------------------\nCLFTab = FTab.MakeNew(shapeCLName, Polyline)          ' create the FTab for the centerline shape file\nshapeField = CLFTab.FindField(\"Shape\")                ' define field holder for shape field\n\n' add standard fields\n'---------------------                                ' define standard items\nf1=Field.Make(\"Stream_ID\",#FI
ELD_CHAR,16,0)\nf2=Field.Make(\"Reach_ID\",#FIELD_CHAR,16,0)\n'f3=Field.Make(\"Station\",#FIELD_DECIMAL,11,4)\n'f4=Field.Make(\"Interp\",#FIELD_CHAR,1,0)\n'CLFTab.AddFields({f1,f2,f3,f4})                       ' add the fields to the table\nCLFTab.AddFields({f1,f2})                          ' add the fields to the table\nCLFTab.Flush\n\n' add it to the view\n'-------------------\nCLTheme = FTheme.Make(CLFTab)\noView.AddTheme(CLTheme)\n\n' make it editable             CTA; 9.27.99\n'-------------------------------\noView.SetEdit
ableTheme(CLTheme)\nCLTheme.SetVisible(true)         'have it ready to draw to the screen upon digitizing\n\n' and make it active- and the only active theme   CTA;9.27.99\n'-------------------------------------------------\ntheThemeList = oView.GetActiveThemes\nfor each ActiveTheme in theThemeList\n  ActiveTheme.SetActive(false)\nend\nCLTheme.SetActive(true)\n\n' make the Stream Centerline color Blue        CTA;9.27.99\n'----------------------------------------------\nnewLegend = Legend.Make(#SYMBOL_PEN)\nnewLegend.GetSy
mbols.Get(0).SetColor(Color.GetBlue)\nCLTheme.SetLegend(newLegend)\nCLTheme.UpdateLegend                                      ' Redraw\n\n' tag the theme with \"centerline\" if necessary\n'---------------------------------------------\nif (bResponse) then\n  ' put the \"centerline\" tag to the newly created theme.\n  av.run(\"RAS.FRM.ThmTagMgr\", {\"SetThm\",oView,CLTheme,\"centerline\"})\nend\n\n\nreturn true\n\n"
)

(Script.276
	Name:	"RAS.UTL.CreateCutLines"
	SourceCode:	"' Name: RAS.UTL.CreateCutLines\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:          RAS.UTL.CreateCutLines \n' USAGE:         Called from menu\n' Returns:       true  - when operation terminated successfully\n'                false - failed due to the theme setup (framework)\n
'                nil   - failed in some aspect\n' Description:   Create an empty shape file and tag it as a CutLines theme.\n' Calling:       none\n' CalledBy:      none\n' Requires:      Framework (RAS.FRM.GetThmsByTagR, etc.)\n' History:       CTA 9/99\n' ***************************************************************************\n\noView = av.GetActiveDoc\nsTitle = \"HEC-GeoRAS: Creating CutLines theme\"\n\n' Check if there is a stream centerline already in the view\n'--------------------------------------------------
--------\nlStreamTheme = av.run(\"RAS.FRM.ThmTagMgr\", {\"Get\",oView,\"cross2d\"})\nbResponse = TRUE\nif (lStreamTheme.Count > 0) then\n  ' there is at least one theme taged with \"CutLines\".  Ask the user if\n  ' they want to replace the tag.\n  tMessage = \"There is at least one theme already defined as a cross section\"\n  tMessage = tMessage + nl + \"cut lines theme.  Do you want to tag the newly\"\n  tMessage = tMessage + nl + \"created theme as the cut lines theme?\"\n  bResponse = MsgBox.YesNoCancel(tMessage,sTitle,TRUE)
\n  if (bResponse = nil) then\n    ' canceled from the menu.  Quit operation.\n    return nil\n  end\nend\n\n' define the initial name\n'------------------------\nthePropString=\"xscutlines.shp\"\nnewFN = thePropString.AsFileName\nshapeCLName = FileDialog.Put(newFN,\"*.shp\",\"Specify the name of the cut lines shape file to create\")\nif (shapeCLName = nil) then\n  ' the selection has not been made.  Give a message and quit\n  tMessage = \"The CutLines name has not been selected!\"\n  tMessage = tMessage + nl + \"XS Cut Lines them
e creation has not been performed.\"\n  MsgBox.Warning(tMessage, sTitle)\n  return nil    \nend\n  \n' create the shapefile\n'---------------------\nCLFTab = FTab.MakeNew(shapeCLName, Polyline)          ' create the FTab for the CutLines shape file\nshapeField = CLFTab.FindField(\"Shape\")                ' define field holder for shape field\nf1=Field.Make(\"ID\",#FIELD_DECIMAL,8,0)\nCLFTab.AddFields({f1})                          ' add the fields to the table\nCLFTab.Flush\nCLFTab.SetEditable(false)\n\n' add it to the view\n'
-------------------\nCLTheme = FTheme.Make(CLFTab)\noView.AddTheme(CLTheme)\n\n' and make it active- and the only active theme   CTA;9.27.99\n'-------------------------------------------------\ntheThemeList = oView.GetActiveThemes\nfor each ActiveTheme in theThemeList\n  ActiveTheme.SetActive(false)\nend\nCLTheme.SetActive(true)\n\n' make it editable             CTA; 9.27.99\n'-------------------------------\nCLTheme.SetVisible(true)         'have it ready to draw to the screen upon digitizing\noView.SetEditableTheme(CLTh
eme)\n\n\n' make the Stream Centerline color Green        CTA;9.27.99\n'----------------------------------------------\nnewLegend = Legend.Make(#SYMBOL_PEN)\nnewLegend.GetSymbols.Get(0).SetColor(Color.GetGreen)\nCLTheme.SetLegend(newLegend)\nCLTheme.UpdateLegend                                      ' Redraw\n\n' tag the theme with \"cross2d\" if necessary\n'---------------------------------------------\nif (bResponse) then\n  ' put the \"cross2d\" tag to the newly created theme.\n  av.run(\"RAS.FRM.ThmTagMgr\", {\"SetThm\",oView
,CLTheme,\"cross2d\"})\nend\n\n\nreturn true\n\n"
)

(Script.277
	Name:	"RAS.UTL.CreateFlowpath"
	SourceCode:	"' Name: RAS.UTL.CreateFlowpath\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:          RAS.UTL.CreateFlowpath \n' USAGE:         Called from menu\n' Returns:       true  - when operation terminated successfully\n'                false - failed due to the theme setup (framework)\n
'                nil   - failed in some aspect\n' Description:   Create an empty shape file and tag it as a flowpath\n'                theme.  If stream centerline theme exists, ask the user\n'                whether to copy the shapes from that theme into the\n'                flowpath theme.\n' Calling:       none\n' CalledBy:      none\n' Requires:      Framework (RAS.FRM.GetThmsByTagR, etc.)\n' Comment:       Almost the same code as for the RAS.UTL.CreateCenterline.\n' History:       DDJ 2/99\n'                CT
A 9/23/99  Change LineType as CHar from 2 to 8\n' ***************************************************************************\n\noView = av.GetActiveDoc\nsTitle = \"HEC-GeoRAS: Creating flowpath theme\"\n\n' Check if there is a flowpath theme already in the view\n'----------------------------------------------------------\nlFlowPTheme = av.run(\"RAS.FRM.ThmTagMgr\", {\"Get\",oView,\"flowpaths\"})\nbResponse = TRUE\nif (lFlowPTheme.Count > 0) then\n  ' there is at least one theme taged with \"flowpaths\".  Ask the user if\n  ' th
ey want to replace the tag.\n  tMessage = \"There is at least one theme already defined as a flowpath\"\n  tMessage = tMessage + nl + \"theme.  Do you want to tag the newly created\"\n  tMessage = tMessage + nl + \"theme as the flowpath theme?\"\n  bResponse = MsgBox.YesNoCancel(tMessage,sTitle,TRUE)\n  if (bResponse = nil) then\n    ' canceled from the menu.  Quit operation.\n    return nil\n  end\nend\n\n' define the initial name\n'------------------------\nthePropString=\"Flowpath.shp\"\nnew3DFN = thePropString.AsFileName\nsha
peFPName = FileDialog.Put(new3DFN,\"*.shp\",\"Specify the name of the flowpath shape file to create\")\nif (shapeFPName = nil) then\n  ' the selection has not been made.  Give a message and quit\n  tMessage = \"The flowpath theme name has not been selected!\"\n  tMessage = tMessage + nl + \"Flowpath theme creation has not been performed.\"\n  MsgBox.Warning(tMessage, sTitle)\n  return nil    \nend\n\nbDone = 0                        ' define boolean for manual theme creation\n\n' Check if there is a stream centerline already 
in the view\n'----------------------------------------------------------\noSCTheme = av.run(\"RAS.FRM.ThmTagMgr\", {\"GetOne\",oView,\"centerline\"})\nif (oSCTheme<>nil) then\n  ' there is at least one theme taged with \"centerline\".  Ask the user if\n  ' they want to move the content to flowpath theme.\n  tMessage = \"The stream centerline theme is defined!\"\n  tMessage = tMessage + nl + \"Do you want to copy the existing stream\"\n  tMessage = tMessage + nl + \"centerline shapes into the flowpath theme?\"\n  bResponse1 = MsgB
ox.YesNoCancel(tMessage,sTitle,TRUE)\n  if (bResponse1 = nil) then\n    ' canceled from the menu.  Quit operation.\n    return nil\n  end\n  \n  if (bResponse1) then\n      ' copy the stream centerline shapes into the flowpath shape\n      SCFTab = oSCTheme.GetFTab\n      FPFTab = SCFTab.Export (shapeFPName,PolyLine,FALSE)\n      ' add standard field\n      FPFTab.SetEditable(True)\n      f1=Field.Make(\"LineType\",#FIELD_CHAR,8,0)\n      FPFTab.AddFields({f1})                                ' add the fields to the table\n
      FPFTab.SetEditable(False)\n      FPFTab.Flush\n      bDone = 1                            ' say the creation is done\n    else\n      ' do not copy the stream centerline shapes into the flowpath shape\n      bDone = 0                            ' say the creation is not done\n  end\nend\n\n' check if the shape file has not yet been defined and create it if necessary\n'----------------------------------------------------------------------------\nif (bDone = 0) then\n  ' create the shapefile\n  FPFTab = FTab.MakeNew
(shapeFPName, Polyline)          ' create the FTab for the centerline shape file\n  shapeField = FPFTab.FindField(\"Shape\")                ' define field holder for shape field\n  \n  ' add standard fields (at least one needs to be added anyway)\n  f1=Field.Make(\"LineType\",#FIELD_CHAR,8,0)\n'  f2=Field.Make(\"Reach_ID\",#FIELD_CHAR,16,0)\n  FPFTab.AddFields({f1})                                ' add the fields to the table\n  FPFTab.SetEditable(False)\n  FPFTab.Flush\nend\n\n' add it to the view\n'-------------------\nFPTh
eme = FTheme.Make(FPFTab)\noView.AddTheme(FPTheme)\n\n' make it editable             CTA; 9.27.99\n'-------------------------------\noView.SetEditableTheme(FPTheme)\nFPTheme.SetVisible(true)         'have it ready to draw to the screen upon digitizing\n\n' and make it active- and the only active theme   CTA;9.27.99\n'-------------------------------------------------\ntheThemeList = oView.GetActiveThemes\nfor each ActiveTheme in theThemeList\n  ActiveTheme.SetActive(false)\nend\nFPTheme.SetActive(true)\n\n' make the Stream 
Centerline color Cyan        CTA;9.27.99\n'----------------------------------------------\nnewLegend = Legend.Make(#SYMBOL_PEN)\nnewLegend.GetSymbols.Get(0).SetColor(Color.GetCyan)\nFPTheme.SetLegend(newLegend)\nFPTheme.UpdateLegend                                      ' Redraw\n\n\n' tag the theme with \"flowpaths\" if necessary\n'---------------------------------------------\nif (bResponse) then\n  ' put the \"flowpaths\" tag to the newly created theme.\n  av.run(\"RAS.FRM.ThmTagMgr\", {\"SetThm\",oView,FPTheme,\"flowpaths\"})
\nend\n\n\nreturn true\n\n"
)

(Script.278
	Name:	"RAS.UTL.CreateLUtab"
	SourceCode:	"' Name: RAS.UTL.CreateLUtab\n' ***************************************************************************\n'              (c) Copyright, 1999\n'       David Ford Consulting Engineers\n'              All Rights Reserved\n' ***************************************************************************\n' Name:          RAS.UTL.CreateLUtab \n' USAGE:         Called from menu\n' Returns:       true  - when operation terminated successfully\n'                nil   - failed in some aspect\n' Description:   Create a dBase tab
le with a land use field and an N_value field.\n'                Then, populates the table with land use codes from the active theme\n' Calling:       none\n' CalledBy:      none\n' Requires:      Framework (RAS.FRM.GetThmsByTagR, etc.)\n' History:       DM3, 8/99 Orignially: acted on the Land Use tagged theme\n'                DM3, 9/99 Modified to act on the active theme\n' ***************************************************************************\n\noView = av.GetActiveDoc\nsTitle = \"HEC-GeoRAS: Creating LU-Manni
ng table\"\n\ntheLUtab = nil\nfor each t in oView.GetActiveThemes\n  if (t.GetFTab.GetShapeClass.GetClassName = \"Polygon\") then\n    theLUtab = t.GetFTab\n    break\n  end\nend\n\nif (theLUtab = NIL) then\n  MsgBox.Error( \"Activate a land use polygon theme first.\", sTitle)\n  return nil\nend\n\n' Ask which field to use as land use codes\n' ----------------------------------------\nlFields = theLUtab.GetFields.Clone\nif (lFields.Count <= 1) then\n  tMessage = \"Need to add a land-use-code field to the landuse theme\"\n  MsgBox.Inf
o( tMessage,sTitle)\n  return nil\nend\n\nlFields.Remove(0)        ' Remove the Shape field; it is always first\n\nif (lFields.Count > 1) then\n  luField = MsgBox.Choice( lFields, \"Specify the land-use code field in\"++theLUtab.GetName, sTitle)\n  if (luField = NIL) then\n    return nil\n  end\nelse\n  ' Just one field. No need to ask them which to use.\n  luField = lFields.Get(0)\nend\n\n' define the initial name\n'------------------------\ntheTabFname=\"LUManning.dbf\".AsFileName\nshapeFPName = FileDialog.Put( theTabFname,\"*.d
bf\",\"Specify the name of the dBase file to create\")\nif (shapeFPName = nil) then\n  return nil    \nend\n\n' Create a new table, with a field that's equivalent to the land use code field\n' -----------------------------------------------------------------------------\ntheManningTab = VTab.MakeNew( shapeFPName, dBase)\ntheManningLuField = luField.Clone\ntheManningNvalField = Field.Make( \"N_value\", #FIELD_FLOAT, 6, 3)\ntheManningTab.AddFields( {theManningLuField, theManningNvalField})\n\n' Get a list of all the distinct 
land use codes in the land use theme\n' -------------------------------------------------------------------\nlstLUcodes = {}\nfor each r in theLUtab\n  lstLUcodes.Add( theLUtab.ReturnValue( luField, r))\nend\nlstLUcodes.RemoveDuplicates\n\n' Populate our new LU-Manning table with these codes\n' --------------------------------------------------\nfor each aCode in lstLUcodes\n  theManningTab.SetValue( theManningLuField, theManningTab.AddRecord, aCode)\nend\ntheManningTab.SetEditable( FALSE)\n\n' Join this LU-Manning table 
to the Land Use table\n' -------------------------------------------------\nif (theLUTab.IsBase.Not) then                           ' first, remove all joins\n  theLUTab.UnjoinAll\nend\ntheLUTab.Join( luField, theManningTab, theManningLuField)\n\n\n' Add the VTab to the project\n' ---------------------------\nluTable = Table.Make( theManningTab)\nluTable.SetName( shapeFPName.GetBaseName)\nav.GetProject.AddDoc( luTable)\n\nreturn true\n\n\n\n\n\n' Name: RAS.UTL.CreateLUtab\n' *****************************************************
**********************\n'              (c) Copyright, 1999\n'       David Ford Consulting Engineers\n'              All Rights Reserved\n' ***************************************************************************\n' Name:          RAS.UTL.CreateLUtab \n' USAGE:         Called from menu\n' Returns:       true  - when operation terminated successfully\n'                nil   - failed in some aspect\n' Description:   Create a dBase table with a land use field and an N_value field.\n'                Then, populates the
 table with land use codes from the active theme\n' Calling:       none\n' CalledBy:      none\n' Requires:      Framework (RAS.FRM.GetThmsByTagR, etc.)\n' History:       DM3, 8/99 Orignially: acted on the Land Use tagged theme\n'                DM3, 9/99 Modified to act on the active theme\n' ***************************************************************************\n\noView = av.GetActiveDoc\nsTitle = \"HEC-GeoRAS: Creating LU-Manning table\"\n\nfor each t in oView.GetActiveThemes\n  if (t.GetFTab.GetShapeClass = Poly
gon) then\n    theLUtab = t.GetFTab\n    break\n  end\nend\n\nif (theLUtab = NIL) then\n  MsgBox.Error( \"Activate a land use polygon theme first.\", sTitle)\n  return nil\nend\n\n' Ask which field to use as land use codes\n' ----------------------------------------\nlFields = theLUtab.GetFields.Clone\nif (lFields.Count <= 1) then\n  tMessage = \"Need to add a land-use-code field to the landuse theme\"\n  MsgBox.Info( tMessage,sTitle)\n  return nil\nend\n\nlFields.Remove(0)        ' Remove the Shape field; it is always first\n\nif (
lFields.Count > 1) then\n  luField = MsgBox.Choice( lFields, \"Specify the land-use code field in\"++theLUtab.GetName, sTitle)\n  if (luField = NIL) then\n    return nil\n  end\nelse\n  ' Just one field. No need to ask them which to use.\n  luField = lFields.Get(0)\nend\n\n' define the initial name\n'------------------------\ntheTabFname=\"LUManning.dbf\".AsFileName\nshapeFPName = FileDialog.Put( theTabFname,\"*.dbf\",\"Specify the name of the dBase file to create\")\nif (shapeFPName = nil) then\n  return nil    \nend\n\n' Create a 
new table, with a field that's equivalent to the land use code field\n' -----------------------------------------------------------------------------\ntheManningTab = VTab.MakeNew( shapeFPName, dBase)\ntheManningLuField = luField.Clone\ntheManningNvalField = Field.Make( \"N_value\", #FIELD_FLOAT, 6, 3)\ntheManningTab.AddFields( {theManningLuField, theManningNvalField})\n\n' Get a list of all the distinct land use codes in the land use theme\n' -------------------------------------------------------------------\nlstLUc
odes = {}\nfor each r in theLUtab\n  lstLUcodes.Add( theLUtab.ReturnValue( luField, r))\nend\nlstLUcodes.RemoveDuplicates\n\n' Populate our new LU-Manning table with these codes\n' --------------------------------------------------\nfor each aCode in lstLUcodes\n  theManningTab.SetValue( theManningLuField, theManningTab.AddRecord, aCode)\nend\ntheManningTab.SetEditable( FALSE)\n\n' Join this LU-Manning table to the Land Use table\n' -------------------------------------------------\nif (theLUTab.IsBase.Not) then          
                 ' first, remove all joins\n  theLUTab.UnjoinAll\nend\ntheLUTab.Join( luField, theManningTab, theManningLuField)\n\n\n' Add the VTab to the project\n' ---------------------------\nluTable = Table.Make( theManningTab)\n'luTable.SetName( shapeFPName.GetBaseName)\nav.GetProject.AddDoc( luTable)\n\nreturn true\n\n\n\n\n"
)

(Script.279
	Name:	"RAS.UTL.EditFlowpathType"
	SourceCode:	"' Name: RAS.UTL.EditFlowpathType\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:          RAS.UTL.EditFlowpathType \n' USAGE:         Called from menu bar (utility)\n' Returns:       true  - when operation terminated successfully\n'                false - failed due to the theme 
setup (framework)\n'                nil   - failed in some aspect\n' Description:   For selected shapes in the flowpath theme assign flowpath\n'                type (L,R,M).\n' Calling:       none\n' CalledBy:      none\n' Requires:      Framework (RAS.FRM.GetThmsByTagR, etc.)\n' History:       DDJ 3/99\n'                CTA 9/23/99 change to Left, Channel, Right\n' ***************************************************************************\n\noView = av.GetActiveDoc\n'oDisplay = oView.GetDisplay\nsTitle = \"HEC-GeoRAS: 
Editing Flowpath Type\"\n\nlThemes = oView.GetActiveThemes              ' get active theme\n\n' Check if more than one theme is selected\n'-----------------------------------------\nif (lThemes.Count>1) then\n  ' more than one theme selected.  Give a message and quit\n  sText = \"More than one theme is selected!\"\n  sText = sText + nl + \"Operation cancelled.\"\n  MsgBox.Warning(sText,sTitle)\n  return false\nend\n\n' Check if the selected theme is a flowpath theme\n'----------------------------------------------------------\n
oFPTheme = lThemes.Get(0)                        ' get the selected theme\nsThemeTag = av.run(\"RAS.FRM.ThmTagMgr\", {\"GetValue\",oFPTheme,\"sName\"})\nif ((sThemeTag=nil) and (sThemeTag <> \"flowpaths\")) then\n  ' selected theme is not a flowpath theme.   Give a message and quit\n  sText = \"Selected theme is not a flowpath theme!\"\n  sText = sText + nl + \"Operation cancelled.\"\n  MsgBox.Warning(sText,sTitle)\n  return false  \nend\n\n' There is a theme taged with \"flowpath\".  Use it for ID editing.\n'----------------------
--------------------------------------------\noFPFTab = oFPTheme.GetFTab                          ' get theme's FTab\noTypeField = oFPFTab.FindField(\"LineType\")          ' get LineType field handle\nif (oTypeField = nil) then\n  ' the field is missing.  Give a message and quit.\n  sText = \"The flowpath theme does not contain LineType item!\"\n  sText = sText + nl + \"Operation cancelled.\"\n  MsgBox.Warning(sText,sTitle)\n  return false\nend\n\n' Get selected features\n'----------------------\noBitMap = oFPFTab.GetSelectio
n\nif (oBitMap.Count = 0) then\n  ' There are no selected features.  Give a message and quit.\n  sText = \"No features are selected!\"\n  sText = sText + nl + \"Operation cancelled.\"\n  MsgBox.Warning(sText,sTitle)\n  return false\nend\n\n' Ask the user what to assign the selected features as and do the update.\n'------------------------------------------------------------------------\nlLabels = {\"Left\",\"Channel\",\"Right\"}\nsText = \"Enter Flowpath type for selected features:\"\nsResult = MsgBox.ChoiceAsString (lLabels,sText,
sTitle)\n\n' check if we got a valid return and update if yes\nif (sResult = nil) then\n    ' canceled from the operation - do not change the values\n    return false\n  else\n    ' modify the values\n    oFPFTab.SetEditable(true)\n    for each rec in oBitMap\n      oFPFTab.SetValue(oTypeField,rec,sResult.AsString)\n    end\n    oFPFTab.SetEditable(false)\nend\n\n\n' Done with updates\n'------------------\nreturn true\n"
)

(Script.280
	Name:	"RAS.UTL.EditIDApply"
	SourceCode:	"' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:          RAS.UTL.EditIDApply \n' USAGE:         Called from toolbar\n' Returns:       true  - when operation terminated successfully\n'                false - failed due to the theme setup (framework)\n'                nil   - failed
 in some aspect\n' Description:   Select a shape on which the user clicked, get the\n'                Stream and Reach ID, and offer them for edit in a popup\n'                form.  Update the values in the table if OK is pressed.\n' Calling:       none\n' CalledBy:      none\n' Requires:      Framework (RAS.FRM.GetThmsByTagR, etc.)\n' History:       DDJ 2/99\n' ***************************************************************************\n\noView = av.GetActiveDoc\n'oDisplay = oView.GetDisplay\noToolBar = av.GetActiveG
UI.GetToolBar          ' get the toolbar handle\n\nsTitle = \"HEC-GeoRAS: Editing Stream and Reach IDs\"\n\n' Check if there is a stream centerline already in the view\n'----------------------------------------------------------\noStreamTheme = av.run(\"RAS.FRM.ThmTagMgr\", {\"GetOne\",oView,\"centerline\"})\nif (oStreamTheme=nil) then\n  ' there is NOT a theme taged with \"centerline\".  Give a message and quit\n  sText = \"Stream centerline theme is not defined!\"\n  sText = sText + nl + \"Operation cancelled.\"\n  MsgBox.Warning
(sText,sTitle)\n  ' unenable the \"I\" tool by enabling the first tool in the toolbar\n  oToolBar.GetControls.Get(0).Select\n  return false  \nend\n\n' There is a theme taged with \"centerline\".  Use it for ID editing.\n'------------------------------------------------------------------\noSCFTab = oStreamTheme.GetFTab                      ' get theme's FTab\noSIDField = oSCFTab.FindField(\"Stream_ID\")          ' get STREAM_ID field handle\noRIDField = oSCFTab.FindField(\"Reach_ID\")           ' get REACH_ID field handle\n\n'
 mouse click to get the point - APPLY EVENT!!\npnt = oView.GetDisplay.ReturnUserPoint              ' get the point from the click on the screen\noStreamTheme.SelectByPoint(pnt, #VTAB_SELTYPE_NEW)  ' select a line based on the point location\n'oSCFTab.UpdateSelection\noView.GetDisplay.Flush                              ' flush to show the selection\n\n' Specify the dialog to use and attach the FTab and selected set to it for later use\noDialogRR = av.FindDialog(\"RR_Id\")\nbitmapSelected = oSCFTab.GetSelection\nlDialog
Tag = List.Make\nlDialogTag.Add(oSCFTab)\nlDialogTag.Add(bitmapSelected)\noDialogRR.SetObjectTag(lDialogTag)\n\nfor each rec in oSCFTab.GetSelection\n  ' bring up the dialog for river and reach ID entry\n  lResult = oDialogRR.Open\n  ' check if we got a valid return and update if yes\n  if (lResult.Count = 1) then\n      ' canceled from the operation - do not change the values\n    else\n      ' modify the values\n      oSCFTab.SetEditable(true)\n      oSCFTab.SetValue(oSIDField,rec,lResult.Get(1).AsString)\n      oSCFTab
.SetValue(oRIDField,rec,lResult.Get(2).AsString)\n      oSCFTab.SetEditable(false)\n  end\n\nend\n\nreturn true\n"
)

(Script.281
	Name:	"RAS.UTL.EditIDClick"
	SourceCode:	"' Name: RAS.UTL.EditIDClick\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:          RAS.UTL.EditIDClick \n' USAGE:         Called from toolbar\n' Returns:       true  - when operation terminated successfully\n'                false - failed due to the theme setup (framework)\n'  
              nil   - failed in some aspect\n' Description:   Check if the stream centeline theme exists and disable the\n'                tool if it does not.\n' Calling:       none\n' CalledBy:      none\n' Requires:      Framework (RAS.FRM.GetThmsByTagR, etc.)\n' History:       DDJ 2/99\n' ***************************************************************************\n\noView = av.GetActiveDoc                        ' get the view handle\noToolBar = av.GetActiveGUI.GetToolBar          ' get the toolbar handle\n\nsTitle
 = \"HEC-GeoRAS: Editing Stream and Reach IDs\"\nbVerify=false                                                               ' to force display of theme selection dialog\n\n'---------------------------------------------------------------------\n' Setup of required lists for use with the framework\n'---------------------------------------------------------------------\n\n' Provide the lists of Tags, ThmTypes, and ShpTypes.\nlTags={\"centerline\"}                     'Tags\nlThmTypes={FTheme}                       'ThmTyp
es\nlShpTypes={\"PolyLine\"}                   'ShpTypes POLYGON,POLYLINE,POINT,MultiPoint.\n\n' Create the Field descriptions of the required fields.  They are all listed in RAS.PRE.GetdFields\n' script.  This section just loads it from there.\n' Needs to be there even if none are used.\ndFields=av.run(\"RAS.UTL.GetdFields\",{lTags})\nldFields=List.Make\nfor each sTag in lTags\n  ldFields.Add(dFields.Get(sTag))  \nend\n\n' Define the default names.\nlDefNames={\"CLine\"}                    'Default names\n\n' Define the theme 
purpose type (input/output)\nlPurposes={\"I\"}\n\n' Overwrite options when the specified thm exists in the view, lOverWrt guides the operation.\n'For GTheme, 0=OverWrite,1,2=Prompt for a new name because overwrite is not an option.\n'For FTheme, 0=Clear, 1=Ask For a new Name, 2=Append.\n'lOverWrts is extented to be used for InputThms (used as the output Thm) as well.\n'if 0 then don't ask for a backup, overwrite the input theme with the output theme.\n'if 1 then ask if a backup should be made.\nlOverWrts={2}\n\n  \n' Use
 the framework to check on the themes and items\n'---------------------------------------------------\ndThms=av.run(\"RAS.FRM.GetThmsByTagR\",{oView,lTags,lThmTypes,lShpTypes,ldFields,lDefNames,lPurposes,lOverWrts,bVerify,sTitle})\nif(dThms.is(Dictionary))then\n\n  '---------------------------------------------------------------------------------\n  ' Successfully returned the required themes, so we can do the work\n  '---------------------------------------------------------------------------------\n  '**           
   Stream centerline STREAM and REACH ID setup                    **\n\n  ' Nothing needs to be done since the framework took care of all the prep work !!!!\n  \n'  CenterTag=lTags.Get(0)                                 ' get the centerline tag\n'  theCLTheme=dThms.Get(CenterTag)                        ' get the centerline theme to use\n'  theCLFTab = theCLTheme.getFTab                         ' get the centerline FTab\n  \n  '**           End of Stream centerline STREAM and REACH ID setup                **\n  '----
-----------------------------------------------------------------------------\n\nelse\n\n  ' Problem in returning from checking the themes\n    sText = \"Stream centerline theme is not defined!\"\n    sText = sText + nl + \"Operation cancelled.\"\n    MsgBox.Warning(sText,sTitle)\n    ' unenable the \"I\" tool by enabling the first tool in the toolbar\n    oToolBar.GetControls.Get(0).Select\n    return false\n    \nend\n\nreturn true\n"
)

(Script.282
	Name:	"RAS.UTL.FlipMe"
	SourceCode:	"' Name: RAS.UTL.FlipMe\n'******************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'******************************************************\n' Name:         RAS.UTL.FlipMe\n' Usage:        Called from the menu\n' Returns:      none\n' Description:  Flips a selected polyline.\n' Assumption:   The theme is active.\n'               The polyline is selected.\n' Calling: \n'\n' History:      DDJ; 4/22/98\n'   
            DDJ; 2/99    Modified name and header.\n'******************************************************\n\nstrMessageTitle = \"Polyline flipping\"\n\n\n' Use the active view as the place to process\n'--------------------------------------------\n'myView = av.GetProject.FindDoc(\"View3\")\nmyView = av.GetActiveDoc                                        ' get the active view\nif (myView = nil) then\n  ' the view does not exist - give a message and bail out\n  tMessage = \"The view has not been selected!\"\n  tMessage = tMes
sage + nl + \"Select a view containing the themes to be used\"\n  tMessage = tMessage + nl + \"for polyline flipping.\"\n  MsgBox.Warning (tMessage,strMessageTitle)\n  return nil\nend\n\ntheTheme = myView.GetActiveThemes.Get(0)                        ' get the selected theme\ntheFTab = theTheme.GetFTab                                      ' get theme's ftab\ntheBitMap = theFTab.GetSelection                                ' define the bitmap reflecting the selection\n\ntheShapeF = theFTab.FindField( \"shape\" )             
           ' get the shape field\n\ntheShape = theFTab.GetShapeClass.MakeNull                       ' create a NULL shape\nthePrj = Prj.MakeNull                                           ' create a dummy projection object\n\n\ntheFTab.SetEditable(true)                                       ' start editing the FTab\n\nfor each recNum in theBitMap                                    ' loop through selected shapes\n  theFTab.QueryShape(recNum, thePrj, theShape)                  ' get the shape\n  revShape = theShape.Flip
                                      ' flip the shape\n  if (theFTab.IsEditable) then\n      theFTab.SetValue (theShapeF, recNum, revShape)            ' save the new shape\n  end \nend\n\ntheFtab.Flush                                                   ' save changes to disk\ntheFTab.SetEditable(FALSE)                                      ' stop editing the FTab\n\nmyView.GetDisplay.Invalidate(true)                              ' redraw the screen\n\nreturn nil\n\n"
)

(Script.283
	Name:	"RAS.UTL.GetdFields"
	SourceCode:	"' Name: RAS.UTL.GetdFields\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:        RAS.UTL.GetdFields\n' Self/USAGE:  {TheView,ThmAct,ThmType,ShpType}\n\n' Returns:     list of themes of the type specified.\n' Description: GetdFields by its Tags.  This set is used to define\n'      
        the fields that are required before processing can be\n'              accomplished, so not fields will be generated if they\n'              are not present.\n' Requires:\n' History:     zye 12/19/98\n'              DDJ 2/99    - implementation for RAS preprocessing.\n' ***************************************************************************\n'..TagSummary: List of all the sName tags used in this project.\n' For Themes:\n' sName (Tag)         Desc\n'\n'	centerline          2D stream centerline (FTheme).\n'\n' 
***************************************************************************\n\n\nlTags=SELF.Get(0)\n'..Create the Field descriptions of the required fields.\n\n' The last digit indicates whether the field has to be existent or not.\n' If that value is 0, then the field does not have to be already present in the\n' table - it will be created.  If the value is 1, then the field needs to be \n' present in the table - if it is not, the code will return an error message and \n' the operation will stop with execution.\n\nCen
terDict=Dictionary.Make(3)\n  CenterDict.Add(\"Stream_ID\",\"#FIELD_CHAR,16,0,0\")\n  CenterDict.Add(\"Reach_ID\",\"#FIELD_CHAR,16,0,0\")\n'  CenterDict.Add(\"is_Outlet\",\"#FIELD_SHORT,2,0,0\")\n'  CenterDict.Add(\"from_Node\",\"#FIELD_LONG,8,0,0\")\n'  CenterDict.Add(\"to_Node\",\"#FIELD_LONG,8,0,0\")\n'  CenterDict.Add(\"ArcLength\",\"#FIELD_DECIMAL,12,3,0\")\n'  CenterDict.Add(\"from_ST\",\"#FIELD_DECIMAL,12,3,1\")\n'  CenterDict.Add(\"to_ST\",\"#FIELD_DECIMAL,12,3,1\")\n\nCSDict=Dictionary.Make(3)\n'  CSDict.Add(\"Stream_ID\",\"#FIELD_CHAR,16,0,0\"
)\n'  CSDict.Add(\"Reach_ID\",\"#FIELD_CHAR,16,0,0\")\n  CSDict.Add(\"Station\",\"#FIELD_DECIMAL,11,4,0\")\n\ndFTabFields=Dictionary.Make(1)\n\ndFtabFields.Add(\"centerline\",CenterDict)\n'dFtabFields.Add(\"cross2D\",CSDict)\n'dFtabFields.Add(\"RiverMg\",RiverMgDict)\n'dFtabFields.Add(\"PreMergedWatershed\",WaterMgDict)\n'dFtabFields.Add(\"POURPNT\",POURPNTDict)\n'dFtabFields.Add(\"POURWSH\",POURWSHDict)\n'dFtabFields.Add(\"NewProj\",NewProjDict)\n'dFtabFields.Add(\"ProjMgr\",ProjMgrDict)\n\n\ndFieldsReturn=Dictionary.Make(1)\n\nfor each sTag in lT
ags\n  dFieldsReturn.Add(sTag,dFtabFields.Get(sTag))\nend\n\nreturn dFieldsReturn \n\n\n"
)

(Script.284
	Name:	"RAS.UTL.Help"
	SourceCode:	"' Name: RAS.UTL.Help\n'*****************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'*****************************************************************\n' Name:         RAS.UTL.Help\n' Self:         none\n' Returns:      none\n' Description:  Starts the help system located in the\n'               default AVHOME\\help directory\n'\n' History:      DDJ; 4/29/98\n'               DDJ; 3/99 - modified
 name and header.\n'*****************************************************************\n \n'AVHOME - path to the ArcView home path\nHelpDir = System.GetEnvVar(\"AVHOME\")\nHelpEnd = FileName.Merge(HelpDir,\"\\HELP\")\nOSType=System.GetOSVariant\nif(OSType=#SYSTEM_OSVARIANT_MSWNT)then \n  system.execute(\"winhlp32.exe\"++HelpEnd.asString+\"\\avras.hlp\")\nelseif(OSType=#SYSTEM_OSVARIANT_MSW95) then\n  system.execute(\"winhelp.exe \"++HelpEnd.asString+\"\\avras.hlp\")\nelse\n  msgbox.info(\"There is no on line help for OS= \"+OSType.AsStr
ing,\"HEC-GeoRAS HELP\")\nend  \n\nreturn nil\n"
)

(Script.285
	Name:	"RAS.UTL.LabelFlowpathsApply"
	SourceCode:	"'RAS.UTL.LabelFlowpath\n'Replaces RAS.UTL.EditFlowpathType CTA 10/5/99\n' Name: RAS.UTL.EditFlowpathType\n' ***************************************************************************\n'              (c) Copyright, 1999\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n' ***************************************************************************\n' Name:          RAS.UTL.LabelFlowpath \n' USAGE:         Called from Tool bar (utility)\n' Returns:       true  - when operation termin
ated successfully\n'                false - failed due to the theme setup (framework)\n'                nil   - failed in some aspect\n' Description:   For selected shapes in the flowpath theme assign flowpath\n'                type (Left, Channel, Right).\n' Calling:       none\n' CalledBy:      Flowpath Tool none\n' Requires:      Framework (RAS.FRM.GetThmsByTagR, etc.)\n' History:       DDJ 3/99\n'                CTA 9/23/99 change to Left, Channel, Right\n'                CTA 10.5.99 make it a tool.apply call\n'  
                  click on flowpath on the fly to label\n' ***************************************************************************\noView = av.GetActiveDoc\n'oDisplay = oView.GetDisplay\noToolBar = av.GetActiveGUI.GetToolBar          ' get the toolbar handle\n\nsTitle = \"HEC-GeoRAS: Editing Flowpath type\"\n\n' Check if there is a Flow Path theme already in the view\n'----------------------------------------------------------\noFPTheme = av.run(\"RAS.FRM.ThmTagMgr\", {\"GetOne\",oView,\"flowpaths\"})\nif (oFPTheme=nil) t
hen\n  ' there is NOT a theme taged with \"flowpaths\".  Give a message and quit\n  sText = \"Flow Path theme is not defined!\"\n  sText = sText + nl + \"Operation cancelled.\"\n  MsgBox.Warning(sText,sTitle)\n  ' unenable the \"I\" tool by enabling the first tool in the toolbar\n  oToolBar.GetControls.Get(0).Select\n  return false  \nend\n\n' There is a theme taged with \"flowpaths\".  Use it for Label editing.\n'------------------------------------------------------------------\noFPFTab = oFPTheme.GetFTab                      
' get theme's FTab\noTypeField = oFPFTab.FindField(\"LineType\")       ' get LineType field handle\n\nif (oTypeField = nil) then\n  ' lets add the field for the user\n  ' ...cuz maybe the data set was \"imported\"  CTA 10.6.99\n   oFPFTab.SetEditable(True)\n   f1=Field.Make(\"LineType\",#FIELD_CHAR,8,0)\n   oFPFTab.AddFields({f1})                        ' add the fields to the table\n   oFPFTab.SetEditable(False)\n   oFPFTab.Flush\n   oTypeField = oFPFTab.FindField(\"LineType\")       ' get LineType field handle\nend\n\n'this bl
ock commented out replaced by add field above CTA 10.6.99\n  ' the field is missing.  Give a message and quit.\n'  sText = \"The flowpath theme does not contain LineType item!\"\n'  sText = sText + nl + \"Operation cancelled.\"\n'  MsgBox.Warning(sText,sTitle)\n'  return false\n'end\n\n' mouse click to get the point - APPLY EVENT!!\npnt = oView.GetDisplay.ReturnUserPoint          ' get the point from the click on the screen\noFPTheme.SelectByPoint(pnt, #VTAB_SELTYPE_NEW)  ' select a line based on the point location\n'oFPF
Tab.UpdateSelection\noView.GetDisplay.Flush                          ' flush to show the selection\noBitMap = oFPFTab.GetSelection\n\n' Ask the user what to assign the selected features as and do the update.\n'------------------------------------------------------------------------\nlLabels = {\"Left\",\"Channel\",\"Right\"}\nsText = \"Enter Flowpath type for selected features:\"\nsResult = MsgBox.ChoiceAsString (lLabels,sText,sTitle)\n\n' check if we got a valid return and update if yes\nif (sResult = nil) then\n    ' cancele
d from the operation - do not change the values\n    return false\n  else\n    ' modify the values\n    oFPFTab.SetEditable(true)\n    for each rec in oBitMap\n      oFPFTab.SetValue(oTypeField,rec,sResult.AsString)\n    end\n    oFPFTab.SetEditable(false)\nend\n\n\n' Done with updates\n'------------------\nreturn true\n\n\n\n"
)

(Script.286
	Name:	"RAS.UTL.LabelFlowPathsClick"
	SourceCode:	"' Name: RAS.UTL.LabelFlowPathsClick\n'modified RAS.UTL.EditIDClick\n' ***************************************************************************\n' ***************************************************************************\n' Name:          RAS.UTL.LabelFlowPathsClick \n' USAGE:         Called from toolbar\n' Returns:       true  - when operation terminated successfully\n'                false - failed due to the theme setup (framework)\n'                nil   - failed in some aspect\n' Description:   Check if the
 flowpaths theme exists and disable the\n'                tool if it does not.\n' Calling:       none\n' CalledBy:      none\n' Requires:      Framework (RAS.FRM.GetThmsByTagR, etc.)\n' History:       DDJ 2/99\n'                CTA 10.5.99\n' ***************************************************************************\n\noView = av.GetActiveDoc                        ' get the view handle\noToolBar = av.GetActiveGUI.GetToolBar          ' get the toolbar handle\n\nsTitle = \"HEC-GeoRAS: Select Flowpaths Theme\"\nbVerify=fal
se                                                               ' to force display of theme selection dialog\n\n'---------------------------------------------------------------------\n' Setup of required lists for use with the framework\n'---------------------------------------------------------------------\n\n' Provide the lists of Tags, ThmTypes, and ShpTypes.\nlTags={\"flowpaths\"}                     'Tags\nlThmTypes={FTheme}                       'ThmTypes\nlShpTypes={\"PolyLine\"}                   'ShpTypes POLY
GON,POLYLINE,POINT,MultiPoint.\n\n' Create the Field descriptions of the required fields.  They are all listed in RAS.PRE.GetdFields\n' script.  This section just loads it from there.\n' Needs to be there even if none are used.\ndFields=av.run(\"RAS.UTL.GetdFields\",{lTags})\nldFields=List.Make\nfor each sTag in lTags\n  ldFields.Add(dFields.Get(sTag))  \nend\n\n' Define the default names.\nlDefNames={\"FPaths\"}                    'Default names\n\n' Define the theme purpose type (input/output)\nlPurposes={\"I\"}\n\n' Overwrite 
options when the specified thm exists in the view, lOverWrt guides the operation.\n'For GTheme, 0=OverWrite,1,2=Prompt for a new name because overwrite is not an option.\n'For FTheme, 0=Clear, 1=Ask For a new Name, 2=Append.\n'lOverWrts is extented to be used for InputThms (used as the output Thm) as well.\n'if 0 then don't ask for a backup, overwrite the input theme with the output theme.\n'if 1 then ask if a backup should be made.\nlOverWrts={2}\n\n  \n' Use the framework to check on the themes and items\n'--------
-------------------------------------------\ndThms=av.run(\"RAS.FRM.GetThmsByTagR\",{oView,lTags,lThmTypes,lShpTypes,ldFields,lDefNames,lPurposes,lOverWrts,bVerify,sTitle})\nif(dThms.is(Dictionary))then\n 'Framework took care of everything\nelse\n\n  ' Problem in returning from checking the themes\n    sText = \"Flow Path theme is not defined!\"\n    sText = sText + nl + \"Operation cancelled.\"\n    MsgBox.Warning(sText,sTitle)\n    ' unenable the \"paths\" tool by enabling the first tool in the toolbar\n    oToolBar.GetCont
rols.Get(0).Select\n    return false\n    \nend\n\nreturn true\n"
)

(Script.287
	Name:	"RAS.UTL.RRIdDialogCancel"
	SourceCode:	"' Name: RAS.UTL.RRIdDialogCancel\n'**********************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'************************************************************************\n' Name:        RAS.UTL.RRIdDialogCancel\n' Usage:       Called from the dialog Cancel button\n' Returns:     List of results in the ModalResult property of the dialog.\n'              The list has the following format
:\n'                  OK/Cancel state (0 - cancel, 1 - OK), river string,\n'                  reach string.\n' Description: Act on Cancel button in the RR Input Form.\n'              If Cancel button was pressed, one element will be in the\n'              returned object.\n' Requires:    Framework.\n' History:     DDJ; 3/99 - original coding\n'************************************************************************\n\nstrErrorTitle = \"River and Reach Definition\"\n\noView = av.GetActiveDoc                          ' def
ine the view\n\n' Generate the result list\ntheList = List.Make\ntheList.Add(0)                                   ' the list contains only 0\n\n' Assign the result list to the dialog property\nself.GetDialog.SetModalResult(theList)\n\n' Close the form\nself.GetDialog.Close\n'av.FindDialog(\"RR_Id\").Close                    ' just another way to identify a dialog\n\nreturn nil\n"
)

(Script.288
	Name:	"RAS.UTL.RRIdDialogOK"
	SourceCode:	"' Name: RAS.UTL.RRIdDialogOK\n'**********************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'************************************************************************\n' Name:        RAS.UTL.RRIdDialogOK\n' Usage:       Called from the dialog OK button\n' Returns:     List of results in the ModalResult property of the dialog.\n'              The list has the following format:\n'         
         OK/Cancel state (0 - cancel, 1 - OK), river string,\n'                  reach string.\n' Description: Act on OK button in the RR Input Form.\n'              If OK button was pressed, there elements will be in the\n'              returned object.\n' Requires:    Framework.\n' History:     DDJ; 3/99 - original coding\n'************************************************************************\n\nstrErrorTitle = \"River and Reach Definition\"\n\noView = av.GetActiveDoc                          ' define the view\n\n' I
dentify the combo box objects\n'cmbbRiver = av.FindDialog(\"RR_Id\").FindByName(\"cbRiver\")\ntxtbRiver = av.FindDialog(\"RR_Id\").FindByName(\"txtRiver\")\ntxtbReach = av.FindDialog(\"RR_Id\").FindByName(\"txtReach\")\n\n' Retreive the defined rivers/reaches\n'sRiver = cmbbRiver.GetCurrentValue.AsString\nsRiver = txtbRiver.GetText\nsReach = txtbReach.GetText\n\n' Generate the result list\ntheList = List.Make\ntheList.Add(1)\ntheList.Add(sRiver)\ntheList.Add(sReach)\n\n' Assign the result list to the dialog property\nself.GetDialog.Set
ModalResult(theList)\n\n' Close the form\nself.GetDialog.Close\n'av.FindDialog(\"RR_Id\").Close\n\nreturn nil\n"
)

(Script.289
	Name:	"RAS.UTL.RRIdDialogOpen"
	SourceCode:	"' Name: RAS.UTL.RRIdDialogOpen\n'********************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'********************************************************************\n' Name:         RAS.UTL.RRIdDialogOpen\n' Usage:        Called when River and Reach Dialog is opened.\n' Returns:      none\n' Description:  Display the RR ID Form, generates the list of unique\n'               river entries, 
and populates the dialog with current\n'               values (if any) for river and reach ID.\n'               The dialog object tag contains the FTab to work with\n'               and the currently selected set (record) in it.\n' Requires:     Framework.\n' History:      DDJ; 3/99  -  Original coding\n'********************************************************************\n\n' Identify the view, and the dialog and its elements\ntheView = av.GetActiveDoc                           ' get the view\noDialogRRId = av.FindD
ialog(\"RR_Id\")                ' get the dialog\ncmbbRiver = oDialogRRId.FindByName(\"cbRiver\")       ' get the river combo box\ntxtbRiver = oDialogRRId.FindByName(\"txtRiver\")      ' get the river text box\ntxtbReach = oDialogRRId.FindByName(\"txtReach\")      ' get the reach text box\n\n' Specify the field from which to populate the river list and the current selected record\nlDialogData = oDialogRRId.GetObjectTag\noFTab = lDialogData.Get(0)                          ' retrieve the stream centerline FTab object\nbitmap
Selected = lDialogData.Get(1)                 ' retrieve the bitmap for currently selected recordset\noSIDField = oFTab.FindField(\"Stream_ID\")            ' get STREAM_ID field handle\noRIDField = oFTab.FindField(\"Reach_ID\")             ' get REACH_ID field handle\n\n' Create a list of all the rivers in the view\nlstRivers = list.Make\nfor each rec in oFTab\n  sStreamID = oFTab.ReturnValue(oSIDField,rec)      ' get the river value\n  iLoc = lstRivers.FindByValue (sStreamID)          ' get the location of the river s
tring\n  if (iLoc = -1) then                               ' check if river already in the list\n    ' the river is not in the list - add it\n    lstRivers.Add(sStreamID)\n  end\nend\n\n' Identify the current values for stream and reach ID for the selected record\nfor each rec in bitmapSelected  \n  sReachID = oFTab.ReturnValue(oRIDField,rec)\n  sStreamID = oFTab.ReturnValue(oSIDField,rec)\nend\n\n' Assign existing values to dialog elements\ntxtbRiver.SetText(sStreamID)\ntxtbReach.SetText(sReachID)\ncmbbRiver.DefineFromLis
t(lstRivers)\n\n\nreturn nil\n\n"
)

(Script.290
	Name:	"RAS.UTL.RRIdListSelect"
	SourceCode:	"' Name: RAS.UTL.RRIdListSelect\n'**********************************************************************\n'              (c) Copyright, 1998\n' Environmental Systems Research Institute, Inc.\n'              All Rights Reserved\n'************************************************************************\n' Name:        RAS.UTL.RRIdListSelect\n' Usage:       Called when a selection is made in the combo box\n' Returns:     none\n' Description: Act when a river is selected from the list in the RR Input Form.\n' Requires:   
 Framework.\n' History:     DDJ; 3/99 - original coding\n'************************************************************************\n\n' Identify the combo box objects\ncmbbRiver = av.FindDialog(\"RR_Id\").FindByName(\"cbRiver\")\ntxtbRiver = av.FindDialog(\"RR_Id\").FindByName(\"txtRiver\")\ntxtbReach = av.FindDialog(\"RR_Id\").FindByName(\"txtReach\")\n\n' Update the value\ntxtbRiver.SetText(cmbbRiver.GetCurrentValue.AsString)\n\n\nreturn nil\n"
)

