Esempio n. 1
0
 internal void CommitDialogConfig(TerrainCoverageConfig.Config cfg)
 {
     Resolution = cfg.Resolution;
     SourceFile = cfg.SourceFile;
     Enable     = cfg.Enable;
     LayerId    = cfg.Id;
     ShaderNormalizationMode = cfg.ShaderNormalizationMode;
 }
Esempio n. 2
0
 internal void CommitDialogConfig(TerrainCoverageConfig.Config cfg)
 {
     Resolution = cfg.Resolution;
     SourceFile = String.IsNullOrEmpty(cfg.SourceFile) ? null : new Uri(cfg.SourceFile);
     Enable     = cfg.Enable;
     LayerId    = cfg.Id;
     ShaderNormalizationMode = cfg.ShaderNormalizationMode;
 }
Esempio n. 3
0
        internal TerrainCoverageConfig.Config BuildDialogConfig(XLETerrainGob terrain)
        {
            var cfg = new TerrainCoverageConfig.Config();

            cfg.NodeDimensions = terrain.NodeDimensions;
            cfg.CellTreeDepth  = terrain.CellTreeDepth;

            cfg.Resolution = Resolution;
            cfg.SourceFile = SourceFile;
            cfg.Enable     = Enable;
            cfg.Id         = LayerId;
            cfg.ShaderNormalizationMode = ShaderNormalizationMode;
            return(cfg);
        }
Esempio n. 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);
        }