地图位置调整

This commit is contained in:
shijing 2024-03-18 11:43:23 +08:00
parent 2b4ccc1e5e
commit 9fa1e63438
1 changed files with 13 additions and 9 deletions

View File

@ -374,21 +374,23 @@ export default {
var url = "factory.glb";
var height = 0;
viewer.entities.removeAll() //entity
var position = Cesium.Cartesian3.fromDegrees(87.62594666147378, 42.975362631477815, height)
var heading = Cesium.Math.toRadians(310) //135
var position = Cesium.Cartesian3.fromDegrees(88.644, 42.7229, height)
var heading = Cesium.Math.toRadians(191) //310
var pitch = Cesium.Math.toRadians(0);
var roll = Cesium.Math.toRadians(0);
var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll)
var orientation = Cesium.Transforms.headingPitchRollQuaternion(
position,hpr
)
var modelScale = 30.0; //
var modelEntity = viewer.entities.add({
name: 'photon',
position: position,
orientation: orientation,
model: {
uri: url,//entitits.addgltfuriurl.glb
scale: 1.0,//
scale: modelScale,//
modelMatrix: Cesium.Transforms.eastNorthUpToFixedFrame(position),
minimumPixelSize: 256,//
maximumScale: 20000,//minimumPixelSize
incrementallyLoadTextures: true,//
@ -396,15 +398,18 @@ export default {
heightReference: Cesium.HeightReference.NONE
},
})
viewer.trackedEntity = modelEntity; //
viewer.zoomTo(modelEntity, new Cesium.HeadingPitchRange(-4.2, -0.5, 30));
viewer.trackedEntity = modelEntity; //
//
viewer.zoomTo(modelEntity, new Cesium.HeadingPitchRange(-3.1, -0.6, 900));
that.getEquipmentList();
//
var handler = new Cesium.ScreenSpaceEventHandler(viewer.canvas);
handler.setInputAction(function (click) {
var feature = viewer.scene.pick(click.position);
that.objItem = feature.id._attrs;
that.getInfo(feature.id._id);
if (feature.id._attrs) {
that.objItem = feature.id._attrs;
that.getInfo(feature.id._id);
}
if (Cesium.defined(feature)) {
//
var pickedPosition = viewer.scene.pickPosition(click.position);
@ -423,7 +428,6 @@ export default {
}
},
Cesium.ScreenSpaceEventType.LEFT_CLICK);
},
methods: {
getChartTime() {
@ -522,7 +526,7 @@ export default {
let imgUrl = that.getItemIcon(item.cate_code)
let lon = parseFloat(item.coordinates.longitude);
let lat = parseFloat(item.coordinates.latitude);
let height = parseInt(item.coordinates.height) + 0.5;
let height = parseInt(item.coordinates.height) + 15;
let type = item.cate_code;
let arrs = { name:item.name, lon: lon, lat:lat, height:height, id:item.id, type: type };
let config = { show: true, fontSize: '16px', fillColor: '#ffffff', fillWidth: 1, pixelOffsetX: 10, pixelOffsetY: -30, image: imgUrl, imgWidth: 50, imgHeight: 50, textDistance: 550000, imgDistance: 550000 };