vis-core 0.13.3 → 0.13.5
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/index.js +64 -64
- package/dist/index.module.js +96 -93
- package/dist/version.d.ts +1 -1
- package/dist/vis/map/index.d.ts +4 -2
- package/dist/vis/map/objects/PlaneMap.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.module.js
CHANGED
|
@@ -41145,7 +41145,7 @@ function Bl(n) {
|
|
|
41145
41145
|
const t = new qt();
|
|
41146
41146
|
return t.color.setScalar(n), t;
|
|
41147
41147
|
}
|
|
41148
|
-
const pX = "0.13.
|
|
41148
|
+
const pX = "0.13.5", o1 = !1;
|
|
41149
41149
|
class Na {
|
|
41150
41150
|
constructor(t, e = {}) {
|
|
41151
41151
|
D(this, "container");
|
|
@@ -41520,90 +41520,17 @@ class bX extends ye {
|
|
|
41520
41520
|
}), this.extrudelineArr = y);
|
|
41521
41521
|
});
|
|
41522
41522
|
}
|
|
41523
|
-
|
|
41524
|
-
|
|
41525
|
-
|
|
41526
|
-
|
|
41527
|
-
|
|
41528
|
-
|
|
41529
|
-
|
|
41530
|
-
|
|
41531
|
-
|
|
41532
|
-
|
|
41533
|
-
|
|
41534
|
-
), o = this.options.curvatureResolution && this.options.areaGroup ? a : l;
|
|
41535
|
-
o.color.set("#ffffff"), o.onBeforeCompile = (c) => {
|
|
41536
|
-
c.uniforms.c = {
|
|
41537
|
-
value: new rt(i)
|
|
41538
|
-
}, c.fragmentShader = `
|
|
41539
|
-
uniform vec3 c;
|
|
41540
|
-
vec3 rgb2hsv(float r, float g, float b) {
|
|
41541
|
-
vec3 c = vec3(r, g, b);
|
|
41542
|
-
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
|
41543
|
-
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
|
|
41544
|
-
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
|
|
41545
|
-
|
|
41546
|
-
float d = q.x - min(q.w, q.y);
|
|
41547
|
-
float e = 1.0e-10;
|
|
41548
|
-
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
|
41549
|
-
}
|
|
41550
|
-
|
|
41551
|
-
vec3 hsv2rgb( float h, float s, float v ) {
|
|
41552
|
-
vec3 c = vec3(h, s, v);
|
|
41553
|
-
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
|
41554
|
-
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
|
41555
|
-
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
|
41556
|
-
}
|
|
41557
|
-
|
|
41558
|
-
vec3 adjustBrightnessContrast(vec3 color, float brightness, float contrast) {
|
|
41559
|
-
color = color * brightness;
|
|
41560
|
-
color = (color - 0.5) * contrast + 0.5;
|
|
41561
|
-
return clamp(color, 0.0, 1.0);
|
|
41562
|
-
}
|
|
41563
|
-
|
|
41564
|
-
float contrast(float value, float contrast) {
|
|
41565
|
-
return (value - 0.5) * contrast + 0.5;
|
|
41566
|
-
}
|
|
41567
|
-
|
|
41568
|
-
float contrast2(float value, float contrast, float center) {
|
|
41569
|
-
return (value - center) * contrast + center;
|
|
41570
|
-
}
|
|
41571
|
-
|
|
41572
|
-
vec3 adjustBrightness(vec3 color, float brightness) {
|
|
41573
|
-
float factor = 0.4 * brightness * brightness + 0.6 * brightness;
|
|
41574
|
-
return clamp(color * factor, 0.0, 1.0);
|
|
41575
|
-
}
|
|
41576
|
-
|
|
41577
|
-
${c.fragmentShader}
|
|
41578
|
-
`.replace(
|
|
41579
|
-
"#include <dithering_fragment>",
|
|
41580
|
-
`#include <dithering_fragment>
|
|
41581
|
-
vec4 _i_50_rgb = gl_FragColor;
|
|
41582
|
-
float alpha = 1.0;
|
|
41583
|
-
vec3 _i_51_hsv = rgb2hsv(_i_50_rgb.r, _i_50_rgb.g, _i_50_rgb.b);
|
|
41584
|
-
vec3 _i_52_rgb = hsv2rgb(_i_51_hsv.r, _i_51_hsv.g, _i_51_hsv.b);
|
|
41585
|
-
|
|
41586
|
-
float alphas = _i_52_rgb.b * 0.6;
|
|
41587
|
-
alphas *= 0.8;
|
|
41588
|
-
alphas *= mix(1.5, 1.9, alphas);
|
|
41589
|
-
alphas += (1.0 - alphas) * 0.25;
|
|
41590
|
-
|
|
41591
|
-
float endC = 1.0;
|
|
41592
|
-
alphas = mix(0.3, endC, alphas / endC);
|
|
41593
|
-
alphas = mix(alphas, alphas, step(endC, alphas));
|
|
41594
|
-
alphas = contrast(alphas, 1.4);
|
|
41595
|
-
alphas = contrast2(alphas, 1.5, 0.9);
|
|
41596
|
-
|
|
41597
|
-
vec3 chsv = rgb2hsv(c.r, c.g, c.b);
|
|
41598
|
-
vec3 ccccc = hsv2rgb(chsv.r, chsv.g - 0.2, alphas - 0.27);
|
|
41599
|
-
gl_FragColor = vec4(ccccc, alpha * 0.65);
|
|
41600
|
-
|
|
41601
|
-
|
|
41602
|
-
`
|
|
41603
|
-
);
|
|
41604
|
-
}, o.needsUpdate = !0, s.useMaterial(i);
|
|
41605
|
-
}
|
|
41606
|
-
});
|
|
41523
|
+
setAreaColor(e, i) {
|
|
41524
|
+
if (i === "origin") {
|
|
41525
|
+
e.useMaterial("origin");
|
|
41526
|
+
return;
|
|
41527
|
+
}
|
|
41528
|
+
const [s, l] = e.setMaterialList(
|
|
41529
|
+
i,
|
|
41530
|
+
"clone",
|
|
41531
|
+
!1
|
|
41532
|
+
), a = this.options.curvatureResolution && this.options.areaGroup ? l : s;
|
|
41533
|
+
return a.color.set(i), e.useMaterial(i), a;
|
|
41607
41534
|
}
|
|
41608
41535
|
addArea(e, i) {
|
|
41609
41536
|
return Zt(this, null, function* () {
|
|
@@ -42063,6 +41990,7 @@ const DI = {
|
|
|
42063
41990
|
parentBg: !1,
|
|
42064
41991
|
continentsBg: !1,
|
|
42065
41992
|
continentsBgDepth: 0,
|
|
41993
|
+
parentBgDepth: 0,
|
|
42066
41994
|
clickOusideBack: !0,
|
|
42067
41995
|
mapDepth: [1, 0.4, 0.2],
|
|
42068
41996
|
mapPadding: [100, 100, 100, 100],
|
|
@@ -42110,7 +42038,7 @@ const DI = {
|
|
|
42110
42038
|
shadowMap: !1
|
|
42111
42039
|
});
|
|
42112
42040
|
D(this, "shadowMapLight");
|
|
42113
|
-
if (this.pencilConfig = jI, (this.getAdcodeShowLevel(this.options.adcode) === "province" || this.getAdcodeShowLevel(this.options.adcode) === "country") && (this.extendsOptions.parentBg = () => this.options.parentBg, this.extendsOptions.continentsBg = () => this.options.continentsBg, this.extendsOptions.continentsBgDepth = () => this.options.continentsBgDepth, this.options.continentsBg && this.options.adcode === 1e5 && (this.options.center = [104, 37.5])), this.options.adcode === 0) {
|
|
42041
|
+
if (this.pencilConfig = jI, (this.getAdcodeShowLevel(this.options.adcode) === "province" || this.getAdcodeShowLevel(this.options.adcode) === "country") && (this.extendsOptions.parentBg = () => this.options.parentBg, this.extendsOptions.parentBgDepth = () => this.options.parentBgDepth, this.extendsOptions.continentsBg = () => this.options.continentsBg, this.extendsOptions.continentsBgDepth = () => this.options.continentsBgDepth, this.options.continentsBg && this.options.adcode === 1e5 && (this.options.center = [104, 37.5])), this.options.adcode === 0) {
|
|
42114
42042
|
if (this.options.extrudeLine) {
|
|
42115
42043
|
const o = {
|
|
42116
42044
|
type: "FeatureCollection",
|
|
@@ -42150,8 +42078,7 @@ const DI = {
|
|
|
42150
42078
|
}
|
|
42151
42079
|
handleSetting(e, i) {
|
|
42152
42080
|
return Zt(this, null, function* () {
|
|
42153
|
-
|
|
42154
|
-
return yield qi(Hs.prototype, this, "handleSetting").call(this, e, i), e === "label" ? i === !1 ? (this.eraseLabels(), this.options.showLabel = !1) : (this.settings.labelLite = !1, yield this.settings.labelLite, this.options.showLabel = !0, yield this.drawLabels()) : e === "labelLite" ? i === !1 ? (this.eraseLabels(), this.options.showLabel = !1) : (this.settings.label = !1, yield this.settings.label, this.options.showLabel = "lite", yield this.drawLabels()) : e === "shadowMap" ? i === !1 ? this.shadowMapDisabled() : yield this.shadowMapEnabled() : e === "areaColor" && this.setAreaColor((l = (s = this.mapArea) == null ? void 0 : s.at(0)) == null ? void 0 : l.userData.adcode, i), i;
|
|
42081
|
+
return yield qi(Hs.prototype, this, "handleSetting").call(this, e, i), e === "label" ? i === !1 ? (this.eraseLabels(), this.options.showLabel = !1) : (this.settings.labelLite = !1, yield this.settings.labelLite, this.options.showLabel = !0, yield this.drawLabels()) : e === "labelLite" ? i === !1 ? (this.eraseLabels(), this.options.showLabel = !1) : (this.settings.label = !1, yield this.settings.label, this.options.showLabel = "lite", yield this.drawLabels()) : e === "shadowMap" && (i === !1 ? this.shadowMapDisabled() : yield this.shadowMapEnabled()), i;
|
|
42155
42082
|
});
|
|
42156
42083
|
}
|
|
42157
42084
|
init() {
|
|
@@ -42183,10 +42110,10 @@ const DI = {
|
|
|
42183
42110
|
},
|
|
42184
42111
|
areaGroup: !1,
|
|
42185
42112
|
bbox: c,
|
|
42186
|
-
depth:
|
|
42113
|
+
depth: this.options.parentBgDepth,
|
|
42187
42114
|
materialOptions: Et({}, d)
|
|
42188
42115
|
});
|
|
42189
|
-
this.parentBg.push(r);
|
|
42116
|
+
r.position.z = -this.options.parentBgDepth, this.parentBg.push(r);
|
|
42190
42117
|
}
|
|
42191
42118
|
this.options.continentsBg && (this.continentsBg = yield this.drawController.draw("ContinentsBg", {
|
|
42192
42119
|
depth: this.options.continentsBgDepth,
|
|
@@ -42311,9 +42238,85 @@ const DI = {
|
|
|
42311
42238
|
this.mList.setMaterialObj("plane", s), this.mList.showMaterialList.set("area", ["plane#topMat", "plane#sideMat"]), this.mList.showMaterialList.set("line", "plane#lineMat"), this.mList.showMaterialList.set("extrudeline", "plane#extrudeLineMat"), this.mList.showMaterialListTitle.set("area", "板块"), this.mList.showMaterialListTitle.set("line", "板块线"), this.mList.showMaterialListTitle.set("extrudeline", "板块边线");
|
|
42312
42239
|
});
|
|
42313
42240
|
}
|
|
42314
|
-
|
|
42315
|
-
|
|
42316
|
-
|
|
42241
|
+
setAreaMixColor(e, i) {
|
|
42242
|
+
const s = this.setAreaColorByProperty("adcode", e, i);
|
|
42243
|
+
s && (s.color.set("#ffffff"), s.onBeforeCompile = (l) => {
|
|
42244
|
+
l.uniforms.c = {
|
|
42245
|
+
value: new rt(i)
|
|
42246
|
+
}, l.fragmentShader = `
|
|
42247
|
+
uniform vec3 c;
|
|
42248
|
+
vec3 rgb2hsv(float r, float g, float b) {
|
|
42249
|
+
vec3 c = vec3(r, g, b);
|
|
42250
|
+
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
|
42251
|
+
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
|
|
42252
|
+
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
|
|
42253
|
+
|
|
42254
|
+
float d = q.x - min(q.w, q.y);
|
|
42255
|
+
float e = 1.0e-10;
|
|
42256
|
+
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
|
42257
|
+
}
|
|
42258
|
+
|
|
42259
|
+
vec3 hsv2rgb( float h, float s, float v ) {
|
|
42260
|
+
vec3 c = vec3(h, s, v);
|
|
42261
|
+
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
|
42262
|
+
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
|
42263
|
+
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
|
42264
|
+
}
|
|
42265
|
+
|
|
42266
|
+
vec3 adjustBrightnessContrast(vec3 color, float brightness, float contrast) {
|
|
42267
|
+
color = color * brightness;
|
|
42268
|
+
color = (color - 0.5) * contrast + 0.5;
|
|
42269
|
+
return clamp(color, 0.0, 1.0);
|
|
42270
|
+
}
|
|
42271
|
+
|
|
42272
|
+
float contrast(float value, float contrast) {
|
|
42273
|
+
return (value - 0.5) * contrast + 0.5;
|
|
42274
|
+
}
|
|
42275
|
+
|
|
42276
|
+
float contrast2(float value, float contrast, float center) {
|
|
42277
|
+
return (value - center) * contrast + center;
|
|
42278
|
+
}
|
|
42279
|
+
|
|
42280
|
+
vec3 adjustBrightness(vec3 color, float brightness) {
|
|
42281
|
+
float factor = 0.4 * brightness * brightness + 0.6 * brightness;
|
|
42282
|
+
return clamp(color * factor, 0.0, 1.0);
|
|
42283
|
+
}
|
|
42284
|
+
|
|
42285
|
+
${l.fragmentShader}
|
|
42286
|
+
`.replace(
|
|
42287
|
+
"#include <dithering_fragment>",
|
|
42288
|
+
`#include <dithering_fragment>
|
|
42289
|
+
vec4 _i_50_rgb = gl_FragColor;
|
|
42290
|
+
float alpha = 1.0;
|
|
42291
|
+
vec3 _i_51_hsv = rgb2hsv(_i_50_rgb.r, _i_50_rgb.g, _i_50_rgb.b);
|
|
42292
|
+
vec3 _i_52_rgb = hsv2rgb(_i_51_hsv.r, _i_51_hsv.g, _i_51_hsv.b);
|
|
42293
|
+
|
|
42294
|
+
float alphas = _i_52_rgb.b * 0.6;
|
|
42295
|
+
alphas *= 0.8;
|
|
42296
|
+
alphas *= mix(1.5, 1.9, alphas);
|
|
42297
|
+
alphas += (1.0 - alphas) * 0.25;
|
|
42298
|
+
|
|
42299
|
+
float endC = 1.0;
|
|
42300
|
+
alphas = mix(0.3, endC, alphas / endC);
|
|
42301
|
+
alphas = mix(alphas, alphas, step(endC, alphas));
|
|
42302
|
+
alphas = contrast(alphas, 1.4);
|
|
42303
|
+
alphas = contrast2(alphas, 1.5, 0.9);
|
|
42304
|
+
|
|
42305
|
+
vec3 chsv = rgb2hsv(c.r, c.g, c.b);
|
|
42306
|
+
vec3 ccccc = hsv2rgb(chsv.r, chsv.g - 0.2, alphas - 0.27);
|
|
42307
|
+
gl_FragColor = vec4(ccccc, alpha * 0.65);
|
|
42308
|
+
|
|
42309
|
+
|
|
42310
|
+
`
|
|
42311
|
+
);
|
|
42312
|
+
}, s.needsUpdate = !0);
|
|
42313
|
+
}
|
|
42314
|
+
setAreaColorByProperty(e, i, s) {
|
|
42315
|
+
if (!this.map)
|
|
42316
|
+
return;
|
|
42317
|
+
const l = this.map.areaArr.find((a) => a.userData[e] === i);
|
|
42318
|
+
if (l)
|
|
42319
|
+
return this.map.setAreaColor(l, s);
|
|
42317
42320
|
}
|
|
42318
42321
|
addAreaPlaneByProperty(l, a) {
|
|
42319
42322
|
return Zt(this, arguments, function* (e, i, s = {}) {
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "0.13.
|
|
1
|
+
declare const _default: "0.13.5";
|
|
2
2
|
export default _default;
|
package/dist/vis/map/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export interface MapOptions {
|
|
|
11
11
|
adcode: number;
|
|
12
12
|
center?: [number, number];
|
|
13
13
|
parentBg?: boolean | number;
|
|
14
|
+
parentBgDepth?: number;
|
|
14
15
|
bboxOffset?: number[];
|
|
15
16
|
fixCity?: Record<number, number>;
|
|
16
17
|
continentsBg?: boolean;
|
|
@@ -103,8 +104,9 @@ export default class extends Base {
|
|
|
103
104
|
initMap(adcode: number): Promise<void>;
|
|
104
105
|
loaderAdd(adcode: number): void;
|
|
105
106
|
initMaterial(adcode: number): Promise<void>;
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
setAreaMixColor(adcode: number, color: string): void;
|
|
108
|
+
setAreaColorByProperty(key: string, value: any, color: string): THREE.MeshStandardMaterial | undefined;
|
|
109
|
+
addAreaPlaneByProperty(key: string, value: any, options?: {
|
|
108
110
|
material?: THREE.Material;
|
|
109
111
|
lineMaterial?: MeshLineMaterial;
|
|
110
112
|
curvatureResolution?: number;
|
|
@@ -40,7 +40,7 @@ export default class PlaneMap extends BaseObject {
|
|
|
40
40
|
extrudelineArr?: Line[];
|
|
41
41
|
constructor(options: Options);
|
|
42
42
|
create(): Promise<void>;
|
|
43
|
-
|
|
43
|
+
setAreaColor(area: ExtrudePolygon, color: string): THREE.MeshStandardMaterial | undefined;
|
|
44
44
|
addArea(geojson: GeoJSON, options: {
|
|
45
45
|
material: THREE.Material | THREE.Material[];
|
|
46
46
|
bbox?: number[];
|