Compare commits

..

28 Commits

Author SHA1 Message Date
zh
be1614b50b 提交 2025-08-26 18:53:05 +08:00
zh
8287a00832 提交 2025-08-25 13:56:57 +08:00
zh
5dd7303a6a Merge branch 'project' of http://xny.yj-3d.com:3000/zh/sdk4.0 into project 2025-08-25 11:03:04 +08:00
zh
56910ff8ab Merge branch 'master' of http://xny.yj-3d.com:3000/zh/sdk4.0 into project 2025-08-25 11:01:12 +08:00
zh
229fd9037f Merge branch 'master' of http://xny.yj-3d.com:3000/zh/sdk4.0 into project 2025-08-25 10:51:19 +08:00
zh
24a0078eea 增加自定义提示 2025-08-25 10:43:50 +08:00
zh
6c84baa3c2 材质颜色 2025-08-23 03:31:02 +08:00
zh
22e4652528 贴地svg编辑 2025-08-23 03:30:54 +08:00
zh
c6f3138e25 Merge branch 'develop' of http://xny.yj-3d.com:3000/zh/sdk4.0 2025-08-23 03:25:30 +08:00
819166bae0 文本框点击判断 2025-08-23 03:21:18 +08:00
zh
159ade36f0 Merge branch 'develop' of http://xny.yj-3d.com:3000/zh/sdk4.0 2025-08-23 02:36:26 +08:00
zh
f8443b7f62 优化贴地文字、立体文字颜色 2025-08-23 02:36:17 +08:00
zh
7feab0786a 解决贴地svg编辑时拖动出现负数的问题 2025-08-23 02:35:50 +08:00
5ceaa3b649 文本框位置 2025-08-23 01:17:51 +08:00
9f216b7257 Merge branch 'develop' of http://xny.yj-3d.com:3000/zh/sdk4.0 into develop 2025-08-23 00:07:19 +08:00
4247327bfa 修改文本框位置问题 2025-08-23 00:07:15 +08:00
zh
1a394336ff 修改 2025-08-22 23:53:49 +08:00
zh
1856bc85e3 Merge branch 'master' of http://xny.yj-3d.com:3000/zh/sdk4.0 into develop 2025-08-22 23:50:31 +08:00
zh
dff3739a0f 属性框线条样式 2025-08-22 23:50:22 +08:00
zh
53d2f06918 Merge branch 'develop' of http://xny.yj-3d.com:3000/zh/sdk4.0 2025-08-22 23:49:11 +08:00
zh
cb2741862a 解决二三维鼠标事件绑定问题 2025-08-22 23:48:51 +08:00
zh
ce065fb845 二三维模式标签同步 2025-08-22 21:55:50 +08:00
zh
1d6b635f7a Merge branch 'master' of http://xny.yj-3d.com:3000/zh/sdk4.0 into project 2025-08-22 17:52:43 +08:00
zh
5b788a74d4 修改 2025-08-22 17:52:32 +08:00
zh
65ee6b70ba 解决立体模式下高度修改不生效的问题 2025-08-20 15:51:56 +08:00
zh
ed18fd776b 贴地svg编辑点,用billboard替代point,解决点大小异常的问题 2025-08-20 15:20:20 +08:00
zh
dd7af5aa4d 修改立体模式下文字偏移范围 2025-08-20 15:19:19 +08:00
zh
56ad8ae7a0 贴地svg增加立体模式和锚点设置 2025-08-20 11:05:26 +08:00
42 changed files with 2585 additions and 904 deletions

View File

@ -135,6 +135,7 @@ const open = async (sdk, options = {}, _Dialog = {}) => {
pitch: viewer.camera.pitch, pitch: viewer.camera.pitch,
roll: viewer.camera.roll roll: viewer.camera.roll
} }
tools.message({text: '操作成功'})
}) })
let totalTimeElm = contentElm.querySelector("input[name='totalTime']") let totalTimeElm = contentElm.querySelector("input[name='totalTime']")

View File

@ -0,0 +1,578 @@
/**
* @name: click
* @author: Administrator
* @date: 2023-05-28 11:05
* @descriptionclick
* @update: 2023-05-28 11:05
*/
let leftClickHandler = null
let rightClickHandler = null
let MoveHandler = null
let leftClickCallbackMap = new Map()
let rightClickCallbackMap = new Map()
let MoveCallbackMap = new Map()
let selectedFeature;
function cartesian3Towgs84(cartesian, viewer) {
var ellipsoid = viewer.scene.globe.ellipsoid
var cartesian3 = new Cesium.Cartesian3(
cartesian.x,
cartesian.y,
cartesian.z
)
var cartographic = ellipsoid.cartesianToCartographic(cartesian3)
var lat = Cesium.Math.toDegrees(cartographic.latitude)
var lng = Cesium.Math.toDegrees(cartographic.longitude)
var alt = cartographic.height < 0 ? 0 : cartographic.height
return {
lng: lng,
lat: lat,
alt: alt,
}
}
function getcartesian(sdk, movement) {
if (movement.endPosition) {
movement.endPosition.y -= 2
}
let position = movement.position || movement.endPosition
// 获取世界坐标系地表坐标,考虑地形,不包括模型,倾斜摄影模型表面;
let cartesian = sdk.viewer.scene.pickPosition(position)
if (!cartesian) {
const ray = sdk.viewer.camera.getPickRay(position); //相交的射线
cartesian = sdk.viewer.scene.globe.pick(ray, sdk.viewer.scene);
}
return cartesian
}
function openLeftClick(sdk, cb) {
if (!sdk || !sdk.viewer) {
return
}
let click = true
leftClickHandler = new Cesium.ScreenSpaceEventHandler(sdk.viewer.canvas)
leftClickHandler.setInputAction((movement) => {
let cartesian = sdk.viewer.scene.pickPosition(movement.position)
if (!cartesian) {
const ray = sdk.viewer.camera.getPickRay(movement.position); //相交的射线
cartesian = sdk.viewer.scene.globe.pick(ray, sdk.viewer.scene);
}
if (!cartesian) {
return
}
let pos84 = cartesian3Towgs84(cartesian, sdk.viewer)
cb && cb(pos84)
if (click) {
click = false
setTimeout(() => {
click = true
}, 600);
if (!YJ.Measure.GetMeasureStatus() && cartesian) {
let flag = false
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.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)
flag = true
break
}
}
}
}
// 聚集地
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)
flag = true
break
}
}
}
}
// 单箭头
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)
flag = true
break
}
}
}
}
// 双箭头
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)
flag = true
break
}
}
}
}
// 圆
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)
flag = true
break
}
}
}
}
// 扇形
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)
flag = true
break
}
}
}
}
}
}
}
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)
}
}
}
}
}
}
}
}
// if (click) {
// click = false
// setTimeout(() => {
// click = true
// }, 300);
// if (!YJ.Measure.GetMeasureStatus()) {
// }
// }
}, Cesium.ScreenSpaceEventType.LEFT_CLICK)
// leftClickHandler.setInputAction(function (movement) {
// const feature = sdk.viewer.scene.pick(movement.endPosition);
// // unselectFeature(selectedFeature);
// if (selectedFeature) {
// selectedFeature.color = Cesium.Color.WHITE;
// }
// selectedFeature = feature
// if (feature) {
// feature.color = Cesium.Color.YELLOW;
// }
// }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
// }
}
function closeLeftClick(sdk) {
leftClickHandler.destroy() //关闭事件句柄
leftClickHandler = null
// }
}
function openRightClick(sdk) {
if (!sdk || !sdk.viewer) {
return
}
rightClickHandler = new Cesium.ScreenSpaceEventHandler(sdk.viewer.canvas)
rightClickHandler.setInputAction((movement) => {
if (!YJ.Measure.GetMeasureStatus()) {
const pick = sdk.viewer.scene.pick(movement.position)
if (pick && pick.id) {
let id
if (pick.id.type && pick.id.type === 'vector' && pick.id.parentId) {
let obj = rightClickCallbackMap.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 === 'string') {
id = pick.id
}
else {
id = pick.id.id
}
if (rightClickCallbackMap.has(id)) {
let obj = rightClickCallbackMap.get(id)
if (obj.that.picking) {
let cartesian = getcartesian(sdk, movement)
if (!cartesian) {
return
}
obj.callback(
movement,
id,
cartesian3Towgs84(cartesian, sdk.viewer), obj.that)
}
}
}
}
if (pick && pick.content) {
if (rightClickCallbackMap.has(pick.content.tileset.id)) {
let obj = rightClickCallbackMap.get(pick.content.tileset.id)
if (obj.that.picking) {
if (obj.that.type === 'bim') {
if (YJ.Global.getBimPickStatus(sdk)) {
let cartesian = getcartesian(sdk, movement)
if (!cartesian) {
return
}
obj.callback(
movement,
pick.getProperty('id'),
cartesian3Towgs84(cartesian, sdk.viewer), obj.that)
}
}
else {
let cartesian = getcartesian(sdk, movement)
if (!cartesian) {
return
}
obj.callback(
movement,
pick.content.tileset.id,
cartesian3Towgs84(cartesian, sdk.viewer), obj.that)
}
}
}
}
}
}, Cesium.ScreenSpaceEventType.RIGHT_CLICK)
}
function closeRightClick() {
if (rightClickHandler) {
rightClickHandler.destroy() //关闭事件句柄
rightClickHandler = null
}
}
function openMove(sdk) {
MoveHandler = new Cesium.ScreenSpaceEventHandler(sdk.viewer.canvas)
MoveHandler.setInputAction(function (movement) {
const pick = sdk.viewer.scene.pick(movement.endPosition);
// unselectFeature(selectedFeature);
// if (selectedFeature) {
// let color = '#fff'
// let state = selectedFeature.getProperty('state')
// switch (state) {
// case '0':
// color = '#fff'
// break;
// case '1':
// color = '#f00'
// break;
// case '2':
// color = '#0f0'
// break;
// case '3':
// color = '#00f'
// break;
// default:
// }
// selectedFeature.color = Cesium.Color.fromCssColorString(color).withAlpha(selectedFeature.tileset.transparency)
// }
// if (pick && pick.id) { }
// if (pick && pick.content) {
// if (MoveCallbackMap.has(pick.content.tileset.id)) {
// let obj = MoveCallbackMap.get(pick.content.tileset.id)
// if (obj.that.picking) {
// if (obj.that.type === 'bim') {
// if (YJ.Global.getBimPickStatus(sdk)) {
// selectedFeature = pick
// pick.color = Cesium.Color.YELLOW;
// }
// else {
// selectedFeature = null
// }
// }
// else {
// selectedFeature = pick
// pick.color = Cesium.Color.YELLOW;
// }
// }
// else {
// selectedFeature = null
// }
// }
// }
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
}
function closeMove() {
if (MoveHandler) {
MoveHandler.destroy() //关闭事件句柄
MoveHandler = null
}
}
/*注册左键回调*/
function regLeftClickCallback(id, callback, that) {
leftClickCallbackMap.set(id, { callback, that })
}/*取消左键回调*/
function unRegLeftClickCallback(id,) {
leftClickCallbackMap.delete(id,)
}
/*注册右键回调*/
function regRightClickCallback(id, callback, that) {
rightClickCallbackMap.set(id, { callback, that })
}/*取消右键回调*/
function unRegRightClickCallback(id,) {
rightClickCallbackMap.delete(id,)
}
/*注册左键回调*/
function regMoveCallback(id, callback, that) {
MoveCallbackMap.set(id, { callback, that })
}/*取消左键回调*/
function unregMoveCallback(id,) {
MoveCallbackMap.delete(id,)
}
function getLeftClickState() {
if (leftClickHandler) {
return true
}
else {
false
}
}
function getRightClickState() {
if (rightClickHandler) {
return true
}
else {
false
}
}
function getMoveState() {
if (MoveHandler) {
return true
}
else {
false
}
}
export { openLeftClick, closeLeftClick, regLeftClickCallback, unRegLeftClickCallback, openRightClick, closeRightClick, regRightClickCallback, unRegRightClickCallback, openMove, closeMove, regMoveCallback, unregMoveCallback, getLeftClickState, getRightClickState, getMoveState }

View File

@ -7,6 +7,9 @@ import { CesiumContainer } from '../global'
import { off as offSplitScreen } from "../SplitScreen"; import { off as offSplitScreen } from "../SplitScreen";
import { FlwStatusSwitch, JwwStatusSwitch, getFlwStatus, getJwwStatus } from "../global" import { FlwStatusSwitch, JwwStatusSwitch, getFlwStatus, getJwwStatus } from "../global"
import { SheetIndexStatusSwitch, getStatus } from '../SheetIndex' import { SheetIndexStatusSwitch, getStatus } from '../SheetIndex'
import { getLeftClickState, getRightClickState, getMoveState } from "../../Global/ClickCallback"
import { openLeftClick, openRightClick, openMove } from "./ClickCallback"
let sdk2D let sdk2D
let sdk3D let sdk3D
@ -32,6 +35,16 @@ async function init(sdk) {
}) })
sdk2.viewer.scene.mode = Cesium.SceneMode.SCENE2D sdk2.viewer.scene.mode = Cesium.SceneMode.SCENE2D
sdk2D = await sdk2 sdk2D = await sdk2
if(getLeftClickState()) {
openLeftClick(sdk2D)
}
if(getRightClickState()) {
openRightClick(sdk2D)
}
if(getMoveState()) {
openMove(sdk2D)
}
// window.sdk2D = sdk2D // window.sdk2D = sdk2D
solveBug() solveBug()
syncObject = { sdks: [sdk, sdk2], tools } syncObject = { sdks: [sdk, sdk2], tools }

View File

@ -100,14 +100,14 @@ function MouseRightMenu(sdk, status, callBack) {
that = sdk.entityMap.get(entityId) that = sdk.entityMap.get(entityId)
} }
if (that && that.picking) { // if (that && that.picking) {
addedMenu = ` // addedMenu = `
<span class="divider" style="display: block;border-top: 1px solid #ddd;margin: 5px;"></span> // <span class="divider" style="display: block;border-top: 1px solid #ddd;margin: 5px;"></span>
<ul class="added" style="list-style: none;padding: 0;margin: 0;font-size: 12px;"> // <ul class="added" style="list-style: none;padding: 0;margin: 0;font-size: 12px;">
<li style="padding: 3px 10px;cursor: pointer;">属性</li> // <li style="padding: 3px 10px;cursor: pointer;">属性</li>
</ul> // </ul>
` // `
} // }
let position = tools.cartesian3Towgs84(cartesian, sdk.viewer) let position = tools.cartesian3Towgs84(cartesian, sdk.viewer)
menuElm = document.createElement('div') menuElm = document.createElement('div')
menuElm.id = 'custom-menu' menuElm.id = 'custom-menu'
@ -121,9 +121,6 @@ function MouseRightMenu(sdk, status, callBack) {
<ul class="base" style="list-style: none;padding: 0;margin: 0;font-size: 12px;"> <ul class="base" style="list-style: none;padding: 0;margin: 0;font-size: 12px;">
<li style="padding: 3px 10px;cursor: pointer;">绕鼠标点旋转</li> <li style="padding: 3px 10px;cursor: pointer;">绕鼠标点旋转</li>
</ul> </ul>
<ul class="base" style="list-style: none;padding: 0;margin: 0;font-size: 12px;">
<li style="padding: 3px 10px;cursor: pointer;">文本框</li>
</ul>
${addedMenu} ${addedMenu}
` `
_element.appendChild(menuElm) _element.appendChild(menuElm)

View File

@ -186,8 +186,8 @@ import Frustum from '../Obj/AirLine/frustum'
import DrawTakeOff from '../Obj/AirLine/DrawTakeOff' import DrawTakeOff from '../Obj/AirLine/DrawTakeOff'
import FlowLine from '../Obj/Base/FlowLine' import FlowLine from '../Obj/Base/FlowLine'
import Sunshine from '../Global/efflect/Sunshine' import Sunshine from '../Global/efflect/Sunshine'
import Road2 from '../Obj/Base/RoadObject' // import Road2 from '../Obj/Base/RoadObject'
import TextBox from '../Obj/Base/TextBox' // import TextBox from '../Obj/Base/TextBox'
import BatchModel from '../Obj/Base/BatchModel' import BatchModel from '../Obj/Base/BatchModel'
const YJEarthismeasuring = Symbol('测量状态') const YJEarthismeasuring = Symbol('测量状态')
@ -261,8 +261,8 @@ if (!window.YJ) {
// GenerateRoute // GenerateRoute
Dialog, Dialog,
FlowLine, FlowLine,
Road2, // Road2,
TextBox, // TextBox,
BatchModel BatchModel
}, },
YJEarth, YJEarth,

View File

@ -292,7 +292,7 @@ class PolygonObject extends Base {
} }
set labelShow(v) { set labelShow(v) {
this.options.label.show = v this.options.label.show = v
if (this.show) { if (this.show && !this.showView || this.showView == 3) {
this.label.show = v this.label.show = v
} }
else { else {

View File

@ -319,7 +319,7 @@ class AssembleObject extends Base {
} }
set labelShow(v) { set labelShow(v) {
this.options.label.show = v this.options.label.show = v
if (this.show) { if (this.show && !this.showView || this.showView == 3) {
this.label.show = v this.label.show = v
} }
else { else {

View File

@ -324,7 +324,7 @@ class AttackArrowObject extends Base {
} }
set labelShow(v) { set labelShow(v) {
this.options.label.show = v this.options.label.show = v
if (this.show) { if (this.show && !this.showView || this.showView == 3) {
this.label.show = v this.label.show = v
} }
else { else {

View File

@ -637,7 +637,7 @@ class Model extends BaseModel {
set labelShow(v) { set labelShow(v) {
this.options.label.show = v this.options.label.show = v
if (this.show) { if (this.show && !this.showView || this.showView == 3) {
this.label && (this.label.show = v) this.label && (this.label.show = v)
} }
else { else {

View File

@ -550,7 +550,7 @@ class Model2 extends BaseModel {
set labelShow(v) { set labelShow(v) {
this.options.label.show = v this.options.label.show = v
if (this.show) { if (this.show && !this.showView || this.showView == 3) {
this.label.show = v this.label.show = v
} }
else { else {

View File

@ -40,11 +40,6 @@ import {
import { getGoodsList } from '../../../Tools/getGoodsList' import { getGoodsList } from '../../../Tools/getGoodsList'
class BillboardObject extends Base { class BillboardObject extends Base {
#_postRenderEvent = null
#_destroyMouseEvent = null
#_billboardHeight = 0
/** /**
* @constructor * @constructor
* @description 创建点标注 * @description 创建点标注
@ -123,7 +118,6 @@ class BillboardObject extends Base {
this.options.positions.alt = Number( this.options.positions.alt = Number(
Number(options.positions.alt || 0).toFixed(2) Number(options.positions.alt || 0).toFixed(2)
) )
this.#_billboardHeight = this.options.positions.alt
// this.options.diffuseShow = options.diffuseShow || false // this.options.diffuseShow = options.diffuseShow || false
// this.options.diffuseRadius = (options.diffuseRadius || options.diffuseRadius === 0) ? options.diffuseRadius : 10 // this.options.diffuseRadius = (options.diffuseRadius || options.diffuseRadius === 0) ? options.diffuseRadius : 10
// this.options.diffuseDuration = (options.diffuseDuration || options.diffuseDuration === 0) ? options.diffuseDuration : 2000 // this.options.diffuseDuration = (options.diffuseDuration || options.diffuseDuration === 0) ? options.diffuseDuration : 2000
@ -151,18 +145,11 @@ class BillboardObject extends Base {
this.options.attribute.goods.content || [] this.options.attribute.goods.content || []
this.options.attributeType = options.attributeType || 'richText' this.options.attributeType = options.attributeType || 'richText'
this.options.coordinate = options.coordinate || '' this.options.coordinate = options.coordinate || ''
this.options.attributeBoxState = options.attributeBoxState || false
this.operate = {} this.operate = {}
this._elms = {} this._elms = {}
this.previous = { this.previous = {
positions: { ...this.options.positions } positions: { ...this.options.positions }
} }
this.options.attributePos = options.attributePos || {
x: 60,
y: 60,
width: 200,
height: 120
}
this.entity this.entity
this._proj = this.sdk.proj this._proj = this.sdk.proj
@ -195,108 +182,7 @@ class BillboardObject extends Base {
this.#_destroyMouseEvent = () => {
this.attributeElm && (this.attributeElm.style.pointerEvents = 'unset')
this.sdk.viewer._element.onmousemove = null
document.removeEventListener('mouseup', this.#_destroyMouseEvent)
document.removeEventListener('mouseleave', this.#_destroyMouseEvent)
}
this.#_postRenderEvent = () => {
let siteInfoPosition = Cesium.Cartesian3.fromDegrees(
this.options.positions.lng,
this.options.positions.lat,
this.#_billboardHeight
)
if (this.attributeElm && this.entity) {
let winpos = this.sdk.viewer.scene.cartesianToCanvasCoordinates(
siteInfoPosition
)
let pixelOffset = this.entity.label.pixelOffset.getValue()
if (winpos) {
let scale = getCurrentBillboardScale(this.entity, this.sdk.viewer.scene)
let height = ((this.entity.billboard.height.getValue() * (this.options.billboard.scale || 0)) + this.options.label.fontSize) * (1 - (scale * scale))
let flag = false
let lineElm = this.attributeElm.getElementsByClassName('billboard-attribute-box-line')[0]
let leftTopElm = this.attributeElm.getElementsByClassName('left-top')[0]
let rightTopElm = this.attributeElm.getElementsByClassName('right-top')[0]
this.attributeElm.style.left = (winpos.x + this.options.attributePos.x).toFixed(0) + 'px'
this.attributeElm.style.top = (winpos.y + pixelOffset.y - (this.options.label.show ? (this.options.label.fontSize / 2) : -(this.options.label.fontSize / 2)) - this.attributeElm.offsetHeight - this.options.attributePos.y + height).toFixed(0) + 'px'
this.attributeElm.style.width = this.options.attributePos.width + 'px'
this.attributeElm.style.height = this.options.attributePos.height + 'px'
if (this.options.attributePos.x < -this.options.attributePos.width / 2) {
flag = true
lineElm.style.left = 'unset'
lineElm.style.right = '0'
leftTopElm.style.display = 'block'
rightTopElm.style.display = 'none'
}
else {
lineElm.style.left = '0'
lineElm.style.right = 'unset'
leftTopElm.style.display = 'none'
rightTopElm.style.display = 'block'
}
let lineLength
let lineAngleRad
let lineAngle
let x
let y
if (flag) {
x = this.attributeElm.offsetWidth + this.options.attributePos.x
y = this.options.attributePos.y ? this.options.attributePos.y : 0
}
else {
x = this.options.attributePos.x
y = this.options.attributePos.y ? this.options.attributePos.y : 0
}
lineLength = Math.sqrt((x * x) + (y * y)).toFixed(2);
lineAngleRad = Math.atan(x / y);
lineAngle = parseFloat((lineAngleRad * 180 / Math.PI).toFixed(2));
if (this.options.attributePos.y < 0) {
lineAngle = lineAngle + 180
}
// if(this.options.attributePos.y<-this.options.attributePos.height/2) {
// lineElm.style.bottom = 'unset'
// lineElm.style.top = '0'
// }
// else {
// lineElm.style.bottom = -lineLength + 'px'
// lineElm.style.top = 'unset'
// }
lineElm.style.height = lineLength + 'px'
lineElm.style.transform = 'rotate(' + lineAngle + 'deg)'
}
}
}
function getCurrentBillboardScale(entity, scene) {
// 获取相机到Billboard的距离
const distance = Cesium.Cartesian3.distance(
scene.camera.positionWC,
entity.position.getValue()
);
// 获取缩放距离配置
const scaleByDistance = entity.billboard.scaleByDistance ? entity.billboard.scaleByDistance.getValue() : undefined;
if (!scaleByDistance) {
// 如果没有设置距离缩放,则使用基础缩放值
return 1.0;
}
// 解析缩放距离参数 [near, nearScale, far, farScale]
const { near, nearValue, far, farValue } = scaleByDistance;
if (distance <= near) {
return nearValue;
} else if (distance >= far) {
return farValue;
} else {
// 计算中间距离的缩放值(线性插值)
const t = (distance - near) / (far - near);
return Cesium.Math.lerp(nearValue, farValue, t);
}
}
this.sdk.addIncetance(this.options.id, this) this.sdk.addIncetance(this.options.id, this)
@ -357,7 +243,6 @@ class BillboardObject extends Base {
that.entity.billboard.imgHeight = 0 that.entity.billboard.imgHeight = 0
that.entity.billboard.image = canvas that.entity.billboard.image = canvas
addCluster(that.sdk, that.entity) addCluster(that.sdk, that.entity)
that.attributeBoxState && (that.attributeBoxState = true)
} }
return return
} }
@ -382,7 +267,6 @@ class BillboardObject extends Base {
return img return img
}, false) }, false)
addCluster(that.sdk, that.entity) addCluster(that.sdk, that.entity)
that.attributeBoxState && (that.attributeBoxState = true)
} }
}) })
} }
@ -414,7 +298,6 @@ class BillboardObject extends Base {
that.entity.billboard.imgHeight = height that.entity.billboard.imgHeight = height
that.entity.billboard.image = canvas that.entity.billboard.image = canvas
addCluster(that.sdk, that.entity) addCluster(that.sdk, that.entity)
that.attributeBoxState && (that.attributeBoxState = true)
} }
} }
image.onerror = function (err) { image.onerror = function (err) {
@ -426,7 +309,6 @@ class BillboardObject extends Base {
that.entity.billboard.imgHeight = 0 that.entity.billboard.imgHeight = 0
that.entity.billboard.image = canvas that.entity.billboard.image = canvas
addCluster(that.sdk, that.entity) addCluster(that.sdk, that.entity)
that.attributeBoxState && (that.attributeBoxState = true)
} }
}; };
} }
@ -551,11 +433,11 @@ class BillboardObject extends Base {
value: '链接', value: '链接',
key: 'link' key: 'link'
}, },
{ // {
name: 'IP摄像头', // name: 'IP摄像头',
value: 'IP摄像头', // value: 'IP摄像头',
key: 'camera' // key: 'camera'
}, // },
// { // {
// name: 'ISC摄像头', // name: 'ISC摄像头',
// value: 'ISC摄像头', // value: 'ISC摄像头',
@ -566,16 +448,16 @@ class BillboardObject extends Base {
// value: '传感器', // value: '传感器',
// key: 'sensor' // key: 'sensor'
// }, // },
{ // {
name: '全景图', // name: '全景图',
value: '全景图', // value: '全景图',
key: 'vr' // key: 'vr'
}, // },
{ // {
name: '物资', // name: '物资',
value: '物资', // value: '物资',
key: 'goods' // key: 'goods'
} // }
] ]
} }
@ -583,36 +465,15 @@ class BillboardObject extends Base {
return this.options.show return this.options.show
} }
set show(v) { set show(v) {
if (!this.isShowView) { if(!this.isShowView) {
this.options.show = v this.options.show = v
this.originalOptions.show = v this.originalOptions.show = v
} }
if (!this.showView || this.showView == 3) { if(!this.showView || this.showView == 3) {
this.entity && (this.entity.show = this.options.show) this.entity && (this.entity.show = this.options.show)
if (this.attributeBoxState && this.options.show) {
this.attributeBoxState = this.options.show
}
else {
// 关闭属性框
document.addEventListener('mouseup', this.#_destroyMouseEvent);
document.addEventListener('mouseleave', this.#_destroyMouseEvent);
if (this.attributeElm) {
this.sdk.viewer._element.removeChild(this.attributeElm)
this.attributeElm = null
}
this.sdk.viewer.scene.postRender.removeEventListener(this.#_postRenderEvent)
}
} }
else { else {
this.entity && (this.entity.show = false) this.entity && (this.entity.show = false)
// 关闭属性框
document.addEventListener('mouseup', this.#_destroyMouseEvent);
document.addEventListener('mouseleave', this.#_destroyMouseEvent);
if (this.attributeElm) {
this.sdk.viewer._element.removeChild(this.attributeElm)
this.attributeElm = null
}
this.sdk.viewer.scene.postRender.removeEventListener(this.#_postRenderEvent)
} }
syncData(this.sdk, this.options.id) syncData(this.sdk, this.options.id)
syncSplitData(this.sdk, this.options.id) syncSplitData(this.sdk, this.options.id)
@ -701,26 +562,6 @@ class BillboardObject extends Base {
if (this.entity) { if (this.entity) {
this.entity.billboard.heightReference = heightMode this.entity.billboard.heightReference = heightMode
this.entity.label.heightReference = heightMode this.entity.label.heightReference = heightMode
if(heightMode == Cesium.HeightReference.CLAMP_TO_GROUND) {
if (this.sdk.viewer.scene.terrainProvider.availability) {
Cesium.sampleTerrainMostDetailed(
this.sdk.viewer.scene.terrainProvider,
[
Cesium.Cartographic.fromDegrees(
this.options.positions.lng,
this.options.positions.lat
)
]
).then(position => {
this.#_billboardHeight = position[0].height
})
} else {
this.#_billboardHeight = 0
}
}
else {
this.#_billboardHeight = this.options.positions.alt
}
} }
this._elms.heightMode && (this._elms.heightMode.value = heightModeName) this._elms.heightMode && (this._elms.heightMode.value = heightModeName)
} }
@ -775,7 +616,6 @@ class BillboardObject extends Base {
} }
set alt(v) { set alt(v) {
this.options.positions.alt = Number(Number(v).toFixed(2)) this.options.positions.alt = Number(Number(v).toFixed(2))
this.#_billboardHeight = this.options.positions.alt
// this.scan && (this.scan.alt = v) // this.scan && (this.scan.alt = v)
// this.diffuse && (this.diffuse.alt = v) // this.diffuse && (this.diffuse.alt = v)
this.renewPoint() this.renewPoint()
@ -1876,22 +1716,6 @@ class BillboardObject extends Base {
this.cameraSelect && this.cameraSelect() this.cameraSelect && this.cameraSelect()
this.ISCSelect && this.ISCSelect() this.ISCSelect && this.ISCSelect()
this.goodsSelect && this.goodsSelect() this.goodsSelect && this.goodsSelect()
let col = document.createElement('div')
col.className = 'col'
col.style.flex = '0 0 110px'
col.innerHTML = `
<span class="label">属性框</span>
<input class="btn-switch" type="checkbox">
`
let row = this._DialogObject._element.content.getElementsByClassName('attribute')[0].getElementsByClassName('row')[0]
row.appendChild(col)
let boxSwitch = col.getElementsByClassName('btn-switch')[0]
boxSwitch.checked = this.attributeBoxState
boxSwitch.addEventListener('change', (e) => {
this.attributeBoxState = boxSwitch.checked
})
let tagData = this.attributeSelect let tagData = this.attributeSelect
let attributeElm = this._DialogObject._element.content.getElementsByClassName( let attributeElm = this._DialogObject._element.content.getElementsByClassName(
'attribute-select-box' 'attribute-select-box'
@ -2403,7 +2227,6 @@ class BillboardObject extends Base {
this.attributeCamera = this.options.attribute.camera.content this.attributeCamera = this.options.attribute.camera.content
this.attributeGoods = this.options.attribute.goods.content this.attributeGoods = this.options.attribute.goods.content
this.attributeISC = this.options.attribute.ISC.content this.attributeISC = this.options.attribute.ISC.content
this.attributeBoxState = this.options.attributeBoxState
this.cameraSelect && this.cameraSelect() this.cameraSelect && this.cameraSelect()
this.goodsSelect && this.goodsSelect() this.goodsSelect && this.goodsSelect()
} }
@ -2411,7 +2234,6 @@ class BillboardObject extends Base {
async remove() { async remove() {
await remove_entity_from_cluster(this.sdk.viewer, this.entity) await remove_entity_from_cluster(this.sdk.viewer, this.entity)
this.entity = null this.entity = null
this.attributeBoxState = false
if (!this.sdk.viewer || !this.sdk.viewer.entities) { if (!this.sdk.viewer || !this.sdk.viewer.entities) {
return return
} }
@ -2617,7 +2439,6 @@ class BillboardObject extends Base {
switch (this._elms.heightMode.value) { switch (this._elms.heightMode.value) {
case '海拔高度': case '海拔高度':
heightElm.value = this.options.positions.alt heightElm.value = this.options.positions.alt
this.#_billboardHeight = this.options.positions.alt
break break
case '相对地表': case '相对地表':
if (this.sdk.viewer.scene.terrainProvider.availability) { if (this.sdk.viewer.scene.terrainProvider.availability) {
@ -2633,18 +2454,15 @@ class BillboardObject extends Base {
heightElm.value = Number( heightElm.value = Number(
(this.options.positions.alt - position[0].height).toFixed(2) (this.options.positions.alt - position[0].height).toFixed(2)
) )
this.#_billboardHeight = this.options.positions.alt
}) })
} else { } else {
heightElm.value = this.options.positions.alt heightElm.value = this.options.positions.alt
this.#_billboardHeight = this.options.positions.alt
} }
break break
case '依附地表': case '依附地表':
break break
case '依附模型': case '依附模型':
heightElm.value = this.options.positions.alt heightElm.value = this.options.positions.alt
this.#_billboardHeight = this.options.positions.alt
break break
} }
} }
@ -2918,216 +2736,6 @@ class BillboardObject extends Base {
(this.originalOptions.customView = this.options.customView) (this.originalOptions.customView = this.options.customView)
} }
} }
get attributeBoxState() {
return this.options.attributeBoxState
}
set attributeBoxState(state) {
state = state ? true : false
this.options.attributeBoxState = state
document.addEventListener('mouseup', this.#_destroyMouseEvent);
document.addEventListener('mouseleave', this.#_destroyMouseEvent);
if (this.attributeElm) {
this.sdk.viewer._element.removeChild(this.attributeElm)
this.attributeElm = null
}
this.sdk.viewer.scene.postRender.removeEventListener(this.#_postRenderEvent)
if (state && this.sdk && this.sdk.viewer && this.sdk.viewer._element && this.show) {
let attributeElm = document.createElement('div')
this.attributeElm = attributeElm
attributeElm.className = 'billboard-attribute-box'
attributeElm.style.top = '0px'
attributeElm.style.left = '0px'
attributeElm.style.width = 0
attributeElm.style.height = 0
// 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>`
}
if (this.options.attribute.goods && this.options.attribute.goods.content && this.options.attribute.goods.content.length > 0) {
goodsHtml += `<DIV-cy-tab-pane label="物资">
<div class="table">
<div class="table-head">
<div class="tr">
<div class="th" style="width: 20%; flex: 0 20%;">序号</div>
<div class="th" style="width: 40%; flex: 0 40%;">名称</div>
<div class="th" style="width: 40%; flex: 0 40%;">数量</div>
</div>
</div>
<div class="table-body">
`
for (let i = 0; i < this.options.attribute.goods.content.length; i++) {
goodsHtml += `<div class="tr">
<div class="td" style="width: 20%; flex: 0 20%;">${i + 1}</div>
<div class="td" style="width: 40%; flex: 0 40%;">${this.options.attribute.goods.content[i].name}</div>
<div class="td" style="width: 40%; flex: 0 40%;">${this.options.attribute.goods.content[i].cnt}</div>
</div>`
}
goodsHtml += `</div></div></DIV-cy-tab-pane>`
}
if (this.options.richTextContent) {
richTextHtml = `<DIV-cy-tab-pane label="富文本">
${this.options.richTextContent}
</DIV-cy-tab-pane>`
}
let boxHtml = `
<span class="drag-nook left-top"></span>
<span class="drag-nook right-top"></span>
`
if (!linkHtml && !goodsHtml && !richTextHtml) {
boxHtml = boxHtml + '<p style="margin: 0;width: 100%;height: 100%;display: flex;justify-content: center;align-items: center;">暂无属性信息</p><div class="billboard-attribute-box-line"></div>'
}
else {
boxHtml = boxHtml + `
<DIV-cy-tabs class="tabs">
${richTextHtml}
${goodsHtml}
${linkHtml}
</DIV-cy-tabs>
<div class="billboard-attribute-box-line"></div>`
}
attributeElm.innerHTML = boxHtml
if (attributeElm.getElementsByClassName('tabs')[0]) {
let tabsElm = new cy_tabs(attributeElm.getElementsByClassName('tabs')[0], undefined, this.sdk)
}
let imgElm = attributeElm.getElementsByTagName('img')
for (let i = 0; i < imgElm.length; i++) {
if (!imgElm[i].style.width) {
imgElm[i].style.width = '100%'
}
}
this.sdk.viewer.scene.postRender.addEventListener(this.#_postRenderEvent)
let leftOnmousedown = (e) => {
if (this.options.attributePos.width < 200) {
this.options.attributePos.width = 200
}
if (this.options.attributePos.height < 120) {
this.options.attributePos.height = 120
}
let x = e.x
let y = e.y
let width = this.options.attributePos.width
let height = this.options.attributePos.height
let positionx = this.options.attributePos.x
this.sdk.viewer._element.onmousemove = (e2) => {
this.options.attributePos.width = width + (x - e2.x)
this.options.attributePos.height = height + (y - e2.y)
if (this.options.attributePos.width < 200) {
this.options.attributePos.width = 200
}
else {
this.options.attributePos.x = positionx - (x - e2.x)
}
if (this.options.attributePos.height < 120) {
this.options.attributePos.height = 120
}
// this.options.attributePos.y = positiony + (y - e2.y)
}
document.addEventListener('mouseup', this.#_destroyMouseEvent);
document.addEventListener('mouseleave', this.#_destroyMouseEvent);
}
let rightOnmousedown = (e) => {
let x = e.x
let y = e.y
if (this.options.attributePos.width < 200) {
this.options.attributePos.width = 200
}
if (this.options.attributePos.height < 120) {
this.options.attributePos.height = 120
}
let width = this.options.attributePos.width
let height = this.options.attributePos.height
this.sdk.viewer._element.onmousemove = (e2) => {
this.options.attributePos.width = width + (e2.x - x)
this.options.attributePos.height = height + (y - e2.y)
}
document.addEventListener('mouseup', this.#_destroyMouseEvent);
document.addEventListener('mouseleave', this.#_destroyMouseEvent);
}
// leftTopElm.onmousedown = (e) => {
// console.log(1111111111)
// if (this.options.attributePos.width < 200) {
// this.options.attributePos.width = 200
// }
// if (this.options.attributePos.height < 120) {
// this.options.attributePos.height = 120
// }
// let x = e.x
// let y = e.y
// let width = this.options.attributePos.width
// let height = this.options.attributePos.height
// let positionx = this.options.attributePos.x
// this.sdk.viewer._element.onmousemove = (e2) => {
// this.options.attributePos.width = width + (x - e2.x)
// this.options.attributePos.height = height + (y - e2.y)
// if (this.options.attributePos.width < 200) {
// this.options.attributePos.width = 200
// }
// else {
// this.options.attributePos.x = positionx - (x - e2.x)
// }
// if (this.options.attributePos.height < 120) {
// this.options.attributePos.height = 120
// }
// // this.options.attributePos.y = positiony + (y - e2.y)
// }
// document.addEventListener('mouseup', this.#_destroyMouseEvent);
// document.addEventListener('mouseleave', this.#_destroyMouseEvent);
// }
// rightTopElm.onmousedown = (e) => {
// let x = e.x
// let y = e.y
// if (this.options.attributePos.width < 200) {
// this.options.attributePos.width = 200
// }
// if (this.options.attributePos.height < 120) {
// this.options.attributePos.height = 120
// }
// let width = this.options.attributePos.width
// let height = this.options.attributePos.height
// this.sdk.viewer._element.onmousemove = (e2) => {
// this.options.attributePos.width = width + (e2.x - x)
// this.options.attributePos.height = height + (y - e2.y)
// }
// document.addEventListener('mouseup', this.#_destroyMouseEvent);
// document.addEventListener('mouseleave', this.#_destroyMouseEvent);
// }
attributeElm.onmousedown = (e) => {
attributeElm.style.pointerEvents = 'none'
if (e.target.className.indexOf('left-top') != -1) {
leftOnmousedown(e)
}
else if (e.target.className.indexOf('right-top') != -1) {
rightOnmousedown(e)
}
else {
let x = e.x
let y = e.y
let oldX = this.options.attributePos.x
let oldXY = this.options.attributePos.y
let height = this.options.attributePos.height
this.sdk.viewer._element.onmousemove = (e2) => {
this.options.attributePos.x = oldX + (e2.x - x)
this.options.attributePos.y = oldXY - (e2.y - y)
}
document.addEventListener('mouseup', this.#_destroyMouseEvent);
document.addEventListener('mouseleave', this.#_destroyMouseEvent);
}
}
}
}
} }
export default BillboardObject export default BillboardObject

View File

@ -181,7 +181,7 @@ class CircleDiffuse extends Base {
} }
that.sdk._entityZIndex++ that.sdk._entityZIndex++
if (that.sdk.viewer._element.className === 'cesium-viewer 2d') { if (that.sdk.viewer._element.className === 'cesium-viewer 2d') {
that.entity.ellipse.height = 1000000 that.entity.ellipse.height = 1
} }
CircleDiffuse.createLabel(that) CircleDiffuse.createLabel(that)
syncData(that.sdk, that.options.id) syncData(that.sdk, that.options.id)

View File

@ -333,7 +333,7 @@ class CircleObject extends Base {
} }
set labelShow(v) { set labelShow(v) {
this.options.label.show = v this.options.label.show = v
if (this.show && (!this.showView || this.showView == 3)) { if (this.show && !this.showView || this.showView == 3) {
this.label.show = v this.label.show = v
} }
else { else {

View File

@ -666,7 +666,7 @@ class CurvelineObject extends Base {
} }
set labelShow(v) { set labelShow(v) {
this.options.label.show = v this.options.label.show = v
if (this.show) { if (this.show && !this.showView || this.showView == 3) {
this.label.show = v this.label.show = v
setTimeout(() => { setTimeout(() => {
this.label.position = [ this.label.position = [
@ -1384,10 +1384,10 @@ class CurvelineObject extends Base {
that.options.lengthByMeter = res that.options.lengthByMeter = res
that.lengthUnit = that.options['length-unit'] that.lengthUnit = that.options['length-unit']
syncData(that.sdk, that.options.id) 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']) { // if (this.options['nose-to-tail']) {
// let array = [] // let array = []

View File

@ -347,7 +347,7 @@ class EllipseObject extends Base {
} }
set labelShow(v) { set labelShow(v) {
this.options.label.show = v this.options.label.show = v
if (this.show) { if (this.show && !this.showView || this.showView == 3) {
this.label.show = v this.label.show = v
} }
else { else {

View File

@ -162,6 +162,7 @@ class FlyRoam extends Base {
pitch: viewer.camera.pitch, pitch: viewer.camera.pitch,
roll: viewer.camera.roll roll: viewer.camera.roll
} }
this.message({text: '操作成功'})
}) })
let totalTimeElm = contentElm.querySelector("input[name='totalTime']") let totalTimeElm = contentElm.querySelector("input[name='totalTime']")

View File

@ -17,6 +17,18 @@ function html(that) {
</div> </div>
<span class="custom-divider"></span> <span class="custom-divider"></span>
<div class="div-item"> <div class="div-item">
<div class="row">
<div class="col" mode="0">
<button class="anchor btn">调整锚点</button>
</div>
<div class="col mode-box">
<span class="label" style="flex: unset;">军标模式</span>
<div class="mode"></div>
</div>
</div>
</div>
<span class="custom-divider" mode="0"></span>
<div class="div-item" mode="0">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<span class="label">旋转角度</span> <span class="label">旋转角度</span>
@ -50,11 +62,11 @@ function html(that) {
</div> </div>
</div> </div>
<span class="custom-divider"></span> <span class="custom-divider"></span>
<div class="div-item"> <div class="div-item" mode="0">
<div class="row"> <div class="row">
<div class="col" style="flex: 5;"> <div class="col" style="flex: 5;">
<span class="label">文字内容</span> <span class="label">文字内容</span>
<input class="input" type="text" @model="textValue" maxlength="30"> <input class="input" type="text" @model="textValue">
</div> </div>
<div class="col"> <div class="col">
<button class="btn" @click="textPosPick">设置位置</span> <button class="btn" @click="textPosPick">设置位置</span>
@ -70,9 +82,9 @@ function html(that) {
<div class="textColor"></div> <div class="textColor"></div>
</div> </div>
<div class="col"> <div class="col">
<span class="label">字大小</span> <span class="label">字大小</span>
<div class="input-number input-number-unit-2"> <div class="input-number input-number-unit-2">
<input class="input" type="number" title="" min="1" max="99" @model="textFontSize"> <input class="input" type="number" title="" min="1" max="99" step="1" @model="textFontSize">
<span class="unit">px</span> <span class="unit">px</span>
<span class="arrow"></span> <span class="arrow"></span>
</div> </div>
@ -101,6 +113,98 @@ function html(that) {
</div> </div>
</div> </div>
</div> </div>
<div class="div-item" mode="1">
<div class="row">
<div class="col height-mode-box" style="flex: 0 0 155px;margin-right: 10px;">
<span class="label" style="flex: 0 0 56px;">高度模式</span>
<div class="height-mode"></div>
</div>
<div class="col" style="margin: 0 10px;">
<div class="height-box" style="display: flex; align-items: center;">
<span class="label" style="flex: 0 0 56px;">高度</span>
<div class="input-number input-number-unit-1">
<input class="input height" type="number" title="" min="-9999999" max="999999999">
<span class="unit">m</span>
<span class="arrow"></span>
</div>
</div>
</div>
<div class="col" style="margin-left: 10px;">
<span class="label">图标倍数</span>
<div class="input-number input-number-unit-1">
<input class="input" type="number" title="" data-min="0.1" max="99" @model="billboardScale">
<span class="unit">倍</span>
<span class="arrow"></span>
</div>
</div>
</div>
<div class="row">
<div class="col" style="flex: 0 0 155px;margin-right: 10px;">
<span class="label">视野缩放</span>
<input class="btn-switch" type="checkbox" @model="billboardScaleByDistance">
</div>
<div class="col" style="margin: 0 10px;">
<span class="label">最近距离</span>
<div class="input-number input-number-unit-1">
<input class="input" type="number" title="" min="1" max="99999999" @model="billboardNear">
<span class="unit">m</span>
<span class="arrow"></span>
</div>
</div>
<div class="col" style="margin-left: 10px;">
<span class="label">最远距离</span>
<div class="input-number input-number-unit-1">
<input class="input" type="number" title="" min="1" max="99999999" @model="billboardFar">
<span class="unit">m</span>
<span class="arrow"></span>
</div>
</div>
</div>
<h4>文字设置</h4>
<div class="row">
<div class="col" style="flex: 0 0 80px;margin: 0 10px 0 0;;">
<span class="label" style="flex: none;">显隐</span>
<input class="btn-switch" type="checkbox" @model="labelShow">
</div>
<div class="col font-select-box" style="margin: 0 0px;flex: 0 0 160px;">
<span class="label" style="flex: none;">字体选择</span>
<div class="input input-select font-select"></div>
</div>
<div class="col" style="margin: 0 10px;">
<span class="label">文字大小</span>
<div class="input-number input-number-unit-2">
<input class="input label-font-size" type="number" title="" min="1" max="99" step="1" style="width: 70px;">
<span class="unit">px</span>
<span class="arrow"></span>
</div>
</div>
<div class="col" style="margin-left: 10px;">
<span class="label">文字颜色</span>
<div class="labelColor"></div>
</div>
</div>
<div class="row" style="justify-content: flex-start;">
<div class="col font-select-box" style="margin: 0 0px;flex: 0 0 70px;">
<span class="label" style="flex: none;">文字偏移</span>
</div>
<div class="col" style="margin: 0 10px;flex: 0 0 100px;">
<span class="label">x</span>
<div class="input-number input-number-unit-2">
<input class="input label-offset-x" type="number" title="" min="-999" max="999" step="1">
<span class="unit">px</span>
<span class="arrow"></span>
</div>
</div>
<div class="col" style="margin: 0 10px;flex: 0 0 100px;">
<span class="label">y</span>
<div class="input-number input-number-unit-2">
<input class="input label-offset-y" type="number" title="" min="-999" max="999" step="1">
<span class="unit">px</span>
<span class="arrow"></span>
</div>
</div>
</div>
</div>
<span class="custom-divider"></span> <span class="custom-divider"></span>
<div class="div-item attribute-info"> <div class="div-item attribute-info">
<div class="row"> <div class="row">

File diff suppressed because it is too large Load Diff

View File

@ -334,7 +334,7 @@ class PincerArrowObject extends Base {
} }
set labelShow(v) { set labelShow(v) {
this.options.label.show = v this.options.label.show = v
if (this.show) { if (this.show && !this.showView || this.showView == 3) {
this.label.show = v this.label.show = v
} }
else { else {

View File

@ -355,7 +355,7 @@ class PolygonObject extends Base {
} }
set labelShow(v) { set labelShow(v) {
this.options.label.show = v this.options.label.show = v
if (this.show) { if (this.show && !this.showView || this.showView == 3) {
this.label.show = v this.label.show = v
} else { } else {
this.label.show = false this.label.show = false

View File

@ -517,7 +517,7 @@ class PolyhedronObject extends Base {
} }
set labelShow(v) { set labelShow(v) {
this.options.label.show = v this.options.label.show = v
if (this.show) { if (this.show && !this.showView || this.showView == 3) {
this.label.show = v this.label.show = v
} }
else { else {

View File

@ -701,7 +701,7 @@ class PolylineObject extends Base {
} }
set labelShow(v) { set labelShow(v) {
this.options.label.show = v this.options.label.show = v
if (this.show) { if (this.show && !this.showView || this.showView == 3) {
this.label.show = v this.label.show = v
setTimeout(() => { setTimeout(() => {
this.label.position = [ this.label.position = [
@ -893,6 +893,7 @@ class PolylineObject extends Base {
}) })
} }
} }
get labelBackgroundColorEnd() { get labelBackgroundColorEnd() {
return this.options.label.backgroundColor[1] return this.options.label.backgroundColor[1]
} }
@ -1410,10 +1411,10 @@ class PolylineObject extends Base {
that.options.lengthByMeter = res that.options.lengthByMeter = res
that.lengthUnit = that.options['length-unit'] that.lengthUnit = that.options['length-unit']
syncData(that.sdk, that.options.id) 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']) { // if (this.options['nose-to-tail']) {

View File

@ -138,7 +138,7 @@ class RadarScan extends Base {
}) })
that.sdk._entityZIndex++ that.sdk._entityZIndex++
if (that.sdk.viewer._element.className === 'cesium-viewer 2d') { if (that.sdk.viewer._element.className === 'cesium-viewer 2d') {
that.entity.ellipse.height = 1000000 that.entity.ellipse.height = 1
} }
RadarScan.createLabel(that) RadarScan.createLabel(that)
syncData(that.sdk, that.options.id) syncData(that.sdk, that.options.id)

View File

@ -424,7 +424,7 @@ class RadarScanStereoscopic extends Base {
} }
set labelShow(v) { set labelShow(v) {
this.options.label.show = v this.options.label.show = v
if (this.show) { if (this.show && !this.showView || this.showView == 3) {
this.label.show = v this.label.show = v
} }
else { else {

View File

@ -344,7 +344,7 @@ class SectorObject extends Base {
} }
set labelShow(v) { set labelShow(v) {
this.options.label.show = v this.options.label.show = v
if (this.show) { if (this.show && !this.showView || this.showView == 3) {
this.label.show = v this.label.show = v
} }
else { else {

View File

@ -321,7 +321,7 @@ class StraightArrowObject extends Base {
} }
set labelShow(v) { set labelShow(v) {
this.options.label.show = v this.options.label.show = v
if (this.show) { if (this.show && !this.showView || this.showView == 3) {
this.label.show = v this.label.show = v
} }
else { else {

View File

@ -53,8 +53,7 @@ class TextBox extends Base {
// 配置CSS样式和内容结构 // 配置CSS样式和内容结构
viewer.cesiumWidget.container.appendChild(dom); viewer.cesiumWidget.container.appendChild(dom);
let posi = Cesium.Cartesian3.fromDegrees(that.options.position.lng.toFixed(4), that.options.position.lat.toFixed(4), that.options.position.alt.toFixed(4)) let posi = Cesium.Cartesian3.fromDegrees(that.options.position.lng, that.options.position.lat, that.options.position.alt)
that.handler = function () { that.handler = function () {
const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates( const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates(
viewer.scene, posi viewer.scene, posi
@ -70,22 +69,44 @@ class TextBox extends Base {
that.textDom = dom; that.textDom = dom;
} }
async isClick(posi, id) {
let params = [
{
position: posi
},
id,
null
]
this.clickCallBack({ position: posi }, id, null)
}
async setHandeler(data) { async setHandeler(data) {
let that = this let that = this
const ray = this.sdk.viewer.camera.getPickRay(new Cesium.Cartesian2(data.x, data.y));
var cartesian = this.sdk.viewer.scene.globe.pick(ray, this.sdk.viewer.scene); let cartesian = this.sdk.viewer.scene.pickPosition(new Cesium.Cartesian2(data.x, data.y)); //屏幕坐标转为笛卡尔空间坐标
// if (!cartesian) return;
// let c = Cesium.Cartographic.fromCartesian(position);
if (!cartesian) {
const ray = this.sdk.viewer.camera.getPickRay(new Cesium.Cartesian2(data.x, data.y));
cartesian = this.sdk.viewer.scene.globe.pick(ray, this.sdk.viewer.scene);
}
if (Cesium.defined(cartesian)) { if (Cesium.defined(cartesian)) {
that.sdk.viewer.scene.postRender.removeEventListener(that.handler); that.sdk.viewer.scene.postRender.removeEventListener(that.handler);
var cartographic = Cesium.Cartographic.fromCartesian(cartesian); var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
var longitude = Cesium.Math.toDegrees(cartographic.longitude); var longitude = Cesium.Math.toDegrees(cartographic.longitude);
var latitude = Cesium.Math.toDegrees(cartographic.latitude); var latitude = Cesium.Math.toDegrees(cartographic.latitude);
let height = await that.getClampToHeight({ lng: longitude, lat: latitude })
that.position = { that.position = {
lng: longitude, lng: longitude,
lat: latitude, lat: latitude,
alt: cartographic.height alt: cartographic.height
// alt: height
} }
let posi = Cesium.Cartesian3.fromDegrees(longitude.toFixed(4), latitude.toFixed(4), cartographic.height.toFixed(4)) let posi = Cesium.Cartesian3.fromDegrees(longitude, latitude, cartographic.height)
that.handler = function () { that.handler = function () {
const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates( const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates(
@ -108,6 +129,16 @@ class TextBox extends Base {
async returnFun() { async returnFun() {
return this.handler return this.handler
} }
get onClick() {
return this.clickCallBack
}
set onClick(val) {
if (val && typeof val !== 'function') {
console.error('val:', val, '不是一个function')
} else {
this.clickCallBack = val
}
}
get show() { get show() {
return this.options.show return this.options.show
} }

View File

@ -649,7 +649,7 @@ class GroundText extends Base {
ctx.font = 200 + 'px serif' ctx.font = 200 + 'px serif'
ctx.fillStyle = 'rgba(255, 255, 255, 0)' ctx.fillStyle = 'rgba(255, 255, 255, 0)'
ctx.fillRect(0, 0, maxWidth + 30, 210) ctx.fillRect(0, 0, maxWidth + 30, 210)
ctx.fillStyle = this.options.color ctx.fillStyle = 'rgba(255, 255, 255, 1)'
ctx.font = '200px serif' ctx.font = '200px serif'
ctx.fillText(textArray[i], 0, 210 * (i + 1)) ctx.fillText(textArray[i], 0, 210 * (i + 1))
} }

View File

@ -508,7 +508,7 @@ class StandText extends Base {
ctx.font = 200 + "px serif"; ctx.font = 200 + "px serif";
ctx.fillStyle = 'rgba(255, 255, 255, 0)' ctx.fillStyle = 'rgba(255, 255, 255, 0)'
ctx.fillRect(0, 0, maxWidth + 30, 210) ctx.fillRect(0, 0, maxWidth + 30, 210)
ctx.fillStyle = this.options.color; ctx.fillStyle = 'rgba(255, 255, 255, 1)';
ctx.font = "200px serif"; ctx.font = "200px serif";
ctx.fillText(textArray[i], 0, 210 * (i+1)); ctx.fillText(textArray[i], 0, 210 * (i+1));
} }

View File

@ -1,205 +1,188 @@
function html() { function html() {
return ` return `
<span class="custom-divider"></span> <span class="custom-divider"></span>
<div class="div-item"> <div class="div-item">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<span class="label" style="flex: 0 0 70px;">名称</span> <span class="label" style="flex: 0 0 70px;">名称</span>
<input class="input" maxlength="40" type="text" @model="name"> <input class="input" maxlength="40" type="text" @model="name">
</div>
<div class="col"></div>
</div> </div>
<div class="col"></div>
</div> </div>
<span class="custom-divider"></span> </div>
<div class="div-item"> <span class="custom-divider"></span>
<div class="row"> <div class="div-item">
<div class="col"> <div class="row">
<span class="label" style="flex: 0 0 70px;">起始点高度</span> <div class="col">
<div class="input-number input-number-unit-1 height-box"> <span class="label" style="flex: 0 0 70px;">起始点高度</span>
<input class="input" type="number" title="" min="-9999999" max="999999999" @model="height"> <div class="input-number input-number-unit-1 height-box">
<span class="unit">m</span> <input class="input" type="number" title="" min="-9999999" max="999999999" @model="height">
<span class="arrow"></span> <span class="unit">m</span>
</div> <span class="arrow"></span>
</div>
<div class="col">
<span class="label">模型倍数</span>
<div class="input-number input-number-unit-2">
<input class="input" type="number" title="" min="0" max="99999" step="1" @model="scale">
<span class="unit">倍</span>
<span class="arrow"></span>
</div>
</div> </div>
</div> </div>
<div class="row"> <div class="col">
<div class="col"> <span class="label">模型倍数</span>
<span class="label" style="flex: 0 0 70px;">运行速度</span> <div class="input-number input-number-unit-2">
<div class="input-number input-number-unit-3"> <input class="input" type="number" title="" min="0" max="99999" step="1" @model="scale">
<input class="input" type="number" title="" min="0" max="99999999" step="1" @model="speed"> <span class="unit">倍</span>
<span class="unit">m/s</span> <span class="arrow"></span>
<span class="arrow"></span>
</div>
</div>
<div class="col">
<span class="label">延迟运动</span>
<div class="input-number input-number-unit-3">
<input class="input" type="number" title="" min="0" max="9999999" @model="delay">
<span class="unit">ms</span>
<span class="arrow"></span>
</div>
</div>
</div>
<div class="row">
<div class="col">
<span class="label" style="flex: 0 0 70px;">更换模型</span>
<button class="btn" @click="clickChangeModel">选择</button>
</div>
<div class="col">
<span class="label">模型方向</span>
<button class="btn model-rotate-btn" @click="modelRotate">开始调整</button>
<svg class="icon-rubric"><use xlink:href="#yj-icon-rubric"></use></svg>
</div> </div>
</div> </div>
</div> </div>
<span class="custom-divider"></span> <div class="row">
<div class="div-item"> <div class="col">
<div class="row"> <span class="label" style="flex: 0 0 70px;">运行速度</span>
<div class="col"> <div class="input-number input-number-unit-3">
<div class="btn-group"> <input class="input" type="number" title="" min="0" max="99999999" step="1" @model="speed">
<button class="btn" style="border-radius: 5px 0 0 5px;" name="firstPerson" <span class="unit">m/s</span>
data-state="true"><span>第一视角</span></button> <span class="arrow"></span>
<button class="btn" style="border-radius: 0 5px 5px 0;" name="firstPerson" </div>
data-state="false"><span>第三视角</span></button> </div>
</div> <div class="col">
<span class="label">延迟运动</span>
<div class="input-number input-number-unit-3">
<input class="input" type="number" title="" min="0" max="9999999" @model="delay">
<span class="unit">ms</span>
<span class="arrow"></span>
</div> </div>
</div> </div>
</div> </div>
<div class="div-item div-item-switch"> <div class="row">
<div class="row"> <div class="col">
<div class="col"> <span class="label" style="flex: 0 0 70px;">更换模型</span>
<span class="label">路径显隐</span> <button class="btn" @click="clickChangeModel">选择</button>
<input class="btn-switch" type="checkbox" @model="lineShow">
</div>
<div class="col">
<span class="label">模型显隐</span>
<input class="btn-switch" type="checkbox" @model="modelShow">
</div>
<div class="col">
<span class="label">实时路径</span>
<input class="btn-switch" type="checkbox" @model="realTimeRoute">
</div>
</div> </div>
<div class="row"> <div class="col">
<div class="col"> <span class="label">模型方向</span>
<span class="label">编辑</span> <button class="btn model-rotate-btn" @click="modelRotate">开始调整</button>
<input class="btn-switch" type="checkbox" @model="lineEdit"> <svg class="icon-rubric"><use xlink:href="#yj-icon-rubric"></use></svg>
</div>
<div class="col">
<span class="label">路径圆滑</span>
<input class="btn-switch" type="checkbox" @model="smooth">
</div>
<div class="col">
<span class="label">环线</span>
<input class="btn-switch" type="checkbox" @model="noseToTail">
</div>
</div> </div>
<div class="row"> </div>
<div class="col"> </div>
<span class="label">轨迹贴地</span> <span class="custom-divider"></span>
<input class="btn-switch" type="checkbox" @model="ground"> <div class="div-item">
</div> <div class="row">
<div class="col"> <div class="col">
<span class="label">轨迹循环</span> <div class="btn-group">
<input class="btn-switch" type="checkbox" @model="loop"> <button class="btn" style="border-radius: 5px 0 0 5px;" name="firstPerson"
</div> data-state="true"><span>第一视角</span></button>
<div class="col"> <button class="btn" style="border-radius: 0 5px 5px 0;" name="firstPerson"
<span class="label">轨迹动画</span> data-state="false"><span>第三视角</span></button>
<input class="btn-switch" type="checkbox" @model="state">
</div>
</div>
<div class="row">
<div class="col">
<span class="label">路径方向</span>
<input class="btn-switch" type="checkbox" @model="routeDirection">
</div>
<div class="col" style="margin-right: 33px;">
<span class="label">视角跟随</span>
<input class="btn-switch" type="checkbox" @model="viewFollow">
</div>
<div class="col" style="margin: 0px;">
<span class="label">模型动画</span>
<div class="input input-select model-animate-select"></div>
</div> </div>
</div> </div>
</div> </div>
<span class="custom-divider"></span> </div>
<div class="div-item"> <div class="div-item div-item-switch">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<span class="label">文字开关</span> <span class="label">路径显隐</span>
<input class="btn-switch" type="checkbox" @model="labelShow"> <input class="btn-switch" type="checkbox" @model="lineShow">
</div>
<div class="col"></div>
</div> </div>
<div class="row"> <div class="col">
<div class="col" style="margin-right: 14px;"> <span class="label">模型显隐</span>
<span class="label">字体颜色</span> <input class="btn-switch" type="checkbox" @model="modelShow">
<div class="labelColor"></div>
</div>
<div class="col font-select-box">
<span class="label" style="flex: none;">字体选择</span>
<div class="input input-select font-select"></div>
</div>
<div class="col">
<span class="label">字体大小</span>
<div class="input-number input-number-unit-2" style="width: 82px;">
<input class="input" type="number" title="" min="1" max="99" @model="labelFontSize">
<span class="unit">px</span>
<span class="arrow"></span>
</div>
</div>
</div> </div>
<div class="row"> <div class="col">
<div class="col"> <span class="label">实时路径</span>
<span class="label">视野缩放</span> <input class="btn-switch" type="checkbox" @model="realTimeRoute">
<input class="btn-switch" type="checkbox" @model="labelScaleByDistance"> </div>
</div> </div>
<div class="col"> <div class="row">
<span class="label">最近距离</span> <div class="col">
<div class="input-number input-number-unit-1" style="width: 82px;"> <span class="label">编辑</span>
<input class="input" type="number" title="" min="1" max="99999999" @model="labelNear"> <input class="btn-switch" type="checkbox" @model="lineEdit">
<span class="unit">m</span> </div>
<span class="arrow"></span> <div class="col">
</div> <span class="label">路径圆滑</span>
</div> <input class="btn-switch" type="checkbox" @model="smooth">
<div class="col"> </div>
<span class="label">最远距离</span> <div class="col">
<div class="input-number input-number-unit-1" style="width: 82px;"> <span class="label">环线</span>
<input class="input" type="number" title="" min="1" max="99999999" @model="labelFar"> <input class="btn-switch" type="checkbox" @model="noseToTail">
<span class="unit">m</span> </div>
<span class="arrow"></span> </div>
</div> <div class="row">
<div class="col">
<span class="label">轨迹贴地</span>
<input class="btn-switch" type="checkbox" @model="ground">
</div>
<div class="col">
<span class="label">轨迹循环</span>
<input class="btn-switch" type="checkbox" @model="loop">
</div>
<div class="col">
<span class="label">轨迹动画</span>
<input class="btn-switch" type="checkbox" @model="state">
</div>
</div>
<div class="row">
<div class="col">
<span class="label">路径方向</span>
<input class="btn-switch" type="checkbox" @model="routeDirection">
</div>
<div class="col" style="margin-right: 33px;">
<span class="label">视角跟随</span>
<input class="btn-switch" type="checkbox" @model="viewFollow">
</div>
<div class="col" style="margin: 0px;">
<span class="label">模型动画</span>
<div class="input input-select model-animate-select"></div>
</div>
</div>
</div>
<span class="custom-divider"></span>
<div class="div-item">
<div class="row">
<div class="col">
<span class="label">文字开关</span>
<input class="btn-switch" type="checkbox" @model="labelShow">
</div>
<div class="col"></div>
</div>
<div class="row">
<div class="col" style="margin-right: 14px;">
<span class="label">字体颜色</span>
<div class="labelColor"></div>
</div>
<div class="col font-select-box">
<span class="label" style="flex: none;">字体选择</span>
<div class="input input-select font-select"></div>
</div>
<div class="col">
<span class="label">字体大小</span>
<div class="input-number input-number-unit-2" style="width: 82px;">
<input class="input" type="number" title="" min="1" max="99" @model="labelFontSize">
<span class="unit">px</span>
<span class="arrow"></span>
</div> </div>
</div> </div>
</div> </div>
<span class="custom-divider"></span> <div class="row">
<div class="div-item"> <div class="col">
<div class="row"> <span class="label">视野缩放</span>
<div class="col"> <input class="btn-switch" type="checkbox" @model="labelScaleByDistance">
<span class="label">油耗</span> </div>
<div class="input-number input-number-unit-6" style="width: 170px;"> <div class="col">
<input class="input" type="number" title="" min="1" max="99999999" @model="unitFuelConsumption"> <span class="label">最近距离</span>
<span class="unit">L/100km</span> <div class="input-number input-number-unit-1" style="width: 82px;">
<span class="arrow"></span> <input class="input" type="number" title="" min="1" max="99999999" @model="labelNear">
</div> <span class="unit">m</span>
<span class="arrow"></span>
</div> </div>
<div class="col" style="flex: 0 0 0;"> </div>
<span class="label">总油耗</span> <div class="col">
<input class="btn-switch" type="checkbox" @model="fuelShow"> <span class="label">最远距离</span>
<div class="input-number input-number-unit-1" style="width: 82px;">
<input class="input" type="number" title="" min="1" max="99999999" @model="labelFar">
<span class="unit">m</span>
<span class="arrow"></span>
</div> </div>
</div> </div>
</div> </div>
<span class="custom-divider"></span> </div>
` <span class="custom-divider"></span>
`
} }
export { html } export { html }

View File

@ -78,7 +78,6 @@ class TrajectoryMotion extends Base {
this.options.line.smooth = options.line.smooth ? options.line.smooth : false this.options.line.smooth = options.line.smooth ? options.line.smooth : false
this.options.line.noseToTail = options.line.noseToTail ? options.line.noseToTail : false this.options.line.noseToTail = options.line.noseToTail ? options.line.noseToTail : false
this.positions_smooth = [] this.positions_smooth = []
this.options.unitFuelConsumption = options.unitFuelConsumption || 0
this.options.ground = options.ground || false this.options.ground = options.ground || false
this.options.state = (options.state || options.state === false) ? options.state : true this.options.state = (options.state || options.state === false) ? options.state : true
this.options.routeDirection = (options.routeDirection || options.routeDirection === false) ? options.routeDirection : true this.options.routeDirection = (options.routeDirection || options.routeDirection === false) ? options.routeDirection : true
@ -181,8 +180,7 @@ class TrajectoryMotion extends Base {
if (this.realTimeRoute) { if (this.realTimeRoute) {
this.realTimeLine && (this.realTimeLine.show = (!this.showView || this.showView == 3 || !sdkD) ? true : false) this.realTimeLine && (this.realTimeLine.show = (!this.showView || this.showView == 3 || !sdkD) ? true : false)
} }
this.label && (this.label.show = (!this.showView || this.showView == 3) ? this.options.label.show : false) this.label && (this.label.show = (!this.showView || this.showView == 3 || !sdkD) ? this.options.label.show : false)
this.fuelLabel && (this.fuelLabel.show = (!this.showView || this.showView == 3) ? this.options.fuelShow : false)
} }
else { else {
this.model.show = (!this.showView || this.showView == 3 || !sdkD) ? this.options.show : false this.model.show = (!this.showView || this.showView == 3 || !sdkD) ? this.options.show : false
@ -205,7 +203,6 @@ class TrajectoryMotion extends Base {
this.keyPoints[i].show = (!this.showView || this.showView == 3) ? show : false this.keyPoints[i].show = (!this.showView || this.showView == 3) ? show : false
} }
this.label && (this.label.show = false) this.label && (this.label.show = false)
this.fuelLabel && (this.fuelLabel.show = false)
this.viewFollow = false this.viewFollow = false
} }
@ -260,17 +257,14 @@ class TrajectoryMotion extends Base {
// Cesium.Matrix4.multiplyByTranslation(this.model.modelMatrix, new Cesium.Cartesian3(0, 0, -difference), this.model.modelMatrix) // Cesium.Matrix4.multiplyByTranslation(this.model.modelMatrix, new Cesium.Cartesian3(0, 0, -difference), this.model.modelMatrix)
// Cesium.Matrix4.getTranslation(this.model.modelMatrix, this.model.position) // Cesium.Matrix4.getTranslation(this.model.modelMatrix, this.model.position)
this.label && (this.label.show = this.label.show) this.label && (this.label.show = this.label.show)
this.fuelLabel && (this.fuelLabel.show = this.fuelLabel.show)
if (this.options.label.position) { if (this.options.label.position) {
setTimeout(() => { setTimeout(() => {
if (this.options.label.position.alt) { if (this.options.label.position.alt) {
this.label && (this.label.position = [this.options.label.position.lng, this.options.label.position.lat, this.options.label.position.alt]) this.label && (this.label.position = [this.options.label.position.lng, this.options.label.position.lat, this.options.label.position.alt])
this.fuelLabel && (this.fuelLabel.position = [this.options.label.position.lng, this.options.label.position.lat, this.options.label.position.alt])
} }
else { else {
this.getClampToHeight({ lng: this.options.label.position.lng, lat: this.options.label.position.lat }).then((height) => { this.getClampToHeight({ lng: this.options.label.position.lng, lat: this.options.label.position.lat }).then((height) => {
this.label && (this.label.position = [this.options.label.position.lng, this.options.label.position.lat, height]) this.label && (this.label.position = [this.options.label.position.lng, this.options.label.position.lat, height])
this.fuelLabel && (this.fuelLabel.position = [this.options.label.position.lng, this.options.label.position.lat, height])
}) })
} }
}, 0) }, 0)
@ -1174,21 +1168,18 @@ class TrajectoryMotion extends Base {
show = false show = false
} }
if (this.show) { if (this.show) {
if (this.label) { this.label && (this.label.show = show)
this.label.show = show if (this.options.label.position) {
this.label.pixelOffset = this.options.label.pixelOffset + (this.fuelShow ? this.labelFontSize + 20 : 0) setTimeout(() => {
if (this.options.label.position) { if (this.options.label.position.alt) {
setTimeout(() => { this.label && (this.label.position = [this.options.label.position.lng, this.options.label.position.lat, this.options.label.position.alt])
if (this.options.label.position.alt) { }
this.label && (this.label.position = [this.options.label.position.lng, this.options.label.position.lat, this.options.label.position.alt]) else {
} this.getClampToHeight({ lng: this.options.label.position.lng, lat: this.options.label.position.lat }).then((height) => {
else { this.label && (this.label.position = [this.options.label.position.lng, this.options.label.position.lat, height])
this.getClampToHeight({ lng: this.options.label.position.lng, lat: this.options.label.position.lat }).then((height) => { })
this.label && (this.label.position = [this.options.label.position.lng, this.options.label.position.lat, height]) }
}) }, 0);
}
}, 0);
}
} }
} }
else { else {
@ -1206,7 +1197,6 @@ class TrajectoryMotion extends Base {
set labelFontFamily(v) { set labelFontFamily(v) {
this.options.label.fontFamily = v || 0 this.options.label.fontFamily = v || 0
this.label && (this.label.fontFamily = this.options.label.fontFamily) this.label && (this.label.fontFamily = this.options.label.fontFamily)
this.fuelLabel && (this.fuelLabel.fontFamily = this.options.label.fontFamily)
let name = getFontFamilyName(this.labelFontFamily) || '' let name = getFontFamilyName(this.labelFontFamily) || ''
this._elms.labelFontFamily && this._elms.labelFontFamily &&
@ -1221,7 +1211,6 @@ class TrajectoryMotion extends Base {
set labelColor(v) { set labelColor(v) {
this.options.label.color = v this.options.label.color = v
this.label && (this.label.color = v) this.label && (this.label.color = v)
this.fuelLabel && (this.fuelLabel.color = v)
if (this._elms.labelColor) { if (this._elms.labelColor) {
this._elms.labelColor.forEach((item, i) => { this._elms.labelColor.forEach((item, i) => {
let labelColorPicker = new YJColorPicker({ let labelColorPicker = new YJColorPicker({
@ -1249,13 +1238,6 @@ class TrajectoryMotion extends Base {
set labelFontSize(v) { set labelFontSize(v) {
this.options.label.fontSize = v this.options.label.fontSize = v
this.label && (this.label.fontSize = v) this.label && (this.label.fontSize = v)
if (this.fuelLabel) {
this.fuelLabel.fontSize = v
this.label.pixelOffset = this.options.label.pixelOffset + v + 20
}
else {
this.label.pixelOffset = this.options.label.pixelOffset
}
this._elms.labelFontSize && this._elms.labelFontSize.forEach((item) => { this._elms.labelFontSize && this._elms.labelFontSize.forEach((item) => {
item.value = v item.value = v
}) })
@ -1267,7 +1249,6 @@ class TrajectoryMotion extends Base {
set labelScaleByDistance(v) { set labelScaleByDistance(v) {
this.options.label.scaleByDistance = v this.options.label.scaleByDistance = v
this.label && (this.label.scaleByDistance = v) this.label && (this.label.scaleByDistance = v)
this.fuelLabel && (this.fuelLabel.scaleByDistance = v)
this._elms.labelScaleByDistance && this._elms.labelScaleByDistance.forEach((item) => { this._elms.labelScaleByDistance && this._elms.labelScaleByDistance.forEach((item) => {
item.checked = v item.checked = v
}) })
@ -1283,7 +1264,6 @@ class TrajectoryMotion extends Base {
} }
this.options.label.near = near this.options.label.near = near
this.label && (this.label.near = near) this.label && (this.label.near = near)
this.fuelLabel && (this.fuelLabel.near = near)
this._elms.labelNear && this._elms.labelNear.forEach((item) => { this._elms.labelNear && this._elms.labelNear.forEach((item) => {
item.value = near item.value = near
}) })
@ -1299,66 +1279,11 @@ class TrajectoryMotion extends Base {
} }
this.options.label.far = far this.options.label.far = far
this.label && (this.label.far = far) this.label && (this.label.far = far)
this.fuelLabel && (this.fuelLabel.far = far)
this._elms.labelFar && this._elms.labelFar.forEach((item) => { this._elms.labelFar && this._elms.labelFar.forEach((item) => {
item.value = far item.value = far
}) })
} }
get unitFuelConsumption() {
return this.options.unitFuelConsumption
}
set unitFuelConsumption(v) {
this.options.unitFuelConsumption = v
this._elms.unitFuelConsumption && this._elms.unitFuelConsumption.forEach((item) => {
item.value = v
})
}
get fuelShow() {
return this.options.fuelShow
}
set fuelShow(v) {
this.options.fuelShow = v
let show = v
if (this.show && (!this.showView || this.showView == 3)) {
show = v
}
else {
show = false
}
if (this.show) {
if (this.fuelLabel) {
this.fuelLabel.show = show
this.label.pixelOffset = this.options.label.pixelOffset + (show ? this.labelFontSize + 20 : 0)
}
else {
this.label.pixelOffset = this.options.label.pixelOffset
}
if (this.options.label.position) {
setTimeout(() => {
if (this.options.label.position.alt) {
this.fuelLabel && (this.fuelLabel.position = [this.options.label.position.lng, this.options.label.position.lat, this.options.label.position.alt])
}
else {
this.getClampToHeight({ lng: this.options.label.position.lng, lat: this.options.label.position.lat }).then((height) => {
this.fuelLabel && (this.fuelLabel.position = [this.options.label.position.lng, this.options.label.position.lat, height])
})
}
}, 0);
}
}
else {
this.fuelLabel && (this.fuelLabel.show = false)
this.label.pixelOffset = this.options.label.pixelOffset
}
this._elms.fuelShow && this._elms.fuelShow.forEach((item) => {
item.checked = v
})
}
// 创建路径 // 创建路径
static addLine(that) { static addLine(that) {
let positions_smooth = that.renewLinePositions(that.options.line.positions) let positions_smooth = that.renewLinePositions(that.options.line.positions)
@ -1477,7 +1402,6 @@ class TrajectoryMotion extends Base {
} }
let pos = that.smooth ? that.positions_smooth : Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArrayHeights) let pos = that.smooth ? that.positions_smooth : Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArrayHeights)
TrajectoryMotion.createLabel(that) TrajectoryMotion.createLabel(that)
TrajectoryMotion.createFuelLabel(that)
that.modelMove(pos) that.modelMove(pos)
@ -1487,13 +1411,13 @@ class TrajectoryMotion extends Base {
static async createLabel(that) { static async createLabel(that) {
let labelPosition = that.cartesian3Towgs84(that.model.position, that.sdk.viewer) let labelPosition = that.cartesian3Towgs84(that.model.position, that.sdk.viewer)
that.label = new LabelObject(that.sdk, { that.label = new LabelObject(that.sdk, {
show: that.options.show ? (that.options.label.show ? true : false) : false, show: that.options.show ? (that.options.model.show ? that.options.label.show : false) : false,
position: [labelPosition.lng, labelPosition.lat, labelPosition.alt], position: [labelPosition.lng, labelPosition.lat, labelPosition.alt],
text: that.options.name, text: that.options.name,
fontSize: that.options.label.fontSize, fontSize: that.options.label.fontSize,
fontFamily: that.options.label.fontFamily, fontFamily: that.options.label.fontFamily,
color: that.options.label.color, color: that.options.label.color,
pixelOffset: that.options.label.pixelOffset + (that.options.fuelShow ? that.options.label.fontSize + 20 : 0), pixelOffset: that.options.label.pixelOffset,
backgroundColor: that.options.label.backgroundColor, backgroundColor: that.options.label.backgroundColor,
lineColor: that.options.label.lineColor, lineColor: that.options.label.lineColor,
lineWidth: that.options.label.lineWidth, lineWidth: that.options.label.lineWidth,
@ -1503,26 +1427,6 @@ class TrajectoryMotion extends Base {
}, that.model) }, that.model)
} }
static async createFuelLabel(that) {
let labelPosition = that.cartesian3Towgs84(that.model.position, that.sdk.viewer)
that.fuelLabel = new LabelObject(that.sdk, {
show: that.options.show ? (that.options.fuelShow ? true : false) : false,
// show: true,
position: [labelPosition.lng, labelPosition.lat, labelPosition.alt],
text: '总油耗:',
fontSize: that.options.label.fontSize,
fontFamily: that.options.label.fontFamily,
color: that.options.label.color,
pixelOffset: 0,
backgroundColor: ['#6e6e6e', '#6e6e6e'],
lineColor: '#00ffff00',
lineWidth: 0,
scaleByDistance: that.options.label.scaleByDistance,
near: that.options.label.near,
far: that.options.label.far
}, that.model)
}
// 创建关键点 // 创建关键点
static async addKeyPoint(that) { static async addKeyPoint(that) {
for (let i = 0; i < that.options.line.positions.length; i++) { for (let i = 0; i < that.options.line.positions.length; i++) {
@ -1627,8 +1531,8 @@ class TrajectoryMotion extends Base {
else { else {
setPosition(startDistance) setPosition(startDistance)
setTimeout(() => { setTimeout(() => {
_this.model.isMove = false _this.model && (_this.model.isMove = false)
}, 1000); }, 500);
animateUpdate() animateUpdate()
@ -1651,8 +1555,6 @@ class TrajectoryMotion extends Base {
} }
async function setPosition(distance) { async function setPosition(distance) {
_this.totalFuelConsumption = Number((distance / 100 * _this.unitFuelConsumption).toFixed(2))
_this.fuelLabel.text = '总油耗:' + _this.totalFuelConsumption + ' L'
_this.model.isMove = true _this.model.isMove = true
let sdk2D = get2DView() let sdk2D = get2DView()
let splitSdk = getSdk() let splitSdk = getSdk()
@ -1764,9 +1666,10 @@ class TrajectoryMotion extends Base {
if (!cartesian3) { if (!cartesian3) {
return return
} }
coordinates = _this.cartesian3Towgs84(cartesian3, viewer); let pos84 = _this.cartesian3Towgs84(cartesian3, viewer);
coordinates = [pos84.lng, pos84.lat, pos84.alt + 1.8]
position = cartesian3 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 = [] let positions_smooth = []
for (let i = 0; i <= 1000; i++) { for (let i = 0; i <= 1000; i++) {
if ((i / 1000) > (distance / _this.distance)) { if ((i / 1000) > (distance / _this.distance)) {
@ -1864,7 +1767,6 @@ class TrajectoryMotion extends Base {
} }
let labelPosition = _this.cartesian3Towgs84(position, _this.sdk.viewer) let labelPosition = _this.cartesian3Towgs84(position, _this.sdk.viewer)
_this.label.position = [labelPosition.lng, labelPosition.lat, labelPosition.alt] _this.label.position = [labelPosition.lng, labelPosition.lat, labelPosition.alt]
_this.fuelLabel.position = [labelPosition.lng, labelPosition.lat, labelPosition.alt]
lastDistance = distance lastDistance = distance
// console.log(position) // console.log(position)
_this.realTimeRouteArray.push(position) _this.realTimeRouteArray.push(position)
@ -1890,7 +1792,7 @@ class TrajectoryMotion extends Base {
else { else {
if (_this.sdk.viewer.trackedEntity) { if (_this.sdk.viewer.trackedEntity) {
_this.sdk.viewer.camera.setView({ _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: { orientation: {
heading: Cesium.Math.toRadians(-90), heading: Cesium.Math.toRadians(-90),
pitch: 0, pitch: 0,
@ -2186,7 +2088,7 @@ class TrajectoryMotion extends Base {
rubricElm.style.color = '#ff5733'; rubricElm.style.color = '#ff5733';
rubricElm.style.display = 'none' rubricElm.style.display = 'none'
rubricElm.innerHTML = `场景正方向为轨迹前进正方向<div x-arrow="" class="custom__popper__arrow" style="left: 59px;"></div>` rubricElm.innerHTML = `场景正方向为轨迹前进正方向<div x-arrow="" class="custom__popper__arrow" style="left: 59px;"></div>`
let iconRubric = contentElm.getElementsByClassName('icon-rubric')[0] let iconRubric = contentElm.getElementsByClassName('icon-rubric')[0]
iconRubric.addEventListener('mouseenter', (e) => { iconRubric.addEventListener('mouseenter', (e) => {
rubricElm.style.display = 'block' rubricElm.style.display = 'block'
@ -2261,7 +2163,6 @@ class TrajectoryMotion extends Base {
this.sdk.viewer.entities.remove(this.line) this.sdk.viewer.entities.remove(this.line)
this.sdk.viewer.entities.remove(this.realTimeLine) this.sdk.viewer.entities.remove(this.realTimeLine)
this.label && this.label.remove() this.label && this.label.remove()
this.fuelLabel && this.fuelLabel.remove()
for (let i = 0; i < this.keyPointShow.length; i++) { for (let i = 0; i < this.keyPointShow.length; i++) {
this.sdk.viewer.entities.remove(this.keyPointShow[i]) this.sdk.viewer.entities.remove(this.keyPointShow[i])
} }
@ -2269,7 +2170,6 @@ class TrajectoryMotion extends Base {
this.realTimeLine = null this.realTimeLine = null
this.model = null this.model = null
this.label = null this.label = null
this.fuelLabel = null
if (this._DialogObject && !this._DialogObject.isDestroy) { if (this._DialogObject && !this._DialogObject.isDestroy) {
this._DialogObject.close() this._DialogObject.close()
this._DialogObject = null this._DialogObject = null
@ -2323,7 +2223,6 @@ class TrajectoryMotion extends Base {
this.model && (this.model.show = false) this.model && (this.model.show = false)
} }
this.labelShow = this.originalOptions.label.show this.labelShow = this.originalOptions.label.show
this.fuelLabelShow = this.originalOptions.fuelShow
this.labelColor = this.originalOptions.label.color this.labelColor = this.originalOptions.label.color
this.labelFontSize = this.originalOptions.label.fontSize this.labelFontSize = this.originalOptions.label.fontSize
this.labelFontFamily = this.originalOptions.label.fontFamily this.labelFontFamily = this.originalOptions.label.fontFamily

View File

@ -253,7 +253,7 @@ class WallRealStereoscopic extends Base {
} }
set labelShow(v) { set labelShow(v) {
this.options.label.show = v this.options.label.show = v
if (this.show) { if (this.show && !this.showView || this.showView == 3) {
this.label.show = v this.label.show = v
} }
else { else {

View File

@ -157,7 +157,7 @@ class WallStereoscopic extends Base {
} }
set labelShow(v) { set labelShow(v) {
this.options.label.show = v this.options.label.show = v
if (this.show) { if (this.show && !this.showView || this.showView == 3) {
this.label.show = v this.label.show = v
} }
else { else {

View File

@ -243,7 +243,7 @@ class WallRealStereoscopic extends Base {
} }
set labelShow(v) { set labelShow(v) {
this.options.label.show = v this.options.label.show = v
if (this.show) { if (this.show && !this.showView || this.showView == 3) {
this.label.show = v this.label.show = v
} }
else { else {

View File

@ -195,7 +195,7 @@ class WallStereoscopic extends Base {
} }
set labelShow(v) { set labelShow(v) {
this.options.label.show = v this.options.label.show = v
if (this.show) { if (this.show && !this.showView || this.showView == 3) {
this.label.show = v this.label.show = v
} }
else { else {

View File

@ -9,6 +9,7 @@ import Tools from "../../Tools";
import { getHost, getToken } from "../../on"; import { getHost, getToken } from "../../on";
import { regLeftClickCallback, regRightClickCallback, regMoveCallback } from "../../Global/ClickCallback"; import { regLeftClickCallback, regRightClickCallback, regMoveCallback } from "../../Global/ClickCallback";
import { regLeftClickCallback as regLeftClickCallback2, regRightClickCallback as regRightClickCallback2, regMoveCallback as regMoveCallback2 } from "../../Global/SplitScreen/ClickCallback"; import { regLeftClickCallback as regLeftClickCallback2, regRightClickCallback as regRightClickCallback2, regMoveCallback as regMoveCallback2 } from "../../Global/SplitScreen/ClickCallback";
import { regLeftClickCallback as regLeftClickCallback3, regRightClickCallback as regRightClickCallback3, regMoveCallback as regMoveCallback3 } from "../../Global/MultiViewportMode/ClickCallback";
import { setSplitDirection, syncSplitData, getSdk } from "../../Global/SplitScreen"; import { setSplitDirection, syncSplitData, getSdk } from "../../Global/SplitScreen";
import { syncData, getSdk as get2DSdk } from '../../Global/MultiViewportMode' import { syncData, getSdk as get2DSdk } from '../../Global/MultiViewportMode'
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../Global/global' import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../Global/global'
@ -68,7 +69,7 @@ class Base extends Tools {
let sdk2D = get2DSdk().sdkD let sdk2D = get2DSdk().sdkD
if (!sdk2D) { if (!sdk2D) {
this.#_showView = v this.#_showView = v
if(this.entity) { if (this.entity) {
this.entity._showView = v this.entity._showView = v
} }
return return
@ -361,12 +362,17 @@ class Base extends Tools {
console.error('val:', val, '不是一个function') console.error('val:', val, '不是一个function')
} else { } else {
let sdkD = getSdk().sdkD let sdkD = getSdk().sdkD
let sdk2D = get2DSdk().sdkD
if (sdkD && this.sdk === sdkD) { if (sdkD && this.sdk === sdkD) {
if (this.clickCallBack == null && this.options && this.options.id) { if (this.clickCallBack == null && this.options && this.options.id) {
regLeftClickCallback2(this.options.id, this.leftClickCB, this) regLeftClickCallback2(this.options.id, this.leftClickCB, this)
} }
} }
else { else if (sdk2D && this.sdk === sdk2D) {
if (this.clickCallBack == null && this.options && this.options.id) {
regLeftClickCallback3(this.options.id, this.leftClickCB, this)
}
} else {
if (this.clickCallBack == null && this.options && this.options.id) { if (this.clickCallBack == null && this.options && this.options.id) {
regLeftClickCallback(this.options.id, this.leftClickCB, this) regLeftClickCallback(this.options.id, this.leftClickCB, this)
} }
@ -384,12 +390,17 @@ class Base extends Tools {
console.error('val:', val, '不是一个function') console.error('val:', val, '不是一个function')
} else { } else {
let sdkD = getSdk().sdkD let sdkD = getSdk().sdkD
let sdk2D = get2DSdk().sdkD
if (sdkD && this.sdk === sdkD) { if (sdkD && this.sdk === sdkD) {
if (this.rightClickCallBack == null && this.entity && this.entity.id) { if (this.rightClickCallBack == null && this.entity && this.entity.id) {
regRightClickCallback2(this.entity.id, this.rightClickCB, this) regRightClickCallback2(this.entity.id, this.rightClickCB, this)
} }
} }
else { else if (sdk2D && this.sdk === sdk2D) {
if (this.clickCallBack == null && this.options && this.options.id) {
regRightClickCallback3(this.options.id, this.leftClickCB, this)
}
} else {
if (this.rightClickCallBack == null && this.entity && this.entity.id) { if (this.rightClickCallBack == null && this.entity && this.entity.id) {
regRightClickCallback(this.entity.id, this.rightClickCB, this) regRightClickCallback(this.entity.id, this.rightClickCB, this)
} }
@ -407,12 +418,17 @@ class Base extends Tools {
console.error('val:', val, '不是一个function') console.error('val:', val, '不是一个function')
} else { } else {
let sdkD = getSdk().sdkD let sdkD = getSdk().sdkD
let sdk2D = get2DSdk().sdkD
if (sdkD && this.sdk === sdkD) { if (sdkD && this.sdk === sdkD) {
if (this.mouseMoveCallBack == null && this.entity && this.entity.id) { if (this.mouseMoveCallBack == null && this.entity && this.entity.id) {
regMoveCallback2(this.entity.id, this.mouseMoveCB, this) regMoveCallback2(this.entity.id, this.mouseMoveCB, this)
} }
} }
else { else if (sdk2D && this.sdk === sdk2D) {
if (this.clickCallBack == null && this.options && this.options.id) {
regMoveCallback3(this.options.id, this.leftClickCB, this)
}
} else {
if (this.mouseMoveCallBack == null && this.entity && this.entity.id) { if (this.mouseMoveCallBack == null && this.entity && this.entity.id) {
regMoveCallback(this.entity.id, this.mouseMoveCB, this) regMoveCallback(this.entity.id, this.mouseMoveCB, this)
} }

View File

@ -78,6 +78,7 @@ class Dialog extends BaseDialog {
this.footAppChild(div) this.footAppChild(div)
if (this.options.updateHeightCallBack) { if (this.options.updateHeightCallBack) {
let heightBtn = document.createElement('button'); let heightBtn = document.createElement('button');
heightBtn.className = 'update-height'
heightBtn.innerHTML = '<svg class="icon-updateheigh"><use xlink:href="#yj-icon-updateheight"></use></svg>更新高程' heightBtn.innerHTML = '<svg class="icon-updateheigh"><use xlink:href="#yj-icon-updateheight"></use></svg>更新高程'
heightBtn.style.width = 'auto' heightBtn.style.width = 'auto'
heightBtn.addEventListener('click', () => { heightBtn.addEventListener('click', () => {

View File

@ -50,7 +50,8 @@ export default class CircleDiffuseMaterialProperty {
let color = this.colors[ratio[i]] let color = this.colors[ratio[i]]
_sourceColor = _sourceColor + ` _sourceColor = _sourceColor + `
if(dis < float(${Number(ratio[i]) / 2})) { 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;
} }
` `
} }

View File

@ -238,8 +238,8 @@ function StreamWall2() {
else { else {
material.alpha = 1.0; material.alpha = 1.0;
} }
material.diffuse = color.rgb*0.0; material.diffuse = colorImage.rgb * color.rgb*0.0;
material.emission = color.rgb * 1.0; material.emission = colorImage.rgb * color.rgb * 1.0;
return material; return material;
}`, }`,
components: { components: {

View File

@ -1493,6 +1493,23 @@ 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'
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}
`
document.body.appendChild(message)
message.classList.add(type)
}
} }

View File

@ -62,9 +62,9 @@ class YJEarth {
removeIncetance(id) { removeIncetance(id) {
this.entityMap.delete(id) this.entityMap.delete(id)
unRegLeftClickCallback(id) unRegLeftClickCallback(this, id)
unRegRightClickCallback(id) unRegRightClickCallback(this, id)
unregMoveCallback(id) unregMoveCallback(this, id)
syncSplitData(this, id) syncSplitData(this, id)
} }
@ -436,6 +436,7 @@ class YJEarth {
textList[i].style['pointer-events'] = 'all' textList[i].style['pointer-events'] = 'all'
textList[i].querySelector('textarea').focus() textList[i].querySelector('textarea').focus()
_this.isLeftClick = true _this.isLeftClick = true
_this.entityMap.get(_this.clickTextDom.id).isClick(movement.position, _this.clickTextDom.id)
break; break;
} }
} }

View File

@ -2743,7 +2743,7 @@
/* 贴地svg */ /* 贴地svg */
.YJ-custom-base-dialog.ground-svg>.content { .YJ-custom-base-dialog.ground-svg>.content {
width: 535px; width: 560px;
} }
.YJ-custom-base-dialog.ground-svg>.content>div .div-item:nth-of-type(2) .row .col .label { .YJ-custom-base-dialog.ground-svg>.content>div .div-item:nth-of-type(2) .row .col .label {
@ -3120,7 +3120,7 @@
} }
/* 文本框 */ /* 文本框 */
.popup-textarea{ .popup-textarea {
/* width: 212px; */ /* width: 212px; */
width: 161px; width: 161px;
/* height: 154px; */ /* height: 154px; */
@ -3140,21 +3140,22 @@
border: unset!important; border: unset!important;
color: #fff; color: #fff;
} }
.popup-textarea textarea::-webkit-scrollbar { .popup-textarea textarea::-webkit-scrollbar {
width: 8px!important; width: 8px !important;
/* height: 8px!important; */ /* height: 8px!important; */
} }
.popup-textarea textarea::-webkit-scrollbar-thumb { .popup-textarea textarea::-webkit-scrollbar-thumb {
border-radius: 5px!important; border-radius: 5px !important;
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2)!important; -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2) !important;
background-color: rgba(var(--color-sdk-base-rgb))!important; background-color: rgba(var(--color-sdk-base-rgb)) !important;
} }
.popup-textarea textarea::-webkit-scrollbar-track { .popup-textarea textarea::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2)!important; -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2) !important;
border-radius: 5px!important; border-radius: 5px !important;
background-color: rgba(var(--color-sdk-base-rgb), 0.1)!important; background-color: rgba(var(--color-sdk-base-rgb), 0.1) !important;
} }
/* 贴地图片 */ /* 贴地图片 */
@ -3627,6 +3628,7 @@
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
backdrop-filter: blur(2px);
} }
.billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-top .DIV-cy-tab-pane-title { .billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-top .DIV-cy-tab-pane-title {
@ -3762,3 +3764,55 @@
.billboard-attribute-box .table .table-body .tr:first-child { .billboard-attribute-box .table .table-body .tr:first-child {
border-top: none; 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);
}
/* 滑入动画 */
@keyframes YJ-custom-message-slideDown {
to {
top: 20px;
/* 移动到屏幕顶部 */
}
}
/* 淡出动画 - 1500ms后执行 */
@keyframes YJ-custom-message-fadeOut {
to {
opacity: 0;
top: -200px
/* 移回顶部外 */
}
}