/3.2 (Extension.1 Name: "NHD Watershed Characteristics" FirstRootClassName: "Butn" Roots: 2 Roots: 4 Roots: 5 Roots: 6 Roots: 7 Roots: 8 Roots: 9 Roots: 10 Roots: 11 Roots: 12 Roots: 13 Roots: 14 Version: 32 About: "The NHD Watershed Characteristics extension allows users to summarize watershed characteristics of choice in newly delineated watersheds." InstallScript: 15 UninstallScript: 16 ) (Butn.2 Disabled: 1 Help: "Summarize Watershed Characteritics of Interest // Summarize Watershed Characteristics of Interest" Update: "NHDBASIN.btnBasinCharacteristicsUpdate" Icon: 3 Click: "NHDBASIN.btnBasinCharacteristicsClick" ) (AVIcon.3 Name: "wc.bmp" Data: 4e442049 6d616765 00010018 00180000 Data: 02400e0e 0e0e0e0e 0e0e0e0e 0e0e0e0e Data: 0e0e0e0e 0e0e0e0e 0e0e0e0e 0e0e0e0e Data: 0e0e0e0e 0e0e0e0e 0e0e0e0e 0e0e0e0e Data: 0e0e0e0e 0e0e0e0e 0e0e0e0e 0e0e0e0e Data: 0e0e0e0e 0e0e0e0e 0e0e0e0e 0e0e0e0e Data: 0e0e0e0e 0e0e0e0e 0e0e0e0e 0e0e0e0e Data: 0e0e0e0e 0e0e0e0e 0e0e0e0e 0e0e0e0e Data: 0e0e0e0e 0e0e0e0e 0e0e0e0e 0e0e0e0e Data: 0e0e0e0e 0e0e0e0e 0e0e1414 14140e0e Data: 0e0e0e0e 0e0e0e0e 0e0e0e0e 0e0e0e0e Data: 0e14140e 0e14140e 0e0e0e0e 0e0e0e0e Data: 0e0e0e0e 0e0e0e0e 14140e0e 0e0e0e0e Data: 0e0e0e0e 0e0e0e0e 0e0e0e0e 0e0e0e0e Data: 14140e0e 0e0e0e0e 0e0e0e0e 0e0e0e0e Data: 0e0e0e0e 0e0e0e0e 14140e0e 0e0e0e0e Data: 0e0e0e0e 0e0e0e0e 0e0e0e0e 0e0e0e0e Data: 14140e0e 0e0e0e0e 0e0e0e0e 0e0e0e0e Data: 0e0e0e0e 0e0e0e0e 14140e0e 0e0e0e0e Data: 0e0e0e0e 0e0e0e0e 0e0e0e0e 0e0e0e0e Data: 0e14140e 0e14140e 0e0e0e0e 0e0e0e14 Data: 140e0e0e 0e0e1414 0e0e1414 14140e0e Data: 0e0e0e0e 0e0e1414 14140e0e 0e141414 Data: 140e0e0e 0e0e0e0e 0e0e0e0e 0e0e1414 Data: 0e14140e 14140e14 140e0e0e 0e0e0e0e Data: 0e0e0e0e 0e14140e 0e14140e 14140e0e Data: 14140e0e 0e0e0e0e 0e0e0e0e 0e14140e Data: 0e0e1414 140e0e0e 14140e0e 0e0e0e0e Data: 0e0e0e0e 14140e0e 0e0e1414 140e0e0e Data: 0e14140e 0e0e0e0e 0e0e0e0e 14140e0e Data: 0e0e0e14 0e0e0e0e 0e14140e 0e0e0e0e Data: 0e0e0e0e 0e0e0e0e 0e0e0e0e 0e0e0e0e Data: 0e0e0e0e 0e0e0e0e 0e0e0e0e 0e0e0e0e Data: 0e0e0e0e 0e0e0e0e 0e0e0e0e 0e0e0e0e Data: 0e0e0e0e 0e0e0e0e 0e0e0e0e 0e0e0e0e Data: 0e0e0e0e 0e0e0e0e 0e0e0e0e 0e0e0e0e Data: 0e0e0e0e 0e0e0e0e 0e0e0e0e 0e0e0e0e Data: 0e0e0000 00700000 00008080 80000000 Data: 80000080 80000080 00008080 00008000 Data: 00008000 80004080 80004040 0000ff80 Data: 00008040 0000ff00 40000040 8000ffff Data: ff00c0c0 c0000000 ff0000ff ff0000ff Data: 0000ffff 0000ff00 0000ff00 ff0080ff Data: ff0080ff 0000ffff 8000ff80 80008000 Data: ff004080 ff000002 00080007 00200001 Data: 00020000 00000000 0000 ) (Choice.4 Tag: "9999" Update: "NHDBASIN.menuSelectDataLocationUpdate" Label: "Select Watershed Characteristics Support Data Location" Click: "NHDBASIN.menuSelectDataLocationClick" Shortcut: "Keys.None" ) (Choice.5 Update: "NHDBASIN.menuClearDataLocationUpdate" Label: "Clear Watershed Characteristics Support Data Location" Click: "NHDBASIN.menuClearDataLocationClick" Shortcut: "Keys.None" ) (Script.6 Name: "NHDBASIN.btnBasinCharacteristicsClick" SourceCode: "'Name: NHDBASIN.btnBasinCharactisticsClick\n'Purpose: Coordinate the calculation and application of the basin characteristics\n'Author: Jen Hill, Horizon Systems Corporation\n'Date: March 2002\n'Input Parameters: None\n'Input Files: None\n'Output Parameters (Return Values): None\n'Output Files: None\n'Calls: None\n'Called By: ArcView when the basin charactistics button is clicked\n'Globals: None\n'Locals: \n'Notes: None\n'------------------------------------------------------------------------\n'Revision Author:\n'Revisi on Date:\n'Revision Notes:\n'------------------------------------------------------------------------\n'\n\n'Call the project-specific basin characteristics calculation script\n\nlistBasinCharacteristics = av.run(\"NHDBASIN.ProjectCalculateBasinCharacteristics\",{})\n\n'listBasinCharacteristics contains ...\n' 0 - numSq_miles\n' 1 - numPercentWB\n' 2 - numPercentGT1200\n' 3 - numNorthing\n' 4 - numMeanPrecip\n\n'Call the project-specific basin characteristics application script\n\nav.run(\"NHDBASIN.ProjectUseBC\",listBasinC haracteristics)\n" ) (Script.7 Name: "NHDBASIN.btnBasinCharacteristicsUpdate" SourceCode: "'Name: NHDBASIN.btnBasinCharactisticsUpdate\n'Purpose: Enable the Basin Charactistics Button if appropriate.\n'Author: Jen Hill, Horizon Systems Corporation\n'Date: March 2002\n'Input Parameters: None\n'Input Files: None\n'Output Parameters (Return Values): None\n'Output Files: None\n'Calls: None\n'Called By: ArcView when the view is updated \n'Globals: None\n'Locals: \n'Notes: None\n'------------------------------------------------------------------------\n'Revision Author:\n'Revision Date:\n'Revision Notes:\n'---------- --------------------------------------------------------------\n'\n\n\n\nviewCurrent= av.GetActiveDoc\nif (viewCurrent.FindTheme(\"Watershed Tool Results\") <> Nil) then\n SELF.SetEnabled(true)\nelse\n SELF.SetEnabled(false)\nend\n\n" ) (Script.8 Name: "NHDBASIN.menuClearDataLocationClick" SourceCode: "'Name: NHDBASIN.menuSelectDataLocationClick\n'Purpose: Identify the location of the basin characteristics support data\n'Author: Jen Hill, Horizon Systems Corporation\n'Date: March 2002\n'Input Parameters: None\n'Input Files: None\n'Output Parameters (Return Values): None\n'Output Files: None\n'Calls: None\n'Called By: ArcView when the menu choice is selected. \n'Globals: None\n'Locals: \n'Notes: None\n'------------------------------------------------------------------------\n'Revision Author:\n'Revision Date:\n'Revision Notes:\n'------------------------------------------------------------------------\n'\n\n'Store the path in the NHD Tools SEd (dictionary)\nav.run(\"NHDZCOMMON.StoreValue\",{\"NHDBASINDATALOCATION\", Nil})\n \n" ) (Script.9 Name: "NHDBASIN.menuClearDataLocationUpdate" SourceCode: "'Name: NHDBASIN.menuClearDataLocationClick\n'Purpose: Enable or disable the Clear Basin Characteristics Support Data Location Menu Option\n'Author: Jen Hill, Horizon Systems Corporation\n'Date: March 20021\n'Input Parameters: None\n'Input Files: None\n'Output Parameters (Return Values): None\n'Output Files: None\n'Calls: None\n'Called By: ArcView when the view is updated. \n'Globals: None\n'Locals: \n'Notes: None\n'------------------------------------------------------------------------\n'Revision Author:\n'Revision Dat e:\n'Revision Notes:\n'------------------------------------------------------------------------\n'\nSELF.SetEnabled(True)\n\n\n" ) (Script.10 Name: "NHDBASIN.menuNHDWatershedCharacteristicsHelp" SourceCode: "'Name: NHDBASIN.menuNHDWatershedCharacteristicsHelp\n'Purpose: Display the NHD Watershed Characteristics Help file\n'Author: Pete Steeves\n'Date: September 2003\n'Input Parameters: None\n'Input Files: None\n'Output Parameters (Return Values): None\n'Output Files: None\n'Calls: \n'Called By: \n'Globals: None\n'Locals: \n'Notes: None\n'------------------------------------------------------------------------\n'Revision Author:\n'Revision Date:\n'Revision Notes:\n'---------------------------------------------------------------- --------\n\n\nwinCurrent = av.GetActiveWin\nguiCurrent = av.GetProject.GetSelectedGUI\ndocCurrent = av.GetActiveDoc\n\nstrParameter = av.run(\"NHDZCOMMON.GetNHDToolsPath\",\"\") + \"\\nhdwatershedcharacteristics\\nhd watershedcharacteristics.chm\"\n\nsystem.execute(\"hh \" + strParameter)\n \n\nav.GetProject.SetSelectedGUI( guiCurrent )\nwinCurrent.Activate\ndocCurrent.GetWin.Activate\n\n" ) (Script.11 Name: "NHDBASIN.menuSelectDataLocationClick" SourceCode: "'Name: NHDBASIN.menuSelectDataLocationClick\n'Purpose: Identify the location of the basin characteristics support data\n'Author: Jen Hill, Horizon Systems Corporation\n'Date: March 2002\n'Input Parameters: None\n'Input Files: None\n'Output Parameters (Return Values): None\n'Output Files: None\n'Calls: None\n'Called By: ArcView when the menu choice is selected. \n'Globals: None\n'Locals: \n'Notes: None\n'------------------------------------------------------------------------\n'Revision Author:\n'Revision Date:\n'Revision Notes:\n'------------------------------------------------------------------------\n'\n\nfnamePath = FileDialog.Show(\"openme.txt\", \"openme.txt\", \"Please select the Openme.txt file under the Watershed Support Directory\")\n'msgbox.info(fnamePath.asstring,\"\")\nif (fnamePath <> Nil) then\n\n fnamePath = filename.GetCwd\n\n 'Store the path in the NHD Tools SEd (dictionary)\n av.run(\"NHDZCOMMON.StoreValue\",{\"NHDBASINDATALOCATION\", fnamePath})\n \n 'msgbox.info(fnamePath.asstring,\"\")\nend\n" ) (Script.12 Name: "NHDBASIN.menuSelectDataLocationUpdate" SourceCode: "'Name: NHDBASIN.menuSelectDataLocationUpdate\n'Purpose: Enable or disable the Select Basin Characteristics Data Location menu option\n'Author: Jen Hill, Horizon Systems Corporation\n'Date: March 2002\n'Input Parameters: None\n'Input Files: None\n'Output Parameters (Return Values): None\n'Output Files: None\n'Calls: None\n'Called By: ArcView when the view is updated. \n'Globals: None\n'Locals: \n'Notes: None\n'------------------------------------------------------------------------\n'Revision Author:\n'Revision Date:\n'Re vision Notes:\n'------------------------------------------------------------------------\n'\nSELF.SetEnabled(True)\n\n" ) (Script.13 Name: "NHDBASIN.ProjectCalculateBasinCharacteristics" SourceCode: "'Name: NHDBASIN.ProjectCalculateBasinCharacteristics\n'Purpose: Calculate the project specific basin charactistics\n'Author: Jen Hill, Horizon Systems Corporation\n'Date: March 2002\n'Input Parameters: None\n'Input Files: None\n'Output Parameters (Return Values): None\n'Output Files: None\n'Calls: None\n'Called By: NHDBASIN.btnBasinCharacteristicsClick\n'Globals: None\n'Locals: \n'Notes: None\n\n'------------------------------------------------------------------------\n'Revision Author: Peter Steeves, US Geological Surve y\n'Revision Date: 9/30/02\n'Revision Notes: The 5 sample characteristic summaries below are a diverse\n' range of calculation types to give users a few examples for calculating their\n' own characteristics. Each characteristic summary is headed by a text section\n' explaining what is being calculated, and how the user could modify the characteristic\n' for their own project. \n'------------------------------------------------------------------------\n'\n'----------------------------------------------------------- -------------\n'Revision Author:\n'Revision Date:\n'Revision Notes:\n'------------------------------------------------------------------------\n'\n\n\nav.ShowMsg(\"Calculating basin characteristics\")\n\nviewCurrent = av.GetActiveDoc\nstrWatershed = \"Watershed Tool Results\"\nlistReach = av.run(\"NHDZCOMMON.RetrieveValue\",\"NHDWSSELECTEDREACH\")\n'listReach contains:\n' 0 record number\n' 1 com_id\n' 2 rch_code\n' 3 measure\n' 4 theme name\n \n'Gather some information that will be necessar y for several of the basin charactistics \n\n'Get information about the delineated watershed \n themeWS = viewCurrent.FindTheme(strWatershed)\n vtabWS = themeWS.GetFtab\n 'There will be only one record\n for each objRec in vtabWS\n 'Get the sq_km \n numWSSq_km = vtabWS.ReturnValue(vtabWS.FindField(\"sq_km\"),objRec)\n 'Get the shape\n shpWS = vtabWS.ReturnValue(vtabWS.FindField(\"shape\"),objRec)\n end\n 'msgbox.info(\"1\",\"\")\n \n'Get information about the location of th e basin characteristics supporting data location\n fnamePath = av.Run(\"NHDZCOMMON.RetrieveValue\",\"NHDBASINDATALOCATION\")\n if (fnamePath = Nil) then\n return nil\n end\n 'msgbox.info(\"2\",\"\")\n\n'Set the analysis environment \n ae=viewCurrent.GetExtension(AnalysisEnvironment)\n ae.setExtent(#ANALYSISENV_VALUE,shpWS.ReturnExtent)\n ae.Activate\n Grid.SetAnalysisCellSize(#GRID_ENVTYPE_VALUE,10)\n 'msgbox.info(\"3\",\"\")\n\n'1. Area in square miles\n\n' By default NHD Watershed should be calculating basin area in square \n' kilometers. This example shows a simple conversion of that value to square miles.\n' The 'numSq_miles' is the only line of code in this section, and would need to be \n' modified for other area measurements (i.e. square feet).\n\n\n 'Convert from sq_km to sq miles\n 'To convert sq_km into sq miles multiply sq_km by .3861\n\n numSq_miles = numWSSq_km * 0.3861\n 'msgbox.info(\"4\",\"\")\n\n'2. Percent of area that is waterbodies (lakes,ponds, and reservoirs)\n\n' This is an example of how to use N HD to calculate a summary statistic, in\n' this case, area of waterbodies (lakes and ponds). \n\n strLinearReachThemeName = listReach.Get(4)\n strWBReachThemeName = strLinearReachThemeName.\n Substitute(\"Reach\",\"Waterbody Reach\").\n Substitute(\"nhd.route.rch\",\"nhd.region.rch\")\n themeWBR = viewCurrent.FindTheme(strWBReachThemeName)\n \n if (themeWBR <> Nil) then\n \n 'Get the current waterbody reach selection\n vtabWBR = themeWBR.GetFtab\n bmpTe mp = vtabWBR.GetSelection\n\n 'Select the waterbody reaches in the watershed shape\n themeWBR.SelectByShapes({shpWS},#VTAB_SELTYPE_NEW) \n\n numWBRSq_km = 0\n 'Add the sq_km for selected wbs \n for each objRec in vtabWBR.GetSelection\n numWBRSq_km = numWBRSq_km + vtabWBR.ReturnValue(vtabWBR.FindField(\"sq_km\"),objRec)\n end\n\n 'Reset the waterbody reach selection\n vtabWBR.SetSelection(bmpTemp)\n vtabWBR.UpdateSelection\n \n numPercentWB = (numWBRSq_km / numWSSq_km) * 100\n \n else\n \n 'TODO - the waterbody reach theme has not been added via NHD load. Add it temporarily. \n \n end\n 'msgbox.info(\"5\",\"\")\n \n'3. Percent (%) of basin greater than 1200 feet.\n\n' This example shows how to use a grids \"value\" attribute to summarize areas in percent.\n' The grid (grid_1200ft) is divided into cells < 1200 feet (value = 1) \n' and cells > 1200 feet (value = 2). \n\n 'Create theme and grid objects for the grid_1200\n srcn ame1200 = grid.MakeSrcName(fnamePath.AsString +\"\\grid_1200ft\")\n theme1200 = theme.make( srcname1200 )\n grid1200 = theme1200.GetGrid\n 'viewCurrent.AddTheme(theme1200)\n \n 'Get the intersection of the watershed polygon and the grid\n gridPartial = grid1200.ExtractByPolygon(shpWS, prj.MakeNull, false) \n themePartial = gtheme.make(gridPartial)\n 'viewCurrent.AddTheme(themePartial)\n \n 'Get the counts for values for 1 and 2\n ftabPartial = themePartial.GetVtab\n num1 = 0\n num2 = 0\n for eac h objRec in ftabPartial\n if (ftabPartial.ReturnValue(ftabPartial.FindField(\"value\"),objRec) = 1) then\n num1 = ftabPartial.ReturnValue(ftabPartial.FindField(\"count\"),objRec)\n end\n if (ftabPartial.ReturnValue(ftabPartial.FindField(\"value\"),objRec) = 2) then\n num2 = ftabPartial.ReturnValue(ftabPartial.FindField(\"count\"),objRec)\n end\n end\n \n numPercentGT1200 = (num2 / (num1 + num2) ) * 100\n 'msgbox.info(\"6\",\"\")\n \n \n'4. The northing (GetY) coordinate of the cent roid of the basin. \n\n' Note: calculating this characteristic includes calling a second script \"NHDBASIN.ProjectPolyCent\" \n \n themeCentroid = av.run(\"NHDBASIN.ProjectPolycent\",{viewCurrent,strWatershed})\n ftabCentroid = themeCentroid.GetFtab\n for each objRec in ftabCentroid\n shpCentroid = ftabCentroid.ReturnValue(ftabCentroid.FindField(\"shape\"),objRec)\n end\n numNorthing = shpCentroid.GetY\n 'msgbox.info(\"7\",\"\")\n \n'5. Mean annual precipitation.\n\n' This example shows how to extract def ault statistics of an integer grid, in\n' this case a precipitation grid. The grid name here is \"precip_grid\".\n\n 'Create theme and grid objects for the grid_1200\n srcnamePrecip = grid.MakeSrcName(fnamePath.AsString +\"\\precip_grd\")\n themePrecip = theme.make( srcnamePrecip )\n gridPrecip = themePrecip.GetGrid\n 'viewCurrent.AddTheme(themePrecip)\n \n 'Get the intersection of the watershed polygon and the grid\n gridPartial = gridPrecip.ExtractByPolygon(shpWS, prj.MakeNull, false) \n themePartia l = gtheme.make(gridPartial)\n 'viewCurrent.AddTheme(themePartial)\n \n listStatistics = gridPartial.GetStatistics\n \n numMeanPrecip = listStatistics.Get(2)\n 'msgbox.info(\"8\",\"\")\n\n\n\n \nlistBasinCharacteristics = list.Make\nlistBasinCharacteristics.Add(numSq_miles)\nlistBasinCharacteristics.Add(numPercentWB)\nlistBasinCharacteristics.Add(numPercentGT1200)\nlistBasinCharacteristics.Add(numNorthing)\nlistBasinCharacteristics.Add(numMeanPrecip)\n\n \n' The commented out lines below can be uncommented to vie w a message box\n' of your results. First, modify the variables to work with your watershed characteristics \n'msgbox.info(\"Square Miles: \" + numSq_miles.AsString + NL +\n' \"Percent WBs: \" + numPercentWB.AsString + NL +\n' \"Percent > 1200: \" + numPercentGT1200.AsString + NL +\n' \"Northing: \" + numNorthing.AsString + NL +\n' \"Mean Annual Precip: \" + numMeanPrecip.AsString,\"\") \n\n\nav.ShowMsg(\"\")\n\nreturn listBasinCharacterist ics\n" ) (Script.14 Name: "NHDBASIN.ProjectUseBC" SourceCode: "'Name: NHDBASIN.ProjectUseBC\n'Purpose: Use the basin charactistics.\n'Author: Jen Hill, Horizon Systems Corporation\n'Date: September 2002\n'Input Parameters: None\n'Input Files: None\n'Output Parameters (Return Values): None\n'Output Files: None\n'Calls: None\n'Called By: NHDBASIN.btnBasinCharactisticsClick\n'Globals: None\n'Locals: \n'Notes: None\n'------------------------------------------------------------------------\n'Revision Author:\n'Revision Date:\n'Revision Notes:\n'--------------------------------------------- ---------------------------\n'\nlistBasinCharacteristics = SELF\n\n'Call the project-specific basin characteristics application script\n'Below is an example\n\n'av.run(\"NHDBASIN.ProjectCallFortran\",listBasinCharacteristics)\n" ) (Script.15 Name: "nbas.Install" SourceCode: "'Name: NWS.Install\n'Purpose: Install the NHD Watershed Characteristics extension.\n'Author: Jennifer Hill\n'Date: June 2000\n'Input Parameters: None\n'Input Files: None\n'Output Parameters (Return Values): None\n'Output Files: None\n'Calls: $AVEXT//nhdtools.ini\n' strNHDTools + \"\\nhdzcommon\\nhdzcommon.avx\"\n' NHDZCOMMON.menuNHD_Tools \n' NHDZCOMMON.menuNHDAbout\n' NHDZCOMMON.viewBarMenuCheck\n'Called By: ArcView when the extension load occurs\n'Globals: None\n'Locals:\n' docCurrent - Generic document object representing the current active document\n' winCurrent - window object identifying the current window\n' guiCurrent - gui object representing the current GUI\n' ndictExtensions - Name dictionary of currently loaded extensions\n' listExtensions - List of currently loaded extensions (created from the name\n' dictionary)\n' lfINI - Line file object representing NHDTOOLS.INI\n' strNHDTools - String object representing path to T he NHD ArcView Toolkit\n' fnameNHDZCommon - Filename opject for NHDZCommon\n' extNHDZCommon - Extension object for NHDZCommon\n' prjCurrent - Project object for the current project\n' guiView - GUI object for the 'View' GUI\n' listMenuNHD_Tools - List returned from the NHDZCommon.menuNHD_Tools script\n' listGUIs - List of existing GUIs\n' objGUI - GUI object used in stepping through a list of GUIs\n' mbarClass - Menubar object for the current GUI\n' menu ClassHelp - Menu object for the 'Help' menu if there is one.\n' listHelpControls - List of control (choices) in the Help menu\n' numObj - Temporary number object\n' numPos - Another temporary number object. Both numObj and numPos are\n' used to find the separator and position the NHD Watershed Characteristics Help\n' menu choice\n' objCtrl - Control object used in stepping through a list of controls\n' choiceNew - Menu choice for 'NHD Watershed Ch aracteristics Help'\n'Notes: None\n'------------------------------------------------------------------------\n'Revision Author:\n'Revision Date:\n'Revision Notes:\n'------------------------------------------------------------------------\nndictExtensions = Extension.GetExtensions\nlistExtensions = ndictExtensions.ReturnKeys\n'for each i in listExtensions\n' msgbox.info(i.asstring,\"\")\n'end\n\n'Make sure NHDZCOMMON is present.\n\n'TODO - may also want to check for NHD Load and NHD Navigate\n\nif ( listExtensions.FindByValu e(\"NHDZCommon\") = -1 ) then\n lfINI = LineFile.Make ( \"$AVEXT//nhdtools.ini\".asfilename, #FILE_PERM_READ )\n 'msgbox.info(\"lfINI opened\",\"info\")\n if (lfINI = NIL) then\n 'msgbox.info(\"The Arcview\\\\Ext32\\NHDTools.ini file was not opened, unable to install NHD Watershed Characteristics.\",\"NHD Watershed Characteristics\")\n 'msgbox.info(\"NHD Watershed Characteristics did not install correctly. Please make sure the NHD ArView Toolkit is installed properly. If you cannot resolve this problem, contac t nhd@usgs.gov.\",\"NHD Load/Unload Workspace\")\n else\n strNHDTools = lfINI.ReadElt\n lfINI.Close\n if (strNHDTools <> Nil) then\n if (strNHDTools = \"!NETWORK!\") then\n strNHDTools = system.GetEnvVar(\"AVEXT\") + \"\\NHDToolkit\"\n end\n fnameNHDZCommon = (strNHDTools + \"\\Nhdzcommon\\nhdzcommon.avx\").asfilename\n extNHDZCommon = extension.open(fnameNHDZCommon)\n ndictExtensions = Extension.GetExtensions\n listExtensions = ndictExtensions.ReturnKeys\n if (extNHDZCommon <> Nil) then\n 'msgbox.info(\"NHDZCommon was loaded\",\"\")\n \n else\n msgbox.info(\"NHD Watershed Characteristics did not install correctly. Please make sure the NHD ArcView Toolkit is installed properly. If you cannot resolve this problem, contact nhd@usgs.gov.\",\"NHD Watershed Characteristics\")\n 'msgbox.info(\"NHDZCommon was NOT loaded\",\"\")\n SELF.Unload\n return(Nil)\n end\n end\n end\nend\n\n\nprjCurrent = av.Get Project\nif ( (prjCurrent <> Nil) and\n (listExtensions.FindByValue(\"NHDZCommon\") <> -1) ) then\n\n 'Now check Arcview version number and check for a View GUI\n avVersion = av.getversion\n if ((avVersion.left(3).asnumber < 3.1) or (av.getproject.findgui(\"view\") = nil)) then\n if (avVersion.left(3).asnumber < 3.1) then\n msgbox.info(\"Sorry, NHD Watershed Characteristics only works on ArcView version 3.1 or higher.\",\"NHD Watershed Characteristics\")\n end\n if (av.getproject.findgui(\"view \") = nil) then\n msgbox.info(\"Sorry, you must have the View Interface in this project in order to add this extension.\",\n \"NHD Watershed Characteristics\")\n end\n \n self.unload\n return nil\n end\n\n guiView = prjCurrent.FindGUI( \"View\" )\n\n if (guiView <> nil) Then\n \n listMenuNHD_Tools = av.run(\"NHDZCOMMON.menuNHD_Tools\",{\"LOAD\",{SELF.Get(1), SELF.Get(2)},400} )\n if (listMenuNHD_Tools.get(0) > 1) then \n ' No controls loaded\n 'msgbox.info(\"Warning: The re was a problem loading the controls for the NHD Watershed Characteristics extension. \"+\n ' \"Perhaps the tools for this extension already exist in this project?\",\n ' \"NHD Watershed Characteristics\")\n end\n if (listMenuNHD_Tools.get(0) = 1) then \n ' Some controls loaded\n 'msgbox.info(\"Warning: There was a problem loading some controls for the NHD Watershed Characteristics extension. \"+\n ' \"Perhaps the tools for this extension already exist in this project?\",\n ' \"NHD Watershed Characteristics\")\n end\n\n 'Add the button\n guiView.GetButtonBar.Add(SELF.Get(0), guiView.GetButtonBar.GetControls.Count)\n \n av.run(\"NHDZCOMMON.menuNHDAbout\", {\"LOAD\",{\"NHDWCharacteristics\", \n \"The NHD Watershed Characteristics extension is designed to allow users \" +\n \"to ????. \", \n \"USGS\",\n \"\",\n \"1.0.0b1\",\n \"\"} } )\n \n \n 'Do not need any of this at the moment since there is no help \n listGUIs = prjCurrent.GetGUIs\n for each objGUI in listGUIs\n if ( (objGUI.AsString = \"View\") or\n (objGUI.AsString = \"Table\") or\n (objGUI.AsString = \"Chart\") or\n (obj GUI.AsString = \"Layout\") or\n (objGUI.AsString = \"Script\") or\n (objGUI.AsString = \"Project\") or\n (objGUI.AsString = \"Appl\") ) then\n mbarClass = prjCurrent.FindGUI(objGUI.asstring).GetMenuBar\n menuClassHelp = mbarClass.FindByLabel(\"Help\")\n listHelpControls = menuClassHelp.GetControls\n numObj = -1\n for each objCtrl in listHelpControls\n numObj = numObj + 1\n 'msgbox.info(objCtrl.getHelp.asstr ing,\"\")\n if (objCtrl.GetClass.GetClassName = \"Space\") then\n numpos = numObj-1\n end \n end\n \n if (menuClassHelp <> Nil) then\n 'See if the help menu contains an About NHD Tools option\n 'if not, add one\n if (menuClassHelp.FindByLabel(\"NHD Watershed Characteristics Help\") = Nil) then\n choiceNew = choice.Make\n choiceNew.SetLabel(\"NHD Watershed Characteristics Help\")\n choiceNew.SetHelp(\"Provides information regarding the NHD Watershed Characteristics Extension.\")\n choiceNew.SetClick(\"NHDBASIN.menuNHDWatershedCharacteristicsHelp\")\n menuClassHelp.Add(choiceNew,numPos)\n end\n end\n end\n end\n\n 'Verify that everything will fit on the screen\n av.run(\"NHDZCOMMON.viewBarMenuCheck\",{\"BARMENUCHECK\",\n { {\"View\",{\"Help\"},true,false},\n {\"Table\",{\"Help\"},f alse,false},\n {\"Chart\",{\"Help\"},false,false},\n {\"Layout\",{\"Help\"},false,false},\n {\"Script\",{\"Help\"},false,false},\n {\"Project\",{\"Help\"},false,false},\n {\"Appl\",{\"Help\"},false,false} } } )\n \n av.GetProject.SetSelectedGUI( av.GetProject.FindGUI(\"View\") )\n \n end\n\nelse\n\n if (prjCurrent = Nil) then\n msgbox.info(\"There is no project open. The NHD Watershed Charac teristics extension cannot be loaded unless there is an open project.\",\"NHD Watershed Characteristics\")\n elseif (listExtensions.FindByValue(\"NHDZCommon\") = -1) then\n msgbox.info(\"NHD Watershed Characteristics did not install correctly. Please make sure the NHD ArcView Toolkit is installed properly. If you cannot resolve this problem, contact nhd@usgs.gov.\",\"NHD Watershed Characteristics\")\n end\n SELF.Unload\n return (Nil)\n \nend\n\n\n" ) (Script.16 Name: "nbas.UnInstall" SourceCode: "'Name: NBAS.UnInstall\n'Purpose: UnInstall the NHDWCHARACTERISTICS extension.\n'Author: Jennifer Hill\n'Date: April 2002\n'Input Parameters: None\n'Input Files: None\n'Output Parameters (Return Values): None\n'Output Files: None\n'Calls: NHDZCOMMON.menuNHD_Tools \n' NHDZCOMMON.menuNHDAbout\n'Called By: ArcView when the extension uninstall occurs\n'Globals: None\n'Locals: docCurrent - Generic document object representing the current active document\n' winCurrent - window object identifying the curre nt window\n' guiCurrent - gui object representing the current GUI\n' ndictExtensions - Name dictionary of currently loaded extensions\n' listExtensions - List of currently loaded extensions (created from the name\n' dictionary)\n' listDependencies - list of extensions dependendent on NHD Navigate\n' boolIsDependency - Flag identifying the extension is a dependency\n' objDep - Objject used in stepping through the list of dependencies \n' boolRe moveZCommon - Flag identifying whether or not to remove NHDZCommon\n' extZCommon - Extension object for NHDZCommon\n' prjCurrent - Project object for the current project\n' guiView - GUI object for the 'View' GUI\n' listGUIs - List of existing GUIs\n' objGUI - GUI object used in stepping through a list of GUIs\n' mbarClass - Menubar object for the current GUI\n' menuClass - Menu object for the 'Help' menu if there is one.\n' choiceNHDNavHelp - Menu choice for 'NHD Navigate Help'\n'Notes: None\n'------------------------------------------------------------------------\n'Revision Author:\n'Revision Date:\n'Revision Notes:\n'------------------------------------------------------------------------\nprjCurrent = av.GetProject\n\n\n\nif ( prjCurrent = nil ) then\n return (nil)\nend\nif (prjCurrent.IsClosing ) then\n return (nil)\nend\n\n\n\nndictExtensions = Extension.GetExtensions\nlistExtensions = ndictExtensions.ReturnKeys\n\nif (listExtensions.FindByValue(\"NHDZCommon\") <> -1) then\n \n guiView = prjCurrent.FindGUI( \"View\" )\n\n if (guiView <> nil) Then\n 'There are no menu options in NHD_Tools menu - so do not need the following command\n av.run(\"NHDZCOMMON.menuNHD_Tools\",{\"UNLOAD\",{SELF.Get(1), SELF.Get(2)},400})\n \n 'Remove help 'About' information\n av.run(\"NHDZCOMMON.menuNHDAbout\", {\"UNLOAD\",{\"NHD Watershed Characteristics\"}})\n \n end\n\n 'Remove the basin tool control\n bbarView = guiView.GetButtonBar\n bbarView.Remove(bbarView.FindByScript(\"NHDBASIN.btnB asinCharacteristicsClick\"))\n\n 'Do not need all this since there is no help \n listGUIs = prjCurrent.GetGUIs\n for each objGUI in listGUIs\n \n mbarClass = prjCurrent.FindGUI(objGUI.asstring).GetMenuBar\n menuClass = mbarClass.FindByLabel(\"Help\")\n \n if (menuClass <> Nil) then \n \n choiceNHDNavHelp = menuClass.FindByLabel(\"NHD Watershed Characteristics Help\")\n if (choiceNHDNavHelp <> Nil) then\n menuClass.Remove(choiceNHDNavHelp)\n e nd\n \n end\n \n \n end\n\nelse\n\n 'msgbox.info(\"Unable to uninstall NHD Watershed Characteristics because the NHDZCommon extension is not loaded.\",\"NHD Navigate\")\n \nend\n\n" )