├── CoordConvert.sln ├── CoordConvert.suo ├── CoordConvert ├── CalFourPara.Designer.cs ├── CalFourPara.cs ├── CalFourPara.resx ├── CoordConvert.cs ├── CoordConvertApp.csproj ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── Test.cs ├── bin │ └── Debug │ │ ├── CoordConvert.dll │ │ ├── CoordConvert.pdb │ │ ├── CoordConvert.vshost.exe.manifest │ │ ├── CoordConvertApp.exe │ │ ├── CoordConvertApp.pdb │ │ ├── CoordConvertApp.vshost.exe │ │ └── CoordConvertApp.vshost.exe.manifest └── obj │ └── x86 │ └── Debug │ ├── CoordConvertApp.CalFourPara.resources │ ├── CoordConvertApp.csproj.FileListAbsolute.txt │ ├── CoordConvertApp.exe │ ├── CoordConvertApp.pdb │ ├── DesignTimeResolveAssemblyReferences.cache │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ ├── GenerateResource.read.1.tlog │ ├── GenerateResource.write.1.tlog │ └── ResolveAssemblyReference.cache ├── CoordConvertDLL ├── CoordConsts.cs ├── CoordConvertDLL.csproj ├── CoordinateSystem │ ├── BLHCoordinate.cs │ ├── Datum.cs │ └── XYZCoordinate.cs ├── FourPara.cs ├── GaussProjection.cs ├── MatrixLib.cs ├── Para4.cs ├── Para7.cs ├── Properties │ └── AssemblyInfo.cs ├── SevenPara.cs ├── XYZetBLH.cs ├── bin │ └── Debug │ │ ├── CoordConvert.dll │ │ └── CoordConvert.pdb └── obj │ └── Debug │ ├── CoordConvert.dll │ ├── CoordConvert.pdb │ ├── CoordConvertDLL.csproj.FileListAbsolute.txt │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ └── ResolveAssemblyReference.cache └── README.md /CoordConvert.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoordConvertApp", "CoordConvert\CoordConvertApp.csproj", "{A431CFAA-AAFF-4D72-A163-25CA4C275220}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoordConvertDLL", "CoordConvertDLL\CoordConvertDLL.csproj", "{0705D465-925A-497B-9386-1BFE32C2B88D}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|Mixed Platforms = Debug|Mixed Platforms 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|Mixed Platforms = Release|Mixed Platforms 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {A431CFAA-AAFF-4D72-A163-25CA4C275220}.Debug|Any CPU.ActiveCfg = Debug|x86 19 | {A431CFAA-AAFF-4D72-A163-25CA4C275220}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 20 | {A431CFAA-AAFF-4D72-A163-25CA4C275220}.Debug|Mixed Platforms.Build.0 = Debug|x86 21 | {A431CFAA-AAFF-4D72-A163-25CA4C275220}.Debug|x86.ActiveCfg = Debug|x86 22 | {A431CFAA-AAFF-4D72-A163-25CA4C275220}.Debug|x86.Build.0 = Debug|x86 23 | {A431CFAA-AAFF-4D72-A163-25CA4C275220}.Release|Any CPU.ActiveCfg = Release|x86 24 | {A431CFAA-AAFF-4D72-A163-25CA4C275220}.Release|Mixed Platforms.ActiveCfg = Release|x86 25 | {A431CFAA-AAFF-4D72-A163-25CA4C275220}.Release|Mixed Platforms.Build.0 = Release|x86 26 | {A431CFAA-AAFF-4D72-A163-25CA4C275220}.Release|x86.ActiveCfg = Release|x86 27 | {A431CFAA-AAFF-4D72-A163-25CA4C275220}.Release|x86.Build.0 = Release|x86 28 | {0705D465-925A-497B-9386-1BFE32C2B88D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {0705D465-925A-497B-9386-1BFE32C2B88D}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {0705D465-925A-497B-9386-1BFE32C2B88D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 31 | {0705D465-925A-497B-9386-1BFE32C2B88D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 32 | {0705D465-925A-497B-9386-1BFE32C2B88D}.Debug|x86.ActiveCfg = Debug|Any CPU 33 | {0705D465-925A-497B-9386-1BFE32C2B88D}.Release|Any CPU.ActiveCfg = Release|Any CPU 34 | {0705D465-925A-497B-9386-1BFE32C2B88D}.Release|Any CPU.Build.0 = Release|Any CPU 35 | {0705D465-925A-497B-9386-1BFE32C2B88D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 36 | {0705D465-925A-497B-9386-1BFE32C2B88D}.Release|Mixed Platforms.Build.0 = Release|Any CPU 37 | {0705D465-925A-497B-9386-1BFE32C2B88D}.Release|x86.ActiveCfg = Release|Any CPU 38 | EndGlobalSection 39 | GlobalSection(SolutionProperties) = preSolution 40 | HideSolutionNode = FALSE 41 | EndGlobalSection 42 | EndGlobal 43 | -------------------------------------------------------------------------------- /CoordConvert.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NewMapper/CoordConvert/f0fab366a1a6c0090417061a605f14f48904ecba/CoordConvert.suo -------------------------------------------------------------------------------- /CoordConvert/CalFourPara.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace CoordConvertApp 2 | { 3 | partial class CalFourPara 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.groupBox1 = new System.Windows.Forms.GroupBox(); 32 | this.txtL6 = new System.Windows.Forms.TextBox(); 33 | this.txtB6 = new System.Windows.Forms.TextBox(); 34 | this.label15 = new System.Windows.Forms.Label(); 35 | this.txtL5 = new System.Windows.Forms.TextBox(); 36 | this.txtB5 = new System.Windows.Forms.TextBox(); 37 | this.label7 = new System.Windows.Forms.Label(); 38 | this.txtL4 = new System.Windows.Forms.TextBox(); 39 | this.txtB4 = new System.Windows.Forms.TextBox(); 40 | this.label6 = new System.Windows.Forms.Label(); 41 | this.txtL3 = new System.Windows.Forms.TextBox(); 42 | this.txtB3 = new System.Windows.Forms.TextBox(); 43 | this.label5 = new System.Windows.Forms.Label(); 44 | this.txtL2 = new System.Windows.Forms.TextBox(); 45 | this.txtB2 = new System.Windows.Forms.TextBox(); 46 | this.label4 = new System.Windows.Forms.Label(); 47 | this.label3 = new System.Windows.Forms.Label(); 48 | this.txtL1 = new System.Windows.Forms.TextBox(); 49 | this.label2 = new System.Windows.Forms.Label(); 50 | this.txtB1 = new System.Windows.Forms.TextBox(); 51 | this.label1 = new System.Windows.Forms.Label(); 52 | this.txtPtNum = new System.Windows.Forms.TextBox(); 53 | this.label17 = new System.Windows.Forms.Label(); 54 | this.btnCal = new System.Windows.Forms.Button(); 55 | this.groupBox3 = new System.Windows.Forms.GroupBox(); 56 | this.txtLon = new System.Windows.Forms.TextBox(); 57 | this.label22 = new System.Windows.Forms.Label(); 58 | this.txtS = new System.Windows.Forms.TextBox(); 59 | this.label21 = new System.Windows.Forms.Label(); 60 | this.txtAx = new System.Windows.Forms.TextBox(); 61 | this.label20 = new System.Windows.Forms.Label(); 62 | this.txtDeltaY = new System.Windows.Forms.TextBox(); 63 | this.label19 = new System.Windows.Forms.Label(); 64 | this.txtDeltaX = new System.Windows.Forms.TextBox(); 65 | this.label18 = new System.Windows.Forms.Label(); 66 | this.groupBox2 = new System.Windows.Forms.GroupBox(); 67 | this.txtY6 = new System.Windows.Forms.TextBox(); 68 | this.txtX6 = new System.Windows.Forms.TextBox(); 69 | this.label8 = new System.Windows.Forms.Label(); 70 | this.txtY5 = new System.Windows.Forms.TextBox(); 71 | this.txtX5 = new System.Windows.Forms.TextBox(); 72 | this.label9 = new System.Windows.Forms.Label(); 73 | this.txtY4 = new System.Windows.Forms.TextBox(); 74 | this.txtX4 = new System.Windows.Forms.TextBox(); 75 | this.label10 = new System.Windows.Forms.Label(); 76 | this.txtY3 = new System.Windows.Forms.TextBox(); 77 | this.txtX3 = new System.Windows.Forms.TextBox(); 78 | this.label11 = new System.Windows.Forms.Label(); 79 | this.txtY2 = new System.Windows.Forms.TextBox(); 80 | this.txtX2 = new System.Windows.Forms.TextBox(); 81 | this.label12 = new System.Windows.Forms.Label(); 82 | this.label13 = new System.Windows.Forms.Label(); 83 | this.txtY1 = new System.Windows.Forms.TextBox(); 84 | this.label14 = new System.Windows.Forms.Label(); 85 | this.txtX1 = new System.Windows.Forms.TextBox(); 86 | this.label16 = new System.Windows.Forms.Label(); 87 | this.label23 = new System.Windows.Forms.Label(); 88 | this.groupBox1.SuspendLayout(); 89 | this.groupBox3.SuspendLayout(); 90 | this.groupBox2.SuspendLayout(); 91 | this.SuspendLayout(); 92 | // 93 | // groupBox1 94 | // 95 | this.groupBox1.Controls.Add(this.txtL6); 96 | this.groupBox1.Controls.Add(this.txtB6); 97 | this.groupBox1.Controls.Add(this.label15); 98 | this.groupBox1.Controls.Add(this.txtL5); 99 | this.groupBox1.Controls.Add(this.txtB5); 100 | this.groupBox1.Controls.Add(this.label7); 101 | this.groupBox1.Controls.Add(this.txtL4); 102 | this.groupBox1.Controls.Add(this.txtB4); 103 | this.groupBox1.Controls.Add(this.label6); 104 | this.groupBox1.Controls.Add(this.txtL3); 105 | this.groupBox1.Controls.Add(this.txtB3); 106 | this.groupBox1.Controls.Add(this.label5); 107 | this.groupBox1.Controls.Add(this.txtL2); 108 | this.groupBox1.Controls.Add(this.txtB2); 109 | this.groupBox1.Controls.Add(this.label4); 110 | this.groupBox1.Controls.Add(this.label3); 111 | this.groupBox1.Controls.Add(this.txtL1); 112 | this.groupBox1.Controls.Add(this.label2); 113 | this.groupBox1.Controls.Add(this.txtB1); 114 | this.groupBox1.Controls.Add(this.label1); 115 | this.groupBox1.Location = new System.Drawing.Point(21, 12); 116 | this.groupBox1.Name = "groupBox1"; 117 | this.groupBox1.Size = new System.Drawing.Size(375, 268); 118 | this.groupBox1.TabIndex = 0; 119 | this.groupBox1.TabStop = false; 120 | this.groupBox1.Text = "WGS84经纬度坐标"; 121 | // 122 | // txtL6 123 | // 124 | this.txtL6.Location = new System.Drawing.Point(246, 229); 125 | this.txtL6.Name = "txtL6"; 126 | this.txtL6.Size = new System.Drawing.Size(100, 21); 127 | this.txtL6.TabIndex = 19; 128 | // 129 | // txtB6 130 | // 131 | this.txtB6.Location = new System.Drawing.Point(93, 229); 132 | this.txtB6.Name = "txtB6"; 133 | this.txtB6.Size = new System.Drawing.Size(100, 21); 134 | this.txtB6.TabIndex = 18; 135 | // 136 | // label15 137 | // 138 | this.label15.AutoSize = true; 139 | this.label15.Location = new System.Drawing.Point(16, 232); 140 | this.label15.Name = "label15"; 141 | this.label15.Size = new System.Drawing.Size(47, 12); 142 | this.label15.TabIndex = 17; 143 | this.label15.Text = "6号点:"; 144 | // 145 | // txtL5 146 | // 147 | this.txtL5.Location = new System.Drawing.Point(246, 191); 148 | this.txtL5.Name = "txtL5"; 149 | this.txtL5.Size = new System.Drawing.Size(100, 21); 150 | this.txtL5.TabIndex = 16; 151 | // 152 | // txtB5 153 | // 154 | this.txtB5.Location = new System.Drawing.Point(93, 191); 155 | this.txtB5.Name = "txtB5"; 156 | this.txtB5.Size = new System.Drawing.Size(100, 21); 157 | this.txtB5.TabIndex = 15; 158 | // 159 | // label7 160 | // 161 | this.label7.AutoSize = true; 162 | this.label7.Location = new System.Drawing.Point(16, 194); 163 | this.label7.Name = "label7"; 164 | this.label7.Size = new System.Drawing.Size(47, 12); 165 | this.label7.TabIndex = 14; 166 | this.label7.Text = "5号点:"; 167 | // 168 | // txtL4 169 | // 170 | this.txtL4.Location = new System.Drawing.Point(246, 153); 171 | this.txtL4.Name = "txtL4"; 172 | this.txtL4.Size = new System.Drawing.Size(100, 21); 173 | this.txtL4.TabIndex = 13; 174 | // 175 | // txtB4 176 | // 177 | this.txtB4.Location = new System.Drawing.Point(93, 153); 178 | this.txtB4.Name = "txtB4"; 179 | this.txtB4.Size = new System.Drawing.Size(100, 21); 180 | this.txtB4.TabIndex = 12; 181 | // 182 | // label6 183 | // 184 | this.label6.AutoSize = true; 185 | this.label6.Location = new System.Drawing.Point(16, 156); 186 | this.label6.Name = "label6"; 187 | this.label6.Size = new System.Drawing.Size(47, 12); 188 | this.label6.TabIndex = 11; 189 | this.label6.Text = "4号点:"; 190 | // 191 | // txtL3 192 | // 193 | this.txtL3.Location = new System.Drawing.Point(246, 115); 194 | this.txtL3.Name = "txtL3"; 195 | this.txtL3.Size = new System.Drawing.Size(100, 21); 196 | this.txtL3.TabIndex = 10; 197 | // 198 | // txtB3 199 | // 200 | this.txtB3.Location = new System.Drawing.Point(93, 115); 201 | this.txtB3.Name = "txtB3"; 202 | this.txtB3.Size = new System.Drawing.Size(100, 21); 203 | this.txtB3.TabIndex = 9; 204 | // 205 | // label5 206 | // 207 | this.label5.AutoSize = true; 208 | this.label5.Location = new System.Drawing.Point(16, 118); 209 | this.label5.Name = "label5"; 210 | this.label5.Size = new System.Drawing.Size(47, 12); 211 | this.label5.TabIndex = 8; 212 | this.label5.Text = "3号点:"; 213 | // 214 | // txtL2 215 | // 216 | this.txtL2.Location = new System.Drawing.Point(246, 77); 217 | this.txtL2.Name = "txtL2"; 218 | this.txtL2.Size = new System.Drawing.Size(100, 21); 219 | this.txtL2.TabIndex = 7; 220 | // 221 | // txtB2 222 | // 223 | this.txtB2.Location = new System.Drawing.Point(93, 77); 224 | this.txtB2.Name = "txtB2"; 225 | this.txtB2.Size = new System.Drawing.Size(100, 21); 226 | this.txtB2.TabIndex = 6; 227 | // 228 | // label4 229 | // 230 | this.label4.AutoSize = true; 231 | this.label4.Location = new System.Drawing.Point(16, 80); 232 | this.label4.Name = "label4"; 233 | this.label4.Size = new System.Drawing.Size(47, 12); 234 | this.label4.TabIndex = 5; 235 | this.label4.Text = "2号点:"; 236 | // 237 | // label3 238 | // 239 | this.label3.AutoSize = true; 240 | this.label3.Location = new System.Drawing.Point(281, 17); 241 | this.label3.Name = "label3"; 242 | this.label3.Size = new System.Drawing.Size(29, 12); 243 | this.label3.TabIndex = 4; 244 | this.label3.Text = "经度"; 245 | // 246 | // txtL1 247 | // 248 | this.txtL1.Location = new System.Drawing.Point(246, 39); 249 | this.txtL1.Name = "txtL1"; 250 | this.txtL1.Size = new System.Drawing.Size(100, 21); 251 | this.txtL1.TabIndex = 3; 252 | // 253 | // label2 254 | // 255 | this.label2.AutoSize = true; 256 | this.label2.Location = new System.Drawing.Point(126, 17); 257 | this.label2.Name = "label2"; 258 | this.label2.Size = new System.Drawing.Size(29, 12); 259 | this.label2.TabIndex = 2; 260 | this.label2.Text = "纬度"; 261 | // 262 | // txtB1 263 | // 264 | this.txtB1.Location = new System.Drawing.Point(93, 39); 265 | this.txtB1.Name = "txtB1"; 266 | this.txtB1.Size = new System.Drawing.Size(100, 21); 267 | this.txtB1.TabIndex = 1; 268 | // 269 | // label1 270 | // 271 | this.label1.AutoSize = true; 272 | this.label1.Location = new System.Drawing.Point(16, 42); 273 | this.label1.Name = "label1"; 274 | this.label1.Size = new System.Drawing.Size(47, 12); 275 | this.label1.TabIndex = 0; 276 | this.label1.Text = "1号点:"; 277 | // 278 | // txtPtNum 279 | // 280 | this.txtPtNum.Location = new System.Drawing.Point(114, 369); 281 | this.txtPtNum.Name = "txtPtNum"; 282 | this.txtPtNum.Size = new System.Drawing.Size(100, 21); 283 | this.txtPtNum.TabIndex = 20; 284 | // 285 | // label17 286 | // 287 | this.label17.AutoSize = true; 288 | this.label17.Location = new System.Drawing.Point(19, 372); 289 | this.label17.Name = "label17"; 290 | this.label17.Size = new System.Drawing.Size(77, 12); 291 | this.label17.TabIndex = 19; 292 | this.label17.Text = "控制点个数:"; 293 | // 294 | // btnCal 295 | // 296 | this.btnCal.Location = new System.Drawing.Point(267, 367); 297 | this.btnCal.Name = "btnCal"; 298 | this.btnCal.Size = new System.Drawing.Size(75, 23); 299 | this.btnCal.TabIndex = 21; 300 | this.btnCal.Text = "计 算"; 301 | this.btnCal.UseVisualStyleBackColor = true; 302 | this.btnCal.Click += new System.EventHandler(this.btnCal_Click); 303 | // 304 | // groupBox3 305 | // 306 | this.groupBox3.Controls.Add(this.txtLon); 307 | this.groupBox3.Controls.Add(this.label22); 308 | this.groupBox3.Controls.Add(this.txtS); 309 | this.groupBox3.Controls.Add(this.label21); 310 | this.groupBox3.Controls.Add(this.txtAx); 311 | this.groupBox3.Controls.Add(this.label20); 312 | this.groupBox3.Controls.Add(this.txtDeltaY); 313 | this.groupBox3.Controls.Add(this.label19); 314 | this.groupBox3.Controls.Add(this.txtDeltaX); 315 | this.groupBox3.Controls.Add(this.label18); 316 | this.groupBox3.Location = new System.Drawing.Point(415, 304); 317 | this.groupBox3.Name = "groupBox3"; 318 | this.groupBox3.Size = new System.Drawing.Size(375, 136); 319 | this.groupBox3.TabIndex = 22; 320 | this.groupBox3.TabStop = false; 321 | this.groupBox3.Text = "中央经线及四参数"; 322 | // 323 | // txtLon 324 | // 325 | this.txtLon.Location = new System.Drawing.Point(93, 23); 326 | this.txtLon.Name = "txtLon"; 327 | this.txtLon.ReadOnly = true; 328 | this.txtLon.Size = new System.Drawing.Size(100, 21); 329 | this.txtLon.TabIndex = 30; 330 | // 331 | // label22 332 | // 333 | this.label22.AutoSize = true; 334 | this.label22.Location = new System.Drawing.Point(34, 26); 335 | this.label22.Name = "label22"; 336 | this.label22.Size = new System.Drawing.Size(29, 12); 337 | this.label22.TabIndex = 29; 338 | this.label22.Text = "Lon:"; 339 | // 340 | // txtS 341 | // 342 | this.txtS.Location = new System.Drawing.Point(93, 103); 343 | this.txtS.Name = "txtS"; 344 | this.txtS.ReadOnly = true; 345 | this.txtS.Size = new System.Drawing.Size(100, 21); 346 | this.txtS.TabIndex = 28; 347 | // 348 | // label21 349 | // 350 | this.label21.AutoSize = true; 351 | this.label21.Location = new System.Drawing.Point(46, 106); 352 | this.label21.Name = "label21"; 353 | this.label21.Size = new System.Drawing.Size(17, 12); 354 | this.label21.TabIndex = 27; 355 | this.label21.Text = "S:"; 356 | // 357 | // txtAx 358 | // 359 | this.txtAx.Location = new System.Drawing.Point(246, 65); 360 | this.txtAx.Name = "txtAx"; 361 | this.txtAx.ReadOnly = true; 362 | this.txtAx.Size = new System.Drawing.Size(100, 21); 363 | this.txtAx.TabIndex = 26; 364 | // 365 | // label20 366 | // 367 | this.label20.AutoSize = true; 368 | this.label20.Location = new System.Drawing.Point(223, 68); 369 | this.label20.Name = "label20"; 370 | this.label20.Size = new System.Drawing.Size(23, 12); 371 | this.label20.TabIndex = 25; 372 | this.label20.Text = "Ax:"; 373 | // 374 | // txtDeltaY 375 | // 376 | this.txtDeltaY.Location = new System.Drawing.Point(93, 65); 377 | this.txtDeltaY.Name = "txtDeltaY"; 378 | this.txtDeltaY.ReadOnly = true; 379 | this.txtDeltaY.Size = new System.Drawing.Size(100, 21); 380 | this.txtDeltaY.TabIndex = 24; 381 | // 382 | // label19 383 | // 384 | this.label19.AutoSize = true; 385 | this.label19.Location = new System.Drawing.Point(16, 68); 386 | this.label19.Name = "label19"; 387 | this.label19.Size = new System.Drawing.Size(47, 12); 388 | this.label19.TabIndex = 23; 389 | this.label19.Text = "deltaY:"; 390 | // 391 | // txtDeltaX 392 | // 393 | this.txtDeltaX.Location = new System.Drawing.Point(246, 23); 394 | this.txtDeltaX.Name = "txtDeltaX"; 395 | this.txtDeltaX.ReadOnly = true; 396 | this.txtDeltaX.Size = new System.Drawing.Size(100, 21); 397 | this.txtDeltaX.TabIndex = 22; 398 | // 399 | // label18 400 | // 401 | this.label18.AutoSize = true; 402 | this.label18.Location = new System.Drawing.Point(199, 26); 403 | this.label18.Name = "label18"; 404 | this.label18.Size = new System.Drawing.Size(47, 12); 405 | this.label18.TabIndex = 21; 406 | this.label18.Text = "deltaX:"; 407 | // 408 | // groupBox2 409 | // 410 | this.groupBox2.Controls.Add(this.txtY6); 411 | this.groupBox2.Controls.Add(this.txtX6); 412 | this.groupBox2.Controls.Add(this.label8); 413 | this.groupBox2.Controls.Add(this.txtY5); 414 | this.groupBox2.Controls.Add(this.txtX5); 415 | this.groupBox2.Controls.Add(this.label9); 416 | this.groupBox2.Controls.Add(this.txtY4); 417 | this.groupBox2.Controls.Add(this.txtX4); 418 | this.groupBox2.Controls.Add(this.label10); 419 | this.groupBox2.Controls.Add(this.txtY3); 420 | this.groupBox2.Controls.Add(this.txtX3); 421 | this.groupBox2.Controls.Add(this.label11); 422 | this.groupBox2.Controls.Add(this.txtY2); 423 | this.groupBox2.Controls.Add(this.txtX2); 424 | this.groupBox2.Controls.Add(this.label12); 425 | this.groupBox2.Controls.Add(this.label13); 426 | this.groupBox2.Controls.Add(this.txtY1); 427 | this.groupBox2.Controls.Add(this.label14); 428 | this.groupBox2.Controls.Add(this.txtX1); 429 | this.groupBox2.Controls.Add(this.label16); 430 | this.groupBox2.Location = new System.Drawing.Point(415, 12); 431 | this.groupBox2.Name = "groupBox2"; 432 | this.groupBox2.Size = new System.Drawing.Size(375, 268); 433 | this.groupBox2.TabIndex = 23; 434 | this.groupBox2.TabStop = false; 435 | this.groupBox2.Text = "当地平面坐标"; 436 | // 437 | // txtY6 438 | // 439 | this.txtY6.Location = new System.Drawing.Point(246, 229); 440 | this.txtY6.Name = "txtY6"; 441 | this.txtY6.Size = new System.Drawing.Size(100, 21); 442 | this.txtY6.TabIndex = 19; 443 | // 444 | // txtX6 445 | // 446 | this.txtX6.Location = new System.Drawing.Point(93, 229); 447 | this.txtX6.Name = "txtX6"; 448 | this.txtX6.Size = new System.Drawing.Size(100, 21); 449 | this.txtX6.TabIndex = 18; 450 | // 451 | // label8 452 | // 453 | this.label8.AutoSize = true; 454 | this.label8.Location = new System.Drawing.Point(16, 232); 455 | this.label8.Name = "label8"; 456 | this.label8.Size = new System.Drawing.Size(47, 12); 457 | this.label8.TabIndex = 17; 458 | this.label8.Text = "6号点:"; 459 | // 460 | // txtY5 461 | // 462 | this.txtY5.Location = new System.Drawing.Point(246, 191); 463 | this.txtY5.Name = "txtY5"; 464 | this.txtY5.Size = new System.Drawing.Size(100, 21); 465 | this.txtY5.TabIndex = 16; 466 | // 467 | // txtX5 468 | // 469 | this.txtX5.Location = new System.Drawing.Point(93, 191); 470 | this.txtX5.Name = "txtX5"; 471 | this.txtX5.Size = new System.Drawing.Size(100, 21); 472 | this.txtX5.TabIndex = 15; 473 | // 474 | // label9 475 | // 476 | this.label9.AutoSize = true; 477 | this.label9.Location = new System.Drawing.Point(16, 194); 478 | this.label9.Name = "label9"; 479 | this.label9.Size = new System.Drawing.Size(47, 12); 480 | this.label9.TabIndex = 14; 481 | this.label9.Text = "5号点:"; 482 | // 483 | // txtY4 484 | // 485 | this.txtY4.Location = new System.Drawing.Point(246, 153); 486 | this.txtY4.Name = "txtY4"; 487 | this.txtY4.Size = new System.Drawing.Size(100, 21); 488 | this.txtY4.TabIndex = 13; 489 | // 490 | // txtX4 491 | // 492 | this.txtX4.Location = new System.Drawing.Point(93, 153); 493 | this.txtX4.Name = "txtX4"; 494 | this.txtX4.Size = new System.Drawing.Size(100, 21); 495 | this.txtX4.TabIndex = 12; 496 | // 497 | // label10 498 | // 499 | this.label10.AutoSize = true; 500 | this.label10.Location = new System.Drawing.Point(16, 156); 501 | this.label10.Name = "label10"; 502 | this.label10.Size = new System.Drawing.Size(47, 12); 503 | this.label10.TabIndex = 11; 504 | this.label10.Text = "4号点:"; 505 | // 506 | // txtY3 507 | // 508 | this.txtY3.Location = new System.Drawing.Point(246, 115); 509 | this.txtY3.Name = "txtY3"; 510 | this.txtY3.Size = new System.Drawing.Size(100, 21); 511 | this.txtY3.TabIndex = 10; 512 | // 513 | // txtX3 514 | // 515 | this.txtX3.Location = new System.Drawing.Point(93, 115); 516 | this.txtX3.Name = "txtX3"; 517 | this.txtX3.Size = new System.Drawing.Size(100, 21); 518 | this.txtX3.TabIndex = 9; 519 | // 520 | // label11 521 | // 522 | this.label11.AutoSize = true; 523 | this.label11.Location = new System.Drawing.Point(16, 118); 524 | this.label11.Name = "label11"; 525 | this.label11.Size = new System.Drawing.Size(47, 12); 526 | this.label11.TabIndex = 8; 527 | this.label11.Text = "3号点:"; 528 | // 529 | // txtY2 530 | // 531 | this.txtY2.Location = new System.Drawing.Point(246, 77); 532 | this.txtY2.Name = "txtY2"; 533 | this.txtY2.Size = new System.Drawing.Size(100, 21); 534 | this.txtY2.TabIndex = 7; 535 | // 536 | // txtX2 537 | // 538 | this.txtX2.Location = new System.Drawing.Point(93, 77); 539 | this.txtX2.Name = "txtX2"; 540 | this.txtX2.Size = new System.Drawing.Size(100, 21); 541 | this.txtX2.TabIndex = 6; 542 | // 543 | // label12 544 | // 545 | this.label12.AutoSize = true; 546 | this.label12.Location = new System.Drawing.Point(16, 80); 547 | this.label12.Name = "label12"; 548 | this.label12.Size = new System.Drawing.Size(47, 12); 549 | this.label12.TabIndex = 5; 550 | this.label12.Text = "2号点:"; 551 | // 552 | // label13 553 | // 554 | this.label13.AutoSize = true; 555 | this.label13.Location = new System.Drawing.Point(286, 17); 556 | this.label13.Name = "label13"; 557 | this.label13.Size = new System.Drawing.Size(11, 12); 558 | this.label13.TabIndex = 4; 559 | this.label13.Text = "Y"; 560 | // 561 | // txtY1 562 | // 563 | this.txtY1.Location = new System.Drawing.Point(246, 39); 564 | this.txtY1.Name = "txtY1"; 565 | this.txtY1.Size = new System.Drawing.Size(100, 21); 566 | this.txtY1.TabIndex = 3; 567 | // 568 | // label14 569 | // 570 | this.label14.AutoSize = true; 571 | this.label14.Location = new System.Drawing.Point(136, 17); 572 | this.label14.Name = "label14"; 573 | this.label14.Size = new System.Drawing.Size(11, 12); 574 | this.label14.TabIndex = 2; 575 | this.label14.Text = "X"; 576 | // 577 | // txtX1 578 | // 579 | this.txtX1.Location = new System.Drawing.Point(93, 39); 580 | this.txtX1.Name = "txtX1"; 581 | this.txtX1.Size = new System.Drawing.Size(100, 21); 582 | this.txtX1.TabIndex = 1; 583 | // 584 | // label16 585 | // 586 | this.label16.AutoSize = true; 587 | this.label16.Location = new System.Drawing.Point(16, 42); 588 | this.label16.Name = "label16"; 589 | this.label16.Size = new System.Drawing.Size(47, 12); 590 | this.label16.TabIndex = 0; 591 | this.label16.Text = "1号点:"; 592 | // 593 | // label23 594 | // 595 | this.label23.AutoSize = true; 596 | this.label23.ForeColor = System.Drawing.Color.Red; 597 | this.label23.Location = new System.Drawing.Point(19, 304); 598 | this.label23.Name = "label23"; 599 | this.label23.Size = new System.Drawing.Size(287, 36); 600 | this.label23.TabIndex = 24; 601 | this.label23.Text = "说明:至少2个控制点,X是横轴坐标,Y是竖轴坐标,\r\n \r\n 计算结果会显示在右侧"; 602 | // 603 | // CalFourPara 604 | // 605 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 606 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 607 | this.ClientSize = new System.Drawing.Size(810, 461); 608 | this.Controls.Add(this.label23); 609 | this.Controls.Add(this.groupBox2); 610 | this.Controls.Add(this.groupBox3); 611 | this.Controls.Add(this.btnCal); 612 | this.Controls.Add(this.txtPtNum); 613 | this.Controls.Add(this.label17); 614 | this.Controls.Add(this.groupBox1); 615 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; 616 | this.MaximizeBox = false; 617 | this.Name = "CalFourPara"; 618 | this.Text = "计算四参数"; 619 | this.groupBox1.ResumeLayout(false); 620 | this.groupBox1.PerformLayout(); 621 | this.groupBox3.ResumeLayout(false); 622 | this.groupBox3.PerformLayout(); 623 | this.groupBox2.ResumeLayout(false); 624 | this.groupBox2.PerformLayout(); 625 | this.ResumeLayout(false); 626 | this.PerformLayout(); 627 | 628 | } 629 | 630 | #endregion 631 | 632 | private System.Windows.Forms.GroupBox groupBox1; 633 | private System.Windows.Forms.TextBox txtL5; 634 | private System.Windows.Forms.TextBox txtB5; 635 | private System.Windows.Forms.Label label7; 636 | private System.Windows.Forms.TextBox txtL4; 637 | private System.Windows.Forms.TextBox txtB4; 638 | private System.Windows.Forms.Label label6; 639 | private System.Windows.Forms.TextBox txtL3; 640 | private System.Windows.Forms.TextBox txtB3; 641 | private System.Windows.Forms.Label label5; 642 | private System.Windows.Forms.TextBox txtL2; 643 | private System.Windows.Forms.TextBox txtB2; 644 | private System.Windows.Forms.Label label4; 645 | private System.Windows.Forms.Label label3; 646 | private System.Windows.Forms.TextBox txtL1; 647 | private System.Windows.Forms.Label label2; 648 | private System.Windows.Forms.TextBox txtB1; 649 | private System.Windows.Forms.Label label1; 650 | private System.Windows.Forms.TextBox txtL6; 651 | private System.Windows.Forms.TextBox txtB6; 652 | private System.Windows.Forms.Label label15; 653 | private System.Windows.Forms.TextBox txtPtNum; 654 | private System.Windows.Forms.Label label17; 655 | private System.Windows.Forms.Button btnCal; 656 | private System.Windows.Forms.GroupBox groupBox3; 657 | private System.Windows.Forms.TextBox txtS; 658 | private System.Windows.Forms.Label label21; 659 | private System.Windows.Forms.TextBox txtAx; 660 | private System.Windows.Forms.Label label20; 661 | private System.Windows.Forms.TextBox txtDeltaY; 662 | private System.Windows.Forms.Label label19; 663 | private System.Windows.Forms.TextBox txtDeltaX; 664 | private System.Windows.Forms.Label label18; 665 | private System.Windows.Forms.TextBox txtLon; 666 | private System.Windows.Forms.Label label22; 667 | private System.Windows.Forms.GroupBox groupBox2; 668 | private System.Windows.Forms.TextBox txtY6; 669 | private System.Windows.Forms.TextBox txtX6; 670 | private System.Windows.Forms.Label label8; 671 | private System.Windows.Forms.TextBox txtY5; 672 | private System.Windows.Forms.TextBox txtX5; 673 | private System.Windows.Forms.Label label9; 674 | private System.Windows.Forms.TextBox txtY4; 675 | private System.Windows.Forms.TextBox txtX4; 676 | private System.Windows.Forms.Label label10; 677 | private System.Windows.Forms.TextBox txtY3; 678 | private System.Windows.Forms.TextBox txtX3; 679 | private System.Windows.Forms.Label label11; 680 | private System.Windows.Forms.TextBox txtY2; 681 | private System.Windows.Forms.TextBox txtX2; 682 | private System.Windows.Forms.Label label12; 683 | private System.Windows.Forms.Label label13; 684 | private System.Windows.Forms.TextBox txtY1; 685 | private System.Windows.Forms.Label label14; 686 | private System.Windows.Forms.TextBox txtX1; 687 | private System.Windows.Forms.Label label16; 688 | private System.Windows.Forms.Label label23; 689 | } 690 | } -------------------------------------------------------------------------------- /CoordConvert/CalFourPara.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using CoordConvert; 10 | 11 | namespace CoordConvertApp 12 | { 13 | public partial class CalFourPara : Form 14 | { 15 | Datum WGS84Datum = new Datum(6378137, 6356752.3142, 0.00669437999013); 16 | 17 | public CalFourPara() 18 | { 19 | InitializeComponent(); 20 | } 21 | 22 | private void btnCal_Click(object sender, EventArgs e) 23 | { 24 | try 25 | { 26 | List pSourceBLH = new List(); 27 | List pSource = new List(); 28 | List pTo = new List(); 29 | List pToNew = new List(); 30 | 31 | if (txtB1.Text != "" && txtL1.Text != "") 32 | { 33 | pSourceBLH.Add(new BLHCoordinate(double.Parse(txtB1.Text), double.Parse(txtL1.Text), 0)); 34 | } 35 | if (txtB2.Text != "" && txtL2.Text != "") 36 | { 37 | pSourceBLH.Add(new BLHCoordinate(double.Parse(txtB2.Text), double.Parse(txtL2.Text), 0)); 38 | } 39 | if (txtB3.Text != "" && txtL3.Text != "") 40 | { 41 | pSourceBLH.Add(new BLHCoordinate(double.Parse(txtB3.Text), double.Parse(txtL3.Text), 0)); 42 | } 43 | if (txtB4.Text != "" && txtL4.Text != "") 44 | { 45 | pSourceBLH.Add(new BLHCoordinate(double.Parse(txtB4.Text), double.Parse(txtL4.Text), 0)); 46 | } 47 | if (txtB5.Text != "" && txtL5.Text != "") 48 | { 49 | pSourceBLH.Add(new BLHCoordinate(double.Parse(txtB5.Text), double.Parse(txtL5.Text), 0)); 50 | } 51 | if (txtB6.Text != "" && txtL6.Text != "") 52 | { 53 | pSourceBLH.Add(new BLHCoordinate(double.Parse(txtB6.Text), double.Parse(txtL6.Text), 0)); 54 | } 55 | 56 | if (txtX1.Text != "" && txtY1.Text != "") 57 | { 58 | pTo.Add(new XYZCoordinate(double.Parse(txtX1.Text), double.Parse(txtY1.Text), 0)); 59 | } 60 | if (txtX2.Text != "" && txtY2.Text != "") 61 | { 62 | pTo.Add(new XYZCoordinate(double.Parse(txtX2.Text), double.Parse(txtY2.Text), 0)); 63 | } 64 | if (txtX3.Text != "" && txtY3.Text != "") 65 | { 66 | pTo.Add(new XYZCoordinate(double.Parse(txtX3.Text), double.Parse(txtY3.Text), 0)); 67 | } 68 | if (txtX4.Text != "" && txtY4.Text != "") 69 | { 70 | pTo.Add(new XYZCoordinate(double.Parse(txtX4.Text), double.Parse(txtY4.Text), 0)); 71 | } 72 | if (txtX5.Text != "" && txtY5.Text != "") 73 | { 74 | pTo.Add(new XYZCoordinate(double.Parse(txtX5.Text), double.Parse(txtY5.Text), 0)); 75 | } 76 | if (txtX6.Text != "" && txtY6.Text != "") 77 | { 78 | pTo.Add(new XYZCoordinate(double.Parse(txtX6.Text), double.Parse(txtY6.Text), 0)); 79 | } 80 | 81 | int ptNum = 0; 82 | if (txtPtNum.Text != "") 83 | { 84 | ptNum = int.Parse(txtPtNum.Text); 85 | } 86 | 87 | double Lon = 0; 88 | if (pSourceBLH.Count > 1) 89 | { 90 | Lon = (int)pSourceBLH[0].L; 91 | } 92 | else 93 | { 94 | MessageBox.Show("请输入控制点坐标!"); 95 | return; 96 | } 97 | 98 | for (int i = 0; i < ptNum; i++) 99 | { 100 | XYZCoordinate wgsxy = GaussProjection.GaussProjCal(pSourceBLH[i], WGS84Datum, Lon); 101 | pSource.Add(wgsxy); 102 | pToNew.Add(pTo[i]); 103 | } 104 | double rms; 105 | FourPara forPara = Para4.Calc4Para(pSource, pTo,out rms); 106 | txtLon.Text = Lon + ""; 107 | txtDeltaX.Text = forPara.deltaX + ""; 108 | txtDeltaY.Text = forPara.deltaY + ""; 109 | txtAx.Text = forPara.Ax + ""; 110 | txtS.Text = forPara.scale + ""; 111 | } 112 | catch 113 | { 114 | MessageBox.Show("错误,请检查!"); 115 | } 116 | } 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /CoordConvert/CalFourPara.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /CoordConvert/CoordConvert.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace CoordConvertApp 7 | { 8 | class CoordConvert 9 | { 10 | public static double GetX_dc(double dx, double dy) 11 | { 12 | double A1 = 6103729.01171875; 13 | double B1 = -158449219.125; 14 | double C1 = -709804016; 15 | double D1 = 18920915837.022213; 16 | double fx; 17 | 18 | fx = A1 * dx * dy + B1 * dx + C1 * dy + D1; 19 | 20 | return fx / 1000; 21 | } 22 | 23 | public static double GetY_dc(double dx, double dy) 24 | { 25 | double A2 = 7662548.3125; 26 | double B2 = -305916495; 27 | double C2 = -780249200; 28 | double D2 = 31456748837.828285; 29 | double fy; 30 | 31 | fy = A2 * dx * dy + B2 * dx + C2 * dy + D2; 32 | 33 | return fy / 1000; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /CoordConvert/CoordConvertApp.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | x86 6 | 8.0.30703 7 | 2.0 8 | {A431CFAA-AAFF-4D72-A163-25CA4C275220} 9 | WinExe 10 | Properties 11 | CoordConvertApp 12 | CoordConvertApp 13 | v4.0 14 | Client 15 | 512 16 | 17 | 18 | x86 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | x86 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | Form 53 | 54 | 55 | CalFourPara.cs 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | {0705D465-925A-497B-9386-1BFE32C2B88D} 65 | CoordConvertDLL 66 | 67 | 68 | 69 | 70 | CalFourPara.cs 71 | 72 | 73 | 74 | 81 | -------------------------------------------------------------------------------- /CoordConvert/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Windows.Forms; 5 | 6 | namespace CoordConvertApp 7 | { 8 | static class Program 9 | { 10 | /// 11 | /// The main entry point for the application. 12 | /// 13 | [STAThread] 14 | static void Main() 15 | { 16 | //Application.EnableVisualStyles(); 17 | //Application.SetCompatibleTextRenderingDefault(false); 18 | //Application.Run(new CalFourPara()); 19 | 20 | Test.ConvertTest(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /CoordConvert/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CoordConvertApp")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CoordConvertApp")] 13 | [assembly: AssemblyCopyright("Copyright © 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("367b3430-61c1-4d23-9373-0dd82a9b18a6")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /CoordConvert/Test.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.IO; 6 | using CoordConvert; 7 | 8 | namespace CoordConvertApp 9 | { 10 | class Test 11 | { 12 | public static void ConvertTest() 13 | { 14 | List pSource = new List(); 15 | List pTo = new List(); 16 | 17 | //FourPara forPara = new FourPara(-439902.865, -3266656.406, 0.0013362875487730103, 0.99999205271109981); 18 | 19 | StreamReader sr = new StreamReader(@"E:\Projects\张家口\张家口控制点-宣化.txt"); 20 | //StreamWriter sw = new StreamWriter(@"E:\Projects\杭州项目\点云数据\data-20120517-123249_1_left.xyzt"); 21 | string line; 22 | double b, l, h, x1 = 0, y1 = 0, x2 = 0, y2 = 0, weekSec; 23 | int i = 1; 24 | while ((line = sr.ReadLine()) != null) 25 | { 26 | string[] strs = line.Split(' '); 27 | //b = double.Parse(strs[0]) + double.Parse(strs[1]) / 60 + double.Parse(strs[2]) / 3600; 28 | //l = double.Parse(strs[3]) + double.Parse(strs[4]) / 60 + double.Parse(strs[5]) / 3600; 29 | x1 = double.Parse(strs[0]); 30 | y1 = double.Parse(strs[1]); 31 | 32 | x2 = double.Parse(strs[2]); 33 | y2 = double.Parse(strs[3]); 34 | 35 | //l = double.Parse(strs[4]) + double.Parse(strs[5]) / 60 + double.Parse(strs[6]) / 3600; 36 | //b = double.Parse(strs[7]) + double.Parse(strs[8]) / 60 + double.Parse(strs[9]) / 3600; 37 | 38 | //int intb = (int)b; 39 | //double millib = b - intb; 40 | //int minb = (int)(millib * 100); 41 | //double secb = (millib * 100 - minb) * 100; 42 | //b = intb + minb / 60.0 + secb / 3600; 43 | 44 | //int intl = (int)l; 45 | //double millil = l - intl; 46 | //int minl = (int)(millil * 100); 47 | //double secl = (millil * 100 - minl) * 100; 48 | //l = intl + minl / 60.0 + secl / 3600; 49 | 50 | //BLHCoordinate wgsblh = GaussProjection.GaussProjInvCal(new XYZCoordinate(x, y, h), CoordConsts.WGS84Datum, 105); 51 | 52 | //XYZCoordinate wgsxyh = GaussProjection.GaussProjCal(new BLHCoordinate(b,l,0), CoordConsts.WGS84Datum, 108); 53 | pSource.Add(new XYZCoordinate(y1, x1, 0)); 54 | 55 | pTo.Add(new XYZCoordinate(y2, x2, 0)); 56 | } 57 | sr.Close(); 58 | //sw.Close(); 59 | double rms; 60 | FourPara forPara = Para4.Calc4Para(pSource, pTo, out rms); 61 | 62 | 63 | //SevenPara bigPara7 = Para7.CalBigAngle7Paras(pSource,pTo); 64 | //SevenPara sevenPara = Para7.Calc7Para(pSource, pTo); 65 | //SevenPara sevenPara = new SevenPara(-3297.3976, 12883.8090, 17375.9167, 0.4908300492, 0.1026210199, 0.053060665555, -1286.6821354); 66 | //XYZCoordinate wgs84xyz = new XYZCoordinate(103.51925547390123, 30.588686329132248, 486.1406); 67 | //XYZCoordinate bj54xyz = Para7.Para7Convert(wgs84xyz, sevenPara); 68 | 69 | //XYZCoordinate wgsxyh = GaussProjection.GaussProjCal(new BLHCoordinate(30.5857555556, 103.5258305556, 16.580), CoordConsts.WGS84Datum, 105); 70 | //FourPara forPara = new FourPara(-439902.86518674204, -3266656.40625, 0.0013362875487730103, 0.99999205271109981); 71 | //XYZCoordinate localCor = Para4.Para4Convert(wgsxyh, forPara); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /CoordConvert/bin/Debug/CoordConvert.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NewMapper/CoordConvert/f0fab366a1a6c0090417061a605f14f48904ecba/CoordConvert/bin/Debug/CoordConvert.dll -------------------------------------------------------------------------------- /CoordConvert/bin/Debug/CoordConvert.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NewMapper/CoordConvert/f0fab366a1a6c0090417061a605f14f48904ecba/CoordConvert/bin/Debug/CoordConvert.pdb -------------------------------------------------------------------------------- /CoordConvert/bin/Debug/CoordConvert.vshost.exe.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /CoordConvert/bin/Debug/CoordConvertApp.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NewMapper/CoordConvert/f0fab366a1a6c0090417061a605f14f48904ecba/CoordConvert/bin/Debug/CoordConvertApp.exe -------------------------------------------------------------------------------- /CoordConvert/bin/Debug/CoordConvertApp.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NewMapper/CoordConvert/f0fab366a1a6c0090417061a605f14f48904ecba/CoordConvert/bin/Debug/CoordConvertApp.pdb -------------------------------------------------------------------------------- /CoordConvert/bin/Debug/CoordConvertApp.vshost.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NewMapper/CoordConvert/f0fab366a1a6c0090417061a605f14f48904ecba/CoordConvert/bin/Debug/CoordConvertApp.vshost.exe -------------------------------------------------------------------------------- /CoordConvert/bin/Debug/CoordConvertApp.vshost.exe.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /CoordConvert/obj/x86/Debug/CoordConvertApp.CalFourPara.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NewMapper/CoordConvert/f0fab366a1a6c0090417061a605f14f48904ecba/CoordConvert/obj/x86/Debug/CoordConvertApp.CalFourPara.resources -------------------------------------------------------------------------------- /CoordConvert/obj/x86/Debug/CoordConvertApp.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | D:\空间信息科学\GPS\CoordConvert\CoordConvert\obj\x86\Debug\ResolveAssemblyReference.cache 2 | D:\空间信息科学\GPS\CoordConvert\CoordConvert\bin\Debug\CoordConvertApp.exe 3 | D:\空间信息科学\GPS\CoordConvert\CoordConvert\bin\Debug\CoordConvertApp.pdb 4 | D:\空间信息科学\GPS\CoordConvert\CoordConvert\bin\Debug\CoordConvert.dll 5 | D:\空间信息科学\GPS\CoordConvert\CoordConvert\bin\Debug\CoordConvert.pdb 6 | D:\空间信息科学\GPS\CoordConvert\CoordConvert\obj\x86\Debug\CoordConvertApp.exe 7 | D:\空间信息科学\GPS\CoordConvert\CoordConvert\obj\x86\Debug\CoordConvertApp.pdb 8 | D:\3S\GPS\CoordConvert\CoordConvert\obj\x86\Debug\CoordConvertApp.exe 9 | D:\3S\GPS\CoordConvert\CoordConvert\obj\x86\Debug\CoordConvertApp.pdb 10 | D:\3S\GPS\CoordConvert\CoordConvert\bin\Debug\CoordConvertApp.exe 11 | D:\3S\GPS\CoordConvert\CoordConvert\bin\Debug\CoordConvertApp.pdb 12 | D:\3S\GPS\CoordConvert\CoordConvert\bin\Debug\CoordConvert.dll 13 | D:\3S\GPS\CoordConvert\CoordConvert\bin\Debug\CoordConvert.pdb 14 | D:\3S\GPS\CoordConvert\CoordConvert\obj\x86\Debug\ResolveAssemblyReference.cache 15 | D:\3S\GPS\CoordConvert\CoordConvert\obj\x86\Debug\CoordConvertApp.CalFourPara.resources 16 | D:\3S\GPS\CoordConvert\CoordConvert\obj\x86\Debug\GenerateResource.read.1.tlog 17 | D:\3S\GPS\CoordConvert\CoordConvert\obj\x86\Debug\GenerateResource.write.1.tlog 18 | -------------------------------------------------------------------------------- /CoordConvert/obj/x86/Debug/CoordConvertApp.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NewMapper/CoordConvert/f0fab366a1a6c0090417061a605f14f48904ecba/CoordConvert/obj/x86/Debug/CoordConvertApp.exe -------------------------------------------------------------------------------- /CoordConvert/obj/x86/Debug/CoordConvertApp.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NewMapper/CoordConvert/f0fab366a1a6c0090417061a605f14f48904ecba/CoordConvert/obj/x86/Debug/CoordConvertApp.pdb -------------------------------------------------------------------------------- /CoordConvert/obj/x86/Debug/DesignTimeResolveAssemblyReferences.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NewMapper/CoordConvert/f0fab366a1a6c0090417061a605f14f48904ecba/CoordConvert/obj/x86/Debug/DesignTimeResolveAssemblyReferences.cache -------------------------------------------------------------------------------- /CoordConvert/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NewMapper/CoordConvert/f0fab366a1a6c0090417061a605f14f48904ecba/CoordConvert/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /CoordConvert/obj/x86/Debug/GenerateResource.read.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NewMapper/CoordConvert/f0fab366a1a6c0090417061a605f14f48904ecba/CoordConvert/obj/x86/Debug/GenerateResource.read.1.tlog -------------------------------------------------------------------------------- /CoordConvert/obj/x86/Debug/GenerateResource.write.1.tlog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NewMapper/CoordConvert/f0fab366a1a6c0090417061a605f14f48904ecba/CoordConvert/obj/x86/Debug/GenerateResource.write.1.tlog -------------------------------------------------------------------------------- /CoordConvert/obj/x86/Debug/ResolveAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NewMapper/CoordConvert/f0fab366a1a6c0090417061a605f14f48904ecba/CoordConvert/obj/x86/Debug/ResolveAssemblyReference.cache -------------------------------------------------------------------------------- /CoordConvertDLL/CoordConsts.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CoordConvert 6 | { 7 | public class CoordConsts 8 | { 9 | public static Datum WGS84Datum = new Datum(6378137, 6356752.3142, 0.00669437999013); 10 | public static Datum bj54Datum = new Datum(6378245, 6356863.0188, 0.006693421622966); 11 | public static Datum xian80Datum = new Datum(6378140, 6356755.2882, 0.00669438499959); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /CoordConvertDLL/CoordConvertDLL.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {0705D465-925A-497B-9386-1BFE32C2B88D} 9 | Library 10 | Properties 11 | CoordConvert 12 | CoordConvert 13 | v2.0 14 | 512 15 | 16 | 17 | 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 65 | -------------------------------------------------------------------------------- /CoordConvertDLL/CoordinateSystem/BLHCoordinate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CoordConvert 6 | { 7 | public class BLHCoordinate 8 | { 9 | private double _b; 10 | private double _l; 11 | private double _h; 12 | 13 | /// 14 | /// Initializes a new Point 15 | /// 16 | /// X coordinate 17 | /// Y coordinate 18 | public BLHCoordinate() 19 | { 20 | _b = 0; 21 | _l = 0; 22 | _h = 0; 23 | } 24 | 25 | /// 26 | /// Initializes a new Point 27 | /// 28 | /// X coordinate 29 | /// Y coordinate 30 | public BLHCoordinate(double b, double l, double h) 31 | { 32 | _b = b; 33 | _l = l; 34 | _h = h; 35 | } 36 | 37 | /// 38 | /// Gets or sets the X coordinate of the point 39 | /// 40 | public double B 41 | { 42 | get 43 | { 44 | return _b; 45 | } 46 | set 47 | { 48 | _b = value; 49 | } 50 | } 51 | 52 | /// 53 | /// Gets or sets the X coordinate of the point 54 | /// 55 | public double L 56 | { 57 | get 58 | { 59 | return _l; 60 | } 61 | set 62 | { 63 | _l = value; 64 | } 65 | } 66 | 67 | /// 68 | /// Gets or sets the X coordinate of the point 69 | /// 70 | public double H 71 | { 72 | get 73 | { 74 | return _h; 75 | } 76 | set 77 | { 78 | _h = value; 79 | } 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /CoordConvertDLL/CoordinateSystem/Datum.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CoordConvert 6 | { 7 | public class Datum 8 | { 9 | private double _a; 10 | private double _b; 11 | private double _e2; 12 | 13 | /// 14 | /// Initializes a new Point 15 | /// 16 | /// X coordinate 17 | /// Y coordinate 18 | public Datum() 19 | { 20 | _a = 0; 21 | _b = 0; 22 | _e2 = 0; 23 | } 24 | 25 | /// 26 | /// Initializes a new Point 27 | /// 28 | /// X coordinate 29 | /// Y coordinate 30 | public Datum(double a, double b, double e2) 31 | { 32 | _a = a; 33 | _b = b; 34 | _e2 = e2; 35 | } 36 | 37 | /// 38 | /// Gets or sets the X coordinate of the point 39 | /// 40 | public double r_major 41 | { 42 | get 43 | { 44 | return _a; 45 | } 46 | set 47 | { 48 | _a = value; 49 | } 50 | } 51 | 52 | /// 53 | /// Gets or sets the X coordinate of the point 54 | /// 55 | public double r_minor 56 | { 57 | get 58 | { 59 | return _b; 60 | } 61 | set 62 | { 63 | _b = value; 64 | } 65 | } 66 | 67 | /// 68 | /// Gets or sets the X coordinate of the point 69 | /// 70 | public double E2 71 | { 72 | get 73 | { 74 | return _e2; 75 | } 76 | set 77 | { 78 | _e2 = value; 79 | } 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /CoordConvertDLL/CoordinateSystem/XYZCoordinate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CoordConvert 6 | { 7 | public class XYZCoordinate 8 | { 9 | private double _X; 10 | private double _Y; 11 | private double _Z; 12 | 13 | /// 14 | /// Initializes a new Point 15 | /// 16 | /// X coordinate 17 | /// Y coordinate 18 | public XYZCoordinate() 19 | { 20 | _X = 0; 21 | _Y = 0; 22 | _Z = 0; 23 | } 24 | 25 | /// 26 | /// Initializes a new Point 27 | /// 28 | /// X coordinate 29 | /// Y coordinate 30 | public XYZCoordinate(double x, double y, double z) 31 | { 32 | _X = x; 33 | _Y = y; 34 | _Z = z; 35 | } 36 | 37 | /// 38 | /// Gets or sets the X coordinate of the point 39 | /// 40 | public double X 41 | { 42 | get 43 | { 44 | return _X; 45 | } 46 | set 47 | { 48 | _X = value; 49 | } 50 | } 51 | 52 | /// 53 | /// Gets or sets the X coordinate of the point 54 | /// 55 | public double Y 56 | { 57 | get 58 | { 59 | return _Y; 60 | } 61 | set 62 | { 63 | _Y = value; 64 | } 65 | } 66 | 67 | /// 68 | /// Gets or sets the X coordinate of the point 69 | /// 70 | public double Z 71 | { 72 | get 73 | { 74 | return _Z; 75 | } 76 | set 77 | { 78 | _Z = value; 79 | } 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /CoordConvertDLL/FourPara.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace CoordConvert 5 | { 6 | public class FourPara 7 | { 8 | public double deltaX; 9 | public double deltaY; 10 | public double scale; 11 | public double Ax; 12 | 13 | /// 14 | /// Initializes a new Point 15 | /// 16 | /// X coordinate 17 | /// Y coordinate 18 | public FourPara() 19 | { 20 | deltaX = 0; 21 | deltaY = 0; 22 | scale = 0; 23 | Ax = 0; 24 | } 25 | 26 | /// 27 | /// Initializes a new Point 28 | /// 29 | /// X coordinate 30 | /// Y coordinate 31 | public FourPara(double dx, double dy, double Ex, double m) 32 | { 33 | deltaX = dx; 34 | deltaY = dy; 35 | scale = m; 36 | Ax = Ex; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /CoordConvertDLL/GaussProjection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CoordConvert 6 | { 7 | //高斯投影正、反算 8 | 9 | //3度带宽 10 | 11 | //NN卯酉圈曲率半径,测量学里面用N表示 12 | 13 | //M为子午线弧长,测量学里用大X表示 14 | 15 | //fai为底点纬度,由子午弧长反算公式得到,测量学里用Bf表示 16 | 17 | //R为底点所对的曲率半径,测量学里用Nf表示 18 | public class GaussProjection 19 | { 20 | //高斯投影由经纬度(Unit:DD)计算大地平面坐标(含带号,Unit:Metres) 21 | public static XYZCoordinate GaussProjCal(BLHCoordinate BLH, Datum datum,double lon) 22 | { 23 | int ProjNo, ZoneWide; ////带宽 24 | double longitude0, X0, xval, yval; 25 | double a, e2, ee, NN, T, C, A, M, b, l, h; 26 | b = BLH.B; 27 | l = BLH.L; 28 | h = BLH.H; 29 | ZoneWide = 3; //3度带宽 30 | a = datum.r_major; 31 | ProjNo = (int)((l - 1.5) / ZoneWide + 1); 32 | longitude0 = lon; 33 | if (Math.Abs(lon - 0) < 0.000001) 34 | { 35 | longitude0 = ProjNo * ZoneWide; //中央经线 36 | } 37 | longitude0 = longitude0 * Math.PI / 180; 38 | l = l * Math.PI / 180; //经度转换为弧度 39 | b = b * Math.PI / 180; //纬度转换为弧度 40 | e2 = datum.E2; 41 | ee = e2 * (1.0 - e2); 42 | NN = a / Math.Sqrt(1.0 - e2 * Math.Sin(b) * Math.Sin(b)); 43 | T = Math.Tan(b) * Math.Tan(b); 44 | C = ee * Math.Cos(b) * Math.Cos(b); 45 | A = (l - longitude0) * Math.Cos(b); 46 | 47 | M = a * ((1 - e2 / 4 - 3 * e2 * e2 / 64 - 5 * e2 * e2 * e2 / 256) * b - (3 * e2 / 8 + 3 * e2 * e2 / 32 + 45 * e2 * e2 * e2 / 1024) * Math.Sin(2 * b) + (15 * e2 * e2 / 256 + 45 * e2 * e2 * e2 / 1024) * Math.Sin(4 * b) - (35 * e2 * e2 * e2 / 3072) * Math.Sin(6 * b)); 48 | xval = NN * (A + (1 - T + C) * A * A * A / 6 + (5 - 18 * T + T * T + 72 * C - 58 * ee) * A * A * A * A * A / 120); 49 | yval = M + NN * Math.Tan(b) * (A * A / 2 + (5 - T + 9 * C + 4 * C * C) * A * A * A * A / 24 + (61 - 58 * T + T * T + 600 * C - 330 * ee) * A * A * A * A * A * A / 720); 50 | //X0 = 1000000L * ProjNo + 500000L; 51 | X0 = 500000L; 52 | xval = xval + X0; 53 | return new XYZCoordinate(xval, yval, h); 54 | } 55 | 56 | //高斯投影由大地平面坐标(Unit:Metres)反算经纬度(Unit:DD) 57 | public static BLHCoordinate GaussProjInvCal(XYZCoordinate XYZ, Datum datum, double lon) 58 | { 59 | int ProjNo, ZoneWide; ////带宽 60 | double l, b, longitude0, X0, xval, yval; 61 | double e1, e2, f, a, ee, NN, T, C, M, D, R, u, fai; 62 | a = datum.r_major; //54年北京坐标系参数 63 | ZoneWide = 3; //3度带宽 64 | ProjNo = (int)(XYZ.X / 1000000L); //查找带号 65 | longitude0 = lon; 66 | if (Math.Abs(lon - 0) < 0.000001) 67 | { 68 | longitude0 = ProjNo * ZoneWide; //中央经线 69 | } 70 | longitude0 = longitude0 * Math.PI / 180; //中央经线 71 | X0 = ProjNo * 1000000L + 500000L; 72 | xval = XYZ.X - X0; //带内大地坐标 73 | yval = XYZ.Y; 74 | e2 = datum.E2; 75 | e1 = (1.0 - Math.Sqrt(1 - e2)) / (1.0 + Math.Sqrt(1 - e2)); 76 | ee = e2 / (1 - e2); 77 | M = yval; 78 | u = M / (a * (1 - e2 / 4 - 3 * e2 * e2 / 64 - 5 * e2 * e2 * e2 / 256)); 79 | fai = u + (3 * e1 / 2 - 27 * e1 * e1 * e1 / 32) * Math.Sin(2 * u) + (21 * e1 * e1 / 16 - 55 * e1 * e1 * e1 * e1 / 32) * Math.Sin(4 * u) + (151 * e1 * e1 * e1 / 96) * Math.Sin(6 * u) + (1097 * e1 * e1 * e1 * e1 / 512) * Math.Sin(8 * u); 80 | C = ee * Math.Cos(fai) * Math.Cos(fai); 81 | T = Math.Tan(fai) * Math.Tan(fai); 82 | NN = a / Math.Sqrt(1.0 - e2 * Math.Sin(fai) * Math.Sin(fai)); 83 | 84 | R = a * (1 - e2) / Math.Sqrt((1 - e2 * Math.Sin(fai) * Math.Sin(fai)) * (1 - e2 * Math.Sin(fai) * Math.Sin(fai)) * (1 - e2 * Math.Sin(fai) * Math.Sin(fai))); 85 | D = xval / NN; 86 | //计算经度(Longitude) 纬度(Latitude) 87 | l = longitude0 + (D - (1 + 2 * T + C) * D * D * D / 6 + (5 - 2 * C + 28 * T - 3 * C * C + 8 * ee + 24 * T * T) * D 88 | * D * D * D * D / 120) / Math.Cos(fai); 89 | b = fai - (NN * Math.Tan(fai) / R) * (D * D / 2 - (5 + 3 * T + 10 * C - 4 * C * C - 9 * ee) * D * D * D * D / 24 90 | + (61 + 90 * T + 298 * C + 45 * T * T - 256 * ee - 3 * C * C) * D * D * D * D * D * D / 720); 91 | //转换为度 DD 92 | l = l * 180 / Math.PI; 93 | b = b * 180 / Math.PI; 94 | return new BLHCoordinate(b, l, XYZ.Z); 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /CoordConvertDLL/MatrixLib.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NewMapper/CoordConvert/f0fab366a1a6c0090417061a605f14f48904ecba/CoordConvertDLL/MatrixLib.cs -------------------------------------------------------------------------------- /CoordConvertDLL/Para4.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CoordConvert 6 | { 7 | public class Para4 8 | { 9 | /// 10 | /// 根据2个或者2个以上的点的两套坐标系的坐标计算4参数(最小二乘法) 11 | /// 12 | /// 已知点的源坐标系的坐标 13 | /// 已知点的新坐标系的坐标 14 | /// 输出: 4参数 15 | public static FourPara Calc4Para(List aPtSource, List aPtTo,out double rms) 16 | { 17 | #region 给A B 矩阵赋值 18 | double[,] arrA = new double[aPtSource.Count * 2, 4]; // 如果是4个已知点, 8 * 4矩阵 A*X=B中的矩阵A 19 | for (int i = 0; i <= arrA.GetLength(0) - 1; i++) 20 | { 21 | if (i % 2 == 0) 22 | { 23 | arrA[i, 0] = aPtSource[i / 2].X; 24 | arrA[i, 1] = aPtSource[i / 2].Y; 25 | arrA[i, 2] = 1; 26 | arrA[i, 3] = 0; 27 | } 28 | else if (i % 2 == 1) 29 | { 30 | arrA[i, 0] = aPtSource[i / 2].Y; 31 | arrA[i, 1] = -aPtSource[i / 2].X; 32 | arrA[i, 2] = 0; 33 | arrA[i, 3] = 1; 34 | } 35 | } 36 | double[,] arrB = new double[aPtSource.Count * 2, 1]; // A * X = B 中的矩阵B, 如果有4个点,就是 8*1矩阵 37 | for (int i = 0; i <= arrB.GetLength(0) - 1; i++) 38 | { 39 | if (i % 2 == 0) 40 | { 41 | arrB[i, 0] = aPtTo[i / 2].X; 42 | } 43 | else if (i % 2 == 1) 44 | { 45 | arrB[i, 0] = aPtTo[i / 2].Y; 46 | } 47 | } 48 | #endregion 49 | Matrix mtrA = new Matrix(arrA); // A矩阵 50 | Matrix mtrAT = Matrix.Transpose(mtrA); // A的转置 51 | Matrix mtrB = new Matrix(arrB); // B矩阵 52 | Matrix mtrATmulA = Matrix.Multiply(mtrAT, mtrA); // A的转置×A 53 | // 求(A的转置×A)的逆矩阵 54 | mtrATmulA = Matrix.Inverse(mtrATmulA); 55 | // A的转置 × B 56 | Matrix mtrATmulB = Matrix.Multiply(mtrAT, mtrB); // A的转置 * B 57 | // 结果 58 | Matrix mtrResult = Matrix.Multiply(mtrATmulA, mtrATmulB); 59 | 60 | FourPara forPara = new FourPara(); 61 | forPara.deltaX = mtrResult[2, 0]; 62 | forPara.deltaY = mtrResult[3, 0]; 63 | forPara.Ax = Math.Atan(mtrResult[1, 0] / mtrResult[0, 0]); 64 | forPara.scale = mtrResult[1, 0] / Math.Sin(forPara.Ax); 65 | 66 | //计算均方根误差rms 67 | List pTo = new List(); 68 | for (int i = 0; i < aPtSource.Count; i++) 69 | { 70 | pTo.Add(Para4Convert(aPtSource[i], forPara)); 71 | } 72 | rms = 0; 73 | for (int i = 0; i < aPtTo.Count; i++) 74 | { 75 | double deltaX = aPtTo[i].X - pTo[i].X; 76 | double deltaY = aPtTo[i].Y - pTo[i].Y; 77 | 78 | double oneSigma = Math.Sqrt((Math.Pow(deltaX, 2) + Math.Pow(deltaY, 2)) / 2); 79 | 80 | rms += oneSigma; 81 | } 82 | 83 | rms = rms / aPtTo.Count; 84 | 85 | return forPara; 86 | } 87 | 88 | /// 89 | /// 利用4参数求新坐标系的坐标 90 | /// 91 | /// 点的源坐标系的坐标 92 | /// 已经知道的4参数 93 | /// 输出: 点的新坐标系的坐标 94 | public static XYZCoordinate Para4Convert(XYZCoordinate aPtSource, FourPara forPara) 95 | { 96 | double k = forPara.scale; 97 | double a1 = k * Math.Cos(forPara.Ax); 98 | double a2 = k * Math.Sin(forPara.Ax); 99 | 100 | XYZCoordinate ToCoordinate = new XYZCoordinate(); 101 | ToCoordinate.X = forPara.deltaX + a1 * aPtSource.X + a2 * aPtSource.Y; 102 | ToCoordinate.Y = forPara.deltaY + a1 * aPtSource.Y - a2 * aPtSource.X; 103 | ToCoordinate.Z = aPtSource.Z; 104 | 105 | return ToCoordinate; 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /CoordConvertDLL/Para7.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CoordConvert 6 | { 7 | public class Para7 8 | { 9 | /// 10 | /// 根据3个或者3个以上的点的两套坐标系的坐标计算7参数(最小二乘法) 适用于小角度转换 bursa模型 11 | /// 12 | /// 已知点的源坐标系的坐标 13 | /// 已知点的新坐标系的坐标 14 | /// 输出: 7参数 15 | public static SevenPara Calc7Para(List aPtSource, List aPtTo, out double rms) 16 | { 17 | #region 给A B 矩阵赋值 18 | double[,] arrA = new double[aPtSource.Count * 3, 7]; // 如果是4个已知点, 12 * 7矩阵 A*X=B中的矩阵A 19 | for (int i = 0; i < arrA.GetLength(0); i++) 20 | { 21 | if (i % 3 == 0) 22 | { 23 | arrA[i, 0] = 1; 24 | arrA[i, 1] = 0; 25 | arrA[i, 2] = 0; 26 | arrA[i, 3] = aPtSource[i / 3].X; 27 | arrA[i, 4] = 0; 28 | arrA[i, 5] = -aPtSource[i / 3].Z; 29 | arrA[i, 6] = aPtSource[i / 3].Y; 30 | } 31 | else if (i % 3 == 1) 32 | { 33 | arrA[i, 0] = 0; 34 | arrA[i, 1] = 1; 35 | arrA[i, 2] = 0; 36 | arrA[i, 3] = aPtSource[i / 3].Y; 37 | arrA[i, 4] = aPtSource[i / 3].Z; 38 | arrA[i, 5] = 0; 39 | arrA[i, 6] = -aPtSource[i / 3].X; 40 | } 41 | else if (i % 3 == 2) 42 | { 43 | arrA[i, 0] = 0; 44 | arrA[i, 1] = 0; 45 | arrA[i, 2] = 1; 46 | arrA[i, 3] = aPtSource[i / 3].Z; 47 | arrA[i, 4] = -aPtSource[i / 3].Y; 48 | arrA[i, 5] = aPtSource[i / 3].X; 49 | arrA[i, 6] = 0; 50 | } 51 | } 52 | double[,] arrB = new double[aPtSource.Count * 3, 1]; // A * X = B 中的矩阵B, 如果有4个点,就是 12*1矩阵 53 | for (int i = 0; i <= arrB.GetLength(0) - 1; i++) 54 | { 55 | if (i % 3 == 0) 56 | { 57 | arrB[i, 0] = aPtTo[i / 3].X; 58 | } 59 | else if (i % 3 == 1) 60 | { 61 | arrB[i, 0] = aPtTo[i / 3].Y; 62 | } 63 | else if (i % 3 == 2) 64 | { 65 | arrB[i, 0] = aPtTo[i / 3].Z; 66 | } 67 | } 68 | #endregion 69 | Matrix mtrA = new Matrix(arrA); // A矩阵 70 | Matrix mtrAT = Matrix.Transpose(mtrA); // A的转置 71 | Matrix mtrB = new Matrix(arrB); // B矩阵 72 | Matrix mtrATmulA = Matrix.Multiply(mtrAT, mtrA); // A的转置×A 73 | // 求(A的转置×A)的逆矩阵 74 | mtrATmulA = Matrix.Inverse(mtrATmulA); 75 | // A的转置 × B 76 | Matrix mtrATmulB = Matrix.Multiply(mtrAT, mtrB); // A的转置 * B 77 | // 结果 78 | Matrix mtrResult = Matrix.Multiply(mtrATmulA, mtrATmulB); 79 | SevenPara sep = new SevenPara(); 80 | sep.deltaX = mtrResult[0, 0]; 81 | sep.deltaY = mtrResult[1, 0]; 82 | sep.deltaZ = mtrResult[2, 0]; 83 | sep.scale = mtrResult[3, 0]; 84 | sep.Ax = mtrResult[4, 0] / sep.scale; 85 | sep.Ay = mtrResult[5, 0] / sep.scale; 86 | sep.Az = mtrResult[6, 0] / sep.scale; 87 | 88 | //计算均方根误差rms 89 | List pTo = new List(); 90 | for (int i = 0; i < aPtSource.Count; i++) 91 | { 92 | pTo.Add(Para7Convert(aPtSource[i], sep)); 93 | } 94 | rms = 0; 95 | for (int i = 0; i < aPtTo.Count; i++) 96 | { 97 | double deltaX = aPtTo[i].X - pTo[i].X; 98 | double deltaY = aPtTo[i].Y - pTo[i].Y; 99 | 100 | double oneSigma = Math.Sqrt((Math.Pow(deltaX, 2) + Math.Pow(deltaY, 2)) / 2); 101 | 102 | rms += oneSigma; 103 | } 104 | 105 | rms = rms / aPtTo.Count; 106 | 107 | return sep; 108 | } 109 | 110 | /// 111 | /// 12参数最小二乘解大角度7参数 112 | /// 113 | /// 114 | /// 115 | /// 116 | /// 117 | public static SevenPara CalBigAngle7Paras(List aPtSource, List aPtTo) 118 | { 119 | Matrix A = new Matrix(3 * aPtSource.Count, 12); 120 | Matrix B = new Matrix(3 * aPtSource.Count, 1); 121 | 122 | for (int i = 0; i < 3 * aPtSource.Count; i++) 123 | { 124 | if (i % 3 == 0) 125 | { 126 | A[i, 0] = aPtSource[i / 3].X; 127 | A[i, 1] = aPtSource[i / 3].Y; 128 | A[i, 2] = aPtSource[i / 3].Z; 129 | A[i, 3] = 0; 130 | A[i, 4] = 0; 131 | A[i, 5] = 0; 132 | A[i, 6] = 0; 133 | A[i, 7] = 0; 134 | A[i, 8] = 0; 135 | A[i, 9] = 1; 136 | A[i, 10] = 0; 137 | A[i, 11] = 0; 138 | } 139 | else if (i % 3 == 1) 140 | { 141 | A[i, 0] = 0; 142 | A[i, 1] = 0; 143 | A[i, 2] = 0; 144 | A[i, 3] = aPtSource[i / 3].X; 145 | A[i, 4] = aPtSource[i / 3].Y; 146 | A[i, 5] = aPtSource[i / 3].Z; 147 | A[i, 6] = 0; 148 | A[i, 7] = 0; 149 | A[i, 8] = 0; 150 | A[i, 9] = 0; 151 | A[i, 10] = 1; 152 | A[i, 11] = 0; 153 | } 154 | else if (i % 3 == 2) 155 | { 156 | A[i, 0] = 0; 157 | A[i, 1] = 0; 158 | A[i, 2] = 0; 159 | A[i, 3] = 0; 160 | A[i, 4] = 0; 161 | A[i, 5] = 0; 162 | A[i, 6] = aPtSource[i / 3].X; 163 | A[i, 7] = aPtSource[i / 3].Y; 164 | A[i, 8] = aPtSource[i / 3].Z; 165 | A[i, 9] = 0; 166 | A[i, 10] = 0; 167 | A[i, 11] = 1; 168 | } 169 | } 170 | 171 | for (int i = 0; i < 3 * aPtTo.Count; i++) 172 | { 173 | if (i % 3 == 0) 174 | { 175 | B[i, 0] = aPtTo[i / 3].X; 176 | } 177 | else if (i % 3 == 1) 178 | { 179 | B[i, 0] = aPtTo[i / 3].Y; 180 | } 181 | else if (i % 3 == 2) 182 | { 183 | B[i, 0] = aPtTo[i / 3].Z; 184 | } 185 | } 186 | 187 | Matrix R12 = Matrix.Inverse(Matrix.Transpose(A) * A) * (Matrix.Transpose(A) * B); 188 | 189 | //根据R_w_ins的矩阵元素可解出各个姿态角 190 | double s = Math.Sqrt(Math.Pow(R12[0, 0], 2) + Math.Pow(R12[3, 0], 2) + Math.Pow(R12[6, 0], 2)); 191 | double cosRoll = Math.Sqrt(Math.Pow(R12[0, 0], 2) + Math.Pow(R12[3, 0], 2)) / s; 192 | double sinRoll = -R12[6, 0] / s; 193 | double roll = (sinRoll >= 0) ? (Math.Acos(cosRoll)) : (-Math.Acos(cosRoll)); 194 | double sinPitch = R12[7, 0] / Math.Cos(roll) / s; 195 | double cosPitch = R12[8, 0] / Math.Cos(roll) / s; 196 | double pitch = (sinPitch >= 0) ? (Math.Acos(cosPitch)) : (-Math.Acos(cosPitch)); 197 | double sinYaw = -R12[3, 0] / Math.Cos(roll) / s; 198 | double cosYaw = R12[0, 0] / Math.Cos(roll) / s; 199 | double yaw = (sinYaw >= 0) ? (Math.Acos(cosYaw)) : (-Math.Acos(cosYaw)); 200 | yaw = (yaw >= 0) ? yaw : (-yaw); 201 | 202 | 203 | roll = roll * 180 / Math.PI; 204 | pitch = pitch * 180 / Math.PI; 205 | yaw = yaw * 180 / Math.PI; 206 | 207 | SevenPara sevPara = new SevenPara(); 208 | sevPara.deltaX = R12[9, 0]; 209 | sevPara.deltaY = R12[10, 0]; 210 | sevPara.deltaZ = R12[11, 0]; 211 | sevPara.Ax = pitch; 212 | sevPara.Ay = roll; 213 | sevPara.Az = yaw; 214 | sevPara.scale = s; 215 | 216 | return sevPara; 217 | } 218 | 219 | /// 220 | /// //罗德里格公式计算七参数 221 | ///坐标转换公式:X2=s*R*X1+T 222 | ///输入参数 223 | /// X1 坐标系1下标定点坐标 3*N 224 | /// X2 坐标系2下标定点坐标 3*N 225 | ///输出 226 | /// R 旋转矩阵 227 | /// T 平移向量 228 | /// s 缩放因子 229 | ///罗德里格矩阵形式 230 | /// R = inv(I-S)*(I+S) 231 | /// I为单位矩阵,S为反对称矩阵 232 | /// S=[ 0 -c b; 233 | /// c 0 -a; 234 | /// -b a 0] 235 | /// 236 | /// 237 | /// 238 | /// 239 | public static List CalRT(List ptSource, List ptTo) 240 | { 241 | int N = ptSource.Count; 242 | 243 | Matrix ptSource_center = new Matrix(3, 1); 244 | Matrix ptTo_center = new Matrix(3, 1); 245 | 246 | //计算控制点质心坐标 247 | for (int i = 0; i < N; i++) 248 | { 249 | ptSource_center += ptSource[i]; 250 | 251 | ptTo_center += ptTo[i]; 252 | } 253 | 254 | ptSource_center /= N; 255 | 256 | ptTo_center /= N; 257 | 258 | for (int i = 0; i < N; i++) 259 | { 260 | ptSource[i] = ptSource[i] - ptSource_center; 261 | 262 | ptTo[i] = ptTo[i] - ptTo_center; 263 | } 264 | 265 | //根据线段长度计算 s 比例因子 266 | double s1 = 0; 267 | double s2 = 0; 268 | for (int i = 0; i < N; i++) 269 | { 270 | s1 = s1 + Matrix.norm(ptSource[i]); 271 | s2 = s2 + Matrix.norm(ptTo[i]); 272 | } 273 | double s = s2 / s1; 274 | 275 | Matrix A = new Matrix(3 * N, 3); 276 | Matrix L = new Matrix(3 * N, 1); 277 | for (int i = 0; i < N; i++) 278 | { 279 | double a1 = 1; 280 | double a2 = 0; 281 | double a3 = 0; 282 | double b1 = 0; 283 | double b2 = 1; 284 | double b3 = 0; 285 | double c1 = 0; 286 | double c2 = 0; 287 | double c3 = 1; 288 | 289 | // 将坐标转为重力坐标 290 | // 计算u v w 291 | double x2 = ptTo[i][0, 0]; 292 | double y2 = ptTo[i][1, 0]; 293 | double z2 = ptTo[i][2, 0]; 294 | double x1 = ptSource[i][0, 0]; 295 | double y1 = ptSource[i][1, 0]; 296 | double z1 = ptSource[i][2, 0]; 297 | double u = a3 * x2 + b3 * y2 + c3 * z2 + s * z1; 298 | double v = a2 * x2 + b2 * y2 + c2 * z2 + s * y1; 299 | double w = a1 * x2 + b1 * y2 + c1 * z2 + s * x1; 300 | Matrix one_A = new Matrix(new double[3, 3] { { 0, u, -v }, { -u, 0, w }, { v, -w, 0 } }); 301 | Matrix one_L = new Matrix(new double[3, 1] { { a1 * x2 + b1 * y2 + c1 * z2 - s * x1 }, { a2 * x2 + b2 * y2 + c2 * z2 - s * y1 }, { a3 * x2 + b3 * y2 + c3 * z2 - s * z1 } }); 302 | for (int j = 0; j < 3; j++) 303 | { 304 | for (int k = 0; k < 3; k++) 305 | { 306 | A[3 * i + j, k] = one_A[j, k]; 307 | } 308 | L[3 * i + j, 0] = one_L[j, 0]; 309 | } 310 | } 311 | 312 | Matrix X = Matrix.Inverse(Matrix.Transpose(A) * A) * Matrix.Transpose(A) * L; 313 | 314 | double a = X[0, 0]; 315 | double b = X[1, 0]; 316 | double c = X[2, 0]; 317 | Matrix S = new Matrix(new double[3, 3] { { 0, -c, b }, { c, 0, -a }, { -b, a, 0 } }); 318 | Matrix I = new Matrix(new double[3, 3] { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } }); 319 | Matrix R = Matrix.Inverse(I - S) * (I + S); 320 | Matrix T = ptTo_center - s * R * ptSource_center; 321 | 322 | List RT = new List(); 323 | RT.Add(R); 324 | RT.Add(T); 325 | 326 | return RT; 327 | } 328 | 329 | /// 330 | /// 利用7参数求新坐标系的坐标 331 | /// 332 | /// 点的源坐标系的坐标 333 | /// 已经知道的7参数 334 | /// 输出: 点的新坐标系的坐标 335 | public static XYZCoordinate Para7Convert(XYZCoordinate aPtSource, SevenPara sep) 336 | { 337 | double k = sep.scale; 338 | double a2 = k * sep.Ax; 339 | double a3 = k * sep.Ay; 340 | double a4 = k * sep.Az; 341 | 342 | XYZCoordinate ToCoordinate = new XYZCoordinate(); 343 | ToCoordinate.X = sep.deltaX + k * aPtSource.X - a3 * aPtSource.Z + a4 * aPtSource.Y; 344 | ToCoordinate.Y = sep.deltaY + k * aPtSource.Y + a2 * aPtSource.Z - a4 * aPtSource.X; 345 | ToCoordinate.Z = sep.deltaZ + k * aPtSource.Z - a2 * aPtSource.Y + a3 * aPtSource.X; 346 | 347 | return ToCoordinate; 348 | } 349 | } 350 | } 351 | -------------------------------------------------------------------------------- /CoordConvertDLL/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CoordConvertDLL")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CoordConvertDLL")] 13 | [assembly: AssemblyCopyright("Copyright © 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("00cf3c82-8945-4896-885d-d86ed1d39ca5")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /CoordConvertDLL/SevenPara.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CoordConvert 6 | { 7 | public class SevenPara 8 | { 9 | public double deltaX; 10 | public double deltaY; 11 | public double deltaZ; 12 | public double scale; 13 | public double Ax; 14 | public double Ay; 15 | public double Az; 16 | 17 | /// 18 | /// Initializes a new Point 19 | /// 20 | /// X coordinate 21 | /// Y coordinate 22 | public SevenPara() 23 | { 24 | deltaX = 0; 25 | deltaY = 0; 26 | deltaZ = 0; 27 | scale = 0; 28 | Ax = 0; 29 | Ay = 0; 30 | Az = 0; 31 | } 32 | 33 | /// 34 | /// Initializes a new Point 35 | /// 36 | /// X coordinate 37 | /// Y coordinate 38 | public SevenPara(double dx, double dy, double dz, double Ex, double Ey, double Ez, double m) 39 | { 40 | deltaX = dx; 41 | deltaY = dy; 42 | deltaZ = dz; 43 | scale = m; 44 | Ax = Ex; 45 | Ay = Ey; 46 | Az = Ez; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /CoordConvertDLL/XYZetBLH.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace CoordConvert 6 | { 7 | public class XYZetBLH 8 | { 9 | private const double Pi = 3.1415926; 10 | public static XYZCoordinate BLHToXYZ(BLHCoordinate BLH, Datum datum) 11 | { 12 | double a = datum.r_major; 13 | double b = datum.r_minor; 14 | double b1 = BLH.B * Pi / 180; 15 | double l1 = BLH.L * Pi / 180; 16 | double h1 = BLH.H; 17 | double eq = datum.E2; 18 | double N = a / Math.Sqrt(1 - eq * Math.Sin(b1) * Math.Sin(b1)); 19 | double Xq = (N + h1) * Math.Cos(b1) * Math.Cos(l1); 20 | double Yq = (N + h1) * Math.Cos(b1) * Math.Sin(l1); 21 | double Zq = ((1 - eq) * N + h1) * Math.Sin(b1); 22 | return new XYZCoordinate(Xq, Yq, Zq); 23 | } 24 | 25 | public static BLHCoordinate XYZToBLH(XYZCoordinate XYZ, Datum datum) 26 | { 27 | double f, f1, f2; 28 | double p,zw, nnq; 29 | double b, l, h; 30 | 31 | double a = datum.r_major; 32 | double eq = datum.E2; 33 | f = Pi * 50 / 180; 34 | double x, y, z; 35 | x = XYZ.X; 36 | y = XYZ.Y; 37 | z = XYZ.Z; 38 | p = z / Math.Sqrt(x * x + y * y); 39 | do 40 | { 41 | zw = a / Math.Sqrt(1 - eq * Math.Sin(f) * Math.Sin(f)); 42 | nnq = 1 - eq * zw / (Math.Sqrt(x * x + y * y) / Math.Cos(f)); 43 | f1 = Math.Atan(p / nnq); 44 | f2 = f; 45 | f = f1; 46 | } while (!(Math.Abs(f2 - f1) < 10E-10)); 47 | b = f * 180 / Pi; 48 | l = Math.Atan(y / x) * 180 / Pi; 49 | if (l < 0) 50 | l += 180; 51 | h = Math.Sqrt(x * x + y * y) / Math.Cos(f1) - a / Math.Sqrt(1 - eq * Math.Sin(f1) * Math.Sin(f1)); 52 | return new BLHCoordinate(b, l, h); 53 | } 54 | 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /CoordConvertDLL/bin/Debug/CoordConvert.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NewMapper/CoordConvert/f0fab366a1a6c0090417061a605f14f48904ecba/CoordConvertDLL/bin/Debug/CoordConvert.dll -------------------------------------------------------------------------------- /CoordConvertDLL/bin/Debug/CoordConvert.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NewMapper/CoordConvert/f0fab366a1a6c0090417061a605f14f48904ecba/CoordConvertDLL/bin/Debug/CoordConvert.pdb -------------------------------------------------------------------------------- /CoordConvertDLL/obj/Debug/CoordConvert.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NewMapper/CoordConvert/f0fab366a1a6c0090417061a605f14f48904ecba/CoordConvertDLL/obj/Debug/CoordConvert.dll -------------------------------------------------------------------------------- /CoordConvertDLL/obj/Debug/CoordConvert.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NewMapper/CoordConvert/f0fab366a1a6c0090417061a605f14f48904ecba/CoordConvertDLL/obj/Debug/CoordConvert.pdb -------------------------------------------------------------------------------- /CoordConvertDLL/obj/Debug/CoordConvertDLL.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | D:\空间信息科学\GPS\CoordConvert\CoordConvertDLL\obj\Debug\ResolveAssemblyReference.cache 2 | D:\空间信息科学\GPS\CoordConvert\CoordConvertDLL\bin\Debug\CoordConvert.dll 3 | D:\空间信息科学\GPS\CoordConvert\CoordConvertDLL\bin\Debug\CoordConvert.pdb 4 | D:\空间信息科学\GPS\CoordConvert\CoordConvertDLL\obj\Debug\CoordConvert.dll 5 | D:\空间信息科学\GPS\CoordConvert\CoordConvertDLL\obj\Debug\CoordConvert.pdb 6 | D:\3S\GPS\CoordConvert\CoordConvertDLL\bin\Debug\CoordConvert.dll 7 | D:\3S\GPS\CoordConvert\CoordConvertDLL\bin\Debug\CoordConvert.pdb 8 | D:\3S\GPS\CoordConvert\CoordConvertDLL\obj\Debug\ResolveAssemblyReference.cache 9 | D:\3S\GPS\CoordConvert\CoordConvertDLL\obj\Debug\CoordConvert.dll 10 | D:\3S\GPS\CoordConvert\CoordConvertDLL\obj\Debug\CoordConvert.pdb 11 | -------------------------------------------------------------------------------- /CoordConvertDLL/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NewMapper/CoordConvert/f0fab366a1a6c0090417061a605f14f48904ecba/CoordConvertDLL/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /CoordConvertDLL/obj/Debug/ResolveAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NewMapper/CoordConvert/f0fab366a1a6c0090417061a605f14f48904ecba/CoordConvertDLL/obj/Debug/ResolveAssemblyReference.cache -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CoordConvert 2 | 空间坐标、经纬度坐标的七参数、四参数转换以及高斯投影正反算 3 | --------------------------------------------------------------------------------