Skip to content

Commit 706886d

Browse files
author
fltb
committed
init pixi components
1 parent e54de87 commit 706886d

File tree

5 files changed

+84
-0
lines changed

5 files changed

+84
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export class AbstractComponent {
2+
/**
3+
* 地图中的组件。组件是图层中的基本元素。一般来说会通过控制一些 Pixi Graphic 或者 Sprite 对象来渲染元素。
4+
*
5+
* @param {import("../layers/AbstructLayer").AbstractLayer} layer - pixi scene object
6+
* @param {String} id
7+
*/
8+
constructor(layer, id) {
9+
this.layer = layer;
10+
this.scene = layer.scene
11+
this.id = id
12+
}
13+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { AbstractComponent } from "./AbstructComponent";
2+
3+
export class BackgroundTile extends AbstractComponent {
4+
/**
5+
* 地图 tile 组件,在图层上渲染一小块地图
6+
*
7+
* @param {import("../layers/AbstructLayer").AbstractLayer} layer - pixi scene object
8+
* @param {String} id
9+
* @param {String} source - a format string for tile source
10+
* @param {Number} zoom - a number of zoom level
11+
* @param {Number} x - 当前 zoom 在地图分割后的 x, 不是坐标
12+
* @param {Number} y - 当前 zoom 在地图分割后的 y, 不是坐标
13+
*/
14+
constructor(layer, id, source, zoom, x, y) {
15+
super(layer, id)
16+
this.source = source
17+
this.zoom = zoom
18+
}
19+
}

src/pixi/components/Line.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { AbstractComponent } from "./AbstructComponent";
2+
3+
4+
export class Line extends AbstractComponent {
5+
/**
6+
* 渲染一条线,注意有宽度,高亮和阴影,使用 PIXI Graphic
7+
*
8+
* @param {import("../layers/AbstructLayer").AbstractLayer} layer - pixi scene object
9+
* @param {String} id
10+
* @param {Number} zoom - a number of zoom level
11+
*/
12+
constructor(layer, id, zoom) {
13+
super(layer, id)
14+
this.zoom = zoom
15+
}
16+
}

src/pixi/components/Point.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { AbstractComponent } from "./AbstructComponent";
2+
3+
4+
export class Point extends AbstractComponent {
5+
/**
6+
* 渲染一个点。
7+
*
8+
* @param {import("../layers/AbstructLayer").AbstractLayer} layer - pixi scene object
9+
* @param {String} id
10+
* @param {Number} zoom - a number of zoom level
11+
* @param {Number} x - EPSG:3857
12+
* @param {Number} y - EPSG:3857
13+
*/
14+
constructor(layer, id, zoom, x, y) {
15+
super(layer, id)
16+
this.zoom = zoom
17+
this.x = x
18+
this.y = y
19+
}
20+
}

src/pixi/components/Polygon.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { AbstractComponent } from "./AbstructComponent";
2+
3+
export class Polygon extends AbstractComponent {
4+
/**
5+
* 地图 tile 组件,在图层上渲染一小块地图
6+
*
7+
* @param {import("../layers/AbstructLayer").AbstractLayer} layer - pixi scene object
8+
* @param {String} id
9+
* @param {Number} zoom - a number of zoom level
10+
*/
11+
constructor(layer, id, zoom) {
12+
super(layer, id)
13+
this.source = source
14+
this.zoom = zoom
15+
}
16+
}

0 commit comments

Comments
 (0)