diff --git a/model/contour-map/contour-map.json b/model/contour-map/contour-map.json index 4f7e95a..04929da 100644 --- a/model/contour-map/contour-map.json +++ b/model/contour-map/contour-map.json @@ -25,6 +25,6 @@ "button": "#9FB4D4", "frame": "#0A1524" }, - "updatedAt": "2026-11-14T04:41:38Z", - "build": "e4299c5c99" + "updatedAt": "2026-11-14T04:52:33Z", + "build": "6824878fe5" } diff --git a/model/contour-map/contour-map.model/ContourMapModel.dll b/model/contour-map/contour-map.model/ContourMapModel.dll index c44b4df..37e543f 100644 Binary files a/model/contour-map/contour-map.model/ContourMapModel.dll and b/model/contour-map/contour-map.model/ContourMapModel.dll differ diff --git a/model/contour-map/src/ContourView.cs b/model/contour-map/src/ContourView.cs index 61084ff..73816c3 100644 --- a/model/contour-map/src/ContourView.cs +++ b/model/contour-map/src/ContourView.cs @@ -50,6 +50,15 @@ public sealed class ContourView : Control // ── 交互状态 private double _hoverU = 0.5, _hoverV = 0.5; private bool _hasHover; + private Point _pointerPosition; + private HoverRegion _hoverRegion; + + private enum HoverRegion + { + None, + Terrain, + ContourMap + } private bool _showContours = true; private bool _showLabels = true; @@ -106,7 +115,7 @@ public sealed class ContourView : Control var p = e.GetPosition(this); UpdateHover(p); }; - PointerExited += (_, _) => { _hasHover = false; InvalidateVisual(); }; + PointerExited += (_, _) => ClearHover(); } private void UpdateHover(Point p) @@ -115,21 +124,31 @@ public sealed class ContourView : Control if (size.Width < 40 || size.Height < 40) return; var (left, right) = SplitRects(size); + var map = ContourMapRect(right); double u = -1, v = -1; + var region = HoverRegion.None; - if (right.Contains(p)) + if (map.Contains(p)) { - u = (p.X - right.X) / right.Width; - v = (p.Y - right.Y) / right.Height; + u = (p.X - map.X) / map.Width; + v = (p.Y - map.Y) / map.Height; + region = HoverRegion.ContourMap; } else if (left.Contains(p)) { // 左图是斜视图,做逆变换近似:把点击位置反投到 u/v (u, v) = UnprojectIso(left, p); + region = HoverRegion.Terrain; } - if (u < 0 || u > 1 || v < 0 || v > 1) return; + if (region == HoverRegion.None || u < 0 || u > 1 || v < 0 || v > 1) + { + ClearHover(); + return; + } _hoverU = u; _hoverV = v; _hasHover = true; + _pointerPosition = p; + _hoverRegion = region; var h = Field.SampleSmooth(u, v); var f = TerrainAnalyzer.Classify(Field, u, v); @@ -137,6 +156,14 @@ public sealed class ContourView : Control InvalidateVisual(); } + private void ClearHover() + { + if (!_hasHover) return; + _hasHover = false; + _hoverRegion = HoverRegion.None; + InvalidateVisual(); + } + private (Rect Left, Rect Right) SplitRects(Size size) { var pad = 16.0; @@ -146,6 +173,14 @@ public sealed class ContourView : Control new Rect(pad * 2 + half, pad, half, h)); } + private static Rect ContourMapRect(Rect panel) + { + var profileHeight = Math.Min(132, panel.Height * 0.30); + return profileHeight > 50 + ? new Rect(panel.X, panel.Y, panel.Width, panel.Height - profileHeight) + : panel; + } + // ---------------------------------------------------------------- 渲染 public override void Render(DrawingContext dc) @@ -221,7 +256,9 @@ public sealed class ContourView : Control if (_hasHover) { var h = Field.SampleSmooth(_hoverU, _hoverV); - var p = Project(_hoverU, _hoverV, h); + var p = _hoverRegion == HoverRegion.Terrain + ? _pointerPosition + : Project(_hoverU, _hoverV, h); dc.DrawEllipse(new SolidColorBrush(Colors.White), new Pen(new SolidColorBrush(CAccent), 2), p, 5, 5); var stem = new Point(p.X, p.Y + 30); @@ -245,9 +282,10 @@ public sealed class ContourView : Control // ---- 右侧:等高线俯视图 ---- private void DrawContourMap(DrawingContext dc, Rect r) { - // 底部预留剖面图的空间 - var profileH = Math.Min(132, r.Height * 0.30); - if (profileH > 50) r = new Rect(r.X, r.Y, r.Width, r.Height - profileH); + var panel = r; + var mapRect = ContourMapRect(panel); + var profileRect = new Rect(panel.X, mapRect.Bottom, panel.Width, panel.Bottom - mapRect.Bottom); + r = mapRect; // 分层设色底图 const int N = 96; for (var j = 0; j < N; j++) @@ -379,7 +417,7 @@ public sealed class ContourView : Control DrawNorthArrow(dc, r); DrawScaleBar(dc, r); DrawLegend(dc, r); - DrawProfile(dc, r); + if (profileRect.Height > 50) DrawProfile(dc, profileRect, mapRect); // 边框 dc.DrawRectangle(null, new Pen(new SolidColorBrush(CLine), 1.2), r); @@ -389,10 +427,8 @@ public sealed class ContourView : Control /// 地形剖面图(教科书等高线图必配):沿图幅中部的一条南北剖面线, /// 画出地面起伏并标注各点海拔。这是最能体现「等高线图 ↔ 立体地形」关系的图。 /// - private void DrawProfile(DrawingContext dc, Rect mapRect) + private void DrawProfile(DrawingContext dc, Rect r, Rect mapRect) { - var h = Math.Min(132, mapRect.Height * 0.30); - var r = new Rect(mapRect.X, mapRect.Bottom - h, mapRect.Width, h); if (r.Height < 50) return; // 背景 diff --git a/model/earth-geography/earth-geography.json b/model/earth-geography/earth-geography.json index b251d13..15abb3a 100644 --- a/model/earth-geography/earth-geography.json +++ b/model/earth-geography/earth-geography.json @@ -18,7 +18,7 @@ ], "dataDir": "earth-geography.model", "version": "1.8", - "updatedAt": "2026-11-14T04:41:38Z", + "updatedAt": "2026-11-14T04:52:33Z", "chrome": { "titleBar": "#0C1828", "titleBorder": "#1B2740", @@ -26,5 +26,5 @@ "button": "#9FB4D4", "frame": "#0A1524" }, - "build": "64b985e484" + "build": "e06308cb71" } diff --git a/model/earth-geography/earth-geography.model/EarthGeographyModel.dll b/model/earth-geography/earth-geography.model/EarthGeographyModel.dll index f2c87d9..694d84d 100644 Binary files a/model/earth-geography/earth-geography.model/EarthGeographyModel.dll and b/model/earth-geography/earth-geography.model/EarthGeographyModel.dll differ diff --git a/model/earth-revolution/earth-revolution.json b/model/earth-revolution/earth-revolution.json index 793e828..bd3709e 100644 --- a/model/earth-revolution/earth-revolution.json +++ b/model/earth-revolution/earth-revolution.json @@ -24,7 +24,7 @@ "preview": "preview.png", "apiVersion": 1, "version": "1.6", - "updatedAt": "2026-11-14T04:41:38Z", + "updatedAt": "2026-11-14T04:52:33Z", "chrome": { "titleBar": "#0C1828", "titleBorder": "#1B2740", @@ -32,5 +32,5 @@ "button": "#9FB4D4", "frame": "#0A1524" }, - "build": "7fda246d48" + "build": "dfe649ec3c" } diff --git a/model/earth-revolution/earth-revolution.model/EarthRevolutionModel.dll b/model/earth-revolution/earth-revolution.model/EarthRevolutionModel.dll index 5bfe61b..b27e335 100644 Binary files a/model/earth-revolution/earth-revolution.model/EarthRevolutionModel.dll and b/model/earth-revolution/earth-revolution.model/EarthRevolutionModel.dll differ diff --git a/model/earth-rotation/earth-rotation.json b/model/earth-rotation/earth-rotation.json index 61d8f5c..824bbb2 100644 --- a/model/earth-rotation/earth-rotation.json +++ b/model/earth-rotation/earth-rotation.json @@ -24,7 +24,7 @@ "preview": "preview.png", "apiVersion": 1, "version": "1.6", - "updatedAt": "2026-11-14T04:41:38Z", + "updatedAt": "2026-11-14T04:52:33Z", "chrome": { "titleBar": "#0C1828", "titleBorder": "#1B2740", @@ -32,5 +32,5 @@ "button": "#9FB4D4", "frame": "#0A1524" }, - "build": "446633f2b9" + "build": "ea8cf4a843" } diff --git a/model/earth-rotation/earth-rotation.model/EarthRotationModel.dll b/model/earth-rotation/earth-rotation.model/EarthRotationModel.dll index ff390db..5822019 100644 Binary files a/model/earth-rotation/earth-rotation.model/EarthRotationModel.dll and b/model/earth-rotation/earth-rotation.model/EarthRotationModel.dll differ diff --git a/model/scale-calculator/scale-calculator.json b/model/scale-calculator/scale-calculator.json index ef205b4..21edf09 100644 --- a/model/scale-calculator/scale-calculator.json +++ b/model/scale-calculator/scale-calculator.json @@ -25,7 +25,7 @@ "preview": "preview.png", "apiVersion": 1, "version": "1.5", - "updatedAt": "2026-11-14T04:41:38Z", + "updatedAt": "2026-11-14T04:52:33Z", "chrome": { "titleBar": "#FFFFFF", "titleBorder": "#E3E8F3", @@ -33,5 +33,5 @@ "button": "#5B6A86", "frame": "#F4F6FB" }, - "build": "f7913ac484" + "build": "139afd4199" } diff --git a/model/scale-calculator/scale-calculator.model/ScaleCalculatorModel.dll b/model/scale-calculator/scale-calculator.model/ScaleCalculatorModel.dll index 3763f61..13eec5b 100644 Binary files a/model/scale-calculator/scale-calculator.model/ScaleCalculatorModel.dll and b/model/scale-calculator/scale-calculator.model/ScaleCalculatorModel.dll differ diff --git a/model/scale-calculator/scale-calculator.model/preview.png b/model/scale-calculator/scale-calculator.model/preview.png index ace9b69..b4075bb 100644 Binary files a/model/scale-calculator/scale-calculator.model/preview.png and b/model/scale-calculator/scale-calculator.model/preview.png differ diff --git a/model/version.json b/model/version.json index 81ff54a..bafe588 100644 --- a/model/version.json +++ b/model/version.json @@ -1,6 +1,6 @@ { "schema": 1, - "generated": "2026-11-14T04:41:38Z", + "generated": "2026-11-14T04:52:33Z", "repository": "https://gitcode.com/2509_92447106/GC", "branch": "main", "modelDir": "model", @@ -34,31 +34,31 @@ { "id": "contour-map", "version": "1.0", - "build": "e4299c5c99", + "build": "6824878fe5", "dir": "model/contour-map" }, { "id": "earth-geography", "version": "1.8", - "build": "64b985e484", + "build": "e06308cb71", "dir": "model/earth-geography" }, { "id": "earth-revolution", "version": "1.6", - "build": "7fda246d48", + "build": "dfe649ec3c", "dir": "model/earth-revolution" }, { "id": "earth-rotation", "version": "1.6", - "build": "446633f2b9", + "build": "ea8cf4a843", "dir": "model/earth-rotation" }, { "id": "scale-calculator", "version": "1.5", - "build": "f7913ac484", + "build": "139afd4199", "dir": "model/scale-calculator" } ] diff --git a/version.json b/version.json index 81ff54a..bafe588 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "schema": 1, - "generated": "2026-11-14T04:41:38Z", + "generated": "2026-11-14T04:52:33Z", "repository": "https://gitcode.com/2509_92447106/GC", "branch": "main", "modelDir": "model", @@ -34,31 +34,31 @@ { "id": "contour-map", "version": "1.0", - "build": "e4299c5c99", + "build": "6824878fe5", "dir": "model/contour-map" }, { "id": "earth-geography", "version": "1.8", - "build": "64b985e484", + "build": "e06308cb71", "dir": "model/earth-geography" }, { "id": "earth-revolution", "version": "1.6", - "build": "7fda246d48", + "build": "dfe649ec3c", "dir": "model/earth-revolution" }, { "id": "earth-rotation", "version": "1.6", - "build": "446633f2b9", + "build": "ea8cf4a843", "dir": "model/earth-rotation" }, { "id": "scale-calculator", "version": "1.5", - "build": "f7913ac484", + "build": "139afd4199", "dir": "model/scale-calculator" } ]