Merge branch 'develop' of http://xny.yj-3d.com:3000/zh/sdk4.0 into develop

This commit is contained in:
2025-08-22 18:32:13 +08:00
59 changed files with 3735 additions and 488 deletions

View File

@ -1,5 +1,5 @@
class BaseDialog {
constructor(container, options = {}) {
constructor(container, options = {}, only = true) {
this.container = container
this.options = { ...options }
this.options.ismove = true
@ -9,10 +9,13 @@ class BaseDialog {
this.closeCallBack = options.closeCallBack
this._element = {}
this._element_style = undefined
this.only = only
}
async init() {
if (this.only) {
this.closeAll()
}
DialogAll.push(this)
this.isDestroy = false
// body
@ -48,6 +51,15 @@ class BaseDialog {
<button class="close">关闭</button>
`
this._element.body.appendChild(this._element.foot)
let curtain = await document.createElement('div')
curtain.style.position = 'absolute'
curtain.style.top = '0'
curtain.style.left = '0'
curtain.style.width = '100%'
curtain.style.height = '100%'
curtain.style.backdropFilter = 'blur(2px)'
curtain.style.zIndex = '-999999'
this._element.body.appendChild(curtain)
// 关闭
let closeBtnsBox = this._element.body.getElementsByClassName('close-box')[0];

View File

@ -59,12 +59,17 @@ export default class DrawAttackArrow extends Draw {
return
}
into = '3D'
let pos84 = this.cartesian3Towgs84(cartesian, this.viewer)
let lastPos84 = cache_positions[cache_positions.length - 1]
if(lastPos84 && (lastPos84.lng === pos84.lng && lastPos84.lat === pos84.lat)) {
return
}
if (!this.entityHasCreated) {
let polyline_id = DrawAttackArrow.create_arrow_polygon(this)
this.points_ids.push(polyline_id)
}
this.points_ids.push(this.create_point(cartesian))
cache_positions.push(this.cartesian3Towgs84(cartesian, this.viewer))
cache_positions.push(pos84)
isMove = false
})
this.event.mouse_right((movement, cartesian) => {

View File

@ -13,6 +13,7 @@ class DrawPolygon extends Draw {
* */
constructor(sdk, options = {}) {
super(sdk, options)
this.color = options.color || 'rgba(255,0,0,0.5)'
this.polygonHasCreated = false
}
@ -34,8 +35,8 @@ class DrawPolygon extends Draw {
positions: new Cesium.CallbackProperty((e) => {
return that.positions.concat(that.positions[0])
}),
width: 2,
material: Cesium.Color.fromCssColorString('#c1c505').withAlpha(0.5),
width: 3,
material: Cesium.Color.fromCssColorString(that.color).withAlpha(1),
clampToGround: true,
zIndex: 99999999
},

View File

@ -1420,11 +1420,11 @@ async function MapPrint(sdk, thumbnailImg, rectangle, originalImg) {
const url = URL.createObjectURL(blob);
let downloadElement = document.createElement('a');
downloadElement.href = url;
downloadElement.download = `高清出图-${getDateTimeString()}.jpg`;
downloadElement.download = `高清出图-${getDateTimeString()}.png`;
document.body.appendChild(downloadElement);
downloadElement.click();
document.body.removeChild(downloadElement);
}, 'image/jpeg', 0.95);
}, 'image/png', 0.95);
exporting = false;
exportBtn.innerHTML = '打印';
// canvas2.toBlob(function (blob) {

View File

@ -124,7 +124,7 @@ function syncViewer() {
if (height > 9000000) {
height = 9000000
}
if (height < 100000) {
if (height < 400000) {
this.entity.billboard.show = true
this.entity.rectangle.show = false
}

View File

@ -4,18 +4,38 @@
import Tools from "../../Tools";
import { getCoordinateSystem } from "../../Global/global";
import MouseEvent from '../../Event/index'
import { getSdk as get2DSdk } from '../../Global/MultiViewportMode'
import { getSdk as getSplitScreenSdk } from "../../Global/SplitScreen";
let event
let event2
let MouseCoordinateElm
let requestAnimationFrameEventId
let tmovement
let targetSdk
let sdkD
const MouseCoordinate = (sdk, status) => {
if (!sdk || !sdk.viewer) {
return
}
targetSdk = sdk
sdkD = get2DSdk().sdkD
if(!sdkD) {
sdkD = getSplitScreenSdk().sdkD
}
let tools = new Tools(sdk)
if (status) {
if (event) {
event.destroy()
}
if (event2) {
event2.destroy()
event2 = undefined
}
event = new MouseEvent(sdk)
tmovement = null
let position = {
x: '',
y: '',
@ -40,22 +60,60 @@ const MouseCoordinate = (sdk, status) => {
contentElm.style['background-size'] = `200% 200%`;
MouseCoordinateElm = contentElm
}
sdk.viewer._element.appendChild(contentElm)
let tmovement
sdk.viewer.container.appendChild(contentElm)
event.mouse_move((movement, cartesian) => {
tmovement = { ...movement }
targetSdk = sdk
tmovement = { ...movement.endPosition }
})
const getPosition = () => {
if(!tmovement) {
if (!targetSdk) {
return
}
let canvas = sdk.viewer._element.getElementsByTagName('canvas')[0]
let left = tmovement.endPosition.x;
let top = tmovement.endPosition.y;
let cartesian = event.getcartesian(tmovement)
contentElm.style['background-position-x'] = `${-canvas.width + left + 4}px`;
contentElm.style['background-position-y'] = `${-canvas.height + top - 2}px`;
sdkD = get2DSdk().sdkD
if(!sdkD) {
sdkD = getSplitScreenSdk().sdkD
}
if (!event2 && sdkD) {
event2 = new MouseEvent(sdkD)
event2.mouse_move((movement, cartesian) => {
targetSdk = sdkD
tmovement = { x: movement.endPosition.x, y: movement.endPosition.y }
})
}
if (!tmovement) {
return
}
let left = tmovement.x;
let top = tmovement.y;
let cartesian
if (targetSdk.viewer.scene.mode === 2) {
left = left + canvas.width
cartesian = targetSdk.viewer.camera.pickEllipsoid(tmovement, targetSdk.viewer.scene.globe.ellipsoid)
}
else {
cartesian = targetSdk.viewer.scene.pickPosition(tmovement)
if (!cartesian) {
const ray = targetSdk.viewer.camera.getPickRay(position); //相交的射线
let pickedObjects = targetSdk.viewer.scene.drillPickFromRay(ray, 10);
let result = {}
for (let i = 0; i < pickedObjects.length; i++) {
if (pickedObjects[i].position) {
result = pickedObjects[i]
break
}
}
cartesian = result.position
if (!cartesian) {
cartesian = targetSdk.viewer.scene.globe.pick(ray, targetSdk.viewer.scene);
}
}
}
contentElm.style['background-position-x'] = `${-sdk.viewer.container.clientWidth + left + 4}px`;
contentElm.style['background-position-y'] = `${-sdk.viewer.container.clientHeight + top - 2}px`;
// this.entity.position = cartesian
if (cartesian) {
let degrees = tools.cartesian3Towgs84(cartesian, sdk.viewer)
@ -97,10 +155,13 @@ const MouseCoordinate = (sdk, status) => {
else {
if (event) {
event.destroy()
event = undefined
}
if (event2) {
event2.destroy()
event2 = undefined
}
if (MouseCoordinateElm) {
sdk.viewer._element.removeChild(MouseCoordinateElm)
sdk.viewer.container.removeChild(MouseCoordinateElm)
MouseCoordinateElm = undefined
}
if (requestAnimationFrameEventId) {

View File

@ -49,7 +49,16 @@ async function init(sdk) {
sdk2D.viewer.imageryLayers.removeAll()
for (let i = 0; i < imageryLayers.length; i++) {
let entity = sdk2D.viewer.imageryLayers.addImageryProvider(imageryLayers[i].imageryProvider, imageryLayers[i]._layerIndex)
if(imageryLayers[i]._id) {
entity._id = imageryLayers[i]._id
}
entity.show = imageryLayers[i].show
entity.alpha = imageryLayers[i].alpha
if (imageryLayers[i]._objectState) {
if (imageryLayers[i]._showView == 3) {
entity.show = false
}
}
}
// sdk.viewer.entities.collectionChanged.addEventListener(syncEntities)
// sdk.viewer.dataSources.dataSourceAdded.addEventListener(syncDataSources)
@ -61,6 +70,12 @@ async function init(sdk) {
JwwStatusSwitch(sdk2, true)
}
sdk.entityMap.forEach((item, key) => {
if (item.showView == 2) {
item.showView = 2
}
})
}
async function on(sdk) {
if (sdk2D) {
@ -94,6 +109,11 @@ function off(sdk) {
activeViewer = null
syncObject = {}
}
sdk.entityMap.forEach((item, key) => {
if (item.showView) {
item.show = item.show
}
})
}
async function syncData2(sdk, id, entityId) {
@ -119,7 +139,11 @@ async function syncData2(sdk, id, entityId) {
options.heightMode = 0
options.height = 0
}
if (!that.type || (that.type !== 'tileset' && that.type !== 'bim' && that.type !== 'glb' && that.type !== 'layer')) {
if (!that.type || (that.type !== 'tileset' && that.type !== 'bim' && that.type !== 'glb' && that.type !== 'layer' && that.type !== 'wallStereoscopic')) {
if (that.showView == 3) {
options.show = false
}
let newObject = await new that.constructor(sdk2D, options)
newObject.onClick = that.onClick
newObject.onRightClick = that.onRightClick
@ -207,8 +231,15 @@ async function syncData2(sdk, id, entityId) {
obj.options.heightReference = 1
}
let options = syncObject.tools.deepCopyObj(obj.options)
if (!obj.type || (obj.type !== 'tileset' && obj.type !== 'bim' && obj.type !== 'glb' && obj.type !== 'layer')) {
let target = await new obj.constructor(sdk2D, options)
if (!obj.type || (obj.type !== 'tileset' && obj.type !== 'bim' && obj.type !== 'glb' && obj.type !== 'layer' && obj.type !== 'wallStereoscopic')) {
if (obj.showView == 3) {
options.show = false
}
let target = await sdk2D.entityMap.get(options.id)
if(target) {
await target.remove()
}
target = await new obj.constructor(sdk2D, options)
target.onClick = obj.onClick
target.onRightClick = obj.onRightClick
target.onMouseMove = obj.onMouseMove
@ -401,12 +432,26 @@ function syncImageryLayerRemoved(layer, index) {
sdk2D.viewer.imageryLayers.remove(layer2d)
}
function syncImageryLayerShownOrHidden(layer, index, state) {
return
let layer2d = sdk2D.viewer.imageryLayers._layers[index]
let layer3d = sdk3D.viewer.imageryLayers._layers[index]
console.log('layer2d', layer2d, sdk2D, layer3d)
if (!layer2d) {
return
}
if (layer3d._objectState) {
if (!layer3d._showView || layer3d._showView == 2) {
layer2d.show = true
}
if (layer3d._showView == 3) {
layer2d.show = false
}
}
else {
layer2d.show = state
}
}
async function syncPrimitives(primitive) {
if (!sdk3D) {
@ -535,6 +580,7 @@ function syncViewer() {
}
function get2DView() {
return sdk2D
}

View File

@ -517,7 +517,7 @@ async function setSplitDirection(v, id, isoff = false, entityId) {
thatD.textShow = thatP.textShow
}
if (thatP.label && thatP.labelShow) {
thatP.label.entity.show = true
thatP.labelShow = true
}
if (thatD.label) {
thatD.label.options.ground = false

View File

@ -121,6 +121,9 @@ function MouseRightMenu(sdk, status, callBack) {
<ul class="base" style="list-style: none;padding: 0;margin: 0;font-size: 12px;">
<li style="padding: 3px 10px;cursor: pointer;">绕鼠标点旋转</li>
</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}
`
_element.appendChild(menuElm)
@ -175,6 +178,7 @@ function MouseRightMenu(sdk, status, callBack) {
break
case '文本框':
object.position = position
key = 'textBox'
break
}
eventListener[sdk.div_id].callBack(key, object)

View File

@ -91,7 +91,7 @@ class MeasureDistance extends Measure {
//暂时固定取20个点
if (d > 20) {//大于20m时固定取20个点
if (d > 2) {//大于20m时固定取20个点
meters = d / 20
await start(meters)
} else if (d < 1) {
@ -106,8 +106,8 @@ class MeasureDistance extends Measure {
async sampleHeight(p1, index) {
let p2 = await this.sampleHeightMostDetailed([p1])
p1.alt = p2[0].height
let height = await this.getClampToHeight(p1, [...this.sdk.viewer.entities.values])
p1.alt = height
return {position: p1, index}
}

View File

@ -47,6 +47,11 @@ class ContourAnalysis {
YJ.Analysis.AnalysesResults.push(this)
this.createNewLine();
}
get type() {
return 'ContourAnalysis'
}
createNewLine() {
ContourAnalysis.interpolatePoint(this);
}

View File

@ -63,11 +63,15 @@ class VisibilityAnalysis extends Tools {
that.tip.set_text("左键创建视角终点,右键结束通视分析")
if (!that.resultObject.viewPoint) {
let pos84 = that.cartesian3Towgs84(cartesian, that.viewer)
let positions = await Cesium.sampleTerrainMostDetailed(
let positions
if(that.sdk.viewer.terrainProvider.availability)
{
positions = await Cesium.sampleTerrainMostDetailed(
that.sdk.viewer.terrainProvider,
[Cesium.Cartographic.fromDegrees(pos84.lng, pos84.lat)]
);
if (positions[0].height > pos84.alt) {
}
if (positions && positions[0].height > pos84.alt) {
pos84.alt = positions[0].height
}
pos84.alt = pos84.alt + that.viewPointHeight

View File

@ -40,7 +40,7 @@ class AssembleObject extends Base {
this.options.positions = options.positions || []
this.options.line = options.line || {}
this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3)
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 0.5)'
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)'
this.options['area-unit'] = options['area-unit'] || '平方米'
this.entity
this.event = new MouseEvent(this.sdk)

View File

@ -40,7 +40,7 @@ class AttackArrowObject extends Base {
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
this.options.line = options.line || {}
this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3)
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 0.5)'
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)'
this.options['area-unit'] = options['area-unit'] || '平方米'
this.entity
this.event = new MouseEvent(this.sdk)

View File

@ -9,7 +9,7 @@
import Dialog from '../../../Element/Dialog';
import CoordTransform from "../../../../transform/CoordTransform";
import BaseSource from "../index";
import { syncData } from '../../../../Global/MultiViewportMode'
import { syncData, get2DView } from '../../../../Global/MultiViewportMode'
import { setSplitDirection, syncSplitData } from '../../../../Global/SplitScreen'
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../../Global/global'
@ -244,8 +244,19 @@ class BaseLayer extends BaseSource {
this.originalOptions = this.deepCopyObj(this.options)
this._DialogObject.close()
this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(this.originalOptions)
syncData(this.sdk, this.options.id)
// syncData(this.sdk, this.options.id)
syncSplitData(this.sdk, this.options.id)
let sdk2D = get2DView()
if (sdk2D && sdk2D != this.sdk) {
for(let i=0;i<sdk2D.viewer.imageryLayers._layers.length;i++) {
let layer = sdk2D.viewer.imageryLayers._layers[i]
if(layer._id && layer._id == this.options.id) {
layer.alpha = this.options.alpha
break
}
}
}
},
closeCallBack: () => {
this.reset()

View File

@ -56,7 +56,7 @@ function html(that) {
</div>
</div>
<div class="col">
<span class="label">固定大小</span>
<span class="label" style="flex: 0 0 60px;">固定大小</span>
<input class="btn-switch" type="checkbox" @model="scaleByDistance">
</div>
</div>

View File

@ -78,6 +78,11 @@ class BaseTerrain extends BaseSource {
close() {
this.sdk.viewer.scene.terrainProvider =
new Cesium.EllipsoidTerrainProvider({})
for (let i = 0; i < YJ.Analysis.AnalysesResults.length; i++) {
if (YJ.Analysis.AnalysesResults[i].type === 'ContourAnalysis') {
YJ.Analysis.AnalysesResults[i].destroy()
}
}
syncSplitData(this.sdk, this.options.id)
clearTimeout(this.#updateModelTimeout)

View File

@ -40,6 +40,11 @@ import {
import { getGoodsList } from '../../../Tools/getGoodsList'
class BillboardObject extends Base {
#_postRenderEvent = null
#_destroyMouseEvent = null
#_billboardHeight = 0
/**
* @constructor
* @description 创建点标注
@ -118,6 +123,7 @@ class BillboardObject extends Base {
this.options.positions.alt = Number(
Number(options.positions.alt || 0).toFixed(2)
)
this.#_billboardHeight = this.options.positions.alt
// this.options.diffuseShow = options.diffuseShow || false
// this.options.diffuseRadius = (options.diffuseRadius || options.diffuseRadius === 0) ? options.diffuseRadius : 10
// this.options.diffuseDuration = (options.diffuseDuration || options.diffuseDuration === 0) ? options.diffuseDuration : 2000
@ -145,11 +151,18 @@ class BillboardObject extends Base {
this.options.attribute.goods.content || []
this.options.attributeType = options.attributeType || 'richText'
this.options.coordinate = options.coordinate || ''
this.options.attributeBoxState = options.attributeBoxState || false
this.operate = {}
this._elms = {}
this.previous = {
positions: { ...this.options.positions }
}
this.options.attributePos = options.attributePos || {
x: 60,
y: 60,
width: 200,
height: 120
}
this.entity
this._proj = this.sdk.proj
@ -182,7 +195,108 @@ 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)
@ -243,6 +357,7 @@ class BillboardObject extends Base {
that.entity.billboard.imgHeight = 0
that.entity.billboard.image = canvas
addCluster(that.sdk, that.entity)
that.attributeBoxState && (that.attributeBoxState = true)
}
return
}
@ -267,6 +382,7 @@ class BillboardObject extends Base {
return img
}, false)
addCluster(that.sdk, that.entity)
that.attributeBoxState && (that.attributeBoxState = true)
}
})
}
@ -298,6 +414,7 @@ class BillboardObject extends Base {
that.entity.billboard.imgHeight = height
that.entity.billboard.image = canvas
addCluster(that.sdk, that.entity)
that.attributeBoxState && (that.attributeBoxState = true)
}
}
image.onerror = function (err) {
@ -309,6 +426,7 @@ class BillboardObject extends Base {
that.entity.billboard.imgHeight = 0
that.entity.billboard.image = canvas
addCluster(that.sdk, that.entity)
that.attributeBoxState && (that.attributeBoxState = true)
}
};
}
@ -465,14 +583,45 @@ class BillboardObject extends Base {
return this.options.show
}
set show(v) {
if (!this.isShowView) {
this.options.show = v
this.originalOptions.show = v
this.entity && (this.entity.show = v)
}
if (!this.showView || this.showView == 3) {
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 {
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)
syncSplitData(this.sdk, this.options.id)
if (this._DialogObject && this._DialogObject.showBtn) {
this._DialogObject.showBtn.checked = v
this._DialogObject.showBtn.checked = this.options.show
}
this.isShowView = false
// if (v) {
// if (this.diffuseShow) {
// this.diffuseShow = true
@ -552,6 +701,26 @@ class BillboardObject extends Base {
if (this.entity) {
this.entity.billboard.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)
}
@ -606,6 +775,7 @@ class BillboardObject extends Base {
}
set alt(v) {
this.options.positions.alt = Number(Number(v).toFixed(2))
this.#_billboardHeight = this.options.positions.alt
// this.scan && (this.scan.alt = v)
// this.diffuse && (this.diffuse.alt = v)
this.renewPoint()
@ -766,6 +936,8 @@ class BillboardObject extends Base {
_this._frameImages = []
superGif.load(function (status) {
if (status == 404) {
let width = 31
let height = 36
canvas = document.createElement('canvas')
canvas.width = 0
canvas.height = 0
@ -855,6 +1027,8 @@ class BillboardObject extends Base {
billboardH = height * (31 / width)
}
image.onerror = function (err) {
let width = 31
let height = 36
canvas.width = 0
canvas.height = 0
billboardH = 0
@ -1702,6 +1876,22 @@ class BillboardObject extends Base {
this.cameraSelect && this.cameraSelect()
this.ISCSelect && this.ISCSelect()
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 attributeElm = this._DialogObject._element.content.getElementsByClassName(
'attribute-select-box'
@ -2213,6 +2403,7 @@ class BillboardObject extends Base {
this.attributeCamera = this.options.attribute.camera.content
this.attributeGoods = this.options.attribute.goods.content
this.attributeISC = this.options.attribute.ISC.content
this.attributeBoxState = this.options.attributeBoxState
this.cameraSelect && this.cameraSelect()
this.goodsSelect && this.goodsSelect()
}
@ -2220,6 +2411,7 @@ class BillboardObject extends Base {
async remove() {
await remove_entity_from_cluster(this.sdk.viewer, this.entity)
this.entity = null
this.attributeBoxState = false
if (!this.sdk.viewer || !this.sdk.viewer.entities) {
return
}
@ -2344,6 +2536,9 @@ class BillboardObject extends Base {
}
async updateHeight() {
if (!this.sdk || !this.sdk.viewer || !this.sdk.viewer.scene) {
return
}
let height
let height2
let point1 = new Cesium.Cartesian3.fromDegrees(
@ -2422,6 +2617,7 @@ class BillboardObject extends Base {
switch (this._elms.heightMode.value) {
case '海拔高度':
heightElm.value = this.options.positions.alt
this.#_billboardHeight = this.options.positions.alt
break
case '相对地表':
if (this.sdk.viewer.scene.terrainProvider.availability) {
@ -2437,15 +2633,18 @@ class BillboardObject extends Base {
heightElm.value = Number(
(this.options.positions.alt - position[0].height).toFixed(2)
)
this.#_billboardHeight = this.options.positions.alt
})
} else {
heightElm.value = this.options.positions.alt
this.#_billboardHeight = this.options.positions.alt
}
break
case '依附地表':
break
case '依附模型':
heightElm.value = this.options.positions.alt
this.#_billboardHeight = this.options.positions.alt
break
}
}
@ -2719,6 +2918,216 @@ class BillboardObject extends Base {
(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

View File

@ -6,7 +6,7 @@ import EventBinding from '../../Element/Dialog/eventBinding';
import richText from "../../Element/richText";
import MouseEvent from '../../../Event/index'
import LabelObject from '../LabelObject'
import { syncData } from '../../../Global/MultiViewportMode'
import { syncData, getSdk as get2DSdk } from '../../../Global/MultiViewportMode'
import { legp } from '../../Element/datalist';
import { getFontList, getFontFamilyName } from '../../Element/fontSelect'
import MouseTip from '../../../MouseTip'
@ -223,16 +223,31 @@ class CircleDiffuse extends Base {
set show(v) {
if (typeof v === "boolean") {
let sdkD = get2DSdk().sdkD
if (!this.isShowView || !sdkD) {
this.options.show = v
this.entity.show = v
}
if (!this.showView || this.showView == 3 || !sdkD) {
this.entity.show = this.options.show
if (this.options.label.show) {
this.label.show = this.options.show
}
}
else {
this.entity.show = false
if (this.options.label.show) {
this.label.show = false
}
}
this.isShowView = false
syncData(this.sdk, this.options.id)
syncSplitData(this.sdk, this.options.id)
if (this._DialogObject && this._DialogObject.showBtn) {
this._DialogObject.showBtn.checked = v
}
if (this.options.label.show) {
this.label.show = v
}
} else {
console.error("参数必须为boolean")
}
@ -362,6 +377,7 @@ class CircleDiffuse extends Base {
return this.options.circle
}
set circle(v) {
console.log(v)
this.options.circle = v || [{ radius: 10 }]
for (let i = 0; i < this.options.circle.length; i++) {
if(this.options.circle[i].radius>999999) {
@ -427,8 +443,9 @@ class CircleDiffuse extends Base {
return this.options.label.show
}
set labelShow(v) {
let sdkD = get2DSdk().sdkD
this.options.label.show = v
if (this.show) {
if (this.show && (!this.showView || this.showView == 3 || !sdkD)) {
this.label.show = v
}
else {
@ -1321,7 +1338,7 @@ class CircleDiffuse extends Base {
}
async remove() {
this.label.remove()
this.label && this.label.remove()
this.entity && this.sdk.viewer.entities.remove(this.entity)
this.entity2 && this.sdk.viewer.entities.remove(this.entity2)
this.entity = null
@ -1405,7 +1422,7 @@ class CircleDiffuse extends Base {
}
}
this._radius = radius
inputElm.value = value
// inputElm.value = value
CircleDiffuse.create(this)
}
}

View File

@ -45,7 +45,7 @@ class CircleObject extends Base {
this.options.center = options.center || {}
this.options.line = options.line || {}
this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3)
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 0.5)'
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)'
this.options['area-unit'] = options['area-unit'] || '平方米'
options.label = options.label || {}
this._elms = {};
@ -333,7 +333,7 @@ class CircleObject extends Base {
}
set labelShow(v) {
this.options.label.show = v
if (this.show) {
if (this.show && (!this.showView || this.showView == 3)) {
this.label.show = v
}
else {

View File

@ -30,7 +30,7 @@ class CurvelineObject extends Base {
* @param options.heightMode{number} 高度模式0海拔高度1相对高度2依附模式
* @param options['nose-to-tail']=false {boolean} 首尾相连
* @param options.extend=false {boolean} 线缓冲
* @param options['extend-width']=1 {number} 线缓冲宽度
* @param options['extend-width']=10 {number} 线缓冲宽度
* @param options['extend-color']=#ffde00 {number} 线缓冲颜色
* @param options.show=true {boolean} 显隐
* @param {Array.<object>} options.positions 坐标数组 [{lng,lat},...]
@ -66,8 +66,8 @@ class CurvelineObject extends Base {
this.options['extend-width'] =
options['extend-width'] || options['extend-width'] === 0
? options['extend-width']
: 1
this.options['extend-color'] = options['extend-color'] || '#ffde00'
: 10
this.options['extend-color'] = options['extend-color'] || 'rgba(255,255,80,0.3)'
this.options.show =
options.show || options.show === false ? options.show : true
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2

View File

@ -24,7 +24,7 @@ class EllipseObject extends Base {
* @param options.name {string} 名称
* @param options.show=true {boolean} 显示/隐藏
* @param options.center {object} 位置
* @param options.color="#ff000080" {string} 颜色
* @param options.color="rgba(255, 0, 0, 0.5)" {string} 颜色
* @param options.center.lng {object} 经度
* @param options.center.lat {object} 维度
* @param options.semiMinorAxis=10 {number} 短半轴长度
@ -32,14 +32,14 @@ class EllipseObject extends Base {
* @param options.bearing=0 {number} 旋转角度
* @param options.line {object} 边框
* @param options.line.width=2 {string} 边框宽
* @param options.line.color="#ff000080" {string} 边框颜色
* @param options.line.color="rgba(255, 0, 0, 1)" {string} 边框颜色
* @param options.label {object} 标注
* @param options.heightMode=2{number} 高度模式0海拔高度1相对地表2依附模式
*/
constructor(sdk, options = {}) {
super(sdk, options);
this.options.name = options.name || '未命名对象'
this.options.color = options.color || "#ff000080"
this.options.color = options.color || "rgba(255, 0, 0, 0.5)"
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
this.options.semiMinorAxis = (options.semiMinorAxis || options.semiMinorAxis === 0) ? options.semiMinorAxis : 10
this.options.semiMajorAxis = (options.semiMajorAxis || options.semiMajorAxis === 0) ? options.semiMajorAxis : 20
@ -47,7 +47,7 @@ class EllipseObject extends Base {
this.options.center = options.center || {}
this.options.line = options.line || {}
this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3)
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 0.5)'
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)'
this.options['area-unit'] = options['area-unit'] || '平方米'
options.label = options.label || {}
this._elms = {};

View File

@ -8,6 +8,8 @@
import { getHost, getToken } from "../../../on";
import Base from '../index'
import Tools from '../../../Tools'
import { syncSplitData } from "../../../Global/SplitScreen";
import { syncData, getSdk as get2DSdk } from '../../../Global/MultiViewportMode'
import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../Global/global'
class GeoJson extends Base {
@ -27,6 +29,7 @@ class GeoJson extends Base {
this.primitive = undefined
this.positions = []
this.loading = true
}
@ -48,6 +51,27 @@ class GeoJson extends Base {
return this.options.show
}
// set show(status) {
// let sdkD = get2DSdk().sdkD
// if (!this.isShowView || !sdkD) {
// this.options.show = status
// }
// if (this.entity) {
// if (!this.showView || this.showView == 3 || !sdkD) {
// for (let i = 0; i < this.entity.entities.values.length; i++) {
// this.entity.entities.values[i].show = this.options.show
// }
// }
// else {
// for (let i = 0; i < this.entity.entities.values.length; i++) {
// this.entity.entities.values[i].show = false
// }
// }
// }
// syncData(this.sdk, this.options.id)
// syncSplitData(this.sdk, this.options.id)
// this.isShowView = false
// }
set show(status) {
this.options.show = status
if (this.entity) {
@ -74,6 +98,7 @@ class GeoJson extends Base {
})
let json = await rsp.json()
this.geojson = json
// this.sdk.addIncetance(this.options.id, this)
return GeoJson.addDataToGlobe(this, json.features)
}

View File

@ -7,13 +7,21 @@ function html() {
<span class="label">名称</span>
<input class="input" maxlength="40" type="text" @model="name">
</div>
<div class="col">
</div>
<div class="col"></div>
</div>
</div>
<span class="custom-divider"></span>
<div class="div-item">
<div class="row">
<div class="col">
<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 class="row" mode="0">
<div class="col">
<span class="label">旋转角度</span>
<input type="range" max="360" min="0" step="0.1" @model="angle">
@ -24,16 +32,85 @@ function html() {
</div>
</div>
</div>
<div class="row">
<div class="row" mode="0">
<div class="col">
<span class="label">调整大小</span>
<input type="range" max="99999" min="0" step="0.1" @model="scale">
<input type="range" max="40000" min="0" step="0.1" @model="scale">
<div class="input-number input-number-unit-1" style="width: 100px;flex: 0 0 100px;margin-left: 10px;">
<input class="input" type="number" title="" min="0" max="99999" step="0.1" @model="scale">
<input class="input" type="number" title="" min="0" max="40000" step="0.1" @model="scale">
<span class="arrow"></span>
</div>
</div>
</div>
<div class="row" mode="1">
<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" mode="1">
<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 mode="1">文字设置</h4>
<div class="row" mode="1">
<div class="col" style="flex: 0 0 80px;margin: 0 10px;">
<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 150px;">
<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" type="number" title="" min="1" max="99" @model="labelFontSize" 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>
<span class="custom-divider"></span>
`

File diff suppressed because it is too large Load Diff

View File

@ -54,7 +54,7 @@ function html(that) {
<div class="row">
<div class="col" style="flex: 5;">
<span class="label">文字内容</span>
<input class="input" type="text" @model="textValue">
<input class="input" type="text" @model="textValue" maxlength="30">
</div>
<div class="col">
<button class="btn" @click="textPosPick">设置位置</span>

View File

@ -10,6 +10,7 @@ import { FontLoader } from '../../../../static/3rdparty/three/jsm/loaders/FontLo
import { TextGeometry } from '../../../../static/3rdparty/three/jsm/geometries/TextGeometry.js';
import * as variable from '../../../../static/3rdparty/three/fonts/FZZongYi-M05S_regular.typeface.json'
import Base from "../index";
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global'
import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen'
class GroundSvg extends Base {
@ -108,13 +109,19 @@ class GroundSvg extends Base {
this._isdrag = false
this._EventBinding = new EventBinding()
if(this.sdk.entityMap.get(this.options.id)) {
return
}
this.sdk.addIncetance(this.options.id, this)
this.picking = true
if (this.options.show) {
setSplitDirection(0, this.options.id)
}
this._entityArray = []
this.init()
}
@ -153,12 +160,18 @@ class GroundSvg extends Base {
set show(v) {
if (typeof v === "boolean") {
super.show = v
if (this.options.text && this.options.text.show && this.text) {
if (this.options.text && this.options.text.show) {
if(this.text) {
if((!this.showView || this.showView == 3)) {
this.text.show = v
}
syncData(this.sdk, this.options.id)
syncSplitData(this.sdk, this.options.id)
else {
this.text.show = false
}
}
}
super.show = v
} else {
console.error("参数必须为boolean")
}
@ -304,7 +317,12 @@ class GroundSvg extends Base {
set textShow(v) {
this.options.text.show = v
if (this.show) {
if((!this.showView || this.showView == 3)) {
this.text && (this.text.show = v)
}
else {
this.text && (this.text.show = false)
}
if (this.options.text.position) {
setTimeout(() => {
if (this.options.text.position.alt) {
@ -820,8 +838,13 @@ class GroundSvg extends Base {
}
for (let i = 0; i < this.hierarchys.length; i++) {
for (let m = 0; m < this.hierarchys[i].length; m++) {
let id = this.options.id + `-${i}_${m}}`
let oldEntity = this.sdk.viewer.entities.getById(id)
if(oldEntity) {
this.sdk.viewer.entities.remove(oldEntity)
}
let entity = this.sdk.viewer.entities.add({
id: this.options.id + `-${i}_${m}`,
id: this.options.id + `-${i}_${m}}`,
show: this.options.show,
polygon: {
hierarchy: new Cesium.CallbackProperty(() => {
@ -854,6 +877,7 @@ class GroundSvg extends Base {
color: this.geojson.features[i].properties.color
}
}
this._entityArray.push(entity)
this.entity.add(entity)
}
}
@ -1189,7 +1213,7 @@ class GroundSvg extends Base {
* @param {boolean} status=false 状态
*/
drag(status, cd) {
if (!this.#loaded) {
if (!this.#loaded || !this.sdk || !this.sdk.viewer) {
return
}
this.ismove = false
@ -1256,6 +1280,9 @@ class GroundSvg extends Base {
// 中心点到鼠标的距离
let distance = turf.rhumbDistance(pointC, point2, options);
let flag = false
let flag2 = false
switch (this.pickPoint.id) {
case 'svg-control-points_0':
angle = bearing2_0 - bearing1
@ -1267,12 +1294,39 @@ class GroundSvg extends Base {
bearingH = (((turf.rhumbBearing(pointC, turf.point(controlPoints[2])) + 360) - this.angle) % 360)
angleW = bearing2 - bearingW
angleH = bearing2 - bearingH
if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) {
angleW = angleW + 180
flag=true
}
if ((angleH > -360 && angleH < -90) || (angleH < 360 && angleH > 90)) {
angleH = angleH + 180
flag2=true
}
if(flag && flag2) {
this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#ff0000')
}
else {
if(flag) {
this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#ff0000')
this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
}
else if(flag2) {
this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#ff0000')
this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
}
else {
this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#ff0000')
this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
}
}
radiansW = (Math.PI / 180) * angleW
@ -1291,6 +1345,12 @@ class GroundSvg extends Base {
if ((angleH > -360 && angleH < -90) || (angleH < 360 && angleH > 90)) {
angleH = angleH + 180
this.pointEntityCollection.values[2].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[8].point.color = Cesium.Color.fromCssColorString('#ff0000')
}
else {
this.pointEntityCollection.values[2].point.color = Cesium.Color.fromCssColorString('#ff0000')
this.pointEntityCollection.values[8].point.color = Cesium.Color.fromCssColorString('#00ff0a')
}
radiansH = (Math.PI / 180) * angleH
@ -1308,9 +1368,37 @@ class GroundSvg extends Base {
if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) {
angleW = angleW + 180
flag=true
}
if ((angleH > -360 && angleH < -90) || (angleH < 360 && angleH > 90)) {
angleH = angleH + 180
flag2=true
}
if(flag && flag2) {
this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#ff0000')
this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
}
else {
if(flag) {
this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#ff0000')
this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
}
else if(flag2) {
this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#ff0000')
}
else {
this.pointEntityCollection.values[1].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[3].point.color = Cesium.Color.fromCssColorString('#ff0000')
this.pointEntityCollection.values[7].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[9].point.color = Cesium.Color.fromCssColorString('#00ff0a')
}
}
radiansW = (Math.PI / 180) * angleW
@ -1328,6 +1416,12 @@ class GroundSvg extends Base {
if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) {
angleW = angleW + 180
this.pointEntityCollection.values[4].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[6].point.color = Cesium.Color.fromCssColorString('#ff0000')
}
else {
this.pointEntityCollection.values[6].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[4].point.color = Cesium.Color.fromCssColorString('#ff0000')
}
radiansW = (Math.PI / 180) * angleW
@ -1358,6 +1452,12 @@ class GroundSvg extends Base {
if ((angleW > -360 && angleW < -90) || (angleW < 360 && angleW > 90)) {
angleW = angleW + 180
this.pointEntityCollection.values[6].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[4].point.color = Cesium.Color.fromCssColorString('#ff0000')
}
else {
this.pointEntityCollection.values[4].point.color = Cesium.Color.fromCssColorString('#00ff0a')
this.pointEntityCollection.values[6].point.color = Cesium.Color.fromCssColorString('#ff0000')
}
radiansW = (Math.PI / 180) * angleW
@ -1503,6 +1603,9 @@ class GroundSvg extends Base {
controlPoints[9] = turf.destination(point, wh, 0 + angle, options).geometry.coordinates
this.controlPoints = controlPoints
if(!this.sdk || !this.sdk.viewer) {
return
}
for (let i = 0; i < this.controlPoints.length; i++) {
let color = '#00ff0a'
if (i === 5) {
@ -1991,21 +2094,25 @@ class GroundSvg extends Base {
}
async remove() {
this._worker.onmessage = (event) => {}
await this.sdk.removeIncetance(this.options.id)
if (!this.entity) {
return
}
this.drag(false)
if(!this.sdk || !this.sdk.viewer) {
return
}
this.sdk.viewer.entities.remove(this.entity)
this.text && this.text.remove()
for (let i = this.entity.values.length; i >= 0; i--) {
this.sdk.viewer.entities.remove(this.entity.values[i])
}
this.entity = null
if (this._DialogObject && !this._DialogObject.isDestroy) {
this._DialogObject.close()
this._DialogObject = null
}
await this.sdk.removeIncetance(this.options.id)
await syncData(this.sdk, this.options.id)
}
@ -2065,6 +2172,59 @@ class GroundSvg extends Base {
}
this._update()
}
async flyTo(options = {}) {
if (this._error) {
return
}
setActiveViewer(0)
closeRotateAround(this.sdk)
closeViewFollow(this.sdk)
if (this.options.customView && this.options.customView.relativePosition && this.options.customView.orientation) {
let orientation = {
heading: Cesium.Math.toRadians(this.options.customView.orientation.heading || 0.0),
pitch: Cesium.Math.toRadians(this.options.customView.orientation.pitch || -60.0),
roll: Cesium.Math.toRadians(this.options.customView.orientation.roll || 0.0)
}
let lng = this.options.customView.relativePosition.lng
let lat = this.options.customView.relativePosition.lat
let alt = this.options.customView.relativePosition.alt
let destination = Cesium.Cartesian3.fromDegrees(lng, lat, alt)
let position = { ...this.options.position }
// 如果没有高度值,则获取紧贴高度计算
if (!position.hasOwnProperty('alt')) {
position.alt = await this.getClampToHeight(position)
}
lng = this.options.customView.relativePosition.lng + position.lng
lat = this.options.customView.relativePosition.lat + position.lat
alt = this.options.customView.relativePosition.alt + position.alt
destination = Cesium.Cartesian3.fromDegrees(lng, lat, alt)
this.sdk.viewer.camera.flyTo({
destination: destination,
orientation: orientation
})
}
else {
let array = []
for (let i = 0; i < this.controlPoints.length; i++) {
let height = await this.getClampToHeight({lng: this.controlPoints[i][0], lat: this.controlPoints[i][1]})
let cartesian = Cesium.Cartesian3.fromDegrees(this.controlPoints[i][0], this.controlPoints[i][1], height)
array.push(cartesian.x, cartesian.y, cartesian.z)
}
let BoundingSphere = Cesium.BoundingSphere.fromVertices(array)
this.sdk.viewer.camera.flyToBoundingSphere(BoundingSphere, {
offset: options.orientation || {
heading: Cesium.Math.toRadians(0.0),
pitch: Cesium.Math.toRadians(-60.0),
roll: Cesium.Math.toRadians(0.0)
}
})
}
}
}
export default GroundSvg

View File

@ -14,6 +14,8 @@ import {
class LabelObject extends Base {
#updateBillboardImageTimeout
#canvas = document.createElement('canvas')
#canvas2 = document.createElement('canvas')
constructor(sdk, options = {}, model) {
super(sdk, options)
this.model = model
@ -65,6 +67,11 @@ class LabelObject extends Base {
}
this.originalOptions = copyObj(this.options)
let id = this.options.id + '-label'
let oldEntity = this.sdk.viewer.entities.getById(id)
if(oldEntity) {
this.sdk.viewer.entities.remove(oldEntity)
}
this.entity = this.sdk.viewer.entities.add({
show: this.options.show,
id: this.options.id + '-label',
@ -433,11 +440,12 @@ class LabelObject extends Base {
this.updateBillboardImage()
}
updateBillboardImage() {
clearTimeout(this.#updateBillboardImageTimeout)
this.#updateBillboardImageTimeout = setTimeout(() => {
clearTimeout(this.#updateBillboardImageTimeout)
this.entity.billboard.image = this.getcanvas()
}, 500)
// clearTimeout(this.#updateBillboardImageTimeout)
// this.#updateBillboardImageTimeout = setTimeout(() => {
// clearTimeout(this.#updateBillboardImageTimeout)
// this.entity.billboard.image = this.getcanvas()
// }, 500)
}
get lineColor() {
return this.options.pixelOffset
@ -484,9 +492,8 @@ class LabelObject extends Base {
// }
getcanvas() {
const canvas = document.createElement('canvas')
const ctx = canvas.getContext('2d')
const ctx = this.#canvas.getContext('2d')
ctx.clearRect(0, 0, this.#canvas.width, this.#canvas.height);
ctx.font = this.options.fontSize + 'px ' + this.font
let texts = this.options.text.split('\n')
let canvasWidth = 0
@ -504,9 +511,8 @@ class LabelObject extends Base {
if (canvasWidth < this.options.lineWidth) {
canvasWidth = this.options.lineWidth
}
canvas.width = canvasWidth
canvas.height = this.options.pixelOffset + canvasHeight
this.#canvas.width = canvasWidth
this.#canvas.height = this.options.pixelOffset + canvasHeight
const linearGradient = ctx.createLinearGradient(
0,
0,
@ -553,15 +559,14 @@ class LabelObject extends Base {
ctx.stroke()
ctx.closePath()
const canvas2 = document.createElement('canvas')
const ctx2 = canvas2.getContext('2d')
canvas2.width = canvas.width + 10
canvas2.height = canvas.height + 10
ctx2.drawImage(canvas, 5, 5);
const ctx2 = this.#canvas2.getContext('2d')
this.#canvas2.width = this.#canvas.width + 10
this.#canvas2.height = this.#canvas.height + 10
ctx2.drawImage(this.#canvas, 5, 5);
// const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
// ctx.putImageData(imageData, 40, 40);
return canvas2
return this.#canvas2.toDataURL("image/png")
}
remove() {

View File

@ -7,7 +7,7 @@ import EventBinding from './eventBinding'
import Base from "../../index";
import MouseEvent from '../../../../Event/index'
import { syncPrimitives } from '../../../../Global/MultiViewportMode'
import { syncData } from '../../../../Global/MultiViewportMode'
import { syncData, getSdk as get2DSdk } from '../../../../Global/MultiViewportMode'
import MouseTip from '../../../../MouseTip'
import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen'
import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../../Global/global'
@ -82,18 +82,34 @@ class Flame extends Base {
set show(v) {
if (typeof v === "boolean") {
let sdkD = get2DSdk().sdkD
if (!this.isShowView || !sdkD) {
this.options.show = v
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
this.entity.show = v
}
if (!this.showView || this.showView == 3 || !sdkD) {
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
this.entity.show = this.options.show
}
if (this.options.label && this.options.label.show) {
this.label.show = this.options.show
}
}
else {
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
this.entity.show = false
}
if (this.options.label && this.options.label.show) {
this.label.show = false
}
}
if (this._DialogObject && this._DialogObject.showBtn) {
this._DialogObject.showBtn.checked = v
}
if (this.options.label && this.options.label.show) {
this.label.show = v
}
syncData(this.sdk, this.options.id)
syncSplitData(this.sdk, this.options.id)
this.isShowView = false
} else {
console.error("参数必须为boolean")
}

View File

@ -6,7 +6,7 @@ import { html } from "./_element";
import EventBinding from './eventBinding'
import Base from "../../index";
import MouseEvent from '../../../../Event/index'
import { syncData } from '../../../../Global/MultiViewportMode'
import { syncData, getSdk as get2DSdk } from '../../../../Global/MultiViewportMode'
import MouseTip from '../../../../MouseTip'
import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen'
import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../../Global/global'
@ -83,18 +83,32 @@ class Fountain extends Base {
set show(v) {
if (typeof v === "boolean") {
let sdkD = get2DSdk().sdkD
if (!this.isShowView || !sdkD) {
this.options.show = v
}
if (!this.showView || this.showView == 3 || !sdkD) {
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
this.entity.show = v
this.entity.show = this.options.show
}
if (this.options.label && this.options.label.show) {
this.label.show = this.options.show
}
}
else {
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
this.entity.show = false
}
if (this.options.label && this.options.label.show) {
this.label.show = false
}
}
if(this._DialogObject && this._DialogObject.showBtn) {
this._DialogObject.showBtn.checked = v
}
if (this.options.label && this.options.label.show) {
this.label.show = v
}
syncData(this.sdk, this.options.id)
syncSplitData(this.sdk, this.options.id)
this.isShowView = false
} else {
console.error("参数必须为boolean")
}

View File

@ -6,7 +6,7 @@ import { html, css } from "./_element";
import EventBinding from './eventBinding'
import Base from "../../index";
import MouseEvent from '../../../../Event/index'
import { syncData } from '../../../../Global/MultiViewportMode'
import { syncData, getSdk as get2DSdk } from '../../../../Global/MultiViewportMode'
import MouseTip from '../../../../MouseTip'
import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen'
import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../../Global/global'
@ -81,18 +81,32 @@ class Smoke extends Base {
set show(v) {
if (typeof v === "boolean") {
let sdkD = get2DSdk().sdkD
if (!this.isShowView || !sdkD) {
this.options.show = v
}
if (!this.showView || this.showView == 3 || !sdkD) {
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
this.entity.show = v
this.entity.show = this.options.show
}
if (this.options.label && this.options.label.show) {
this.label.show = this.options.show
}
}
else {
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
this.entity.show = false
}
if (this.options.label && this.options.label.show) {
this.label.show = false
}
}
if(this._DialogObject && this._DialogObject.showBtn) {
this._DialogObject.showBtn.checked = v
}
if (this.options.label && this.options.label.show) {
this.label.show = v
}
syncData(this.sdk, this.options.id)
syncSplitData(this.sdk, this.options.id)
this.isShowView = false
} else {
console.error("参数必须为boolean")
}

View File

@ -5,7 +5,7 @@ import Dialog from '../../../Element/Dialog';
import { html, css } from "./_element";
import Base from "../../index";
import MouseEvent from '../../../../Event/index'
import { syncData } from '../../../../Global/MultiViewportMode'
import { syncData, getSdk as get2DSdk } from '../../../../Global/MultiViewportMode'
import MouseTip from '../../../../MouseTip'
import { setSplitDirection, syncSplitData, setActiveId } from '../../../../Global/SplitScreen'
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../../Global/global'
@ -84,18 +84,32 @@ class Spout extends Base {
set show(v) {
if (typeof v === "boolean") {
let sdkD = get2DSdk().sdkD
if (!this.isShowView || !sdkD) {
this.options.show = v
}
if (!this.showView || this.showView == 3 || !sdkD) {
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
this.entity.show = v
this.entity.show = this.options.show
}
if (this.options.label && this.options.label.show) {
this.label.show = this.options.show
}
}
else {
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
this.entity.show = false
}
if (this.options.label && this.options.label.show) {
this.label.show = false
}
}
if(this._DialogObject && this._DialogObject.showBtn) {
this._DialogObject.showBtn.checked = v
}
if (this.options.label && this.options.label.show) {
this.label.show = v
}
syncData(this.sdk, this.options.id)
syncSplitData(this.sdk, this.options.id)
this.isShowView = false
} else {
console.error("参数必须为boolean")
}

View File

@ -40,7 +40,7 @@ class PincerArrowObject extends Base {
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
this.options.line = options.line || {}
this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3)
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 0.5)'
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)'
this.options['area-unit'] = options['area-unit'] || '平方米'
this.options.height = options.height
this.options.loop = options.loop || false

View File

@ -47,7 +47,7 @@ class PolygonObject extends Base {
this.options.line = options.line || {}
this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3)
this.options.line.color =
this.options.line.color || 'rgba(255, 0, 0, 0.5)'
this.options.line.color || 'rgba(255, 0, 0, 1)'
this.options['area-unit'] = options['area-unit'] || '平方米'
this.entity
this.event = new MouseEvent(this.sdk)
@ -1216,7 +1216,6 @@ class PolygonObject extends Base {
alt: this.label.position[2]
}
this.originalOptions = this.deepCopyObj(this.options)
console.log('000000000000',this.options.label.scaleByDistance)
this._DialogObject.close()
this.Dialog.confirmCallBack &&
this.Dialog.confirmCallBack(this.originalOptions)

View File

@ -21,6 +21,7 @@ class eventBinding {
let Event = []
let isEvent = false
let removeName = []
let blurEvent = () => { }
if (!elements[i] || !elements[i].attributes) {
continue
}
@ -36,7 +37,8 @@ class eventBinding {
Event.push((e) => {
let value = e.target.value
if (e.target.type == 'number') {
if (e.data != '.' && (e.data != '-' || e.target.value)) {
let str = e.target.value + ''
if (e.data != '.' && (e.data != '-' || e.target.value) && !(str.charAt(str.length - 1) == '0' && e.target.value.toString().includes('.')) && e.target.value != '0') {
value = Number(value)
if((e.target.max) && value>Number(e.target.max)) {
value = Number(e.target.max)
@ -57,6 +59,22 @@ class eventBinding {
that[m.value] = value
}
})
blurEvent = (e) => {
let value = e.target.value
if ((e.target.type == 'number') && (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null)))) {
value = Number(value)
if ((e.target.max) && value > Number(e.target.max)) {
value = Number(e.target.max)
}
if ((e.target.min) && value < Number(e.target.min)) {
value = Number(e.target.min)
}
if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) {
value = Number(e.target.dataset.min)
}
}
that[m.value] = value
}
if(elements[i].nodeName=='IMG') {
elements[i].src = that[m.value]
}
@ -114,6 +132,7 @@ class eventBinding {
Event[t](e)
}
});
elements[i].addEventListener('blur', blurEvent)
}
}
}

View File

@ -90,27 +90,6 @@ function html(that) {
<div class="col" style="flex: 0 0 37%;">
</div>
</div>
<div class="row" id="dashTextureDom">
<div class="col">
<span class="label">动画顺向</span>
<input class="btn-switch" type="checkbox" @model="rotate">
</div>
<div class="col" style="flex: 0 0 33%;">
<span class="label">流动速率</span>
<div class="input-number input-number-unit-1" style="width: 80px;">
<input class="input" type="number" title="" min="0" max="999999" step="1" @model="speed">
<span class="arrow"></span>
</div>
</div>
<div class="col" style="flex: 0 0 37%;">
<span class="label lineSpace">间距</span>
<div class="input-number input-number-unit-1 lineSpace" style="width: 80px;">
<input class="input" type="number" title="" min="0" max="4.5" step="0.1" @model="space">
<span class="unit">倍</span>
<span class="arrow"></span>
</div>
</div>
</div>
<div class="row">
<div class="col">
<span class="label">线段缓冲</span>
@ -129,6 +108,27 @@ function html(that) {
<div class="extendColor"></div>
</div>
</div>
<div class="row" id="dashTextureDom">
<div class="col">
<span class="label">首尾反向</span>
<input class="btn-switch" type="checkbox" @model="rotate">
</div>
<div class="col" style="flex: 0 0 33%;">
<span class="label">流动速率</span>
<div class="input-number input-number-unit-1" style="width: 80px;">
<input class="input" type="number" title="" min="0" max="999999" step="1" @model="speed">
<span class="arrow"></span>
</div>
</div>
<div class="col" style="flex: 0 0 37%;">
<span class="label lineSpace">线条间距</span>
<div class="input-number input-number-unit-1 lineSpace" style="width: 80px;">
<input class="input" type="number" title="" min="0" max="4.5" step="0.1" @model="space">
<span class="unit">倍</span>
<span class="arrow"></span>
</div>
</div>
</div>
</DIV-cy-tab-pane>
<DIV-cy-tab-pane label="标注风格">
${labelStyleElm1()}

View File

@ -13,10 +13,12 @@ import MouseTip from '../../../MouseTip'
import Controller from '../../../Controller/index'
import { syncData, get3DView } from '../../../Global/MultiViewportMode'
import { legp } from '../../Element/datalist'
import { getFontList, getFontFamilyName } from '../../Element/fontSelect'
import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen'
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global'
class PolylineObject extends Base {
#unitDataLegpObject
/**
* @constructor
* @param sdk
@ -30,8 +32,8 @@ class PolylineObject extends Base {
* @param options['nose-to-tail']=false {boolean} 首尾相连
* @param options.smooth=false {boolean} 线段圆滑
* @param options.extend=false {boolean} 线缓冲
* @param options['extend-width']=1 {number} 线缓冲宽度
* @param options['extend-color']=#ffde00 {number} 线缓冲颜色
* @param options['extend-width']=10 {number} 线缓冲宽度
* @param options['extend-color']=rgba(255,255,80,0.3) {number} 线缓冲颜色
* @param options.show=true {boolean} 显隐
* @param {Array.<object>} options.positions 坐标数组 [{lng,lat},...]
* @param options.label {object} 标注
@ -67,8 +69,8 @@ class PolylineObject extends Base {
this.options['extend-width'] =
options['extend-width'] || options['extend-width'] === 0
? options['extend-width']
: 1
this.options['extend-color'] = options['extend-color'] || '#ffde00'
: 10
this.options['extend-color'] = options['extend-color'] || 'rgba(255,255,80,0.3)'
this.options.show =
options.show || options.show === false ? options.show : true
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
@ -82,6 +84,7 @@ class PolylineObject extends Base {
options.label.fontSize || options.label.fontSize === 0
? options.label.fontSize
: 20,
fontFamily: options.label.fontFamily ? options.label.fontFamily : 0,
color: options.label.color || '#ffffff',
lineWidth:
options.label.lineWidth || options.label.lineWidth === 0
@ -268,6 +271,7 @@ class PolylineObject extends Base {
this._elms.lengthUnit.forEach(item => {
item.value = v
})
this.#unitDataLegpObject && this.#unitDataLegpObject.legp_searchActive(v)
if (this.options.lengthByMeter) {
if (this.unitNum > 2) {
switch (v) {
@ -715,6 +719,21 @@ class PolylineObject extends Base {
})
}
get labelFontFamily() {
return this.options.label.fontFamily
}
set labelFontFamily(v) {
this.options.label.fontFamily = v || 0
this.label && (this.label.fontFamily = this.options.label.fontFamily)
let name = getFontFamilyName(this.labelFontFamily) || ''
this._elms.labelFontFamily &&
this._elms.labelFontFamily.forEach(item => {
item.value = name
})
}
get labelColor() {
return this.options.label.color
}
@ -825,7 +844,6 @@ class PolylineObject extends Base {
set labelLineColor(v) {
this.options.label.lineColor = v
this.label.lineColor = v
let _this = this
if (this._elms.labelLineColor) {
this._elms.labelLineColor.forEach((item, i) => {
let lineColorPicker = new YJColorPicker({
@ -840,6 +858,29 @@ class PolylineObject extends Base {
}, //点击确认按钮事件回调
clear: () => {
this.labelLineColor = 'rgba(0,255,255,0.5)'
} //点击清空按钮事件回调
})
this._elms.labelLineColor[i] = lineColorPicker
})
}
}
get labelBackgroundColorStart() {
return this.options.label.backgroundColor[0]
}
set labelBackgroundColorStart(v) {
this.options.label.backgroundColor[0] = v
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
if (this._elms.labelBackgroundColorStart) {
this._elms.labelBackgroundColorStart.forEach((item, i) => {
let labelBackgroundColorStartPicker = new YJColorPicker({
el: item.el,
size: 'mini', //颜色box类型
alpha: true, //是否开启透明度
defaultColor: this.labelBackgroundColorStart,
disabled: false, //是否禁止打开颜色选择器
openPickerAni: 'opacity', //打开颜色选择器动画
sure: color => {
this.labelBackgroundColorStart = color
}, //点击确认按钮事件回调
clear: () => {
@ -848,7 +889,7 @@ class PolylineObject extends Base {
})
this._elms.labelBackgroundColorStart[
i
] = _this.labelBackgroundColorStartPicker
] = labelBackgroundColorStartPicker
})
}
}
@ -1312,6 +1353,7 @@ class PolylineObject extends Base {
],
text: that.options.name,
fontSize: that.options.label.fontSize,
fontFamily: that.options.label.fontFamily,
color: that.options.label.color,
pixelOffset: that.options.label.pixelOffset,
backgroundColor: that.options.label.backgroundColor,
@ -1565,6 +1607,9 @@ class PolylineObject extends Base {
}
this.nodePoints = []
this.positionEditing = false
YJ.Measure.SetMeasureStatus(false)
this.event && this.event.destroy()
this.tip && this.tip.destroy()
},
showCallBack: show => {
this.options.show = show
@ -1799,6 +1844,7 @@ class PolylineObject extends Base {
'.input-select-unit',
1
)
this.#unitDataLegpObject = unitDataLegpObject
if (unitDataLegpObject) {
unitDataLegpObject.legp_search(unitData)
let unitDataLegpElm = this._DialogObject._element.content
@ -2221,6 +2267,37 @@ class PolylineObject extends Base {
this._elms.altInput.push(altInput)
tBodyElm.appendChild(tr)
}
let fontData = getFontList()
let fontObject = legp(
this._DialogObject._element.content.getElementsByClassName(
'font-select-box'
)[0],
'.font-select'
)
if (fontObject) {
fontObject.legp_search(fontData)
let fontDataLegpElm = this._DialogObject._element.content
.getElementsByClassName('font-select')[0]
.getElementsByTagName('input')[0]
fontDataLegpElm.value = fontData[this.labelFontFamily].value
for (let i = 0; i < fontData.length; i++) {
if (fontData[i].value == fontDataLegpElm.value) {
fontObject.legp_searchActive(fontData[i].value)
break
}
}
fontDataLegpElm.addEventListener('input', () => {
for (let i = 0; i < fontData.length; i++) {
if (fontData[i].value === fontDataLegpElm.value) {
this.labelFontFamily = fontData[i].key
break
}
}
})
this._elms.labelFontFamily = [fontDataLegpElm]
}
}, 0)
} else {
if (this._DialogObject && this._DialogObject.close) {
@ -2422,6 +2499,7 @@ class PolylineObject extends Base {
this.labelShow = this.originalOptions.label.show
this.labelColor = this.originalOptions.label.color
this.labelFontSize = this.originalOptions.label.fontSize
this.labelFontFamily = this.originalOptions.label.fontFamily
this.labelLineWidth = this.originalOptions.label.lineWidth
this.labelPixelOffset = this.originalOptions.label.pixelOffset
this.labelLineColor = this.originalOptions.label.lineColor

View File

@ -6,7 +6,7 @@ import EventBinding from '../../Element/Dialog/eventBinding';
import richText from "../../Element/richText";
import MouseEvent from '../../../Event/index'
import LabelObject from '../LabelObject'
import { syncData } from '../../../Global/MultiViewportMode'
import { syncData, getSdk as get2DSdk } from '../../../Global/MultiViewportMode'
import { legp } from '../../Element/datalist';
import { getFontList, getFontFamilyName } from '../../Element/fontSelect'
import MouseTip from '../../../MouseTip'
@ -246,16 +246,29 @@ class RadarScan extends Base {
set show(v) {
if (typeof v === "boolean") {
let sdkD = get2DSdk().sdkD
if (!this.isShowView || !sdkD) {
this.options.show = v
this.entity.show = v
}
if (!this.showView || this.showView == 3 || !sdkD) {
this.entity.show = this.options.show
if (this.options.label.show && this.label) {
this.label.show = this.options.show
}
}
else {
this.entity.show = false
if (this.options.label.show && this.label) {
this.label.show = false
}
}
if (this._DialogObject && this._DialogObject.showBtn) {
this._DialogObject.showBtn.checked = v
}
if (this.options.label.show && this.label) {
this.label.show = v
}
syncData(this.sdk, this.options.id)
syncSplitData(this.sdk, this.options.id)
this.isShowView = false
} else {
console.error("参数必须为boolean")
}
@ -448,8 +461,9 @@ class RadarScan extends Base {
return this.options.label.show
}
set labelShow(v) {
let sdkD = get2DSdk().sdkD
this.options.label.show = v
if (this.show) {
if (this.show && (!this.showView || this.showView == 3 || !sdkD)) {
this.label.show = v
}
else {
@ -1374,7 +1388,7 @@ class RadarScan extends Base {
}
async remove() {
this.label.remove()
this.label && this.label.remove()
this.entity && this.sdk.viewer.entities.remove(this.entity)
this.entity2 && this.sdk.viewer.entities.remove(this.entity2)
this.entity = null

View File

@ -23,7 +23,7 @@ class SectorObject extends Base {
* @param options.id {string} 标注id
* @param options.name {string} 名称
* @param options.show=true {boolean} 显示/隐藏
* @param options.color="#ff000080" {string} 颜色
* @param options.color="rgba(255, 0, 0, 0.5)" {string} 颜色
* @param options.center {object} 位置
* @param options.center.lng {object} 经度
* @param options.center.lat {object} 维度
@ -39,7 +39,7 @@ class SectorObject extends Base {
constructor(sdk, options = {}) {
super(sdk, options);
this.options.name = options.name || '未命名对象'
this.options.color = options.color || "#ff000080"
this.options.color = options.color || "rgba(255, 0, 0, 0.5)"
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
this.options.semiMinorAxis = (options.semiMinorAxis || options.semiMinorAxis === 0) ? options.semiMinorAxis : 10
this.options.semiMajorAxis = (options.semiMajorAxis || options.semiMajorAxis === 0) ? options.semiMajorAxis : 20
@ -47,7 +47,7 @@ class SectorObject extends Base {
this.options.center = options.center || {}
this.options.line = options.line || {}
this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3)
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 0.5)'
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)'
this.options['area-unit'] = options['area-unit'] || '平方米'
options.label = options.label || {}
this._elms = {};
@ -1922,6 +1922,19 @@ class SectorObject extends Base {
that.cartesian3Towgs84(positions[1], that.sdk.viewer),
that.cartesian3Towgs84(positions[positions.length - 4], that.sdk.viewer)
]
let objectsToExclude = [...that.sdk.viewer.entities.values]
that
.getClampToHeight({
lng: that.options.center.lng,
lat: that.options.center.lat
}, objectsToExclude)
.then(height => {
that.label.position = [
that.options.center.lng,
that.options.center.lat,
height
]
})
setTimeout(() => {
createNodePoints(positions[1], 'sector-start')
createNodePoints(positions[positions.length - 4], 'sector-end')

View File

@ -40,7 +40,7 @@ class StraightArrowObject extends Base {
this.options.positions = options.positions || []
this.options.line = options.line || {}
this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3)
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 0.5)'
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)'
this.options['area-unit'] = options['area-unit'] || '平方米'
this.entity
this.event = new MouseEvent(this.sdk)

View File

@ -417,71 +417,11 @@ class StandText extends Base {
this.color = 'rgba(255,255,255,1)'
},//点击清空按钮事件回调
})
let labelColorPicker = new YJColorPicker({
el: contentElm.getElementsByClassName("labelColor")[0],
size: 'mini',//颜色box类型
alpha: true,//是否开启透明度
defaultColor: this.labelColor,
disabled: false,//是否禁止打开颜色选择器
openPickerAni: 'opacity',//打开颜色选择器动画
sure: (color) => {
this.labelColor = color
},//点击确认按钮事件回调
clear: () => {
this.labelColor = 'rgba(255,255,255,1)'
},//点击清空按钮事件回调
})
let lineColorPicker = new YJColorPicker({
el: contentElm.getElementsByClassName("labelLineColor")[0],
size: 'mini',//颜色box类型
alpha: true,//是否开启透明度
defaultColor: this.labelLineColor,
disabled: false,//是否禁止打开颜色选择器
openPickerAni: 'opacity',//打开颜色选择器动画
sure: (color) => {
this.labelLineColor = color
},//点击确认按钮事件回调
clear: () => {
this.labelLineColor = 'rgba(255,255,255,1)'
},//点击清空按钮事件回调
})
let labelBackgroundColorStartPicker = new YJColorPicker({
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
size: 'mini',
alpha: true,
defaultColor: this.labelBackgroundColorStart,
disabled: false,
openPickerAni: 'opacity',
sure: (color) => {
this.labelBackgroundColorStart = color
},
clear: () => {
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
},
})
let labelBackgroundColorEndPicker = new YJColorPicker({
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
size: 'mini',
alpha: true,
defaultColor: this.labelBackgroundColorEnd,
disabled: false,
openPickerAni: 'opacity',
sure: (color) => {
this.labelBackgroundColorEnd = color
},
clear: () => {
this.labelBackgroundColorEnd = 'rgba(255,255,255,1)'
},
})
let all_elm = contentElm.getElementsByTagName("*")
this._EventBinding.on(this, all_elm)
this._elms = this._EventBinding.element
this._elms.color = [colorPicker]
this._elms.labelColor = [labelColorPicker]
this._elms.labelLineColor = [lineColorPicker]
this._elms.labelBackgroundColorStart = [labelBackgroundColorStartPicker]
this._elms.labelBackgroundColorEnd = [labelBackgroundColorEndPicker]
} else {
if (this._DialogObject && this._DialogObject.remove) {
this._DialogObject.remove()

View File

@ -182,6 +182,23 @@ function html() {
</div>
</div>
<span class="custom-divider"></span>
<div class="div-item">
<div class="row">
<div class="col">
<span class="label">油耗</span>
<div class="input-number input-number-unit-6" style="width: 170px;">
<input class="input" type="number" title="" min="1" max="99999999" @model="unitFuelConsumption">
<span class="unit">L/100km</span>
<span class="arrow"></span>
</div>
</div>
<div class="col" style="flex: 0 0 0;">
<span class="label">总油耗</span>
<input class="btn-switch" type="checkbox" @model="fuelShow">
</div>
</div>
</div>
<span class="custom-divider"></span>
`
}

View File

@ -78,6 +78,7 @@ class TrajectoryMotion extends Base {
this.options.line.smooth = options.line.smooth ? options.line.smooth : false
this.options.line.noseToTail = options.line.noseToTail ? options.line.noseToTail : false
this.positions_smooth = []
this.options.unitFuelConsumption = options.unitFuelConsumption || 0
this.options.ground = options.ground || false
this.options.state = (options.state || options.state === false) ? options.state : true
this.options.routeDirection = (options.routeDirection || options.routeDirection === false) ? options.routeDirection : true
@ -99,7 +100,7 @@ class TrajectoryMotion extends Base {
color: options.label.color || '#ffffff',
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
backgroundColor: options.label.backgroundColor || ['#42c6ef', '#42c6ef'],
backgroundColor: options.label.backgroundColor || ['#00ffff80', '#00ffff80'],
lineColor: options.label.lineColor || '#00ffff80',
scaleByDistance: options.label.scaleByDistance || false,
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
@ -144,18 +145,22 @@ class TrajectoryMotion extends Base {
set show(v) {
if (typeof v === "boolean") {
let sdkD = get2DView()
if (!this.isShowView || !sdkD) {
this.options.show = v
if (this.originalOptions) {
this.originalOptions.show = v
}
if (v) {
}
if (this.options.show) {
if (this.firstPersonView) {
this.model.show = false
}
else {
this.model.show = this.modelShow
this.model.show = (!this.showView || this.showView == 3 || !sdkD) ? this.modelShow : false
}
if ((!this.showView || this.showView == 3 || !sdkD)) {
this.line.polyline.material = this.lineShow ? new Cesium.PolylineDashMaterialProperty({
color: new Cesium.Color.fromCssColorString('#00ffff'),
dashLength: 20,
@ -163,18 +168,33 @@ class TrajectoryMotion extends Base {
color: new Cesium.Color.fromCssColorString('#00ffff00'),
dashLength: 20,
})
for (let i = 0; i < this.keyPoints.length; i++) {
this.keyPoints[i].show = this.keyPointShow
}
if (this.realTimeRoute) {
this.realTimeLine && (this.realTimeLine.show = true)
}
this.label && (this.label.show = this.options.label.show)
}
else {
this.model.show = v
this.line.polyline.material = new Cesium.PolylineDashMaterialProperty({
color: new Cesium.Color.fromCssColorString('#00ffff00'),
dashLength: 20,
})
}
for (let i = 0; i < this.keyPoints.length; i++) {
this.keyPoints[i].show = (!this.showView || this.showView == 3 || !sdkD) ? this.keyPointShow : false
}
if (this.realTimeRoute) {
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.fuelLabel && (this.fuelLabel.show = (!this.showView || this.showView == 3) ? this.options.fuelShow : false)
}
else {
this.model.show = (!this.showView || this.showView == 3 || !sdkD) ? this.options.show : false
let show = this.options.show
if ((!this.showView || this.showView == 3 || !sdkD)) {
show = this.options.show
}
else {
show = false
}
this.realTimeLine && (this.realTimeLine.show = false)
this.line.polyline.material = v ? new Cesium.PolylineDashMaterialProperty({
this.line.polyline.material = show ? new Cesium.PolylineDashMaterialProperty({
color: new Cesium.Color.fromCssColorString('#00ffff'),
dashLength: 20,
}) : new Cesium.PolylineDashMaterialProperty({
@ -182,9 +202,10 @@ class TrajectoryMotion extends Base {
dashLength: 20,
})
for (let i = 0; i < this.keyPoints.length; i++) {
this.keyPoints[i].show = v
this.keyPoints[i].show = (!this.showView || this.showView == 3) ? show : false
}
this.label && (this.label.show = false)
this.fuelLabel && (this.fuelLabel.show = false)
this.viewFollow = false
}
@ -193,6 +214,7 @@ class TrajectoryMotion extends Base {
}
syncData(this.sdk, this.options.id)
syncSplitData(this.sdk, this.options.id)
this.isShowView = false
} else {
console.error("参数必须为boolean")
}
@ -238,14 +260,17 @@ class TrajectoryMotion extends Base {
// Cesium.Matrix4.multiplyByTranslation(this.model.modelMatrix, new Cesium.Cartesian3(0, 0, -difference), this.model.modelMatrix)
// Cesium.Matrix4.getTranslation(this.model.modelMatrix, this.model.position)
this.label && (this.label.show = this.label.show)
this.fuelLabel && (this.fuelLabel.show = this.fuelLabel.show)
if (this.options.label.position) {
setTimeout(() => {
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.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.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)
@ -636,7 +661,7 @@ class TrajectoryMotion extends Base {
})
this.TweenAnimate.pause()
setTimeout(() => {
_this.model.isMove = false
_this.model && (_this.model.isMove = false)
}, 200);
}
}
@ -655,9 +680,17 @@ class TrajectoryMotion extends Base {
return this.options.model.show
}
set modelShow(v) {
let sdkD = get2DView()
this.options.model.show = v
let show = v
if (this.show && (!this.showView || this.showView == 3 || !sdkD)) {
show = v
}
else {
show = false
}
if (this.model && this.show) {
this.model.show = v
this.model.show = show
}
this._elms.modelShow && this._elms.modelShow.forEach((item) => {
item.checked = v
@ -723,8 +756,16 @@ class TrajectoryMotion extends Base {
this.realTimeRoute = false
}
this.options.line.show = v
let show = v
let sdkD = get2DView()
if ((!this.showView || this.showView == 3 || !sdkD)) {
show = v
}
else {
show = false
}
if (this.line && this.show) {
this.line.polyline.material = v ? new Cesium.PolylineDashMaterialProperty({
this.line.polyline.material = show ? new Cesium.PolylineDashMaterialProperty({
color: new Cesium.Color.fromCssColorString('#00ffff'),
dashLength: 20, //短划线长度
}) : new Cesium.PolylineDashMaterialProperty({
@ -941,6 +982,7 @@ class TrajectoryMotion extends Base {
set firstPersonView(v) {
// this.state = true
let sdkD = get2DView()
let splitSdk = getSdk()
if (get2DView() || splitSdk.sdkD || !this.show) {
v = false
@ -994,7 +1036,14 @@ class TrajectoryMotion extends Base {
else {
CameraController(this.sdk, true)
if (this.model && this.modelShow && this.show) {
this.model.show = true
let show = true
if (this.show && (!this.showView || this.showView == 3 || !sdkD)) {
show = true
}
else {
show = false
}
this.model.show = show
}
if (this._DialogObject && this._DialogObject._element.content) {
let e_firstPerson = this._DialogObject._element.content.querySelectorAll("button[name='firstPerson']")
@ -1116,8 +1165,18 @@ class TrajectoryMotion extends Base {
}
set labelShow(v) {
this.options.label.show = v
let sdkD = get2DView()
let show = v
if (this.show && (!this.showView || this.showView == 3 || !sdkD)) {
show = v
}
else {
show = false
}
if (this.show) {
this.label && (this.label.show = v)
if (this.label) {
this.label.show = show
this.label.pixelOffset = this.options.label.pixelOffset + (this.fuelShow ? this.labelFontSize + 20 : 0)
if (this.options.label.position) {
setTimeout(() => {
if (this.options.label.position.alt) {
@ -1131,6 +1190,7 @@ class TrajectoryMotion extends Base {
}, 0);
}
}
}
else {
this.label && (this.label.show = false)
}
@ -1146,6 +1206,7 @@ class TrajectoryMotion extends Base {
set labelFontFamily(v) {
this.options.label.fontFamily = v || 0
this.label && (this.label.fontFamily = this.options.label.fontFamily)
this.fuelLabel && (this.fuelLabel.fontFamily = this.options.label.fontFamily)
let name = getFontFamilyName(this.labelFontFamily) || ''
this._elms.labelFontFamily &&
@ -1160,6 +1221,7 @@ class TrajectoryMotion extends Base {
set labelColor(v) {
this.options.label.color = v
this.label && (this.label.color = v)
this.fuelLabel && (this.fuelLabel.color = v)
if (this._elms.labelColor) {
this._elms.labelColor.forEach((item, i) => {
let labelColorPicker = new YJColorPicker({
@ -1187,6 +1249,13 @@ class TrajectoryMotion extends Base {
set labelFontSize(v) {
this.options.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) => {
item.value = v
})
@ -1198,6 +1267,7 @@ class TrajectoryMotion extends Base {
set labelScaleByDistance(v) {
this.options.label.scaleByDistance = v
this.label && (this.label.scaleByDistance = v)
this.fuelLabel && (this.fuelLabel.scaleByDistance = v)
this._elms.labelScaleByDistance && this._elms.labelScaleByDistance.forEach((item) => {
item.checked = v
})
@ -1213,6 +1283,7 @@ class TrajectoryMotion extends Base {
}
this.options.label.near = near
this.label && (this.label.near = near)
this.fuelLabel && (this.fuelLabel.near = near)
this._elms.labelNear && this._elms.labelNear.forEach((item) => {
item.value = near
})
@ -1228,11 +1299,66 @@ class TrajectoryMotion extends Base {
}
this.options.label.far = far
this.label && (this.label.far = far)
this.fuelLabel && (this.fuelLabel.far = far)
this._elms.labelFar && this._elms.labelFar.forEach((item) => {
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) {
let positions_smooth = that.renewLinePositions(that.options.line.positions)
@ -1351,6 +1477,7 @@ class TrajectoryMotion extends Base {
}
let pos = that.smooth ? that.positions_smooth : Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArrayHeights)
TrajectoryMotion.createLabel(that)
TrajectoryMotion.createFuelLabel(that)
that.modelMove(pos)
@ -1360,13 +1487,13 @@ class TrajectoryMotion extends Base {
static async createLabel(that) {
let labelPosition = that.cartesian3Towgs84(that.model.position, that.sdk.viewer)
that.label = new LabelObject(that.sdk, {
show: that.options.show ? (that.options.model.show ? that.options.label.show : false) : false,
show: that.options.show ? (that.options.label.show ? true : false) : false,
position: [labelPosition.lng, labelPosition.lat, labelPosition.alt],
text: that.options.name,
fontSize: that.options.label.fontSize,
fontFamily: that.options.label.fontFamily,
color: that.options.label.color,
pixelOffset: that.options.label.pixelOffset,
pixelOffset: that.options.label.pixelOffset + (that.options.fuelShow ? that.options.label.fontSize + 20 : 0),
backgroundColor: that.options.label.backgroundColor,
lineColor: that.options.label.lineColor,
lineWidth: that.options.label.lineWidth,
@ -1376,6 +1503,26 @@ class TrajectoryMotion extends Base {
}, 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) {
for (let i = 0; i < that.options.line.positions.length; i++) {
@ -1481,7 +1628,7 @@ class TrajectoryMotion extends Base {
setPosition(startDistance)
setTimeout(() => {
_this.model.isMove = false
}, 500);
}, 1000);
animateUpdate()
@ -1504,6 +1651,8 @@ class TrajectoryMotion extends Base {
}
async function setPosition(distance) {
_this.totalFuelConsumption = Number((distance / 100 * _this.unitFuelConsumption).toFixed(2))
_this.fuelLabel.text = '总油耗:' + _this.totalFuelConsumption + ' L'
_this.model.isMove = true
let sdk2D = get2DView()
let splitSdk = getSdk()
@ -1715,6 +1864,7 @@ class TrajectoryMotion extends Base {
}
let labelPosition = _this.cartesian3Towgs84(position, _this.sdk.viewer)
_this.label.position = [labelPosition.lng, labelPosition.lat, labelPosition.alt]
_this.fuelLabel.position = [labelPosition.lng, labelPosition.lat, labelPosition.alt]
lastDistance = distance
// console.log(position)
_this.realTimeRouteArray.push(position)
@ -2036,7 +2186,7 @@ class TrajectoryMotion extends Base {
rubricElm.style.color = '#ff5733';
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]
iconRubric.addEventListener('mouseenter', (e) => {
rubricElm.style.display = 'block'
@ -2111,6 +2261,7 @@ class TrajectoryMotion extends Base {
this.sdk.viewer.entities.remove(this.line)
this.sdk.viewer.entities.remove(this.realTimeLine)
this.label && this.label.remove()
this.fuelLabel && this.fuelLabel.remove()
for (let i = 0; i < this.keyPointShow.length; i++) {
this.sdk.viewer.entities.remove(this.keyPointShow[i])
}
@ -2118,6 +2269,7 @@ class TrajectoryMotion extends Base {
this.realTimeLine = null
this.model = null
this.label = null
this.fuelLabel = null
if (this._DialogObject && !this._DialogObject.isDestroy) {
this._DialogObject.close()
this._DialogObject = null
@ -2171,6 +2323,7 @@ class TrajectoryMotion extends Base {
this.model && (this.model.show = false)
}
this.labelShow = this.originalOptions.label.show
this.fuelLabelShow = this.originalOptions.fuelShow
this.labelColor = this.originalOptions.label.color
this.labelFontSize = this.originalOptions.label.fontSize
this.labelFontFamily = this.originalOptions.label.fontFamily
@ -2229,7 +2382,6 @@ class TrajectoryMotion extends Base {
this._DialogObject._element.content.getElementsByClassName('model-rotate-btn')[0].innerHTML = '结束调整'
this._DialogObject._element.content.getElementsByClassName('model-rotate-btn')[0].className = 'btn model-rotate-btn is-active'
}
console.log(this._DialogObject._element.content, this._DialogObject._element.content.getElementsByClassName('model-rotate-btn')[0])
this.state = false
this.editObj = new EditGltf(this.sdk, this.model)
this.editObj.editRtation()

View File

@ -21,6 +21,7 @@ class eventBinding {
let Event = []
let isEvent = false
let removeName = []
let blurEvent = ()=>{}
if (!elements[i] ||!elements[i].attributes) {
continue;
}
@ -37,6 +38,26 @@ class eventBinding {
let value = e.target.value
if (e.target.type == 'number') {
if (e.data != '.' && (e.data != '-' || e.target.value)) {
let v = Number(value)
if((e.target.max) && v>Number(e.target.max)) {
value = Number(e.target.max)
}
if((e.target.min) && v<Number(e.target.min)) {
value = Number(e.target.min)
}
if((e.target.dataset.min) && v<Number(e.target.dataset.min)) {
value = Number(e.target.dataset.min)
}
that[m.value] = value
}
}
else {
that[m.value] = value
}
})
blurEvent = (e) => {
let value = e.target.value
if ((e.target.type == 'number') && (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null)))) {
value = Number(value)
if ((e.target.max) && value > Number(e.target.max)) {
value = Number(e.target.max)
@ -47,13 +68,9 @@ class eventBinding {
if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) {
value = Number(e.target.dataset.min)
}
}
that[m.value] = value
}
}
else {
that[m.value] = value
}
})
if(elements[i].nodeName=='IMG') {
elements[i].src = that[m.value]
}
@ -111,6 +128,9 @@ class eventBinding {
Event[t](e)
}
});
elements[i].addEventListener('blur', (e) => {
blurEvent(e)
});
}
}
}

View File

@ -21,6 +21,7 @@ class eventBinding {
let Event = []
let isEvent = false
let removeName = []
let blurEvent = () => { }
if (!elements[i] || !elements[i].attributes) {
continue;
}
@ -37,11 +38,11 @@ class eventBinding {
let value = e.target.value
if (e.target.type == 'number') {
if (e.data != '.' && (e.data != '-' || e.target.value)) {
value = Number(value)
if((e.target.max) && value>Number(e.target.max)) {
let v = Number(value)
if ((e.target.max) && v > Number(e.target.max)) {
value = Number(e.target.max)
}
if((e.target.min) && value<Number(e.target.min)) {
if ((e.target.min) && v < Number(e.target.min)) {
value = Number(e.target.min)
}
that[m.value] = value
@ -51,6 +52,24 @@ class eventBinding {
that[m.value] = value
}
})
blurEvent = (e) => {
let value = e.target.value
if ((e.target.type == 'number') && (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null)))) {
value = Number(value)
if ((e.target.max) && value > Number(e.target.max)) {
value = Number(e.target.max)
}
if ((e.target.min) && value < Number(e.target.min)) {
value = Number(e.target.min)
}
if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) {
value = Number(e.target.dataset.min)
}
}
that[m.value] = value
}
if (elements[i].nodeName == 'IMG') {
elements[i].src = that[m.value]
}
@ -108,6 +127,9 @@ class eventBinding {
Event[t](e)
}
});
elements[i].addEventListener('blur', (e) => {
blurEvent(e)
});
}
}
}

View File

@ -88,6 +88,10 @@ class WallStereoscopic extends Base {
}
}
get type() {
return 'wallStereoscopic'
}
static createLabel(that) {
// 标签
that.label = new LabelObject(that.sdk, {

View File

@ -35,7 +35,8 @@ class eventBinding {
else {
Event.push((e) => {
let value = e.target.value
if (e.target.type == 'number') {
let str = e.target.value + ''
if (e.target.type == 'number' && !(str.charAt(str.length - 1) == '0' && e.target.value.toString().includes('.'))) {
value = Number(value)
}
that[m.value] = value

View File

@ -10,10 +10,12 @@ import { getHost, getToken } from "../../on";
import { regLeftClickCallback, regRightClickCallback, regMoveCallback } from "../../Global/ClickCallback";
import { regLeftClickCallback as regLeftClickCallback2, regRightClickCallback as regRightClickCallback2, regMoveCallback as regMoveCallback2 } from "../../Global/SplitScreen/ClickCallback";
import { setSplitDirection, syncSplitData, getSdk } from "../../Global/SplitScreen";
import { syncData } from '../../Global/MultiViewportMode'
import { syncData, getSdk as get2DSdk } from '../../Global/MultiViewportMode'
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../Global/global'
class Base extends Tools {
#_showView
#_isShowView
constructor(sdk, options = {}) {
super(sdk, options);
if (!sdk || !sdk.viewer) {
@ -29,6 +31,7 @@ class Base extends Tools {
this.rightClickCallBack = null
this.picking = true
this.options.host = this.options.host || getHost()
// this.#_showView = this.options.showView || 0
this.setDefaultValue()
// this.sdk.addIncetance(this.options.id, this)
@ -55,6 +58,60 @@ class Base extends Tools {
// setSplitDirection(this._splitDirection, this.options.id)
// }
get showView() {
return this.#_showView
}
set showView(v) {
let sdk2D = get2DSdk().sdkD
if (!sdk2D) {
this.#_showView = v
if(this.entity) {
this.entity._showView = v
}
return
}
if (this.sdk === sdk2D) {
this.#_showView = 0
return
}
if (!this.#_showView && !this.show) {
return
}
if (this.sdk === sdk2D) {
this.#_showView = 0
return
}
if (v != 2 && v != 3) {
this.#_showView = 0
}
else {
this.#_showView = v
}
this.isShowView = true
// if(!this.show) {
// return
// }
if (!this.#_showView) {
this.show = true
}
else {
if (v == 2) {
this.show = false
}
else {
this.show = true
}
}
}
get name() {
return this.options.name
}
@ -72,19 +129,60 @@ class Base extends Tools {
set show(v) {
if (typeof v === "boolean") {
let sdkD = get2DSdk().sdkD
if (!this.isShowView || !sdkD) {
this.options.show = v
if (this.originalOptions) {
this.originalOptions.show = v
}
this.entity && (this.entity.show = v)
if (this._DialogObject && this._DialogObject.showBtn) {
this._DialogObject.showBtn.checked = v
}
this.entity._showView = this.showView
if (this.type == 'layer') {
if (this.entity) {
this.entity._objectState = this.options.show
}
}
if (!this.showView || this.showView == 3 || !sdkD) {
this.entity && (this.entity.show = this.options.show)
if (this.options.label && this.options.label.show && this.label) {
this.label.show = v
this.label.show = this.options.show
}
}
else {
this.entity && (this.entity.show = false)
if (this.options.label && this.options.label.show && this.label) {
this.label.show = false
}
}
if (this._DialogObject && this._DialogObject.showBtn) {
this._DialogObject.showBtn.checked = this.options.show
}
syncData(this.sdk, this.options.id)
syncSplitData(this.sdk, this.options.id)
this.isShowView = false
if (this.type == 'layer' && sdkD) {
let layer2d = sdkD.viewer.imageryLayers._layers[this.layerIndex]
let layer3d = this.entity
if (!layer2d) {
return
}
if (layer3d._objectState) {
if (!layer3d._showView || layer3d._showView == 2) {
layer2d.show = true
}
if (layer3d._showView == 3) {
layer2d.show = false
}
}
else {
layer2d.show = this.options.show
}
}
} else {
console.error("参数必须为boolean")
}
@ -192,7 +290,7 @@ class Base extends Tools {
let destination = Cesium.Cartesian3.fromDegrees(lng, lat, alt)
let position = { lng: 0, lat: 0 }
if (this.options.position) {
if (this.options.position && Object.prototype.toString.call(this.options.position) === '[object Object]') {
position = { ...this.options.position }
}
else if (this.options.positions) {
@ -338,7 +436,7 @@ class Base extends Tools {
let position = { lng: 0, lat: 0 }
let relativePosition = { ...cameraPosition84 }
if (this.options.position) {
if (this.options.position && Object.prototype.toString.call(this.options.position) === '[object Object]') {
position = { ...this.options.position }
}
else if (this.options.positions) {

View File

@ -55,6 +55,9 @@ class EventBinding {
if ((e.target.min) && value < Number(e.target.min)) {
value = Number(e.target.min)
}
if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) {
value = Number(e.target.dataset.min)
}
that[m.value] = value
}
}

View File

@ -2,13 +2,10 @@ import BaseDialog from '../../../BaseDialog';
class Dialog extends BaseDialog {
constructor(sdk, info, options, only) {
super(sdk.viewer._container, options);
super(sdk.viewer._container, options, only);
this.sdk = sdk
this.viewer = sdk.viewer
this.info = info
if (only) {
this.closeAll()
}
this._init()
}

View File

@ -1,6 +1,13 @@
class cy_tabs {
constructor(id, clickTabCallBack, sdk) {
let elm = document.getElementById(id);
constructor(boxElm, clickTabCallBack, sdk) {
let elm
if(typeof boxElm === 'string') {
elm = document.getElementById(boxElm);
}
else {
elm = boxElm
}
// let elm = document.getElementById(id);
let pane = elm.getElementsByTagName('DIV-cy-tab-pane')
let tabTop = `<div class="DIV-cy-tab-top">`
@ -37,7 +44,9 @@
tabContent = tabContent + `</div>`
let BoxElm = document.createElement('div');
BoxElm.setAttribute('id', id)
if(typeof boxElm === 'string') {
BoxElm.setAttribute('id', boxElm)
}
BoxElm.setAttribute('class', 'DIV-cy-tabs')
BoxElm.innerHTML = tabTop + tabContent
elm.parentNode.insertBefore(BoxElm, elm);

View File

@ -56,8 +56,8 @@ class richText {
MENU_CONF: {
uploadImage: {
fieldName: 'file',
maxFileSize: 50 * 1024 * 1024,
base64LimitSize: 50 * 1024 * 1024, // 50M 以下插入 base64
// maxFileSize: 50 * 1024 * 1024,
// base64LimitSize: 50 * 1024 * 1024, // 50M 以下插入 base64
server: this.uploadImageServer,
// // 上传之前触发
// onBeforeUpload(file) { // TS 语法
@ -95,18 +95,18 @@ class richText {
// console.log(`${file.name} 上传出错`, err, res)
// },
// // 自定义上传
// async customUpload(file, insertFn) { // TS 语法
// // async customUpload(file, insertFn) { // JS 语法
// // file 即选中的文件
// // 自己实现上传,并得到图片 url alt href
// // 最后插入图片
// console.log(file, insertFn)
// insertFn(url, file.name)
// }
// 自定义上传
async customUpload(file, insertFn) { // TS 语法
// async customUpload(file, insertFn) { // JS 语法
// file 即选中的文件
// 自己实现上传,并得到图片 url alt href
// 最后插入图片
let url = await _this.upload(file)
insertFn((_this.host = _this.host || getHost()) + '/' + url)
}
},
uploadVideo: {
maxFileSize: 500 * 1024 * 1024,
// maxFileSize: 500 * 1024 * 1024,
server: this.uploadVideoServer,
allowedFileTypes: ['video/mp4', 'video/mp3', 'video/ogg', 'video/webm', 'video/avi'],
// 自定义上传

View File

@ -1,4 +1,4 @@
let list = ['icon-py', 'icon-edit', 'icon-add', 'icon-add2', 'icon-minus', 'icon-play', 'icon-pause', 'icon-updateheight', 'icon-draw', 'icon-positions', 'icon-reset', 'icon-xj', 'icon-yj', 'icon-zj', 'icon-close', 'icon-query', 'icon-route', 'icon-copy', 'icon-load', 'icon-rubric', 'icon-pen', 'icon-cross']
let list = ['icon-py', 'icon-edit', 'icon-add', 'icon-add2', 'icon-minus', 'icon-play', 'icon-pause', 'icon-updateheight', 'icon-draw', 'icon-positions', 'icon-reset', 'icon-xj', 'icon-yj', 'icon-zj', 'icon-close', 'icon-query', 'icon-route', 'icon-copy', 'icon-load', 'icon-rubric', 'icon-pen', 'icon-cross', 'icom-confirm']
function setSvg() {
let svgElm = document.createElement('svg');
svgElm.xmlns = 'http://www.w3.org/2000/svg'

View File

@ -1,7 +1,11 @@
class YJColorPicker {
constructor(options = {}) {
let _this = this
let pickAlphaInput
let RInput
let GInput
let BInput
let AInput
let config = {
el: options.el,
size: "mini",
@ -12,18 +16,22 @@ class YJColorPicker {
hasClear: true,
openPickerAni: 'opacity',
defaultColor: options.defaultColor,
pickerInputChange: pickerInputChange,
startMainCallback: (t) => {
_this.colorPicker && (_this.colorPicker.picker.style.opacity = 0)
setTimeout(() => {
customizeStyle()
}, 0);
}
}
this.el = options.el
if (options.sure) {
config.sure = (color) => {
this.colorPicker.config.defaultColor = this.colorPicker.pickerInput.value
// this.colorPicker.config.defaultColor = this.colorPicker.pickerInput.value
let c = Cesium.Color.fromCssColorString(color)
if (pickAlphaInput) {
c = c.withAlpha(pickAlphaInput.value / 100)
this.pickAlphaInputValue = pickAlphaInput.value
if (AInput) {
c = c.withAlpha(AInput.value)
this.pickAlphaInputValue = AInput.value
}
color = c.toCssHexString()
if (typeof options.sure == 'function') {
@ -34,8 +42,8 @@ class YJColorPicker {
}
if (options.clear) {
config.clear = () => {
if (pickAlphaInput) {
pickAlphaInput.value = this.pickAlphaInputValue = 100
if (AInput) {
AInput.value = this.pickAlphaInputValue = 1
}
this.colorPicker.config.defaultColor = ''
customizeStyle()
@ -66,42 +74,93 @@ class YJColorPicker {
customizeStyle()
function customizeStyle() {
if (!_this.colorPicker) {
if (!_this.colorPicker || !_this.colorPicker.picker) {
return
}
let isSubtract = false
let box = _this.colorPicker.box
let picker = _this.colorPicker.picker
let x = box.getBoundingClientRect().x
let y = box.getBoundingClientRect().y
let height = 0
// if (picker.style.display === 'none') {
// picker.style.display = 'block'
// height = picker.offsetHeight
// console.log('picker.style.display.opacity', picker.style.display.opacity)
// picker.style.display = 'none'
// }
// console.log('===========================================')
// console.log((y + box.offsetHeight + 4), height, window.innerHeight)
// if ((y + box.offsetHeight + 4) + height > window.innerHeight) {
// console.log(y, height)
// picker.style.top = y - height + 'px'
// }
// else {
// picker.style.top = (y + box.offsetHeight + 4) + 'px'
// }
picker.style.left = x + 'px'
picker.style.minWidth = '325px'
let pickerContent = picker.getElementsByClassName('ew-color-picker-content')[0]
// let pickerContent = picker.getElementsByClassName('ew-color-picker-content')[0]
let pickAlphaSliderBar = picker.getElementsByClassName('ew-alpha-slider-bar')[0]
if (pickAlphaSliderBar) {
pickAlphaSliderBar.parentNode.style.width = '16px'
pickAlphaSliderBar.parentNode.removeChild(pickAlphaSliderBar)
}
// let customDivider = document.createElement('span')
// customDivider.className = 'custom-divider'
// customDivider.style.margin = '10px 0'
// pickerContent.parentNode.insertBefore(customDivider, pickerContent.nextSibling)
let pickPen = document.createElement('div')
pickPen.className = 'icon-pen-box'
pickPen.innerHTML = '<svg class="icon-pen"><use xlink:href="#yj-icon-pen"></use></svg>'
/** 为完成、暂时隐藏 *///////
pickPen.style.display = 'none'
pickPen.style.cursor = 'unset'
let pickerInput = _this.colorPicker.pickerInput
pickerInput.parentNode.insertBefore(pickPen, pickerInput)
pickerInput.style.width = '188px'
pickerInput.style.display = 'none'
if (options.alpha) {
let pickAlpha = document.createElement('div')
pickAlpha.className = 'input-number input-number-unit-1 color-alpha'
pickAlpha.innerHTML = `
<input class="input" type="number" title="" step="0.01" min="0" max="100">
<span class="unit">%</span>
<span class="arrow"></span>`
pickerInput.parentNode.insertBefore(pickAlpha, pickerInput.nextSibling)
pickerInput.style.width = '106px'
pickAlpha.style.width = '80px'
pickAlphaInput = pickAlpha.getElementsByClassName('input')[0]
pickAlphaInput.addEventListener('blur', (e) => {
let colorInputBox = document.createElement('div')
let row1Elm = document.createElement('div')
row1Elm.className = 'row'
row1Elm.style.margin = '6px 0 0 0'
row1Elm.innerHTML = `
<div class="col">R</div>
<div class="col">G</div>
<div class="col">B</div>
<div class="col" style="flex: 0 0 92px;"></div>
`
let row2Elm = document.createElement('div')
row2Elm.className = 'row'
row2Elm.innerHTML = `
<div class="col">
<input type="number" step="1" min="0" max="255">
</div>
<div class="col">
<input type="number" step="1" min="0" max="255">
</div>
<div class="col">
<input type="number" step="1" min="0" max="255">
</div>
`
colorInputBox.appendChild(row1Elm)
colorInputBox.appendChild(row2Elm)
let Inputs = row2Elm.getElementsByTagName('input')
Inputs[0].style.width = '72px'
Inputs[1].style.width = '72px'
Inputs[2].style.width = '72px'
RInput = Inputs[0]
GInput = Inputs[1]
BInput = Inputs[2]
let dropbtns = picker.getElementsByClassName('ew-color-dropbtns')[0]
picker.insertBefore(colorInputBox, dropbtns)
RInput.addEventListener('blur', (e) => {
let value = e.target.value
if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) {
value = Number(value)
@ -114,23 +173,105 @@ class YJColorPicker {
if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) {
value = Number(e.target.dataset.min)
}
pickAlphaInput.value = Number(value.toFixed(2))
RInput.value = parseInt(value)
_this.colorPicker.hsba = colorRgbaToHsba(`rgb(${RInput.value}, ${GInput.value}, ${BInput.value})`)
_this.colorPicker.changeColor(_this.colorPicker, _this.colorPicker.pickerPanel.offsetWidth,_this.colorPicker.pickerPanel.offsetHeight)
}
})
GInput.addEventListener('blur', (e) => {
let value = e.target.value
if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) {
value = Number(value)
if ((e.target.max) && value > Number(e.target.max)) {
value = Number(e.target.max)
}
if ((e.target.min) && value < Number(e.target.min)) {
value = Number(e.target.min)
}
if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) {
value = Number(e.target.dataset.min)
}
GInput.value = parseInt(value)
_this.colorPicker.hsba = colorRgbaToHsba(`rgb(${RInput.value}, ${GInput.value}, ${BInput.value})`)
_this.colorPicker.changeColor(_this.colorPicker, _this.colorPicker.pickerPanel.offsetWidth,_this.colorPicker.pickerPanel.offsetHeight)
}
})
BInput.addEventListener('blur', (e) => {
let value = e.target.value
if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) {
value = Number(value)
if ((e.target.max) && value > Number(e.target.max)) {
value = Number(e.target.max)
}
if ((e.target.min) && value < Number(e.target.min)) {
value = Number(e.target.min)
}
if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) {
value = Number(e.target.dataset.min)
}
BInput.value = parseInt(value)
_this.colorPicker.hsba = colorRgbaToHsba(`rgb(${RInput.value}, ${GInput.value}, ${BInput.value})`)
_this.colorPicker.changeColor(_this.colorPicker, _this.colorPicker.pickerPanel.offsetWidth,_this.colorPicker.pickerPanel.offsetHeight)
}
})
if (options.alpha) {
Inputs[0].style.width = '52px'
Inputs[1].style.width = '52px'
Inputs[2].style.width = '52px'
let pickAlpha = document.createElement('div')
pickAlpha.className = 'input-number input-number-unit color-alpha'
pickAlpha.innerHTML = `
<input class="input" type="number" title="" step="0.01" min="0" max="1">
<span class="arrow"></span>`
pickerInput.parentNode.insertBefore(pickAlpha, pickerInput.nextSibling)
pickAlpha.style.width = '66px'
pickAlpha.style.margin = '0 6px 0 0'
AInput = pickAlpha.getElementsByClassName('input')[0]
row1Elm.innerHTML = `
<div class="col">R</div>
<div class="col">G</div>
<div class="col">B</div>
<div class="col">A</div>
<div class="col" style="flex: 0 0 106px;"></div>
`
row2Elm.appendChild(pickAlpha)
AInput.addEventListener('blur', (e) => {
let value = e.target.value
if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) {
value = Number(value)
if ((e.target.max) && value > Number(e.target.max)) {
value = Number(e.target.max)
}
if ((e.target.min) && value < Number(e.target.min)) {
value = Number(e.target.min)
}
if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) {
value = Number(e.target.dataset.min)
}
AInput.value = parseInt(value * 100) / 100
}
})
if (_this.pickAlphaInputValue || _this.pickAlphaInputValue === 0 || _this.pickAlphaInputValue === '0') {
pickAlphaInput.value = Number(Number(_this.pickAlphaInputValue).toFixed(2))
AInput.value = parseInt(_this.pickAlphaInputValue * 100) / 100
}
else {
pickAlphaInput.value = CesiumColor ? Number((CesiumColor.alpha * 100).toFixed(2)) : 100
AInput.value = CesiumColor ? parseInt(Number(CesiumColor.alpha.toFixed(2)) * 100) / 100 : 1
}
_this.pickAlphaInputValue = pickAlphaInput.value
box.style.background = Cesium.Color.fromCssColorString(_this.colorPicker.config.defaultColor || '#ffffff').withAlpha(pickAlphaInput.value / 100).toCssColorString()
_this.pickAlphaInputValue = AInput.value
box.style.background = Cesium.Color.fromCssColorString(_this.colorPicker.config.defaultColor || '#ffffff').withAlpha(AInput.value).toCssColorString()
}
else {
CesiumColor = CesiumColor ? CesiumColor.withAlpha(1) : ''
box.style.background = Cesium.Color.fromCssColorString(_this.colorPicker.config.defaultColor || '#ffffff').toCssColorString()
}
let btngroup = picker.getElementsByClassName('ew-color-dropbtngroup')[0]
row2Elm.appendChild(btngroup)
let defineColorContainer = picker.getElementsByClassName('ew-pre-define-color-container')[0]
if (defineColorContainer) {
let colorList = localStorage.getItem('custom-color')
@ -157,8 +298,10 @@ class YJColorPicker {
addColorBtn.className = 'yj-pre-collect-color add'
let subtractColorBtn = document.createElement('div')
subtractColorBtn.innerHTML = '<svg class="icon-minus"><use xlink:href="#yj-icon-minus"></use></svg>'
subtractColorBtn.innerHTML = '<svg class="icon-minus" style="display: unset;"><use xlink:href="#yj-icon-minus"></use></svg><svg class="icon-confirm" style="display: none;"><use xlink:href="#yj-icom-confirm"></use></svg>'
subtractColorBtn.className = 'yj-pre-collect-color subtract'
let minusIcon = subtractColorBtn.getElementsByClassName('icon-minus')[0]
let confirmIcon = subtractColorBtn.getElementsByClassName('icon-confirm')[0]
collectColorContainer.appendChild(addColorBtn)
collectColorContainer.appendChild(subtractColorBtn)
@ -217,8 +360,8 @@ class YJColorPicker {
let color = colorRgbaToHex(colorHsbaToRgba(_this.colorPicker.hsba))
let c = Cesium.Color.fromCssColorString(color || '#ffffff')
if (pickAlphaInput) {
c = c.withAlpha(pickAlphaInput.value / 100)
if (AInput) {
c = c.withAlpha(AInput.value)
}
let colorString = c.toCssHexString()
colorItemElm.style.backgroundColor = colorString
@ -252,23 +395,43 @@ class YJColorPicker {
subtractColorBtn.addEventListener('click', () => {
isSubtract = !isSubtract
if (isSubtract) {
minusIcon.style.display = 'none'
confirmIcon.style.display = 'unset'
for (let i = 0; i < subtractElmList.length; i++) {
subtractElmList[i].style.display = 'block'
}
}
else {
minusIcon.style.display = 'unset'
confirmIcon.style.display = 'none'
for (let i = 0; i < subtractElmList.length; i++) {
subtractElmList[i].style.display = 'none'
}
}
})
}
height = picker.offsetHeight
if (picker.style.display === 'none') {
picker.style.display = 'block'
height = picker.offsetHeight
picker.style.display = 'none'
}
if ((y + box.offsetHeight + 4) + height > window.innerHeight) {
picker.style.top = y - height + 'px'
}
else {
picker.style.top = (y + box.offsetHeight + 4) + 'px'
}
_this.colorPicker.pancelTop = parseFloat(picker.style.top) - 2
pickerInputChange(Cesium.Color.fromCssColorString(_this.colorPicker.config.defaultColor || '#ffffff').toCssHexString())
}
function clickDefineColor(color) {
if (pickAlphaInput) {
if (AInput) {
let c = Cesium.Color.fromCssColorString(color)
pickAlphaInput.value = Number((c.alpha * 100).toFixed(2))
AInput.value = parseInt(Number(c.alpha.toFixed(2)) * 100) / 100
}
}
@ -321,6 +484,84 @@ class YJColorPicker {
"#" + n
}
}
function colorHexToRgba(hex, alpha) {
let a = alpha || 1,
hColor = hex.toLowerCase(),
hLen = hex.length,
rgbaColor = [];
hColor = Cesium.Color.fromCssColorString(hColor).toCssHexString().substring(0, 7)
const colorRegExp = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
if (hex && colorRegExp.test(hColor)) {
//the hex length may be 4 or 7,contained the symbol of #
if (hLen === 4) {
let hSixColor = '#';
for (let i = 1; i < hLen; i++) {
let sColor = hColor.slice(i, i + 1);
hSixColor += sColor.concat(sColor);
}
hColor = hSixColor;
}
for (let j = 1, len = hColor.length; j < len; j += 2) {
rgbaColor.push(parseInt('0X' + hColor.slice(j, j + 2), 16));
}
// return "rgba(" + rgbaColor.join(",") + ',' + a + ")";
return rgbaColor;
} else {
return;
}
}
function colorRgbaToHsba(e) {
var t = e.slice(e.indexOf("(") + 1, e.lastIndexOf(")")).split(",")
, r = t.length < 4 ? 1 : Number(t[3])
, n = Number(t[0]) / 255
, o = Number(t[1]) / 255
, i = Number(t[2]) / 255
, a = void 0
, s = void 0
, l = void 0
, c = Math.min(n, o, i)
, d = l = Math.max(n, o, i)
, u = d - c;
if (d === c)
a = 0;
else {
switch (d) {
case n:
a = (o - i) / u + (o < i ? 6 : 0);
break;
case o:
a = 2 + (i - n) / u;
break;
case i:
a = 4 + (n - o) / u
}
a = Math.round(60 * a)
}
s = 0 === d ? 0 : 1 - c / d;
return s = Math.round(100 * s),
l = Math.round(100 * l),
{
h: a,
s: s,
b: l,
a: r
}
}
function pickerInputChange(v) {
if (_this.colorPicker && _this.colorPicker.pickerInput) {
let rgbaColor = colorHexToRgba(v || _this.colorPicker.pickerInput.value)
RInput.value = rgbaColor[0]
GInput.value = rgbaColor[1]
BInput.value = rgbaColor[2]
}
}
}
}

View File

@ -70,7 +70,7 @@ function StreamWall1() {
fragColor.rgb = color.rgb / 1.0;\n\
fragColor = czm_gammaCorrect(fragColor);\n\
material.alpha = colorImage.a * color.a;\n\
material.diffuse = (colorImage.rgb+color.rgb)/2.0;\n\
material.diffuse = color.rgb/20.0;\n\
material.emission = fragColor.rgb;\n\
return material;\n\
}";
@ -208,6 +208,14 @@ function StreamWall2() {
Property.equals(this.repeat, other._repeat) &&
Property.equals(this.repeats, other._repeats)
};
// let code2 = 'material.diffuse = color.rgb*1.0;'
// if (uniforms.is2D) {
// code2 = `
// material.diffuse = color.rgb*0.0;
// material.emission = color.rgb * 1.0;
// `
// }
// console.log(code2, uniforms.is2D)
// 将定义的材质对象添加到cesium的材质队列中
Material._materialCache.addMaterial(MaterialType, {
fabric: {
@ -230,8 +238,8 @@ function StreamWall2() {
else {
material.alpha = 1.0;
}
material.diffuse = colorImage.rgb*color.rgb*0.0;
material.emission = colorImage.rgb*color.rgb * 1.4;
material.diffuse = color.rgb*0.0;
material.emission = color.rgb * 1.0;
return material;
}`,
components: {

View File

@ -746,6 +746,7 @@
o.colorHsbaToRgba)(e.hsba) : e.pickerInput.value = (0,
o.colorRgbaToHex)((0,
o.colorHsbaToRgba)(e.hsba))
e.config.pickerInputChange && e.config.pickerInputChange()
}
function f(e) {
if (this.pickerFlag = !1,
@ -795,6 +796,8 @@
n.isFunction)(e.sure) ? e.sure : null,
clear: (0,
n.isFunction)(e.clear) ? e.clear : null,
pickerInputChange: (0,
n.isFunction)(e.pickerInputChange) ? e.pickerInputChange : null,
startMainCallback: (0,
n.isFunction)(e.startMainCallback) ? e.startMainCallback : null,
clickDefineColor: (0,
@ -807,8 +810,10 @@
else
this.init(o, this.config)
}
this.changeColor = g
this.close = () => {
this.pickerFlag = !this.pickerFlag,
this.picker.style.opacity = 0
this.render(this.box.parentNode, this.config),
d(this),
g(this, this.panelWidth, this.panelHeight)
@ -890,6 +895,7 @@
var u = i - e.hsba.a * i;
c(e.alphaBarThumb, "top", u + "px")
}
e.config.pickerInputChange && e.config.pickerInputChange()
}
function b(e, t) {
var r = e.hueBar.offsetHeight
@ -965,6 +971,7 @@
}
,
f.prototype.startMain = function(e, t) {
// console.log(e,t)
var r = this;
this.box = l(e, "ew-color-picker-box"),
this.box.setAttribute("color-box-id", this.uid),
@ -1002,8 +1009,21 @@
c += s.offsetParent.offsetTop,
f += s.offsetParent.offsetLeft,
s = s.offsetParent;
this.pancelLeft = f,
this.pancelTop = c + e.offsetHeight,
this.pancelLeft = f;
let defineColorContainer = this.picker.getElementsByClassName('ew-pre-define-color-container')[0]
let customColorHeight = 0
if(defineColorContainer) {
let colorList = localStorage.getItem('custom-color') || '{}'
colorList = JSON.parse(colorList)
customColorHeight = (Math.floor((Object.keys(colorList).length+2) / 11)+1) * 30
}
this.picker.style.display = 'block'
this.pancelTop = e.getBoundingClientRect().y + (e.offsetHeight + customColorHeight) + 2
if((this.picker.offsetHeight + customColorHeight) + this.pancelTop > window.innerHeight) {
this.pancelTop = e.getBoundingClientRect().y - (this.picker.offsetHeight + customColorHeight)
this.picker.style.top = this.pancelTop + 2 + 'px'
}
this.picker.style.display = 'none'
this.preDefineItem = l(e, "ew-pre-define-color", !0),
this.preDefineItem.length && (0,
n.ewObjToArray)(this.preDefineItem).map(function(e) {
@ -1054,7 +1074,7 @@
}, !1),
this.pickerClear.addEventListener("click", function() {
!function(e, t) {
t.config.defaultColor = "rgba(255,255,255,1)",
t.config.defaultColor = "",
t.pickerFlag = !t.pickerFlag,
t.render(e, t.config),
d(t),
@ -1070,6 +1090,9 @@
o.colorHsbaToRgba)(e.hsba) : (0,
o.colorRgbaToHex)((0,
o.colorHsbaToRgba)(e.hsba));
e.config.defaultColor = e.pickerInput.value
e.config.pickerInputChange && e.config.pickerInputChange()
e.render(e.box.parentNode, e.config),
e.config.sure(t, e)
}(r)
}),
@ -1097,6 +1120,7 @@
}(r, e)
}, !1),
this.bindEvent(this.pickerCursor, function(e, t, r, n) {
// console.log(e)
r=r-7
n=n-7
u(e, Math.max(0, Math.min(r - e.pancelLeft, i)), Math.max(0, Math.min(n - e.pancelTop, a)), i, a)
@ -1119,7 +1143,8 @@
a = i,
o.moveX = n.eventType[0].indexOf("touch") > -1 ? a.changedTouches[0].clientX : a.clientX,
o.moveY = n.eventType[0].indexOf("touch") > -1 ? a.changedTouches[0].clientY : a.clientY,
r ? t(o, o.moveX, o.moveY) : t(o, e, o.moveX, o.moveY)
r ? t(o, o.moveX, o.moveY) : t(o, e, o.moveX, o.moveY);
// console.log('222222', i, t,e, o.moveX, o.moveY)
};
document.addEventListener(n.eventType[1], a, {
capture: !1,

View File

@ -68,7 +68,6 @@
z-index: 999999;
background: linear-gradient(0deg, var(--color-sdk-bg-gradual)), rgba(0, 0, 0, 0.6);
border: 1.5px solid;
backdrop-filter: blur(2px);
border-image: linear-gradient(to bottom, var(--color-sdk-gradual)) 1;
text-align: left;
font-family: 'sy-boldface';
@ -1033,11 +1032,26 @@
background: linear-gradient(0deg, var(--color-sdk-bg-gradual)), rgba(0, 0, 0, 0.6);
border-image: linear-gradient(to bottom, var(--color-sdk-gradual)) 1;
padding: 5px;
position: fixed !important;
}
.YJ-custom-base-dialog>.content .ew-color-picker input {
font-size: 14px;
line-height: 28px;
height: 28px;
padding: 0 8px;
font-weight: 400;
}
.YJ-custom-base-dialog>.content .ew-color-picker .input-number-unit input[type=number] {
padding: 0 20px 0 8px;
width: 66px;
}
.YJ-custom-base-dialog.ew-color-picker>.ew-color-picker-content {
margin-bottom: 10px;
}
.YJ-custom-base-dialog .ew-color-picker>.ew-color-picker-content>.ew-color-panel {
width: 302px;
}
@ -1058,13 +1072,16 @@
.YJ-custom-base-dialog .ew-color-picker .icon-pen-box {
display: inline-block;
/* cursor: pointer; */
cursor: no-drop;
width: 24px;
height: 24px;
text-align: center;
line-height: 24px;
}
.YJ-custom-base-dialog>.content>div .ew-color-picker .row>.col {
margin: 0 !important;
}
.YJ-custom-base-dialog .ew-color-picker .icon-pen-box .icon-pen {
margin: 0;
}
@ -1080,9 +1097,9 @@
}
.YJ-custom-base-dialog .ew-color-picker .color-alpha>input {
font-weight: 400;
font-family: Arial;
font-size: 14px;
font-weight: 400 !important;
font-family: Arial !important;
font-size: 14px !important;
}
.YJ-custom-base-dialog .ew-color-picker>.ew-pre-define-color-container {
@ -1095,6 +1112,7 @@
margin: 0 0 8px 8px;
border: 1px solid #9b979b;
}
.YJ-custom-base-dialog .ew-color-picker>.ew-pre-define-color-container>.ew-pre-define-color:nth-child(11n+1) {
width: 22px;
height: 22px;
@ -1124,6 +1142,7 @@
text-align: center;
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==");
}
.YJ-custom-base-dialog .ew-color-picker>.yj-pre-collect-color-container>.yj-pre-collect-color:nth-child(11n+1) {
margin: 0 0 8px 0;
}
@ -1132,7 +1151,9 @@
.YJ-custom-base-dialog .ew-color-picker>.yj-pre-collect-color-container>.yj-pre-collect-color.subtract {
border-color: rgba(var(--color-sdk-base-rgb), 0.2);
background: unset;
line-height: 22px;
}
.YJ-custom-base-dialog .ew-color-picker>.yj-pre-collect-color-container>.yj-pre-collect-color.add:hover,
.YJ-custom-base-dialog .ew-color-picker>.yj-pre-collect-color-container>.yj-pre-collect-color.subtract:hover {
border-color: rgba(var(--color-sdk-base-rgb), 0.4);
@ -1156,10 +1177,12 @@
border-radius: 3px;
cursor: pointer;
}
.YJ-custom-base-dialog .ew-color-picker>.yj-pre-collect-color-container>.yj-pre-collect-color>.yj-pre-define-color-item.subtract-btn {
position: absolute;
top: 0;
left: 0;
line-height: 20px;
}
.YJ-custom-base-dialog .ew-color-picker>.yj-pre-collect-color-container>.yj-pre-collect-color:hover {
@ -1168,11 +1191,15 @@
.YJ-custom-base-dialog .ew-color-picker .ew-color-dropbtngroup {
display: flex;
position: unset;
}
.YJ-custom-base-dialog .ew-color-picker .ew-color-dropbtngroup button {
padding: 5px 10px 4px 10px;
padding: 0 8px;
height: 28px;
line-height: 28px;
}
.YJ-custom-base-dialog .ew-color-picker .ew-color-dropbtngroup button.ew-color-clear {
margin-right: 8px;
}
@ -1180,6 +1207,7 @@
.YJ-custom-base-dialog .ew-color-picker-box {
border-width: 4px;
border-color: #ffffff;
display: block;
}
.YJ-custom-base-dialog .ew-color-picker-box>.ew-color-picker-no,
@ -1401,6 +1429,24 @@
margin-bottom: 10px;
display: flex;
position: relative;
overflow-y: auto;
}
.DIV-cy-tabs .DIV-cy-tab-top::-webkit-scrollbar {
width: 4px;
height: 4px;
}
.DIV-cy-tabs .DIV-cy-tab-top::-webkit-scrollbar-thumb {
border-radius: 5px;
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
background-color: rgba(var(--color-sdk-base-rgb));
}
.DIV-cy-tabs .DIV-cy-tab-top::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
border-radius: 5px;
background-color: rgba(var(--color-sdk-base-rgb), 0.1);
}
.DIV-cy-tabs .DIV-cy-tab-top::after {
@ -1445,7 +1491,14 @@
border-bottom: 2px solid #dddddd00;
position: relative;
z-index: 2;
white-space: nowrap;
user-select: none;
cursor: pointer;
-webkit-pointer-events: auto;
-moz-pointer-events: auto;
-ms-pointer-events: auto;
-o-pointer-events: auto;
pointer-events: auto;
}
.DIV-cy-tabs .DIV-cy-tab-pane-title-p span {
@ -1935,6 +1988,7 @@
.YJ-custom-base-dialog.water-surface>.content>div .row .label {
flex: 0 0 60px;
}
/* 流光飞线 */
.YJ-custom-base-dialog.flow-line-surface>.content {
width: 586px;
@ -2104,6 +2158,10 @@
width: 200px;
}
.YJ-custom-base-dialog.particle-effects>.content .ew-color-picker .row>.col {
width: auto;
}
.YJ-custom-base-dialog.particle-effects>.content [type="range"] {
margin-top: 10px;
}
@ -2749,6 +2807,7 @@
.YJ-custom-base-dialog.polyline>.content {
width: 580px;
}
.YJ-custom-base-dialog.polyline>.content>div #dashTextureDom {
display: none;
}
@ -2800,6 +2859,7 @@
.YJ-custom-base-dialog.polyline>.content>div .spatial-info-table .table-body {
max-height: 185px;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-unit-box textarea {
border-radius: unset !important;
}
@ -2935,10 +2995,12 @@
background-color: rgba(var(--color-sdk-base-rgb), 0.1) !important;
border-radius: 4px 0px 0px 4px !important;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-unit:nth-of-type(1) .datalist {
background-color: rgba(var(--color-sdk-base-rgb), 0.1) !important;
border-radius: 4px 0px, 0px, 4px !important;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-unit:nth-of-type(2) .datalist {
background-color: rgba(var(--color-sdk-base-rgb), 0.1) !important;
border-radius: 0px 4px 4px 0px !important;
@ -2947,6 +3009,7 @@
.YJ-custom-base-dialog.polyline>.content>div .input-select-unit:nth-of-type(1) input {
border: 1px solid rgba(var(--color-sdk-base-rgb), 0.5) !important;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-unit:nth-of-type(2) input {
border: 1px solid rgba(var(--color-sdk-base-rgb), 0.5) !important;
}
@ -2979,65 +3042,78 @@
height: 13px;
margin-right: 7px;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.line {
border: 1px solid rgba(var(--color-sdk-base-rgb), 1);
height: 0px;
margin-top: 4px;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.dash-line {
border: 1px dashed rgba(var(--color-sdk-base-rgb), 1);
height: 0px;
margin-top: 4px;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.light-line {
border: 1px solid rgba(var(--color-sdk-base-rgb), 1);
height: 0px;
margin-top: 4px;
box-shadow: 0 0 3px #fff
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.tail-line {
background: url(../../img/arrow/tail.png) 100% 100% no-repeat;
background-size: 100% 100%;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.mult-tail-line {
background: url(../../img/arrow/tail.png) 100% 100% no-repeat;
background-size: 100% 100%;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.flow-dash-line1 {
border: 1px dashed rgba(var(--color-sdk-base-rgb), 1);
height: 0px;
margin-top: 4px;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.flow-dash-line2 {
border: 1px dashed rgba(var(--color-sdk-base-rgb), 1);
height: 0px;
margin-top: 4px;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.pic-line1 {
background: url(../../img/arrow/1.png);
background-size: cover;
background-position: center;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.pic-line2 {
background: url(../../img/arrow/2.png);
background-size: cover;
background-position: center;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.pic-line3 {
background: url(../../img/arrow/3.png);
background-size: cover;
background-position: center;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.pic-line4 {
background: url(../../img/arrow/4.png);
background-size: cover;
background-position: center;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.pic-line5 {
background: url(../../img/arrow/5.png);
background-size: cover;
background-position: center;
}
.YJ-custom-base-dialog.polyline>.content>div .input-select-line-type-box .cy_datalist i.pic-line6 {
background: url(../../img/arrow/6.png) 100% 100% no-repeat;
background-size: 100% 100%;
@ -3083,7 +3159,7 @@
/* 贴地图片 */
.YJ-custom-base-dialog.ground-image>.content {
width: 500px;
width: 560px;
}
/* 模型 */
@ -3505,3 +3581,184 @@
.YJ-custom-base-dialog.contour>.content .label {
flex: unset;
}
/* 锚点设置 */
.YJ-custom-base-dialog.anchor-point {
user-select: none;
}
.YJ-custom-base-dialog.anchor-point>.content {
padding: 14px 40px;
}
.YJ-custom-base-dialog.anchor-point>.content>div {
border: 1px solid #757575;
position: relative;
}
.YJ-custom-base-dialog.anchor-point>.content>div>.point {
width: 10px;
height: 10px;
position: absolute;
background: #FFDF53;
border-radius: 50%;
border: 1px solid #ff7300;
cursor: pointer;
}
.billboard-attribute-box {
position: absolute;
z-index: 1;
background: linear-gradient(0deg, var(--color-sdk-bg-gradual)), rgba(0, 0, 0, 0.6);
border: 1.5px solid;
border-image: linear-gradient(to bottom, var(--color-sdk-gradual)) 1;
color: #fff;
min-width: 200px;
min-height: 120px;
box-sizing: border-box;
/* -webkit-pointer-events: none;
-moz-pointer-events: none;
-ms-pointer-events: none;
-o-pointer-events: none;
pointer-events: none; */
}
.billboard-attribute-box .DIV-cy-tabs {
height: 100%;
display: flex;
flex-direction: column;
}
.billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-top .DIV-cy-tab-pane-title {
padding: 0 2px;
}
.billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-top .DIV-cy-tab-pane-title:first-child {
padding-left: 0;
}
.billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-top .DIV-cy-tab-pane-title:last-child {
padding-right: 0;
}
.billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-top .DIV-cy-tab-pane-title span {
margin: 0 5px;
}
.billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-content {
padding: 0 5px 5px 5px;
box-sizing: border-box;
flex: 1;
overflow: auto;
}
.billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-content::-webkit-scrollbar {
width: 8px;
height: 8px;
}
.billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-content::-webkit-scrollbar-thumb {
border-radius: 5px;
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
background-color: rgba(var(--color-sdk-base-rgb));
}
.billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-content::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
border-radius: 5px;
background-color: rgba(var(--color-sdk-base-rgb), 0.1);
}
.billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-content-pane {
width: 100%;
height: 100%;
}
.billboard-attribute-box .DIV-cy-tabs .DIV-cy-tab-content-pane iframe {
border: none;
}
.billboard-attribute-box .billboard-attribute-box-line {
position: absolute;
width: 0px;
/* border-left: 1px solid rgba(var(--color-sdk-base-rgb), 0.5); */
border-left: 1px solid rgba(var(--color-sdk-base-rgb), 1);
/* transform: rotate(45deg); */
transform-origin: 0px 0px;
-webkit-pointer-events: none;
-moz-pointer-events: none;
-ms-pointer-events: none;
-o-pointer-events: none;
pointer-events: none;
}
.billboard-attribute-box .drag-nook {
position: absolute;
width: 12px;
height: 12px;
display: block;
user-select: none;
-webkit-pointer-events: auto;
-moz-pointer-events: auto;
-ms-pointer-events: auto;
-o-pointer-events: auto;
pointer-events: auto;
z-index: 3;
clip-path: polygon(0% 100%, 100% 100%, 50% 50%);
background-image: linear-gradient(to top, #ffffff 1px, #00000000 1px);
background-size: 100% 3px;
/* background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAJRJREFUWEftltsJgFAMQ5NNdBJ1Eh3NTdRJdJPIBQXF50/p/WgHSNNDCSGch877EQbyIyCpBtAa/cZEsj9qXwhImgEURgZA8rTzzkAiYGVgITm+ErC6/Ek3vycMAkHAnYCkAUDKAosZSTaeSZiCqIwgCgJBIG8CWyXzKySSZBGBu+afStYBqIxMfJdSo8WPslHJgsAKWjkmIRBy/c8AAAAASUVORK5CYII='); */
}
.billboard-attribute-box .drag-nook.left-top {
top: -6px;
left: -6px;
cursor: se-resize;
transform: rotate(-45deg);
display: none;
}
.billboard-attribute-box .drag-nook.right-top {
top: -6px;
right: -6px;
cursor: ne-resize;
transform: rotate(45deg);
display: none;
}
.billboard-attribute-box .table {
background-color: #ffffff00;
color: #ffffff;
overflow: hidden;
border: 1px solid rgba(var(--color-sdk-base-rgb), 0.5);
}
.billboard-attribute-box .table .table-head .tr {
border-top: none;
border-left: none;
border-right: none;
}
.billboard-attribute-box .table .tr {
display: flex;
border: 1px solid rgba(var(--color-sdk-base-rgb), 0.5);
border-right: none;
}
.billboard-attribute-box .table .tr .th, .billboard-attribute-box .table .tr .td {
border-right: 1px solid rgba(var(--color-sdk-base-rgb), 0.5);
display: flex;
justify-content: center;
}
.billboard-attribute-box .table .tr .th:last-child, .billboard-attribute-box .table .tr .td:last-child {
border-right: none;
}
.billboard-attribute-box .table .table-body .tr {
border-bottom: none;
border-left: none;
}
.billboard-attribute-box .table .table-body .tr:first-child {
border-top: none;
}

View File

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="12" height="9.19921875" viewBox="0 0 12 9.19921875" fill="none">
<path d="M4.66806 9.2C4.47815 9.2 4.29548 9.12926 4.15776 9.00078L0.22761 5.35124C-0.0666872 5.0784 -0.0768368 4.62509 0.204411 4.33925C0.485649 4.0534 0.953909 4.04474 1.2482 4.31759L4.60427 7.43442L10.6916 0.260945C10.9511 -0.0436629 11.4165 -0.0884161 11.731 0.162779C12.0457 0.413972 12.0905 0.864388 11.8325 1.17044L5.23924 8.94014C5.10877 9.09461 4.91741 9.18845 4.713 9.2L4.66806 9.2Z" fill="#FFFFFF" >
</path>
</svg>

After

Width:  |  Height:  |  Size: 582 B