From 39b861d4d1da53feb5ac3b84c7453aa9f6a91412 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期三, 16 八月 2023 15:59:23 +0800
Subject: [PATCH] 1

---
 ExportMap/cs/TerraUtils.cs |   29 +++++++++++++++++++++++------
 1 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/ExportMap/cs/TerraUtils.cs b/ExportMap/cs/TerraUtils.cs
index 3c0f599..0340cef 100644
--- a/ExportMap/cs/TerraUtils.cs
+++ b/ExportMap/cs/TerraUtils.cs
@@ -13,10 +13,27 @@
     {
         private static string pyFile;
 
+        private static int terrainMaxLevel = 0;
+
         /// <summary>
-        /// 榛樿鏈�澶х骇鍒�
+        /// 鍦板舰鏈�澶х骇鍒�
         /// </summary>
-        public static int DEFAULT_MAX_LEVEL = 16;
+        public static int TERRAIN_MAX_LEVEL
+        {
+            get
+            {
+                if (0 == terrainMaxLevel)
+                {
+                    string str = Tools.GetSetting("terrainMaxLevel");
+                    if (!int.TryParse(str, out terrainMaxLevel))
+                    {
+                        terrainMaxLevel = 14;
+                    }
+                }
+
+                return terrainMaxLevel;
+            }
+        }
 
         /// <summary>
         /// 榛樿鏈�澶ф枃浠跺ぇ灏忥細5GB
@@ -170,7 +187,7 @@
                 else
                 {
                     //if (File.Exists(tifFile)) File.Delete(tifFile);
-                    //WriteText(txtFile, metas, null);
+                    WriteText(txtFile, metas, null);
                     if (File.Exists(tifFile)) return tifFile;
                 }
 
@@ -225,7 +242,7 @@
         private static int GetTerrainMaxLevel(XYZArgs args, string tifFile)
         {
             FileInfo fi = new FileInfo(tifFile);
-            if (fi.Length > DDEFAULT_MAX_SIZE) return DEFAULT_MAX_LEVEL;
+            if (fi.Length > DDEFAULT_MAX_SIZE) return TERRAIN_MAX_LEVEL;
 
             string ctbPath = Tools.GetSetting("ctbPath");
             string dirPath = GetTerrainPath(args.dircode);
@@ -236,7 +253,7 @@
             Tools.ExecCmd(new List<string>() { gdal_data, createLayer });
 
             string layerJson = Path.Combine(dirPath, "layer.json");
-            if (!File.Exists(layerJson)) return DEFAULT_MAX_LEVEL;
+            if (!File.Exists(layerJson)) return TERRAIN_MAX_LEVEL;
 
             string[] lines = File.ReadAllLines(layerJson, Encoding.UTF8);
 
@@ -247,7 +264,7 @@
             }
             if (File.Exists(layerJson)) File.Delete(layerJson);
 
-            return level > DEFAULT_MAX_LEVEL ? DEFAULT_MAX_LEVEL : level;
+            return level > TERRAIN_MAX_LEVEL ? TERRAIN_MAX_LEVEL : level;
         }
 
         /// <summary>

--
Gitblit v1.9.3