'---------------------------------
'Name: Grid.AddGridsAvl
'Date: 1-17-01
'Author: Marco Morais
'
' prompts the user for grids on disk
'
' prompts the user for a single avl file
'
' loads all grids into a new view and assigns
' legend from avl file
'
'Returns:
'NILL
'
'Called By:
'MANY
'
'Calls:
'View.ZoomFullExtentArgs
'
'Arguments:
'None
'---------------------------------
MsgBox.Report("Grid.AddGridsAvl" + NL +
"1. prompts the user for grids on disk" + NL +
"2. prompts the user for a single avl file on disk" + NL +
"3. loads all grids into a new view with legend from avl", "About Script....")
'---------------------------------------
'retrieve list of grids to load
'---------------------------------------
theGridsSrcNameList = SourceDialog.ShowClass("Select the Grid(s) to load into a new view", Grid)
if ( theGridsSrcNameList.Count = 0 ) then
return NIL
end
'---------------------------------------
'retrieve avl file
'---------------------------------------
theAvlFileNameList = FileDialog.ReturnFiles({"*.avl"}, {"ArcView Legend Files(*.avl)"},
"Select the ArcView Legend to Display Grids", 0)
if ( theAvlFileNameList.Count <> 1 ) then
return NIL
end
theAvlFileName = theAvlFileNameList.Get(0)
'---------------------------------------
'make grids from srcnames
'---------------------------------------
theGridsList = List.Make
for each srcn in theGridsSrcNameList
theGrid = Grid.Make(srcn)
if ( theGrid.HasError ) then
MsgBox.Error("Grid not created:" ++ srcn.GetName, "Error")
continue
end
theGridsList.Add(theGrid)
end
'---------------------------------------
'add grids to new view
'---------------------------------------
theNewView = View.Make
theNewView.GetWin.Open
for each g in theGridsList
theGTheme = GTheme.Make(g)
theNewView.AddTheme(theGTheme)
theLegend = theGTheme.GetLegend
theLegend.Load(theAvlFileName, #LEGEND_LOADTYPE_ALL)
theGTheme.SetLegendVisible(FALSE)
theGTheme.UpdateLegend
theGTheme.SetVisible(TRUE)
theNewView.InvalidateTOC(theGTheme)
end
av.Run("View.ZoomFullExtentArgs", theNewView)
av.PurgeObjects
return NIL
Last Updated: Marco Morais