/3.1 (Extension.1 Name: "Stream Digitizing Extension V1.0b 8/3/99" Dependencies: "$AVBIN/AVDLOG.DLL\n" FirstRootClassName: "List" Roots: 2 Roots: 3 Roots: 12 Roots: 13 Roots: 14 Roots: 15 Roots: 16 Roots: 17 Roots: 18 Roots: 19 Roots: 20 Roots: 21 Roots: 22 Roots: 23 Roots: 24 Roots: 25 Roots: 26 Roots: 27 Roots: 28 Roots: 29 Version: 31 About: "This Extension Provides On-Screen Stream Mode Digitizing Functionality V 1.0b 8/3/99" InstallScript: 15 UninstallScript: 17 ExtVersion: 1 ) (List.2 ) (List.3 Child: 4 ) (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: "StreamMode.Form.Activate" ) (Butn.9 Help: "Open Stream Digitize Form//Opens the Stream Digitizing Form that supports adding features in stream mode...." Update: "StreamMode.Form.Update" Icon: 10 Click: "StreamMode.Form.Activate" ) (AVIcon.10 Name: "Stroke" Res: "Icons.Stroke" ) (Numb.11 N: 25.00000000000000 ) (List.12 ) (List.13 ) (List.14 ) (Script.15 Name: "Extension.Install" SourceCode: "' Name: Extension.Install\n'\n' Author: Timothy N. Loesch\n' Minnesota Department of Natural Resources\n' 500 Lafayette Road - Box 11\n' St. Paul, MN 55155\n' tim.loesch@dnr.state.mn.us\n' \n' Date: Mon Mar 01 13:14:04 1999\n' Revised by: \n' Revision Date: \n' Revisions: \n' -------------------------------------------------------------------\n' Description: This script was modified by Tim Loesch to provide quick\n' and easy abilities to create exte nsions\n' Requires: \n' Runs: \n' Run by: \n' Self: \n' Returns: \n' -------------------------------------------------------------------\n\n' DO NOT EDIT\n\nDEBUG = true\nDEBUGNOT = false\n\nif (av.getproject=nil) then return(nil) end\n\ntheDocs = SELF.get(0)\ntheControlList = SELF.get(1)\ntheMenuList = SELF.get(2)\nthePopupList= SELF.get(3)\ntheToolMenuList=SELF.Get(4)\ntheProject=Av.getproject\n\ntheOldCindex=0\nButtonStartIndex=23\nTootlStartIndex=14\nNumControlSpaces=0\nNumToolSpaces=0\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 aspacer=totalControl.get(2)\n \n if (aspacer=\"Space\") then\n if (NumControlSpaces=0) then\n theCindex=ButtonStartIndex\n theOldCindex=theCindex\n NumControlSpaces=NumControlSpaces+1\n else\n theCindex=theOldCindex+1\n end\n \n thecommand=\"av.getproject.findGUI(\"\"\"+totalControl.get(0)+\"\"\").Get\"+totalcontrol.get(1)\n thescript1= Script.Make(thecommand)\n thecontrolset=thescript1.doit(\"\") \n theControl=space.make\n theControl.setName(\"Spacer\")\n \n else\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 theOldCindex=theCindex\n end\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 \n if (totalControl.get(2)=\"Space\") then\n theCindex=theO ldCindex+1\n theControl=space.make\n theControl.SetName(\"Spacer\")\n else\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 theOldCindex=theCindex\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)+\" cann ot 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 themenu=menu.make\n themenu.setlabel(mMenu)\n theMbar.add(themenu,999)\n end\n end\n themenu.add(thecontrol, theCindex)\nend\n\n'________________________________________________________________\n'Custom code for adding popups\n'_____________________________________________________________ ___\n\n'Add the popups\n\nfor each totalcontrol in thePopupList\n \n 'The Control list\n acontrol=totalControl.get(0)\n \n if (totalControl.get(2)=\"Space\") then\n theCindex=theOldCindex+1\n theControl=space.make\n theControl.SetName(\"Spacer\")\n else\n pDoc=acontrol.get(0)\n popMenu=acontrol.get(1)\n pMenuItem=acontrol.get(2)\n \n 'The physical control\n theControl = totalControl.get(1)\n \n 'The control Index\n theCindex=totalControl.get(2)\n theOldCindex=theCin dex\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 thepopups=av.getproject.findGUI(pDoc).Getpopups\n thepopup=thepopups.findbylabel(popMenu)\n if (thepopup=NiL) then\n thepopup=popup.make\n thepopup.setlabel(popMenu)\n thepopups.add(thepopup,999)\n end\n end\n th epopup.add(thecontrol, theCindex)\nend\n\n'______________________________________________________________________\n \n'Add the Tool Menus\n\nfor each totalControl in theToolMenuList\n 'The Control list\n acontrol=totalControl.get(0)\n \n if (aControl=\"Space\") then\n theCindex=theOldCindex+1\n theControl=space.make\n else\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.getpro ject.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)).GetToolBar\n theOldCindex=theCindex\n end\n \n 'Add the control to the control set\n theControlSet.Add(theControl,theCindex)\nend\n\nav.getproject.setmodified(true)\n" ) (Script.16 Name: "Extension.Make" SourceCode: "' Name: Extension.Make\n'\n' Author: Original Script ESRI Redlands\n' Modified Harley Prowse, Auckland UniServices - Geographic Technologies (harleyp@gtech.co.nz)\n'\n' Title: Extension Builder - Make\n'\n' Topics: \n'\n' Description: \n'\n' Requires: \n'\n' Self: \n'\n' Returns:\n'\n'Modifications: Original ESRI script did not allow for menu spaces or the inclusion of popups. I have modified the\n' make, install and uninstall scripts to facilitate the addition of spaces and popups. \n' I have not added spacer ability to the Tools code, but this should not be hard to do if someone wants\n' to give it a go. There are lots of \"Do Not Edits\" in these scripts, put in by ESRI. Ignore them if you\n' know what you are doing, otherwise, modify at your own risk.\n'\n' If your extension contains dialogs (ie is dependant on the Dialog Designer Extension, there is a line which\n' needs to be un-commented at the end of the Uninstall script.\n'\n' I take no responsibility for the reliability of this code. I use it and it seems fine (so far!). Treat\n' with caution and don't blame me if it breaks!\n\n'------------------------------\n 'the Filename of the extension\n 'eg myextension.avx will yield myextension.avx, $HOME\\myextension.avx will force it to be written to the $HOME directory.\n \n '\ntheExtensionFile = \"$USEREXT/StreamMode.AVX\"\n\n'------------------------------\n 'The Name of the extension to be displayed in the\n 'extensi on dialog\ntheExtensionName = \"Stream Digitizing Extension V1.0b 8/3/99\"\n\n'------------------------------\n 'The description of the extension to be displayed\n ' in the extension dialog\n \ntheDescription = \"This Extension Provides On-Screen Stream Mode Digitizing Functionality V 1.0b 8/3/99\"\n\n'------------------------------\n 'The version of the extension\ntheVersion = 1.0\n\n'------------------------------\n 'Install Script\n ' The Script to use to install the extension\nInScriptName=\"Extension.Install\"\n\n'----------- -------------------\n 'Uninstall Script\n ' The Script to use to uninstall the extension\nUnScriptName=\"Extension.Uninstall\"\n\n'------------------------------\n 'Load Script\n ' The Script which may be used to set one of initializations when the extension loads\n 'Set to nil if there isn't one\n LoadScriptName=nil\n\n'------------------------------\n\n'UnLoad Script\n ' The Script which may be used to clean up when an extension unloads, not to be confused with\n ' the uninstall script.\n 'Set to nil if there isn't one\n U nLoadScriptName=nil\n \n'------------------------------\n 'Any document Names to include\n ' This is a list of any documents to include\n ' e.g. theDocs={\"View1\",\"Layout1\"}\ntheDocs={}\n\n'------------------------------\n 'Controls (Buttons and normal Tools) to include\n 'Controls {GUI name,ControlType,ScriptName}\n 'For a spacer, substitute the name of the script of rhte word \"Space\"\n 'e.g. TheControlList={{\"View\",\"ButtonBar\",\"View.ZoomIn\"}, {\"View\",\"ToolBar\",\"View.Identify\"}}\n \nTheControllist={ {\"View\",\"ButtonBar \",\"StreamMode.Form.Activate\"},\n }\n\n'------------------------------\n 'Tool menus to include\n ' This is a list of which tool menus to include. Tool menus are specified\n ' by giving a GUI name and a script name of one of the tools in the tool menu\n ' Using this to locate the tool menu ALL other tools inb that menu and \n ' their scripts will be extracted\n \n '**** the code for adding tools has not been modified for adding spaces ****\n \nTheToolMenuList={}\n\n\n'------------------------------\n 'The Men us to include (a list of menu items listing the doc, the top menu, and the script for the menu item)\n 'For a spacer, substitute the name of the script of rhte word \"Space\"\n 'The MenuList {Doc name, Main Menu name , menu item Scriptname}\n ' e.g. The MenuList={}\n \n TheMenuList={}\n \n '------------------------------\n 'The popups to include (a list of popups listing the doc, the top menu item, and the script for the popup item)\n 'For a spacer, substitute the name of the script of the word \"SPACE\"\n 'The PopupList {Doc name, Popup Menu name , popup item Scriptname}\n \n ThePopupList={}\n\n\n '------------------------------\n 'I prefix all my scripts with a code eg SRV.Open. If I want them to be included with the extension, then all I have to do is\n 'put the prefix here. There is a check to remove any scripts that have all ready ben referenced above (ie in menus of controls).\n \n'****Enter the script prefix only****\nScriptPrefix=\"StreamMode\"\n\n'------------------------------\n 'The dialogs to include.\n\ntheDialogs={\"StreamMo de.Form\"}\n\n'------------------------------\n 'The Dependencies\ntheDependencies={\"$AVBIN/AVDLOG.DLL\".asfilename}\n\n'------------------------------\n' ATTENTION!!!!!!!!!!!!!!!\n' Do NOT alter the script after these lines, the remainer of this script\n' uses the lists you provided above to build the extension object.\n'_______________________________________________________________\n'_______________________________________________________________\n'_______________________________________________________________\n'____ ___________________________________________________________\n'_______________________________________________________________\n'_______________________________________________________________\n'_______________________________________________________________\n'_______________________________________________________________\n'_______________________________________________________________\n\n'Create a total list of the needed scripts\nTheNeeded={}\n\n'Modified to make a full list of the scripts, add in the others and \n 'then remove the duplicates\n\nScriptPrefixFull=ScriptPrefix+\".\"\n\nfor each d in av.GetProject.GetDocs\n if (d.Is(SEd) AND (d.GetName.Left(ScriptPrefix.count+1) = ScriptPrefixFull)) then \n theNeeded.Add(d.GetName)\n end\nend\n\nfor each ControlScript in thecontrolList\n 'test for spacers\n if(ControlScript.get(2) <> \"Space\") then\n TheNeeded.add(ConTrolScript.get(2))\n end\nend\n\nFor each MenuScript in theMenuList\n 'test for spacers\n if(MenuScript.get(2) <> \"Space\") then\n theNeeded.add(MenuScript.get(2))\n en d\nend\n\nFor each PopUpScript in thePopupList\n 'test for spacers\n if(PopupScript.get(2) <> \"Space\") then\n theNeeded.add(PopupScript.get(2))\n end\nend\n\n \n'Make a unique list of all the scripts referenced.\n\n'totalscripts=thescripts.merge(theNeeded)\nTotalScripts=theNeeded\nTotalScripts.removeduplicates\n\n'msgbox.listAsString(TotalScripts,\"\",\"\")\n\ntheInstall=av.GetProject.FindScript(InscriptName)\nif (theInstall=NIL) then \n Msgbox.Error(\"The install Script \"+InScriptName+\" was not found\",\"Script not found\")\n retu rn(nil)\nend\n\ntheUninstall=av.GetProject.FindScript(unscriptName)\nif (theUninstall=NIL) then \n Msgbox.Error(\"The install Script \"+UnScriptName+\" was not found\",\"Script not found\")\n return(nil)\nend\n\n\n'Create the extension\n' Extension.Make(ExtensionFile, theExtensionName, InstallScript, UninstallScript, Dependancies_\n\nmyExt = Extension.Make(theExtensionFile.asFilename, \n theExtensionName,\n theInstall,\n theUninstall, \n theDependencies)\n\n\n\nTheDoc List={}\nTheTotalControls={}\nThetotalMenus={}\ntheTotalToolMenus={}\nTheTotalPopups={}\n\n' Process the Document List\nfor each aDoc in TheDocs\n if ((av.getproject.findDoc(aDoc)=\"Null\").NOT) then\n TheDocList.Add(av.GetProject.FindDoc(aDoc))\n else\n MsgBox.Warning(\"The Doc \"+adoc.asstring+\" cannot be found in the current project.\",\"Script Error\")\n return(nil)\n end\nend\n\n'Add the List of Documents\nMyExt.add(TheDocList)\n\n\n\n' Process the control List\n'__________________________________________\n\n'Contro ls {GUI,ControlType,Scriptname}\n'__________________________________________\n'__________________________________________\n'__________________________________________\n\nfor each aControl in TheControlList\n 'msgbox.info(acontrol.get(0).asstring,\"\")\n if (acontrol.get(2)=\"Space\") then\n theDocGui=acontrol.get(0)\n theControl=acontrol.get(1)\n TheTotalControls.add({theDocGui,theControl,\"Space\"})\n else\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgB ox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current project.\",\"Script Error\")\n return(nil)\n end\n \n theControlType=acontrol.get(1)\n thecommand=\"av.getproject.findGUI(\"\"\"+aControl.get(0)+\"\"\").Get\"+acontrol.get(1)\n 'msgbox.info(thecommand,\"\")\n thescript1=Script.Make(thecommand)\n thecontrolset=thescript1.doit(\"\")\n theFoundControl=TheControlSet.FindbyScript(aControl.get(2))\n if (theFoundControl=NIL) then \n MsgBox.Warning(\"No Control found wi th the script \"+aControl.get(2)+\" in \"+acontrol.get(1),\"Warning\")\n return(nil)\n end\n if (theFoundControl.is(ToolMenu)) then \n MsgBox.Warning(\"The script \"+aControl.get(2)+\" in \"+acontrol.get(1)+\" is for a tool menu.\",\"Not Supported\")\n return(nil)\n end\n \n TheTotalControls.Add({aControl,thefoundControl,theControlSet.getcontrols.find(thefoundcontrol)})\n end\nend \n'Add to Ext\nMyExt.add(TheTotalControls)\n\n'__________________________________________\n\n'The MenuList {Doc, Menu, MenuScript}\n'__________________________________________\n'__________________________________________\n'__________________________________________\n\nFor each aMenu in themenulist\n if (aMenu.get(2) = \"Space\") then\n theDocGui=amenu.get(0)\n theControl=amenu.get(1)\n theTotalMenus.add({theDocGui,theControl,\"Space\"})\n else\n mDoc=aMenu.get(0)\n mMenu=aMenu.get(1)\n mScript=aMenu.get(2)\n \n themDoc=av.getproject.findGUI(mDoc)\n if (themDoc=NIL) then \n MsgBox.Warning(\"The G UI \"+mDoc+\" cannot be found in the current project.\",\"Script Error\")\n return(nil)\n end\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 Error\")\n return(nil)\n end\n \n themenucontrol=themenu.findbyScript(mScript)\n \n if (themenucontrol=NiL) then\n MsgBox.Warning(\"The script \"+mScript+\" not found.\",\"Warning\")\n return(nil)\n end\n themenuitemidx=themenu.getcontrols.find(themenucontrol)\n thetotalmenus.add({amenu,theMenuControl,theMenuItemIdx})\n end\nend\n\nmyext.add(thetotalmenus)\n\n\n'__________________________________________\n\n'The PopupList {Doc, menu, PopupScript}\n'__________________________________________\n'__________________________________________\n'__________________________________________\n\nFor each apopup in thepopuplist\n if (apopup.get(2) = \"Space\") then\n theDocGui=apopup.get(0)\n theControl=apopup.get(1)\n theTot alPopups.add({theDocGui,theControl,\"Space\"})\n else\n pDoc=apopup.get(0)\n popMenu=apopup.get(1)\n pScript=apopup.get(2)\n \n thepDoc=av.getproject.findGUI(pDoc)\n if (thepDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+pDoc+\" cannot be found in the current project.\",\"Script Error\")\n return(nil)\n end\n thepopups=av.getproject.findGUI(pDoc).GetPopUps\n thepopup=thepopups.findbylabel(popMenu)\n if (thepopup=NiL) then\n MsgBox.Warning(\"The popup named \"+popMenu+\" is not h ere.\",\"Script Error\")\n return(nil)\n end\n \n thepopupcontrol=thepopup.findbyScript(pScript)\n \n if (thepopupcontrol=NiL) then\n MsgBox.Warning(\"The script \"+pScript+\" not found.\",\"Warning\")\n return(nil)\n end\n thepopitemidx=thepopup.getcontrols.find(thepopupcontrol)\n thetotalpopups.add({apopup,thepopupControl,thepopItemIdx})\n end\nend\n\nmyext.add(thetotalpopups)\n \n'__________________________________________\n\n'Process the Tool Menu List\n'_______________________________ ___________\n'__________________________________________\n'__________________________________________\n \nfor each aControl in TheToolMenuList\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 Error\")\n return(nil)\n end\n thecontrolset=theControlDoc.getToolbar\n theFoundControl=TheControlSet.FindbyScript(aControl.get(1))\n if (theFoundControl=NIL) then \n MsgB ox.Warning(\"No Control found with the script \"+aControl.get(1)+\" in \"+acontrol.get(1),\"Warning\")\n return(nil)\n end\n if (theFoundControl.is(ToolMenu).not) then \n MsgBox.Warning(\"The script \"+aControl.get(1)+\" is NOT for a tool menu.\",\"User Error\")\n return(nil)\n end \n \n TheTotalToolMenus.Add({aControl,thefoundControl,theControlSet.getcontrols.find(thefoundcontrol)})\nend \n\nmyext.add(thetotalToolmenus)\n \n\n'__________________________________________\n\n' Process the Script list\n' __________________________________________\n'__________________________________________\n'__________________________________________\n\n\nfor each adoc in av.getproject.getdocs\n if (adoc.Is(SED)) then\n myExt.Add(adoc.getscript)\n end\nend\n\n\n'__________________________________________\n\n' Process the Dialog list\n'__________________________________________\n'__________________________________________\n'__________________________________________\n\nfor each adialog in theDialogs\n if ((av.getproject.finddialog(adialo g)=\"Null\").NOT) then\n myExt.Add(av.GetProject.FindDialog(adialog))\n else\n MsgBox.Warning(\"The dialog \"+adialog+\" cannot be found in the current project.\",\"Dialog Eror\")\n return(nil)\n end\nend\n\nif (LoadScriptName <> Nil) then\n if ((av.getproject.findscript(LoadScriptName)=\"Null\").NOT) then\n myExt.SetLoadScript( av.FindScript(LoadScriptName))\n else\n MsgBox.Warning(\"The Load Script \"+LoadScriptName+\" cannot be found in the current project.\",\"Load Script Eror\")\n return(nil)\n end\nend\n\nif (UnLoadScriptName <> Nil) then\n if ((av.getproject.findscript(UnLoadScriptName)=\"Null\").NOT) then\n myExt.SetUnLoadScript(av.FindScript(UnLoadScriptName))\n else\n MsgBox.Warning(\"The UnLoad Script \"+UnLoadScriptName+\" cannot be found in the current project.\",\"UnLoad Script Eror\")\n return(nil)\n end\nend\n \nmyExt.SetAbout(theDescription)\nmyExt.SetExtVersion(theVersion)\nmyExt.Commit\nfile.copy(\"$USEREXT/StreamMode.AVX\".asfilename,\"d:\\projects\\avproj\\dnrhydro\\StreamMode.avx\".asfilena me)\n" ) (Script.17 Name: "Extension.Uninstall" SourceCode: "' Name: Extension.Uninstall\n'\n' Author: Original Script ESRI Redlands\n' Modified Harley Prowse, Auckland UniServices - Geographic Technologies (harleyp@gtech.co.nz)\n'\n' Title: Extension Builder - Uninstall\n'\n' Topics: \n'\n' Description: \n'\n' Requires: \n'\n' Self: \n'\n' Returns:\n\n'DO NOT EDIT!!!\n\n'The SELF is the Extension\n\ntheDocs = SELF.get(0)\ntheControlList = SELF.get(1)\ntheMenuList = SELF.get(2)\nthePopupList = SELF.get(3)\ntheToolMenuList=SELF.get(4)\ntheProject=Av.getproject\n\n\n'remove 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 theProject.RemoveDoc(adoc)\n end\nend\n\n'Removethe Controls\n'\nfor each totalControl in theControlList\n \n if (totalcontrol.get(2) <> \"Space\") then\n \n 'Get the control list from the Ext\n acontrol=totalControl.get(0)\n \n 'Get the physical Control\n theControl = tot alControl.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\n else\n thecommand=\"av.getproject.findGUI(\"\"\"+totalControl.get(0)+\"\"\").Get\"+totalcontrol.get(1)\n thescript1=Script.Make(thecommand)\n thecontrolset=thescript1 .doit(\"\")\n \n spacerControl=theControlSet.FindByName(\"Spacer\")\n \n if (spacerControl <> nil) then\n theControlSet.remove(spacerControl)\n end\n end\nend\n\n'msgbox.info(\"Controls Removed OK\",\"\")\n\n'Remove the Menus\n'\nfor each totalcontrol in theMenuList\n \n 'The Control list\n acontrol=totalControl.get(0)\n if (totalControl.get(2) <> \"Space\") then\n \n mDoc=acontrol.get(0)\n mMenu=acontrol.get(1)\n mMenuItem=acontrol.get(2)\n \n 'The physical contro l\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\n else\n 'Find the DocGUI\n theControlDoc=av.getproject.findGUI(totalControl .get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+totalControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\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 theSpacer=themenu.findbyname(\"Spacer\")\n if (thespacer <> nil) then\n themenu.remove(theSpacer)\n end\n end\n end\nend\n\n'msgbox.info(\"Menus Removed OK\",\"\")\n\n'__________________________________________________________________________\n'Remove the Popups\n'__________________________________________________________________________\n\nfor each totalcontrol in thePopupList\n \n 'The Control list\n acontrol=totalControl.get(0)\n if (totalControl.get(2) <> \"Space\") then\n \n pDoc=acontrol.get(0)\n popMenu=acontrol.get(1)\n pMenuIt em=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 thepopups=av.getproject.findGUI(pDoc).Getpopups\n thep opup=thepopups.findbylabel(popMenu)\n if (thepopup=NiL) then\n MsgBox.Warning(\"The popup named \"+popMenu+\" is not here.\",\"Script Eror\")\n 'return(nil)\n else \n thething=thepopup.getcontrols.find(thecontrol)\n if (thething<>NIL) then \n thepopup.remove(thecontrol) \n end\n 'msgbox.info(themenu.GetControls.count.asstring,\"\")\n if (thepopup.GetControls.count<1) then\n thepopups.remove(thepopup)\n end\n end\n else\n 'Find the DocGUI\n theControlDoc=av.getproject.findGUI(totalControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+totalControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n thepopups=av.getproject.findGUI(mDoc).Getpopups\n thepopup=thepopups.findbylabel(popMenu)\n if (thepopup=NiL) then\n MsgBox.Warning(\"The popup named \"+thepopup+\" is not here.\",\"Script Eror\")\n 'return(nil)\n else\n theSpacer=thepopup.findbyname(\"Spacer\")\n if (thespacer <> nil) then\n thepopup.remove(theSpacer)\n end\n end\n end\nend\n\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=NI L) 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.getproject.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'msgbox.info(\"ToolMenus Removed OK\",\"\")\n\n'And the scripts delete themselves\n\n'**** Uncomment this line if your extension contains dialogs *****\n\nav.getproject.removedialog(\"StreamMode.Form\")\nDialog.detachfromextension(self)\n\n\nav.purgeObjects\nav.getproject.setmodified(true)\n\n\n\n\n" ) (Script.18 Name: "StreamMode.Digitize" SourceCode: "' Name: StreamMode.Digitize\n'\n' Author: Timothy N. Loesch \n' Minnesota Department of Natural Resources\n' GIS Applications Coordinator\n' 500 Lafayette Road, Box 11\n' St. Paul, MN 55155\n' tim.loesch@dnr.state.mn.us\n' (651) 296-0654 \n\n' Date: Mon Aug 02 14:57:00 1999\n' Revised by: \n' Revision Date: \n' Revisions: \n' -------------------------------------------------------------------\n' Description: This script is the main driver for the Stream Dig itizing Module.\n' Using a pre-defined stack object (defined in the StreamMode.Form.Open script) this\n' script finds the mouse location on the view and gets the value and places it on the \n' stack. If the point is within the distance tolerance defined on the StreamMode.Form \n' Dialog, it is not added to the stack. A line is created to show the user where the lines\n' are being recorded.\n' \n' This script should be attach ed to a tool and as long as the Shift key is pressed, the\n' script will call itself every 0.1 seconds to record a new mouse location.\n' Requires: StreamMode.Form to be opened\n' Runs: StreamMode.MakeLine\n' Run by: a tool on the StreamMode.Form\n' Self: \n' Returns: nothing, StreamMode.MakeLine does the rest of the work.....\n'-------------------------------------------------------------------\nScript.The.SetNumberFormat(\"dd.d\")\ntheview = av.getactivedoc\nif (theView.Is(View).Not) then\n return nil\nen d\nthedisplay = theview.getdisplay\n\n' as long as the Shift Key is down do the following...\n'\nif (System.IsShiftKeyDown) then \n 'get the current mouse location...\n thepnt = thedisplay.getmouseloc.clone\n \n 'see how far away the current mouse location is from the previous point. If it's outside the tolerance,\n ' add it to the stack and create a temporary line segment on the screen.\n '\n if (thepnt.distance(_Previous_Point) > \n av.FindDialog(\"StreamMode.Form\").FindByName(\"Distance Tole rance txt\").GetText.AsNumber) then\n\n 'draw the temporary line segment so that the user can see what they're doing\n '\n theline = line.make(_Previous_Point,thepnt)\n thegraphic = graphicShape.make(theline)\n theGraphic.SetObjectTag(\"StreamModeTempLine\")\n theView.getgraphics.add(thegraphic)\n \n 'add the current mouse location to the stack and set it as the _Previous_Point for the next location....\n '\n _cs.push(thepnt)\n _Previous_Point = thepnt.clone\n av.showmsg(thepnt.asstring) \n \n else\n av.showmsg(\"Segment too short, segment not added\")\n end\n \n ' run this script again, 0.1 seconds later...\n '\n Av.DelayedRun(\"StreamMode.Digitize\",nil,_T_Tol)\n else\n ' if the shift key is released, then make sure more than one point has been added to the stack. If so, then\n ' call the StreamMode.Makeline Script and reset the _Previous_Point Variable.....\n if (_cs.depth > 1) then\n av.run(\"StreamMode.MakeLine\",nil)\n _Previous_Point = Point.MakeNull\n end\nend\n" ) (Script.19 Name: "StreamMode.Form.Activate" SourceCode: "' Name: StreamMode.Form.Activate\n'\n' Author: Timothy N. Loesch \n' Minnesota Department of Natural Resources\n' GIS Applications Coordinator\n' 500 Lafayette Road, Box 11\n' St. Paul, MN 55155\n' tim.loesch@dnr.state.mn.us\n' (651) 296-0654 \n\n' Date: Tue Aug 03 09:40:10 1999\n' Revised by: \n' Revision Date: \n' Revisions: \n' -------------------------------------------------------------------\n' Description: This script is run from a button on the inte rface that opens\n' the dialog - StreamMode.Form\n' Requires: \n' Runs: \n' Run by: \n' Self: \n' Returns: \n'-------------------------------------------------------------------\n\nav.FindDialog(\"StreamMode.Form\").Open" ) (Script.20 Name: "StreamMode.Form.Open" SourceCode: "theDialog = av.FindDialog(\"StreamMode.Form\")\ntheDTol = av.getactivedoc.getdisplay.ReturnExtent.GetWidth * 0.001\n\ntheDialog.FindByName(\"Line Smoothing ckb\").SetSelected(true)\ntheDialog.FindByName(\"Generalize Lines cbx\").SetSelected(True)\ntheDialog.FindByName(\"Distance Tolerance txt\").SetText(theDTol.SetFormat(\"d.ddd\").Truncate.AsString)\n\n_cs = Stack.Make\n_T_Tol = 0.5\n_Previous_Point = Point.MakeNull\n\nAVUpperLeft = av.ReturnOrigin\nAVWidth = av.ReturnExtent.GetX\nTheDialog.MoveTo(( (AVUpperLeft.GetX + AVWidth) - theDialog.ReturnExtent.GetWidth), AVUpperLeft.GetY + 95)" ) (Script.21 Name: "StreamMode.Form.SmoothLines.Click" SourceCode: "av.FindDialog(\"StreamMode.Form\").FindByName(\"Smoothing Slider\").update" ) (Script.22 Name: "StreamMode.Form.Steptxl.Update" SourceCode: "' Name: StreamMode.Form.Steptxl.Update\n'\n' Author: Timothy N. Loesch \n' Minnesota Department of Natural Resources\n' GIS Applications Coordinator\n' 500 Lafayette Road, Box 11\n' St. Paul, MN 55155\n' tim.loesch@dnr.state.mn.us\n' (651) 296-0654 \n\n' Date: Wed Aug 04 11:45:26 1999\n' Revised by: \n' Revision Date: \n' Revisions: \n' -------------------------------------------------------------------\n' Description: this script updates the Smooth Step In crement Textline. If smoothing\n' is off, then this control gets inactive.\n' Requires: \n' Runs: \n' Run by: \n' Self: \n' Returns: \n'-------------------------------------------------------------------\n\nif (av.FindDialog(\"StreamMode.Form\").FindByName(\"Line Smoothing ckb\").IsSelected) then\n av.FindDialog(\"StreamMode.Form\").FindByName(\"Smoothing Slider\").SetEnabled(True)\n else\n av.FindDialog(\"StreamMode.Form\").FindByName(\"Smoothing Slider\").SetEnabled(FALSE)\nend\n \n " ) (Script.23 Name: "StreamMode.Form.Update" SourceCode: "' Name: StreamMode.Form.Update\n'\n' Author: Timothy N. Loesch \n' Minnesota Department of Natural Resources\n' GIS Applications Coordinator\n' 500 Lafayette Road, Box 11\n' St. Paul, MN 55155\n' tim.loesch@dnr.state.mn.us\n' (651) 296-0654 \n\n' Date: Tue Aug 03 09:25:12 1999\n' Revised by: \n' Revision Date: \n' Revisions: \n' -------------------------------------------------------------------\n' Description: This script updates the tools on the form\n' Re quires: \n' Runs: \n' Run by: \n' Self: \n' Returns: \n'-------------------------------------------------------------------\ntheView = av.GetActiveDoc\nif (TheView.Is(View).not) then\n return nil\nend\n\ntheDialog = av.FindDialog(\"StreamMode.Form\")\ntheTheme = theView.GetEditableTheme\n\nif (thetheme = nil) then\n for each atool in {\"Stream Polygon Tool\",\"Stream Line Tool\"}\n theDialog.FindByName(atool).SetEnabled(TRUE)\n end\n for each atool in {\"Polygon Append Tool\",\"Feature Split Tool\"}\n theDialog.FindByName(ato ol).SetEnabled(False)\n end\n return nil\nend\n\nif (theTheme.GetFTab.FindField(\"Shape\").GetType = #FIELD_SHAPEPOLY) then\n theDialog.FindByName(\"Stream Polygon Tool\").SetEnabled(TRUE)\n theDialog.FindByName(\"Polygon Append Tool\").SetEnabled(TRUE)\n else\n theDialog.FindByName(\"Stream Polygon Tool\").SetEnabled(FALSE)\n theDialog.FindByName(\"Polygon Append Tool\").SetEnabled(FALSE)\nend\n\nif (theTheme.GetFTab.FindField(\"Shape\").GetType = #FIELD_SHAPELINE) then\n theDialog.FindByName(\"Stream Line Tool\").SetEnabled(T RUE)\n else\n theDialog.FindByName(\"Stream Line Tool\").SetEnabled(FALSE)\nend\n\nif ( (theTheme.GetFTab.FindField(\"Shape\").GetType = #FIELD_SHAPELINE) or (theTheme.GetFTab.FindField(\"Shape\").GetType = #FIELD_SHAPEPOLY) ) then\n theDialog.FindByName(\"Feature Split Tool\").SetEnabled(TRUE)\n else\n theDialog.FindByName(\"Feature Split Tool\").SetEnabled(FALSE)\nend\n" ) (Script.24 Name: "StreamMode.Generalize" SourceCode: "' Name: StreamMode.Generalize\n'\n' Author: Timothy N. Loesch \n' Minnesota Department of Natural Resources\n' GIS Applications Coordinator\n' 500 Lafayette Road, Box 11\n' St. Paul, MN 55155\n' tim.loesch@dnr.state.mn.us\n' (651) 296-0654 \n\n' Date: Mon Aug 02 12:36:08 1999\n' Revised by: \n' Revision Date: \n' Revisions: \n' -------------------------------------------------------------------\n' Description: Generalizes a PolyLine Segment using simple imp lementation of the Douglas - Peucker algorithm\n' Requires: \n' Runs: \n' Run by: \n' Self: \n' Returns: \n'-------------------------------------------------------------------\n\nthePolyLine = Self.Get(0)\ntheTol = Self.Get(1)\n\n'thepolyline = av.getactivedoc.getgraphics.getselected.get(0).getshape\n'thetol = 10\n\n' Make a list for collecting the new set of point lists\n\ntheNShape = List.Make\n\nfor each p in thePolyLine.AsList\n ' Make a list for collecting the vertices to keep\n theNList = List.Make\n\n ' Set up stack fo r holding a set of lists of form {index,point}\n theStack = Stack.Make\n\n ' Add first point to the list being assembled, and make it the anchor\n theAnchor = p.Get(0)\n theNList.Add(theAnchor)\n \n aIndex = 0\n\n ' Add last point to stack\n fIndex = p.Count - 1\n theStack.Push({fIndex,p.Get(fIndex)})\n ' Process the points with the Douglas - Peucker approach\n while (theStack.IsEmpty.Not)\n ' Process from Anchor (beginning) to Floater (top of stack)\n fIndex = theStack.Top.Get(0)\n ' Create graphic sha pe for comparing distances\n theVect = Line.Make(theAnchor,theStack.Top.Get(1))\n\n ' Initialize values for comparison\n\n theMax = theTol\n mxIndex = 0\n\n ' Find distance\n for each i in (aIndex + 1) .. (fIndex - 1) ' process middle points\n dist = theVect.Distance(p.Get(i))\n ' Check against previous maximum\n if (dist >= theMax) then ' this point is out of the tolerance\n theMax = dist\n mxIndex = i\n end\n end\n ' If a vertex is found outside the current tolera nce corridor,\n ' push it onto the stack\n if (mxIndex > 0) then 'a new floater has been found\n theStack.Push({mxIndex,p.Get(mxIndex)})\n else ' add floater to the list for the new shape and move forward\n theNList.Add(theStack.Top.Get(1))\n ' Make the floater the new anchor\n theAnchor = theStack.Pop.Get(1)\n aIndex = fIndex\n end\n theNShape.Add(theNList)\n end\nend\ntheNShape = Polyline.Make(theNShape)\n\nif (theNShape.IsNull) then\n msgbox.info(\"The output is null\",\"\")\n else\n return theNShape\nend" ) (Script.25 Name: "StreamMode.MakeLine" SourceCode: "' Name: StreamMode.MakeLine\n'\n' Author: Timothy N. Loesch \n' Minnesota Department of Natural Resources\n' GIS Applications Coordinator\n' 500 Lafayette Road, Box 11\n' St. Paul, MN 55155\n' tim.loesch@dnr.state.mn.us\n' (651) 296-0654 \n\n' Date: Tue Aug 03 08:44:39 1999\n' Revised by: \n' Revision Date: \n' Revisions: \n' -------------------------------------------------------------------\n' Description: This script makes a PolyLine or Polygon Shape fro m the coordinates\n' in the Global Stack object _CS (CoordinateStack). It also removes any\n' Graphics in the View that have an object tag of \"StreamModeTempLine\"\n' Requires: The global object _CS\n' Runs: \n' Run by: StreamMode.Digitize\n' Self: \n' Returns: \n'-------------------------------------------------------------------\n\n' first get the stack object that contains the coordinates of the digitizing event. If the\n' stack depth is less that one, then it doesn't do anything....\n\nif (_ cs.depth < 2) then\n return nil\nend\n\nclist = {}\nwhile (true)\n if (_cs.depth < 1) then\n break\n else\n clist.add(_cs.pop)\n end\nend\n\nScript.The.SetNumberFormat(\"dd.d\")\n\ntheView = av.getactivedoc\ntheDialog = av.FindDialog(\"StreamMode.Form\")\n\ntheShape = PolyLine.Make({clist})\n\nif (theDialog.FindByName(\"Line Smoothing ckb\").IsSelected) then\n theShape = av.run(\"StreamMode.SmoothPolyLine\",{theShape,av.FindDialog(\"StreamMode.Form\").FindByName(\"Smoothing Slider\").GetValue})\n if (theShape = nil) then\n re turn nil\n end\nend\n\nif (theDialog.FindByName(\"Generalize Lines cbx\").IsSelected) then\n theShape = av.run(\"StreamMode.Generalize\",{theShape,av.FindDialog(\"StreamMode.Form\").FindByName(\"Distance Tolerance txt\").GetText.AsNumber})\n if (theShape = nil) then\n return nil\n end\nend\n\n' now turn the polyline into a polygon if it needs to be....\nif (theDialog.FindByName(\"Stream Polygon Tool\").IsSelected) then\n theShape = Polygon.Make({clist})\nend\n\ntheShape.clean\n\ntheTheme = theView.GetEditableTheme\n\n' the next section is used when the user is splitting a line or polygon with a stream mode defined line\n'\nif (theDialog.FindByName(\"Feature Split Tool\").IsSelected) then\n if (theTheme <> nil) then \n theTheme.GetFtab.BeginTransaction\n theField = theTheme.GetFTab.FindField(\"Shape\")\n theType = theField.GetType\n if ((theType = #FIELD_SHAPEPOLY) or (theType = #FIELD_SHAPELINE)) then\n theTheme.Split(theshape)\n end\n theTheme.GetFtab.EndTransaction\n end \n 'the next section is used when appending to an existing polygon\n '\nelseif (theDialog.FindByName(\"Polygon Append Tool\").IsSelected) then\n if (theTheme <> nil) then\n theTheme.GetFtab.BeginTransaction\n theTheme.AutoComplete(theShape)\n theTheme.GetFtab.EndTransaction\n end \nelseif (theTheme <> nil) then\n ' This next section is for adding a polygon or line to the editable theme\n ' else it just goes on as a graphic\n theTheme.GetFtab.BeginTransaction\n thePrj = theView.GetProjection\n if (thePrj.IsNull.Not) then\n theshape = theshape.Return Unprojected(thePrj)\n end\n theField = theTheme.GetFTab.FindField(\"Shape\")\n rec = theTheme.GetFTab.AddRecord\n theTheme.GetFTab.SetValue(theField, rec, theshape)\n theTheme.GetFTab.GetSelection.ClearAll\n theTheme.GetFTab.GetSelection.Set(rec)\n theTheme.GetFTab.UpdateSelection\n theTheme.GetFtab.EndTransaction\n else ' just put the line or polygon on the View as a graphic....\n thegraphic = graphicShape.make(theShape)\n theView.GetGraphics.UnselectAll\n theGraphic.SetSelected(TRUE)\n theView.getgraphics.ad d(thegraphic)\nend\n\ngrlist = theView.GetGraphics\nwhile (true)\n if (grlist.FindByObjectTag(\"StreamModeTempLine\") <> nil) then\n grlist.removegraphic(grlist.FindByObjectTag(\"StreamModeTempLine\"))\n else\n break\n end\nend\ntheview.invalidate\nav.GetProject.SetModified(true)\n" ) (Script.26 Name: "StreamMode.SetDistTolInteractive" SourceCode: "theView = av.GetActiveDoc\ntheDialog = av.FindDialog(\"StreamMode.Form\")\nc = theView.ReturnUserCircle\n\nif (c.IsNull) then\n return nil\nelse\n thePrj = theView.GetProjection\n if (thePrj.IsNull.Not) then\n c = c.ReturnUnprojected(thePrj)\n end\nend\ntheDialog.FindByName(\"Distance Tolerance txt\").SetText(c.GetRadius.SetFormat(\"d.ddd\").AsString)\ntheDialog.FindByName(\"Distance Tolerance txt\").focus\n" ) (Script.27 Name: "StreamMode.SmoothPolyLine" SourceCode: "' Name: StreamMode.SmoothPolyLine\n'\n' Author: Timothy N. Loesch \n' Minnesota Department of Natural Resources\n' GIS Applications Coordinator\n' 500 Lafayette Road, Box 11\n' St. Paul, MN 55155\n' tim.loesch@dnr.state.mn.us\n' (651) 296-0654 \n\n' Date: Mon Aug 02 10:10:32 1999\n' Revised by: \n' Revision Date: \n' Revisions: \n' -------------------------------------------------------------------\n' Description: Smooth a PolyLine object using an iterative bezier technique\n' Requires: \n' Runs: \n' Run by: \n' Self: A list that contains a PolyLine object and a smoothing Step.\n' Returns: \n'-------------------------------------------------------------------\n\nThePolyLine = self.get(0)\nif (ThePolyLine.Is(PolyLine).Not) then\n msgbox.info(\"This script requires a Polyline\",Script.The.GetName)\n return nil\nend\n\n'Step Distance is used to define \n'\n'stepDist = thepolyline.returnlength * 0.02\n\n'stepdist = (self.get(1) / 100) * thePolyLine.ReturnLength\n'msgbox.info(stepdi st.asstring,\"\")\nstepdist = (self.get(1))\n\n' The following two factors, used in conjunction with step distance,\n' can be modified to control smoothness.\n'\noutsideIterations = 2 ' 1 .. n - degrees of freedom\niterations = 5 ' 1 .. n - smoothness within degrees freedom\n\nreduceStep = stepDist\nstepDist = stepDist * outsideIterations\n\nfor each j in 1 .. outsideIterations \n newplist = thepolyline.returndensified(stepDist).AsList.Get(0) \n for each x in 1..iterations \n newerplist = {} \n for each i in 0..(newplist.count-1)\n ' following if statement preserves start and end coords but at\n ' risk of overly densified start and end of path. \n if(i = 0) then \n newerplist.add(newplist.get(i))\n elseif(i = (newplist.count-1)) then\n newerplist.add(newplist.get(i))\n break\n end \n newp = line.make(newplist.get(i),newplist.get(i+1)).returncenter \n newerplist.add(newp) \n end\n newplist = newerplist.deepclone \n end \n thepolyline = polyline.make( {newplist}) \n stepDist = stepDist - reduceStep\nend\n\nreturn thepolyline" ) (Script.28 Name: "StreamMode.TestOutput" SourceCode: "' Name: StreamMode.TestOutput\n'\n' Author: Timothy N. Loesch \n' Minnesota Department of Natural Resources\n' GIS Applications Coordinator\n' 500 Lafayette Road, Box 11\n' St. Paul, MN 55155\n' tim.loesch@dnr.state.mn.us\n' (651) 296-0654 \n\n' Date: Tue Aug 03 08:24:42 1999\n' Revised by: \n' Revision Date: \n' Revisions: \n' -------------------------------------------------------------------\n' Description: This script was used to visualize different lev els of smoothing and generalizing...\n' Requires: \n' Runs: \n' Run by: \n' Self: \n' Returns: \n'-------------------------------------------------------------------\n\nthepl = av.getactivedoc.getgraphics.getselected.get(0)\nthepl = thepl.getshape\n\n'if (grout.IsNull) then\n' msgbox.info(\"Graphic Shape is Null\",\"\")\n' return nil\n'end\n\n\nfor each i in {10,20,30,40,50}\n thesymbol = symbol.make(#symbol_Pen)\n if (i = 10) then thesymbol.setcolor(Color.GetRed) end\n if (i = 20) then thesymbol.SetColor(Color.GetBlue) end\n if (i = 30) then thesymbol.SetColor(color.Getyellow) end\n if (i = 40) then thesymbol.SetColor(Color.GetGreen) end\n if (i = 50) then thesymbol.SetColor(Color.GetBlack) end\n' grout = av.run(\"StreamMode.Generalize\",{thepl,i})\n grout = av.run(\"StreamMode.SmoothPolyLine\",{thepl,i})\n thegraphic = graphicShape.make(grout)\n theGraphic.SetSymbol(thesymbol)\n av.getactivedoc.getgraphics.add(thegraphic)\n av.getactivedoc.invalidate\nend\n" ) (AVDLog.29 Name: "StreamMode.Form" X: 646 Y: 116 W: 312 H: 175 ConstrainedControlNames: 30 ConstrainedControlNames: 31 ConstrainedControlNames: 32 ConstrainedControlNames: 33 ConstrainedControlNames: 34 Constraints: 35 Constraints: 36 Constraints: 37 Constraints: 38 Constraints: 39 Server: 40 ControlPanel: 41 Title: "Stream Mode Digitizing" EscapeEnabled: 1 AlwaysOnTop: 1 HasTitleBar: 1 Closeable: 1 Open: "StreamMode.Form.Open" DefaultButton: 80 ) (AVStr.30 S: "Set Dist Tol Tool" ) (AVStr.31 S: "Stream Line Tool" ) (AVStr.32 S: "Stream Polygon Tool" ) (AVStr.33 S: "Polygon Append Tool" ) (AVStr.34 S: "Feature Split Tool" ) (Numb.35 N: 85.00000000000000 ) (Numb.36 N: 85.00000000000000 ) (Numb.37 N: 85.00000000000000 ) (Numb.38 N: 85.00000000000000 ) (Numb.39 N: 85.00000000000000 ) (Nil.40 ) (CPanel.41 Child: 42 Child: 49 Child: 66 Child: 68 Child: 70 Child: 72 ResBox: 74 ResBox: 75 ResBox: 76 ResBox: 77 ResBox: 78 ResBox: 79 Listening: 1 ) (CPanel.42 InternalName: "aControlPanel1" Child: 43 Child: 45 Constraints: 0x55 ResBox: 47 ResBox: 48 VisibleBorder: 1 Listening: 1 ) (Tool.43 InternalName: "Set Dist Tol Tool" Help: "Set Distance Tolerance//Interactively Set the Vertex Distance Tolerance. No two vertices will be closer than this tolerance." Icon: 44 Cursor: "Cursors.Target" Apply: "StreamMode.SetDistTolInteractive" ) (AVIcon.44 Name: "SelectCircle" Res: "Icons.SelectCircle" ) (TextLine.45 InternalName: "Distance Tolerance txt" Text: "27" Label: "Distance Tolerance" Constraints: 0x55 Listening: 1 TextType: 46 NextControl: 40 ) (AVEnum.46 Name: "TEXTLINE_TYPE_REAL" ) (RectD.47 Left: 203.00000000000000 Top: 40.00000000000000 Right: 232.00000000000000 Bottom: 10.00000000000000 ) (RectD.48 Left: 8.00000000000000 Top: 35.00000000000000 Right: 190.00000000000000 Bottom: 15.00000000000000 ) (CPanel.49 InternalName: "aControlPanel3" Child: 50 Child: 51 Child: 52 Child: 59 Child: 60 Constraints: 0x55 ResBox: 61 ResBox: 62 ResBox: 63 ResBox: 64 ResBox: 65 VisibleBorder: 1 Listening: 1 ) (AVCBox.50 InternalName: "Line Smoothing ckb" Help: "Smooth Lines as they are added//This option will Smooth input lines using an iterative Bezier technique." Listening: 1 Label: "Smooth Lines" Click: "StreamMode.Form.SmoothLines.Click" Constraints: 0x55 ) (AVCBox.51 InternalName: "Generalize Lines cbx" Help: "Generalize Lines as they are added//This option will remove any vertices closer than the Distance Tolerance after Smoothing. It should have no effect on Unsmoothed Lines" Listening: 1 Selected: 1 Label: "Generalize Lines" Constraints: 0x55 ) (AVSlider.52 InternalName: "Smoothing Slider" Help: "Degree of Line Smoothing//Set the amount of smoothing you want to occurr on your lines..." Constraints: 0x55 NextControl: 40 Listening: 1 Horizontal: 1 Value: 53 Upper: 54 Lower: 55 ValueIncrement: 56 MainIncrement: 57 AuxIncrement: 58 ) (Numb.53 InternalName: "50.000000" N: 50.00000000000000 ) (Numb.54 InternalName: "300.000000" N: 300.00000000000000 ) (Numb.55 InternalName: "50.000000" N: 50.00000000000000 ) (Numb.56 InternalName: "2.000000" N: 2.00000000000000 ) (Numb.57 InternalName: "10.000000" N: 10.00000000000000 ) (Numb.58 InternalName: "0.000" ) (TextLabel.59 InternalName: "Low Txt" Constraints: 0x55 Label: "Low" Listening: 1 ) (TextLabel.60 InternalName: "High txl" Constraints: 0x55 Label: "High" Listening: 1 ) (RectD.61 Left: 155.00000000000000 Top: 27.00000000000000 Right: 288.00000000000000 Bottom: 7.00000000000000 ) (RectD.62 Left: 155.00000000000000 Top: 47.00000000000000 Right: 289.00000000000000 Bottom: 27.00000000000000 ) (RectD.63 Left: 2.00000000000000 Top: 28.00000000000000 Right: 148.00000000000000 Bottom: 6.00000000000000 ) (RectD.64 Left: 9.00000000000000 Top: 55.00000000000000 Right: 41.00000000000000 Bottom: 32.00000000000000 ) (RectD.65 Left: 117.00000000000000 Top: 54.00000000000000 Right: 149.00000000000000 Bottom: 32.00000000000000 ) (Tool.66 InternalName: "Stream Line Tool" Help: "Stream Digitize Lines//Allows the user to on-screen digitize lines in Stream Mode. Press the SHIFT Key, and click the mouse of the View to Start Digitizing. Release the SHIFT key to stop." Tag: "PolyLine" Update: "View.PolylineToolUpdate" Icon: 67 Cursor: "Cursors.CrossHair" Apply: "StreamMode.Digitize" ) (AVIcon.67 Name: "Stroke" Res: "Icons.Stroke" ) (Tool.68 InternalName: "Stream Polygon Tool" Help: "Stream Digitize Polygons//Allows the user to on-screen digitize Polygons in Stream Mode. Press the SHIFT Key, and click the mouse of the View to Start Digitizing. Release the Shift key to stop." Tag: "Polygon" Icon: 69 Cursor: "Cursors.CrossHair" Apply: "StreamMode.Digitize" ) (AVIcon.69 Name: "Loop" Res: "Icons.Loop" ) (Tool.70 InternalName: "Polygon Append Tool" Disabled: 1 Help: "Append Polygon//Creates a new polygon by adding a line to an adjacent polygon and completes it. You don't have to digitize the common boundary." Tag: "AutoComplete" Update: "View.AutoCompleteUpdate" Icon: 71 Cursor: "Cursors.CrossHair" Apply: "StreamMode.Digitize" ) (AVIcon.71 Name: "AutoComplete" Res: "Icons.AutoComplete" ) (Tool.72 InternalName: "Feature Split Tool" Disabled: 1 Help: "Split Feature//Use Stream Mode to create a PolyLine that will Split an existing PolyLine or Polygon" Tag: "SplitPoly" Update: "View.SplitPolyToolUpdate" Icon: 73 Cursor: "Cursors.CrossHair" Apply: "StreamMode.Digitize" ) (AVIcon.73 Name: "SplitPoly" Res: "Icons.SplitPoly" ) (RectD.74 Left: 13.00000000000000 Top: 122.00000000000000 Right: 297.00000000000000 Bottom: 67.00000000000000 ) (RectD.75 Left: 13.00000000000000 Top: 67.00000000000000 Right: 297.00000000000000 Bottom: 9.00000000000000 ) (RectD.76 Left: 199.00000000000000 Top: 158.00000000000000 Right: 228.00000000000000 Bottom: 128.00000000000000 ) (RectD.77 Left: 157.00000000000000 Top: 158.00000000000000 Right: 186.00000000000000 Bottom: 128.00000000000000 ) (RectD.78 Left: 116.00000000000000 Top: 158.00000000000000 Right: 145.00000000000000 Bottom: 128.00000000000000 ) (RectD.79 Left: 74.00000000000000 Top: 158.00000000000000 Right: 103.00000000000000 Bottom: 128.00000000000000 ) (Nil.80 )