/3.2 (Extension.1 Name: "Soil Mapper (v1.0)" FirstRootClassName: "List" Roots: 2 Roots: 3 Roots: 20 Roots: 49 Roots: 50 Roots: 51 Roots: 52 Roots: 53 Version: 32 About: "This extension installs a File Menu item to import .e00 files from the Project or View windows, a View Button to load legends for Detailed Soil, Hydro and Civil themes, and a View Button to load associated Soil coverage tables." InstallScript: 54 UninstallScript: 55 ExtVersion: 1 ) (List.2 ) (List.3 Child: 4 Child: 12 ) (List.4 Child: 5 Child: 9 Child: 11 ) (List.5 Child: 6 Child: 7 Child: 8 ) (AVStr.6 S: "View" ) (AVStr.7 S: "ButtonBar" ) (AVStr.8 S: "d_loadleg" ) (Butn.9 Help: "Load legends for Detailed Soil / Hydro / Civil themes." HelpTopic: "Load legends for Detailed Soil / Hydro / Civil themes." Icon: 10 Click: "d_loadleg" ) (AVIcon.10 Name: "leg2.bmp" Data: 4e442049 6d616765 00010018 00150000 Data: 05e80000 009c9a9c 9c9a9c9c 9a9c9c9a Data: 9c9c9a9c 9c9a9c9c 9a9c9c9a 9c9c9a9c Data: 9c9a9c9c 9a9c9c9a 9c9c9a9c 9c9a9c9c Data: 9a9c9c9a 9c9c9a9c 9c9a9c9c 9a9c9c9a Data: 9c9c9a9c 9c9a9c9c 9a9c0000 00ffffff Data: 9c9a9c9c 9a9c9c9a 9c9c9a9c 9c9a9c9c Data: 9a9c9c9a 9c9c9a9c 9c9a9c9c 9a9c9c9a Data: 9c9c9a9c 9c9a9c9c 9a9c9c9a 9c9c9a9c Data: 9c9a9c9c 9a9c9c9a 9c9c9a9c 9c9a9c9c Data: 9a9c0000 00ffffff c6c3c6c6 c3c6c6c3 Data: c6c6c3c6 c6c3c6c6 c3c6c6c3 c6c6c3c6 Data: c6c3c6c6 c3c6c6c3 c6c6c3c6 c6c3c6c6 Data: c3c6c6c3 c6c6c3c6 c6c3c6c6 c3c6c6c3 Data: c6c6c3c6 9c9a9c9c 9a9c0000 00ffffff Data: c6c3c6c6 c3c6c6c3 c6ff0000 ff0000ff Data: 0000ff00 00ff0000 c6c3c6c6 c3c60000 Data: 00c6c3c6 000000c6 c3c60000 00000000 Data: c6c3c600 0000c6c3 c6c6c3c6 9c9a9c9c Data: 9a9c0000 00ffffff c6c3c6c6 c3c6c6c3 Data: c6ff0000 ff0000ff 0000ff00 00ff0000 Data: c6c3c600 00000000 00000000 c6c3c600 Data: 0000c6c3 c6c6c3c6 000000c6 c3c6c6c3 Data: c6c6c3c6 9c9a9c9c 9a9c0000 00ffffff Data: c6c3c6c6 c3c6c6c3 c6ff0000 ff0000ff Data: 0000ff00 00ff0000 c6c3c6c6 c3c6c6c3 Data: c6c6c3c6 c6c3c6c6 c3c6c6c3 c6c6c3c6 Data: c6c3c6c6 c3c6c6c3 c6c6c3c6 9c9a9c9c Data: 9a9c0000 00ffffff c6c3c6c6 c3c6c6c3 Data: c6c6c3c6 c6c3c6c6 c3c6c6c3 c6c6c3c6 Data: c6c3c6c6 c3c6c6c3 c6c6c3c6 c6c3c6c6 Data: c3c6c6c3 c6c6c3c6 c6c3c6c6 c3c6c6c3 Data: c6c6c3c6 9c9a9c9c 9a9c0000 00ffffff Data: c6c3c6c6 c3c6c6c3 c6c6c3c6 c6c3c6c6 Data: c3c6c6c3 c6c6c3c6 c6c3c6c6 c3c6c6c3 Data: c6c6c3c6 c6c3c6c6 c3c6c6c3 c6c6c3c6 Data: c6c3c6c6 c3c6c6c3 c6c6c3c6 9c9a9c9c Data: 9a9c0000 00ffffff c6c3c6c6 c3c6c6c3 Data: c6ffff00 ffff00ff ff00ffff 00ffff00 Data: c6c3c6c6 c3c60000 00c6c3c6 00000000 Data: 0000c6c3 c6c6c3c6 c6c3c6c6 c3c6c6c3 Data: c6c6c3c6 9c9a9c9c 9a9c0000 00ffffff Data: c6c3c6c6 c3c6c6c3 c6ffff00 ffff00ff Data: ff00ffff 00ffff00 c6c3c600 00000000 Data: 00000000 c6c3c600 00000000 00000000 Data: 00000000 0000c6c3 c6c6c3c6 9c9a9c9c Data: 9a9c0000 00ffffff c6c3c6c6 c3c6c6c3 Data: c6ffff00 ffff00ff ff00ffff 00ffff00 Data: c6c3c6c6 c3c6c6c3 c6c6c3c6 c6c3c6c6 Data: c3c6c6c3 c6c6c3c6 c6c3c6c6 c3c6c6c3 Data: c6c6c3c6 9c9a9c9c 9a9c0000 00ffffff Data: c6c3c6c6 c3c6c6c3 c6c6c3c6 c6c3c6c6 Data: c3c6c6c3 c6c6c3c6 c6c3c6c6 c3c6c6c3 Data: c6c6c3c6 c6c3c6c6 c3c6c6c3 c6c6c3c6 Data: c6c3c6c6 c3c6c6c3 c6c6c3c6 9c9a9c9c Data: 9a9c0000 00ffffff c6c3c6c6 c3c6c6c3 Data: c6c6c3c6 c6c3c6c6 c3c6c6c3 c6c6c3c6 Data: c6c3c6c6 c3c60000 00c6c3c6 00000000 Data: 0000c6c3 c6000000 00000000 0000c6c3 Data: c6c6c3c6 9c9a9c9c 9a9c0000 00ffffff Data: c6c3c6c6 c3c6c6c3 c6c6c3c6 c6c3c6c6 Data: c3c6c6c3 c6c6c3c6 c6c3c600 00000000 Data: 00000000 c6c3c6c6 c3c60000 00000000 Data: c6c3c6c6 c3c6c6c3 c6c6c3c6 9c9a9c9c Data: 9a9c0000 00ffffff c6c3c6c6 c3c6c6c3 Data: c6c6c3c6 c6c3c6c6 c3c6c6c3 c6c6c3c6 Data: c6c3c6c6 c3c6c6c3 c6c6c3c6 c6c3c6c6 Data: c3c6c6c3 c6c6c3c6 c6c3c6c6 c3c6c6c3 Data: c6c6c3c6 9c9a9c9c 9a9c0000 00ffffff Data: c6c3c6c6 c3c6c6c3 c6c6c3c6 c6c3c6c6 Data: c3c6c6c3 c6c6c3c6 c6c3c6c6 c3c6c6c3 Data: c6c6c3c6 c6c3c6c6 c3c6c6c3 c6c6c3c6 Data: c6c3c6c6 c3c6c6c3 c6c6c3c6 9c9a9c9c Data: 9a9c0000 00ffffff c6c3c6c6 c3c6c6c3 Data: c6c6c3c6 c6c3c600 0000c6c3 c6000000 Data: c6c3c600 00000000 00000000 00000000 Data: 00000000 00000000 c6c3c6c6 c3c6c6c3 Data: c6c6c3c6 9c9a9c9c 9a9c0000 00ffffff Data: c6c3c6c6 c3c6c6c3 c6c6c3c6 00000000 Data: 00000000 00c6c3c6 c6c3c600 0000c6c3 Data: c6c6c3c6 000000c6 c3c6c6c3 c6000000 Data: c6c3c6c6 c3c6c6c3 c6c6c3c6 9c9a9c9c Data: 9a9c0000 00ffffff c6c3c6c6 c3c6c6c3 Data: c6c6c3c6 c6c3c6c6 c3c6c6c3 c6c6c3c6 Data: c6c3c6c6 c3c6c6c3 c6c6c3c6 c6c3c6c6 Data: c3c6c6c3 c6c6c3c6 c6c3c6c6 c3c6c6c3 Data: c6c6c3c6 9c9a9c9c 9a9c0000 00ffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffff9c Data: 9a9cc6c3 c6000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 00000001 Data: 00180007 00200001 00020000 00000000 Data: 0000 ) (Numb.11 N: 24.00000000000000 ) (List.12 Child: 13 Child: 17 Child: 19 ) (List.13 Child: 14 Child: 15 Child: 16 ) (AVStr.14 S: "View" ) (AVStr.15 S: "ButtonBar" ) (AVStr.16 S: "d_tables" ) (Butn.17 Help: "Loads CMP, LAYER, NAME, and MAPUNIT tables for the active Soil themes." Icon: 18 Click: "d_tables" ) (AVIcon.18 Name: "Link" Res: "Icons.Link" ) (Numb.19 N: 25.00000000000000 ) (List.20 Child: 21 Child: 28 Child: 35 Child: 42 ) (List.21 Child: 22 Child: 26 Child: 27 ) (List.22 Child: 23 Child: 24 Child: 25 ) (AVStr.23 S: "Project" ) (AVStr.24 S: "File" ) (AVStr.25 ) (Choice.26 Help: "Creates a new project" HelpTopic: "New_Project" Label: "&New Project" Click: "Project.New" Shortcut: "Keys.Ctrl+N" ) (Numb.27 ) (List.28 Child: 29 Child: 33 Child: 34 ) (List.29 Child: 30 Child: 31 Child: 32 ) (AVStr.30 S: "Project" ) (AVStr.31 S: "File" ) (AVStr.32 S: "d_importer" ) (Choice.33 Help: "Imports .e00 files and applies appropriate directory names for Detailed Soil, Hydro, and Civil coverages." Label: "&Import .e00 files" Click: "d_importer" Shortcut: "Keys.None" ) (Numb.34 N: 9.00000000000000 ) (List.35 Child: 36 Child: 40 Child: 41 ) (List.36 Child: 37 Child: 38 Child: 39 ) (AVStr.37 S: "View" ) (AVStr.38 S: "File" ) (AVStr.39 ) (Choice.40 Help: "Closes the active component" HelpTopic: "Close" Label: "&Close" Click: "Project.CloseDoc" Shortcut: "Keys.None" ) (Numb.41 ) (List.42 Child: 43 Child: 47 Child: 48 ) (List.43 Child: 44 Child: 45 Child: 46 ) (AVStr.44 S: "View" ) (AVStr.45 S: "File" ) (AVStr.46 S: "d_importer" ) (Choice.47 Help: "Imports .e00 files and applies appropriate directory names for Detailed Soil, Hydro, and Civil coverages." Label: "&Import .e00 files" Click: "d_importer" Shortcut: "Keys.None" ) (Numb.48 N: 15.00000000000000 ) (List.49 ) (Script.50 Name: "d_loadleg" SourceCode: "'d_loadLg.ave\n'loads legends for Detailed Soil, Hydro, and Civil themes in the Active View \n\ntheView=av.GetActiveDoc\n\n'check to make sure that the active view is not empty\nif (theView.GetThemes.count = 0) then\n Msgbox.Info (\"There are no themes in the active view\",\"Empty View\")\n Exit\nend \n\n'check to give user the opportunity to name themes properly\ncheckNames = MsgBox.YesNo (\"Theme names must CONTAIN the word 'Hydro', 'Soil', or 'Civil' (see Theme / Properties menu).\"+NL+NL+\"Apply standard legends to the mes?\",\"Apply legends to themes\",True)\nif (checknames.Not) then\n Exit\nend\n\n\n'flags for presence of the 3 themes in the View\nhydroflag=false\nsoilflag=false\ncivilflag=false\n\n'Custom Colours\nlightGray = Color.Make\nlightGray.setRGBList({204,204,204})\ndarkBrown = Color.Make\ndarkBrown.SetRgbList ({153,102,0})\ndarkRed = Color.Make\ndarkRed.SetRgbList ({102,0,0})\n\nnum=10\nfor each thm in theView.getthemes 'check each theme, render according to Soil, Hydro, or Civil\n\n thmFeature = thm.getSrcName.getSubName 'find out if theme is loaded as polygon, arc, or labelpoint\n\n if (thm.getname.contains(\"Hydro\")) then\n hydroLeg=thm.getlegend\n\n 'check for the feature type, and render accordingly\n if ((thm.getFTab.FindField(\"Type\") <> NIL) AND (thmFeature = \"polygon\")) then \n 'this is the prefered legend\n hydroLeg.SetLegendType(#LEGEND_TYPE_UNIQUE)\n hydroLeg.Unique(thm,\"Type\")\n \n classList=hydroleg.getClassifications\n for each a in classlist\n if (a.getlabel.asstring = \"L\") then\n num = c lassList.Find (a)\n end \n end\n if (num <> 10) then\n classlist.Remove(num)\n end\n num=10\n \n for each n in 0 .. (classlist.count - 1)\n if (classlist.get(n).getlabel = \"W\") then\n waterSym = symbol.make(#SYMBOL_FILL)\n watersym.setstyle(#RASTERFILL_STYLE_SOLID)\n watersym.setcolor(color.getblue)\n watersym.setOLcolor(color.getblue)\n hydroLeg.SetClassInfo (n, {\"Water\",\"W\",watersym,\"W\",\"W\"})\n elseif (classlist.get(n).getlabel = \" L\") then\n\n landSym = symbol.make(#SYMBOL_FILL)\n landSym.setStyle(#RASTERFILL_STYLE_EMPTY)\n landSym.setoutlined(FALSE)\n hydroLeg.setClassInfo(n,{\"Land\",\"L\",landSym,\"L\",\"L\"})\n elseif (classlist.get(n).getLabel = \"O\") then\n oceanSym = symbol.make(#SYMBOL_FILL)\n oceanSym.setstyle(#RASTERFILL_STYLE_SOLID)\n oceanSym.setcolor(color.getCyan)\n oceanSym.setOLcolor(color.getCyan)\n hydroLeg.SetClassInfo (n, {\"Ocean\",\"O\",oceanSym,\"O\" ,\"O\"})\n end\n end \n \n elseif ((thmFeature = \"labelpoint\") AND (thm.getFTab.FindField(\"Type\") <> NIL)) then\n hydroLeg.SetLegendType(#LEGEND_TYPE_UNIQUE)\n hydroLeg.Unique(thm,\"Type\")\n classList=hydroleg.getClassifications\n\n for each a in classlist\n if (a.getlabel.asstring = \"L\") then\n num = classList.Find (a)\n end \n end\n if (num <> 10) then\n classlist.Remove(num)\n end\n num=10\n \n for each n in 0 .. (classlist.count - 1 )\n if (classlist.get(n).getlabel = \"W\") then\n waterSym = symbol.make(#SYMBOL_MARKER)\n watersym.SetStyle(#BASICMARKER_STYLE_PATTERN)\n watersym.SetCharacter(\".\".AsASCII)\n watersym.setcolor(color.getblue)\n hydroLeg.SetClassInfo (n, {\"Water\",\"W\",watersym,\"W\",\"W\"})\n elseif (classlist.get(n).getlabel = \"L\") then\n landSym = symbol.make(#SYMBOL_MARKER)\n landsym.SetStyle(#BASICMARKER_STYLE_PATTERN)\n landsym.SetCharacter(\".\".AsASCII )\n landSym.setColor(darkBrown)\n hydroLeg.setClassInfo(n,{\"Land\",\"L\",landSym,\"L\",\"L\"})\n elseif (classlist.get(n).getLabel = \"O\") then\n oceanSym = symbol.make(#SYMBOL_FILL)\n oceansym.SetStyle(#BASICMARKER_STYLE_PATTERN)\n oceansym.SetCharacter(\".\".AsASCII)\n oceansym.setcolor(color.getCyan)\n hydroLeg.SetClassInfo (n, {\"Ocean\",\"O\",oceansym,\"O\",\"O\"})\n end\n end \n \n elseif ((thm.getFTab.FindField(\"Type\") = NIL) AND ((thmFea ture = \"polygon\") OR (thmFeature = \"labelpoint\"))) then \n hydroLeg.SetLegendType(#LEGEND_TYPE_SIMPLE)\n theSymlist=hydroleg.getsymbols\n thesymlist.get(0).setcolor(color.getblue)\n if (thmFeature = \"polygon\") then\n thesymlist.get(0).setOlcolor(color.getblue)\n end \n elseif (thmFeature = \"arc\") then \n hydroLeg.SetLegendType(#LEGEND_TYPE_SIMPLE)\n theSymlist=hydroleg.getsymbols\n thesymlist.get(0).setcolor(color.getblue)\n end\n \n 'reflect changes in the Hy dro TOC\n \n theView.InvalidateTOC(Thm)\n hydroFlag=true\n \n elseif (thm.getname.contains(\"Soil\")) then\n 'applySoil = MsgBox.YesNo (\"Would you like to change the legend for the SOIL theme?\",\"Apply legend to Soil theme?\",True)\n applySoil = MsgBox.YesNo (\"Would you like to change the legend for the \" + thm.getname + \" theme?\",\"Apply legend to Soil theme?\",True)\n \n if (applySoil) then\n soilLeg=thm.getlegend\n \n if ((thmFeature = \"polygon\") AND (thm.getFTab.FindField(\"MapUnit\") <> NIL)) then\n 'this is the prefered legend\n soilLeg.SetLegendType(#LEGEND_TYPE_UNIQUE)\n soilLeg.Unique(thm,\"Mapunit\")\n theColorSchemes = symbolList.GetPreDefined(#SYMLIST_TYPE_COLORSCHEME)\n for each scheme in theColorSchemes\n if (scheme.GetName=\"Minerals\") then\n theColorScheme=scheme\n end\n end\n soilLeg.GetSymbols.RandomSavedSymbols(theColorScheme)\n thm.SetLegendVisible(false) \n elseif ((thmFeature = \"polygon\") AND (t hm.getFTab.FindField(\"MapUnit\") = NIL)) then\n soilLeg.SetLegendType(#LEGEND_TYPE_SIMPLE)\n theSymlist=soilleg.getsymbols\n thesymlist.get(0).setOLcolor(color.getBlack)\n thesymlist.get(0).setColor(lightGray)\n elseif ((thmFeature = \"arc\") OR (thmFeature=\"labelpoint\")) then\n soilLeg.SetLegendType(#LEGEND_TYPE_SIMPLE)\n theSymlist=soilleg.getsymbols\n thesymlist.get(0).setcolor(color.getBlack)\n end\n \n 'reflect changes in the TOC\n thm.updateLe gend\n soilFlag=true\n end \n elseif (thm.getname.contains(\"Civil\")) then\n 'civil cover should be loaded as an ARC theme\n civilLeg=thm.getLegend\n civilLeg.setLegendType(#LEGEND_TYPE_SIMPLE)\n theSymlist=civilLeg.getsymbols\n theSymlist.get(0).setcolor(darkRed)\n if (thmFeature=\"polygon\") then\n theSymlist.get(0).setOLcolor(Color.GetBlack)\n end\n \n 'reflect changes in the TOC\n thm.updateLegend\n civilFlag=true \n end 'finished rendering the theme\n \nend 'finished going through each theme in the view \n\n'____________________________________________\n'check order of themes - hydro and civil must be on TOP of soil\ntheThemes = theView.GetThemes 'Get the themes\nif (theThemes = NIL) then\n exit\nend\n\n' Theme types. Change the order of this list to change the display \n' order in the TOC; civil, hydro,soil,other\n\ntheTypes = {\"civil\",\"hydro\",\"soil\"}\n\n' Use a Dictionary to store themes of various types\n\naDictionary = Dictionary.Make(theTypes.Count + 1)\nfor each type in theTypes\n a Dictionary.Add (type,{})\nend\naDictionary.Add(\"other\",{}) ' Store types not in theTypes\n\n' Sort themes by type\n\nfor each thm in theThemes\n if (thm.getname.contains (\"Hydro\")) then\n aKey = \"Hydro\"\n elseif (thm.getname.contains (\"Soil\")) then\n aKey = \"Soil\"\n elseif (thm.getname.contains (\"Civil\")) then\n aKey = \"Civil\"\n else\n aKey = \"Other\" \n end\n\n if (theTypes.FindByValue(aKey) >= 0) then \n ' Get list out of dictionary and add theme to list\n aValue = aDictionary.Get(aKey) + {thm}\n aDictionary.Set(aKey,aValue)\n else\n ' theme contains another word\n type = \"other\" 'Set default\n aValue = aDictionary.Get(type) + {thm}\n aDictionary.Set(type, aValue)\n end 'else\nend 'for\n\n' Reorder the TOC by rebuilding the TOC list\ntheThemes.Empty\nfor each type in theTypes\n theThemes.Merge(aDictionary.Get(type))\nend\ntheThemes.Merge(aDictionary.Get(\"other\"))\n\n\n' Refresh TOC and View\ntheView.InvalidateTOC(nil)\ntheView.Invalidate\n\nif (hydroFlag.not and soilFlag.not and civilFlag.not) then\n M sgBox.Warning (\"The theme names must CONTAIN the word 'Civil', 'Hydro', or 'Soil' in order to render each theme type appropriately. Please change the names of your themes using the Theme / Properties menu.\", \"No 'Civil', 'Hydro', or 'Soil' themes\")\nend\n \n\n\n\n" ) (Script.51 Name: "d_tables" SourceCode: "'d_tables\n'this script will open cmp,name,layer,mapunit tables for each \"active\" theme\n'in the active view\n\nCurrentView = av.getActiveDoc\n'check to make sure there is an active View, redundant because the button \n'is only visible if there is an Active view\nif ((CurrentView = nil) OR (CurrentView.GetGUI <> \"View\")) then\n MsgBox.Error (\"A View is not active - please select a view that contains a Soil coverage theme\", \"No active document\")\n exit\nend\n\nActiveThemes = CurrentView.GetActiveThemes\n'check to make sure that some themes are selected\n'and that they are soil coverages\nif (ActiveThemes.Count < 1) then\n MsgBox.Error (\"There are no active themes - please select one or more Soil coverage themes in the View\", \"No active themes\") \nend \n\n'make sure that at the active theme is a SOIL coverage.\n'the word \"soil\" must be in the theme name.\nfor each ActiveTheme in ActiveThemes\n sourceName = activeTheme.getsrcname 'e.g soil_codroy\n if (sourceName.asstring.contains (\"soil\")) then\n DataSourceName = sourceName. getDataSource 'full path of coverage. Go up one dir and add \\info to get to tables\n if (system.getOS.asstring = \"SYSTEM_OS_UNIX\") then\n INFOdirectory = (datasourcename.asString).basictrim(\"\",sourcename.asString) + \"info/\"\n else\n INFOdirectory = (datasourcename.asString).basictrim(\"\",sourcename.asString) + \"INFO\\\"\n end \n \n cmpFile = (INFOdirectory + sourcename.asString + \".cmp\").asFilename \n nameFile = (INFOdirectory + sourcename.asString + \".name\").asFileName\n layerFile = (INFOdirectory + sourcename.asString + \".layer\").asFileName\n mapunitFile = (INFOdirectory + sourcename.asString + \".mapunit\").asFileName\n filelist={}\n filelist.add(mapunitFile) \n filelist.add(layerFile)\n filelist.add(nameFile)\n filelist.add(cmpFile)\n 'open tables for the 4 associated soil tables files\n for each f in filelist\n v = VTab.Make(f, FALSE, FALSE)\n if (v.HasError) then\n if (v.HasLockError) then\n MsgBox.Error(\"Unable to acquire Read Lock for file \" + f.GetBaseName, \"\")\n else\n MsgBox.Error(\"The file '\" + f.GetBaseName + \"' is not valid.\", \"\")\n end\n else\n gui = av.GetProject.GetSelectedGUI\n if (gui.GetType <> \"Table\") then\n GUIName = \"Table\"\n else\n GUIName = gui.GetName\n end \n t = Table.MakeWithGUI(v, GUIName)\n t.SetName(v.GetName)\n t.GetWin.Open\n end\n end \n \n 'open theme table (.pat file)\n if (activeTheme.HasTable) then\n activeTheme.E ditTable\n end\n \n end\nend\n\n\n" ) (Nil.52 ) (Script.53 Name: "d_importer" SourceCode: "\n'd_importer.ave\n'location of import program\nBinLoc = System.GetEnvVar(\"AVBIN\")\nif (system.getOS.asString = \"SYSTEM_OS_MSW\") then\n EXEPath = BinLoc + \"\\import71.exe\"\nelseif (system.getOS.asString = \"SYSTEM_OS_UNIX\") then\n EXEPath = BinLoc + \"/import\"\nend\n\nif (not (File.Exists (EXEpath.asFilename))) then\n if (system.getOS.asString = \"SYSTEM_OS_MSW\") then\n ImportProgram = FileDialog.ReturnFiles({\"*.*\"}, {\"All Files\"}, \"Locate the ESRI Import program\",0)\n if ((importProgram = nil) or (importProgram.co unt = 0) ) then\n msgbox.error (\"Cannot locate the import program.\",\"Import program not found\")\n exit\n elseif (not ((importProgram.get(0).asString).contains(\"import\"))) then\n msgbox.error (\"The file you selected is not the ESRI Import program\",\"Import program not found\")\n exit\n else\n EXEPath = importProgram.get(0).asString\n end \n elseif (system.getOS.asString = \"SYSTEM_OS_UNIX\") then \n Msgbox.info(\"Please put the ESRI import program in the Arcview bin directory\",\"Import program not found\")\n exit\n end\nend\n\n'list of e00 files obtained from user interaction\nInFileList = FileDialog.ReturnFiles({\"*.e00\"}, {\"Arc/Info Export Files (*.e00)\"}, \"Select File To Import, No spaces in the .e00 filename!\", 0)\nif (InFileList.Count <= 0) then\n return nil \nend\nFor each f in inFileList\n if (f.asString.Contains(\" \")) then\n msgbox.error (\"Please rename your .e00 files so that there are no spaces in the filename\",\"Rename .e00 filename\")\n return nil\n end\nend\n\n'ListofThemes = Lis t.Make ''create list of full path names to themes for adding to view later\nListofThemes = {}\nfor each f in InFileList\n InFile=f 'gets filename\n InFileBase = f.GetBaseName 'gets part after the path\n\n 'try to determine the content of the e00 file based on its filename\n 'used to help name the output coverage directory name\n if (infilebase.contains(\"soil\")) then\n typeofCover = \"soil\"\n elseif (infilebase.contains(\"hydro\")) then\n typeofcover = \"hydro\"\n elseif (infilebase.contains(\"civil\")) then\n t ypeofcover = \"civil\"\n else \n InFileBase = InFileBase.Substitute(\".e00\", \"\") 'gets rid of e00 part\n typeOfCover = infilebase.Left(13)\n end\n \n 'put import .e00 filename in the status bar at bottom of screen \n av.ShowMsg (f.GetFullName.asString) \n\n 'determine name of output directory\n OutCov = FileDialog.Put(typeofcover.asFilename,\"\",\"Include '\" + typeofcover + \"' in the output name, No more than 13 characters in name\")\n 'run the import71.exe program, in synchronous mode\n if (outcov <> n il) then 'if the person didn't press cancel, import the file\n if (EXEPath.contains (\"exe\")) then\n System.ExecuteSynchronous(EXEPath ++ InFile.asString ++ OutCov.asString ++ \"/T\")\n else 'unix system - don't run import synchronously\n exeString = EXEPath + \" \" + InFile.asString + \" \" + OutCov.asString\n System.Execute(exeString)\n end \n 'create list of themes for adding to view later\n ListofThemes.Add(OutCov.asString) \n end\nend\n\n'iterate through each theme that was imported and d ecide whether or not to add to a view\nif (listofthemes.count > 0) then\n viewDoc = av.GetActiveDoc.getgui 'if active doc is a view, add to the current view\n if (ViewDoc = \"View\") then 'they ran the import while in the View GUI\n choicebox = MsgBox.ListAsString ({\"Add to Current View\",\"Add to New View\",\"Do not load into a View\"}, \"Add Coverages to a View?\", \"Add Coverages to a View\")\n else 'they ran the import while in the Project GUI\n choicebox = MsgBox.ListAsString ({\"Add to New View\",\"Do not load i nto a View\"}, \"Add Coverages to a View?\", \"Add Coverages to a View\")\n end \n \n if (choicebox = \"Add to Current View\") then\n useView = av.GetActiveDoc \n elseif (choicebox = \"Add to New View\") then\n newView=View.Make\n av.getProject.AddDoc(newView)\n useView = av.getProject.FindDoc(newView.GetName)\n useView.GetWin.Activate\n else\n useView = nil 'not adding coverages to a view\n end\n \n if (useview <> nil) then\n for each t in ListofThemes\n ' Get the list of SrcNames av ailable in this coverage 'add themes - try for polygon feature class. If not, add arcs. If not, add labelepoints.\n n = Coverage.ReturnSrcNames(t.asString) \n \n for each th in n\n \n if ((th.asString).contains(\"civil\")) then \n if (th.getSubName = \"arc\") then\n theTheme = Theme.Make(th)\n theTheme.SetVisible(true)\n useView.addTheme(theTheme) \n useView.InvalidateTOC(nil)\n useView.Invalidate\n end\n else\n if (th.getSubName = \"polygon\") then \n theTheme = Theme.Make(th) \n theTheme.SetVisible(true)\n useView.addTheme(theTheme) \n useView.InvalidateTOC(nil)\n useView.Invalidate\n end\n end 'if theme name contains Civil \n \n end 'for each theme\n \n end 'for each theme in list of themes\n \n end\n \nend\nav.ClearMsg \n\n\n\n\n\n\n" ) (Script.54 Name: "My Extension Install" SourceCode: "'DO NOT EDIT!!!\n\nif (av.getproject=nil) then return(nil) end\n\n\ntheDocs = SELF.get(0)\ntheControlList = SELF.get(1)\ntheMenuList = SELF.get(2)\ntheToolMenuList=SELF.Get(3)\ntheProject=Av.getproject\n\n\n'Add the Docs\n'\nfor each adoc in theDocs\n theProject.addDoc(adoc)\nend\n\n'Add the Controls\n'\nfor each totalControl in theControlList\n 'The Control list\n acontrol=totalControl.get(0)\n \n 'The physical control\n theControl = totalControl.get(1)\n \n 'The control Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n 'This finds the control set \n thecommand=\"av.getproject.findGUI(\"\"\"+aControl.get(0)+\"\"\").Get\"+acontrol.get(1)\n thescript1=Script.Make(thecommand)\n thecontrolset=thescript1.doit(\"\")\n \n 'Add the control to the control set\n theControlSet.Add(theControl,theCindex )\nend\n\n\n'Add the menus\nfor each totalcontrol in theMenuList\n \n 'The Control list\n acontrol=totalControl.get(0)\n mDoc=acontrol.get(0)\n mMenu=acontrol.get(1)\n mMenuItem=acontrol.get(2)\n\n 'The physical control\n theControl = totalControl.get(1)\n \n 'The control Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the c urrent project.\",\"Script Eror\")\n return(nil)\n end\n \n theMbar=av.getproject.findGUI(mDoc).GetMenuBar\n themenu=theMbar.findbylabel(mMenu)\n if (themenu=NiL) then\n themenu=menu.make\n themenu.setlabel(mMenu)\n theMbar.add(themenu,999)\n end\n \n themenu.add(thecontrol, theCindex)\nend\n \n \n'Add the Tool Menus\n\nfor each totalControl in theToolMenuList\n 'The Control list\n acontrol=totalControl.get(0)\n \n 'The physical control\n theControl = totalControl.get(1)\n \n 'The con trol Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n 'This finds the control set \n thecommand=\"av.getproject.findGUI(\"\"\"+aControl.get(0)+\"\"\").Get\"+acontrol.get(1)\n thescript1=Script.Make(thecommand)\n thecontrolset=av.getproject.findGUI(aControl.get(0)).GetToolBa r\n \n 'Add the control to the control set\n theControlSet.Add(theControl,theCindex)\nend\n\n\nav.getproject.setmodified(true)\n\n\n'And the scripts add themselves\n" ) (Script.55 Name: "My Extension Uninstall" SourceCode: "'DO NOT EDIT!!!\n\n'The SELF is the Extension\n\ntheDocs = SELF.get(0)\ntheControlList = SELF.get(1)\ntheMenuList = SELF.get(2)\ntheToolMenuList=SELF.get(3)\ntheProject=Av.getproject\n\n\n'Add the Docs\n'\nfor each adoc in theDocs\n If (theProject.finddoc(adoc.getname)<>NIL) then \n theAnswer=msgbox.yesno(\"Remove the Document \"+adoc.getname+\"?\",\"Remove Document?\",TRUE)\n if (theAnswer=TRUE) then theProject.RemoveDoc(adoc) end\n end\nend\n\n'Removethe Controls\n'\nfor each totalControl in theControlList\n 'Get the control list from the Ext\n acontrol=totalControl.get(0)\n \n 'Get the physical Control\n theControl = totalControl.get(1)\n \n 'Get the Controls Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI for the Control\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n 'This sequence finds the appropiate control set\n thecommand= \"av.getproject.findGUI(\"\"\"+aControl.get(0)+\"\"\").Get\"+acontrol.get(1)\n thescript1=Script.Make(thecommand)\n thecontrolset=thescript1.doit(\"\")\n\n 'See if the control is in the set , if so remove it\n if (theControlSet.GetControls.find(theControl)<>NIL) then\n theControlSet.remove(theControl)\n if (thecontrol = \"ToolBar\") then\n theControlSet.selectdefault\n end\n end\nend\n\n\n'Remove the Menus\n'\nfor each totalcontrol in theMenuList\n \n 'The Control list\n acontrol=totalControl.get(0 )\n mDoc=acontrol.get(0)\n mMenu=acontrol.get(1)\n mMenuItem=acontrol.get(2)\n\n 'The physical control\n theControl = totalControl.get(1)\n \n 'The control Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n theMbar=av.getproject.findGUI(mDoc).GetMenuBar\n themenu=theMbar.findbylabel(mMenu)\n if (themenu=NiL) then\n MsgBox.Warning(\"The menu named \"+mMenu+\" is not here.\",\"Script Eror\")\n 'return(nil)\n else\n \n thething=themenu.getcontrols.find(thecontrol)\n if (thething<>NIL) then \n themenu.remove(thecontrol) \n end\n 'msgbox.info(themenu.GetControls.count.asstring,\"\")\n if (themenu.GetControls.count<1) then\n theMbar.remove(themenu)\n end\n end\nend\n \nfor each totalControl in theToolMenuList\n 'Get the control list from the Ext\n acontrol=totalControl.get(0)\n \n 'Get the physical Control\n theControl = totalControl.get(1)\n \n 'Get the Controls Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI for the Control\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n 'This sequence finds the appropiate control set\n thecontrolset=av.getp roject.findGUI(aControl.get(0)).GetToolBar\n\n \n 'See if the control is in the set , if so remove it\n if (theControlSet.GetControls.find(theControl)<>NIL) then\n \n theControlSet.remove(theControl)\n theControlSet.selectdefault\n end\n\nend\n \n\n'And the scripts delete themselves\n\n\nav.getproject.setmodified(true)\n" )