管道基础大数据平台系统开发-【CS】-ExportMap
13693261870
2024-01-02 137e1aba5c31b24df51d801814c413c752c0d637
添加基础工具栏
已添加3个文件
已修改5个文件
385 ■■■■■ 文件已修改
TEWin/FrmTool.Designer.cs 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
TEWin/FrmTool.cs 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
TEWin/FrmTool.resx 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
TEWin/FrmTree.Designer.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
TEWin/FrmWin.Designer.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
TEWin/FrmWin.cs 144 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
TEWin/TEWin.csproj 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
TEWin/app.config 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
TEWin/FrmTool.Designer.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,74 @@
namespace TEWin
{
    partial class FrmTool
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.txtCode = new System.Windows.Forms.TextBox();
            this.btnTest = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // txtCode
            //
            this.txtCode.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtCode.Location = new System.Drawing.Point(13, 32);
            this.txtCode.Name = "txtCode";
            this.txtCode.Size = new System.Drawing.Size(391, 26);
            this.txtCode.TabIndex = 1;
            this.txtCode.Text = "0xc0";
            //
            // btnTest
            //
            this.btnTest.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.btnTest.Location = new System.Drawing.Point(417, 32);
            this.btnTest.Name = "btnTest";
            this.btnTest.Size = new System.Drawing.Size(75, 26);
            this.btnTest.TabIndex = 0;
            this.btnTest.Text = "Test";
            this.btnTest.UseVisualStyleBackColor = true;
            this.btnTest.Click += new System.EventHandler(this.btnTest_Click);
            //
            // FrmTool
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(504, 89);
            this.Controls.Add(this.btnTest);
            this.Controls.Add(this.txtCode);
            this.Name = "FrmTool";
            this.Text = "FrmTool";
            this.ResumeLayout(false);
            this.PerformLayout();
        }
        #endregion
        private System.Windows.Forms.TextBox txtCode;
        private System.Windows.Forms.Button btnTest;
    }
}
TEWin/FrmTool.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace TEWin
{
    public partial class FrmTool : Form
    {
        FrmWin win;
        public FrmTool(FrmWin win)
        {
            this.win = win;
            InitializeComponent();
        }
        private void btnTest_Click(object sender, EventArgs e)
        {
            string str = this.txtCode.Text.Trim().Replace("0x", "");
            if (string.IsNullOrWhiteSpace(str)) return;
            int code = Convert.ToInt32(str, 16);
            win.InvokeProc(code);
        }
    }
}
TEWin/FrmTool.resx
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema
    Version 2.0
    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.
    Example:
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
    There are any number of "resheader" rows that contain simple
    name/value pairs.
    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.
    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:
    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
</root>
TEWin/FrmTree.Designer.cs
@@ -54,7 +54,6 @@
            this.Margin = new System.Windows.Forms.Padding(2);
            this.Name = "FrmTree";
            this.Text = "FrmTree";
            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
            ((System.ComponentModel.ISupportInitialize)(this.axTETree)).EndInit();
            this.ResumeLayout(false);
TEWin/FrmWin.Designer.cs
@@ -55,7 +55,6 @@
            this.Name = "FrmWin";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "FrmWin";
            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
            ((System.ComponentModel.ISupportInitialize)(this.axTEWin)).EndInit();
            this.ResumeLayout(false);
TEWin/FrmWin.cs
@@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
@@ -15,6 +17,10 @@
{
    public partial class FrmWin : Form
    {
        FrmTree tree;
        FrmTool tool;
        public SGWorld74 SG = null;
        public static string StartupPath
@@ -49,8 +55,20 @@
                SG.OnLoadFinished += SG_OnLoadFinished;
                SG.Open(fly);
                FrmTree tree = new FrmTree();
                tree = new FrmTree();
                tree.Show(this);
                string isTest = ConfigurationManager.AppSettings["isTest"];
                if ("1".Equals(isTest))
                {
                    tool = new FrmTool(this);
                    tool.Show();
                }
                else
                {
                    this.WindowState = FormWindowState.Maximized;
                    tree.WindowState = FormWindowState.Maximized;
                }
            }
            catch (Exception ex)
@@ -68,5 +86,129 @@
        {
            LogOut.Info("关闭程序.");
        }
        protected override void DefWndProc(ref Message m)
        {
            switch (m.Msg)
            {
                case 0xc0: // é‡ç½®é¼ æ ‡æ¨¡å¼
                    SG.Window.SetInputMode(0);
                    break;
                case 0xc1: // æ‰“开数据方案/打开显示场景
                    SG.Command.Execute(1001, null);
                    break;
                case 0xc2: // ä¿å­˜æ•°æ®æ–¹æ¡ˆ/保存显示场景
                    SG.Command.Execute(1003, null);
                    break;
                case 0xc3: // çŸ¢é‡æ•°æ®(默认为*.shp)
                    SG.Command.Execute(1013, 5);
                    break;
                case 0xc4: // å½±åƒæ•°æ®(默认为*.tif)
                    SG.Command.Execute(1014, 9);
                    break;
                case 0xc5: // åœ°å½¢æ•°æ®(默认为*.tif)
                    SG.Command.Execute(1014, 26);
                    break;
                case 0xc6: // æ¨¡åž‹æ•°æ®(*.osgb)
                    //SG.Command.Execute(2342, null);
                    string path = Path.Combine(ConfigurationManager.AppSettings["tePath"], "MeshLayerTool.exe");
                    string args = " -RunApp TerraExplorer -RunConvertor -Mode ImportMeshLayer -Type osgb";
                    ExecCmd(new List<string> { "taskkill /f /t /im MeshLayerTool.exe" });
                    RunExe(path, args, false);
                    break;
                case 0xc7: // æ¨¡åž‹æ•°æ®(*.obj)
                    SG.Command.Execute(1012, 13);
                    break;
                case 0xd1: // ç‚¹é‡ç®—
                    SG.Command.Execute(1023, null);
                    break;
                case 0xd2: // è·ç¦»é‡ç®—
                    SG.Command.Execute(2356, null);
                    break;
                case 0xd3: // é¢ç§¯é‡ç®—
                    if (SG.Command.IsChecked(2359, null))
                        SG.Window.SetInputMode(0);
                    else
                        SG.Command.Execute(2359, null);
                    break;
                /*
*/
                default:
                    base.DefWndProc(ref m);
                    break;
            }
        }
        public void InvokeProc(int code)
        {
            Message m = new Message();
            m.Msg = code;
            this.DefWndProc(ref m);
        }
        public void RunExe(string path, string args, bool noWindow = true)
        {
            Process p = new Process();
            p.StartInfo.FileName = path;
            p.StartInfo.Arguments = args;
            p.StartInfo.CreateNoWindow = noWindow;
            p.StartInfo.UseShellExecute = false;
            p.Start();
        }
        public static string ExecCmd(List<string> list)
        {
            string str = null;
            Process p = null;
            try
            {
                p = new Process();
                p.StartInfo.FileName = "cmd.exe";
                p.StartInfo.UseShellExecute = false;
                p.StartInfo.CreateNoWindow = true;
                p.StartInfo.RedirectStandardInput = true;
                p.StartInfo.RedirectStandardOutput = true;
                p.StartInfo.RedirectStandardError = true;
                p.Start();
                StreamWriter si = p.StandardInput;
                StreamReader se = p.StandardError;
                LogOut.Info("cmd = " + string.Join(",", list));
                si.AutoFlush = true;
                foreach (string cmd in list)
                {
                    si.WriteLine(cmd);
                }
                si.WriteLine("exit");
                str = se.ReadToEnd();
                se.Close();
                si.Close();
            }
            catch (Exception ex)
            {
                LogOut.Error(ex.Message + "\r\n" + ex.StackTrace);
                str = ex.Message;
            }
            finally
            {
                if (p != null)
                {
                    p.Close();
                }
            }
            return str;
        }
    }
}
TEWin/TEWin.csproj
@@ -69,6 +69,7 @@
      <HintPath>Fly\Newtonsoft.Json.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.configuration" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
@@ -81,6 +82,12 @@
  </ItemGroup>
  <ItemGroup>
    <Compile Include="CS\LogOut.cs" />
    <Compile Include="FrmTool.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="FrmTool.Designer.cs">
      <DependentUpon>FrmTool.cs</DependentUpon>
    </Compile>
    <Compile Include="FrmTree.cs">
      <SubType>Form</SubType>
    </Compile>
@@ -95,6 +102,9 @@
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <EmbeddedResource Include="FrmTool.resx">
      <DependentUpon>FrmTool.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="FrmTree.resx">
      <DependentUpon>FrmTree.cs</DependentUpon>
    </EmbeddedResource>
TEWin/app.config
@@ -1,6 +1,8 @@
<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="isTest" value="1"/>
    <add key="tePath" value="C:\Program Files\Skyline\TerraExplorer Pro"/>
  </appSettings>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>