Skip to content

Commit 7d38d76

Browse files
kochizufanclaude
andcommitted
feat: V3フォーマット対応 (0.5.0)
feature/v3-boundary-algorithm の成果を MaplatTransform に移植。 - V3 compiled フォーマット(N境界頂点)の読み込みに対応 - テストケース・compiled ファイルを MaplatTin から移行 - デモを demo/ に整備(MaplatTin と同構成) - コードレビュー指摘事項を修正 - GitHub Pages CI/CD 設定 - README V3 対応を追記 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2 parents 40c0673 + b8577e6 commit 7d38d76

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+397164
-308
lines changed

.claude/settings.local.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"mcp__serena__list_dir",
5+
"mcp__serena__activate_project",
6+
"mcp__serena__get_symbols_overview",
7+
"Bash(wc -l /Users/kochizufan/github/MaplatTransform/src/*.ts /Users/kochizufan/github/MaplatTransform/tests/*.ts)",
8+
"Bash(npm test:*)",
9+
"Bash(xargs ls:*)",
10+
"Bash(npm run:*)"
11+
]
12+
}
13+
}

.github/workflows/deploy.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,20 @@ jobs:
2424
- name: Setup Node.js
2525
uses: actions/setup-node@v4
2626
with:
27-
node-version: 20
27+
node-version: 22
2828
cache: "pnpm"
2929

3030
- name: Install dependencies
3131
run: pnpm install
3232

3333
- name: Build demo site
3434
run: pnpm run build:demo
35-
35+
36+
- name: Copy compiled files for demo
37+
run: |
38+
mkdir -p dist-demo/tests/compiled
39+
cp tests/compiled/*_v2.json tests/compiled/*_v3.json dist-demo/tests/compiled/
40+
3641
- name: Setup Pages
3742
uses: actions/configure-pages@v5
3843

.serena/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/cache
2+
/project.local.yml
-40.5 KB
Binary file not shown.

.serena/project.yml

Lines changed: 91 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
# language of the project (csharp, python, rust, java, typescript, go, cpp, or ruby)
2-
# * For C, use cpp
3-
# * For JavaScript, use typescript
4-
# Special requirements:
5-
# * csharp: Requires the presence of a .sln file in the project folder.
6-
language: typescript
71

82
# whether to use the project's gitignore file to ignore files
93
# Added on 2025-04-07
@@ -64,5 +58,95 @@ excluded_tools: []
6458
# initial prompt for the project. It will always be given to the LLM upon activating the project
6559
# (contrary to the memories, which are loaded on demand).
6660
initial_prompt: ""
67-
61+
# the name by which the project can be referenced within Serena
6862
project_name: "MaplatTransform"
63+
64+
# list of tools to include that would otherwise be disabled (particularly optional tools that are disabled by default).
65+
# This extends the existing inclusions (e.g. from the global configuration).
66+
included_optional_tools: []
67+
68+
# fixed set of tools to use as the base tool set (if non-empty), replacing Serena's default set of tools.
69+
# This cannot be combined with non-empty excluded_tools or included_optional_tools.
70+
fixed_tools: []
71+
72+
# list of mode names to that are always to be included in the set of active modes
73+
# The full set of modes to be activated is base_modes + default_modes.
74+
# If the setting is undefined, the base_modes from the global configuration (serena_config.yml) apply.
75+
# Otherwise, this setting overrides the global configuration.
76+
# Set this to [] to disable base modes for this project.
77+
# Set this to a list of mode names to always include the respective modes for this project.
78+
base_modes:
79+
80+
# list of mode names that are to be activated by default.
81+
# The full set of modes to be activated is base_modes + default_modes.
82+
# If the setting is undefined, the default_modes from the global configuration (serena_config.yml) apply.
83+
# Otherwise, this overrides the setting from the global configuration (serena_config.yml).
84+
# This setting can, in turn, be overridden by CLI parameters (--mode).
85+
default_modes:
86+
87+
# time budget (seconds) per tool call for the retrieval of additional symbol information
88+
# such as docstrings or parameter information.
89+
# This overrides the corresponding setting in the global configuration; see the documentation there.
90+
# If null or missing, use the setting from the global configuration.
91+
symbol_info_budget:
92+
93+
# The language backend to use for this project.
94+
# If not set, the global setting from serena_config.yml is used.
95+
# Valid values: LSP, JetBrains
96+
# Note: the backend is fixed at startup. If a project with a different backend
97+
# is activated post-init, an error will be returned.
98+
language_backend:
99+
100+
# line ending convention to use when writing source files.
101+
# Possible values: unset (use global setting), "lf", "crlf", or "native" (platform default)
102+
# This does not affect Serena's own files (e.g. memories and configuration files), which always use native line endings.
103+
line_ending:
104+
105+
# list of regex patterns which, when matched, mark a memory entry as read‑only.
106+
# Extends the list from the global configuration, merging the two lists.
107+
read_only_memory_patterns: []
108+
109+
# list of regex patterns for memories to completely ignore.
110+
# Matching memories will not appear in list_memories or activate_project output
111+
# and cannot be accessed via read_memory or write_memory.
112+
# To access ignored memory files, use the read_file tool on the raw file path.
113+
# Extends the list from the global configuration, merging the two lists.
114+
# Example: ["_archive/.*", "_episodes/.*"]
115+
ignored_memory_patterns: []
116+
117+
# advanced configuration option allowing to configure language server-specific options.
118+
# Maps the language key to the options.
119+
# Have a look at the docstring of the constructors of the LS implementations within solidlsp (e.g., for C# or PHP) to see which options are available.
120+
# No documentation on options means no options are available.
121+
ls_specific_settings: {}
122+
123+
# the encoding used by text files in the project
124+
# For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings
125+
encoding: utf-8
126+
127+
128+
# list of languages for which language servers are started; choose from:
129+
# al bash clojure cpp csharp
130+
# csharp_omnisharp dart elixir elm erlang
131+
# fortran fsharp go groovy haskell
132+
# java julia kotlin lua markdown
133+
# matlab nix pascal perl php
134+
# php_phpactor powershell python python_jedi r
135+
# rego ruby ruby_solargraph rust scala
136+
# swift terraform toml typescript typescript_vts
137+
# vue yaml zig
138+
# (This list may be outdated. For the current list, see values of Language enum here:
139+
# https://github.com/oraios/serena/blob/main/src/solidlsp/ls_config.py
140+
# For some languages, there are alternative language servers, e.g. csharp_omnisharp, ruby_solargraph.)
141+
# Note:
142+
# - For C, use cpp
143+
# - For JavaScript, use typescript
144+
# - For Free Pascal/Lazarus, use pascal
145+
# Special requirements:
146+
# Some languages require additional setup/installations.
147+
# See here for details: https://oraios.github.io/serena/01-about/020_programming-languages.html#language-servers
148+
# When using multiple languages, the first language server that supports a given file will be used for that file.
149+
# The first language is the default language and the respective language server will be used as a fallback.
150+
# Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored.
151+
languages:
152+
- typescript

README.ja.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ English README is [here](./README.md).
1010
## 主な機能
1111

1212
- **座標変換定義のインポート:** Maplatで生成された座標変換定義をインポートし、変換のための内部構造を構築
13+
- **V2/V3フォーマット対応:** レガシーV2フォーマット(固定4境界頂点)と新しいV3フォーマット(N境界頂点、より高精度)の両方に対応
1314
- **双方向座標変換:** 2つの平面間で双方向の座標変換が可能
1415
- **位相保存:** 変換時の同相性(トポロジー)を維持
1516
- **複数の座標系サポート:** 通常の直交座標系、Y軸反転座標系、鳥瞰図のような歪んだ座標系など、様々な座標系間の変換に対応
@@ -82,10 +83,10 @@ const transform = new Transform();
8283

8384
##### `setCompiled(compiled: Compiled | CompiledLegacy): void`
8485

85-
Maplatで生成されたコンパイル済み変換定義をインポートして適用します。
86+
Maplatで生成されたコンパイル済み変換定義をインポートして適用します。レガシー形式、V2(4境界頂点)、V3(N境界頂点)を自動的に判別して処理します。
8687

8788
- **パラメータ:**
88-
- `compiled`: コンパイル済み変換定義オブジェクト
89+
- `compiled`: コンパイル済み変換定義オブジェクト(V2、V3、またはレガシー形式)
8990

9091
##### `transform(apoint: number[], backward?: boolean, ignoreBounds?: boolean): number[] | false`
9192

@@ -140,6 +141,13 @@ import { format_version } from '@maplat/transform';
140141
console.log(format_version); // 現在のフォーマットバージョン
141142
```
142143

144+
コンパイル済みデータのフォーマットには2つのモダンバージョンがあります:
145+
146+
- **V2:** マップのバウンディングボックスから算出した固定4点の境界頂点を使用
147+
- **V3:** N個(4以上)の境界頂点を使用し、特にマップ端付近の変換精度を向上
148+
149+
どちらのフォーマットも `setCompiled()` が自動的に判別して処理します。V3フォーマットのコンパイル済みデータはバージョン3以降の[@maplat/tin](https://github.com/code4history/MaplatTin/)で生成されます。
150+
143151
## ドキュメント
144152

145153
変換処理の内部実装に関する技術的な詳細については、以下を参照してください:

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This is part of the [Maplat](https://github.com/code4history/Maplat/) project.
1010
## Key Features
1111

1212
- **Import Transformation Definitions:** Import and build internal structures from transformation definitions generated by Maplat
13+
- **V2/V3 Format Support:** Compatible with both legacy V2 compiled format (4 fixed boundary vertices) and the new V3 format (N boundary vertices for higher accuracy)
1314
- **Bidirectional Coordinate Transformation:** Convert coordinates between two planes in both directions
1415
- **Topology Preservation:** Maintains homeomorphic properties during transformation
1516
- **Multiple Coordinate System Support:** Handles transformations between various coordinate systems including standard orthogonal coordinates, Y-axis inverted coordinates, and distorted coordinates like bird's-eye views
@@ -82,10 +83,10 @@ const transform = new Transform();
8283

8384
##### `setCompiled(compiled: Compiled | CompiledLegacy): void`
8485

85-
Import and apply a compiled transformation definition generated by Maplat.
86+
Import and apply a compiled transformation definition generated by Maplat. Supports legacy format, V2 (4 boundary vertices), and V3 (N boundary vertices) automatically.
8687

8788
- **Parameters:**
88-
- `compiled`: Compiled transformation definition object
89+
- `compiled`: Compiled transformation definition object (V2, V3, or legacy format)
8990

9091
##### `transform(apoint: number[], backward?: boolean, ignoreBounds?: boolean): number[] | false`
9192

@@ -140,6 +141,13 @@ import { format_version } from '@maplat/transform';
140141
console.log(format_version); // Current format version
141142
```
142143

144+
The compiled data format has two modern versions:
145+
146+
- **V2:** Uses 4 fixed boundary vertices derived from the map bounding box
147+
- **V3:** Uses N boundary vertices (≥4) for more precise boundary definition, improving transformation accuracy especially near map edges
148+
149+
Both formats are handled transparently by `setCompiled()`. V3 compiled data is generated by [@maplat/tin](https://github.com/code4history/MaplatTin/) version 3 or later.
150+
143151
## Documentation
144152

145153
For detailed technical information about the transformation internals, see:

0 commit comments

Comments
 (0)