/3.2 (Extension.1 Name: "NZ Projections V2.0, May 2002" Dependencies: "$AVBIN/avdlog.dll\n" FirstRootClassName: "List" Roots: 2 Roots: 3 Roots: 73 Roots: 74 Roots: 82 Roots: 83 Roots: 84 Roots: 85 Roots: 86 Roots: 87 Roots: 88 Roots: 89 Roots: 90 Roots: 91 Roots: 92 Roots: 93 Roots: 94 Version: 32 About: "Projecting between NZMG, NZGD2000 circuits, NZTM, Geographic & UTM/GRS80. NZTM corrected by KimO May 2002" UnloadScript: 95 InstallScript: 96 UninstallScript: 97 ExtVersion: 1 ) (List.2 ) (List.3 Child: 4 ) (AVDLog.4 Name: "NZProjDialogue" X: 293 Y: 247 W: 488 H: 331 ConstrainedControlNames: 5 ConstrainedControlNames: 6 ConstrainedControlNames: 7 Constraints: 8 Constraints: 9 Constraints: 10 Server: 11 ControlPanel: 12 Title: "New Zealand Projection Conversion" EscapeEnabled: 1 Modal: 1 Resizable: 1 AlwaysOnTop: 1 HasTitleBar: 1 Closeable: 1 DefaultButton: 72 ) (AVStr.5 S: "okButton" ) (AVStr.6 S: "CancelButton" ) (AVStr.7 S: "helpButton" ) (Numb.8 N: 85.00000000000000 ) (Numb.9 N: 85.00000000000000 ) (Numb.10 N: 85.00000000000000 ) (Nil.11 ) (CPanel.12 Child: 13 ResBox: 71 Listening: 1 ) (CPanel.13 InternalName: "thePanel" Child: 14 Child: 15 Child: 16 Child: 17 Child: 18 Child: 62 Child: 63 Constraints: 0x55 ResBox: 64 ResBox: 65 ResBox: 66 ResBox: 67 ResBox: 68 ResBox: 69 ResBox: 70 Label: "Projection Options" VisibleBorder: 1 Listening: 1 ) (LButn.14 InternalName: "okButton" Label: "OK" Click: "AAA.DialogueOK" ) (LButn.15 InternalName: "CancelButton" Label: "Cancel" Click: "AAA.DialogueCancel" ) (LButn.16 InternalName: "helpButton" Label: "Help" Click: "AAA.DialogueHelp" ) (AVLBox.17 InternalName: "fromListBox" NextControl: 18 ContentKind: 4 Value: 56 Value: 57 Value: 58 Value: 59 Value: 60 Constraints: 0x55 ColumnCount: 1 HorizontalScroll: 1 Listening: 1 VerticalScroll: 1 SelectionStyle: 61 ) (AVLBox.18 InternalName: "toListBox" NextControl: 11 ContentKind: 4 Value: 19 Value: 20 Value: 21 Value: 22 Value: 23 Value: 24 Value: 25 Value: 26 Value: 27 Value: 28 Value: 29 Value: 30 Value: 31 Value: 32 Value: 33 Value: 34 Value: 35 Value: 36 Value: 37 Value: 38 Value: 39 Value: 40 Value: 41 Value: 42 Value: 43 Value: 44 Value: 45 Value: 46 Value: 47 Value: 48 Value: 49 Value: 50 Value: 51 Value: 52 Value: 53 Value: 54 Constraints: 0x55 ColumnCount: 1 HorizontalScroll: 1 Listening: 1 VerticalScroll: 1 SelectionStyle: 55 ) (AVStr.19 S: "Geographic Int1909" ) (AVStr.20 S: "Geographic GRS80" ) (AVStr.21 S: "New Zealand Map Grid" ) (AVStr.22 S: "Mount Eden 2000" ) (AVStr.23 S: "Bay of Plenty 2000" ) (AVStr.24 S: "Poverty Bay 2000" ) (AVStr.25 S: "Hawkes Bay 2000" ) (AVStr.26 S: "Taranaki 2000" ) (AVStr.27 S: "Tuhirangi 2000" ) (AVStr.28 S: "Wanganui 2000" ) (AVStr.29 S: "Wairarapa 2000" ) (AVStr.30 S: "Wellington 2000" ) (AVStr.31 S: "Collingwood 2000" ) (AVStr.32 S: "Nelson 2000" ) (AVStr.33 S: "Karamea 2000" ) (AVStr.34 S: "Buller 2000" ) (AVStr.35 S: "Grey 2000" ) (AVStr.36 S: "Amuri 2000" ) (AVStr.37 S: "Marlborough 2000" ) (AVStr.38 S: "Hokitika 2000" ) (AVStr.39 S: "Okarito 2000" ) (AVStr.40 S: "Jackson's Bay 2000" ) (AVStr.41 S: "Mount Pleasant 2000" ) (AVStr.42 S: "Gawler 2000" ) (AVStr.43 S: "Timaru 2000" ) (AVStr.44 S: "Lindis Peak 2000" ) (AVStr.45 S: "Mount Nicholas 2000" ) (AVStr.46 S: "Mount York 2000" ) (AVStr.47 S: "Observation Point 2000" ) (AVStr.48 S: "North Taieri 2000" ) (AVStr.49 S: "Bluff 2000" ) (AVStr.50 S: "UTM GRS80 - Zone 58" ) (AVStr.51 S: "UTM GRS80 - Zone 59" ) (AVStr.52 S: "UTM GRS80 - Zone 60" ) (AVStr.53 S: "North Island National Grid (yard)" ) (AVStr.54 S: "South Island National Grid (yard)" ) (AVEnum.55 Name: "LISTBOX_SELECTION_SINGLECELL" ) (AVStr.56 S: "UTM GRS80 - Zone 58" ) (AVStr.57 S: "UTM GRS80 - Zone 59" ) (AVStr.58 S: "UTM GRS80 - Zone 60" ) (AVStr.59 S: "North Island National Grid (yard)" ) (AVStr.60 S: "South Island National Grid (yard)" ) (AVEnum.61 Name: "LISTBOX_SELECTION_SINGLECELL" ) (TextLabel.62 InternalName: "label2" Constraints: 0x55 Label: "From Proj" Listening: 1 ) (TextLabel.63 InternalName: "label3" Constraints: 0x55 Label: "To Proj" Listening: 1 ) (RectD.64 Left: 73.00000000000000 Top: 265.00000000000000 Right: 146.00000000000000 Bottom: 231.00000000000000 ) (RectD.65 Left: 292.00000000000000 Top: 265.00000000000000 Right: 365.00000000000000 Bottom: 231.00000000000000 ) (RectD.66 Left: 182.00000000000000 Top: 265.00000000000000 Right: 255.00000000000000 Bottom: 231.00000000000000 ) (RectD.67 Left: 112.00000000000000 Top: 102.00000000000000 Right: 367.00000000000000 Bottom: 24.00000000000000 ) (RectD.68 Left: 112.00000000000000 Top: 210.00000000000000 Right: 367.00000000000000 Bottom: 122.00000000000000 ) (RectD.69 Left: 14.00000000000000 Top: 54.00000000000000 Right: 70.00000000000000 Bottom: 27.00000000000000 ) (RectD.70 Left: 23.00000000000000 Top: 159.00000000000000 Right: 70.00000000000000 Bottom: 130.00000000000000 ) (RectD.71 Left: 20.00000000000000 Top: 305.00000000000000 Right: 471.00000000000000 Bottom: 16.00000000000000 ) (Nil.72 ) (List.73 ) (List.74 Child: 75 ) (List.75 Child: 76 Child: 80 Child: 81 ) (List.76 Child: 77 Child: 78 Child: 79 ) (AVStr.77 S: "View" ) (AVStr.78 S: "Theme" ) (AVStr.79 S: "AAA.NZProjection" ) (Choice.80 Disabled: 1 Help: "NZ Projections//Project between NZMG,NZTM NZGD2000,UTM/GRS80 options" Update: "AAA.NZProjectionUpdate" Label: "Convert N&Z Projection" Click: "AAA.NZProjection" Shortcut: "Keys.None" ) (Numb.81 ) (List.82 ) (Script.83 Name: "AAA.ConvertDatum" SourceCode: "'Convert datum cartesian coordinates using a 7-parameter Bursa-Wolf model.\n'\n'SELF: List of PointZ,dX,dY,dZ,rX,rY,rZ,sC being:\n'\n'dX,dY,dZ - cartesian differences of the spheroids\n'rX,rY,rZ - rotational differences of the two spheroids (radians)\n'sC - scale difference between the coordinate systems\n'\n'Returns: PointZ\n'\nScript.The.SetNumberFormat(\"d.dddddddd\")\n'\nx2 = SELF.Get(0).GetX\ny2 = SELF.Get(0).GetY\nz2 = SELF.Get(0).GetZ\n'\ndX = SELF.Get(1)\ndY = SELF.Get(2)\ndZ = SELF.Get(3)\nrX = SELF.Get(4)\nrY = SELF.Get(5)\nrZ = SELF.Get(6)\nsC = SELF.Get(7)\n'\n'\nx1 = dX + (sC*(x2 + (rZ*y2) - (rY*z2)))\ny1 = dY + (sC*(y2 + (rX*z2) - (rZ*x2)))\nz1 = dz + (sC*(z2 + (rY*x2) - (rX*y2)))\n'\nreturn PointZ.Make(x1,y1,z1)" ) (Script.84 Name: "AAA.DialogueCancel" SourceCode: "SELF.GetDialog.SetModalResult(nil)\nSELF.GetDialog.Close" ) (Script.85 Name: "AAA.DialogueHelp" SourceCode: "'Message available within the Dialogue box brought up\n'within AAA.NZProject\n'\n'\ntheString = \n\"From Proj: Please select which projection applies to the\"+nl+\n\"active theme. You must know this for certain.\"+nl+nl+\n\"To Proj: Please select the desired output projection\"+nl+\n\"or Geographic coordinates for your data.\"+nl+\n\"Geographic coordinates will be in decimal degrees.\"+nl+nl+\n\"Notes: The datum conversion approach used here is a\"+nl+\n\"7-parameter Bursa-Wolf model, accurate to within approximately\"+nl+\n\"4 me tres. For survey-accurate data conversion use conversion tool in ArcGIS 8\"+nl+\n\"or LINZ utility.\"\n'\nMsgBox.Report(theString,\"Projection Dialogue Help\")" ) (Script.86 Name: "AAA.DialogueOK" SourceCode: "fromBox = SELF.GetDialog.FindByName(\"fromListBox\")\nfromdescription = fromBox.GetSelection.Get(0)\ntoBox = SELF.GetDialog.FindByName(\"toListBox\")\ntoDescription = toBox.GetSelection.Get(0)\nSELF.GetDialog.SetModalResult({fromDescription,toDescription})\nSELF.GetDialog.Close" ) (Script.87 Name: "AAA.MakeCartesian" SourceCode: "'Convert latitude, longitude and height to cartesian X,Y,Z\n'\n'SELF: List of PointZ,a,b where:\n'\n'PointZ = latitude@longitude,h (lat/long in radians)\n'h = height of Point above spheroid along ellipsoidal normal\n'a = spheroid semi-major axis\n'b = spheroid semi-minor axis\n'\n'a,b,h in same units\n'\n'Returns PointZ\n'\n'\nScript.The.SetNumberFormat(\"d.dddddddd\")\n'\nlambda = SELF.Get(0).GetX\nphi = SELF.Get(0).GetY\nh = SELF.Get(0).GetZ\na = SELF.Get(1)\nb = SELF.Get(2)\n'\n'\nr = (a^2) / ((((a^2) * ((phi.Cos)^2)) + ((b^2) * ((phi.Sin)^2))).Sqrt)\nx = (r+h)*(phi.Cos)*(lambda.Cos)\ny = (r+h)*(phi.Cos)*(lambda.Sin)\nz = (((((b^2)/(a^2))*r)+h))*(phi.Sin)\n'\n'\nreturn PointZ.Make(x,y,z)" ) (Script.88 Name: "AAA.MakeGeographic" SourceCode: "'Convert cartesian X,Y,Z to latitude, longitude and height\n'\n'SELF: list of PointZ,a,b\n'\n'PointZ = x@y,z\n'a = spheroid semi-major axis\n'b = spheroid semi-minor axis\n'\n'x,y,z,a,b in same units\n'\n'Returns PointZ\n'\nScript.The.SetNumberFormat(\"d.dddddddd\")\n'\nx = SELF.Get(0).GetX\ny = SELF.Get(0).GetY\nz = SELF.Get(0).GetZ\na = SELF.Get(1)\nb = SELF.Get(2)\n'\n'\ne = ((a^2) - (b^2)) / (a^2)\ne1 = ((a^2) - (b^2)) / (b^2)\np = ((x^2) + (y^2)).Sqrt\ntheta = (z * a / p / b).ATan\nterm1 = z + (e1 * b * ((theta.Sin)^3))\nterm2 = p - (e * a * ((theta.Cos)^3))\nphi = (term1 / term2).ATan\nlambda = Number.GetPi + ((y/x).ATan)\nr = (a^2) / ((((a^2) * ((phi.Cos)^2)) + ((b^2) * ((phi.Sin)^2))).Sqrt)\nh = (p / (phi.Cos)) - r\n'\nreturn PointZ.Make(lambda.AsDegrees,phi.AsDegrees,h)" ) (Script.89 Name: "AAA.NZCoordSys" SourceCode: "'Create a CoordSys object containing NZMG, NZTM2000, NZGD2000 meridional\n'circuits and UTM/GRS80 zones 58-60 (for large scale mapping).\n'\n'\n'Returns: CoordSys\n'\n'Warning: If you add NZGD49 local circuits to the CoordSys then\n'you must determine and code the datum shift parameters used\n'in AAA.ReProjectPoint\n'\n'\nnzCoordSys = CoordSys.Make\nnzCoordSys.SetName(\"New Zealand Projections\")\nnzProjections = nzCoordSys.GetProjections\n'\n'Add Geographic\n'\ngeoPrj = Prj.MakeNull\ngeoPrj.SetDescription(\"Geographic Int1909 (Geodetic 1949) \")\ngeoPrj.SetSpheroid(#spheroid_international1909)\nnzProjections.Add(geoPrj)\ngeoPrj = Prj.MakeNull\ngeoPrj.SetDescription(\"Geographic GRS80 (WGS 84)\")\ngeoPrj.SetSpheroid(#spheroid_grs80)\nnzProjections.Add(geoPrj)\n'\n'\n'Add NZMG\n'\nnzmgPrj = NewZealand.Make(Rect.MakeXY(-180,-90,180,90))\nnzmgPrj.SetDescription(\"New Zealand Map Grid\")\nnzProjections.Add(nzmgPrj)\n'\n'Add NZTM 2000\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 173\ntheLatitude = 0\nnzgdPrj.SetCentralMe ridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(0.9996)\nnzgdPrj.SetFalseEasting(1600000)\nnzgdPrj.SetFalseNorthing(10000000)\nnzgdPrj.SetDescription(\"New Zealand TM 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\n'Add the NZGD2000 Meridional Circuits\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 174 + (45/60) + (51/3600)\ntheLatitude = -36 - (52/60) - (47/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitud e(theLatitude)\nnzgdPrj.SetScale(0.9999)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"Mount Eden 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 176 + (27/60) + (58/3600)\ntheLatitude = -37 - (45/60) - (40/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorth ing(800000)\nnzgdPrj.SetDescription(\"Bay of Plenty 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 177 + (53/60) + (8/3600)\ntheLatitude = -38 - (37/60) - (28/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"Poverty Bay 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nn zgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 176 + (40/60) + (25/3600)\ntheLatitude = -39 - (39/60) - (3/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"Hawkes Bay 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMe ridian = 174 + (13/60) + (40/3600)\ntheLatitude = -39 - (8/60) - (8/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"Taranaki 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 175 + (38/60) + (24/3600)\ntheLatitude = -39 - (30/60) - (44/3600)\nnzgdPrj.SetCentralMeri dian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"Tuhirangi 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 175 + (29/60) + (17/3600)\ntheLatitude = -40 - (14/60) - (31/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.S etFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"Wanganui 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 175 + (38/60) + (50/3600)\ntheLatitude = -40 - (55/60) - (31/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"Wairarapa 2000\" )\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 174 + (46/60) + (35/3600)\ntheLatitude = -41 - (18/60) - (4/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"Wellington 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgd Prj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 172 + (40/60) + (19/3600)\ntheLatitude = -40 - (42/60) - (53/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"Collingwood 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 173 + (17/60) + (57/3600)\ntheLatitude = -41 - (16/60) - (28/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"Nelson 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 172 + (6/60) + (32/3600)\ntheLatitude = -41 - (17/60) - (23/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatit ude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"Karamea 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 171 + (34/60) + (52/3600)\ntheLatitude = -41 - (48/60) - (38/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nn zgdPrj.SetDescription(\"Buller 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 171 + (32/60) + (59/3600)\ntheLatitude = -42 - (20/60) - (1/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"Grey 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect. MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 173 + (0/60) + (36/3600)\ntheLatitude = -42 - (41/60) - (20/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"Amuri 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 173 + (48/60) + (7/3600 )\ntheLatitude = -41 - (32/60) - (40/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"Marlborough 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 170 + (58/60) + (47/3600)\ntheLatitude = -42 - (53/60) - (10/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.Se tReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"Hokitika 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 170 + (15/60) + (39/3600)\ntheLatitude = -43 - (6/60) - (36/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj .SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"Okarito 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 168 + (36/60) + (22/3600)\ntheLatitude = -43 - (58/60) - (40/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"Jackson\"+39.AsChar+\"s Bay 2000\")\nnzProjections .Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 172 + (43/60) + (37/3600)\ntheLatitude = -43 - (35/60) - (26/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"Mount Pleasant 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSph eroid(#spheroid_grs80)\ntheMeridian = 171 + (21/60) + (38/3600)\ntheLatitude = -43 - (44/60) - (55/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"Gawler 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 171 + (3/60) + (26/3600)\ntheLatitude = -44 - (24/60) - (7/36 00)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"Timaru 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 169 + (28/60) + (3/3600)\ntheLatitude = -44 - (44/60) - (6/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetSc ale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"Lindis Peak 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 168 + (23/60) + (55/3600)\ntheLatitude = -45 - (7/60) - (58/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescr iption(\"Mount Nicholas 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 167 + (44/60) + (19/3600)\ntheLatitude = -45 - (33/60) - (49/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"Mount York 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect. MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 170 + (37/60) + (42/3600)\ntheLatitude = -45 - (48/60) - (58/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"Observation Point 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 170 + (16/ 60) + (57/3600)\ntheLatitude = -45 - (51/60) - (41/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(0.99996)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"North Taieri 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_grs80)\ntheMeridian = 168 + (20/60) + (34/3600)\ntheLatitude = -46 - (36/60) - (0/3600)\nnzgdPrj.SetCentralMeridian(theMerid ian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(400000)\nnzgdPrj.SetFalseNorthing(800000)\nnzgdPrj.SetDescription(\"Bluff 2000\")\nnzProjections.Add(nzgdPrj.Clone)\n'\n'Add UTM/GRS80 zones encompassing New Zealand, Zones 58-60\nfor each zone in {58,59,60}\n utmPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\n utmPrj.SetSpheroid(#spheroid_grs80)\n theMeridian = ((zone * 6) - 183)\n theLatitude = 0\n utmPrj.SetCentralMeridian(theMeridian)\n utmPrj.SetReferenceLatitude( theLatitude)\n utmPrj.SetScale(0.9996)\n utmPrj.SetFalseEasting(500000)\n utmPrj.SetFalseNorthing(10000000)\n utmPrj.FixExtent(Rect.MakeXY(theMeridian-3,-80,theMeridian+3,84))\n utmPrj.SetDescription(\"UTM GRS80 - Zone\"++zone.AsString)\n nzProjections.Add(utmPrj.Clone)\nend\n'\n'Add old North Island yard grid\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_international1909)\nyardSpheroid = nzgdPrj.GetSpheroid\nyardSpheroid.SetUnits(#units_linear_yards)\ntheMeridian = 175 + (30/6 0) + (0/3600)\ntheLatitude = -39 - (0/60) - (0/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(300000)\nnzgdPrj.SetFalseNorthing(400000)\nnzgdPrj.SetDescription(\"North Island National Grid (yard)\")\nnzProjections.Add(nzgdPrj.Clone)\n'\n'Add old South Island yard grid\nnzgdPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\nnzgdPrj.SetSpheroid(#spheroid_international1909)\nyardSpheroid = nzgdPrj.GetSpheroid\nyardSpheroid.SetUnits(#u nits_linear_yards)\ntheMeridian = 171 + (30/60) + (0/3600)\ntheLatitude = -44 - (0/60) - (0/3600)\nnzgdPrj.SetCentralMeridian(theMeridian)\nnzgdPrj.SetReferenceLatitude(theLatitude)\nnzgdPrj.SetScale(1.0000)\nnzgdPrj.SetFalseEasting(500000)\nnzgdPrj.SetFalseNorthing(500000)\nnzgdPrj.SetDescription(\"South Island National Grid (yard)\")\nnzProjections.Add(nzgdPrj.Clone)\n'\nreturn nzCoordSys\n" ) (Script.90 Name: "AAA.NZFromToList" SourceCode: "'Build two lists of Projection names which make sense\n'\n'Returns: List\n'\ntheTheme = SELF\ntheExtent = theTheme.ReturnExtent\n'\ngeogOK = (Rect.MakeXY(160,-60,180,-25).Contains(theExtent))\n'\nnzprjOK = (theExtent.GetRight < 5000000) and\n (theExtent.GetBottom > 5000000)\nutmOK = false\nfor each zone in {58,59,60}\n utmPrj = TrnMerc.Make(Rect.MakeXY(-180,-90,180,90))\n utmPrj.SetSpheroid(#spheroid_grs80)\n theMeridian = ((zone * 6) - 183)\n theLatitude = 0\n utmPrj.SetCentralMeridian(theMeridian)\n utmPrj. SetReferenceLatitude(theLatitude)\n utmPrj.SetScale(0.9996)\n utmPrj.SetFalseEasting(500000)\n utmPrj.SetFalseNorthing(10000000)\n thePoint = theExtent.ReturnCenter.Clone\n utmOK = utmPrj.UnprojectPt(thePoint)\n if (utmOK) then break end\nend\nnzgdOK = (nzprjOK.Not) and\n (theExtent.GetLeft > 200000) and\n (theExtent.GetBottom > 600000)\nyardOK = (nzprjOK.Not) and (Rect.MakeXY(0,0,800000,1000000).Contains(theExtent))\n\n'\n'\nnzCoordSys = av.Run(\"AAA.NZCoordSys\",nil)\nfromList = {} 'possible source projections\n'\nif (nzprjOK) then\n for each nzPrj in nzCoordSys.GetProjections\n if (nzPrj.ReturnDescription = \"*Zealand*\".AsPattern) then\n fromList.Add(nzPrj.ReturnDescription)\n end\n end\nend\n'\nif (nzgdOK) then\n midPoint = theExtent.ReturnCenter\n for each nzPrj in nzCoordSys.GetProjections\n if (nzPrj.ReturnDescription = \"*2000\".AsPattern) then\n prjOrigin = nzPrj.ReturnCentralMeridian@\n nzPrj.ReturnReferenceLatitude\n ok = nzPrj.ProjectPt(prjOrigin)\n ok = (prjO rigin.Distance(midPoint) < 200000)\n if (ok) then\n fromList.Add(nzPrj.ReturnDescription)\n end\n end\n end\nend\n'\nif (utmOK) then\n midPoint = theExtent.ReturnCenter.Clone\n for each nzPrj in nzCoordSys.GetProjections\n if (nzPrj.ReturnDescription = \"UTM*\".AsPattern) then\n testPoint = midPoint.Clone\n ok = nzPrj.UnProjectPt(testPoint)\n if (ok) then\n fromList.Add(nzPrj.ReturnDescription)\n end\n end\n end\nend\n'\nif (yardOK) then\n midPoint = theExtent.ReturnCenter. Clone\n for each nzPrj in nzCoordSys.GetProjections\n if (nzPrj.ReturnDescription = \"*yard*\".AsPattern) then\n testPoint = midPoint.Clone\n ok = nzPrj.UnProjectPt(testPoint)\n if (ok) then\n fromList.Add(nzPrj.ReturnDescription)\n end\n end\n end\nend\n'\n'\nif (geogOK) then\n for each nzPrj in nzCoordSys.GetProjections\n if (nzPrj.ReturnDescription = \"Geographic*\".AsPattern) then\n fromList.Add(nzPrj.ReturnDescription)\n end\n end\nend\n'\ntoList = {}\nfor each nzPrj in nzCoordSys .GetProjections\n if (nzPrj.ReturnDescription <> \"*yard*\".AsPattern) then\n toList.Add(nzPrj.ReturnDescription)\n end\nend\n'\nreturn {fromList,toList}" ) (Script.91 Name: "AAA.NZProjection" SourceCode: "' Project the active FTheme into another New Zealand Projection\n'\n' The source Theme may be 3D but this is strictly speaking only\n' defined for NZGD2000 meridional circuits and UTM/GRS80 data.\n'\n' The projection approach is (for each point in each shape):\n'\n' - unproject to geographic latitude, longitude, height\n' - convert to cartesian x,y,z for the spheroid\n' - convert xyz cartesian coordinates to the new datum (Bursa-Wolf method)\n' - convert to geographic latitude, longitude, height in the ne w datum\n' - project to the new projection\n' - collapse onto sofa and have a cup of tea\n' \n'\nScript.The.SetNumberFormat(\"d.dddddddd\")\ntheView = av.GetActiveDoc\ntheTheme = theView.GetActiveThemes.Get(0)\n'\n'Choose current and output projections\nfromtoList = av.Run(\"AAA.NZFromToList\",theTheme)\nfromList = fromtoList.Get(0) 'reasonable guesses at source projection\ntoList = fromtoList.Get(1) 'possible output projections\ntheDialogue = av.FindDialog(\"NZProjDialogue\")\nfromBox = theDialogue.FindByName(\" fromListBox\")\nfromBox.DefineFromList(fromList)\nfromBox.GoRecord(0)\nfromBox.SelectCurrent(false)\ntoBox = theDialogue.FindByName(\"toListBox\")\ntoBox.DefineFromList(toList)\ntoBox.GoRecord(0)\ntoBox.SelectCurrent(false)\ntheChoices = theDialogue.Open\nif (theChoices = nil) then return nil end\nfromProjectionName = theChoices.Get(0)\ntoProjectionName = theChoices.Get(1) 'may be Geographic Int1909 or GRS80\n'\n'Obtain axes of spheroids\nnzCoordSys = av.Run(\"AAA.NZCoordSys\",nil)\nfromMajAxis = 0\nfromMinAxis = 0\ntoMajAxis = 0\ntoMinAxis = 0\nfor each nzPrj in nzCoordSys.GetProjections\n if (nzPrj.ReturnDescription = fromProjectionName) then\n fromPrj = nzPrj.Clone\n fromMajAxis = nzPrj.GetSpheroid.ReturnRadius\n ecc = nzPrj.GetSpheroid.ReturnEccentricity\n fromMinAxis = ((fromMajAxis^2) * (1 - ecc)).Sqrt\n end\n if (nzPrj.ReturnDescription = toProjectionName) then\n toPrj = nzPrj.Clone\n toMajAxis = nzPrj.GetSpheroid.ReturnRadius\n ecc = nzPrj.GetSpheroid.ReturnEccentricity\n toMinAxis = ((toMajAxis^2) * (1 - ecc )).Sqrt\n end\nend\nfor each ax in {fromMajAxis,fromMinAxis,toMajAxis,toMinAxis}\n if (ax = 0) then\n MsgBox.Error(\"Cannot determine spheroid axes\",\"Error\")\n return nil\n end\nend\n'\n'Now project the Theme\ntheFields = theTheme.GetFTab.GetFields\nfor each fld in theFields\n if (fld.GetName.Count > 10) then\n MsgBox.Error(\"Field name too long:\"++ fld.Getname,\"10 Chars Max\")\n return nil\n end\nend\nnewFields = theFields.DeepClone\nnewList = {}\nfor each f in newFields\n f.SetAlias(theFields.Get(newFields.Find (f)).GetName) 'INFO names allowed\n if (f.IsTypeShape.Not) then\n newList.Add(f)\n end\nend\nnewFields = newList\nwhereCanIPutThis = FileDialog.Put(\"theme1.shp\".AsFileName,\"*.shp\",\n \"Output\"++toPrj.ReturnDescription++\"Shapefile\")\nif(whereCanIPutThis = nil) then return nil end\noutFTab = FTab.MakeNew(whereCanIPutThis,theTheme.GetFTab.GetShapeClass)\noutFTab.AddFields(newFields)\noutFTab.SetEditable(true)\ninFTab = theTheme.GetFTab\nav.ShowMsg(\"Projecting\"++fromProjectionName++\"to\"+ +toProjectionName+\"...\")\nav.SetStatus(0)\ntheCount = inFTab.GetNumRecords\nj = 1\nfor each i in inFTab\n inShape = inFTab.ReturnValue(inFTab.FindField(\"Shape\"),i)\n newRec = outFTab.AddRecord\n '\n 'Set the fields\n for each f in outFTab.GetFields\n if (f.GetName = \"Shape\") then\n newShape = av.Run(\"AAA.ReProjectShape\",{inShape,fromPrj,toPrj})\n if (newShape <> nil) then\n outFTab.SetValue(outFTab.FindField(\"Shape\"),newRec,newShape)\n else\n theClass = inFTab.GetShapeClass\n out FTab.SetValue(outFTab.FindField(\"Shape\"),newRec,theClass.MakeNull)\n end\n else\n inField = inFTab.FindField(f.GetName)\n if (inField.Is(Field).Not) then\n inField = inFTab.FindField(f.GetAlias)\n end\n oldValue = inFTab.ReturnValue(inField,i)\n outFTab.SetValue(f,newRec,oldValue)\n end\n end\n j = j + 1\n av.SetStatus(j / theCount * 100)\nend\noutFTab.SetEditable(false)\nav.ClearMsg\nav.SetStatus(0)\n'\nMsgBox.Info(\"Projection complete\",\"New Zealand Projections\")\n" ) (Script.92 Name: "AAA.NZProjectionUpdate" SourceCode: "'Update script for NZProjection\n'\n'Detects if active FTheme is in a recognised NZ coordinate system\n'\nok = false\n'\ntheView = av.GetActiveDoc\n'\nif (theView.GetProjection.IsNull) then\n if (theView.GetActiveThemes.Count = 1) then\n theTheme = theView.GetActiveThemes.Get(0)\n theExtent = theTheme.ReturnExtent\n if (theTheme.Is(FTheme)) then\n 'nzmgOK = (theExtent.GetRight < 5000000) and\n ' (theExtent.GetBottom > 5000000)\n 'nzgdOK = (nzmgOK.Not) and\n ' (theExtent.GetLeft > 40 0000) and\n ' (theExtent.GetBottom > 800000)\n 'utmOK = (nzmgOK.Not) and (nzgdOK.Not) and\n ' (theExtent.GetLeft > 500000) and\n ' (theExtent.GetTop < 10000000)\n nzmgOK = true\n nzgdOK = true\n utmOK = true\n if (nzmgOK or nzgdOK or utmOK) then\n ok = true\n end\n end\n end\nend\n'\nSELF.SetEnabled (ok)" ) (Script.93 Name: "AAA.ReProjectPoint" SourceCode: "'Project Point\n'\n'\n'SELF: List of Point (may have Z), from projection, to projection\n'\n'Returns: Point or PointZ as appropriate\n'\nScript.The.SetNumberFormat(\"d.dddddddd\")\nthePoint = SELF.Get(0)\nfromPrj = SELF.Get(1).Clone\ntoPrj = SELF.Get(2) 'may be Geographic Int1909 or GRS80\nfromS = fromPrj.GetSpheroid.GetSpheroidName\ntoS = toPrj.GetSpheroid.GetSpheroidName\n'\n'Catch yard conversions\nif (fromPrj.GetSpheroid.GetUnits = #units_linear_yards) then\n fromPrj.GetSpheroid.SetUnits(#units_linear_meter s)\n thePoint.SetX(thePoint.GetX * 36 / 39.37)\n thePoint.SetY(thePoint.GetY * 36 / 39.37)\n if (thePoint.HasZ) then\n thePoint.SetZ(thePoint.GetZ * 36 / 39.37)\n end\nend\n'\nfromA = fromPrj.GetSpheroid.ReturnRadius\necc = fromPrj.GetSpheroid.ReturnEccentricity\nfromB = ((fromA^2) * (1 - ecc)).Sqrt\ntoA = toPrj.GetSpheroid.ReturnRadius\necc = toPrj.GetSpheroid.ReturnEccentricity\ntoB = ((toA^2) * (1 - ecc)).Sqrt\n'\n'\n'get geographic coordinates & height\nok = fromPrj.UnProjectPt(thePoint) \nx = thePoint.GetX\ny = thePoint.GetY\nif (thePoint.HasZ) then\n z = thePoint.GetZ\nelse\n z = 0\nend\n'\n'convert to cartesian\nthePointZ = PointZ.Make(x.AsRadians,y.AsRadians,z)\ncartPointZ = av.Run(\"AAA.MakeCartesian\",{thePointZ,fromA,fromB})\n'\n'convert datum if necessary\nif (fromS <> toS) then\n if ((fromS = \"International 1909\") and (toS = \"GRS 80\")) then\n 'Parameters from LINZ as at July 1999\n dX = 59.47\n dY = 5.04.Negate\n dZ = 187.44\n rX = (0.47/3600).Negate.AsRadians\n rY = (0.10/3600 ).AsRadians\n rZ = (1.024/3600).Negate.AsRadians\n sC = 1 - (4.5993/1000000)\n elseif ((fromS = \"GRS 80\") and (toS = \"International 1909\")) then\n 'reverse above parameters\n dX = 59.47.Negate\n dY = 5.04\n dZ = 187.44.Negate\n rX = (0.47/3600).AsRadians\n rY = (0.10/3600).Negate.AsRadians\n rZ = (1.024/3600).AsRadians\n sc = 1 + (4.5993/1000000)\n else\n MsgBox.Error(\"Unsupported datum shift:\"+nl+\n fromS++\"->\"++toS,\"Exiting\")\n exit\n end\n '\n cartPointZ = av.Run(\" AAA.ConvertDatum\",{cartPointZ,dX,dY,dZ,rX,rY,rZ,sC})\n '\nend\n'\n'convert to geographic\nnewPointZ = av.Run(\"AAA.MakeGeographic\",{cartPointZ,toA,toB})\n'\n'convert to output projection unless Geographic required.\nif (toPrj.ReturnDescription <> \"Geographic*\".AsPattern) then\n ok = toPrj.ProjectPt(newPointZ)\nend\n'\nif (thePoint.HasZ) then\n return newPointZ\nelse\n return newPointZ.GetX@newPointZ.GetY\nend\n" ) (Script.94 Name: "AAA.ReProjectShape" SourceCode: "'Project shapes\n'\n'SELF = inShape,fromPrj,toPrj\n'\n'Returns: Shape\n'\n'\nScript.The.SetNumberFormat(\"d.dddddddd\")\ntheShape = SELF.Get(0)\nfromPrj = SELF.Get(1)\ntoPrj = SELF.Get(2)\n'\nif (theShape.Is(Point)) then\n return av.Run(\"AAA.ReProjectPoint\",{theShape,fromPrj,toPrj})\nelseif ((theShape.Is(Multipoint)) and (theShape.Is(Polyline).Not) and\n (theShape.Is(Polygon).Not)) then\n newList = {}\n for each pt in theShape.AsList\n newPoint = av.Run(\"AAA.ReProjectPoint\",{pt,fromPrj,toPrj})\n newList. Add(newPoint)\n end\n return MultiPoint.Make(newList.DeepClone)\nelseif ((theShape.Is(Polyline)) and (theShape.Is(Polygon).Not)) then\n newListList = {}\n for each ptList in theShape.AsList\n newList = {}\n for each pt in ptList\n newPoint = av.Run(\"AAA.ReProjectPoint\",{pt,fromPrj,toPrj})\n newList.Add(newPoint) \n end\n newListList.Add(newList.DeepClone)\n end\n return Polyline.Make(newListList.DeepClone)\nelseif (theShape.Is(Polygon)) then\n newListList = {}\n for each ptList in theShape.AsLis t\n newList = {}\n for each pt in ptList\n newPoint = av.Run(\"AAA.ReProjectPoint\",{pt,fromPrj,toPrj})\n newList.Add(newPoint) \n end\n newListList.Add(newList.DeepClone)\n end\n return Polygon.Make(newListList.DeepClone)\nelse\n return nil\nend\n\n\n" ) (Script.95 Name: "My Extension Unload" SourceCode: "Dialog.DetachFromExtension(SELF)" ) (Script.96 Name: "My Extension Install" SourceCode: "'DO NOT EDIT!!!\n\nif (av.getproject=nil) then return(nil) end\n\n\ntheDocs = SELF.get(0)\ntheDialogs = SELF.get(1)\ntheControlList = SELF.get(2)\ntheMenuList = SELF.get(3)\ntheToolMenuList=SELF.Get(4)\ntheProject=Av.getproject\n\n\n'Add the Docs\n'\nfor each adoc in theDocs\n theProject.addDoc(adoc)\nend\n\n'Add the Dialogs\n'\nfor each adialog in theDialogs\n theProject.addDialog(adialog)\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 c ontrol\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 thec ontrolset=thescript1.doit(\"\")\n \n 'Add the control to the control set\n theControlSet.Add(theControl,theCindex)\nend\n\n\n'Add the menus\nfor each totalcontrol in theMenuList\n \n 'The Control list\n acontrol=totalControl.get(0)\n mDoc=acontrol.get(0)\n mMenu=acontrol.get(1)\n mMenuItem=acontrol.get(2)\n\n 'The physical control\n theControl = totalControl.get(1)\n \n 'The control Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the 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\"+acontr ol.get(1)\n thescript1=Script.Make(thecommand)\n thecontrolset=av.getproject.findGUI(aControl.get(0)).GetToolBar\n \n 'Add the control to the control set\n theControlSet.Add(theControl,theCindex)\nend\n\n\nav.getproject.setmodified(true)\n\n\n'And the scripts add themselves\n" ) (Script.97 Name: "My Extension Uninstall" SourceCode: "'DO NOT EDIT!!!\n\n'The SELF is the Extension\n\ntheDocs = SELF.get(0)\ntheDialogs = SELF.get(1)\ntheControlList = SELF.get(2)\ntheMenuList = SELF.get(3)\ntheToolMenuList=SELF.get(4)\ntheProject=Av.getproject\n\n\n'Remove the Docs\n'\nfor each adoc in theDocs\n If (theProject.finddoc(adoc.getname)<>NIL) then \n theAnswer=msgbox.yesno(\"Remove the Document \"+adoc.getname+\"?\",\"Remove Document?\",TRUE)\n if (theAnswer=TRUE) then theProject.RemoveDoc(adoc) end\n end\nend\n\n'Remove the Dialogs\n'\nfor each adialog in theDialogs\n the Project.RemoveDialog(adialog.AsString)\nend\n\n'Removethe Controls\n'\nfor each totalControl in theControlList\n 'Get the control list from the Ext\n acontrol=totalControl.get(0)\n \n 'Get the physical Control\n theControl = totalControl.get(1)\n \n 'Get the Controls Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI for the Control\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n 'This sequence finds the appropiate control set\n thecommand=\"av.getproject.findGUI(\"\"\"+aControl.get(0)+\"\"\").Get\"+acontrol.get(1)\n thescript1=Script.Make(thecommand)\n thecontrolset=thescript1.doit(\"\")\n\n 'See if the control is in the set , if so remove it\n if (theControlSet.GetControls.find(theControl)<>NIL) then\n theControlSet.remove(theControl)\n if (thecontrol = \"ToolBar\") then\n theControlSet.selectdefault\n end\n end\nend\n\n\n'Remove the Menus\n'\nfor each totalcontrol in theMenuList\n \n 'The Control list\n acontrol=totalControl.get(0)\n mDoc=acontrol.get(0)\n mMenu=acontrol.get(1)\n mMenuItem=acontrol.get(2)\n\n 'The physical control\n theControl = totalControl.get(1)\n \n 'The control Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot b e found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n theMbar=av.getproject.findGUI(mDoc).GetMenuBar\n themenu=theMbar.findbylabel(mMenu)\n if (themenu=NiL) then\n MsgBox.Warning(\"The menu named \"+mMenu+\" is not here.\",\"Script Eror\")\n 'return(nil)\n else\n \n thething=themenu.getcontrols.find(thecontrol)\n if (thething<>NIL) then \n themenu.remove(thecontrol) \n end\n 'msgbox.info(themenu.GetControls.count.asstring,\"\")\n if (themenu.GetControls.count<1) th en\n theMbar.remove(themenu)\n end\n end\nend\n \nfor each totalControl in theToolMenuList\n 'Get the control list from the Ext\n acontrol=totalControl.get(0)\n \n 'Get the physical Control\n theControl = totalControl.get(1)\n \n 'Get the Controls Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI for the Control\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current pr oject.\",\"Script Eror\")\n return(nil)\n end\n \n 'This sequence finds the appropiate control set\n thecontrolset=av.getproject.findGUI(aControl.get(0)).GetToolBar\n\n \n 'See if the control is in the set , if so remove it\n if (theControlSet.GetControls.find(theControl)<>NIL) then\n \n theControlSet.remove(theControl)\n theControlSet.selectdefault\n end\n\nend\n \n\n'And the scripts delete themselves\n\n\nav.getproject.setmodified(true)\n" )