/3.1 (Extension.1 Name: "GenScn Map" FirstRootClassName: "Choice" Roots: 2 Roots: 3 Version: 31 About: "This extension adds an item to the View menu, allowing a user to export a view to a GenScn Map file. Version 1.0 Beta. Created by AQUA TERRA Consultants, Decatur, GA." InstallScript: 4 UninstallScript: 5 ExtVersion: 1 ) (Choice.2 Help: "Export this View to a GenScn Map file" Label: "Export to GenScn Map" Click: "ExportToGenScnMap" Shortcut: "Keys.None" ) (Script.3 Name: "ExportToGenScnMap" SourceCode: "theView = av.getactivedoc ' active doc must be theme\nfilestring = \"genscn.map\"\nfilenamex = filestring.asfilename\nnewfile = filedialog.put(filenamex,\"*.map\",\"GenScn Map File Save\")\nrecordlist = {}\n\nif (newfile <> NIL) then\n\n lf = LineFile.Make(newfile, #FILE_PERM_WRITE ) ' opens the file\n\n for each t in theView.Getthemes ' loop through each theme in the view\n themename = t.getsrcname\n fullfilename = themename.getfilename\n themestring = fullfilename.asstring\n lastfour = themestring.right(4)\n lastfour = lastfour.ucase\n lastseven = themestring.right(7)\n lastseven = lastseven.ucase\n lasteight = themestring.right(8)\n lasteight = lasteight.ucase\n rivthree = lasteight.left(3)\n \n if (lastfour = \".SHP\") then ' this is a shapefile\n \n theLegend = t.GetLegend ' figure out color\n theSymbol = theLegend.GetSymbols.Get(0)\n colorobj = thesymbol.getcolor\n colorlist = colorobj.getrgblist\n redcolor = colorlist.get(0)\n greencolor = colorlist.get(1)\n bl uecolor = colorlist.get(2)\n rgbnumber = number.SetDefFormat( \"ddddddddd\" ) \n rgbnumber = (bluecolor * 256 * 256) + (greencolor*256) + redcolor\n \n writestring = \"LYR '\" + themestring + \"', \" + rgbnumber.asstring\n \n if (thesymbol.gettype = #SYMBOL_FILL ) then ' this is a polygon\n \n fillstyle = thesymbol.getstyle ' see if this is transparent\n if (fillstyle = #RASTERFILL_STYLE_EMPTY ) then\n writestring = writestring + \",Style Transparent \"\n elseif (colorobj.asstring = \"Transparent\") then\n writestring = writestring + \",Style Transparent \" \n end\n\n colorobj = thesymbol.getolcolor ' figure out outline color\n colorlist = colorobj.getrgblist\n redcolor = colorlist.get(0)\n greencolor = colorlist.get(1)\n bluecolor = colorlist.get(2)\n rgbnumber = number.SetDefFormat( \"ddddddddd\" ) \n rgbnumber = (bluecolor * 256 * 256) + (greencolor*256) + redcolor\n \n writestring = writ estring + \",Outline \" + rgbnumber.asstring\n end \n \n if (t.isvisible = FALSE) then ' hide the layers not turned on\n writestring = writestring + \",Hide\"\n end \n\n if (lastseven = \"RF1.SHP\") then ' default key fields for rf1\n writestring = writestring + \",KEY 'Ccsm',BRN 'Pname',DWN 'Dscsm',LEN 'Length'\"\n end \n\n if (rivthree = \"RIV\") then ' default key fields for riv shape from watershed delineator\n writestring = writestring + \",KEY 'Subbasin',DWN 'Sub basinr',LEN 'Len2'\"\n end \n\n themename = t.getname ' add theme name as caption\n writestring = writestring + \",Name '\" + themename + \"'\"\n\n recordlist.add(writestring) ' store in recordlist for writing below\n \n end \n end\n\n if (recordlist.count > 0) then\n 'are there any shape files to add to map file?\n \n 'determine extent of the view\n d = theview.GetDisplay\n extentrect = d.returnvisextent\n topnum = number.SetDefFormat( \"dddddddd.dddddddd\" ) \n topnum = ext entrect.gettop\n botnum = extentrect.getbottom\n leftnum = extentrect.getleft\n rightnum = extentrect.getright\n tempstring = \"EXT \" + leftnum.asstring +\" \"+ topnum.asstring +\" \"+ rightnum.asstring +\" \"+ botnum.asstring\n lf.writeelt(tempstring)\n \n 'now write records to file \n for each i in 1 .. recordlist.count\n tempstring = recordlist.get(recordlist.count - i)\n lf.writeelt(tempstring)\n end\n end\n \n lf.Close\n \nend \n" ) (Script.4 Name: "Install" SourceCode: "'Make sure there is a project\nif (av.GetProject = nil) then\n return nil\nend\n\n'The self object for this script is the extension\n'The first root is the menu\n'\n'Add the menu in the view's VIEW menu \nmb = av.GetProject.FindGUI(\"View\").GetMenuBar\nm = mb.FindByLabel(\"View\")\nif (m <> nil) then\n 'place = m.GetControls.count\n m.Add(self.Get(0), 23)\nend\n\n" ) (Script.5 Name: "Uninstall" SourceCode: "'Make sure there is a project\nif (av.GetProject = nil) then\n return nil\nend\n\n'Uninstall only if the project is not closing\nif (av.GetProject.IsClosing) then\n return nil\nend\n\n'The self object for this script is the extension\n'The first root is the menu\n'\n'Remove the menu \nmb = av.GetProject.FindGUI(\"View\").GetMenuBar\nm = mb.FindByLabel(\"View\")\nm.Remove(self.Get(0))\n\n\n\n" )