]+>/g, "")), t
}
});
t.KmlLayer = s
}, function (e, t, i) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.CzmlLayer = void 0;
var r = i(0),
n = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(r),
o = i(33),
a = i(2),
s = o.GeoJsonLayer.extend({
queryData: function () {
var e = this,
t = (0, a.getProxyUrl)(this.config);
n.CzmlDataSource.load(t.url, t).then(function (t) {
e.showResult(t)
}).otherwise(function (t) {
e.showError("服务出错", t)
})
},
getEntityAttr: function (e) {
if (e.description && e.description.getValue) return e.description.getValue(this.viewer.clock.currentTime)
}
});
t.CzmlLayer = s
}, function (e, t, i) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.TerrainLayer = void 0;
var r = i(0),
n = (function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
t.default = e
}(r), i(9)),
o = i(18),
a = n.BaseLayer.extend({
terrain: null,
add: function () {
this.terrain || (this.terrain = (0, o.getTerrainProvider)(this.config)), this.viewer.terrainProvider = this.terrain
},
remove: function () {
this.viewer.terrainProvider = (0, o.getEllipsoidTerrain)()
}
});
t.TerrainLayer = a
}, function (e, t, i) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.DrawLayer = void 0;
var r = i(0),
n = (function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
t.default = e
}(r), i(5)),
o = function (e) {
return e && e.__esModule ? e : {
default: e
}
}(n),
a = i(9),
s = i(16),
l = i(2),
u = a.BaseLayer.extend({
create: function () {
this.drawControl = new s.Draw(this.viewer, {
hasEdit: !1,
nameTooltip: !1,
removeScreenSpaceEvent: !1
})
},
add: function () {
this._isload ? this.drawControl.setVisible(!0) : this._loadData()
},
remove: function () {
this.drawControl.setVisible(!1)
},
centerAt: function (e) {
var t = this.drawControl.getEntitys();
this.viewer.flyTo(t, {
duration: e
})
},
hasOpacity: !1,
setOpacity: function (e) {},
_loadData: function () {
var e = this;
o.default.ajax({
type: "get",
dataType: "json",
url: this.config.url,
timeout: 1e4,
success: function (t) {
e._isload = !0;
var i = e.drawControl.jsonToEntity(t, !0, e.config.flyTo);
e._bindEntityConfig(i)
},
error: function (t, i, r) {
console.log("Json文件" + e.config.url + "加载失败!")
}
})
},
_bindEntityConfig: function (e) {
for (var t = this, i = 0, r = e.length; i < r; i++) {
var n = e[i];
(this.config.columns || this.config.popup) && (n.popup = {
html: function (e) {
var i = e.attribute.attr;
return i.layer_name = t.config.name, i.draw_type = e.attribute.type, i.draw_typename = e.attribute.name, (0, l.getPopupForConfig)(t.config, i)
},
anchor: this.config.popupAnchor || [0, -15]
}), this.config.tooltip && (n.tooltip = {
html: function (e) {
var i = e.attribute.attr;
return i.layer_name = t.config.name, i.draw_type = e.attribute.type, i.draw_typename = e.attribute.name, (0, l.getPopupForConfig)({
popup: t.config.tooltip
}, i)
},
anchor: this.config.tooltipAnchor || [0, -15]
}), this.config.click && (n.click = this.config.click), this.config.mouseover && (n.mouseover = this.config.mouseover), this.config.mouseout && (n.mouseout = this.config.mouseout)
}
}
});
t.DrawLayer = u
}, function (e, t, i) {
"use strict";
function r(e) {
var t = e.url;
if (o.defined(e.layer)) switch (e.layer) {
case "vec":
t = "http://online{s}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles=" + (e.bigfont ? "ph" : "pl") + "&scaler=1&p=1";
break;
case "img_d":
t = "http://shangetu{s}.map.bdimg.com/it/u=x={x};y={y};z={z};v=009;type=sate&fm=46";
break;
case "img_z":
t = "http://online{s}.map.bdimg.com/tile/?qt=tile&x={x}&y={y}&z={z}&styles=" + (e.bigfont ? "sh" : "sl") + "&v=020";
break;
case "custom":
e.customid = e.customid || "midnight", t = "http://api{s}.map.bdimg.com/customimage/tile?&x={x}&y={y}&z={z}&scale=1&customid=" + e.customid;
break;
case "time":
t = "http://its.map.baidu.com:8002/traffic/TrafficTileService?x={x}&y={y}&level={z}&time=" + (new Date).getTime() + "&label=web2D&v=017"
}
this._url = t, this._tileWidth = 256, this._tileHeight = 256, this._maximumLevel = 18;
var i = new o.Cartesian2(-s, -a),
r = new o.Cartesian2(s, a);
this._tilingScheme = new o.WebMercatorTilingScheme({
rectangleSouthwestInMeters: i,
rectangleNortheastInMeters: r
}), this._credit = void 0, this._rectangle = this._tilingScheme.rectangle, this._ready = !0
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.BaiduImageryProvider = void 0;
var n = i(0),
o = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(n),
a = 33746824,
s = 33554054;
o.defineProperties(r.prototype, {
url: {
get: function () {
return this._url
}
},
token: {
get: function () {
return this._token
}
},
proxy: {
get: function () {
return this._proxy
}
},
tileWidth: {
get: function () {
if (!this._ready) throw new DeveloperError("tileWidth must not be called before the imagery provider is ready.");
return this._tileWidth
}
},
tileHeight: {
get: function () {
if (!this._ready) throw new DeveloperError("tileHeight must not be called before the imagery provider is ready.");
return this._tileHeight
}
},
maximumLevel: {
get: function () {
if (!this._ready) throw new DeveloperError("maximumLevel must not be called before the imagery provider is ready.");
return this._maximumLevel
}
},
minimumLevel: {
get: function () {
if (!this._ready) throw new DeveloperError("minimumLevel must not be called before the imagery provider is ready.");
return 0
}
},
tilingScheme: {
get: function () {
if (!this._ready) throw new DeveloperError("tilingScheme must not be called before the imagery provider is ready.");
return this._tilingScheme
}
},
rectangle: {
get: function () {
if (!this._ready) throw new DeveloperError("rectangle must not be called before the imagery provider is ready.");
return this._rectangle
}
},
tileDiscardPolicy: {
get: function () {
if (!this._ready) throw new DeveloperError("tileDiscardPolicy must not be called before the imagery provider is ready.");
return this._tileDiscardPolicy
}
},
errorEvent: {
get: function () {
return this._errorEvent
}
},
ready: {
get: function () {
return this._ready
}
},
readyPromise: {
get: function () {
return this._readyPromise.promise
}
},
credit: {
get: function () {
return this._credit
}
},
usingPrecachedTiles: {
get: function () {
return this._useTiles
}
},
hasAlphaChannel: {
get: function () {
return !0
}
},
layers: {
get: function () {
return this._layers
}
}
}), r.prototype.getTileCredits = function (e, t, i) {}, r.prototype.requestImage = function (e, t, i) {
if (!this._ready) throw new DeveloperError("requestImage must not be called before the imagery provider is ready.");
var r = this._tilingScheme.getNumberOfXTilesAtLevel(i),
n = this._tilingScheme.getNumberOfYTilesAtLevel(i),
a = this._url.replace("{x}", e - r / 2).replace("{y}", n / 2 - t - 1).replace("{z}", i).replace("{s}", Math.floor(10 * Math.random()));
return o.ImageryProvider.loadImage(this, a)
}, t.BaiduImageryProvider = r
}, function (e, t, i) {
"use strict";
function r(e) {
if (e = o.defaultValue(e, o.defaultValue.EMPTY_OBJECT), this.options = e, this._tileWidth = o.defaultValue(e.tileWidth, 256), this._tileHeight = o.defaultValue(e.tileHeight, 256), this._minimumLevel = o.defaultValue(e.minimumLevel, 0), this._maximumLevel = e.maximumLevel, e.rectangle && e.rectangle.xmin && e.rectangle.xmax && e.rectangle.ymin && e.rectangle.ymax) {
var t = e.rectangle.xmin,
i = e.rectangle.xmax,
r = e.rectangle.ymin,
n = e.rectangle.ymax;
e.rectangle = o.Rectangle.fromDegrees(t, r, i, n)
}
this._tilingScheme = o.defaultValue(e.tilingScheme, new o.GeographicTilingScheme({
ellipsoid: e.ellipsoid
})), this._rectangle = o.defaultValue(e.rectangle, this._tilingScheme.rectangle), this._rectangle = o.Rectangle.intersection(this._rectangle, this._tilingScheme.rectangle), this._hasAlphaChannel = o.defaultValue(e.hasAlphaChannel, !0), this._errorEvent = new o.Event, this._readyPromise = o.when.resolve(!0), this._credit = void 0, this._ready = !0
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.FeatureGridImageryProvider = void 0;
var n = i(0),
o = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(n);
o.defineProperties(r.prototype, {
url: {
get: function () {
return this._url
}
},
token: {
get: function () {
return this._token
}
},
proxy: {
get: function () {
return this._proxy
}
},
tileWidth: {
get: function () {
if (!this._ready) throw new DeveloperError("tileWidth must not be called before the imagery provider is ready.");
return this._tileWidth
}
},
tileHeight: {
get: function () {
if (!this._ready) throw new DeveloperError("tileHeight must not be called before the imagery provider is ready.");
return this._tileHeight
}
},
maximumLevel: {
get: function () {
if (!this._ready) throw new DeveloperError("maximumLevel must not be called before the imagery provider is ready.");
return this._maximumLevel
}
},
minimumLevel: {
get: function () {
if (!this._ready) throw new DeveloperError("minimumLevel must not be called before the imagery provider is ready.");
return 0
}
},
tilingScheme: {
get: function () {
if (!this._ready) throw new DeveloperError("tilingScheme must not be called before the imagery provider is ready.");
return this._tilingScheme
}
},
rectangle: {
get: function () {
if (!this._ready) throw new DeveloperError("rectangle must not be called before the imagery provider is ready.");
return this._rectangle
}
},
tileDiscardPolicy: {
get: function () {
if (!this._ready) throw new DeveloperError("tileDiscardPolicy must not be called before the imagery provider is ready.");
return this._tileDiscardPolicy
}
},
errorEvent: {
get: function () {
return this._errorEvent
}
},
ready: {
get: function () {
return this._ready
}
},
readyPromise: {
get: function () {
return this._readyPromise.promise
}
},
credit: {
get: function () {
return this._credit
}
},
usingPrecachedTiles: {
get: function () {
return this._useTiles
}
},
hasAlphaChannel: {
get: function () {
return !0
}
},
layers: {
get: function () {
return this._layers
}
}
}), r.prototype.getTileCredits = function (e, t, i) {}, r.prototype.requestImage = function (e, t, i) {
var r = document.createElement("canvas");
if (r.width = 256, r.height = 256, i < this._minimumLevel) return r;
if (this.options.debuggerTileInfo) {
var n = r.getContext("2d");
n.strokeStyle = "#ffff00", n.lineWidth = 2, n.strokeRect(1, 1, 255, 255);
var o = "L" + i + "X" + e + "Y" + t;
n.font = "bold 25px Arial", n.textAlign = "center", n.fillStyle = "black", n.fillText(o, 127, 127), n.fillStyle = "#ffff00", n.fillText(o, 124, 124)
}
return r
}, r.prototype._getGridKey = function (e) {
return e.level + "_x" + e.x + "_y" + e.y
}, r.prototype.addImageryCache = function (e) {
e.level < this._minimumLevel || e.level < e.maxLevel - 1 || this.options.addImageryCache && (e.key = this._getGridKey(e), this.options.addImageryCache(e))
}, r.prototype.removeImageryCache = function (e) {
e.maxLevel < this._minimumLevel && this.options.removeAllImageryCache && this.options.removeAllImageryCache(), e.level < this._minimumLevel || this.options.removeImageryCache && (e.key = this._getGridKey(e), this.options.removeImageryCache(e))
}, t.FeatureGridImageryProvider = r
}, function (e, t, i) {
"use strict";
function r(e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.DrawBillboard = void 0;
var n = i(0),
o = r(n),
a = i(27),
s = i(21),
l = r(s),
u = i(8);
t.DrawBillboard = a.DrawPoint.extend({
type: "billboard",
attrClass: l,
createFeature: function (e) {
this._positions_draw = null;
var t = this,
i = {
show: !1,
position: new o.CallbackProperty(function (e) {
return t.getDrawPosition()
}, !1),
billboard: l.style2Entity(e.style),
attribute: e
};
return e.style && e.style.label && (i.label = (0, u.style2Entity)(e.style.label)), this.entity = this.dataSource.entities.add(i), this.updateAttrForDrawing(), this.entity
},
style2Entity: function (e, t) {
return this.updateImg(e, t), e && e.label && (0, u.style2Entity)(e.label, t.label), l.style2Entity(e, t.billboard)
},
updateAttrForDrawing: function () {
this.updateImg(this.entity.attribute.style, this.entity)
},
updateImg: function (e, t) {}
})
}, function (e, t, i) {
"use strict";
function r(e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.DrawLabel = void 0;
var n = i(0),
o = r(n),
a = i(27),
s = i(8),
l = r(s);
t.DrawLabel = a.DrawPoint.extend({
type: "label",
attrClass: l,
createFeature: function (e) {
this._positions_draw = null;
var t = this,
i = {
show: !1,
position: new o.CallbackProperty(function (e) {
return t.getDrawPosition()
}, !1),
label: l.style2Entity(e.style),
attribute: e
};
return this.entity = this.dataSource.entities.add(i), this.entity
},
style2Entity: function (e, t) {
return l.style2Entity(e, t.label)
}
})
}, function (e, t, i) {
"use strict";
function r(e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.DrawModel = void 0;
var n = i(0),
o = r(n),
a = i(27),
s = i(24),
l = r(s),
u = i(8);
t.DrawModel = a.DrawPoint.extend({
type: "model",
attrClass: l,
createFeature: function (e) {
this._positions_draw = null;
var t = this,
i = {
position: new o.CallbackProperty(function (e) {
return t.getDrawPosition()
}, !1),
model: l.style2Entity(e.style),
attribute: e
};
return e.style && e.style.label && (i.label = (0, u.style2Entity)(e.style.label)), this.entity = this.dataSource.entities.add(i), this.entity
},
style2Entity: function (e, t) {
return this.updateOrientation(e, t), e && e.label && (0, u.style2Entity)(e.label, t.label), l.style2Entity(e, t.model)
},
updateAttrForDrawing: function () {
this.updateOrientation(this.entity.attribute.style, this.entity)
},
updateOrientation: function (e, t) {
var i = t.position.getValue(this.viewer.clock.currentTime);
if (null != i) {
var r = o.Math.toRadians(Number(e.heading || 0)),
n = o.Math.toRadians(Number(e.pitch || 0)),
a = o.Math.toRadians(Number(e.roll || 0)),
s = new o.HeadingPitchRoll(r, n, a);
t.orientation = o.Transforms.headingPitchRollQuaternion(i, s)
}
}
})
}, function (e, t, i) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.DrawCurve = void 0;
var r = i(0),
n = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(r),
o = i(10),
a = i(17),
s = i(47);
t.DrawCurve = o.DrawPolyline.extend({
type: "curve",
editClass: s.EditCurve,
_positions_show: null,
getDrawPosition: function () {
return this._positions_show
},
updateAttrForDrawing: function () {
if (null == this._positions_draw || this._positions_draw.length < 3) return void(this._positions_show = this._positions_draw);
this._positions_show = (0, a.line2curve)(this._positions_draw, this.entity.attribute.style.closure)
},
finish: function () {
var e = this.entity;
e.editing = this.getEditClass(e), this.entity._positions_draw = this._positions_draw, this.entity._positions_show = this._positions_show, e.polyline.positions = new n.CallbackProperty(function (t) {
return e._positions_show
}, !1), this._positions_show = null
}
})
}, function (e, t, i) {
"use strict";
function r(e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.DrawPolylineVolume = void 0;
var n = i(0),
o = r(n),
a = i(10),
s = (i(1), i(38)),
l = r(s),
u = i(48),
c = i(3);
r(c), t.DrawPolylineVolume = a.DrawPolyline.extend({
type: "polylineVolume",
_minPointNum: 2,
_maxPointNum: 9999,
editClass: u.EditPolylineVolume,
attrClass: l,
createFeature: function (e) {
this._positions_draw = [], this._minPointNum_def || (this._minPointNum_def = this._minPointNum), this._maxPointNum_def || (this._maxPointNum_def = this._maxPointNum), e.config ? (this._minPointNum = e.config.minPointNum || this._minPointNum_def, this._maxPointNum = e.config.maxPointNum || this._maxPointNum_def) : (this._minPointNum = this._minPointNum_def, this._maxPointNum = this._maxPointNum_def);
var t = this,
i = {
polylineVolume: l.style2Entity(e.style),
attribute: e
};
return i.polylineVolume.positions = new o.CallbackProperty(function (e) {
return t.getDrawPosition()
}, !1), this.entity = this.dataSource.entities.add(i), this.entity._positions_draw = this._positions_draw, this.entity
},
style2Entity: function (e, t) {
return l.style2Entity(e, t.polylineVolume)
},
updateAttrForDrawing: function () {},
finish: function () {
var e = this.entity;
e.editing = this.getEditClass(e), e._positions_draw = this.getDrawPosition(), e.polylineVolume.positions = new o.CallbackProperty(function (t) {
return e._positions_draw
}, !1)
}
})
}, function (e, t, i) {
"use strict";
function r(e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.DrawCorridor = void 0;
var n = i(0),
o = r(n),
a = i(10),
s = i(1),
l = i(41),
u = r(l),
c = i(49),
h = i(3);
r(h), t.DrawCorridor = a.DrawPolyline.extend({
type: "corridor",
_minPointNum: 2,
_maxPointNum: 9999,
editClass: c.EditCorridor,
attrClass: u,
createFeature: function (e) {
this._positions_draw = [], this._minPointNum_def || (this._minPointNum_def = this._minPointNum), this._maxPointNum_def || (this._maxPointNum_def = this._maxPointNum), e.config ? (this._minPointNum = e.config.minPointNum || this._minPointNum_def, this._maxPointNum = e.config.maxPointNum || this._maxPointNum_def) : (this._minPointNum = this._minPointNum_def, this._maxPointNum = this._maxPointNum_def);
var t = this,
i = {
corridor: u.style2Entity(e.style),
attribute: e
};
return i.corridor.positions = new o.CallbackProperty(function (e) {
return t.getDrawPosition()
}, !1), this.entity = this.dataSource.entities.add(i), this.entity._positions_draw = this._positions_draw, this.entity
},
style2Entity: function (e, t) {
return u.style2Entity(e, t.corridor)
},
updateAttrForDrawing: function () {
var e = this.entity.attribute.style;
if (!e.clampToGround) {
var t = (0, s.getMaxHeight)(this.getDrawPosition());
0 != t && (this.entity.corridor.height = t, e.height = t, e.extrudedHeight && (this.entity.corridor.extrudedHeight = t + Number(e.extrudedHeight)))
}
},
finish: function () {
var e = this.entity;
e.editing = this.getEditClass(e), e._positions_draw = this.getDrawPosition(), e.corridor.positions = new o.CallbackProperty(function (t) {
return e._positions_draw
}, !1)
}
})
}, function (e, t, i) {
"use strict";
function r(e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.DrawRectangle = void 0;
var n = i(0),
o = r(n),
a = i(10),
s = i(1),
l = i(43),
u = r(l),
c = i(51),
h = i(3);
r(h), t.DrawRectangle = a.DrawPolyline.extend({
type: "rectangle",
_minPointNum: 2,
_maxPointNum: 2,
editClass: c.EditRectangle,
attrClass: u,
getRectangle: function () {
var e = this.getDrawPosition();
return e.length < 2 ? null : o.Rectangle.fromCartesianArray(e)
},
createFeature: function (e) {
this._positions_draw = [];
var t = this,
i = {
rectangle: u.style2Entity(e.style),
attribute: e
};
return i.rectangle.coordinates = new o.CallbackProperty(function (e) {
return t.getRectangle()
}, !1), i.polyline = {
clampToGround: e.style.clampToGround,
arcType: o.ArcType.RHUMB,
show: !1
}, this.entity = this.dataSource.entities.add(i), this.entity._draw_positions = this._positions_draw, this.bindOutline(this.entity), this.entity
},
style2Entity: function (e, t) {
return u.style2Entity(e, t.rectangle)
},
bindOutline: function (e) {
e.polyline.show = new o.CallbackProperty(function (t) {
return e.rectangle.outline && e.rectangle.outline.getValue(t) && e.rectangle.outlineWidth && e.rectangle.outlineWidth.getValue(t) > 1
}, !1), e.polyline.positions = new o.CallbackProperty(function (t) {
return e.polyline.show.getValue(t) && e._draw_positions ? u.getOutlinePositions(e) : null
}, !1), e.polyline.width = new o.CallbackProperty(function (t) {
return e.rectangle.outlineWidth
}, !1), e.polyline.material = new o.ColorMaterialProperty(new o.CallbackProperty(function (t) {
return e.rectangle.outlineColor.getValue(t)
}, !1))
},
updateAttrForDrawing: function () {
var e = this.entity.attribute.style;
if (!e.clampToGround) {
var t = (0, s.getMaxHeight)(this.getDrawPosition());
0 != t && (this.entity.rectangle.height = t, e.height = t, e.extrudedHeight && (this.entity.rectangle.extrudedHeight = t + Number(e.extrudedHeight)))
}
},
finish: function () {
var e = this.entity;
e.editing = this.getEditClass(e), e._positions_draw = this._positions_draw, e.rectangle.coordinates = new o.CallbackProperty(function (t) {
return e._positions_draw.length < 2 ? null : o.Rectangle.fromCartesianArray(e._positions_draw)
}, !1)
}
})
}, function (e, t, i) {
"use strict";
function r(e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.DrawCircle = void 0;
var n = i(0),
o = r(n),
a = i(10),
s = (i(1), i(7)),
l = (r(s), i(4), i(31)),
u = r(l),
c = i(52);
t.DrawCircle = a.DrawPolyline.extend({
type: "ellipse",
_minPointNum: 2,
_maxPointNum: 2,
editClass: c.EditCircle,
attrClass: u,
getShowPosition: function (e) {
return this._positions_draw && this._positions_draw.length > 1 ? this._positions_draw[0] : null
},
createFeature: function (e) {
this._positions_draw = [], "ellipse" == e.type ? this._maxPointNum = 3 : this._maxPointNum = 2;
var t = this,
i = {
position: new o.CallbackProperty(function (e) {
return t.getShowPosition(e)
}, !1),
ellipse: u.style2Entity(e.style),
attribute: e
};
return this.entity = this.dataSource.entities.add(i), this.entity
},
style2Entity: function (e, t) {
return u.style2Entity(e, t.ellipse)
},
updateAttrForDrawing: function (e) {
if (this._positions_draw) {
if (e) return void this.addPositionsForRadius(this._positions_draw);
if (!(this._positions_draw.length < 2)) {
var t = this.entity.attribute.style;
if (!t.clampToGround) {
var i = this.formatNum(o.Cartographic.fromCartesian(this._positions_draw[0]).height, 2);
if (this.entity.ellipse.height = i, t.height = i, t.extrudedHeight) {
var r = i + Number(t.extrudedHeight);
this.entity.ellipse.extrudedHeight = r
}
}
var n = this.formatNum(o.Cartesian3.distance(this._positions_draw[0], this._positions_draw[1]), 2);
if (this.entity.ellipse.semiMinorAxis = n, 3 == this._maxPointNum) {
var a;
a = 3 == this._positions_draw.length ? this.formatNum(o.Cartesian3.distance(this._positions_draw[0], this._positions_draw[2]), 2) : n, this.entity.ellipse.semiMajorAxis = a, t.semiMinorAxis = n, t.semiMajorAxis = a
} else this.entity.ellipse.semiMajorAxis = n, t.radius = n
}
}
},
addPositionsForRadius: function (e) {
this._positions_draw = [e];
var t = this.entity.attribute.style,
i = o.EllipseGeometryLibrary.computeEllipsePositions({
center: e,
semiMajorAxis: this.entity.ellipse.semiMajorAxis.getValue(this.viewer.clock.currentTime),
semiMinorAxis: this.entity.ellipse.semiMinorAxis.getValue(this.viewer.clock.currentTime),
rotation: o.Math.toRadians(Number(t.rotation || 0)),
granularity: 2
}, !0, !1),
r = new o.Cartesian3(i.positions[0], i.positions[1], i.positions[2]);
if (this._positions_draw.push(r), 3 == this._maxPointNum) {
var n = new o.Cartesian3(i.positions[3], i.positions[4], i.positions[5]);
this._positions_draw.push(n)
}
},
finish: function () {
var e = this.entity;
e.editing = this.getEditClass(e), e._positions_draw = this._positions_draw, e.position = new o.CallbackProperty(function (t) {
return e._positions_draw && e._positions_draw.length > 0 ? e._positions_draw[0] : null
}, !1)
}
})
}, function (e, t, i) {
"use strict";
function r(e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.DrawCylinder = void 0;
var n = i(0),
o = r(n),
a = i(10),
s = i(1),
l = i(7),
u = (r(l), i(4), i(42)),
c = r(u),
h = i(93);
t.DrawCylinder = a.DrawPolyline.extend({
type: "cylinder",
_minPointNum: 2,
_maxPointNum: 2,
editClass: h.EditCylinder,
attrClass: c,
getShowPosition: function (e) {
return this._positions_draw && this._positions_draw.length > 1 ? (0, s.addPositionsHeight)(this._positions_draw[0], this.entity.cylinder.length.getValue(e) / 2) : null
},
createFeature: function (e) {
this._positions_draw = [];
var t = this,
i = {
position: new o.CallbackProperty(function (e) {
return t.getShowPosition(e)
}, !1),
cylinder: c.style2Entity(e.style),
attribute: e
};
return this.entity = this.dataSource.entities.add(i), this.entity
},
style2Entity: function (e, t) {
return c.style2Entity(e, t.cylinder)
},
updateAttrForDrawing: function (e) {
if (this._positions_draw) {
if (e) return void this.addPositionsForRadius(this._positions_draw);
if (!(this._positions_draw.length < 2)) {
var t = (this.entity.attribute.style, this.formatNum(o.Cartesian3.distance(this._positions_draw[0], this._positions_draw[1]), 2));
this.entity.cylinder.bottomRadius = t
}
}
},
addPositionsForRadius: function (e) {
this._positions_draw = [e];
var t = this.entity.cylinder.bottomRadius.getValue(this.viewer.clock.currentTime),
i = o.EllipseGeometryLibrary.computeEllipsePositions({
center: e,
semiMajorAxis: t,
semiMinorAxis: t,
rotation: 0,
granularity: 2
}, !0, !1),
r = new o.Cartesian3(i.positions[0], i.positions[1], i.positions[2]);
this._positions_draw.push(r)
},
finish: function () {
var e = this.entity;
e.editing = this.getEditClass(e), e._positions_draw = this._positions_draw, e.position = new o.CallbackProperty(function (t) {
return e._positions_draw && e._positions_draw.length > 0 ? (0, s.addPositionsHeight)(e._positions_draw[0], e.cylinder.length.getValue(t) / 2) : null
}, !1)
}
})
}, function (e, t, i) {
"use strict";
function r(e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.EditCylinder = void 0;
var n = i(0),
o = r(n),
a = i(6),
s = r(a),
l = i(4),
u = i(19),
c = i(1);
t.EditCylinder = u.EditPolygon.extend({
getGraphic: function () {
return this.entity.cylinder
},
changePositionsToCallback: function () {
this._positions_draw = this.entity._positions_draw;
var e = this.viewer.clock.currentTime,
t = this;
this.attr_bottomRadius = this.getGraphic().bottomRadius.getValue(e), this.getGraphic().bottomRadius = new o.CallbackProperty(function (e) {
return t.attr_bottomRadius
}, !1), this.attr_length = this.getGraphic().length.getValue(e), this.getGraphic().length = new o.CallbackProperty(function (e) {
return t.attr_length
}, !1)
},
finish: function () {
this.entity._positions_draw = this._positions_draw, this.getGraphic().bottomRadius = this.attr_bottomRadius, this.getGraphic().length = this.attr_length
},
bindDraggers: function () {
var e = this,
t = this.getPosition(),
i = new o.Cartesian3,
r = (new o.Cartesian3, this.entity.attribute.style),
n = t[0],
a = s.createDragger(this.dataSource, {
position: n,
onDrag: function (r, n) {
o.Cartesian3.subtract(n, t[r.index], i), t[r.index] = n, e.updateDraggers()
}
});
a.index = 0, this.draggers.push(a);
var u = (this.viewer.clock.currentTime, o.EllipseGeometryLibrary.computeEllipsePositions({
center: n,
semiMajorAxis: this.attr_bottomRadius,
semiMinorAxis: this.attr_bottomRadius,
rotation: o.Math.toRadians(Number(r.rotation || 0)),
granularity: 2
}, !0, !1)),
h = new o.Cartesian3(u.positions[0], u.positions[1], u.positions[2]);
t[1] = h;
var d = s.createDragger(this.dataSource, {
position: h,
type: s.PointType.EditAttr,
tooltip: l.message.dragger.editRadius,
onDrag: function (i, n) {
t[i.index] = n;
var a = e.formatNum(o.Cartesian3.distance(t[0], n), 2);
e.attr_bottomRadius = a, r.bottomRadius = a, e.updateDraggers()
}
});
this.draggers.push(d);
var n = (0, c.addPositionsHeight)(t[0], this.attr_length),
f = s.createDragger(this.dataSource, {
position: n,
type: s.PointType.MoveHeight,
tooltip: l.message.dragger.moveHeight,
onDrag: function (i, n) {
var a = e.formatNum(o.Cartesian3.distance(t[0], n), 2);
e.attr_length = a, r.length = a, e.updateDraggers()
}
});
this.draggers.push(f)
}
})
}, function (e, t, i) {
"use strict";
function r(e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.DrawEllipsoid = void 0;
var n = i(0),
o = r(n),
a = i(10),
s = (i(1), i(7)),
l = (r(s), i(4), i(44)),
u = r(l),
c = i(53);
t.DrawEllipsoid = a.DrawPolyline.extend({
type: "ellipsoid",
_minPointNum: 2,
_maxPointNum: 3,
editClass: c.EditEllipsoid,
attrClass: u,
getShowPosition: function (e) {
return this._positions_draw && this._positions_draw.length > 0 ? this._positions_draw[0] : null
},
createFeature: function (e) {
this._positions_draw = [];
var t = this,
i = {
position: new o.CallbackProperty(function (e) {
return t.getShowPosition(e)
}, !1),
ellipsoid: u.style2Entity(e.style),
attribute: e
};
return this.entity = this.dataSource.entities.add(i), this.entity
},
style2Entity: function (e, t) {
return u.style2Entity(e, t.ellipsoid)
},
updateAttrForDrawing: function (e) {
if (this._positions_draw) {
if (e) return void this.addPositionsForRadius(this._positions_draw);
if (!(this._positions_draw.length < 2)) {
var t = this.entity.attribute.style,
i = this.formatNum(o.Cartesian3.distance(this._positions_draw[0], this._positions_draw[1]), 2);
t.extentRadii = i, t.heightRadii = i;
var r;
r = 3 == this._positions_draw.length ? this.formatNum(o.Cartesian3.distance(this._positions_draw[0], this._positions_draw[2]), 2) : i, t.widthRadii = r, this.updateRadii(t)
}
}
},
updateRadii: function (e) {
this.entity.ellipsoid.radii.setValue(new o.Cartesian3(e.extentRadii, e.widthRadii, e.heightRadii))
},
addPositionsForRadius: function (e) {
this._positions_draw = [e];
var t = this.entity.attribute.style,
i = o.EllipseGeometryLibrary.computeEllipsePositions({
center: e,
semiMajorAxis: Number(t.extentRadii),
semiMinorAxis: Number(t.widthRadii),
rotation: o.Math.toRadians(Number(t.rotation || 0)),
granularity: 2
}, !0, !1),
r = new o.Cartesian3(i.positions[0], i.positions[1], i.positions[2]);
this._positions_draw.push(r);
var n = new o.Cartesian3(i.positions[3], i.positions[4], i.positions[5]);
this._positions_draw.push(n)
},
finish: function () {
this.entity.editing = this.getEditClass(this.entity), this.entity._positions_draw = this._positions_draw, this.entity.position = this.getShowPosition()
}
})
}, function (e, t, i) {
"use strict";
function r(e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.DrawWall = void 0;
var n = i(0),
o = r(n),
a = i(10),
s = (i(1), i(39)),
l = r(s),
u = i(54),
c = i(3);
r(c), t.DrawWall = a.DrawPolyline.extend({
type: "wall",
_minPointNum: 2,
_maxPointNum: 9999,
editClass: u.EditWall,
attrClass: l,
createFeature: function (e) {
this._positions_draw = [], this._minPointNum_def || (this._minPointNum_def = this._minPointNum), this._maxPointNum_def || (this._maxPointNum_def = this._maxPointNum), e.config ? (this._minPointNum = e.config.minPointNum || this._minPointNum_def, this._maxPointNum = e.config.maxPointNum || this._maxPointNum_def) : (this._minPointNum = this._minPointNum_def, this._maxPointNum = this._maxPointNum_def), this.maximumHeights = [], this.minimumHeights = [];
var t = this,
i = {
wall: l.style2Entity(e.style),
attribute: e
};
return i.wall.positions = new o.CallbackProperty(function (e) {
return t.getDrawPosition()
}, !1), i.wall.minimumHeights = new o.CallbackProperty(function (e) {
return t.getMinimumHeights()
}, !1), i.wall.maximumHeights = new o.CallbackProperty(function (e) {
return t.getMaximumHeights()
}, !1), this.entity = this.dataSource.entities.add(i), this.entity
},
style2Entity: function (e, t) {
return l.style2Entity(e, t.wall)
},
maximumHeights: null,
getMaximumHeights: function (e) {
return this.maximumHeights
},
minimumHeights: null,
getMinimumHeights: function (e) {
return this.minimumHeights
},
updateAttrForDrawing: function () {
var e = this.entity.attribute.style,
t = this.getDrawPosition(),
i = t.length;
this.maximumHeights = new Array(i), this.minimumHeights = new Array(i);
for (var r = 0; r < i; r++) {
var n = o.Cartographic.fromCartesian(t[r]).height;
this.minimumHeights[r] = n, this.maximumHeights[r] = n + Number(e.extrudedHeight)
}
},
finish: function () {
var e = this.entity;
e.editing = this.getEditClass(e), e._positions_draw = this.getDrawPosition(), e.wall.positions = new o.CallbackProperty(function (t) {
return e._positions_draw
}, !1), e._minimumHeights = this.getMinimumHeights(), e.wall.minimumHeights = new o.CallbackProperty(function (t) {
return e._minimumHeights
}, !1), e._maximumHeights = this.getMaximumHeights(), e.wall.maximumHeights = new o.CallbackProperty(function (t) {
return e._maximumHeights
}, !1)
}
})
}, function (e, t, i) {
"use strict";
function r(e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.DrawPModel = void 0;
var n = i(0),
o = r(n),
a = i(23),
s = i(1),
l = i(24),
u = r(l),
c = i(4),
h = i(55);
t.DrawPModel = a.DrawBase.extend({
type: "point",
editClass: h.EditPModel,
attrClass: u,
createFeature: function (e) {
var t = this;
this._positions_draw = o.Cartesian3.ZERO;
var i = e.style,
r = this.primitives.add(o.Model.fromGltf({
url: i.modelUrl,
modelMatrix: this.getModelMatrix(i),
minimumPixelSize: o.defaultValue(i.minimumPixelSize, 0),
scale: o.defaultValue(i.scale, 1)
}));
return r.readyPromise.then(function (e) {
t.style2Entity(i, t.entity)
}), r.attribute = e, this.entity = r, this.entity
},
getModelMatrix: function (e, t) {
var i = new o.HeadingPitchRoll(o.Math.toRadians(e.heading || 0), o.Math.toRadians(e.pitch || 0), o.Math.toRadians(e.roll || 0)),
r = o.Transforms.eastNorthUpToFixedFrame;
return o.Transforms.headingPitchRollToFixedFrame(t || this._positions_draw, i, this.viewer.scene.globe.ellipsoid, r)
},
style2Entity: function (e, t) {
return t.modelMatrix = this.getModelMatrix(e, t.position), u.style2Entity(e, t)
},
bindEvent: function () {
var e = this;
this.getHandler().setInputAction(function (t) {
var i = (0, s.getCurrentMousePosition)(e.viewer.scene, t.endPosition, e.entity);
i && (e._positions_draw = i, e.entity.modelMatrix = e.getModelMatrix(e.entity.attribute.style)), e.tooltip.showAt(t.endPosition, c.message.draw.point.start)
}, o.ScreenSpaceEventType.MOUSE_MOVE), this.getHandler().setInputAction(function (t) {
var i = (0, s.getCurrentMousePosition)(e.viewer.scene, t.position, e.entity);
i && (e._positions_draw = i, e.disable())
}, o.ScreenSpaceEventType.LEFT_CLICK)
},
finish: function () {
this.entity.modelMatrix = this.getModelMatrix(this.entity.attribute.style), this.entity.editing = this.getEditClass(this.entity), this.entity.position = this.getDrawPosition()
}
})
}, function (e, t, i) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.DrawPolygonEx = void 0;
var r = i(0),
n = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(r),
o = i(50);
t.DrawPolygonEx = o.DrawPolygon.extend({
_positions_show: null,
getDrawPosition: function () {
return this._positions_show
},
updateAttrForDrawing: function () {
if (null == this._positions_draw || this._positions_draw.length < this._minPointNum) return void(this._positions_show = this._positions_draw);
this._positions_show = this.getShowPositions(this._positions_draw, this.entity.attribute)
},
getShowPositions: function (e, t) {
return e
},
finish: function () {
var e = this.entity;
e.editing = this.getEditClass(e), this._positions_draw.length > this._maxPointNum && this._positions_draw.splice(this._maxPointNum, this._positions_draw.length - this._maxPointNum), this.entity._positions_draw = this._positions_draw, this.entity._positions_show = this._positions_show, e.polygon.hierarchy = new n.CallbackProperty(function (t) {
var i = e._positions_show;
return new n.PolygonHierarchy(i)
}, !1), this._positions_draw = null, this._positions_show = null
},
toGeoJSON: function (e) {
return this.attrClass.toGeoJSON(e, !0)
}
})
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.KeyboardRoam = t.KeyboardType = t.maxPitch = t.minPitch = t.rotateStep = t.dirStep = t.speedRatio = void 0;
var n = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o),
s = i(1),
l = t.speedRatio = 150,
u = t.dirStep = 25,
c = t.rotateStep = 1,
h = t.minPitch = .1,
d = t.maxPitch = .95,
f = t.KeyboardType = {
ENLARGE: 0,
NARROW: 1,
LEFT_ROTATE: 2,
RIGHT_ROTATE: 3,
TOP_ROTATE: 4,
BOTTOM_ROTATE: 5
};
t.KeyboardRoam = function () {
function e(i, n) {
r(this, e), this.viewer = i, this.flags = {
moveForward: !1,
moveBackward: !1,
moveUp: !1,
moveDown: !1,
moveLeft: !1,
moveRight: !1
};
var o = i.scene.canvas;
o.setAttribute("tabindex", "0"), o.onclick = function () {
o.focus()
};
var s = this;
document.addEventListener("keydown", function (e) {
if (s._enable) {
var t = s.getFlagForKeyCode(e.keyCode);
void 0 !== t && (s.flags[t] = !0)
}
}, !1), document.addEventListener("keyup", function (e) {
if (s._enable) {
var t = s.getFlagForKeyCode(e.keyCode);
void 0 !== t && (s.flags[t] = !1)
}
}, !1), this.handler = new a.ScreenSpaceEventHandler(i.scene.canvas), this.handler.setInputAction(function (e) {
s._enable && (e > 0 ? (t.speedRatio = l *= .9, t.rotateStep = c *= 1.1, t.dirStep = u *= .9) : (t.speedRatio = l *= 1.1, t.rotateStep = c *= .9, t.dirStep = u *= 1.1))
}, a.ScreenSpaceEventType.WHEEL), this._enable = !1
}
return n(e, [{
key: "bind",
value: function (e) {
this._enable || (this._enable = !0, a.defined(e) && (t.speedRatio = l = e.speedRatio || l, t.dirStep = u = e.dirStep || u, t.rotateStep = c = e.rotateStep || c, t.minPitch = h = e.minPitch || h, t.maxPitch = d = e.maxPitch || d), this.viewer.clock.onTick.addEventListener(this.cameraFunc, this))
}
}, {
key: "unbind",
value: function () {
this._enable && (this._enable = !1, this.viewer.clock.onTick.removeEventListener(this.cameraFunc, this))
}
}, {
key: "destroy",
value: function () {
this.unbind(), this.handler.destroy()
}
}, {
key: "getFlagForKeyCode",
value: function (e) {
switch (e) {
case "W".charCodeAt(0):
return "moveForward";
case "S".charCodeAt(0):
return "moveBackward";
case "D".charCodeAt(0):
return "moveRight";
case "A".charCodeAt(0):
return "moveLeft";
case "Q".charCodeAt(0):
return "moveUp";
case "E".charCodeAt(0):
return "moveDown";
case 38:
this.rotateCamera(f.TOP_ROTATE);
break;
case 37:
this.rotateCamera(f.LEFT_ROTATE);
break;
case 39:
this.rotateCamera(f.RIGHT_ROTATE);
break;
case 40:
this.rotateCamera(f.BOTTOM_ROTATE);
break;
case "I".charCodeAt(0):
case 104:
this.moveCamera(f.ENLARGE);
break;
case "K".charCodeAt(0):
case 101:
this.moveCamera(f.NARROW);
break;
case "J".charCodeAt(0):
case 100:
this.moveCamera(f.LEFT_ROTATE);
break;
case "L".charCodeAt(0):
case 102:
this.moveCamera(f.RIGHT_ROTATE);
break;
case "U".charCodeAt(0):
case 103:
this.moveCamera(f.TOP_ROTATE);
break;
case "O".charCodeAt(0):
case 105:
this.moveCamera(f.BOTTOM_ROTATE)
}
}
}, {
key: "startMoveForward",
value: function () {
this.flags.moveForward = !0
}
}, {
key: "stopMoveForward",
value: function () {
this.flags.moveForward = !1
}
}, {
key: "startMoveBackward",
value: function () {
this.flags.moveBackward = !0
}
}, {
key: "stopMoveBackward",
value: function () {
this.flags.moveBackward = !1
}
}, {
key: "startMoveRight",
value: function () {
this.flags.moveRight = !0
}
}, {
key: "stopMoveRight",
value: function () {
this.flags.moveRight = !1
}
}, {
key: "startMoveLeft",
value: function () {
this.flags.moveLeft = !0
}
}, {
key: "stopMoveLeft",
value: function () {
this.flags.moveLeft = !1
}
}, {
key: "moveForward",
value: function (e) {
var t = this.viewer.camera,
i = t.direction,
r = a.Cartesian3.normalize(t.position, new a.Cartesian3),
n = a.Cartesian3.cross(i, r, new a.Cartesian3);
i = a.Cartesian3.cross(r, n, new a.Cartesian3), i = a.Cartesian3.normalize(i, i), i = a.Cartesian3.multiplyByScalar(i, e, i), t.position = a.Cartesian3.add(t.position, i, t.position)
}
}, {
key: "cameraFunc",
value: function (e) {
var t = this.viewer.camera,
i = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(t.position).height,
r = i / l;
this.flags.moveForward && this.moveForward(r), this.flags.moveBackward && this.moveForward(-r), this.flags.moveUp && t.moveUp(r), this.flags.moveDown && t.moveDown(r), this.flags.moveLeft && t.moveLeft(r), this.flags.moveRight && t.moveRight(r)
}
}, {
key: "resetCameraPos",
value: function (e) {
e && (this.viewer.scene.camera.position = e.position, this.viewer.scene.camera.direction = e.direction, this.viewer.scene.camera.right = e.right, this.viewer.scene.camera.up = e.up)
}
}, {
key: "limitAngle",
value: function (e, t, i) {
var r = a.Cartesian3.dot(e, a.Cartesian3.normalize(t, new a.Cartesian3));
return !("up" == i && r < h) && !("down" == i && r > d)
}
}, {
key: "computedNewPos",
value: function (e, t, i) {
var r = e.position,
n = (0, s.getCenter)(this.viewer);
if (n) {
var o = a.Cartesian3.fromDegrees(n.x, n.y, n.z);
if (o) {
var l = a.Cartesian3.distance(o, r),
u = l / 100;
u = i ? u * c : u;
var h = {},
d = new a.Ray(r, t);
if (h.position = a.Ray.getPoint(d, u), h.direction = e.direction, h.right = e.right, h.up = e.up, i) {
var f = a.Cartesian3.normalize(a.Cartesian3.subtract(h.position, o, new a.Cartesian3), new a.Cartesian3);
d = new a.Ray(o, f), h.position = a.Ray.getPoint(d, l), h.direction = a.Cartesian3.negate(f, new a.Cartesian3), h.up = a.Cartesian3.normalize(h.position, new a.Cartesian3), h.right = a.Cartesian3.cross(h.direction, h.up, new a.Cartesian3)
}
return h
}
}
}
}, {
key: "moveCamera",
value: function (e) {
var t, i = this.viewer.scene.camera;
switch (e) {
case f.ENLARGE:
t = this.computedNewPos(i, i.direction);
break;
case f.NARROW:
t = this.computedNewPos(i, a.Cartesian3.negate(i.direction, new a.Cartesian3));
break;
case f.LEFT_ROTATE:
t = this.computedNewPos(i, a.Cartesian3.negate(i.right, new a.Cartesian3), !0);
break;
case f.RIGHT_ROTATE:
t = this.computedNewPos(i, i.right, !0);
break;
case f.TOP_ROTATE:
var r = this.limitAngle(a.clone(i.up), a.clone(i.position), "up");
if (!r) return;
t = this.computedNewPos(i, a.clone(i.up), !0);
break;
case f.BOTTOM_ROTATE:
var r = this.limitAngle(a.clone(i.up), a.clone(i.position), "down");
if (!r) return;
t = this.computedNewPos(i, a.Cartesian3.negate(i.up, new a.Cartesian3), !0)
}
t && this.resetCameraPos(t)
}
}, {
key: "rotateCamera",
value: function (e) {
var t = [0, 0],
i = this.viewer.scene.canvas.clientWidth,
r = this.viewer.scene.canvas.clientHeight,
n = (i + r) / u;
switch (e) {
case f.LEFT_ROTATE:
t = [-n * i / r, 0];
break;
case f.RIGHT_ROTATE:
t = [n * i / r, 0];
break;
case f.TOP_ROTATE:
t = [0, n];
break;
case f.BOTTOM_ROTATE:
t = [0, -n];
break;
default:
return
}
var o = t[0] / i,
s = t[1] / r,
l = this.viewer.camera;
l.lookRight(.05 * o), l.lookUp(.05 * s);
var c = l.direction,
h = a.Cartesian3.normalize(l.position, new a.Cartesian3),
d = a.Cartesian3.cross(c, h, new a.Cartesian3);
h = a.Cartesian3.cross(d, c, new a.Cartesian3), l.up = h, l.right = d
}
}, {
key: "enable",
get: function () {
return this._enable
},
set: function (e) {
e ? this.bind() : this.unbind()
}
}]), e
}()
}, function (e, t, i) {
"use strict";
function r(e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}
function n(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.Popup = void 0;
var o = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) {
return typeof e
} : function (e) {
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
},
a = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
s = i(0),
l = r(s),
u = i(5),
c = function (e) {
return e && e.__esModule ? e : {
default: e
}
}(u),
h = i(1),
d = i(2),
f = i(20),
p = r(f);
t.Popup = function () {
function e(t, i) {
var r = this;
n(this, e), this.viewer = t, this.options = i || {}, this._isOnly = !0, this._enable = !0, this._depthTest = !0, this.viewerid = t._container.id, this.objPopup = {}, this.highlighted = {
feature: void 0,
originalColor: new l.Color
}, this.defaultHighlightedClr = new l.Color.fromCssColorString("#95e40c"), this.getPopupForConfig = d.getPopupForConfig, this.getPopup = d.getPopup;
var o = '
';
(0, c.default)("#" + this.viewerid).append(o), this.handler = new l.ScreenSpaceEventHandler(this.viewer.scene.canvas), this.handler.setInputAction(function (e) {
r.options.onLeftClick && r.options.onLeftClick(e), r.mousePickingClick(e)
}, l.defaultValue(this.options.popupEventType, l.ScreenSpaceEventType.LEFT_CLICK)), this.viewer.scene.postRender.addEventListener(this.bind2scene, this)
}
return a(e, [{
key: "mousePickingClick",
value: function (e) {
if (this.removeFeatureForImageryLayer(), this.removeFeatureFor3dtiles(), this._isOnly && this.close(), this._enable) {
var t, i = e.position;
try {
t = this.viewer.scene.pick(i)
} catch (e) {}
var r = !1;
if (l.defined(t) && l.defined(t.id) && t.id instanceof l.Entity) {
var n = t.id;
if (l.defined(n.popup)) {
var o;
o = n.billboard || n.label || n.point || n.model ? n.position : (0, h.getCurrentMousePosition)(this.viewer.scene, i), this.show(n, o, i), r = !0
}
n.click && "function" == typeof n.click && n.click(n, i)
} else if (l.defined(t) && l.defined(t.tileset) && l.defined(t.getProperty)) {
for (var a = {}, s = t.getPropertyNames(), u = 0; u < s.length; u++) {
var c = s[u];
if (t.hasProperty(c)) {
var f = t.getProperty(c);
null != f && (a[c] = f)
}
}
var p = t.tileset._config;
if (p) {
if (l.defined(p.popup)) {
var o = (0, h.getCurrentMousePosition)(this.viewer.scene, i),
m = {
id: t._batchId,
popup: {
html: (0, d.getPopupForConfig)(p, a),
anchor: p.popupAnchor || [0, -15]
}
};
this.show(m, o, i), r = !0
}
p.showClickFeature && this.showFeatureFor3dtiles(t, p.clickFeatureColor), p.click && "function" == typeof p.click && p.click({
attr: a,
feature: t
}, i)
}
} else if (t && l.defined(t.primitive)) {
var g = t.primitive;
if (l.defined(g.popup)) {
var o = (0, h.getCurrentMousePosition)(this.viewer.scene, i);
this.show(g, o, i), r = !0
}
g.click && "function" == typeof g.click && g.click(g, i)
}
r || this.pickImageryLayerFeatures(i)
}
}
}, {
key: "pickImageryLayerFeatures",
value: function (e) {
var t = this.viewer.scene,
i = t.camera.getPickRay(e),
r = t.imageryLayers.pickImageryLayerFeatures(i, t);
if (l.defined(r)) {
var n = this;
l.when(r, function (i) {
if (l.defined(i) && 0 !== i.length) {
var r = i[0];
if (null != r.imageryLayer && null != r.imageryLayer.config) {
var o = r.imageryLayer.config;
o.showClickFeature && r.data && n.showFeatureForImageryLayer(r.data, o.pickFeatureStyle);
var a = (0, d.getPopupForConfig)(r.imageryLayer.config, r.properties);
if (a) {
var s = (0, h.getCurrentMousePosition)(t, e);
n.show({
id: "imageryLayerFeaturePromise",
popup: {
html: a,
anchor: r.imageryLayer.config.popupAnchor || [0, -12]
}
}, s, e)
}
o.click && "function" == typeof o.click && o.click(r.properties, e)
}
}
}, function () {})
}
}
}, {
key: "show",
value: function (e, t, i) {
if (null != e && null != e.popup) {
t || (t = p.getCenterPosition(e));
var r = e.billboard || e.label || e.point || e.model;
r && r.heightReference && (t = this.getPositionValue(t), r.heightReference._value == l.HeightReference.CLAMP_TO_GROUND ? t = (0, h.updateHeightForClampToGround)(this.viewer, t) : r.heightReference._value == l.HeightReference.RELATIVE_TO_GROUND && (t = (0, h.updateHeightForClampToGround)(this.viewer, t, !0)));
var n = this.getPopupId(e);
this.close(n), this.objPopup[n] = {
id: e.id,
popup: e.popup,
entity: e,
cartesian: t,
viewPoint: i
};
var a;
if ("object" === o(e.popup) ? (a = e.popup.html, this.objPopup[n].onAdd = e.popup.onAdd, this.objPopup[n].onRemove = e.popup.onRemove) : a = e.popup, a) {
var s = this;
"function" == typeof a && (a = a(e, t, function (r) {
s._showHtml(r, n, e, t, i)
})), a && this._showHtml(a, n, e, t, i)
}
}
}
}, {
key: "getItem",
value: function (e) {
return this.objPopup[e]
}
}, {
key: "_showHtml",
value: function (e, t, i, r, n) {
(0, c.default)("#" + this.viewerid + "pupup-all-view").append('');
var o = this;
if ((0, c.default)("#" + t + "-popup-close").click(function () {
var e = (0, c.default)(this).attr("data-id");
o.close(e, !0)
}), !this.updateViewPoint(t, r, i.popup, n) && this._depthTest) return void this.close(t);
this.objPopup[t] && this.objPopup[t].onAdd && this.objPopup[t].onAdd(t)
}
}, {
key: "getPositionValue",
value: function (e) {
if (!e) return e;
var t;
return e instanceof l.Cartesian3 ? t = e : "function" == typeof e.getValue ? t = e.getValue(this.viewer.clock.currentTime) : e._value && e._value instanceof l.Cartesian3 && (t = e._value), t
}
}, {
key: "updateViewPoint",
value: function (e, t, i, r) {
var n = this.getPositionValue(t);
if (!l.defined(n)) return !1;
var a = l.SceneTransforms.wgs84ToWindowCoordinates(this.viewer.scene, n);
if (l.defined(a) && (r = a, this.objPopup[e] && (this.objPopup[e].viewPoint = a)), !l.defined(r)) return console.log("wgs84ToWindowCoordinates无法转换为屏幕坐标"), !1;
var s = this.viewer.scene;
if (this._depthTest && s.mode === l.SceneMode.SCENE3D) {
var u = s.camera.getPickRay(r),
h = s.globe.pick(u, s);
if (h) {
if (l.Cartesian3.distance(n, h) > 1e6) return !1
}
}
if ("object" === (void 0 === i ? "undefined" : o(i)) && i.timeRender && i.html && "function" == typeof i.html) {
var d = i.html(this.objPopup[e] && this.objPopup[e].entity, n);
(0, c.default)("#" + e + " .cesium-popup-content").html(d)
}
var f = (0, c.default)("#" + e),
p = r.x - f.width() / 2,
m = r.y - f.height();
return i && "object" === (void 0 === i ? "undefined" : o(i)) && i.anchor && (p += i.anchor[0], m += i.anchor[1]), f.css("transform", "translate3d(" + p + "px," + m + "px, 0)"), !0
}
}, {
key: "bind2scene",
value: function () {
for (var e in this.objPopup) {
var t = this.objPopup[e];
!this.updateViewPoint(e, t.cartesian, t.popup, t.viewPoint) && this._depthTest && this.close(e)
}
}
}, {
key: "getPopupId",
value: function (e) {
return this.viewerid + "popup_" + ((e.id || "") + "").replace(new RegExp("[^0-9a-zA-Z_]", "gm"), "_")
}
}, {
key: "close",
value: function (e, t) {
if (!this._isOnly && e) {
"object" === (void 0 === e ? "undefined" : o(e)) && (e = this.getPopupId(e));
for (var i in this.objPopup)
if (e == this.objPopup[i].id || e == i) {
this.objPopup[i] && this.objPopup[i].onRemove && this.objPopup[i].onRemove(i), (0, c.default)("#" + i).remove(), delete this.objPopup[i];
break
}
} else {
for (var i in this.objPopup) this.objPopup[i] && this.objPopup[i].onRemove && this.objPopup[i].onRemove(i);
(0, c.default)("#" + this.viewerid + "pupup-all-view").empty(), this.objPopup = {}
}
t && (this.removeFeatureForImageryLayer(), this.removeFeatureFor3dtiles())
}
}, {
key: "destroy",
value: function () {
this.close(), this.viewer.scene.postRender.removeEventListener(this.bind2scene, this), this.handler.destroy(), delete this.handler, (0, c.default)("#" + this.viewerid + "pupup-all-view").remove()
}
}, {
key: "removeFeatureForImageryLayer",
value: function () {
null != this.lastShowFeature && (this.viewer.dataSources.remove(this.lastShowFeature), this.lastShowFeature = null)
}
}, {
key: "showFeatureForImageryLayer",
value: function (e, t) {
var i = this;
this.removeFeatureForImageryLayer();
var r = e;
if (e.geometryType && -1 != e.geometryType.indexOf("esri")) {
if (JSON.stringify(e.geometry).length < 1e4) {
var n = window.wutu3d.L || window.L;
if (!n.esri) return void console.log("需要引入 wutu-esri 插件解析arcgis标准的json数据!");
r = n.esri.Util.arcgisToGeoJSON(e.geometry)
}
} else if (e.geometry && e.geometry.type) {
var n = window.wutu3d.L || window.L;
if (n) {
var o = n.geoJSON(e.geometry, {
coordsToLatLng: function (e) {
return e[0] > 180 || e[0] < -180 ? n.CRS.EPSG3857.unproject(n.point(e[0], e[1])) : new n.LatLng(e[1], e[0], e[2])
}
});
r = o.toGeoJSON()
}
}
if (null != r) {
t = t || {};
l.GeoJsonDataSource.load(r, {
clampToGround: !0,
stroke: new l.Color.fromCssColorString(t.stroke || "#ffff00"),
strokeWidth: t.strokeWidth || 3,
fill: new l.Color.fromCssColorString(t.fill || "#ffff00").withAlpha(t.fillAlpha || .7)
}).then(function (e) {
i.viewer.dataSources.add(e), i.lastShowFeature = e, l.defined(t.showTime) && setTimeout(function () {
i.removeFeatureForImageryLayer()
}, t.showTime)
}).otherwise(function (e) {
console.log(e)
})
}
}
}, {
key: "removeFeatureFor3dtiles",
value: function () {
if (l.defined(this.highlighted.feature)) {
try {
this.highlighted.feature.color = this.highlighted.originalColor
} catch (e) {}
this.highlighted.feature = void 0
}
}
}, {
key: "showFeatureFor3dtiles",
value: function (e, t) {
this.removeFeatureFor3dtiles(), this.highlighted.feature = e, l.Color.clone(e.color, this.highlighted.originalColor), t && "string" == typeof t && (t = new l.Color.fromCssColorString(t)), e.color = t || this.defaultHighlightedClr
}
}, {
key: "isOnly",
get: function () {
return this._isOnly
},
set: function (e) {
this._isOnly = e
}
}, {
key: "enable",
get: function () {
return this._enable
},
set: function (e) {
this._enable = e, e || this.close()
}
}, {
key: "depthTest",
get: function () {
return this._depthTest
},
set: function (e) {
this._depthTest = e
}
}]), e
}()
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.Tooltip = void 0;
var n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) {
return typeof e
} : function (e) {
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
},
o = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
a = i(0),
s = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(a),
l = i(5),
u = function (e) {
return e && e.__esModule ? e : {
default: e
}
}(l),
c = i(1),
h = i(2);
t.Tooltip = function () {
function e(t, i) {
var n = this;
r(this, e), this.viewer = t, this.options = i || {}, this._enable = !0, this.viewerid = t._container.id, this.tooltipcontentid = this.viewerid + "tooltip-content", this.highlighted = {
feature: void 0,
originalColor: new s.Color
}, this.defaultHighlightedClr = new s.Color.fromCssColorString("#95e40c"), this.getTooltipForConfig = h.getTooltipForConfig;
var o = ' ';
(0, u.default)("#" + this.viewerid).append(o), this._tooltipDOM = (0, u.default)("#" + this.viewerid + "tooltip-view"), this._tooltipContentDOM = (0, u.default)("#" + this.tooltipcontentid), this.handler = new s.ScreenSpaceEventHandler(t.scene.canvas), this.handler.setInputAction(function (e) {
n.options.onMouseMove && n.options.onMouseMove(e), n.mouseMovingPicking(e)
}, s.ScreenSpaceEventType.MOUSE_MOVE)
}
return o(e, [{
key: "mouseMovingPicking",
value: function (e) {
var t = this;
if (this._enable) {
if ((0, u.default)(".cesium-viewer").css("cursor", ""), !1 === this.viewer.scene.screenSpaceCameraController.enableRotate || !1 === this.viewer.scene.screenSpaceCameraController.enableTilt || !1 === this.viewer.scene.screenSpaceCameraController.enableTranslate) return void this.close();
var i, r, n = e.endPosition;
try {
r = this.viewer.scene.pick(n, 5, 5)
} catch (e) {}
if (s.defined(r) && s.defined(r.id) && r.id instanceof s.Entity) i = r.id;
else if (s.defined(r) && s.defined(r.tileset) && s.defined(r.getProperty)) {
var o = r.tileset._config;
if (o) {
for (var a = {}, l = r.getPropertyNames(), d = 0; d < l.length; d++) {
var f = l[d];
if (r.hasProperty(f)) {
var p = r.getProperty(f);
null != p && (a[f] = p)
}
}
i = {
id: r._batchId,
tooltip: {
html: (0, h.getTooltipForConfig)(o, a),
anchor: o.popupAnchor || [0, -15]
},
attr: a,
feature: r
}, o.noMouseMove || (o.mouseover && (i.mouseover = o.mouseover), o.mouseover && (i.mouseover = o.mouseover)), o.showMoveFeature && this.showFeatureFor3dtiles(r, o.moveFeatureColor)
}
} else r && s.defined(r.primitive) && (i = r.primitive);
if (i)
if ((i.popup || i.click || i.cursorCSS) && (0, u.default)(".cesium-viewer").css("cursor", i.cursorCSS || "pointer"), i.noMouseMove || (clearTimeout(this.lastTime), this.lastTime = setTimeout(function (e) {
t.activateMouseOver(i, n)
}, 20)), i.tooltip) {
var m = (0, c.getCurrentMousePosition)(this.viewer.scene, n);
this.show(i, m, n)
} else this.close();
else this.close(), clearTimeout(this.lastTime), this.lastTime = setTimeout(function (e) {
t.activateMouseOut()
}, 20)
}
}
}, {
key: "show",
value: function (e, t, i) {
if (null != e && null != e.tooltip) {
if (null == i && (i = s.SceneTransforms.wgs84ToWindowCoordinates(this.viewer.scene, t)), null == i) return void this.close();
if (this._lastTooltipEntity !== e) {
var r, o;
if ("object" === n(e.tooltip)) {
if (r = e.tooltip.html, o = e.tooltip.onAdd, this.onRemove = e.tooltip.onRemove, e.tooltip.check && !e.tooltip.check()) return void this.close()
} else r = e.tooltip;
if ("function" == typeof r && (r = r(e, t)), !r) return;
this._tooltipContentDOM.html(r), this._tooltipDOM.show(), o && o(this.tooltipcontentid)
}
this._lastTooltipEntity = e;
var a = i.x - this._tooltipDOM.width() / 2,
l = i.y - this._tooltipDOM.height(),
u = e.tooltip;
u && "object" === (void 0 === u ? "undefined" : n(u)) && u.anchor ? (a += u.anchor[0], l += u.anchor[1]) : l -= 15, this._tooltipDOM.css("transform", "translate3d(" + a + "px," + l + "px, 0)")
}
}
}, {
key: "close",
value: function () {
this.onRemove && (this.onRemove(this.tooltipcontentid), delete this.onRemove), this._tooltipContentDOM.empty(), this._tooltipDOM.hide(), this.removeFeatureFor3dtiles(), delete this._lastTooltipEntity
}
}, {
key: "activateMouseOver",
value: function (e, t) {
this._lastMouseEntity !== e && (this.activateMouseOut(), e.mouseover && "function" == typeof e.mouseover && e.mouseover(e, t), this._lastMouseEntity = e)
}
}, {
key: "activateMouseOut",
value: function () {
null != this._lastMouseEntity && (this._lastMouseEntity.mouseout && "function" == typeof this._lastMouseEntity.mouseout && this._lastMouseEntity.mouseout(this._lastMouseEntity), this._lastMouseEntity = null)
}
}, {
key: "destroy",
value: function () {
this.close(), this.handler.destroy(), delete this.handler, this._tooltipDOM.remove(), delete this._tooltipDOM, delete this._tooltipContentDOM, this._lastMouseEntity && (this._lastMouseEntity = null), this._lastTooltipEntity && (this._lastTooltipEntity = null)
}
}, {
key: "removeFeatureFor3dtiles",
value: function () {
if (s.defined(this.highlighted.feature)) {
try {
this.highlighted.feature.color = this.highlighted.originalColor
} catch (e) {}
this.highlighted.feature = void 0
}
}
}, {
key: "showFeatureFor3dtiles",
value: function (e, t) {
this.removeFeatureFor3dtiles(), this.highlighted.feature = e, s.Color.clone(e.color, this.highlighted.originalColor), t && "string" == typeof t && (t = new s.Color.fromCssColorString(t)), e.color = t || this.defaultHighlightedClr
}
}, {
key: "enable",
get: function () {
return this._enable
},
set: function (e) {
this._enable = e, e || this.close()
}
}]), e
}()
}, function (e, t, i) {
"use strict";
function r(e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}
function n(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
function o(e) {
return [{
text: "查看此处坐标",
iconCls: "fa fa-info-circle",
calback: function (e) {
var t = d.formatNum(e.position.x, 1),
i = d.formatNum(e.position.y, 1),
r = d.formatNum(e.position.z, 1),
n = d.formatPosition(e.position),
o = "经度:" + n.x + ", 纬度:" + n.y + ", 高程:" + n.z + "\n
笛卡尔(xyz):" + t + "," + i + "," + r + " ";
g.alert(o, "位置信息")
}
}, {
text: "查看当前视角",
iconCls: "fa fa-camera-retro",
calback: function (t) {
var i = d.getCameraView(e);
g.alert(JSON.stringify(i), "当前视角信息")
}
}, {
text: "视角切换",
iconCls: "fa fa-street-view",
children: [{
text: "绕此处环绕飞行",
iconCls: "fa fa-retweet",
visible: function (e) {
return !d.windingPoint.isStart
},
calback: function (t) {
d.windingPoint.start(e, t.position)
}
}, {
text: "关闭环绕飞行",
iconCls: "fa fa-remove",
visible: function (e) {
return d.windingPoint.isStart
},
calback: function (e) {
d.windingPoint.stop()
}
}, {
text: "移动到此处",
iconCls: "fa fa-send-o",
calback: function (t) {
var i = e.scene.camera.positionCartographic.height;
i > 5e3 && (i = 5e3), e.camera.lookAt(t.position, new l.HeadingPitchRange(e.camera.heading, e.camera.pitch, i)), e.camera.lookAtTransform(l.Matrix4.IDENTITY)
}
}, {
text: "第一视角站到此处",
iconCls: "fa fa-male",
calback: function (t) {
e.camera.flyTo({
destination: d.addPositionsHeight(t.position, 10),
orientation: {
heading: l.Math.toRadians(0),
pitch: l.Math.toRadians(10),
roll: l.Math.toRadians(0)
}
})
}
}, {
text: "开启键盘漫游",
iconCls: "fa fa-keyboard-o",
visible: function (t) {
return !e.wutu.keyboardRoam.enable
},
calback: function (t) {
e.wutu.keyboardRoam.enable = !0
}
}, {
text: "关闭键盘漫游",
iconCls: "fa fa-keyboard-o",
visible: function (t) {
return e.wutu.keyboardRoam.enable
},
calback: function (t) {
e.wutu.keyboardRoam.enable = !1
}
}]
}, {
text: "三维模型",
iconCls: "fa fa-building-o",
visible: function (t) {
var i = p.pick3DTileset(e, t.position);
return l.defined(i)
},
children: [{
text: "显示三角网",
iconCls: "fa fa-connectdevelop",
visible: function (t) {
return !p.pick3DTileset(e, t.position).debugWireframe
},
calback: function (t) {
p.pick3DTileset(e, t.position).debugWireframe = !0
}
}, {
text: "关闭三角网",
iconCls: "fa fa-connectdevelop",
visible: function (t) {
return p.pick3DTileset(e, t.position).debugWireframe
},
calback: function (t) {
p.pick3DTileset(e, t.position).debugWireframe = !1
}
}, {
text: "显示包围盒",
iconCls: "fa fa-codepen",
visible: function (t) {
return !p.pick3DTileset(e, t.position).debugShowBoundingVolume
},
calback: function (t) {
p.pick3DTileset(e, t.position).debugShowBoundingVolume = !0
}
}, {
text: "关闭包围盒",
iconCls: "fa fa-codepen",
visible: function (t) {
return p.pick3DTileset(e, t.position).debugShowBoundingVolume
},
calback: function (t) {
p.pick3DTileset(e, t.position).debugShowBoundingVolume = !1
}
}]
}, {
text: "地形服务",
iconCls: "fa fa-globe",
visible: function (e) {
return !l.defined(e.target)
},
children: [{
text: "开启地形",
iconCls: "fa fa-rss",
visible: function (t) {
return !e.wutu.hasTerrain()
},
calback: function (t) {
e.wutu.updateTerrainProvider(!0)
}
}, {
text: "关闭地形",
iconCls: "fa fa-rss",
visible: function (t) {
return e.wutu.hasTerrain()
},
calback: function (t) {
e.wutu.updateTerrainProvider(!1)
}
}, {
text: "显示三角网",
iconCls: "fa fa-connectdevelop",
visible: function (t) {
return !e.scene.globe._surface.tileProvider._debug.wireframe
},
calback: function (t) {
e.scene.globe._surface.tileProvider._debug.wireframe = !0
}
}, {
text: "关闭三角网",
iconCls: "fa fa-connectdevelop",
visible: function (t) {
return e.scene.globe._surface.tileProvider._debug.wireframe
},
calback: function (t) {
e.scene.globe._surface.tileProvider._debug.wireframe = !1
}
}]
}, {
text: "场景设置",
iconCls: "fa fa-gear",
children: [{
text: "开启深度监测",
iconCls: "fa fa-eye-slash",
visible: function (t) {
return !e.scene.globe.depthTestAgainstTerrain
},
calback: function (t) {
e.scene.globe.depthTestAgainstTerrain = !0
}
}, {
text: "关闭深度监测",
iconCls: "fa fa-eye",
visible: function (t) {
return e.scene.globe.depthTestAgainstTerrain
},
calback: function (t) {
e.scene.globe.depthTestAgainstTerrain = !1
}
}, {
text: "开启光照效果",
iconCls: "fa fa-bullseye",
visible: function (t) {
return !e.shadows
},
calback: function (t) {
e.shadows = !0, e.terrainShadows = l.ShadowMode.ENABLED, e.scene.globe.enableLighting = !0
}
}, {
text: "关闭光照效果",
iconCls: "fa fa-sun-o",
visible: function (t) {
return e.shadows
},
calback: function (t) {
e.shadows = !1, e.terrainShadows = l.ShadowMode.RECEIVE_ONLY, e.scene.globe.enableLighting = !1
}
}, {
text: "开启大气渲染",
iconCls: "fa fa-cloud",
visible: function (t) {
return !e.scene.skyAtmosphere.show
},
calback: function (t) {
e.scene.skyAtmosphere.show = !0, e.scene.globe.showGroundAtmosphere = !0
}
}, {
text: "关闭大气渲染",
iconCls: "fa fa-cloud",
visible: function (t) {
return e.scene.skyAtmosphere.show
},
calback: function (t) {
e.scene.skyAtmosphere.show = !1, e.scene.globe.showGroundAtmosphere = !1
}
}, {
text: "场景截图",
iconCls: "fa fa-download",
calback: function (t) {
e.wutu.expImage()
}
}]
}]
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.ContextMenu = void 0;
var a = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}();
t.getDefaultContextMenu = o;
var s = i(0),
l = r(s),
u = i(5),
c = function (e) {
return e && e.__esModule ? e : {
default: e
}
}(u),
h = i(1),
d = r(h),
f = i(26),
p = r(f),
m = i(2),
g = r(m);
t.ContextMenu = function () {
function e(t, i) {
var r = this;
n(this, e), this.viewer = t, this.viewerid = t._container.id, this._enable = !0, this.menuIndex = 0, this.objMenu = {};
var o = '';
(0, c.default)("#" + t._container.id).append(o), this._contextmenuDOM = (0, c.default)("#" + this.viewerid + "wutu-contextmenu"), this._contextmenuULDOM = (0, c.default)("#" + this.viewerid + "wutu-contextmenu-ul");
var a = new l.ScreenSpaceEventHandler(t.scene.canvas);
a.setInputAction(function (e) {
r.close()
}, l.ScreenSpaceEventType.LEFT_DOWN), a.setInputAction(function (e) {
r.close()
}, l.ScreenSpaceEventType.MIDDLE_DOWN), a.setInputAction(function (e) {
r.close()
}, l.ScreenSpaceEventType.RIGHT_DOWN), a.setInputAction(function (e) {
r.close()
}, l.ScreenSpaceEventType.PINCH_START), a.setInputAction(function (e) {
r.close()
}, l.ScreenSpaceEventType.WHEEL), a.setInputAction(function (e) {
if (r.close(), r._enable) {
var i, n = e.position,
o = t.scene.pick(n, 5, 5),
a = t.wutu.contextmenuItems;
l.defined(o) && l.defined(o.id) && o.id instanceof l.Entity ? (i = o.id, l.defined(i.contextmenuItems) && (a = i.contextmenuItems)) : l.defined(o) && l.defined(o.primitive) && (i = o.primitive, l.defined(i.contextmenuItems) && (a = i.contextmenuItems)), r.show(a, n, i)
}
}, l.ScreenSpaceEventType.RIGHT_CLICK), this.handler = a
}
return a(e, [{
key: "show",
value: function (e, t, i) {
if (!e || 0 == e.length) return void this.close();
for (var r = d.getCurrentMousePosition(this.viewer.scene, t), n = "", o = 0, a = e.length; o < a; o++) {
var s = e[o],
l = this.getItemHtml(s, {
positionMouse: t,
position: r,
target: i
});
l && (n += l)
}
if ("" == n) return void this.close();
var u = this;
this._contextmenuULDOM.html(n), (0, c.default)("#" + this.viewerid + "wutu-contextmenu-ul .contextmenu-item").click(function (e) {
var n = Number((0, c.default)(this).attr("data-index")),
o = u.objMenu[n];
o && o.calback && o.calback({
positionMouse: t,
position: r,
data: o,
target: i
}), u.close()
}), (0, c.default)("#" + this.viewerid + "wutu-contextmenu-ul .contextmenu-item").mouseover(function (e) {
(0, c.default)(".sub-menu").hide();
var t = this.querySelector(".sub-menu");
t && (t.style.display = "block"), (0, c.default)("#" + u.viewerid + "wutu-contextmenu-ul .active").removeClass("active"), (0, c.default)(this).addClass("active")
});
var h = t.y,
f = t.x,
p = this._contextmenuDOM.height(),
m = this._contextmenuDOM.width();
(0, c.default)("#" + this.viewerid + "wutu-contextmenu-ul .sub-menu").css({
left: m + 3 + "px"
}), h + p > this.viewer.scene.canvas.clientHeight ? (h -= p - 10) <= 0 && (h = 0) : h += 10, f + m > this.viewer.scene.canvas.clientWidth ? (f -= m - 10) <= 0 && (f = 0) : f += 10, this._contextmenuDOM.css({
top: h,
left: f
}).show()
}
}, {
key: "getItemHtml",
value: function (e, t) {
if (e.hasOwnProperty("visible")) {
var i = e.visible;
try {
"function" == typeof i && (t.data = e, i = e.visible(t))
} catch (e) {
console.log(e)
}
if (!i) return null
}
var r;
if (e.text) {
var n = "",
o = "";
if (e.children) {
n = '", o = '
'
}
this.menuIndex++, this.objMenu[this.menuIndex] = e, r = '"
} else r = '
';
return r
}
}, {
key: "close",
value: function () {
(0, c.default)("#" + this.viewerid + "wutu-contextmenu").hide()
}
}, {
key: "destroy",
value: function () {
this.close(), this.handler.destroy(), delete this.handler, (0, c.default)("#" + this.viewerid + "wutu-contextmenu").remove(), delete this._contextmenuDOM, delete this._contextmenuULDOM
}
}, {
key: "enable",
get: function () {
return this._enable
},
set: function (e) {
this._enable = e, e || this.close()
}
}]), e
}()
}, function (e, t, i) {
"use strict";
function r(e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}
function n(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.Location = void 0;
var o = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
a = i(0),
s = r(a),
l = i(5),
u = function (e) {
return e && e.__esModule ? e : {
default: e
}
}(l),
c = i(1),
h = r(c),
d = i(2),
f = r(d);
t.Location = function () {
function e(t, i) {
var r = this;
n(this, e), this.viewer = t, this.options = i, this.containerid = t._container.id + "_location_mars_jwd", this.locationFormat = i.format || "
经度:{x}
纬度:{y}
海拔:{z}米
方向:{heading}度
俯仰角:{pitch}度
视高:{height}米
";
var o = '
';
if ((0, u.default)("#" + t._container.id).prepend(o), i.style ? (0, u.default)("#" + this.containerid).css(i.style) : (0, u.default)("#" + this.containerid).css({
left: t.animation ? "170px" : "0",
right: "0",
bottom: t.timeline ? "25px" : "0"
}), this.locationData = {}, this.locationData.height = h.formatNum(t.camera.positionCartographic.height, 1), this.locationData.heading = h.formatNum(s.Math.toDegrees(t.camera.heading), 0), this.locationData.pitch = h.formatNum(s.Math.toDegrees(t.camera.pitch), 0), s.defaultValue(this.options.bindEvent, !0)) {
var a = new s.ScreenSpaceEventHandler(t.scene.canvas);
a.setInputAction(function (e) {
r.updateData(e)
}, s.ScreenSpaceEventType.MOUSE_MOVE), this.handler = a
}
t.scene.camera.changed.addEventListener(this.updaeCamera, this)
}
return o(e, [{
key: "updateData",
value: function (e) {
var t = h.getCurrentMousePosition(this.viewer.scene, e.endPosition);
if (t) {
var i = s.Cartographic.fromCartesian(t);
this.locationData.z = h.formatNum(i.height / this.viewer.scene.terrainExaggeration, 1);
var r = s.Math.toDegrees(i.longitude),
n = s.Math.toDegrees(i.latitude);
switch (this.options.crs) {
default:
var o = this.options.hasOwnProperty("toFixed") ? this.options.toFixed : 6;
this.locationData.x = h.formatNum(r, o), this.locationData.y = h.formatNum(n, o);
break;
case "degree":
this.locationData.x = f.formatDegree(r), this.locationData.y = f.formatDegree(n);
break;
case "project":
var o = this.options.hasOwnProperty("toFixed") ? this.options.toFixed : 0;
this.locationData.x = h.formatNum(t.x, o), this.locationData.y = h.formatNum(t.y, o);
break;
case "wgs":
var o = this.options.hasOwnProperty("toFixed") ? this.options.toFixed : 6,
a = point2wgs({
x: r,
y: n
});
this.locationData.x = h.formatNum(a.x, o), this.locationData.y = h.formatNum(a.y, o);
break;
case "wgs-degree":
var a = point2wgs({
x: r,
y: n
});
this.locationData.x = f.formatDegree(a.x), this.locationData.y = f.formatDegree(a.y)
}
var l;
l = "function" == typeof this.locationFormat ? this.locationFormat(this.locationData) : f.template(this.locationFormat, this.locationData), (0, u.default)("#" + this.containerid).html('
' + l + "
")
}
}
}, {
key: "updaeCamera",
value: function () {
if (this.locationData.height = h.formatNum(this.viewer.camera.positionCartographic.height, 1), this.locationData.heading = h.formatNum(s.Math.toDegrees(this.viewer.camera.heading), 0), this.locationData.pitch = h.formatNum(s.Math.toDegrees(this.viewer.camera.pitch), 0), null != this.locationData.x) {
var e;
e = "function" == typeof this.locationFormat ? this.locationFormat(this.locationData) : f.template(this.locationFormat, this.locationData), (0, u.default)("#" + this.containerid).html('
' + e + "
")
}
}
}, {
key: "destroy",
value: function () {
this.viewer.scene.camera.changed.removeEventListener(this.updaeCamera, this), this.handler && (this.handler.destroy(), delete this.handler), (0, u.default)("#" + this.containerid).remove()
}
}]), e
}()
}, function (e, t, i) {
"use strict";
function r(e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}
function n(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.MouseZoomStyle = void 0;
var o = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
a = i(0),
s = r(a),
l = i(5),
u = function (e) {
return e && e.__esModule ? e : {
default: e
}
}(l),
c = i(1),
h = r(c),
d = i(2);
r(d), t.MouseZoomStyle = function () {
function e(t, i) {
n(this, e), this.viewer = t, this.options = i;
var r = t._container.id + "-mousezoom";
this.containerid = r, (0, u.default)("#" + t._container.id).append('
');
var o = -1,
a = new s.ScreenSpaceEventHandler(this.viewer.scene.canvas);
a.setInputAction(function (e) {
(0, u.default)("#" + r).addClass("cesium-mousezoom-visible"), clearTimeout(o), o = setTimeout(function () {
(0, u.default)("#" + r).removeClass("cesium-mousezoom-visible")
}, 200)
}, s.ScreenSpaceEventType.WHEEL), a.setInputAction(function (e) {
h.getCurrentMousePosition(t.scene, e.position) && (t.camera.positionCartographic.height > t.scene.screenSpaceCameraController.minimumCollisionTerrainHeight || (a.removeInputAction(s.ScreenSpaceEventType.MOUSE_MOVE), clearTimeout(o), (0, u.default)("#" + r).css({
top: e.position.y + "px",
left: e.position.x + "px"
}), (0, u.default)("#" + r).addClass("cesium-mousezoom-visible")))
}, s.ScreenSpaceEventType.MIDDLE_DOWN), a.setInputAction(function (e) {
(0, u.default)("#" + r).removeClass("cesium-mousezoom-visible"), a.setInputAction(function (e) {
(0, u.default)("#" + r).css({
top: e.endPosition.y + "px",
left: e.endPosition.x + "px"
})
}, s.ScreenSpaceEventType.MOUSE_MOVE)
}, s.ScreenSpaceEventType.MIDDLE_UP), this.handler = a
}
return o(e, [{
key: "destroy",
value: function () {
this.handler && (this.handler.destroy(), delete this.handler), (0, u.default)("#" + this.containerid).remove()
}
}]), e
}()
}, function (e, t, i) {
"use strict";
function r(e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}
function n(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.GaodePOIGeocoder = void 0;
var o = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
a = i(0),
s = r(a),
l = i(25),
u = r(l),
c = i(2);
t.GaodePOIGeocoder = function () {
function e(t) {
n(this, e), t = t || {}, this.citycode = t.citycode || "", this.gaodekey = t.key || ["f2fedb9b08ae13d22f1692cd472d345e", "81825d9f2bafbb14f235d2779be90c0f", "b185732970a4487de104fa71ef575f29", "2e6ca4aeb6867fb637a5bee8333e5d3a", "027187040fa924e56048468aaa77b62c"]
}
return o(e, [{
key: "getOneKey",
value: function () {
var e = this.gaodekey;
return e[Math.floor(Math.random() * e.length + 1) - 1]
}
}, {
key: "geocode",
value: function (e, t) {
var i = this,
r = this.getOneKey();
return new s.Resource({
url: "http://restapi.amap.com/v3/place/text",
queryParameters: {
key: r,
city: this.citycode,
keywords: e
}
}).fetchJson().then(function (t) {
if (0 == t.status) return void(0, c.msg)("请求失败(" + t.infocode + "):" + t.info);
if (0 === t.pois.length) return void(0, c.msg)("未查询到“" + e + "”相关数据!");
var r = 3e3;
return i.viewer.camera.positionCartographic.height < r && (r = i.viewer.camera.positionCartographic.height), t.pois.map(function (e) {
var t = e.location.split(",");
t = u.gcj2wgs(t);
var n = i.viewer.wutu.point2map({
x: t[0],
y: t[1]
});
return {
displayName: e.name,
destination: s.Cartesian3.fromDegrees(n.x, n.y, r)
}
})
})
}
}]), e
}()
}, function (e, t, i) {
"use strict";
function r(e) {
return e && e.__esModule ? e : {
default: e
}
}
function n(e, t) {
var i = e.scene.globe,
r = [],
n = a.defined(i._material) && (i._material.shaderSource.match(/slope/) || i._material.shaderSource.match("normalEC")),
o = [l.default];
!a.defined(i._material) || n && !i._terrainProvider.requestVertexNormals ? i._surface._tileProvider.uniformMap = void 0 : (o.push(i._material.shaderSource), i._surface._tileProvider.uniformMap = i._material._uniforms), r.push(t), o.push(d.default), i._surfaceShaderSet.baseVertexShaderSource = new a.ShaderSource({
sources: [l.default, c.default],
defines: r
}), i._surfaceShaderSet.baseFragmentShaderSource = new a.ShaderSource({
sources: o,
defines: r
}), i._surfaceShaderSet.material = i._material
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.addDefine = n;
var o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o),
s = i(106),
l = r(s),
u = i(107),
c = r(u),
h = i(108),
d = r(h)
}, function (e, t) {
e.exports = "/*!\r\n * Atmosphere code:\r\n *\r\n * Copyright (c) 2000-2005, Sean O'Neil (s_p_oneil@hotmail.com)\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions\r\n * are met:\r\n *\r\n * * Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n * * Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n * * Neither the name of the project nor the names of its contributors may be\r\n * used to endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r\n * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE\r\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\r\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\r\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\r\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n *\r\n * Modifications made by Analytical Graphics, Inc.\r\n */\r\n\r\n // Atmosphere:\r\n // Code: http://sponeil.net/\r\n // GPU Gems 2 Article: http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter16.html\r\n\r\nconst float fInnerRadius = 6378137.0;\r\nconst float fOuterRadius = 6378137.0 * 1.025;\r\nconst float fOuterRadius2 = fOuterRadius * fOuterRadius;\r\n\r\nconst float Kr = 0.0025;\r\nconst float Km = 0.0015;\r\nconst float ESun = 15.0;\r\n\r\nconst float fKrESun = Kr * ESun;\r\nconst float fKmESun = Km * ESun;\r\nconst float fKr4PI = Kr * 4.0 * czm_pi;\r\nconst float fKm4PI = Km * 4.0 * czm_pi;\r\n\r\nconst float fScale = 1.0 / (fOuterRadius - fInnerRadius);\r\nconst float fScaleDepth = 0.25;\r\nconst float fScaleOverScaleDepth = fScale / fScaleDepth;\r\n\r\nstruct AtmosphereColor\r\n{\r\n vec3 mie;\r\n vec3 rayleigh;\r\n};\r\n\r\nconst int nSamples = 2;\r\nconst float fSamples = 2.0;\r\n\r\nfloat scale(float fCos)\r\n{\r\n float x = 1.0 - fCos;\r\n return fScaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25))));\r\n}\r\n\r\nAtmosphereColor computeGroundAtmosphereFromSpace(vec3 v3Pos, bool useSunLighting)\r\n{\r\n\tvec3 v3InvWavelength = vec3(1.0 / pow(0.650, 4.0), 1.0 / pow(0.570, 4.0), 1.0 / pow(0.475, 4.0));\r\n\r\n // Get the ray from the camera to the vertex and its length (which is the far point of the ray passing through the atmosphere)\r\n vec3 v3Ray = v3Pos - czm_viewerPositionWC;\r\n float fFar = length(v3Ray);\r\n v3Ray /= fFar;\r\n\r\n float fCameraHeight = length(czm_viewerPositionWC);\r\n float fCameraHeight2 = fCameraHeight * fCameraHeight;\r\n\r\n // This next line is an ANGLE workaround. It is equivalent to B = 2.0 * dot(czm_viewerPositionWC, v3Ray),\r\n // which is what it should be, but there are problems at the poles.\r\n float B = 2.0 * length(czm_viewerPositionWC) * dot(normalize(czm_viewerPositionWC), v3Ray);\r\n float C = fCameraHeight2 - fOuterRadius2;\r\n float fDet = max(0.0, B*B - 4.0 * C);\r\n float fNear = 0.5 * (-B - sqrt(fDet));\r\n\r\n // Calculate the ray's starting position, then calculate its scattering offset\r\n vec3 v3Start = czm_viewerPositionWC + v3Ray * fNear;\r\n fFar -= fNear;\r\n float fDepth = exp((fInnerRadius - fOuterRadius) / fScaleDepth);\r\n\r\n // The light angle based on the sun position would be:\r\n // dot(czm_sunDirectionWC, v3Pos) / length(v3Pos);\r\n // When we want the atmosphere to be uniform over the globe so it is set to 1.0.\r\n\r\n float fLightAngle = czm_branchFreeTernary(useSunLighting, dot(czm_sunDirectionWC, v3Pos) / length(v3Pos), 1.0);\r\n float fCameraAngle = dot(-v3Ray, v3Pos) / length(v3Pos);\r\n float fCameraScale = scale(fCameraAngle);\r\n float fLightScale = scale(fLightAngle);\r\n float fCameraOffset = fDepth*fCameraScale;\r\n float fTemp = (fLightScale + fCameraScale);\r\n\r\n // Initialize the scattering loop variables\r\n float fSampleLength = fFar / fSamples;\r\n float fScaledLength = fSampleLength * fScale;\r\n vec3 v3SampleRay = v3Ray * fSampleLength;\r\n vec3 v3SamplePoint = v3Start + v3SampleRay * 0.5;\r\n\r\n // Now loop through the sample rays\r\n vec3 v3FrontColor = vec3(0.0);\r\n vec3 v3Attenuate = vec3(0.0);\r\n for(int i=0; i
i.options.maxHeight) return t.onStop && t.onStop(), void i.stop();
i.extrudedHeight += i.options.speed, t.onChange && t.onChange(i.extrudedHeight)
}, 100)
}
}, {
key: "stop",
value: function () {
clearInterval(this.timeIdx)
}
}, {
key: "clear",
value: function () {
this.stop(), null !== this._last_depthTestAgainstTerrain && (this.viewer.scene.globe.depthTestAgainstTerrain = this._last_depthTestAgainstTerrain), this.entity = null
}
}, {
key: "updateHeight",
value: function (e) {
this.extrudedHeight = e
}
}, {
key: "height",
get: function () {
return this.extrudedHeight
},
set: function (e) {
this.extrudedHeight = e
}
}]), e
}()
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.FloodByTerrain = void 0;
var n = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o);
t.FloodByTerrain = function () {
function e(t, i) {
r(this, e), this.viewer = t, i = i || {};
var n = a.clone(a.ExpandByMars._defaultFloodAnalysis);
this.minHeight = a.defaultValue(i.minHeight, a.clone(n.minHeight)), this.maxHeight = a.defaultValue(i.maxHeight, a.clone(n.maxHeight)), this._positions = a.defaultValue(i.positions, a.clone(n.positions)), this._checkArgs() && (this.floodVar = a.defaultValue(i.floodVar, a.clone(n.floodVar)), this.ym_pos_x = a.defaultValue(i.ym_pos_x, a.clone(n.ym_pos_x)), this.ym_pos_y = a.defaultValue(i.ym_pos_y, a.clone(n.ym_pos_y)), this.ym_pos_z = a.defaultValue(i.ym_pos_z, a.clone(n.ym_pos_z)), this.rect_flood = a.defaultValue(i.rect_flood, a.clone(n.rect_flood)), this.ym_max_index = a.defaultValue(i.ym_max_index, a.clone(n.ym_max_index)), this._globe = a.defaultValue(i.globe, a.clone(n.globe)), this._speed = a.defaultValue(i.speed, a.clone(n.floodSpeed)), this._visibleOutArea = a.defaultValue(i.visibleOutArea, a.clone(n.showElseArea)), this._boundingSwell = a.defaultValue(i.boundingSwell, 20), this.defaultShow = a.defaultValue(i.show, !0), this.onStop = a.defaultValue(i.onStop, null), this.height = a.defaultValue(i.height, null), this._init())
}
return n(e, [{
key: "_checkArgs",
value: function () {
if (void 0 == this.minHeight || void 0 == this.maxHeight) return console.log("请确认高度值为数值!"), !1;
if (this.minHeight > this.maxHeight) {
var e = this.minHeight;
this.minHeight = this.maxHeight, this.maxHeight = e
}
return !0
}
}, {
key: "_init",
value: function () {
this._positions && 0 != this._positions.length && (this._prepareFlood(this._positions), this._setFloodVar(), this._startFlood(), this._activeFloodSpeed())
}
}, {
key: "setPositions",
value: function (e) {
e && 0 != e.length && (this._prepareFlood(e), this._setFloodVar(), this._startFlood(), this._activeFloodSpeed())
}
}, {
key: "_activeFloodSpeed",
value: function () {
var e = this;
this.activeFlooding || (this.activeFlooding = function () {
e.height ? e.floodVar[1] = e.height() : e.floodVar[1] += e.speed / 50, e.floodVar[1] > e.floodVar[2] && (e.floodVar[1] = e.floodVar[2], e.cancelFloodSpeed(), e.onStop && e.onStop()), e.floodVar[1] < e.floodVar[0] && (e.floodVar[1] = e.floodVar[0], e.cancelFloodSpeed(), e.onStop && e.onStop()), a.ExpandByMars.floodAnalysis.floodVar[1] = e.floodVar[1]
}, this.viewer.clock.onTick.addEventListener(this.activeFlooding))
}
}, {
key: "cancelFloodSpeed",
value: function () {
this.viewer.clock.onTick.removeEventListener(this.activeFlooding), this.activeFlooding = null
}
}, {
key: "reFlood",
value: function () {
this.floodVar[1] = this.floodVar[0], this._activeFloodSpeed()
}
}, {
key: "_switchShow",
value: function () {
this.show ? this.viewer.scene.globe.material = a.Material.fromType("YanMo") : this.viewer.scene.globe.material = null
}
}, {
key: "_prepareFlood",
value: function (e) {
this.ym_pos_arr = e;
var t = e.length;
if (0 != t) {
this.ym_max_index = t;
for (var i = 99999999, r = 99999999, n = 99999999, o = -99999999, a = -99999999, s = -99999999, l = 0; l < t; l++) e[l] ? (this.ym_pos_x[l] = e[l].x, this.ym_pos_y[l] = e[l].y, this.ym_pos_z[l] = e[l].z, e[l].x > o && (o = e[l].x), e[l].x < i && (i = e[l].x), e[l].y > a && (a = e[l].y), e[l].y < r && (r = e[l].y), e[l].z > s && (s = e[l].z), e[l].z < n && (n = e[l].z)) : (this.ym_pos_x[l] = 0, this.ym_pos_y[l] = 0, this.ym_pos_z[l] = 0);
var u = this.boundingSwell;
this._base_rect = this.rect_flood = [i - u, r - u, n - u, o + u, a + u, s + u, 0, 0, 0]
}
}
}, {
key: "_setFloodVar",
value: function () {
this.floodVar = [this.minHeight, this.minHeight, this.maxHeight, this.maxHeight - this.minHeight]
}
}, {
key: "_startFlood",
value: function () {
a.ExpandByMars.floodAnalysis.floodVar[0] = this.floodVar[0], a.ExpandByMars.floodAnalysis.floodVar[1] = this.floodVar[1], a.ExpandByMars.floodAnalysis.ym_pos_x = this.ym_pos_x, a.ExpandByMars.floodAnalysis.ym_pos_y = this.ym_pos_y, a.ExpandByMars.floodAnalysis.ym_pos_z = this.ym_pos_z, a.ExpandByMars.floodAnalysis.rect_flood = this.rect_flood, a.ExpandByMars.floodAnalysis.ym_pos_arr = this.ym_pos_arr, a.ExpandByMars.floodAnalysis.floodSpeed = this.speed, a.ExpandByMars.floodAnalysis.ym_max_index = this.ym_max_index, a.ExpandByMars.floodAnalysis.globe = this.globe = !1, a.ExpandByMars.floodAnalysis.showElseArea = this.visibleOutArea, this.viewer.scene.globe.material = a.Material.fromType("YanMo")
}
}, {
key: "destroy",
value: function () {
this.viewer && (this.viewer.scene.globe.material = null, this.cancelFloodSpeed()), a.ExpandByMars.resetFloodAnalysis(), delete this.activeFlooding, delete this.viewer, delete this.ym_max_height, delete this.ym_pos_x, delete this.ym_pos_y, delete this.ym_pos_z, delete this.ym_pos_arr, delete this.speed, delete this.ym_max_index, delete this.globe, delete this.maxDepthOfWater, delete this.rect_flood
}
}, {
key: "visibleOutArea",
get: function () {
return this._visibleOutArea
},
set: function (e) {
this._visibleOutArea = e, a.ExpandByMars.floodAnalysis.showElseArea = e
}
}, {
key: "globe",
get: function () {
return this._globe
},
set: function (e) {
this._globe = e, a.ExpandByMars.floodAnalysis.globe = e
}
}, {
key: "speed",
get: function () {
return this._speed
},
set: function (e) {
this._speed = Number(e)
}
}, {
key: "boundingSwell",
get: function () {
return this._boundingSwell
},
set: function (e) {
var t = this._base_rect;
this._boundingSwell = Number(e), this.rect_flood = [t[0] - this.boundingSwell, t[1] - this.boundingSwell, t[2] - this.boundingSwell, t[3] - this.boundingSwell, t[4] - this.boundingSwell, t[5] - this.boundingSwell, 0, 0, 0], a.ExpandByMars.floodAnalysis.rect_flood = this.rect_flood
}
}, {
key: "show",
get: function () {
return this.defaultShow
},
set: function (e) {
this.defaultShow = Boolean(e), this._switchShow()
}
}]), e
}()
}, function (e, t, i) {
"use strict";
function r(e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.Measure = void 0;
var n = i(0),
o = r(n),
a = i(16),
s = i(7),
l = r(s),
u = i(3),
c = i(8),
h = i(2),
d = r(h),
f = i(1),
p = i(28),
m = function (e) {
function t(e) {
m(), x = "length", e = e || {}, e.type = x, e.hasOwnProperty("terrain") || (e.terrain = !0), M.start(e)
}
function i(e) {
m(), x = "section", e = e || {}, e.type = x, e.terrain = !0, e.splitNum = o.defaultValue(e.splitNum, 6), M.start(e)
}
function r(e) {
m(), x = "area", e = e || {}, e.type = x, T.start(e)
}
function n(e) {
m(), e = e || {}, e.hasOwnProperty("isSuper") && !e.isSuper ? (x = "height", e.type = x, S.start(e)) : (x = "super_height", e.type = x, O.start(e))
}
function s(e) {
m(), x = "angle", e = e || {}, e.type = x, D.start(e)
}
function h(e) {
m(), x = "point", e = e || {}, e.type = x, k.start(e)
}
function m() {
M.clearLastNoEnd(), T.clearLastNoEnd(), S.clearLastNoEnd(), O.clearLastNoEnd(), D.clearLastNoEnd(), k.clearLastNoEnd(), P.stopDraw()
}
function g() {
if (null != C) {
switch (x) {
case "length":
case "section":
M.showMoveDrawing(C);
break;
case "area":
T.showMoveDrawing(C);
break;
case "height":
S.showMoveDrawing(C);
break;
case "super_height":
O.showMoveDrawing(C);
break;
case "angle":
D.showMoveDrawing(C)
}
P.endDraw(), C = null
}
}
function v() {
x = "", m(), P.deleteAll()
}
function y(e, t) {
var i = E.entities.values;
for (var r in i) {
var n = i[r];
if (n.label && n.isMarsMeasureLabel && n.attribute && n.attribute.value) {
if (n.attribute.type != e) continue;
"area" == e ? n.label.text._value = (n.attribute.textEx || "") + d.formatArea(n.attribute.value, t) : n._label.text._value = (n.attribute.textEx || "") + d.formatLength(n.attribute.value, t)
}
}
}
var _ = e.viewer,
w = (0, u.getDefStyle)("label", {
color: "#ffffff",
font_size: 20,
border: !0,
border_color: "#000000",
border_width: 3,
background: !0,
background_color: "#000000",
background_opacity: .5,
scaleByDistance: !0,
scaleByDistance_far: 8e5,
scaleByDistance_farValue: .5,
scaleByDistance_near: 1e3,
scaleByDistance_nearValue: 1,
pixelOffset: [0, -15],
visibleDepth: !1
});
if (o.defined(e.label))
for (var b in e.label) w[b] = e.label[b];
var C, x = "",
P = new a.Draw(_, {
hasEdit: !1,
removeScreenSpaceEvent: e.removeScreenSpaceEvent
});
P.on(l.DrawAddPoint, function (e) {
switch (C = e.entity, x) {
case "length":
case "section":
M.showAddPointLength(C);
break;
case "area":
T.showAddPointLength(C);
break;
case "height":
S.showAddPointLength(C);
break;
case "super_height":
O.showAddPointLength(C);
break;
case "angle":
D.showAddPointLength(C)
}
}), P.on(l.DrawRemovePoint, function (e) {
switch (x) {
case "length":
case "section":
M.showRemoveLastPointLength(e);
break;
case "area":
T.showRemoveLastPointLength(e);
break;
case "height":
S.showRemoveLastPointLength(e);
break;
case "super_height":
O.showRemoveLastPointLength(e);
break;
case "angle":
D.showRemoveLastPointLength(e)
}
}), P.on(l.DrawMouseMove, function (e) {
switch (C = e.entity, x) {
case "length":
case "section":
M.showMoveDrawing(C);
break;
case "area":
T.showMoveDrawing(C);
break;
case "height":
S.showMoveDrawing(C);
break;
case "super_height":
O.showMoveDrawing(C);
break;
case "angle":
D.showMoveDrawing(C)
}
}), P.on(l.DrawCreated, function (e) {
switch (C = e.entity, x) {
case "length":
case "section":
M.showDrawEnd(C);
break;
case "area":
T.showDrawEnd(C);
break;
case "height":
S.showDrawEnd(C);
break;
case "super_height":
O.showDrawEnd(C);
break;
case "angle":
D.showDrawEnd(C);
break;
case "point":
k.showDrawEnd(C)
}
C = null
});
var E = P.getDataSource(),
M = {
options: null,
arrLables: [],
totalLable: null,
disTerrainScale: 1.2,
clearLastNoEnd: function () {
if (o.defined(this.totalLable) && E.entities.remove(this.totalLable), o.defined(this.arrLables) && this.arrLables.length > 0) {
var e = this.arrLables;
if (e && e.length > 0)
for (var t in e) E.entities.remove(e[t])
}
this.totalLable = null, this.arrLables = []
},
start: function (e) {
this.options = e;
var t = (0, c.style2Entity)(w, {
horizontalOrigin: o.HorizontalOrigin.LEFT,
verticalOrigin: o.VerticalOrigin.BOTTOM,
show: !1
});
this.totalLable = E.entities.add({
label: t,
isMarsMeasureLabel: !0,
_noMousePosition: !0,
attribute: {
unit: this.options.unit,
type: this.options.type
}
}), this.arrLables = [], P.startDraw({
type: "polyline",
config: {
addHeight: e.addHeight
},
style: e.style || {
lineType: "glow",
color: "#ebe12c",
width: 9,
glowPower: .1,
clampToGround: "section" == this.options.type || this.options.terrain,
depthFailMaterial: new o.Color.fromCssColorString("#ebe12c").withAlpha(.4)
}
})
},
showAddPointLength: function (e) {
var t = P.getPositions(e),
i = (0, c.style2Entity)(w, {
horizontalOrigin: o.HorizontalOrigin.LEFT,
verticalOrigin: o.VerticalOrigin.BOTTOM,
show: !0
}),
r = E.entities.add({
position: t[t.length - 1],
label: i,
isMarsMeasureLabel: !0,
_noMousePosition: !0,
attribute: {
unit: this.options.unit,
type: this.options.type
}
});
if (1 == t.length) r.label.text = "起点";
else {
var n = d.getLength(t),
a = d.formatLength(n, this.options.unit);
r.label.text = a, r.attribute.value = n, d.getLength([t[t.length - 2], t[t.length - 1]]) < 5 && (r.show = !1)
}
this.arrLables.push(r)
},
showRemoveLastPointLength: function (e) {
var t = this.arrLables.pop();
E.entities.remove(t), this.showMoveDrawing(e.entity), this.totalLable.position = e.position
},
showMoveDrawing: function (e) {
var t = P.getPositions(e);
if (t.length < 2) return void(this.totalLable.label.show = !1);
var i = d.getLength(t),
r = d.formatLength(i, this.options.unit);
this.totalLable.position = t[t.length - 1], this.totalLable.label.text = "总长:" + r, this.totalLable.label.show = !0, this.totalLable.attribute.value = i, this.totalLable.attribute.textEx = "总长:", this.options.calback && this.options.calback(r, i)
},
showDrawEnd: function (e) {
var t = P.getPositions(e),
i = this.arrLables.length - t.length;
if (i >= 0) {
for (var r = this.arrLables.length - 1; r >= t.length - 1; r--) E.entities.remove(this.arrLables[r]);
this.arrLables.splice(t.length - 1, i + 1)
}
e._totalLable = this.totalLable, e._arrLables = this.arrLables, this.totalLable = null, this.arrLables = [], null != e.polyline && ("section" == this.options.type ? this.updateSectionForTerrain(e) : this.options.terrain && this.updateLengthForTerrain(e))
},
updateLengthForTerrain: function (e) {
function t() {
if (++s >= r.length && o) {
var e = d.formatLength(l, a);
return o.label.text = "总长:" + e, o.attribute.value = l, i.options.calback && i.options.calback(e, l), void(i.options.onStop && i.options.onStop())
}
var u = [r[s - 1], r[s]];
(0, f.terrainPolyline)({
viewer: _,
positions: u,
splitNum: i.options.splitNum,
calback: function (e, r) {
var o = d.getLength(e);
r && (o *= i.disTerrainScale);
var u = n[s];
if (u) {
var c = d.formatLength(o, a);
u.label.text = c, u.attribute.value = o
}
l += o, t()
}
})
}
var i = this,
r = e.polyline.positions.getValue(_.clock.currentTime),
n = e._arrLables,
o = e._totalLable,
a = o && o.unit;
this.options.onStart && this.options.onStart();
var s = 0,
l = 0;
t()
},
updateSectionForTerrain: function (e) {
function t() {
s++;
var e = [i[s - 1], i[s]];
(0, f.terrainPolyline)({
viewer: _,
positions: e,
splitNum: g.options.splitNum,
calback: function (v, y) {
l = y ? 1 == s ? l.concat(e) : l.concat([i[s]]) : l.concat(v);
for (var _ = o.Cartographic.fromCartesian(i[s - 1]).height, w = o.Cartographic.fromCartesian(i[s]).height, b = (w - _) / v.length, C = 0; C < v.length; C++) {
0 != C && (u += o.Cartesian3.distance(v[C], v[C - 1])), c.push(Number(u.toFixed(1)));
var x = (0, f.formatPosition)(v[C]);
h.push(x.z), m.push(x);
var P = Number((_ + b * C).toFixed(1));
p.push(P)
}
if (s >= i.length - 1) {
if (n) {
var E = d.getLength(l),
M = d.formatLength(E, a);
n.label.text = "总长:" + M, n.attribute.value = E
}
g.options.calback && g.options.calback({
distancestr: M,
distance: E,
arrLen: c,
arrLX: p,
arrHB: h,
arrPoint: m
}), g.options.onStop && g.options.onStop()
} else {
var E = d.getLength(v),
M = d.formatLength(E, a),
T = r[s];
T.label.text = M, T.attribute.value = E, t()
}
}
})
}
var i = e.polyline.positions.getValue(_.clock.currentTime);
if (!(i.length < 2)) {
var r = e._arrLables,
n = e._totalLable,
a = n && n.unit,
s = 0,
l = [],
u = 0,
c = [],
h = [],
p = [],
m = [];
this.options.onStart && this.options.onStart();
var g = this;
t()
}
}
},
T = {
options: null,
totalLable: null,
clearLastNoEnd: function () {
null != this.totalLable && E.entities.remove(this.totalLable), this.totalLable = null
},
start: function (e) {
this.options = e;
var t = (0, c.style2Entity)(w, {
horizontalOrigin: o.HorizontalOrigin.CENTER,
verticalOrigin: o.VerticalOrigin.BOTTOM,
show: !1
});
this.totalLable = E.entities.add({
label: t,
isMarsMeasureLabel: !0,
_noMousePosition: !0,
attribute: {
unit: this.options.unit,
type: this.options.type
}
}), P.startDraw({
type: "polygon",
style: e.style || {
color: "#00fff2",
outline: !0,
outlineColor: "#fafa5a",
outlineWidth: 1,
opacity: .4,
clampToGround: !0
}
})
},
showAddPointLength: function (e) {
this.showMoveDrawing(e)
},
showRemoveLastPointLength: function (e) {
P.getPositions(e.entity).length < 3 && (this.totalLable.label.show = !1)
},
showMoveDrawing: function (e) {
var t = P.getPositions(e);
if (t.length < 3) return void(this.totalLable.label.show = !1);
var i = d.getArea(t),
r = d.formatArea(i, this.options.unit),
n = (0, f.centerOfMass)(t);
this.totalLable.position = n, this.totalLable.label.text = "面积:" + r, this.totalLable.label.show = !0, this.totalLable.attribute.value = i, this.totalLable.attribute.textEx = "面积:", this.options.calback && this.options.calback(r, i)
},
showDrawEnd: function (e) {
null != e.polygon && (e._totalLable = this.totalLable, this.totalLable = null)
}
},
S = {
options: null,
totalLable: null,
clearLastNoEnd: function () {
null != this.totalLable && E.entities.remove(this.totalLable), this.totalLable = null
},
start: function (e) {
this.options = e;
var t = (0, c.style2Entity)(w, {
horizontalOrigin: o.HorizontalOrigin.RIGHT,
verticalOrigin: o.VerticalOrigin.BOTTOM,
show: !1
});
this.totalLable = E.entities.add({
label: t,
isMarsMeasureLabel: !0,
_noMousePosition: !0,
attribute: {
unit: this.options.unit,
type: this.options.type
}
}), P.startDraw({
type: "polyline",
config: {
maxPointNum: 2
},
style: e.style || {
lineType: "glow",
color: "#ebe12c",
width: 9,
glowPower: .1,
depthFailMaterial: new o.Color.fromCssColorString("#ebe12c").withAlpha(.4)
}
})
},
showAddPointLength: function (e) {
this.showMoveDrawing(e)
},
showRemoveLastPointLength: function (e) {
this.totalLable && (this.totalLable.label.show = !1)
},
showMoveDrawing: function (e) {
var t = P.getPositions(e);
if (t.length < 2) return void(this.totalLable.label.show = !1);
var i = o.Cartographic.fromCartesian(t[0]),
r = o.Cartographic.fromCartesian(t[1]),
n = Math.abs(r.height - i.height),
a = d.formatLength(n, this.options.unit);
this.totalLable.position = o.Cartesian3.midpoint(t[0], t[1], new o.Cartesian3), this.totalLable.label.text = "高度差:" + a, this.totalLable.label.show = !0, this.totalLable.attribute.value = n, this.totalLable.attribute.textEx = "高度差:", this.options.calback && this.options.calback(a, n)
},
showDrawEnd: function (e) {
e._totalLable = this.totalLable, this.totalLable = null
}
},
O = {
options: null,
totalLable: null,
xLable: null,
hLable: null,
clearLastNoEnd: function () {
null != this.totalLable && E.entities.remove(this.totalLable), null != this.xLable && E.entities.remove(this.xLable), null != this.hLable && E.entities.remove(this.hLable), this.totalLable = null, this.xLable = null, this.hLable = null
},
start: function (e) {
this.options = e;
var t = (0, c.style2Entity)(w, {
horizontalOrigin: o.HorizontalOrigin.RIGHT,
verticalOrigin: o.VerticalOrigin.CENTER,
show: !1
});
this.totalLable = E.entities.add({
label: t,
isMarsMeasureLabel: !0,
_noMousePosition: !0,
attribute: {
unit: this.options.unit,
type: this.options.type
}
});
var i = (0, c.style2Entity)(w, {
horizontalOrigin: o.HorizontalOrigin.CENTER,
verticalOrigin: o.VerticalOrigin.BOTTOM,
show: !1
});
i.pixelOffset = new o.Cartesian2(0, 0), this.xLable = E.entities.add({
label: i,
isMarsMeasureLabel: !0,
_noMousePosition: !0,
attribute: {
unit: this.options.unit,
type: this.options.type
}
}), this.hLable = E.entities.add({
label: i,
isMarsMeasureLabel: !0,
_noMousePosition: !0,
attribute: {
unit: this.options.unit,
type: this.options.type
}
}), P.startDraw({
type: "polyline",
config: {
maxPointNum: 2
},
style: e.style || {
lineType: "glow",
color: "#ebe12c",
width: 9,
glowPower: .1,
depthFailMaterial: new o.Color.fromCssColorString("#ebe12c").withAlpha(.4)
}
})
},
showAddPointLength: function (e) {
var t = P.getPositions(e);
if (4 == t.length) {
var i = t[3].clone();
t.pop(), t.pop(), t.pop(), t.push(i)
}
if (2 == t.length) {
var r = this.getZHeightPosition(t[0], t[1]);
this.getHDistance(t[0], t[1]) > 3 && (t.push(r), t.push(t[0]))
}
this.showSuperHeight(t)
},
showRemoveLastPointLength: function (e) {
var t = P.getPositions(e.entity);
2 == t.length && (t.pop(), t.pop(), this.totalLable.label.show = !1, this.hLable.label.show = !1, this.xLable.label.show = !1)
},
showMoveDrawing: function (e) {
var t = P.getPositions(e);
if (4 == t.length) {
var i = t[3].clone();
t.pop(), t.pop(), t.pop(), t.push(i)
}
if (2 == t.length) {
var r = this.getZHeightPosition(t[0], t[1]);
this.getHDistance(t[0], t[1]) > 3 && (t.push(r), t.push(t[0]))
}
this.showSuperHeight(t)
},
showDrawEnd: function (e) {
e._arrLables = [this.totalLable, this.hLable, this.xLable], this.totalLable = null, this.hLable = null, this.xLable = null
},
showSuperHeight: function (e) {
var t, i, r, n;
if (4 == e.length) {
var a, s, l = o.Cartesian3.midpoint(e[0], e[1], new o.Cartesian3),
u = o.Cartographic.fromCartesian(e[0]),
c = o.Cartographic.fromCartesian(e[1]),
h = o.Cartographic.fromCartesian(e[2]),
f = c.height - h.height;
n = c.height - u.height, r = o.Cartesian3.distance(e[0], e[1]), n > -1 && n < 1 ? (s = e[1], this.updateSuperHeightLabel(this.totalLable, s, "高度差:", n), this.updateSuperHeightLabel(this.hLable, l, "", r)) : (f > -.1 && f < .1 ? (a = o.Cartesian3.midpoint(e[2], e[1], new o.Cartesian3), s = o.Cartesian3.midpoint(e[2], e[3], new o.Cartesian3), i = o.Cartesian3.distance(e[1], e[2]), t = o.Cartesian3.distance(e[3], e[2])) : (s = o.Cartesian3.midpoint(e[2], e[1], new o.Cartesian3), a = o.Cartesian3.midpoint(e[2], e[3], new o.Cartesian3), i = o.Cartesian3.distance(e[3], e[2]), t = o.Cartesian3.distance(e[1], e[2])), this.updateSuperHeightLabel(this.totalLable, s, "高度差:", t), this.updateSuperHeightLabel(this.xLable, a, "", i), this.updateSuperHeightLabel(this.hLable, l, "", r))
} else if (2 == e.length) {
t = o.Cartesian3.distance(e[1], e[0]);
var s = o.Cartesian3.midpoint(e[0], e[1], new o.Cartesian3);
this.xLable.label.show && (this.xLable.label.show = !1, this.hLable.label.show = !1), this.updateSuperHeightLabel(this.totalLable, s, "高度差:", t)
}
var p = d.formatLength(t, this.options.unit);
this.options.calback && this.options.calback(p, t)
},
updateSuperHeightLabel: function (e, t, i, r) {
null != e && (e.position = t, e.label.text = i + d.formatLength(r, this.options.unit), e.label.show = !0, e.attribute.value = r, e.attribute.textEx = i)
},
getZHeightPosition: function (e, t) {
var i = o.Cartographic.fromCartesian(e),
r = Number(o.Math.toDegrees(i.longitude)),
n = Number(o.Math.toDegrees(i.latitude)),
a = Number(i.height.toFixed(2)),
s = o.Cartographic.fromCartesian(t),
l = Number(o.Math.toDegrees(s.longitude)),
u = Number(o.Math.toDegrees(s.latitude)),
c = Number(s.height.toFixed(2));
return a > c ? o.Cartesian3.fromDegrees(l, u, a) : o.Cartesian3.fromDegrees(r, n, c)
},
getHDistance: function (e, t) {
var i = this.getZHeightPosition(e, t),
r = o.Cartographic.fromCartesian(t),
n = o.Cartographic.fromCartesian(i),
a = o.Cartesian3.distance(e, i);
return Math.abs(Number(n.height) - Number(r.height)) < .01 && (a = o.Cartesian3.distance(t, i)), a
}
},
D = {
options: null,
totalLable: null,
exLine: null,
clearLastNoEnd: function () {
null != this.totalLable && E.entities.remove(this.totalLable), this.totalLable = null, null != this.exLine && E.entities.remove(this.exLine), this.exLine = null
},
start: function (e) {
this.options = e;
var t = (0, c.style2Entity)(w, {
horizontalOrigin: o.HorizontalOrigin.LEFT,
verticalOrigin: o.VerticalOrigin.BOTTOM,
show: !1
});
this.totalLable = E.entities.add({
label: t,
isMarsMeasureLabel: !0,
_noMousePosition: !0,
attribute: {
unit: this.options.unit,
type: this.options.type
}
}), P.startDraw({
type: "polyline",
config: {
maxPointNum: 2
},
style: e.style || {
lineType: "arrow",
color: "#ebe967",
width: 9,
clampToGround: !0,
depthFailMaterial: new o.Color.fromCssColorString("#ebe12c").withAlpha(.4)
}
})
},
showAddPointLength: function (e) {
this.showMoveDrawing(e)
},
showRemoveLastPointLength: function (e) {
this.exLine && (this.exLine.polyline.show = !1), this.totalLable && (this.totalLable.label.show = !1)
},
showMoveDrawing: function (e) {
var t = P.getPositions(e);
if (t.length < 2) return void(this.totalLable.label.show = !1);
var i = o.Cartesian3.distance(t[0], t[1]),
r = d.getAngle(t[0], t[1]),
n = (0, p.getRotateCenterPoint)(t[0], t[1], -r);
this.updateExLine([t[0], n]), this.totalLable.position = t[1], this.totalLable.label.text = "角度:" + r + "°\n距离:" + d.formatLength(i), this.totalLable.label.show = !0, this.totalLable.attribute.value = r, this.totalLable.attribute.textEx = "角度:", this.options.calback && this.options.calback(r + "°", r)
},
updateExLine: function (e) {
this.exLine ? (this.exLine.polyline.show = !0, this.exLine.polyline.positions.setValue(e)) : this.exLine = E.entities.add({
polyline: {
positions: e,
width: 3,
clampToGround: !0,
material: new o.PolylineDashMaterialProperty({
color: o.Color.RED
})
}
})
},
showDrawEnd: function (e) {
e._totalLable = this.totalLable, this.totalLable = null, this.exLine = null
}
},
k = {
options: null,
totalLable: null,
clearLastNoEnd: function () {
_.wutu.popup.close()
},
start: function (e) {
this.options = e, P.startDraw({
type: "point",
style: e.style || {
visibleDepth: !1
}
})
},
showDrawEnd: function (e) {
var t = P.getPositions(e)[0],
i = (0, f.formatPosition)(t),
r = d.formatDegree(i.x),
n = d.formatDegree(i.y),
o = '\n ";
e.popup = {
html: o,
anchor: [0, -15]
}, _.wutu.popup.show(e)
}
};
return {
measuerLength: t,
measureHeight: n,
measureArea: r,
measureAngle: s,
measureSection: i,
measurePoint: h,
updateUnit: y,
clearMeasure: v,
formatArea: d.formatArea,
formatLength: d.formatLength,
draw: function () {
return P
},
stopDraw: m,
endDraw: g
}
};
t.Measure = m
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.MeasureVolume = void 0;
var n = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o),
s = i(1),
l = i(8),
u = i(11),
c = i(16),
h = i(3);
t.MeasureVolume = function () {
function e(t, i) {
r(this, e), this.viewer = t, i = a.defaultValue(i, {}), this._last_depthTestAgainstTerrain = this.viewer.scene.globe.depthTestAgainstTerrain, this.viewer.scene.globe.depthTestAgainstTerrain = !0, this.onStart = i.onStart, this.onStop = i.onStop, this._heightLabel = a.defaultValue(i.heightLabel, !0), this._offsetLabel = a.defaultValue(i.offsetLabel, !1);
var n = {
color: "#ffffff",
font_family: "楷体",
font_size: 20,
border: !0,
border_color: "#000000",
border_width: 3,
background: !0,
background_color: "#000000",
background_opacity: .3,
scaleByDistance: !0,
scaleByDistance_far: 8e5,
scaleByDistance_farValue: .5,
scaleByDistance_near: 1e3,
scaleByDistance_nearValue: 1,
pixelOffset: [0, -15],
visibleDepth: !1
};
if (a.defined(i.label))
for (var o in i.label) n[o] = i.label[o];
this._labelAttr = n;
var s = {
color: "#ffffff",
font_family: "楷体",
font_size: 15,
border: !0,
border_color: "#000000",
border_width: 3,
background: !1,
scaleByDistance: !0,
scaleByDistance_far: 8e5,
scaleByDistance_farValue: .5,
scaleByDistance_near: 1e3,
scaleByDistance_nearValue: 1,
pixelOffset: [0, -15],
visibleDepth: !1
};
if (a.defined(i.labelEx))
for (var o in i.labelEx) s[o] = i.labelEx[o];
this._labelHeightAttr = s;
var l = (0, h.getDefStyle)("polygon", {
color: "#00fff2",
opacity: .4
});
if (a.defined(i.polygon))
for (var o in i.polygon) l[o] = i.polygon[o];
this._polygonStyle = l;
var u = (0, h.getDefStyle)("polygon", {
color: "#00ff00",
opacity: .3
});
if (a.defined(i.polygonJzm))
for (var o in i.polygonJzm) u[o] = i.polygonJzm[o];
this._polygonJzmStyle = u, this.drawControl = new c.Draw(this.viewer, {
hasEdit: !1,
removeScreenSpaceEvent: !0
})
}
return n(e, [{
key: "startDraw",
value: function () {
this.clear(), this._polygonStyle.clampToGround = !0;
var e = this;
this.drawControl.startDraw({
type: "polygon",
style: this._polygonStyle,
success: function (t) {
if (null != t.polygon) {
var i = e.drawControl.getPositions(t);
e.onStart && e.onStart(i), setTimeout(function () {
e.start(i), e.drawControl.deleteEntity(t)
}, 500)
}
}
})
}
}, {
key: "start",
value: function (e) {
this.positions = e;
var t = this.computeCutVolume(e);
this.squareResult = t;
var i = t.maxHeight;
this.ptcenter = (0, s.centerOfMass)(e, i + 10), this._maxHeight = i, this._minHeight = t.minHeight, this.jzmHeight = t.minHeight, this.resetLabels();
var r = this.drawControl.dataSource,
n = this;
if (!this.entityPQM) {
var o = (0, u.style2Entity)(this._polygonJzmStyle, {
hierarchy: new a.PolygonHierarchy(e),
height: new a.CallbackProperty(function (e, t) {
return n.jzmHeight
}, !1)
});
delete o.perPositionHeight, this.entityPQM = r.entities.add({
polygon: o
})
}
delete this._polygonStyle.clampToGround;
var o = (0, u.style2Entity)(this._polygonStyle, {
hierarchy: new a.PolygonHierarchy(e),
extrudedHeight: new a.CallbackProperty(function (e, t) {
return n.maxHeight
}, !1),
closeTop: !1,
closeBottom: !1
});
this.entityWell = r.entities.add({
polygon: o
}), this.measureFill(t.minHeight)
}
}, {
key: "resetLabels",
value: function () {
if (this.tdLabels && this.tdLabels.length)
for (var e = 0; e < this.tdLabels.length; e++) this.drawControl.deleteEntity(this.tdLabels[e]);
if (this.heightLabel || this.offsetLabel) {
for (var t = [], e = 0, i = this.squareResult.tdHeights.length; e < i; e++) {
var r = this.squareResult.tdHeights[e],
n = "";
if (this.heightLabel && (n += "海拔:" + r.toFixed(2) + "米"), this.offsetLabel) {
var o = (this.height || 0) - r;
this.heightLabel && (n += "\n"), n += "离地:" + o.toFixed(2) + "米"
}
var s = (0, l.style2Entity)(this._labelHeightAttr, {
text: n,
horizontalOrigin: a.HorizontalOrigin.CENTER,
verticalOrigin: a.VerticalOrigin.BOTTOM
}),
u = this.drawControl.dataSource.entities.add({
position: this.squareResult.tdposs[e],
label: s
});
t.push(u)
}
this.tdLabels = t
}
}
}, {
key: "computeCutVolume",
value: function (e) {
for (var t = [], i = 0; i < e.length; i++) t.push(e[i].clone());
for (var r = 15e3, n = [], o = [], i = 0; i < t.length; i++) {
var s = a.Cartographic.fromCartesian(t[i]),
l = this.viewer.scene.globe.getHeight(s);
n.push(l), o.push(a.Cartesian3.fromRadians(s.longitude, s.latitude, l)), r > l && (r = l)
}
var u = Math.PI / Math.pow(2, 11);
u /= 64;
for (var c, h, d, f, p, m, g, v, y, _, s, w, b = new a.PolygonGeometry.fromPositions({
positions: t,
vertexFormat: a.PerInstanceColorAppearance.FLAT_VERTEX_FORMAT,
granularity: u
}), C = new a.PolygonGeometry.createGeometry(b), x = 0, P = 0, E = 0, M = [], T = [], i = 0; i < C.indices.length; i += 3) {
c = C.indices[i], h = C.indices[i + 1], d = C.indices[i + 2], _ = new a.Cartesian3(C.attributes.position.values[3 * c], C.attributes.position.values[3 * c + 1], C.attributes.position.values[3 * c + 2]), s = a.Cartographic.fromCartesian(_), f = this.viewer.scene.globe.getHeight(s), g = a.Cartesian3.fromRadians(s.longitude, s.latitude, 0), P < f && (P = f), r > f && (r = f), _ = new a.Cartesian3(C.attributes.position.values[3 * h], C.attributes.position.values[3 * h + 1], C.attributes.position.values[3 * h + 2]), s = a.Cartographic.fromCartesian(_), p = this.viewer.scene.globe.getHeight(s);
var v = a.Cartesian3.fromRadians(s.longitude, s.latitude, 0);
P < p && (P = p), r > p && (r = p), _ = new a.Cartesian3(C.attributes.position.values[3 * d], C.attributes.position.values[3 * d + 1], C.attributes.position.values[3 * d + 2]), s = a.Cartographic.fromCartesian(_), m = this.viewer.scene.globe.getHeight(s), y = a.Cartesian3.fromRadians(s.longitude, s.latitude, 0), P < m && (P = m), r > m && (r = m)
}
for (var i = 0; i < C.indices.length; i += 3) {
c = C.indices[i], h = C.indices[i + 1], d = C.indices[i + 2], _ = new a.Cartesian3(C.attributes.position.values[3 * c], C.attributes.position.values[3 * c + 1], C.attributes.position.values[3 * c + 2]), s = a.Cartographic.fromCartesian(_), f = this.viewer.scene.globe.getHeight(s), g = a.Cartesian3.fromRadians(s.longitude, s.latitude, 0), P < f && (P = f), r > f && (r = f), _ = new a.Cartesian3(C.attributes.position.values[3 * h], C.attributes.position.values[3 * h + 1], C.attributes.position.values[3 * h + 2]), s = a.Cartographic.fromCartesian(_), p = this.viewer.scene.globe.getHeight(s);
var v = a.Cartesian3.fromRadians(s.longitude, s.latitude, 0);
P < p && (P = p), r > p && (r = p), _ = new a.Cartesian3(C.attributes.position.values[3 * d], C.attributes.position.values[3 * d + 1], C.attributes.position.values[3 * d + 2]), s = a.Cartographic.fromCartesian(_), m = this.viewer.scene.globe.getHeight(s), y = a.Cartesian3.fromRadians(s.longitude, s.latitude, 0), P < m && (P = m), r > m && (r = m), w = this.computeAreaOfTriangle(g, v, y), M.push(w), E += w, x += w * (f - r + p - r + m - r) / 3, T.push([f, p, m])
}
return {
positions: t,
minHeight: r,
maxHeight: P,
totalCutVolume: x,
sjareas: M,
heightArr: T,
tdHeights: n,
tdposs: o,
totalBottomArea: E
}
}
}, {
key: "computeAreaOfTriangle",
value: function (e, t, i) {
var r = a.Cartesian3.distance(e, t),
n = a.Cartesian3.distance(t, i),
o = a.Cartesian3.distance(i, e),
s = (r + n + o) / 2;
return Math.sqrt(s * (s - r) * (s - n) * (s - o))
}
}, {
key: "formatNum",
value: function (e) {
return e > 1e4 ? (e / 1e4).toFixed(2) + "万" : e.toFixed(2)
}
}, {
key: "measureFill",
value: function (e) {
var t = this.fillVolume(e);
if (t && this.ptcenter) {
var i = this.drawControl.dataSource;
this.entitieLbl && i.entities.remove(this.entitieLbl);
var r = "";
t.fill > 0 && (r += "填方体积:" + this.formatNum(t.fill) + "立方米"), t.dig > 0 && (t.fill > 0 && (r += "\n"), r += "挖方体积:" + this.formatNum(t.dig) + "立方米");
var n = (0, l.style2Entity)(this._labelAttr, {
text: r,
horizontalOrigin: a.HorizontalOrigin.CENTER,
verticalOrigin: a.VerticalOrigin.BOTTOM
});
this.entitieLbl = i.entities.add({
position: this.ptcenter,
label: n
}), this.onStop && this.onStop()
}
}
}, {
key: "fillVolume",
value: function (e) {
if (this.squareResult) {
for (var t = 0, i = 0, r = this.squareResult.sjareas, n = this.squareResult.heightArr, o = r.length, a = this.squareResult.minHeight, s = 0; s < o; s++) {
var l = n[s][0],
u = n[s][1],
c = n[s][2];
l > e && (l = e), u > e && (u = e), c > e && (c = e), !l && 0 != l || !u && 0 != u || !c && 0 != c || (t += r[s] * (l - a + u - a + c - a) / 3, i += r[s] * (e - a))
}
if (e < a) var h = 0;
else var h = i - t;
return {
fill: h,
dig: this.squareResult.totalCutVolume - t
}
}
}
}, {
key: "clear",
value: function () {
this.drawControl.clearDraw(), this.entitieLbl && this.drawControl.dataSource.entities.remove(this.entitieLbl), this.entityPQM && this.drawControl.dataSource.entities.remove(this.entityPQM), this.entityWell && this.drawControl.dataSource.entities.remove(this.entityWell), delete this.entitieLbl, delete this.entityPQM, delete this.entityWell
}
}, {
key: "resetFillV",
value: function () {
var e = this.fillVolume(this.jzmHeight),
t = this.drawControl.dataSource;
this.entitieLbl && t.entities.remove(this.entitieLbl);
var i = "";
e.fill > 0 && (i += "填方体积:" + this.formatNum(e.fill) + "立方米\n"), e.dig > 0 && (i += "挖方体积:" + this.formatNum(e.dig) + "立方米");
var r = (0, l.style2Entity)(this._labelAttr, {
text: i,
horizontalOrigin: a.HorizontalOrigin.CENTER,
verticalOrigin: a.VerticalOrigin.BOTTOM
});
this.entitieLbl = t.entities.add({
position: this.ptcenter,
label: r
})
}
}, {
key: "selecteHeight",
value: function () {
if (this.entityPQM && this.entityWell) {
var e = this;
this.drawControl.startDraw({
type: "point",
style: {
color: "#00fff2"
},
success: function (t) {
if (t.point) {
var i = t._position._value,
r = a.Cartographic.fromCartesian(i).height;
e.height = r, e.drawControl.dataSource.entities.remove(t)
}
}
})
}
}
}, {
key: "destroy",
value: function () {
this.viewer.scene.globe.depthTestAgainstTerrain = this._last_depthTestAgainstTerrain, this.clear(), this.drawControl.destroy(), delete this.viewer, delete this.jzmHeight, delete this.drawControl, delete this.squareResult, delete this.ptcenter, delete this.positions, delete this.onStop, delete this._last_depthTestAgainstTerrain
}
}, {
key: "height",
get: function () {
return this.jzmHeight
},
set: function (e) {
this.jzmHeight = e, e > this.maxHeight && (this.maxHeight = e), this.entityPQM && this.entityWell && (this.resetFillV(), this.measureFill(e), this.resetLabels())
}
}, {
key: "minHeight",
get: function () {
return this._minHeight
},
set: function (e) {
this._minHeight = e, this.squareResult && (this.squareResult.minHeight = e)
}
}, {
key: "maxHeight",
get: function () {
return this._maxHeight
},
set: function (e) {
this._maxHeight = e, this.squareResult && (this.squareResult.maxHeight = e)
}
}, {
key: "heightLabel",
get: function () {
return this._heightLabel
},
set: function (e) {
this._heightLabel = e, this.resetLabels()
}
}, {
key: "offsetLabel",
get: function () {
return this._offsetLabel
},
set: function (e) {
this._offsetLabel = e, this.resetLabels()
}
}]), e
}()
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.Skyline = void 0;
var n = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o),
s = i(114),
l = function (e) {
return e && e.__esModule ? e : {
default: e
}
}(s);
t.Skyline = function () {
function e(t, i) {
r(this, e), i || (i = {});
var n = {
tjxWidth: 2,
strokeType: new a.Cartesian3(!0, !1, !1),
tjxColor: new a.Color(1, 0, 0),
bjColor: new a.Color(0, 0, 1),
mbDis: 500
};
this.viewer = t, this.tjxWidth = a.defaultValue(i.tjxWidth, n.tjxWidth), this.strokeType = a.defaultValue(i.strokeType, n.strokeType), this.tjxColor = a.defaultValue(i.tjxColor, n.tjxColor), this.bjColor = a.defaultValue(i.bjColor, n.bjColor), this.mbDis = a.defaultValue(i.mbDis, n.mbDis), this.init()
}
return n(e, [{
key: "init",
value: function () {
this.addPostStage()
}
}, {
key: "addPostStage",
value: function () {
var e = this;
this.postProcess = new a.PostProcessStage({
fragmentShader: l.default,
uniforms: {
height: function () {
return a.Cartographic.fromCartesian(e.viewer.scene.camera.position).height
},
lineWidth: function () {
return e.tjxWidth
},
strokeType: function () {
return e.strokeType
},
tjxColor: function () {
return e.tjxColor
},
bjColor: function () {
return e.bjColor
},
cameraPos: function () {
return e.viewer.scene.camera.position
},
mbDis: function () {
return e.mbDis
}
}
}), this.viewer.scene.postProcessStages.add(this.postProcess)
}
}, {
key: "destroy",
value: function () {
this.viewer.scene.postProcessStages.remove(this.postProcess), delete this.viewer, delete this.tjxWidth, delete this.strokeType, delete this.tjxColor, delete this.bjColor, delete this.mbDis, delete this.postProcess
}
}]), e
}()
}, function (e, t) {
e.exports = "#extension GL_OES_standard_derivatives : enable\r\nuniform sampler2D colorTexture;\r\nuniform sampler2D depthTexture;\r\nuniform float lineWidth;\r\nuniform float height;\r\nuniform bvec3 strokeType;\r\nuniform vec3 tjxColor;\r\nuniform vec3 bjColor;\r\nuniform vec3 cameraPos;\r\nuniform float mbDis;\r\nvarying vec2 v_textureCoordinates;\r\nvec4 toEye(in vec2 uv, in float depth){\r\n vec2 xy = vec2((uv.x * 2.0 - 1.0),(uv.y * 2.0 - 1.0));\r\n vec4 posInCamera =czm_inverseProjection * vec4(xy, depth, 1.0);\r\n posInCamera =posInCamera / posInCamera.w;\r\n return posInCamera;\r\n}\r\nfloat getDepth(in vec4 depth){\r\n float z_window = czm_unpackDepth(depth);\r\n z_window = czm_reverseLogDepth(z_window);\r\n float n_range = czm_depthRange.near;\r\n float f_range = czm_depthRange.far;\r\n return (2.0 * z_window - n_range - f_range) / (f_range - n_range);\r\n}\r\nbool isTJX(vec2 uv,float lw){\r\n vec2 pixelSize = lw / czm_viewport.zw;\r\n float dx0 = -pixelSize.x;\r\n float dy0 = -pixelSize.y;\r\n float dx1 = pixelSize.x;\r\n float dy1 = pixelSize.y;\r\n\r\n vec2 currUV = uv + vec2(dx0, dy0);\r\n vec4 currDepth = texture2D(depthTexture, currUV);\r\n float depth = getDepth(currDepth);\r\n if(depth>=1.0)return true;\r\n\r\n currUV = uv + vec2(0.0, dy0);\r\n currDepth = texture2D(depthTexture, currUV);\r\n depth = getDepth(currDepth);\r\n if(depth>=1.0)return true;\r\n\r\n currUV = uv + vec2(dx1, dy0);\r\n currDepth = texture2D(depthTexture, currUV);\r\n depth = getDepth(currDepth);\r\n if(depth>=1.0)return true;\r\n\r\n currUV = uv + vec2(dx0, 0.0);\r\n currDepth = texture2D(depthTexture, currUV);\r\n depth = getDepth(currDepth);\r\n if(depth>=1.0)return true;\r\n\r\n currUV = uv + vec2(dx1, 0.0);\r\n currDepth = texture2D(depthTexture, currUV);\r\n depth = getDepth(currDepth);\r\n if(depth>=1.0)return true;\r\n\r\n currUV = uv + vec2(dx0, dy1);\r\n currDepth = texture2D(depthTexture, currUV);\r\n depth = getDepth(currDepth);\r\n if(depth>=1.0)return true;\r\n\r\n currUV = uv + vec2(0.0, dy1);\r\n currDepth = texture2D(depthTexture, currUV);\r\n depth = getDepth(currDepth);\r\n if(depth>=1.0)return true;\r\n\r\n currUV = uv + vec2(dx1, dy1);\r\n currDepth = texture2D(depthTexture, currUV);\r\n depth = getDepth(currDepth);\r\n if(depth>=1.0)return true;\r\n\r\n return false;\r\n}\r\nvoid main(){\r\n\r\n\r\n vec4 color = texture2D(colorTexture, v_textureCoordinates);\r\n if(height>14102.0){\r\n gl_FragColor = color;\r\n return;\r\n }\r\n vec4 currD = texture2D(depthTexture, v_textureCoordinates);\r\n if(currD.r>=1.0){\r\n gl_FragColor = color;\r\n return;\r\n }\r\n float depth = getDepth(currD);\r\n vec4 positionEC = toEye(v_textureCoordinates, depth);\r\n vec3 dx = dFdx(positionEC.xyz);\r\n vec3 dy = dFdy(positionEC.xyz);\r\n vec3 normal = normalize(cross(dx,dy));\r\n\r\n if(strokeType.y||strokeType.z){\r\n vec4 wp = czm_inverseView * positionEC;\r\n if(distance(wp.xyz,cameraPos)>mbDis){\r\n gl_FragColor = color;\r\n }else{\r\n float dotNum = abs(dot(normal,normalize(positionEC.xyz)));\r\n if(dotNum<0.05){\r\n gl_FragColor = vec4(bjColor,1.0);\r\n return;\r\n }\r\n }\r\n }\r\n if(strokeType.x||strokeType.z){\r\n bool tjx = isTJX(v_textureCoordinates,lineWidth);\r\n if(tjx){\r\n gl_FragColor = vec4(tjxColor,1.0);\r\n return;\r\n }\r\n }\r\n gl_FragColor = color;\r\n}"
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.TerrainClip = void 0;
var n = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o),
s = i(56),
l = i(57);
t.TerrainClip = function () {
function e(t, i) {
if (r(this, e), t) {
this.viewer = t, i = i || {}, this.viewer.scene.highDynamicRange || (this.viewer.scene.highDynamicRange = !0, this._hasChangeHighDynamicRange = !0);
var n = a.clone(a.ExpandByMars._defaultExcavateAnalysis);
this._positions = a.defaultValue(i.positions, a.clone(n.positions)), this.bottomImg = a.defaultValue(i.bottomImg, a.clone(n.bottomImg)), this.wallImg = a.defaultValue(i.wallImg, a.clone(n.wallImg)), this.splitNum = a.defaultValue(i.splitNum, a.clone(n.splitNum)), this.excavateDig = a.defaultValue(i.excavateDig, a.clone(n.excavateDig)), this.dig_pos_x = a.defaultValue(i.dig_pos_x, a.clone(n.dig_pos_x)), this.dig_pos_y = a.defaultValue(i.dig_pos_y, a.clone(n.dig_pos_y)), this.dig_pos_z = a.defaultValue(i.dig_pos_z, a.clone(n.dig_pos_z)), this.rect_dig = a.defaultValue(i.rect_dig, a.clone(n.rect_dig)), this.excavateMinHeight = a.defaultValue(i.excavateMinHeight, a.clone(n.excavateMinHeight)), this.excavatePerPoint = a.defaultValue(i.excavatePerPoint, a.clone(n.excavatePerPoint)), this.dig_max_index = a.defaultValue(i.dig_max_index, a.clone(n.dig_max_index)), this.defaultShowSelfOnly = a.defaultValue(i.showSelfOnly, a.clone(n.showSelfOnly)), this._height = a.defaultValue(i.height, a.clone(n.excavateHeight)), this.defaultShow = a.defaultValue(i.show, !0), this.defaultBoundingSwell = a.defaultValue(i.boundingSwell, 20), this._showWall = a.defaultValue(i.wall, !0), this._init()
}
}
return n(e, [{
key: "_init",
value: function () {
this._positions && 0 != this._positions.length && (this._startExcavate(this._positions), this.viewer.scene.globe.material = a.Material.fromType("WaJue"), this.viewer.scene.globe.depthTestAgainstTerrain = !0, this._effectExcavate())
}
}, {
key: "setPositions",
value: function (e) {
e && 0 != e.length && (this._startExcavate(e), this.viewer.scene.globe.material = a.Material.fromType("WaJue"), this.viewer.scene.globe.depthTestAgainstTerrain = !0, this._effectExcavate())
}
}, {
key: "_prepareWell",
value: function (e) {
var t = this.splitNum,
i = e.length;
if (0 != i) {
var r = this.excavateMinHeight - this.height;
this.targetHeight = r;
for (var n = [], o = [], s = [], l = 0; l < i; l++)
for (var u = l == i - 1 ? 0 : l + 1, c = a.Cartographic.fromCartesian(e[l]), h = a.Cartographic.fromCartesian(e[u]), d = [c.longitude, c.latitude], f = [h.longitude, h.latitude], p = 0; p < t; p++) {
var m = a.Math.lerp(d[0], f[0], p / t),
g = a.Math.lerp(d[1], f[1], p / t);
s.push(new a.Cartographic(m, g)), o.push(a.Cartesian3.fromRadians(m, g, r)), n.push(a.Cartesian3.fromRadians(m, g, 0))
}
this.wellData = {
lerp_pos: s,
bottom_pos: o,
no_height_top: n
}
}
}
}, {
key: "_createWell",
value: function (e) {
if (Boolean(this.viewer.terrainProvider._layers)) {
var t = this;
this._createBottomSurface(e.bottom_pos);
var i = a.sampleTerrainMostDetailed(this.viewer.terrainProvider, e.lerp_pos),
r = -9999;
a.when(i, function (i) {
for (var n = i.length, o = [], s = [], l = 0; l < n; l++) {
s.push(i[l].height), i[l].height > r && (r = i[l].height);
var u = a.Cartesian3.fromRadians(i[l].longitude, i[l].latitude, i[l].height);
o.push(u)
}
t.maxHeight = r, t.top_heights = s, t._createWellWall(e.bottom_pos, o), t.viewer.scene.primitives.add(t.wellWall)
})
} else this._createBottomSurface(e.bottom_pos), this._createWellWall(e.bottom_pos, e.no_height_top), this.viewer.scene.primitives.add(this.wellWall)
}
}, {
key: "_createWellWall",
value: function (e, t) {
var i = new l.WellNoBottom({
minimumArr: e,
maximumArr: t
});
i = i.createGeometry(i, this);
var r = new a.Material({
fabric: {
type: "Image",
uniforms: {
image: this.wallImg
}
}
}),
n = new a.MaterialAppearance({
translucent: !1,
flat: !0,
material: r
});
this.wellWall = new a.Primitive({
geometryInstances: new a.GeometryInstance({
geometry: i,
attributes: {
color: a.ColorGeometryInstanceAttribute.fromColor(a.Color.GREY)
},
id: "PitWall"
}),
appearance: n,
asynchronous: !1
})
}
}, {
key: "_createBottomSurface",
value: function (e) {
if (e.length) {
var t = new s.CustomPlaneGeometry({
pos_arr: e
});
t = t.createGeometry(t);
var i = new a.Material({
fabric: {
type: "Image",
uniforms: {
image: this.bottomImg
}
}
}),
r = new a.MaterialAppearance({
translucent: !1,
flat: !0,
material: i
});
this.bottomSurface = new a.Primitive({
geometryInstances: new a.GeometryInstance({
geometry: t
}),
appearance: r,
asynchronous: !1
})
}
}
}, {
key: "_prepareExcavate",
value: function (e) {
var t = e.length;
if (0 != t) {
this.dig_max_index = t;
for (var i = 99999999, r = 99999999, n = 99999999, o = -99999999, s = -99999999, l = -99999999, u = 0; u < t; u++)
if (e[u]) {
this.dig_pos_x[u] = e[u].x, this.dig_pos_y[u] = e[u].y, this.dig_pos_z[u] = e[u].z;
var c = a.Cartographic.fromCartesian(e[u]);
this.excavateMinHeight = this.excavateMinHeight > c.height ? c.height : this.excavateMinHeight, e[u].x > o && (o = e[u].x), e[u].x < i && (i = e[u].x), e[u].y > s && (s = e[u].y), e[u].y < r && (r = e[u].y), e[u].z > l && (l = e[u].z), e[u].z < n && (n = e[u].z)
} else this.dig_pos_x[u] = 0, this.dig_pos_y[u] = 0, this.dig_pos_z[u] = 0;
var h = this.boundingSwell;
this._base_rect = this.rect_dig = [i - h, r - h, n - h, o + h, s + h, l + h, 0, 0, 0]
}
}
}, {
key: "_startExcavate",
value: function (e) {
if (this.viewer.scene.globe.material = a.Material.fromType("WaJue"), this._prepareExcavate(e), this._showWall) {
if (this._prepareWell(e), !this.wellData) return;
this._createWell(this.wellData)
}
}
}, {
key: "_updateExcavateDepth",
value: function (e) {
if (void 0 != e && null != e) {
this.bottomSurface && this.viewer.scene.primitives.remove(this.bottomSurface), this.wellWall && this.viewer.scene.primitives.remove(this.wellWall);
for (var t = this.wellData.lerp_pos, i = [], r = t.length, n = 0; n < r; n++) i.push(a.Cartesian3.fromRadians(t[n].longitude, t[n].latitude, this.excavateMinHeight - e));
this.wellData.bottom_pos = i, this._createWell(this.wellData), this.bottomSurface && this.viewer.scene.primitives.add(this.bottomSurface), this.wellWall && this.viewer.scene.primitives.add(this.wellWall)
}
}
}, {
key: "_effectExcavate",
value: function () {
a.ExpandByMars.excavateAnalysis.dig_pos_x = this.dig_pos_x, a.ExpandByMars.excavateAnalysis.dig_pos_y = this.dig_pos_y, a.ExpandByMars.excavateAnalysis.dig_pos_z = this.dig_pos_z, a.ExpandByMars.excavateAnalysis.excavateDig = this.excavateDig, a.ExpandByMars.excavateAnalysis.dig_max_index = this.dig_max_index, a.ExpandByMars.excavateAnalysis.showSelfOnly = this.showSelfOnly, a.ExpandByMars.excavateAnalysis.rect_dig = this.rect_dig, this.bottomSurface && this.viewer.scene.primitives.add(this.bottomSurface)
}
}, {
key: "_switchShow",
value: function (e) {
e ? (this.viewer.scene.globe.material = a.Material.fromType("WaJue"), this._showWall && (this.wellWall.show = !0, this.bottomSurface.show = !0)) : (this.viewer.scene.globe.material = null, this._showWall && (this.wellWall.show = !1, this.bottomSurface.show = !1))
}
}, {
key: "destroy",
value: function () {
this._hasChangeHighDynamicRange && (this.viewer.scene.highDynamicRange = !1, this._hasChangeHighDynamicRange = !1), this.viewer.scene.globe.material = null, a.ExpandByMars.resetExcavateAnalysis(), this.bottomSurface && (this.viewer.scene.primitives.remove(this.bottomSurface), delete this.bottomSurface), this.wellWall && (this.wellWall && this.viewer.scene.primitives.remove(this.wellWall), delete this.wellWall), delete this.viewer, delete this._positions, delete this.bottomImg, delete this.wallImg, delete this.dig_pos_x, delete this.dig_pos_y, delete this.dig_pos_z, delete this.dig_max_index, delete this.excavatePerPoint, delete this.splitNum, delete this.excavateDig, delete this.rect_dig, delete this._height, delete this.defaultShow, delete this.defaultShowSelfOnly, delete this.excavateMinHeight, delete this.wellData, delete this._base_rect
}
}, {
key: "showSelfOnly",
get: function () {
return this.defaultShowSelfOnly
},
set: function (e) {
this.defaultShowSelfOnly = e, a.ExpandByMars.excavateAnalysis.showSelfOnly = e
}
}, {
key: "height",
get: function () {
return this._height
},
set: function (e) {
this._height = e, this._showWall && this._updateExcavateDepth(e)
}
}, {
key: "show",
get: function () {
return this.defaultShow
},
set: function (e) {
this.defaultShow = Boolean(e), this._switchShow(Boolean(e))
}
}, {
key: "boundingSwell",
get: function () {
return this.defaultBoundingSwell
},
set: function (e) {
var t = this._base_rect;
this.defaultBoundingSwell = Number(e), this.rect_dig = [t[0] - this.boundingSwell, t[1] - this.boundingSwell, t[2] - this.boundingSwell, t[3] + this.boundingSwell, t[4] + this.boundingSwell, t[5] + this.boundingSwell, 0, 0, 0], a.ExpandByMars.excavateAnalysis.rect_dig = this.rect_dig
}
}]), e
}()
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.TerrainClipPlan = void 0;
var n = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o),
s = i(56),
l = i(57),
u = i(2);
t.TerrainClipPlan = function () {
function e(t, i) {
r(this, e), this.viewer = t, this.options = i || {}, this._positions = i.positions, this._height = this.options.height || 0, this._showWall = a.defaultValue(i.wall, !0), this.bottomImg = i.bottomImg, this.wallImg = i.wallImg, this.splitNum = a.defaultValue(i.splitNum, 50), this._positions && this._positions.length > 0 && this.updateData(this._positions)
}
return n(e, [{
key: "updateData",
value: function (e) {
if (this.clear(), !e || e.length < 3) return void console.log("挖地坐标数据存在问题!");
var t = [],
i = e.length,
r = (0, u.getAngle)(e[0], e[1]),
n = (0, u.getAngle)(e[0], e[2]),
o = r < n;
this.excavateMinHeight = 9999;
for (var s = 0; s < i; ++s) {
var l = (s + 1) % i,
c = a.Cartesian3.midpoint(e[s], e[l], new a.Cartesian3),
h = a.Cartographic.fromCartesian(e[s]),
d = this.viewer.scene.globe.getHeight(h) || h.height;
d < this.excavateMinHeight && (this.excavateMinHeight = d);
var f, p = a.Cartesian3.normalize(c, new a.Cartesian3);
f = o ? a.Cartesian3.subtract(e[s], c, new a.Cartesian3) : a.Cartesian3.subtract(e[l], c, new a.Cartesian3), f = a.Cartesian3.normalize(f, f);
var m = a.Cartesian3.cross(f, p, new a.Cartesian3);
m = a.Cartesian3.normalize(m, m);
var g = new a.Plane(m, 0),
v = a.Plane.getPointDistance(g, c);
t.push(new a.ClippingPlane(m, v))
}
this.viewer.scene.globe.clippingPlanes = new a.ClippingPlaneCollection({
planes: t,
edgeWidth: 1,
edgeColor: a.Color.WHITE,
enabled: !0
}), this._showWall && (this._prepareWell(e), this._createWell(this.wellData))
}
}, {
key: "clear",
value: function () {
this.viewer.scene.globe.clippingPlanes && (this.viewer.scene.globe.clippingPlanes.enabled = !1, this.viewer.scene.globe.clippingPlanes.removeAll(), this.viewer.scene.globe.clippingPlanes.isDestroyed() || this.viewer.scene.globe.clippingPlanes.destroy()), this.viewer.scene.globe.clippingPlanes = void 0, this.bottomSurface && this.viewer.scene.primitives.remove(this.bottomSurface), this.wellWall && this.viewer.scene.primitives.remove(this.wellWall), delete this.bottomSurface, delete this.wellWall, delete this.wellData, this.viewer.scene.render()
}
}, {
key: "destroy",
value: function () {
this.clear()
}
}, {
key: "_prepareWell",
value: function (e) {
var t = this.splitNum,
i = e.length;
if (0 != i) {
var r = this.excavateMinHeight - this.height;
this.targetHeight = r;
for (var n = [], o = [], s = [], l = 0; l < i; l++)
for (var u = l == i - 1 ? 0 : l + 1, c = a.Cartographic.fromCartesian(e[l]), h = a.Cartographic.fromCartesian(e[u]), d = [c.longitude, c.latitude], f = [h.longitude, h.latitude], p = 0; p < t; p++) {
var m = a.Math.lerp(d[0], f[0], p / t),
g = a.Math.lerp(d[1], f[1], p / t);
s.push(new a.Cartographic(m, g)), o.push(a.Cartesian3.fromRadians(m, g, r)), n.push(a.Cartesian3.fromRadians(m, g, 0))
}
this.wellData = {
lerp_pos: s,
bottom_pos: o,
no_height_top: n
}
}
}
}, {
key: "_createWell",
value: function (e) {
if (Boolean(this.viewer.terrainProvider._layers)) {
var t = this;
this._createBottomSurface(e.bottom_pos);
var i = a.sampleTerrainMostDetailed(this.viewer.terrainProvider, e.lerp_pos),
r = -9999;
a.when(i, function (i) {
for (var n = i.length, o = [], s = [], l = 0; l < n; l++) {
s.push(i[l].height), i[l].height > r && (r = i[l].height);
var u = a.Cartesian3.fromRadians(i[l].longitude, i[l].latitude, i[l].height);
o.push(u)
}
t.maxHeight = r, t.top_heights = s, t._createWellWall(e.bottom_pos, o), t.viewer.scene.primitives.add(t.wellWall)
})
} else this._createBottomSurface(e.bottom_pos), this._createWellWall(e.bottom_pos, e.no_height_top), this.viewer.scene.primitives.add(this.wellWall)
}
}, {
key: "_createWellWall",
value: function (e, t) {
var i = new l.WellNoBottom({
minimumArr: e,
maximumArr: t
});
i = i.createGeometry(i, this);
var r = new a.Material({
fabric: {
type: "Image",
uniforms: {
image: this.wallImg
}
}
}),
n = new a.MaterialAppearance({
translucent: !1,
flat: !0,
material: r
});
this.wellWall = new a.Primitive({
geometryInstances: new a.GeometryInstance({
geometry: i,
attributes: {
color: a.ColorGeometryInstanceAttribute.fromColor(a.Color.GREY)
},
id: "PitWall"
}),
appearance: n,
asynchronous: !1
}), this.viewer.scene.primitives.add(this.wellWall)
}
}, {
key: "_createBottomSurface",
value: function (e) {
if (e.length) {
var t = new s.CustomPlaneGeometry({
pos_arr: e
});
t = t.createGeometry(t);
var i = new a.Material({
fabric: {
type: "Image",
uniforms: {
image: this.bottomImg
}
}
}),
r = new a.MaterialAppearance({
translucent: !1,
flat: !0,
material: i
});
this.bottomSurface = new a.Primitive({
geometryInstances: new a.GeometryInstance({
geometry: t
}),
appearance: r,
asynchronous: !1
}), this.viewer.scene.primitives.add(this.bottomSurface)
}
}
}, {
key: "_switchExcavate",
value: function (e) {
e ? (this.wellWall && (this.wellWall.show = !0), this.bottomSurface && (this.bottomSurface.show = !0)) : (this.wellWall && (this.wellWall.show = !1), this.bottomSurface && (this.bottomSurface.show = !1))
}
}, {
key: "_updateExcavateDepth",
value: function (e) {
if (this.wellData) {
this.bottomSurface && this.viewer.scene.primitives.remove(this.bottomSurface), this.wellWall && this.viewer.scene.primitives.remove(this.wellWall);
for (var t = this.wellData.lerp_pos, i = [], r = t.length, n = 0; n < r; n++) i.push(a.Cartesian3.fromRadians(t[n].longitude, t[n].latitude, this.excavateMinHeight - e));
this.wellData.bottom_pos = i, this._createWell(this.wellData), this.viewer.scene.primitives.add(this.bottomSurface), this.viewer.scene.primitives.add(this.wellWall)
}
}
}, {
key: "show",
get: function () {
return this._show
},
set: function (e) {
this._show = e, this.viewer.scene.globe.clippingPlanes && (this.viewer.scene.globe.clippingPlanes.enabled = e), this._showWall && this._switchExcavate(e)
}
}, {
key: "height",
get: function () {
return this._height
},
set: function (e) {
this._height = e, this._showWall && this._updateExcavateDepth(e)
}
}]), e
}()
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.Underground = void 0;
var n = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o);
t.Underground = function () {
function e(t, i) {
r(this, e), this.viewer = t;
var n = a.defaultValue(i, {});
this._depth = a.defaultValue(n.depth, 500), this._alpha = a.defaultValue(n.alpha, .5), this.enable = a.defaultValue(n.enable, !1)
}
return n(e, [{
key: "_updateImageryLayersAlpha",
value: function (e) {
for (var t = this.viewer.imageryLayers._layers, i = 0, r = t.length; i < r; i++) t[i].alpha = e
}
}, {
key: "_historyOpts",
value: function () {
var e = {};
e.alpha = a.clone(this.viewer.imageryLayers._layers[0] && this.viewer.imageryLayers._layers[0].alpha), e.highDynamicRange = a.clone(this.viewer.scene.highDynamicRange), e.skyShow = a.clone(this.viewer.scene.skyAtmosphere.show), e.skyBoxShow = a.clone(this.viewer.scene.skyBox.show), e.depthTest = a.clone(this.viewer.scene.globe.depthTestAgainstTerrain), this.viewer.scene.globe._surface && this.viewer.scene.globe._surface._tileProvider && this.viewer.scene.globe._surface._tileProvider._renderState && (e.blending = a.clone(this.viewer.scene.globe._surface._tileProvider._renderState.blending)), this._oldViewOpts = e
}
}, {
key: "activate",
value: function () {
if (!this._enable) {
this._enable = !0, this._historyOpts(), this._updateImageryLayersAlpha(this._alpha);
var e = this.viewer;
a.ExpandByMars.underEarth.cullFace = !1, a.ExpandByMars.underEarth.enable = !0, a.ExpandByMars.underEarth.enableDepth = this._depth, a.ExpandByMars.underEarth.enableSkirt = !0, e.scene.globe.depthTestAgainstTerrain = !0, e.scene.highDynamicRange = !1, e.scene.skyAtmosphere.show = !1, e.scene.skyBox.show = !1, e.scene.globe._surface._tileProvider && e.scene.globe._surface._tileProvider._renderState && e.scene.globe._surface._tileProvider._renderState.blending && (e.scene.globe._surface._tileProvider._renderState.blending.enabled = !0, e.scene.globe._surface._tileProvider._renderState.blending.equationRgb = a.BlendEquation.ADD, e.scene.globe._surface._tileProvider._renderState.blending.equationAlpha = a.BlendEquation.ADD, e.scene.globe._surface._tileProvider._renderState.blending.functionSourceAlpha = a.BlendFunction.ONE, e.scene.globe._surface._tileProvider._renderState.blending.functionSourceRgb = a.BlendFunction.ONE, e.scene.globe._surface._tileProvider._renderState.blending.functionDestinationAlpha = a.BlendFunction.ZERO, e.scene.globe._surface._tileProvider._renderState.blending.functionDestinationRgb = a.BlendFunction.ZERO)
}
}
}, {
key: "disable",
value: function () {
if (this._enable) {
this._enable = !1, this._updateImageryLayersAlpha(this._oldViewOpts.alpha);
var e = this.viewer;
a.ExpandByMars.underEarth.cullFace = void 0, a.ExpandByMars.underEarth.enable = !1, a.ExpandByMars.underEarth.enableDepth = 0, a.ExpandByMars.underEarth.enableSkirt = !1, e.scene.globe.depthTestAgainstTerrain = this._oldViewOpts.depthTest, e.scene.skyBox.show = this._oldViewOpts.skyBoxShow, e.scene.highDynamicRange = this._oldViewOpts.highDynamicRange, e.scene.skyAtmosphere.show = this._oldViewOpts.skyShow, void 0 != this._oldViewOpts.blending && (e.scene.globe._surface._tileProvider._renderState.blending = this._oldViewOpts.blending)
}
}
}, {
key: "destroy",
value: function () {
this.disable(), delete this.viewer, delete this._alpha, delete this._depth, delete this._enable, delete this._oldViewOpts
}
}, {
key: "alpha",
get: function () {
return this._alpha
},
set: function (e) {
this._alpha = Number(e), this._enable && this._updateImageryLayersAlpha(this._alpha)
}
}, {
key: "depth",
get: function () {
return this._depth
},
set: function (e) {
this._depth = Number(e), this._enable && (a.ExpandByMars.underEarth.enableDepth = this._depth)
}
}, {
key: "enable",
get: function () {
return this._enable
},
set: function (e) {
e ? this.activate() : this.disable()
}
}]), e
}()
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.ViewShed3D = void 0;
var n = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o),
s = i(119),
l = function (e) {
return e && e.__esModule ? e : {
default: e
}
}(s),
u = i(58),
c = i(1),
h = {
cameraPosition: null,
viewPosition: null,
horizontalAngle: 120,
verticalAngle: 90,
visibleAreaColor: new a.Color(0, 1, 0),
hiddenAreaColor: new a.Color(1, 0, 0),
alpha: .5,
distance: 100,
frustum: !0,
show: !0
};
t.ViewShed3D = function () {
function e(t, i) {
r(this, e), t && (i || (i = {}), this.viewer = t, this.cameraPosition = a.defaultValue(i.cameraPosition, h.cameraPosition), this.viewPosition = a.defaultValue(i.viewPosition, h.viewPosition), this._horizontalAngle = a.defaultValue(i.horizontalAngle, h.horizontalAngle), this._verticalAngle = a.defaultValue(i.verticalAngle, h.verticalAngle), this._visibleAreaColor = a.defaultValue(i.visibleAreaColor, h.visibleAreaColor), this._hiddenAreaColor = a.defaultValue(i.hiddenAreaColor, h.hiddenAreaColor), this._alpha = a.defaultValue(i.alpha, h.alpha), this._distance = a.defaultValue(i.distance, h.distance), this._frustum = a.defaultValue(i.frustum, h.frustum), this.calback = i.calback, this.defaultShow = a.defaultValue(i.show, !0), this.viewer.terrainShadows = a.ShadowMode.ENABLED, this._defaultColorTexture = new a.Texture({
context: this.viewer.scene.context,
source: {
width: 1,
height: 1,
arrayBufferView: new Uint8Array([0, 0, 0, 0])
},
flipY: !1
}), this.cameraPosition && this.viewPosition ? (this._addToScene(), this.calback && this.calback(this._distance, this)) : this._bindMourseEvent())
}
return n(e, [{
key: "_bindMourseEvent",
value: function () {
var e = this,
t = this.viewer,
i = new a.ScreenSpaceEventHandler(this.viewer.scene.canvas);
i.setInputAction(function (i) {
var r = (0, c.getCurrentMousePosition)(t.scene, i.position);
r && (e.cameraPosition ? e.cameraPosition && !e.viewPosition && (e.viewPosition = r, e._addToScene(), e._unbindMourseEvent(), e.calback && e.calback(e._distance, e)) : e.cameraPosition = r)
}, a.ScreenSpaceEventType.LEFT_CLICK), i.setInputAction(function (i) {
var r = (0, c.getCurrentMousePosition)(t.scene, i.endPosition);
if (r) {
var n = e.cameraPosition;
n && (e.frustumQuaternion = e.getFrustumQuaternion(n, r), e.distance = Number(a.Cartesian3.distance(n, r).toFixed(1)))
}
}, a.ScreenSpaceEventType.MOUSE_MOVE), this._handler = i
}
}, {
key: "_unbindMourseEvent",
value: function () {
null != this._handler && (this._handler.destroy(), delete this._handler)
}
}, {
key: "_addToScene",
value: function () {
this.frustumQuaternion = this.getFrustumQuaternion(this.cameraPosition, this.viewPosition), this._createShadowMap(this.cameraPosition, this.viewPosition), this._addPostProcess(), !this.radar && this.addRadar(this.cameraPosition, this.frustumQuaternion), this.viewer.scene.primitives.add(this)
}
}, {
key: "_createShadowMap",
value: function (e, t, i) {
var r = e,
n = t,
o = this.viewer.scene,
s = new a.Camera(o);
s.position = r, s.direction = a.Cartesian3.subtract(n, r, new a.Cartesian3(0, 0, 0)), s.up = a.Cartesian3.normalize(r, new a.Cartesian3(0, 0, 0));
var l = Number(a.Cartesian3.distance(n, r).toFixed(1));
this.distance = l, s.frustum = new a.PerspectiveFrustum({
fov: a.Math.toRadians(120),
aspectRatio: o.canvas.clientWidth / o.canvas.clientHeight,
near: .1,
far: 5e3
});
this.viewShadowMap = new a.ShadowMap({
lightCamera: s,
enable: !1,
isPointLight: !1,
isSpotLight: !0,
cascadesEnabled: !1,
context: o.context,
pointLightRadius: l
})
}
}, {
key: "getFrustumQuaternion",
value: function (e, t) {
var i = a.Cartesian3.normalize(a.Cartesian3.subtract(t, e, new a.Cartesian3), new a.Cartesian3),
r = a.Cartesian3.normalize(e, new a.Cartesian3),
n = new a.Camera(this.viewer.scene);
n.position = e, n.direction = i, n.up = r, i = n.directionWC, r = n.upWC;
var o = n.rightWC,
s = new a.Cartesian3,
l = new a.Matrix3,
u = new a.Quaternion;
o = a.Cartesian3.negate(o, s);
var c = l;
return a.Matrix3.setColumn(c, 0, o, c), a.Matrix3.setColumn(c, 1, r, c), a.Matrix3.setColumn(c, 2, i, c), a.Quaternion.fromRotationMatrix(c, u)
}
}, {
key: "_addPostProcess",
value: function () {
var e = this,
t = l.default,
i = this,
r = i.viewShadowMap._isPointLight ? i.viewShadowMap._pointBias : i.viewShadowMap._primitiveBias;
this.postProcess = new a.PostProcessStage({
fragmentShader: t,
uniforms: {
czzj: function () {
return e.verticalAngle
},
dis: function () {
return e.distance
},
spzj: function () {
return e.horizontalAngle
},
visibleColor: function () {
return e.visibleAreaColor
},
disVisibleColor: function () {
return e.hiddenAreaColor
},
mixNum: function () {
return e.alpha
},
stcshadow: function () {
return i.viewShadowMap._shadowMapTexture || e._defaultColorTexture
},
_shadowMap_matrix: function () {
return i.viewShadowMap._shadowMapMatrix
},
shadowMap_lightPositionEC: function () {
return i.viewShadowMap._lightPositionEC
},
shadowMap_lightPositionWC: function () {
return i.viewShadowMap._lightCamera.position
},
shadowMap_lightDirectionEC: function () {
return i.viewShadowMap._lightDirectionEC
},
shadowMap_lightUp: function () {
return i.viewShadowMap._lightCamera.up
},
shadowMap_lightDir: function () {
return i.viewShadowMap._lightCamera.direction
},
shadowMap_lightRight: function () {
return i.viewShadowMap._lightCamera.right
},
shadowMap_texelSizeDepthBiasAndNormalShadingSmooth: function () {
var e = new a.Cartesian2;
return e.x = 1 / i.viewShadowMap._textureSize.x, e.y = 1 / i.viewShadowMap._textureSize.y, a.Cartesian4.fromElements(e.x, e.y, r.depthBias, r.normalShadingSmooth, this.combinedUniforms1)
},
shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness: function () {
return a.Cartesian4.fromElements(r.normalOffsetScale, i.viewShadowMap._distance, i.viewShadowMap.maximumDistance, i.viewShadowMap._darkness, this.combinedUniforms2)
},
depthTexture1: function () {
return e.getSceneDepthTexture(e.viewer)
}
}
}), this.show && this.viewer.scene.postProcessStages.add(this.postProcess)
}
}, {
key: "getSceneDepthTexture",
value: function (e) {
var t = e.scene,
i = t._environmentState,
r = t._view,
n = i.useGlobeDepthFramebuffer,
o = n ? r.globeDepth.framebuffer : void 0,
s = r.sceneFramebuffer.getFramebuffer();
return a.defaultValue(o, s).depthStencilTexture
}
}, {
key: "removeRadar",
value: function () {
this.viewer.entities.remove(this.radar)
}
}, {
key: "resetRadar",
value: function () {
this.removeRadar(), this.addRadar(this.cameraPosition, this.frustumQuaternion)
}
}, {
key: "addRadar",
value: function (e, t) {
var i = e,
r = this;
this.radar = this.viewer.entities.add({
position: i,
orientation: t,
show: this.show,
rectangularSensor: new u.RectangularSensorGraphics({
radius: r.distance,
xHalfAngle: a.Math.toRadians(r.horizontalAngle / 2),
yHalfAngle: a.Math.toRadians(r.verticalAngle / 2),
material: new a.Color(0, 1, 1, .4),
lineColor: new a.Color(1, 1, 1, 1),
slice: 8,
showScanPlane: !1,
scanPlaneColor: new a.Color(0, 1, 1, 1),
scanPlaneMode: "vertical",
scanPlaneRate: 3,
showThroughEllipsoid: !1,
showLateralSurfaces: !1,
showDomeSurfaces: !1
})
})
}
}, {
key: "update",
value: function (e) {
this.viewShadowMap && e.shadowMaps.push(this.viewShadowMap)
}
}, {
key: "_switchShow",
value: function () {
this.show ? !this.postProcess && this._addPostProcess() : (this.viewer.scene.postProcessStages.remove(this.postProcess), delete this.postProcess, this.postProcess = null), this.radar.show = this.show
}
}, {
key: "destroy",
value: function () {
this.viewer.terrainShadows = a.ShadowMode.DISABLED, this._unbindMourseEvent(), this.viewer.scene.postProcessStages.remove(this.postProcess), this.viewer.entities.remove(this.radar), delete this.radar, delete this.postProcess, delete this.viewShadowMap, delete this.verticalAngle, delete this.viewer, delete this.horizontalAngle, delete this.visibleAreaColor, delete this.hiddenAreaColor, delete this.distance, delete this.frustumQuaternion, delete this.cameraPosition, delete this.viewPosition, delete this.alpha
}
}, {
key: "horizontalAngle",
get: function () {
return this._horizontalAngle
},
set: function (e) {
this._horizontalAngle = e, this.resetRadar()
}
}, {
key: "verticalAngle",
get: function () {
return this._verticalAngle
},
set: function (e) {
this._verticalAngle = e, this.resetRadar()
}
}, {
key: "distance",
get: function () {
return this._distance
},
set: function (e) {
this._distance = e, this.resetRadar()
}
}, {
key: "visibleAreaColor",
get: function () {
return this._visibleAreaColor
},
set: function (e) {
this._visibleAreaColor = e
}
}, {
key: "hiddenAreaColor",
get: function () {
return this._hiddenAreaColor
},
set: function (e) {
this._hiddenAreaColor = e
}
}, {
key: "alpha",
get: function () {
return this._alpha
},
set: function (e) {
this._alpha = e
}
}, {
key: "show",
get: function () {
return this.defaultShow
},
set: function (e) {
this.defaultShow = Boolean(e), this._switchShow()
}
}]), e
}()
}, function (e, t) {
e.exports = "uniform float czzj;\r\nuniform float dis;\r\nuniform float spzj;\r\nuniform vec3 visibleColor;\r\nuniform vec3 disVisibleColor;\r\nuniform float mixNum;\r\nuniform sampler2D colorTexture;\r\nuniform sampler2D stcshadow; \r\nuniform sampler2D depthTexture;\r\nuniform mat4 _shadowMap_matrix; \r\nuniform vec4 shadowMap_lightPositionEC; \r\nuniform vec3 shadowMap_lightPositionWC;\r\nuniform vec4 shadowMap_lightDirectionEC;\r\nuniform vec3 shadowMap_lightUp;\r\nuniform vec3 shadowMap_lightDir;\r\nuniform vec3 shadowMap_lightRight;\r\nuniform vec4 shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness; \r\nuniform vec4 shadowMap_texelSizeDepthBiasAndNormalShadingSmooth; \r\nvarying vec2 v_textureCoordinates;\r\nvec4 toEye(in vec2 uv, in float depth){\r\n vec2 xy = vec2((uv.x * 2.0 - 1.0),(uv.y * 2.0 - 1.0));\r\n vec4 posInCamera =czm_inverseProjection * vec4(xy, depth, 1.0);\r\n posInCamera =posInCamera / posInCamera.w;\r\n return posInCamera;\r\n}\r\nfloat getDepth(in vec4 depth){\r\n float z_window = czm_unpackDepth(depth);\r\n z_window = czm_reverseLogDepth(z_window);\r\n float n_range = czm_depthRange.near;\r\n float f_range = czm_depthRange.far;\r\n return (2.0 * z_window - n_range - f_range) / (f_range - n_range);\r\n}\r\nfloat _czm_sampleShadowMap(sampler2D shadowMap, vec2 uv){\r\n return texture2D(shadowMap, uv).r;\r\n}\r\nfloat _czm_shadowDepthCompare(sampler2D shadowMap, vec2 uv, float depth){\r\n return step(depth, _czm_sampleShadowMap(shadowMap, uv));\r\n}\r\nfloat _czm_shadowVisibility(sampler2D shadowMap, czm_shadowParameters shadowParameters){\r\n float depthBias = shadowParameters.depthBias;\r\n float depth = shadowParameters.depth;\r\n float nDotL = shadowParameters.nDotL;\r\n float normalShadingSmooth = shadowParameters.normalShadingSmooth;\r\n float darkness = shadowParameters.darkness;\r\n vec2 uv = shadowParameters.texCoords;\r\n depth -= depthBias;\r\n vec2 texelStepSize = shadowParameters.texelStepSize;\r\n float radius = 1.0;\r\n float dx0 = -texelStepSize.x * radius;\r\n float dy0 = -texelStepSize.y * radius;\r\n float dx1 = texelStepSize.x * radius;\r\n float dy1 = texelStepSize.y * radius;\r\n float visibility = \r\n (\r\n _czm_shadowDepthCompare(shadowMap, uv, depth)\r\n +_czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy0), depth) +\r\n _czm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy0), depth) +\r\n _czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy0), depth) +\r\n _czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, 0.0), depth) +\r\n _czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, 0.0), depth) +\r\n _czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy1), depth) +\r\n _czm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy1), depth) +\r\n _czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy1), depth)\r\n ) * (1.0 / 9.0)\r\n ;\r\n return visibility;\r\n}\r\nvec3 pointProjectOnPlane(in vec3 planeNormal, in vec3 planeOrigin, in vec3 point){\r\n vec3 v01 = point -planeOrigin;\r\n float d = dot(planeNormal, v01) ;\r\n return (point - planeNormal * d);\r\n}\r\nfloat ptm(vec3 pt){\r\n return sqrt(pt.x*pt.x + pt.y*pt.y + pt.z*pt.z);\r\n}\r\nvoid main() \r\n{ \r\n const float PI = 3.141592653589793;\r\n vec4 color = texture2D(colorTexture, v_textureCoordinates);\r\n vec4 currD = texture2D(depthTexture, v_textureCoordinates);\r\n\r\n // vec4 stcc = texture2D(stcshadow, v_textureCoordinates);\r\n // gl_FragColor = currD;\r\n // return;\r\n if(currD.r>=1.0){\r\n gl_FragColor = color;\r\n return;\r\n }\r\n \r\n float depth = getDepth(currD);\r\n // gl_FragColor = vec4(depth,0.0,0.0,1.0);\r\n // return;\r\n // float depth = czm_unpackDepth(texture2D(depthTexture, v_textureCoordinates));\r\n vec4 positionEC = toEye(v_textureCoordinates, depth);\r\n vec3 normalEC = vec3(1.0);\r\n czm_shadowParameters shadowParameters; \r\n shadowParameters.texelStepSize = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.xy; \r\n shadowParameters.depthBias = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.z; \r\n shadowParameters.normalShadingSmooth = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.w; \r\n shadowParameters.darkness = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.w; \r\n shadowParameters.depthBias *= max(depth * 0.01, 1.0); \r\n vec3 directionEC = normalize(positionEC.xyz - shadowMap_lightPositionEC.xyz); \r\n float nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0); \r\n vec4 shadowPosition = _shadowMap_matrix * positionEC; \r\n shadowPosition /= shadowPosition.w; \r\n if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0)))) \r\n { \r\n gl_FragColor = color;\r\n return;\r\n }\r\n\r\n //坐标与视点位置距离,大于最大距离则舍弃阴影效果\r\n vec4 lw = vec4(shadowMap_lightPositionWC,1.0);\r\n vec4 vw = czm_inverseView* vec4(positionEC.xyz, 1.0);\r\n if(distance(lw.xyz,vw.xyz)>dis){\r\n gl_FragColor = color;\r\n return;\r\n }\r\n\r\n\r\n //水平夹角限制\r\n vec3 ptOnSP = pointProjectOnPlane(shadowMap_lightUp,lw.xyz,vw.xyz);\r\n directionEC = ptOnSP - lw.xyz;\r\n float directionECMO = ptm(directionEC.xyz);\r\n float shadowMap_lightDirMO = ptm(shadowMap_lightDir.xyz);\r\n float cosJJ = dot(directionEC,shadowMap_lightDir)/(directionECMO*shadowMap_lightDirMO);\r\n float degJJ = acos(cosJJ)*(180.0 / PI);\r\n degJJ = abs(degJJ);\r\n if(degJJ>spzj/2.0){\r\n gl_FragColor = color;\r\n return;\r\n }\r\n\r\n //垂直夹角限制\r\n vec3 ptOnCZ = pointProjectOnPlane(shadowMap_lightRight,lw.xyz,vw.xyz);\r\n vec3 dirOnCZ = ptOnCZ - lw.xyz;\r\n float dirOnCZMO = ptm(dirOnCZ);\r\n float cosJJCZ = dot(dirOnCZ,shadowMap_lightDir)/(dirOnCZMO*shadowMap_lightDirMO);\r\n float degJJCZ = acos(cosJJCZ)*(180.0 / PI);\r\n degJJCZ = abs(degJJCZ);\r\n if(degJJCZ>czzj/2.0){\r\n gl_FragColor = color;\r\n return;\r\n }\r\n\r\n shadowParameters.texCoords = shadowPosition.xy; \r\n shadowParameters.depth = shadowPosition.z; \r\n shadowParameters.nDotL = nDotL; \r\n float visibility = _czm_shadowVisibility(stcshadow, shadowParameters); \r\n if(visibility==1.0){\r\n gl_FragColor = mix(color,vec4(visibleColor,1.0),mixNum);\r\n }else{\r\n // if(abs(shadowPosition.z-0.0)<0.01){\r\n // return;\r\n // }\r\n gl_FragColor = mix(color,vec4(disVisibleColor,1.0),mixNum);\r\n }\r\n} "
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.Sightline = void 0;
var n = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o),
s = i(1);
t.Sightline = function () {
function e(t, i) {
r(this, e), this.viewer = t, i || (i = {}), this.lines = [], this._visibleColor = new a.Color(0, 1, 0, 1), this._hiddenColor = new a.Color(1, 0, 0, 1), this._depthFailMaterial = this._hiddenColor, i.originPoint && i.targetPoint && this.analysis(i.originPoint, i.targetPoint)
}
return n(e, [{
key: "add",
value: function (e, t) {
var i = (0, s.addPositionsHeight)(e, 1.5),
r = a.Cartesian3.normalize(a.Cartesian3.subtract(t, i, new a.Cartesian3), new a.Cartesian3),
n = new a.Ray(i, r),
o = this.viewer.scene.drillPickFromRay(n, 2, this.lines);
if (a.defined(o) && o.length > 0 && a.defined(o[0]) && a.defined(o[0].position)) {
var l = o[0].position,
u = this.viewer.entities.add({
polyline: {
positions: [e, l],
width: 2,
material: this._visibleColor
}
});
this.lines.push(u);
var c = this.viewer.entities.add({
polyline: {
positions: [l, t],
width: 2,
material: this._hiddenColor
}
});
return this.lines.push(c), [u, c]
}
var u = this.viewer.entities.add({
polyline: {
positions: [e, t],
width: 2,
material: this._visibleColor,
depthFailMaterial: this._depthFailMaterial
}
});
return this.lines.push(u), [u]
}
}, {
key: "clear",
value: function () {
for (var e = 0, t = this.lines.length; e < t; e++) this.viewer.entities.remove(this.lines[e]);
this.lines = []
}
}, {
key: "destroy",
value: function () {
this.clear(), delete this.viewer, delete this._visibleColor, delete this._hiddenColor
}
}, {
key: "visibleColor",
get: function () {
return this._visibleColor
},
set: function (e) {
this._visibleColor = e
}
}, {
key: "hiddenColor",
get: function () {
return this._hiddenColor
},
set: function (e) {
this._hiddenColor = e
}
}, {
key: "depthFailMaterial",
get: function () {
return this._depthFailMaterial
},
set: function (e) {
this._depthFailMaterial = e
}
}]), e
}()
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.HeightCounterByTerrain = void 0;
var n = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o);
t.HeightCounterByTerrain = function () {
function e(t, i) {
r(this, e), this.viewer = t, i = i || {};
var n = a.clone(a.ExpandByMars._defaultFloodAnalysis);
this._positions = a.defaultValue(i.positions, a.clone(n.positions)), this.floodVar = a.defaultValue(i.floodVar, a.clone(n.floodVar)), this.ym_pos_x = a.defaultValue(i.ym_pos_x, a.clone(n.ym_pos_x)), this.ym_pos_y = a.defaultValue(i.ym_pos_y, a.clone(n.ym_pos_y)), this.ym_pos_z = a.defaultValue(i.ym_pos_z, a.clone(n.ym_pos_z)), this.rect_flood = a.defaultValue(i.rect_flood, a.clone(n.rect_flood)), this.ym_max_index = a.defaultValue(i.ym_max_index, a.clone(n.ym_max_index)), this._globe = a.defaultValue(i.globe, a.clone(n.globe)), this._visibleOutArea = a.defaultValue(i.visibleOutArea, a.clone(n.showElseArea)), this._boundingSwell = a.defaultValue(i.boundingSwell, 20), this.defaultShow = a.defaultValue(i.show, !0), this.onStop = a.defaultValue(i.onStop, null), this.height = a.defaultValue(i.height, null), this._init()
}
return n(e, [{
key: "_checkArgs",
value: function () {
if (void 0 == this.minHeight || void 0 == this.maxHeight) return console.log("请确认高度值为数值!"), !1;
if (this.minHeight > this.maxHeight) {
var e = this.minHeight;
this.minHeight = this.maxHeight, this.maxHeight = e
}
return !0
}
}, {
key: "_init",
value: function () {
this._positions && 0 != this._positions.length && (this._prepareFlood(this._positions), this._setFloodVar(), this._startFlood())
}
}, {
key: "setPositions",
value: function (e) {
e && 0 != e.length && (this._prepareFlood(e), this._setFloodVar(), this._startFlood())
}
}, {
key: "reFlood",
value: function () {
this.floodVar[1] = this.floodVar[0]
}
}, {
key: "_switchShow",
value: function () {
this.show ? this.viewer.scene.globe.material = a.Material.fromType("YanMo") : this.viewer.scene.globe.material = null
}
}, {
key: "_prepareFlood",
value: function (e) {
this.ym_pos_arr = e;
var t = e.length;
if (0 != t) {
this.ym_max_index = t;
for (var i = 99999999, r = 99999999, n = 99999999, o = -99999999, a = -99999999, s = -99999999, l = 0; l < t; l++) e[l] ? (this.ym_pos_x[l] = e[l].x, this.ym_pos_y[l] = e[l].y, this.ym_pos_z[l] = e[l].z, e[l].x > o && (o = e[l].x), e[l].x < i && (i = e[l].x), e[l].y > a && (a = e[l].y), e[l].y < r && (r = e[l].y), e[l].z > s && (s = e[l].z), e[l].z < n && (n = e[l].z)) : (this.ym_pos_x[l] = 0, this.ym_pos_y[l] = 0, this.ym_pos_z[l] = 0);
var u = this.boundingSwell;
this._base_rect = this.rect_flood = [i - u, r - u, n - u, o + u, a + u, s + u, 0, 0, 0]
}
}
}, {
key: "_setFloodVar",
value: function () {
this.floodVar = [this.minHeight, this.minHeight, this.maxHeight, this.maxHeight - this.minHeight]
}
}, {
key: "_startFlood",
value: function () {
a.ExpandByMars.floodAnalysis.floodVar[0] = this.floodVar[0], a.ExpandByMars.floodAnalysis.floodVar[1] = this.floodVar[1], a.ExpandByMars.floodAnalysis.ym_pos_x = this.ym_pos_x, a.ExpandByMars.floodAnalysis.ym_pos_y = this.ym_pos_y, a.ExpandByMars.floodAnalysis.ym_pos_z = this.ym_pos_z, a.ExpandByMars.floodAnalysis.rect_flood = this.rect_flood, a.ExpandByMars.floodAnalysis.ym_pos_arr = this.ym_pos_arr, a.ExpandByMars.floodAnalysis.ym_max_index = this.ym_max_index, a.ExpandByMars.floodAnalysis.globe = this.globe = !1, a.ExpandByMars.floodAnalysis.showElseArea = this.visibleOutArea, this.viewer.scene.globe.material = a.Material.fromType("ElevationContour")
}
}, {
key: "destroy",
value: function () {
this.viewer && (this.viewer.scene.globe.material = null), a.ExpandByMars.resetFloodAnalysis(), delete this.activeFlooding, delete this.viewer, delete this.ym_max_height, delete this.ym_pos_x, delete this.ym_pos_y, delete this.ym_pos_z, delete this.ym_pos_arr, delete this.ym_max_index, delete this.globe, delete this.maxDepthOfWater, delete this.rect_flood
}
}, {
key: "visibleOutArea",
get: function () {
return this._visibleOutArea
},
set: function (e) {
this._visibleOutArea = e, a.ExpandByMars.floodAnalysis.showElseArea = e
}
}, {
key: "globe",
get: function () {
return this._globe
},
set: function (e) {
this._globe = e, a.ExpandByMars.floodAnalysis.globe = e
}
}, {
key: "boundingSwell",
get: function () {
return this._boundingSwell
},
set: function (e) {
var t = this._base_rect;
this._boundingSwell = Number(e), this.rect_flood = [t[0] - this.boundingSwell, t[1] - this.boundingSwell, t[2] - this.boundingSwell, t[3] - this.boundingSwell, t[4] - this.boundingSwell, t[5] - this.boundingSwell, 0, 0, 0], a.ExpandByMars.floodAnalysis.rect_flood = this.rect_flood
}
}, {
key: "show",
get: function () {
return this.defaultShow
},
set: function (e) {
this.defaultShow = Boolean(e), this._switchShow()
}
}]), e
}()
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.MixedOcclusion = void 0;
var n = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o);
t.MixedOcclusion = function () {
function e(t, i) {
r(this, e), this.viewer = t, i = i || {}, this._enabled = a.defaultValue(i.enabled, !0), this._alpha = a.defaultValue(i.alpha, .5), this.init()
}
return n(e, [{
key: "init",
value: function () {
var e = this.viewer.scene.context,
t = this.viewer.scene.drawingBufferWidth,
i = this.viewer.scene.drawingBufferHeight;
this.width = t, this.height = i, this.tt = new a.Texture({
context: e,
width: t,
height: i,
pixelFormat: a.PixelFormat.RGBA,
pixelDatatype: a.PixelDatatype.FLOAT,
sampler: new a.Sampler({
wrapS: a.TextureWrap.CLAMP_TO_EDGE,
wrapT: a.TextureWrap.CLAMP_TO_EDGE,
minificationFilter: a.TextureMinificationFilter.NEAREST,
magnificationFilter: a.TextureMagnificationFilter.NEAREST
})
}), this.depthStencilTexture = new a.Texture({
context: e,
width: t,
height: i,
pixelFormat: a.PixelFormat.DEPTH_STENCIL,
pixelDatatype: a.PixelDatatype.UNSIGNED_INT_24_8
}), a.ExpandByMars.mixedOcclusion.tilesFbo = new a.Framebuffer({
context: e,
colorTextures: [this.tt],
depthStencilTexture: this.depthStencilTexture,
destroyAttachments: !1
}), a.ExpandByMars.mixedOcclusion.tilesFboClear = new a.ClearCommand({
color: new a.Color(0, 0, 0, 0),
framebuffer: a.ExpandByMars.mixedOcclusion.tilesFbo,
depth: 2,
stencil: 2
}), this.viewer.scene._preUpdate.addEventListener(this._preUpdateHandler, this), this.setEnabled(this._enabled)
}
}, {
key: "_preUpdateHandler",
value: function (e) {
a.ExpandByMars.mixedOcclusion.newFrame = !0;
var t = this.viewer.scene.drawingBufferWidth,
i = this.viewer.scene.drawingBufferHeight;
if (t != this.width || i != this.height) {
var r = this.viewer.scene.context,
n = t,
o = i;
this.width = n, this.height = o, this.DepthTexture && this.DepthTexture.destroy(), this.depthStencilTexture && this.depthStencilTexture.destroy(), this.tt && this.tt.destroy(), a.ExpandByMars.mixedOcclusion.tilesFbo && a.ExpandByMars.mixedOcclusion.tilesFbo.destroy(), this.tt = new a.Texture({
context: r,
width: n,
height: o,
pixelFormat: a.PixelFormat.RGBA,
pixelDatatype: a.PixelDatatype.FLOAT,
sampler: new a.Sampler({
wrapS: a.TextureWrap.CLAMP_TO_EDGE,
wrapT: a.TextureWrap.CLAMP_TO_EDGE,
minificationFilter: a.TextureMinificationFilter.NEAREST,
magnificationFilter: a.TextureMagnificationFilter.NEAREST
})
}), this.depthStencilTexture = new a.Texture({
context: r,
width: n,
height: o,
pixelFormat: a.PixelFormat.DEPTH_STENCIL,
pixelDatatype: a.PixelDatatype.UNSIGNED_INT_24_8
}), this.DepthTexture = new a.Texture({
context: r,
width: n,
height: o,
pixelFormat: a.PixelFormat.RGBA,
pixelDatatype: a.PixelDatatype.UNSIGNED_BYTE,
sampler: new a.Sampler({
wrapS: a.TextureWrap.CLAMP_TO_EDGE,
wrapT: a.TextureWrap.CLAMP_TO_EDGE,
minificationFilter: a.TextureMinificationFilter.NEAREST,
magnificationFilter: a.TextureMagnificationFilter.NEAREST
})
}), a.ExpandByMars.mixedOcclusion.tilesFbo = new a.Framebuffer({
context: r,
colorTextures: [this.tt],
depthStencilTexture: this.depthStencilTexture,
destroyAttachments: !1
}), a.ExpandByMars.mixedOcclusion.tilesFboClear = new a.ClearCommand({
color: new a.Color(0, 0, 0, 0),
framebuffer: a.ExpandByMars.mixedOcclusion.tilesFbo,
depth: 2,
stencil: 2
})
}
}
}, {
key: "setEnabled",
value: function (e) {
var t = this;
a.ExpandByMars.mixedOcclusion.enable = e, e ? (this.postProcess = new a.PostProcessStage({
fragmentShader: "\n uniform sampler2D colorTexture;\n uniform sampler2D mergeTexture; \n uniform float alpha;\n varying vec2 v_textureCoordinates;\n void main(){\n vec4 color = texture2D(colorTexture, v_textureCoordinates);\n vec4 mergeColor = texture2D(mergeTexture, v_textureCoordinates);\n if(length(mergeColor.rgb)>0.01){\n gl_FragColor = mix(color,mergeColor,alpha);\n }else{\n gl_FragColor = color;\n }\n } ",
uniforms: {
mergeTexture: function () {
return a.ExpandByMars.mixedOcclusion.tilesFbo._colorTextures[0]
},
alpha: function () {
return t._alpha
}
}
}), this.viewer.scene.postProcessStages.add(this.postProcess)) : (a.ExpandByMars.mixedOcclusion.tilesFboClear.execute(this.viewer.scene.context), this.postProcess && this.viewer.scene.postProcessStages.remove(this.postProcess))
}
}, {
key: "destroy",
value: function () {
this.setEnabled(!1), this.viewer.scene._preUpdate.removeEventListener(this._preUpdateHandler, this), delete this.postProcess, this.DepthTexture && (this.DepthTexture.destroy(), delete this.DepthTexture), this.depthStencilTexture && (this.depthStencilTexture.destroy(), delete this.depthStencilTexture), this.tt && (this.tt.destroy(), delete this.tt)
}
}, {
key: "alpha",
get: function () {
return this._alpha
},
set: function (e) {
this._alpha = e
}
}, {
key: "enabled",
get: function () {
return this._enabled
},
set: function (e) {
this._enabled = e, this.setEnabled(e)
}
}]), e
}()
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.TilesEditor = void 0;
var n = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o);
t.TilesEditor = function () {
function e(t, i) {
r(this, e), this.viewer = t, this.scene = this.viewer.scene, this.options = i, this.position = i.position, this.heading = i.heading || 0, this.range = i.range || 100, this.dragging = !1, this.rotating = !1, this.enable = !1, this.billboards = this.viewer.scene.primitives.add(new a.BillboardCollection), this.handler = new a.ScreenSpaceEventHandler(this.viewer.canvas), this.movep = this.billboards.add({
position: this.position,
color: new a.Color.fromCssColorString("#FFFF00"),
image: i.moveImg,
show: !1,
disableDepthTestDistance: Number.POSITIVE_INFINITY
}), this.rotatep = this.billboards.add({
position: this.position ? this.rotationPos() : null,
color: new a.Color.fromCssColorString("#FFFF00"),
image: i.rotateImg,
show: !1,
disableDepthTestDistance: Number.POSITIVE_INFINITY
})
}
return n(e, [{
key: "update",
value: function (e) {
for (var t in e) this[t] = e[t];
this.movep.position = this.position, this.rotatep.position = this.rotationPos()
}
}, {
key: "modelMatrix",
value: function () {
var e = a.Transforms.eastNorthUpToFixedFrame(this.position),
t = a.Matrix4.fromRotationTranslation(a.Matrix3.fromRotationZ(this.heading));
if (a.Matrix4.multiply(e, t, e), this.scale > 0 && 1 != this.scale && a.Matrix4.multiplyByUniformScale(e, this.scale, e), this.axis && "" != this.axis) {
var i;
switch (this.axis.toUpperCase()) {
case "Y_UP_TO_Z_UP":
i = a.Axis.Y_UP_TO_Z_UP;
break;
case "Z_UP_TO_Y_UP":
i = a.Axis.Z_UP_TO_Y_UP;
break;
case "X_UP_TO_Z_UP":
i = a.Axis.X_UP_TO_Z_UP;
break;
case "Z_UP_TO_X_UP":
i = a.Axis.Z_UP_TO_X_UP;
break;
case "X_UP_TO_Y_UP":
i = a.Axis.X_UP_TO_Y_UP;
break;
case "Y_UP_TO_X_UP":
i = a.Axis.Y_UP_TO_X_UP
}
i && (e = a.Matrix4.multiplyTransformation(e, i, e))
}
return e
}
}, {
key: "rotationPos",
value: function () {
var e = new a.Cartesian3(this.range, 0, 0),
t = a.Matrix4.getMatrix3(this.modelMatrix(), new a.Matrix3);
return e = a.Matrix3.multiplyByVector(t, e, e), e = a.Cartesian3.add(this.position, e, e)
}
}, {
key: "pickTerrain",
value: function (e) {
var t = this.viewer.camera.getPickRay(e);
return this.viewer.scene.globe.pick(t, this.viewer.scene)
}
}, {
key: "setEnable",
value: function (e) {
if (e) {
var t = this;
this.handler.setInputAction(function (e) {
t.handler_onLeafDown(e)
}, a.ScreenSpaceEventType.LEFT_DOWN), this.handler.setInputAction(function (e) {
t.handler_onMouseMove(e)
}, a.ScreenSpaceEventType.MOUSE_MOVE), this.handler.setInputAction(function (e) {
t.handler_onLeftUp(e)
}, a.ScreenSpaceEventType.LEFT_UP), this.rotatep.show = !0, this.movep.show = !0
} else this.handler.removeInputAction(a.ScreenSpaceEventType.LEFT_DOWN), this.handler.removeInputAction(a.ScreenSpaceEventType.MOUSE_MOVE), this.handler.removeInputAction(a.ScreenSpaceEventType.LEFT_UP), this.rotatep.show = !1, this.movep.show = !1;
this._enable = !1
}
}, {
key: "handler_onLeafDown",
value: function (e) {
for (var t = this.scene.drillPick(e.position, 2), i = 0; i < t.length; i++) {
var r = t[i];
if (a.defined(r) && r.primitive === this.movep) {
this.dragging = !0, this.scene.screenSpaceCameraController.enableRotate = !1;
break
}
if (a.defined(r) && r.primitive === this.rotatep) {
this.rotating = !0, this.scene.screenSpaceCameraController.enableRotate = !1;
break
}
}
}
}, {
key: "handler_onMouseMove",
value: function (e) {
var t = this.pickTerrain(e.endPosition);
if (t)
if (this.dragging) this.position = t, this.movep.position = this.position, this.rotatep.position = this.rotationPos(), this.options.onPosition && this.options.onPosition(this.position);
else if (this.rotating) {
this.rotatep.position = t, this.range = a.Cartesian3.distance(this.position, t);
var i = a.Transforms.eastNorthUpToFixedFrame(this.position);
i = a.Matrix4.getMatrix3(i, new a.Matrix3);
var r = a.Matrix3.getColumn(i, 0, new a.Cartesian3),
n = a.Matrix3.getColumn(i, 1, new a.Cartesian3),
o = a.Matrix3.getColumn(i, 2, new a.Cartesian3),
s = a.Cartesian3.subtract(t, this.position, new a.Cartesian3);
s = a.Cartesian3.cross(s, o, s), s = a.Cartesian3.cross(o, s, s), s = a.Cartesian3.normalize(s, s), this.heading = a.Cartesian3.angleBetween(r, s);
var l = a.Cartesian3.angleBetween(n, s);
l > .5 * Math.PI && (this.heading = 2 * Math.PI - this.heading), this.options.onHeading && this.options.onHeading(this.heading)
}
}
}, {
key: "handler_onLeftUp",
value: function (e) {
(this.dragging || this.rotating) && (this.rotating = this.dragging = !1, this.scene.screenSpaceCameraController.enableRotate = !0, this.billboards._createVertexArray = !0)
}
}, {
key: "remove",
value: function () {
this.billboards && (this.scene.primitives.remove(this.billboards), this.billboards = void 0), this.enable = !1
}
}, {
key: "destroy",
value: function () {
this.remove(), this.handler.destroy(), this.handler = null, this.viewer = null
}
}]), e
}()
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.TilesClipPlan = void 0;
var n = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o);
(t.TilesClipPlan = function () {
function e(t, i) {
r(this, e), this.tileset = t, this.options = i || {}, this.options.type && (this.type = this.options.type), this.options.distance && (this.distance = this.options.distance)
}
return n(e, [{
key: "createPlane",
value: function (t) {
this.clear();
var i;
switch (t) {
case e.Type.Z:
i = [new a.ClippingPlane(new a.Cartesian3(0, 0, 1), 1)];
break;
default:
case e.Type.ZR:
i = [new a.ClippingPlane(new a.Cartesian3(0, 0, -1), 1)];
break;
case e.Type.X:
i = [new a.ClippingPlane(new a.Cartesian3(1, 0, 0), 1)];
break;
case e.Type.XR:
i = [new a.ClippingPlane(new a.Cartesian3(-1, 0, 0), 1)];
break;
case e.Type.Y:
i = [new a.ClippingPlane(new a.Cartesian3(0, 1, 0), 1)];
break;
case e.Type.YR:
i = [new a.ClippingPlane(new a.Cartesian3(0, -1, 0), 1)]
}
var r = new a.ClippingPlaneCollection({
planes: i,
edgeWidth: this.options.edgeWidth || 0
});
this.clippingPlanes = r, this.tileset.clippingPlanes = r
}
}, {
key: "updateDistance",
value: function (e) {
if (null != this.clippingPlanes)
for (var t = 0; t < this.clippingPlanes.length; t++) {
var i = this.clippingPlanes.get(t);
i.distance = e
}
}
}, {
key: "clear",
value: function () {
this.tileset.clippingPlanes && (this.tileset.clippingPlanes.enabled = !1), this.clippingPlanes && (this.clippingPlanes.destroy(), delete this.clippingPlanes)
}
}, {
key: "planes",
get: function () {
return this.clippingPlanes
}
}, {
key: "type",
get: function () {
return this._type
},
set: function (e) {
this._type = e, this.createPlane(e)
}
}, {
key: "distance",
get: function () {
return this._distance || 0
},
set: function (e) {
this._distance = e, this.updateDistance(e)
}
}]), e
}()).Type = {
Z: 1,
ZR: 2,
X: 3,
XR: 4,
Y: 5,
YR: 6
}
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
function n(e, t) {
if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return !t || "object" != typeof t && "function" != typeof t ? e : t
}
function o(e, t) {
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + typeof t);
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
enumerable: !1,
writable: !0,
configurable: !0
}
}), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.TilesClip = void 0;
var a = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
s = function e(t, i, r) {
null === t && (t = Function.prototype);
var n = Object.getOwnPropertyDescriptor(t, i);
if (void 0 === n) {
var o = Object.getPrototypeOf(t);
return null === o ? void 0 : e(o, i, r)
}
if ("value" in n) return n.value;
var a = n.get;
if (void 0 !== a) return a.call(r)
},
l = i(0),
u = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(l),
c = i(34);
t.TilesClip = function (e) {
function t(e) {
r(this, t);
var i = n(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e));
return i.viewer ? (i._clipOutSide = e.clipOutSide || !1, i.drawCommand && i.activeEdit(), i) : n(i)
}
return o(t, e), a(t, [{
key: "activeEdit",
value: function () {
u.ExpandByMars.tilesEditor.fbo = this.fbo, u.ExpandByMars.tilesEditor.polygonBounds = this.polygonBounds, u.ExpandByMars.tilesEditor.IsYaPing[0] = !0, u.ExpandByMars.tilesEditor.IsYaPing[2] = !0, u.ExpandByMars.tilesEditor.editVar[0] = this.clipOutSide, this.viewer.scene.primitives.add(this)
}
}, {
key: "destroy",
value: function () {
this.viewer.scene.primitives.remove(this), s(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "destroy", this).call(this), delete this.clipOutSide, delete this.viewer
}
}, {
key: "clipOutSide",
get: function () {
return this._clipOutSide
},
set: function (e) {
this._clipOutSide = Boolean(e), u.ExpandByMars.tilesEditor.editVar[0] = this.clipOutSide
}
}]), t
}(c.TilesBase)
}, function (e, t) {
e.exports = "uniform mat4 myPorjection;\r\nattribute vec3 position;\r\nvarying vec2 depth;\r\nvoid main()\r\n{\r\nvec4 pos = vec4(position.xyz,1.0);\r\ndepth = pos.zw;\r\npos.z = 0.0;\r\ngl_Position = czm_projection*pos;\r\n}"
}, function (e, t) {
e.exports = "#ifdef GL_FRAGMENT_PRECISION_HIGH\r\n precision highp float;\r\n#else\r\n precision mediump float;\r\n#endif\r\n\r\n#define OES_texture_float_linear\r\n\r\nvarying vec2 depth;\r\n\r\nvec4 packDepth(float depth)\r\n{\r\n vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * depth;\r\n enc = fract(enc);\r\n enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\r\n return enc;\r\n}\r\n\r\nvoid main()\r\n{\r\n float fDepth = (depth.x / 5000.0)/2.0 + 0.5;\r\n gl_FragColor = packDepth(fDepth);\r\n}"
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
function n(e, t) {
if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return !t || "object" != typeof t && "function" != typeof t ? e : t
}
function o(e, t) {
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + typeof t);
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
enumerable: !1,
writable: !0,
configurable: !0
}
}), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.TilesFlat = void 0;
var a = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
s = function e(t, i, r) {
null === t && (t = Function.prototype);
var n = Object.getOwnPropertyDescriptor(t, i);
if (void 0 === n) {
var o = Object.getPrototypeOf(t);
return null === o ? void 0 : e(o, i, r)
}
if ("value" in n) return n.value;
var a = n.get;
if (void 0 !== a) return a.call(r)
},
l = i(0),
u = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(l),
c = i(34);
t.TilesFlat = function (e) {
function t(e) {
r(this, t);
var i = n(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e));
return i.viewer ? (i._b3dmOffset = e.b3dmOffset || new u.Cartesian2, i._flatHeight = e.flatHeight || 0, i.drawCommand && i.activeEdit(), i) : n(i)
}
return o(t, e), a(t, [{
key: "activeEdit",
value: function () {
u.ExpandByMars.tilesEditor.fbo = this.fbo, u.ExpandByMars.tilesEditor.polygonBounds = this.polygonBounds, u.ExpandByMars.tilesEditor.IsYaPing[0] = !0, u.ExpandByMars.tilesEditor.IsYaPing[1] = !0, u.ExpandByMars.tilesEditor.heightVar[0] = this.minLocalPos.z, u.ExpandByMars.tilesEditor.heightVar[1] = this.flatHeight, this.viewer.scene.primitives.add(this)
}
}, {
key: "destroy",
value: function () {
this.viewer.scene.primitives.remove(this), s(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "destroy", this).call(this), delete this.viewer, delete this.flatHeight, delete this._flatHeight
}
}, {
key: "flatHeight",
get: function () {
return this._flatHeight
},
set: function (e) {
this._flatHeight = Number(e), u.ExpandByMars.tilesEditor.heightVar[1] = this._flatHeight
}
}]), t
}(c.TilesBase)
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
function n(e, t) {
if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return !t || "object" != typeof t && "function" != typeof t ? e : t
}
function o(e, t) {
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + typeof t);
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
enumerable: !1,
writable: !0,
configurable: !0
}
}), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.TilesFlood = void 0;
var a = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
s = function e(t, i, r) {
null === t && (t = Function.prototype);
var n = Object.getOwnPropertyDescriptor(t, i);
if (void 0 === n) {
var o = Object.getPrototypeOf(t);
return null === o ? void 0 : e(o, i, r)
}
if ("value" in n) return n.value;
var a = n.get;
if (void 0 !== a) return a.call(r)
},
l = i(0),
u = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(l),
c = i(34);
t.TilesFlood = function (e) {
function t(e) {
r(this, t);
var i = n(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e));
return i.floodColor = e.floodColor || [.15, .7, .95, .5], i.floodSpeed = e.floodSpeed || 5.5, i._floodAll = e.floodAll, i.maxFloodDepth = e.floodSpeed || 200, i.ableFlood = !0, (i.drawCommand || i._floodAll) && i.activeEdit(), i
}
return o(t, e), a(t, [{
key: "bindSpeed",
value: function () {
var e = this;
this.speedFun = function () {
e.ableFlood && (u.ExpandByMars.tilesEditor.floodVar[1] += e.floodSpeed / 55, u.ExpandByMars.tilesEditor.floodVar[1] >= u.ExpandByMars.tilesEditor.floodVar[2] && (u.ExpandByMars.tilesEditor.floodVar[1] = u.ExpandByMars.tilesEditor.floodVar[2]))
}, this.viewer.clock.onTick.addEventListener(this.speedFun)
}
}, {
key: "resetFlood",
value: function () {
u.ExpandByMars.tilesEditor.floodVar[1] = u.ExpandByMars.tilesEditor.floodVar[0]
}
}, {
key: "activeEdit",
value: function () {
this.bindSpeed(), u.ExpandByMars.tilesEditor.fbo = this.fbo, u.ExpandByMars.tilesEditor.polygonBounds = this.polygonBounds, u.ExpandByMars.tilesEditor.IsYaPing[0] = !0, u.ExpandByMars.tilesEditor.IsYaPing[3] = !0, u.ExpandByMars.tilesEditor.floodVar = [this.minLocalPos.z, this.minLocalPos.z, this.minLocalPos.z + this.maxFloodDepth, 200], u.ExpandByMars.tilesEditor.floodColor = this.floodColor, u.ExpandByMars.tilesEditor.editVar[1] = this.floodAll || !1, !this.floodAll && this.viewer.scene.primitives.add(this)
}
}, {
key: "destroy",
value: function () {
this.viewer.clock.onTick.removeEventListener(this.speedFun), this.viewer.scene.primitives.remove(this), s(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "destroy", this).call(this), delete this.viewer, delete this.floodColor, delete this.floodSpeed, delete this.ableFlood, delete this.speedFun, delete this.floodAll, delete this.maxFloodDepth
}
}, {
key: "floodAll",
get: function () {
return this._floodAll
},
set: function (e) {
this._floodAll = Boolean(e), u.ExpandByMars.tilesEditor.editVar[1] = this.floodAll
}
}]), t
}(c.TilesBase)
}, function (e, t, i) {
"use strict";
function r(e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}
function n(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.FlyLine = void 0;
var o = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) {
return typeof e
} : function (e) {
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
},
a = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
s = i(0),
l = r(s),
u = i(2),
c = i(1),
h = i(28),
d = i(20),
f = r(d),
p = new l.Matrix4,
m = new l.Matrix3,
g = new l.Cartesian3,
v = new l.Quaternion,
y = {
model: {
show: !1,
scale: 1,
minimumPixelSize: 50
},
label: {
show: !1,
color: "#ffffff",
opacity: 1,
font_family: "楷体",
font_size: 20,
border: !0,
border_color: "#000000",
border_width: 3,
background: !1,
hasPixelOffset: !0,
pixelOffsetX: 30,
pixelOffsetY: -30,
scaleByDistance: !0,
scaleByDistance_far: 1e7,
scaleByDistance_farValue: .4,
scaleByDistance_near: 1e5,
scaleByDistance_nearValue: 1
},
path: {
show: !1,
lineType: "solid",
color: "#3388ff",
opacity: .5,
width: 1,
outline: !1,
outlineColor: "#ffffff",
outlineWidth: 2
},
shadow: {
show: !1,
color: "#00ff00",
outline: !1,
opacity: .3
},
camera: {
type: "gs",
followedX: 50,
followedZ: 10
},
showGroundHeight: !1
};
t.FlyLine = function () {
function e(t, i) {
n(this, e), this.viewer = t, this.id = i.id || 0, this.name = i.name || "", this.points = i.points, this.speeds = i.speed;
for (var r in y) {
var a = y[r];
if (i.hasOwnProperty(r) && "object" === o(i[r]))
for (var s in a) i[r].hasOwnProperty(s) || (i[r][s] = a[s]);
else i[r] = a
}
this.options = i, this._isStart = !1, this._createLine()
}
return a(e, [{
key: "_createLine",
value: function () {
var e, t = new l.SampledPositionProperty,
i = this.viewer.clock.currentTime,
r = this.points;
if (r.length < 2) return void console.log("路线无坐标数据,无法漫游!");
var n = this.speeds,
o = !(0, u.isNumber)(n);
if (2 == r.length) {
var a = [(r[0][0] + r[1][0]) / 2, (r[0][1] + r[1][1]) / 2, r[0][2]];
r.splice(1, 0, a), n && o && n.splice(1, 0, n[0])
}
for (var s, c = [], h = 0, d = 0, f = {}, p = [], m = 0, g = r.length; m < g; m++) {
var v = r[m],
y = l.Cartesian3.fromDegrees(v[0], v[1], v[2] || 0);
if (y.lonlat = v, 0 == m) {
var _ = l.JulianDate.addSeconds(i, h, new l.JulianDate);
y.time = _, y.second = h, t.addSample(_, y)
} else {
var w = o ? n ? n[m - 1] : 100 : n || 100;
c.push(w);
var b = l.Cartesian3.distance(y, s),
C = Math.round(b / w * 3.6);
C < .5 && (C = .5), h += C, d += b;
var _ = l.JulianDate.addSeconds(i, h, new l.JulianDate);
y.time = _, y.second = h, t.addSample(_, y)
}
s = y, p.push(y), f[m] = d
}
this.speeds = c, this.arrLinePoint = p, e = l.JulianDate.addSeconds(i, h, new l.JulianDate), this.alltimes = h, this.alllen = d, this.stepLen = f, this.startTime = i, this.stopTime = e, this.property = t, this.options.interpolation && this.property.setInterpolationOptions({
interpolationDegree: this.options.interpolationDegree || 2,
interpolationAlgorithm: l.LagrangePolynomialApproximation
})
}
}, {
key: "_createEntity",
value: function () {
this.options.label.text = this.name;
var e = f.model.style2Entity(this.options.model),
t = f.label.style2Entity(this.options.label),
i = f.polyline.style2Entity(this.options.path, {});
i.isAll || (i.leadTime = 0, i.trailTime = 10 * this.alltimes);
var r = new l.VelocityOrientationProperty(this.property);
this.velocityOrientation = r, this.entity && (this.viewer.entities.remove(this.entity), delete this.entity), this.entity = this.viewer.entities.add({
availability: new l.TimeIntervalCollection([new l.TimeInterval({
start: this.startTime,
stop: this.stopTime
})]),
position: this.property,
orientation: r,
model: e,
label: t,
path: i,
point: {
show: !e.show,
color: new l.Color.fromCssColorString("#ffffff").withAlpha(.01),
pixelSize: 1
},
popup: this._popup
})
}
}, {
key: "clampToGround",
value: function (e, t) {
function i() {
s++;
var d = l.Cartesian3.fromDegrees(n[s - 1][0], n[s - 1][1], n[s - 1][2] || 0),
f = l.Cartesian3.fromDegrees(n[s][0], n[s][1], n[s][2] || 0),
p = o[s - 1],
m = [d, f];
(0, c.terrainPolyline)({
viewer: a,
positions: m,
has3dtiles: t.has3dtiles,
splitNum: t.splitNum,
offset: t.offset,
calback: function (t, o) {
if (o) 1 == s && u.push(n[0]), u.push(n[s]), h.push(p);
else
for (var a = 0; a < t.length; a++) {
var c = t[a],
d = l.Cartographic.fromCartesian(c);
u.push([l.Math.toDegrees(d.longitude), l.Math.toDegrees(d.latitude), d.height]), h.push(p)
}
s >= n.length - 1 ? (r.points = u, r.speeds = h, r._createLine(), e && e({
lonlats: u,
speeds: h
})) : i()
}
})
}
t = t || {};
var r = this,
n = this.points,
o = this.speeds,
a = this.viewer,
s = 0,
u = [],
h = [];
i()
}
}, {
key: "updateStyle",
value: function (e) {
for (var t in e)
if ("object" === o(e[t]) && this.options[t])
for (var i in e[t]) this.options[t][i] = e[t][i];
else this.options[t] = e[t]
}
}, {
key: "updateAngle",
value: function (e, t) {
if (e) this.entity.orientation = this.velocityOrientation;
else {
t = t || {};
var i = this.position,
r = this.orientation,
n = (0, h.getHeadingPitchRollByOrientation)(i, r),
o = n.heading,
a = l.Math.toRadians(Number(t.pitch || 0)),
s = l.Math.toRadians(Number(t.roll || 0));
this.entity.orientation = l.Transforms.headingPitchRollQuaternion(i, new l.HeadingPitchRoll(o, a, s))
}
}
}, {
key: "start",
value: function (e) {
if (!l.defined(this.arrLinePoint) || 0 == this.arrLinePoint.length) return void console.log("没有坐标数据,飞行路线启动失败");
this.endfun = e, this._isStart && this.stop(), this._isStart = !0, this._createEntity(), this._bak_multiplier = this.viewer.clock.multiplier, this.viewer.clock.multiplier = this.options.multiplier || 1, this.viewer.clock.shouldAnimate = !0, this.viewer.clock.currentTime = this.startTime.clone(), this.options.clockLoop && (this._bak_clockRange = this.viewer.clock.clockRange, this._bak_startTime = this.viewer.clock.startTime, this._bak_stopTime = this.viewer.clock.stopTime, this.viewer.clock.clockRange = l.ClockRange.LOOP_STOP, this.viewer.clock.startTime = this.startTime.clone(), this.viewer.clock.stopTime = this.stopTime.clone(), this.viewer.timeline && this.viewer.timeline.zoomTo(this.startTime, this.stopTime)), this.options.shadow.show && ("wall" == this.options.shadow.type ? this.addWallShading() : "cylinder" == this.options.shadow.type && this.addCylinderShading()), this._flyok_point_index = 0, this.viewer.scene.preRender.addEventListener(this.preRender_eventHandler, this)
}
}, {
key: "preRender_eventHandler",
value: function (e) {
if (this._isStart && null != this.entity) {
l.JulianDate.greaterThanOrEquals(this.viewer.clock.currentTime, this.stopTime) && (this._flyok_point_index = this.arrLinePoint.length - 1, this.endfun && this.endfun(), this.endfun = null);
var t = this.position;
if (l.defined(t)) {
switch (this.options.camera.type) {
default:
void 0 != this.viewer.trackedEntity && (this.viewer.trackedEntity = void 0);
break;
case "gs":
this.viewer.trackedEntity != this.entity && (this.viewer.trackedEntity = this.entity);
break;
case "dy":
this.viewer.trackedEntity != this.entity && (this.viewer.trackedEntity = this.entity);
var i = this.getModelMatrix(),
r = this.options.camera.followedX,
n = this.options.camera.followedZ;
this.viewer.scene.camera.lookAtTransform(i, new l.Cartesian3(-r, 0, n));
break;
case "sd":
this.viewer.trackedEntity != this.entity && (this.viewer.trackedEntity = this.entity);
var i = this.getModelMatrix(),
n = this.options.camera.followedZ;
this.viewer.scene.camera.lookAtTransform(i, new l.Cartesian3(-1, 0, n))
}
this.realTime(t)
}
}
}
}, {
key: "getCurrIndex",
value: function () {
var e = this.arrLinePoint.length;
l.JulianDate.compare(this.viewer.clock.currentTime, this.arrLinePoint[0].time) <= 0 && (this._flyok_point_index = 0), (this._flyok_point_index < 0 || this._flyok_point_index >= e) && (this._flyok_point_index = 0);
for (var t = this._flyok_point_index; t < e; t++) {
var i = this.arrLinePoint[t];
if (l.JulianDate.compare(this.viewer.clock.currentTime, i.time) <= 0) return t - 1
}
for (var t = 0; t < e; t++) {
var i = this.arrLinePoint[t];
if (l.JulianDate.compare(this.viewer.clock.currentTime, i.time) <= 0) return t - 1
}
return e - 1
}
}, {
key: "realTime",
value: function (e) {
var t = l.JulianDate.secondsDifference(this.viewer.clock.currentTime, this.startTime),
i = (0, c.formatPosition)(e);
this._flyok_point_index = this.getCurrIndex();
var r = this.arrLinePoint.length;
(this._flyok_point_index < 0 || this._flyok_point_index >= r) && (this._flyok_point_index = 0);
var n = this.stepLen[this._flyok_point_index],
o = this.arrLinePoint[this._flyok_point_index];
if (l.defined(o) && (n += l.Cartesian3.distance(e, o)), n >= this.alllen && (this._flyok_point_index = r - 1, n = this.alllen), this.timeinfo = {
time: t,
len: n,
x: i.x,
y: i.y,
z: i.z
}, this.options.shadow.show && "wall" == this.options.shadow.type) {
var a = this.arrLinePoint.slice(0, this._flyok_point_index + 1);
a.push(e), this.updateWallShading(a)
}
var s = l.Cartographic.fromCartesian(e),
h = this.viewer.scene.globe.getHeight(s);
if (null != h && h > 0 && (this.timeinfo.hbgd = h, this.timeinfo.ldgd = i.z - h), this.options.showGroundHeight) {
var d = this;
(0, c.terrainPolyline)({
viewer: d.viewer,
positions: [e, e],
calback: function (e, t) {
if (null != e && 0 != e.length && !t) {
var r = (0, c.formatPosition)(e[0]).z,
n = i.z - r;
if (this.timeinfo.hbgd = r, this.timeinfo.ldgd = n, this.entity.label) {
var o = (0, u.formatLength)(this.timeinfo.z),
a = (0, u.formatLength)(this.timeinfo.ldgd);
this.entity.label.text = this.name + "\n漫游高程:" + o + "\n离地距离:" + a
}
}
}
})
}
}
}, {
key: "getModelMatrix",
value: function () {
var e = this.entity,
t = this.viewer.clock.currentTime,
i = l.Property.getValueOrUndefined(e.position, t, g);
if (l.defined(i)) {
var r = l.Property.getValueOrUndefined(e.orientation, t, v);
return l.defined(r) ? l.Matrix4.fromRotationTranslation(l.Matrix3.fromQuaternion(r, m), i, p) : l.Transforms.eastNorthUpToFixedFrame(i, void 0, p)
}
}
}, {
key: "addWallShading",
value: function () {
this._wall_positions = [], this._wall_minimumHeights = [], this._wall_maximumHeights = [];
var e = this,
t = f.wall.style2Entity(this.options.shadow);
t.minimumHeights = new l.CallbackProperty(function (t) {
return e._wall_minimumHeights
}, !1), t.maximumHeights = new l.CallbackProperty(function (t) {
return e._wall_maximumHeights
}, !1), t.positions = new l.CallbackProperty(function (t) {
return e._wall_positions
}, !1), this.wallEntity = this.viewer.entities.add({
wall: t
})
}
}, {
key: "updateWallShading",
value: function (e) {
for (var t = [], i = [], r = [], n = 0; n < e.length; n++) {
var o = e[n].clone();
if (o) {
t.push(o);
var a = l.Cartographic.fromCartesian(o);
i.push(0), r.push(a.height)
}
}
this._wall_positions = t, this._wall_minimumHeights = i, this._wall_maximumHeights = r
}
}, {
key: "addCylinderShading",
value: function () {
var e = 100,
t = 100,
i = this.property,
r = f.wall.style2Entity(this.options.shadow);
r.length = new l.CallbackProperty(function (e) {
return t
}, !1), r.topRadius = 0, r.bottomRadius = new l.CallbackProperty(function (t) {
return e
}, !1), r.numberOfVerticalLines = 0, this.cylinderEntity = this.viewer.entities.add({
position: new l.CallbackProperty(function (r) {
var n = l.Property.getValueOrUndefined(i, r, new l.Cartesian3),
o = l.Cartographic.fromCartesian(n),
a = l.Cartesian3.fromRadians(o.longitude, o.latitude, o.height / 2);
return t = o.height, e = .3 * t, a
}, !1),
cylinder: r
})
}
}, {
key: "getTerrainHeight",
value: function (e) {
function t() {
h++;
var d = [r[h - 1], r[h]];
(0, c.terrainPolyline)({
viewer: i.viewer,
positions: d,
calback: function (i, d) {
for (var f = r[h - 1].lonlat[2], p = r[h].lonlat[2], m = (p - f) / i.length, g = 0; g < i.length; g++) {
0 != g && (n += l.Cartesian3.distance(i[g], i[g - 1])), o.push(Number(n.toFixed(1)));
var v = (0, c.formatPosition)(i[g]);
u.push(v);
var y = d ? 0 : v.z;
a.push(y);
var _ = Number((f + m * g).toFixed(1));
s.push(_)
}
h >= r.length - 1 ? e({
arrLength: o,
arrFxgd: s,
arrHbgd: a,
arrPoint: u
}) : t()
}
})
}
var i = this,
r = this.arrLinePoint,
n = 0,
o = [],
a = [],
s = [],
u = [],
h = 0;
t()
}
}, {
key: "toGeoJSON",
value: function () {
return this.options
}
}, {
key: "toCZML",
value: function () {
for (var e = (this.options, this.startTime.toString()), t = this.stopTime.toString(), i = [], r = this.arrLinePoint, n = 0, o = r.length; n < o; n++) {
var a = r[n];
i.push(a.second), i = i.concat(a.lonlat)
}
var s = {
id: this.name,
description: this.options.remark,
availability: e + "/" + t,
orientation: {
velocityReference: "#position"
},
position: {
epoch: e,
cartographicDegrees: i,
interpolationAlgorithm: "LAGRANGE",
interpolationDegree: 2
}
};
return this.options.label.show && (s.label = {
show: !0,
outlineWidth: 2,
text: this.name,
font: "12pt 微软雅黑 Console",
outlineColor: {
rgba: [0, 0, 0, 255]
},
horizontalOrigin: "LEFT",
fillColor: {
rgba: [213, 255, 0, 255]
}
}), this.options.path.show && (s.path = {
show: !0,
material: {
solidColor: {
color: {
rgba: [255, 0, 0, 255]
}
}
},
width: 5,
resolution: 1,
leadTime: 0,
trailTime: this.alltimes
}), this.options.model.show && (s.model = this.options.model), [{
version: "1.0",
id: "document",
clock: {
interval: e + "/" + t,
currentTime: e,
multiplier: 1
}
}, s]
}
}, {
key: "stop",
value: function () {
this.viewer.trackedEntity = void 0, this.viewer.scene.preRender.removeEventListener(this.preRender_eventHandler, this), this.entity && (this.viewer.entities.remove(this.entity), delete this.entity), this._bak_startTime && (this.viewer.clock.startTime = this._bak_startTime, delete this._bak_startTime), this._bak_stopTime && (this.viewer.clock.stopTime = this._bak_stopTime, delete this._bak_stopTime), this._bak_multiplier && (this.viewer.clock.multiplier = this._bak_multiplier, delete this._bak_multiplier), this._bak_clockRange && (this.viewer.clock.clockRange = this._bak_clockRange, delete this._bak_clockRange), this._flyok_point_index = 0, this._isStart = !1
}
}, {
key: "destroy",
value: function () {
this.stop(), this.entity && (this.viewer.entities.remove(this.entity), delete this.entity), this.wallEntity && (this.viewer.entities.remove(this.wallEntity), delete this.wallEntity), this.cylinderEntity && (this.viewer.entities.remove(this.cylinderEntity), delete this.cylinderEntity)
}
}, {
key: "popup",
get: function () {
return this._popup
},
set: function (e) {
this._popup = e, this.entity && (this.entity.popup = e)
}
}, {
key: "info",
get: function () {
return this.timeinfo
}
}, {
key: "indexForFlyOK",
get: function () {
return this._flyok_point_index
}
}, {
key: "position",
get: function () {
return l.Property.getValueOrUndefined(this.property, this.viewer.clock.currentTime, g)
}
}, {
key: "orientation",
get: function () {
return l.Property.getValueOrUndefined(this.velocityOrientation, this.viewer.clock.currentTime, v)
}
}, {
key: "hdr",
get: function () {
var e = this.position,
t = this.orientation;
return (0, h.getHeadingPitchRollByOrientation)(e, t)
}
}, {
key: "matrix",
get: function () {
return this.getModelMatrix()
}
}]), e
}()
}, function (e, t, i) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.EditPolygonEx = void 0;
var r = i(0),
n = (function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
t.default = e
}(r), i(19));
t.EditPolygonEx = n.EditPolygon.extend({
_hasMidPoint: !1,
changePositionsToCallback: function () {
this._positions_draw = this.entity._positions_draw, this._positions_show = this.entity._positions_show
},
updateAttrForEditing: function () {
if (null == this._positions_draw || this._positions_draw.length < this._minPointNum) return void(this._positions_show = this._positions_draw);
this._positions_show = this.getShowPositions(this._positions_draw, this.entity.attribute), this.entity._positions_show = this._positions_show
},
getShowPositions: function (e, t) {
return e
},
finish: function () {
this.entity._positions_show = this._positions_show, this.entity._positions_draw = this._positions_draw
}
})
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.CircleFadeMaterial = void 0;
var n = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o),
s = i(133),
l = function (e) {
return e && e.__esModule ? e : {
default: e
}
}(s),
u = new a.Color(0, 0, 0, 0),
c = t.CircleFadeMaterial = function () {
function e(t) {
r(this, e), t = a.defaultValue(t, a.defaultValue.EMPTY_OBJECT), this._definitionChanged = new a.Event, this._color = void 0, this._colorSubscription = void 0, this.color = a.defaultValue(t.color, u), this._duration = t.duration || 1e3, this._time = void 0
}
return n(e, [{
key: "getType",
value: function (e) {
return a.Material.CircleFadeMaterialType
}
}, {
key: "getValue",
value: function (e, t) {
return a.defined(t) || (t = {}), t.color = a.Property.getValueOrClonedDefault(this._color, e, u, t.color), void 0 === this._time && (this._time = (new Date).getTime()), t.time = ((new Date).getTime() - this._time) / this._duration, t
}
}, {
key: "equals",
value: function (t) {
return this === t || t instanceof e && a.Property.equals(this._color, t._color)
}
}, {
key: "isConstant",
get: function () {
return !1
}
}, {
key: "definitionChanged",
get: function () {
return this._definitionChanged
}
}]), e
}();
a.defineProperties(c.prototype, {
color: a.createPropertyDescriptor("color")
}), a.Material.CircleFadeMaterialType = "CircleFadeMaterial", a.Material._materialCache.addMaterial(a.Material.CircleFadeMaterialType, {
fabric: {
type: a.Material.CircleFadeMaterialType,
uniforms: {
color: new a.Color(1, 0, 0, 1),
time: 1
},
source: l.default
},
translucent: function () {
return !0
}
})
}, function (e, t) {
e.exports = "czm_material czm_getMaterial(czm_materialInput materialInput)\r\n{\r\n czm_material material = czm_getDefaultMaterial(materialInput);\r\n material.diffuse = 1.5 * color.rgb;\r\n vec2 st = materialInput.st;\r\n float dis = distance(st, vec2(0.5, 0.5));\r\n float per = fract(time);\r\n if(dis > per * 0.5){\r\n //material.alpha = 0.0;\r\n discard;\r\n }else {\r\n material.alpha = color.a * dis / per / 2.0;\r\n }\r\n return material;\r\n}"
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.CircleScanMaterial = void 0;
var n = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o),
s = i(135),
l = function (e) {
return e && e.__esModule ? e : {
default: e
}
}(s),
u = t.CircleScanMaterial = function () {
function e(t) {
r(this, e), t = a.defaultValue(t, a.defaultValue.EMPTY_OBJECT), this._definitionChanged = new a.Event, this._colorSubscription = void 0, this._color = a.defaultValue(t.color, new a.Color(1, 0, 0, 1)), this._scanImg = a.defaultValue(t.url)
}
return n(e, [{
key: "getType",
value: function (e) {
return a.Material.EntityScanMaterialType
}
}, {
key: "getValue",
value: function (e, t) {
return a.defined(t) || (t = {}), t.color = this._color, t.scanImg = this._scanImg, t
}
}, {
key: "equals",
value: function (t) {
return this === t || t instanceof e && a.Property.equals(this._color, t._color)
}
}, {
key: "isConstant",
get: function () {
return !1
}
}, {
key: "definitionChanged",
get: function () {
return this._definitionChanged
}
}]), e
}();
a.defineProperties(u.prototype, {
color: a.createPropertyDescriptor("color"),
scanImg: a.createPropertyDescriptor("scanImg")
}), a.Material.EntityScanMaterialType = "CircleScanMaterial", a.Material._materialCache.addMaterial(a.Material.EntityScanMaterialType, {
fabric: {
type: a.Material.EntityScanMaterialType,
uniforms: {
color: new a.Color(1, 0, 0, 1),
scanImg: ""
},
source: l.default
},
translucent: function () {
return !0
}
})
}, function (e, t) {
e.exports = "czm_material czm_getMaterial(czm_materialInput materialInput)\r\n{\r\n czm_material material = czm_getDefaultMaterial(materialInput);\r\n vec2 st = materialInput.st;\r\n vec4 imgC = texture2D(scanImg,st);\r\n if(imgC.a>.0){\r\n material.diffuse = color.rgb;\r\n }\r\n material.alpha = imgC.a;\r\n return material;\r\n}"
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.GroundLineFlowMaterial = void 0;
var n = i(0),
o = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(n),
a = i(137),
s = function (e) {
return e && e.__esModule ? e : {
default: e
}
}(a);
t.GroundLineFlowMaterial = function e(t) {
r(this, e), t = o.defaultValue(t, o.defaultValue.EMPTY_OBJECT);
var i = o.defaultValue(t.color, new o.Color(1, 0, 0, 1)),
n = t.url || t.image,
a = o.defaultValue(t.repeat, {
x: 10,
y: 1
}),
l = o.defaultValue(t.axisY, !1),
u = o.defaultValue(t.speed, 1);
return new o.Material({
fabric: {
uniforms: {
color: i,
image: n,
repeat: a,
axisY: l,
speed: u
},
source: s.default
}
})
}
}, function (e, t) {
e.exports = "czm_material czm_getMaterial(czm_materialInput materialInput) \r\n{ \r\n czm_material material = czm_getDefaultMaterial(materialInput); \r\n vec2 st = repeat * materialInput.st;\r\n // vec4 color = texture2D(image, materialInput.st/repeat); \r\n vec4 colorImage = texture2D(image, vec2(fract((axisY?st.t:st.s) - czm_frameNumber*speed/100.0), st.t));\r\n if(color.a == 0.0)\r\n {\r\n material.alpha = colorImage.a;\r\n material.diffuse = colorImage.rgb; \r\n }\r\n else\r\n {\r\n material.alpha = colorImage.a * color.a;\r\n material.diffuse = max(color.rgb * material.alpha * 3.0, color.rgb); \r\n }\r\n return material; \r\n}"
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
function n(e, t) {
d++;
var i = f + d + "Type",
r = f + d + "Image";
return s.Material[i] = i, s.Material[r] = e, s.Material._materialCache.addMaterial(s.Material[i], {
fabric: {
type: i,
uniforms: {
color: new s.Color(1, 0, 0, 1),
image: s.Material[r],
time: 0,
repeat: t || new s.Cartesian2(1, 1)
},
source: u.default
},
translucent: function () {
return !0
}
}), {
type: s.Material[i],
image: s.Material[r]
}
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.TextMaterial = void 0;
var o = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
a = i(0),
s = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(a),
l = i(139),
u = function (e) {
return e && e.__esModule ? e : {
default: e
}
}(l),
c = new s.Color(0, 0, 0, 0),
h = t.TextMaterial = function () {
function e(t) {
if (r(this, e), t = s.defaultValue(t, s.defaultValue.EMPTY_OBJECT), t.text) {
this._text = t.text, this._textStyles = s.defaultValue(t.textStyles, {
font: "50px 楷体",
fill: !0,
fillColor: new s.Color(1, 1, 0, 1),
stroke: !0,
strokeWidth: 2,
strokeColor: new s.Color(1, 1, 1, .8),
backgroundColor: new s.Color(1, 1, 1, .1),
textBaseline: "top",
padding: 40
}), this._definitionChanged = new s.Event, this._color = void 0, this._colorSubscription = void 0, this.color = s.defaultValue(t.color, c), this.repeat = s.defaultValue(t.repeat, new s.Cartesian2(1, 1)), this._img = this._text2Img(this._text, this._textStyles);
var i = n(this._img.src, this.repeat);
this._materialType = s.clone(i.type), this._materialImage = s.clone(i.image)
}
}
return o(e, [{
key: "getType",
value: function (e) {
return this._materialType
}
}, {
key: "getValue",
value: function (e, t) {
return s.defined(t) || (t = {}), t.color = s.Property.getValueOrClonedDefault(this._color, e, c, t.color), t.image = this._materialImage, t.repeat = this.repeat, t
}
}, {
key: "equals",
value: function (t) {
return this === t || t instanceof e && s.Property.equals(this._color, t._color)
}
}, {
key: "_text2Img",
value: function (e, t) {
var i = s.writeTextToCanvas(e, t);
if (i) {
this.canvas = i;
var r = new Image;
return r.src = i.toDataURL("image/png"), r
}
}
}, {
key: "isConstant",
get: function () {
return !1
}
}, {
key: "definitionChanged",
get: function () {
return this._definitionChanged
}
}, {
key: "text",
get: function () {
return this._text
},
set: function (e) {
if (e) {
this._text = e, delete this._img, this._img = this._text2Img(this._text, this._textStyles);
var t = n(this._img.src, this.repeat);
this._materialType = s.clone(t.type), this._materialImage = s.clone(t.image)
}
}
}, {
key: "textStyles",
get: function () {
return this._textStyles
},
set: function (e) {
if (e) {
delete this._img, this._textStyles = e, this._img = this._text2Img(this._text, this._textStyles);
var t = n(this._img.src, this.repeat);
this._materialType = s.clone(t.type), this._materialImage = s.clone(t.image)
}
}
}]), e
}();
s.defineProperties(h.prototype, {
color: s.createPropertyDescriptor("color")
});
var d = 0,
f = "Text"
}, function (e, t) {
e.exports = "czm_material czm_getMaterial(czm_materialInput materialInput)\r\n{\r\n czm_material material = czm_getDefaultMaterial(materialInput);\r\n vec2 mst = fract(materialInput.st + vec2(.0,.0));\r\n mst = vec2(mst.x,mst.y);\r\n vec2 st = fract(repeat * mst);\r\n vec4 colorImage = texture2D(image, st);\r\n if(color.a == 0.0)\r\n {\r\n material.alpha = colorImage.a;\r\n material.diffuse = colorImage.rgb; \r\n }\r\n else\r\n {\r\n material.alpha = colorImage.a * color.a;\r\n material.diffuse = max(color.rgb * material.alpha * 3.0, color.rgb); \r\n }\r\n return material;\r\n}"
}, function (e, t) {
e.exports = "attribute vec4 position;\r\nattribute vec3 normal;\r\n\r\nvarying vec3 v_position;\r\nvarying vec3 v_positionWC;\r\nvarying vec3 v_positionEC;\r\nvarying vec3 v_normalEC;\r\n\r\nvoid main()\r\n{\r\n gl_Position = czm_modelViewProjection * position;\r\n v_position = vec3(position);\r\n v_positionWC = (czm_model * position).xyz;\r\n v_positionEC = (czm_modelView * position).xyz;\r\n v_normalEC = czm_normal * normal;\r\n}"
}, function (e, t) {
e.exports = '#ifdef GL_OES_standard_derivatives\r\n #extension GL_OES_standard_derivatives : enable\r\n#endif\r\n\r\nuniform bool u_showIntersection;\r\nuniform bool u_showThroughEllipsoid;\r\n\r\nuniform float u_radius;\r\nuniform float u_xHalfAngle;\r\nuniform float u_yHalfAngle;\r\nuniform float u_normalDirection;\r\nuniform float u_type;\r\n\r\nvarying vec3 v_position;\r\nvarying vec3 v_positionWC;\r\nvarying vec3 v_positionEC;\r\nvarying vec3 v_normalEC;\r\n\r\nvec4 getColor(float sensorRadius, vec3 pointEC)\r\n{\r\n czm_materialInput materialInput;\r\n\r\n vec3 pointMC = (czm_inverseModelView * vec4(pointEC, 1.0)).xyz;\r\n materialInput.st = sensor2dTextureCoordinates(sensorRadius, pointMC);\r\n materialInput.str = pointMC / sensorRadius;\r\n\r\n vec3 positionToEyeEC = -v_positionEC;\r\n materialInput.positionToEyeEC = positionToEyeEC;\r\n\r\n vec3 normalEC = normalize(v_normalEC);\r\n materialInput.normalEC = u_normalDirection * normalEC;\r\n\r\n czm_material material = czm_getMaterial(materialInput);\r\n\r\n return mix(czm_phong(normalize(positionToEyeEC), material), vec4(material.diffuse, material.alpha), 0.4);\r\n\r\n}\r\n\r\nbool isOnBoundary(float value, float epsilon)\r\n{\r\n float width = getIntersectionWidth();\r\n float tolerance = width * epsilon;\r\n\r\n#ifdef GL_OES_standard_derivatives\r\n float delta = max(abs(dFdx(value)), abs(dFdy(value)));\r\n float pixels = width * delta;\r\n float temp = abs(value);\r\n // There are a couple things going on here.\r\n // First we test the value at the current fragment to see if it is within the tolerance.\r\n // We also want to check if the value of an adjacent pixel is within the tolerance,\r\n // but we don\'t want to admit points that are obviously not on the surface.\r\n // For example, if we are looking for "value" to be close to 0, but value is 1 and the adjacent value is 2,\r\n // then the delta would be 1 and "temp - delta" would be "1 - 1" which is zero even though neither of\r\n // the points is close to zero.\r\n return temp < tolerance && temp < pixels || (delta < 10.0 * tolerance && temp - delta < tolerance && temp < pixels);\r\n#else\r\n return abs(value) < tolerance;\r\n#endif\r\n}\r\n\r\nvec4 shade(bool isOnBoundary)\r\n{\r\n if (u_showIntersection && isOnBoundary)\r\n {\r\n return getIntersectionColor();\r\n }\r\n if(u_type == 1.0){\r\n return getLineColor();\r\n }\r\n return getColor(u_radius, v_positionEC);\r\n}\r\n\r\nfloat ellipsoidSurfaceFunction(czm_ellipsoid ellipsoid, vec3 point)\r\n{\r\n vec3 scaled = ellipsoid.inverseRadii * point;\r\n return dot(scaled, scaled) - 1.0;\r\n}\r\n\r\nvoid main()\r\n{\r\n vec3 sensorVertexWC = czm_model[3].xyz; // (0.0, 0.0, 0.0) in model coordinates\r\n vec3 sensorVertexEC = czm_modelView[3].xyz; // (0.0, 0.0, 0.0) in model coordinates\r\n\r\n //vec3 pixDir = normalize(v_position);\r\n float positionX = v_position.x;\r\n float positionY = v_position.y;\r\n float positionZ = v_position.z;\r\n\r\n vec3 zDir = vec3(0.0, 0.0, 1.0);\r\n vec3 lineX = vec3(positionX, 0 ,positionZ);\r\n vec3 lineY = vec3(0, positionY, positionZ);\r\n float resX = dot(normalize(lineX), zDir);\r\n if(resX < cos(u_xHalfAngle)-0.00001){\r\n discard;\r\n }\r\n float resY = dot(normalize(lineY), zDir);\r\n if(resY < cos(u_yHalfAngle)-0.00001){\r\n discard;\r\n }\r\n\r\n\r\n czm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC();\r\n float ellipsoidValue = ellipsoidSurfaceFunction(ellipsoid, v_positionWC);\r\n\r\n // Occluded by the ellipsoid?\r\n\tif (!u_showThroughEllipsoid)\r\n\t{\r\n\t // Discard if in the ellipsoid\r\n\t // PERFORMANCE_IDEA: A coarse check for ellipsoid intersection could be done on the CPU first.\r\n\t if (ellipsoidValue < 0.0)\r\n\t {\r\n discard;\r\n\t }\r\n\r\n\t // Discard if in the sensor\'s shadow\r\n\t if (inSensorShadow(sensorVertexWC, ellipsoid, v_positionWC))\r\n\t {\r\n\t discard;\r\n\t }\r\n }\r\n\r\n // Notes: Each surface functions should have an associated tolerance based on the floating point error.\r\n bool isOnEllipsoid = isOnBoundary(ellipsoidValue, czm_epsilon3);\r\n //isOnEllipsoid = false;\r\n //if((resX >= 0.8 && resX <= 0.81)||(resY >= 0.8 && resY <= 0.81)){\r\n /*if(false){\r\n gl_FragColor = vec4(1.0,0.0,0.0,1.0);\r\n }else{\r\n gl_FragColor = shade(isOnEllipsoid);\r\n }\r\n*/\r\n gl_FragColor = shade(isOnEllipsoid);\r\n\r\n}'
}, function (e, t) {
e.exports = "uniform vec4 u_intersectionColor;\nuniform float u_intersectionWidth;\nuniform vec4 u_lineColor;\n\nbool inSensorShadow(vec3 coneVertexWC, czm_ellipsoid ellipsoidEC, vec3 pointWC)\n{\n // Diagonal matrix from the unscaled ellipsoid space to the scaled space. \n vec3 D = ellipsoidEC.inverseRadii;\n\n // Sensor vertex in the scaled ellipsoid space\n vec3 q = D * coneVertexWC;\n float qMagnitudeSquared = dot(q, q);\n float test = qMagnitudeSquared - 1.0;\n \n // Sensor vertex to fragment vector in the ellipsoid's scaled space\n vec3 temp = D * pointWC - q;\n float d = dot(temp, q);\n \n // Behind silhouette plane and inside silhouette cone\n return (d < -test) && (d / length(temp) < -sqrt(test));\n}\n\n///////////////////////////////////////////////////////////////////////////////\n\nvec4 getLineColor()\n{\n return u_lineColor;\n}\n\nvec4 getIntersectionColor()\n{\n return u_intersectionColor;\n}\n\nfloat getIntersectionWidth()\n{\n return u_intersectionWidth;\n}\n\nvec2 sensor2dTextureCoordinates(float sensorRadius, vec3 pointMC)\n{\n // (s, t) both in the range [0, 1]\n float t = pointMC.z / sensorRadius;\n float s = 1.0 + (atan(pointMC.y, pointMC.x) / czm_twoPi);\n s = s - floor(s);\n \n return vec2(s, t);\n}\n"
}, function (e, t) {
e.exports = '#ifdef GL_OES_standard_derivatives\r\n #extension GL_OES_standard_derivatives : enable\r\n#endif\r\n\r\nuniform bool u_showIntersection;\r\nuniform bool u_showThroughEllipsoid;\r\n\r\nuniform float u_radius;\r\nuniform float u_xHalfAngle;\r\nuniform float u_yHalfAngle;\r\nuniform float u_normalDirection;\r\nuniform vec4 u_color;\r\n\r\nvarying vec3 v_position;\r\nvarying vec3 v_positionWC;\r\nvarying vec3 v_positionEC;\r\nvarying vec3 v_normalEC;\r\n\r\nvec4 getColor(float sensorRadius, vec3 pointEC)\r\n{\r\n czm_materialInput materialInput;\r\n\r\n vec3 pointMC = (czm_inverseModelView * vec4(pointEC, 1.0)).xyz;\r\n materialInput.st = sensor2dTextureCoordinates(sensorRadius, pointMC);\r\n materialInput.str = pointMC / sensorRadius;\r\n\r\n vec3 positionToEyeEC = -v_positionEC;\r\n materialInput.positionToEyeEC = positionToEyeEC;\r\n\r\n vec3 normalEC = normalize(v_normalEC);\r\n materialInput.normalEC = u_normalDirection * normalEC;\r\n\r\n czm_material material = czm_getMaterial(materialInput);\r\n\r\n material.diffuse = u_color.rgb;\r\n material.alpha = u_color.a;\r\n\r\n return mix(czm_phong(normalize(positionToEyeEC), material), vec4(material.diffuse, material.alpha), 0.4);\r\n\r\n}\r\n\r\nbool isOnBoundary(float value, float epsilon)\r\n{\r\n float width = getIntersectionWidth();\r\n float tolerance = width * epsilon;\r\n\r\n#ifdef GL_OES_standard_derivatives\r\n float delta = max(abs(dFdx(value)), abs(dFdy(value)));\r\n float pixels = width * delta;\r\n float temp = abs(value);\r\n // There are a couple things going on here.\r\n // First we test the value at the current fragment to see if it is within the tolerance.\r\n // We also want to check if the value of an adjacent pixel is within the tolerance,\r\n // but we don\'t want to admit points that are obviously not on the surface.\r\n // For example, if we are looking for "value" to be close to 0, but value is 1 and the adjacent value is 2,\r\n // then the delta would be 1 and "temp - delta" would be "1 - 1" which is zero even though neither of\r\n // the points is close to zero.\r\n return temp < tolerance && temp < pixels || (delta < 10.0 * tolerance && temp - delta < tolerance && temp < pixels);\r\n#else\r\n return abs(value) < tolerance;\r\n#endif\r\n}\r\n\r\nvec4 shade(bool isOnBoundary)\r\n{\r\n if (u_showIntersection && isOnBoundary)\r\n {\r\n return getIntersectionColor();\r\n }\r\n return getColor(u_radius, v_positionEC);\r\n}\r\n\r\nfloat ellipsoidSurfaceFunction(czm_ellipsoid ellipsoid, vec3 point)\r\n{\r\n vec3 scaled = ellipsoid.inverseRadii * point;\r\n return dot(scaled, scaled) - 1.0;\r\n}\r\n\r\nvoid main()\r\n{\r\n vec3 sensorVertexWC = czm_model[3].xyz; // (0.0, 0.0, 0.0) in model coordinates\r\n vec3 sensorVertexEC = czm_modelView[3].xyz; // (0.0, 0.0, 0.0) in model coordinates\r\n\r\n //vec3 pixDir = normalize(v_position);\r\n float positionX = v_position.x;\r\n float positionY = v_position.y;\r\n float positionZ = v_position.z;\r\n\r\n vec3 zDir = vec3(0.0, 0.0, 1.0);\r\n vec3 lineX = vec3(positionX, 0 ,positionZ);\r\n vec3 lineY = vec3(0, positionY, positionZ);\r\n float resX = dot(normalize(lineX), zDir);\r\n if(resX < cos(u_xHalfAngle) - 0.0001){\r\n discard;\r\n }\r\n float resY = dot(normalize(lineY), zDir);\r\n if(resY < cos(u_yHalfAngle)- 0.0001){\r\n discard;\r\n }\r\n\r\n\r\n czm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC();\r\n float ellipsoidValue = ellipsoidSurfaceFunction(ellipsoid, v_positionWC);\r\n\r\n // Occluded by the ellipsoid?\r\n\tif (!u_showThroughEllipsoid)\r\n\t{\r\n\t // Discard if in the ellipsoid\r\n\t // PERFORMANCE_IDEA: A coarse check for ellipsoid intersection could be done on the CPU first.\r\n\t if (ellipsoidValue < 0.0)\r\n\t {\r\n discard;\r\n\t }\r\n\r\n\t // Discard if in the sensor\'s shadow\r\n\t if (inSensorShadow(sensorVertexWC, ellipsoid, v_positionWC))\r\n\t {\r\n\t discard;\r\n\t }\r\n }\r\n\r\n // Notes: Each surface functions should have an associated tolerance based on the floating point error.\r\n bool isOnEllipsoid = isOnBoundary(ellipsoidValue, czm_epsilon3);\r\n gl_FragColor = shade(isOnEllipsoid);\r\n\r\n}'
}, function (e, t, i) {
"use strict";
Object.defineProperty(t, "__esModule", {
value: !0
}), t.RectangularSensorVisualizer = void 0;
var r = i(0),
n = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(r),
o = i(59),
a = i(145),
s = n.AssociativeArray,
l = n.Cartesian3,
u = n.Color,
c = n.defined,
h = n.destroyObject,
d = n.DeveloperError,
f = n.Matrix3,
p = n.Matrix4,
m = n.Quaternion,
g = n.MaterialProperty,
v = n.Property,
y = new f,
_ = new l,
w = new l,
b = new m,
C = new l,
x = new m,
P = function e(t, i) {
if (!c(t)) throw new d("scene is required.");
if (!c(i)) throw new d("entityCollection is required.");
i.collectionChanged.addEventListener(e.prototype._onCollectionChanged, this), this._scene = t, this._primitives = t.primitives, this._entityCollection = i, this._hash = {}, this._entitiesToVisualize = new s, this._onCollectionChanged(i, i.values, [], [])
};
P.prototype.update = function (e) {
if (!c(e)) throw new d("time is required.");
for (var t = this._entitiesToVisualize.values, i = this._hash, r = this._primitives, a = 0, s = t.length; a < s; a++) {
var h, P, E, M, T, S = t[a],
O = S._rectangularSensor,
D = i[S.id],
k = S.isShowing && S.isAvailable(e) && v.getValueOrDefault(O._show, e, !0);
if (k && (h = v.getValueOrUndefined(S._position, e, _), P = v.getValueOrUndefined(S._orientation, e, b), E = v.getValueOrUndefined(O._radius, e), M = v.getValueOrUndefined(O._xHalfAngle, e), T = v.getValueOrUndefined(O._yHalfAngle, e), k = c(h) && c(M) && c(T)), k) {
var A = c(D) ? D.primitive : void 0;
c(A) || (A = new o.RectangularSensorPrimitive, A.id = S, r.add(A), D = {
primitive: A,
position: void 0,
orientation: void 0
}, i[S.id] = D);
var R = v.getValueOrUndefined(O._gaze, e);
if (c(R)) {
var L = v.getValueOrUndefined(R._position, e, w);
if (!c(h) || !c(L)) continue;
var F = l.subtract(h, L, C),
N = l.angleBetween(n.Cartesian3.UNIT_Z, F),
V = l.cross(n.Cartesian3.UNIT_Z, F, C),
P = m.fromAxisAngle(V, N - Math.PI, x);
E = l.distance(h, L), A.modelMatrix = p.fromRotationTranslation(f.fromQuaternion(P, y), h, A.modelMatrix)
} else l.equals(h, D.position) && m.equals(P, D.orientation) || (c(P) ? (A.modelMatrix = p.fromRotationTranslation(f.fromQuaternion(P, y), h, A.modelMatrix), D.position = l.clone(h, D.position), D.orientation = m.clone(P, D.orientation)) : (A.modelMatrix = n.Transforms.eastNorthUpToFixedFrame(h), D.position = l.clone(h, D.position)));
A.show = !0, A.gaze = R, A.radius = E, A.xHalfAngle = M, A.yHalfAngle = T, A.lineColor = v.getValueOrDefault(O._lineColor, e, u.WHITE), A.showSectorLines = v.getValueOrDefault(O._showSectorLines, e, !0), A.showSectorSegmentLines = v.getValueOrDefault(O._showSectorSegmentLines, e, !0), A.showLateralSurfaces = v.getValueOrDefault(O._showLateralSurfaces, e, !0), A.material = g.getValue(e, O._material, A.material), A.showDomeSurfaces = v.getValueOrDefault(O._showDomeSurfaces, e, !0), A.showDomeLines = v.getValueOrDefault(O._showDomeLines, e, !0), A.showIntersection = v.getValueOrDefault(O._showIntersection, e, !0), A.intersectionColor = v.getValueOrDefault(O._intersectionColor, e, u.WHITE), A.intersectionWidth = v.getValueOrDefault(O._intersectionWidth, e, 1), A.showThroughEllipsoid = v.getValueOrDefault(O._showThroughEllipsoid, e, !0), A.scanPlaneMode = v.getValueOrDefault(O._scanPlaneMode, e), A.scanPlaneColor = v.getValueOrDefault(O._scanPlaneColor, e, u.WHITE), A.showScanPlane = v.getValueOrDefault(O._showScanPlane, e, !0), A.scanPlaneRate = v.getValueOrDefault(O._scanPlaneRate, e, 1)
} else c(D) && (D.primitive.show = !1)
}
return !0
}, P.prototype.isDestroyed = function () {
return !1
}, P.prototype.destroy = function () {
for (var e = this._entitiesToVisualize.values, t = this._hash, i = this._primitives, r = e.length - 1; r > -1; r--)(0, a.removePrimitive)(e[r], t, i);
return h(this)
}, P.prototype._onCollectionChanged = function (e, t, i, r) {
var n, o, s = this._entitiesToVisualize,
l = this._hash,
u = this._primitives;
for (n = t.length - 1; n > -1; n--) o = t[n], c(o._rectangularSensor) && c(o._position) && s.set(o.id, o);
for (n = r.length - 1; n > -1; n--) o = r[n], c(o._rectangularSensor) && c(o._position) ? s.set(o.id, o) : ((0, a.removePrimitive)(o, l, u), s.remove(o.id));
for (n = i.length - 1; n > -1; n--) o = i[n], (0, a.removePrimitive)(o, l, u), s.remove(o.id)
}, t.RectangularSensorVisualizer = P
}, function (e, t, i) {
"use strict";
function r(e, t, i) {
var r = t[e.id];
if (o.defined(r)) {
var n = r.primitive;
try {
i.remove(n)
} catch (e) {}
n.isDestroyed && !n.isDestroyed() && n.destroy(), delete t[e.id]
}
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.removePrimitive = r;
var n = i(0),
o = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(n)
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.DivPoint = void 0;
var n = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o),
s = i(5),
l = function (e) {
return e && e.__esModule ? e : {
default: e
}
}(s),
u = i(1);
t.DivPoint = function () {
function e(t, i) {
r(this, e), this.viewer = t, this.position = i.position, this.position_original = i.position, this.anchor = i.anchor, (i.visibleDistanceMin || i.visibleDistanceMax) && (i.distanceDisplayCondition = new a.DistanceDisplayCondition(i.visibleDistanceMin || 0, i.visibleDistanceMax || 1e5)), this._distanceDisplayCondition = i.distanceDisplayCondition, this._heightReference = a.defaultValue(i.heightReference, a.HeightReference.NONE), this.opts = i, this._depthTest = !0, this.$view = (0, l.default)(i.html), this.$view.css({
position: "absolute",
left: "0",
top: "0"
}), this.$view.appendTo("#" + t._container.id), this.visible = a.defaultValue(i.visible, !0);
var n = this;
(i.click || i.popup) && this.$view.click(function (e) {
i.popup && t.wutu.popup.show(i, n.position), i.click && i.click(i, n, e)
}), i.tooltip && this.$view.hover(function () {
t.wutu.tooltip.show(i, n.position)
}, function () {
t.wutu.tooltip.close()
}), this.$view.on("mousewheel", function (e) {}), t.scene.postRender.addEventListener(this.updateViewPoint, this)
}
return n(e, [{
key: "updateViewPoint",
value: function () {
if (this._visible) {
this._heightReference == a.HeightReference.CLAMP_TO_GROUND ? this.position = (0, u.updateHeightForClampToGround)(this.viewer, this.position_original) : this._heightReference == a.HeightReference.RELATIVE_TO_GROUND && (this.position = (0, u.updateHeightForClampToGround)(this.viewer, this.position_original, !0));
var e, t = this.viewer.scene,
i = a.SceneTransforms.wgs84ToWindowCoordinates(t, this.position);
if (e = t.mode === a.SceneMode.SCENE3D ? a.Cartesian3.distance(this.position, this.viewer.camera.position) : this.viewer.camera.positionCartographic.height, null == i || this._distanceDisplayCondition && (this._distanceDisplayCondition.near > e || this._distanceDisplayCondition.far < e)) return void(this.$view.is(":visible") && this.$view.hide());
if (this._depthTest && t.mode === a.SceneMode.SCENE3D) {
var r = t.camera.getPickRay(i),
n = t.globe.pick(r, t);
if (n) {
if (a.Cartesian3.distance(this.position, n) > 1e6) return void(this.$view.is(":visible") && this.$view.hide())
}
}
var o = this.$view.height(),
s = this.$view.width(),
l = i.x,
c = i.y - o;
this.anchor ? ("center" == this.anchor[0] ? l -= s / 2 : l += this.anchor[0], c += this.anchor[1]) : l -= s / 2, this.$view.is(":visible") || this.$view.show();
var h = 1;
if (this.opts.scaleByDistance) {
var d = this.opts.scaleByDistance;
h = e <= d.near ? d.nearValue : e > d.near && e < d.far ? d.nearValue + (d.farValue - d.nearValue) * (e - d.near) / (d.far - d.near) : d.farValue
}
var f = "matrix(" + h + ",0,0," + h + "," + l + "," + c + ")";
this.$view.css({
transform: f,
"transform-origin": "left bottom 0",
"-ms-transform": f,
"-ms-transform-origin": "left bottom 0",
"-webkit-transform": f,
"-webkit-transform-origin": "left bottom 0",
"-moz-transform": f,
"-moz-transform-origin": "left bottom 0",
"-o-transform": f,
"-o-transform-origin": "left bottom 0"
}), this.opts.postRender && this.opts.postRender({
x: l,
y: c,
height: o,
width: s,
distance: e
})
}
}
}, {
key: "setVisible",
value: function (e) {
this._visible = e, e ? this.$view.show() : this.$view.hide()
}
}, {
key: "destroy",
value: function () {
this.viewer.scene.postRender.removeEventListener(this.updateViewPoint, this), this.$view.remove(), this.$view = null, this.position = null, this.anchor = null, this.viewer = null
}
}, {
key: "dom",
get: function () {
return this.$view
}
}, {
key: "visible",
get: function () {
return this._visible
},
set: function (e) {
this._visible = e, this.setVisible(e)
}
}, {
key: "depthTest",
get: function () {
return this._depthTest
},
set: function (e) {
this._depthTest = e
}
}]), e
}()
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.DynamicRiver = void 0;
var n = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o),
s = i(2),
l = i(148),
u = i(16);
t.DynamicRiver = function () {
function e(t, i) {
r(this, e), t && (this.viewer = t, i = i || {}, this.positions = a.defaultValue(i.positions, null), this._image = a.defaultValue(i.image, null), this._flipY = a.defaultValue(i.flipY, !1), this._width = a.defaultValue(i.width, 10), this._height = a.defaultValue(i.height, 0), this._alpha = a.defaultValue(i.alpha, .5), this._speed = a.defaultValue(i.speed, 1), this._move = a.defaultValue(i.move, !0), this._moveDir = a.defaultValue(i.moveDir, !0), this._moveVar = a.defaultValue(i.moveVar, new a.Cartesian3(50, 1, 100)), this.callBack = i.callBack, this.init())
}
return n(e, [{
key: "init",
value: function () {
this.prepareVertex(), this.sideRes && (this.material = this.prepareMaterial(), this.riverPrimitive && this.viewer.scene.primitives.remove(this.riverPrimitive), this.riverPrimitive = this.createPrimitive(), this.viewer.scene.primitives.add(this.riverPrimitive), this.callBack && this.callBack())
}
}, {
key: "prepareVertex",
value: function () {
(0, s.isArray)(this.positions) && this.positions.length && (this.sideRes = (0, l.Lines2Plane)(this.positions, this.width, this.height))
}
}, {
key: "setPositions",
value: function (e) {
this.positions = e, this.init()
}
}, {
key: "resetPos",
value: function () {
this.sideRes = (0, l.Lines2Plane)(this.positions, this.width, this.height), this.sideRes && (this.material = this.prepareMaterial(), this.riverPrimitive && this.viewer.scene.primitives.remove(this.riverPrimitive), this.riverPrimitive = this.createPrimitive(), this.viewer.scene.primitives.add(this.riverPrimitive))
}
}, {
key: "drawLines",
value: function (e) {
this.drawControl || (this.drawControl = new u.Draw(viewer, {
hasEdit: !1,
removeScreenSpaceEvent: !0
}));
var t = this.drawControl,
i = this;
t.startDraw({
type: "polyline",
style: e || {
color: "#55ff33",
width: 3,
clampToGround: !0
},
success: function (e) {
var t = i.drawControl.getPositions(e);
i.positions = t, i.setPositions(t), i.drawControl.deleteAll()
}
})
}
}, {
key: "prepareMaterial",
value: function () {
if (this.image) {
var e = new a.Material({
fabric: {
uniforms: {
image: this.image,
alpha: this.alpha,
moveVar: this.moveVar,
reflux: this.moveDir ? -1 : 1,
speed: this.speed,
move: this.move,
flipY: this.flipY
},
source: "czm_material czm_getMaterial(czm_materialInput materialInput) { \n czm_material material = czm_getDefaultMaterial(materialInput); \n vec2 st = materialInput.st;\n if(move){\n float r = sqrt((st.x-0.8)*(st.x-0.8) + (st.y-0.8)*(st.y-0.8));\n float r2 = sqrt((st.x-0.2)*(st.x-0.2) + (st.y-0.2)*(st.y-0.2));\n float z = cos(moveVar.x*r + czm_frameNumber/100.0*moveVar.y)/moveVar.z;\n float z2 = cos(moveVar.x*r2 + czm_frameNumber/100.0*moveVar.y)/moveVar.z;\n st += sqrt(z*z+z2*z2);\n st.s += reflux * czm_frameNumber/1000.0 * speed;\n st.s = mod(st.s,1.0);\n }\n if(flipY){\n st = vec2(st.t,st.s);\n }\n vec4 colorImage = texture2D(image, st);\n material.alpha = alpha;\n material.diffuse = colorImage.rgb; \n return material; \n }"
}
});
return e
}
var e = a.Material.fromType("Color");
return e.uniforms.color = new a.Color(0, 1, 0, this.alpha), e
}
}, {
key: "createPrimitive",
value: function () {
var e = this.sideRes,
t = new Float64Array(e.vertexs),
i = new a.GeometryAttributes;
i.position = new a.GeometryAttribute({
componentDatatype: a.ComponentDatatype.DOUBLE,
componentsPerAttribute: 3,
values: t
}), i.st = new a.GeometryAttribute({
componentDatatype: a.ComponentDatatype.FLOAT,
componentsPerAttribute: 2,
values: e.uvs
});
var r = new a.Geometry({
attributes: i,
indices: e.indexs,
primitiveType: a.PrimitiveType.TRIANGLES,
boundingSphere: a.BoundingSphere.fromVertices(t)
}),
n = new a.GeometryInstance({
geometry: r
}),
o = new a.RenderState;
return o.depthTest.enabled = !0, new a.Primitive({
geometryInstances: n,
appearance: new a.Appearance({
material: this.material,
renderState: o,
vertexShaderSource: "attribute vec3 position3DHigh;\n attribute vec3 position3DLow;\n attribute vec2 st;\n attribute float batchId;\n \n varying vec3 v_positionMC;\n varying vec3 v_positionEC;\n varying vec2 v_st;\n \n void main()\n {\n vec4 p = czm_computePosition();\n \n v_positionMC = position3DHigh + position3DLow; // position in model coordinates\n v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates\n v_st = st;\n \n gl_Position = czm_modelViewProjectionRelativeToEye * p;\n }\n ",
fragmentShaderSource: "varying vec3 v_positionMC;\n varying vec3 v_positionEC;\n varying vec2 v_st;\n \n void main()\n {\n czm_materialInput materialInput;\n \n vec3 normalEC = normalize(czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\n #ifdef FACE_FORWARD\n normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n #endif\n \n materialInput.s = v_st.s;\n materialInput.st = v_st;\n materialInput.str = vec3(v_st, 0.0);\n \n // Convert tangent space material normal to eye space\n materialInput.normalEC = normalEC;\n materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);\n \n // Convert view vector to world space\n vec3 positionToEyeEC = -v_positionEC;\n materialInput.positionToEyeEC = positionToEyeEC;\n \n czm_material material = czm_getMaterial(materialInput);\n \n #ifdef FLAT\n gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n #else\n gl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n #endif\n }\n "
})
})
}
}, {
key: "offsetHeight",
value: function (e, t) {
this.startDH(e, t)
}
}, {
key: "startDH",
value: function (e, t) {
if (e && t && this.riverPrimitive) {
for (var i = this, r = 0, n = e / (20 * t), o = this.sideRes.self, s = new a.Cartesian3, l = 0, u = o.length; l < u; l++) {
var c = a.Cartesian3.normalize(o[l], new a.Cartesian3);
a.Cartesian3.add(s, c, s)
}
a.Cartesian3.normalize(s, s);
var h = a.clone(this.riverPrimitive.modelMatrix);
this.dhEvent = function () {
if (Math.abs(r) <= Math.abs(e)) {
var t = a.Cartesian3.multiplyByScalar(s, r, new a.Cartesian3);
i.riverPrimitive.modelMatrix = a.Matrix4.multiplyByTranslation(h, t, new a.Matrix4)
} else i.viewer.clock.onTick.removeEventListener(i.dhEvent);
r += n
}, this.viewer.clock.onTick.addEventListener(this.dhEvent)
}
}
}, {
key: "destroy",
value: function () {
this.viewer.scene.primitives.remove(this.riverPrimitive), this.drawControl && (this.drawControl.destroy(), delete this.drawControl), this.material.destroy(), delete this.material, delete this.image, delete this.position, delete this.width, delete this.height, delete this.alpha, delete this.speed, delete this._width, delete this._height, delete this._alpha, delete this._moveDir, delete this._speed, delete this.oldDepthTest, delete this.sideRes
}
}, {
key: "width",
get: function () {
return this._width
},
set: function (e) {
this._width = Number(e) || 1, this.resetPos()
}
}, {
key: "height",
get: function () {
return this._height
},
set: function (e) {
this._height = Number(e), this.resetPos()
}
}, {
key: "alpha",
get: function () {
return this._alpha
},
set: function (e) {
this._alpha = Number(e), this.material.uniforms.alpha = this._alpha
}
}, {
key: "moveDir",
get: function () {
return this._moveDir
},
set: function (e) {
this._moveDir = Boolean(e), this.material.uniforms.reflux = this._moveDir ? -1 : 1
}
}, {
key: "speed",
get: function () {
return this._speed
},
set: function (e) {
this._speed = Number(e) || 1, this.material.uniforms.speed = this._speed
}
}, {
key: "image",
get: function () {
return this._image
},
set: function (e) {
this._image = e, this.material.uniforms.image = this._image
}
}, {
key: "move",
get: function () {
return this._move
},
set: function (e) {
this._move = Boolean(e), this.material.uniforms.move = this._move
}
}, {
key: "flipY",
get: function () {
return this._flipY
},
set: function (e) {
this._flipY = Boolean(e), this.material.uniforms.flipY = this._flipY
}
}, {
key: "moveVar",
get: function () {
return this._moveVar
},
set: function (e) {
this._moveVar = e, this.material.uniforms.moveVar = this._moveVar
}
}]), e
}()
}, function (e, t, i) {
"use strict";
function r(e, t, i) {
if (!e || e.length <= 1 || !t || 0 == t) return void console.log("请确认参数符合规则:数组长度大于1,宽高不能为0!");
for (var r = e.length, a = [], l = [], u = t / 2, c = 0; c < r; c++) {
var h = void 0,
d = void 0,
f = void 0,
p = void 0,
m = void 0;
if (0 == c ? (h = e[c], d = e[c], f = e[c + 1]) : c == r - 1 ? (h = e[c - 1], d = e[c], f = e[c - 1]) : (h = e[c - 1], d = e[c], f = e[c + 1]), 0 != i && (h = n(h, i), d = n(d, i), f = n(f, i)), h && d && f) {
var g = o(d, f, u);
if (p = g.left, m = g.right, 0 == c) {
a.push(p), l.push(m), a.push(p), l.push(m);
continue
}
if (!(c < r - 1)) {
a.push(m), l.push(p), a.push(m), l.push(p);
continue
}
a.push(p), l.push(m), g = o(d, h, u), p = g.left, m = g.right, a.push(m), l.push(p)
}
}
var v = [],
y = [];
if (a.length != 2 * r) return void console.log("计算左右侧点出问题!");
for (var _ = 0; _ < r; _++) {
var w = e[_],
b = a[2 * _ + 0],
C = a[2 * _ + 1],
x = s.Cartesian3.subtract(b, w, new s.Cartesian3),
P = s.Cartesian3.subtract(C, w, new s.Cartesian3),
E = s.Cartesian3.add(x, P, new s.Cartesian3),
M = s.Cartesian3.add(w, E, new s.Cartesian3);
v.push(s.clone(M));
var T = l[2 * _ + 0],
S = l[2 * _ + 1];
x = s.Cartesian3.subtract(T, w, new s.Cartesian3), P = s.Cartesian3.subtract(S, w, new s.Cartesian3), E = s.Cartesian3.add(x, P, new s.Cartesian3), M = s.Cartesian3.add(w, E, new s.Cartesian3), y.push(s.clone(M))
}
for (var O = [], D = [], k = [], A = [], R = [], L = 0; L < r; L++) {
var F = s.EncodedCartesian3.fromCartesian(y[L]);
D.push(y[L].x), D.push(y[L].y), D.push(y[L].z), k.push(F.high.x), k.push(F.high.y), k.push(F.high.z), A.push(F.low.x), A.push(F.low.y), A.push(F.low.z), O.push(1, 1), L < r - 1 && (R.push(L + 2 * r), R.push(L + 1), R.push(L + 1 + r), R.push(L + 2 * r), R.push(L + 1 + r), R.push(r + L + 2 * r))
}
for (var N = 0; N < r; N++) {
var V = s.EncodedCartesian3.fromCartesian(v[N]);
D.push(v[N].x), D.push(v[N].y), D.push(v[N].z), k.push(V.high.x), k.push(V.high.y), k.push(V.high.z), A.push(V.low.x), A.push(V.low.y), A.push(V.low.z), O.push(1, 0)
}
for (var I = 0; I < r; I++) {
var z = s.EncodedCartesian3.fromCartesian(y[I]);
D.push(y[I].x), D.push(y[I].y), D.push(y[I].z), k.push(z.high.x), k.push(z.high.y), k.push(z.high.z), A.push(z.low.x), A.push(z.low.y), A.push(z.low.z), O.push(0, 1)
}
for (var H = 0; H < r; H++) {
var B = s.EncodedCartesian3.fromCartesian(v[H]);
D.push(v[H].x), D.push(v[H].y), D.push(v[H].z), k.push(B.high.x), k.push(B.high.y), k.push(B.high.z), A.push(B.low.x), A.push(B.low.y), A.push(B.low.z), O.push(0, 0)
}
return {
left: v,
right: y,
self: e,
vertexs: new Float32Array(D),
vertexsH: new Float32Array(k),
vertexsL: new Float32Array(A),
indexs: new Uint16Array(R),
uvs: new Float32Array(O)
}
}
function n(e, t) {
if (!(e instanceof s.Cartesian3)) return void console.log("请确认点是Cartesian3类型!");
if (!t || 0 == t) return void console.log("请确认高度是非零数值!");
var i = s.Cartesian3.normalize(e, new s.Cartesian3),
r = new s.Ray(e, i);
return s.Ray.getPoint(r, t)
}
function o(e, t, i) {
var r = s.Cartesian3.normalize(s.Cartesian3.subtract(t, e, new s.Cartesian3), new s.Cartesian3),
n = s.Cartesian3.normalize(e, new s.Cartesian3),
o = s.Cartesian3.cross(n, r, new s.Cartesian3),
a = s.Cartesian3.cross(r, n, new s.Cartesian3),
l = new s.Ray(e, o),
u = new s.Ray(e, a);
return {
left: s.Ray.getPoint(l, i),
right: s.Ray.getPoint(u, i)
}
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.Lines2Plane = r;
var a = i(0),
s = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(a)
}, function (e, t, i) {
"use strict";
function r() {
return "varying vec3 v_positionMC;\n varying vec3 v_positionEC;\n varying vec2 v_st;\n \n void main()\n {\n czm_materialInput materialInput;\n vec3 normalEC = normalize(czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\n #ifdef FACE_FORWARD\n normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n #endif\n materialInput.s = v_st.s;\n materialInput.st = v_st;\n materialInput.str = vec3(v_st, 0.0);\n materialInput.normalEC = normalEC;\n materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);\n vec3 positionToEyeEC = -v_positionEC;\n materialInput.positionToEyeEC = positionToEyeEC;\n czm_material material = czm_getMaterial(materialInput);\n #ifdef FLAT\n gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n #else\n gl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n gl_FragColor.a = 0.5;\n #endif\n }"
}
function n(e, t) {
return new a.Primitive({
geometryInstances: new a.GeometryInstance({
geometry: e,
id: t.id || "water"
}),
appearance: new a.EllipsoidSurfaceAppearance({
aboveGround: !1,
material: new a.Material({
fabric: {
type: "Water",
uniforms: {
normalMap: t.normalMap,
frequency: t.frequency || 8e3,
animationSpeed: t.animationSpeed || .03,
amplitude: t.amplitude || 5,
specularIntensity: t.specularIntensity || .8,
baseWaterColor: new a.Color.fromCssColorString(t.baseWaterColor || "#123e59"),
blendColor: new a.Color.fromCssColorString(t.blendColor || "#123e59")
}
}
}),
fragmentShaderSource: r()
}),
show: !0
})
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.createWaterPrimitive = n;
var o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o)
}, function (e, t) {
e.exports = "uniform sampler2D colorTexture;\r\nvarying vec2 v_textureCoordinates;\r\n\r\nfloat hash(float x){\r\n return fract(sin(x*133.3)*13.13);\r\n}\r\n\r\nvoid main(void){ \r\n float time = czm_frameNumber / 240.0;\r\n vec2 resolution = czm_viewport.zw;\r\n\r\n vec2 uv=(gl_FragCoord.xy*2.-resolution.xy)/min(resolution.x,resolution.y);\r\n vec3 c=vec3(.6,.7,.8);\r\n\r\n float a=-.4;\r\n float si=sin(a),co=cos(a);\r\n uv*=mat2(co,-si,si,co);\r\n uv*=length(uv+vec2(0,4.9))*.3+1.;\r\n\r\n float v=1.-sin(hash(floor(uv.x*100.))*2.);\r\n float b=clamp(abs(sin(20.*time*v+uv.y*(5./(2.+v))))-.95,0.,1.)*20.;\r\n c*=v*b; \r\n\r\n gl_FragColor = mix(texture2D(colorTexture, v_textureCoordinates), vec4(c,1), 0.5); \r\n}\r\n "
}, function (e, t) {
e.exports = "uniform sampler2D colorTexture;\r\nvarying vec2 v_textureCoordinates;\r\n\r\nfloat snow(vec2 uv,float scale){\r\n float time = czm_frameNumber / 60.0;\r\n float w=smoothstep(1.,0.,-uv.y*(scale/10.));if(w<.1)return 0.;\r\n uv+=time/scale;uv.y+=time*2./scale;uv.x+=sin(uv.y+time*.5)/scale;\r\n uv*=scale;vec2 s=floor(uv),f=fract(uv),p;float k=3.,d;\r\n p=.5+.35*sin(11.*fract(sin((s+p+scale)*mat2(7,3,6,5))*5.))-f;d=length(p);k=min(d,k);\r\n k=smoothstep(0.,k,sin(f.x+f.y)*0.01);\r\n return k*w;\r\n}\r\n\r\nvoid main(void){\r\n vec2 resolution = czm_viewport.zw;\r\n vec2 uv=(gl_FragCoord.xy*2.-resolution.xy)/min(resolution.x,resolution.y);\r\n vec3 finalColor=vec3(0);\r\n float c = 0.0;\r\n // c+=snow(uv,30.)*.0;\r\n // c+=snow(uv,20.)*.0;\r\n // c+=snow(uv,15.)*.0;\r\n c+=snow(uv,10.);\r\n c+=snow(uv,8.);\r\n c+=snow(uv,6.);\r\n c+=snow(uv,5.);\r\n finalColor=(vec3(c)); \r\n gl_FragColor = mix(texture2D(colorTexture, v_textureCoordinates), vec4(finalColor,1), 0.5); \r\n\r\n}"
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.FogEffect = void 0;
var n = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o);
t.FogEffect = function () {
function e(t, i) {
r(this, e), i = i || {}, this.trength = a.defaultValue(i.trength, .1), this.color = a.defaultValue(i.color, new a.Color(.8, .8, .8, .5)), this._show = a.defaultValue(i.show, !0), this.viewer = t, this.init()
}
return n(e, [{
key: "init",
value: function () {
var e = this;
this.FogStage = new a.PostProcessStage({
name: "MarsFog",
fragmentShader: " uniform sampler2D colorTexture;\n uniform sampler2D depthTexture;\n uniform float trength;\n uniform vec4 fogcolor;\n varying vec2 v_textureCoordinates;\n void main(void)\n {\n vec4 origcolor=texture2D(colorTexture, v_textureCoordinates);\n\n float depth = czm_readDepth(depthTexture, v_textureCoordinates);\n vec4 depthcolor=texture2D(depthTexture, v_textureCoordinates);\n\n float f=trength*(depthcolor.r-0.3)/0.2;\n if(f<0.0) f=0.0;\n else if(f>1.0) f=1.0;\n gl_FragColor = mix(origcolor,fogcolor,f);\n }",
uniforms: {
trength: function () {
return e.trength
},
fogcolor: function () {
return e.color
}
}
}), this.FogStage.enabled = this._show, this.viewer.scene.postProcessStages.add(this.FogStage)
}
}, {
key: "destroy",
value: function () {
this.viewer.scene.postProcessStages.remove(this.FogStage), delete this.trength, delete this.color, delete this.viewer
}
}, {
key: "show",
get: function () {
return this._show
},
set: function (e) {
this._show = Boolean(e), this.FogStage.enabled = this._show
}
}]), e
}()
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.InvertedScene = void 0;
var n = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o),
s = i(154),
l = function (e) {
return e && e.__esModule ? e : {
default: e
}
}(s);
t.InvertedScene = function () {
function e(t, i) {
r(this, e), this.viewer = t, i = i || {}, this._show = a.defaultValue(i.show, !0), this.init()
}
return n(e, [{
key: "init",
value: function () {
this.postStage = new a.PostProcessStage({
name: "InvertedScene",
fragmentShader: l.default
}), this.postStage.enabled = this._show, this.viewer.scene.postProcessStages.add(this.postStage)
}
}, {
key: "destroy",
value: function () {
this.viewer.scene.postProcessStages.remove(this.postStage)
}
}, {
key: "show",
get: function () {
return this._show
},
set: function (e) {
this._show = Boolean(e), this.postStage.enabled = this._show
}
}]), e
}()
}, function (e, t) {
e.exports = "#extension GL_OES_standard_derivatives : enable\r\nuniform sampler2D colorTexture;\r\nuniform sampler2D depthTexture;\r\nvarying vec2 v_textureCoordinates;\r\nvec4 toEye(in vec2 uv, in float depth){\r\n vec2 xy = vec2((uv.x * 2.0 - 1.0),(uv.y * 2.0 - 1.0));\r\n vec4 posInCamera =czm_inverseProjection * vec4(xy, depth, 1.0);\r\n posInCamera =posInCamera / posInCamera.w;\r\n return posInCamera;\r\n}\r\nfloat getDepth(in vec4 depth){\r\n float z_window = czm_unpackDepth(depth);\r\n z_window = czm_reverseLogDepth(z_window);\r\n float n_range = czm_depthRange.near;\r\n float f_range = czm_depthRange.far;\r\n return (2.0 * z_window - n_range - f_range) / (f_range - n_range);\r\n}\r\nvec3 guussColor(vec2 uv){\r\n vec2 pixelSize = 1.0 / czm_viewport.zw;\r\n float dx0 = -pixelSize.x;\r\n float dy0 = -pixelSize.y;\r\n float dx1 = pixelSize.x;\r\n float dy1 = pixelSize.y;\r\n vec4 gc = (\r\n texture2D(colorTexture, uv)+\r\n texture2D(colorTexture, uv + vec2(dx0, dy0)) +\r\n texture2D(colorTexture, uv + vec2(0.0, dy0)) +\r\n texture2D(colorTexture, uv + vec2(dx1, dy0)) +\r\n texture2D(colorTexture, uv + vec2(dx0, 0.0)) +\r\n texture2D(colorTexture, uv + vec2(dx1, 0.0)) +\r\n texture2D(colorTexture, uv + vec2(dx0, dy1)) +\r\n texture2D(colorTexture, uv + vec2(0.0, dy1)) +\r\n texture2D(colorTexture, uv + vec2(dx1, dy1))\r\n ) * (1.0 / 9.0);\r\n return gc.rgb;\r\n}\r\nvoid main(){\r\n // mat4 dither = mat4(\r\n // 0, 0.5, 0.125, 0.625,\r\n // 0.75, 0.25, 0.875, 0.375,\r\n // 0.1875, 0.6875, 0.0625, 0.5625,\r\n // 0.9375, 0.4375, 0.8125, 0.3125\r\n // );\r\n // int sampleCoordX = int(mod((gl_FragCoord.x * v_textureCoordinates.x),4.0));\r\n // int sampleCoordY = int(mod((gl_FragCoord.y * v_textureCoordinates.y),4.0));\r\n float offset = 0.0;\r\n\r\n\r\n vec4 color = texture2D(colorTexture, v_textureCoordinates);\r\n vec4 currD = texture2D(depthTexture, v_textureCoordinates);\r\n // gl_FragColor = currD;\r\n // return;\r\n if(currD.r>=1.0){\r\n gl_FragColor = color;\r\n return;\r\n }\r\n float depth = getDepth(currD);\r\n // gl_FragColor = vec4(depth,0.0,0.0,1.0);\r\n // return;\r\n\r\n \r\n vec4 positionEC = toEye(v_textureCoordinates, depth);\r\n vec3 dx = dFdx(positionEC.xyz);\r\n vec3 dy = dFdy(positionEC.xyz);\r\n vec3 normal = normalize(cross(dx,dy));\r\n\r\n vec4 positionWC = normalize(czm_inverseView * positionEC);\r\n vec3 normalWC = normalize(czm_inverseViewRotation * normal);\r\n float fotNumWC = dot(positionWC.xyz,normalWC);\r\n if(fotNumWC<=0.5){\r\n gl_FragColor = color;\r\n return;\r\n }\r\n \r\n\r\n\r\n\r\n\r\n // float dotNum = dot(normal,vec3(0.0,1.0,0.0));\r\n // gl_FragColor = mix(color,vec4(1.0),dotNum*0.8);\r\n // return;\r\n\r\n vec3 viewDir = normalize(positionEC.xyz);\r\n vec3 reflectDir = reflect(viewDir, normal);\r\n // vec3 viewReflectDir = czm_viewRotation * reflectDir;\r\n vec3 viewReflectDir = reflectDir;\r\n\r\n \r\n float step = 0.05;\r\n int stepNum = int(20.0 / step);\r\n vec3 pos;\r\n vec3 albedo;\r\n bool jd = false;\r\n for(int i = 1;i <= 400;i++)\r\n {\r\n float delta = step * float(i) + offset;\r\n pos = positionEC.xyz + viewReflectDir * delta;\r\n float d = -pos.z;\r\n\r\n vec4 tmp = czm_projection * vec4(pos,1.0);\r\n vec3 screenPos = tmp.xyz / tmp.w;\r\n vec2 uv = vec2(screenPos.x, screenPos.y) * 0.5 + vec2(0.5, 0.5);\r\n \r\n if(uv.x > 0.0 && uv.x < 1.0 && uv.y > 0.0 && uv.y < 1.0){\r\n float dd = getDepth(texture2D(depthTexture, uv));\r\n vec4 jzc = toEye(uv, dd);\r\n dd = -jzc.z;\r\n if(d>dd){\r\n if(abs(abs(d) - abs(dd)) <=step){\r\n jd = true;\r\n // albedo = texture2D(colorTexture, uv).rgb;\r\n albedo = guussColor(uv);\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n if(jd){\r\n gl_FragColor = vec4(mix(color.xyz,albedo,0.5),1.0);\r\n }else{\r\n gl_FragColor = color;\r\n }\r\n}"
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.SnowCover = void 0;
var n = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o),
s = i(156),
l = function (e) {
return e && e.__esModule ? e : {
default: e
}
}(s);
t.SnowCover = function () {
function e(t, i) {
r(this, e), this.viewer = t, i = i || {}, this.alpha = a.defaultValue(i.alpha, 1), this._show = a.defaultValue(i.show, !0), this.init()
}
return n(e, [{
key: "init",
value: function () {
var e = this;
this.postStage = new a.PostProcessStage({
name: "SnowCover",
fragmentShader: l.default,
uniforms: {
alpha: function () {
return e.alpha
}
}
}), this.postStage.enabled = this._show, this.viewer.scene.postProcessStages.add(this.postStage)
}
}, {
key: "destroy",
value: function () {
this.viewer.scene.postProcessStages.remove(this.postStage)
}
}, {
key: "show",
get: function () {
return this._show
},
set: function (e) {
this._show = Boolean(e), this.postStage.enabled = this._show
}
}]), e
}()
}, function (e, t) {
e.exports = "#extension GL_OES_standard_derivatives : enable\r\nuniform sampler2D colorTexture;\r\nuniform sampler2D depthTexture;\r\nuniform float alpha;\r\nvarying vec2 v_textureCoordinates;\r\nvec4 toEye(in vec2 uv, in float depth){\r\n vec2 xy = vec2((uv.x * 2.0 - 1.0),(uv.y * 2.0 - 1.0));\r\n vec4 posInCamera =czm_inverseProjection * vec4(xy, depth, 1.0);\r\n posInCamera =posInCamera / posInCamera.w;\r\n return posInCamera;\r\n}\r\nfloat getDepth(in vec4 depth){\r\n float z_window = czm_unpackDepth(depth);\r\n z_window = czm_reverseLogDepth(z_window);\r\n float n_range = czm_depthRange.near;\r\n float f_range = czm_depthRange.far;\r\n return (2.0 * z_window - n_range - f_range) / (f_range - n_range);\r\n}\r\nvoid main(){\r\n vec4 color = texture2D(colorTexture, v_textureCoordinates);\r\n vec4 currD = texture2D(depthTexture, v_textureCoordinates);\r\n if(currD.r>=1.0){\r\n gl_FragColor = color;\r\n return;\r\n }\r\n float depth = getDepth(currD);\r\n vec4 positionEC = toEye(v_textureCoordinates, depth);\r\n vec3 dx = dFdx(positionEC.xyz);\r\n vec3 dy = dFdy(positionEC.xyz);\r\n vec3 nor = normalize(cross(dx,dy));\r\n\r\n vec4 positionWC = normalize(czm_inverseView * positionEC);\r\n vec3 normalWC = normalize(czm_inverseViewRotation * nor);\r\n float dotNumWC = dot(positionWC.xyz,normalWC);\r\n if(dotNumWC<=0.3){\r\n gl_FragColor = mix(color,vec4(1.0),alpha*0.3);\r\n return;\r\n }\r\n gl_FragColor = mix(color,vec4(1.0),dotNumWC*alpha);\r\n}"
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.WaterSpout = void 0;
var n = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o),
s = new a.Matrix4,
l = new a.Cartesian3,
u = new a.Quaternion,
c = new a.HeadingPitchRoll,
h = new a.TranslationRotationScale,
d = new a.Cartesian3;
t.WaterSpout = function () {
function e(t, i) {
r(this, e), t && (this.viewer = t, i = i || {}, this.image = i.image, this.startColor = a.defaultValue(i.startColor, a.Color.LIGHTCYAN.withAlpha(.3)), this.endColor = a.defaultValue(i.endColor, a.Color.WHITE.withAlpha(0)), this.startScale = a.defaultValue(i.startScale, 2), this.endScale = a.defaultValue(i.endScale, 4), this.minimumParticleLife = a.defaultValue(i.minimumParticleLife, 4.1), this.maximumParticleLife = a.defaultValue(i.maximumParticleLife, 1.1), this.minimumSpeed = a.defaultValue(i.minimumSpeed, 0), this.maximumSpeed = a.defaultValue(i.maximumSpeed, 0), this.particleSize = a.defaultValue(i.particleSize, 28), this.emissionRate = a.defaultValue(i.emissionRate, 100), this.lifetime = a.defaultValue(i.lifetime, 8), this.bursts = a.defaultValue(i.bursts, [new a.ParticleBurst({
time: 5,
minimum: 60,
maximum: 100
})]), this.gravity = a.defaultValue(i.gravity, -11), this._show = a.defaultValue(i.show, !1), this.arrPS = [], this.viewer.scene.preUpdate.addEventListener(this._scene_preUpdateHandler, this))
}
return n(e, [{
key: "add",
value: function (e) {
function t(e, t) {
var r = new a.Cartesian3(-.8, -.5, 2);
a.Cartesian3.multiplyByScalar(r, .1, r);
var n = e.position;
a.Cartesian3.add(e.position, r, e.position), a.Cartesian3.normalize(n, d), a.Cartesian3.multiplyByScalar(d, i.gravity * t, d), e.velocity = a.Cartesian3.add(e.velocity, d, e.velocity)
}
for (var i = this, r = 0, n = e.length; r < n; r++) {
var o = e[r],
s = a.Cartesian3.fromDegrees(o[0], o[1], o[2]),
l = this.viewer.scene.primitives.add(new a.ParticleSystem({
image: this.image,
startColor: this.startColor,
endColor: this.endColor,
startScale: this.startScale,
endScale: this.endScale,
minimumParticleLife: this.minimumParticleLife,
maximumParticleLife: this.maximumParticleLife,
minimumSpeed: this.minimumSpeed,
maximumSpeed: this.maximumSpeed,
imageSize: new a.Cartesian2(this.particleSize, this.particleSize),
emissionRate: this.emissionRate,
bursts: this.bursts,
lifetime: this.lifetime,
emitter: new a.CircleEmitter(2),
emitterModelMatrix: this._computeEmitterModelMatrix(),
updateCallback: t,
show: this.show
}));
this.arrPS.push({
center: s,
particleSystem: l
})
}
}
}, {
key: "_scene_preUpdateHandler",
value: function () {
if (this.arrPS && 0 != this.arrPS.length)
for (var e = 0, t = this.arrPS.length; e < t; e++) {
var i = this.arrPS[e],
r = i.particleSystem;
r.modelMatrix = this._computeModelMatrix(i.center), r.emitterModelMatrix = this._computeEmitterModelMatrix()
}
}
}, {
key: "_computeModelMatrix",
value: function (e) {
var t = a.Transforms.eastNorthUpToFixedFrame(e),
i = a.Matrix3.fromHeadingPitchRoll(new a.HeadingPitchRoll(2.619728786416368, 0, 0)),
r = a.Matrix4.fromRotationTranslation(i, new a.Cartesian3(0, 0, -2));
return a.Matrix4.multiply(t, r, t), t
}
}, {
key: "_computeEmitterModelMatrix",
value: function () {
c = a.HeadingPitchRoll.fromDegrees(0, 0, 0, c), h.translation = a.Cartesian3.fromElements(0, 0, 0, l), h.rotation = a.Quaternion.fromHeadingPitchRoll(c, u), a.Matrix4.fromTranslationRotationScale(h, s);
var e = new a.Cartesian3(-2, -2, 2);
return a.Matrix4.multiplyByTranslation(s, e, s), s
}
}, {
key: "updateVisible",
value: function (e, t) {
this.arrPS[t].particleSystem.show = e
}
}, {
key: "updateAllVisible",
value: function (e) {
for (var t = 0, i = this.arrPS.length; t < i; t++) this.arrPS[t].particleSystem.show = e
}
}, {
key: "clear",
value: function () {
for (var e = 0, t = this.arrPS.length; e < t; e++) this.viewer.scene.primitives.remove(this.arrPS[e].particleSystem);
this.arrPS = []
}
}, {
key: "destroy",
value: function () {
this.viewer.scene.preUpdate.removeEventListener(this._scene_preUpdateHandler, this), this.clear()
}
}, {
key: "show",
get: function () {
return this._show
},
set: function (e) {
this._show = e, this.updateAllVisible(this._show)
}
}]), e
}()
}, function (e, t, i) {
"use strict";
function r(e, t) {
e = t.wutu.point2map(e);
var i = a.Cartesian3.fromDegrees(e.x, e.y, e.z || 0),
r = a.Math.toRadians(e.heading || 0),
n = a.Math.toRadians(e.pitch || 0),
o = a.Math.toRadians(e.roll || 0),
s = new a.HeadingPitchRoll(r, n, o),
l = e.converter || a.Transforms.eastNorthUpToFixedFrame,
u = a.Transforms.headingPitchRollQuaternion(i, s, t.scene.globe.ellipsoid, l);
return t.entities.add({
name: e.name || "",
position: i,
orientation: u,
model: e,
tooltip: e.tooltip,
popup: e.popup
})
}
function n(e, t) {
var i, r = t.viewer || window.viewer,
n = new a.SampledPositionProperty,
o = r.clock.currentTime,
s = e.position.getValue(o);
n.addSample(o, s);
var l = t.position,
u = t.time || 3;
i = a.JulianDate.addSeconds(o, u, new a.JulianDate), n.addSample(i, l), e.position = n, r.clock.shouldAnimate = !0;
var c = r.clock.multiplier;
r.clock.multiplier = t.speed || 1, r.clock.currentTime = o.clone(), setTimeout(function () {
e.position = l, r.clock.multiplier = c, t.onEnd && t.onEnd()
}, 1e3 * u)
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.rotate = void 0, t.createModel = r, t.move = n;
var o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o),
s = i(28);
t.rotate = {
isStart: !1,
viewer: null,
start: function (e, t) {
this.entity = e, this.viewer = t.viewer || window.viewer, this.time = this.viewer.clock.currentTime.clone(), this.hpr = (0, s.getHeadingPitchRollByOrientation)(this.entity.position._value, this.entity.orientation && this.entity.orientation._value), this.angle = t.step || 10, this.viewer.clock.shouldAnimate = !0, this.viewer.clock.onTick.addEventListener(this.clock_onTickHandler, this), this.isStart = !0
},
clock_onTickHandler: function (e) {
var t = a.JulianDate.secondsDifference(this.viewer.clock.currentTime, this.time),
i = a.Math.toRadians(t * this.angle) + this.hpr.heading,
r = new a.HeadingPitchRoll(i, this.hpr.pitch, this.hpr.roll);
this.entity.orientation = a.Transforms.headingPitchRollQuaternion(this.entity.position._value, r)
},
stop: function () {
this.isStart && (this.viewer && this.viewer.clock.onTick.removeEventListener(this.clock_onTickHandler, this), this.isStart = !1)
}
}
}, function (e, t, i) {
"use strict";
function r(e) {
return e && e.__esModule ? e : {
default: e
}
}
function n(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.Video3D = void 0;
var o = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
a = i(0),
s = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(a),
l = i(5),
u = r(l),
c = i(160),
h = r(c),
d = {
LEFT: "Z",
RIGHT: "-Z",
TOP: "Y",
BOTTOM: "-Y",
ALONG: "X",
INVERSE: "-X"
},
f = {
font: "50px 楷体",
fill: !0,
fillColor: new s.Color(1, 1, 0, 1),
stroke: !0,
strokeWidth: 2,
strokeColor: new s.Color(1, 1, 1, .8),
backgroundColor: new s.Color(1, 1, 1, .1),
textBaseline: "top",
padding: 40
},
p = {
Color: 1,
Image: 2,
Video: 3,
Text: 4
};
(t.Video3D = function () {
function e(t, i) {
if (n(this, e), t) {
i || (i = {}), this.viewer = t, this._cameraPosition = i.cameraPosition, this._position = i.position, this.type = i.type, this.alpha = i.alpha || 1, this.color = i.color, this._debugFrustum = s.defaultValue(i.debugFrustum, !0), this._aspectRatio = i.aspectRatio || this._getWinWidHei();
var r = i.fov && s.Math.toRadians(i.fov);
if (this._camerafov = r || this.viewer.scene.camera.frustum.fov, this.videoTexture = this.texture = i.texture || new s.Texture({
context: this.viewer.scene.context,
source: {
width: 1,
height: 1,
arrayBufferView: new Uint8Array([255, 255, 255, 255])
},
flipY: !1
}), this._videoPlay = s.defaultValue(i.videoPlay, !0), this.defaultShow = s.defaultValue(i.show, !0), this.clearBlack = s.defaultValue(i.clearBlack, !1), this._rotateDeg = 1, this._dirObj = s.defaultValue(i.dirObj, void 0), this.text = s.defaultValue(i.text, void 0), this.textStyles = s.defaultValue(i.textStyles, f), this._disViewColor = s.defaultValue(i.disViewColor, new s.Color(0, 0, 0, .5)), !this.cameraPosition || !this.cameraPosition) return void console.log("初始化失败:请确认相机位置与视点位置正确!");
switch (i.dom && (this.dom = i.dom, this.dom instanceof HTMLElement && (this.dom = i.dom), i.dom instanceof u.default && i.dom.length && (this.dom = i.dom[0])), this.url = i.url, this.type) {
default:
case p.Video:
this.activeVideo(this.url);
break;
case p.Image:
this.activePicture(this.url), this.deActiveVideo();
break;
case p.Color:
this.activeColor(this.color), this.deActiveVideo();
break;
case p.Text:
this.activeText(this.text, this.textStyles), this.deActiveVideo()
}
this._createShadowMap(), this._getOrientation(), this._addCameraFrustum(), this._addPostProcess(), this.viewer.scene.primitives.add(this)
}
}
return o(e, [{
key: "rotateCamera",
value: function (e, t) {
var i = s.defaultValue(t, this._rotateDeg);
switch (e) {
case d.LEFT:
break;
case d.RIGHT:
i *= -1;
break;
case d.TOP:
break;
case d.BOTTOM:
i *= -1;
break;
case d.ALONG:
break;
case d.INVERSE:
i *= -1
}
var r = this._computedNewViewDir(e, i);
this.viewer.scene.postProcessStages.remove(this.postProcess), this.viewer.scene.primitives.remove(this.cameraFrustum), this.viewShadowMap.destroy(), this.cameraFrustum.destroy(), this._resetCameraDir(r), this._getOrientation(), this._addCameraFrustum(), this._addPostProcess()
}
}, {
key: "_resetCameraDir",
value: function (e) {
e && e.up && e.right && e.direction && (this._dirObj = e, this._createShadowMap())
}
}, {
key: "_computedNewViewDir",
value: function (e, t) {
t = s.Math.toRadians(t);
var i = this.viewShadowMap._lightCamera,
r = s.clone(i.direction),
n = s.clone(i.right),
o = s.clone(i.up),
a = new s.Matrix3;
switch (e) {
case d.LEFT:
case d.RIGHT:
s.Matrix3.fromRotationZ(t, a);
break;
case d.TOP:
case d.BOTTOM:
s.Matrix3.fromRotationY(t, a);
break;
case d.ALONG:
case d.INVERSE:
s.Matrix3.fromRotationX(t, a)
}
var l = s.Transforms.eastNorthUpToFixedFrame(i.position),
u = s.Matrix4.inverse(l, new s.Matrix4),
c = s.Matrix4.multiplyByPointAsVector(u, r, new s.Cartesian3),
h = s.Matrix3.multiplyByVector(a, c, new s.Cartesian3),
f = s.Matrix4.multiplyByPointAsVector(l, h, new s.Cartesian3),
p = s.Matrix4.multiplyByPointAsVector(u, n, new s.Cartesian3),
m = s.Matrix3.multiplyByVector(a, p, new s.Cartesian3),
g = s.Matrix4.multiplyByPointAsVector(l, m, new s.Cartesian3),
v = s.Matrix4.multiplyByPointAsVector(u, o, new s.Cartesian3),
y = s.Matrix3.multiplyByVector(a, v, new s.Cartesian3);
return {
direction: f,
right: g,
up: s.Matrix4.multiplyByPointAsVector(l, y, new s.Cartesian3)
}
}
}, {
key: "getPercentagePoint",
value: function (e) {
if (e) {
var t = this.viewShadowMap._lightCamera._viewMatrix,
i = this.viewShadowMap._lightCamera.frustum.projectionMatrix,
r = new s.Cartesian4(e.x, e.y, e.z, 1),
n = s.Matrix4.multiply(i, t, new s.Matrix4),
o = s.Matrix4.multiplyByVector(n, r, new s.Cartesian4),
a = new s.Cartesian2(o.x / o.w, o.y / o.w);
return new s.Cartesian2(a.x / 2 + .5, a.y / 2 + .5)
}
}
}, {
key: "_changeCameraFov",
value: function () {
this.viewer.scene.postProcessStages.remove(this.postProcess), this.viewer.scene.primitives.remove(this.cameraFrustum), this._createShadowMap(), this._getOrientation(), this._addCameraFrustum(), this._addPostProcess()
}
}, {
key: "_changeVideoWidHei",
value: function () {
this.viewer.scene.postProcessStages.remove(this.postProcess), this.viewer.scene.primitives.remove(this.cameraFrustum), this._createShadowMap(), this._getOrientation(), this._addCameraFrustum(), this._addPostProcess()
}
}, {
key: "_changeCameraPos",
value: function () {
this.viewer.scene.postProcessStages.remove(this.postProcess), this.viewer.scene.primitives.remove(this.cameraFrustum), this.viewShadowMap.destroy(), this.cameraFrustum.destroy(), this._createShadowMap(!0), this._getOrientation(), this._addCameraFrustum(), this._addPostProcess()
}
}, {
key: "_changeViewPos",
value: function () {
this.viewer.scene.postProcessStages.remove(this.postProcess), this.viewer.scene.primitives.remove(this.cameraFrustum), this.viewShadowMap.destroy(), this.cameraFrustum.destroy(), this._createShadowMap(!0), this._getOrientation(), this._addCameraFrustum(), this._addPostProcess()
}
}, {
key: "_switchShow",
value: function () {
this.show ? !this.postProcess && this._addPostProcess() : (this.viewer.scene.postProcessStages.remove(this.postProcess), delete this.postProcess, this.postProcess = null)
}
}, {
key: "activeVideo",
value: function (e) {
var t;
t = this.dom ? this.dom : this._createVideoEle(e);
var i = this;
t && (this.type = p.Video, this.videoElement = t, t.addEventListener("canplaythrough", function () {
i.viewer.clock.onTick.addEventListener(i.activeVideoListener, i)
}))
}
}, {
key: "activeVideoListener",
value: function () {
try {
this._videoPlay && this.videoElement.paused && this.videoElement.play()
} catch (e) {}
this.videoTexture && this.videoTexture.destroy(), this.videoTexture = new s.Texture({
context: this.viewer.scene.context,
source: this.videoElement,
pixelFormat: s.PixelFormat.RGBA,
pixelDatatype: s.PixelDatatype.UNSIGNED_BYTE
})
}
}, {
key: "deActiveVideo",
value: function () {
this.viewer.clock.onTick.removeEventListener(this.activeVideoListener, this), delete this.activeVideoListener
}
}, {
key: "activePicture",
value: function (e) {
this.videoTexture = this.texture;
var t = this,
i = new Image;
i.onload = function () {
t.type = p.Image, t.videoTexture = new s.Texture({
context: t.viewer.scene.context,
source: i
})
}, i.onerror = function () {
console.log("图片加载失败:" + e)
}, i.src = e
}
}, {
key: "activeColor",
value: function (e) {
var t = this;
this.type = p.Color;
var i, r, n, o;
e ? (i = 255 * e.red, r = 255 * e.green, n = 255 * e.blue, o = 255 * e.alpha) : (i = 255 * Math.random(), r = 255 * Math.random(), n = 255 * Math.random(), o = 255 * Math.random()), t.videoTexture = new s.Texture({
context: t.viewer.scene.context,
source: {
width: 1,
height: 1,
arrayBufferView: new Uint8Array([i, r, n, o])
},
flipY: !1
})
}
}, {
key: "activeText",
value: function (e, t) {
var i = this;
this.type = p.Text, e && (t = t || {}, t.textBaseline = "top", this.textCanvas = s.writeTextToCanvas(e, t), i.videoTexture = new s.Texture({
context: i.viewer.scene.context,
source: this.textCanvas,
flipY: !0
}))
}
}, {
key: "locate",
value: function () {
var e = s.clone(this.cameraPosition),
t = s.clone(this.position);
if (this.viewer.camera.position = e, this._dirObj) return this.viewer.camera.direction = s.clone(this._dirObj.direction), this.viewer.camera.right = s.clone(this._dirObj.right), void(this.viewer.camera.up = s.clone(this._dirObj.up));
this.viewer.camera.direction = s.Cartesian3.subtract(t, e, new s.Cartesian3(0, 0, 0)), this.viewer.camera.up = s.Cartesian3.normalize(e, new s.Cartesian3(0, 0, 0))
}
}, {
key: "_getOrientation",
value: function () {
var e = this.cameraPosition,
t = this.position,
i = s.Cartesian3.normalize(s.Cartesian3.subtract(t, e, new s.Cartesian3), new s.Cartesian3),
r = s.Cartesian3.normalize(e, new s.Cartesian3),
n = new s.Camera(this.viewer.scene);
n.position = e, n.direction = i, n.up = r, i = n.directionWC, r = n.upWC;
var o = n.rightWC,
a = new s.Cartesian3,
l = new s.Matrix3,
u = new s.Quaternion;
o = s.Cartesian3.negate(o, a);
var c = l;
s.Matrix3.setColumn(c, 0, o, c), s.Matrix3.setColumn(c, 1, r, c), s.Matrix3.setColumn(c, 2, i, c);
var h = s.Quaternion.fromRotationMatrix(c, u);
return this.orientation = h, h
}
}, {
key: "_createVideoEle",
value: function (e) {
if (e) {
var t = document.createElement("SOURCE");
t.type = "video/mp4", t.src = e;
var i = document.createElement("SOURCE");
i.type = "video/quicktime", i.src = e;
var r = document.createElement("video");
return r.setAttribute("autoplay", !0), r.setAttribute("loop", !0), r.setAttribute("crossorigin", !0), r.appendChild(t), r.appendChild(i), r.style.display = "none", document.body.appendChild(r), r
}
}
}, {
key: "_getWinWidHei",
value: function () {
var e = this.viewer.scene;
return e.canvas.clientWidth / e.canvas.clientHeight
}
}, {
key: "_createShadowMap",
value: function (e) {
var t = this.cameraPosition,
i = this.position,
r = this.viewer.scene,
n = new s.Camera(r);
n.position = t, this._dirObj && !e ? (n.direction = this._dirObj.direction, n.right = this._dirObj.right, n.up = this._dirObj.up) : (n.direction = s.Cartesian3.subtract(i, t, new s.Cartesian3(0, 0, 0)), n.up = s.Cartesian3.normalize(t, new s.Cartesian3(0, 0, 0)));
var o = s.Cartesian3.distance(i, t);
this.viewDis = o, n.frustum = new s.PerspectiveFrustum({
fov: this.fov,
aspectRatio: this.aspectRatio,
near: .1,
far: 2 * o
});
this.viewShadowMap = new s.ShadowMap({
lightCamera: n,
enable: !1,
isPointLight: !1,
isSpotLight: !0,
cascadesEnabled: !1,
context: r.context,
pointLightRadius: o
})
}
}, {
key: "_addCameraFrustum",
value: function () {
var e = this;
this.cameraFrustum = new s.Primitive({
geometryInstances: new s.GeometryInstance({
geometry: new s.FrustumOutlineGeometry({
origin: e.cameraPosition,
orientation: e.orientation,
frustum: this.viewShadowMap._lightCamera.frustum,
_drawNearPlane: !0
}),
attributes: {
color: s.ColorGeometryInstanceAttribute.fromColor(new s.Color(0, .5, .5))
}
}),
appearance: new s.PerInstanceColorAppearance({
translucent: !1,
flat: !0
}),
asynchronous: !1,
show: this.debugFrustum && this.show
}), this.viewer.scene.primitives.add(this.cameraFrustum)
}
}, {
key: "_addPostProcess",
value: function () {
var e = this,
t = h.default,
i = e.viewShadowMap._isPointLight ? e.viewShadowMap._pointBias : e.viewShadowMap._primitiveBias;
this.show && (this.postProcess = new s.PostProcessStage({
fragmentShader: t,
uniforms: {
mixNum: function () {
return e.alpha
},
stcshadow: function () {
return e.viewShadowMap._shadowMapTexture
},
videoTexture: function () {
return e.videoTexture
},
_shadowMap_matrix: function () {
return e.viewShadowMap._shadowMapMatrix
},
shadowMap_lightPositionEC: function () {
return e.viewShadowMap._lightPositionEC
},
shadowMap_texelSizeDepthBiasAndNormalShadingSmooth: function () {
var t = new s.Cartesian2;
return t.x = 1 / e.viewShadowMap._textureSize.x, t.y = 1 / e.viewShadowMap._textureSize.y, s.Cartesian4.fromElements(t.x, t.y, i.depthBias, i.normalShadingSmooth, this.combinedUniforms1)
},
shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness: function () {
return s.Cartesian4.fromElements(i.normalOffsetScale, e.viewShadowMap._distance, e.viewShadowMap.maximumDistance, e.viewShadowMap._darkness, this.combinedUniforms2)
},
disViewColor: function () {
return e._disViewColor
},
clearBlack: function () {
return e.clearBlack
}
}
}), this.viewer.scene.postProcessStages.add(this.postProcess))
}
}, {
key: "update",
value: function (e) {
this.viewShadowMap && e.shadowMaps.push(this.viewShadowMap)
}
}, {
key: "destroy",
value: function () {
this.viewer.scene.postProcessStages.remove(this.postProcess), this.viewer.scene.primitives.remove(this.cameraFrustum), this.videoElement && this.videoElement.parentNode.removeChild(this.videoElement), delete this.videoElement, this.viewer.clock.onTick.removeEventListener(this.activeVideoListener, this), delete this.activeVideoListener, delete this.postProcess, delete this.viewShadowMap, delete this.color, delete this.viewDis, delete this.cameraPosition, delete this.position, delete this.alpha, delete this._camerafov, delete this._cameraPosition, delete this.videoTexture, delete this.cameraFrustum, delete this.dom, delete this._debugFrustum, delete this._position, delete this._aspectRatio, delete this.orientation, delete this.texture, delete this.type, delete this.videoTexture, delete this.url, this.viewer.scene.primitives.remove(this), delete this.viewer
}
}, {
key: "alpha",
get: function () {
return this._alpha
},
set: function (e) {
this._alpha = e
}
}, {
key: "aspectRatio",
get: function () {
return this._aspectRatio
},
set: function (e) {
this._aspectRatio = e, this._changeVideoWidHei()
}
}, {
key: "debugFrustum",
get: function () {
return this._debugFrustum
},
set: function (e) {
this._debugFrustum = e, this.cameraFrustum.show = e
}
}, {
key: "fov",
get: function () {
return this._camerafov
},
set: function (e) {
this._camerafov = s.Math.toRadians(e), this._changeCameraFov()
}
}, {
key: "cameraPosition",
get: function () {
return this._cameraPosition
},
set: function (e) {
e && (this._cameraPosition = e, this._changeCameraPos())
}
}, {
key: "position",
get: function () {
return this._position
},
set: function (e) {
e && (this._position = e, this._changeViewPos())
}
}, {
key: "videoPlay",
get: function () {
return this._videoPlay
},
set: function (e) {
this._videoPlay = Boolean(e), this.videoElement && (this.videoPlay ? this.videoElement.play() : this.videoElement.pause())
}
}, {
key: "params",
get: function () {
var e = {};
return e.type = this.type, this.type == p.Color ? e.color = this.color : e.url = this.url, e.position = this.position, e.cameraPosition = this.cameraPosition, e.fov = s.Math.toDegrees(this.fov), e.aspectRatio = this.aspectRatio, e.alpha = this.alpha, e.debugFrustum = this.debugFrustum, e.dirObj = this._dirObj, e
}
}, {
key: "show",
get: function () {
return this.defaultShow
},
set: function (e) {
this.defaultShow = Boolean(e), this._switchShow()
}
}, {
key: "camera",
get: function () {
return this.viewShadowMap._lightCamera
}
}, {
key: "disViewColor",
get: function () {
return this._disViewColor
},
set: function (e) {
e && (this._disViewColor = e, e.a || 0 == e.a || (this._disViewColor.a = 1))
}
}]), e
}()).Type = p
}, function (e, t) {
e.exports = "\r\n\r\n\r\n\r\nuniform float mixNum;\r\nuniform sampler2D colorTexture;\r\nuniform sampler2D stcshadow; \r\nuniform sampler2D videoTexture;\r\nuniform sampler2D depthTexture;\r\nuniform mat4 _shadowMap_matrix; \r\nuniform vec4 shadowMap_lightPositionEC; \r\nuniform vec4 shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness; \r\nuniform vec4 shadowMap_texelSizeDepthBiasAndNormalShadingSmooth; \r\nuniform vec4 disViewColor;\r\nuniform bool clearBlack;\r\nvarying vec2 v_textureCoordinates;\r\nvec4 toEye(in vec2 uv, in float depth){\r\n vec2 xy = vec2((uv.x * 2.0 - 1.0),(uv.y * 2.0 - 1.0));\r\n vec4 posInCamera =czm_inverseProjection * vec4(xy, depth, 1.0);\r\n posInCamera =posInCamera / posInCamera.w;\r\n return posInCamera;\r\n}\r\nfloat getDepth(in vec4 depth){\r\n float z_window = czm_unpackDepth(depth);\r\n z_window = czm_reverseLogDepth(z_window);\r\n float n_range = czm_depthRange.near;\r\n float f_range = czm_depthRange.far;\r\n return (2.0 * z_window - n_range - f_range) / (f_range - n_range);\r\n}\r\nfloat _czm_sampleShadowMap(sampler2D shadowMap, vec2 uv){\r\n return texture2D(shadowMap, uv).r;\r\n}\r\nfloat _czm_shadowDepthCompare(sampler2D shadowMap, vec2 uv, float depth){\r\n return step(depth, _czm_sampleShadowMap(shadowMap, uv));\r\n}\r\nfloat _czm_shadowVisibility(sampler2D shadowMap, czm_shadowParameters shadowParameters){\r\n float depthBias = shadowParameters.depthBias;\r\n float depth = shadowParameters.depth;\r\n float nDotL = shadowParameters.nDotL;\r\n float normalShadingSmooth = shadowParameters.normalShadingSmooth;\r\n float darkness = shadowParameters.darkness;\r\n vec2 uv = shadowParameters.texCoords;\r\n depth -= depthBias;\r\n vec2 texelStepSize = shadowParameters.texelStepSize;\r\n float radius = 1.0;\r\n float dx0 = -texelStepSize.x * radius;\r\n float dy0 = -texelStepSize.y * radius;\r\n float dx1 = texelStepSize.x * radius;\r\n float dy1 = texelStepSize.y * radius;\r\n float visibility = \r\n (\r\n _czm_shadowDepthCompare(shadowMap, uv, depth)\r\n +_czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy0), depth) +\r\n _czm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy0), depth) +\r\n _czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy0), depth) +\r\n _czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, 0.0), depth) +\r\n _czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, 0.0), depth) +\r\n _czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy1), depth) +\r\n _czm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy1), depth) +\r\n _czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy1), depth)\r\n ) * (1.0 / 9.0)\r\n ;\r\n return visibility;\r\n}\r\nvec3 pointProjectOnPlane(in vec3 planeNormal, in vec3 planeOrigin, in vec3 point){\r\n vec3 v01 = point -planeOrigin;\r\n float d = dot(planeNormal, v01) ;\r\n return (point - planeNormal * d);\r\n}\r\nfloat ptm(vec3 pt){\r\n return sqrt(pt.x*pt.x + pt.y*pt.y + pt.z*pt.z);\r\n}\r\nvoid main() \r\n{ \r\n const float PI = 3.141592653589793;\r\n vec4 color = texture2D(colorTexture, v_textureCoordinates);\r\n vec4 currD = texture2D(depthTexture, v_textureCoordinates);\r\n if(currD.r>=1.0){\r\n gl_FragColor = color;\r\n return;\r\n }\r\n \r\n float depth = getDepth(currD);\r\n vec4 positionEC = toEye(v_textureCoordinates, depth);\r\n vec3 normalEC = vec3(1.0);\r\n czm_shadowParameters shadowParameters; \r\n shadowParameters.texelStepSize = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.xy; \r\n shadowParameters.depthBias = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.z; \r\n shadowParameters.normalShadingSmooth = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.w; \r\n shadowParameters.darkness = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.w; \r\n shadowParameters.depthBias *= max(depth * 0.01, 1.0); \r\n vec3 directionEC = normalize(positionEC.xyz - shadowMap_lightPositionEC.xyz); \r\n float nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0); \r\n vec4 shadowPosition = _shadowMap_matrix * positionEC; \r\n shadowPosition /= shadowPosition.w; \r\n if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0)))) \r\n { \r\n gl_FragColor = color;\r\n return;\r\n }\r\n\r\n shadowParameters.texCoords = shadowPosition.xy; \r\n shadowParameters.depth = shadowPosition.z; \r\n shadowParameters.nDotL = nDotL; \r\n float visibility = _czm_shadowVisibility(stcshadow, shadowParameters); \r\n\r\n vec4 videoColor = texture2D(videoTexture,shadowPosition.xy);\r\n if(clearBlack){\r\n if(videoColor.r + videoColor.g + videoColor.b <0.01){\r\n gl_FragColor = color;\r\n return;\r\n }\r\n }\r\n if(visibility==1.0){\r\n gl_FragColor = mix(color,vec4(videoColor.xyz,1.0),mixNum*videoColor.a);\r\n }else{\r\n if(abs(shadowPosition.z-0.0)<0.01){\r\n return;\r\n }\r\n if(clearBlack){\r\n gl_FragColor = color;\r\n return;\r\n }\r\n gl_FragColor = vec4(mix(color.rgb,disViewColor.rgb,disViewColor.a),disViewColor.a);\r\n }\r\n} "
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.Video2D = void 0;
var n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) {
return typeof e
} : function (e) {
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
},
o = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
a = i(0),
s = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(a),
l = i(5),
u = function (e) {
return e && e.__esModule ? e : {
default: e
}
}(l),
c = {
LEFT: "Z",
RIGHT: "-Z",
TOP: "Y",
BOTTOM: "-Y",
ALONG: "X",
INVERSE: "-X"
};
t.Video2D = function () {
function e(t, i, n) {
if (r(this, e), t) {
this.viewer = t, n = s.defaultValue(n, {}), this.dom = s.defaultValue(i, null), this._play = !0, this._aspectRatio = s.defaultValue(n.aspectRatio, null), this._aspectRatio || (this._aspectRatio = this.viewer.scene.context.drawingBufferWidth / this.viewer.scene.context.drawingBufferHeight), this._fov = s.defaultValue(n.fov, this.viewer.scene.camera.frustum.fov), this._dis = s.defaultValue(n.dis, 10), this._stRotation = s.defaultValue(n.stRotation, 0), this._rotateCam = s.defaultValue(n.rotateCam, .05), this._frustumShow = s.defaultValue(n.frustumShow, !0), this._camera = s.defaultValue(n.camera, null);
if (!this.checkDom(this.dom)) return "string" == typeof this.dom && this.dom.constructor == String && (this._url = this.dom, this.dom = this._createVideoEle(this._url)), void console.log("传入了非DOM元素");
this.init()
}
}
return o(e, [{
key: "init",
value: function () {
this.recordObj = this.record(), this.rectPos = this.computedPos(this.dis, this.fov, this.aspectRatio, this.recordObj);
var e = this.getOrientation(this.recordObj),
t = this.createFrustum(this.fov, this.aspectRatio, this.dis),
i = this.createFrustumGeo(t, e, this.recordObj.position);
this.frustumPri = this.createFrustumPri(i), this.addToScene()
}
}, {
key: "reset",
value: function () {
this.viewer.scene.primitives.remove(this.frustumPri), this.viewer.entities.remove(this.entity), this.rectPos = this.computedPos(this.dis, this.fov, this.aspectRatio, this.recordObj);
var e = this.getOrientation(this.recordObj),
t = this.createFrustum(this.fov, this.aspectRatio, this.dis),
i = this.createFrustumGeo(t, e, this.recordObj.position);
this.frustumPri = this.createFrustumPri(i), this.addToScene()
}
}, {
key: "record",
value: function () {
var e = {},
t = this._camera || this.viewer.scene.camera;
return e.direction = s.clone(t.direction), e.up = s.clone(t.up), e.right = s.clone(t.right), e.position = s.clone(t.position), e
}
}, {
key: "addToScene",
value: function () {
this.viewer.scene.primitives.add(this.frustumPri), this.entity = viewer.entities.add({
polygon: {
hierarchy: this.rectPos,
perPositionHeight: !0,
material: this.dom,
stRotation: this.stRotation
}
})
}
}, {
key: "computedPos",
value: function (e, t, i, r) {
var n = (this.viewer, r.position),
o = r.direction,
a = r.right,
l = r.up,
u = new s.Ray(n, o),
c = s.Ray.getPoint(u, e, new s.Cartesian3),
h = t / 2,
d = Math.tan(h),
f = e * d,
p = f / i,
m = Math.sqrt(f * f + p * p),
g = new s.Cartesian3,
v = new s.Ray(c, a),
y = s.Ray.getPoint(v, f, new s.Cartesian3),
_ = new s.Ray(y, l);
s.Ray.getPoint(_, p, g);
var w = new s.Cartesian3,
b = s.Cartesian3.negate(l, new s.Cartesian3),
C = new s.Ray(y, b);
s.Ray.getPoint(C, p, w);
var x = new s.Cartesian3,
P = s.Cartesian3.normalize(s.Cartesian3.subtract(c, g, new s.Cartesian3), new s.Cartesian3),
E = new s.Ray(c, P);
s.Ray.getPoint(E, m, x);
var M = new s.Cartesian3,
T = s.Cartesian3.normalize(s.Cartesian3.subtract(c, w, new s.Cartesian3), new s.Cartesian3),
S = new s.Ray(c, T);
return s.Ray.getPoint(S, m, M), this.reverse ? [x, M, g, w].reverse() : [x, M, g, w]
}
}, {
key: "checkDom",
value: function (e) {
if (e) return e instanceof u.default && e.length && (e = e[0], this.dom = e), "object" === ("undefined" == typeof HTMLElement ? "undefined" : n(HTMLElement)) ? e instanceof HTMLElement : e && "object" === (void 0 === e ? "undefined" : n(e)) && 1 === e.nodeType && "string" == typeof e.nodeName
}
}, {
key: "_createVideoEle",
value: function (e) {
if (e) {
this.videoId = "visualDomId";
var t = document.createElement("SOURCE");
t.type = "video/mp4", t.src = e;
var i = document.createElement("SOURCE");
i.type = "video/quicktime", i.src = e;
var r = document.createElement("VIDEO");
return r.setAttribute("autoplay", !0), r.setAttribute("loop", !0), r.setAttribute("crossorigin", !0), r.appendChild(t), r.appendChild(i), r.style.display = "none", document.body.appendChild(r), r
}
}
}, {
key: "createFrustum",
value: function (e, t, i) {
return new s.PerspectiveFrustum({
fov: e,
aspectRatio: t,
near: .1,
far: i
})
}
}, {
key: "getOrientation",
value: function (e) {
if (e) {
var t = e.direction,
i = e.up,
r = e.right,
n = new s.Cartesian3,
o = new s.Matrix3,
a = new s.Quaternion;
r = s.Cartesian3.negate(r, n);
var l = o;
s.Matrix3.setColumn(l, 0, r, l), s.Matrix3.setColumn(l, 1, i, l), s.Matrix3.setColumn(l, 2, t, l);
return s.Quaternion.fromRotationMatrix(l, a)
}
}
}, {
key: "createFrustumGeo",
value: function (e, t, i) {
return new s.FrustumOutlineGeometry({
frustum: e,
orientation: t,
origin: i
})
}
}, {
key: "createFrustumPri",
value: function (e) {
var t = new s.GeometryInstance({
geometry: e
});
return new s.Primitive({
geometryInstances: t,
appearance: new s.MaterialAppearance({
material: s.Material.fromType("Color"),
faceForward: !0
})
})
}
}, {
key: "locate",
value: function () {
this.viewer.camera.direction = s.clone(this.recordObj.direction), this.viewer.camera.right = s.clone(this.recordObj.right), this.viewer.camera.up = s.clone(this.recordObj.up), this.viewer.camera.position = s.clone(this.recordObj.position)
}
}, {
key: "rotateCamera",
value: function (e, t) {
var i = s.defaultValue(t, this._rotateCam);
switch (e) {
case c.LEFT:
break;
case c.RIGHT:
i *= -1;
break;
case c.TOP:
break;
case c.BOTTOM:
i *= -1;
break;
case c.ALONG:
break;
case c.INVERSE:
i *= -1
}
var r = this._computedNewViewDir(e, i);
this.recordObj.direction = r.direction, this.recordObj.up = r.up, this.recordObj.right = r.right, this.reset()
}
}, {
key: "_computedNewViewDir",
value: function (e, t) {
t = s.Math.toRadians(t);
var i = this.recordObj,
r = s.clone(i.direction),
n = s.clone(i.right),
o = s.clone(i.up),
a = new s.Matrix3;
switch (e) {
case c.LEFT:
case c.RIGHT:
s.Matrix3.fromRotationZ(t, a);
break;
case c.TOP:
case c.BOTTOM:
s.Matrix3.fromRotationY(t, a);
break;
case c.ALONG:
case c.INVERSE:
s.Matrix3.fromRotationX(t, a)
}
var l = s.Transforms.eastNorthUpToFixedFrame(i.position),
u = s.Matrix4.inverse(l, new s.Matrix4),
h = s.Matrix4.multiplyByPointAsVector(u, r, new s.Cartesian3),
d = s.Matrix3.multiplyByVector(a, h, new s.Cartesian3),
f = s.Matrix4.multiplyByPointAsVector(l, d, new s.Cartesian3),
p = s.Matrix4.multiplyByPointAsVector(u, n, new s.Cartesian3),
m = s.Matrix3.multiplyByVector(a, p, new s.Cartesian3),
g = s.Matrix4.multiplyByPointAsVector(l, m, new s.Cartesian3),
v = s.Matrix4.multiplyByPointAsVector(u, o, new s.Cartesian3),
y = s.Matrix3.multiplyByVector(a, v, new s.Cartesian3);
return {
direction: f,
right: g,
up: s.Matrix4.multiplyByPointAsVector(l, y, new s.Cartesian3)
}
}
}, {
key: "destroy",
value: function () {
this.viewer.scene.primitives.remove(this.frustumPri), this.viewer.entities.remove(this.entity), delete this.recordObj.direction, delete this.recordObj.right, delete this.recordObj.up, delete this.recordObj.position, delete this.recordObj, delete this.aspectRatio, delete this.fov, delete this.dis, delete this.dom, delete this.rectPos
}
}, {
key: "play",
get: function () {
return this._play
},
set: function (e) {
this._play = Boolean(e), this._play ? this.dom.play() : this.dom.pause()
}
}, {
key: "aspectRatio",
get: function () {
return this._aspectRatio
},
set: function (e) {
!(e = Number(e)) || e < 0 || (e < 1 && (e = 1), this._aspectRatio = e, this.reset())
}
}, {
key: "fov",
get: function () {
return this._fov
},
set: function (e) {
!(e = Number(e)) || e < 0 || (this._fov = e, this.reset())
}
}, {
key: "dis",
get: function () {
return this._dis
},
set: function (e) {
!(e = Number(e)) || e < 0 || (this._dis = e, this.reset())
}
}, {
key: "stRotation",
get: function () {
return this._stRotation
},
set: function (e) {
!(e = Number(e)) || e < 0 || (this._stRotation = e, this.entity.polygon.stRotation = e)
}
}, {
key: "frustumShow",
get: function () {
return this._frustumShow
},
set: function (e) {
e = Boolean(e), this._frustumShow = e, this.frustumPri.show = e
}
}, {
key: "params",
get: function () {
return {
fov: this.fov,
dis: this.dis,
stRotation: this.stRotation,
frustumShow: this.frustumShow,
aspectRatio: this.aspectRatio,
camera: {
position: this.recordObj.position,
direction: this.recordObj.direction,
up: this.recordObj.up,
right: this.recordObj.right
}
}
}
}]), e
}()
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.FlowEcharts = void 0;
var n = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o),
s = i(163),
l = function (e) {
return e && e.__esModule ? e : {
default: e
}
}(s),
u = a.Math.toRadians(80),
c = function () {
function e(t, i) {
r(this, e), this._GLMap = t, this.dimensions = ["lng", "lat"], this._mapOffset = [0, 0], this._api = i
}
return n(e, [{
key: "setMapOffset",
value: function (e) {
this._mapOffset = e
}
}, {
key: "getBMap",
value: function () {
return this._GLMap
}
}, {
key: "dataToPoint",
value: function (e) {
var t = [99999, 99999],
i = a.Cartesian3.fromDegrees(e[0], e[1]);
if (!i) return t;
var r = this._GLMap.cartesianToCanvasCoordinates(i);
if (!r) return t;
var n = this._GLMap;
if (n.mode === a.SceneMode.SCENE3D) {
if (a.Cartesian3.angleBetween(n.camera.position, i) > u) return !1
}
return [r.x - this._mapOffset[0], r.y - this._mapOffset[1]]
}
}, {
key: "pointToData",
value: function (e) {
var t = this._mapOffset,
e = this._bmap.project([e[0] + t[0], e[1] + t[1]]);
return [e.lng, e.lat]
}
}, {
key: "getViewRect",
value: function () {
var e = this._api;
return new l.default.graphic.BoundingRect(0, 0, e.getWidth(), e.getHeight())
}
}, {
key: "getRoamTransform",
value: function () {
return l.default.matrix.create()
}
}]), e
}();
c.dimensions = ["lng", "lat"], c.create = function (e, t) {
var i;
e.eachComponent("GLMap", function (e) {
var r = t.getZr().painter;
if (r) {
var n = (r.getViewportRoot(), l.default.glMap);
i = new c(n, t), i.setMapOffset(e.__mapOffset || [0, 0]), e.coordinateSystem = i
}
}), e.eachSeries(function (e) {
"GLMap" === e.get("coordinateSystem") && (e.coordinateSystem = i)
})
}, l.default && (l.default.registerCoordinateSystem("GLMap", c), l.default.registerAction({
type: "GLMapRoam",
event: "GLMapRoam",
update: "updateLayout"
}, function (e, t) {}), l.default.extendComponentModel({
type: "GLMap",
getBMap: function () {
return this.__GLMap
},
defaultOption: {
roam: !1
}
}), l.default.extendComponentView({
type: "GLMap",
init: function (e, t) {
this.api = t, l.default.glMap.postRender.addEventListener(this.moveHandler, this)
},
moveHandler: function (e, t) {
this.api.dispatchAction({
type: "GLMapRoam"
})
},
render: function (e, t, i) {},
dispose: function (e) {
l.default.glMap.postRender.removeEventListener(this.moveHandler, this)
}
}));
var h = 999;
t.FlowEcharts = function () {
function e(t, i) {
r(this, e), this._viewer = t, this._overlay = this._createChartOverlay(), this._overlay.setOption(i)
}
return n(e, [{
key: "_createChartOverlay",
value: function () {
var e = this._viewer.scene;
e.canvas.setAttribute("tabIndex", 0);
var t = document.createElement("div");
return t.style.position = "absolute", t.style.top = "0px", t.style.left = "0px", t.style.width = e.canvas.clientWidth + "px", t.style.height = e.canvas.clientHeight + "px", t.style.pointerEvents = "none", t.style.zIndex = h--, t.setAttribute("id", "echarts"), t.setAttribute("class", "echartMap"), this._viewer.cesiumWidget.container.appendChild(t), this._echartsContainer = t, l.default.glMap = e, l.default.init(t)
}
}, {
key: "dispose",
value: function () {
this._echartsContainer && (this._viewer.cesiumWidget.container.removeChild(this._echartsContainer), this._echartsContainer = null), this._overlay && (this._overlay.dispose(), this._overlay = null)
}
}, {
key: "destroy",
value: function () {
this.dispose()
}
}, {
key: "updateOverlay",
value: function (e) {
this._overlay && this._overlay.setOption(e)
}
}, {
key: "getMap",
value: function () {
return this._viewer
}
}, {
key: "getOverlay",
value: function () {
return this._overlay
}
}, {
key: "show",
value: function () {
this._echartsContainer && (this._echartsContainer.style.visibility = "visible")
}
}, {
key: "hide",
value: function () {
this._echartsContainer && (this._echartsContainer.style.visibility = "hidden")
}
}]), e
}()
}, function (e, t) {
e.exports = __WEBPACK_EXTERNAL_MODULE_163__
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.MapVLayer = void 0;
var n = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
o = i(0),
a = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(o),
s = i(165),
l = 0;
t.MapVLayer = function () {
function e(t, i, n, o) {
r(this, e), this.map = t, this.scene = t.scene, this.mapvBaseLayer = new s.MapVRenderer(t, i, n, this), this.mapVOptions = n, this.initDevicePixelRatio(), this.canvas = this._createCanvas(), this.render = this.render.bind(this), void 0 != o ? (this.container = o, o.appendChild(this.canvas)) : (this.container = t.container, this.addInnerContainer()), this.bindEvent(), this._reset()
}
return n(e, [{
key: "initDevicePixelRatio",
value: function () {
this.devicePixelRatio = window.devicePixelRatio || 1
}
}, {
key: "addInnerContainer",
value: function () {
this.container.appendChild(this.canvas)
}
}, {
key: "bindEvent",
value: function () {
var e = this;
this.innerMoveStart = this.moveStartEvent.bind(this), this.innerMoveEnd = this.moveEndEvent.bind(this), this.scene.camera.moveStart.addEventListener(this.innerMoveStart, this), this.scene.camera.moveEnd.addEventListener(this.innerMoveEnd, this);
var t = new a.ScreenSpaceEventHandler(this.canvas);
t.setInputAction(function (t) {
e.innerMoveEnd()
}, a.ScreenSpaceEventType.LEFT_UP), t.setInputAction(function (t) {
e.innerMoveEnd()
}, a.ScreenSpaceEventType.MIDDLE_UP), this.handler = t
}
}, {
key: "unbindEvent",
value: function () {
this.scene.camera.moveStart.removeEventListener(this.innerMoveStart, this), this.scene.camera.moveEnd.removeEventListener(this.innerMoveEnd, this), this.scene.postRender.removeEventListener(this._reset, this), this.handler && (this.handler.destroy(), this.handler = null)
}
}, {
key: "moveStartEvent",
value: function () {
this.mapvBaseLayer && this.mapvBaseLayer.animatorMovestartEvent(), this.scene.postRender.addEventListener(this._reset, this), console.log("mapv moveStartEvent")
}
}, {
key: "moveEndEvent",
value: function () {
this.scene.postRender.removeEventListener(this._reset, this), this.mapvBaseLayer && this.mapvBaseLayer.animatorMoveendEvent(), this._reset(), console.log("mapv moveEndEvent")
}
}, {
key: "zoomStartEvent",
value: function () {
this._unvisiable()
}
}, {
key: "zoomEndEvent",
value: function () {
this._unvisiable()
}
}, {
key: "addData",
value: function (e, t) {
void 0 != this.mapvBaseLayer && this.mapvBaseLayer.addData(e, t)
}
}, {
key: "updateData",
value: function (e, t) {
void 0 != this.mapvBaseLayer && this.mapvBaseLayer.updateData(e, t)
}
}, {
key: "getData",
value: function () {
return this.mapvBaseLayer && (this.dataSet = this.mapvBaseLayer.getData()), this.dataSet
}
}, {
key: "removeData",
value: function (e) {
void 0 != this.mapvBaseLayer && this.mapvBaseLayer && this.mapvBaseLayer.removeData(e)
}
}, {
key: "removeAllData",
value: function () {
void 0 != this.mapvBaseLayer && this.mapvBaseLayer.clearData()
}
}, {
key: "_visiable",
value: function () {
return this.canvas.style.display = "block"
}
}, {
key: "_unvisiable",
value: function () {
return this.canvas.style.display = "none"
}
}, {
key: "_createCanvas",
value: function () {
var e = document.createElement("canvas");
e.id = this.mapVOptions.layerid || "mapv" + l++, e.style.position = "absolute", e.style.top = "0px", e.style.left = "0px", e.style.pointerEvents = "none", e.style.zIndex = this.mapVOptions.zIndex || 100, e.width = parseInt(this.map.canvas.width), e.height = parseInt(this.map.canvas.height), e.style.width = this.map.canvas.style.width, e.style.height = this.map.canvas.style.height;
var t = this.devicePixelRatio;
return "2d" == this.mapVOptions.context && e.getContext(this.mapVOptions.context).scale(t, t), e
}
}, {
key: "_reset",
value: function () {
this.resizeCanvas(), this.fixPosition(), this.onResize(), this.render()
}
}, {
key: "draw",
value: function () {
this._reset()
}
}, {
key: "show",
value: function () {
this._visiable()
}
}, {
key: "hide",
value: function () {
this._unvisiable()
}
}, {
key: "destroy",
value: function () {
this.unbindEvent(), this.remove()
}
}, {
key: "remove",
value: function () {
void 0 != this.mapvBaseLayer && (this.removeAllData(), this.mapvBaseLayer.destroy(), this.mapvBaseLayer = void 0, this.canvas.parentElement.removeChild(this.canvas))
}
}, {
key: "update",
value: function (e) {
void 0 != e && this.updateData(e.data, e.options)
}
}, {
key: "resizeCanvas",
value: function () {
if (void 0 != this.canvas && null != this.canvas) {
var e = this.canvas;
e.style.position = "absolute", e.style.top = "0px", e.style.left = "0px", e.width = parseInt(this.map.canvas.width), e.height = parseInt(this.map.canvas.height), e.style.width = this.map.canvas.style.width, e.style.height = this.map.canvas.style.height
}
}
}, {
key: "fixPosition",
value: function () {}
}, {
key: "onResize",
value: function () {}
}, {
key: "render",
value: function () {
void 0 != this.mapvBaseLayer && this.mapvBaseLayer._canvasUpdate()
}
}]), e
}()
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
function n(e, t) {
if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return !t || "object" != typeof t && "function" != typeof t ? e : t
}
function o(e, t) {
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + typeof t);
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
enumerable: !1,
writable: !0,
configurable: !0
}
}), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.MapVRenderer = void 0;
var a = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
s = function e(t, i, r) {
null === t && (t = Function.prototype);
var n = Object.getOwnPropertyDescriptor(t, i);
if (void 0 === n) {
var o = Object.getPrototypeOf(t);
return null === o ? void 0 : e(o, i, r)
}
if ("value" in n) return n.value;
var a = n.get;
if (void 0 !== a) return a.call(r)
},
l = i(0),
u = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(l),
c = i(166),
h = c ? c.baiduMapLayer : null,
d = h ? h.__proto__ : Function,
f = u.Math.toRadians(80);
t.MapVRenderer = function (e) {
function t(e, i, o, a) {
r(this, t);
var s = n(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e, i, o));
return d ? (s.map = e, s.scene = e.scene, s.dataSet = i, o = o || {}, s.init(o), s.argCheck(o), s.initDevicePixelRatio(), s.canvasLayer = a, s.stopAniamation = !1, s.animation = o.animation, s.clickEvent = s.clickEvent.bind(s), s.mousemoveEvent = s.mousemoveEvent.bind(s), s.bindEvent(), s) : n(s)
}
return o(t, e), a(t, [{
key: "initDevicePixelRatio",
value: function () {
this.devicePixelRatio = window.devicePixelRatio || 1
}
}, {
key: "clickEvent",
value: function (e) {
var i = e.point;
s(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "clickEvent", this).call(this, i, e)
}
}, {
key: "mousemoveEvent",
value: function (e) {
var i = e.point;
s(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "mousemoveEvent", this).call(this, i, e)
}
}, {
key: "addAnimatorEvent",
value: function () {}
}, {
key: "animatorMovestartEvent",
value: function () {
var e = this.options.animation;
this.isEnabledTime() && this.animator && (this.steps.step = e.stepsRange.start)
}
}, {
key: "animatorMoveendEvent",
value: function () {
this.isEnabledTime() && this.animator
}
}, {
key: "bindEvent",
value: function () {
this.map, this.options.methods && (this.options.methods.click, this.options.methods.mousemove)
}
}, {
key: "unbindEvent",
value: function () {
var e = this.map;
this.options.methods && (this.options.methods.click && e.off("click", this.clickEvent), this.options.methods.mousemove && e.off("mousemove", this.mousemoveEvent))
}
}, {
key: "getContext",
value: function () {
return this.canvasLayer.canvas.getContext(this.context)
}
}, {
key: "init",
value: function (e) {
this.options = e, this.initDataRange(e), this.context = this.options.context || "2d", this.options.zIndex && this.canvasLayer && this.canvasLayer.setZIndex && this.canvasLayer.setZIndex(this.options.zIndex), this.initAnimator()
}
}, {
key: "_canvasUpdate",
value: function (e) {
this.map;
var t = this.scene;
if (this.canvasLayer && !this.stopAniamation) {
var i = this.options.animation,
r = this.getContext();
if (this.isEnabledTime()) {
if (void 0 === e) return void this.clear(r);
"2d" === this.context && (r.save(), r.globalCompositeOperation = "destination-out", r.fillStyle = "rgba(0, 0, 0, .1)", r.fillRect(0, 0, r.canvas.width, r.canvas.height), r.restore())
} else this.clear(r);
if ("2d" === this.context)
for (var n in this.options) r[n] = this.options[n];
else r.clear(r.COLOR_BUFFER_BIT);
var o = {
transferCoordinate: function (e) {
var i = [99999, 99999],
r = u.Cartesian3.fromDegrees(e[0], e[1]);
if (!r) return i;
var n = t.cartesianToCanvasCoordinates(r);
if (!n) return i;
if (t.mode === u.SceneMode.SCENE3D) {
if (u.Cartesian3.angleBetween(t.camera.position, r) > f) return !1
}
return [n.x, n.y]
}
};
void 0 !== e && (o.filter = function (t) {
var r = i.trails || 10;
return !!(e && t.time > e - r && t.time < e)
});
var a = this.dataSet.get(o);
this.processData(a), "m" == this.options.unit && this.options.size, this.options._size = this.options.size;
var s = u.SceneTransforms.wgs84ToWindowCoordinates(t, u.Cartesian3.fromDegrees(0, 0));
this.drawContext(r, new c.DataSet(a), this.options, s), this.options.updateCallback && this.options.updateCallback(e)
}
}
}, {
key: "updateData",
value: function (e, i) {
var r = e;
r && r.get && (r = r.get()), void 0 != r && this.dataSet.set(r), s(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "update", this).call(this, {
options: i
})
}
}, {
key: "addData",
value: function (e, t) {
var i = e;
e && e.get && (i = e.get()), this.dataSet.add(i), this.update({
options: t
})
}
}, {
key: "getData",
value: function () {
return this.dataSet
}
}, {
key: "removeData",
value: function (e) {
if (this.dataSet) {
var t = this.dataSet.get({
filter: function (t) {
return null == e || "function" != typeof e || !e(t)
}
});
this.dataSet.set(t), this.update({
options: null
})
}
}
}, {
key: "clearData",
value: function () {
this.dataSet && this.dataSet.clear(), this.update({
options: null
})
}
}, {
key: "draw",
value: function () {
this.canvasLayer.draw()
}
}, {
key: "clear",
value: function (e) {
e && e.clearRect && e.clearRect(0, 0, e.canvas.width, e.canvas.height)
}
}, {
key: "destroy",
value: function () {
this.unbindEvent(), this.clear(this.getContext()), this.clearData(), this.animator && this.animator.stop(), this.animator = null, this.canvasLayer = null
}
}]), t
}(d)
}, function (e, t) {
e.exports = __WEBPACK_EXTERNAL_MODULE_166__
}, function (e, t, i) {
"use strict";
function r(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
function n(e, t, i) {
var r = e.scene,
n = r.camera;
if (r.mode != s.SceneMode.MORPHING && (s.defined(i) || (i = new s.Cartesian3), s.defined(e.trackedEntity) ? i = e.trackedEntity.position.getValue(e.clock.currentTime, i) : (u.origin = n.positionWC, u.direction = n.directionWC, i = r.globe.pick(u, r, i)), s.defined(i))) return r.mode == s.SceneMode.SCENE2D || r.mode == s.SceneMode.COLUMBUS_VIEW ? (i = n.worldToCameraCoordinatesPoint(i, i), t && (i = r.globe.ellipsoid.cartographicToCartesian(r.mapProjection.unproject(i, l), i))) : t || (i = n.worldToCameraCoordinatesPoint(i, i)), i
}
Object.defineProperty(t, "__esModule", {
value: !0
}), t.ZoomNavigation = void 0;
var o = function () {
function e(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
return function (t, i, r) {
return i && e(t.prototype, i), r && e(t, r), t
}
}(),
a = i(0),
s = function (e) {
if (e && e.__esModule) return e;
var t = {};
if (null != e)
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
return t.default = e, t
}(a),
l = new s.Cartographic,
u = new s.Ray,
c = new s.Cartesian3;
t.ZoomNavigation = function () {
function e(t, i) {
r(this, e), this.viewer = t, this.relativeAmount = 2, i && (this.relativeAmount = 1 / this.relativeAmount)
}
return o(e, [{
key: "activate",
value: function () {
this.zoom(this.relativeAmount)
}
}, {
key: "zoom",
value: function (e) {
if (this.isActive = !0, s.defined(this.viewer)) {
var t = this.viewer.scene,
i = t.screenSpaceCameraController;
if (!i.enableInputs || !i.enableZoom) return;
var r, o = t.camera;
switch (t.mode) {
case s.SceneMode.MORPHING:
break;
case s.SceneMode.SCENE2D:
o.zoomIn(o.positionCartographic.height * (1 - this.relativeAmount));
break;
default:
var a;
if (a = s.defined(this.viewer.trackedEntity) ? new s.Cartesian3 : n(this.viewer, !1), s.defined(a)) r = {
direction: o.direction,
up: o.up
};
else {
var l = new s.Ray(o.worldToCameraCoordinatesPoint(t.globe.ellipsoid.cartographicToCartesian(o.positionCartographic)), o.directionWC);
a = s.IntersectionTests.grazingAltitudeLocation(l, t.globe.ellipsoid), r = {
heading: o.heading,
pitch: o.pitch,
roll: o.roll
}
}
var u = s.Cartesian3.subtract(o.position, a, c),
h = s.Cartesian3.multiplyByScalar(u, e, u),
d = s.Cartesian3.add(a, h, a);
s.defined(this.viewer.trackedEntity) || t.mode == s.SceneMode.COLUMBUS_VIEW ? o.position = d : o.flyTo({
destination: d,
orientation: r,
duration: .5,
convert: !1
})
}
}
this.isActive = !1
}
}]), e
}()
}])
});