@terra.gl/core 0.0.1-alpha.46 → 0.0.1-alpha.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/README.md +200 -0
- package/dist/README_CN.md +201 -0
- package/dist/assets/favicon/android-chrome-192x192.png +0 -0
- package/dist/assets/favicon/android-chrome-512x512.png +0 -0
- package/dist/assets/favicon/apple-touch-icon.png +0 -0
- package/dist/assets/favicon/favicon-16x16.png +0 -0
- package/dist/assets/favicon/favicon-32x32.png +0 -0
- package/dist/assets/favicon/favicon.ico +0 -0
- package/dist/assets/terra.css +501 -0
- package/dist/index.js +4 -5
- package/dist/index.umd.cjs +4 -5
- package/package.json +3 -3
package/dist/README.md
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# Terra-GL Core
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
**High-Performance WebGL 3D Map Engine Based on Three.js 🌍**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@terra.gl/core)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
|
|
10
|
+
English | [简体中文](./README_CN.md)
|
|
11
|
+
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 📖 Introduction
|
|
17
|
+
|
|
18
|
+
Terra-GL Core is a modern WebGL 3D map engine built on Three.js. It provides complete GIS visualization capabilities, supporting tile map loading, vector feature rendering, 3D model display, and more. Perfect for building smart cities, digital twins, geographic information systems, and other applications.
|
|
19
|
+
|
|
20
|
+
### ✨ Core Features
|
|
21
|
+
|
|
22
|
+
- 🚀 **High-Performance Rendering** - Built on Three.js WebGL engine, supports large-scale data visualization
|
|
23
|
+
- 🗺️ **Multi-Source Tile Support** - Compatible with WMTS, ArcGIS, MapBox, Tianditu, and other mainstream tile services
|
|
24
|
+
- 📐 **Rich Feature Types** - Supports points, lines, polygons, labels, models, and other geographic features
|
|
25
|
+
- 🎨 **Flexible Style System** - Dynamic style configuration and theme switching
|
|
26
|
+
- 🎯 **Complete Event System** - Rich event mechanisms for map interaction and feature events
|
|
27
|
+
- 🛠️ **Powerful Drawing Tools** - Built-in drawing tools for interactive creation of points, lines, polygons, etc.
|
|
28
|
+
- 🌈 **3D Effect Enhancement** - Supports skybox, shadows, HDR, clouds, and other visual effects
|
|
29
|
+
- 📱 **UI Component System** - Provides info windows, tooltips, and other common UI components
|
|
30
|
+
- 🔧 **Collision Detection** - Smart label avoidance for optimized dense feature display
|
|
31
|
+
- 📦 **Modular Design** - Clear code structure, easy to extend and maintain
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 🌟 Why Choose Terra-GL
|
|
36
|
+
|
|
37
|
+
### 💪 Technical Advantages
|
|
38
|
+
|
|
39
|
+
**1. Native Three.js Architecture**
|
|
40
|
+
- Fully built on Three.js with no additional rendering layer abstraction
|
|
41
|
+
- Direct access to Three.js scene objects for free extension
|
|
42
|
+
- Full utilization of WebGL performance advantages
|
|
43
|
+
- Seamless integration with Three.js ecosystem
|
|
44
|
+
|
|
45
|
+
**2. Professional GIS Capabilities**
|
|
46
|
+
- Support for multiple coordinate systems and projection transformations (Web Mercator, WGS84, etc.)
|
|
47
|
+
- Complete tile map system supporting massive data loading
|
|
48
|
+
- Compatible with mainstream map services (WMTS, ArcGIS, MapBox, Tianditu)
|
|
49
|
+
- Vector tile (MVT) rendering support
|
|
50
|
+
|
|
51
|
+
**3. Rich Visualization Capabilities**
|
|
52
|
+
- Unified management of 2D vector features (points, lines, polygons) and 3D models
|
|
53
|
+
- GLTF/GLB model loading with Draco compression
|
|
54
|
+
- Real-time shadows, HDR environment lighting, post-processing effects
|
|
55
|
+
- Particle clouds, water ripples, and other special effects support
|
|
56
|
+
|
|
57
|
+
**4. Flexible Interactive Experience**
|
|
58
|
+
- Complete event system (map events, feature events)
|
|
59
|
+
- Built-in drawing tools supporting points, lines, polygons, circles, etc.
|
|
60
|
+
- Smart collision detection and label avoidance
|
|
61
|
+
- Info windows, tooltips, and other UI components
|
|
62
|
+
|
|
63
|
+
**5. Developer Friendly**
|
|
64
|
+
- Written in TypeScript with complete type definitions
|
|
65
|
+
- Clear modular design, easy to understand and extend
|
|
66
|
+
- Rich examples and documentation
|
|
67
|
+
- Supports both ES Module and UMD module formats
|
|
68
|
+
|
|
69
|
+
### 💡 Use Cases
|
|
70
|
+
|
|
71
|
+
| Category | Typical Applications | Core Capabilities |
|
|
72
|
+
|---------|---------|----------|
|
|
73
|
+
| **🏙️ Smart City** | Urban 3D modeling, BIM display, planning comparison | Large-scale model rendering, LOD control, layer management |
|
|
74
|
+
| **🔮 Digital Twin** | Industrial parks, smart buildings, equipment monitoring | Real-time data binding, dynamic updates, state visualization |
|
|
75
|
+
| **🗺️ GIS** | Terrain analysis, resource distribution, pipeline management | Coordinate conversion, spatial query, buffer analysis |
|
|
76
|
+
| **🚨 Emergency Command** | Situation display, resource scheduling, route planning | Real-time tracking, heatmaps, dynamic plotting |
|
|
77
|
+
|
|
78
|
+
### ⚡ Performance Features
|
|
79
|
+
|
|
80
|
+
- **On-Demand Tile Loading** - Dynamically loads tiles based on viewport, supports tens of thousands of square kilometers of data
|
|
81
|
+
- **LOD Level Control** - Automatically switches model detail based on distance, optimizing rendering performance
|
|
82
|
+
- **Quadtree Spatial Indexing** - Fast query of visible features, improving interaction response speed
|
|
83
|
+
- **WebGL Instanced Rendering** - Batch drawing of identical geometries, reducing draw calls
|
|
84
|
+
- **Collision Avoidance Optimization** - Intelligently hides overlapping labels, keeping interface clean
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## 📚 Core Module Overview
|
|
89
|
+
|
|
90
|
+
### 🏗️ Core Architecture
|
|
91
|
+
- **🗺️ Map** - Map container, unified management of layers, views, events
|
|
92
|
+
- **👁️ Viewer** - Three.js-based rendering engine, manages scenes, cameras, lighting
|
|
93
|
+
- **📚 Layer System** - Layered management of tiles, vectors, models, and other data
|
|
94
|
+
- **📍 Feature** - Abstraction of geographic elements such as points, lines, polygons, models
|
|
95
|
+
- **🔲 TileSystem** - Dynamic loading system supporting multi-source tiles like WMTS, ArcGIS
|
|
96
|
+
|
|
97
|
+
### 🔑 Key Features
|
|
98
|
+
- **⚡ Event System** - Complete map/feature-level event mechanism
|
|
99
|
+
- **✏️ Drawing Tools** - Built-in interactive drawing (points, lines, polygons, circles, etc.)
|
|
100
|
+
- **🎨 UI Components** - InfoWindow, ToolTip, and other common components
|
|
101
|
+
- **🎯 Collision Detection** - Smart label avoidance, optimized dense scene display
|
|
102
|
+
- **🎭 Style System** - Unified vector/model style configuration
|
|
103
|
+
|
|
104
|
+
[View Detailed API Documentation →](link-to-detailed-docs)
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
## 🚀 Quick Start
|
|
108
|
+
|
|
109
|
+
### 📦 Installation
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
npm install @terra.gl/core three@^0.171.0
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### ⚡ 5-Minute Guide
|
|
116
|
+
|
|
117
|
+
```javascript
|
|
118
|
+
import * as terra from '@terra.gl/core';
|
|
119
|
+
|
|
120
|
+
// Create map
|
|
121
|
+
const map = new terra.Map('#map', {
|
|
122
|
+
center: [116.397428, 39.90923, 1000], // [longitude, latitude, camera height]
|
|
123
|
+
basemap: {
|
|
124
|
+
Baselayers: [
|
|
125
|
+
new terra.WMTSTileLayer('base', {
|
|
126
|
+
source: new terra.WMTSSource({
|
|
127
|
+
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png'
|
|
128
|
+
}),
|
|
129
|
+
projection: terra.ProjectFactory.createFromID('3857', 0)
|
|
130
|
+
})
|
|
131
|
+
],
|
|
132
|
+
minLevel: 1,
|
|
133
|
+
maxLevel: 18
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// Add label
|
|
138
|
+
const label = new terra.Label({
|
|
139
|
+
geometry: { type: 'Point', coordinates: [116.397428, 39.90923, 0] },
|
|
140
|
+
style: { text: 'Tiananmen Square', fontSize: 16, fontColor: '#ffffff' }
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
const pointLayer = new terra.PointLayer('points');
|
|
144
|
+
map.addLayer(pointLayer);
|
|
145
|
+
label.addTo(pointLayer);
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
See the `example/` directory for more examples.
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 🔧 Development
|
|
155
|
+
|
|
156
|
+
### 🔨 Build
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# Development mode (watch file changes)
|
|
160
|
+
npm run dev
|
|
161
|
+
|
|
162
|
+
# Production build
|
|
163
|
+
npm run build
|
|
164
|
+
|
|
165
|
+
# Generate API documentation
|
|
166
|
+
npm run doc
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### 📂 Project Structure
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
packages/core/
|
|
173
|
+
├── src/ # Source code
|
|
174
|
+
├── dist/ # Compiled output
|
|
175
|
+
├── docs/ # API documentation
|
|
176
|
+
├── assets/ # Asset files
|
|
177
|
+
├── package.json # Package configuration
|
|
178
|
+
├── tsconfig.json # TypeScript configuration
|
|
179
|
+
├── vite.config.ts # Vite build configuration
|
|
180
|
+
└── typedoc.json # Documentation generation configuration
|
|
181
|
+
```
|
|
182
|
+
## 🤝 Contributing
|
|
183
|
+
|
|
184
|
+
Issues and Pull Requests are welcome!
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## 🔗 Related Links
|
|
189
|
+
|
|
190
|
+
- [Three.js Official Website](https://threejs.org/)\
|
|
191
|
+
- [GeoJSON Specification](https://geojson.org/)
|
|
192
|
+
- [WMTS Standard](https://www.ogc.org/standards/wmts)
|
|
193
|
+
<!-- - [three-tile Website](https://sxguojf.github.io/three-tile-doc/1.introduce/01.whatIs/) -->
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
<div align="center">
|
|
197
|
+
|
|
198
|
+
**If this project helps you, please give it a ⭐️ Star!**
|
|
199
|
+
|
|
200
|
+
</div>
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# Terra-GL Core
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
**基于 Three.js 的高性能 WebGL 三维地图引擎 🌍**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@terra.gl/core)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
|
|
10
|
+
[English](./README.md) | 简体中文
|
|
11
|
+
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 📖 简介
|
|
17
|
+
|
|
18
|
+
Terra-GL Core 是一个基于 Three.js 构建的现代化 WebGL 三维地图引擎核心库。它提供了完整的 GIS 可视化能力,支持瓦片地图加载、矢量要素渲染、三维模型展示等丰富功能,适用于构建智慧城市、数字孪生、地理信息系统等应用场景。
|
|
19
|
+
|
|
20
|
+
### ✨ 核心特性
|
|
21
|
+
|
|
22
|
+
- 🚀 **高性能渲染** - 基于 Three.js WebGL 引擎,支持大规模数据可视化
|
|
23
|
+
- 🗺️ **多源瓦片支持** - 兼容 WMTS、ArcGIS、MapBox、天地图等主流瓦片服务
|
|
24
|
+
- 📐 **丰富的要素类型** - 支持点、线、面、标注、模型等多种地理要素
|
|
25
|
+
- 🎨 **灵活的样式系统** - 支持动态样式配置与主题切换
|
|
26
|
+
- 🎯 **完善的事件系统** - 提供地图交互、要素事件等丰富的事件机制
|
|
27
|
+
- 🛠️ **强大的绘制工具** - 内置绘制工具,支持点线面等要素的交互式绘制
|
|
28
|
+
- 🌈 **三维效果增强** - 支持天空盒、阴影、HDR、云层等视觉效果
|
|
29
|
+
- 📱 **UI 组件系统** - 提供信息窗口、工具提示等常用 UI 组件
|
|
30
|
+
- 🔧 **碰撞检测避让** - 智能标注避让,优化密集要素显示效果
|
|
31
|
+
- 📦 **模块化设计** - 清晰的代码结构,易于扩展和维护
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 🌟 为什么选择 Terra-GL
|
|
36
|
+
|
|
37
|
+
### 💪 技术优势
|
|
38
|
+
|
|
39
|
+
**1. 原生 Three.js 架构**
|
|
40
|
+
- 完全基于 Three.js 构建,无额外渲染层抽象
|
|
41
|
+
- 直接访问 Three.js 场景对象,可自由扩展
|
|
42
|
+
- 充分利用 WebGL 的性能优势
|
|
43
|
+
- 与 Three.js 生态无缝集成
|
|
44
|
+
|
|
45
|
+
**2. 专业的 GIS 能力**
|
|
46
|
+
- 支持多种坐标系统和投影变换(Web Mercator、WGS84 等)
|
|
47
|
+
- 完整的瓦片地图系统,支持海量数据加载
|
|
48
|
+
- 兼容主流地图服务(WMTS、ArcGIS、MapBox、天地图)
|
|
49
|
+
- 矢量瓦片(MVT)渲染支持
|
|
50
|
+
|
|
51
|
+
**3. 丰富的可视化能力**
|
|
52
|
+
- 二维矢量要素(点、线、面)与三维模型统一管理
|
|
53
|
+
- 支持 GLTF/GLB 模型加载,带 Draco 压缩
|
|
54
|
+
- 实时阴影、HDR 环境光、后期处理效果
|
|
55
|
+
- 粒子云层、水面波纹等特效支持
|
|
56
|
+
|
|
57
|
+
**4. 灵活的交互体验**
|
|
58
|
+
- 完善的事件系统(地图事件、要素事件)
|
|
59
|
+
- 内置绘制工具,支持点线面圆等图形绘制
|
|
60
|
+
- 智能碰撞检测与标注避让
|
|
61
|
+
- 信息窗口、工具提示等 UI 组件
|
|
62
|
+
|
|
63
|
+
**5. 开发友好**
|
|
64
|
+
- TypeScript 编写,完整类型定义
|
|
65
|
+
- 清晰的模块化设计,易于理解和扩展
|
|
66
|
+
- 丰富的示例和文档
|
|
67
|
+
- 支持 ES Module 和 UMD 两种模块格式
|
|
68
|
+
|
|
69
|
+
### 💡 适用场景
|
|
70
|
+
|
|
71
|
+
| 场景类型 | 典型应用 | 核心能力 |
|
|
72
|
+
|---------|---------|----------|
|
|
73
|
+
| **🏙️ 智慧城市** | 城市三维建模、BIM 展示、规划方案对比 | 大规模模型渲染、LOD 控制、图层管理 |
|
|
74
|
+
| **🔮 数字孪生** | 工业园区、智慧楼宇、设备监控 | 实时数据绑定、动态更新、状态可视化 |
|
|
75
|
+
| **🗺️ 地理信息** | 地形分析、资源分布、管线管理 | 坐标转换、空间查询、缓冲区分析 |
|
|
76
|
+
| **🚨 应急指挥** | 态势展示、资源调度、路径规划 | 实时轨迹、热力图、动态标绘 |
|
|
77
|
+
|
|
78
|
+
### ⚡ 性能特点
|
|
79
|
+
|
|
80
|
+
- **瓦片按需加载** - 根据视野范围动态加载瓦片,支持数万平方公里数据
|
|
81
|
+
- **LOD 层级控制** - 自动根据距离切换模型细节,优化渲染性能
|
|
82
|
+
- **四叉树空间索引** - 快速查询可见要素,提升交互响应速度
|
|
83
|
+
- **WebGL 实例化渲染** - 批量绘制相同几何体,降低 Draw Call
|
|
84
|
+
- **碰撞避让优化** - 智能隐藏重叠标注,保持界面整洁
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
## 📚 核心模块概述
|
|
88
|
+
|
|
89
|
+
### 🏗️ 核心架构
|
|
90
|
+
- **🗺️ Map** - 地图容器,统一管理图层、视图、事件
|
|
91
|
+
- **👁️ Viewer** - 基于Three.js的渲染引擎,管理场景、相机、光照
|
|
92
|
+
- **📚 Layer System** - 分层管理瓦片、矢量、模型等数据
|
|
93
|
+
- **📍 Feature** - 点、线、面、模型等地理要素的抽象
|
|
94
|
+
- **🔲 TileSystem** - 支持WMTS、ArcGIS等多源瓦片的动态加载系统
|
|
95
|
+
|
|
96
|
+
### 🔑 关键特性
|
|
97
|
+
- **⚡ 事件系统** - 完整的地图/要素级事件机制
|
|
98
|
+
- **✏️ 绘制工具** - 内置交互式绘制(点、线、面、圆等)
|
|
99
|
+
- **🎨 UI组件** - InfoWindow、ToolTip等常用组件
|
|
100
|
+
- **🎯 碰撞检测** - 智能标注避让,优化密集场景显示
|
|
101
|
+
- **🎭 样式系统** - 统一的矢量/模型样式配置
|
|
102
|
+
|
|
103
|
+
[查看详细API文档 →](链接到详细文档)
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 🚀 快速开始
|
|
108
|
+
|
|
109
|
+
### 📦 安装
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
npm install @terra.gl/core three@^0.171.0
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### ⚡ 5 分钟上手
|
|
116
|
+
|
|
117
|
+
```javascript
|
|
118
|
+
import * as terra from '@terra.gl/core';
|
|
119
|
+
|
|
120
|
+
// 创建地图
|
|
121
|
+
const map = new terra.Map('#map', {
|
|
122
|
+
center: [116.397428, 39.90923, 1000], // [经度, 纬度, 相机高度]
|
|
123
|
+
basemap: {
|
|
124
|
+
Baselayers: [
|
|
125
|
+
new terra.WMTSTileLayer('base', {
|
|
126
|
+
source: new terra.WMTSSource({
|
|
127
|
+
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png'
|
|
128
|
+
}),
|
|
129
|
+
projection: terra.ProjectFactory.createFromID('3857', 0)
|
|
130
|
+
})
|
|
131
|
+
],
|
|
132
|
+
minLevel: 1,
|
|
133
|
+
maxLevel: 18
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// 添加标注
|
|
138
|
+
const label = new terra.Label({
|
|
139
|
+
geometry: { type: 'Point', coordinates: [116.397428, 39.90923, 0] },
|
|
140
|
+
style: { text: '北京天安门', fontSize: 16, fontColor: '#ffffff' }
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
const pointLayer = new terra.PointLayer('points');
|
|
144
|
+
map.addLayer(pointLayer);
|
|
145
|
+
label.addTo(pointLayer);
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
查看 `example/` 目录获取更多示例。
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 🔧 开发
|
|
153
|
+
|
|
154
|
+
### 🔨 构建
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# 开发模式(监听文件变化)
|
|
158
|
+
npm run dev
|
|
159
|
+
|
|
160
|
+
# 生产构建
|
|
161
|
+
npm run build
|
|
162
|
+
|
|
163
|
+
# 生成 API 文档
|
|
164
|
+
npm run doc
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### 📂 项目结构
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
packages/core/
|
|
171
|
+
├── src/ # 源代码
|
|
172
|
+
├── dist/ # 编译输出
|
|
173
|
+
├── docs/ # API 文档
|
|
174
|
+
├── assets/ # 资源文件
|
|
175
|
+
├── package.json # 包配置
|
|
176
|
+
├── tsconfig.json # TypeScript 配置
|
|
177
|
+
├── vite.config.ts # Vite 构建配置
|
|
178
|
+
└── typedoc.json # 文档生成配置
|
|
179
|
+
```
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## 🤝 贡献
|
|
183
|
+
|
|
184
|
+
欢迎提交 Issue 和 Pull Request!
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## 🔗 相关链接
|
|
189
|
+
|
|
190
|
+
- [Three.js 官网](https://threejs.org/)
|
|
191
|
+
- [GeoJSON 规范](https://geojson.org/)
|
|
192
|
+
- [WMTS 标准](https://www.ogc.org/standards/wmts)
|
|
193
|
+
<!-- - [three-tile 官网](https://sxguojf.github.io/three-tile-doc/1.introduce/01.whatIs/) -->
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
<div align="center">
|
|
198
|
+
|
|
199
|
+
**如果这个项目对你有帮助,请给一个 ⭐️ Star 支持一下!**
|
|
200
|
+
|
|
201
|
+
</div>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|