Compare commits
38 Commits
229fd9037f
...
develop
Author | SHA1 | Date | |
---|---|---|---|
5f383f661f | |||
ee38db98fb | |||
d334518da7 | |||
8f41d5907a | |||
9866588986 | |||
5ab4a3b925 | |||
2604512f47 | |||
0bb1e5bd54 | |||
5d6679d919 | |||
41c132e506 | |||
09f760b10a | |||
b0619e1b31 | |||
43a4fca804 | |||
53e692f6ca | |||
dd1855002f | |||
d1dd920fd2 | |||
a69034a18e | |||
7fc4f14756 | |||
feff8c3a76 | |||
58b8c6a897 | |||
349c91f8df | |||
92ef4a68fd | |||
623a220cbf | |||
e8258d96d0 | |||
d0a682f233 | |||
65441ddff4 | |||
7f3b04eb08 | |||
9289d08f24 | |||
f9a3ffb359 | |||
f5d915bd58 | |||
91cc200917 | |||
0c4c956868 | |||
838f39ba40 | |||
077170f2d4 | |||
a1e33d907d | |||
57a9ccacbd | |||
0eef08ce45 | |||
0f9ad0a0f0 |
@ -72,13 +72,267 @@ function openLeftClick(sdk, cb) {
|
||||
click = true
|
||||
}, 600);
|
||||
if (!YJ.Measure.GetMeasureStatus() && cartesian) {
|
||||
let flag = false
|
||||
const pick = sdk.viewer.scene.pick(movement.position)
|
||||
if (pick) {
|
||||
if (pick.id) {
|
||||
let entityId
|
||||
// 矢量
|
||||
if (pick.id.type && pick.id.type === 'vector' && pick.id.parentId) {
|
||||
let obj = leftClickCallbackMap.get(pick.id.parentId)
|
||||
if (obj.that.picking && obj.that.geojson) {
|
||||
for (let i = 0; i < obj.that.geojson.features.length; i++) {
|
||||
if (obj.that.geojson.features[i].id === pick.id._id) {
|
||||
obj.callback(
|
||||
movement,
|
||||
obj.that.geojson.features[i].id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (typeof pick.id.id == 'string') {
|
||||
let array = pick.id.id.split('-')
|
||||
array.splice(array.length - 1, 1)
|
||||
entityId = array.join('-')
|
||||
}
|
||||
|
||||
if (pick.id.properties && pick.id.properties.id && leftClickCallbackMap.has(pick.id.properties.id._value)) {
|
||||
let obj = leftClickCallbackMap.get(pick.id.properties.id._value)
|
||||
if (obj.that.picking) {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.id.properties.id._value,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
else if (leftClickCallbackMap.has(pick.id.id)) {
|
||||
let obj = leftClickCallbackMap.get(pick.id.id)
|
||||
if (obj.that.type === 'PolygonObject') {
|
||||
// 是否可点击y
|
||||
if (obj.that.picking) {
|
||||
if (obj.that.options.positions && obj.that.options.positions.length >= 3) {
|
||||
let pt = turf.point([pos84.lng, pos84.lat]);
|
||||
let polyPos = []
|
||||
for (let i = 0; i < obj.that.options.positions.length; i++) {
|
||||
polyPos.push([
|
||||
obj.that.options.positions[i].lng,
|
||||
obj.that.options.positions[i].lat
|
||||
])
|
||||
}
|
||||
polyPos.push([
|
||||
obj.that.options.positions[0].lng,
|
||||
obj.that.options.positions[0].lat
|
||||
])
|
||||
let poly = turf.polygon([polyPos]);
|
||||
let contain = turf.booleanPointInPolygon(pt, poly);
|
||||
if (contain) {
|
||||
obj.callback(
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 聚集地
|
||||
else if (obj.that.type === 'AssembleObject') {
|
||||
if (obj.that.picking) {
|
||||
if (obj.that.options.positions && obj.that.options.positions.length >= 3) {
|
||||
let positions = obj.that.computeAssemble(obj.that.options.positions, true)
|
||||
let pt = turf.point([pos84.lng, pos84.lat]);
|
||||
let polyPos = []
|
||||
for (let i = 0; i < positions.length; i += 2) {
|
||||
polyPos.push([
|
||||
positions[i],
|
||||
positions[i + 1]
|
||||
])
|
||||
}
|
||||
let poly = turf.polygon([polyPos]);
|
||||
let contain = turf.booleanPointInPolygon(pt, poly);
|
||||
if (contain) {
|
||||
obj.callback(
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 单箭头
|
||||
else if (obj.that.type === 'AttackArrowObject') {
|
||||
if (obj.that.picking) {
|
||||
if (obj.that.options.positions && obj.that.options.positions.length >= 3) {
|
||||
let pt = turf.point([pos84.lng, pos84.lat]);
|
||||
let positions = obj.that.computeAttackArrow(obj.that.options.positions)
|
||||
let polyPos = []
|
||||
for (let m = 0; m < positions.length; m++) {
|
||||
let pos84 = cartesian3Towgs84(positions[m], sdk.viewer)
|
||||
polyPos.push([pos84.lng, pos84.lat])
|
||||
}
|
||||
let poly = turf.polygon([polyPos]);
|
||||
let contain = turf.booleanPointInPolygon(pt, poly);
|
||||
if (contain) {
|
||||
obj.callback(
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 双箭头
|
||||
else if (obj.that.type === 'PincerArrowObject') {
|
||||
if (obj.that.picking) {
|
||||
if (obj.that.options.positions && obj.that.options.positions.length >= 5) {
|
||||
let pt = turf.point([pos84.lng, pos84.lat]);
|
||||
let positions = obj.that.computePincerArrow(obj.that.options.positions)
|
||||
let polyPos = []
|
||||
for (let m = 0; m < positions.length; m++) {
|
||||
let pos84 = cartesian3Towgs84(positions[m], sdk.viewer)
|
||||
polyPos.push([pos84.lng, pos84.lat])
|
||||
}
|
||||
let pos84_0 = cartesian3Towgs84(positions[0], sdk.viewer)
|
||||
polyPos.push([pos84_0.lng, pos84_0.lat])
|
||||
let poly = turf.polygon([polyPos]);
|
||||
let contain = turf.booleanPointInPolygon(pt, poly);
|
||||
if (contain) {
|
||||
obj.callback(
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 圆
|
||||
else if (obj.that.type === 'CircleObject') {
|
||||
if (obj.that.picking) {
|
||||
let pt = turf.point([pos84.lng, pos84.lat]);
|
||||
if (obj.that.options.center && obj.that.options.radius) {
|
||||
let center = [obj.that.options.center.lng, obj.that.options.center.lat];
|
||||
let radius = obj.that.options.radius / 1000;
|
||||
let options = { steps: 360, units: 'kilometers' };
|
||||
let circle = turf.circle(center, radius, options);
|
||||
let contain = turf.booleanPointInPolygon(pt, circle);
|
||||
if (contain) {
|
||||
obj.callback(
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// 扇形
|
||||
else if (obj.that.type === 'SectorObject') {
|
||||
if (obj.that.picking) {
|
||||
let pt = turf.point([pos84.lng, pos84.lat]);
|
||||
if (obj.that.options.center && obj.that.options.radius && obj.that.options.startAngle && obj.that.options.endAngle) {
|
||||
let positions = obj.that.calSector(obj.that.options.center, obj.that.options.radius, obj.that.options.startAngle, obj.that.options.endAngle, undefined, true)
|
||||
let polyPos = []
|
||||
for (let m = 0; m < positions.length; m++) {
|
||||
polyPos.push([positions[m].lng, positions[m].lat])
|
||||
}
|
||||
let poly = turf.polygon([polyPos]);
|
||||
let contain = turf.booleanPointInPolygon(pt, poly);
|
||||
if (contain) {
|
||||
obj.callback(
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (obj.that.picking) {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.id.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
else if (entityId && leftClickCallbackMap.has(entityId)) {
|
||||
let obj = leftClickCallbackMap.get(entityId)
|
||||
if (obj.that.picking) {
|
||||
obj.callback(
|
||||
movement,
|
||||
entityId,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
else if (pick.primitive) {
|
||||
if (typeof pick.id == 'string' && leftClickCallbackMap.has(pick.id)) {
|
||||
let obj = leftClickCallbackMap.get(pick.id)
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (pick.primitive && pick.primitive.id) {
|
||||
if (leftClickCallbackMap.has(pick.primitive.id)) {
|
||||
let obj = leftClickCallbackMap.get(pick.primitive.id)
|
||||
if (obj.that.picking) {
|
||||
if (obj.that.type === 'bim') {
|
||||
if (YJ.Global.getBimPickStatus(sdk)) {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.primitive,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
else {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.primitive.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pick.content && (!pick.primitive || !pick.primitive.id)) {
|
||||
if (leftClickCallbackMap.has(pick.content.tileset.id)) {
|
||||
let obj = leftClickCallbackMap.get(pick.content.tileset.id)
|
||||
if (obj.that.picking) {
|
||||
if (obj.that.type === 'bim') {
|
||||
if (YJ.Global.getBimPickStatus(sdk)) {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.content.tileset,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
else {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.content.tileset.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let i = leftClickCallbackMap.size - 1; i >= 0; i--) {
|
||||
let key = Array.from(leftClickCallbackMap.keys())[i]
|
||||
let obj = leftClickCallbackMap.get(key)
|
||||
if (obj) {
|
||||
|
||||
if (obj.that) {
|
||||
if (obj.that && obj.that.show && (obj.that.entity && obj.that.entity.show)) {
|
||||
// 是否为多边形
|
||||
if (obj.that.type === 'PolygonObject') {
|
||||
// 是否可点击y
|
||||
@ -103,7 +357,6 @@ function openLeftClick(sdk, cb) {
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -129,7 +382,6 @@ function openLeftClick(sdk, cb) {
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -153,7 +405,6 @@ function openLeftClick(sdk, cb) {
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -179,7 +430,6 @@ function openLeftClick(sdk, cb) {
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -200,7 +450,6 @@ function openLeftClick(sdk, cb) {
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -224,7 +473,6 @@ function openLeftClick(sdk, cb) {
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -234,114 +482,6 @@ function openLeftClick(sdk, cb) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
const pick = sdk.viewer.scene.pick(movement.position)
|
||||
if (pick) {
|
||||
if (pick.id) {
|
||||
let entityId
|
||||
// 矢量
|
||||
if (pick.id.type && pick.id.type === 'vector' && pick.id.parentId) {
|
||||
let obj = leftClickCallbackMap.get(pick.id.parentId)
|
||||
if (obj.that.picking && obj.that.geojson) {
|
||||
for (let i = 0; i < obj.that.geojson.features.length; i++) {
|
||||
if (obj.that.geojson.features[i].id === pick.id._id) {
|
||||
obj.callback(
|
||||
movement,
|
||||
obj.that.geojson.features[i].id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (typeof pick.id.id == 'string') {
|
||||
let array = pick.id.id.split('-')
|
||||
array.splice(array.length - 1, 1)
|
||||
entityId = array.join('-')
|
||||
}
|
||||
|
||||
if (pick.id.properties && pick.id.properties.id && leftClickCallbackMap.has(pick.id.properties.id._value)) {
|
||||
let obj = leftClickCallbackMap.get(pick.id.properties.id._value)
|
||||
if (obj.that.picking) {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.id.properties.id._value,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
else if (leftClickCallbackMap.has(pick.id.id)) {
|
||||
let obj = leftClickCallbackMap.get(pick.id.id)
|
||||
if (obj.that.picking) {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.id.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
else if (entityId && leftClickCallbackMap.has(entityId)) {
|
||||
let obj = leftClickCallbackMap.get(entityId)
|
||||
if (obj.that.picking) {
|
||||
obj.callback(
|
||||
movement,
|
||||
entityId,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
else if (pick.primitive) {
|
||||
if (typeof pick.id == 'string' && leftClickCallbackMap.has(pick.id)) {
|
||||
let obj = leftClickCallbackMap.get(pick.id)
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (pick.primitive && pick.primitive.id) {
|
||||
if (leftClickCallbackMap.has(pick.primitive.id)) {
|
||||
let obj = leftClickCallbackMap.get(pick.primitive.id)
|
||||
if (obj.that.picking) {
|
||||
if (obj.that.type === 'bim') {
|
||||
if (YJ.Global.getBimPickStatus(sdk)) {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.primitive,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
else {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.primitive.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pick.content && (!pick.primitive || !pick.primitive.id)) {
|
||||
if (leftClickCallbackMap.has(pick.content.tileset.id)) {
|
||||
let obj = leftClickCallbackMap.get(pick.content.tileset.id)
|
||||
if (obj.that.picking) {
|
||||
if (obj.that.type === 'bim') {
|
||||
if (YJ.Global.getBimPickStatus(sdk)) {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.content.tileset,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
else {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.content.tileset.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,6 +135,7 @@ const open = async (sdk, options = {}, _Dialog = {}) => {
|
||||
pitch: viewer.camera.pitch,
|
||||
roll: viewer.camera.roll
|
||||
}
|
||||
tools.message({text: '操作成功'})
|
||||
})
|
||||
|
||||
let totalTimeElm = contentElm.querySelector("input[name='totalTime']")
|
||||
|
@ -101,6 +101,7 @@ function getFlagFromKeyboard(key) {
|
||||
*/
|
||||
function keyDown(event) {
|
||||
let _viewer = this
|
||||
|
||||
// 判断是否有输入框聚焦
|
||||
function isInputFocused() {
|
||||
const activeElement = document.activeElement;
|
||||
@ -164,32 +165,51 @@ function keyUp(event) {
|
||||
* @return {*}
|
||||
*/
|
||||
function keyboardMapRoamingRender(_viewer) {
|
||||
if(!_viewer.scene.screenSpaceCameraController.enableTilt) {
|
||||
if(!_viewer || !_viewer.scene || !_viewer.scene.screenSpaceCameraController.enableTilt) {
|
||||
return
|
||||
}
|
||||
let camera = _viewer.camera;
|
||||
let ellipsoid = _viewer.scene.globe.ellipsoid;
|
||||
let cameraHeight = ellipsoid.cartesianToCartographic(camera.position).height;
|
||||
let cameraHeight2 = camera.positionCartographic.height;
|
||||
|
||||
|
||||
// 根据相机高度设置移动距离,比默认距离移动效果更好
|
||||
let moveRate = cameraHeight / 20.0;
|
||||
let rotationRate = moveRate / 500000 / Cesium.Math.toDegrees(camera.pitch);
|
||||
let moveRate2 = cameraHeight2 / 100.0;
|
||||
|
||||
if (flags.moveForward) {
|
||||
// camera.moveForward(moveRate);
|
||||
camera.rotate(camera.right, -rotationRate);
|
||||
if(_viewer.scene.mode == 2) {
|
||||
camera.moveUp(moveRate2);
|
||||
}
|
||||
else {
|
||||
camera.rotate(camera.right, -rotationRate);
|
||||
}
|
||||
}
|
||||
if (flags.moveBackward) {
|
||||
// camera.moveBackward(moveRate);
|
||||
camera.rotate(camera.right, rotationRate);
|
||||
if(_viewer.scene.mode == 2) {
|
||||
camera.moveDown(moveRate2);
|
||||
}
|
||||
else {
|
||||
camera.rotate(camera.right, rotationRate);
|
||||
}
|
||||
}
|
||||
if (flags.moveLeft) {
|
||||
// camera.moveLeft(moveRate);
|
||||
camera.rotate(camera.up, -rotationRate);
|
||||
if(_viewer.scene.mode == 2) {
|
||||
camera.moveLeft(moveRate2);
|
||||
}
|
||||
else {
|
||||
camera.rotate(camera.up, -rotationRate);
|
||||
}
|
||||
}
|
||||
if (flags.moveRight) {
|
||||
// camera.moveRight(moveRate);
|
||||
camera.rotate(camera.up, rotationRate);
|
||||
if(_viewer.scene.mode == 2) {
|
||||
camera.moveRight(moveRate2);
|
||||
}
|
||||
else {
|
||||
camera.rotate(camera.up, rotationRate);
|
||||
}
|
||||
}
|
||||
if (flags.moveUp) {
|
||||
camera.moveUp(moveRate);
|
||||
|
@ -72,13 +72,267 @@ function openLeftClick(sdk, cb) {
|
||||
click = true
|
||||
}, 600);
|
||||
if (!YJ.Measure.GetMeasureStatus() && cartesian) {
|
||||
let flag = false
|
||||
const pick = sdk.viewer.scene.pick(movement.position)
|
||||
if (pick) {
|
||||
if (pick.id) {
|
||||
let entityId
|
||||
// 矢量
|
||||
if (pick.id.type && pick.id.type === 'vector' && pick.id.parentId) {
|
||||
let obj = leftClickCallbackMap.get(pick.id.parentId)
|
||||
if (obj.that.picking && obj.that.geojson) {
|
||||
for (let i = 0; i < obj.that.geojson.features.length; i++) {
|
||||
if (obj.that.geojson.features[i].id === pick.id._id) {
|
||||
obj.callback(
|
||||
movement,
|
||||
obj.that.geojson.features[i].id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (typeof pick.id.id == 'string') {
|
||||
let array = pick.id.id.split('-')
|
||||
array.splice(array.length - 1, 1)
|
||||
entityId = array.join('-')
|
||||
}
|
||||
|
||||
if (pick.id.properties && pick.id.properties.id && leftClickCallbackMap.has(pick.id.properties.id._value)) {
|
||||
let obj = leftClickCallbackMap.get(pick.id.properties.id._value)
|
||||
if (obj.that.picking) {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.id.properties.id._value,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
else if (leftClickCallbackMap.has(pick.id.id)) {
|
||||
let obj = leftClickCallbackMap.get(pick.id.id)
|
||||
if (obj.that.type === 'PolygonObject') {
|
||||
// 是否可点击y
|
||||
if (obj.that.picking) {
|
||||
if (obj.that.options.positions && obj.that.options.positions.length >= 3) {
|
||||
let pt = turf.point([pos84.lng, pos84.lat]);
|
||||
let polyPos = []
|
||||
for (let i = 0; i < obj.that.options.positions.length; i++) {
|
||||
polyPos.push([
|
||||
obj.that.options.positions[i].lng,
|
||||
obj.that.options.positions[i].lat
|
||||
])
|
||||
}
|
||||
polyPos.push([
|
||||
obj.that.options.positions[0].lng,
|
||||
obj.that.options.positions[0].lat
|
||||
])
|
||||
let poly = turf.polygon([polyPos]);
|
||||
let contain = turf.booleanPointInPolygon(pt, poly);
|
||||
if (contain) {
|
||||
obj.callback(
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 聚集地
|
||||
else if (obj.that.type === 'AssembleObject') {
|
||||
if (obj.that.picking) {
|
||||
if (obj.that.options.positions && obj.that.options.positions.length >= 3) {
|
||||
let positions = obj.that.computeAssemble(obj.that.options.positions, true)
|
||||
let pt = turf.point([pos84.lng, pos84.lat]);
|
||||
let polyPos = []
|
||||
for (let i = 0; i < positions.length; i += 2) {
|
||||
polyPos.push([
|
||||
positions[i],
|
||||
positions[i + 1]
|
||||
])
|
||||
}
|
||||
let poly = turf.polygon([polyPos]);
|
||||
let contain = turf.booleanPointInPolygon(pt, poly);
|
||||
if (contain) {
|
||||
obj.callback(
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 单箭头
|
||||
else if (obj.that.type === 'AttackArrowObject') {
|
||||
if (obj.that.picking) {
|
||||
if (obj.that.options.positions && obj.that.options.positions.length >= 3) {
|
||||
let pt = turf.point([pos84.lng, pos84.lat]);
|
||||
let positions = obj.that.computeAttackArrow(obj.that.options.positions)
|
||||
let polyPos = []
|
||||
for (let m = 0; m < positions.length; m++) {
|
||||
let pos84 = cartesian3Towgs84(positions[m], sdk.viewer)
|
||||
polyPos.push([pos84.lng, pos84.lat])
|
||||
}
|
||||
let poly = turf.polygon([polyPos]);
|
||||
let contain = turf.booleanPointInPolygon(pt, poly);
|
||||
if (contain) {
|
||||
obj.callback(
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 双箭头
|
||||
else if (obj.that.type === 'PincerArrowObject') {
|
||||
if (obj.that.picking) {
|
||||
if (obj.that.options.positions && obj.that.options.positions.length >= 5) {
|
||||
let pt = turf.point([pos84.lng, pos84.lat]);
|
||||
let positions = obj.that.computePincerArrow(obj.that.options.positions)
|
||||
let polyPos = []
|
||||
for (let m = 0; m < positions.length; m++) {
|
||||
let pos84 = cartesian3Towgs84(positions[m], sdk.viewer)
|
||||
polyPos.push([pos84.lng, pos84.lat])
|
||||
}
|
||||
let pos84_0 = cartesian3Towgs84(positions[0], sdk.viewer)
|
||||
polyPos.push([pos84_0.lng, pos84_0.lat])
|
||||
let poly = turf.polygon([polyPos]);
|
||||
let contain = turf.booleanPointInPolygon(pt, poly);
|
||||
if (contain) {
|
||||
obj.callback(
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 圆
|
||||
else if (obj.that.type === 'CircleObject') {
|
||||
if (obj.that.picking) {
|
||||
let pt = turf.point([pos84.lng, pos84.lat]);
|
||||
if (obj.that.options.center && obj.that.options.radius) {
|
||||
let center = [obj.that.options.center.lng, obj.that.options.center.lat];
|
||||
let radius = obj.that.options.radius / 1000;
|
||||
let options = { steps: 360, units: 'kilometers' };
|
||||
let circle = turf.circle(center, radius, options);
|
||||
let contain = turf.booleanPointInPolygon(pt, circle);
|
||||
if (contain) {
|
||||
obj.callback(
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// 扇形
|
||||
else if (obj.that.type === 'SectorObject') {
|
||||
if (obj.that.picking) {
|
||||
let pt = turf.point([pos84.lng, pos84.lat]);
|
||||
if (obj.that.options.center && obj.that.options.radius && obj.that.options.startAngle && obj.that.options.endAngle) {
|
||||
let positions = obj.that.calSector(obj.that.options.center, obj.that.options.radius, obj.that.options.startAngle, obj.that.options.endAngle, undefined, true)
|
||||
let polyPos = []
|
||||
for (let m = 0; m < positions.length; m++) {
|
||||
polyPos.push([positions[m].lng, positions[m].lat])
|
||||
}
|
||||
let poly = turf.polygon([polyPos]);
|
||||
let contain = turf.booleanPointInPolygon(pt, poly);
|
||||
if (contain) {
|
||||
obj.callback(
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (obj.that.picking) {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.id.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
else if (entityId && leftClickCallbackMap.has(entityId)) {
|
||||
let obj = leftClickCallbackMap.get(entityId)
|
||||
if (obj.that.picking) {
|
||||
obj.callback(
|
||||
movement,
|
||||
entityId,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
else if (pick.primitive) {
|
||||
if (typeof pick.id == 'string' && leftClickCallbackMap.has(pick.id)) {
|
||||
let obj = leftClickCallbackMap.get(pick.id)
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (pick.primitive && pick.primitive.id) {
|
||||
if (leftClickCallbackMap.has(pick.primitive.id)) {
|
||||
let obj = leftClickCallbackMap.get(pick.primitive.id)
|
||||
if (obj.that.picking) {
|
||||
if (obj.that.type === 'bim') {
|
||||
if (YJ.Global.getBimPickStatus(sdk)) {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.primitive,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
else {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.primitive.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pick.content && (!pick.primitive || !pick.primitive.id)) {
|
||||
if (leftClickCallbackMap.has(pick.content.tileset.id)) {
|
||||
let obj = leftClickCallbackMap.get(pick.content.tileset.id)
|
||||
if (obj.that.picking) {
|
||||
if (obj.that.type === 'bim') {
|
||||
if (YJ.Global.getBimPickStatus(sdk)) {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.content.tileset,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
else {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.content.tileset.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let i = leftClickCallbackMap.size - 1; i >= 0; i--) {
|
||||
let key = Array.from(leftClickCallbackMap.keys())[i]
|
||||
let obj = leftClickCallbackMap.get(key)
|
||||
if (obj) {
|
||||
|
||||
if (obj.that) {
|
||||
if (obj.that && obj.that.show && (obj.that.entity && obj.that.entity.show)) {
|
||||
// 是否为多边形
|
||||
if (obj.that.type === 'PolygonObject') {
|
||||
// 是否可点击y
|
||||
@ -103,7 +357,6 @@ function openLeftClick(sdk, cb) {
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -129,7 +382,6 @@ function openLeftClick(sdk, cb) {
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -153,7 +405,6 @@ function openLeftClick(sdk, cb) {
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -179,7 +430,6 @@ function openLeftClick(sdk, cb) {
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -200,7 +450,6 @@ function openLeftClick(sdk, cb) {
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -224,7 +473,6 @@ function openLeftClick(sdk, cb) {
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -234,114 +482,6 @@ function openLeftClick(sdk, cb) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
const pick = sdk.viewer.scene.pick(movement.position)
|
||||
if (pick) {
|
||||
if (pick.id) {
|
||||
let entityId
|
||||
// 矢量
|
||||
if (pick.id.type && pick.id.type === 'vector' && pick.id.parentId) {
|
||||
let obj = leftClickCallbackMap.get(pick.id.parentId)
|
||||
if (obj.that.picking && obj.that.geojson) {
|
||||
for (let i = 0; i < obj.that.geojson.features.length; i++) {
|
||||
if (obj.that.geojson.features[i].id === pick.id._id) {
|
||||
obj.callback(
|
||||
movement,
|
||||
obj.that.geojson.features[i].id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (typeof pick.id.id == 'string') {
|
||||
let array = pick.id.id.split('-')
|
||||
array.splice(array.length - 1, 1)
|
||||
entityId = array.join('-')
|
||||
}
|
||||
|
||||
if (pick.id.properties && pick.id.properties.id && leftClickCallbackMap.has(pick.id.properties.id._value)) {
|
||||
let obj = leftClickCallbackMap.get(pick.id.properties.id._value)
|
||||
if (obj.that.picking) {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.id.properties.id._value,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
else if (leftClickCallbackMap.has(pick.id.id)) {
|
||||
let obj = leftClickCallbackMap.get(pick.id.id)
|
||||
if (obj.that.picking) {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.id.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
else if (entityId && leftClickCallbackMap.has(entityId)) {
|
||||
let obj = leftClickCallbackMap.get(entityId)
|
||||
if (obj.that.picking) {
|
||||
obj.callback(
|
||||
movement,
|
||||
entityId,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
else if (pick.primitive) {
|
||||
if (typeof pick.id == 'string' && leftClickCallbackMap.has(pick.id)) {
|
||||
let obj = leftClickCallbackMap.get(pick.id)
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (pick.primitive && pick.primitive.id) {
|
||||
if (leftClickCallbackMap.has(pick.primitive.id)) {
|
||||
let obj = leftClickCallbackMap.get(pick.primitive.id)
|
||||
if (obj.that.picking) {
|
||||
if (obj.that.type === 'bim') {
|
||||
if (YJ.Global.getBimPickStatus(sdk)) {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.primitive,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
else {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.primitive.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pick.content && (!pick.primitive || !pick.primitive.id)) {
|
||||
if (leftClickCallbackMap.has(pick.content.tileset.id)) {
|
||||
let obj = leftClickCallbackMap.get(pick.content.tileset.id)
|
||||
if (obj.that.picking) {
|
||||
if (obj.that.type === 'bim') {
|
||||
if (YJ.Global.getBimPickStatus(sdk)) {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.content.tileset,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
else {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.content.tileset.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,12 @@ async function syncData2(sdk, id, entityId) {
|
||||
if (that.showView == 3) {
|
||||
options.show = false
|
||||
}
|
||||
let newObject = await new that.constructor(sdk2D, options)
|
||||
let callback
|
||||
if(that.type === 'TextBox') {
|
||||
callback = that.callback
|
||||
}
|
||||
|
||||
let newObject = await new that.constructor(sdk2D, options, callback)
|
||||
newObject.onClick = that.onClick
|
||||
newObject.onRightClick = that.onRightClick
|
||||
newObject.onMouseMove = that.onMouseMove
|
||||
@ -252,7 +257,11 @@ async function syncData2(sdk, id, entityId) {
|
||||
if(target) {
|
||||
await target.remove()
|
||||
}
|
||||
target = await new obj.constructor(sdk2D, options)
|
||||
let callback
|
||||
if(obj.type === 'TextBox') {
|
||||
callback = obj.callback
|
||||
}
|
||||
target = await new obj.constructor(sdk2D, options, callback)
|
||||
target.onClick = obj.onClick
|
||||
target.onRightClick = obj.onRightClick
|
||||
target.onMouseMove = obj.onMouseMove
|
||||
|
@ -72,13 +72,267 @@ function openLeftClick(sdk, cb) {
|
||||
click = true
|
||||
}, 600);
|
||||
if (!YJ.Measure.GetMeasureStatus() && cartesian) {
|
||||
let flag = false
|
||||
const pick = sdk.viewer.scene.pick(movement.position)
|
||||
if (pick) {
|
||||
if (pick.id) {
|
||||
let entityId
|
||||
// 矢量
|
||||
if (pick.id.type && pick.id.type === 'vector' && pick.id.parentId) {
|
||||
let obj = leftClickCallbackMap.get(pick.id.parentId)
|
||||
if (obj.that.picking && obj.that.geojson) {
|
||||
for (let i = 0; i < obj.that.geojson.features.length; i++) {
|
||||
if (obj.that.geojson.features[i].id === pick.id._id) {
|
||||
obj.callback(
|
||||
movement,
|
||||
obj.that.geojson.features[i].id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (typeof pick.id.id == 'string') {
|
||||
let array = pick.id.id.split('-')
|
||||
array.splice(array.length - 1, 1)
|
||||
entityId = array.join('-')
|
||||
}
|
||||
|
||||
if (pick.id.properties && pick.id.properties.id && leftClickCallbackMap.has(pick.id.properties.id._value)) {
|
||||
let obj = leftClickCallbackMap.get(pick.id.properties.id._value)
|
||||
if (obj.that.picking) {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.id.properties.id._value,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
else if (leftClickCallbackMap.has(pick.id.id)) {
|
||||
let obj = leftClickCallbackMap.get(pick.id.id)
|
||||
if (obj.that.type === 'PolygonObject') {
|
||||
// 是否可点击y
|
||||
if (obj.that.picking) {
|
||||
if (obj.that.options.positions && obj.that.options.positions.length >= 3) {
|
||||
let pt = turf.point([pos84.lng, pos84.lat]);
|
||||
let polyPos = []
|
||||
for (let i = 0; i < obj.that.options.positions.length; i++) {
|
||||
polyPos.push([
|
||||
obj.that.options.positions[i].lng,
|
||||
obj.that.options.positions[i].lat
|
||||
])
|
||||
}
|
||||
polyPos.push([
|
||||
obj.that.options.positions[0].lng,
|
||||
obj.that.options.positions[0].lat
|
||||
])
|
||||
let poly = turf.polygon([polyPos]);
|
||||
let contain = turf.booleanPointInPolygon(pt, poly);
|
||||
if (contain) {
|
||||
obj.callback(
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 聚集地
|
||||
else if (obj.that.type === 'AssembleObject') {
|
||||
if (obj.that.picking) {
|
||||
if (obj.that.options.positions && obj.that.options.positions.length >= 3) {
|
||||
let positions = obj.that.computeAssemble(obj.that.options.positions, true)
|
||||
let pt = turf.point([pos84.lng, pos84.lat]);
|
||||
let polyPos = []
|
||||
for (let i = 0; i < positions.length; i += 2) {
|
||||
polyPos.push([
|
||||
positions[i],
|
||||
positions[i + 1]
|
||||
])
|
||||
}
|
||||
let poly = turf.polygon([polyPos]);
|
||||
let contain = turf.booleanPointInPolygon(pt, poly);
|
||||
if (contain) {
|
||||
obj.callback(
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 单箭头
|
||||
else if (obj.that.type === 'AttackArrowObject') {
|
||||
if (obj.that.picking) {
|
||||
if (obj.that.options.positions && obj.that.options.positions.length >= 3) {
|
||||
let pt = turf.point([pos84.lng, pos84.lat]);
|
||||
let positions = obj.that.computeAttackArrow(obj.that.options.positions)
|
||||
let polyPos = []
|
||||
for (let m = 0; m < positions.length; m++) {
|
||||
let pos84 = cartesian3Towgs84(positions[m], sdk.viewer)
|
||||
polyPos.push([pos84.lng, pos84.lat])
|
||||
}
|
||||
let poly = turf.polygon([polyPos]);
|
||||
let contain = turf.booleanPointInPolygon(pt, poly);
|
||||
if (contain) {
|
||||
obj.callback(
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 双箭头
|
||||
else if (obj.that.type === 'PincerArrowObject') {
|
||||
if (obj.that.picking) {
|
||||
if (obj.that.options.positions && obj.that.options.positions.length >= 5) {
|
||||
let pt = turf.point([pos84.lng, pos84.lat]);
|
||||
let positions = obj.that.computePincerArrow(obj.that.options.positions)
|
||||
let polyPos = []
|
||||
for (let m = 0; m < positions.length; m++) {
|
||||
let pos84 = cartesian3Towgs84(positions[m], sdk.viewer)
|
||||
polyPos.push([pos84.lng, pos84.lat])
|
||||
}
|
||||
let pos84_0 = cartesian3Towgs84(positions[0], sdk.viewer)
|
||||
polyPos.push([pos84_0.lng, pos84_0.lat])
|
||||
let poly = turf.polygon([polyPos]);
|
||||
let contain = turf.booleanPointInPolygon(pt, poly);
|
||||
if (contain) {
|
||||
obj.callback(
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 圆
|
||||
else if (obj.that.type === 'CircleObject') {
|
||||
if (obj.that.picking) {
|
||||
let pt = turf.point([pos84.lng, pos84.lat]);
|
||||
if (obj.that.options.center && obj.that.options.radius) {
|
||||
let center = [obj.that.options.center.lng, obj.that.options.center.lat];
|
||||
let radius = obj.that.options.radius / 1000;
|
||||
let options = { steps: 360, units: 'kilometers' };
|
||||
let circle = turf.circle(center, radius, options);
|
||||
let contain = turf.booleanPointInPolygon(pt, circle);
|
||||
if (contain) {
|
||||
obj.callback(
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// 扇形
|
||||
else if (obj.that.type === 'SectorObject') {
|
||||
if (obj.that.picking) {
|
||||
let pt = turf.point([pos84.lng, pos84.lat]);
|
||||
if (obj.that.options.center && obj.that.options.radius && obj.that.options.startAngle && obj.that.options.endAngle) {
|
||||
let positions = obj.that.calSector(obj.that.options.center, obj.that.options.radius, obj.that.options.startAngle, obj.that.options.endAngle, undefined, true)
|
||||
let polyPos = []
|
||||
for (let m = 0; m < positions.length; m++) {
|
||||
polyPos.push([positions[m].lng, positions[m].lat])
|
||||
}
|
||||
let poly = turf.polygon([polyPos]);
|
||||
let contain = turf.booleanPointInPolygon(pt, poly);
|
||||
if (contain) {
|
||||
obj.callback(
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (obj.that.picking) {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.id.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
else if (entityId && leftClickCallbackMap.has(entityId)) {
|
||||
let obj = leftClickCallbackMap.get(entityId)
|
||||
if (obj.that.picking) {
|
||||
obj.callback(
|
||||
movement,
|
||||
entityId,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
else if (pick.primitive) {
|
||||
if (typeof pick.id == 'string' && leftClickCallbackMap.has(pick.id)) {
|
||||
let obj = leftClickCallbackMap.get(pick.id)
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (pick.primitive && pick.primitive.id) {
|
||||
if (leftClickCallbackMap.has(pick.primitive.id)) {
|
||||
let obj = leftClickCallbackMap.get(pick.primitive.id)
|
||||
if (obj.that.picking) {
|
||||
if (obj.that.type === 'bim') {
|
||||
if (YJ.Global.getBimPickStatus(sdk)) {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.primitive,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
else {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.primitive.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pick.content && (!pick.primitive || !pick.primitive.id)) {
|
||||
if (leftClickCallbackMap.has(pick.content.tileset.id)) {
|
||||
let obj = leftClickCallbackMap.get(pick.content.tileset.id)
|
||||
if (obj.that.picking) {
|
||||
if (obj.that.type === 'bim') {
|
||||
if (YJ.Global.getBimPickStatus(sdk)) {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.content.tileset,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
else {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.content.tileset.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let i = leftClickCallbackMap.size - 1; i >= 0; i--) {
|
||||
let key = Array.from(leftClickCallbackMap.keys())[i]
|
||||
let obj = leftClickCallbackMap.get(key)
|
||||
if (obj) {
|
||||
|
||||
if (obj.that) {
|
||||
if (obj.that && obj.that.show && (obj.that.entity && obj.that.entity.show)) {
|
||||
// 是否为多边形
|
||||
if (obj.that.type === 'PolygonObject') {
|
||||
// 是否可点击y
|
||||
@ -103,7 +357,6 @@ function openLeftClick(sdk, cb) {
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -129,7 +382,6 @@ function openLeftClick(sdk, cb) {
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -153,7 +405,6 @@ function openLeftClick(sdk, cb) {
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -179,7 +430,6 @@ function openLeftClick(sdk, cb) {
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -200,7 +450,6 @@ function openLeftClick(sdk, cb) {
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -224,7 +473,6 @@ function openLeftClick(sdk, cb) {
|
||||
movement,
|
||||
obj.that.options.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -234,114 +482,6 @@ function openLeftClick(sdk, cb) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
const pick = sdk.viewer.scene.pick(movement.position)
|
||||
if (pick) {
|
||||
if (pick.id) {
|
||||
let entityId
|
||||
// 矢量
|
||||
if (pick.id.type && pick.id.type === 'vector' && pick.id.parentId) {
|
||||
let obj = leftClickCallbackMap.get(pick.id.parentId)
|
||||
if (obj.that.picking && obj.that.geojson) {
|
||||
for (let i = 0; i < obj.that.geojson.features.length; i++) {
|
||||
if (obj.that.geojson.features[i].id === pick.id._id) {
|
||||
obj.callback(
|
||||
movement,
|
||||
obj.that.geojson.features[i].id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (typeof pick.id.id == 'string') {
|
||||
let array = pick.id.id.split('-')
|
||||
array.splice(array.length - 1, 1)
|
||||
entityId = array.join('-')
|
||||
}
|
||||
|
||||
if (pick.id.properties && pick.id.properties.id && leftClickCallbackMap.has(pick.id.properties.id._value)) {
|
||||
let obj = leftClickCallbackMap.get(pick.id.properties.id._value)
|
||||
if (obj.that.picking) {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.id.properties.id._value,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
else if (leftClickCallbackMap.has(pick.id.id)) {
|
||||
let obj = leftClickCallbackMap.get(pick.id.id)
|
||||
if (obj.that.picking) {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.id.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
else if (entityId && leftClickCallbackMap.has(entityId)) {
|
||||
let obj = leftClickCallbackMap.get(entityId)
|
||||
if (obj.that.picking) {
|
||||
obj.callback(
|
||||
movement,
|
||||
entityId,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
else if (pick.primitive) {
|
||||
if (typeof pick.id == 'string' && leftClickCallbackMap.has(pick.id)) {
|
||||
let obj = leftClickCallbackMap.get(pick.id)
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (pick.primitive && pick.primitive.id) {
|
||||
if (leftClickCallbackMap.has(pick.primitive.id)) {
|
||||
let obj = leftClickCallbackMap.get(pick.primitive.id)
|
||||
if (obj.that.picking) {
|
||||
if (obj.that.type === 'bim') {
|
||||
if (YJ.Global.getBimPickStatus(sdk)) {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.primitive,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
else {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.primitive.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pick.content && (!pick.primitive || !pick.primitive.id)) {
|
||||
if (leftClickCallbackMap.has(pick.content.tileset.id)) {
|
||||
let obj = leftClickCallbackMap.get(pick.content.tileset.id)
|
||||
if (obj.that.picking) {
|
||||
if (obj.that.type === 'bim') {
|
||||
if (YJ.Global.getBimPickStatus(sdk)) {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.content.tileset,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
else {
|
||||
obj.callback(
|
||||
movement,
|
||||
pick.content.tileset.id,
|
||||
cartesian3Towgs84(getcartesian(sdk, movement), sdk.viewer), obj.that)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,11 +102,20 @@ function off() {
|
||||
let leftCanvas = leftBox.getElementsByTagName('canvas')[0]
|
||||
leftBox.style.width = '100%'
|
||||
leftCanvas.style.width = '100%'
|
||||
let billboardAttributeBoxs = sdkP.viewer._element.getElementsByClassName('billboard-attribute-box')
|
||||
for (let i = 0; i < billboardAttributeBoxs.length; i++) {
|
||||
billboardAttributeBoxs[i].style.display = 'block'
|
||||
}
|
||||
sdkP = null
|
||||
}
|
||||
|
||||
|
||||
async function init(sdk) {
|
||||
let billboardAttributeBoxs = sdk.viewer._element.getElementsByClassName('billboard-attribute-box')
|
||||
for (let i = 0; i < billboardAttributeBoxs.length; i++) {
|
||||
billboardAttributeBoxs[i].style.display = 'none'
|
||||
}
|
||||
|
||||
sdk.entityMap.forEach((item, key) => {
|
||||
if (item.type && item.type == 'TrajectoryMotion' && item.viewFollow) {
|
||||
item.viewFollow = false
|
||||
@ -137,10 +146,8 @@ async function init(sdk) {
|
||||
rightElm.style.position = 'absolute'
|
||||
rightElm.style.right = 'calc(50% - 50px)'
|
||||
|
||||
if (!activeIds || activeIds.length == 0) {
|
||||
leftElm.style.display = 'none'
|
||||
rightElm.style.display = 'none'
|
||||
}
|
||||
leftElm.style.display = 'none'
|
||||
rightElm.style.display = 'none'
|
||||
|
||||
sdk.viewer._element.appendChild(leftElm)
|
||||
sdk.viewer._element.appendChild(rightElm)
|
||||
@ -149,6 +156,12 @@ async function init(sdk) {
|
||||
let right = 0
|
||||
if (activeIds) {
|
||||
for (let i = 0; i < activeIds.length; i++) {
|
||||
let thatP = sdk.entityMap.get(activeIds[i])
|
||||
if (!thatP || (thatP.type === 'terrain' || !thatP.show) || thatP.type === 'TextBox') {
|
||||
continue
|
||||
}
|
||||
leftElm.style.display = 'unset'
|
||||
rightElm.style.display = 'unset'
|
||||
let status = statusMap.get(activeIds[i])
|
||||
if (status) {
|
||||
if (status.P) {
|
||||
@ -911,7 +924,7 @@ async function setSplitDirection(v, id, isoff = false, entityId) {
|
||||
}
|
||||
if (thatP.type === 'GroundSvg' && thatP.text) {
|
||||
thatP.text.show = thatP.textShow
|
||||
target.textShow = false
|
||||
target && (target.textShow = false)
|
||||
}
|
||||
if (thatP.label && thatP.labelShow) {
|
||||
thatP.label.entity.show = true
|
||||
@ -1281,6 +1294,8 @@ function setActiveId(ids = []) {
|
||||
}
|
||||
else {
|
||||
if (leftElm && rightElm) {
|
||||
leftElm.style.display = 'none'
|
||||
rightElm.style.display = 'none'
|
||||
let left = 0
|
||||
let right = 0
|
||||
for (let i = 0; i < activeIds.length; i++) {
|
||||
@ -1298,10 +1313,8 @@ function setActiveId(ids = []) {
|
||||
|
||||
|
||||
let thatP = sdkP.entityMap.get(activeIds[i])
|
||||
let thatD = sdkD.entityMap.get(activeIds[i])
|
||||
if (!thatP || (thatP.type === 'terrain' || !thatP.show)) {
|
||||
leftElm.style.display = 'none'
|
||||
rightElm.style.display = 'none'
|
||||
// let thatD = sdkD.entityMap.get(activeIds[i])
|
||||
if (!thatP || (thatP.type === 'terrain' || !thatP.show) || thatP.type === 'TextBox') {
|
||||
continue
|
||||
}
|
||||
leftElm.style.display = 'unset'
|
||||
|
@ -29,7 +29,7 @@ function getCurrentView(sdk) {
|
||||
// heading: viewer.camera.heading,
|
||||
// pitch: viewer.camera.pitch,
|
||||
// roll: viewer.camera.roll,
|
||||
position: tools.cartesian3Towgs84(viewer.camera.position, viewer),
|
||||
position: tools.cartesian3Towgs84(viewer.camera._positionWC, viewer),
|
||||
orientation: {
|
||||
heading: Cesium.Math.toDegrees(viewer.camera.heading),
|
||||
pitch: Cesium.Math.toDegrees(viewer.camera.pitch),
|
||||
|
@ -92,12 +92,12 @@ function MouseRightMenu(sdk, status, callBack) {
|
||||
entityId = entityId.parentId
|
||||
}
|
||||
let addedMenu = ''
|
||||
let that = sdk.entityMap.get(entityId)
|
||||
let that = sdk.entityMap.get(entityId+'')
|
||||
if (!that && entityId) {
|
||||
let array = entityId.split('-')
|
||||
let array = (entityId+'').split('-')
|
||||
array.splice(array.length - 1, 1)
|
||||
entityId = array.join('-')
|
||||
that = sdk.entityMap.get(entityId)
|
||||
that = sdk.entityMap.get(entityId+'')
|
||||
}
|
||||
|
||||
if (that && that.picking) {
|
||||
|
@ -5,6 +5,7 @@ import Dialog from '../../Element/Dialog';
|
||||
import { html } from "./_element";
|
||||
import EventBinding from '../../Element/Dialog/eventBinding';
|
||||
import Base from "../index";
|
||||
import Tools from "../../../Tools";
|
||||
import { syncData } from '../../../Global/MultiViewportMode'
|
||||
import Model from '../BaseSource/BaseModel/Model'
|
||||
import { legp } from '../../Element/datalist'
|
||||
@ -13,7 +14,7 @@ import DrawPolyline from '../../../Draw/drawPolyline'
|
||||
import DrawPolygon from '../../../Draw/drawPolygon'
|
||||
import DrawThreeRect from '../../../Draw/drawThreeRect'
|
||||
import DrawPoint from '../../../Draw/drawPoint'
|
||||
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global'
|
||||
import { setActiveViewer, closeRotateAround, closeViewFollow, CesiumContainer } from '../../../Global/global'
|
||||
|
||||
import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen'
|
||||
|
||||
@ -37,7 +38,7 @@ class BatchModel extends Base {
|
||||
this.options.name = options.name || '批量模型'
|
||||
this.options.type = options.type || '面'
|
||||
this.options.url = options.url || ''
|
||||
this.options.spacing = options.spacing || 50
|
||||
this.options.spacing = options.spacing * 1 || 50
|
||||
this.options.positions = options.positions || []
|
||||
this.options.show = (options.show || options.show === false) ? options.show : true
|
||||
this.callback = callback
|
||||
@ -45,13 +46,19 @@ class BatchModel extends Base {
|
||||
this._EventBinding = new EventBinding()
|
||||
this._elms = {};
|
||||
this.pointArr = []
|
||||
this.sdk.addIncetance(this.options.id, this)
|
||||
// this.sdk.addIncetance(this.options.id, this)
|
||||
let tools = new Tools(sdk)
|
||||
// BatchModel.computeDis(this)
|
||||
// if (this.options.positions.length > 0 || this.options.positions.lng) {
|
||||
if (this.options.spacing < 0 || options.spacing * 1 === 0) {
|
||||
tools.message({ type: 'warning', text: '请输入正确的间距!' })
|
||||
return;
|
||||
}
|
||||
if ((options.type && options.spacing != undefined) || options.type == '点') {
|
||||
// BatchModel.computeDis(this)
|
||||
|
||||
let Draw
|
||||
console.log('kkkkk')
|
||||
switch (options.type) {
|
||||
case '点':
|
||||
Draw = new DrawPoint(this.sdk)
|
||||
@ -67,8 +74,37 @@ class BatchModel extends Base {
|
||||
}
|
||||
Draw && Draw.start((a, positions) => {
|
||||
this.options.positions = positions;
|
||||
// this.callback(this.options);
|
||||
(this.options.positions.length || this.options.positions.lng) && BatchModel.computeDis(this)
|
||||
console.log('uuuuuu')
|
||||
//判断范围是否过大
|
||||
if (positions.length != 0 || positions.lng) {
|
||||
if (options.type == '面') {
|
||||
let posi = positions.map(v => {
|
||||
return Cesium.Cartesian3.fromDegrees(v.lng, v.lat)
|
||||
})
|
||||
let dis1 = Cesium.Cartesian3.distance(posi[0], posi[1])
|
||||
let dis2 = Cesium.Cartesian3.distance(posi[1], posi[2])
|
||||
let num1 = dis1 / this.options.spacing
|
||||
let num2 = dis2 / this.options.spacing
|
||||
if (num1 * num2 > 100) {
|
||||
tools.message({ type: 'warning', text: '数量大于100,请重新绘制' })
|
||||
return;
|
||||
}
|
||||
} else if (options.type == '线') {
|
||||
let posi = positions.map(v => {
|
||||
return Cesium.Cartesian3.fromDegrees(v.lng, v.lat)
|
||||
})
|
||||
let dis = 0
|
||||
for (let i = 0; i < posi.length - 2; i++) {
|
||||
dis += Cesium.Cartesian3.distance(posi[i], posi[i + 1])
|
||||
}
|
||||
if (dis / this.options.spacing > 100) {
|
||||
tools.message({ type: 'warning', text: '数量大于100,请重新绘制' })
|
||||
return;
|
||||
}
|
||||
}
|
||||
// this.callback(this.options);
|
||||
(this.options.positions.length || this.options.positions.lng) && BatchModel.computeDis(this)
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
@ -83,51 +119,59 @@ class BatchModel extends Base {
|
||||
let posiArr = []
|
||||
let array = []
|
||||
if (that.options.type == '面') {
|
||||
that.options.positions.forEach(item => {
|
||||
fromDegreesArray.push(item.lng, item.lat)
|
||||
})
|
||||
// arr = that.generateInterpolatedPoints(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray), that.options.spacing)
|
||||
arr = await that.computedArea(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray), that.options.spacing)
|
||||
array[0] = arr
|
||||
array[1] = that.calculateRoadAngle(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)[0], Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)[3])
|
||||
arr.forEach((item, index) => {
|
||||
const cartographic = Cesium.Cartographic.fromCartesian(
|
||||
item // Cartesian3对象 {x, y, z}
|
||||
);
|
||||
const longitude = Cesium.Math.toDegrees(cartographic.longitude);
|
||||
const latitude = Cesium.Math.toDegrees(cartographic.latitude);
|
||||
const height = cartographic.height;
|
||||
posiArr.push({
|
||||
lng: longitude,
|
||||
lat: latitude,
|
||||
alt: height
|
||||
if (that.options.positions.length != 0) {
|
||||
that.options.positions.forEach(item => {
|
||||
fromDegreesArray.push(item.lng, item.lat)
|
||||
})
|
||||
})
|
||||
// arr = that.generateInterpolatedPoints(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray), that.options.spacing)
|
||||
arr = await that.computedArea(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray), that.options.spacing)
|
||||
array[0] = arr
|
||||
array[1] = that.calculateRoadAngle(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)[0], Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)[3])
|
||||
arr.forEach((item, index) => {
|
||||
const cartographic = Cesium.Cartographic.fromCartesian(
|
||||
item // Cartesian3对象 {x, y, z}
|
||||
);
|
||||
const longitude = Cesium.Math.toDegrees(cartographic.longitude);
|
||||
const latitude = Cesium.Math.toDegrees(cartographic.latitude);
|
||||
const height = cartographic.height;
|
||||
posiArr.push({
|
||||
lng: longitude,
|
||||
lat: latitude,
|
||||
alt: height
|
||||
})
|
||||
})
|
||||
}
|
||||
} else if (that.options.type == '线') {
|
||||
that.options.positions.forEach(item => {
|
||||
fromDegreesArray.push(item.lng, item.lat)
|
||||
})
|
||||
array = await that.linePoint(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray), that.options.spacing)
|
||||
arr = array[0]
|
||||
that.pointArr = arr
|
||||
arr.forEach((item, index) => {
|
||||
const cartographic = Cesium.Cartographic.fromCartesian(
|
||||
item // Cartesian3对象 {x, y, z}
|
||||
);
|
||||
const longitude = Cesium.Math.toDegrees(cartographic.longitude);
|
||||
const latitude = Cesium.Math.toDegrees(cartographic.latitude);
|
||||
const height = cartographic.height;
|
||||
posiArr.push({
|
||||
lng: longitude,
|
||||
lat: latitude,
|
||||
alt: height
|
||||
if (that.options.positions.length != 0) {
|
||||
that.options.positions.forEach(item => {
|
||||
fromDegreesArray.push(item.lng, item.lat)
|
||||
})
|
||||
})
|
||||
array = await that.linePoint(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray), that.options.spacing)
|
||||
arr = array[0]
|
||||
that.pointArr = arr
|
||||
arr.forEach((item, index) => {
|
||||
const cartographic = Cesium.Cartographic.fromCartesian(
|
||||
item // Cartesian3对象 {x, y, z}
|
||||
);
|
||||
const longitude = Cesium.Math.toDegrees(cartographic.longitude);
|
||||
const latitude = Cesium.Math.toDegrees(cartographic.latitude);
|
||||
const height = cartographic.height;
|
||||
posiArr.push({
|
||||
lng: longitude,
|
||||
lat: latitude,
|
||||
alt: height
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
} else if (that.options.type == '点') {
|
||||
let height = await that.getClampToHeight({ lng: that.options.positions.lng, lat: that.options.positions.lat })
|
||||
posiArr = [{ lng: that.options.positions.lng, lat: that.options.positions.lat, alt: height }]
|
||||
// posiArr = [that.options.positions]
|
||||
that.pointArr = posiArr
|
||||
if (that.options.positions.lng) {
|
||||
let height = await that.getClampToHeight({ lng: that.options.positions.lng, lat: that.options.positions.lat })
|
||||
posiArr = [{ lng: that.options.positions.lng, lat: that.options.positions.lat, alt: height }]
|
||||
// posiArr = [that.options.positions]
|
||||
that.pointArr = posiArr
|
||||
}
|
||||
|
||||
}
|
||||
let params = {
|
||||
type: that.options.type,
|
||||
|
@ -29,7 +29,8 @@ import MouseTip from '../../../MouseTip'
|
||||
import {
|
||||
setSplitDirection,
|
||||
syncSplitData,
|
||||
setActiveId
|
||||
setActiveId,
|
||||
getState
|
||||
} from '../../../Global/SplitScreen'
|
||||
import {
|
||||
setActiveViewer,
|
||||
@ -197,7 +198,9 @@ class BillboardObject extends Base {
|
||||
|
||||
this.#_destroyMouseEvent = () => {
|
||||
this.attributeElm && (this.attributeElm.style.pointerEvents = 'unset')
|
||||
this.sdk.viewer._element.onmousemove = null
|
||||
if(this.sdk && this.sdk.viewer && this.sdk.viewer._element) {
|
||||
this.sdk.viewer._element.onmousemove = null
|
||||
}
|
||||
document.removeEventListener('mouseup', this.#_destroyMouseEvent)
|
||||
document.removeEventListener('mouseleave', this.#_destroyMouseEvent)
|
||||
}
|
||||
@ -2943,13 +2946,16 @@ class BillboardObject extends Base {
|
||||
attributeElm.style.left = '0px'
|
||||
attributeElm.style.width = 0
|
||||
attributeElm.style.height = 0
|
||||
if(getState()) {
|
||||
attributeElm.style.display = 'none'
|
||||
}
|
||||
// attributeElm.innerHTML = this.options.richTextContent
|
||||
this.sdk.viewer._element.appendChild(attributeElm)
|
||||
let linkHtml = ''
|
||||
let goodsHtml = ''
|
||||
let richTextHtml = ''
|
||||
for (let i = 0; i < this.options.attribute.link.content.length; i++) {
|
||||
linkHtml += `<DIV-cy-tab-pane label="${this.options.attribute.link.content[i].name}"><iframe width='100%' height='100%' src="${this.options.attribute.link.content[i].url}"></iframe></DIV-cy-tab-pane>`
|
||||
linkHtml += `<DIV-cy-tab-pane label="${this.options.attribute.link.content[i].name}"><iframe width='100%' height='100%' src="${this.options.attribute.link.content[i].url}" ></iframe></DIV-cy-tab-pane>`
|
||||
}
|
||||
if (this.options.attribute.goods && this.options.attribute.goods.content && this.options.attribute.goods.content.length > 0) {
|
||||
goodsHtml += `<DIV-cy-tab-pane label="物资">
|
||||
|
@ -181,7 +181,7 @@ class CircleDiffuse extends Base {
|
||||
}
|
||||
that.sdk._entityZIndex++
|
||||
if (that.sdk.viewer._element.className === 'cesium-viewer 2d') {
|
||||
that.entity.ellipse.height = 1000000
|
||||
that.entity.ellipse.height = 1
|
||||
}
|
||||
CircleDiffuse.createLabel(that)
|
||||
syncData(that.sdk, that.options.id)
|
||||
|
@ -348,9 +348,10 @@ class CurvelineObject extends Base {
|
||||
this._elms.lineWidth.forEach(item => {
|
||||
item.value = this.options.width
|
||||
})
|
||||
this.entity &&
|
||||
this.entity.polyline &&
|
||||
(this.entity.polyline.width = this.options.width)
|
||||
if (this.entity && this.entity.polyline) {
|
||||
this.entity.polyline.width = this.entity.polyline.width + v - this.entity.polyline.oriWidth
|
||||
this.entity.polyline.oriWidth = this.options.width
|
||||
}
|
||||
}
|
||||
|
||||
get lineType() {
|
||||
@ -1384,10 +1385,10 @@ class CurvelineObject extends Base {
|
||||
that.options.lengthByMeter = res
|
||||
that.lengthUnit = that.options['length-unit']
|
||||
syncData(that.sdk, that.options.id)
|
||||
if (that.options.show) {
|
||||
setSplitDirection(0, that.options.id)
|
||||
}
|
||||
})
|
||||
if (that.options.show) {
|
||||
setSplitDirection(0, that.options.id)
|
||||
}
|
||||
|
||||
// if (this.options['nose-to-tail']) {
|
||||
// let array = []
|
||||
|
@ -162,6 +162,7 @@ class FlyRoam extends Base {
|
||||
pitch: viewer.camera.pitch,
|
||||
roll: viewer.camera.roll
|
||||
}
|
||||
this.message({text: '操作成功'})
|
||||
})
|
||||
|
||||
let totalTimeElm = contentElm.querySelector("input[name='totalTime']")
|
||||
|
@ -376,7 +376,10 @@ class GroundSvg extends Base {
|
||||
}
|
||||
set textFontSize(v) {
|
||||
this.options.text.fontSize = v
|
||||
this.text && (this.text.fontSize = v)
|
||||
if(this.text) {
|
||||
this.text.fontSize = v
|
||||
this.text.pixelOffset = v
|
||||
}
|
||||
this._elms.textFontSize && this._elms.textFontSize.forEach((item) => {
|
||||
item.value = v
|
||||
})
|
||||
@ -909,11 +912,10 @@ class GroundSvg extends Base {
|
||||
text: that.options.text.value,
|
||||
fontSize: that.options.text.fontSize,
|
||||
color: that.options.text.color,
|
||||
pixelOffset: that.options.text.pixelOffset,
|
||||
pixelOffset: that.options.text.fontSize,
|
||||
backgroundColor: that.options.text.backgroundColor,
|
||||
lineColor: that.options.text.lineColor,
|
||||
lineWidth: that.options.text.lineWidth,
|
||||
pixelOffset: 0,
|
||||
lineColor: '#ffffff00',
|
||||
lineWidth: 0,
|
||||
scaleByDistance: that.options.text.scaleByDistance,
|
||||
backgroundColor: ['#ffffff00', '#ffffff00'],
|
||||
near: that.options.text.near,
|
||||
@ -1213,9 +1215,12 @@ class GroundSvg extends Base {
|
||||
* @param {boolean} status=false 状态
|
||||
*/
|
||||
drag(status, cd) {
|
||||
if (!this.#loaded || !this.sdk || !this.sdk.viewer) {
|
||||
if (!this.#loaded || !this.sdk || !this.sdk.viewer || !this.entity || !this.entity.values || this.entity.values.length == 0) {
|
||||
return
|
||||
}
|
||||
let greenImg = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA+0lEQVR4AZSTPQ7CMAyFk0jAFYCRCbgEbHAKBqRyKCoYOAVs5RLAQseKKxQkwntWVCltJdzK+bO/59ZW6kztGX6mi/F7dhiV0ydWzxH2B8ZquIkSAN47bzNAW2vtBKtY2G8ZIyPOMFUJxuX8DF+C8c+SwAonCSSr9SvxaCawogHrQl2aNwOPLKHWoa5N5O5woNZ575cdNBFKrQsdjgLaA7XSRK2gjWMJeVtA40MJOUvgxdHwDQYlZO5r/akRUTqoda/e4wo+xehqKbXSxKJ/3xlvL+oMYEUDgSTAaorBbY1V8yVpYIGb+G9kVtTFi3Vkh4XAFPZHxsjAVdkPAAD//0PYov0AAAAGSURBVAMA5pZjby819WUAAAAASUVORK5CYII='
|
||||
let redImg = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA1klEQVR4AZST0Q2CQBBEF0qhEfjDKvgwwaIk+kEV8oeFSCs4D4+gB4l7ZIfszc7OLXDkFl2zWSnchJcwB5DDlZHcfgwkvkowCmehENYghxuDZuU3AxUeYlvhX7RBu+iWCUSwc70wvlsdeixXwnN5do6tmaRkgiauJKwbDKqEhlhaYcAbjgvedYGBV3yow2A6rPjICQMOjk++V40Y9HvezfR5ZvaUvBNSo6OXCUzJRd2D4I0h9Gz/goiTuj2TsDNayW0zYJWZMQkH667199chh6uCRuVPvAEAAP//mBlPPAAAAAZJREFUAwAzdy+JgzpBHQAAAABJRU5ErkJggg=='
|
||||
let yellowImg = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA8ElEQVR4AZyQMY7CQAxFbbe7W7IH2GrJJaCDU1AgwaFAUHAK6OASQAM9UAJtzLxRBikUKMwo1jjf//0oNnk518t/534uZtdTcbidC6fooxZmL3apBdwv7Ym6rV1kqCp/yUwftTDDk3TuZ0D40tJdR4jvCg/e5IkBVWoviQ3uXsWI8c+kNoBqFhhYM7dBbfLBC6yVLl3JPLDGhjN5gY1LzA2AM3c50uQUrJnKWjIPrJVaLjJ5gbWf1n6j6tNPQ2Bg4xK/WrtxCFiFavqsKkZiANT377ZPKv27woM3eZ4BCKS6ll0VmbNhNIo+amGGBy3VAwAA//9///lSAAAABklEQVQDAADzbcvdBag1AAAAAElFTkSuQmCC'
|
||||
this.ismove = false
|
||||
this._isdrag = status
|
||||
if (this.ScreenSpaceEventHandler) {
|
||||
@ -1296,44 +1301,67 @@ class GroundSvg extends Base {
|
||||
angleH = bearing2 - bearingH
|
||||
if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) {
|
||||
angleW = angleW + 180
|
||||
flag=true
|
||||
flag = true
|
||||
}
|
||||
if ((angleH > -360 && angleH < -90) || (angleH < 360 && angleH > 90)) {
|
||||
angleH = angleH + 180
|
||||
flag2=true
|
||||
flag2 = true
|
||||
}
|
||||
if(flag && flag2) {
|
||||
this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
}
|
||||
else {
|
||||
if(flag) {
|
||||
this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
}
|
||||
else if(flag2) {
|
||||
this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
}
|
||||
else {
|
||||
this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
radiansW = (Math.PI / 180) * angleW
|
||||
radiansH = (Math.PI / 180) * angleH
|
||||
// 矩形高度
|
||||
w = (Math.cos(radiansW) * distance) * 2
|
||||
h = (Math.cos(radiansH) * distance) * 2
|
||||
|
||||
if(h<0) {
|
||||
flag2 = !flag2
|
||||
}
|
||||
if(w<0) {
|
||||
flag = !flag
|
||||
}
|
||||
if (flag && flag2) {
|
||||
// this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
this.pointEntityCollection.values[1].billboard.image = greenImg
|
||||
this.pointEntityCollection.values[3].billboard.image = greenImg
|
||||
this.pointEntityCollection.values[7].billboard.image = greenImg
|
||||
this.pointEntityCollection.values[9].billboard.image = redImg
|
||||
}
|
||||
else {
|
||||
if (flag) {
|
||||
// this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
// this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[1].billboard.image = greenImg
|
||||
this.pointEntityCollection.values[3].billboard.image = redImg
|
||||
this.pointEntityCollection.values[7].billboard.image = greenImg
|
||||
this.pointEntityCollection.values[9].billboard.image = greenImg
|
||||
}
|
||||
else if (flag2) {
|
||||
// this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
// this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[1].billboard.image = greenImg
|
||||
this.pointEntityCollection.values[3].billboard.image = greenImg
|
||||
this.pointEntityCollection.values[7].billboard.image = redImg
|
||||
this.pointEntityCollection.values[9].billboard.image = greenImg
|
||||
}
|
||||
else {
|
||||
// this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
// this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[1].billboard.image = redImg
|
||||
this.pointEntityCollection.values[3].billboard.image = greenImg
|
||||
this.pointEntityCollection.values[7].billboard.image = greenImg
|
||||
this.pointEntityCollection.values[9].billboard.image = greenImg
|
||||
}
|
||||
}
|
||||
// scaleY值
|
||||
this.scale.x = Math.abs(w) / 3.5
|
||||
this.scale.y = Math.abs(h) / 3.5
|
||||
@ -1345,12 +1373,16 @@ class GroundSvg extends Base {
|
||||
|
||||
if ((angleH > -360 && angleH < -90) || (angleH < 360 && angleH > 90)) {
|
||||
angleH = angleH + 180
|
||||
this.pointEntityCollection.values[2].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[8].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
// this.pointEntityCollection.values[2].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[8].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
this.pointEntityCollection.values[2].billboard.image = greenImg
|
||||
this.pointEntityCollection.values[8].billboard.image = redImg
|
||||
}
|
||||
else {
|
||||
this.pointEntityCollection.values[2].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
this.pointEntityCollection.values[8].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[2].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
// this.pointEntityCollection.values[8].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[2].billboard.image = redImg
|
||||
this.pointEntityCollection.values[8].billboard.image = greenImg
|
||||
}
|
||||
|
||||
radiansH = (Math.PI / 180) * angleH
|
||||
@ -1368,37 +1400,11 @@ class GroundSvg extends Base {
|
||||
|
||||
if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) {
|
||||
angleW = angleW + 180
|
||||
flag=true
|
||||
flag = true
|
||||
}
|
||||
if ((angleH > -360 && angleH < -90) || (angleH < 360 && angleH > 90)) {
|
||||
angleH = angleH + 180
|
||||
flag2=true
|
||||
}
|
||||
if(flag && flag2) {
|
||||
this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
}
|
||||
else {
|
||||
if(flag) {
|
||||
this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
}
|
||||
else if(flag2) {
|
||||
this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
}
|
||||
else {
|
||||
this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
}
|
||||
flag2 = true
|
||||
}
|
||||
|
||||
radiansW = (Math.PI / 180) * angleW
|
||||
@ -1406,6 +1412,56 @@ class GroundSvg extends Base {
|
||||
// 矩形高度
|
||||
w = (Math.cos(radiansW) * distance) * 2
|
||||
h = (Math.cos(radiansH) * distance) * 2
|
||||
|
||||
if(h<0) {
|
||||
flag2 = !flag2
|
||||
}
|
||||
if(w<0) {
|
||||
flag = !flag
|
||||
}
|
||||
|
||||
if (flag && flag2) {
|
||||
// this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
// this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[1].billboard.image = greenImg
|
||||
this.pointEntityCollection.values[3].billboard.image = greenImg
|
||||
this.pointEntityCollection.values[7].billboard.image = redImg
|
||||
this.pointEntityCollection.values[9].billboard.image = greenImg
|
||||
}
|
||||
else {
|
||||
if (flag) {
|
||||
// this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
// this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[1].billboard.image = redImg
|
||||
this.pointEntityCollection.values[3].billboard.image = greenImg
|
||||
this.pointEntityCollection.values[7].billboard.image = greenImg
|
||||
this.pointEntityCollection.values[9].billboard.image = greenImg
|
||||
}
|
||||
else if (flag2) {
|
||||
// this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
this.pointEntityCollection.values[1].billboard.image = greenImg
|
||||
this.pointEntityCollection.values[3].billboard.image = greenImg
|
||||
this.pointEntityCollection.values[7].billboard.image = greenImg
|
||||
this.pointEntityCollection.values[9].billboard.image = redImg
|
||||
}
|
||||
else {
|
||||
// this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
// this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[1].billboard.image = greenImg
|
||||
this.pointEntityCollection.values[3].billboard.image = redImg
|
||||
this.pointEntityCollection.values[7].billboard.image = greenImg
|
||||
this.pointEntityCollection.values[9].billboard.image = greenImg
|
||||
}
|
||||
}
|
||||
// scaleY值
|
||||
this.scale.x = Math.abs(w) / 3.5
|
||||
this.scale.y = Math.abs(h) / 3.5
|
||||
@ -1416,12 +1472,16 @@ class GroundSvg extends Base {
|
||||
|
||||
if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) {
|
||||
angleW = angleW + 180
|
||||
this.pointEntityCollection.values[4].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[6].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
// this.pointEntityCollection.values[4].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[6].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
this.pointEntityCollection.values[4].billboard.image = greenImg
|
||||
this.pointEntityCollection.values[6].billboard.image = redImg
|
||||
}
|
||||
else {
|
||||
this.pointEntityCollection.values[6].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[4].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
// this.pointEntityCollection.values[6].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[4].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
this.pointEntityCollection.values[6].billboard.image = greenImg
|
||||
this.pointEntityCollection.values[4].billboard.image = redImg
|
||||
}
|
||||
|
||||
radiansW = (Math.PI / 180) * angleW
|
||||
@ -1452,12 +1512,16 @@ class GroundSvg extends Base {
|
||||
|
||||
if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) {
|
||||
angleW = angleW + 180
|
||||
this.pointEntityCollection.values[6].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[4].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
// this.pointEntityCollection.values[6].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[4].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
this.pointEntityCollection.values[6].billboard.image = greenImg
|
||||
this.pointEntityCollection.values[4].billboard.image = redImg
|
||||
}
|
||||
else {
|
||||
this.pointEntityCollection.values[4].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[6].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
// this.pointEntityCollection.values[4].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[6].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
this.pointEntityCollection.values[4].billboard.image = greenImg
|
||||
this.pointEntityCollection.values[6].billboard.image = redImg
|
||||
}
|
||||
|
||||
radiansW = (Math.PI / 180) * angleW
|
||||
@ -1522,18 +1586,22 @@ class GroundSvg extends Base {
|
||||
}
|
||||
for (let i = 0; i < this.pointEntityCollection.values.length; i++) {
|
||||
if (pickPoint && this.pointEntityCollection.values[i].id === pickPoint.id) {
|
||||
pickPoint.point.color = Cesium.Color.fromCssColorString('#ffff00')
|
||||
// pickPoint.point.color = Cesium.Color.fromCssColorString('#ffff00')
|
||||
pickPoint.billboard.image = yellowImg
|
||||
}
|
||||
else {
|
||||
switch (this.pointEntityCollection.values[i].id) {
|
||||
case 'svg-control-points_5':
|
||||
this.pointEntityCollection.values[i].point.color = Cesium.Color.fromCssColorString('#ffff00')
|
||||
// this.pointEntityCollection.values[i].point.color = Cesium.Color.fromCssColorString('#ffff00')
|
||||
this.pointEntityCollection.values[i].billboard.image = yellowImg
|
||||
break
|
||||
case 'svg-control-points_0':
|
||||
this.pointEntityCollection.values[i].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
// this.pointEntityCollection.values[i].point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
this.pointEntityCollection.values[i].billboard.image = redImg
|
||||
break
|
||||
default:
|
||||
this.pointEntityCollection.values[i].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pointEntityCollection.values[i].point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pointEntityCollection.values[i].billboard.image = greenImg
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1548,7 +1616,8 @@ class GroundSvg extends Base {
|
||||
) {
|
||||
YJ.Global.CameraController(this.sdk, false)
|
||||
this.pickPoint = pickedObject.primitive._id
|
||||
this.pickPoint.point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
// this.pickPoint.point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
this.pickPoint.billboard.image = redImg
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -1558,13 +1627,16 @@ class GroundSvg extends Base {
|
||||
YJ.Global.CameraController(this.sdk, true)
|
||||
switch (this.pickPoint.id) {
|
||||
case 'svg-control-points_4':
|
||||
this.pickPoint.point.color = Cesium.Color.fromCssColorString('#ffff00')
|
||||
// this.pickPoint.point.color = Cesium.Color.fromCssColorString('#ffff00')
|
||||
this.pickPoint.billboard.image = yellowImg
|
||||
break
|
||||
case 'svg-control-points_9':
|
||||
this.pickPoint.point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
// this.pickPoint.point.color = Cesium.Color.fromCssColorString('#ff0000')
|
||||
this.pickPoint.billboard.image = redImg
|
||||
break
|
||||
default:
|
||||
this.pickPoint.point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
// this.pickPoint.point.color = Cesium.Color.fromCssColorString('#00ff0a')
|
||||
this.pickPoint.billboard.image = greenImg
|
||||
}
|
||||
this.pickPoint = null
|
||||
}
|
||||
@ -1603,16 +1675,19 @@ class GroundSvg extends Base {
|
||||
controlPoints[9] = turf.destination(point, wh, 0 + angle, options).geometry.coordinates
|
||||
|
||||
this.controlPoints = controlPoints
|
||||
if(!this.sdk || !this.sdk.viewer) {
|
||||
if (!this.sdk || !this.sdk.viewer) {
|
||||
return
|
||||
}
|
||||
for (let i = 0; i < this.controlPoints.length; i++) {
|
||||
let color = '#00ff0a'
|
||||
let img = greenImg
|
||||
if (i === 5) {
|
||||
color = '#ffff00'
|
||||
img = yellowImg
|
||||
}
|
||||
if (i === 0) {
|
||||
color = '#ff0000'
|
||||
img = redImg
|
||||
}
|
||||
let entity = this.sdk.viewer.entities.getOrCreateEntity('svg-control-points_' + i)
|
||||
entity.show = true
|
||||
@ -1620,11 +1695,18 @@ class GroundSvg extends Base {
|
||||
entity.position = new Cesium.CallbackProperty(() => {
|
||||
return Cesium.Cartesian3.fromDegrees(...this.controlPoints[i])
|
||||
})
|
||||
entity.point = new Cesium.PointGraphics({
|
||||
color: Cesium.Color.fromCssColorString(color), // 点的颜色
|
||||
pixelSize: 10, // 点的大小
|
||||
// entity.point = new Cesium.PointGraphics({
|
||||
// color: Cesium.Color.fromCssColorString(color), // 点的颜色
|
||||
// pixelSize: 10, // 点的大小
|
||||
// heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
||||
// scaleByDistance: new Cesium.NearFarScalar(0.0, 1.0, 1.0e10, 1.0),
|
||||
// disableDepthTestDistance: Number.POSITIVE_INFINITY // 不应用深度测试
|
||||
// })
|
||||
entity.billboard = new Cesium.BillboardGraphics({
|
||||
image: img,
|
||||
width: 10,
|
||||
height: 10,
|
||||
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
||||
scaleByDistance: new Cesium.NearFarScalar(0.0, 1.0, 1.0e10, 1.0),
|
||||
disableDepthTestDistance: Number.POSITIVE_INFINITY // 不应用深度测试
|
||||
})
|
||||
this.pointEntityCollection.add(entity)
|
||||
@ -1846,7 +1928,7 @@ class GroundSvg extends Base {
|
||||
})
|
||||
this.hierarchys = [...hierarchys]
|
||||
|
||||
if (!this.entity) {
|
||||
if (!this.entity || !this.entity.values || this.entity.values.length == 0) {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -1410,10 +1410,10 @@ class PolylineObject extends Base {
|
||||
that.options.lengthByMeter = res
|
||||
that.lengthUnit = that.options['length-unit']
|
||||
syncData(that.sdk, that.options.id)
|
||||
if (that.options.show) {
|
||||
setSplitDirection(0, that.options.id)
|
||||
}
|
||||
})
|
||||
if (that.options.show) {
|
||||
setSplitDirection(0, that.options.id)
|
||||
}
|
||||
|
||||
|
||||
// if (this.options['nose-to-tail']) {
|
||||
|
@ -138,7 +138,7 @@ class RadarScan extends Base {
|
||||
})
|
||||
that.sdk._entityZIndex++
|
||||
if (that.sdk.viewer._element.className === 'cesium-viewer 2d') {
|
||||
that.entity.ellipse.height = 1000000
|
||||
that.entity.ellipse.height = 1
|
||||
}
|
||||
RadarScan.createLabel(that)
|
||||
syncData(that.sdk, that.options.id)
|
||||
|
@ -2,6 +2,7 @@
|
||||
* 文本框
|
||||
*/
|
||||
import Base from "../index";
|
||||
import { syncData, getSdk } from '../../../Global/MultiViewportMode'
|
||||
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global'
|
||||
class TextBox extends Base {
|
||||
/**
|
||||
@ -29,7 +30,15 @@ class TextBox extends Base {
|
||||
this.textDom = undefined
|
||||
this.create(this)
|
||||
this.sdk.addIncetance(this.options.id, this)
|
||||
|
||||
this.callback = callback
|
||||
|
||||
syncData(this.sdk, this.options.id)
|
||||
|
||||
}
|
||||
|
||||
get type() {
|
||||
return 'TextBox'
|
||||
}
|
||||
|
||||
async create(that) {
|
||||
@ -38,6 +47,7 @@ class TextBox extends Base {
|
||||
let dom = document.createElement('span');
|
||||
dom.id = that.options.id
|
||||
dom.className = 'popup-textarea'
|
||||
dom.style.zIndex = 1
|
||||
// 创建textarea元素
|
||||
var textarea = document.createElement('textarea');
|
||||
textarea.className = 'textarea'
|
||||
@ -124,11 +134,49 @@ class TextBox extends Base {
|
||||
}
|
||||
async getwords(words) {
|
||||
this.options.text = words
|
||||
this.callback(this.options)
|
||||
|
||||
let { sdkP } = getSdk()
|
||||
if (this.sdk === sdkP && sdkP) {//三维
|
||||
this.callback(this.options)
|
||||
syncData(this.sdk, this.options.id)
|
||||
}
|
||||
else if (sdkP) {//二维
|
||||
sdkP.entityMap.get(this.options.id).text = words
|
||||
sdkP.entityMap.get(this.options.id).twoToThree(this.options.position)
|
||||
} else if (!sdkP) {
|
||||
this.callback(this.options)
|
||||
syncData(this.sdk, this.options.id)
|
||||
}
|
||||
}
|
||||
async twoToThree(position) {
|
||||
let that = this
|
||||
that.sdk.viewer.scene.postRender.removeEventListener(that.handler);
|
||||
let posi = Cesium.Cartesian3.fromDegrees(position.lng, position.lat, position.alt)
|
||||
|
||||
that.handler = function () {
|
||||
const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates(
|
||||
that.sdk.viewer.scene, posi
|
||||
);
|
||||
if (position) {
|
||||
let width = that.textDom.clientWidth * 1
|
||||
let height = that.textDom.clientHeight * 1
|
||||
that.textDom.style.left = `${position.x - width / 2}px`;
|
||||
that.textDom.style.top = `${position.y - height}px`;
|
||||
}
|
||||
}
|
||||
that.sdk.viewer.scene.postRender.addEventListener(that.handler);
|
||||
}
|
||||
async returnFun() {
|
||||
return this.handler
|
||||
}
|
||||
get text() {
|
||||
return this.options.text
|
||||
}
|
||||
set text(val) {
|
||||
this.options.text = val
|
||||
this.textDom.querySelector('textarea').value = val
|
||||
this.callback(this.options)
|
||||
}
|
||||
get onClick() {
|
||||
return this.clickCallBack
|
||||
}
|
||||
@ -145,6 +193,7 @@ class TextBox extends Base {
|
||||
set show(v) {
|
||||
this.options.show = v
|
||||
this.textDom && (this.textDom.style.display = v ? 'block' : 'none');
|
||||
syncData(this.sdk, this.options.id)
|
||||
}
|
||||
get position() {
|
||||
return this.options.position
|
||||
@ -235,6 +284,8 @@ class TextBox extends Base {
|
||||
if (this.textDom && this.textDom.parentNode) {
|
||||
this.sdk.viewer.cesiumWidget.container.removeChild(this.textDom);
|
||||
}
|
||||
await this.sdk.removeIncetance(this.options.id)
|
||||
syncData(this.sdk, this.options.id)
|
||||
}
|
||||
|
||||
flicker() { }
|
||||
|
@ -187,7 +187,7 @@ function html() {
|
||||
<div class="col">
|
||||
<span class="label">油耗</span>
|
||||
<div class="input-number input-number-unit-6" style="width: 170px;">
|
||||
<input class="input" type="number" title="" min="1" max="99999999" @model="unitFuelConsumption">
|
||||
<input class="input" type="number" title="" min="0" max="99999999" @model="unitFuelConsumption">
|
||||
<span class="unit">L/100km</span>
|
||||
<span class="arrow"></span>
|
||||
</div>
|
||||
|
@ -1764,9 +1764,10 @@ class TrajectoryMotion extends Base {
|
||||
if (!cartesian3) {
|
||||
return
|
||||
}
|
||||
coordinates = _this.cartesian3Towgs84(cartesian3, viewer);
|
||||
let pos84 = _this.cartesian3Towgs84(cartesian3, viewer);
|
||||
coordinates = [pos84.lng, pos84.lat, pos84.alt + 1.8]
|
||||
position = cartesian3
|
||||
positionCamera = Cesium.Cartesian3.fromDegrees(coordinates.lng, coordinates.lat, coordinates.alt + 1.8)
|
||||
positionCamera = Cesium.Cartesian3.fromDegrees(coordinates[0], coordinates[1], coordinates[2])
|
||||
let positions_smooth = []
|
||||
for (let i = 0; i <= 1000; i++) {
|
||||
if ((i / 1000) > (distance / _this.distance)) {
|
||||
@ -1890,7 +1891,7 @@ class TrajectoryMotion extends Base {
|
||||
else {
|
||||
if (_this.sdk.viewer.trackedEntity) {
|
||||
_this.sdk.viewer.camera.setView({
|
||||
destination: Cesium.Cartesian3.fromDegrees(coordinates.lng, coordinates.lat, _this.sdk.viewer.camera.positionCartographic.height),
|
||||
destination: Cesium.Cartesian3.fromDegrees(coordinates[0], coordinates[1], _this.sdk.viewer.camera.positionCartographic.height),
|
||||
orientation: {
|
||||
heading: Cesium.Math.toRadians(-90),
|
||||
pitch: 0,
|
||||
@ -2323,7 +2324,7 @@ class TrajectoryMotion extends Base {
|
||||
this.model && (this.model.show = false)
|
||||
}
|
||||
this.labelShow = this.originalOptions.label.show
|
||||
this.fuelLabelShow = this.originalOptions.fuelShow
|
||||
this.fuelShow = this.originalOptions.fuelShow
|
||||
this.labelColor = this.originalOptions.label.color
|
||||
this.labelFontSize = this.originalOptions.label.fontSize
|
||||
this.labelFontFamily = this.originalOptions.label.fontFamily
|
||||
|
@ -137,7 +137,7 @@ class Base extends Tools {
|
||||
this.originalOptions.show = v
|
||||
}
|
||||
}
|
||||
this.entity._showView = this.showView
|
||||
this.entity && (this.entity._showView = this.showView)
|
||||
if (this.type == 'layer') {
|
||||
if (this.entity) {
|
||||
this.entity._objectState = this.options.show
|
||||
|
@ -100,7 +100,7 @@ function attributeElm(that) {
|
||||
let tr = `
|
||||
<div class="tr">
|
||||
<div class="td">
|
||||
<input type="checkbox" value="${'ID' in data.data.list[i] ? data.data.list[i].ID : data.data.list[i].id}">
|
||||
<input type="checkbox" value="${data.data.list[i].deviceId}">
|
||||
<span>绑定</span>
|
||||
</div>
|
||||
<div class="td">${data.data.list[i].cameraName}</div>
|
||||
@ -126,11 +126,8 @@ function attributeElm(that) {
|
||||
}
|
||||
else {
|
||||
let newArray = that.attributeCamera.filter((item) => {
|
||||
if ('ID' in data.data.list[i]) {
|
||||
return item.ID !== data.data.list[i].ID
|
||||
}
|
||||
else {
|
||||
return item.id !== data.data.list[i].id
|
||||
if ('deviceId' in data.data.list[i]) {
|
||||
return item.deviceId !== data.data.list[i].deviceId
|
||||
}
|
||||
})
|
||||
that.attributeCamera = newArray
|
||||
@ -139,7 +136,7 @@ function attributeElm(that) {
|
||||
tableContent.appendChild(trElm)
|
||||
|
||||
for (let m = 0; m < that.attributeCamera.length; m++) {
|
||||
if (('ID' in data.data.list[i]) ? (that.attributeCamera[m].ID === data.data.list[i].ID) : (that.attributeCamera[m].id === data.data.list[i].id)) {
|
||||
if (('deviceId' in data.data.list[i]) ? (that.attributeCamera[m].deviceId === data.data.list[i].deviceId):false) {
|
||||
checkbox.checked = true
|
||||
break
|
||||
}
|
||||
@ -200,17 +197,9 @@ function attributeElm(that) {
|
||||
for (let i = that.attributeCamera.length - 1; i >= 0; i--) {
|
||||
let flag = false
|
||||
for (let m = 0; m < data.data.list.length; m++) {
|
||||
if ('ID' in data.data.list[m]) {
|
||||
if (that.attributeCamera[i].ID === data.data.list[m].ID) {
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if ('id' in data.data.list[m]) {
|
||||
if (that.attributeCamera[i].id === data.data.list[m].id) {
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
if (that.attributeCamera[i].deviceId === data.data.list[m].deviceId) {
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
|
@ -50,7 +50,8 @@ export default class CircleDiffuseMaterialProperty {
|
||||
let color = this.colors[ratio[i]]
|
||||
_sourceColor = _sourceColor + `
|
||||
if(dis < float(${Number(ratio[i]) / 2})) {
|
||||
material.diffuse = 1.5 * vec4(${color.red},${color.green},${color.blue},${color.alpha}).rgb;
|
||||
material.diffuse = vec4(0.0,0.0,0.0,0.0).rgb;
|
||||
material.emission = 1.0 * vec4(${color.red},${color.green},${color.blue},${color.alpha}).rgb;
|
||||
}
|
||||
`
|
||||
}
|
||||
@ -110,7 +111,7 @@ export default class CircleDiffuseMaterialProperty {
|
||||
transparency: 1,
|
||||
count: 4,
|
||||
gradient: 0.2,
|
||||
frameNumber: Cesium.getTimestamp(),
|
||||
frameNumber: Cesium.getTimestamp(),
|
||||
},
|
||||
source: this._source,
|
||||
},
|
||||
|
@ -1493,6 +1493,30 @@ class Tools {
|
||||
}
|
||||
}
|
||||
|
||||
message(option = {}) {
|
||||
let type = option.type || 'success'
|
||||
let text = option.text || ''
|
||||
let duration = option.duration || 1500
|
||||
|
||||
let message = document.getElementById('YJ-custom-message');
|
||||
if (message) {
|
||||
document.body.removeChild(message)
|
||||
}
|
||||
message = document.createElement('div')
|
||||
message.id = 'YJ-custom-message'
|
||||
if (type == 'success') {
|
||||
message.innerHTML = `
|
||||
<i><?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1755929961282" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5064" width="16" height="16" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M874.119618 149.859922A510.816461 510.816461 0 0 0 511.997 0.00208a509.910462 509.910462 0 0 0-362.119618 149.857842c-199.817789 199.679789-199.817789 524.581447 0 724.260236a509.969462 509.969462 0 0 0 362.119618 149.857842A508.872463 508.872463 0 0 0 874.119618 874.120158c199.836789-199.679789 199.836789-524.581447 0-724.260236zM814.94268 378.210681L470.999043 744.132295a15.359984 15.359984 0 0 1-5.887994 4.095996c-1.751998 1.180999-2.913997 2.362998-5.276994 2.913997a34.499964 34.499964 0 0 1-13.469986 2.914997 45.547952 45.547952 0 0 1-12.897986-2.303998l-4.095996-2.363997a45.291952 45.291952 0 0 1-7.009992-4.095996l-196.902793-193.789796a34.126964 34.126964 0 0 1-10.555989-25.186973c0-9.37399 3.583996-18.74698 9.98399-25.186974a36.429962 36.429962 0 0 1 50.372947 0l169.98382 167.423824L763.389735 330.220732a37.059961 37.059961 0 0 1 50.371947-1.732998 33.647965 33.647965 0 0 1 11.165988 25.186973 35.544963 35.544963 0 0 1-9.98399 24.575974v-0.04z m0 0" fill="#52C41A" p-id="5065"></path></svg></i>${text}
|
||||
`
|
||||
} else if (type == 'warning') {
|
||||
message.innerHTML = `
|
||||
<i><?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1756093599258" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1648" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16"><path d="M512.002558 64.24521c-247.292176 0-447.75786 200.464661-447.75786 447.756837 0 247.287059 200.464661 447.752744 447.75786 447.752744 247.286036 0 447.75172-200.464661 447.75172-447.752744C959.754279 264.710894 759.288594 64.24521 512.002558 64.24521zM512.010745 735.87586c-20.602224 0-37.319977-16.718777-37.319977-37.323047 0-20.597107 16.717753-37.319977 37.319977-37.319977 20.60427 0 37.297464 16.72287 37.297464 37.319977C549.308209 719.158107 532.613992 735.87586 512.010745 735.87586zM549.308209 567.969733c0 20.600177-16.693194 37.293371-37.297464 37.293371-20.602224 0-37.319977-16.693194-37.319977-37.293371L474.690768 325.420581c0-20.605294 16.717753-37.297464 37.319977-37.297464 20.60427 0 37.297464 16.693194 37.297464 37.297464L549.308209 567.969733z" fill="#e98f36" p-id="1649"></path></svg></i>${text}
|
||||
`
|
||||
}
|
||||
|
||||
document.body.appendChild(message)
|
||||
message.classList.add(type)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@ import AModelLoader from '../Obj/Base/LoadObjModel/AModelLoader'
|
||||
import { setSvg } from '../Obj/Element/svg'
|
||||
import Tools from '../Tools'
|
||||
import { Proj } from '../Tools/proj'
|
||||
import { syncData, getSdk } from '../Global/MultiViewportMode'
|
||||
import {
|
||||
unRegLeftClickCallback,
|
||||
unRegRightClickCallback,
|
||||
@ -151,7 +152,7 @@ class YJEarth {
|
||||
}
|
||||
this.options.contextOptions = {
|
||||
webgl: {
|
||||
alpha: true,
|
||||
// alpha: true,
|
||||
depth: true,
|
||||
stencil: true,
|
||||
antialias: true,
|
||||
@ -419,7 +420,8 @@ class YJEarth {
|
||||
|
||||
let ClickHandler = new Cesium.ScreenSpaceEventHandler(_this.viewer.canvas)
|
||||
ClickHandler.setInputAction((movement) => {
|
||||
let textList = document.getElementsByClassName('popup-textarea')
|
||||
// let textList = document.getElementsByClassName('popup-textarea')
|
||||
let textList = _this.viewer._element.getElementsByClassName('popup-textarea')
|
||||
_this.isLeftClick = false
|
||||
for (let i = textList.length - 1; i > -1; i--) {
|
||||
let left = returnNumber(textList[i].style.left)
|
||||
@ -431,12 +433,24 @@ class YJEarth {
|
||||
if (x > left && x < left + width && y > top && y < top + height) {
|
||||
if (_this.clickTextDom) {
|
||||
_this.clickTextDom.style['pointer-events'] = 'none'
|
||||
_this.clickTextDom.querySelector('textarea').removeEventListener('blur', _this.blurFun)
|
||||
}
|
||||
|
||||
_this.clickTextDom = textList[i]
|
||||
textList[i].style['pointer-events'] = 'all'
|
||||
textList[i].querySelector('textarea').focus()
|
||||
_this.isLeftClick = true
|
||||
_this.entityMap.get(_this.clickTextDom.id).isClick(movement.position, _this.clickTextDom.id)
|
||||
_this.blurFun = () => {
|
||||
// let { sdkP } = getSdk()
|
||||
// if (_this == sdkP && sdkP) {//二维
|
||||
// _this.entityMap.get(_this.clickTextDom.id).getwords(_this.clickTextDom.getElementsByTagName('textarea')[0].value)
|
||||
// } else if (!sdkP) {
|
||||
_this.entityMap.get(_this.clickTextDom.id).getwords(_this.clickTextDom.getElementsByTagName('textarea')[0].value)
|
||||
// }
|
||||
_this.clickTextDom.querySelector('textarea').removeEventListener('blur', _this.blurFun)
|
||||
}
|
||||
_this.clickTextDom.querySelector('textarea').addEventListener('blur', _this.blurFun)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -458,7 +472,7 @@ class YJEarth {
|
||||
click = true
|
||||
}
|
||||
mousemove = function (e) {
|
||||
if (!click) {
|
||||
if (!click || !_this.clickTextDom) {
|
||||
return
|
||||
}
|
||||
let width = _this.clickTextDom.clientWidth * 1
|
||||
@ -467,6 +481,11 @@ class YJEarth {
|
||||
x: e.clientX - layerX + width / 2,
|
||||
y: e.clientY - layerY + height,
|
||||
}
|
||||
let { sdkP } = getSdk()
|
||||
if (_this != sdkP && sdkP) {//二维
|
||||
let num = sdkP.viewer._element.clientWidth
|
||||
param.x = param.x - num
|
||||
}
|
||||
_this.entityMap.get(_this.clickTextDom.id).setHandeler(param)
|
||||
|
||||
}
|
||||
@ -478,15 +497,15 @@ class YJEarth {
|
||||
}
|
||||
|
||||
_this.clickTextDom.addEventListener('mousedown', mousedown);
|
||||
document.addEventListener('mousemove', mousemove);
|
||||
document.addEventListener('mouseup', mouseup);
|
||||
_this.viewer._element.addEventListener('mousemove', mousemove);
|
||||
_this.viewer._element.addEventListener('mouseup', mouseup);
|
||||
}
|
||||
// 点击其他地方取消
|
||||
if (!_this.isLeftClick && _this.clickTextDom) {
|
||||
_this.clickTextDom.removeEventListener('mousedown', mousedown);
|
||||
document.removeEventListener('mousemove', mousemove);
|
||||
document.removeEventListener('mouseup', mouseup);
|
||||
_this.entityMap.get(_this.clickTextDom.id).getwords(_this.clickTextDom.getElementsByTagName('textarea')[0].value)
|
||||
_this.viewer._element.removeEventListener('mousemove', mousemove);
|
||||
_this.viewer._element.removeEventListener('mouseup', mouseup);
|
||||
// _this.entityMap.get(_this.clickTextDom.id).getwords(_this.clickTextDom.getElementsByTagName('textarea')[0].value)
|
||||
|
||||
_this.clickTextDom.style['pointer-events'] = 'none'
|
||||
_this.clickTextDom = undefined
|
||||
|
@ -3493,6 +3493,7 @@
|
||||
cursor: e-resize;
|
||||
background-color: #d3d3d3;
|
||||
user-select: none;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.cesium-performanceDisplay-defaultContainer {
|
||||
@ -3762,4 +3763,61 @@
|
||||
|
||||
.billboard-attribute-box .table .table-body .tr:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* 自定义提示 */
|
||||
#YJ-custom-message {
|
||||
/* 固定在顶部中央 */
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
transform: translate(-50%, 0%);
|
||||
/* 初始位置在屏幕顶部外 */
|
||||
|
||||
/* 样式美化 */
|
||||
display: flex;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
padding: 15px 20px;
|
||||
width: 380px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
z-index: 9999999;
|
||||
|
||||
|
||||
/* 动画定义 */
|
||||
animation: YJ-custom-message-slideDown 0.5s forwards,
|
||||
YJ-custom-message-fadeOut 0.5s 1500ms forwards;
|
||||
}
|
||||
|
||||
#YJ-custom-message i {
|
||||
margin: 2px 10px 0 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 16px;
|
||||
}
|
||||
|
||||
#YJ-custom-message.success {
|
||||
background-color: #f0f9eb;
|
||||
color: rgb(82, 196, 26);
|
||||
}
|
||||
#YJ-custom-message.warning {
|
||||
background-color: #fdf6ec;
|
||||
color: #e6a23c;
|
||||
}
|
||||
|
||||
/* 滑入动画 */
|
||||
@keyframes YJ-custom-message-slideDown {
|
||||
to {
|
||||
top: 20px;
|
||||
/* 移动到屏幕顶部 */
|
||||
}
|
||||
}
|
||||
|
||||
/* 淡出动画 - 1500ms后执行 */
|
||||
@keyframes YJ-custom-message-fadeOut {
|
||||
to {
|
||||
opacity: 0;
|
||||
top: -200px
|
||||
/* 移回顶部外 */
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user