コード例 #1
0
        public static void OpenInGoogleEarth(Stream stream)
        {
            // create file from stream
              var reader = new BinaryReader(stream);
              stream.Position = 0;
              var data = reader.ReadBytes((int)stream.Length);
              reader.Close();
              var fileName = CommonUtil.GetTempFileName("kmz");
              var fileStream = File.Create(fileName);
              fileStream.Write(data, 0, data.Length);
              fileStream.Close();
              fileStream.Dispose();

              var googleEarthApplication = new EARTHLib.ApplicationGEClass();
              googleEarthApplication.OpenKmlFile(fileName, 1);
              BringWindowToForeground((IntPtr)googleEarthApplication.GetMainHwnd());
        }
コード例 #2
0
ファイル: GoogleEarthUtil.cs プロジェクト: gabbe/quickroute
        public static void OpenInGoogleEarth(Stream stream)
        {
            // create file from stream
            var reader = new BinaryReader(stream);

            stream.Position = 0;
            var data = reader.ReadBytes((int)stream.Length);

            reader.Close();
            var fileName   = CommonUtil.GetTempFileName("kmz");
            var fileStream = File.Create(fileName);

            fileStream.Write(data, 0, data.Length);
            fileStream.Close();
            fileStream.Dispose();

            var googleEarthApplication = new EARTHLib.ApplicationGEClass();

            googleEarthApplication.OpenKmlFile(fileName, 1);
            BringWindowToForeground((IntPtr)googleEarthApplication.GetMainHwnd());
        }