MaplatTin
关于MaplatTin
mapplattin是一个定义和执行同态的JavaScript库 基于控制点的两平面坐标系之间的转换。它 保证了一个非线性但保持拓扑的(同胚)双向 映射,这是允许 Maplat 查看器叠加历史 精确的现代地图上的地图 不扭曲原始图像.
mapplattin是在Apache许可证2.0下开源的(从0.14.2版本开始)。
关键特性
- 生成转换定义 -创建坐标变换 基于控制点和边缘约束的定义
- 双向坐标变换 -转换坐标 两个方向上的两个平面
- 拓扑保存 -在期间保持同胚性质 转换
- 灵活的配置 -顶点处理模式(正常/鸟瞰 视图),拓扑检查模式(严格/自动/松散),y轴方向控制
- 边缘约束 -指定约束边缘以获得更精确的转换
- 状态管理 -保存和恢复转换定义
- 开源(从0.14.2版本开始的Apache 2.0)——是Maplat生态系统的一部分
快速入门
当前版本:
1.1.1. 这个街区是唯一一个 这个存储库携带一个发布版本(ADR-0012);外面的一切都是 针对1.0版本编写的。 npm:@maplat/tin
安装
# pnpm (recommended)
pnpm add @maplat/tin
# npm
npm install @maplat/tin
最小的使用
import Tin from '@maplat/tin';
// Create a new instance with basic configuration
const tin = new Tin({
wh: [500, 500], // Width and height of the source plane
yaxisMode: Tin.YAXIS_FOLLOW,
});
// Set control points: Array of [source, target] coordinates
tin.setPoints([
[[100, 100], [200, 200]],
[[200, 200], [400, 400]],
[[150, 150], [320, 350]],
[[200, 100], [420, 220]],
]);
// Initialize the TIN network
tin.updateTin();
// Forward transform: source to target
const transformed = tin.transform([160, 160], false);
// Backward transform: target to source
const restored = tin.transform(transformed, true);
CDN (jsDelivr)
<!-- MaplatTin (UMD) -->
<script src="https://cdn.jsdelivr.net/npm/@maplat/[email protected]/dist/maplat_tin.umd.js"></script>
<script>
const tin = new maplatTin.default({ wh: [500, 500] });
</script>
或者使用ES模块:
<script type="module">
import Tin from 'https://cdn.jsdelivr.net/npm/@maplat/[email protected]/dist/maplat_tin.js';
const tin = new Tin({ wh: [500, 500] });
</script>
注意:请确保使用最新的兼容版本。
API参考
- API签名 (release-dependent):明白了
docs/api/ - 概念性指南 (release-independent):参见 Wiki api参考
开发
设置
克隆存储库并安装依赖项。
git clone https://github.com/code4history/MaplatTin.git
cd MaplatTin
pnpm install
开发服务器
使用热重新加载启动开发服务器。
pnpm dev
构建
pnpm build # Build library (dist/)
pnpm build:demo # Build demo site (dist-demo/)
测试
pnpm test # Run unit tests (Vitest)
pnpm typecheck # Run type checks (TypeScript)
pnpm lint # Run linter and formatter (ESLint/Prettier)
测试覆盖率:
tests/edgebound/-内部EdgeBound约束引擎测试(455个测试)tests/tin.test.ts-使用真实地图数据进行TIN转换测试tests/transform.test.ts-坐标变换测试
先决条件
源自
engines场package.json(adr - 0012: release-dependent)。
- node . js:
>=20.0.0(通过GitHub Actions测试LTS) - 规划:
>=9.0.0(要求;package.json实施规划)
生态系统
MaplatTin是Maplat生态系统的一部分 历史代码. 查看完整的生态系统地图(8个存储库+产品/企业网站):
📖 生态系统图 - - - - - - (该图目前保存在一个私人规划中 库;下面的姊妹存储库表是公共替代品)
妹妹存储库
| 存储库 | 许可证 | npm | 角色 |
|---|---|---|---|
| Maplat | Apache 2.0 | @maplat/ui | 主要查看器 |
| MaplatCore | Apache 2.0 | @maplat/core | 核心库 |
| MaplatTin | Apache 2.0 | @maplat/tin | 锡转换 |
| MaplatTransform | Apache 2.0 | @maplat/transform | 坐标变换 |
| MaplatEditor | Apache 2.0 | - - - - - - | 数据创作工具(桌面) |
| 楚辞 | 麻省理工学院 | @c4h/chuci | 多媒体滑动器和查看器Web组件 |
| 屈原 | 麻省理工学院 | @c4h/quyuan | GeoJSON模板引擎+多媒体浏览器Web组件 |
| Weiwudi | 麻省理工学院 | @c4h/weiwudi | Service Worker用于tile缓存 |
mapplateditor是用于创建地图和poi的数据创作工具 上面的观众渲染。Maplat生态系统是端到端的: 作者与mapplateditor,服务于任何查看器库。
链接
| 观众 | 链接 | 目的 |
|---|---|---|
| 项目信息/功能/案例 | https://www.maplat.jp/en/ | 产品网站 |
| 赞助商/业务查询 | https://www.nayuta-inc.co.jp/en/ | 公司网站(Nayuta, Inc.) |
ADR-0013: apache许可的存储库(这个)链接到两个站点。 麻省理工学院授权的姊妹reppos (Weiwudi / Quyuan / chui)没有Nayuta链接。
许可证
Apache License 2.0 -参见 许可证.
Copyright 2019-2026 Kohei Otsuka, Code for History / Nayuta, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
专利的通知: Maplat坐标变换技术获得专利 日本(专利号:6684776)。
过去的版本: 0.14.2之前的版本在 Maplat有限许可1.1。license恢复到Apache 2.0需要 1.0.0-rc1版本生效。早期版本可在npmjs.com上获得 保持在原始的有限许可条款下。
贡献者
- 大冢浩平表示
- 历史代码
我们欢迎您的贡献!欢迎提交 问题和拉取请求.