コード例 #1
0
ファイル: XLETerrainGob.cs プロジェクト: coreafive/XLE
        internal void DoExport(XLETerrainGob terrain)
        {
            if (terrain == null)
            {
                return;
            }

            var fileDlg = new SaveFileDialog();

            fileDlg.Filter = "Tiff files|*.tiff;*.tif";
            if (fileDlg.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    terrain.Unload();
                    using (var progress = new ControlsLibrary.ProgressDialog.ProgressInterface())
                    {
                        GUILayer.EditorInterfaceUtils.ExecuteTerrainExport(
                            fileDlg.FileName,
                            terrain.BuildEngineConfig(),
                            terrain.UberSurfaceDirectory,
                            LayerId, progress);
                    }
                    terrain.Reload();
                }
                catch
                {
                    MessageBox.Show(
                        "Export operation failed", "Terrain coverage export",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                }
            }
        }
コード例 #2
0
        void DoRebuildCellFiles(XLETerrainGob terrain)
        {
            if (terrain == null)
            {
                return;
            }

            terrain.Unload();

            try
            {
                using (var progress = new ControlsLibrary.ProgressDialog.ProgressInterface())
                {
                    GUILayer.EditorInterfaceUtils.GenerateCellFiles(
                        terrain.BuildEngineConfig(), terrain.UberSurfaceDirectory.LocalPath, true,
                        LayerId, progress);
                }
            }
            catch (Exception e)
            {
                XLETerrainGob.Show(e, "Rebuilding cell files");
            }

            terrain.Reload();
        }
コード例 #3
0
        internal void DoExport(XLETerrainGob terrain)
        {
            if (terrain == null)
            {
                return;
            }

            var fileDlg = new SaveFileDialog();

            fileDlg.Filter = "Tiff files|*.tiff;*.tif";
            if (fileDlg.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    terrain.Unload();
                    using (var progress = new ControlsLibrary.ProgressDialog.ProgressInterface())
                    {
                        GUILayer.EditorInterfaceUtils.ExecuteTerrainExport(
                            fileDlg.FileName,
                            terrain.BuildEngineConfig(),
                            terrain.UberSurfaceDirectory.LocalPath,
                            LayerId, progress);
                    }
                    terrain.Reload();
                }
                catch (Exception e)
                {
                    XLETerrainGob.Show(e, "Terrain export to tiff");
                }
            }
        }
コード例 #4
0
        internal bool Reconfigure(TerrainCoverageConfig.Config cfg, XLETerrainGob terrain)
        {
            if (terrain != null)
            {
                terrain.Unload();   // (have to unload to write to ubersurface)
            }
            try
            {
                // If an import or create operation was requested, we
                // must perform those now. Note that this might require
                // some format changes.
                if (cfg.Import == TerrainCoverageConfig.Config.ImportType.DEMFile &&
                    cfg.SourceFile != null && cfg.SourceFile.Length > 0 &&
                    terrain != null)
                {
                    using (var progress = new ControlsLibrary.ProgressDialog.ProgressInterface())
                    {
                        cfg.ImportOp.Execute(
                            terrain.UberSurfaceDirectory.LocalPath,
                            cfg.Id, cfg.ImportOp.ImportCoverageFormat,
                            progress);
                    }
                    Format = cfg.ImportOp.ImportCoverageFormat;
                }
                else if (cfg.Import == TerrainCoverageConfig.Config.ImportType.NewBlankTerrain)
                {
                    // todo -- create new blank coverage with the given format
                }
            }
            catch (Exception e)
            {
                XLETerrainGob.Show(e, "Terrain import operation");
                return(false);
            }

            CommitDialogConfig(cfg);

            if (terrain != null)
            {
                terrain.Reconfigure();
            }
            return(true);
        }