1683 lines
58 KiB
JavaScript
1683 lines
58 KiB
JavaScript
|
import './main.css';
|
|||
|
const P = {
|
|||
|
props: {
|
|||
|
polygons: {
|
|||
|
// 实体
|
|||
|
type: Array,
|
|||
|
default: () => []
|
|||
|
}
|
|||
|
},
|
|||
|
computed: {
|
|||
|
polygonsComputed: {
|
|||
|
get() {
|
|||
|
return this.viewer ? this.polygons.map((t) => {
|
|||
|
let i;
|
|||
|
switch (Object.prototype.toString.call(t.color)) {
|
|||
|
case "[object String]":
|
|||
|
i = Cesium.Color.fromCssColorString(t.color);
|
|||
|
break;
|
|||
|
case "[object Array]":
|
|||
|
i = new Cesium.StripeMaterialProperty({
|
|||
|
evenColor: Cesium.Color.fromCssColorString(t.color[0]),
|
|||
|
oddColor: Cesium.Color.fromCssColorString(t.color[1]),
|
|||
|
repeat: 32,
|
|||
|
offset: 20,
|
|||
|
orientation: Cesium.StripeOrientation[t.color[2]]
|
|||
|
});
|
|||
|
break;
|
|||
|
}
|
|||
|
const o = new Cesium.Entity({
|
|||
|
id: t.id,
|
|||
|
name: t.name,
|
|||
|
description: t.description,
|
|||
|
polygon: {
|
|||
|
hierarchy: {
|
|||
|
positions: t.positions
|
|||
|
},
|
|||
|
material: i
|
|||
|
}
|
|||
|
});
|
|||
|
return Object.entries(t.data).forEach(([r, n]) => {
|
|||
|
o.addProperty(r), o[r] = n;
|
|||
|
}), o;
|
|||
|
}) : [];
|
|||
|
},
|
|||
|
set(t) {
|
|||
|
this.$emit("update:polygons", t);
|
|||
|
}
|
|||
|
}
|
|||
|
},
|
|||
|
data() {
|
|||
|
return {
|
|||
|
handlerPoint: {}
|
|||
|
};
|
|||
|
},
|
|||
|
watch: {
|
|||
|
polygonsComputed: {
|
|||
|
handler: function(t) {
|
|||
|
this.viewer && t.forEach((i, e) => {
|
|||
|
try {
|
|||
|
const o = this.viewer.entities.getById(i.id);
|
|||
|
o ? (this.viewer.entities.remove(o), this.viewer.entities.add(i)) : this.viewer.entities.add(i);
|
|||
|
} catch (o) {
|
|||
|
console.error(o);
|
|||
|
}
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
},
|
|||
|
methods: {
|
|||
|
draw(t = 3) {
|
|||
|
return new Promise((i, e) => {
|
|||
|
if (!this.viewer)
|
|||
|
return e("view未就绪");
|
|||
|
const o = (n) => {
|
|||
|
this.$emit("active", n);
|
|||
|
}, r = {
|
|||
|
1: Cesium.DrawMode.Point,
|
|||
|
2: Cesium.DrawMode.Line,
|
|||
|
3: Cesium.DrawMode.Polygon,
|
|||
|
4: Cesium.RasterGeometryType.POLYLINE,
|
|||
|
5: Cesium.RasterGeometryType.POLYGON,
|
|||
|
6: Cesium.DrawMode.Marker
|
|||
|
};
|
|||
|
this.handlerPoint = new Cesium.DrawHandler(this.viewer, r[t]), this.handlerPoint.activeEvt.addEventListener(o), this.handlerPoint.drawEvt.addEventListener((n) => i(n)), this.handlerPoint.activate();
|
|||
|
});
|
|||
|
},
|
|||
|
cancelDraw() {
|
|||
|
this.handlerPoint && (this.handlerPoint.polygon.show = !1, this.handlerPoint.polyline.show = !1, this.handlerPoint.clear(), this.handlerPoint.deactivate());
|
|||
|
}
|
|||
|
}
|
|||
|
}, B = {
|
|||
|
props: {
|
|||
|
coordinate: Object
|
|||
|
},
|
|||
|
watch: {
|
|||
|
viewer: function(t) {
|
|||
|
t && (t.scene.sun.show = !0, t.scene.lightSource.ambientLightColor = new Cesium.Color(0.76, 0.76, 0.76, 1));
|
|||
|
},
|
|||
|
coordinate: function(t) {
|
|||
|
this.viewer && this.viewer.camera.flyTo({
|
|||
|
destination: new Cesium.Cartesian3.fromDegrees(t.lng, t.lat, t.height),
|
|||
|
orientation: {
|
|||
|
heading: t.heading,
|
|||
|
pitch: t.pitch,
|
|||
|
roll: t.roll
|
|||
|
},
|
|||
|
duration: 5
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
}, I = {
|
|||
|
props: {
|
|||
|
tianditu: { type: Boolean, default: !0 },
|
|||
|
// 需要配合tiandituToken 使用
|
|||
|
tiandituCIA: { type: Boolean, default: !0 },
|
|||
|
// 需要配合tiandituToken 使用
|
|||
|
tiandituToken: { type: String, default: "4a00a1dc5387b8ed8adba3374bd87e5e" }
|
|||
|
},
|
|||
|
watch: {
|
|||
|
viewer: function(t) {
|
|||
|
t && this.tianditu && (this.initTdt(t), this.tiandituCIA && this.initTdtCIA(t));
|
|||
|
}
|
|||
|
},
|
|||
|
methods: {
|
|||
|
initTdt({ imageryLayers: t }) {
|
|||
|
const i = new Cesium.TiandituImageryProvider({
|
|||
|
token: this.tiandituToken,
|
|||
|
packingRequest: 1
|
|||
|
});
|
|||
|
t.addImageryProvider(i);
|
|||
|
},
|
|||
|
initTdtCIA({ imageryLayers: t }) {
|
|||
|
var i = new Cesium.TiandituImageryProvider({
|
|||
|
mapStyle: Cesium.TiandituMapsStyle.CIA_C,
|
|||
|
//天地图全球中文注记服务(经纬度投影)
|
|||
|
token: this.tiandituToken,
|
|||
|
packingRequest: 1
|
|||
|
});
|
|||
|
t.addImageryProvider(i);
|
|||
|
}
|
|||
|
}
|
|||
|
}, M = {
|
|||
|
data() {
|
|||
|
return {
|
|||
|
layers: [],
|
|||
|
propstyle: {}
|
|||
|
};
|
|||
|
},
|
|||
|
methods: {
|
|||
|
color(t) {
|
|||
|
return (...i) => new Cesium.Color[t](...i);
|
|||
|
},
|
|||
|
do(t) {
|
|||
|
return (...i) => {
|
|||
|
this.layers.forEach((e) => {
|
|||
|
e[t](...i);
|
|||
|
});
|
|||
|
};
|
|||
|
},
|
|||
|
entitieCall(t) {
|
|||
|
if (!this.viewer) {
|
|||
|
console.log("未就绪");
|
|||
|
return;
|
|||
|
}
|
|||
|
return (...i) => this.viewer.entities[t](...i);
|
|||
|
}
|
|||
|
}
|
|||
|
}, C = {
|
|||
|
props: {
|
|||
|
sceneInfos: {
|
|||
|
type: Array
|
|||
|
}
|
|||
|
// {id:'',layerUrl:'',dataUrl:''}
|
|||
|
},
|
|||
|
data() {
|
|||
|
return {
|
|||
|
scenes: [],
|
|||
|
otherInfo: {},
|
|||
|
layers: []
|
|||
|
};
|
|||
|
},
|
|||
|
watch: {
|
|||
|
viewer: function(t) {
|
|||
|
t && this.sceneInfos && this.sceneInfos.length != 0 && (this.beforeInit(t, this.sceneInfos), this.init(t, this.sceneInfos), this.action(t));
|
|||
|
},
|
|||
|
sceneInfos: function(t) {
|
|||
|
this.viewer && t && t.length != 0 && (this.beforeInit(this.viewer, t), this.init(this.viewer, t), this.action(this.viewer));
|
|||
|
},
|
|||
|
otherInfo: function(t) {
|
|||
|
this.viewer && this.action(this.viewer);
|
|||
|
}
|
|||
|
},
|
|||
|
methods: {
|
|||
|
beforeInit({ scene: t }, i) {
|
|||
|
i.forEach((e) => {
|
|||
|
e.pickHandle = (o) => {
|
|||
|
this.$emit("pick", { feature: o });
|
|||
|
}, e.promise = t.open(e.layerUrl, e.sceneName);
|
|||
|
});
|
|||
|
},
|
|||
|
action({ scene: t }) {
|
|||
|
const i = (o) => {
|
|||
|
let r = t.pick(o.position), n;
|
|||
|
Cesium.defined(r) && (n = this.otherInfo[r.id.id]), this.$emit("action", { ...o, pick: r, data: n });
|
|||
|
};
|
|||
|
new Cesium.ScreenSpaceEventHandler(t.canvas).setInputAction(i, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
|||
|
},
|
|||
|
init({ scene: t, pickEvent: i }, e) {
|
|||
|
const o = ({ pickColor: n, pickHandle: a, dataUrl: l, id: s }, d) => {
|
|||
|
const h = Cesium.Color.fromCssColorString(n || "rgba(23,92,239,0.5)"), m = [];
|
|||
|
d.forEach((c) => {
|
|||
|
c.selectedColor = h;
|
|||
|
const u = c.name.split("@"), f = t.layers.find(c.name);
|
|||
|
f.setQueryParameter({
|
|||
|
url: l,
|
|||
|
dataSourceName: u[1],
|
|||
|
dataSetName: u[0],
|
|||
|
isMerge: !0
|
|||
|
}), m.push(f.datasetInfo());
|
|||
|
}), Cesium.when.all(m, (c) => {
|
|||
|
console.log("图层信息", c), this.$emit("dataInfo", { id: s, datas: c });
|
|||
|
}), this.layers = d, i.addEventListener(a), this.$emit("init");
|
|||
|
}, r = (n) => {
|
|||
|
console.log("准备打开", n), Cesium.when(
|
|||
|
n.promise,
|
|||
|
(a) => {
|
|||
|
console.log("该场景图层", a), n.dataUrl && o(n, a);
|
|||
|
},
|
|||
|
function(a) {
|
|||
|
this.$emit("error", a);
|
|||
|
}
|
|||
|
);
|
|||
|
};
|
|||
|
try {
|
|||
|
e.forEach(r);
|
|||
|
} catch (n) {
|
|||
|
this.$emit("error", n);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}, p = (t, i) => {
|
|||
|
let e, o = {};
|
|||
|
try {
|
|||
|
Array.prototype.slice.call(t).forEach((r) => {
|
|||
|
if (r.className === i)
|
|||
|
throw e = r, o;
|
|||
|
});
|
|||
|
} catch (r) {
|
|||
|
if (r !== o)
|
|||
|
throw r;
|
|||
|
}
|
|||
|
return e;
|
|||
|
}, x = (t, i) => {
|
|||
|
var e = [];
|
|||
|
e.push(
|
|||
|
new t.ProviderViewModel({
|
|||
|
name: "本地图片",
|
|||
|
iconUrl: `${i}Widgets/Images/ImageryProviders/bingAerial.png`,
|
|||
|
tooltip: "本地图片",
|
|||
|
creationFunction: () => new t.SingleTileImageryProvider({
|
|||
|
url: `${i}Assets/Textures/GlobalBkLayer.jpg`
|
|||
|
})
|
|||
|
})
|
|||
|
), t.defined(t.SuperMapImageryProvider) ? (e.push(
|
|||
|
new t.ProviderViewModel({
|
|||
|
name: "天地图全球影像地图服务",
|
|||
|
iconUrl: `${i}Widgets/Images/ImageryProviders/bingAerial.png`,
|
|||
|
tooltip: "天地图全球影像地图服务",
|
|||
|
creationFunction: () => new t.TiandituImageryProvider({
|
|||
|
credit: new t.Credit(
|
|||
|
`天地图全球影像地图服务
|
|||
|
数据来源:国家地理信息公共服务平台 & 四川省测绘地理信息局`
|
|||
|
)
|
|||
|
})
|
|||
|
})
|
|||
|
), e.push(
|
|||
|
new t.ProviderViewModel({
|
|||
|
name: "天地图全球矢量地图服务",
|
|||
|
iconUrl: `${i}Widgets/Images/ImageryProviders/bingAerial.png`,
|
|||
|
tooltip: "天地图全球矢量地图服务",
|
|||
|
creationFunction: () => new t.TiandituImageryProvider({
|
|||
|
credit: new t.Credit(
|
|||
|
`天地图全球矢量地图服务
|
|||
|
数据来源:国家地理信息公共服务平台 & 四川省测绘地理信息局`
|
|||
|
),
|
|||
|
mapStyle: t.TiandituMapsStyle.VEC_C
|
|||
|
})
|
|||
|
})
|
|||
|
)) : e.push(
|
|||
|
new t.ProviderViewModel({
|
|||
|
name: "天地图全球影像服务",
|
|||
|
iconUrl: `${i}Widgets/Images/ImageryProviders/bingAerial.png`,
|
|||
|
tooltip: "全球天地图影像服务",
|
|||
|
creationFunction: () => new t.WebMapTileServiceImageryProvider({
|
|||
|
url: "http://t0.tianditu.com/img_c/wmts?service=WMTS&version=1.0.0&request=GetTile&tilematrix={TileMatrix}&layer=img&style={style}&tilerow={TileRow}&tilecol={TileCol}&tilematrixset={TileMatrixSet}&format=tiles",
|
|||
|
layer: "img",
|
|||
|
style: "default",
|
|||
|
format: "tiles",
|
|||
|
tileMatrixSetID: "c",
|
|||
|
credit: new t.Credit(
|
|||
|
`天地图全球影像服务。
|
|||
|
数据来源:国家地理信息公共服务平台 & 四川省测绘地理信息局`
|
|||
|
),
|
|||
|
subdomains: ["t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7"],
|
|||
|
maximumLevel: 20,
|
|||
|
tilingScheme: new t.GeographicTilingScheme(),
|
|||
|
tileMatrixLabels: [
|
|||
|
"1",
|
|||
|
"2",
|
|||
|
"3",
|
|||
|
"4",
|
|||
|
"5",
|
|||
|
"6",
|
|||
|
"7",
|
|||
|
"8",
|
|||
|
"9",
|
|||
|
"10",
|
|||
|
"11",
|
|||
|
"12",
|
|||
|
"13",
|
|||
|
"14",
|
|||
|
"15",
|
|||
|
"16",
|
|||
|
"17",
|
|||
|
"18",
|
|||
|
"19"
|
|||
|
]
|
|||
|
})
|
|||
|
})
|
|||
|
), e.push(
|
|||
|
new t.ProviderViewModel({
|
|||
|
name: "高德影像",
|
|||
|
iconUrl: `${i}Widgets/Images/ImageryProviders/bingAerial.png`,
|
|||
|
tooltip: "高德影像",
|
|||
|
creationFunction: function() {
|
|||
|
return b(t);
|
|||
|
}
|
|||
|
})
|
|||
|
), e.push(
|
|||
|
new t.ProviderViewModel({
|
|||
|
name: "高德矢量",
|
|||
|
iconUrl: `${i}Widgets/Images/ImageryProviders/bingAerial.png`,
|
|||
|
tooltip: "高德矢量",
|
|||
|
creationFunction: function() {
|
|||
|
return b(t, {
|
|||
|
url: "http://webst01.is.autonavi.com/appmaptile?style=7&x={x}&y={y}&z={z}"
|
|||
|
});
|
|||
|
}
|
|||
|
})
|
|||
|
), e.push(
|
|||
|
new t.ProviderViewModel({
|
|||
|
name: "百度地图服务",
|
|||
|
iconUrl: `${i}Widgets/Images/ImageryProviders/bingAerial.png`,
|
|||
|
tooltip: "百度地图服务",
|
|||
|
creationFunction: function() {
|
|||
|
return new o();
|
|||
|
}
|
|||
|
})
|
|||
|
), e.push(
|
|||
|
new t.ProviderViewModel({
|
|||
|
name: "Bing Maps Aerial",
|
|||
|
iconUrl: `${i}Widgets/Images/ImageryProviders/bingAerial.png`,
|
|||
|
tooltip: `Bing Maps aerial imagery
|
|||
|
http://www.bing.com/maps`,
|
|||
|
creationFunction: function() {
|
|||
|
return new t.BingMapsImageryProvider({
|
|||
|
url: "https://dev.virtualearth.net",
|
|||
|
mapStyle: t.BingMapsStyle.AERIAL
|
|||
|
});
|
|||
|
}
|
|||
|
})
|
|||
|
), e.push(
|
|||
|
new t.ProviderViewModel({
|
|||
|
name: "Bing Maps Aerial with Labels",
|
|||
|
iconUrl: `${i}Widgets/Images/ImageryProviders/bingAerialLabels.png`,
|
|||
|
tooltip: `Bing Maps aerial imagery with label overlays
|
|||
|
http://www.bing.com/maps`,
|
|||
|
creationFunction: function() {
|
|||
|
return new t.BingMapsImageryProvider({
|
|||
|
url: "https://dev.virtualearth.net",
|
|||
|
mapStyle: t.BingMapsStyle.AERIAL_WITH_LABELS
|
|||
|
});
|
|||
|
}
|
|||
|
})
|
|||
|
), e.push(
|
|||
|
new t.ProviderViewModel({
|
|||
|
name: "Bing Maps Roads",
|
|||
|
iconUrl: `${i}Widgets/Images/ImageryProviders/bingRoads.png`,
|
|||
|
tooltip: `Bing Maps standard road maps
|
|||
|
http://www.bing.com/maps`,
|
|||
|
creationFunction: function() {
|
|||
|
return new t.BingMapsImageryProvider({
|
|||
|
url: "https://dev.virtualearth.net",
|
|||
|
mapStyle: t.BingMapsStyle.ROAD
|
|||
|
});
|
|||
|
}
|
|||
|
})
|
|||
|
), e.push(
|
|||
|
new t.ProviderViewModel({
|
|||
|
name: "Mapbox Satellite",
|
|||
|
tooltip: "Mapbox satellite imagery https://www.mapbox.com/maps/",
|
|||
|
iconUrl: `${i}Widgets/Images/ImageryProviders/mapboxSatellite.png`,
|
|||
|
creationFunction: function() {
|
|||
|
return new t.MapboxImageryProvider({
|
|||
|
mapId: "mapbox.satellite"
|
|||
|
});
|
|||
|
}
|
|||
|
})
|
|||
|
), e.push(
|
|||
|
new t.ProviderViewModel({
|
|||
|
name: "Mapbox Streets",
|
|||
|
tooltip: "Mapbox streets imagery https://www.mapbox.com/maps/",
|
|||
|
iconUrl: `${i}Widgets/Images/ImageryProviders/mapboxTerrain.png`,
|
|||
|
creationFunction: function() {
|
|||
|
return new t.MapboxImageryProvider({
|
|||
|
mapId: "mapbox.streets"
|
|||
|
});
|
|||
|
}
|
|||
|
})
|
|||
|
), e.push(
|
|||
|
new t.ProviderViewModel({
|
|||
|
name: "ESRI World Imagery",
|
|||
|
iconUrl: `${i}Widgets/Images/ImageryProviders/esriWorldImagery.png`,
|
|||
|
tooltip: `World Imagery provides one meter or better satellite and aerial imagery in many parts of the world and lower resolution satellite imagery worldwide. The map includes NASA Blue Marble: Next Generation 500m resolution imagery at small scales (above 1:1,000,000), i-cubed 15m eSAT imagery at medium-to-large scales (down to 1:70,000) for the world, and USGS 15m Landsat imagery for Antarctica. The map features 0.3m resolution imagery in the continental United States and 0.6m resolution imagery in parts of Western Europe from DigitalGlobe. In other parts of the world, 1 meter resolution imagery is available from GeoEye IKONOS, i-cubed Nationwide Prime, Getmapping, AeroGRID, IGN Spain, and IGP Portugal. Additionally, imagery at different resolutions has been contributed by the GIS User Community.
|
|||
|
http://www.esri.com`,
|
|||
|
creationFunction: function() {
|
|||
|
return new t.ArcGisMapServerImageryProvider({
|
|||
|
url: "https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",
|
|||
|
enablePickFeatures: !1
|
|||
|
});
|
|||
|
}
|
|||
|
})
|
|||
|
), e.push(
|
|||
|
new t.ProviderViewModel({
|
|||
|
name: "ESRI World Street Map",
|
|||
|
iconUrl: `${i}Widgets/Images/ImageryProviders/esriWorldStreetMap.png`,
|
|||
|
tooltip: `This worldwide street map presents highway-level data for the world. Street-level data includes the United States; much of Canada; Japan; most countries in Europe; Australia and New Zealand; India; parts of South America including Argentina, Brazil, Chile, Colombia, and Venezuela; Ghana; and parts of southern Africa including Botswana, Lesotho, Namibia, South Africa, and Swaziland.
|
|||
|
http://www.esri.com`,
|
|||
|
creationFunction: function() {
|
|||
|
return new t.ArcGisMapServerImageryProvider({
|
|||
|
url: "https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer",
|
|||
|
enablePickFeatures: !1
|
|||
|
});
|
|||
|
}
|
|||
|
})
|
|||
|
), e.push(
|
|||
|
new t.ProviderViewModel({
|
|||
|
name: "ESRI National Geographic",
|
|||
|
iconUrl: `${i}Widgets/Images/ImageryProviders/esriNationalGeographic.png`,
|
|||
|
tooltip: `This web map contains the National Geographic World Map service. This map service is designed to be used as a general reference map for informational and educational purposes as well as a basemap by GIS professionals and other users for creating web maps and web mapping applications.
|
|||
|
http://www.esri.com`,
|
|||
|
creationFunction: function() {
|
|||
|
return new t.ArcGisMapServerImageryProvider({
|
|||
|
url: "https://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/",
|
|||
|
enablePickFeatures: !1
|
|||
|
});
|
|||
|
}
|
|||
|
})
|
|||
|
), e.push(
|
|||
|
new t.ProviderViewModel({
|
|||
|
name: "OpenStreetMap",
|
|||
|
iconUrl: `${i}Widgets/Images/ImageryProviders/openStreetMap.png`,
|
|||
|
tooltip: `OpenStreetMap (OSM) is a collaborative project to create a free editable map of the world.
|
|||
|
http://www.openstreetmap.org`,
|
|||
|
creationFunction: function() {
|
|||
|
return t.createOpenStreetMapImageryProvider({
|
|||
|
url: "https://a.tile.openstreetmap.org/"
|
|||
|
});
|
|||
|
}
|
|||
|
})
|
|||
|
), e.push(
|
|||
|
new t.ProviderViewModel({
|
|||
|
name: "Stamen Watercolor",
|
|||
|
iconUrl: `${i}Widgets/Images/ImageryProviders/stamenWatercolor.png`,
|
|||
|
tooltip: `Reminiscent of hand drawn maps, Stamen watercolor maps apply raster effect area washes and organic edges over a paper texture to add warm pop to any map.
|
|||
|
http://maps.stamen.com`,
|
|||
|
creationFunction: function() {
|
|||
|
return t.createOpenStreetMapImageryProvider({
|
|||
|
url: "https://stamen-tiles.a.ssl.fastly.net/watercolor/",
|
|||
|
credit: "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA."
|
|||
|
});
|
|||
|
}
|
|||
|
})
|
|||
|
), e.push(
|
|||
|
new t.ProviderViewModel({
|
|||
|
name: "Stamen Toner",
|
|||
|
iconUrl: `${i}Widgets/Images/ImageryProviders/stamenToner.png`,
|
|||
|
tooltip: `A high contrast black and white map.
|
|||
|
http://maps.stamen.com`,
|
|||
|
creationFunction: function() {
|
|||
|
return t.createOpenStreetMapImageryProvider({
|
|||
|
url: "https://stamen-tiles.a.ssl.fastly.net/toner/",
|
|||
|
credit: "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA."
|
|||
|
});
|
|||
|
}
|
|||
|
})
|
|||
|
), e.push(
|
|||
|
new t.ProviderViewModel({
|
|||
|
name: "The Black Marble",
|
|||
|
iconUrl: `${i}Widgets/Images/ImageryProviders/blackMarble.png`,
|
|||
|
tooltip: "The lights of cities and villages trace the outlines of civilization in this global view of the Earth at night as seen by NASA/NOAA's Suomi NPP satellite.",
|
|||
|
creationFunction: function() {
|
|||
|
return t.createTileMapServiceImageryProvider({
|
|||
|
url: "https://cesiumjs.org/blackmarble",
|
|||
|
flipXY: !0,
|
|||
|
credit: "Black Marble imagery courtesy NASA Earth Observatory"
|
|||
|
});
|
|||
|
}
|
|||
|
})
|
|||
|
), e.push(
|
|||
|
new t.ProviderViewModel({
|
|||
|
name: "Natural Earth II",
|
|||
|
iconUrl: `${i}Widgets/Images/ImageryProviders/naturalEarthII.png`,
|
|||
|
tooltip: `Natural Earth II, darkened for contrast.
|
|||
|
http://www.naturalearthdata.com/`,
|
|||
|
creationFunction: function() {
|
|||
|
return t.createTileMapServiceImageryProvider({
|
|||
|
url: `${i}Assets/Textures/NaturalEarthII`
|
|||
|
});
|
|||
|
}
|
|||
|
})
|
|||
|
);
|
|||
|
function o(n) {
|
|||
|
this._url = "http://online1.map.bdimg.com/onlinelabel/?qt=tile", this._tileWidth = 256, this._tileHeight = 256, this._maximumLevel = 18;
|
|||
|
var a = new t.Cartesian2(-25165824, -25165824), l = new t.Cartesian2(25165824, 25165824);
|
|||
|
this._tilingScheme = new t.WebMercatorTilingScheme({
|
|||
|
rectangleSouthwestInMeters: a,
|
|||
|
rectangleNortheastInMeters: l
|
|||
|
}), this._credit = void 0, this._rectangle = this._tilingScheme.rectangle, this._ready = !0;
|
|||
|
}
|
|||
|
function r(n, a, l, s) {
|
|||
|
var d = n._url + "&x={x}&y={y}&z={z}", h = n._tilingScheme.getNumberOfXTilesAtLevel(s), m = n._tilingScheme.getNumberOfYTilesAtLevel(s);
|
|||
|
return d = d.replace("{x}", a - h / 2).replace("{y}", m / 2 - l).replace("{z}", s), d;
|
|||
|
}
|
|||
|
return t.defineProperties(o.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 t.DeveloperError(
|
|||
|
"tileWidth must not be called before the imagery provider is ready."
|
|||
|
);
|
|||
|
return this._tileWidth;
|
|||
|
}
|
|||
|
},
|
|||
|
tileHeight: {
|
|||
|
get: function() {
|
|||
|
if (!this._ready)
|
|||
|
throw new t.DeveloperError(
|
|||
|
"tileHeight must not be called before the imagery provider is ready."
|
|||
|
);
|
|||
|
return this._tileHeight;
|
|||
|
}
|
|||
|
},
|
|||
|
maximumLevel: {
|
|||
|
get: function() {
|
|||
|
if (!this._ready)
|
|||
|
throw new t.DeveloperError(
|
|||
|
"maximumLevel must not be called before the imagery provider is ready."
|
|||
|
);
|
|||
|
return this._maximumLevel;
|
|||
|
}
|
|||
|
},
|
|||
|
minimumLevel: {
|
|||
|
get: function() {
|
|||
|
if (!this._ready)
|
|||
|
throw new t.DeveloperError(
|
|||
|
"minimumLevel must not be called before the imagery provider is ready."
|
|||
|
);
|
|||
|
return 0;
|
|||
|
}
|
|||
|
},
|
|||
|
tilingScheme: {
|
|||
|
get: function() {
|
|||
|
if (!this._ready)
|
|||
|
throw new t.DeveloperError(
|
|||
|
"tilingScheme must not be called before the imagery provider is ready."
|
|||
|
);
|
|||
|
return this._tilingScheme;
|
|||
|
}
|
|||
|
},
|
|||
|
rectangle: {
|
|||
|
get: function() {
|
|||
|
if (!this._ready)
|
|||
|
throw new t.DeveloperError(
|
|||
|
"rectangle must not be called before the imagery provider is ready."
|
|||
|
);
|
|||
|
return this._rectangle;
|
|||
|
}
|
|||
|
},
|
|||
|
tileDiscardPolicy: {
|
|||
|
get: function() {
|
|||
|
if (!this._ready)
|
|||
|
throw new t.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;
|
|||
|
}
|
|||
|
}
|
|||
|
}), o.prototype.getTileCredits = function(n, a, l) {
|
|||
|
}, o.prototype.requestImage = function(n, a, l) {
|
|||
|
if (!this._ready)
|
|||
|
throw new t.DeveloperError(
|
|||
|
"requestImage must not be called before the imagery provider is ready."
|
|||
|
);
|
|||
|
var s = r(this, n, a, l);
|
|||
|
return t.ImageryProvider.loadImage(this, s);
|
|||
|
}, e;
|
|||
|
}, S = (t, i) => {
|
|||
|
var e = [];
|
|||
|
return e.push(
|
|||
|
new t.ProviderViewModel({
|
|||
|
name: "WGS84 Ellipsoid",
|
|||
|
iconUrl: `${i}Widgets/Images/TerrainProviders/Ellipsoid.png`,
|
|||
|
tooltip: "WGS84 standard ellipsoid, also known as EPSG:4326",
|
|||
|
creationFunction: function() {
|
|||
|
return new t.EllipsoidTerrainProvider();
|
|||
|
}
|
|||
|
})
|
|||
|
), e.push(
|
|||
|
new t.ProviderViewModel({
|
|||
|
name: "STK World Terrain meshes",
|
|||
|
iconUrl: `${i}Widgets/Images/TerrainProviders/STK.png`,
|
|||
|
tooltip: `High-resolution, mesh-based terrain for the entire globe. Free for use on the Internet. Closed-network options are available.
|
|||
|
http://www.agi.com`,
|
|||
|
creationFunction: function() {
|
|||
|
return new t.CesiumTerrainProvider({
|
|||
|
url: "https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles",
|
|||
|
requestWaterMask: !0,
|
|||
|
requestVertexNormals: !0
|
|||
|
});
|
|||
|
}
|
|||
|
})
|
|||
|
), e;
|
|||
|
};
|
|||
|
function b(t, i) {
|
|||
|
i = t.defaultValue(i, {});
|
|||
|
var e = t.defaultValue(
|
|||
|
i.url,
|
|||
|
"http://webst01.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}"
|
|||
|
), o = new t.Credit("AMap"), r = new t.WebMercatorTilingScheme({
|
|||
|
ellipsoid: i.ellipsoid
|
|||
|
}), n = 256, a = 256, l = t.defaultValue(i.minimumLevel, 0), s = t.defaultValue(i.minimumLevel, 18), d = t.defaultValue(i.rectangle, r.rectangle), h = r.positionToTileXY(
|
|||
|
t.Rectangle.southwest(d),
|
|||
|
l
|
|||
|
), m = r.positionToTileXY(
|
|||
|
t.Rectangle.northeast(d),
|
|||
|
l
|
|||
|
), c = (Math.abs(m.x - h.x) + 1) * (Math.abs(m.y - h.y) + 1);
|
|||
|
if (c > 4)
|
|||
|
throw new t.DeveloperError(
|
|||
|
"The rectangle and minimumLevel indicate that there are " + c + " tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported."
|
|||
|
);
|
|||
|
var u = t.defaultValue(i.credit, o);
|
|||
|
return typeof u == "string" && (u = new t.Credit(u)), new t.UrlTemplateImageryProvider({
|
|||
|
url: e,
|
|||
|
proxy: i.proxy,
|
|||
|
credit: u,
|
|||
|
tilingScheme: r,
|
|||
|
tileWidth: n,
|
|||
|
tileHeight: a,
|
|||
|
minimumLevel: l,
|
|||
|
maximumLevel: s,
|
|||
|
rectangle: d
|
|||
|
});
|
|||
|
}
|
|||
|
function v(t, i, e, o, r, n, a, l) {
|
|||
|
var s = typeof t == "function" ? t.options : t;
|
|||
|
i && (s.render = i, s.staticRenderFns = e, s._compiled = !0), o && (s.functional = !0), n && (s._scopeId = "data-v-" + n);
|
|||
|
var d;
|
|||
|
if (a ? (d = function(c) {
|
|||
|
c = c || // cached call
|
|||
|
this.$vnode && this.$vnode.ssrContext || // stateful
|
|||
|
this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !c && typeof __VUE_SSR_CONTEXT__ < "u" && (c = __VUE_SSR_CONTEXT__), r && r.call(this, c), c && c._registeredComponents && c._registeredComponents.add(a);
|
|||
|
}, s._ssrRegister = d) : r && (d = l ? function() {
|
|||
|
r.call(
|
|||
|
this,
|
|||
|
(s.functional ? this.parent : this).$root.$options.shadowRoot
|
|||
|
);
|
|||
|
} : r), d)
|
|||
|
if (s.functional) {
|
|||
|
s._injectStyles = d;
|
|||
|
var h = s.render;
|
|||
|
s.render = function(u, f) {
|
|||
|
return d.call(f), h(u, f);
|
|||
|
};
|
|||
|
} else {
|
|||
|
var m = s.beforeCreate;
|
|||
|
s.beforeCreate = m ? [].concat(m, d) : [d];
|
|||
|
}
|
|||
|
return {
|
|||
|
exports: t,
|
|||
|
options: s
|
|||
|
};
|
|||
|
}
|
|||
|
const k = {
|
|||
|
name: "sm-bim",
|
|||
|
props: {
|
|||
|
container: {
|
|||
|
type: String,
|
|||
|
default: "cesiumContainer"
|
|||
|
},
|
|||
|
cesiumPath: {
|
|||
|
type: String
|
|||
|
},
|
|||
|
animation: {
|
|||
|
type: Boolean,
|
|||
|
default: !1
|
|||
|
},
|
|||
|
baseLayerPicker: {
|
|||
|
type: Boolean,
|
|||
|
default: !1
|
|||
|
},
|
|||
|
fullscreenButton: {
|
|||
|
type: Boolean,
|
|||
|
default: !1
|
|||
|
},
|
|||
|
vrButton: {
|
|||
|
type: Boolean,
|
|||
|
default: !1
|
|||
|
},
|
|||
|
geocoder: {
|
|||
|
type: Boolean,
|
|||
|
default: !1
|
|||
|
},
|
|||
|
homeButton: {
|
|||
|
type: Boolean,
|
|||
|
default: !1
|
|||
|
},
|
|||
|
infoBox: {
|
|||
|
type: Boolean,
|
|||
|
default: !0
|
|||
|
},
|
|||
|
sceneModePicker: {
|
|||
|
type: Boolean,
|
|||
|
default: !1
|
|||
|
},
|
|||
|
selectionIndicator: {
|
|||
|
type: Boolean,
|
|||
|
default: !0
|
|||
|
},
|
|||
|
timeline: {
|
|||
|
type: Boolean,
|
|||
|
default: !1
|
|||
|
},
|
|||
|
navigationHelpButton: {
|
|||
|
type: Boolean,
|
|||
|
default: !1
|
|||
|
},
|
|||
|
navigationInstructionsInitiallyVisible: {
|
|||
|
type: Boolean,
|
|||
|
default: !1
|
|||
|
},
|
|||
|
scene3DOnly: {
|
|||
|
type: Boolean,
|
|||
|
default: !1
|
|||
|
},
|
|||
|
shouldAnimate: {
|
|||
|
type: Boolean,
|
|||
|
default: !1
|
|||
|
},
|
|||
|
clockViewModel: {
|
|||
|
type: Object
|
|||
|
},
|
|||
|
selectedImageryProviderViewModel: {
|
|||
|
type: Object
|
|||
|
},
|
|||
|
imageryProviderViewModels: {
|
|||
|
type: Object
|
|||
|
},
|
|||
|
selectedTerrainProviderViewModel: {
|
|||
|
type: Object
|
|||
|
},
|
|||
|
terrainProviderViewModels: {
|
|||
|
type: Object
|
|||
|
},
|
|||
|
imageryProvider: {
|
|||
|
type: Object
|
|||
|
},
|
|||
|
terrainProvider: {
|
|||
|
type: Object
|
|||
|
},
|
|||
|
skyBox: {
|
|||
|
type: Object
|
|||
|
},
|
|||
|
skyAtmosphere: {
|
|||
|
type: Object
|
|||
|
},
|
|||
|
fullscreenElement: {
|
|||
|
type: String
|
|||
|
},
|
|||
|
useDefaultRenderLoop: {
|
|||
|
type: Boolean,
|
|||
|
default: !0
|
|||
|
},
|
|||
|
targetFrameRate: {
|
|||
|
type: Number
|
|||
|
},
|
|||
|
showRenderLoopErrors: {
|
|||
|
type: Boolean,
|
|||
|
default: !0
|
|||
|
},
|
|||
|
automaticallyTrackDataSourceClocks: {
|
|||
|
type: Boolean,
|
|||
|
default: !0
|
|||
|
},
|
|||
|
contextOptions: {
|
|||
|
type: Object
|
|||
|
},
|
|||
|
sceneMode: {
|
|||
|
type: Number,
|
|||
|
default: 3
|
|||
|
},
|
|||
|
mapProjection: {
|
|||
|
type: Object
|
|||
|
},
|
|||
|
globe: {
|
|||
|
type: Object
|
|||
|
},
|
|||
|
orderIndependentTranslucency: {
|
|||
|
type: Boolean,
|
|||
|
default: !0
|
|||
|
},
|
|||
|
creditContainer: {
|
|||
|
type: String
|
|||
|
},
|
|||
|
creditViewport: {
|
|||
|
type: String
|
|||
|
},
|
|||
|
dataSources: {
|
|||
|
type: Object
|
|||
|
},
|
|||
|
terrainExaggeration: {
|
|||
|
type: Number,
|
|||
|
default: 1
|
|||
|
},
|
|||
|
shadows: {
|
|||
|
type: Boolean,
|
|||
|
default: !1
|
|||
|
},
|
|||
|
terrainShadows: {
|
|||
|
type: Number
|
|||
|
// default: Cesium.ShadowMode.RECEIVE_ONLY
|
|||
|
},
|
|||
|
mapMode2D: {
|
|||
|
type: Number
|
|||
|
// default: Cesium.MapMode2D.INFINITE_SCROLL
|
|||
|
},
|
|||
|
projectionPicker: {
|
|||
|
type: Boolean,
|
|||
|
default: !1
|
|||
|
},
|
|||
|
requestRenderMode: {
|
|||
|
type: Boolean,
|
|||
|
default: !1
|
|||
|
},
|
|||
|
maximumRenderTimeChange: {
|
|||
|
type: Number,
|
|||
|
default: 0
|
|||
|
},
|
|||
|
navigation: {
|
|||
|
type: Boolean,
|
|||
|
default: !1
|
|||
|
},
|
|||
|
camera: {
|
|||
|
type: Object
|
|||
|
}
|
|||
|
},
|
|||
|
watch: {
|
|||
|
selectionIndicator(t) {
|
|||
|
const { Cesium: i, viewer: e, viewerContainer: o } = this;
|
|||
|
if (i.defined(e.selectionIndicator) && !e.selectionIndicator.isDestroyed() && !t) {
|
|||
|
e.selectionIndicator.destroy(), e._selectionIndicator = void 0;
|
|||
|
let r = p(o.children, "cesium-viewer-selectionIndicatorContainer");
|
|||
|
o.removeChild(r);
|
|||
|
} else if (!i.defined(e.selectionIndicator) || e.selectionIndicator.isDestroyed()) {
|
|||
|
let r = document.createElement("div");
|
|||
|
r.className = "cesium-viewer-selectionIndicatorContainer", o.appendChild(r);
|
|||
|
let n = new i.SelectionIndicator(r, e.scene);
|
|||
|
e._selectionIndicator = n;
|
|||
|
}
|
|||
|
},
|
|||
|
infoBox(t) {
|
|||
|
const { Cesium: i, viewer: e, viewerContainer: o, resizeControl: r } = this;
|
|||
|
if (i.defined(e.infoBox) && !e.infoBox.isDestroyed() && !t) {
|
|||
|
e.infoBox.destroy(), e._infoBox = void 0;
|
|||
|
let n = p(o.children, "cesium-viewer-infoBoxContainer");
|
|||
|
o.removeChild(n);
|
|||
|
} else if (!i.defined(e.infoBox) || e.infoBox.isDestroyed()) {
|
|||
|
let n = document.createElement("div");
|
|||
|
n.className = "cesium-viewer-infoBoxContainer", o.appendChild(n);
|
|||
|
let a = new i.InfoBox(n), l = a.viewModel;
|
|||
|
e._eventHelper.add(l.cameraClicked, e._onInfoBoxCameraClicked, e), e._eventHelper.add(l.closeClicked, e._onInfoBoxClockClicked, e), e._infoBox = a, r();
|
|||
|
}
|
|||
|
},
|
|||
|
geocoder(t) {
|
|||
|
const { Cesium: i, viewer: e, resizeToolbar: o } = this;
|
|||
|
let r = p(e.container.firstChild.children, "cesium-viewer-toolbar");
|
|||
|
if (i.defined(e.geocoder) && !e.geocoder.isDestroyed() && !t) {
|
|||
|
e.geocoder.destroy(), e._geocoder = void 0;
|
|||
|
let n = p(r.children, "cesium-viewer-geocoderContainer");
|
|||
|
r.removeChild(n);
|
|||
|
} else if (!i.defined(e.geocoder) || e.geocoder.isDestroyed()) {
|
|||
|
let n = document.createElement("div");
|
|||
|
n.className = "cesium-viewer-geocoderContainer", r.appendChild(n);
|
|||
|
let a = new i.Geocoder({
|
|||
|
container: n,
|
|||
|
geocoderServices: i.defined(this.geocoder) ? i.isArray(this.geocoder) ? this.geocoder : [this.geocoder] : void 0,
|
|||
|
scene: e.scene,
|
|||
|
viewer: e
|
|||
|
});
|
|||
|
e._eventHelper.add(a.viewModel.search.beforeExecute, e._clearObjects, e), e._geocoder = a, o(r, n);
|
|||
|
}
|
|||
|
},
|
|||
|
homeButton(t) {
|
|||
|
const { Cesium: i, viewer: e, resizeToolbar: o } = this;
|
|||
|
let r = p(e.container.firstChild.children, "cesium-viewer-toolbar");
|
|||
|
if (i.defined(e.homeButton) && !e.homeButton.isDestroyed() && !t)
|
|||
|
e.homeButton.destroy(), e._homeButton = void 0;
|
|||
|
else if (!i.defined(e.homeButton) || e.homeButton.isDestroyed()) {
|
|||
|
let n = new i.HomeButton(r, e.scene);
|
|||
|
i.defined(e.geocoder) && e._eventHelper.add(n.viewModel.command.afterExecute, function() {
|
|||
|
var a = e.geocoder.viewModel;
|
|||
|
a.searchText = "", a.isSearchInProgress && a.search();
|
|||
|
}), e._eventHelper.add(n.viewModel.command.beforeExecute, e._clearTrackedObject, e), e._homeButton = n, o(r, n);
|
|||
|
}
|
|||
|
},
|
|||
|
sceneModePicker(t) {
|
|||
|
const { Cesium: i, viewer: e, resizeToolbar: o } = this;
|
|||
|
let r = p(e.container.firstChild.children, "cesium-viewer-toolbar");
|
|||
|
if (i.defined(e.sceneModePicker) && !e.sceneModePicker.isDestroyed() && !t)
|
|||
|
e.sceneModePicker.destroy(), e._sceneModePicker = void 0;
|
|||
|
else if (!i.defined(e.sceneModePicker) || e.sceneModePicker.isDestroyed()) {
|
|||
|
if (this.sceneModePicker === !0 && this.scene3DOnly)
|
|||
|
throw new i.DeveloperError("options.sceneModePicker is not available when options.scene3DOnly is set to true.");
|
|||
|
if (!this.scene3DOnly && this.sceneModePicker === !0) {
|
|||
|
let n = new i.SceneModePicker(r, e.scene);
|
|||
|
e._sceneModePicker = n, o(r, n);
|
|||
|
}
|
|||
|
}
|
|||
|
},
|
|||
|
projectionPicker(t) {
|
|||
|
const { Cesium: i, viewer: e, resizeToolbar: o } = this;
|
|||
|
let r = p(e.container.firstChild.children, "cesium-viewer-toolbar");
|
|||
|
if (i.defined(e.projectionPicker) && !e.projectionPicker.isDestroyed() && !t)
|
|||
|
e.projectionPicker.destroy(), e._projectionPicker = void 0;
|
|||
|
else if (!i.defined(e.projectionPicker) || e.projectionPicker.isDestroyed()) {
|
|||
|
let n = new i.ProjectionPicker(r, e.scene);
|
|||
|
e._projectionPicker = n, o(r, n);
|
|||
|
}
|
|||
|
},
|
|||
|
baseLayerPicker(t) {
|
|||
|
const { Cesium: i, viewer: e, resizeToolbar: o } = this;
|
|||
|
let r = p(e.container.firstChild.children, "cesium-viewer-toolbar");
|
|||
|
if (i.defined(e.baseLayerPicker) && !e.baseLayerPicker.isDestroyed() && !t) {
|
|||
|
e.baseLayerPicker.destroy(), e._baseLayerPicker = void 0, e.imageryLayers.removeAll();
|
|||
|
let a = this.cesiumPath || this.$Cesium().cesiumPath;
|
|||
|
a.charAt(a.length - 1) !== "/" && (a = a + "/"), e.imageryLayers.add(
|
|||
|
new i.ImageryLayer(
|
|||
|
new i.SingleTileImageryProvider({
|
|||
|
url: `${a}Assets/Textures/GlobalBkLayer.jpg`
|
|||
|
})
|
|||
|
)
|
|||
|
);
|
|||
|
} else if (!i.defined(e.baseLayerPicker) || e.baseLayerPicker.isDestroyed()) {
|
|||
|
let a = (!i.defined(e.globe) || this.globe !== !1) && (!i.defined(e.baseLayerPicker) || this.baseLayerPicker !== !1);
|
|||
|
if (a && i.defined(this.imageryProvider))
|
|||
|
throw new i.DeveloperError(`options.imageryProvider is not available when using the BaseLayerPicker widget.
|
|||
|
Either specify options.selectedImageryProviderViewModel instead or set options.baseLayerPicker to false.`);
|
|||
|
if (!a && i.defined(this.selectedImageryProviderViewModel))
|
|||
|
throw new i.DeveloperError(`options.selectedImageryProviderViewModel is not available when not using the BaseLayerPicker widget.
|
|||
|
Either specify options.imageryProvider instead or set options.baseLayerPicker to true.`);
|
|||
|
if (a && i.defined(this.terrainProvider))
|
|||
|
throw new i.DeveloperError(`options.terrainProvider is not available when using the BaseLayerPicker widget.
|
|||
|
Either specify options.selectedTerrainProviderViewModel instead or set options.baseLayerPicker to false.`);
|
|||
|
if (!a && i.defined(this.selectedTerrainProviderViewModel))
|
|||
|
throw new i.DeveloperError(`options.selectedTerrainProviderViewModel is not available when not using the BaseLayerPicker widget.
|
|||
|
Either specify options.terrainProvider instead or set options.baseLayerPicker to true.`);
|
|||
|
if (a) {
|
|||
|
e.imageryLayers.removeAll();
|
|||
|
let l = this.cesiumPath || this.$Cesium().cesiumPath;
|
|||
|
l.charAt(l.length - 1) !== "/" && (l = l + "/");
|
|||
|
let s = i.defaultValue(this.imageryProviderViewModels, x(i, l)), d = i.defaultValue(this.terrainProviderViewModels, S(i, l)), h = new i.BaseLayerPicker(r, {
|
|||
|
globe: e.scene.globe,
|
|||
|
imageryProviderViewModels: s,
|
|||
|
selectedImageryProviderViewModel: s[0],
|
|||
|
terrainProviderViewModels: d,
|
|||
|
selectedTerrainProviderViewModel: d[0]
|
|||
|
});
|
|||
|
var n = r.getElementsByClassName("cesium-baseLayerPicker-dropDown");
|
|||
|
let m = n[0];
|
|||
|
e._baseLayerPickerDropDown = m, e._baseLayerPicker = h, o(r, h);
|
|||
|
}
|
|||
|
}
|
|||
|
},
|
|||
|
navigationHelpButton(t) {
|
|||
|
const { Cesium: i, viewer: e, resizeToolbar: o } = this;
|
|||
|
let r = p(e.container.firstChild.children, "cesium-viewer-toolbar");
|
|||
|
if (i.defined(e.navigationHelpButton) && !e.navigationHelpButton.isDestroyed() && !t)
|
|||
|
e.navigationHelpButton.destroy(), e._navigationHelpButton = void 0;
|
|||
|
else if (!i.defined(e.navigationHelpButton) || e.navigationHelpButton.isDestroyed()) {
|
|||
|
let a = !0;
|
|||
|
try {
|
|||
|
if (i.defined(window.localStorage)) {
|
|||
|
var n = window.localStorage.getItem("cesium-hasSeenNavHelp");
|
|||
|
i.defined(n) && n ? a = !1 : window.localStorage.setItem("cesium-hasSeenNavHelp", "true");
|
|||
|
}
|
|||
|
} catch {
|
|||
|
}
|
|||
|
let l = new i.NavigationHelpButton({
|
|||
|
container: r,
|
|||
|
instructionsInitiallyVisible: i.defaultValue(this.navigationInstructionsInitiallyVisible, a)
|
|||
|
});
|
|||
|
e._navigationHelpButton = l, o(r, l);
|
|||
|
}
|
|||
|
},
|
|||
|
animation(t) {
|
|||
|
const { Cesium: i, viewer: e, viewerContainer: o, resizeControl: r } = this;
|
|||
|
if (i.defined(e.animation) && !e.animation.isDestroyed() && !t) {
|
|||
|
e.animation.destroy();
|
|||
|
let l = p(o.children, "cesium-viewer-animationContainer");
|
|||
|
o.removeChild(l), e._animation = void 0, r();
|
|||
|
} else if (!i.defined(e.animation) || e.animation.isDestroyed()) {
|
|||
|
let l = document.createElement("div");
|
|||
|
l.className = "cesium-viewer-animationContainer", this.viewerContainer.appendChild(l);
|
|||
|
let s = new i.Animation(l, new i.AnimationViewModel(e.clockViewModel));
|
|||
|
var n = /* @__PURE__ */ new Date(), a = 0 - n.getTimezoneOffset();
|
|||
|
s.viewModel.timeFormatter = function(d, h) {
|
|||
|
var m = i.JulianDate.addMinutes(d, a, new i.JulianDate()), c = i.JulianDate.toGregorianDate(m), u = Math.round(c.millisecond);
|
|||
|
return Math.abs(h._clockViewModel.multiplier) < 1 ? i.sprintf("%02d:%02d:%02d.%03d", c.hour, c.minute, c.second, u) : i.sprintf("%02d:%02d:%02d GMT+8", c.hour, c.minute, c.second);
|
|||
|
}, e._animation = s, r();
|
|||
|
}
|
|||
|
},
|
|||
|
timeline(t) {
|
|||
|
const { Cesium: i, viewer: e, viewerContainer: o, onTimelineScrubfunction: r, resizeControl: n } = this;
|
|||
|
if (i.defined(e.timeline) && !e.timeline.isDestroyed() && !t) {
|
|||
|
e.timeline.destroy(), e._timeline = void 0;
|
|||
|
let a = p(o.children, "cesium-viewer-timelineContainer");
|
|||
|
o.removeChild(a), n();
|
|||
|
} else if (!i.defined(e.timeline) || e.timeline.isDestroyed()) {
|
|||
|
let a = document.createElement("div");
|
|||
|
a.className = "cesium-viewer-timelineContainer", o.appendChild(a);
|
|||
|
let l = new i.Timeline(a, e.clock);
|
|||
|
l.addEventListener("settime", r, !1), l.zoomTo(e.clock.startTime, e.clock.stopTime), e._timeline = l, n();
|
|||
|
}
|
|||
|
},
|
|||
|
fullscreenButton(t) {
|
|||
|
const { Cesium: i, viewer: e, viewerContainer: o, resizeControl: r } = this;
|
|||
|
if (i.defined(e.fullscreenButton) && !e.fullscreenButton.isDestroyed() && !t) {
|
|||
|
e.fullscreenButton.destroy(), e._fullscreenButton = void 0;
|
|||
|
let n = p(o.children, "cesium-viewer-fullscreenContainer");
|
|||
|
o.removeChild(n), r();
|
|||
|
} else if (!i.defined(e.fullscreenButton) || e.fullscreenButton.isDestroyed()) {
|
|||
|
let n = document.createElement("div");
|
|||
|
n.className = "cesium-viewer-fullscreenContainer", o.appendChild(n);
|
|||
|
let a = new i.FullscreenButton(n, document.body);
|
|||
|
e._fullscreenButton = a, r();
|
|||
|
}
|
|||
|
},
|
|||
|
"viewer.fullscreenButton.viewModel.isFullscreenEnabled"(t) {
|
|||
|
const { Cesium: i, viewer: e } = this;
|
|||
|
if (e.fullscreenButton) {
|
|||
|
e.fullscreenButton.container.style.display = t ? "block" : "none";
|
|||
|
let o = 0;
|
|||
|
i.defined(e.vrButton) && (e.vrButton.container.style.right = e.fullscreenButton.container.clientWidth + "px", o += e.fullscreenButton.container.clientWidth), i.defined(e.timeline) && (e.timeline.container.style.right = o + e.fullscreenButton.container.clientWidth + "px", e.timeline.resize());
|
|||
|
} else
|
|||
|
i.defined(e.vrButton) && (e.vrButton.container.style.right = "0px");
|
|||
|
},
|
|||
|
vrButton(t) {
|
|||
|
const { Cesium: i, viewer: e, viewerContainer: o, resizeControl: r, enableVRUI: n } = this;
|
|||
|
if (i.defined(e.vrButton) && !e.vrButton.isDestroyed() && !t) {
|
|||
|
e.vrButton.destroy(), e._vrButton = void 0;
|
|||
|
let a = p(o.children, "cesium-viewer-vrContainer");
|
|||
|
o.removeChild(a), r();
|
|||
|
} else if (!i.defined(e.vrButton) || e.vrButton.isDestroyed()) {
|
|||
|
let a = document.createElement("div");
|
|||
|
a.className = "cesium-viewer-vrContainer", o.appendChild(a);
|
|||
|
let l = new i.VRButton(a, e.scene, document.body), s = l.viewModel._command;
|
|||
|
l.viewModel._command = function(d) {
|
|||
|
s(), n(e, d.isVRMode);
|
|||
|
}, e._vrButton = l, r();
|
|||
|
}
|
|||
|
},
|
|||
|
"viewer.vrButton.viewModel.isVREnabled"(t) {
|
|||
|
const { Cesium: i, viewer: e } = this;
|
|||
|
if (e.vrButton) {
|
|||
|
e.vrButton.container.style.display = t ? "block" : "none";
|
|||
|
let o = 0;
|
|||
|
i.defined(e.fullscreenButton) && (e.vrButton.container.style.right = e.fullscreenButton.container.clientWidth + "px", o += e.fullscreenButton.container.clientWidth), i.defined(e.timeline) && (e.timeline.container.style.right = o + e.vrButton.container.clientWidth + "px", e.timeline.resize());
|
|||
|
}
|
|||
|
},
|
|||
|
navigation(t) {
|
|||
|
const { Cesium: i, viewer: e, viewerContainer: o, resizeControl: r } = this;
|
|||
|
if (i.defined(e.navigation) && !t) {
|
|||
|
e.navigation.viewModel.eventHelper.removeAll(), i.destroyObject(e.navigation.viewModel), e._navigation = void 0;
|
|||
|
let n = p(o.children, "cesium-viewer-navigationContainer");
|
|||
|
o.removeChild(n);
|
|||
|
} else if (!i.defined(e.navigation)) {
|
|||
|
let n = document.createElement("div");
|
|||
|
n.className = "cesium-viewer-navigationContainer", o.appendChild(n);
|
|||
|
let a = new i.Navigation({ container: n, viewer: e, scene: e.scene });
|
|||
|
e._navigation = a, r();
|
|||
|
}
|
|||
|
},
|
|||
|
sceneMode(t) {
|
|||
|
const { Cesium: i, viewer: e } = this;
|
|||
|
(i.SceneMode.COLUMBUS_VIEW === t || i.SceneMode.MORPHING === t || i.SceneMode.SCENE2D === t || i.SceneMode.SCENE3D === t) && (e.scene.mode = t);
|
|||
|
},
|
|||
|
shouldAnimate(t) {
|
|||
|
const { viewer: i } = this;
|
|||
|
i.clock.shouldAnimate = t;
|
|||
|
},
|
|||
|
terrainExaggeration(t) {
|
|||
|
const { viewer: i } = this;
|
|||
|
i.scene._terrainExaggeration = t;
|
|||
|
},
|
|||
|
shadows(t) {
|
|||
|
const { viewer: i } = this;
|
|||
|
i.scene.shadowMap.enabled = t;
|
|||
|
},
|
|||
|
camera: {
|
|||
|
handler(t) {
|
|||
|
const { Cesium: i, viewer: e } = this;
|
|||
|
e.camera.setView({
|
|||
|
destination: i.Cartesian3.fromDegrees(t.position.longitude, t.position.latitude, t.position.height),
|
|||
|
orientation: {
|
|||
|
heading: i.Math.toRadians(t.heading),
|
|||
|
pitch: i.Math.toRadians(t.pitch),
|
|||
|
roll: i.Math.toRadians(t.roll)
|
|||
|
}
|
|||
|
});
|
|||
|
},
|
|||
|
deep: !0
|
|||
|
},
|
|||
|
"viewer.imageryLayers"(t) {
|
|||
|
}
|
|||
|
},
|
|||
|
methods: {
|
|||
|
onTimelineScrubfunction(t) {
|
|||
|
let i = t.clock;
|
|||
|
i.currentTime = t.timeJulian, i.shouldAnimate = !1;
|
|||
|
},
|
|||
|
resizeToolbar(t, i) {
|
|||
|
Array.prototype.slice.call(t.children).forEach((r) => {
|
|||
|
switch (r.className) {
|
|||
|
case "cesium-viewer-geocoderContainer":
|
|||
|
r.customIndex = 1;
|
|||
|
break;
|
|||
|
case "cesium-button cesium-toolbar-button cesium-home-button":
|
|||
|
r.customIndex = 2;
|
|||
|
break;
|
|||
|
case "cesium-sceneModePicker-wrapper cesium-toolbar-button":
|
|||
|
r.customIndex = 3;
|
|||
|
break;
|
|||
|
case "cesium-projectionPicker-wrapper cesium-toolbar-button":
|
|||
|
r.customIndex = 4;
|
|||
|
break;
|
|||
|
case "cesium-button cesium-toolbar-button":
|
|||
|
case "cesium-baseLayerPicker-dropDown":
|
|||
|
r.customIndex = 5;
|
|||
|
break;
|
|||
|
case "cesium-navigationHelpButton-wrapper":
|
|||
|
r.customIndex = 6;
|
|||
|
break;
|
|||
|
}
|
|||
|
});
|
|||
|
let e = [];
|
|||
|
Array.prototype.slice.call(t.children).forEach((r) => {
|
|||
|
e.push(r);
|
|||
|
}), e.sort(function(r, n) {
|
|||
|
return r.customIndex - n.customIndex;
|
|||
|
});
|
|||
|
for (var o = 0; o < e.length; o++)
|
|||
|
t.appendChild(e[o]);
|
|||
|
},
|
|||
|
resizeControl() {
|
|||
|
const { Cesium: t, viewer: i, viewerContainer: e } = this;
|
|||
|
let o = t.defined(i._animation), r = t.defined(i._timeline), n = i._timeline, a = e.clientWidth;
|
|||
|
var l = e.clientHeight;
|
|||
|
let s, d = 0, h = 0, m = 0;
|
|||
|
if (o && window.getComputedStyle(i._animation.container).visibility !== "hidden") {
|
|||
|
var c = this._lastWidth;
|
|||
|
s = i._animation.container, a > 900 ? (d = 169, c <= 900 && (s.style.width = "169px", s.style.height = "112px", i._animation.resize())) : a >= 600 ? (d = 136, (c < 600 || c > 900) && (s.style.width = "136px", s.style.height = "90px", i._animation.resize())) : (d = 106, (c > 600 || c === 0) && (s.style.width = "106px", s.style.height = "70px", i._animation.resize())), h = d + 5;
|
|||
|
}
|
|||
|
if (r && window.getComputedStyle(i._timeline.container).visibility !== "hidden") {
|
|||
|
let f = i._fullscreenButton, y = i._vrButton, w = n.container, g = w.style;
|
|||
|
m = w.clientHeight + 3, g.left = d + "px";
|
|||
|
var u = 0;
|
|||
|
t.defined(i.fullscreenButton) && (u += f.container.clientWidth), t.defined(y) && (u += y.container.clientWidth), g.right = u + "px", n.resize();
|
|||
|
}
|
|||
|
if (t.defined(i.navigation)) {
|
|||
|
let f = p(i.container.firstChild.children, "cesium-viewer-toolbar"), y = p(e.children, "cesium-viewer-navigationContainer");
|
|||
|
y.style.top = f.clientHeight + "px", t.defined(i.infoBox) && (i.infoBox.container.firstChild.style.right = y.clientWidth + "px");
|
|||
|
}
|
|||
|
i._bottomContainer.style.left = h + "px", i._bottomContainer.style.bottom = m + "px", this._lastWidth = a, this._lastHeight = l;
|
|||
|
},
|
|||
|
enableVRUI(t, i) {
|
|||
|
const { Cesium: e } = this;
|
|||
|
let o = t._geocoder, r = t._homeButton, n = t._sceneModePicker, a = t._projectionPicker, l = t._baseLayerPicker, s = t._animation, d = t._timeline, h = t._fullscreenButton, m = t._infoBox, c = t._selectionIndicator, u = i ? "hidden" : "visible";
|
|||
|
if (e.defined(o) && (o.container.style.visibility = u), e.defined(r) && (r.container.style.visibility = u), e.defined(n) && (n.container.style.visibility = u), e.defined(a) && (a.container.style.visibility = u), e.defined(l) && (l.container.style.visibility = u), e.defined(s) && (s.container.style.visibility = u), e.defined(d) && (d.container.style.visibility = u), e.defined(h) && h.viewModel.isFullscreenEnabled && (h.container.style.visibility = u), e.defined(m) && (m.container.style.visibility = u), e.defined(c) && (c.container.style.visibility = u), t._container) {
|
|||
|
var f = i || !e.defined(h) ? 0 : h.container.clientWidth;
|
|||
|
t._vrButton.container.style.right = f + "px", t.forceResize();
|
|||
|
}
|
|||
|
},
|
|||
|
init(t) {
|
|||
|
if (this.viewer)
|
|||
|
return;
|
|||
|
let i = this.$refs.viewer;
|
|||
|
const e = new t.Viewer(i, {
|
|||
|
animation: this.animation,
|
|||
|
baseLayerPicker: this.baseLayerPicker,
|
|||
|
fullscreenButton: this.fullscreenButton,
|
|||
|
vrButton: this.vrButton,
|
|||
|
geocoder: this.geocoder,
|
|||
|
homeButton: this.homeButton,
|
|||
|
infoBox: this.infoBox,
|
|||
|
sceneModePicker: this.sceneModePicker,
|
|||
|
selectionIndicator: this.selectionIndicator,
|
|||
|
timeline: this.timeline,
|
|||
|
navigationHelpButton: this.navigationHelpButton,
|
|||
|
navigationInstructionsInitiallyVisible: this.navigationInstructionsInitiallyVisible,
|
|||
|
scene3DOnly: this.scene3DOnly,
|
|||
|
shouldAnimate: this.shouldAnimate,
|
|||
|
clockViewModel: this.clockViewModel,
|
|||
|
selectedImageryProviderViewModel: this.selectedImageryProviderViewModel,
|
|||
|
imageryProviderViewModels: this.imageryProviderViewModels,
|
|||
|
selectedTerrainProviderViewModel: this.selectedTerrainProviderViewModel,
|
|||
|
terrainProviderViewModels: this.terrainProviderViewModels,
|
|||
|
imageryProvider: this.imageryProvider,
|
|||
|
terrainProvider: this.terrainProvider,
|
|||
|
skyBox: this.skyBox,
|
|||
|
skyAtmosphere: this.skyAtmosphere,
|
|||
|
fullscreenElement: this.fullscreenElement,
|
|||
|
useDefaultRenderLoop: this.useDefaultRenderLoop,
|
|||
|
targetFrameRate: this.targetFrameRate,
|
|||
|
showRenderLoopErrors: this.showRenderLoopErrors,
|
|||
|
automaticallyTrackDataSourceClocks: this.automaticallyTrackDataSourceClocks,
|
|||
|
contextOptions: this.contextOptions,
|
|||
|
sceneMode: this.sceneMode,
|
|||
|
mapProjection: this.mapProjection,
|
|||
|
globe: this.globe,
|
|||
|
orderIndependentTranslucency: this.orderIndependentTranslucency,
|
|||
|
creditContainer: this.creditContainer,
|
|||
|
creditViewport: this.creditViewport,
|
|||
|
dataSources: this.dataSources,
|
|||
|
terrainExaggeration: this.terrainExaggeration,
|
|||
|
shadows: this.shadows,
|
|||
|
terrainShadows: this.terrainShadows,
|
|||
|
mapMode2D: this.mapMode2D,
|
|||
|
projectionPicker: this.projectionPicker,
|
|||
|
requestRenderMode: this.requestRenderMode,
|
|||
|
maximumRenderTimeChange: this.maximumRenderTimeChange,
|
|||
|
navigation: this.navigation
|
|||
|
});
|
|||
|
if (this.viewer = e, t.defined(this.camera) && e.camera.setView({
|
|||
|
destination: t.Cartesian3.fromDegrees(this.camera.position.longitude, this.camera.position.latitude, this.camera.position.height),
|
|||
|
orientation: {
|
|||
|
heading: t.Math.toRadians(this.camera.heading),
|
|||
|
pitch: t.Math.toRadians(this.camera.pitch),
|
|||
|
roll: t.Math.toRadians(this.camera.roll)
|
|||
|
}
|
|||
|
}), t.defined(e.animation)) {
|
|||
|
var o = /* @__PURE__ */ new Date(), r = 0 - o.getTimezoneOffset();
|
|||
|
e.animation.viewModel.timeFormatter = function(n, a) {
|
|||
|
var l = t.JulianDate.addMinutes(n, r, new t.JulianDate()), s = t.JulianDate.toGregorianDate(l), d = Math.round(s.millisecond);
|
|||
|
return Math.abs(a._clockViewModel.multiplier) < 1 ? t.sprintf("%02d:%02d:%02d.%03d", s.hour, s.minute, s.second, d) : t.sprintf("%02d:%02d:%02d GMT+8", s.hour, s.minute, s.second);
|
|||
|
};
|
|||
|
}
|
|||
|
this.$emit("ready", { Cesium: t, viewer: e }), this.viewerContainer = this.$refs.viewer.firstChild, this.resizeControl(), window.someObject = this.someObject;
|
|||
|
},
|
|||
|
initViewer(t) {
|
|||
|
this.Cesium = t, this.init(t);
|
|||
|
},
|
|||
|
getCesiumScript() {
|
|||
|
if (window.Cesium)
|
|||
|
return window.Cesium._preloader ? window.Cesium._preloader : Promise.resolve(window.Cesium);
|
|||
|
{
|
|||
|
let t = this.cesiumPath || this.$Cesium().cesiumPath;
|
|||
|
return t.charAt(t.length - 1) !== "/" && (t = t + "/"), window.Cesium = {}, window.Cesium._preloader = new Promise((i, e) => {
|
|||
|
window._initCesium = function() {
|
|||
|
i(window.Cesium), window.Cesium._preloader = null, window._initCesium = null;
|
|||
|
};
|
|||
|
const o = document.createElement("link");
|
|||
|
o.rel = "stylesheet", window.document.head.appendChild(o), o.href = `${t}Widgets/widgets.css`;
|
|||
|
const r = document.createElement("script");
|
|||
|
window.document.body.appendChild(r), r.src = `${t}Cesium.js`, r.onload = function() {
|
|||
|
window._initCesium();
|
|||
|
};
|
|||
|
const n = document.createElement("script");
|
|||
|
window.document.body.appendChild(n), n.src = `${t}Workers/zlib.min.js`;
|
|||
|
}), window.Cesium._preloader;
|
|||
|
}
|
|||
|
},
|
|||
|
reset() {
|
|||
|
const { getCesiumScript: t, initViewer: i } = this;
|
|||
|
t().then(i);
|
|||
|
}
|
|||
|
},
|
|||
|
mounted() {
|
|||
|
this.reset();
|
|||
|
},
|
|||
|
beforeDestroy() {
|
|||
|
},
|
|||
|
data() {
|
|||
|
return {
|
|||
|
viewer: null,
|
|||
|
viewerContainer: null
|
|||
|
};
|
|||
|
}
|
|||
|
};
|
|||
|
var D = function() {
|
|||
|
var i = this, e = i._self._c;
|
|||
|
return e("div", { ref: "viewer", staticStyle: { width: "100%", height: "100%", margin: "0", padding: "0", overflow: "hidden" }, attrs: { id: i.container } }, [i._t("default")], 2);
|
|||
|
}, T = [], V = /* @__PURE__ */ v(
|
|||
|
k,
|
|||
|
D,
|
|||
|
T,
|
|||
|
!1,
|
|||
|
null,
|
|||
|
null,
|
|||
|
null,
|
|||
|
null
|
|||
|
);
|
|||
|
const _ = V.exports, E = {
|
|||
|
props: {
|
|||
|
customInfobox: {
|
|||
|
type: Boolean,
|
|||
|
default: !0
|
|||
|
}
|
|||
|
},
|
|||
|
watch: {
|
|||
|
customInfobox: function(t) {
|
|||
|
this.viewer && t && (viewer.customInfobox = this.$refs.infoBox);
|
|||
|
},
|
|||
|
viewer: function(t) {
|
|||
|
t && (t.customInfobox = this.$refs.infoBox);
|
|||
|
}
|
|||
|
}
|
|||
|
}, A = {
|
|||
|
props: {
|
|||
|
cursor: {
|
|||
|
type: String
|
|||
|
}
|
|||
|
},
|
|||
|
watch: {
|
|||
|
viewer: function(t) {
|
|||
|
if (!t)
|
|||
|
return;
|
|||
|
const { canvas: i } = t;
|
|||
|
i.style.cursor = this.cursor;
|
|||
|
},
|
|||
|
cursor: function(t) {
|
|||
|
if (!this.viewer)
|
|||
|
return;
|
|||
|
const { canvas: i } = this.viewer;
|
|||
|
i.style.cursor = t;
|
|||
|
}
|
|||
|
}
|
|||
|
};
|
|||
|
const L = {
|
|||
|
components: { SmBim: _ },
|
|||
|
mixins: [C, I, P, B, M, E, A],
|
|||
|
props: {
|
|||
|
cesiumPath: { type: String, default: "/Cesium" },
|
|||
|
width: { type: String, default: "100%" },
|
|||
|
height: { type: String, default: "100%" }
|
|||
|
},
|
|||
|
data() {
|
|||
|
return {
|
|||
|
viewer: void 0
|
|||
|
};
|
|||
|
},
|
|||
|
provide() {
|
|||
|
return {
|
|||
|
viewer: () => this.viewer
|
|||
|
};
|
|||
|
},
|
|||
|
methods: {
|
|||
|
ready({ viewer: t }) {
|
|||
|
this.viewer = t;
|
|||
|
}
|
|||
|
}
|
|||
|
};
|
|||
|
var $ = function() {
|
|||
|
var i = this, e = i._self._c;
|
|||
|
return e("div", { staticClass: "cc-bim" }, [e("SmBim", i._g(i._b({ attrs: { cesiumPath: i.cesiumPath }, on: { ready: i.ready } }, "SmBim", i.$attrs, !1), i.$listeners), [e("div", { ref: "infoBox", style: { position: "absolute", zIndex: 999 } }, [i.viewer ? i._t("infoBox") : i._e()], 2)]), i.viewer ? i._t("default") : i._e()], 2);
|
|||
|
}, W = [], O = /* @__PURE__ */ v(
|
|||
|
L,
|
|||
|
$,
|
|||
|
W,
|
|||
|
!1,
|
|||
|
null,
|
|||
|
null,
|
|||
|
null,
|
|||
|
null
|
|||
|
);
|
|||
|
const R = O.exports;
|
|||
|
class N {
|
|||
|
constructor(i) {
|
|||
|
this._viewer = i.viewer, this.element = i.element, this.position = i.position, this.pixelOffset = i.pixelOffset || new Cesium.Cartesian2(0, 0), this._show = i.show || !1, this.hideOnBehindGlobe = i.hideOnBehindGlobe || !1, this.scaleByDistance = i.scaleByDistance, this.translucencyByDistance = i.translucencyByDistance, this.distanceDisplayCondition = i.distanceDisplayCondition, this.scratch = new Cesium.Cartesian2(), this.RemoveCallback = function() {
|
|||
|
}, this.init(i);
|
|||
|
}
|
|||
|
init(i) {
|
|||
|
if (typeof i.element == "string" && (this.element = document.getElementById(i.element)), this.close(), !this._viewer) {
|
|||
|
console.log("PopupWindow :viewer is required!");
|
|||
|
return;
|
|||
|
}
|
|||
|
this.element.style.transformOrigin = "left bottom 0px", this._viewer.container.appendChild(this.element), this.setViewer(), this.position && setTimeout(() => {
|
|||
|
this.setPosition(i.position);
|
|||
|
}, 500);
|
|||
|
}
|
|||
|
/**
|
|||
|
* 设置关联的cesium viewer
|
|||
|
* @param viewer
|
|||
|
*/
|
|||
|
setViewer() {
|
|||
|
let i = this;
|
|||
|
i.RemoveCallback = i._viewer.camera.changed.addEventListener(function() {
|
|||
|
i._show && i.update();
|
|||
|
});
|
|||
|
}
|
|||
|
/**
|
|||
|
* 获取关联的cesium viewer
|
|||
|
* @return {Cesium.Viewer}
|
|||
|
*/
|
|||
|
getViewer() {
|
|||
|
return this._viewer;
|
|||
|
}
|
|||
|
/**
|
|||
|
* 设置位置
|
|||
|
* @param position{Array}
|
|||
|
*/
|
|||
|
setPosition(i) {
|
|||
|
let e = this;
|
|||
|
if (!i) {
|
|||
|
e.close();
|
|||
|
return;
|
|||
|
}
|
|||
|
if (!e.getViewer())
|
|||
|
return;
|
|||
|
let o = e.getViewer().scene.cartesianToCanvasCoordinates(i, e.scratch);
|
|||
|
if (Cesium.defined(o) && (e.element.style.top = o.y + e.pixelOffset.y + "px", e.element.style.left = o.x + e.pixelOffset.x + "px", e.show(), e.hideOnBehindGlobe || e.distanceDisplayCondition || e.translucencyByDistance || e.scaleByDistance)) {
|
|||
|
let r = e.getViewer().camera.position, n = Cesium.Cartesian3.distance(r, i);
|
|||
|
if (e.hideOnBehindGlobe) {
|
|||
|
let a = e.getViewer().scene.globe.ellipsoid.cartesianToCartographic(r).height;
|
|||
|
a += e.getViewer().scene.globe.ellipsoid.maximumRadius, n > a ? e.element.style.display = "none" : e.element.style.display = "flex";
|
|||
|
}
|
|||
|
if (e.distanceDisplayCondition)
|
|||
|
if (n < e.distanceDisplayCondition.near || n > e.distanceDisplayCondition.far) {
|
|||
|
e.element.style.opacity = 0, e.element.style.zIndex = -1;
|
|||
|
return;
|
|||
|
} else
|
|||
|
e.element.style.opacity = 1, e.element.style.zIndex = 999;
|
|||
|
if (e.translucencyByDistance)
|
|||
|
if (n < e.translucencyByDistance.near)
|
|||
|
e.element.style.opacity = e.translucencyByDistance.nearValue;
|
|||
|
else if (n > e.translucencyByDistance.far)
|
|||
|
e.element.style.opacity = e.translucencyByDistance.farValue;
|
|||
|
else {
|
|||
|
let a = e.translucencyByDistance.farValue - e.translucencyByDistance.nearValue, l = e.translucencyByDistance.far - e.translucencyByDistance.near, s = (n - e.translucencyByDistance.near) / l * a + e.translucencyByDistance.nearValue;
|
|||
|
e.element.style.opacity = s;
|
|||
|
}
|
|||
|
if (e.scaleByDistance)
|
|||
|
if (n < e.scaleByDistance.near) {
|
|||
|
let a = e.scaleByDistance.nearValue;
|
|||
|
e.element.style.transform = `scale(${a}, ${a})`;
|
|||
|
} else if (n > e.scaleByDistance.far) {
|
|||
|
let a = e.scaleByDistance.farValue;
|
|||
|
e.element.style.transform = `scale(${a}, ${a})`;
|
|||
|
} else {
|
|||
|
let a = e.scaleByDistance.farValue - e.scaleByDistance.nearValue, l = e.scaleByDistance.far - e.scaleByDistance.near, s = (n - e.scaleByDistance.near) / l * a + e.scaleByDistance.nearValue;
|
|||
|
e.element.style.transform = `scale(${s}, ${s})`;
|
|||
|
}
|
|||
|
}
|
|||
|
e.position = i;
|
|||
|
}
|
|||
|
update() {
|
|||
|
this.setPosition(this.position);
|
|||
|
}
|
|||
|
getPosition() {
|
|||
|
return this.position;
|
|||
|
}
|
|||
|
close() {
|
|||
|
this.element.style.opacity = 0, this.element.style.zIndex = -1, this._show = !1;
|
|||
|
}
|
|||
|
show() {
|
|||
|
this.element.style.zIndex = 999, this.element.style.opacity = 1, this._show = !0;
|
|||
|
}
|
|||
|
destroy() {
|
|||
|
this.RemoveCallback(), this.close(), this._viewer.container.removeChild(this.element);
|
|||
|
}
|
|||
|
}
|
|||
|
const j = {
|
|||
|
props: {
|
|||
|
position: { type: Object, default: () => ({ x: 0, y: 0, z: 0 }) },
|
|||
|
// x y z
|
|||
|
offset: { type: Array, default: () => [0, 0] },
|
|||
|
// 偏移量 x y
|
|||
|
scale: { type: Array, default: () => [1e3, 1, 1e4, 0.2] },
|
|||
|
// 缩放scale 距离比例
|
|||
|
condition: { type: Array, default: () => [0, 11e3] },
|
|||
|
visibility: { type: Boolean }
|
|||
|
// 控制展示影藏
|
|||
|
},
|
|||
|
model: {
|
|||
|
prop: "visibility",
|
|||
|
event: "change"
|
|||
|
},
|
|||
|
inject: {
|
|||
|
viewer: {
|
|||
|
default: () => {
|
|||
|
}
|
|||
|
}
|
|||
|
},
|
|||
|
data() {
|
|||
|
return {
|
|||
|
prompt: void 0
|
|||
|
};
|
|||
|
},
|
|||
|
computed: {
|
|||
|
viewerInject: function() {
|
|||
|
if (this.viewer)
|
|||
|
return this.viewer();
|
|||
|
},
|
|||
|
status: {
|
|||
|
get: function() {
|
|||
|
return this.visibility;
|
|||
|
},
|
|||
|
set: function(t) {
|
|||
|
this.prompt && this.$emit("change", t);
|
|||
|
}
|
|||
|
}
|
|||
|
},
|
|||
|
async mounted() {
|
|||
|
const { _preloader: t } = window.Cesium, i = t ? await t : window.Cesium;
|
|||
|
this.prompt = new N({
|
|||
|
viewer: this.viewerInject,
|
|||
|
element: this.$refs.popup,
|
|||
|
show: this.visibility,
|
|||
|
position: this.position,
|
|||
|
pixelOffset: new i.Cartesian2(...this.offset),
|
|||
|
scaleByDistance: new i.NearFarScalar(...this.scale),
|
|||
|
// 距离缩放
|
|||
|
distanceDisplayCondition: new i.DistanceDisplayCondition(...this.condition)
|
|||
|
// 显示条件 物体得在这个高度上
|
|||
|
});
|
|||
|
},
|
|||
|
watch: {
|
|||
|
status: function(t) {
|
|||
|
t ? this.prompt.show() : this.prompt.close();
|
|||
|
},
|
|||
|
position: function(t) {
|
|||
|
this.prompt && this.prompt.setPosition(t);
|
|||
|
}
|
|||
|
},
|
|||
|
destroyed() {
|
|||
|
this.prompt && this.prompt.destroy();
|
|||
|
}
|
|||
|
};
|
|||
|
var z = function() {
|
|||
|
var i = this, e = i._self._c;
|
|||
|
return e("div", { ref: "popup", staticClass: "cc-popup" }, [this.viewer ? i._t("default") : i._e()], 2);
|
|||
|
}, F = [], H = /* @__PURE__ */ v(
|
|||
|
j,
|
|||
|
z,
|
|||
|
F,
|
|||
|
!1,
|
|||
|
null,
|
|||
|
null,
|
|||
|
null,
|
|||
|
null
|
|||
|
);
|
|||
|
const G = H.exports;
|
|||
|
const U = {
|
|||
|
props: {
|
|||
|
visibility: {
|
|||
|
type: Boolean,
|
|||
|
default: !1
|
|||
|
},
|
|||
|
width: {
|
|||
|
type: Number,
|
|||
|
default: 300
|
|||
|
}
|
|||
|
},
|
|||
|
computed: {
|
|||
|
vi: {
|
|||
|
get() {
|
|||
|
return this.visibility;
|
|||
|
},
|
|||
|
set(t) {
|
|||
|
this.$emit("update:visibility");
|
|||
|
}
|
|||
|
}
|
|||
|
},
|
|||
|
data() {
|
|||
|
return {
|
|||
|
w: 0,
|
|||
|
zIndex: -1
|
|||
|
};
|
|||
|
},
|
|||
|
watch: {
|
|||
|
vi: {
|
|||
|
handler: function(t) {
|
|||
|
t ? (this.w = this.width, this.zIndex = 10) : (this.w = 0, this.zIndex = -1);
|
|||
|
},
|
|||
|
immediate: !0
|
|||
|
}
|
|||
|
}
|
|||
|
};
|
|||
|
var q = function() {
|
|||
|
var i = this, e = i._self._c;
|
|||
|
return e("div", { staticClass: "cc-draw", style: { width: `${i.w}px`, zIndex: `${i.zIndex}` } }, [i._t("default")], 2);
|
|||
|
}, Y = [], J = /* @__PURE__ */ v(
|
|||
|
U,
|
|||
|
q,
|
|||
|
Y,
|
|||
|
!1,
|
|||
|
null,
|
|||
|
null,
|
|||
|
null,
|
|||
|
null
|
|||
|
);
|
|||
|
const X = J.exports, K = (t, i) => {
|
|||
|
const { cesiumPath: e } = i;
|
|||
|
t.prototype.$Cesium = () => ({ cesiumPath: e }), t.component("SmBim", _), t.component("Bim", R), t.component("Popup", G), t.component("DrawWindow", X);
|
|||
|
};
|
|||
|
export {
|
|||
|
R as Bim,
|
|||
|
X as DrawWindow,
|
|||
|
G as Popup,
|
|||
|
_ as SmBim,
|
|||
|
K as install
|
|||
|
};
|