/3.1 (Extension.1 Name: "Generate to Shape v5.0" FirstRootClassName: "List" Roots: 2 Roots: 3 Roots: 4 Roots: 19 Roots: 20 Roots: 21 Roots: 22 Roots: 23 Roots: 24 Roots: 25 Roots: 26 Roots: 27 Roots: 28 Roots: 29 Roots: 30 Roots: 31 Roots: 32 Roots: 33 Roots: 34 Roots: 35 Roots: 36 Roots: 37 Version: 31 About: "Import generate format ASCII files and convert to shapefiles either interactively or in batch. Version 5.0, 2000-07-10, by Ron S.W. Wardenier ( warden@cistron.nl - More info at: http://warden.www.cistron.nl/geo/ )" InstallScript: 38 UninstallScript: 39 ExtVersion: 50 ) (List.2 ) (List.3 ) (List.4 Child: 5 Child: 12 ) (List.5 Child: 6 Child: 10 Child: 11 ) (List.6 Child: 7 Child: 8 Child: 9 ) (AVStr.7 S: "View" ) (AVStr.8 S: "File" ) (AVStr.9 S: "View.Gen2shpManager" ) (Choice.10 Help: "Import generate format ASCII files and convert to shapefiles (Shift-click for Help)" Label: "Import Generate Files..." Click: "View.Gen2shpManager" Shortcut: "Keys.None" ) (Numb.11 N: 13.00000000000000 ) (List.12 Child: 13 Child: 17 Child: 18 ) (List.13 Child: 14 Child: 15 Child: 16 ) (AVStr.14 S: "View" ) (AVStr.15 S: "View" ) (AVStr.16 S: "View.Gen2shpConverter" ) (Choice.17 Help: "Adds a new Theme to the view from a generate format ASCII file (Shift-click for Help)" Label: "Add Generate Theme..." Click: "View.Gen2shpConverter" Shortcut: "Keys.None" ) (Numb.18 N: 4.00000000000000 ) (List.19 ) (Script.20 Name: "View.Gen2shpBatchProcessor" SourceCode: "' Name: View.Gen2shpBatchProcessor\n' File: g2sbpcsr.ave (or part of the extension g2sv50.avx)\n' \n' Title: Batch processing of multiple generate format files\n'\n' Topics: GeoData\n'\n' Description: Reads a user specified Gen2shp batch file and\n' calls View.Gen2shpConverter to convert each generate format\n' file.\n'\n' Requires:\n'\n' Runs: View.Gen2shpConverter, View.Gen2shpReporter\n'\n' Run by: View.Gen2shpManager\n'\n' Self:\n'\n' Returns:\n'\n' Author : Ron Wardenier ( warden@cistron.nl )\n' Version : see va riable VersionStr below\n VersionStr = \"5.0\"\n' Date : 2000-05-04\n' More info : http://warden.www.cistron.nl/geo/\n' \n\n' Batch file description:\n' \n' BATCH \n' \n' 0|1|2|3 overwrite mode (overwrite existing files)\n' 0 create sequential files (default)\n' 1 do not overwrite existing files\n' 2 prompt user in case of existing files\n' 3 overwrite existing files\n' \n' 0|1|2 verbose mode (shows errors and opts user to overwrite)\n' 0 run silent (default)\n' 1 show progress\n' 2 run stepwise\n' \n' 0|1|2 log mode (creates a log file)\n' 0 do not create a log file (default)\n' 1 create an ASCII text log file\n' 2 create a HTML page log file\n'\n\n\nif (self.Count <> 2) then\n ErrorMessage = \"Invalid number of parameters in call to script View.Gen2shpBatchProcessor.\"\n MsgBox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp BatchProcessor Message\")\n exit\nend\n\ntheBatchFile = self.Get(0)\ninpTokens = self.Get(1)\n\ntheNrOfParameters = inpTokens.Count - 1\nError = false\n\nif (theNrOfParameters >= 1) then\n if (inpTokens.Get(1).IsNumber.Not) then\n Error = true\n else\n OverwriteMode = inpTokens.Get(1).AsNumber\n if ((OverwriteMode < 0) or (OverwriteMode > 3)) then\n Error = true\n end\n end\nelse\n OverwriteMode = 0\nend\n\nif (theNrOfParameters >= 2) then\n if (inpTokens.Get(2).IsNumber.Not) then\n Error = true\n else\n VerboseMode = inpTokens.Get(2).AsNumber\n if ((VerboseMode < 0) or (VerboseMode > 2)) then\n Error = true\n end\n end\nelse\n Verbo seMode = 0\nend\n \nif (theNrOfParameters = 3) then\n LogMode = inpTokens.Get(3).AsNumber \n if (inpTokens.Get(3).IsNumber.Not) then\n Error = true\n else\n LogMode = inpTokens.Get(3).AsNumber \n if ((LogMode < 0) or (LogMode > 2)) then\n Error = true\n end\n end\nelse\n LogMode = 0\nend\n\nif (Error) then\n ErrorMessage = \"One or more invalid Batch parameters in batch file.\"\n MsgBox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp BatchProcessor Message\")\n exit\nend\n\nif (VerboseMode > 0) then \n _EchoSed = Nil\n av.Run(\"View.Gen2shpReporter\", \"New&Echo|\" + \"Processing files...\")\nend\n\ntheBatchFileFN = TheBatchFile.GetFileName\n\nif (LogMode > 0) then\n' create the log file\n theFileName = theBatchFileFN.GetBaseName.AsTokens(\".\").Get(0)\n theSaveDirStr = theBatchFileFN.ReturnDir.AsString\n theLogFN = FileName.Merge(theSaveDirStr, theFileName)\n theLogFN.SetExtension(\"log\")\n if (theLogFN.IsFile) then\n ' log file already exists so create a sequential file\n theLogFN = FN.Make(theSaveDirStr).MakeTmp (theFileName, \"log\")\n end \n theLogFile = LineFile.Make(theLogFN, #FILE_PERM_WRITE)\n ' check for a successful creation\n if(theLogFile = nil) then\n ErrorMessage = \"Unable to create log file\"\n Msgbox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp BatchProcessor Message\")\n exit\n end \n\n ThisRunDate = Date.Now.SetFormat(\"yyyy-MM-dd\").AsString\n ThisRunHoursTime = Date.Now.SetFormat(\"hhhh\").AsString\n ThisRunMinutesTime = Date.Now.GetMinutes\n if (ThisRunMinutesTime < 10) then\n ThisRunMi nutesTime = \"0\"+ThisRunMinutesTime.AsString\n else\n ThisRunMinutesTime = ThisRunMinutesTime.AsString \n end \n ThisRunISOTimeZone = Date.Now.SetFormat(\"ITZ\").AsString\n ThisRunTimestamp = ThisRunDate+\"T\"+ThisRunHoursTime+\":\"+ThisRunMinutesTime+ThisRunISOTimeZone.Left(3)+\":\"+ThisRunISOTimeZone.Right(2)\n ' write the header record\n if (LogMode = 2) then\n theLogFile.WriteElt(\"\")\n theLogFile.WriteElt(\"\")\n theLogFile.WriteElt(\"< HEAD>\")\n theLogFile.WriteElt(\"Gen2shp Log File - \"+theLogFN.AsString+\"\")\n theLogFile.WriteElt(\"\")\n' theLogFile.WriteElt(\"\")\n theLogFile.WriteElt(\"\")\n theLogFile.WriteElt(\"\")\n HTMLTagsStr = \"
\"\n else \n HTMLTagsStr = \"\"\n end \n theLogFile.WriteElt(\"Gen2shp Log file:'\"+theL ogFN.AsString+\"' (this file)\"+HTMLTagsStr)\n theLogFile.WriteElt(\"Description: Generate to shape (version \"+VersionStr+\") log file\"+HTMLTagsStr)\n theLogFile.WriteElt(\"Batch file: '\"+theBatchFileFN.AsString+\"'\"+HTMLTagsStr)\n theLogFile.WriteElt(\"Date of batch run: \"+ThisRunTimestamp+HTMLTagsStr)\n theLogFile.WriteElt(\"Overwrite mode: \"+OverwriteMode.AsString+HTMLTagsStr)\n theLogFile.WriteElt(\"Verbose mode: \"+VerboseMode.AsString+HTMLTagsStr)\n theLogFile.WriteElt(\"Log mode: \"+LogMode.AsString+HTMLTagsStr) \n theLogFile.WriteElt(\"-------------------------------------------------------------------------------\"+HTMLTagsStr)\nend\n\n\ntheBatchFileFN = theBatchFile.AsString.AsFilename\nbuffer = theBatchFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\nnumNrOfImportFiles = 0\nnumNrOfOK = 0\nGoOn = true\n\nwhile (GoOn = true)\n if ((\"#'\".Contains(buffer.Left(1)).Not) and (buffer <> Nil)) then\n theImportFileFN = buffer.AsFileName\n LogMessage = \"\"\n numNrOfImportFiles = numNrOfImportFiles + 1\n if ((VerboseMode = 2) and ( numNrOfImportFiles > 1)) then\n GoOn = MsgBox.AllYesNo(\"Continue with batch run and process next file:\"+NL+\n \"'\"+theImportFileFN.AsString+\"' ?\"+NL+NL+\n \"Note: 'No' terminates batch run\", \"Gen2shp BatchProcessor Message\", true)\n if(GoOn = false) then\n LogMessage = \"File skipped by user\"\n else \n if(GoOn = nil) then\n VerboseMode = 1\n GoOn = true\n end \n end \n end\n\n if (GoON = true) then\n theFileName = theImportFileFN.GetBaseName.AsTokens(\".\").Get(0)\n theSaveDirStr = theBatchFileFN.ReturnDir.AsString\n theShapeFN = FileName.Merge(theSaveDirStr, theFileName)\n theShapeFN.SetExtension(\"shp\")\n \n if (OverwriteMode = 0) then\n if (theShapeFN.IsFile) then\n ' a shapefile with the same name already exists so create a sequential file\n tempName = theImportFileFN.GetBaseName.AsTokens(\".\").Get(0)\n tempDir = theImportFileFN.ReturnDir.AsString\n t heShapeFN = FN.Make(tempDir).MakeTmp(tempName, \"shp\")\n end \n else\n if (OverwriteMode = 1) then\n ' do not overwrite\n if (theShapeFN.IsFile) then\n LogMessage = \"Shapefile already exists\"\n end\n else \n if (OverwriteMode = 2) then\n ' prompt user\n if (theShapeFN.IsFile) then\n ans = MsgBox.ChoiceAsString ({ \"Save As\", \"Skip\", \"Overwrite\" },\n \"The shapefile '\"+TheShapeF N.AsString+\" already exists.\"+NL+\n \"Select action:\",\n \"Gen2shp BatchProcessor Message\")\n if ((ans = \"Skip\") or (ans = Nil)) then\n LogMessage = \"File skipped by user\"\n else\n if (ans = \"Save As\") then\n tempName = theImportFileFN.GetBaseName.AsTokens(\".\").Get(0)\n tempDir = theImportFileFN.ReturnDir.AsString\n defName = FN.M ake(tempDir).MakeTmp(tempName, \"shp\")\n theShapeFN = FileDialog.Put(defName, \"*.shp\", \"Save as\")\n if (theShapeFN = nil) then\n ' Save as canceled by user\n LogMessage = \"Save As canceled by user (file skipped)\"\n end\n end\n end\n end\n end\n end\n end\n end\n \n if (LogMessage = \"\") then\n result = av.run( \"View.Gen2shpConverter\", { theImportFileFN, theShapeFN } )\n \n theNewShapeFN = result.Get(0)\n if (theNewShapeFN = Nil) then\n LogMessage = result.Get(1).AsString\n if (LogMessage = \"Stopped\") then\n ' Clean up the mess (that is delete the partly completed shapefile)\n ' I'm not very proud of this piece of code but I could not figure out\n ' how to use the Manage.Datasources from Avenue in order to delete the\n ' shapefile properly.\n av.PurgeObjects\n if (File.CanDelete(theShapeFN)) then\n theFileName = theShapeFN.GetBaseName.AsTokens(\".\").Get(0)\n theSaveDirStr = theBatchFileFN.ReturnDir.AsString\n theShpFN = FileName.Merge(theSaveDirStr, theFileName)\n theShpFN.SetExtension(\"shp\")\n File.Delete(theShpFN)\n theShxFN = FileName.Merge(theSaveDirStr, theFileName)\n theShxFN.SetExtension(\"shx\")\n File.Delete(theShxFN)\n theDbfFN = FileName.Merge(theSaveDirStr, theFileName)\n theDbfFN.SetExtension(\"db f\")\n File.Delete(theDbfFN)\n end \n boolQuit = MsgBox.YesNo(\"Terminate batch run ?\", \"Gen2shp BatchProcessor Message\", false)\n if (boolQuit = true) then\n GoOn = false\n end\n end\n else\n LogMessage = result.Get(1).AsString+\"; '\"+theNewShapeFN.AsString+\"'; OK\"\n numNrOfOK = numNrOfOK + 1\n end\n end\n\n if (VerboseMode > 0) then\n av.Run(\"View.Gen2shpReporter\", \"Echo|\" + \"'\"+theImportFileFN.AsString+\"': \"+LogMessage)\n end\n\n if (LogMode > 0) then\n theLogFile.WriteElt(\"'\"+theImportFileFN.AsString+\"': \"+LogMessage+HTMLTagsStr)\n end\n\n end \n \n if (theBatchFile.IsAtEnd.Not) then\n buffer = theBatchFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n else\n break\n end \n\nend\n\nif (VerboseMode > 0) then\n if (GoOn = false) then\n av.Run(\"View.Gen2shpReporter\", \"Echo|\" + \"Batch run interupted by user\")\n end\n av.Run(\"View.Gen2shpReporter\", \"Echo|\" + \"Number of files processed: \"+numNrOfImportFiles.AsString)\n av.R un(\"View.Gen2shpReporter\", \"Echo|\" + \"Number of shapefiles created: \"+numNrOfOK.AsString)\n av.Run(\"View.Gen2shpReporter\", \"Echo|\" + NL)\n _EchoSEDwin.Activate\n MsgBox.Info(\"Finished processing batch file '\"+theBatchFileFN.AsString+\"'.\", \"Gen2shp BatchProcessor Message\")\n av.Run(\"View.Gen2shpReporter\", \"New&Echo|\" + NL)\nend\n\nif (LogMode > 0) then\n if (GoOn = false) then\n theLogFile.WriteElt(\"Batch run interupted by user\"+HTMLTagsStr)\n end\n theLogFile.WriteElt(\"--------------------------------------- ----------------------------------------\"+HTMLTagsStr)\n theLogFile.WriteElt(\"Number of files processed: \"+numNrOfImportFiles.AsString+HTMLTagsStr)\n theLogFile.WriteElt(\"Number of shapefiles created: \"+numNrOfOK.AsString+HTMLTagsStr)\n theLogFile.WriteElt(\"-------------------------------------------------------------------------------\"+HTMLTagsStr)\n theLogFile.WriteElt(\"End of Log file\"+HTMLTagsStr)\n if (LogMode = 2) then\n theLogFile.WriteElt(\"\")\n theLogFile.WriteElt(\"\")\n end \n the LogFile.Close\nend\n\n' End of script View.Gen2shpBatchProcessor\n" ) (Script.21 Name: "View.Gen2shpMkBox" SourceCode: "' Name: View.Gen2shpMkBox\n' File: g2smbox.ave (or part of the extension g2sv50.avx)\n' \n' Title: Import generate format files\n'\n' Topics: GeoData\n'\n' Description: Reads a single user specified generate format file\n' and converts the data to the appropriate feature type\n' (either Point, Line or Polygon) to be saved to a user specified\n' shapefile, creates the theme and adds it to the active View.\n' \n' Requires:\n'\n' Runs:\n'\n' Run by: View.Gen2shpConverter\n'\n' Self: \n'\n' Returns: \n'\n' Author : Ron Wa rdenier ( warden@cistron.nl )\n' Version : see variable VersionStr below\n VersionStr = \"5.0\"\n' Date : 2000-05-18\n' More info : http://warden.www.cistron.nl/geo/\n' \n\n' do some basic checks\nif (self.Count <> 2) then\n ErrorMessage = \"Invalid number of parameters in call to script View.Gen2shpMkBox.\"\n MsgBox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp MkBox Message\")\n exit\nelse\n theImportFileFN = self.Get(0)\n theShapeFN = self.Get(1)\n ' Check for a Nil parameter value (avery r are situation that is)\n if ((theImportFileFN = nil) or (theShapeFN = nil)) then\n ErrorMessage = \"Nil parameter in call to script View.Gen2shpMkBox.\"\n return { Nil, ErrorMessage }\n else\n theImportFile = LineFile.Make(theImportFileFN, #FILE_PERM_READ)\n end \nend\n\nNumRecs = theImportFile.GetSize\nRecCnt = 1\n\n' Create the FTab for the new shape file...\ntheFTab = FTab.MakeNew(theShapeFN, Polygon)\n\ntheIDField = Field.Make(\"ID\", #FIELD_DECIMAL, 11, 0)\ntheWidthField = Field.Make(\"Width\", #FIELD_DECIMAL , 13, 3)\ntheHeightField = Field.Make(\"Height\", #FIELD_DECIMAL, 13, 3)\ntheAreaField = Field.Make(\"Area\", #FIELD_DECIMAL, 13, 3)\ntheFTab.AddFields({theWidthField, theHeightField, theAreaField, theIDField})\n\ntheShapeField = theFTab.FindField(\"Shape\")\ntheIDField = theFTab.FindField(\"ID\")\ntheWidthField = theFTab.FindField(\"Width\")\ntheHeightField = theFTab.FindField(\"Height\")\ntheAreaField = theFTab.FindField(\"Area\")\n\n' Skip first record (which reads \"BOX\")\nbuffer = theImportFile.ReadElt\n\nbuffer = theImportFile.Re adElt.Substitute(9.AsChar,\" \").Trim\n\nwhile(buffer <> \"END\")\n\n inpTokens = buffer.AsTokens(\" ,\")\n ID = inpTokens.Get(0)\n\n theBLPoint = inpTokens.Get(1).AsNumber@inpTokens.Get(2).AsNumber\n theWidth = inpTokens.Get(3).AsNumber\n ' if there is no value for the height create a square\n if (inpTokens.Count = 4) then\n theHeight = theWidth\n else\n theHeight = inpTokens.Get(4).AsNumber\n end\n theTRPoint = theWidth@theHeight\n theRectangle = Rect.Make(theBLPoint, theTRPoint)\n theRecord = theFTab.AddRecord \n theFTab.SetValue(theShapeField, theRecord, theRectangle.AsPolygon)\n theFTab.SetValue(theIDField, theRecord, ID)\n theFTab.SetValue(theWidthField, theRecord, theRectangle.GetWidth)\n theFTab.SetValue(theHeightField, theRecord, theRectangle.GetHeight)\n theFTab.SetValue(theAreaField, theRecord, theRectangle.ReturnArea)\n\n RecCnt = RecCnt + 1\n proceed = av.SetStatus((RecCnt / NumRecs) * 100)\n if ( proceed.Not ) then\n av.ClearStatus\n av.ShowMsg(\"Stopped\")\n return { Nil, \"Stopped\" }\n end\n\n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\nend\n\ntheFTab.Flush\ntheFTab.DeActivate\ntheFTab.UnlinkAll \ntheFTab = nil\n\nreturn { theShapeFN }\n\n" ) (Script.22 Name: "View.Gen2shpMkBoxZ" SourceCode: "' Name: View.Gen2shpMkBoxZ\n' File: g2smboxz.ave (or part of the extension g2sv50.avx)\n' \n' Title: Import generate format files\n'\n' Topics: GeoData\n'\n' Description: Reads a single user specified generate format file\n' and converts the data to the appropriate feature type\n' (either Point, Line or Polygon) to be saved to a user specified\n' shapefile, creates the theme and adds it to the active View.\n' \n' Requires:\n'\n' Runs:\n'\n' Run by: View.Gen2shpConverter\n'\n' Self: \n'\n' Returns: \n'\n' Author : Ron Wardenier ( warden@cistron.nl )\n' Version : see variable VersionStr below\n VersionStr = \"5.0\"\n' Date : 2000-05-24\n' More info : http://warden.www.cistron.nl/geo/\n' \n\n' do some basic checks\nif (self.Count <> 2) then\n ErrorMessage = \"Invalid number of parameters in call to script View.Gen2shpMkBoxZ.\"\n MsgBox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp MkBoxZ Message\")\n exit\nelse\n theImportFileFN = self.Get(0)\n theShapeFN = self.Get(1)\n ' Check for a Nil parameter value(a ve ry rare situation that is)\n if ((theImportFileFN = nil) or (theShapeFN = nil)) then\n ErrorMessage = \"Nil parameter in call to script View.Gen2shpMkBoxZ.\"\n return { Nil, ErrorMessage }\n else\n theImportFile = LineFile.Make(theImportFileFN, #FILE_PERM_READ)\n end \nend\n\nNumRecs = theImportFile.GetSize\nRecCnt = 1\n\n' Skip first record (which reads \"XYZ\")\nbuffer = theImportFile.ReadElt\n' Skip second record (which reads \"BoxZ\")\nbuffer = theImportFile.ReadElt\n\n' Create the FTab for the new shape file.. .\ntheFTab = FTab.MakeNew(theShapeFN, MultiPatch)\n\ntheIDField = Field.Make(\"ID\", #FIELD_DECIMAL, 11, 0)\ntheWidthField = Field.Make(\"Width\", #FIELD_DECIMAL, 13, 3)\ntheHeightField = Field.Make(\"Height\", #FIELD_DECIMAL, 13, 3)\ntheDepthField = Field.Make(\"Depth\", #FIELD_DECIMAL, 13, 3)\ntheVolumeField = Field.Make(\"Volume\", #FIELD_DECIMAL, 13, 3)\ntheFTab.AddFields({theWidthField, theHeightField, theDepthField, theVolumeField, theIDField})\n\ntheShapeField = theFTab.FindField(\"Shape\")\ntheIDField = theFTab.FindField( \"ID\")\ntheWidthField = theFTab.FindField(\"Width\")\ntheHeightField = theFTab.FindField(\"Height\")\ntheDepthField = theFTab.FindField(\"Depth\")\ntheVolumeField = theFTab.FindField(\"Volume\")\n\nbuffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\nwhile(buffer <> \"END\")\n\n inpTokens = buffer.AsTokens(\" ,\")\n ID = inpTokens.Get(0)\n\n theMultiPatch = MultiPatch.MakeNull\n \n x0 = inpTokens.Get(1).AsNumber\n y0 = inpTokens.Get(2).AsNumber\n z0 = inpTokens.Get(3).AsNumber\n w = inpTokens.Get(4).AsNumber\n h = inpT okens.Get(5).AsNumber\n d = inpTokens.Get(6).AsNumber\n\n p0 = x0@y0@z0\n p1 = (x0+w)@y0@z0\n p2 = (x0+w)@(y0+h)@z0\n p3 = x0@(y0+h)@z0\n p4 = x0@y0@(z0+d)\n p5 = (x0+w)@y0@(z0+d)\n p6 = (x0+w)@(y0+h)@(z0+d)\n p7 = x0@(y0+h)@(z0+d)\n\n theMultiPatch.AddPart({p0,p1,p2,p3}, #PART_TYPE_OUTERRING)\n theMultiPatch.AddPart({p0,p4,p1,p5,p2,p6,p3,p7,p0,p4}, #PART_TYPE_TRIANGLESTRIP)\n theMultiPatch.AddPart({p4,p5,p6,p7}, #PART_TYPE_OUTERRING)\n \n theRecord = theFTab.AddRecord\n theFTab.SetValue(theShapeField, theRec ord, theMultiPatch)\n theFTab.SetValue(theIDField, theRecord, ID)\n theFTab.SetValue(theWidthField, theRecord, w)\n theFTab.SetValue(theHeightField, theRecord, h)\n theFTab.SetValue(theDepthField, theRecord, d)\n theFTab.SetValue(theVolumeField, theRecord, (w*h*d))\n\n RecCnt = RecCnt + 1\n proceed = av.SetStatus((RecCnt / NumRecs) * 100)\n if ( proceed.Not ) then\n av.ClearStatus\n av.ShowMsg(\"Stopped\")\n return { Nil, \"Stopped\" }\n end\n\n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\n end\n\ntheFTab.Flush\ntheFTab.DeActivate\ntheFTab.UnlinkAll \ntheFTab = nil\n\nreturn { theShapeFN }\n" ) (Script.23 Name: "View.Gen2shpMkCircle" SourceCode: "' Name: View.Gen2shpMkCircle\n' File: g2smcir.ave (or part of the extension g2sv50.avx)\n' \n' Title: Import generate format files\n'\n' Topics: GeoData\n'\n' Description: Reads a single user specified generate format file\n' and converts the data to the appropriate feature type\n' (either Point, Line or Polygon) to be saved to a user specified\n' shapefile, creates the theme and adds it to the active View.\n' \n' Requires:\n'\n' Runs:\n'\n' Run by: View.Gen2shpConverter\n'\n' Self: \n'\n' Returns: \n'\n' Author : Ron Wardenier ( warden@cistron.nl )\n' Version : see variable VersionStr below\n VersionStr = \"5.0\"\n' Date : 2000-05-05\n' More info : http://warden.www.cistron.nl/geo/\n' \n\n' do some basic checks\nif (self.Count <> 2) then\n ErrorMessage = \"Invalid number of parameters in call to script View.Gen2shpMkCircle.\"\n MsgBox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp MkCircle Message\")\n exit\nelse\n theImportFileFN = self.Get(0)\n theShapeFN = self.Get(1)\n ' Check for a Nil parametervalue (a very rare situation that is)\n if ((theImportFileFN = nil) or (theShapeFN = nil)) then\n ErrorMessage = \"Nil parameter in call to script View.Gen2shpMkCircle.\"\n return { Nil, ErrorMessage }\n else\n theImportFile = LineFile.Make(theImportFileFN, #FILE_PERM_READ)\n end \nend\n\nNumRecs = theImportFile.GetSize\nRecCnt = 1\n\n' Create the FTab for the new shape file...\ntheFTab = FTab.MakeNew(theShapeFN, Polygon)\n\ntheIDField = Field.Make(\"ID\", #FIELD_DECIMAL, 11, 0)\ntheRadiusField = Field.Make(\"Radius\", #FIELD_DECIMAL, 13, 3)\ntheAreaField = Field.Make(\"Area\", #FIELD_DECIMAL, 13, 3)\ntheFTab.AddFields({theRadiusField, theAreaField, theIDField})\n\ntheShapeField = theFTab.FindField(\"Shape\")\ntheIDField = theFTab.FindField(\"ID\")\ntheRadiusField = theFTab.FindField(\"Radius\")\ntheAreaField = theFTab.FindField(\"Area\")\n\nbuffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\nwhile(buffer <> \"END\")\n\n inpTokens = buffer.AsTokens(\" ,\")\n ID = inpTokens.Get(0)\n\n theCenter = inpTokens.Get(1).AsNumber@inpTokens.Get(2 ).AsNumber\n theRadius = inpTokens.Get(3).AsNumber\n theCircle = Circle.Make(theCenter, theRadius)\n theRecord = theFTab.AddRecord\n theFTab.SetValue(theShapeField, theRecord, theCircle.AsPolygon)\n theFTab.SetValue(theIDField, theRecord, ID)\n theFTab.SetValue(theRadiusField, theRecord, theCircle.GetRadius)\n theFTab.SetValue(theAreaField, theRecord, theCircle.ReturnArea)\n\n RecCnt = RecCnt + 1\n proceed = av.SetStatus((RecCnt / NumRecs) * 100)\n if (proceed.Not) then\n av.ClearStatus\n av.ShowMsg(\"Sto pped\")\n return { Nil, \"Stopped\" }\n end\n\n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\nend\n\ntheFTab.Flush\ntheFTab.DeActivate\ntheFTab.UnlinkAll \ntheFTab = nil\n\nreturn { theShapeFN }\n" ) (Script.24 Name: "View.Gen2shpMkCircleZ" SourceCode: "' Name: View.Gen2shpMkCircleZ\n' File: g2smcirz.ave (or part of the extension g2sv50.avx)\n' \n' Title: Import generate format files\n'\n' Topics: GeoData\n'\n' Description: Reads a single user specified generate format file\n' and converts the data to the appropriate feature type\n' (either Point, Line or Polygon) to be saved to a user specified\n' shapefile, creates the theme and adds it to the active View.\n' \n' Requires:\n'\n' Runs:\n'\n' Run by: View.Gen2shpConverter\n'\n' Self: \n'\n' Returns: \n'\n' Author : R on Wardenier ( warden@cistron.nl )\n' Version : see variable VersionStr below\n VersionStr = \"5.0\"\n' Date : 2000-05-25\n' More info : http://warden.www.cistron.nl/geo/\n' \n\n' do some basic checks\nif (self.Count <> 2) then\n ErrorMessage = \"Invalid number of parameters in call to script View.Gen2shpMkCircleZ.\"\n MsgBox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp MkCircleZ Message\")\n exit\nelse\n theImportFileFN = self.Get(0)\n theShapeFN = self.Get(1)\n ' Check for a Nil parameter v alue (a very rare situation that is)\n if ((theImportFileFN = nil) or (theShapeFN = nil)) then\n ErrorMessage = \"Nil parameter in call to script View.Gen2shpMkCircleZ.\"\n return { Nil, ErrorMessage }\n else\n theImportFile = LineFile.Make(theImportFileFN, #FILE_PERM_READ)\n end \nend\n\nNumRecs = theImportFile.GetSize\nRecCnt = 1\n\n' Skip first line with the XYZ tag\nbuffer = theImportFile.ReadElt\n\n' Create the FTab for the new shape file...\ntheFTab = FTab.MakeNew(theShapeFN, MultiPatch)\n\ntheIDField = Fi eld.Make(\"ID\", #FIELD_DECIMAL, 11, 0)\ntheRadiusField = Field.Make(\"Radius\", #FIELD_DECIMAL, 13, 3)\ntheDepthField = Field.Make(\"Depth\", #FIELD_DECIMAL, 13, 3)\ntheVolumeField = Field.Make(\"Volume\", #FIELD_DECIMAL, 13, 3)\ntheFTab.AddFields({theRadiusField, theDepthField, theVolumeField, theIDField})\n\ntheShapeField = theFTab.FindField(\"Shape\")\ntheIDField = theFTab.FindField(\"ID\")\ntheRadiusField = theFTab.FindField(\"Radius\")\ntheDepthField = theFTab.FindField(\"Depth\")\ntheVolumeField = theFTab.FindField(\"Volume\")\n \nbuffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\nwhile(buffer <> \"END\")\n\n inpTokens = buffer.AsTokens(\" ,\")\n ID = inpTokens.Get(0)\n\n x0 = inpTokens.Get(1).AsNumber\n y0 = inpTokens.Get(2).AsNumber\n z0 = inpTokens.Get(3).AsNumber\n theCenter = x0@y0@z0\n\n theRadius = inpTokens.Get(4).AsNumber\n theDepth = inpTokens.Get(5).AsNumber\n\n theCircle = Circle.Make(theCenter, theRadius)\n thePolygon = theCircle.AsPolygon\n\n theBottomPolygonZList = {}\n theTopPolygonZList = {}\n theTrianglesList = { }\n theMultiPatch = MultiPatch.MakeNull\n\n theZ0 = z0\n theZ1 = z0+theDepth\n thePoints = thePolygon.AsList\n\n for each i in 0 .. (thePoints.Get(0).Count-1)\n theX = thePoints.Get(0).Get(i).GetX\n theY = thePoints.Get(0).Get(i).GetY\n theBottomPolygonZList.Add(PointZ.Make(theX,theY,theZ0))\n theTopPolygonZList.Add(PointZ.Make(theX,theY,theZ1))\n end\n for each i in 0 .. (theBottomPolygonZList.Count-1)\n theTrianglesList.Add(theBottomPolygonZList.Get(i))\n theTrianglesList.Add(theTopPolygonZL ist.Get(i))\n end\n \n theMultiPatch.AddPart(theBottomPolygonZList, #PART_TYPE_OUTERRING)\n theMultiPatch.AddPart(theTrianglesList, #PART_TYPE_TRIANGLESTRIP)\n theMultiPatch.AddPart(theTopPolygonZList, #PART_TYPE_OUTERRING)\n\n theRecord = theFTab.AddRecord\n theFTab.SetValue(theShapeField, theRecord, theMultiPatch)\n theFTab.SetValue(theIDField, theRecord, ID)\n theFTab.SetValue(theRadiusField, theRecord, theRadius)\n theFTab.SetValue(theDepthField, theRecord, theDepth)\n theFTab.SetValue(theVolumeField, th eRecord, (theCircle.ReturnArea)*theDepth)\n\n RecCnt = RecCnt + 1\n proceed = av.SetStatus((RecCnt / NumRecs) * 50)\n if (proceed.Not) then\n av.ClearStatus\n av.ShowMsg(\"Stopped\")\n return { Nil, \"Stopped\" }\n end\n\n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\nend\n\ntheFTab.Flush\ntheFTab.DeActivate\ntheFTab.UnlinkAll \ntheFTab = nil\n\nreturn { theShapeFN }\n" ) (Script.25 Name: "View.Gen2shpMkDonut" SourceCode: "' Name: View.Gen2shpMkDonut\n' File: g2smdon.ave (or part of the extension g2sv50.avx)\n' \n' Title: Import generate format files\n'\n' Topics: GeoData\n'\n' Description: Reads a single user specified generate format file\n' and converts the data to the appropriate feature type\n' (either Point, Line or Polygon) to be saved to a user specified\n' shapefile, creates the theme and adds it to the active View.\n' \n' Requires:\n'\n' Runs:\n'\n' Run by: View.Gen2shpConverter\n'\n' Self: \n'\n' Returns: \n'\n' Author : RonW ardenier ( warden@cistron.nl )\n' Version : see variable VersionStr below\n VersionStr = \"5.0\"\n' Date : 2000-05-05\n' More info : http://warden.www.cistron.nl/geo/\n' \n\n' do some basic checks\nif (self.Count <> 2) then\n ErrorMessage = \"Invalid number of parameters in call to script View.Gen2shpMkDonut.\"\n MsgBox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp MkDonut Message\")\n exit\nelse\n theImportFileFN = self.Get(0)\n theShapeFN = self.Get(1)\n ' Check for a Nil parameter value (a very rare situation that is)\n if ((theImportFileFN = nil) or (theShapeFN = nil)) then\n ErrorMessage = \"Nil parameter in call to script View.Gen2shpMkDonut.\"\n return { Nil, ErrorMessage }\n else\n theImportFile = LineFile.Make(theImportFileFN, #FILE_PERM_READ)\n end \nend\n\nNumRecs = theImportFile.GetSize\nRecCnt = 1\n\n' Create the FTab for the new shape file...\ntheFTab = FTab.MakeNew(theShapeFN, Polygon)\n\ntheIDField = Field.Make(\"ID\", #FIELD_DECIMAL, 11, 0)\ntheInnerRadiusField = Field.Make(\"InnerRad ius\", #FIELD_DECIMAL, 13, 3)\ntheOuterRadiusField = Field.Make(\"OuterRadius\", #FIELD_DECIMAL, 13, 3)\ntheAreaField = Field.Make(\"Area\", #FIELD_DECIMAL, 13, 3)\ntheFTab.AddFields({theInnerRadiusField, theOuterRadiusField, theAreaField, theIDField})\n\ntheShapeField = theFTab.FindField(\"Shape\")\ntheIDField = theFTab.FindField(\"ID\")\ntheInnerRadiusField = theFTab.FindField(\"InnerRadius\")\ntheOuterRadiusField = theFTab.FindField(\"OuterRadius\")\ntheAreaField = theFTab.FindField(\"Area\")\n\n' Skip first record (which reads \" DONUT\")\nbuffer = theImportFile.ReadElt\n\nbuffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\nwhile(buffer <> \"END\")\n\n inpTokens = buffer.AsTokens(\" ,\")\n ID = inpTokens.Get(0)\n\n theCenter = inpTokens.Get(1).AsNumber@inpTokens.Get(2).AsNumber\n theInnerRadius = inpTokens.Get(3).AsNumber\n theOuterRadius = inpTokens.Get(4).AsNumber\n theOuterCircle = Circle.Make(theCenter, theOuterRadius)\n theInnerCircle = Circle.Make(theCenter, theInnerRadius)\n theDonut = theOuterCircle.ReturnDifference(theInner Circle.AsPolygon)\n theRecord = theFTab.AddRecord\n theFTab.SetValue(theShapeField, theRecord, theDonut)\n theFTab.SetValue(theIDField, theRecord, ID)\n theFTab.SetValue(theInnerRadiusField, theRecord, theInnerRadius)\n theFTab.SetValue(theOuterRadiusField, theRecord, theOuterRadius)\n theFTab.SetValue(theAreaField, theRecord, theDonut.ReturnArea)\n\n RecCnt = RecCnt + 1\n proceed = av.SetStatus((RecCnt / NumRecs) * 100)\n if (proceed.Not) then\n av.ClearStatus\n av.ShowMsg(\"Stopped\")\n return {Nil, \"S topped\" }\n end\n\n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\nend\n\ntheFTab.Flush\ntheFTab.DeActivate\ntheFTab.UnlinkAll \ntheFTab = nil\n\nreturn { theShapeFN }\n" ) (Script.26 Name: "View.Gen2shpMkDonutZ" SourceCode: "' Name: View.Gen2shpMkDonutZ\n' File: g2smdonz.ave (or part of the extension g2sv50.avx)\n' \n' Title: Import generate format files\n'\n' Topics: GeoData\n'\n' Description: Reads a single user specified generate format file\n' and converts the data to the appropriate feature type\n' (either Point, Line or Polygon) to be saved to a user specified\n' shapefile, creates the theme and adds it to the active View.\n' \n' Requires:\n'\n' Runs:\n'\n' Run by: View.Gen2shpConverter\n'\n' Self: \n'\n' Returns: \n'\n' Author : Ro n Wardenier ( warden@cistron.nl )\n' Version : see variable VersionStr below\n VersionStr = \"5.0\"\n' Date : 2000-05-26\n' More info : http://warden.www.cistron.nl/geo/\n' \n\n' do some basic checks\nif (self.Count <> 2) then\n ErrorMessage = \"Invalid number of parameters in call to script View.Gen2shpMkDonutZ.\"\n MsgBox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp MkDonutZ Message\")\n exit\nelse\n theImportFileFN = self.Get(0)\n theShapeFN = self.Get(1)\n ' Check for a Nil parameter valu e (a very rare situation that is)\n if ((theImportFileFN = nil) or (theShapeFN = nil)) then\n ErrorMessage = \"Nil parameter in call to script View.Gen2shpMkDonutZ.\"\n return { Nil, ErrorMessage }\n else\n theImportFile = LineFile.Make(theImportFileFN, #FILE_PERM_READ)\n end \nend\n\nNumRecs = theImportFile.GetSize\nRecCnt = 1\n\n' Skip first line with the XYZ tag\nbuffer = theImportFile.ReadElt\n\n' Create the FTab for the new shape file...\ntheFTab = FTab.MakeNew(theShapeFN, MultiPatch)\n\ntheIDField = Field. Make(\"ID\", #FIELD_DECIMAL, 11, 0)\ntheInnerRadiusField = Field.Make(\"InnerRadius\", #FIELD_DECIMAL, 13, 3)\ntheOuterRadiusField = Field.Make(\"OuterRadius\", #FIELD_DECIMAL, 13, 3)\ntheDepthField = Field.Make(\"Depth\", #FIELD_DECIMAL, 13, 3)\ntheVolumeField = Field.Make(\"Volume\", #FIELD_DECIMAL, 13, 3)\ntheFTab.AddFields({theInnerRadiusField, theOuterRadiusField, theDepthField, theVolumeField, theIDField})\n\ntheShapeField = theFTab.FindField(\"Shape\")\ntheIDField = theFTab.FindField(\"ID\")\ntheInnerRadiusField = theFTab. FindField(\"InnerRadius\")\ntheOuterRadiusField = theFTab.FindField(\"OuterRadius\")\ntheDepthField = theFTab.FindField(\"Depth\")\ntheVolumeField = theFTab.FindField(\"Volume\")\n\n' Skip first record (which reads \"DONUT\")\nbuffer = theImportFile.ReadElt\n\nbuffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\nwhile(buffer <> \"END\")\n\n inpTokens = buffer.AsTokens(\" ,\")\n ID = inpTokens.Get(0)\n\n x0 = inpTokens.Get(1).AsNumber\n y0 = inpTokens.Get(2).AsNumber\n z0 = inpTokens.Get(3).AsNumber\n theCenter = x0@y0@z0\n \n theInnerRadius = inpTokens.Get(4).AsNumber\n theOuterRadius = inpTokens.Get(5).AsNumber\n theDepth = inpTokens.Get(6).AsNumber\n\n theOuterCircle = Circle.Make(theCenter, theOuterRadius)\n theInnerCircle = Circle.Make(theCenter, theInnerRadius)\n theDonut = theOuterCircle.ReturnDifference(theInnerCircle.AsPolygon)\n \n theBottomOuterPolygonZList = {}\n theTopOuterPolygonZList = {}\n theOuterTrianglesList = {}\n theBottomInnerPolygonZList = {}\n theTopInnerPolygonZList = {}\n theInnerTrianglesList = {}\n\n theMultiPatch = MultiPatch.MakeNull\n\n theZ0 = z0\n theZ1 = z0+theDepth\n\n theOuterPoints = theOuterCircle.AsPolygon.AsList\n\n for each i in 0 .. (theOuterPoints.Get(0).Count-1)\n theX = theOuterPoints.Get(0).Get(i).GetX\n theY = theOuterPoints.Get(0).Get(i).GetY\n theBottomOuterPolygonZList.Add(PointZ.Make(theX,theY,theZ0))\n theTopOuterPolygonZList.Add(PointZ.Make(theX,theY,theZ1))\n end\n for each i in 0 .. (theBottomOuterPolygonZList.Count-1)\n theOuterTrianglesList.Add(theBottomOuterPolyg onZList.Get(i))\n theOuterTrianglesList.Add(theTopOuterPolygonZList.Get(i))\n end\n \n theInnerPoints = theInnerCircle.AsPolygon.AsList\n\n for each i in 0 .. (theInnerPoints.Get(0).Count-1)\n theX = theInnerPoints.Get(0).Get(i).GetX\n theY = theInnerPoints.Get(0).Get(i).GetY\n theBottomInnerPolygonZList.Add(PointZ.Make(theX,theY,theZ0))\n theTopInnerPolygonZList.Add(PointZ.Make(theX,theY,theZ1))\n end\n for each i in 0 .. (theBottomInnerPolygonZList.Count-1)\n theInnerTrianglesList.Add(theBo ttomInnerPolygonZList.Get(i))\n theInnerTrianglesList.Add(theTopInnerPolygonZList.Get(i))\n end\n \n theMultiPatch.AddPart(theBottomOuterPolygonZList, #PART_TYPE_OUTERRING)\n theMultiPatch.AddPart(theBottomInnerPolygonZList, #PART_TYPE_INNERRING)\n theMultiPatch.AddPart(theOuterTrianglesList, #PART_TYPE_TRIANGLESTRIP)\n theMultiPatch.AddPart(theInnerTrianglesList, #PART_TYPE_TRIANGLESTRIP)\n theMultiPatch.AddPart(theTopOuterPolygonZList, #PART_TYPE_OUTERRING)\n theMultiPatch.AddPart(theTopInnerPolygonZLis t, #PART_TYPE_INNERRING)\n\n theRecord = theFTab.AddRecord\n theFTab.SetValue(theShapeField, theRecord, theMultiPatch)\n theFTab.SetValue(theIDField, theRecord, ID)\n theFTab.SetValue(theInnerRadiusField, theRecord, theInnerRadius)\n theFTab.SetValue(theOuterRadiusField, theRecord, theOuterRadius)\n theFTab.SetValue(theDepthField, theRecord, theDepth)\n theFTab.SetValue(theVolumeField, theRecord, (theDonut.ReturnArea)*theDepth)\n\n RecCnt = RecCnt + 1\n proceed = av.SetStatus((RecCnt / NumRecs) * 100)\nif (pro ceed.Not) then\n av.ClearStatus\n av.ShowMsg(\"Stopped\")\n return { Nil, \"Stopped\" }\n end\n\n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\nend\n\ntheFTab.Flush\ntheFTab.DeActivate\ntheFTab.UnlinkAll \ntheFTab = nil\n\nreturn { theShapeFN }\n" ) (Script.27 Name: "View.Gen2shpMkLine" SourceCode: "' Name: View.Gen2shpMkLine\n' File: g2smlin.ave (or part of the extension g2sv50.avx)\n' \n' Title: Import generate format files\n'\n' Topics: GeoData\n'\n' Description: Reads a single user specified generate format file\n' and converts the data to the appropriate feature type\n' (either Point, Line or Polygon) to be saved to a user specified\n' shapefile, creates the theme and adds it to the active View.\n' \n' Requires:\n'\n' Runs:\n'\n' Run by: View.Gen2shpConverter\n'\n' Self: \n'\n' Returns: \n'\n' Author : Ron W ardenier ( warden@cistron.nl )\n' Version : see variable VersionStr below\n VersionStr = \"5.0\"\n' Date : 2000-05-05\n' More info : http://warden.www.cistron.nl/geo/\n' \n\n' do some basic checks\nif (self.Count <> 2) then\n ErrorMessage = \"Invalid number of parameters in call to script View.Gen2shpMkLine.\"\n MsgBox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp MkLine Message\")\n exit\nelse\n theImportFileFN = self.Get(0)\n theShapeFN = self.Get(1)\n ' Check for a Nil parameter value(a ver y rare situation that is)\n if ((theImportFileFN = nil) or (theShapeFN = nil)) then\n ErrorMessage = \"Nil parameter in call to script View.Gen2shpMkLine.\"\n return { Nil, ErrorMessage }\n else\n theImportFile = LineFile.Make(theImportFileFN, #FILE_PERM_READ)\n end \nend\n\nNumRecs = theImportFile.GetSize\nRecCnt = 1\n\n' Create the FTab for the new shape file...\ntheFTab = FTab.MakeNew(theShapeFN, Polyline)\n\ntheIDField = Field.Make(\"ID\", #FIELD_DECIMAL, 11, 0)\ntheLengthField = Field.Make(\"Length\", #FIELD_ DECIMAL, 13, 3)\ntheFTab.AddFields({theLengthField, theIDField})\n\ntheShapeField = theFTab.FindField(\"Shape\")\ntheIDField = theFTab.FindField(\"ID\")\ntheLengthField = theFTab.FindField(\"Length\")\n\npointList = List.Make\ntheLineList = List.Make\n\n' This is the loop which reads the file record-by-record.\n'\n' There's an outside loop, which reads the record header. The inside loop\n' then reads the vertices for the polyline feature.\n\nbuffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\nGoOn = true\n\nwhile(GoOn = true)\n\n ' Terminate outside loop at EOF or upon encountering a second \"END\" at the end of file\n\n if((theImportFile.IsAtEnd) or (buffer = \"END\")) then\n break\n end\n\n ' Every record read by the outside loop should be a record header record.\n ' It will contain information about the feature (here only the ID).\n\n inpTokens = buffer.AsTokens(\" ,\")\n ID = inpTokens.Get(0)\n\n theLineList = {}\n\n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n RecCnt = RecCnt + 1\n\n ' Now we're ready to loop through the vertices (this is the inside loop)\n\n newID=False\n\n while((newID = false) and (GoOn = true))\n pointList = {}\n\n while(buffer <> \"END\")\n\n inpTokens = buffer.AsTokens(\" ,\")\n thePoint = inpTokens.Get(0).AsNumber@inpTokens.Get(1).AsNumber\n pointList.Add(thePoint)\n\n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n RecCnt = RecCnt + 1\n\n end\n\n theLineList.add(pointList)\n\n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n RecCnt= RecCn t + 1\n\n proceed = av.SetStatus((RecCnt / NumRecs) * 100)\n if (proceed.Not) then\n av.ClearStatus\n av.ShowMsg(\"Stopped\")\n return { Nil, \"Stopped\" }\n end\n\n inpTokens = buffer.AsTokens(\" ,\")\n if (inpTokens.Count = 1) then\n newID=True\n end\n\n end\n\n thePolyLine = PolyLine.Make(theLineList)\n\n theRecord = theFTab.AddRecord\n theFTab.SetValue(theShapeField, theRecord, thePolyLine)\n theFTab.SetValue(theIDField, theRecord, ID)\n theFTab.SetValue(theLengthField, theRecord, thePo lyLine.ReturnLength)\n\nend\n\ntheFTab.Flush\ntheFTab.DeActivate\ntheFTab.UnlinkAll \ntheFTab = nil\n\nreturn { theShapeFN }\n" ) (Script.28 Name: "View.Gen2shpMkLineZ" SourceCode: "' Name: View.Gen2shpMkLineZ\n' File: g2smlinz.ave (or part of the extension g2sv50.avx)\n' \n' Title: Import generate format files\n'\n' Topics: GeoData\n'\n' Description: Reads a single user specified generate format file\n' and converts the data to the appropriate feature type\n' (either Point, Line or Polygon) to be saved to a user specified\n' shapefile, creates the theme and adds it to the active View.\n' \n' Requires:\n'\n' Runs:\n'\n' Run by: View.Gen2shpConverter\n'\n' Self: \n'\n' Returns: \n'\n' Author : Ron Wardenier ( warden@cistron.nl )\n' Version : see variable VersionStr below\n VersionStr = \"5.0\"\n' Date : 2000-05-05\n' More info : http://warden.www.cistron.nl/geo/\n' \n\n' do some basic checks\nif (self.Count <> 2) then\n ErrorMessage = \"Invalid number of parameters in call to script View.Gen2shpMkLineZ.\"\n MsgBox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp MkLineZ Message\")\n exit\nelse\n theImportFileFN = self.Get(0)\n theShapeFN = self.Get(1)\n ' Check for a Nil parameter value ( a very rare situation that is)\n if ((theImportFileFN = nil) or (theShapeFN = nil)) then\n ErrorMessage = \"Nil parameter in call to script View.Gen2shpMkLineZ.\"\n return { Nil, ErrorMessage }\n else\n theImportFile = LineFile.Make(theImportFileFN, #FILE_PERM_READ)\n end \nend\n\nNumRecs = theImportFile.GetSize\nRecCnt = 1\n\n' Skip first line with the XYZ tag\nbuffer = theImportFile.ReadElt\n\n' Create the FTab for the new shape file...\ntheFTab = FTab.MakeNew(theShapeFN, PolylineZ)\n\ntheIDField = Field.Make( \"ID\", #FIELD_DECIMAL, 11, 0)\ntheLengthField = Field.Make(\"Length\", #FIELD_DECIMAL, 13, 3)\ntheFTab.AddFields({theLengthField, theIDField})\n\ntheShapeField = theFTab.FindField(\"Shape\")\ntheIDField = theFTab.FindField(\"ID\")\ntheLengthField = theFTab.FindField(\"Length\")\n\npointZList = List.Make\ntheLineZList = List.Make\n\n' This is the loop which reads the file record-by-record.\n'\n' There's an outside loop, which reads the record header. The inside loop\n' then reads the vertices for the polyline feature.\n\nbuffer = t heImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\nGoOn = true\n\nwhile(GoOn = true)\n\n ' Terminate outside loop at EOF or upon encountering a second \"END\" at the end of file\n\n if((theImportFile.IsAtEnd) or (buffer = \"END\")) then\n break\n end\n\n ' Every record read by the outside loop should be a record header record.\n ' It will contain information about the feature (here only the ID).\n\n inpTokens = buffer.AsTokens(\" ,\")\n ID = inpTokens.Get(0)\n\n theLineZList = {}\n\n buffer = theImportFile.ReadElt.Sub stitute(9.AsChar,\" \").Trim\n RecCnt = RecCnt + 1\n\n ' Now we're ready to loop through the vertices (this is the inside loop)\n\n newID=False\n\n while((newID = false) and (GoOn = true))\n pointZList = {}\n\n while(buffer <> \"END\")\n\n inpTokens = buffer.AsTokens(\" ,\")\n thePointZ = inpTokens.Get(0).AsNumber@inpTokens.Get(1).AsNumber@inpTokens.Get(2).AsNumber\n pointZList.Add(thePointZ)\n\n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n RecCnt = RecCnt + 1\n\n end\n\n theLi neZList.add(pointZList)\n\n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n RecCnt= RecCnt + 1\n\n proceed = av.SetStatus((RecCnt / NumRecs) * 100)\n if (proceed.Not) then\n av.ClearStatus\n av.ShowMsg(\"Stopped\")\n return { Nil, \"Stopped\" }\n end\n\n inpTokens = buffer.AsTokens(\" ,\")\n if (inpTokens.Count = 1) then\n newID=True\n end\n\n end\n\n thePolyLineZ = PolyLineZ.Make(theLineZList)\n\n theRecord = theFTab.AddRecord\n theFTab.SetValue(theShapeField, theRecord, thePolyLineZ)\n theFTab.SetValue(theIDField, theRecord, ID)\n theFTab.SetValue(theLengthField, theRecord, thePolyLineZ.ReturnLength)\n\nend\n\ntheFTab.Flush\ntheFTab.DeActivate\ntheFTab.UnlinkAll \ntheFTab = nil\n\nreturn { theShapeFN }\n" ) (Script.29 Name: "View.Gen2shpMkPoint" SourceCode: "' Name: View.Gen2shpMkPoint\n' File: g2smpnt.ave (or part of the extension g2sv50.avx)\n' \n' Title: Import generate format files\n'\n' Topics: GeoData\n'\n' Description: Reads a single user specified generate format file\n' and converts the data to the appropriate feature type\n' (either Point, Line or Polygon) to be saved to a user specified\n' shapefile, creates the theme and adds it to the active View.\n' \n' Requires:\n'\n' Runs:\n'\n' Run by: View.Gen2shpConverter\n'\n' Self: \n'\n' Returns: \n'\n' Author : RonW ardenier ( warden@cistron.nl )\n' Version : see variable VersionStr below\n VersionStr = \"5.0\"\n' Date : 2000-05-05\n' More info : http://warden.www.cistron.nl/geo/\n' \n\n' do some basic checks\nif (self.Count <> 2) then\n ErrorMessage = \"Invalid number of parameters in call to script View.Gen2shpMkPoint.\"\n MsgBox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp MkPoint Message\")\n exit\nelse\n theImportFileFN = self.Get(0)\n theShapeFN = self.Get(1)\n ' Check for a Nil parameter value (a very rare situation that is)\n if ((theImportFileFN = nil) or (theShapeFN = nil)) then\n ErrorMessage = \"Nil parameter in call to script View.Gen2shpMkPoint.\"\n return { Nil, ErrorMessage }\n else\n theImportFile = LineFile.Make(theImportFileFN, #FILE_PERM_READ)\n end \nend\n\nNumRecs = theImportFile.GetSize\nRecCnt = 1\n\n' Create the FTab for the new shape file...\ntheFTab = FTab.MakeNew(theShapeFN, Point)\n\ntheIDField = Field.Make(\"ID\", #FIELD_DECIMAL, 11, 0)\ntheXField = Field.Make(\"X\", #FIELD_FLOAT, 12 , 2)\ntheYField = Field.Make(\"Y\", #FIELD_FLOAT, 12, 2)\ntheFTab.AddFields({theIDField, theXField, theYField})\n\ntheShapeField = theFTab.FindField(\"Shape\")\ntheIDField = theFTab.FindField(\"ID\")\ntheXField = theFTab.FindField(\"X\")\ntheYField = theFTab.FindField(\"Y\")\n\n\n' Read next record, replace tabs by a space and remove extra spaces\nbuffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\nwhile(buffer <> \"END\")\n\n inpTokens = buffer.AsTokens(\" ,\")\n ID = inpTokens.Get(0).AsNumber\n\n theX = inpTokens.Get(1).A sNumber\n theY = inpTokens.Get(2).AsNumber\n thePoint = theX@theY\n theRecord = theFTab.AddRecord\n theFTab.SetValue(theShapeField, theRecord, thePoint)\n theFTab.SetValue(theIDField, theRecord, ID)\n theFTab.SetValue(theXField, theRecord, theX)\n theFTab.SetValue(theYField, theRecord, theY)\n\n RecCnt = RecCnt + 1\n proceed = av.SetStatus((RecCnt / NumRecs) * 100)\n if (proceed.Not) then\n av.ClearStatus\n av.ShowMsg(\"Stopped\")\n return { Nil, \"Stopped\" }\n end\n\n if (theImportFile.IsAtEnd.Not)then\n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n else\n break \n end \n\nend\n\n\ntheFTab.Flush\ntheFTab.DeActivate\ntheFTab.UnlinkAll \ntheFTab = nil\n\nreturn { theShapeFN }\n" ) (Script.30 Name: "View.Gen2shpMkPointZ" SourceCode: "' Name: View.Gen2shpMkPointZ\n' File: g2smpntz.ave (or part of the extension g2sv50.avx)\n' \n' Title: Import generate format files\n'\n' Topics: GeoData\n'\n' Description: Reads a single user specified generate format file\n' and converts the data to the appropriate feature type\n' (either Point, Line or Polygon) to be saved to a user specified\n' shapefile, creates the theme and adds it to the active View.\n' \n' Requires:\n'\n' Runs:\n'\n' Run by: View.Gen2shpConverter\n'\n' Self: \n'\n' Returns: \n'\n' Author : Ro n Wardenier ( warden@cistron.nl )\n' Version : see variable VersionStr below\n VersionStr = \"5.0\"\n' Date : 2000-05-05\n' More info : http://warden.www.cistron.nl/geo/\n' \n\n' do some basic checks\nif (self.Count <> 2) then\n ErrorMessage = \"Invalid number of parameters in call to script View.Gen2shpMkPointZ.\"\n MsgBox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp MkPointZ Message\")\n exit\nelse\n theImportFileFN = self.Get(0)\n theShapeFN = self.Get(1)\n ' Check for a Nil parameter valu e (a very rare situation that is)\n if ((theImportFileFN = nil) or (theShapeFN = nil)) then\n ErrorMessage = \"Nil parameter in call to script View.Gen2shpMkPointZ.\"\n return { Nil, ErrorMessage }\n else\n theImportFile = LineFile.Make(theImportFileFN, #FILE_PERM_READ)\n end \nend\n\nNumRecs = theImportFile.GetSize\nRecCnt = 1\n\n' Skip first line with the XYZ tag\nbuffer = theImportFile.ReadElt\n\n' Create the FTab for the new shape file...\ntheFTab = FTab.MakeNew(theShapeFN, PointZ)\n\ntheIDField = Field.Make (\"ID\", #FIELD_DECIMAL, 11, 0)\ntheXField = Field.Make(\"X\", #FIELD_FLOAT, 12, 2)\ntheYField = Field.Make(\"Y\", #FIELD_FLOAT, 12, 2)\ntheZField = Field.Make(\"Z\", #FIELD_FLOAT, 12, 2)\ntheFTab.AddFields({theIDField, theXField, theYField, theZField})\n\ntheShapeField = theFTab.FindField(\"Shape\")\ntheIDField = theFTab.FindField(\"ID\")\ntheXField = theFTab.FindField(\"X\")\ntheYField = theFTab.FindField(\"Y\")\ntheZField = theFTab.FindField(\"Z\")\n\n\n' Read next record, replace tabs by a space and remove extra spaces\nbuffer =theImp ortFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\nwhile(buffer <> \"END\")\n\n inpTokens = buffer.AsTokens(\" ,\")\n ID = inpTokens.Get(0).AsNumber\n\n theX = inpTokens.Get(1).AsNumber\n theY = inpTokens.Get(2).AsNumber\n theZ = inpTokens.Get(3).AsNumber\n thePointZ = pointZ.Make(theX, theY, theZ)\n theRecord = theFTab.AddRecord\n theFTab.SetValue(theShapeField, theRecord, thePointZ)\n theFTab.SetValue(theIDField, theRecord, ID)\n theFTab.SetValue(theXField, theRecord, theX)\n theFTab.SetValue(theYField, theRecord, theY)\n theFTab.SetValue(theZField, theRecord, theZ)\n\n RecCnt = RecCnt + 1\n proceed = av.SetStatus((RecCnt / NumRecs) * 100)\n if (proceed.Not) then\n av.ClearStatus\n av.ShowMsg(\"Stopped\")\n return { Nil, \"Stopped\" }\n end\n\n if (theImportFile.IsAtEnd.Not) then\n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n else\n break \n end \n\nend\n\ntheFTab.Flush\ntheFTab.DeActivate\ntheFTab.UnlinkAll \ntheFTab = nil\n\nreturn { theShapeFN }\n" ) (Script.31 Name: "View.Gen2shpMkPolygon" SourceCode: "' Name: View.Gen2shpMkPolygon\n' File: g2smpol.ave (or part of the extension g2sv50.avx)\n' \n' Title: Import generate format files\n'\n' Topics: GeoData\n'\n' Description: Reads a single user specified generate format file\n' and converts the data to the appropriate feature type\n' (either Point, Line or Polygon) to be saved to a user specified\n' shapefile, creates the theme and adds it to the active View.\n' \n' Requires:\n'\n' Runs:\n'\n' Run by: View.Gen2shpConverter\n'\n' Self: \n'\n' Returns: \n'\n' Author : Ro n Wardenier ( warden@cistron.nl )\n' Version : see variable VersionStr below\n VersionStr = \"5.0\"\n' Date : 2000-05-05\n' More info : http://warden.www.cistron.nl/geo/\n' \n\n' do some basic checks\nif (self.Count <> 3) then\n ErrorMessage = \"Invalid number of parameters in call to script View.Gen2shpMkPolygon.\"\n MsgBox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp MkPolygon Message\")\n exit\nelse\n theImportFileFN = self.Get(0)\n theShapeFN = self.Get(1)\n theClass = self.Get(2)\n' Check for a Nil parameter value (a very rare situation that is)\n if ((theImportFileFN = nil) or (theShapeFN = nil)) then\n ErrorMessage = \"Nil parameter in call to script View.Gen2shpMkPolygon.\"\n return { Nil, ErrorMessage }\n else\n theImportFile = LineFile.Make(theImportFileFN, #FILE_PERM_READ)\n end \nend\n\nNumRecs = theImportFile.GetSize\nRecCnt = 1\n\n' Create the FTab for the new shape file...\ntheFTab = FTab.MakeNew(theShapeFN, Polygon)\n\ntheIDField = Field.Make(\"ID\", #FIELD_DECIMAL, 11, 0)\ntheAreaFie ld = Field.Make(\"Area\", #FIELD_DECIMAL, 13, 3)\nthePerimeterField = Field.Make(\"Perimeter\", #FIELD_DECIMAL, 13, 3)\ntheFTab.AddFields({theAreaField, thePerimeterField, theIDField})\n\ntheShapeField = theFTab.FindField(\"Shape\")\ntheIDField = theFTab.FindField(\"ID\")\ntheAreaField = theFTab.FindField(\"Area\")\nthePerimeterField = theFTab.FindField(\"Perimeter\")\n\npointList = List.Make\nthePolygonList = List.Make\n\nbuffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\nwhile(TRUE) ' loop until terminating END tag i s found\n\n ' Terminate outside loop at EOF or upon encountering a second \"END\" at the end of file\n\n if((theImportFile.IsAtEnd) or (buffer = \"END\")) then\n break\n end\n\n\n inpTokens = buffer.AsTokens(\" ,\")\n ID = inpTokens.Get(0)\n inpTokens.Remove(0)\n\n thePolygonList = {}\n pointList = {}\n\n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n RecCnt = RecCnt + 1\n\n newID=False\n\n while(newID=False)\n' pointList = {}\n\n while(buffer <> \"END\")\n\n inpTokens = buffer.AsTokens(\" ,\")\n thePoint = inpTokens.Get(0).AsNumber@inpTokens.Get(1).AsNumber\n pointList.Add(thePoint)\n\n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n RecCnt = RecCnt + 1\n\n end\n\n thePolygonList.add(pointList)\n pointList = {}\n\n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\n if (buffer = \"END\") then\n break ' this is the terminating END tag, so break out of the loop\n end\n\n RecCnt = RecCnt + 1\n\n proceed = av.SetStatus((RecCnt / NumRecs) * 100)\n if (proceed.Not) then\n av.ClearStatus\n av.ShowMsg(\"Stopped\")\n return { Nil, \"Stopped\" }\n end\n\n inpTokens = buffer.AsTokens(\" ,\")\n if ((inpTokens.Count = 3) or\n ((inpTokens.Count = 1) and (theClass = \"PolygonClose\")) or\n ((inpTokens.Count = 2) and (inpTokens.Get(1) = \"AUTO\"))) then\n newID=True\n end\n\n end\n\n thePolygon = Polygon.Make(thePolygonList)\n\n theRecord = theFTab.AddRecord\n theFTab.SetValue(theShapeField, theRecord, thePolygon)\n theFTab.SetValue(theIDFie ld, theRecord, ID)\n theFTab.SetValue(theAreaField, theRecord, thePolygon.ReturnArea)\n theFTab.SetValue(thePerimeterField, theRecord, thePolygon.ReturnLength)\n\nend\n\ntheFTab.Flush\ntheFTab.DeActivate\ntheFTab.UnlinkAll \ntheFTab = nil\n\nreturn { theShapeFN }\n" ) (Script.32 Name: "View.Gen2shpMkPolygonZ" SourceCode: "' Name: View.Gen2shpMkPolygonZ\n' File: g2smpolz.ave (or part of the extension g2sv50.avx)\n' \n' Title: Import generate format files\n'\n' Topics: GeoData\n'\n' Description: Reads a single user specified generate format file\n' and converts the data to the appropriate feature type\n' (either Point, Line or Polygon) to be saved to a user specified\n' shapefile, creates the theme and adds it to the active View.\n' \n' Requires:\n'\n' Runs:\n'\n' Run by: View.Gen2shpConverter\n'\n' Self: \n'\n' Returns: \n'\n' Author :R on Wardenier ( warden@cistron.nl )\n' Version : see variable VersionStr below\n VersionStr = \"5.0\"\n' Date : 2000-05-20\n' More info : http://warden.www.cistron.nl/geo/\n' \n\n' do some basic checks\nif (self.Count <> 3) then\n ErrorMessage = \"Invalid number of parameters in call to script View.Gen2shpMkPolygonZ.\"\n MsgBox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp MkPolygonZ Message\")\n exit\nelse\n theImportFileFN = self.Get(0)\n theShapeFN = self.Get(1)\n theClass = self.Get(2)\n ' Check for a Nil parameter value (a very rare situation that is)\n if ((theImportFileFN = nil) or (theShapeFN = nil)) then\n ErrorMessage = \"Nil parameter in call to script View.Gen2shpMkPolygonZ.\"\n return { Nil, ErrorMessage }\n else\n theImportFile = LineFile.Make(theImportFileFN, #FILE_PERM_READ)\n end \nend\n\nNumRecs = theImportFile.GetSize\nRecCnt = 1\n\n' Skip first line with the XYZ tag\nbuffer = theImportFile.ReadElt\n\n' Create the FTab for the new shape file...\ntheFTab = FTab.MakeNew(theShapeFN, PolygonZ)\n\ntheIDField = Field.Make(\"ID\", #FIELD_DECIMAL, 11, 0)\ntheAreaField = Field.Make(\"Area\", #FIELD_DECIMAL, 13, 3)\nthePerimeterField = Field.Make(\"Perimeter\", #FIELD_DECIMAL, 13, 3)\ntheFTab.AddFields({theAreaField, thePerimeterField, theIDField})\n\ntheShapeField = theFTab.FindField(\"Shape\")\ntheIDField = theFTab.FindField(\"ID\")\ntheAreaField = theFTab.FindField(\"Area\")\nthePerimeterField = theFTab.FindField(\"Perimeter\")\n\npointZList = List.Make\nthePolygonZList = List.Make\n\nbuffer = theImportFile.ReadElt.Su bstitute(9.AsChar,\" \").Trim\n\nwhile(TRUE) ' loop until terminating END tag is found\n\n ' Terminate outside loop at EOF or upon encountering a second \"END\" at the end of file\n\n if((theImportFile.IsAtEnd) or (buffer = \"END\")) then\n break\n end\n\n\n inpTokens = buffer.AsTokens(\" ,\")\n ID = inpTokens.Get(0)\n inpTokens.Remove(0)\n\n thePolygonZList = {}\n pointZList = {}\n\n thePointZ = inpTokens.Get(0).AsNumber@inpTokens.Get(1).AsNumber@inpTokens.Get(2).AsNumber\n'MsgBox.Info(inpTokens.Get(0).AsNumber.asstring +\",\"+inpTokens.Get(1).AsNumber.asstring+\",\"+inpTokens.Get(2).AsNumber.asstring, \"g2s\")\n pointZList.Add(thePointZ)\n\n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n RecCnt = RecCnt + 1\n\n newID=False\n\n while(newID=False)\n' pointZList = {}\n\n while(buffer <> \"END\")\n\n inpTokens = buffer.AsTokens(\" ,\")\n thePointZ = inpTokens.Get(0).AsNumber@inpTokens.Get(1).AsNumber@inpTokens.Get(2).AsNumber\n'MsgBox.Info(inpTokens.Get(0).AsNumber.asstring+\",\"+inpTokens.Get(1).AsNumber.asstring+\" ,\"+inpTokens.Get(2).AsNumber.asstring, \"g2s\")\n pointZList.Add(thePointZ)\n\n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n RecCnt = RecCnt + 1\n\n end\n\n'MsgBox.Info(\"Number of elements in pointZList is \"+pointZList.Count.asstring, \"Gen2shp\")\n thePolygonZList.add(pointZList)\n pointZList = {}\n \n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\n if (buffer = \"END\") then\n break ' this is the terminating END tag, so break out of the loop\n end\n\n RecCnt = RecCnt + 1\n\n proceed = av.SetStatus((RecCnt / NumRecs) * 100)\n if (proceed.Not) then\n av.ClearStatus\n av.ShowMsg(\"Stopped\")\n return { Nil, \"Stopped\" }\n end\n\n inpTokens = buffer.AsTokens(\" ,\")\n if ((inpTokens.Count = 4) or\n ((inpTokens.Count = 1) and (theClass = \"PolygonClose\")) or\n ((inpTokens.Count = 3) and (inpTokens.Get(1) = \"AUTO\"))) then\n newID=True\n end\n\n end\n\n thePolygonZ = PolygonZ.Make(thePolygonZList)\n' thePolygonZ = PolygonZ.Make( { {0@0@0, 0@1@1, 1@1@3}, {5@5@2, 6@7@4, 9@3@4}} )\n'MsgBox.Info(\"Number of elements in thePolygonZList is \"+thePolygonZList.Count.asstring, \"Gen2shp\")\n\n\n theRecord = theFTab.AddRecord\n theFTab.SetValue(theShapeField, theRecord, thePolygonZ)\n theFTab.SetValue(theIDField, theRecord, ID)\n theFTab.SetValue(theAreaField, theRecord, thePolygonZ.ReturnArea)\n theFTab.SetValue(thePerimeterField, theRecord, thePolygonZ.ReturnLength)\n\nend\n\ntheFTab.Flush\ntheFTab.DeActivate\ntheFTab.UnlinkAll \ntheFTab = nil\n\nreturn { t heShapeFN }\n" ) (Script.33 Name: "View.Gen2shpMkRectangle" SourceCode: "' Name: View.Gen2shpMkRectangle\n' File: g2smrec.ave (or part of the extension g2sv50.avx)\n' \n' Title: Import generate format files\n'\n' Topics: GeoData\n'\n' Description: Reads a single user specified generate format file\n' and converts the data to the appropriate feature type\n' (either Point, Line or Polygon) to be saved to a user specified\n' shapefile, creates the theme and adds it to the active View.\n' \n' Requires:\n'\n' Runs:\n'\n' Run by: View.Gen2shpConverter\n'\n' Self: \n'\n' Returns: \n'\n' Author :R on Wardenier ( warden@cistron.nl )\n' Version : see variable VersionStr below\n VersionStr = \"5.0\"\n' Date : 2000-05-05\n' More info : http://warden.www.cistron.nl/geo/\n' \n\n' do some basic checks\nif (self.Count <> 2) then\n ErrorMessage = \"Invalid number of parameters in call to script View.Gen2shpMkRectangle.\"\n MsgBox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp MkRectangle Message\")\n exit\nelse\n theImportFileFN = self.Get(0)\n theShapeFN = self.Get(1)\n ' Check for a Nil paramet er value (a very rare situation that is)\n if ((theImportFileFN = nil) or (theShapeFN = nil)) then\n ErrorMessage = \"Nil parameter in call to script View.Gen2shpMkRectangle.\"\n return { Nil, ErrorMessage }\n else\n theImportFile = LineFile.Make(theImportFileFN, #FILE_PERM_READ)\n end \nend\n\nNumRecs = theImportFile.GetSize\nRecCnt = 1\n\n' Create the FTab for the new shape file...\ntheFTab = FTab.MakeNew(theShapeFN, Polygon)\n\ntheIDField = Field.Make(\"ID\", #FIELD_DECIMAL, 11, 0)\ntheWidthField = Field.Make (\"Width\", #FIELD_DECIMAL, 13, 3)\ntheHeightField = Field.Make(\"Height\", #FIELD_DECIMAL, 13, 3)\ntheAreaField = Field.Make(\"Area\", #FIELD_DECIMAL, 13, 3)\ntheFTab.AddFields({theWidthField, theHeightField, theAreaField, theIDField})\n\ntheShapeField = theFTab.FindField(\"Shape\")\ntheIDField = theFTab.FindField(\"ID\")\ntheWidthField = theFTab.FindField(\"Width\")\ntheHeightField = theFTab.FindField(\"Height\")\ntheAreaField = theFTab.FindField(\"Area\")\n\nbuffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\nwhile(buffe r <> \"END\")\n\n inpTokens = buffer.AsTokens(\" ,\")\n ID = inpTokens.Get(0)\n\n theRectangle = Rect.MakeXY(inpTokens.Get(1).AsNumber, inpTokens.Get(2).AsNumber,\n inpTokens.Get(3).AsNumber, inpTokens.Get(4).AsNumber)\n theRecord = theFTab.AddRecord\n theFTab.SetValue(theShapeField, theRecord, theRectangle.AsPolygon)\n theFTab.SetValue(theIDField, theRecord, ID)\n theFTab.SetValue(theWidthField, theRecord, theRectangle.GetWidth)\n theFTab.SetValue(theHeightField, theRecord, theRectangl e.GetHeight)\n theFTab.SetValue(theAreaField, theRecord, theRectangle.ReturnArea)\n\n RecCnt = RecCnt + 1\n proceed = av.SetStatus((RecCnt / NumRecs) * 100)\n if (proceed.Not) then\n av.ClearStatus\n av.ShowMsg(\"Stopped\")\n return { Nil, \"Stopped\" }\n end\n\n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\nend\n\ntheFTab.Flush\ntheFTab.DeActivate\ntheFTab.UnlinkAll \ntheFTab = nil\n\nreturn { theShapeFN }\n" ) (Script.34 Name: "View.Gen2shpMkRectangleZ" SourceCode: "' Name: View.Gen2shpMkRectangleZ\n' File: g2smrecz.ave (or part of the extension g2sv50.avx)\n' \n' Title: Import generate format files\n'\n' Topics: GeoData\n'\n' Description: Reads a single user specified generate format file\n' and converts the data to the appropriate feature type\n' (either Point, Line or Polygon) to be saved to a user specified\n' shapefile, creates the theme and adds it to the active View.\n' \n' Requires:\n'\n' Runs:\n'\n' Run by: View.Gen2shpConverter\n'\n' Self: \n'\n' Returns: \n'\n' Author: Ro n Wardenier ( warden@cistron.nl )\n' Version : see variable VersionStr below\n VersionStr = \"5.0\"\n' Date : 2000-05-24\n' More info : http://warden.www.cistron.nl/geo/\n' \n\n' do some basic checks\nif (self.Count <> 2) then\n ErrorMessage = \"Invalid number of parameters in call to script View.Gen2shpMkRectangleZ.\"\n MsgBox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp MkRectangleZ Message\")\n exit\nelse\n theImportFileFN = self.Get(0)\n theShapeFN = self.Get(1)\n ' Check for a Nil parame ter value (a very rare situation that is)\n if ((theImportFileFN = nil) or (theShapeFN = nil)) then\n ErrorMessage = \"Nil parameter in call to script View.Gen2shpMkRectangleZ.\"\n return { Nil, ErrorMessage }\n else\n theImportFile = LineFile.Make(theImportFileFN, #FILE_PERM_READ)\n end \nend\n\nNumRecs = theImportFile.GetSize\nRecCnt = 1\n\n' Skip first record (which reads \"XYZ\")\nbuffer = theImportFile.ReadElt\n\n' Create the FTab for the new shape file...\ntheFTab = FTab.MakeNew(theShapeFN, MultiPatch)\nthe IDField = Field.Make(\"ID\", #FIELD_DECIMAL, 11, 0)\ntheWidthField = Field.Make(\"Width\", #FIELD_DECIMAL, 13, 3)\ntheHeightField = Field.Make(\"Height\", #FIELD_DECIMAL, 13, 3)\ntheDepthField = Field.Make(\"Depth\", #FIELD_DECIMAL, 13, 3)\ntheVolumeField = Field.Make(\"Volume\", #FIELD_DECIMAL, 13, 3)\ntheFTab.AddFields({theWidthField, theHeightField, theDepthField, theVolumeField, theIDField})\n\ntheShapeField = theFTab.FindField(\"Shape\")\ntheIDField = theFTab.FindField(\"ID\")\ntheWidthField = theFTab.FindField(\"Width\")\ntheH eightField = theFTab.FindField(\"Height\")\ntheDepthField = theFTab.FindField(\"Depth\")\ntheVolumeField = theFTab.FindField(\"Volume\")\n\nbuffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\nwhile(buffer <> \"END\")\n\n inpTokens = buffer.AsTokens(\" ,\")\n ID = inpTokens.Get(0)\n\n theMultiPatch = MultiPatch.MakeNull\n \n x0 = inpTokens.Get(1).AsNumber\n y0 = inpTokens.Get(2).AsNumber\n z0 = inpTokens.Get(3).AsNumber\n x1 = inpTokens.Get(4).AsNumber\n y1 = inpTokens.Get(5).AsNumber\n z1 = inpTokens.Get(6).AsNum ber\n\n w = (x1-x0).Abs\n h = (y1-y0).Abs\n d = (z1-z0).Abs\n\n p0 = x0@y0@z0\n p1 = x1@y0@z0\n p2 = x1@y1@z0\n p3 = x0@y1@z0\n p4 = x0@y0@z1\n p5 = x1@y0@z1\n p6 = x1@y1@z1\n p7 = x0@y1@z1\n\n theMultiPatch.AddPart({p0,p1,p2,p3}, #PART_TYPE_OUTERRING)\n theMultiPatch.AddPart({p0,p4,p1,p5,p2,p6,p3,p7,p0,p4}, #PART_TYPE_TRIANGLESTRIP)\n theMultiPatch.AddPart({p4,p5,p6,p7}, #PART_TYPE_OUTERRING)\n \n theRecord = theFTab.AddRecord\n theFTab.SetValue(theShapeField, theRecord, theMultiPatch)\n theFTab.SetValue(theI DField, theRecord, ID)\n theFTab.SetValue(theWidthField, theRecord, w)\n theFTab.SetValue(theHeightField, theRecord, h)\n theFTab.SetValue(theDepthField, theRecord, d)\n theFTab.SetValue(theVolumeField, theRecord, (w*h*d))\n\n RecCnt = RecCnt + 1\n proceed = av.SetStatus((RecCnt / NumRecs) * 100)\n if ( proceed.Not ) then\n av.ClearStatus\n av.ShowMsg(\"Stopped\")\n return { Nil, \"Stopped\" }\n end\n\n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\nend\n\ntheFTab.Flush\ntheFTab.DeActivate\ntheFT ab.UnlinkAll \ntheFTab = nil\n\n'MsgBox.Info(\"MBB=\"+theMultiPatch.ReturnMBB.AsString, \"Gen2shp\")\n\nreturn { theShapeFN }\n" ) (Script.35 Name: "View.Gen2shpReporter" SourceCode: "' Name: View.Gen2shpReporter\n' File: g2sreptr.ave (or part of the extension g2sv50.avx)\n' \n' Title: Creates and writes to the Report Window in Verbose modes 1 and 2.\n'\n' Topics: GeoData\n'\n' Description: Original script by John Ganter (see original header below).\n' Minor modifications to integrate this script by Ron S.W. Wardenier.\n'\n' Requires:\n'\n' Runs:\n'\n' Run by: View.Gen2shpBatchProcessor (in verbose mode 1 or 2)\n'\n' Self: \n'\n' Returns: \n\n' Original header:\n'------------------------------------- -------------------------------\n'SCRIPT: avu-EchoSED\n'PROJECT: gavos.apr, avcsus \n'DATE: 03-22-96, 02-02-96 JG\n'AUTHOR: John Ganter, Sandia National Labs, jganter@sandia.gov\n'DESC: provides an System.Echo window (a SEd) for Windows Avenue \n' developers. Can also be used on platforms that do support\n' System.Echo, since it provides convenient save, print, and \n' copy/cut/paste functions. \n\n'CALL AS: av.Run(\"avu-EchoSED\", \"New&Echo|\" + strThe)\n'ARG01: \"Ech o\"\n' \"New&Echo\" = makes a new SED, then enchos\n'RETURNS: \n'EXPECTS: \n'CALLS TO: \n'--------------------------------------------------------------------\n'Note that the delimiter is a \"|\" character.\n\n'Notes: \n'Remember, you can save, print, and copy/cut/paste from the SED\n'\n'You do need to send a string. If needed, do this: \n'stringMine = numberMine.AsString\n\n'extract request and arguments\n \n lstArguments = SELF.AsTokens(\"|\")\n rRequest = lstArguments.Get(0)\n strNew = lstArguments.Get(1)\n\n'inital size of window; can be changed by dragging\n \n numEchoSEDHi = 250\n numEchoSEDWi = 800\n\n'remove the SED if requested\n\n If ( (rRequest = \"New&Echo\") and (_EchoSED <> Nil) ) then\n 'delete the SED\n av.GetProject.RemoveDoc(_EchoSED) \n return Nil\n end\n\n'if the SED is missing, build a new one\n \n 'refresh the _EchoSED object/handle by finding a document\n 'with its name. If nil is returned, the document is gone even\n 'though the global handle is present \n _EchoSED= av.GetProject.FindDoc(_EchoSED.GetName) \n \n if (_EchoSED = Nil) then\n 'for some reason, you have to MakeFromSource, rather than\n 'just Make, and then fill in below\n _EchoSED = SEd.MakeFromSource(strNew,\"\")\n _EchoSEDwin = _EchoSED.GetWin\n _EchoSEDwin.Resize(numEchoSEDWi, numEchoSEDHi)\n end\n \n'update the SED\n\n 'find the last character and position the cursor\n strPresent = _EchoSED.GetSource\n numCharLast = strPresent.Count\n _EchoSED.SetInsertPos(numCharLast)\n\n if ( numCharLast = 0 ) then 'if there is no text, no newline\n strPrefix = \"\"\n Else\n strPrefix = NL 'if there is already text, add a newline\n End\n \n 'prepare and insert the string, update the SED title \n strPut = strPrefix + strNew\n _EchoSED.Insert(strPut) \n strLabel = \"Gen2shp BatchProcessor Report Window\"\n _EchoSED.SetName(strLabel)\n\n 'make sure the SEd is open and activated\n _EchoSEDwin.Open\n _EchoSEDwin.Activate \n \n 'MsgBox.Info(_EchoSED.GetSource.Count.AsString,\"\") \n\n'----end of script------------------ ---------------------------------\n\n" ) (Script.36 Name: "View.Gen2shpManager" SourceCode: "' Name: View.Gen2shpManager\n' File: g2smngr.ave (or part of the extension g2sv50.avx)\n' \n' Title: Batch handling to Import generate format files\n'\n' Topics: GeoData\n'\n' Description: Reads a user specified single generate format\n' file or a Gen2shp batch file. Depending on the input file\n' type this script makes a single call to View.Gen2shpConverter\n' (when operating in Interactive mode) or a single call to\n' View.Gen2shpBatchProcessor (when operating in Batch mode).\n'\n' Requires:\n'\n' Runs: View.Gen2s hpConverter (when in Interactive mode)\n' or View.Gen2shpBatchProcessor (when in Batch mode)\n'\n' Run by:\n'\n' Self:\n'\n' Returns:\n'\n' Author : Ron Wardenier ( warden@cistron.nl )\n' Version : see variable VersionStr below\n VersionStr = \"5.0\"\n' Date : 2000-05-25\n' More info : http://warden.www.cistron.nl/geo/\n' \n\n\nav.ShowMsg(\"Gen2shp version \"+VersionStr+\" ; Shift-click menu item 'Import Generate files...' for Help.\")\n\nif (System.IsShiftKeyDown) then\n theHelpMsg =\n \"'Import Genera te files...' allows you to convert multiple generate format ASCII files to shapefiles in batch mode. The type of batch mode is set in the batch file. The type of shape is set in each generate file.\"+NL+\n \" \"+NL+\n \"Visit http://warden.www.cistron.nl/geo/ for a full explanation, examples, sample data and updates.\"+NL+\n \" \"+NL+\n \"Gen2shp version \"+VersionStr+NL+\n \"Copyright (c) 2000 Ron Wardenier (Email: warden@cistron.nl )\"+NL+\n \"Gen2shp is distributed under LGPL license. For the full license see http:/ /www.gnu.org/copyleft/lgpl.html\"+NL+\n \"Use at your own risk.\"+NL+\n \" \"+NL+\n \"Includes the avu-EchoSED script by John Ganter, Sandia National Labs\"\n Msgbox.Report(theHelpMsg, \"Gen2shp MiniHelp\")\nend \n\n' Prompt the user for a data file...\n' Open an ASCII line file\n \ntheInputFileFN = FileDialog.Show(\"*\",\"All files (*.*)\",\"Open generate format file or Gen2shp batch file\")\nav.ClearMsg\n\nif (theInputFileFN = nil) then\n exit\nend\n\ntheInputFile = LineFile.Make(theInputFileFN, #FILE_PERM_READ)\n\n' Read thefirst record of the input file, replace tabs by a space and remove extra spaces\nbuffer = theInputFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\nwhile (((\"#'\".Contains(buffer.Left(1))) or (buffer = Nil)) and (Not(theInputFile.IsAtEnd)))\n buffer = theInputFile.ReadElt.Substitute(9.AsChar,\" \").Trim\nend\n\nif (theInputFile.IsAtEnd.Not) then\n inpTokens = buffer.AsTokens(\" ,\")\n if (inpTokens.Get(0) = \"BATCH\") then\n result = av.run( \"View.Gen2shpBatchProcessor\", { theInputFile, inpTokens } )\n else\n result = av.run( \"View.Gen2shpConverter\", { theInputFileFN, \"..\" } )\n end\nelse\n MsgBox.Error(\"Empty input file.\"+NL+\"Halting conversion.\", \"Gen2shp Manager Message\")\nend \n\ntheInputFile.Close\n\n' End of script View.Gen2shpManager\n" ) (Script.37 Name: "View.Gen2shpConverter" SourceCode: "' Name: View.Gen2shpConverter\n' File: g2scnvtr.ave (or part of the extension g2sv50.avx)\n'\n' Title: Import generate format files\n'\n' Topics: GeoData\n'\n' Description: Reads a single user specified generate format file\n' and converts the data to the appropriate feature type\n' (either Point, Line or Polygon) to be saved to a user specified\n' shapefile, creates the theme and adds it to the active View.\n'\n' Requires: When in Interactive mode a View must be the active document.\n'\n' Runs: View.Gen2shpMkXXXw here XXX is the type of shape to create\n'\n' Run by: View.Gen2shpManager (when in Interactive mode)\n' or View.Gen2shpBatchProcessor (when in Batch mode)\n'\n' Self:\n'\n' Returns: Name of newly created shapefile (Nil when failed) and the\n' type of shape\n'\n' Author : Ron Wardenier ( warden@cistron.nl )\n' Version : see variable VersionStr below\n VersionStr = \"5.0\"\n' Date : 2000-05-26\n' More info : http://warden.www.cistron.nl/geo/\n'\n\n' Determine whether we are in interac tive or in batch mode\nif (self.Is(List).Not) then\n' In interactive mode:\n' MsgBox.Info(\"In interactive mode\",\"\")\n\n av.ShowMsg(\"Gen2shp version \"+VersionStr+\" ; Shift-click 'Add Generate Theme...' menu item for Help.\")\n\n if (System.IsShiftKeyDown) then\n theHelpMsg =\n \"'Add Generate Theme...' allows you to convert a generate format ASCII file to shapefile. The type of shape is set in the input file.\"+NL+\n \" \"+NL+\n \"Visit http://warden.www.cistron.nl/geo/ for a full explanation, examples,sample data and updates.\"+NL+\n \" \"+NL+\n \"Gen2shp version \"+VersionStr+NL+\n \"Copyright (c) 2000 Ron Wardenier (Email: warden@cistron.nl )\"+NL+\n \"Gen2shp is distributed under LGPL license. For the full license see http://www.gnu.org/copyleft/lgpl.html\"+NL+\n \"Use at your own risk.\"+NL+\n \" \"+NL+\n \"Includes the avu-EchoSED script by John Ganter, Sandia National Labs\"\n Msgbox.Report(theHelpMsg, \"Gen2shp MiniHelp\")\n end\n\n ' Prompt the user for a data file...\n ' Open an ASCII line file\ntheImport FileFN = FileDialog.Show(\"*\",\"All files (*.*)\",\"Add Theme from generate format ASCII file\")\n av.ClearMsg\n\n ' Check for a Cancel by the user\n if (theImportFileFN = nil) then\n exit\n else\n theImportFile = LineFile.Make(theImportFileFN, #FILE_PERM_READ)\n ' Check whether the file exists (since we use FileDialog.Show this actually is a weird check)\n if (theImportFile = nil) then\n ErrorMessage = \"Input file does not exist.\"\n MsgBox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp Con verter Message\")\n exit\n end\n end\n batch = false\n\nelse\n' In batch mode:\n' MsgBox.Info(\"In batch mode\",\"\")\n\n ' do some basic checks\n if (self.Count <> 2) then\n ErrorMessage = \"Invalid number of parameters in call to script View.Gen2shpConverter.\"\n MsgBox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp Converter Message\")\n exit\n else\n theImportFileFN = self.Get(0)\n theShapeFN = self.Get(1)\n ' Check for a Nil parameter value (a very rare situation that is)\n if ((theImpor tFileFN = nil) or (theShapeFN = nil)) then\n ErrorMessage = \"Nil parameter in call to script View.Gen2shpConverter.\"\n return { Nil, ErrorMessage }\n else\n if (theShapeFN = \"..\") then\n theImportFile = LineFile.Make(theImportFileFN, #FILE_PERM_READ)\n batch = false\n else\n batch = true\n theImportFile = LineFile.Make(theImportFileFN, #FILE_PERM_READ)\n ' Check whether the file exists\n if (theImportFile = nil) then\n ErrorMessage = \"Input file does not exist.\"\n return { Nil, ErrorMessage }\n end\n end\n end\n end\n\nend\n\n' Set output precision\nScript.The.SetNumberFormat( \"d.dddddd\" )\n\n' Read the first record of the input file, replace tabs by a space and remove extra spaces\nbuffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n\nif ((theImportFile.IsAtEnd) or (buffer = nil)) then\n'if ((buffer = nil) or (theImportFile.GetSize = 0)) then\n ErrorMessage = \"Empty input file.\"\n if (batch.Not) then\n MsgBox.Error(ErrorMessag e+NL+\"Halting conversion.\", \"Gen2shp Converter Message\")\n exit\n else\n return { Nil, ErrorMessage }\n end\nend\n\nNumRecs = theImportFile.GetSize\ntheShapeType = \"\"\n\n' Check first record for special tags\ninpTokens = buffer.AsTokens(\" ,\")\ntheTag = inpTokens.Get(0).AsString\n\n' Check for 3D tag\nif(theTag = \"XYZ\") then\n theDimension = 3\n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n inpTokens = buffer.AsTokens(\" ,\")\n theTag = inpTokens.Get(0).AsString\nelse\n theDimension = 2\nend\n\n' Check f irst record for a special graphic tag\nif (theTag = \"CLOSE\") then\n if (theDimension = 2) then\n theShapeType = \"PolygonClose\"\n else\n theShapeType = \"PolygonZClose\"\n end\nelse\n if (theTag = \"BOX\") then\n if (theDimension = 2) then\n theShapeType = \"Box\"\n else\n theShapeType = \"BoxZ\"\n end\n else\n if (theTag = \"DONUT\") then\n if (theDimension = 2) then\n theShapeType = \"Donut\"\n else\n theShapeType = \"DonutZ\"\n end\n end\n end\nend\n\n\nif (theShapeType<> \"\") the n\n' Special tag found\n\n ' Next check for a legal ID; so read the next record\n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n inpTokens = buffer.AsTokens(\" ,\")\n if (inpTokens.Get(0).IsNumber.Not) then\n ErrorMessage = \"ID must be numeric.\"\n if (batch.Not) then\n MsgBox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp Converter Message\")\n exit\n else\n return { Nil, ErrorMessage }\n end\n end\n\nelse\n' No special tag; auto determine type by input file format\n\n ' Ne xt check for a legal ID; no need to read the next record\n inpTokens = buffer.AsTokens(\" ,\")\n if (inpTokens.Get(0).IsNumber.Not) then\n ErrorMessage = \"ID must be numeric.\"\n if (batch.Not) then\n MsgBox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp Converter Message\")\n exit\n else\n return { Nil, ErrorMessage }\n end\n end\n inpTokens = buffer.AsTokens(\" ,\")\n \n if (theDimension = 2) then\n ' 2D shapes\n if (inpTokens.Count = 1) then\n theShapeType = \"Line\"\n else\n if (inpTokens.Count = 5) then\n theShapeType = \"Rectangle\"\n else\n if (inpTokens.Count = 4) then\n theShapeType = \"Circle\"\n else\n if (inpTokens.Count = 3) then\n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n inpTokens = buffer.AsTokens(\" ,\")\n if ((inpTokens.Count = 3) or (buffer = \"END\")) then\n ' if END encountered then there is just one single point\n theShapeType = \"Point\"\n else\n if (inpTokens.Count = 2) then\n theShapeType = \"Polygon\"\n else\n ErrorMessage = \"Unable to determine feature type in input file.\"\n if (batch.Not) then\n MsgBox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp Converter Message\")\n exit\n else\n return { Nil, ErrorMessage }\n end\n end\n end\n else\n if (inpTokens.Get(1) = \"AUT O\") then\n theShapeType = \"Polygon\"\n else\n ErrorMessage = \"Unable to determine feature type in input file.\"\n if (batch.Not) then\n MsgBox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp Converter Message\")\n exit\n else\n return { Nil, ErrorMessage }\n end\n end\n end\n end\n end\n end\n else\n ' 3D shapes\n if (inpTokens.Count = 1) then\n theShapeTyp e = \"LineZ\"\n else\n if (inpTokens.Count = 7) then\n theShapeType = \"RectangleZ\"\n else\n if (inpTokens.Count = 6) then\n theShapeType = \"CircleZ\"\n else\n if (inpTokens.Count = 4) then\n buffer = theImportFile.ReadElt.Substitute(9.AsChar,\" \").Trim\n inpTokens = buffer.AsTokens(\" ,\")\n if ((inpTokens.Count = 4) or (buffer = \"END\")) then\n ' if END encountered then there is just one single point\n theShapeType = \"PointZ\"\n else\n if (inpTokens.Count = 3) then\n theShapeType = \"PolygonZ\"\n else\n ErrorMessage = \"Unable to determine feature type in input file.\"\n if (batch.Not) then\n MsgBox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp Converter Message\")\n exit\n else\n return { Nil, ErrorMessage }\n end\n end\n end\n else\n if (inpToke ns.Get(1) = \"AUTO\") then\n theShapeType = \"PolygonZ\"\n else\n ErrorMessage = \"Unable to determine feature type in input file.\"\n if (batch.Not) then\n MsgBox.Error(ErrorMessage+NL+\"Halting conversion.\", \"Gen2shp Converter Message\")\n exit\n else\n return { Nil, ErrorMessage }\n end\n end\n end\n end\n end\n end\n end\nend\n\n\n' Setup a short message to show the detected shape type\n\nif ((theShapeType = \"Point\") or (theShapeType = \"PointZ\")) then\n InfoMsg = \"Save point(s) as \"+theShapeType\nend\nif ((theShapeType = \"Line\") or (theShapeType = \"LineZ\")) then\n InfoMsg = \"Save line(s) as \"+theShapeType\nend\nif ((theShapeType = \"Polygon\") or (theShapeType = \"PolygonZ\")) then\n InfoMsg = \"Save polygon(s) as \"+theShapeType\nend\nif (theShapeType = \"PolygonClose\") then\n InfoMsg = \"Save polygon(s) as Polygon feature shapefile (with automatic closure)\"\nend\nif (theShapeType = \"PolygonZCl ose\") then\n InfoMsg = \"Save polygon(s) as PolygonZ feature shapefile (with automatic closure)\"\nend\nif (theShapeType = \"Rectangle\") then\n InfoMsg = \"Save rectangle(s) as Polygon\"\nend\nif (theShapeType = \"RectangleZ\") then\n InfoMsg = \"Save rectangle(s) as MultiPatch\"\nend\nif (theShapeType = \"Box\") then\n InfoMsg = \"Save box(es) as Polygon\"\nend\nif (theShapeType = \"BoxZ\") then\n InfoMsg = \"Save box(es) as MultiPatch\"\nend\nif (theShapeType = \"Circle\") then\n InfoMsg = \"Save circle(s) as Polygon\"\nend\nif (theShape Type = \"CircleZ\") then\n InfoMsg = \"Save circle(s) as MultiPatch\"\nend\nif (theShapeType = \"Donut\") then\n InfoMsg = \"Save donut(s) as Polygon\"\nend\nif (theShapeType = \"DonutZ\") then\n InfoMsg = \"Save donut(s) as MultiPatch\"\nend\n\n\n' Input file is valid (so far anyway) and shape type is known\n\n' Construct the output filename for the shapefile\nif (batch.Not) then\n' In interactive mode\n theFileName = theImportFileFN.GetBaseName.AsTokens(\".\").Get(0)\n theSaveDirStr = theImportFileFN.ReturnDir.AsString\n defName = FileName.Merge(theSaveDirStr, theFileName)\n defName.SetExtension(\"shp\")\n if (defName.IsFile) then\n tempName = theImportFileFN.GetBaseName.AsTokens(\".\").Get(0)\n tempDir = theImportFileFN.ReturnDir.AsString\n defName = FN.Make(tempDir).MakeTmp(tempName, \"shp\")\n end\n theShapeFN = FileDialog.Put(defName, \"*.shp\", InfoMsg+\" feature shapefile\")\n if (theShapeFN = nil) then\n ' If canceled by user then quit\n exit\n end\nelse\n' In batch mode\n' Don't do much\nend\n\n' Initialize the progress indicator\nav .ShowMsg(\"Importing \" + theImportFileFN.GetBaseName + \"...\")\nav.ShowStopButton\n\n' Reset file pointer to the beginning of the input file\ntheImportFile.SetPos(0)\n\n\n' Call specific converter script for each type\n\nif (theShapeType = \"Point\") then\n result = av.run( \"View.Gen2shpMkPoint\", { theImportFileFN, theShapeFN } )\n if (result.Get(0) = Nil) then\n ErrorMessage = \"Error when creating Point shapefile.\"\n return { Nil, ErrorMessage }\n end\nend\nif (theShapeType = \"PointZ\") then\n result = av.run( \"View.G en2shpMkPointZ\", { theImportFileFN, theShapeFN } )\n if (result.Get(0) = Nil) then\n ErrorMessage = \"Error when creating PointZ shapefile.\"\n return { Nil, ErrorMessage }\n end\nend\n\n\nif (theShapeType = \"Line\") then\n result = av.run( \"View.Gen2shpMkLine\", { theImportFileFN, theShapeFN } )\n if (result.Get(0) = Nil) then\n ErrorMessage = \"Error when creating Line shapefile.\"\n return { Nil, ErrorMessage }\n end\nend\nif (theShapeType = \"LineZ\") then\n result = av.run(\"View.Gen2shpMkLineZ\", { theImportF ileFN, theShapeFN } )\n if (result.Get(0) = Nil) then\n ErrorMessage = \"Error when creating LineZ shapefile.\"\n return { Nil, ErrorMessage }\n end\nend\n\nif ((theShapeType = \"Polygon\") or (theShapeType = \"PolygonClose\")) then\n if (theShapeType = \"PolygonClose\") then\n ' Skip first record (which reads \"CLOSE\")\n buffer = theImportFile.ReadElt\n end\n result = av.run( \"View.Gen2shpMkPolygon\", { theImportFileFN, theShapeFN, theShapeType } )\n if (result.Get(0) = Nil) then\n ErrorMessage = \"Error when creating Polygon shapefile.\"\n return { Nil, ErrorMessage }\n end\nend\nif ((theShapeType = \"PolygonZ\") or (theShapeType = \"PolygonZClose\")) then\n if (theShapeType = \"PolygonZClose\") then\n ' Skip first record (which reads \"CLOSE\")\n buffer = theImportFile.ReadElt\n end\n result = av.run( \"View.Gen2shpMkPolygonZ\", { theImportFileFN, theShapeFN, theShapeType } )\n if (result.Get(0) = Nil) then\n ErrorMessage = \"Error when creating PolygonZ shapefile.\"\n return { Nil, ErrorMessage }\n end\nend\n\nif (th eShapeType = \"Rectangle\") then\n result = av.run( \"View.Gen2shpMkRectangle\", { theImportFileFN, theShapeFN } )\n if (result.Get(0) = Nil) then\n ErrorMessage = \"Error when creating Rectangle shapefile.\"\n return { Nil, ErrorMessage }\n end\nend\nif (theShapeType = \"RectangleZ\") then\n result = av.run( \"View.Gen2shpMkRectangleZ\", { theImportFileFN, theShapeFN } )\n if (result.Get(0) = Nil) then\n ErrorMessage = \"Error when creating RectangleZ shapefile.\"\n return { Nil, ErrorMessage }\n end\nend\n\nif (th eShapeType = \"Box\") then\n result = av.run( \"View.Gen2shpMkBox\", { theImportFileFN, theShapeFN } )\n if (result.Get(0) = Nil) then\n ErrorMessage = \"Error when creating Box shapefile.\"\n return { Nil, ErrorMessage }\n end\nend\nif (theShapeType = \"BoxZ\") then\n result = av.run( \"View.Gen2shpMkBoxZ\", { theImportFileFN, theShapeFN } )\n if (result.Get(0) = Nil) then\n ErrorMessage = \"Error when creating BoxZ shapefile.\"\n return { Nil, ErrorMessage }\n end\nend\n\nif (theShapeType = \"Circle\") then\n result = av.run( \"View.Gen2shpMkCircle\", { theImportFileFN, theShapeFN } )\n if (result.Get(0) = Nil) then\n ErrorMessage = \"Error when creating Circle shapefile.\"\n return { Nil, ErrorMessage }\n end\nend\nif (theShapeType = \"CircleZ\") then\n result = av.run( \"View.Gen2shpMkCircleZ\", { theImportFileFN, theShapeFN } )\n if (result.Get(0) = Nil) then\n ErrorMessage = \"Error when creating CircleZ shapefile.\"\n return { Nil, ErrorMessage }\n end\nend\n\nif (theShapeType = \"Donut\") then\n result = av.run( \"View.Ge n2shpMkDonut\", { theImportFileFN, theShapeFN } )\n if (result.Get(0) = Nil) then\n ErrorMessage = \"Error when creating Donut shapefile.\"\n return { Nil, ErrorMessage }\n end\nend\nif (theShapeType = \"DonutZ\") then\n result = av.run( \"View.Gen2shpMkDonutZ\", { theImportFileFN, theShapeFN } )\n if (result.Get(0) = Nil) then\n ErrorMessage = \"Error when creating DonutZ shapefile.\"\n return { Nil, ErrorMessage }\n end\nend\n\n\n' Some cleaning up\nav.ClearStatus\nav.ClearMsg\ntheImportFile.Close\n\n' Update the act ive View only when *not* in batch mode\nif (batch.Not) then\n\n if (result.Get(0) <> Nil) then\n\n ' View should be the Active Document\n theView = av.GetActiveDoc\n\n ' Create the new Theme\n NewThemeName = SrcName.Make(theShapeFN.AsString)\n NewTheme = Theme.Make(NewThemeName)\n\n ' Set the Theme name without the extension .shp\n NewTheme.SetName(theShapeFN.GetBaseName)\n\n ' Add it to the active View\n theView.AddTheme(NewTheme)\n\n ' Make sure the View ison top\n theView.GetWin.Activate\n\n ' Flag that the Project has been modified\n av.GetProject.SetModified(True)\n\n else\n ' Clean up the mess (that is delete the partly completed shapefile)\n ' I'm not very proud of this piece of code but I could not figure out\n ' how to use the Manage.Datasources from Avenue in order to delete the\n ' shapefile properly.\n av.PurgeObjects\n if (File.CanDelete(theShapeFN)) then\n theFileName = theShapeFN.GetBaseName.AsTokens(\".\").Get(0)\n theSaveDirStr = theShapeFN.ReturnDir.AsStrin g\n theShpFN = FileName.Merge(theSaveDirStr, theFileName)\n theShpFN.SetExtension(\"shp\")\n File.Delete(theShpFN)\n theShxFN = FileName.Merge(theSaveDirStr, theFileName)\n theShxFN.SetExtension(\"shx\")\n File.Delete(theShxFN)\n theDbfFN = FileName.Merge(theSaveDirStr, theFileName)\n theDbfFN.SetExtension(\"dbf\")\n File.Delete(theDbfFN)\n end\n end\n\nelse\n\n return { theShapeFN, \"theShapeType '\"+theShapeType.AsString+\"'\" }\n\nend\n\n' End of script View.Gen2shpConverter\n\n" ) (Script.38 Name: "Gen2shp Extension Install" SourceCode: "'DO NOT EDIT!!!\n\nif (av.GetProject = nil) then\n return nil\nend\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,theCi ndex)\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 t he current project.\",\"Script Eror\")\n return(nil)\n end\n \n theMbar=av.getproject.findGUI(mDoc).GetMenuBar\n themenu=theMbar.findbylabel(mMenu)\n if (themenu=NiL) then\n themenu=menu.make\n themenu.setlabel(mMenu)\n theMbar.add(themenu,999)\n end\n \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)).GetTo olBar\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.39 Name: "Gen2shp Extension Uninstall" SourceCode: "'DO NOT EDIT!!!\n\nif (av.GetProject = nil) then\n return nil\nend\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 totalCo ntrol 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 \nth eMbar=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 theT oolMenuList\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 a ppropiate control set\n thecontrolset=av.getproject.findGUI(aControl.get(0)).GetToolBar\n\n \n 'See if the control is in the set , if so remove it\n if (theControlSet.GetControls.find(theControl)<>NIL) then\n \n theControlSet.remove(theControl)\n theControlSet.selectdefault\n end\n\nend\n \n\n'And the scripts delete themselves\n\n\nav.getproject.setmodified(true)\n" )