@voxel-pixel/entity 0.0.1-beta.0 → 0.0.1-beta.2
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/LICENSE +8 -8
- package/Polygon/index.d.ts +2 -2
- package/Sprite/index.d.ts +1 -0
- package/index.js +1 -18
- package/package.json +3 -3
- package/BaseEntity.js +0 -17
- package/Circle/index.js +0 -14
- package/Entity.js +0 -35
- package/Group/index.js +0 -98
- package/Line/index.js +0 -23
- package/Point/index.js +0 -14
- package/Polygon/index.js +0 -30
- package/SingleEntity.js +0 -54
- package/Sprite/index.js +0 -14
- package/Text/index.js +0 -14
package/LICENSE
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright © 2025-PRESENT voxel-pixel
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
-
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
-
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright © 2025-PRESENT voxel-pixel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
9
|
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/Polygon/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { Entity } from "../Entity";
|
|
|
3
3
|
interface IPolygonOptions extends PolygonGraphics.ConstructorOptions {
|
|
4
4
|
lineOption: PolylineGraphics.ConstructorOptions;
|
|
5
5
|
}
|
|
6
|
-
declare class
|
|
6
|
+
declare class Polygon extends Entity {
|
|
7
7
|
positions: Cartesian3[];
|
|
8
8
|
constructor(container: Container, options: IPolygonOptions);
|
|
9
9
|
}
|
|
10
|
-
export {
|
|
10
|
+
export { Polygon };
|
package/Sprite/index.d.ts
CHANGED
|
@@ -2,5 +2,6 @@ import { Container, BillboardGraphics } from "@voxel-pixel/core";
|
|
|
2
2
|
import { SingleEntity } from "../SingleEntity";
|
|
3
3
|
declare class Sprite extends SingleEntity {
|
|
4
4
|
constructor(container: Container, options: BillboardGraphics.ConstructorOptions);
|
|
5
|
+
update(options: Partial<BillboardGraphics.ConstructorOptions>): void;
|
|
5
6
|
}
|
|
6
7
|
export { Sprite };
|
package/index.js
CHANGED
|
@@ -1,18 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { Point } from "./Point/index.js";
|
|
3
|
-
import { Line } from "./Line/index.js";
|
|
4
|
-
import { Polgyon } from "./Polygon/index.js";
|
|
5
|
-
import { Circle } from "./Circle/index.js";
|
|
6
|
-
import { Sprite } from "./Sprite/index.js";
|
|
7
|
-
import { Text } from "./Text/index.js";
|
|
8
|
-
import { Group } from "./Group/index.js";
|
|
9
|
-
export {
|
|
10
|
-
BaseEntity,
|
|
11
|
-
Circle,
|
|
12
|
-
Group,
|
|
13
|
-
Line,
|
|
14
|
-
Point,
|
|
15
|
-
Polgyon,
|
|
16
|
-
Sprite,
|
|
17
|
-
Text
|
|
18
|
-
};
|
|
1
|
+
var t=Object.defineProperty,s=(s,i,o)=>(((s,i,o)=>{i in s?t(s,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):s[i]=o})(s,"symbol"!=typeof i?i+"":i,o),o);import{Entity as i,Cartesian3 as o,Cartographic as n,sampleTerrainMostDetailed as e,CallbackProperty as h,PolygonHierarchy as c}from"@voxel-pixel/core";import{generateUUID as r}from"@voxel-pixel/utils";class l extends i{constructor(t){super(t),s(this,"uuid",r())}}class a{constructor(t){s(this,"uuid",r()),s(this,"container"),s(this,"instance"),this.container=t}setProperties(t){this.instance&&(this.instance.properties=t)}lookAtMe(t){this.instance&&this.container.viewer.zoomTo(this.instance,t)}setVisible(t){this.instance&&(this.instance.show=t)}destroy(){this.instance&&this.container.viewer.entities.remove(this.instance),this.instance=void 0}}class p extends a{constructor(t){super(t),s(this,"position"),this.position=new o}lookAtMe(t,s){if(this.instance)if(this.container.mountedTerrain){const i=n.fromCartesian(this.position);e(this.container.viewer.scene.terrainProvider,[i]).then(([o])=>{const e=Math.max(o.height||0,0);i.height=e+(s||0),this.container.viewer.camera.setView({destination:n.toCartesian(i),orientation:t||{heading:Math.PI/2,pitch:-Math.PI/2,roll:0}})})}else{const i=n.fromCartesian(this.position);i.height=s||500,this.container.viewer.camera.setView({destination:n.toCartesian(i),orientation:t||{heading:Math.PI/2,pitch:-Math.PI/2,roll:0}})}}getPosition(){return o.clone(this.position)}}class u extends p{constructor(t,s){super(t),this.instance=t.viewer.entities.add({position:new h(()=>this.getPosition(),!1),point:s})}}class d extends a{constructor(t,i){super(t),s(this,"positions",[]),this.instance=t.viewer.entities.add({polyline:{...i,positions:new h(()=>this.positions,!1)}})}}class f extends a{constructor(t,i){super(t),s(this,"positions",[]);const o={polygon:{...i,hierarchy:new h(()=>new c(this.positions),!1)}};i.lineOption&&(o.polyline={...i.lineOption,positions:new h(()=>this.positions,!1)}),this.instance=t.viewer.entities.add(o)}}class x extends p{constructor(t,s){super(t),this.instance=t.viewer.entities.add({position:new h(()=>this.getPosition(),!1),ellipse:s})}}class b extends p{constructor(t,s){super(t),this.instance=t.viewer.entities.add({position:new h(()=>this.getPosition(),!1),billboard:s})}update(t){var s;const i=null==(s=this.instance)?void 0:s.billboard;if(i)for(const s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;const o=s;i[o]=t[o]}}}class w extends p{constructor(t,s){super(t),this.instance=t.viewer.entities.add({position:new h(()=>this.getPosition(),!1),label:s})}}class y{constructor(t){s(this,"container"),s(this,"children",[]),this.container=t}addChild(t){return this.children.push(t),t.uuid}lookAtChild(t,s,i){const o=this.children.find(s=>s.uuid===t);o&&(o instanceof l?this.container.viewer.zoomTo(o,s):o instanceof p?o.lookAtMe(s,i):o instanceof a&&o.lookAtMe(s))}setChildVisible(t,s){const i=this.children.find(s=>s.uuid===t);i&&(i instanceof l?i.show=s:i instanceof a&&i.setVisible(s))}setVisible(t){this.children.forEach(s=>{s instanceof l?s.show=t:s instanceof a&&s.setVisible(t)})}destroy(){for(let t=this.children.length-1;t>=0;t--){const s=this.children[t];s instanceof l?this.container.viewer.entities.remove(s):s instanceof a&&s.destroy()}this.children=[]}destroyChild(t){const s=this.children.findIndex(s=>s.uuid===t);if(-1!==s){const t=this.children[s];t instanceof l?this.container.viewer.entities.remove(t):t instanceof a&&t.destroy()}this.children.splice(s,1)}}export{l as BaseEntity,x as Circle,y as Group,d as Line,u as Point,f as Polygon,b as Sprite,w as Text};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voxel-pixel/entity",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"description": "实体",
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"typings": "./index.d.ts",
|
|
10
10
|
"peerDependencies": {
|
|
11
|
-
"@voxel-pixel/core": "0.0.1-beta.
|
|
12
|
-
"@voxel-pixel/utils": "0.0.1-beta.
|
|
11
|
+
"@voxel-pixel/core": "0.0.1-beta.2",
|
|
12
|
+
"@voxel-pixel/utils": "0.0.1-beta.4"
|
|
13
13
|
},
|
|
14
14
|
"publishConfig": {
|
|
15
15
|
"registry": "https://registry.npmjs.org/"
|
package/BaseEntity.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => {
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
7
|
-
import { Entity } from "@voxel-pixel/core";
|
|
8
|
-
import { generateUUID } from "@voxel-pixel/utils";
|
|
9
|
-
class BaseEntity extends Entity {
|
|
10
|
-
constructor(options) {
|
|
11
|
-
super(options);
|
|
12
|
-
__publicField(this, "uuid", generateUUID());
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export {
|
|
16
|
-
BaseEntity
|
|
17
|
-
};
|
package/Circle/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { CallbackProperty } from "@voxel-pixel/core";
|
|
2
|
-
import { SingleEntity } from "../SingleEntity.js";
|
|
3
|
-
class Circle extends SingleEntity {
|
|
4
|
-
constructor(container, options) {
|
|
5
|
-
super(container);
|
|
6
|
-
this.instance = container.viewer.entities.add({
|
|
7
|
-
position: new CallbackProperty(() => this.getPosition(), false),
|
|
8
|
-
ellipse: options
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
export {
|
|
13
|
-
Circle
|
|
14
|
-
};
|
package/Entity.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => {
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
7
|
-
import { generateUUID } from "@voxel-pixel/utils";
|
|
8
|
-
class Entity {
|
|
9
|
-
constructor(container) {
|
|
10
|
-
__publicField(this, "uuid", generateUUID());
|
|
11
|
-
__publicField(this, "container");
|
|
12
|
-
__publicField(this, "instance");
|
|
13
|
-
this.container = container;
|
|
14
|
-
}
|
|
15
|
-
setProperties(properties) {
|
|
16
|
-
if (this.instance)
|
|
17
|
-
this.instance.properties = properties;
|
|
18
|
-
}
|
|
19
|
-
lookAtMe(offset) {
|
|
20
|
-
if (this.instance)
|
|
21
|
-
this.container.viewer.zoomTo(this.instance, offset);
|
|
22
|
-
}
|
|
23
|
-
setVisible(visible) {
|
|
24
|
-
if (this.instance)
|
|
25
|
-
this.instance.show = visible;
|
|
26
|
-
}
|
|
27
|
-
destroy() {
|
|
28
|
-
if (this.instance)
|
|
29
|
-
this.container.viewer.entities.remove(this.instance);
|
|
30
|
-
this.instance = void 0;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
export {
|
|
34
|
-
Entity
|
|
35
|
-
};
|
package/Group/index.js
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => {
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
7
|
-
import { Entity } from "../Entity.js";
|
|
8
|
-
import { BaseEntity } from "../BaseEntity.js";
|
|
9
|
-
import { SingleEntity } from "../SingleEntity.js";
|
|
10
|
-
class Group {
|
|
11
|
-
constructor(container) {
|
|
12
|
-
__publicField(this, "container");
|
|
13
|
-
/**
|
|
14
|
-
* 添加子集
|
|
15
|
-
* @param child
|
|
16
|
-
*/
|
|
17
|
-
__publicField(this, "children", []);
|
|
18
|
-
this.container = container;
|
|
19
|
-
}
|
|
20
|
-
addChild(child) {
|
|
21
|
-
this.children.push(child);
|
|
22
|
-
return child.uuid;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* 观看某个子集
|
|
26
|
-
* @param uuid
|
|
27
|
-
*/
|
|
28
|
-
lookAtChild(uuid, offset, height) {
|
|
29
|
-
const child = this.children.find((item) => item.uuid === uuid);
|
|
30
|
-
if (child) {
|
|
31
|
-
if (child instanceof BaseEntity) {
|
|
32
|
-
this.container.viewer.zoomTo(child, offset);
|
|
33
|
-
} else if (child instanceof SingleEntity) {
|
|
34
|
-
child.lookAtMe(offset, height);
|
|
35
|
-
} else if (child instanceof Entity) {
|
|
36
|
-
child.lookAtMe(offset);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* 设置某个子集的显示状态
|
|
42
|
-
* @param uuid
|
|
43
|
-
*/
|
|
44
|
-
setChildVisible(uuid, visible) {
|
|
45
|
-
const child = this.children.find((item) => item.uuid === uuid);
|
|
46
|
-
if (child) {
|
|
47
|
-
if (child instanceof BaseEntity) {
|
|
48
|
-
child.show = visible;
|
|
49
|
-
} else if (child instanceof Entity) {
|
|
50
|
-
child.setVisible(visible);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* 设置显示状态
|
|
56
|
-
* @param visible 为true显示,false隐藏
|
|
57
|
-
*/
|
|
58
|
-
setVisible(visible) {
|
|
59
|
-
this.children.forEach((item) => {
|
|
60
|
-
if (item instanceof BaseEntity) {
|
|
61
|
-
item.show = visible;
|
|
62
|
-
} else if (item instanceof Entity) {
|
|
63
|
-
item.setVisible(visible);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
//销毁
|
|
68
|
-
destroy() {
|
|
69
|
-
for (let i = this.children.length - 1; i >= 0; i--) {
|
|
70
|
-
const entity = this.children[i];
|
|
71
|
-
if (entity instanceof BaseEntity) {
|
|
72
|
-
this.container.viewer.entities.remove(entity);
|
|
73
|
-
} else if (entity instanceof Entity) {
|
|
74
|
-
entity.destroy();
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
this.children = [];
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* 销毁某个子集
|
|
81
|
-
* @param uuid
|
|
82
|
-
*/
|
|
83
|
-
destroyChild(uuid) {
|
|
84
|
-
const idx = this.children.findIndex((item) => item.uuid === uuid);
|
|
85
|
-
if (idx !== -1) {
|
|
86
|
-
const child = this.children[idx];
|
|
87
|
-
if (child instanceof BaseEntity) {
|
|
88
|
-
this.container.viewer.entities.remove(child);
|
|
89
|
-
} else if (child instanceof Entity) {
|
|
90
|
-
child.destroy();
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
this.children.splice(idx, 1);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
export {
|
|
97
|
-
Group
|
|
98
|
-
};
|
package/Line/index.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => {
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
7
|
-
import { CallbackProperty } from "@voxel-pixel/core";
|
|
8
|
-
import { Entity } from "../Entity.js";
|
|
9
|
-
class Line extends Entity {
|
|
10
|
-
constructor(container, options) {
|
|
11
|
-
super(container);
|
|
12
|
-
__publicField(this, "positions", []);
|
|
13
|
-
this.instance = container.viewer.entities.add({
|
|
14
|
-
polyline: {
|
|
15
|
-
...options,
|
|
16
|
-
positions: new CallbackProperty(() => this.positions, false)
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export {
|
|
22
|
-
Line
|
|
23
|
-
};
|
package/Point/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { CallbackProperty } from "@voxel-pixel/core";
|
|
2
|
-
import { SingleEntity } from "../SingleEntity.js";
|
|
3
|
-
class Point extends SingleEntity {
|
|
4
|
-
constructor(container, options) {
|
|
5
|
-
super(container);
|
|
6
|
-
this.instance = container.viewer.entities.add({
|
|
7
|
-
position: new CallbackProperty(() => this.getPosition(), false),
|
|
8
|
-
point: options
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
export {
|
|
13
|
-
Point
|
|
14
|
-
};
|
package/Polygon/index.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => {
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
7
|
-
import { CallbackProperty, PolygonHierarchy } from "@voxel-pixel/core";
|
|
8
|
-
import { Entity } from "../Entity.js";
|
|
9
|
-
class Polgyon extends Entity {
|
|
10
|
-
constructor(container, options) {
|
|
11
|
-
super(container);
|
|
12
|
-
__publicField(this, "positions", []);
|
|
13
|
-
const params = {
|
|
14
|
-
polygon: {
|
|
15
|
-
...options,
|
|
16
|
-
hierarchy: new CallbackProperty(() => new PolygonHierarchy(this.positions), false)
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
if (options.lineOption) {
|
|
20
|
-
params.polyline = {
|
|
21
|
-
...options.lineOption,
|
|
22
|
-
positions: new CallbackProperty(() => this.positions, false)
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
this.instance = container.viewer.entities.add(params);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export {
|
|
29
|
-
Polgyon
|
|
30
|
-
};
|
package/SingleEntity.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => {
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
7
|
-
import { Cartesian3, Cartographic, sampleTerrainMostDetailed } from "@voxel-pixel/core";
|
|
8
|
-
import { Entity } from "./Entity.js";
|
|
9
|
-
class SingleEntity extends Entity {
|
|
10
|
-
constructor(container) {
|
|
11
|
-
super(container);
|
|
12
|
-
__publicField(this, "position");
|
|
13
|
-
this.position = new Cartesian3();
|
|
14
|
-
}
|
|
15
|
-
lookAtMe(offset, height) {
|
|
16
|
-
if (!this.instance)
|
|
17
|
-
return;
|
|
18
|
-
if (this.container.mountedTerrain) {
|
|
19
|
-
const cartographic = Cartographic.fromCartesian(this.position);
|
|
20
|
-
sampleTerrainMostDetailed(
|
|
21
|
-
this.container.viewer.scene.terrainProvider,
|
|
22
|
-
[cartographic]
|
|
23
|
-
).then(([terrainPoint]) => {
|
|
24
|
-
const terrainHeight = Math.max(terrainPoint.height || 0, 0);
|
|
25
|
-
cartographic.height = terrainHeight + (height || 0);
|
|
26
|
-
this.container.viewer.camera.setView({
|
|
27
|
-
destination: Cartographic.toCartesian(cartographic),
|
|
28
|
-
orientation: offset || {
|
|
29
|
-
heading: Math.PI / 2,
|
|
30
|
-
pitch: -Math.PI / 2,
|
|
31
|
-
roll: 0
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
} else {
|
|
36
|
-
const cartographic = Cartographic.fromCartesian(this.position);
|
|
37
|
-
cartographic.height = height || 500;
|
|
38
|
-
this.container.viewer.camera.setView({
|
|
39
|
-
destination: Cartographic.toCartesian(cartographic),
|
|
40
|
-
orientation: offset || {
|
|
41
|
-
heading: Math.PI / 2,
|
|
42
|
-
pitch: -Math.PI / 2,
|
|
43
|
-
roll: 0
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
getPosition() {
|
|
49
|
-
return Cartesian3.clone(this.position);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
export {
|
|
53
|
-
SingleEntity
|
|
54
|
-
};
|
package/Sprite/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { CallbackProperty } from "@voxel-pixel/core";
|
|
2
|
-
import { SingleEntity } from "../SingleEntity.js";
|
|
3
|
-
class Sprite extends SingleEntity {
|
|
4
|
-
constructor(container, options) {
|
|
5
|
-
super(container);
|
|
6
|
-
this.instance = container.viewer.entities.add({
|
|
7
|
-
position: new CallbackProperty(() => this.getPosition(), false),
|
|
8
|
-
billboard: options
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
export {
|
|
13
|
-
Sprite
|
|
14
|
-
};
|
package/Text/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { CallbackProperty } from "@voxel-pixel/core";
|
|
2
|
-
import { SingleEntity } from "../SingleEntity.js";
|
|
3
|
-
class Text extends SingleEntity {
|
|
4
|
-
constructor(container, options) {
|
|
5
|
-
super(container);
|
|
6
|
-
this.instance = container.viewer.entities.add({
|
|
7
|
-
position: new CallbackProperty(() => this.getPosition(), false),
|
|
8
|
-
label: options
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
export {
|
|
13
|
-
Text
|
|
14
|
-
};
|