发布:完整项目代码(三视图 + 词条数据 + 加载页等)
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
|
||||
import math
|
||||
|
||||
from region_codes import make_code
|
||||
|
||||
DATA = [
|
||||
# ===================== 史前 =====================
|
||||
("~ BC 3,200,000", -3200000, "东非 · 埃塞俄比亚", "露西 · 南方古猿", "人", "fossil", 11.2, 40.5, "1974年在埃塞俄比亚哈达尔发现的一具约40%完整的南方古猿阿法种骨架,是直立行走的最早证据之一,被亲切地称为“人类祖母”。"),
|
||||
@@ -360,6 +362,44 @@ def dedupe(entries, km=DEDUP_KM):
|
||||
return out
|
||||
|
||||
DEDUPED = dedupe(DATA)
|
||||
|
||||
# —— 素描多样分配:同类主题轮换到不同画风,避免同一张素描重复出现 ——
|
||||
SKETCH_POOLS = {
|
||||
'sword': ['sword', 'helmet', 'cannon', 'fortress', 'bow', 'shield'],
|
||||
'crown': ['crown', 'throne', 'scepter', 'palace', 'laurel'],
|
||||
'machine': ['machine', 'gear', 'anvil', 'locomotive', 'factory'],
|
||||
'atom': ['atom', 'microscope', 'telescope', 'flask', 'lightbulb'],
|
||||
'scale': ['scale', 'gavel', 'columns', 'document'],
|
||||
'ship': ['ship', 'anchor', 'compass', 'globe'],
|
||||
'fossil': ['fossil', 'dinosaur', 'mountain'],
|
||||
'tablet': ['tablet', 'coin', 'document', 'hourglass'],
|
||||
'scroll': ['scroll', 'book', 'document', 'lyre'],
|
||||
'temple': ['temple', 'columns', 'palace', 'pyramid'],
|
||||
'colosseum': ['colosseum', 'fortress', 'helmet'],
|
||||
'figure': ['figure', 'mask', 'lyre'],
|
||||
'flag': ['flag', 'laurel', 'mountain', 'dove'],
|
||||
'bell': ['bell', 'gavel', 'document'],
|
||||
'rocket': ['rocket', 'telescope', 'lightbulb', 'compass'],
|
||||
'pyramid': ['pyramid', 'temple', 'palace', 'mountain'],
|
||||
'apple': ['apple', 'flask', 'tree', 'flower'],
|
||||
'book': ['book', 'scroll', 'document', 'key'],
|
||||
'tree': ['tree', 'flower', 'dinosaur'],
|
||||
'dove': ['dove', 'laurel', 'flag'],
|
||||
'globe': ['globe', 'compass', 'anchor', 'ship'],
|
||||
'horseman': ['horseman', 'bow', 'fortress', 'helmet'],
|
||||
}
|
||||
_pool_idx = {}
|
||||
def _reassign(e):
|
||||
pool = SKETCH_POOLS.get(e[5])
|
||||
if not pool:
|
||||
return e
|
||||
k = e[5]
|
||||
idx = _pool_idx.get(k, 0)
|
||||
s = pool[idx % len(pool)]
|
||||
_pool_idx[k] = idx + 1
|
||||
return (e[0], e[1], e[2], e[3], e[4], s, e[6], e[7], e[8])
|
||||
|
||||
DEDUPED = [_reassign(e) for e in DEDUPED]
|
||||
print(f"坐标去重:{len(DATA)} -> {len(DEDUPED)} 条(阈值 {DEDUP_KM} km)")
|
||||
|
||||
def esc(s):
|
||||
@@ -397,6 +437,7 @@ lines = ["// 世界历史里程碑条目数据",
|
||||
for i, (time, tn, region, name, cat, sketch, lat, lng, desc) in enumerate(DEDUPED, 1):
|
||||
lines.append(" {")
|
||||
lines.append(f" id: 'No.{i:03d}',")
|
||||
lines.append(f" code: '{esc(make_code(tn, region, lat, lng, i, name, cat))}',")
|
||||
lines.append(f" time: '{esc(normalize_time(time, tn))}',")
|
||||
lines.append(f" timeNumeric: {tn},")
|
||||
lines.append(f" region: '{esc(region)}',")
|
||||
|
||||
Reference in New Issue
Block a user