vis-core 0.21.9 → 0.21.11
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/getVisConfig.d.ts +8 -4
- package/dist/index.js +5 -5
- package/dist/index.module.js +74 -54
- package/dist/version.d.ts +1 -1
- package/dist/vis/all/MaterialList.d.ts +1 -0
- package/dist/vis/map/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.module.js
CHANGED
|
@@ -37242,6 +37242,11 @@ class MaterialList {
|
|
|
37242
37242
|
emitObject3dChange() {
|
|
37243
37243
|
this.pencil.event.emit("object3dListChange");
|
|
37244
37244
|
}
|
|
37245
|
+
setObject3dMeta(e, s) {
|
|
37246
|
+
this.objectList.forEach((h, Y) => {
|
|
37247
|
+
h.key === e && this.objectList.set(Y, xi(xi({}, h), s));
|
|
37248
|
+
});
|
|
37249
|
+
}
|
|
37245
37250
|
setObject3d(e, s, h) {
|
|
37246
37251
|
if (this.objectList.has(e) && console.warn(`ObjectList: ${e.uuid} already exists`), !(h != null && h.disableCheckHide)) {
|
|
37247
37252
|
const Y = e.material;
|
|
@@ -47192,7 +47197,7 @@ function createAreaLightMaterial(c) {
|
|
|
47192
47197
|
const e = new MeshBasicMaterial();
|
|
47193
47198
|
return e.color.setScalar(c), e;
|
|
47194
47199
|
}
|
|
47195
|
-
const version = "0.21.
|
|
47200
|
+
const version = "0.21.11";
|
|
47196
47201
|
class Event {
|
|
47197
47202
|
constructor() {
|
|
47198
47203
|
F0(this, "event", new EventEmitter());
|
|
@@ -49182,7 +49187,7 @@ class ContinentsBg extends D$1 {
|
|
|
49182
49187
|
create() {
|
|
49183
49188
|
return $0(this, null, function* () {
|
|
49184
49189
|
const { depth: s } = this.options, h = this.pencil.installPlugins.get("materialList"), Y = this.pencil.getPlugin("draw"), Ge = h.getMaterialObj("continents");
|
|
49185
|
-
this.createGroup(), yield Promise.all(
|
|
49190
|
+
this.createGroup(), this.object3d.name = "大洲组", yield Promise.all(
|
|
49186
49191
|
continents.features.map((We) => $0(this, null, function* () {
|
|
49187
49192
|
const Re = We.properties.name;
|
|
49188
49193
|
Re === "大洋洲" && (We.geometry.coordinates[4] = [], We.geometry.coordinates[21] = []);
|
|
@@ -49242,8 +49247,13 @@ class ContinentsBg extends D$1 {
|
|
|
49242
49247
|
}), this.mapArr.forEach((h) => {
|
|
49243
49248
|
s.setObject3d(h.object3d, "continents-" + h.userData.name, {
|
|
49244
49249
|
baseObject: h,
|
|
49245
|
-
remove: !1
|
|
49250
|
+
remove: !1,
|
|
49251
|
+
parent: this.object3d
|
|
49246
49252
|
});
|
|
49253
|
+
}), s.setObject3dMeta("continentsArea", {
|
|
49254
|
+
parent: this.object3d
|
|
49255
|
+
}), s.setObject3dMeta("continentsLine", {
|
|
49256
|
+
parent: this.object3d
|
|
49247
49257
|
});
|
|
49248
49258
|
}
|
|
49249
49259
|
dispose() {
|
|
@@ -49730,10 +49740,10 @@ const objs$4 = sn(xi({}, objs$5), {
|
|
|
49730
49740
|
"continentsArea",
|
|
49731
49741
|
["continents#topMat", "continents#sideMat"],
|
|
49732
49742
|
{
|
|
49733
|
-
name: "
|
|
49743
|
+
name: "板块材质"
|
|
49734
49744
|
}
|
|
49735
49745
|
), this.mList.setShowMaterialList("continentsLine", "continents#lineMat", {
|
|
49736
|
-
name: "
|
|
49746
|
+
name: "线材质"
|
|
49737
49747
|
});
|
|
49738
49748
|
}
|
|
49739
49749
|
});
|
|
@@ -49931,7 +49941,13 @@ const objs$4 = sn(xi({}, objs$5), {
|
|
|
49931
49941
|
getDepth(s) {
|
|
49932
49942
|
const h = this.getAdcodeShowLevel(s);
|
|
49933
49943
|
let Y = this.options.mapDepth;
|
|
49934
|
-
|
|
49944
|
+
Array.isArray(Y) || (Y = new Array(3).fill(Y));
|
|
49945
|
+
let Ge;
|
|
49946
|
+
if (h === "country" ? Ge = Y[0] : h === "province" ? Ge = Y[1] : Ge = Y[2], this.options.depthReference && this.options.bboxMap[s]) {
|
|
49947
|
+
const We = this.options.depthReference, Re = this.options.bboxMap[s], Le = Math.abs(Re[3] - Re[1]) / Math.abs(We[3] - We[1]), ve = Math.abs(Re[2] - Re[0]) / Math.abs(We[2] - We[0]);
|
|
49948
|
+
Ge = Ge * Math.max(Le, ve);
|
|
49949
|
+
}
|
|
49950
|
+
return Ge;
|
|
49935
49951
|
}
|
|
49936
49952
|
getAdcodeShowLevel(s) {
|
|
49937
49953
|
var h;
|
|
@@ -53132,7 +53148,7 @@ function stringToUtf8ByteArray(c) {
|
|
|
53132
53148
|
}
|
|
53133
53149
|
let b = "/";
|
|
53134
53150
|
b === "/" && (b = "");
|
|
53135
|
-
const getMapConfig = (
|
|
53151
|
+
const getMapConfig = (h, ...Y) => $0(void 0, [h, ...Y], function* (c, e = b, s) {
|
|
53136
53152
|
if (c === 0)
|
|
53137
53153
|
return {
|
|
53138
53154
|
mapDepth: 5,
|
|
@@ -53142,94 +53158,98 @@ const getMapConfig = (s, ...h) => $0(void 0, [s, ...h], function* (c, e = b) {
|
|
|
53142
53158
|
center: [0, 0]
|
|
53143
53159
|
};
|
|
53144
53160
|
{
|
|
53145
|
-
const
|
|
53161
|
+
const Ge = adcodeMap[c];
|
|
53146
53162
|
return extendMapConfig(
|
|
53147
53163
|
"map",
|
|
53148
53164
|
{
|
|
53149
|
-
center: [
|
|
53150
|
-
adcode:
|
|
53165
|
+
center: [Ge.lng, Ge.lat],
|
|
53166
|
+
adcode: Ge.adcode
|
|
53151
53167
|
},
|
|
53152
|
-
e
|
|
53168
|
+
e,
|
|
53169
|
+
s
|
|
53153
53170
|
);
|
|
53154
53171
|
}
|
|
53155
|
-
}), getMap2Config = (
|
|
53156
|
-
const
|
|
53172
|
+
}), getMap2Config = (h, ...Y) => $0(void 0, [h, ...Y], function* (c, e = b, s) {
|
|
53173
|
+
const Ge = adcodeMap[c];
|
|
53157
53174
|
return extendMapConfig(
|
|
53158
53175
|
"map2",
|
|
53159
53176
|
{
|
|
53160
|
-
center: [
|
|
53161
|
-
adcode:
|
|
53162
|
-
parentBg:
|
|
53177
|
+
center: [Ge.lng, Ge.lat],
|
|
53178
|
+
adcode: Ge.adcode,
|
|
53179
|
+
parentBg: Ge.adcode !== 1e5
|
|
53163
53180
|
},
|
|
53164
|
-
e
|
|
53181
|
+
e,
|
|
53182
|
+
s
|
|
53165
53183
|
);
|
|
53166
|
-
}), getMap2WithCityConfig = (
|
|
53167
|
-
const
|
|
53184
|
+
}), getMap2WithCityConfig = (h, ...Y) => $0(void 0, [h, ...Y], function* (c, e = b, s) {
|
|
53185
|
+
const Ge = adcodeMap[c];
|
|
53168
53186
|
return extendMapConfig(
|
|
53169
53187
|
"map2",
|
|
53170
53188
|
{
|
|
53171
|
-
center: [
|
|
53172
|
-
adcode:
|
|
53189
|
+
center: [Ge.lng, Ge.lat],
|
|
53190
|
+
adcode: Ge.adcode,
|
|
53173
53191
|
showOneLevel: !0,
|
|
53174
|
-
allCity:
|
|
53192
|
+
allCity: Ge.level === "province",
|
|
53175
53193
|
cityOnMap: !0,
|
|
53176
53194
|
parentBg: !1,
|
|
53177
53195
|
mapDepth: 4e-3,
|
|
53178
53196
|
bottomPlane: !1
|
|
53179
53197
|
},
|
|
53180
|
-
e
|
|
53198
|
+
e,
|
|
53199
|
+
s
|
|
53181
53200
|
);
|
|
53182
|
-
}), extendMapConfig = (
|
|
53183
|
-
var
|
|
53201
|
+
}), extendMapConfig = (Y, Ge, ...We) => $0(void 0, [Y, Ge, ...We], function* (c, e, s = b, h) {
|
|
53202
|
+
var Re, Le;
|
|
53184
53203
|
if (e.adcode !== 0 && e.adcode !== 1e5) {
|
|
53185
|
-
const
|
|
53186
|
-
let { res:
|
|
53187
|
-
s + `/geojson/${
|
|
53204
|
+
const ve = (Re = e.fixGeojson) == null ? void 0 : Re[e.adcode], Ie = (Le = e.fixGeojson) == null ? void 0 : Le[e.adcode + "-lite"];
|
|
53205
|
+
let { res: Te } = yield jsonFetch(
|
|
53206
|
+
s + `/geojson/${ve || "json"}/${e.adcode}.json`
|
|
53188
53207
|
);
|
|
53189
|
-
const { res:
|
|
53190
|
-
s + `/geojson/${
|
|
53191
|
-
),
|
|
53208
|
+
const { res: ke } = yield jsonFetch(
|
|
53209
|
+
s + `/geojson/${Ie || "json-lite"}/${e.adcode}.json`
|
|
53210
|
+
), ze = bbox(ke), je = e.adcode, pt = sn(xi({}, e), {
|
|
53192
53211
|
geojsonMap: {
|
|
53193
|
-
[
|
|
53212
|
+
[je]: Te
|
|
53194
53213
|
},
|
|
53195
53214
|
extrudeLineGeojsonMap: {
|
|
53196
|
-
[
|
|
53215
|
+
[je]: ke
|
|
53197
53216
|
},
|
|
53198
53217
|
bboxMap: {
|
|
53199
|
-
[
|
|
53218
|
+
[je]: ze
|
|
53200
53219
|
},
|
|
53201
53220
|
cityBboxMap: {},
|
|
53202
|
-
jsonNameObj: {}
|
|
53221
|
+
jsonNameObj: {},
|
|
53222
|
+
depthReference: void 0
|
|
53203
53223
|
});
|
|
53204
53224
|
if (c === "map2") {
|
|
53205
|
-
if (!(adcodeMap[
|
|
53206
|
-
let
|
|
53207
|
-
for (; adcodeMap[
|
|
53208
|
-
|
|
53209
|
-
const { res:
|
|
53210
|
-
s + `/geojson/${
|
|
53225
|
+
if (!(adcodeMap[je].level === "province")) {
|
|
53226
|
+
let Be = adcodeMap[je].parent;
|
|
53227
|
+
for (; adcodeMap[Be].level !== "province"; )
|
|
53228
|
+
Be = adcodeMap[Be].parent;
|
|
53229
|
+
const { res: at } = yield jsonFetch(
|
|
53230
|
+
s + `/geojson/${ve || "json"}/${Be}.json`
|
|
53211
53231
|
);
|
|
53212
|
-
|
|
53232
|
+
Te = at;
|
|
53213
53233
|
}
|
|
53214
|
-
|
|
53215
|
-
|
|
53216
|
-
|
|
53217
|
-
`${
|
|
53234
|
+
Te.features.forEach((Be) => {
|
|
53235
|
+
pt.cityBboxMap[Be.properties.adcode] = bbox(Be), pt.jsonNameObj[Be.properties.adcode] = ec(
|
|
53236
|
+
Be.properties.name,
|
|
53237
|
+
`${Be.properties.adcode}`
|
|
53218
53238
|
);
|
|
53219
53239
|
});
|
|
53220
53240
|
}
|
|
53221
53241
|
if (e.parentBg) {
|
|
53222
|
-
const
|
|
53223
|
-
if (
|
|
53224
|
-
const { res:
|
|
53225
|
-
s + `/geojson/json/${
|
|
53226
|
-
), { res:
|
|
53227
|
-
s + `/geojson/json-lite/${
|
|
53242
|
+
const nt = adcodeMap[je].parent;
|
|
53243
|
+
if (nt !== 1e5) {
|
|
53244
|
+
const { res: Be } = yield jsonFetch(
|
|
53245
|
+
s + `/geojson/json/${nt}.json`
|
|
53246
|
+
), { res: at } = yield jsonFetch(
|
|
53247
|
+
s + `/geojson/json-lite/${nt}.json`
|
|
53228
53248
|
);
|
|
53229
|
-
|
|
53249
|
+
pt.geojsonMap[nt] = Be, pt.extrudeLineGeojsonMap[nt] = at, pt.bboxMap[nt] = bbox(at);
|
|
53230
53250
|
}
|
|
53231
53251
|
}
|
|
53232
|
-
return
|
|
53252
|
+
return h && (pt.depthReference = h.depthReference || h.bboxMap[h.adcode]), pt;
|
|
53233
53253
|
}
|
|
53234
53254
|
return xi({}, e);
|
|
53235
53255
|
}), getCityConfig = (s, ...h) => $0(void 0, [s, ...h], function* (c, e = b) {
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "0.21.
|
|
1
|
+
declare const _default: "0.21.11";
|
|
2
2
|
export default _default;
|
|
@@ -32,6 +32,7 @@ export default class MaterialList {
|
|
|
32
32
|
}): void;
|
|
33
33
|
getValidShowObjectListArr(): Meta[];
|
|
34
34
|
emitObject3dChange(): void;
|
|
35
|
+
setObject3dMeta(key: string, meta: ObjectMeta): void;
|
|
35
36
|
setObject3d(object3d: THREE.Object3D, key: string, meta?: ObjectMeta & {
|
|
36
37
|
disableCheckHide?: boolean;
|
|
37
38
|
}): void;
|
package/dist/vis/map/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export interface MapOptions extends BaseOptions {
|
|
|
20
20
|
continentsBgDepth?: number;
|
|
21
21
|
clickOusideBack?: boolean;
|
|
22
22
|
mapDepth?: number[];
|
|
23
|
+
depthReference?: number[];
|
|
23
24
|
mapPadding?: number[];
|
|
24
25
|
geojsonMap?: Record<string, GeoJSON>;
|
|
25
26
|
extrudeLineGeojsonMap?: Record<string, GeoJSON>;
|