|
@@ -101,7 +101,14 @@ export default {
|
|
|
)
|
|
|
window.viewer = viewer
|
|
|
// 加载模型
|
|
|
- app.loadingEntities(app.type);
|
|
|
+ let type = app.type;
|
|
|
+ if (app.item) {
|
|
|
+ let url = app.item.split('?');
|
|
|
+ if (url[0].indexOf('.gltf')===(url[0].length-5)) {
|
|
|
+ type = 3;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ app.loadingEntities(type);
|
|
|
},
|
|
|
loadingEntities(type) {
|
|
|
let app = this;
|
|
@@ -175,33 +182,58 @@ export default {
|
|
|
addGltf(url) {
|
|
|
let app= this;
|
|
|
let height = 1;
|
|
|
- if (this.extraParams.elevation && this.extraParams.elevation!=='') {
|
|
|
+ let lon = 120.90685004033816;
|
|
|
+ let lat = 27.918254593203912;
|
|
|
+ let heading = 0;
|
|
|
+ let pitch = 0;
|
|
|
+ let roll = 0;
|
|
|
+ let title = 'gltf';
|
|
|
+ if (this.extraParams && this.extraParams.elevation && this.extraParams.elevation!=='') {
|
|
|
height = Number(this.extraParams.elevation)
|
|
|
}
|
|
|
+ if (this.extraParams && this.extraParams.lon && this.extraParams.lon!=='') {
|
|
|
+ lon = Number(this.extraParams.lon)
|
|
|
+ }
|
|
|
+ if (this.extraParams && this.extraParams.lat && this.extraParams.lat!=='') {
|
|
|
+ lat = Number(this.extraParams.lat)
|
|
|
+ }
|
|
|
+ if (this.extraParams && this.extraParams.heading && this.extraParams.heading!=='') {
|
|
|
+ heading = Number(this.extraParams.heading)
|
|
|
+ }
|
|
|
+ if (this.extraParams && this.extraParams.pitch && this.extraParams.pitch!=='') {
|
|
|
+ pitch = Number(this.extraParams.pitch)
|
|
|
+ }
|
|
|
+ if (this.extraParams && this.extraParams.roll && this.extraParams.roll!=='') {
|
|
|
+ roll = Number(this.extraParams.roll)
|
|
|
+ }
|
|
|
+ if (this.extraParams && this.extraParams.title && this.extraParams.title!=='') {
|
|
|
+ title = this.extraParams.title;
|
|
|
+ }
|
|
|
+
|
|
|
var modelObj = new SkyScenery.singleModelBindClick(viewer, {
|
|
|
url: url,
|
|
|
- lon: this.extraParams.lon,
|
|
|
- lat: this.extraParams.lat,
|
|
|
+ lon: lon,
|
|
|
+ lat: lat,
|
|
|
height: height,
|
|
|
- heading: this.extraParams.heading,
|
|
|
- pitch: this.extraParams.pitch,
|
|
|
- roll: this.extraParams.roll,
|
|
|
+ heading: heading,
|
|
|
+ pitch: pitch,
|
|
|
+ roll: roll,
|
|
|
info: {
|
|
|
- log: this.extraParams.lon,
|
|
|
- lat: this.extraParams.lat,
|
|
|
- elevation: this.extraParams.elevation,
|
|
|
- heading: this.extraParams.heading,
|
|
|
- pitch: this.extraParams.pitch,
|
|
|
- roll: this.extraParams.roll,
|
|
|
- title: this.extraParams.title
|
|
|
+ log: lon,
|
|
|
+ lat: lat,
|
|
|
+ elevation: height,
|
|
|
+ heading: heading,
|
|
|
+ pitch: pitch,
|
|
|
+ roll: roll,
|
|
|
+ title: title
|
|
|
}
|
|
|
})
|
|
|
- let origin = SkyScenery.Cartesian3.fromDegrees(this.extraParams.lon, this.extraParams.lat, 2);
|
|
|
+ let origin = SkyScenery.Cartesian3.fromDegrees(lon, lat, 2);
|
|
|
viewer.camera.flyTo({
|
|
|
destination: origin,
|
|
|
orientation: {
|
|
|
- heading: SkyScenery.Math.toRadians(0), // 方向
|
|
|
- pitch: SkyScenery.Math.toRadians(-90), // 倾斜角度
|
|
|
+ heading: SkyScenery.Math.toRadians(-30), // 方向
|
|
|
+ pitch: SkyScenery.Math.toRadians(-10), // 倾斜角度
|
|
|
roll: SkyScenery.Math.toRadians(0),
|
|
|
},
|
|
|
});
|