/3.0 (Extension.1 Name: "Spatial Tools" FirstRootClassName: "List" Roots: 2 Roots: 3 Roots: 44 Roots: 213 Roots: 214 Roots: 215 Roots: 216 Roots: 217 Roots: 218 Roots: 219 Roots: 220 Roots: 221 Roots: 222 Roots: 223 Roots: 224 Roots: 225 Roots: 226 Roots: 227 Roots: 228 Roots: 229 Roots: 230 Roots: 231 Roots: 232 Roots: 233 Roots: 234 Roots: 235 Roots: 236 Roots: 237 Roots: 238 Roots: 239 Roots: 240 Roots: 241 Roots: 242 Roots: 243 Roots: 244 Roots: 245 Roots: 246 Roots: 247 Roots: 248 Roots: 249 Roots: 250 Roots: 251 Roots: 252 Roots: 253 Version: 30 About: "A collection of Grid Tools, including Warp, Cleanup, Merge, Clip, Mosaic, Aggregate and others." InstallScript: 254 UninstallScript: 255 ExtVersion: 3 ) (List.2 ) (List.3 Child: 4 Child: 12 Child: 20 Child: 28 Child: 36 ) (List.4 Child: 5 Child: 9 Child: 11 ) (List.5 Child: 6 Child: 7 Child: 8 ) (AVStr.6 S: "View" ) (AVStr.7 S: "ToolBar" ) (AVStr.8 S: "Warp.FromLinkTool" ) (Tool.9 Disabled: 1 Help: "Start Points//Creates a from link in the from view" Update: "Warp.FromLinkToolUpdate" Icon: 10 Cursor: "Cursors.CrossHair" Apply: "Warp.FromLinkTool" ) (AVIcon.10 Name: "S" Res: "Icons.S" ) (Numb.11 N: 15.00000000000000 ) (List.12 Child: 13 Child: 17 Child: 19 ) (List.13 Child: 14 Child: 15 Child: 16 ) (AVStr.14 S: "View" ) (AVStr.15 S: "ToolBar" ) (AVStr.16 S: "Warp.toLinkTool" ) (Tool.17 Disabled: 1 Help: "Desired Points//Creates a to link in the to view" Update: "Warp.ToLinkToolUpdate" Icon: 18 Cursor: "Cursors.CrossHair" Apply: "Warp.ToLinkTool" ) (AVIcon.18 Name: "D" Res: "Icons.D" ) (Numb.19 N: 16.00000000000000 ) (List.20 Child: 21 Child: 25 Child: 27 ) (List.21 Child: 22 Child: 23 Child: 24 ) (AVStr.22 S: "View" ) (AVStr.23 S: "ToolBar" ) (AVStr.24 S: "Spatial.Shift" ) (Tool.25 Disabled: 1 Help: "Shift Grid//Shifts the grid to the new clicked on position" Update: "Spatial.HasActiveGridThemeUpdate" Icon: 26 Cursor: "Cursors.Default" Apply: "Spatial.shift" ) (AVIcon.26 Name: "ShiftRight" Res: "Icons.ShiftRight" ) (Numb.27 N: 17.00000000000000 ) (List.28 Child: 29 Child: 33 Child: 35 ) (List.29 Child: 30 Child: 31 Child: 32 ) (AVStr.30 S: "View" ) (AVStr.31 S: "ButtonBar" ) (AVStr.32 S: "Warp.DeleteLink" ) (Butn.33 Disabled: 1 Help: "Delete Links//Deletes one or many links from the current link table" Update: "Warp.DeleteLinkUpdate" Icon: 34 Click: "Warp.DeleteLink" ) (AVIcon.34 Name: "Erase" Res: "Icons.Erase" ) (Numb.35 N: 23.00000000000000 ) (List.36 Child: 37 Child: 41 Child: 43 ) (List.37 Child: 38 Child: 39 Child: 40 ) (AVStr.38 S: "View" ) (AVStr.39 S: "ButtonBar" ) (AVStr.40 S: "Spatial.RotateGrid" ) (Butn.41 Help: "Rotate Grid//Rotates the grid in a clockwise motion around the lower left-hand corner" Update: "Spatial.HasGridThemeUpdate" Icon: 42 Click: "Spatial.RotateGrid" ) (AVIcon.42 Name: "SeriesRowCol" Res: "Icons.SeriesRowCol" ) (Numb.43 N: 24.00000000000000 ) (List.44 Child: 45 Child: 52 Child: 59 Child: 66 Child: 73 Child: 80 Child: 87 Child: 94 Child: 101 Child: 108 Child: 115 Child: 122 Child: 129 Child: 136 Child: 143 Child: 150 Child: 157 Child: 164 Child: 171 Child: 178 Child: 185 Child: 192 Child: 199 Child: 206 ) (List.45 Child: 46 Child: 50 Child: 51 ) (List.46 Child: 47 Child: 48 Child: 49 ) (AVStr.47 S: "View" ) (AVStr.48 S: "Clean Up" ) (AVStr.49 S: "Spatial.MajorityFilter" ) (Choice.50 Disabled: 1 Help: "Prompts for variables, runs MajorityFilter request on active grid theme." Update: "Spatial.HasActiveGridThemeUpdate" Label: "&Majority Filter" Click: "Spatial.MajorityFilter" Shortcut: "Keys.None" ) (Numb.51 ) (List.52 Child: 53 Child: 57 Child: 58 ) (List.53 Child: 54 Child: 55 Child: 56 ) (AVStr.54 S: "View" ) (AVStr.55 S: "Clean Up" ) (AVStr.56 S: "Spatial.RegionGroup" ) (Choice.57 Disabled: 1 Help: "Prompts for variables, runs RegionGroup request on active grid theme." Update: "Spatial.HasActiveGridThemeUpdate" Label: "&Region Group" Click: "Spatial.RegionGroup" Shortcut: "Keys.None" ) (Numb.58 N: 1.00000000000000 ) (List.59 Child: 60 Child: 64 Child: 65 ) (List.60 Child: 61 Child: 62 Child: 63 ) (AVStr.61 S: "View" ) (AVStr.62 S: "Clean Up" ) (AVStr.63 S: "Spatial.ExtractByCount" ) (Choice.64 Disabled: 1 Help: "Runs theGrid.ExtractByAttribute((\\\"[count] >= theCount)) on active grid theme. Cells < theCount are set to No Data in the new theme." Update: "Spatial.HasActiveGridThemeUpdate" Label: "&Extract By Count" Click: "Spatial.ExtractByCount" Shortcut: "Keys.None" ) (Numb.65 N: 2.00000000000000 ) (List.66 Child: 67 Child: 71 Child: 72 ) (List.67 Child: 68 Child: 69 Child: 70 ) (AVStr.68 S: "View" ) (AVStr.69 S: "Clean Up" ) (AVStr.70 S: "Spatial.Nibble" ) (Choice.71 Disabled: 1 Help: "Prompts for mask grid, analysis grid and request variables, runs Nibble request. Ignores active themes." Update: "Spatial.HasActiveGridThemeUpdate" Label: "&Nibble" Click: "Spatial.Nibble" Shortcut: "Keys.None" ) (Numb.72 N: 3.00000000000000 ) (List.73 Child: 74 Child: 78 Child: 79 ) (List.74 Child: 75 Child: 76 Child: 77 ) (AVStr.75 S: "View" ) (AVStr.76 S: "Clean Up" ) (AVStr.77 S: "Spatial.BoundaryClean" ) (Choice.78 Disabled: 1 Help: "Prompts for variables, runs BoundaryClean request on active grid theme." Update: "Spatial.HasActiveGridThemeUpdate" Label: "&Boundary Clean" Click: "Spatial.BoundaryClean" Shortcut: "Keys.None" ) (Numb.79 N: 4.00000000000000 ) (List.80 Child: 81 Child: 85 Child: 86 ) (List.81 Child: 82 Child: 83 Child: 84 ) (AVStr.82 S: "View" ) (AVStr.83 S: "Clean Up" ) (AVStr.84 S: "Spatial.Thin" ) (Choice.85 Disabled: 1 Help: "Prompts for variables then runs Thin request on active grid theme." Update: "Spatial.HasActiveGridThemeUpdate" Label: "&Thin" Click: "Spatial.Thin" Shortcut: "Keys.None" ) (Numb.86 N: 5.00000000000000 ) (List.87 Child: 88 Child: 92 Child: 93 ) (List.88 Child: 89 Child: 90 Child: 91 ) (AVStr.89 S: "View" ) (AVStr.90 S: "Transformation" ) (AVStr.91 S: "Spatial.MergeGrid" ) (Choice.92 Disabled: 1 Help: "Merge two or more grids" Update: "Spatial.HasActiveGridThemeUpdate" Label: "&Merge Grids" Click: "Spatial.MergeGrid" Shortcut: "Keys.None" ) (Numb.93 ) (List.94 Child: 95 Child: 99 Child: 100 ) (List.95 Child: 96 Child: 97 Child: 98 ) (AVStr.96 S: "View" ) (AVStr.97 S: "Transformation" ) (AVStr.98 S: "Spatial.Mosaic" ) (Choice.99 Help: "Runs Mosaic request based on user input." Label: "M&osaic" Click: "Spatial.Mosaic" Shortcut: "Keys.None" ) (Numb.100 N: 1.00000000000000 ) (List.101 Child: 102 Child: 106 Child: 107 ) (List.102 Child: 103 Child: 104 Child: 105 ) (AVStr.103 S: "View" ) (AVStr.104 S: "Transformation" ) (AVStr.105 S: "Spatial.Combine" ) (Choice.106 Disabled: 1 Help: "Combines the first selected grid with grids selected from the file dialog" Update: "Spatial.HasActiveGridThemeUpdate" Label: "&Combine Grids" Click: "Spatial.Combine" Shortcut: "Keys.None" ) (Numb.107 N: 2.00000000000000 ) (List.108 Child: 109 Child: 113 Child: 114 ) (List.109 Child: 110 Child: 111 Child: 112 ) (AVStr.110 S: "View" ) (AVStr.111 S: "Transformation" ) (AVStr.112 S: "Spatial.ClipGrid" ) (Choice.113 Disabled: 1 Help: "Clips either the inside or outside of a grid from a graphic object" Update: "Spatial.HasActiveGridThemeUpdate" Label: "C&lip Grid" Click: "Spatial.ClipGrid" Shortcut: "Keys.None" ) (Numb.114 N: 19.00000000000000 ) (List.115 Child: 116 Child: 120 Child: 121 ) (List.116 Child: 117 Child: 118 Child: 119 ) (AVStr.117 S: "View" ) (AVStr.118 S: "Transformation" ) (AVStr.119 S: "Warp.SetFromView" ) (Choice.120 Help: "Specifies the view to be used as the From View" Update: "Warp.SetFromViewUpdate" Label: "Set From View" Click: "Warp.SetFromView" Shortcut: "Keys.None" ) (Numb.121 N: 21.00000000000000 ) (List.122 Child: 123 Child: 127 Child: 128 ) (List.123 Child: 124 Child: 125 Child: 126 ) (AVStr.124 S: "View" ) (AVStr.125 S: "Transformation" ) (AVStr.126 S: "Warp.SetToView" ) (Choice.127 Help: "Specifies the view to be used as the To View" Update: "Warp.SetToViewUpdate" Label: "Set To View" Click: "Warp.SetToView" Shortcut: "Keys.None" ) (Numb.128 N: 22.00000000000000 ) (List.129 Child: 130 Child: 134 Child: 135 ) (List.130 Child: 131 Child: 132 Child: 133 ) (AVStr.131 S: "View" ) (AVStr.132 S: "Transformation" ) (AVStr.133 S: "Warp.SetLinkTable" ) (Choice.134 Disabled: 1 Help: "Specifies the table to be used as the Link Table" Update: "Warp.SetLinkTableUpdate" Label: "Set Link Table" Click: "Warp.SetLinkTable" Shortcut: "Keys.None" ) (Numb.135 N: 23.00000000000000 ) (List.136 Child: 137 Child: 141 Child: 142 ) (List.137 Child: 138 Child: 139 Child: 140 ) (AVStr.138 S: "View" ) (AVStr.139 S: "Transformation" ) (AVStr.140 S: "Warp.CreateLinkTable" ) (Choice.141 Help: "Creates a blank link table" Update: "Warp.CreateLinkTableUpdate" Label: "Create Link Table" Click: "Warp.CreateLinkTable" Shortcut: "Keys.None" ) (Numb.142 N: 24.00000000000000 ) (List.143 Child: 144 Child: 148 Child: 149 ) (List.144 Child: 145 Child: 146 Child: 147 ) (AVStr.145 S: "View" ) (AVStr.146 S: "Transformation" ) (AVStr.147 S: "Warp.TypeFromLink" ) (Choice.148 Disabled: 1 Help: "Allows you to type-in the coordinates for a from link" Update: "Warp.TypeFromLinkUpdate" Label: "Type In From Link" Click: "Warp.TypeFromLink" Shortcut: "Keys.None" ) (Numb.149 N: 25.00000000000000 ) (List.150 Child: 151 Child: 155 Child: 156 ) (List.151 Child: 152 Child: 153 Child: 154 ) (AVStr.152 S: "View" ) (AVStr.153 S: "Transformation" ) (AVStr.154 S: "Warp.TypeToLink" ) (Choice.155 Disabled: 1 Help: "Allows you to type-in the coordinates for a to link" Update: "Warp.TypeToLinkUpdate" Label: "Type in To Link" Click: "Warp.TypeToLink" Shortcut: "Keys.None" ) (Numb.156 N: 26.00000000000000 ) (List.157 Child: 158 Child: 162 Child: 163 ) (List.158 Child: 159 Child: 160 Child: 161 ) (AVStr.159 S: "View" ) (AVStr.160 S: "Transformation" ) (AVStr.161 S: "Warp.Warp" ) (Choice.162 Disabled: 1 Help: "Performs a polynomial warp on the active grid theme with the links found in the current link table" Update: "Warp.WarpUpdate" Label: "Warp" Click: "Warp.Warp" Shortcut: "Keys.None" ) (Numb.163 N: 27.00000000000000 ) (List.164 Child: 165 Child: 169 Child: 170 ) (List.165 Child: 166 Child: 167 Child: 168 ) (AVStr.166 S: "View" ) (AVStr.167 S: "Transformation" ) (AVStr.168 S: "Spatial.Aggregation" ) (Choice.169 Disabled: 1 Help: "Aggregate a grid using the selected method" Update: "Spatial.HasActiveGridThemeUpdate" Label: "&Aggregate" Click: "Spatial.Aggregation" Shortcut: "Keys.None" ) (Numb.170 N: 29.00000000000000 ) (List.171 Child: 172 Child: 176 Child: 177 ) (List.172 Child: 173 Child: 174 Child: 175 ) (AVStr.173 S: "View" ) (AVStr.174 S: "Analysis" ) (AVStr.175 S: "Spatial.ResampleGrid" ) (Choice.176 Disabled: 1 Help: "Resamples a grid using a control GUI." Update: "Spatial.HasActiveGridThemeUpdate" Label: "R&esample..." Click: "Spatial.ResampleGrid" Shortcut: "Keys.None" ) (Numb.177 N: 23.00000000000000 ) (List.178 Child: 179 Child: 183 Child: 184 ) (List.179 Child: 180 Child: 181 Child: 182 ) (AVStr.180 S: "View" ) (AVStr.181 S: "Analysis" ) (AVStr.182 S: "Spatial.RandomGrid" ) (Choice.183 Help: "Makes a uniform or normal random grid and adjusts it at user request" Label: "Random Grid..." Click: "Spatial.RandomGrid" Shortcut: "Keys.None" ) (Numb.184 N: 24.00000000000000 ) (List.185 Child: 186 Child: 190 Child: 191 ) (List.186 Child: 187 Child: 188 Child: 189 ) (AVStr.187 S: "View" ) (AVStr.188 S: "Analysis" ) (AVStr.189 S: "Spatial.PycnophylacticInterpolation" ) (Choice.190 Disabled: 1 Help: "The program performs pycnophylactic interpolation on a categorial grid\nThe analysis variable in the VTAB of the grid should represent a \nphenomenon that changes continuously over space." Update: "Spatial.HasActiveGridThemeUpdate" Label: "&Pycnophylactic Interpolation..." Click: "Spatial.PycnophylacticInterpolation" Shortcut: "Keys.None" ) (Numb.191 N: 25.00000000000000 ) (List.192 Child: 193 Child: 197 Child: 198 ) (List.193 Child: 194 Child: 195 Child: 196 ) (AVStr.194 S: "View" ) (AVStr.195 S: "Analysis" ) (AVStr.196 S: "Spatial.ZonalGeometryTable" ) (Choice.197 Disabled: 1 Help: "Computes the Zonal Geometry to the requested file and then adds it to the project. Gives the Area, Perimeter, Centroid, and Density." Update: "Spatial.HasActiveGridThemeUpdate" Label: "&Zonal Geometry Table" Click: "Spatial.ZonalGeometryTable" Shortcut: "Keys.None" ) (Numb.198 N: 26.00000000000000 ) (List.199 Child: 200 Child: 204 Child: 205 ) (List.200 Child: 201 Child: 202 Child: 203 ) (AVStr.201 S: "View" ) (AVStr.202 S: "Analysis" ) (AVStr.203 S: "Spatial.Profiler" ) (Choice.204 Help: "Creates chart profiles of line features usling a line theme and elevation grid theme" Label: "Profile" Click: "Spatial.Profiler" Shortcut: "Keys.None" ) (Numb.205 N: 27.00000000000000 ) (List.206 Child: 207 Child: 211 Child: 212 ) (List.207 Child: 208 Child: 209 Child: 210 ) (AVStr.208 S: "View" ) (AVStr.209 S: "Analysis" ) (AVStr.210 S: "Spatial.Profileswithfeaturepts" ) (Choice.211 Help: "Creates elevation profiles of selected lines and selected point features" Label: "Profile With Feature Points" Click: "Spatial.Profileswithfeaturepts" Shortcut: "Keys.None" ) (Numb.212 N: 28.00000000000000 ) (List.213 ) (Script.214 Name: "View.PointThemeUpdate" SourceCode: "theView = av.GetActiveDoc\nenabled = FALSE\n\n' enable if active theme is a point or multipoint theme\nfor each t in theView.GetActiveThemes\n if (t.Is(FTHEME) and ((t.GetFTab.FindField(\"Shape\").GetType = #FIELD_SHAPEPOINT) or\n (t.GetFTab.FindField(\"Shape\").GetType = #FIELD_SHAPEMULTIPOINT))) then \n enabled = TRUE\n end\nend\nif (theView.GetActiveThemes.Count > 1) then\n enabled = FALSE\nend\nSELF.SetEnabled(enabled)\n\n\n\n" ) (Script.215 Name: "Warp.SetToViewUpdate" SourceCode: "' SetToViewUpdate script\n\nenabled = FALSE\n\n' grab current settings of preference dictionary\nwarpExt = Extension.Find(\"Spatial Tools\")\nif (warpExt = NIL) then\n MsgBox.Error(\"Cannot find extension!\",\"ERROR\")\n return NIL\nend\nfromViewName = warpExt.GetPreferences.Get(\"From View\")\nif (fromViewName = NIL) then\n fromViewName = \"\"\nelseif (av.GetProject.FindDoc(fromViewName).Is(View).Not) then\n fromViewName = \"\"\nend\n\ntheViews = {}\nfor each d in av.GetProject.GetDocs\n if (d.Is(View)) then\n theViews.Add(d)\n e nd\nend\n\nif ((theViews.Count > 1) or\n ((theViews.Count = 1) and (theViews.Get(0).GetName <> fromViewName))) then\n enabled = TRUE\nend\n\nself.SetEnabled(enabled)\n\n\n" ) (Script.216 Name: "Warp.SetFromViewUpdate" SourceCode: "' SetFromViewUpdate script\n\nenabled = FALSE\n\n' grab current settings of preference dictionary\nwarpExt = Extension.Find(\"Spatial Tools\")\nif (warpExt = NIL) then\n MsgBox.Error(\"Cannot find extension!\",\"ERROR\")\n return NIL\nend\ntoViewName = warpExt.GetPreferences.Get(\"To View\")\nif (toViewName = NIL) then\n toViewName = \"\"\nelseif (av.GetProject.FindDoc(toViewName).Is(View).Not) then\n toViewName = \"\"\nend\n\ntheViews = {}\nfor each d in av.GetProject.GetDocs\n if (d.Is(View)) then\n theViews.Add(d)\n end\nend\n\nif ((theViews.Count > 1) or\n ((theViews.Count = 1) and (theViews.Get(0).GetName <> toViewName))) then\n enabled = TRUE\nend\n\nself.SetEnabled(enabled)\n\n\n" ) (Script.217 Name: "Warp.SetLinkTableUpdate" SourceCode: "' SetLinkTableUpdate\n\nenabled = FALSE\n\n' grab current setting from preference dictionary\nwarpExt = Extension.Find(\"Spatial Tools\")\nif (warpExt = NIL) then\n MsgBox.Error(\"Cannot find extension!\",\"ERROR\")\n return NIL\nend\nlinkTableName = warpExt.GetPreferences.Get(\"Link Table\")\nif (linkTableName = NIL) then\n linkTableName = \"\"\nelseif ((av.GetProject.FindDoc(linkTableName).Is(Table).Not) or\n ((av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"Link\") = NIL) or\n (av.GetProject.FindDoc(link TableName).GetVTab.FindField(\"From-X\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"From-Y\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"To-X\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"To-Y\") = NIL))) then\n linkTableName = \"\"\nend\n\ntheTables = {}\nfor each d in av.GetProject.GetDocs\n if ((d.Is(Table)) and\n ((d.GetVTab.FindField(\"Link\") <> NIL) or\n (d.GetVTab.FindField(\"From-X\") <> NIL) or\n (d.G etVTab.FindField(\"From-Y\") <> NIL) or\n (d.GetVTab.FindField(\"To-X\") <> NIL) or\n (d.GetVTab.FindField(\"To-Y\") <> NIL))) then\n theTables.Add(d)\n end\nend\n\nif (theTables.Count > 0) then\n enabled = TRUE\nend\n\nself.SetEnabled(enabled)\n\n\n" ) (Script.218 Name: "Warp.CreateLinkTableUpdate" SourceCode: "' CreateLinkTableUpdate script\nself.SetEnabled(TRUE)\n\n\n" ) (Script.219 Name: "Warp.TypeFromLinkUpdate" SourceCode: "'TypeFromLinkUpdate script\n\nenabled = FALSE\n\nwarpExt = Extension.Find(\"Spatial Tools\")\nif (warpExt = NIL) then\n MsgBox.Error(\"Cannot find extension!\",\"ERROR\")\n return NIL\nend\nlinkStatus = warpExt.GetPreferences.Get(\"Link Status\")\nlinkTableName = warpExt.GetPreferences.Get(\"Link Table\")\nif ((linkTableName <> NIL) and\n ((linkStatus <> NIL) and (linkStatus = \"From\"))) then\n enabled = TRUE\nend\n\nself.SetEnabled(enabled)\n\n\n\n" ) (Script.220 Name: "Warp.TypeToLinkUpdate" SourceCode: "' TypeToLinkUpdate script\n\nenabled = FALSE\n\nwarpExt = Extension.Find(\"Spatial Tools\")\nif (warpExt = NIL) then\n MsgBox.Error(\"Cannot find extension!\",\"ERROR\")\n return NIL\nend\nlinkStatus = warpExt.GetPreferences.Get(\"Link Status\")\nlinkTableName = warpExt.GetPreferences.Get(\"Link Table\")\nif ((linkTableName <> NIL) and\n ((linkStatus <> NIL) and (linkStatus = \"To\"))) then\n enabled = TRUE\nend\n\nself.SetEnabled(enabled)\n\n\n\n" ) (Script.221 Name: "Warp.WarpUpdate" SourceCode: "' WarpUpdate script\n\nenabled = FALSE\n\ntheView = av.GetActiveDoc\ntheThemes = theView.GetActiveThemes\nif (theThemes.Count = 1 and theThemes.Get(0).Is(GTHEME)) then\n warpExt = Extension.Find(\"Spatial Tools\")\n if (warpExt = NIL) then\n MsgBox.Error(\"Cannot find extension!\",\"ERROR\")\n return NIL\n end\n linkStatus = warpExt.GetPreferences.Get(\"Link Status\")\n linkTableName = warpExt.GetPreferences.Get(\"Link Table\")\n if ((linkTableName <> NIL) and\n ((linkStatus <> NIL) and (linkStatus = \"From\"))) then \n enabled = TRUE\n end\nend\n\nself.SetEnabled(enabled)\n\n\n" ) (Script.222 Name: "Warp.DeleteLinkUpdate" SourceCode: "' DeleteLinkUpdate script\n\nenabled = FALSE\n\nwarpExt = Extension.Find(\"Spatial Tools\")\nif (warpExt = NIL) then\n MsgBox.Error(\"Cannot find extension!\",\"ERROR\")\n return NIL\nend\nlinkStatus = warpExt.GetPreferences.Get(\"Link Status\")\nlinkTableName = warpExt.GetPreferences.Get(\"Link Table\")\nif ((linkTableName <> NIL) and \n ((linkStatus <> NIL) and (linkStatus = \"From\"))) then\n if ((av.GetProject.FindDoc(linkTableName) <> NIL) and\n (av.GetProject.FindDoc(linkTableName).Is(Table))) then\n if (av.GetPro ject.FindDoc(linkTableName).GetVTab.GetNumRecords > 0) then\n enabled = TRUE\n end\n end\nend\n\nself.SetEnabled(enabled)\n\n\n\n" ) (Script.223 Name: "Warp.FromLinkToolUpdate" SourceCode: "' FromLinkToolUpdate script\n\nenabled = FALSE\n\nwarpExt = Extension.Find(\"Spatial Tools\")\nif (warpExt = NIL) then\n MsgBox.Error(\"Cannot find extension!\",\"ERROR\")\n return NIL\nend\nlinkStatus = warpExt.GetPreferences.Get(\"Link Status\")\nlinkTableName = warpExt.GetPreferences.Get(\"Link Table\")\nfromViewName = warpExt.GetPreferences.Get(\"From View\")\nif (((fromViewName <> NIL) and (av.GetProject.FindDoc(fromViewName).Is(View)) and (av.GetProject.FindDoc(fromViewName).IsActive)) and\n (linkTableName <> NIL) and\n ((linkStatus <> NIL) and (linkStatus = \"From\"))) then\n enabled = TRUE\nend\n\nself.SetEnabled(enabled)\n\n\n\n" ) (Script.224 Name: "Warp.ToLinkToolUpdate" SourceCode: "' ToLinkToolUpdate script\n\nenabled = FALSE\n\nwarpExt = Extension.Find(\"Spatial Tools\")\nif (warpExt = NIL) then\n MsgBox.Error(\"Cannot find extension!\",\"ERROR\")\n return NIL\nend\nlinkStatus = warpExt.GetPreferences.Get(\"Link Status\")\nlinkTableName = warpExt.GetPreferences.Get(\"Link Table\")\ntoViewName = warpExt.GetPreferences.Get(\"To View\")\nif (((toViewName <> NIL) and (av.GetProject.FindDoc(toViewName).Is(View)) and (av.GetProject.FindDoc(toViewName).IsActive)) and\n (linkTableName <> NIL) and\n ((linkStat us <> NIL) and (linkStatus = \"To\"))) then\n enabled = TRUE\nend\n\nself.SetEnabled(enabled)\n\n\n" ) (Script.225 Name: "Warp.FromLinkTool" SourceCode: "' FromLinkTool script\n\n' get link table\nwarpExt = Extension.Find(\"Spatial Tools\")\nif (warpExt = NIL) then\n MsgBox.Error(\"Cannot find extension!\",\"ERROR\")\n return NIL\nend\nlinkTableName = warpExt.GetPreferences.Get(\"Link Table\")\nif ((linkTableName = NIL) or\n (av.GetProject.FindDoc(linkTableName).Is(Table).Not) or\n ((av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"Link\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"From-X\") = NIL) or\n (av.GetProject.FindDoc(lin kTableName).GetVTab.FindField(\"From-Y\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"To-X\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"To-Y\") = NIL))) then\n MsgBox.Error(\"Invalid Link Table\",\"From Link Tool\")\n return NIL\nend\n\n' get next link number\nlistOfLinkNumbers = {}\nlinkVTab = av.GetProject.FindDoc(linkTableName).GetVTab\nfor each r in linkVTab\n listOfLinkNumbers.Add(linkVTab.ReturnValueNumber(linkVTab.FindField(\"Link\"),r))\nend\nlistOfLinkNumbe rs.RemoveDuplicates\nlistOfLinkNumbers.Sort(TRUE)\nfirstNumber = 0\nif (listOfLinkNumbers.Count = 0) then\n newLinkNumber = 1\nelse\n for each n in listOfLinkNumbers\n if ((n - firstNumber) > 1) then\n newLinkNumber = firstNumber + 1\n break\n end\n firstNumber = n\n end\n if (firstNumber = listOfLinkNumbers.Get(listOfLinkNumbers.Count - 1)) then\n newLinkNumber = firstNumber + 1\n end\nend\n\n' set link number\nwarpExt.GetPreferences.Set(\"Link Number\",newLinkNumber.AsString)\n\n' get from view\nfromVi ewName = warpExt.GetPreferences.Get(\"From View\")\nif ((fromViewName = NIL) or\n (av.GetProject.FindDoc(fromViewName).Is(View).Not)) then\n MsgBox.Error(\"Invalid From View\",\"From Link Tool\")\n return NIL\nend\nfromView = av.GetProject.FindDoc(fromViewName)\ntheDisplay = fromView.GetDisplay\n\n' get from coordinate\nthePoint = theDisplay.ReturnUserPoint\nxCoord = thePoint.GetX\nyCoord = thePoint.GetY\n\n' write coordinates into link table\nlinkVTab.SetEditable(TRUE)\nif (linkVTab.IsEditable.Not) then\n MsgBox.Error(\"Can not edit Link Table\",\"From Link Tool\")\n return NIL\nend\nnewRecord = linkVTab.AddRecord\nlinkVTab.SetValueNumber(linkVTab.FindField(\"Link\"),newRecord,newLinkNumber)\nlinkVTab.SetValueNumber(linkVTab.FindField(\"From-X\"),newRecord,xCoord)\nlinkVTab.SetValueNumber(linkVTab.FindField(\"From-Y\"),newRecord,yCoord)\nlinkVTab.SetEditable(FALSE)\n\n' set link status\nwarpExt.GetPreferences.Set(\"Link Status\",\"To\")\n\n' draw link on from view\nviewGraphics = fromView.GetGraphics\nlinkGraphic = GraphicShape.Make(thePoint)\nlinkGraph ic.GetSymbol.SetSize(6)\nlinkNumberGraphic = GraphicText.Make(newLinkNumber.AsString,thePoint)\nlinkNumberGraphic.GetSymbol.SetSize(12)\nlinkGroupGraphic = GraphicGroup.Make\nlinkGroupGraphic.Add(linkGraphic)\nlinkGroupGraphic.Add(linkNumberGraphic)\nlinkGroupGraphic.SetName(newLinkNumber.AsString)\nviewGraphics.Add(linkGroupGraphic)\n\n' activate to view and to link tool if to view is set\ntoViewName = warpExt.GetPreferences.Get(\"To View\")\nif ((toViewName <> NIL) and\n (av.GetProject.FindDoc(toViewName).Is(View))) then\n toView = av.GetProject.FindDoc(toViewName)\n toView.GetWin.Activate\n theDocGUI = av.FindGUI(toView.GetGUI)\n theToolBar = theDocGUI.GetToolBar\n theTool = theToolBar.FindByScript(\"Warp.ToLinkTool\")\n theTool.Select\nend\n\n\n\n" ) (Script.226 Name: "Warp.ToLinkTool" SourceCode: "' ToLinkTool script\n\n' get link table\nwarpExt = Extension.Find(\"Spatial Tools\")\nif (warpExt = NIL) then\n MsgBox.Error(\"Cannot find extension!\",\"ERROR\")\n return NIL\nend\nlinkTableName = warpExt.GetPreferences.Get(\"Link Table\")\nif ((linkTableName = NIL) or\n (av.GetProject.FindDoc(linkTableName).Is(Table).Not) or\n ((av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"Link\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"From-X\") = NIL) or\n (av.GetProject.FindDoc(linkT ableName).GetVTab.FindField(\"From-Y\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"To-X\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"To-Y\") = NIL))) then\n MsgBox.Error(\"Invalid Link Table\",\"To Link Tool\")\n return NIL\nend\n\n' get link number\nlinkNumber = warpExt.GetPreferences.Get(\"Link Number\").AsNumber\nif (linkNumber = NIL) then\n MsgBox.Error(\"Invalid Link Number\",\"To Link Tool\")\nend\n\n' get to view\ntoViewName = warpExt.GetPreferences.Get(\"To View\" )\nif ((toViewName = NIL) or\n (av.GetProject.FindDoc(toViewName).Is(View).Not)) then\n MsgBox.Error(\"Invalid To View\",\"To Link Tool\")\n return NIL\nend\ntoView = av.GetProject.FindDoc(toViewName)\ntheDisplay = toView.GetDisplay\n\n' get to coordinate\nthePoint = theDisplay.ReturnUserPoint\nxCoord = thePoint.GetX\nyCoord = thePoint.GetY\n\n' write coordinates into link table\nlinkVTab = av.GetProject.FindDoc(linkTableName).GetVTab\nlinkVTab.SetEditable(TRUE)\nif (linkVTab.IsEditable.Not) then\n MsgBox.Error(\"Cannot edi t Link Table\",\"To Link Tool\")\n return NIL\nend\nfor each r in linkVTab\n if (linkVTab.ReturnValueNumber(linkVTab.FindField(\"Link\"),r) = linkNumber) then\n linkVTab.SetValueNumber(linkVTab.FindField(\"To-X\"),r,xCoord)\n linkVTab.SetValueNumber(linkVTab.FindField(\"To-Y\"),r,yCoord)\n break\n end\nend\nlinkVTab.SetEditable(FALSE)\n\n' set link status\nwarpExt.GetPreferences.Set(\"Link Status\",\"From\")\n\n' draw link on to view\nviewGraphics = toView.GetGraphics\nlinkGraphic = GraphicShape.Make(thePoint)\nlinkGraphic.Ge tSymbol.SetSize(6)\nlinkNumberGraphic = GraphicText.Make(linkNumber.AsString,thePoint)\nlinkNumberGraphic.GetSymbol.SetSize(12)\nlinkGroupGraphic = GraphicGroup.Make\nlinkGroupGraphic.Add(linkGraphic)\nlinkGroupGraphic.Add(linkNumberGraphic)\nlinkGroupGraphic.SetName(linkNumber.AsString)\nviewGraphics.Add(linkGroupGraphic)\n\n' activate from view and from link tool if from view set\nfromViewName = warpExt.GetPreferences.Get(\"From View\")\nif ((fromViewName <> NIL) and\n (av.GetProject.FindDoc(fromViewName).Is(View))) then\n fromView = av.GetProject.FindDoc(fromViewName)\n fromView.GetWin.Activate\n theDocGUI = av.FindGUI(fromView.GetGUI)\n theToolBar = theDocGUI.GetToolBar\n theTool = theToolBar.FindByScript(\"Warp.FromLinkTool\")\n theTool.Select\nend\n\n\n\n" ) (Script.227 Name: "Spatial.shift" SourceCode: "'\n' Name: Spatial.Shift\n' \n' Title: Merge two or more grids.\n'\n' Author: Philip N. Hooge Ph.D. USGS-Biological Resources Division Glacier Bay Field Station.\n' Email: Philip_Hooge@nps.gov\n'\n' Date: 4/10/98 \n'\n' Version 1.0\n'\n' Topics: Spatial Analyst\n'\n' Description: A tool to shift the grid to the new clicked on point\n'\n' Requires: The Spatial Analyst extension to be loaded. The script\n' also requires an active view with an active grid theme. \n'\n' Note: This cript should be added as a tool item and then assigned \n' \"Spatial.HasActiveGThemeUpdate\" as the update script.\n' \n'\n' Self:\n'\n' Returns:\n'\n'\n'test if Spatial Analyst is loaded\ntest=Extension.Find(\"Spatial Analyst\")\nif (test=NIL) then\n msgbox.error(\"You must have the spatial analyst extension loaded\",\"MergeGrid\")\n return(nil)\nend\n\ntheView = av.GetActiveDoc\nTheDisplay = theView.GetDisplay\nTheNewOrigin=TheDisplay.ReturnUserPoint \n\nenabled = FALSE\n\n' enable if only one active theme and it is a GTheme\nfor each t in theView.GetActiveThemes\n if (t.Is( GTHEME)) then \n enabled = TRUE\n end\nend\nif (theView.GetActiveThemes.Count > 1) then\n enabled = FALSE\n end\n\nif (enabled = FALSE) then\n msgbox.error(\"You must select a valid grid theme first\",\"MergeGrid\")\n return(nil)\nend\n\n\n\n'Get the active view and grid theme\ntheView = av.GetActiveDoc\ntheTheme = theView.GetActiveThemes.Get(0)\naGrid = theTheme.GetGrid\n\n'Does the user really want to do the shift\ndoit=msgbox.YesNo(\"Shift\"++theTheme.asString++\"to point:\"+nl++\n TheNewOrigin.asString,\"Do you want to shift the grid?\",TRUE)\n\nif (doit.not) then\n exit\nend\n\n'Do the shift\nif (enabled) then\n Out_Grid=aGrid.Shift (TheNewOrigin, Nil)\nend\n\n'Check the merged grid for errors\nif (Out_GRID.HasError) then\n MsgBox.Info(\"Out_GRID.HasError = TRUE\", \"ERROR\")\n return NIL\nend\n\n' create a theme\ntheGTheme = GTheme.Make(Out_GRID)\n\n' set name of theme\ntheGTheme.SetName(\"Shift of\"++theTheme.GetName)\n\n' add theme to the view\ntheView.AddTheme(theGTheme)\n\n\n" ) (Script.228 Name: "Warp.DeleteLink" SourceCode: "' DeleteLink script\n\nwarpExt = Extension.Find(\"Spatial Tools\")\nif (warpExt = NIL) then\n MsgBox.Error(\"Cannot find extension!\",\"ERROR\")\n return NIL\nend\nlinkTableName = warpExt.GetPreferences.Get(\"Link Table\")\nif ((linkTableName = NIL) or\n (av.GetProject.FindDoc(linkTableName).Is(Table).Not) or\n ((av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"Link\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"From-X\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab .FindField(\"From-Y\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"To-X\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"To-Y\") = NIL))) then\n MsgBox.Error(\"Invalid Link Table\",\"Delete Link\")\n return NIL\nend\n\n' get link numbers to delete\ntheLinkNumberList = {}\nlinkVTab = av.GetProject.FindDoc(linkTableName).GetVTab\nfor each r in linkVTab\n theLinkNumberList.Add(linkVTab.ReturnValueString(linkVTab.FindField(\"Link\"),r))\nend\ntheDeleteList = MsgBox.MultiLis tAsString(theLinkNumberList,\"Choose links to delete:\", \"Delete Link\")\nif ((theDeleteList = NIL) or (theDeleteList.Count < 1)) then \n return NIL \nend\n\n' delete each link selected\nfor each l in theDeleteList\n\n ' delete link from link table\n linkVTab.SetEditable(TRUE)\n if (linkVTab.IsEditable.Not) then\n MsgBox.Error(\"Cannot edit Link Table\",\"Delete Link\")\n return NIL\n end\n theRecord = NIL\n for each r in linkVTab\n if (linkVTab.ReturnValueNumber(linkVTab.FindField(\"Link\"),r) = l.AsNumber) then\n theRecord = r\n break\n end\n end\n if (theRecord <> NIL) then\n linkVTab.RemoveRecord(theRecord)\n end\n linkVTab.SetEditable(FALSE)\n \n ' delete link on from view if one is set\n fromViewName = warpExt.GetPreferences.Get(\"From View\")\n if ((fromViewName <> NIL) and\n (av.GetProject.FindDoc(fromViewName).Is(View))) then\n fromView = av.GetProject.FindDoc(fromViewName)\n viewGraphics = fromView.GetGraphics\n for each g in viewGraphics\n if (g.GetName = l) then\n viewGraphics .RemoveGraphic(g)\n break\n end\n end\n end\n \n ' delete link on to view if one is set\n toViewName = warpExt.GetPreferences.Get(\"To View\")\n if ((toViewName <> NIL) and\n (av.GetProject.FindDoc(toViewName).Is(View))) then\n toView = av.GetProject.FindDoc(toViewName)\n viewGraphics = toView.GetGraphics\n for each g in viewGraphics\n if (g.GetName = l) then\n viewGraphics.RemoveGraphic(g)\n break\n end\n end\n end\nend\n \n' set link status\nwarpExt.GetPreferences.Se t(\"Link Status\",\"From\")\n\n\n" ) (Script.229 Name: "Spatial.RotateGrid" SourceCode: "'\n' Name: Spatial.Rotate\n' \n' Title: Rotates a grid\n'\n' Author: Philip N. Hooge Ph.D. USGS-Biological Resources Division Glacier Bay Field Station.\n' Email: Philip_Hooge@nps.gov\n' Elizabeth K. Solomon, USGS-Biological Resources Division Glacier Bay Field Station.\n' Email: Elizabeth_Solomon@nps.gov\n'\n' Date: 6/9/98 \n'\n' Version 1.0\n'\n' Topics: Spatial Analyst\n'\n' Description: A tool to rotate the grid in a clockwise motion around the lower-left corner by anAngle.\n'\n' Requires: The Spa tial Analyst extension to be loaded. The script\n' also requires an active view with an active grid theme. \n'\n' Note: This script should be added as a button and then assigned \n' \"Spatial.HasActiveGThemeUpdate\" as the update script.\n' \n'\n' Self:\n'\n' Returns:\n'\n'\n'test if Spatial Analyst is loaded\ntest=Extension.Find(\"Spatial Analyst\")\nif (test=NIL) then\n msgbox.error(\"You must have the spatial analyst extension loaded\",\"MergeGrid\")\n return(nil)\nend\n\ntheView = av.GetActiveDoc\nenabled = FALSE\n\n' enable if onl y one active theme and it is a GTheme\nfor each t in theView.GetActiveThemes\n if (t.Is(GTHEME)) then \n enabled = TRUE\n end\nend\nif (theView.GetActiveThemes.Count > 1) then\n enabled = FALSE\n end\n\nif (enabled = FALSE) then\n msgbox.error(\"You must select a valid grid theme first\",\"RotateGrid\")\n return(nil)\nend\n\n\n\n'Get the active view and grid theme\ntheView = av.GetActiveDoc\ntheTheme = theView.GetActiveThemes.Get(0)\naGrid = theTheme.GetGrid\n'\n'\n'\ntheAngle = MsgBox.Input(\"Enter the Angle\", \"Rotation Ang le\", \"90\")\n'\nanAngle = TheAngle.AsNumber\n'\naList = {\"Nearest Neighbor\",\"Bilinear Interpolation\",\"Cubic Convolution\"}\nfor each s in aList\n s.setName(s)\nend\n'\ntheSampMethod = MsgBox.Choice ( aList,\"Resampling Method\", \"RotateGrid\")\n\nif (theSampMethod = aList.Get(0)) then\n aGridResTypeEnum = #GRID_RESTYPE_NEAREST\nelseif (theSampMethod = aList.Get(1)) then\n aGridResTypeEnum = #GRID_RESTYPE_BILINEAR\nelseif (theSampMethod = aList.Get(2)) then\n aGridResTypeEnum = #GRID_RESTYPE_CUBIC\nelse\n exit\nend\n'\n'Do the rotation\nif (enabled) then\n Out_Grid = aGrid.Rotate (anAngle, aGridResTypeEnum)\nend\n\n'Check the rotated grid for errors\nif (Out_GRID.HasError) then\n MsgBox.Info(\"Out_GRID.HasError = TRUE\", \"ERROR\")\n return NIL\nend\n'else\n 'return(nil)\n'end\n' \n' create a theme\ntheGTheme = GTheme.Make(Out_GRID)\n\n' set name of theme\ntheGTheme.SetName(\"Rotation of\"++theTheme.GetName)\n\n' add theme to the view\ntheView.AddTheme(theGTheme)\n\n\n\n\n" ) (Script.230 Name: "Spatial.MajorityFilter" SourceCode: "'Name: BE.MajorityFilter\n'\n'Title: MajorityFilter \n'\n'Topic: Analysis\n'\n'Description: Prompts user for MajorityFilter variables then runs MajorityFilter on\n'the active theme. The name of the active grid theme and the two variables used are \n'saved in the Comments section of the grid theme created by running this script.\n'\n'Requires: Spatial Analyst; an active view; an active grid theme; run from menu\n'or button\n'\n'Created January 16, 1997; by Bill Eichenlaub\n\ntheView = av.GetActiveDoc\ntheDisplay = theView. GetDisplay\ntheGridTheme = theView.GetActiveThemes.Get(0)\ntheGrid = theGridTheme.GetGrid\n\ntfList = {true, false}\nTFdiagNbrs = MsgBox.ListAsString (tfList, \"TRUE: 8 nearest neighbors used; FALSE: four orthogonal cell used.\",\"diagNbrs variable\")\n\nif (Nil = TFdiagNbrs) then\n exit\nelse\n TFhalfOk = MsgBox.ListAsString (tfList, \"TRUE: majority = one half of all cells or more; FALSE: clear majority needed.\",\"halfOk variable\")\n if (Nil = TFhalfOk) then\n exit\n end\nend\n\ntheFiltered = theGrid.MajorityFilte r (TFdiagNbrs, TFhalfOk)\n\ntheGTheme = GTheme.Make(theFiltered)\nif (theFiltered.HasError) then\n return NIL\nend\ntheView.AddTheme(theGTheme)\ntheNewT = theView.GetThemes.Get(0)\ntheNewT.SetComments (theGridTheme.GetName +\".MajorityFilter(\" + TFdiagNbrs.asString + \", \" + TFhalfOk.asString + \")\")\n\nav.GetProject.SetModified(True)" ) (Script.231 Name: "Spatial.RegionGroup" SourceCode: "'Name: BE.RegionGroup\n'\n'Title: RegionGroup \n'\n'Topic: Analysis\n'\n'Description: Prompts user for RegionGroup variables then runs RegionGroup on\n'the active theme. The name of the active grid theme and the variables used are \n'saved in the Comments section of the grid theme created by running this script.\n'\n'Requires: Spatial Analyst; an active view; an active grid theme; run from menu\n'or button\n'\n'Created January 15, 1997; by Bill Eichenlaub\n'\n'Syntax: theRGroup = theGrid.RegionGroup (diagNbrs, crossClass, excludedValue)\n'\n'From Spatial Analyst Help:\n\n'RegionGroup: Groups each cell of aGrid into a connected region assigning a \n'unique number to each region.\n\n'If diagNbrs is TRUE, then cells diagonal to each other are considered connected. \n'If it is FALSE, then cells must be orthogonal to each other to be connected.\n\n'If crossClass is TRUE, then all values except the excludedValue are considered the \n'same and can be connected into the same region. crossClass can only be TRUE when a \n'value for excludedValue is given. If crossClass is FALSE, then only cells with the \n'same value can be connected into the same region.\n\n'excludedValue can be a Number or Nil, and defines the value of cells to be treated \n'as No Data during the process. If excludedValue is set to Nil, then no value is \n'set to No Data. The value in excludeValue cannot be set to No Data if crossClass \n'is TRUE.\n\n'NOTE: Despite the last line above, RegionGroup will run if crossClass is True and \n'excludedValue is Nil. Results will be a useless singl e class grid theme.\n\n'For simple cleanup use crossClass = False and excludedValue = Nil.\n\ntheView = av.GetActiveDoc\ntheDisplay = theView.GetDisplay\ntheGridTheme = theView.GetActiveThemes.Get(0)\ntheGrid = theGridTheme.GetGrid\n\ntfList = {true, false}\nTFdiagNbrs = MsgBox.ListAsString (tfList, \"TRUE: diagional cells considered connected, FALSE: orthogonal connected.\",\"diagNbrs variable\")\nif (Nil = TFdiagNbrs)then\n exit\nelse\n TFcrossClass = MsgBox.ListAsString (tfList, \"TRUE: excludedValue not part of groups; FALSE: all values analyzed.\",\"crossClass variable\")\n if (Nil = TFcrossClass) then\n exit\n else\n excludedValueNN = MsgBox.ListAsString({\"Number\", \"Nil\"}, \"excludeValue type\", \"\")\n if (Nil = excludedValueNN) then\n exit\n end\n end\nend\n\nif (\"Nil\" = excludedValueNN) then\n excludedValueST = \"Nil\"\n theRGroup = theGrid.RegionGroup(TFdiagNbrs, TFcrossClass, Nil)\nelse\n excludedValueST = MsgBox.Input(\"Number: defines the value of cells to be treated as No Data.\",\"excludedValue varia ble \",\"\")\n if (Nil = excludedValueST) then\n exit\n else\n theRGroup = theGrid.RegionGroup(TFdiagNbrs, TFcrossClass, excludedValueST.AsNumber)\n end\nend\n\n\ntheGTheme = GTheme.Make(theRGroup)\nif (theRGroup.HasError) then\n return NIL\nend\ntheView.AddTheme(theGTheme)\ntheNewT = theView.GetThemes.Get(0)\ntheNewT.SetComments (theGridTheme.GetName +\".RegionGroup(\" + TFdiagNbrs.asString + \", \" + TFcrossClass.asString + \", \" + excludedValueST.AsString + \")\")\n\nav.GetProject.SetModified(True)\n" ) (Script.232 Name: "Spatial.ExtractByCount" SourceCode: "'Name: BE.ExtractByCount\n'\n'Title: Map Query by Count\n'\n'Topic: Analysis\n'\n'Description: Runs a map query using request ExtractByAttribute for theGrid.Count. \n'Prompts user for the count variable. The name of the active grid theme and the \n'variable used are saved in the Comments section of the grid theme created \n'by running this script. Note that unlike Map Query, the extracted original\n'cell values are retained in the new grid. Cells with counts less than theCount \n'variable are set to No Data. Resul ting theme can be used as the mask grid for \n'Nibble. \n'\n'Requires: Spatial Analyst; an active view; an active grid theme; run from menu\n'or button\n'\n'Created January 18, 1997; by Bill Eichenlaub\n\ntheView = av.GetActiveDoc\ntheDisplay = theView.GetDisplay\ntheGridTheme = theView.GetActiveThemes.Get(0)\ntheGrid = theGridTheme.GetGrid\n\ntheCount = MsgBox.Input(\"In the new theme, classes with cell counts less than theCount will be set to No Data. (Use new theme as Nibble mask.) Enter theCount: \",\"Count: \",\"\")\n if (Nil = theCount) then\n exit\n else\n theExtracted = theGrid.ExtractByAttributes((\"[count] >= \" + theCount))\n end\n\ntheGTheme = GTheme.Make(theExtracted)\n if (theExtracted.HasError) then\n return NIL\n end\ntheView.AddTheme(theGTheme)\ntheNewT = theView.GetThemes.Get(0)\ntheNewT.SetComments (theGridTheme.GetName +\".ExtractByAttribute(([Count]\" + \" >= \" + theCount +\")\")\n\n\nav.GetProject.SetModified(True)" ) (Script.233 Name: "Spatial.Nibble" SourceCode: "'Name: BE.Nibble\n'\n'Title: Nibble \n'\n'Topics: Analysis\n'\n'Description: Active themes are not used. Prompts the user for a mask theme, a base \n'theme and the 'dataOnly' variable' to use in the Nibble request. Writes variables\n'used to Comments section of grid created by running this script.\n'\n'NOTE: The mask theme should be created prior to running Cleanup.Nibble1 using \n'RegionGroup, Map Query and Reclassify or script/menu option ExtractByCount. After \n'running RegionGroup, examine the resulting grid tab le to determine your cuttoff. \n'Generally a number <100 is used.\n'Run Map Query with: Grid.count > YourCutoffValue.AsGrid. Use Reclassify on the \n'resulting grid to set all 1 values to No Data, the resulting \n'grid is your mask grid. \n'\n'Requires: Spatial Analyst; an active View document, two grid themes.\n'\n'Created: January 15, 1997 by Bill Eichenlaub\n\ntheView = av.GetActiveDoc\ntheDisplay = theView.GetDisplay\nThemeList = av.GetActiveDoc.GetThemes\nif (ThemeList.Count < 2) Then\n msgbox.Error(\"You must hav e at least two themes\",\"Nibble1 is aborting\")\n exit\nend\n\n\nmaskThemeChoice = MsgBox.ListAsString( ThemeList, \"Select the mask grid\", \"maskGrid variable\" )\nif (Nil = maskThemeChoice) then\n exit\nelse\n theThemeChoice = MsgBox.ListAsString( ThemeList, \"Select the base grid theme\", \"base grid variable\" )\n if (Nil = theThemeChoice) then\n exit\n end\nend\n \n \nmaskGrid = maskThemeChoice.GetGrid\ntheGrid = theThemeChoice.GetGrid\n\ntfList = {true, false}\ntheTF = MsgBox.ListAsString (tfList, \"TRUE: No Dat a neighbors not used; FALSE: No Data neighbors used.\",\"dataOnly variable\")\n\nif (Nil = theTF) then\n exit\nelse\n theNibbled = theGrid.Nibble (maskGrid, theTF)\nend\n\ntheGTheme = GTheme.Make(theNibbled)\nif (theNibbled.HasError) then\n return NIL\nend\ntheView.AddTheme(theGTheme)\ntheNewT = theView.GetThemes.Get(0)\ntheNewT.SetComments (theThemeChoice.AsString + \".Nibble(\" + maskThemeChoice.AsString + \"; \" + theTF.AsString + \")\")\n\nav.GetProject.SetModified(True)" ) (Script.234 Name: "Spatial.BoundaryClean" SourceCode: "'Name: BE.BoundaryClean\n'\n'Title: BoundaryClean\n'\n'Topic: Analysis\n' \n'Description: Prompts user for BoundaryClean variables then runs BoundaryClean on\n'the active theme. The name of the active grid theme and the two variables used are \n'saved in the Comments section of the grid theme created by running this script.\n'\n'Requires: Spatial Analyst; an active view; an active grid theme; run from menu\n'or button\n'\n'Created January 16, 1997; by Bill Eichenlaub\n\ntheView = av.GetActiveDoc\ntheDisplay = theView.GetD isplay\ntheGridTheme = theView.GetActiveThemes.Get(0)\ntheGrid = theGridTheme.GetGrid\n\ntheList = {\"#GRID_SORTTYPE_NOSORT\", \"#GRID_SORTTYPE_DESCEND\", \"#GRID_SORTTYPE_ASCEND\"}\ntheSort = MsgBox.ListAsString (theList, \"Choose the sort type.\",\"aGridSortTypeEnum variable\")\nif (Nil = theSort)then\n exit\n else\n theSSort = theSort.AsString\n tfList = {true, false}\n TFonceOnly = MsgBox.ListAsString (tfList, \"TRUE: Expanding and shrinking done once; FALSE: Done twice.\",\"onceOnly variable\")\n if (Nil = TFo nceOnly) then\n exit\n end\nend\n\ntheSmoothed = theGrid.BoundaryClean(theSSort.AsEnum, TFonceOnly)\n\ntheGTheme = GTheme.Make(theSmoothed) \nif (theSmoothed.HasError) then \n return NIL \nend\ntheView.AddTheme(theGTheme)\ntheNewT = theView.GetThemes.Get(0)\ntheNewT.SetComments (theGridTheme.GetName + \".BoundaryClean(\" + theSSort + \"; \" + TFonceOnly.AsString + \")\")\n\nav.GetProject.SetModified(True)\n\n" ) (Script.235 Name: "Spatial.Thin" SourceCode: "'Name: BE.Thin\n'\n'Title: Thin\n'\n'Topic: Analysis\n'\n'Description: Prompts user for Thin request variables then runs Thin on\n'the active theme. The name of the active grid theme and the variables used are \n'saved in the Comments section of the grid theme created by running this script.\n'\n'Requires: Spatial Analyst; an active view; an active grid theme; run from menu\n'or button\n'\n'Created January 16, 1997; by Bill Eichenlaub\n\ntheView = av.GetActiveDoc\ntheDisplay = theView.GetDisplay\ntheGridTheme = theView.Get ActiveThemes.Get(0)\ntheGrid = theGridTheme.GetGrid\n\ntfList = {true, false}\nTFnotBinary = MsgBox.ListAsString (tfList, \"TRUE: all values other than No Data are thinned; FALSE: only values > 0 are thinned.\",\"notBinary variable\")\n\nif (Nil = TFnotBinary) then exit\nelse\n TFdoFilter = MsgBox.ListAsString (tfList, \"TRUE: Grid is filtered to smooth boundarys; FALSE: Grid not filtered.\",\"doFilter variable\")\n if (Nil = TFdoFilter) then exit\n else\n TFsharpenCorners = MsgBox.ListAsString (tfList, \"TRUE: R ectangular corners preserved; FALSE: Corners smoothed.\",\"sharpenCorners variable\")\n if (Nil = TFsharpenCorners) then exit\n else\n maxThicknessNN = MsgBox.ListAsString ({\"Number\", \"Nil\"}, \"NUMBER: Maximum thickness of linear features. ; NIL: 10x cell size is used.\",\"maxThickness variable\")\n if (Nil = maxThicknessNN) then exit\n else \n end\n end\n end\nend\n\nif (\"Nil\" = maxThicknessNN) then\n maxThicknessST = \"Nil\"\n theThinned = theGrid .Thin (TFnotBinary, TFdoFilter, TFsharpenCorners, Nil)\nelse\n maxThicknessST = MsgBox.Input(\"NUMBER: maximum thickness of linear features.\",\"maxThickness variable \",\"\")\n if (Nil = maxThicknessST) then\n exit\n else\n theThinned = theGrid.Thin (TFnotBinary, TFdoFilter, TFsharpenCorners, maxThicknessST.AsNumber)\n end\nend\n\n\ntheGTheme = GTheme.Make(theThinned)\nif (theThinned.HasError) then\n return NIL\nend\ntheView.AddTheme(theGTheme)\ntheNewT = theView.GetThemes.Get(0)\ntheNewT.SetComments (theGridThe me.GetName +\".Thin(\" + TFnotBinary.asString + \", \" + TFdoFilter.asString + \", \" + TFsharpenCorners.asString + \", \" + maxThicknessST.AsString + \")\")\n\nav.GetProject.SetModified(True)\n\n\n\n\n\n" ) (Script.236 Name: "Spatial.MergeGrid" SourceCode: "'\n' Name: Spatial.MergeGrid\n' \n' Title: Merge two or more grids.\n'\n' Author: Philip N. Hooge Ph.D. USGS-Biological Resources Division Glacier Bay Field Station.\n' Email: Philip_Hooge@nps.gov\n'\n' Date: 1/05/98 \n'\n' Version 2.0\n'\n' Topics: Spatial Analyst\n'\n' Description: Merges together two or more grids using the selected grid as the primary\n' grid and then asks the user to select one or more additional grids from a file dialog\n' box to merge with the selected grid. The order of grid selection dete rmines the precedence\n' of the merging. The program then adds the new merged grid to the current theme.\n'\n' Requires: The Spatial Analyst extension to be loaded. The script\n' also requires an active view with an active grid theme. \n'\n' Note: This cript should be added as a menu item and then assigned \n' \"Spatial.HasActiveGThemeUpdate\" as the update script.\n' The current version of this program does not merge the contents of the attribute tables.\n' \n'\n' Self:\n'\n' Returns:\n'\n'\n'test if Spatial Analyst is loa ded\ntest=Extension.Find(\"Spatial Analyst\")\nif (test=NIL) then\n msgbox.error(\"You must have the spatial analyst extension loaded\",\"MergeGrid\")\n return(nil)\nend\n\ntheView = av.GetActiveDoc\nenabled = FALSE\n\n' enable if only one active theme and it is a GTheme\nfor each t in theView.GetActiveThemes\n if (t.Is(GTHEME)) then \n enabled = TRUE\n end\nend\nif (theView.GetActiveThemes.Count > 1) then\n enabled = FALSE\n end\n\nif (enabled = FALSE) then\n msgbox.error(\"You must select a valid grid theme first\",\"MergeGr id\")\n return(nil)\nend\n\n\n\n'Get the active view and grid theme\ntheView = av.GetActiveDoc\ntheTheme = theView.GetActiveThemes.Get(0)\naGrid = theTheme.GetGrid\n\n'Uses the selected theme as the primary merge file and the asks the user to select the rest\ngridFNlist = SourceManager.ReturnDataSets(GRID, \"Grids to merge with the selected theme\")\nif (gridFNlist = NIL) then return NIL end\nif (gridFNlist.Count < 1) then return NIL end 'End the program if there is no grids to combine\n\n'Make a list for the grids\ntheGridLi st = List.Make\n\n'Get the grids for each file name and put them in thegridlist\nfor each gridFN in gridFNList \n gridSrcName = Grid.MakeSrcName(gridFN.AsString)\n gridtoadd = Grid.Make(gridSrcName)\n 'check each grid for problems\n if (gridtoadd.HasError) then\n MsgBox.Info(\"gridtoadd.HasError = TRUE\", \"ERROR\")\n return NIL\n end\n theGridList = theGridList.add(gridtoadd)\nend\n\n'Merge those grids\nOut_GRID = aGrid.Merge(theGridList)\n\n'Check the merged grid for errors\nif (Out_GRID.HasError) then\n MsgBox.I nfo(\"Out_GRID.HasError = TRUE\", \"ERROR\")\n return NIL\nend\n\n' create a theme\ntheGTheme = GTheme.Make(Out_GRID)\n\n' set name of theme\ntheGTheme.SetName(\"Merged Grids To \"++theTheme.GetName)\n\n' add theme to the view\ntheView.AddTheme(theGTheme)\n\n" ) (Script.237 Name: "Spatial.Mosaic" SourceCode: "'Name: Spatial.Mosaic\n'\n'Title: Mosaic\n'\n'Topic: Geometric Transformation\n'\n'Description: Mosaics together two or more grids using first grid selected by the user as the primary\n' grid and then asks the user to select one or more additional grids from a file dialog\n' box to mosaic with the selected grid. The order of grid selection determines the precedence\n' of the mosaicing. The program then adds the new mosaiced grid to the current theme.'\n'Requires: Spatial Analyst, two grid themes \n'\n' Author: Phi lip N. Hooge Ph.D. USGS-Biological Resources Division Glacier Bay Field Station.\n' Email: Philip_Hooge@nps.gov\n'\n' Date: 10/15/97 \n\n'test if Spatial Analyst is loaded\ntest=Extension.Find(\"Spatial Analyst\")\nif (test=NIL) then\n msgbox.error(\"You must have the spatial analyst extension loaded\",\"MergeGrid\")\n return(nil)\nend\n\n'check for at least two grids\ntheView = av.GetActiveDoc\ntheDisplay = theView.GetDisplay\nThemeList = av.GetActiveDoc.GetThemes\n'error out if less than two grids\nif (ThemeList.Count < 2) Then\n msgbox.Error(\"You must have at least two grid themes.\",\"\")\n exit\nend\n\nfirstTheme = MsgBox.ListAsString( ThemeList, \"Select the first grid theme\", \"Mosaic variable: aGrid\" )\nif (Nil = firstTheme) then\n exit\nelse\n otherThemesList = MsgBox.MultiList( ThemeList, \"Use Shift-LeftMouseClick to select the other grid themes.\", \"Mosaic variable: aGridList\" )\n if (Nil = otherThemesList) then\n exit\n else\n end\nend\n\nfirstGrid = firstTheme.getGrid\n\ntheStack = Stack.Make\notherGridsList = List.Make\n\nf or each t in otherThemesList\n anOtherGrid = t.getGrid\n theStack.Push(anOtherGrid)\nend\n\nfor each i in otherThemesList\n otherGridsList.Add(theStack.pop)\nend\n\ntheMosaic = firstGrid.Mosaic(otherGridsList)\n\n'check for errors in the output grid\ntheGTheme = GTheme.Make(theMosaic)\nif (theMosaic.HasError) then\n return NIL\nend\n\ntheGTheme.SetName(\"Mosaiced Grids of \"++firsttheme.GetName)\n\ntheView.AddTheme(theGTheme)\n\n' set name of theme\ntheNewT = theView.GetThemes.Get(0)\n\nav.GetProject.SetModified(True)\n\n\n" ) (Script.238 Name: "Spatial.Combine" SourceCode: "'\n' Name: Spatial.CombineGrid\n' \n' Title: Combines two or more grids.\n'\n' Author: Philip N. Hooge Ph.D. USGS-Biological Resources Division Glacier Bay Field Station.\n' Email: Philip_Hooge@nps.gov\n'\n' Date: 1/26/97\n'\n' Version 1.0\n'\n' Topics: Spatial Analyst\n'\n' Description: Merges together two or more grids using the selected grid as the primary\n' grid and then asks the user to select one or more additional grids from a file dialog\n' box to merge with the selected grid. The order of grid selection determines the precedence\n' of the merging. The program then adds the new merged grid to the current theme.\n'\n' Requires: The Spatial Analyst extension to be loaded. The script\n' also requires an active view with an active grid theme. \n'\n' Note: This cript should be added as a menu item and then assigned \n' \"Spatial.HasActiveGThemeUpdate\" as the update script.\n' The current version of this program does not merge the contents of the attribute tables.\n' \n'\n' Self:\n'\n' Returns:\n'\n'\n'test if Spatial Analyst is loaded\ntest=Extension.Find(\"Spatial Analyst\")\nif (test=NIL) then\n msgbox.error(\"You must have the spatial analyst extension loaded\",\"MergeGrid\")\n return(nil)\nend\n\ntheView = av.GetActiveDoc\nenabled = FALSE\n\n' enable if only one active theme and it is a GTheme\nfor each t in theView.GetActiveThemes\n if (t.Is(GTHEME)) then \n enabled = TRUE\n end\nend\nif (theView.GetActiveThemes.Count > 1) then\n enabled = FALSE\n end\n\nif (enabled = FALSE) then\n msgbox.error(\"You must select a valid grid theme first\",\"Mer geGrid\")\n return(nil)\nend\n\n\n\n'Get the active view and grid theme\ntheView = av.GetActiveDoc\ntheTheme = theView.GetActiveThemes.Get(0)\naGrid = theTheme.GetGrid\n\n'Uses the selected theme as the primary combine file and the asks the user to select the rest\ngridFNlist = SourceManager.ReturnDataSets(GRID, \"Grids to combine with the selected theme\")\nif (gridFNlist = NIL) then return NIL end\nif (gridFNlist.Count < 1) then return NIL end 'End the program if there is no grids to combine\n\n'Make a list for the grids\nt heGridList = List.Make\n\n'Get the grids for each file name and put them in thegridlist\nfor each gridFN in gridFNList \n gridSrcName = Grid.MakeSrcName(gridFN.AsString)\n gridtoadd = Grid.Make(gridSrcName)\n 'check each grid for problems\n if (gridtoadd.HasError) then\n MsgBox.Info(\"gridtoadd.HasError = TRUE\", \"ERROR\")\n return NIL\n end\n theGridList = theGridList.add(gridtoadd)\nend\n\n'Merge those grids\nOut_GRID = aGrid.Combine(theGridList)\n\n'Check the merged grid for errors\nif (Out_GRID.HasError) then\n MsgBox.Info(\"Out_GRID.HasError = TRUE\", \"ERROR\")\n return NIL\nend\n\n' create a theme\ntheGTheme = GTheme.Make(Out_GRID)\n\n' set name of theme\ntheGTheme.SetName(\"Combined Grids To \"++theTheme.GetName)\n\n' add theme to the view\ntheView.AddTheme(theGTheme)\n\n" ) (Script.239 Name: "Spatial.ClipGrid" SourceCode: "' Name: Spatial.ExtractByGraphic\n' \n' Title: Extract grids by a graphic\n' \n' Topics: Spatial\n' \n' Description: This script extracts a new grid by clipping from an\n' overlaying graphic. \n'\n' Modified Philip N. Hooge September 3, 1997 to request either inside or outside\n' grid clip.\n' \n' Requires: Spatial Analyst Extension\n' \n' Self: \n' \n' Returns: \n' \n\n\n\ntest=Extension.Find(\"Spatial Analyst\")\nif (test=NIL) then\n msgbox.error(\"You must have the spatial analyst extension loaded\",\"ExtractbyShape\")\n return (nil)\nend\n \n\n\n\ntheView = av.GetActiveDoc\nthegraphics=theview.getgraphics\ntheSelg=theGraphics.getselected\nif (theSelG.count=0) then\n msgbox.error(\"No Graphics Selected\",\"ExtractbyShape\")\n return(nil)\nend\n\nagraphic=thegraphics.getselected.get(0)\nif (agraphic.getshape.is(point)) then\n msgbox.error(\"Shape must be a line or polygon\",\"ExtractbyShape\")\n return(nil)\nend\n\nashp=agraphic.getshape.aspolygon\n\n' set the projection to null since graphics are projected\ntheprojection=Prj.MakeNull\n\n\n\nfor each at in theView.G etActiveThemes\n if (at.Is( GTHEME )) then \n t = at\n break\n end\nend\nif (t = NIL) then \n return(NIL) \nend\n\ng = t.GetGrid\n\nae = theView.GetExtension(AnalysisEnvironment)\nae.SetCellSize(#ANALYSISENV_VALUE, g.getcellsize)\n\n'Request where to clip\nclipList = {\"inside\", \"outside\"}\nClipWhere = MsgBox.ChoiceAsString (clipList, \"Clip grid on inside or outside of graphic\",\"Clip Inside or Outside?\")\nif (Nil = ClipWhere)then\n MsgBox.Info( \"NO SELECTION, Bye...\", \"\")\n exit\nelse\n if (ClipWhere = \"inside\") then \n ashpext=agraphic.getbounds\n ae.SetExtent(#ANALYSISENV_VALUE, ashpext)\n r = g.ExtractbyPolygon(ashp, theProjection, FALSE)\n else\n ashpext=g.GetExtent\n ae.SetExtent(#ANALYSISENV_VALUE, ashpext)\n r = g.ExtractbyPolygon(ashp, theProjection, TRUE)\n end\nend\n\n\n' rename data set\naFN = av.GetProject.GetWorkDir.MakeTmp(\"gext\", \"\")\nr.Rename(aFN)\n\n' check if output is ok\nif (r.HasError) then return NIL end\n\n' create a theme \ngthm = GTheme.Make(r) \n\n' set name of theme\ngthm.SetName (\"Extract from \" + t.GetName)\n\n' add theme to the specifiedView\ntheView.AddTheme(gthm)\n\ngthm.invalidate(true)\n\n'Reset the extent\nae.SetExtent(#ANALYSISENV_MAXOF, nil)\n" ) (Script.240 Name: "Warp.SetFromView" SourceCode: "' SetFromView script\n\n' grab current settings of preference dictionary\nwarpExt = Extension.Find(\"Spatial Tools\")\nif (warpExt = NIL) then\n MsgBox.Error(\"Cannot find extension!\",\"ERROR\")\n return NIL\nend\ntoViewName = warpExt.GetPreferences.Get(\"To View\")\nif (toViewName = NIL) then\n toViewName = \"\"\nelseif (av.GetProject.FindDoc(toViewName).Is(View).Not) then\n toViewName = \"\"\nend\nfromViewName = warpExt.GetPreferences.Get(\"From View\")\nif (fromViewName = NIL) then\n fromViewName = \"\"\nelseif (av.GetProject.Find Doc(fromViewName).Is(View).Not) then\n fromViewName = \"\"\nend\n\n' get new properties\nlistOfViews = {}\nfor each d in av.GetProject.GetDocs\n if (d.Is(View)) then\n if (d.GetName <> toViewName) then\n if (d.GetName = fromViewName) then\n listOfViews.Insert(d.GetName)\n else\n listOfViews.Add(d.GetName)\n end\n end\n end\nend\nnewFromViewName = MsgBox.ListAsString(listOfViews,\"Choose From View:\", \"Set From View\")\nif (newFromViewName = NIL) then\n return NIL\nend\nif (newFromViewName <> fr omViewName) then\n newView = av.GetProject.FindDoc(newFromViewName)\n newString = newView.GetName\n newString = newString++\"(From View)\"\n newView.SetName(newString)\n oldView = av.GetProject.FindDoc(fromViewName)\n oldString = oldView.GetName\n oldString = oldString.Substitute(\"(From View)\",\"\").Trim\n oldView.SetName(oldString)\n fromViewName = newView.GetName\n \n ' set to view\n warpExt.GetPreferences.Set(\"From View\",fromViewName)\nend\n\n\n\n\n" ) (Script.241 Name: "Warp.SetToView" SourceCode: "' SetToView script\n\n' grab current settings of preference dictionary\nwarpExt = Extension.Find(\"Spatial Tools\")\nif (warpExt = NIL) then\n MsgBox.Error(\"Cannot find extension!\",\"ERROR\")\n return NIL\nend\ntoViewName = warpExt.GetPreferences.Get(\"To View\")\nif (toViewName = NIL) then\n toViewName = \"\"\nelseif (av.GetProject.FindDoc(toViewName).Is(View).Not) then\n toViewName = \"\"\nend\nfromViewName = warpExt.GetPreferences.Get(\"From View\")\nif (fromViewName = NIL) then\n fromViewName = \"\"\nelseif (av.GetProject.FindDo c(fromViewName).Is(View).Not) then\n fromViewName = \"\"\nend\n\n' get new properties\nlistOfViews = {}\nfor each d in av.GetProject.GetDocs\n if (d.Is(View)) then\n if (d.GetName <> fromViewName) then\n if (d.GetName = toViewName) then\n listOfViews.Insert(d.GetName)\n else\n listOfViews.Add(d.GetName)\n end\n end\n end\nend\nnewToViewName = MsgBox.ListAsString(listOfViews,\"Choose To View:\", \"Set To View\")\nif (newToViewName = NIL) then\n return NIL\nend\nif (newToViewName <> toViewName) th en\n newView = av.GetProject.FindDoc(newToViewName)\n newString = newView.GetName\n newString = newString++\"(To View)\"\n newView.SetName(newString)\n oldView = av.GetProject.FindDoc(toViewName)\n oldString = oldView.GetName\n oldString = oldString.Substitute(\"(To View)\",\"\").Trim\n oldView.SetName(oldString)\n toViewName = newView.GetName\n \n ' set to view\n warpExt.GetPreferences.Set(\"To View\",toViewName)\nend\n\n\n\n" ) (Script.242 Name: "Warp.SetLinkTable" SourceCode: "' SetLinkTable script\n\n' grab current setting from preference dictionary\nwarpExt = Extension.Find(\"Spatial Tools\")\nif (warpExt = NIL) then\n MsgBox.Error(\"Cannot find extension!\",\"ERROR\")\n return NIL\nend\nlinkTableName = warpExt.GetPreferences.Get(\"Link Table\")\nif (linkTableName = NIL) then\n linkTableName = \"\"\nelseif ((av.GetProject.FindDoc(linkTableName).Is(Table).Not) or\n ((av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"Link\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVT ab.FindField(\"From-X\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"From-Y\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"To-X\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"To-Y\") = NIL))) then\n linkTableName = \"\"\nend\n\n' get new properties\nlistOfTables = {}\nfor each d in av.GetProject.GetDocs\n if ((d.Is(Table)) and\n ((d.GetVTab.FindField(\"Link\") <> NIL) or\n (d.GetVTab.FindField(\"From-X\") <> NIL) or\n (d.GetVTab.FindField(\"From-Y\") <> NIL) or\n (d.GetVTab.FindField(\"To-X\") <> NIL) or\n (d.GetVTab.FindField(\"To-Y\") <> NIL))) then\n if (d.GetName = linkTableName) then\n listOfTables.Insert(d.GetName)\n else\n listOfTables.Add(d.GetName)\n end\n end\nend\nnewLinkTableName = MsgBox.ListAsString(listOfTables,\"Choose Link Table:\", \"Set Link Table\")\nif (newLinkTableName = NIL) then\n return NIL\nend\nif (newLinkTableName <> linkTableName) then\n newTable = av.GetProject.FindDoc(newLinkTa bleName)\n newString = newTable.GetName\n newString = newString++\"(Link Table)\"\n newTable.SetName(newString)\n oldTable = av.GetProject.FindDoc(linkTableName)\n oldString = oldTable.GetName\n oldString = oldString.Substitute(\"(Link Table)\",\"\").Trim\n oldTable.SetName(oldString)\n linkTableName = newTable.GetName\n \n ' set link table\n warpExt.GetPreferences.Set(\"Link Table\",linkTableName)\nend\n\n' reset link status\nwarpExt.GetPreferences.Set(\"Link Status\",\"From\")\n\n\n\n" ) (Script.243 Name: "Warp.CreateLinkTable" SourceCode: "' CreateLinkTable script\n\ntheFile = FileDialog.Put(av.GetProject.GetWorkDir.MakeTmp(\"links\",\"dbf\"),\"*.dbf\",\"Create Link Table\")\nif (theFile = NIL) then\n return NIL\nend\ntheVTab = VTab.MakeNew(theFile,dBASE)\nlinkField = Field.Make(\"Link\",#FIELD_SHORT,3,0)\nfromXField = Field.Make(\"From-X\",#FIELD_DOUBLE,14,6)\nfromYField = Field.Make(\"From-Y\",#FIELD_DOUBLE,14,6)\ntoXField = Field.Make(\"To-X\",#FIELD_DOUBLE,14,6)\ntoYField = Field.Make(\"To-Y\",#FIELD_DOUBLE,14,6)\ntheVTab.AddFields({linkField,fromXField,fromYField,to XField,toYField})\ntheVTab.SetEditable(FALSE)\nlinkTable = Table.Make(theVTab)\nlinkTable.SetName(linkTable.GetVTab.GetName++\"(Link Table)\")\nlinkTable.GetWin.Open\nlinkTable.GetWin.GetNext.Activate\n\n' make new link table the active link table\nwarpExt = Extension.Find(\"Spatial Tools\")\nif (warpExt = NIL) then\n MsgBox.Error(\"Cannot find extension!\",\"ERROR\")\n return NIL\nend\noldLinkTableName = warpExt.GetPreferences.Get(\"Link Table\")\nif (oldLinkTableName <> NIL) then\n oldTable = av.GetProject.FindDoc(oldLinkTable Name)\n oldString = oldTable.GetName\n oldString = oldString.Substitute(\"(Link Table)\",\"\").Trim\n oldTable.SetName(oldString)\nend\nwarpExt.GetPreferences.Set(\"Link Table\",linkTable.GetName)\n\n' reset link status\nwarpExt.GetPreferences.Set(\"Link Status\",\"From\")\n\n\n\n" ) (Script.244 Name: "Warp.TypeFromLink" SourceCode: "' TypeFromLink script\n\n' get link table\nwarpExt = Extension.Find(\"Spatial Tools\")\nif (warpExt = NIL) then\n MsgBox.Error(\"Cannot find extension!\",\"ERROR\")\n return NIL\nend\nlinkTableName = warpExt.GetPreferences.Get(\"Link Table\")\nif ((linkTableName = NIL) or\n (av.GetProject.FindDoc(linkTableName).Is(Table).Not) or\n ((av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"Link\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"From-X\") = NIL) or\n (av.GetProject.FindDoc(lin kTableName).GetVTab.FindField(\"From-Y\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"To-X\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"To-Y\") = NIL))) then\n MsgBox.Error(\"Invalid Link Table\",\"Type-in From Link\")\n return NIL\nend\n\n' get next link number\nlistOfLinkNumbers = {}\nlinkVTab = av.GetProject.FindDoc(linkTableName).GetVTab\nfor each r in linkVTab\n listOfLinkNumbers.Add(linkVTab.ReturnValueNumber(linkVTab.FindField(\"Link\"),r))\nend\nlistOfLinkNu mbers.RemoveDuplicates\nlistOfLinkNumbers.Sort(TRUE)\nfirstNumber = 0\nif (listOfLinkNumbers.Count = 0) then\n newLinkNumber = 1\nelse\n for each n in listOfLinkNumbers\n if ((n - firstNumber) > 1) then\n newLinkNumber = firstNumber + 1\n break\n end\n firstNumber = n\n end\n if (firstNumber = listOfLinkNumbers.Get(listOfLinkNumbers.Count - 1)) then\n newLinkNumber = firstNumber + 1\n end\nend\n\n' set link number\nwarpExt.GetPreferences.Set(\"Link Number\",newLinkNumber.AsString)\n\n' get from coordina te\nstatus = TRUE\nsuggestXCoord = \"\"\nsuggestYCoord = \"\"\nwhile (status)\n coordList = MsgBox.MultiInput(\"Enter from coordinates:\", \"Type-in From Link\", {\"X coordinate:\", \"Y coordinate:\"}, {suggestXCoord,suggestYCoord})\n if (coordList.Count < 2) then \n return NIL \n end\n xCoord = coordList.Get(0)\n yCoord = coordList.Get(1)\n if (xCoord.IsNumber) then\n xOK = TRUE\n suggestXCoord = xCoord\n else\n xOK = FALSE\n MsgBox.Info(\"The x coordinate must be a number\",\"Type-in From Link\")\n end\n if (yCoord .IsNumber) then\n yOK = TRUE\n suggestYCoord = yCoord\n else\n yOK = FALSE\n MsgBox.Info(\"The y coordinate must be a number\",\"Type-in From Link\")\n end\n if (xOK and yOK) then\n status = FALSE\n else\n status = TRUE\n end\nend \n\n' write coordinates into link table\nlinkVTab = av.GetProject.FindDoc(linkTableName).GetVTab\nlinkVTab.SetEditable(TRUE)\nif (linkVTab.IsEditable.Not) then\n MsgBox.Error(\"Cannot edit Link Table\",\"Type-in From Link\")\n return NIL\nend\nnewRecord = linkVTab.AddRecord\nlinkVTab.S etValueNumber(linkVTab.FindField(\"Link\"),newRecord,newLinkNumber)\nlinkVTab.SetValueNumber(linkVTab.FindField(\"From-X\"),newRecord,xCoord.AsNumber)\nlinkVTab.SetValueNumber(linkVTab.FindField(\"From-Y\"),newRecord,yCoord.AsNumber)\nlinkVTab.SetEditable(FALSE)\n\n' set link status\nwarpExt.GetPreferences.Set(\"Link Status\",\"To\")\n\n' draw link on from view if one is set\nfromViewName = warpExt.GetPreferences.Get(\"From View\")\nif ((fromViewName <> NIL) and\n (av.GetProject.FindDoc(fromViewName).Is(View))) then\n fromView = av.GetProject.FindDoc(fromViewName)\n viewGraphics = fromView.GetGraphics\n thePoint = Point.Make(xCoord.AsNumber,yCoord.AsNumber)\n linkGraphic = GraphicShape.Make(thePoint)\n linkGraphic.GetSymbol.SetSize(6)\n linkNumberGraphic = GraphicText.Make(newLinkNumber.AsString,thePoint)\n linkNumberGraphic.GetSymbol.SetSize(12)\n linkGroupGraphic = GraphicGroup.Make\n linkGroupGraphic.Add(linkGraphic)\n linkGroupGraphic.Add(linkNumberGraphic)\n linkGroupGraphic.SetName(newLinkNumber.AsString)\n viewGraphics.Ad d(linkGroupGraphic)\nend\n\n' activate to view and to link tool if to view set\ntoViewName = warpExt.GetPreferences.Get(\"To View\")\nif ((toViewName <> NIL) and\n (av.GetProject.FindDoc(toViewName).Is(View))) then\n toView = av.GetProject.FindDoc(toViewName)\n toView.GetWin.Activate\n theDocGUI = av.FindGUI(toView.GetGUI)\n theToolBar = theDocGUI.GetToolBar\n theTool = theToolBar.FindByScript(\"Warp.ToLinkTool\")\n theTool.Select\nend\n\n\n\n" ) (Script.245 Name: "Warp.TypeToLink" SourceCode: "' TypeToLink script\n\n' get link table\nwarpExt = Extension.Find(\"Spatial Tools\")\nif (warpExt = NIL) then\n MsgBox.Error(\"Cannot find extension!\",\"ERROR\")\n return NIL\nend\nlinkTableName = warpExt.GetPreferences.Get(\"Link Table\")\nif ((linkTableName = NIL) or\n (av.GetProject.FindDoc(linkTableName).Is(Table).Not) or\n ((av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"Link\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"From-X\") = NIL) or\n (av.GetProject.FindDoc(linkT ableName).GetVTab.FindField(\"From-Y\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"To-X\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"To-Y\") = NIL))) then\n MsgBox.Error(\"Invalid Link Table\",\"Type-in To Link\")\n return NIL\nend\n\n' get link number\nlinkNumber = warpExt.GetPreferences.Get(\"Link Number\").AsNumber\nif (linkNumber = NIL) then\n MsgBox.Error(\"Invalid Link Number\",\"Type-in To Link\")\nend\n\n' get from coordinate\nstatus = TRUE\nsuggestXCoord = \"\"\nsu ggestYCoord = \"\"\nwhile (status)\n coordList = MsgBox.MultiInput(\"Enter to coordinates:\", \"Type-in To Link\", {\"X coordinate:\", \"Y coordinate:\"}, {suggestXCoord,suggestYCoord})\n if (coordList.Count < 2) then \n return NIL \n end\n xCoord = coordList.Get(0)\n yCoord = coordList.Get(1)\n if (xCoord.IsNumber) then\n xOK = TRUE\n suggestXCoord = xCoord\n else\n xOK = FALSE\n MsgBox.Info(\"The x coordinate must be a number\",\"Type-in To Link\")\n end\n if (yCoord.IsNumber) then\n yOK = TRUE\n suggestYC oord = yCoord\n else\n yOK = FALSE\n MsgBox.Info(\"The y coordinate must be a number\",\"Type-in To Link\")\n end\n if (xOK and yOK) then\n status = FALSE\n else\n status = TRUE\n end\nend \n\n' write coordinates into link table\nlinkVTab = av.GetProject.FindDoc(linkTableName).GetVTab\nlinkVTab.SetEditable(TRUE)\nif (linkVTab.IsEditable.Not) then\n MsgBox.Error(\"Cannot edit Link Table\",\"Type-in To Link\")\n return NIL\nend\nfor each r in linkVTab\n if (linkVTab.ReturnValueNumber(linkVTab.FindField(\"Link\"),r) = l inkNumber) then\n linkVTab.SetValueNumber(linkVTab.FindField(\"To-X\"),r,xCoord.AsNumber)\n linkVTab.SetValueNumber(linkVTab.FindField(\"To-Y\"),r,yCoord.AsNumber)\n break\n end\nend\nlinkVTab.SetEditable(FALSE)\n\n' set link status\nwarpExt.GetPreferences.Set(\"Link Status\",\"From\")\n\n' draw link on to view if one is set\ntoViewName = warpExt.GetPreferences.Get(\"To View\")\nif ((toViewName <> NIL) and\n (av.GetProject.FindDoc(toViewName).Is(View))) then\n toView = av.GetProject.FindDoc(toViewName)\n viewGraphics = toView.GetGraphics\n thePoint = Point.Make(xCoord.AsNumber,yCoord.AsNumber)\n linkGraphic = GraphicShape.Make(thePoint)\n linkGraphic.GetSymbol.SetSize(6)\n linkNumberGraphic = GraphicText.Make(linkNumber.AsString,thePoint)\n linkNumberGraphic.GetSymbol.SetSize(12)\n linkGroupGraphic = GraphicGroup.Make\n linkGroupGraphic.Add(linkGraphic)\n linkGroupGraphic.Add(linkNumberGraphic)\n linkGroupGraphic.SetName(linkNumber.AsString)\n viewGraphics.Add(linkGroupGraphic)\nend\n\n' activate from view and from link to ol if from view is set\nfromViewName = warpExt.GetPreferences.Get(\"From View\")\nif ((fromViewName <> NIL) and\n (av.GetProject.FindDoc(fromViewName).Is(View))) then\n fromView = av.GetProject.FindDoc(fromViewName)\n fromView.GetWin.Activate\n theDocGUI = av.FindGUI(fromView.GetGUI)\n theToolBar = theDocGUI.GetToolBar\n theTool = theToolBar.FindByScript(\"Warp.FromLinkTool\")\n theTool.Select\nend\n\n\n\n" ) (Script.246 Name: "Warp.Warp" SourceCode: "' Warp script\n\ntheView = av.GetActiveDoc\ntheTheme = theView.GetActiveThemes.Get(0)\ntheGrid = theTheme.GetGrid\n\n' get link table\nwarpExt = Extension.Find(\"Spatial Tools\")\nif (warpExt = NIL) then\n MsgBox.Error(\"Cannot find extension!\",\"ERROR\")\n return NIL\nend\nlinkTableName = warpExt.GetPreferences.Get(\"Link Table\")\nif ((linkTableName = NIL) or\n (av.GetProject.FindDoc(linkTableName).Is(Table).Not) or\n ((av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"Link\") = NIL) or\n (av.GetProject.FindD oc(linkTableName).GetVTab.FindField(\"From-X\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"From-Y\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"To-X\") = NIL) or\n (av.GetProject.FindDoc(linkTableName).GetVTab.FindField(\"To-Y\") = NIL))) then\n MsgBox.Error(\"Invalid Link Table\",\"Warp\")\n return NIL\nend\ntoViewName = warpExt.GetPreferences.Get(\"To View\")\n\n' create link list\ntheLinkList = {}\nnumLinks = 0\ntheLinkVTab = av.GetProject.FindDoc(linkTableNam e).GetVTab\nfromXField = theLinkVTab.FindField(\"From-X\")\nfromYField = theLinkVTab.FindField(\"From-Y\")\ntoXField = theLinkVTab.FindField(\"To-X\")\ntoYField = theLinkVTab.FindField(\"To-Y\")\nfor each r in theLinkVTab\n fromX = theLinkVTab.ReturnValueNumber(fromXField,r)\n fromY = theLinkVTab.ReturnValueNumber(fromYField,r)\n toX = theLinkVTab.ReturnValueNumber(toXField,r)\n toY = theLinkVTab.ReturnValueNumber(toYField,r)\n if (fromX.Is(Number) and fromY.Is(Number) and toX.Is(Number) and toY.Is(Number)) then\n fir stPoint = Point.Make(fromX,fromY)\n secondPoint = Point.Make(toX,toY)\n theLink = Line.Make(firstPoint,secondPoint)\n theLinkList.Add(theLink)\n numLinks = numLinks + 1\n end\nend\nif (numLinks < 3) then\n MsgBox.Error(\"A minimum of 3 links is needed.\",\"Warp\")\n return NIL\nend\n\n' obtain order\nstatus = TRUE\nsuggestOrder = \"2\"\nwhile (status)\n theOrder = MsgBox.Input(\"Enter order (1 - 12):\",\"Warp\",suggestOrder)\n if (theOrder = NIL) then\n return NIL\n end\n if (theOrder.IsNumber and ((theOrder.AsNumb er > 0) and (theOrder.AsNumber < 13))) then\n linksNeeded = ((theOrder.AsNumber + 1) * (theOrder.AsNumber + 2)) / 2\n if (numLinks >= linksNeeded) then\n status = FALSE\n else\n suggestOrder = (theOrder.AsNumber - 1).AsString\n MsgBox.Info(\"You don't have enough links for this high of an order. You have\"++\n numLinks.AsString++\"valid links in the current link table.\"++\n \"You need\"++linksNeeded.AsString++\"links for a\"++theOrder++\"order warp.\"++\n \"Please lower the order.\",\"Warp\")\n end\n else\n MsgBox.Info(\"The order must be a number between 1 and 12\",\"Warp\")\n end\nend\n\n' obtain resampling method\ntheResamplingType = MsgBox.ChoiceAsString({\"Nearest Neighbor\",\"Bilinear\",\"Cubic Convolution\"},\"Choose resampling method\",\"Warp\")\nif (theResamplingType = NIL) then\n return NIL\nend\nif (theResamplingType = \"Nearest Neighbor\") then\n theResampType = #GRID_RESTYPE_NEAREST\nelseif (theResamplingType = \"Bilinear\") then\n theResampType = #GRID_RESTYPE_B ILINEAR\nelseif (theResamplingType = \"Cubic Convolution\") then\n theResampType = #GRID_RESTYPE_CUBIC\nelse\n return NIL\nend\n\n' perform warp\ntheResult = theGrid.Warp(theLinkList,theOrder.AsNumber,theResampType,NIL)\n\n' rename data set\ntheFN = av.GetProject.GetWorkDir.MakeTmp(\"warp\",\"\")\ntheResult.Rename(theFN)\nif (theResult.HasError) then\n return NIL\nend\n\n' create gtheme and add it to To View if present, otherwise add it to \n' the active view\ntheGTheme = GTheme.Make(theResult)\ntheGTheme.SetName(\"Warp of\"++theTh eme.GetName)\nif ((toViewName <> NIL) and\n (av.GetProject.FindDoc(toViewName).Is(View))) then\n av.GetProject.FindDoc(toViewName).AddTheme(theGTheme)\nelse\n theView.AddTheme(theGTheme)\nend\n\n\n" ) (Script.247 Name: "Spatial.Aggregation" SourceCode: "'\n' Name: Spatial.Aggregation\n' \n' Title: Merge two or more grids.\n'\n' Author: Philip N. Hooge Ph.D. USGS-Biological Resources Division, Glacier Bay Field Station.\n' Email: Philip_Hooge@usgs.gov\n'\n' Date: 9/11/97 \n'\n' Version 1.0\n'\n' Topics: Spatial Analyst, Aggregation\n'\n' Description: Aggregates a grid using the chosen aggregate function. Asks the user\n' to select the appropriate cell size for aggregation and then request the \n' aggregation method. As the user whether they they wish to have the gr id extent expand to the\n' right and bottom or decrease. Then asks the user whether or not to use no value\n' cells in the calculations. A Grid theme must be selected before implementing.\n'\n' Note: Several of the functions give errors on all grids that I have tried these include\n' Majority filter, Minority Filter, Standard Deviation, Range, and Unique. I have\n' disabled them in this program. Uncomment out the aggList line if you want to try them on your grids. \n'\n' Requires: The Spatial Analyst extension to be loaded. The script\n' also requires an active view with an active grid theme. \n'\n' Note: This cript should be added as a menu item and then assigned \n' \"Spatial.HasActiveGThemeUpdate\" as the update script.\n' The current version of this program does not merge the contents of the attribute tables.\n' \n'\n' Self:\n'\n' Returns:\n'\n'\n'test if Spatial Analyst is loaded\ntest=Extension.Find(\"Spatial Analyst\")\nif (test=NIL) then\n msgbox.error(\"You must have the spatial analyst extension loaded\",\"MergeGri d\")\n return(nil)\nend\n\ntheView = av.GetActiveDoc\nenabled = FALSE\n\n' enable if only one active theme and it is a GTheme\nfor each t in theView.GetActiveThemes\n if (t.Is(GTHEME)) then \n enabled = TRUE\n end\nend\nif (theView.GetActiveThemes.Count > 1) then\n enabled = FALSE\n end\n\nif (enabled = FALSE) then\n msgbox.error(\"You must select a valid grid theme first\",\"Aggregate\")\n return(nil)\nend\n\n\n\n'Get the active view and grid theme\ntheView = av.GetActiveDoc\ntheTheme = theView.GetActiveThemes.Get(0)\naGrid = theTheme.GetGrid\n\n'Check the input grid for errors\nif (aGrid.HasError) then\n MsgBox.Info(\"aGrid.HasError = TRUE\", \"ERROR\")\n return NIL\nend\n\n'Set the analysis extent\nae = theView.GetExtension(AnalysisEnvironment)\nae.SetExtent(#ANALYSISENV_MAXOF, nil)\nae.SetCellSize(#ANALYSISENV_VALUE, aGrid.getcellsize)\n\n' Offer the user the opportunity to change\n ae = theView.GetExtension(AnalysisEnvironment)\n box = Rect.Make(0@0,1@1)\n cellSize = 1\n ce = AnalysisPropertiesDialog.Show(theView, TRUE, \"Output Grid Specif ication\")\n if (ce = NIL) then return NIL end\n ce.GetCellSize(cellSize)\n ce.GetExtent(box)\n\n\n'Ask for the cell value\naCellSizeST = MsgBox.Input(\"Enter the cell size.\",\"Resample variable: aCellSize \",\"\")\n if (Nil = aCellSizeST) then\n exit\n end\n\n'Ask for the aggregation method\n'aggList = {\"Majority\", \"Maximum\", \"Mean\", \"Median\", \"Minimum\", \"Minority\", \"Range\", \"Standard Deviation\", \"Sum\", \"Unique\"}\naggList = {\"Maximum\", \"Mean\", \"Median\", \"Minimum\", \"Sum\"}\nAggMethod = MsgBox.ChoiceAsString (aggList, \"W hich aggregation method to use?\", \"Aggregation Method\")\n\nIf (AggMethod = \"Majority\") then method = #GRID_STATYPE_MAJORITY\n elseif (AggMethod = \"Maximum\") then method = #GRID_STATYPE_MAX\n elseif (AggMethod = \"Mean\") then method = #GRID_STATYPE_MEAN\n elseif (AggMethod = \"Median\") then method = #GRID_STATYPE_MEDIAN\n elseif (AggMethod = \"Minimum\") then method = #GRID_STATYPE_MIN\n elseif (AggMethod = \"Minority\") then method = #GRID_STATYPE_MINORITY\n elseif (AggMethod = \"Range\") then method = #GRID_ST ATYPE_RANGE\n elseif (AggMethod = \"Standard Deviation\") then method = #GRID_STATYPE_STD\n elseif (AggMethod = \"Sum\") then method = #GRID_STATYPE_SUM\n elseif (AggMethod = \"Unique\") then method = #GRID_STATYPE_VARIETY\n else\n exit\nend\n\n\n'Ask for expanded or not\nnoExpand = MsgBox.YesNo( \"Do you wish expand the extent?\", \"Expand Extent\", TRUE )\n'Ask whether or not to use no value cells\n\nnoData = MsgBox.YesNo( \"Do you wish to use no value cells?\", \"No Data\", TRUE )\n\n\n'Aggregate\n\nOut_Grid = aGrid.Aggreg ate (aCellSizeST.asNumber,method,noExpand,noData)\n\n\n\n'Check the aggregated grid for errors\nif (Out_GRID.HasError) then\n MsgBox.Info(\"Out_GRID.HasError = TRUE\", \"ERROR\")\n return NIL\nend\n\n' create a theme\ntheGTheme = GTheme.Make(Out_GRID)\n\n' set name of theme\ntheGTheme.SetName(AggMethod++\" Aggregation of\"++theTheme.GetName)\n\n' add theme to the view\ntheView.AddTheme(theGTheme)\n\n" ) (Script.248 Name: "Spatial.ResampleGrid" SourceCode: "'\n' Name: Spatial.ResampleGrid\n' \n' Title: Resample a Grid to Specified Cell Size.\n'\n' Author: Brent L. Brock, Dept. of Agronomy, Kansas State Univ.\n'\n' Date: 1/09/97\n'\n' Topics: Spatial Analyst\n'\n' Description: Resamples a grid using a control GUI.\n' aGrid.Resample (aCellSize, aGridResTypeEnum) is used to \n' resample the grid. aCellSize is obtained from \"aCellSize\", and \n' aGridResTypeEnum is obtained from \"theSampMethod\". The default \n' value for aGridResTypeEnum is Nearest Neighbor. The default value\n' displayed in the Cell Size input box is the current Cell Size of\n' the grid to be resampled.\n'\n' Requires: The Spatial Analyst extension to be loaded. The script\n' also requires an active view with an active grid theme that \n' represents a surface. The grid theme should be the only active \n' theme in the view.\n'\n' Note: Error messages may be avoided by assigning this script to a\n' menu item and assigning \"Spatial.HasActiveGThemeUpdate\" as the\n' update script.\n'\n' Self:\n'\n' Returns:\n'\n'test if Spatial Anal yst is loaded\ntest=Extension.Find(\"Spatial Analyst\")\nif (test=NIL) then\n msgbox.error(\"You must have the spatial analyst extension loaded\",\"ResampleGrid\")\n return(nil)\nend\n'\ntheView = av.GetActiveDoc\n'\n' get active GTheme\ntheTheme = theView.GetActiveThemes.Get(0)\ntheExt = theTheme.GetClass.GetClassName\nif (theExt <> \"Gtheme\") then\n msgbox.error(\"The Selected Theme Is Not A Grid\", \"ResampleGrid\")\n return(nil)\nend\ntheGrid = theTheme.GetGrid\ntheCellSize = theGrid.GetCellSize.AsString \n'\n' display input box t o get cell size and resampling method information.\ndefaultstring = theCellSize\ntheSize = MsgBox.Input(\"Enter Output Cell Size\", \"RasampleGrid\", defaultstring)\nif (theSize = NIL) then\n return(nil)\nend\naCellSize = theSize.AsNumber\naList = {\"Nearest Neighbor\",\"Bilinear Interpolation\",\"Cubic Convolution\"}\nfor each s in aList\n s.setName(s)\nend\ntheSampMethod = MsgBox.Choice ( aList,\"Resampling Method\", \"ResampleGrid\")\n'\nif (theSampMethod = aList.Get(0)) then\n aGridResTypeEnum = #GRID_RESTYPE_NEAREST\nelseif (t heSampMethod = aList.Get(1)) then\n aGridResTypeEnum = #GRID_RESTYPE_BILINEAR\nelseif (theSampMethod = aList.Get(2)) then\n aGridResTypeEnum = #GRID_RESTYPE_CUBIC\nelse\n return(nil)\nend\n' \n' create a theme with resampled data\ntheGTheme = GTheme.Make(theGrid.Resample (aCellSize, aGridResTypeEnum))\n\n' set name of theme\ntheGTheme.SetName(\"Resampled\"++theTheme.GetName)\n\n' add theme to the view\ntheView.AddTheme(theGTheme)\n'" ) (Script.249 Name: "Spatial.RandomGrid" SourceCode: "'\n' Name: Spatial.RandomGrid\n' \n' Title: Creates a random grid.\n'\n' Author: Elizabeth K. Solomon and Philip N. Hooge \n' USGS-Biological Resources Division Glacier Bay Field Station.\n' Email: elizabeth_solomon@nps.gov, philip_hooge@usgs.gov\n'\n' Date: 6/15/98 \n'\n' Version 1.5\n'\n' Topics: Spatial Analyst\n'\n' Description: A function to create a normal or uniform random grid.\n'\n' Requires: The Spatial Analyst extension to be loaded. The script\n' also requires an active view. \n'\n' Note: This scri pt should be added as a menu item \n'\n' Self:\n'\n' Returns:\n'\n'test if Spatial Analyst is loaded\ntest=Extension.Find(\"Spatial Analyst\")\nif (test=NIL) then\n msgbox.error(\"You must have the spatial analyst extension loaded\",\"RandomGrid\")\n return(nil)\nend\n\ntheView = av.GetActiveDoc\n\n'bring up the AnalysisPropertiesDialog\ntheAE = AnalysisPropertiesDialog.Show (theView,TRUE, \"Analysis Properties\")\n'check for Cancel on dialog\nif (theAE = NIL) then\n return NIL\n end\n'activate new settings\ntheAE.Activate\n\n\n' select the type of grid\naList = {\"Uniform\",\"Normal\"}\nfor each s in aList\n s.setName(s)\nend\n\nGridChoice = MsgBox.ListAsString (aList,\"Which type of random grid?\", \"Random Grid\")\nif (GridChoice = \"Uniform\") then\n Out_GRID = Grid.MakeRandom \nelseif (GridChoice = \"Normal\") then\n Out_GRID = Grid.MakeNormal\nelse\n exit\nend\n' \n\n'Check the random grid for errors\nif (Out_GRID.HasError) then\n MsgBox.Info(\"Out_GRID.HasError = TRUE\", \"ERROR\")\n exit\nend\n\n'Now ask the user if they want to modify the grid\nAdjus tGrid=Msgbox.YesNo(\"Do you want to adjust the grid?\",\"Grid Adjust?\",TRUE)\n\nIf (AdjustGrid) then\n 'If Uniform Random was selected, prompt for a range of values\n If (GridChoice = \"Uniform\") then\n TheMinimumValue = MsgBox.Input (\"Enter the minimum value in the range\", \"Range of Uniform Random Values\", \"0\")\n TheMaximumValue = MsgBox.Input (\"Enter the maximum value in the range\", \"Range of Uniform Random Values\", \"10\") \n TheRange = TheMaximumValue.asNumber - TheMinimumValue.asNumber\n Out_Grid = (Out_GRID * TheRange) + TheMinimumValue.asNumber \n \n 'Check the new unform random grid for errors\n if (Out_Grid.HasError) then\n MsgBox.Info(\"Out_GRID.HasError = TRUE\", \"ERROR\")\n exit\n end 'Out_Grid.haserror\n end 'GridChoice = Uniform\n\n 'If a Normal Random grid was selected, prompt for new values\n If (GridChoice = \"Normal\") then\n TheMeanValueString = MsgBox.Input (\"Enter the mean value\", \"Normal Distribution Values\", \"0\")\n TheStdD evString = MsgBox.Input (\"Enter the standard deviation\" + nl + \"Enter 0 for standard normal\", \"Normal Distribution Values\", \"1\") \n\n\n If (TheStdDevString = \"NIL\") then \n TheStdDevString = 0 \n end\n \n If (TheStdDevString = \"0\") then\n TheStdDevString = TheMeanValueString\n end\n \n TheMeanValue = TheMeanValueString.AsNumber\n TheStdDev = TheStdDevString.AsNumber\n \n \n Out_Grid = (Out_GRID * TheStdDev) + TheMeanValue\n \n 'Check the new normal grid for errors\n if (Out_Grid.HasError) then\n MsgBox.Info(\"Out_GRID.HasError = TRUE\", \"ERROR\")\n exit\n end 'Out_Grid.HasError\n end 'Grid choice = normal\nend 'If adjust grid\n\n\n\n' create a theme\ntheGTheme = GTheme.Make(Out_GRID)\n\n' set name of theme\ntheGTheme.SetName(\"Random Grid\")\n\n' add theme to the view\ntheView.AddTheme(theGTheme)\n" ) (Script.250 Name: "Spatial.PycnophylacticInterpolation" SourceCode: "'----------------------------------------------------------------------\n'Tobler: (c) by Leop.\n'The program performs pycnophylactic interpolation on a categorial grid\n'The analysis variable in the VTAB of the grid should represent a \n'phenomenon that changes continuously over space.\n'----------------------------------------------------------------------\n'Please send comments to \n' DI Leopold Riedl\n' Department for Urban and Regional Research\n' Technical Un iversity Vienna / Austria\n' Karlsg.13\n' A - 1040 Wien\n' email: or \n' fax: +43 / 1 / 5042156\n' phone: +43 / 1 / 58801 / 4343\n'----------------------------------------------------------------------\n'Requires:\n' 1) The SpatialAnalyst extension is loaded\n' 2) the active theme in the current view is a categorial integer-GRID \n' with an associated VTAB with at least 3 attributes: \n' VALUE (defines the zones)\n' COUNT (Number of cells in zone)\n' the analysis variable (to be smoothed/interpolated)\n'Dialogs:\n' 1) asks for the analysis variable (in VTAB)\n' 2) asks for normalization: \n' if YES: the analysis variable is divided by COUNT (in VTAB)\n' NO: the analysis variable is assumed to be already normalized\n' 3) asks for the interpolation-parameters:\n' - Maximum number of iterations:\n' default = 50\n' - Number of smoothing-steps per iteration:\n' default = 2\n' Defines the number of times a smoothing mean-filter is \n' applied during one iteration.\n' After each iteration the resultgrid is numerically adjusted \n' to keep the zonalsum of the analysis variable constant.\n' (i.e. pycnophylactic = body preserving; see algorithm below)\n' - Size of smoothing-neighborhood in cells:\n' default = 3\n' should be an odd integer (a rectangular neighborhood is used)\n' - Convergence-limit in percent of range of the Analysis Variable:\n' default = 1.0 %\n' The measure of convergence is the maximum of the absolute \n' difference between the resultgrids of the last two iterations\n' In pseudo-code: theMeasure = (newGrid-oldGrid).Abs.MaximumOf\n' - Interval of contour-lines (0 for no contours):\n' default = range-depending (results in at least 10 and \n' at most 100 contour-levels)\n' Optional contourlines are derived from the result-grid.\n'Algorithm (c ore):\n' REPEAT\n' smooth_grid (with mean-filter)\n' adjust_grid (to preserve zonalsum of analvar)\n' UNTIL convergence_or_maximum_of_iterations_is_reached\n'Results:\n' 1) a Float-Grid named \n' PIP(a,b,c,d) of x of y\n' with\n' PIP .. Pycnophylactic-Inter-Polation\n' a .. n of iterations needed\n' b .. n of smoothing-steps/iteration\n' c .. size of rectangular neighborhood used for smoothing\n' d .. limit of convergence as percentage of range (anal.var .)\n' x .. the analysis variable\n' y .. the categorial input-grid\n' 2) an optional shapefile with contour-lines\n'----------------------------------------------------------------------\n'Installation:\n' 1) Load this script into an empty script-editor-window\n' 2) Compile the script\n' 3) Assign the script to the click-property of a new menu-entry or \n' button in the view-gui (with project/customize...)\n'----------------------------------------------------------------------\n'Comments:\n' 1 ) It was not possible for me to keep you informed about the progress \n' of the algorithm during execution. \n' The implementation of the grid-class always uses the statusbar \n' during grid-calculations and I found no way to stop this annoying \n' behaviour. What a nuisance!\n' So you will only be informed once after the end of the algorithm.\n' Remarks will be gratefully acknowledged!\n' I'm lokking forward to the new DialogDesigner for a workaround.\n' 2) This script is tested only w ith relatively small grids. \n' It seems to me that the avenue-memory-management works pretty well\n' but you never know!\n'----------------------------------------------------------------------\ntheView = av.GetActiveDoc\nthePrj = theView.GetProjection\ntheHeader = \"Pycnophylactic Interpolation (c) by Leop.\"\n\n' create output for active GTheme t\nif (theView.GetActiveThemes.Count=0) then\n MsgBox.Error(\"No Theme selected\",theHeader)\n return nil\nend\nt = theView.GetActiveThemes.Get(0)\nif (t. Is(GTHEME).Not) then \n MsgBox.Error(\"No Grid:\"++t.GetName,theHeader)\n return nil\nend\n' obtain cellsize\ncellSize = t.GetGrid.GetCellSize\n\ntheVTab = t.GetVTab\nif (theVtab=nil) then\n MsgBox.Error(\"Grid '\"+t.GetName+\"' has no Attribute-table\",theHeader) \n return nil \nend\ntheVars = theVTab.GetFields.Clone\nvalfld = theVtab.FindField(\"Value\")\nif (valfld=nil) then \n MsgBox.Error(\"No Value-Field found in 'Attributes of\"++t.GetName+\"'\",\n theHeader)\n return nil\nend\ncntfld = theVtab.FindField(\"Count \")\nif (cntfld=nil) then \n MsgBox.Error(\"No Count-Field found in 'Attributes of\"++t.GetName+\"'\",\n theHeader) \n return nil \nend\ntheVars.RemoveObj(valfld)\ntheVars.RemoveObj(cntfld)\nanalvar = MsgBox.List(theVars,\"Choose analysis variable\"+NL+\n \"in 'Attributes of\"++t.GetName+\"'\",theHeader)\nif (analvar=nil) then return nil end\n\n'Normalisieren?\nnormalize = MsgBox.YesNo(\"Normalize\"++analvar.AsString++\"of\"\n ++t.GetName+\"?\",theHeader,true)\nif (normalize) th en\n g0 = t.GetGrid.Lookup(analvar.AsString) / t.GetGrid.Lookup(\"Count\")\n r0 = t.GetGrid.Lookup(analvar.AsString)\n theName = \"normalized\" ++ analvar.AsString ++ \"of\" ++ t.GetName\nelse\n g0 = t.GetGrid.Lookup(analvar.AsString)\n r0 = t.GetGrid.Lookup(analvar.AsString) * t.GetGrid.Lookup(\"Count\")\n theName = analvar.AsString ++ \"of\" ++ t.GetName\nend\ntheStatList = g0.GetStatistics\ntheRange = theStatList.Get(1) - theStatList.Get(0) '=maximum-minimum\nif (theRange.log(10)>0) then 'interval for contours\n theDefInterval = (10^(theRange.log(10).truncate))/10\nelse\n theDefInterval = (10^(theRange.log(10).truncate-1))/10\nend\n\n' ask for the parameters of interpolation:\ntheLabels = {\"Maximum number of iterations:\",\n \"Number of smoothing-steps per iteration:\",\n \"Size of smoothing-neighborhood in cells:\",\n \"Convergence-limit in percent of range (\"\n +theRange.AsString+\"):\",\n \"Interval of contour-lines (0 for no contours):\" }\ntheDefaults = {\"50\",\"2\",\"3\",\"1.0\",theDefInterval.AsString}\ntheParams = MsgBox.MultiInput(\"Analysis variable: \"++theName,\n theHeader,theLabels,theDefaults)\nif ((theParams=nil) or (theParams.Count<=0)) then return nil end\nmaxIter = theParams.Get(0)\ngiter = theParams.Get(1)\ntheRadius = theParams.Get(2)\ntheProzLimit = theParams.Get(3)\ntheInterval = theParams.Get(4)\n\n' Test der Parameter\nif ((maxIter=nil) or (maxIter.IsNumber.Not)) then return nil end\nmaxIter = maxIter.AsNumber.R ound.Abs\n\nif (giter=nil) then return nil end\ngiter = giter.AsNumber.Round.Abs\n\nif ((theRadius=nil) or (theRadius.IsNumber.Not)) then return nil end\ntheRadius = theRadius.AsNumber.Round.Abs\ntheNbr = NbrHood.MakeRectangle(theRadius,theRadius,false)\n\nif ((theProzLimit=nil) or (theProzLimit.IsNumber.Not)) then return nil end\ntheLimit = theProzLimit.AsNumber.Abs * theRange / 100.0\n\n' Interpolation - Loop\nr = g0\nmaxDiff = theRange\nmore = true\niter = 0\nwhile (more)\n iter = iter + 1\n rold = r\n for each j in 1..g iter\n r = r.FocalStats(#GRID_STATYPE_MEAN, theNbr, FALSE)\n end\n r = r/r.ZonalStats(#GRID_STATYPE_SUM,t.GetGrid,thePrj,valfld,FALSE)*r0 \n maxdiff = (r-rold).Abs.GetStatistics.Get(1)\n more = ((itertheLimit))\nend\n\n' inform the user\nif (maxDiff>theLimit) then \n MsgBox.Info(\"Maximum number of iterations reached:\"++iter.AsString+NL+\n \"MaxDifference =\" ++ maxdiff.AsString++\n \"(\"+(maxdiff/theRange*100.0).AsString+\n \"% of range of\"++theName+\")\", theHeader)\nelse\n MsgBox.Info(\"Convergence reached after Iteration\"++iter.AsString+NL+\n \"MaxDifference =\" ++ maxdiff.AsString++\n \"(\"+(maxdiff/theRange*100.0).AsString+\n \"% of range of\"++theName+\")\",theHeader)\nend\n\n' Make a Gtheme and rename data set\naFN = av.GetProject.GetWorkDir.MakeTmp(\"pip\",\"\")\nr.Rename(aFN)\nif (r.HasError) then return NIL end\n' create a Gtheme\ngthm = GTheme.Make(r)\n' set name for theme\ntheName = \"PIP(\"+iter.AsString+\",\"+giter.AsString+\",\"+theRadius .AsString+\n \",\"+theProzLimit.AsString+\") of \"+analvar.AsString+\" of \"+t.GetName\ngthm.SetName(theName) \n' add theme to the View\ntheView.AddTheme(gthm)\ngthm.SetVisible(true)\n\n' CreateContours, if wanted \nif ((theInterval=nil) or (theInterval.IsNumber.Not) \n or (theInterval.AsNumber<=0)) then return nil end\ntheInterval = theInterval.AsNumber.Abs\n' create contour Shapefile\ncontourFTab = gthm.GetGrid.Contour(\n av.GetProject.GetWorkDir.MakeTmp(\"ctpip\",\"shp\"),theInterval,0,thePrj)\nif (contourFTab = NIL) then return NIL end\ncontourFTab.CreateIndex(contourFTab.FindField(\"Shape\"))\n' create a theme \nthm = FTheme.Make(contourFTab) \n' set name for theme\nthm.SetName(theInterval.AsString+\"-Contours of\" ++ gthm.GetName)\n' add theme to the View\ntheView.AddTheme(thm)\nthm.SetVisible(true)\nreturn nil\n" ) (Script.251 Name: "Spatial.ZonalGeometryTable" SourceCode: "'\n' Name: Spatial.ZonalGeometryTable' \n' Title: Merge two or more grids.\n'\n' Author: Philip N. Hooge Ph.D. USGS-Biological Resources Division Glacier Bay Field Station.\n' Email: Philip_Hooge@nps.gov\n'\n' Date: 9/11/97 \n'\n' Version 1.0\n'\n' Topics: Spatial Analyst\n'\n' Description: Does the Zonal Geometry Table Request. For some reason this gives fewer errors\n' than useing the Map Calculator to do the request. It will also query you for the output file\n' and load it into the project. If you wish to ge t just the area's without waiting the other \n' data hit the quit bottom just before it finishes the calculations.\n'\n' Requires: The Spatial Analyst extension to be loaded. The script\n' also requires an active view with an active grid theme. \n'\n' \n'\n' Self:\n'\n' Returns:\n'\n'\n'test if Spatial Analyst is loaded\ntest=Extension.Find(\"Spatial Analyst\")\nif (test=NIL) then\n msgbox.error(\"You must have the spatial analyst extension loaded\",\"MergeGrid\")\n return(nil)\nend\n\ntheView = av.GetActiveDoc\nenabled = FALSE\n\n' en able if only one active theme and it is a GTheme\nfor each t in theView.GetActiveThemes\n if (t.Is(GTHEME)) then \n enabled = TRUE\n end\nend\nif (theView.GetActiveThemes.Count > 1) then\n enabled = FALSE\n end\n\nif (enabled = FALSE) then\n msgbox.error(\"You must select a valid grid theme first\",\"MergeGrid\")\n return(nil)\nend\n\n\n'Get the active view and grid theme\ntheView = av.GetActiveDoc\ntheTheme = theView.GetActiveThemes.Get(0)\naGrid = theTheme.GetGrid\n\n'Get a output file name and establish it as a dbase file\n theClass = DBASE\n theFilter = \"*.dbf\"\n theExt = \"dbf\"\ntheFileName=FileDialog.Put(av.GetProject.MakeFileName(\"table\", theExt),\n theFilter,\"Export Table\")\nif (theFileName = NIL) then return nil end\n\n\n'Get the table statistics\nout_table = aGrid.ZonalGeometryTable(theFileName)\n\n'Check the table for errors\nif (Out_table.HasError) then\n MsgBox.Info(\"Out_table.HasError = TRUE\", \"ERROR\")\n return NIL\nend\n\n'************************* add the new table to the project ****************************\n\np atterns = {\"*.dbf\", \"arcdr9\", \"*.txt\"}\nlabels = {\"dBASE (*.dbf)\",\n \"INFO\", \"Delimited Text (*.txt)\"}\n\nv = VTab.Make(theFileName, FALSE, FALSE)\nt = Table.Make(v)\nt.SetName(v.GetName)\nt.GetWin.Open\n" ) (Script.252 Name: "Spatial.Profiler" SourceCode: "'ArcView 3.0a Avenue Script: Profiler Ver 1.0\n'\n'Use to create chart profiles of line features (streams, roads, trails, etc.) using a line theme \n'and an elevation grid theme. \n'\n'Requires Spatial Analyst Extension.\n'\n'Requires two active themes, The first a line theme and the second a grid theme of elevations. \n'\n'Requires lines to be selected. In general, selected lines should be connected for results \n'to be realistic. There is no programmatic check to ensure selected lines are connected. In general, s elected lines\n'should not contain multiple branching for results to be realistic. That is, each node should connect no more than\n'two _selected_ line segments. \n'\n'Merges selected lines then finds interval points along the merged line at equal intervals. User is queried for how \n'many divisions of merged line. \n'\n'Queries active grid theme cells for elevation values at interval points.\n'\n'Outputs a dbf file of distances starting at the lowest interval point and includes all interval points\n'and correspondi ng z values. \n' \n'Outputs a line graph (profile) of distance from origin vs. z values if no more \n'than about 100 interval points are produced. Use a more robust graphing package to graph larger outputs. \n'\n'Bill Eichenlaub\n'bill_eichenlaub@nps.gov \n'\n'Date: 5/18/98\n\ntheView = av.getActiveDoc\nthePrj = theView.GetProjection\n\n\nif (thePrj.IsNull) then\n hasPrj = false\n msgbox.warning(\"The data needs to be projected\"\n +NL+\"into a cartesian coordiante system\",\"Projection Needed - Exiting! \")\n exit\nelse\n hasPrj = true\nend\n\nerr1 = \"The first active theme must be a polyline theme, the second active theme must be a grid. Click, hold and drag to change theme order. Use SHIFT click to select more than one theme. \"\n\nif (theView.GetActiveThemes.Count <> 2) then\n msgbox.error(err1,\"You need two selected themes...\")\n return(nil)\nend\n\ntheFTheme = theView.GetActiveThemes.Get(0)\n\nif (theFTheme.is(FTHEME)) then\n theFTab = theFtheme.GetFTab\nelse\n MsgBox.Error (err1 ,\"The first selected theme is n ot a polyline theme...\")\n return(nil)\nend\n\ntheClassName = theFTab.GetShapeClass.GetClassName\nif ((theClassName = \"Polyline\").Not) then\n MsgBox.Error (err1,\"The first selected theme is not a polyline theme...\")\n return(nil)\nend\n\ntheGTheme = theView.GetActiveThemes.Get(1)\nif (theGTheme.is(GTHEME))then\n theGrid = theGTheme.GetGrid\nelse\n MsgBox.Error (err1,\"The second selected theme is not a Grid theme...\")\n return(nil)\nend\n \ntheGraphics = theView.GetGraphics\n\ntheSet = theFtab.GetSelection\nif (theSet .count = 0) then\n MsgBox.Error (\"The active polyline theme must have at least one selected line.\",\"Try Again...\")\n return(nil)\nend\n\ntheShapeIn = theFTab.FindField(\"Shape\")\n\n'for each rec in the bit, merge into a polyline\nc =0\nfor each rec in theSet\n theLine=theFtab.ReturnValue(theShapeIn, rec)\n if (c = 0) then\n allLines = theLine\n else\n allLines = allLines.returnMerged(theLine)\n end\n c=c+1\nend\n\nallLines.clean\n\nddd = graphicShape.make(allLines.returnProjected(thePrj))\ntheGraphics.addbatch(ddd )\n\n'get the length of the resulting line\nlineLength = allLines.returnProjected(thePrj).returnLength\n\n'get number of divisions from user\nnumDivisions = msgbox.input(\"The selected lines total \" + lineLength.asString + \" units in length. They will be copied, merged and divided into even length intervals to produce the table and graph. How many divisions?\",\"Profiler\",\"10\")\nif (numDivisions = nil)then\n exit\nend\nnumDivisions = numDivisions.asNumber\n\nlengthPerDiv = lineLength/numDivisions\npercentInc = (lengthPe rDiv/lineLength)*100\n\nstartPt = allLines.asList.get(0).get(0)\ncenterPt = allLines.returnCenter\nstartPtZ = theGrid.CellValue (startPt, thePrj)\ncenterPtZ = theGrid.CellValue (centerPt, thePrj)\nif (startPtZ > centerPtZ) then\n allLines.flip\nend\n\ntheList = {}\n\n'disect the line\ndist = 0 \nfor each i in 0..100 by percentInc\n eachPt = allLines.Along(i) \n 'theGraphics.Add(graphicShape.Make(eachPt.clone.returnProjected(thePrj)))\n theZ = theGrid.CellValue (eachPt, thePrj)\n theList.add({eachPt, dist, theZ, \"Segmen t\", i.clone})\n dist = dist + lengthPerDiv\nend\n\n\n'make a dbf file and vtab to store the distance and z data\nMADefault = fileName.make(\"$HOME\").makeTmp(\"StrPr_\",\"dbf\")\nMAOutput = fileDialog.put( MADefault,\"*.dbf\",\"Output table of line lengths and elevations.\" )\nif (MAOutput = nil) then\n theFTab.SetSelection(theSet)\n theFTab.UpdateSelection\n msgBox.info(\"No name entered, procedure cancelled\",\"Exiting Procedure\")\n return nil\nend\nMAOutput.setExtension(\"dbf\")\ntheVtab = Vtab.makeNew(MAOutput, dbase)\ntheMeanA Table = table.make(theVtab)\nfSamNum = field.make(\"Num\", #FIELD_SHORT, 5, 0)\nfDistance = field.make(\"Distance\", #FIELD_DOUBLE, 15, 1)\nfzVal = field.make(\"Elevetion\", #FIELD_DOUBLE, 15, 1)\nfiVal = field.make(\"Per_Dist\", #FIELD_DOUBLE, 15, 4)\nftype = field.make(\"Type\", #FIELD_CHAR, 10, 0)\ntheVTab.addFields({fSamNum, fDistance, fzVal, ftype, fiVal})\n'add the data \ncount = 0\nfor each k in theList\n mDistance = k.get(1)\n mzVal = k.get(2)\n mtype = k.get(3) \n miVal = k.get(4)\n rec= theVtab.addRecord\n theVtab.s etValue(fSamNum, rec, count)\n theVtab.setValue(fDistance, rec, mDistance)\n theVtab.setValue(fzVal, rec, mzVal)\n theVtab.setValue(fiVal, rec, miVal)\n count=count+1\nend\ntheMeanATable.SetName(MAOutput.asString + \"_Profile_Table\")\n\n'chart the grid values vs. the line end points\nif(theList.count < 100) then \n 'make a chart of the Mean Area data\n theDistance = theVtab.FindField(\"Distance\")\n newChart = Chart.make(theVTab, {fzVal})\n newChart.SetRecordLabelField(theDistance) \n newChart.SetSeriesFromRecord s(false)\n newChart.GetChartDisplay.SetType(#CHARTDISPLAY_LINE)\n newChart.GetChartDisplay.SetSeriesColor (0, Color.GetBlue) \n anXAxis = newChart.GetXAxis\n anXAxis.SetName (\"Distance\")\n anXAxis.SetLabelVisible (True)\n anYAxis = newChart.GetYAxis\n anYAxis.SetName (\"Elevation\")\n anYAxis.SetLabelVisible (True)\n newChart.GetTitle.SetName(\"Themes used: \" + theFTheme.GetName+ \" and \"+ theGtheme.GetName) \n newChart.getChartLegend.SetVisible (false)\n newChart.SetName(MAOutput.asString + \"_Profile_Chart\") \n newChart.GetWin.Open\nelse\n msgbox.info(\"No graph produced because the number of points used is greater than or equal to 100, the maximum which can be graphed.\",\"Line Profiler\")\nend\n\ntheGraphics.endBatch\ntheGraphics.Invalidate\n\n\n" ) (Script.253 Name: "Spatial.Profileswithfeaturepts" SourceCode: "'ArcView 3.0a Avenue Script: BE.ProfilesWithFeaturePts Ver 1.0\n'\n'Use to create elevation profiles of selected lines and selected point features. \n'\n'Requires Spatial Analyst Extension.\n'\n'Requires three active themes, The first a point theme (the feature points) and the second a \n'line theme and the third a grid theme of elevations. Points do not need to be\n'exactly on the line. Uses request PointPosition to find point on line nearest to feature point. \n'\n'Requires feature points to be selected. \n'\n'Req uires lines to be selected. In general, selected lines should be connected for results \n'to be realistic. There is no programmatic check to ensure selected lines are connected. In general, selected lines\n'should not contain multiple branching for results to be realistic. That is, each node should connect no more than\n'two _selected_ line segments. \n'\n'Merges selected lines then finds interval points along the merged line at equal intervals. User is queried for how \n'many divisions of merged line. \n'\n'Queri es active grid theme cells for elevation values at interval points and selected feature points.\n'\n'Outputs a dbf file of distances starting at the lowest interval point and includes all interval points, feature \n'points and corresponding z values. Dbf table contains a field \"Type\" indicating if a distance is \n'an interval point or a feature point.\n' \n'Outputs a scatter-diagram graph (the line profile) of distance from origin vs. z values if no more \n'than about 50 points are produced. Use a more robust gr aphing package to graph larger outputs. \n'\n'Use a more robust graphic package to construct scatter-diagrams which differentiate interval and \n'feature points by color. \n'\n'Bill Eichenlaub\n'bill_eichenlaub@nps.gov\n'\n'Date: 5/17/1998\n\ntheView = av.getActiveDoc\nthePrj = theView.GetProjection\n\nif (thePrj.IsNull) then\n hasPrj = false\n msgbox.warning(\"The data needs to be projected\"\n +NL+\"into a cartesian coordiante system\",\"Projection Needed - Exiting!\")\n exit\nelse\n hasPrj = true\nend\n\ner r1 = \"The first active theme must be a point theme, the second active theme must be a line theme, third active theme must be a grid. Click, hold and drag to change theme order. Use SHIFT click to select more than one theme.\"\n\nif (theView.GetActiveThemes.Count <> 3) then\n msgbox.error(err1,\"You need three selected themes...\")\n return(nil)\nend\n\nthePtFTheme = theView.GetActiveThemes.Get(0)\n\nif (thePtFTheme.is(FTHEME)) then\n thePtFTab = thePtFtheme.GetFTab\nelse\n MsgBox.Error (err1 ,\"The first selected t heme is not a point theme...\")\n return(nil)\nend\n\ntheClassName = thePtFTab.GetShapeClass.GetClassName\nif ((theClassName = \"point\").Not) then\n MsgBox.Error (err1,\"The first selected theme is not a point theme...\")\n return(nil)\nend\n\ntheFTheme = theView.GetActiveThemes.Get(1)\n\nif (theFTheme.is(FTHEME)) then\n theFTab = theFtheme.GetFTab\nelse\n MsgBox.Error (err1 ,\"The second selected theme is not a polyline theme...\")\n return(nil)\nend\n\ntheClassName = theFTab.GetShapeClass.GetClassName\nif ((theClassName = \"polyline\").Not) then\n MsgBox.Error (err1,\"The second selected theme is not a polyline theme...\")\n return(nil)\nend\n\ntheGTheme = theView.GetActiveThemes.Get(2)\nif (theGTheme.is(GTHEME))then\n theGrid = theGTheme.GetGrid\nelse\n MsgBox.Error (err1,\"The third selected theme is not a Grid theme...\")\n return(nil)\nend\n \ntheGraphics = theView.GetGraphics\n\nthePtSet = thePtFtab.GetSelection\nthePtSetCount = thePtSet.count\nif (thePtSetCount = 0) then\n MsgBox.Error (\"The active point theme must have at least one selected point.\",\"Try Again...\")\n return(nil)\nend\n\ntheSet = theFtab.GetSelection\nif (theSet.count = 0) then\n MsgBox.Error (\"The active polyline theme must have at least one selected line.\",\"Try Again...\")\n return(nil)\nend\n\nthePtShapeIn = thePtFTab.FindField(\"Shape\")\ntheShapeIn = theFTab.FindField(\"Shape\")\n\n'for each rec in the bit, merge into a polyline\nc =0\nfor each rec in theSet\n theLine=theFtab.ReturnValue(theShapeIn, rec)\n if (c = 0) then\n allLines = theLine\n else\n allLines = allLi nes.returnMerged(theLine)\n end\n c=c+1\nend\n\nallLines.clean\n\nddd = graphicShape.make(allLines.returnProjected(thePrj))\n'theGraphics.addbatch(ddd)\n\n'get the length of the resulting line\nlineLength = allLines.returnProjected(thePrj).returnLength\n\n'get number of divisions from user\nnumDivisions = msgbox.input(\"The selected lines total \" + lineLength.asString + \" units in length. They will be copied, merged and divided into even lengths to produce the table and graph. How many divisions?\",\"Line Profiler\",\"10\" )\nif (numDivisions = nil)then\n exit\nend\nnumDivisions = numDivisions.asNumber\n\nlengthPerDiv = lineLength/numDivisions\npercentInc = (lengthPerDiv/lineLength)*100\n\nstartPt = allLines.asList.get(0).get(0)\ncenterPt = allLines.returnCenter\nstartPtZ = theGrid.CellValue (startPt, thePrj)\ncenterPtZ = theGrid.CellValue (centerPt, thePrj)\nif (startPtZ > centerPtZ) then\n allLines.flip\nend\n\nfeatureDict = dictionary.make(thePtSetCount + 1)\nfeatureKeyList = list.make\n'get the points on the line closest to each feature p oint\n'use pointPosition to get percentage and along to get point\nfor each rec in thePtSet\n thePt=thePtFtab.ReturnValue(thePtShapeIn, rec)\n featurePer = allLines.pointPosition(thePt)\n featureIntPt = allLines.along(featurePer) \n featureDist = (featurePer/100)*lineLength\n featureKeyList.add(featurePer)\n featureDict.add(featurePer, {featureIntPt, featureDist, featurePer})\nend\n\nfeatureKeylist.sort(True)\ntheList = {}\n\n'disect the line\ndist = 0 \nfor each i in 0..100 by percentInc\n for each pt in featureKey list\n dictList=featureDict.get(pt)\n sampPer = dictList.get(2)\n sampIntPt = dictList.get(0)\n sampDist = dictList.get(1)\n iLast = i.clone - percentInc\n if ((iLast < sampPer) and (i > sampPer)) then \n theSampIntZ = theGrid.CellValue (sampIntPt, thePrj)\n theList.add({sampIntPt, sampDist, theSampIntZ, \"Feature\", sampPer})\n end\n end \n eachPt = allLines.Along(i) \n 'theGraphics.Add(graphicShape.Make(eachPt.clone.returnProjected(thePrj)))\n theZ = theGrid.CellValue (eachPt, theP rj)\n theList.add({eachPt, dist, theZ, \"Interval\", i.clone})\n dist = dist + lengthPerDiv\nend\n\n'make a dbf file and vtab to store the distance and z data\nMADefault = fileName.make(\"$HOME\").makeTmp(\"StrPr_\",\"dbf\")\nMAOutput = fileDialog.put( MADefault,\"*.dbf\",\"Output table of line lengths and elevations.\" )\nif (MAOutput = nil) then\n theFTab.SetSelection(theSet)\n theFTab.UpdateSelection\n msgBox.info(\"No name entered, procedure cancelled\",\"Exiting Procedure\")\n return nil\nend\nMAOutput.setExtension(\"dbf\")\nth eVtab = Vtab.makeNew(MAOutput, dbase)\ntheMeanATable = table.make(theVtab)\nfSamNum = field.make(\"Num\", #FIELD_SHORT, 5, 0)\nfDistance = field.make(\"Distance\", #FIELD_DOUBLE, 15, 1)\nfzVal = field.make(\"Elevation\", #FIELD_DOUBLE, 15, 1)\nffeatureZVal = field.make(\"Pt_Ele\", #FIELD_DOUBLE, 15, 1)\nfiVal = field.make(\"Per_Dist\", #FIELD_DOUBLE, 15, 4)\nftype = field.make(\"Type\", #FIELD_CHAR, 10, 0)\ntheVTab.addFields({fSamNum, fDistance, fzVal, ffeatureZVal, ftype, fiVal})\n'add the data in the order of the sorted key l ist\ncount = 0\nfor each k in theList\n mDistance = k.get(1)\n mzVal = k.get(2)\n mtype = k.get(3) \n miVal = k.get(4)\n rec= theVtab.addRecord\n theVtab.setValue(fSamNum, rec, count)\n theVtab.setValue(fDistance, rec, mDistance)\n theVtab.setValue(fzVal, rec, mzVal)\n theVtab.setValue(fiVal, rec, miVal)\n theVtab.setValue(ftype, rec, mtype)\n if (mtype = \"Feature\")then\n theVtab.setValue(ffeatureZVal, rec, mZVal)\n else\n theVtab.setValue(ffeatureZVal, rec, nil)\n end\n count=count+1\nend\ntheMeanATable. SetName(MAOutput.asString + \"_Line_Point_Profile_Table\")\n\n'chart the grid values vs. the line end points\nif(theList.count < 51) then \n 'make a chart \n theDist = theVtab.FindField(\"Distance\") \n nChart = Chart.make(theVTab, {fDistance, fzVal})\n nChart.GetChartDisplay.SetType(#CHARTDISPLAY_XYSCATTER)\n aXAxis = nChart.GetXAxis\n aXAxis.SetName (\"Distance\")\n aXAxis.SetLabelVisible (True)\n anYAxis = nChart.GetYAxis\n anYAxis.SetName (\"Elevation\")\n anYAxis.SetLabelVisible (True) \n nChart.GetChartDispla y.SetSeriesColor(1, Color.GetBlue)\n nChart.GetTitle.SetName(\"Themes used: \" + theFTheme.GetName + \" and \"+ theGtheme.GetName + NL + \"Number of intervals: \" + numDivisions.asString + \". Interval length: \" + lengthPerDiv.asString +\" distance units.\" + NL + \"Chart shows interval points and feature points.\") \n nChart.getChartLegend.SetVisible (false)\n nChart.SetName(MAOutput.asString + \"_Line_Point_Profile_Chart\")\n nChart.GetWin.Open\nelse\n msgbox.info(\"No graph produced because the number of interval and feature points is greater than ArcView can handle. Use another program to produce a scatter diagram of the output table.\",\"Line Profiler\")\nend\n\ntheGraphics.endBatch\ntheGraphics.Invalidate\n\n" ) (Script.254 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 if (mMenuItem = \"Warp.SetFromView\") then\n themenu.add(Space.Make, theCindex)\n end\n\n if (mMenuItem = \"Spatial.Aggregation\") then\n themenu.add(Space.Make, theCindex)\n end\n\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 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=av.getproject.findGUI(aControl.get(0)).GetToolBar\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.255 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" )