/3.1 (Extension.1 Name: "Points to Polygons" FirstRootClassName: "List" Roots: 2 Roots: 3 Roots: 12 Roots: 13 Roots: 14 Version: 31 About: "This script makes a polygon feature representing the connection of the outermost points from a cluster of selected features in a point theme. If a polygon theme is editable in the view, the new polygon is created as a record within that theme and a pop-up screen queries the user for data entry of attributes for that record." InstallScript: 15 UninstallScript: 16 ExtVersion: 3 ) (List.2 ) (List.3 Child: 4 ) (List.4 Child: 5 Child: 9 Child: 11 ) (List.5 Child: 6 Child: 7 Child: 8 ) (AVStr.6 S: "View" ) (AVStr.7 S: "ButtonBar" ) (AVStr.8 S: "ViewTools.PointsToPolygons" ) (Butn.9 Help: "Points to Polygons//Converts Selected Features in a Point Theme to a Polygon (Hold Shift and Click for Help) " Update: "View.HasDataUpdate" Icon: 10 Click: "ViewTools.PointsToPolygons" ) (AVIcon.10 Name: "pt2ply.gif" Data: 4e442049 6d616765 00010019 00160000 Data: 02260000 00000000 00000000 00000000 Data: 00000000 00000000 00000000 05050505 Data: 05050505 05050505 05050505 05050505 Data: 05050300 00050402 04040404 02040404 Data: 04040404 04040404 04040403 00000502 Data: 02020404 02020204 04040404 04040404 Data: 04040404 03000005 04020404 04040204 Data: 04040404 04040404 04040404 04030000 Data: 05040404 04040404 04040404 04040404 Data: 04040404 04040300 00050404 04040404 Data: 04040404 04040404 04040404 04040403 Data: 00000504 02040404 04020404 04040404 Data: 04040404 04040404 03000005 02020204 Data: 04020202 04040404 04040404 04040404 Data: 04030000 05040204 04040402 04000404 Data: 00040404 04040404 04040300 00050404 Data: 04040404 04040400 04000404 04040404 Data: 04040403 00000504 04040404 04040404 Data: 04000004 04040404 04040404 03000005 Data: 04040404 04040404 00000000 04020404 Data: 04040402 04030000 05040404 04040404 Data: 04040404 04020202 01010102 02020300 Data: 00050404 04040404 04040404 04040402 Data: 04040404 04020403 00000504 04040404 Data: 04040404 04040404 01040404 04040104 Data: 03000005 04040404 04040404 04040404 Data: 04010404 04040401 04030000 05040404 Data: 04040404 04040404 04040204 04040404 Data: 02040300 00050404 04040404 04040404 Data: 04040202 02010101 02020203 00000504 Data: 04040404 04040404 04040404 02040404 Data: 04040204 03000003 03030303 03030303 Data: 03030303 03030303 03030303 03030000 Data: 00000000 00000000 00000000 00000000 Data: 00000000 00000000 00000300 00000000 Data: 00ff0084 84848484 c6c6c6ff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffffff ffffffff ffffffff 00020008 Data: 00050018 00000000 00000000 00000000 ) (Numb.11 N: 26.00000000000000 ) (List.12 ) (List.13 ) (Script.14 Name: "ViewTools.PointsToPolygons" SourceCode: "' ===========================================================================\n' Golly GIS, Richard Butgereit\n'\n' rdbutger@tfn.net 850/412-0071\n' 214 Britt Street Tallahassee,FL 32301\n' \n' ============================================================================\n'\n'\n' Name: ViewTools.PointsToPolygon\n'\n' Description: Takes points from a selected theme and converts them into a polygon.\n' Will add po lygon to a polygon theme is one is editable, otherwise adds\n' graphic to view. Install as control on View.\n'\n' History: RDB 03/99 - adapted from ESRI Sample Points.ConvertToPolygon\n'\n' ...........................................................................\n\n' Check for the shift key, if the shift key is down, pop up instructions for using this script\n \nif (System.IsShiftKeyDown) then\n message =\n \"Instructions For Point to Polygons:\"+nl+nl+\n \"This script makes a polygon feature represen ting the connection of the outermost points from a cluster of selected featues in a point theme.\"+nl+nl+\n \"Script by Richard Butgereit (rdbutger@tfn.net), GollyGIS.\"+nl+nl+\n \" Brief Instructions:\"+nl+nl+\n \"1. Select at least 3 features in a point theme.\"+nl+nl+\n \"2. Click this button.\"+nl+nl+\n \"3. A polygon respresenting the outermost points of the point cluster is made. If a polygon theme is editable within the view, the new polygon is added to that theme and a pop-up asks the user to input attribute s for the new record; otherwise the polygon is added a graphic.\"+nl\n \n msgbox.report(message,\"Point to Polygon Instructions\")\n \n Clipboard.The.Empty\n Clipboard.The.Add(message)\n Clipboard.The.Update\n \n MsgBox.Info(\"These instructions were copied to the system clipboard. To print them, open a text editor\"++\n \"(like notepad), paste in the contents of the clipboard, and print them from the text editor.\",\"PRINT INSTRUCTIONS\")\n \n return nil\nend\n\n' ................................................... ........................\n\n\ntheView = av.GetActivedoc\n\nlstThm = List.Make\nfor each thm in theView.GetThemes\n if (thm.Is(FTheme)) then\n theFtab = thm.GetFtab\n theShapeField = theFtab.FindField(\"Shape\")\n shapetype = theShapeField.GetType\n theSelrecs = theFtab.GetSelection\n if ((shapetype = #FIELD_SHAPEPOINT) or (shapetype = #FIELD_SHAPEMULTIPOINT) and (theSelrecs.Count > 2)) then\n lstThm.Add(thm)\n end\n end\nend \n\nif (lstThm.Count = 0) then\n MsgBox.Warning(\"A point theme with at least 3 selected fe atures is required.\",\"NO POINT THEMES WITH SELECTED FEATURES\")\n exit\nend\n\nif (lstThm.Count > 1) then\n theTheme = MsgBox.ListAsString(lstThm,\"Choose only one point theme with selected features:\",\"MULTIPLE POINT THEMES WITH SELECTED FEATURES\")\n if (theTheme = nil) then\n MsgBox.Error(\"You didn't pick a theme. You gotta pick a theme.\",\"SCRIPT TERMINATED\")\n exit\n end\nelse\n theTheme = lstThm.Get(0)\nend\n\naFtab = theTheme.GetFTab\nshpFld = aFtab.FindField(\"Shape\")\n\ndicX = dictionary.make(11)\ndicY = dictiona ry.make(11)\n\nlistPoly = {}\n\nfor each rec in aFtab.GetSelection\n pt = aFtab.ReturnValue(shpFld,rec)\n if (pt.Is(Point)) then\n dicX.Add(pt.GetX,pt)\n dicY.Add(pt.GetY,pt)\n end\nend\nif (dicX.Count < 3) then\n msgbox.info(\"Please have least 3 graphic points on view to make polygon\",\"\")\n exit\nend\n\nlistX = dicX.ReturnKeys\nlistY = dicY.ReturnKeys\n\nlistX.Sort(true)\n\npt0 = dicX.Get(listX.Get(0))\nlistPoly.Add(pt0)\n\nlistX.Remove(0)\n\nfor each X in listX\n pt = dicX.Get(X)\n if (pt.GetY < pt0.GetY) then \n pt0 = pt \n listPoly.Add(pt0)\n end\nend\n\nlistY.Sort(true)\nlistY.Remove(0)\nfor each Y in listY\n pt = dicY.Get(Y)\n if (pt.GetX > pt0.GetX) then \n\n pt0 = pt \n listPoly.Add(pt0)\n end\nend\n\nlistX.Sort(false)\nlistX.Remove(0)\nfor each X in listX\n pt = dicX.Get(X)\n if (pt.GetY > pt0.GetY) then \n pt0 = pt \n listPoly.Add(pt0)\n end\nend\n\nlistY.Sort(false)\nlistY.Remove(0)\nfor each Y in listY\n pt = dicY.Get(Y)\n if (pt.GetX < pt0.GetX) then \n pt0 = pt \n listPoly.Add(pt0)\n end\nend\n\nlistPoly.Add (listPoly.Get(0))\npoly = polygon.make({listPoly})\n\ntheEditTheme = theView.GetEditableTheme\nIF (Not(theEditTheme = Nil)) THEN\n theFTab = theEditTheme.GetFTab\n theShpField = theFTab.FindField(\"Shape\")\n theFTab.BeginTransaction\n newRecno = theFTab.AddRecord\n theFTab.SetValue(theShpField,newRecno,poly)\n\n lstFields = {}\n lstLabels = {}\n for each fld in theFtab.GetFields\n if (fld <> theShpField) then\n lstFields.Add(fld.AsString)\n lstLabels.Add(fld.AsString++\" (\"+ fld.GetType.AsString++fld.GetWidth.AsString+\") \")\n end\n end\n \n fldUpdate = MsgBox.MultiInput(\"Enter Values\",\"FIELD ATTRIBUTES FOR NEW RECORD\",lstLabels,{})\n\n if (fldUpdate.Count <> 0) then\n for each val in 0..(fldUpdate.Count-1)\n theFtab.SetValue(theFtab.FindField(lstFields.Get(val)),newRecNo,fldUpdate.Get(val))\n end\n else\n MsgBox.Warning(\"New record added, fields not updated.\",\"\")\n end \n\n theFTab.EndTransaction\n theFTab.Refresh\n \nELSE\n th eView.GetGraphics.Add(GraphicShape.Make(poly))\nEND\n\n\n\n\n\n" ) (Script.15 Name: "ViewTools.Install" SourceCode: "'DO NOT EDIT!!!\n\nif (av.getproject=nil) then return(nil) end\n\n\ntheDocs = SELF.get(0)\ntheControlList = SELF.get(1)\ntheMenuList = SELF.get(2)\ntheToolMenuList=SELF.Get(3)\ntheProject=Av.getproject\n\n\n'Add the Docs\n'\nfor each adoc in theDocs\n theProject.addDoc(adoc)\nend\n\n'Add the Controls\n'\nfor each totalControl in theControlList\n 'The Control list\n acontrol=totalControl.get(0)\n \n 'The physical control\n theControl = totalControl.get(1)\n \n 'The control Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n 'This finds the control set \n thecommand=\"av.getproject.findGUI(\"\"\"+aControl.get(0)+\"\"\").Get\"+acontrol.get(1)\n thescript1=Script.Make(thecommand)\n thecontrolset=thescript1.doit(\"\")\n \n 'Add the control to the control set\n theControlSet.Add(theControl,theCindex )\nend\n\n\n'Add the menus\nfor each totalcontrol in theMenuList\n \n 'The Control list\n acontrol=totalControl.get(0)\n mDoc=acontrol.get(0)\n mMenu=acontrol.get(1)\n mMenuItem=acontrol.get(2)\n\n 'The physical control\n theControl = totalControl.get(1)\n \n 'The control Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the c urrent project.\",\"Script Eror\")\n return(nil)\n end\n \n theMbar=av.getproject.findGUI(mDoc).GetMenuBar\n themenu=theMbar.findbylabel(mMenu)\n if (themenu=NiL) then\n themenu=menu.make\n themenu.setlabel(mMenu)\n theMbar.add(themenu,999)\n end\n \n themenu.add(thecontrol, theCindex)\nend\n \n \n'Add the Tool Menus\n\nfor each totalControl in theToolMenuList\n 'The Control list\n acontrol=totalControl.get(0)\n \n 'The physical control\n theControl = totalControl.get(1)\n \n 'The con trol Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n 'This finds the control set \n thecommand=\"av.getproject.findGUI(\"\"\"+aControl.get(0)+\"\"\").Get\"+acontrol.get(1)\n thescript1=Script.Make(thecommand)\n thecontrolset=av.getproject.findGUI(aControl.get(0)).GetToolBa r\n \n 'Add the control to the control set\n theControlSet.Add(theControl,theCindex)\nend\n\n\nav.getproject.setmodified(true)\n\n\n'And the scripts add themselves\n" ) (Script.16 Name: "ViewTools.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" )