@terra.gl/core 0.0.1-alpha.20 โ 0.0.1-alpha.22
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/README.md +218 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4595 -4620
- package/dist/index.umd.cjs +24 -24
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
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
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## ๐ Examples
|
|
186
|
+
|
|
187
|
+
See the `example/` directory for more complete examples:
|
|
188
|
+
|
|
189
|
+
- **1.้ๅทๅคๆฏ.html** - City night scene effects
|
|
190
|
+
- **2.ๅฐๅพไบไปถ.html** - Map interaction events
|
|
191
|
+
- **3.่ฆ็ด ไบไปถ.html** - Feature event handling
|
|
192
|
+
- **4.็ธๆบ้ฃ่ก.html** - Camera animation flight
|
|
193
|
+
- **5.็ปๅถๅทฅๅ
ท.html** - Interactive drawing tools
|
|
194
|
+
- **6.ๅฐๅพไฟกๆฏๆก.html** - Map info window
|
|
195
|
+
- **7.่ฆ็ด ไฟกๆฏๆก.html** - Feature info display
|
|
196
|
+
- **8.่ชๅฎไน็ไฟกๆฏๆก.html** - Custom UI components
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## ๐ค Contributing
|
|
201
|
+
|
|
202
|
+
Issues and Pull Requests are welcome!
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## ๐ Related Links
|
|
207
|
+
|
|
208
|
+
- [Three.js Official Website](https://threejs.org/)\
|
|
209
|
+
- [GeoJSON Specification](https://geojson.org/)
|
|
210
|
+
- [WMTS Standard](https://www.ogc.org/standards/wmts)
|
|
211
|
+
<!-- - [three-tile Website](https://sxguojf.github.io/three-tile-doc/1.introduce/01.whatIs/) -->
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
<div align="center">
|
|
215
|
+
|
|
216
|
+
**If this project helps you, please give it a โญ๏ธ Star!**
|
|
217
|
+
|
|
218
|
+
</div>
|
package/dist/index.d.ts
CHANGED