Compare commits
79 Commits
zh
...
b7e0249757
| Author | SHA1 | Date | |
|---|---|---|---|
| b7e0249757 | |||
| 67540c1808 | |||
| a888969c5d | |||
| 6bd3778ad9 | |||
| 0007343353 | |||
| e6da82c76c | |||
| d8962ff3cc | |||
| 7958e40494 | |||
| 00f1a40e2a | |||
| e38dd4d029 | |||
| 656a21a6dd | |||
| bdc7e58263 | |||
| d47ab3715d | |||
| 20a9388579 | |||
| ef3a682724 | |||
| 4954b51176 | |||
| 01e2422444 | |||
| 7a00e78145 | |||
| e2657ce0a8 | |||
| 76f4b707a6 | |||
| 01d82c16c9 | |||
| 8afd3138f4 | |||
| 3bbc71065a | |||
| 53ba8cb014 | |||
| 829d1a59f7 | |||
| 8ca3576c3e | |||
| a79c09b45d | |||
| f2a198ddaf | |||
| 72fc510167 | |||
| 552c086d3a | |||
| 603421ea87 | |||
| 9e0a43a75f | |||
| 60378db79d | |||
| 7b583f761b | |||
| 50b0866520 | |||
| 01b07a6fa2 | |||
| 3b5b026d43 | |||
| 8b00dcd56e | |||
| 294e38ed31 | |||
| 4bf05f109e | |||
| 6917b19ae8 | |||
| b3749b2a16 | |||
| 314f2a58b5 | |||
| 32066bbf99 | |||
| 6a71f41a19 | |||
| 3eadec9b11 | |||
| ea7feea226 | |||
| 05c69c034e | |||
| a82a8abf65 | |||
| 2fd421e637 | |||
| 6e2efbe544 | |||
| a43c71d94e | |||
| 12fcb9fed7 | |||
| f24a95ab32 | |||
| c03cd63532 | |||
| 1b712424d8 | |||
| 51f7ef9864 | |||
| 040049236d | |||
| 2db5eafabf | |||
| c843b025fc | |||
| 53b4eb03e5 | |||
| e242427228 | |||
| ff60cc4f65 | |||
| e45b67298a | |||
| 579b76dc0e | |||
| b0ae9c7042 | |||
| 11812253e6 | |||
| 399725ed06 | |||
| 574538e7bb | |||
| 45f2d6f4eb | |||
| ff4f823a27 | |||
| c6aa99792f | |||
| 16942a2e63 | |||
| dd003aa00d | |||
| ea94efb65f | |||
| fa3325580c | |||
| 0cf59afffd | |||
| 2b6edf70b9 | |||
| 484fe70e16 |
@ -1,5 +1,5 @@
|
|||||||
class BaseDialog {
|
class BaseDialog {
|
||||||
constructor(container, options = {}) {
|
constructor(container, options = {}, only = true) {
|
||||||
this.container = container
|
this.container = container
|
||||||
this.options = { ...options }
|
this.options = { ...options }
|
||||||
this.options.ismove = true
|
this.options.ismove = true
|
||||||
@ -9,10 +9,13 @@ class BaseDialog {
|
|||||||
this.closeCallBack = options.closeCallBack
|
this.closeCallBack = options.closeCallBack
|
||||||
this._element = {}
|
this._element = {}
|
||||||
this._element_style = undefined
|
this._element_style = undefined
|
||||||
|
this.only = only
|
||||||
}
|
}
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
this.closeAll()
|
if (this.only) {
|
||||||
|
this.closeAll()
|
||||||
|
}
|
||||||
DialogAll.push(this)
|
DialogAll.push(this)
|
||||||
this.isDestroy = false
|
this.isDestroy = false
|
||||||
// body
|
// body
|
||||||
@ -48,6 +51,15 @@ class BaseDialog {
|
|||||||
<button class="close">关闭</button>
|
<button class="close">关闭</button>
|
||||||
`
|
`
|
||||||
this._element.body.appendChild(this._element.foot)
|
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];
|
let closeBtnsBox = this._element.body.getElementsByClassName('close-box')[0];
|
||||||
|
|||||||
@ -49,7 +49,7 @@ export default class DrawCircle extends Draw {
|
|||||||
if (clickNum === 2) {
|
if (clickNum === 2) {
|
||||||
radius_points = cache_points.concat(cartesian)
|
radius_points = cache_points.concat(cartesian)
|
||||||
endpoint = this.cartesian3Towgs84(cartesian, this.viewer)
|
endpoint = this.cartesian3Towgs84(cartesian, this.viewer)
|
||||||
radius = this.computeDistance([center, endpoint])
|
radius = this.computeDistance2([center, endpoint])
|
||||||
positions = this.createCircle(center, radius)
|
positions = this.createCircle(center, radius)
|
||||||
this.end()
|
this.end()
|
||||||
cb(null, { center, radius: Number(radius) })
|
cb(null, { center, radius: Number(radius) })
|
||||||
@ -74,7 +74,7 @@ export default class DrawCircle extends Draw {
|
|||||||
if (clickNum) {
|
if (clickNum) {
|
||||||
radius_points = cache_points.concat(cartesian)
|
radius_points = cache_points.concat(cartesian)
|
||||||
endpoint = this.cartesian3Towgs84(cartesian, this.viewer)
|
endpoint = this.cartesian3Towgs84(cartesian, this.viewer)
|
||||||
radius = this.computeDistance([center, endpoint])
|
radius = this.computeDistance2([center, endpoint])
|
||||||
positions = this.createCircle(center, radius)
|
positions = this.createCircle(center, radius)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ export default class DrawCircle extends Draw {
|
|||||||
if (clickNum === 2) {
|
if (clickNum === 2) {
|
||||||
radius_points = cache_points.concat(cartesian)
|
radius_points = cache_points.concat(cartesian)
|
||||||
endpoint = this.cartesian3Towgs84(cartesian, this.viewer)
|
endpoint = this.cartesian3Towgs84(cartesian, this.viewer)
|
||||||
radius = this.computeDistance([center, endpoint])
|
radius = this.computeDistance2([center, endpoint])
|
||||||
positions = this.createCircle(center, radius)
|
positions = this.createCircle(center, radius)
|
||||||
this.end()
|
this.end()
|
||||||
cb(null, { center, radius: Number(radius) })
|
cb(null, { center, radius: Number(radius) })
|
||||||
@ -136,7 +136,7 @@ export default class DrawCircle extends Draw {
|
|||||||
if (clickNum === 2) {
|
if (clickNum === 2) {
|
||||||
radius_points = cache_points.concat(cartesian)
|
radius_points = cache_points.concat(cartesian)
|
||||||
endpoint = this.cartesian3Towgs84(cartesian, this.viewer)
|
endpoint = this.cartesian3Towgs84(cartesian, this.viewer)
|
||||||
radius = this.computeDistance([center, endpoint])
|
radius = this.computeDistance2([center, endpoint])
|
||||||
positions = this.createCircle(center, radius)
|
positions = this.createCircle(center, radius)
|
||||||
this.end()
|
this.end()
|
||||||
cb(null, { center, radius: Number(radius) })
|
cb(null, { center, radius: Number(radius) })
|
||||||
@ -161,7 +161,7 @@ export default class DrawCircle extends Draw {
|
|||||||
if (clickNum) {
|
if (clickNum) {
|
||||||
radius_points = cache_points.concat(cartesian)
|
radius_points = cache_points.concat(cartesian)
|
||||||
endpoint = this.cartesian3Towgs84(cartesian, this.viewer)
|
endpoint = this.cartesian3Towgs84(cartesian, this.viewer)
|
||||||
radius = this.computeDistance([center, endpoint])
|
radius = this.computeDistance2([center, endpoint])
|
||||||
positions = this.createCircle(center, radius)
|
positions = this.createCircle(center, radius)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ export default class DrawCircle extends Draw {
|
|||||||
if (clickNum === 2) {
|
if (clickNum === 2) {
|
||||||
radius_points = cache_points.concat(cartesian)
|
radius_points = cache_points.concat(cartesian)
|
||||||
endpoint = this.cartesian3Towgs84(cartesian, this.viewer)
|
endpoint = this.cartesian3Towgs84(cartesian, this.viewer)
|
||||||
radius = this.computeDistance([center, endpoint])
|
radius = this.computeDistance2([center, endpoint])
|
||||||
positions = this.createCircle(center, radius)
|
positions = this.createCircle(center, radius)
|
||||||
this.end()
|
this.end()
|
||||||
cb(null, { center, radius: Number(radius) })
|
cb(null, { center, radius: Number(radius) })
|
||||||
|
|||||||
@ -13,6 +13,7 @@ class DrawPolygon extends Draw {
|
|||||||
* */
|
* */
|
||||||
constructor(sdk, options = {}) {
|
constructor(sdk, options = {}) {
|
||||||
super(sdk, options)
|
super(sdk, options)
|
||||||
|
this.color = options.color || 'rgba(255,0,0,0.5)'
|
||||||
this.polygonHasCreated = false
|
this.polygonHasCreated = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,8 +35,8 @@ class DrawPolygon extends Draw {
|
|||||||
positions: new Cesium.CallbackProperty((e) => {
|
positions: new Cesium.CallbackProperty((e) => {
|
||||||
return that.positions.concat(that.positions[0])
|
return that.positions.concat(that.positions[0])
|
||||||
}),
|
}),
|
||||||
width: 2,
|
width: 3,
|
||||||
material: Cesium.Color.fromCssColorString('#c1c505').withAlpha(0.5),
|
material: Cesium.Color.fromCssColorString(that.color).withAlpha(1),
|
||||||
clampToGround: true,
|
clampToGround: true,
|
||||||
zIndex: 99999999
|
zIndex: 99999999
|
||||||
},
|
},
|
||||||
|
|||||||
109
src/Global/Contour/_element.js
Normal file
109
src/Global/Contour/_element.js
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
function html() {
|
||||||
|
return `
|
||||||
|
<span class="custom-divider"></span>
|
||||||
|
<div class="div-item">
|
||||||
|
<div class="row" style="align-items: flex-start;">
|
||||||
|
<div class="col" style="flex: 0 0 120px;">
|
||||||
|
<span class="label">等高线</span>
|
||||||
|
<input class="btn-switch show" type="checkbox">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<span class="custom-divider"></span>
|
||||||
|
<div class="div-item">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col input-select-unit-box">
|
||||||
|
<span class="label">等高距</span>
|
||||||
|
<div class="input-number input-number-unit-1">
|
||||||
|
<input class="input equal-height-distance" type="number" title="" min="1" max="1000">
|
||||||
|
<span class="unit">m</span>
|
||||||
|
<span class="arrow"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col input-select-unit-box" style="flex: 0 0 60px;">
|
||||||
|
</div>
|
||||||
|
<div class="col input-select-unit-box" style="flex: 0 0 157px;">
|
||||||
|
<span class="label">选中线颜色</span>
|
||||||
|
<div class="active-color"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<span class="custom-divider"></span>
|
||||||
|
<div class="div-item">
|
||||||
|
<div class="row" style="align-items: flex-start;">
|
||||||
|
<div class="col" style="flex: 0 0 120px;">
|
||||||
|
<span class="label">计曲线</span>
|
||||||
|
<input class="btn-switch index-contour-switch" type="checkbox">
|
||||||
|
</div>
|
||||||
|
<div class="col input-select-unit-box" style="flex: 0 0 120px;">
|
||||||
|
<span class="label">计曲线颜色</span>
|
||||||
|
<div class="index-contour-color"></div>
|
||||||
|
</div>
|
||||||
|
<div class="col input-select-unit-box">
|
||||||
|
<span class="label">计曲线宽度</span>
|
||||||
|
<div class="input-number input-number-unit-1">
|
||||||
|
<input class="input index-contour-width" type="number" title="" step="0.1" min="1" max="10">
|
||||||
|
<span class="unit">px</span>
|
||||||
|
<span class="arrow"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row" style="align-items: flex-start;">
|
||||||
|
<div class="col" style="flex: 0 0 120px;">
|
||||||
|
<span class="label">首曲线</span>
|
||||||
|
<input class="btn-switch intermediate-contour-switch" type="checkbox">
|
||||||
|
</div>
|
||||||
|
<div class="col input-select-unit-box" style="flex: 0 0 120px;">
|
||||||
|
<span class="label">首曲线颜色</span>
|
||||||
|
<div class="intermediate-contour-color"></div>
|
||||||
|
</div>
|
||||||
|
<div class="col input-select-unit-box">
|
||||||
|
<span class="label">首曲线宽度</span>
|
||||||
|
<div class="input-number input-number-unit-1">
|
||||||
|
<input class="input intermediate-contour-width" type="number" step="0.1" title="" min="1" max="10">
|
||||||
|
<span class="unit">px</span>
|
||||||
|
<span class="arrow"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row" style="align-items: flex-start;">
|
||||||
|
<div class="col" style="flex: 0 0 120px;">
|
||||||
|
<span class="label">间曲线</span>
|
||||||
|
<input class="btn-switch halfInterval-contour-switch" type="checkbox">
|
||||||
|
</div>
|
||||||
|
<div class="col input-select-unit-box" style="flex: 0 0 120px;">
|
||||||
|
<span class="label">间曲线颜色</span>
|
||||||
|
<div class="halfInterval-contour-color"></div>
|
||||||
|
</div>
|
||||||
|
<div class="col input-select-unit-box">
|
||||||
|
<span class="label">间曲线宽度</span>
|
||||||
|
<div class="input-number input-number-unit-1">
|
||||||
|
<input class="input halfInterval-contour-width" type="number" title="" min="1" max="10">
|
||||||
|
<span class="unit">px</span>
|
||||||
|
<span class="arrow"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row" style="align-items: flex-start;">
|
||||||
|
<div class="col" style="flex: 0 0 120px;">
|
||||||
|
<span class="label">助曲线</span>
|
||||||
|
<input class="btn-switch supplementary-contour-switch" type="checkbox">
|
||||||
|
</div>
|
||||||
|
<div class="col input-select-unit-box" style="flex: 0 0 120px;">
|
||||||
|
<span class="label">助曲线颜色</span>
|
||||||
|
<div class="supplementary-contour-color"></div>
|
||||||
|
</div>
|
||||||
|
<div class="col input-select-unit-box">
|
||||||
|
<span class="label">助曲线宽度</span>
|
||||||
|
<div class="input-number input-number-unit-1">
|
||||||
|
<input class="input supplementary-contour-width" type="number" title="" min="1" max="10">
|
||||||
|
<span class="unit">px</span>
|
||||||
|
<span class="arrow"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|
||||||
|
export { html }
|
||||||
@ -3,12 +3,35 @@
|
|||||||
*/
|
*/
|
||||||
import Dialog from "../../Obj/Element/Dialog";
|
import Dialog from "../../Obj/Element/Dialog";
|
||||||
import Tools from "../../Tools";
|
import Tools from "../../Tools";
|
||||||
|
import { flyTo } from '../global'
|
||||||
|
import YJColorPicker from "../../Obj/Element/yj-color-picker";
|
||||||
|
|
||||||
|
import { html } from "./_element";
|
||||||
|
|
||||||
let _DialogObject = null;
|
let _DialogObject = null;
|
||||||
let material = null;
|
let material = null;
|
||||||
let handler = null;
|
let handler = null;
|
||||||
let activeHeightElm = null;
|
let activeHeightElm = null;
|
||||||
let tools
|
let tools
|
||||||
|
let _sdk
|
||||||
|
let secondaryLinesCount = 19
|
||||||
|
let show = false
|
||||||
|
let equalHeightDistance = 10
|
||||||
|
let activeColor = '#ffd000'
|
||||||
|
let indexContourShow = true
|
||||||
|
let indexContourWidth = 2.5
|
||||||
|
let indexContourColor = '#43cf7c'
|
||||||
|
let intermediateContourShow = true
|
||||||
|
let intermediateContourWidth = 1.8
|
||||||
|
let intermediateContourColor = '#ff0000'
|
||||||
|
let halfIntervalContourShow = false
|
||||||
|
let halfIntervalContourWidth = 1.0
|
||||||
|
let halfIntervalContourColor = '#64b6d9'
|
||||||
|
let supplementaryContourShow = false
|
||||||
|
let supplementaryContourWidth = 1.0
|
||||||
|
let supplementaryContourColor = '#d084d1'
|
||||||
|
|
||||||
|
|
||||||
activeHeightElm = document.createElement('div')
|
activeHeightElm = document.createElement('div')
|
||||||
activeHeightElm.className = 'YJ-customize-active-height-elm'
|
activeHeightElm.className = 'YJ-customize-active-height-elm'
|
||||||
activeHeightElm.style.position = 'absolute'
|
activeHeightElm.style.position = 'absolute'
|
||||||
@ -20,7 +43,39 @@ activeHeightElm.style.textAlign = 'center'
|
|||||||
activeHeightElm.style.pointerEvents = 'none'
|
activeHeightElm.style.pointerEvents = 'none'
|
||||||
activeHeightElm.style.color = '#ff0000'
|
activeHeightElm.style.color = '#ff0000'
|
||||||
activeHeightElm.style.display = 'none'
|
activeHeightElm.style.display = 'none'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function accordingToCameraHeight() {
|
||||||
|
if (_sdk) {
|
||||||
|
const camera = _sdk.viewer.camera;
|
||||||
|
const position = camera.positionCartographic;
|
||||||
|
|
||||||
|
// 计算相机高度(相对于椭球面)
|
||||||
|
let cameraHeight = Cesium.Math.toDegrees(position.height);
|
||||||
|
if (cameraHeight < 1000000) {
|
||||||
|
if (!_sdk.viewer.scene.globe.material && show === true) {
|
||||||
|
showContour(_sdk)
|
||||||
|
}
|
||||||
|
// if (material) {
|
||||||
|
// if (cameraHeight > 450000) {
|
||||||
|
// material.uniforms.supplementaryContourShow = false
|
||||||
|
// }
|
||||||
|
// else if (supplementaryContourShow) {
|
||||||
|
// material.uniforms.supplementaryContourShow = true
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
hideContour(_sdk)
|
||||||
|
}
|
||||||
|
// console.log(cameraHeight)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
async function dialog(sdk) {
|
async function dialog(sdk) {
|
||||||
|
_sdk = sdk
|
||||||
|
|
||||||
if (!sdk || _DialogObject) {
|
if (!sdk || _DialogObject) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -28,13 +83,12 @@ async function dialog(sdk) {
|
|||||||
createMaterial()
|
createMaterial()
|
||||||
}
|
}
|
||||||
if (!tools) {
|
if (!tools) {
|
||||||
tools = new Tools()
|
tools = new Tools(sdk)
|
||||||
}
|
}
|
||||||
|
|
||||||
_DialogObject = await new Dialog(sdk, {}, {
|
_DialogObject = await new Dialog(sdk, {}, {
|
||||||
title: "等高线", left: '180px',
|
title: "全局等高线", left: '180px',
|
||||||
top: '100px',
|
top: '100px',
|
||||||
confirmCallBack: options => { },
|
|
||||||
closeCallBack: () => {
|
closeCallBack: () => {
|
||||||
_DialogObject = null
|
_DialogObject = null
|
||||||
}
|
}
|
||||||
@ -43,125 +97,374 @@ async function dialog(sdk) {
|
|||||||
_DialogObject._element.body.className =
|
_DialogObject._element.body.className =
|
||||||
_DialogObject._element.body.className + ' contour'
|
_DialogObject._element.body.className + ' contour'
|
||||||
let contentElm = document.createElement('div')
|
let contentElm = document.createElement('div')
|
||||||
contentElm.innerHTML = `
|
contentElm.innerHTML = html(this)
|
||||||
<span class="custom-divider"></span>
|
|
||||||
<div class="div-item">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col input-select-unit-box">
|
|
||||||
<span class="label">高差</span>
|
|
||||||
<div class="input-number input-number-unit-1">
|
|
||||||
<input class="input gap" type="number" title="" min="0" max="1000">
|
|
||||||
<span class="unit">m</span>
|
|
||||||
<span class="arrow"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col input-select-unit-box" style="flex: 0 0 120px;">
|
|
||||||
<span class="label">主线颜色</span>
|
|
||||||
<div class="primary-lice-color"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col input-select-unit-box">
|
|
||||||
<span class="label">次线条数</span>
|
|
||||||
<div class="input-number input-number-unit-1">
|
|
||||||
<input class="input gap2" type="number" title="" min="0" max="10">
|
|
||||||
<span class="unit"></span>
|
|
||||||
<span class="arrow"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col input-select-unit-box" style="flex: 0 0 120px;">
|
|
||||||
<span class="label">次线颜色</span>
|
|
||||||
<div class="secondary-lice-color"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row" style="align-items: flex-start;">
|
|
||||||
<div class="col">
|
|
||||||
</div>
|
|
||||||
<div class="col" style="flex: 0 0 120px;">
|
|
||||||
<span class="label">开关</span>
|
|
||||||
<input class="btn-switch" type="checkbox">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<span class="custom-divider"></span>
|
|
||||||
`
|
|
||||||
contentElm.innerHTML = `
|
|
||||||
<span class="custom-divider"></span>
|
|
||||||
<div class="div-item">
|
|
||||||
<div class="row" style="align-items: flex-start;">
|
|
||||||
<div class="col" style="flex: 0 0 120px;">
|
|
||||||
<span class="label">开关</span>
|
|
||||||
<input class="btn-switch" type="checkbox">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`
|
|
||||||
_DialogObject.contentAppChild(contentElm)
|
_DialogObject.contentAppChild(contentElm)
|
||||||
|
|
||||||
contentElm.getElementsByClassName('btn-switch')[0].addEventListener('change', (e) => {
|
sdk.viewer.scene.postRender.removeEventListener(accordingToCameraHeight)
|
||||||
if (e.target.checked) {
|
sdk.viewer.scene.postRender.addEventListener(accordingToCameraHeight)
|
||||||
if (handler) {
|
|
||||||
handler.destroy()
|
|
||||||
}
|
|
||||||
if (!sdk.viewer.container.getElementsByClassName('YJ-customize-active-height-elm')[0]) {
|
|
||||||
sdk.viewer.container.appendChild(activeHeightElm)
|
|
||||||
}
|
|
||||||
|
|
||||||
handler = new Cesium.ScreenSpaceEventHandler(
|
// 显示
|
||||||
sdk.viewer.canvas
|
let showBtn = contentElm.getElementsByClassName('show')[0]
|
||||||
)
|
showBtn.checked = show
|
||||||
handler.setInputAction((movement) => {
|
showBtn.addEventListener('change', (e) => {
|
||||||
let cartesian = sdk.viewer.scene.pickPosition(movement.endPosition)
|
if (e.target.checked) {
|
||||||
if (cartesian) {
|
show = true
|
||||||
let top = 0
|
let height = sdk.viewer.camera.positionCartographic.height
|
||||||
let left = 0
|
if (height > 16360) {
|
||||||
if (sdk.viewer && sdk.viewer._element) {
|
let cartographic = sdk.viewer.camera.positionCartographic
|
||||||
let element = sdk.viewer._element.getElementsByClassName('cesium-widget')[0].getElementsByTagName('canvas')[0]
|
let options = {
|
||||||
top = element.getBoundingClientRect().top + window.scrollY
|
position: {
|
||||||
left = element.getBoundingClientRect().left + window.scrollX
|
lng: Cesium.Math.toDegrees(cartographic.longitude),
|
||||||
}
|
lat: Cesium.Math.toDegrees(cartographic.latitude),
|
||||||
activeHeightElm.style.left = movement.endPosition.x - 50 + left + 'px'
|
alt: 16360,
|
||||||
activeHeightElm.style.top = movement.endPosition.y - 40 + top + 'px'
|
},
|
||||||
activeHeightElm.style.display = 'block'
|
|
||||||
let pos84 = tools.cartesian3Towgs84(cartesian, sdk.viewer)
|
|
||||||
let mainContourHeight = Math.floor(pos84.alt / material.uniforms.spacing) * material.uniforms.spacing
|
|
||||||
let gap = pos84.alt - mainContourHeight
|
|
||||||
let gap2 = material.uniforms.spacing / (material.uniforms.secondaryLinesCount + 1)
|
|
||||||
let activeHeight = Math.floor(gap / gap2) * gap2 + mainContourHeight
|
|
||||||
if ((pos84.alt - activeHeight) > gap2 / 2) {
|
|
||||||
activeHeight = activeHeight + gap2
|
|
||||||
}
|
|
||||||
material.uniforms.mouseHeight = pos84.alt
|
|
||||||
material.uniforms.mousePosition = cartesian
|
|
||||||
activeHeightElm.innerHTML = `${activeHeight.toFixed(0)}`
|
|
||||||
}
|
}
|
||||||
else {
|
flyTo(sdk, options, 0.5)
|
||||||
activeHeightElm.style.display = 'none'
|
}
|
||||||
}
|
showContour(sdk)
|
||||||
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE)
|
|
||||||
sdk.viewer.scene.globe.material = material;
|
|
||||||
} else {
|
} else {
|
||||||
if (handler) {
|
show = false
|
||||||
handler.destroy()
|
hideContour(sdk)
|
||||||
handler = null
|
|
||||||
}
|
|
||||||
if (sdk.viewer.container.getElementsByClassName('YJ-customize-active-height-elm')[0]) {
|
|
||||||
activeHeightElm.style.display = 'none'
|
|
||||||
sdk.viewer.container.removeChild(activeHeightElm)
|
|
||||||
}
|
|
||||||
sdk.viewer.scene.globe.material = null;
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
// 等高距
|
||||||
|
let equalHeightDistanceInput = contentElm.getElementsByClassName('equal-height-distance')[0]
|
||||||
|
equalHeightDistanceInput.value = equalHeightDistance
|
||||||
|
equalHeightDistanceInput.addEventListener('blur', (e) => {
|
||||||
|
let value = initInputValue(e)
|
||||||
|
equalHeightDistance = value
|
||||||
|
equalHeightDistanceInput.value = value
|
||||||
|
if (material) {
|
||||||
|
material.uniforms.spacing = equalHeightDistance * 5
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 选中颜色
|
||||||
|
// let activeColorPicker = new YJColorPicker({
|
||||||
|
// el: contentElm.getElementsByClassName('active-color')[0],
|
||||||
|
// size: "mini",
|
||||||
|
// isLog: false,
|
||||||
|
// alpha: true, //是否开启透明度
|
||||||
|
// disabled: false, //是否禁止打开颜色选择器
|
||||||
|
// predefineColor: true, // 预定义颜色
|
||||||
|
// defaultColor: '#ffffff',
|
||||||
|
// sure: color => {
|
||||||
|
// activeColor = color
|
||||||
|
// if (material) {
|
||||||
|
// material.uniforms.activeColor = Cesium.Color.fromCssColorString(activeColor)
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// clear: () => {
|
||||||
|
// activeColor = 'rgba(255,255,255,1)'
|
||||||
|
// if (material) {
|
||||||
|
// material.uniforms.activeColor = Cesium.Color.fromCssColorString(activeColor)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
let activeColorPicker = new YJColorPicker({
|
||||||
|
el: contentElm.getElementsByClassName('active-color')[0],
|
||||||
|
size: 'mini',//颜色box类型
|
||||||
|
alpha: true,//是否开启透明度
|
||||||
|
defaultColor: activeColor,
|
||||||
|
disabled: false,//是否禁止打开颜色选择器
|
||||||
|
openPickerAni: 'opacity',//打开颜色选择器动画
|
||||||
|
sure: color => {
|
||||||
|
activeColor = color
|
||||||
|
if (material) {
|
||||||
|
material.uniforms.activeColor = Cesium.Color.fromCssColorString(activeColor)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
clear: () => {
|
||||||
|
activeColor = 'rgba(255,255,255,1)'
|
||||||
|
if (material) {
|
||||||
|
material.uniforms.activeColor = Cesium.Color.fromCssColorString(activeColor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 计曲线开关
|
||||||
|
let indexContourSwitch = contentElm.getElementsByClassName('index-contour-switch')[0]
|
||||||
|
indexContourSwitch.checked = indexContourShow
|
||||||
|
indexContourSwitch.addEventListener('change', (e) => {
|
||||||
|
indexContourShow = e.target.checked
|
||||||
|
if (material) {
|
||||||
|
material.uniforms.indexContourShow = indexContourShow
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// 计曲线颜色
|
||||||
|
let indexContourColorPicker = new YJColorPicker({
|
||||||
|
el: contentElm.getElementsByClassName('index-contour-color')[0],
|
||||||
|
size: 'mini',//颜色box类型
|
||||||
|
alpha: true,//是否开启透明度
|
||||||
|
defaultColor: indexContourColor,
|
||||||
|
disabled: false,//是否禁止打开颜色选择器
|
||||||
|
openPickerAni: 'opacity',//打开颜色选择器动画
|
||||||
|
sure: color => {
|
||||||
|
indexContourColor = color
|
||||||
|
if (material) {
|
||||||
|
material.uniforms.indexContourColor = Cesium.Color.fromCssColorString(indexContourColor)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
clear: () => {
|
||||||
|
indexContourColor = 'rgba(255,255,255,1)'
|
||||||
|
if (material) {
|
||||||
|
material.uniforms.indexContourColor = Cesium.Color.fromCssColorString(indexContourColor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// 计曲线宽度
|
||||||
|
let indexContourWidthInput = contentElm.getElementsByClassName('index-contour-width')[0]
|
||||||
|
indexContourWidthInput.value = indexContourWidth
|
||||||
|
indexContourWidthInput.addEventListener('blur', (e) => {
|
||||||
|
let value = initInputValue(e)
|
||||||
|
indexContourWidth = value
|
||||||
|
indexContourWidthInput.value = value
|
||||||
|
if (material) {
|
||||||
|
material.uniforms.indexContourWidth = indexContourWidth
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 首曲线开关
|
||||||
|
let intermediateContourSwitch = contentElm.getElementsByClassName('intermediate-contour-switch')[0]
|
||||||
|
intermediateContourSwitch.checked = intermediateContourShow
|
||||||
|
intermediateContourSwitch.addEventListener('change', (e) => {
|
||||||
|
intermediateContourShow = e.target.checked
|
||||||
|
if (material) {
|
||||||
|
material.uniforms.intermediateContourShow = intermediateContourShow
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// 首曲线颜色
|
||||||
|
let intermediateContourColorPicker = new YJColorPicker({
|
||||||
|
el: contentElm.getElementsByClassName('intermediate-contour-color')[0],
|
||||||
|
size: 'mini',//颜色box类型
|
||||||
|
alpha: true,//是否开启透明度
|
||||||
|
defaultColor: intermediateContourColor,
|
||||||
|
disabled: false,//是否禁止打开颜色选择器
|
||||||
|
openPickerAni: 'opacity',//打开颜色选择器动画
|
||||||
|
sure: color => {
|
||||||
|
intermediateContourColor = color
|
||||||
|
if (material) {
|
||||||
|
material.uniforms.intermediateContourColor = Cesium.Color.fromCssColorString(intermediateContourColor)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
clear: () => {
|
||||||
|
intermediateContourColor = 'rgba(255,255,255,1)'
|
||||||
|
if (material) {
|
||||||
|
material.uniforms.intermediateContourColor = Cesium.Color.fromCssColorString(intermediateContourColor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// 首曲线宽度
|
||||||
|
let intermediateContourWidthInput = contentElm.getElementsByClassName('intermediate-contour-width')[0]
|
||||||
|
intermediateContourWidthInput.value = intermediateContourWidth
|
||||||
|
intermediateContourWidthInput.addEventListener('blur', (e) => {
|
||||||
|
let value = initInputValue(e)
|
||||||
|
intermediateContourWidth = value
|
||||||
|
intermediateContourWidthInput.value = value
|
||||||
|
if (material) {
|
||||||
|
material.uniforms.intermediateContourWidth = intermediateContourWidth
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 间曲线开关
|
||||||
|
let halfIntervalContourSwitch = contentElm.getElementsByClassName('halfInterval-contour-switch')[0]
|
||||||
|
halfIntervalContourSwitch.checked = halfIntervalContourShow
|
||||||
|
halfIntervalContourSwitch.addEventListener('change', (e) => {
|
||||||
|
halfIntervalContourShow = e.target.checked
|
||||||
|
if (material) {
|
||||||
|
material.uniforms.halfIntervalContourShow = halfIntervalContourShow
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// 间曲线颜色
|
||||||
|
let halfIntervalContourColorPicker = new YJColorPicker({
|
||||||
|
el: contentElm.getElementsByClassName('halfInterval-contour-color')[0],
|
||||||
|
size: 'mini',//颜色box类型
|
||||||
|
alpha: true,//是否开启透明度
|
||||||
|
defaultColor: halfIntervalContourColor,
|
||||||
|
disabled: false,//是否禁止打开颜色选择器
|
||||||
|
openPickerAni: 'opacity',//打开颜色选择器动画
|
||||||
|
sure: color => {
|
||||||
|
halfIntervalContourColor = color
|
||||||
|
if (material) {
|
||||||
|
material.uniforms.halfIntervalContourColor = Cesium.Color.fromCssColorString(halfIntervalContourColor)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
clear: () => {
|
||||||
|
halfIntervalContourColor = 'rgba(255,255,255,1)'
|
||||||
|
if (material) {
|
||||||
|
material.uniforms.halfIntervalContourColor = Cesium.Color.fromCssColorString(halfIntervalContourColor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// 间曲线宽度
|
||||||
|
let halfIntervalContourWidthInput = contentElm.getElementsByClassName('halfInterval-contour-width')[0]
|
||||||
|
halfIntervalContourWidthInput.value = halfIntervalContourWidth
|
||||||
|
halfIntervalContourWidthInput.addEventListener('blur', (e) => {
|
||||||
|
let value = initInputValue(e)
|
||||||
|
halfIntervalContourWidth = value
|
||||||
|
halfIntervalContourWidthInput.value = value
|
||||||
|
if (material) {
|
||||||
|
material.uniforms.halfIntervalContourWidth = halfIntervalContourWidth
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 助曲线开关
|
||||||
|
let supplementaryContourSwitch = contentElm.getElementsByClassName('supplementary-contour-switch')[0]
|
||||||
|
supplementaryContourSwitch.checked = supplementaryContourShow
|
||||||
|
supplementaryContourSwitch.addEventListener('change', (e) => {
|
||||||
|
supplementaryContourShow = e.target.checked
|
||||||
|
if (material) {
|
||||||
|
material.uniforms.supplementaryContourShow = supplementaryContourShow
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// 助曲线颜色
|
||||||
|
let supplementaryContourColorPicker = new YJColorPicker({
|
||||||
|
el: contentElm.getElementsByClassName('supplementary-contour-color')[0],
|
||||||
|
size: 'mini',//颜色box类型
|
||||||
|
alpha: true,//是否开启透明度
|
||||||
|
defaultColor: supplementaryContourColor,
|
||||||
|
disabled: false,//是否禁止打开颜色选择器
|
||||||
|
openPickerAni: 'opacity',//打开颜色选择器动画
|
||||||
|
sure: color => {
|
||||||
|
supplementaryContourColor = color
|
||||||
|
if (material) {
|
||||||
|
material.uniforms.supplementaryContourColor = Cesium.Color.fromCssColorString(supplementaryContourColor)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
clear: () => {
|
||||||
|
supplementaryContourColor = 'rgba(255,255,255,1)'
|
||||||
|
if (material) {
|
||||||
|
material.uniforms.supplementaryContourColor = Cesium.Color.fromCssColorString(supplementaryContourColor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// 助曲线宽度
|
||||||
|
let supplementaryContourWidthInput = contentElm.getElementsByClassName('supplementary-contour-width')[0]
|
||||||
|
supplementaryContourWidthInput.value = supplementaryContourWidth
|
||||||
|
supplementaryContourWidthInput.addEventListener('blur', (e) => {
|
||||||
|
let value = initInputValue(e)
|
||||||
|
supplementaryContourWidth = value
|
||||||
|
supplementaryContourWidthInput.value = value
|
||||||
|
if (material) {
|
||||||
|
material.uniforms.supplementaryContourWidth = supplementaryContourWidth
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function initInputValue(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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function showContour(sdk) {
|
||||||
|
const camera = sdk.viewer.camera;
|
||||||
|
const position = camera.positionCartographic;
|
||||||
|
// 计算相机高度(相对于椭球面)
|
||||||
|
let cameraHeight = Cesium.Math.toDegrees(position.height);
|
||||||
|
if (cameraHeight > 1000000) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (handler) {
|
||||||
|
handler.destroy()
|
||||||
|
}
|
||||||
|
if (!sdk.viewer.container.getElementsByClassName('YJ-customize-active-height-elm')[0]) {
|
||||||
|
sdk.viewer.container.appendChild(activeHeightElm)
|
||||||
|
}
|
||||||
|
|
||||||
|
handler = new Cesium.ScreenSpaceEventHandler(
|
||||||
|
sdk.viewer.canvas
|
||||||
|
)
|
||||||
|
handler.setInputAction((movement) => {
|
||||||
|
let cartesian = sdk.viewer.scene.pickPosition(movement.endPosition)
|
||||||
|
if (cartesian) {
|
||||||
|
let top = 0
|
||||||
|
let left = 0
|
||||||
|
if (sdk.viewer && sdk.viewer._element) {
|
||||||
|
let element = sdk.viewer._element.getElementsByClassName('cesium-widget')[0].getElementsByTagName('canvas')[0]
|
||||||
|
top = element.getBoundingClientRect().top + window.scrollY
|
||||||
|
left = element.getBoundingClientRect().left + window.scrollX
|
||||||
|
}
|
||||||
|
activeHeightElm.style.left = movement.endPosition.x - 50 + left + 'px'
|
||||||
|
activeHeightElm.style.top = movement.endPosition.y - 40 + top + 'px'
|
||||||
|
activeHeightElm.style.display = 'block'
|
||||||
|
// let pos = sdk.viewer.scene.clampToHeight(cartesian)
|
||||||
|
let pos84 = tools.cartesian3Towgs84(cartesian, sdk.viewer)
|
||||||
|
// pos84.alt = height
|
||||||
|
let mainContourHeight = Math.floor(pos84.alt / material.uniforms.spacing) * material.uniforms.spacing
|
||||||
|
let gap = pos84.alt - mainContourHeight
|
||||||
|
let gap2 = material.uniforms.spacing / (material.uniforms.secondaryLinesCount + 1)
|
||||||
|
let activeHeight = Math.floor(gap / gap2) * gap2 + mainContourHeight
|
||||||
|
if (pos84.alt < 0) {
|
||||||
|
pos84.alt = 0
|
||||||
|
}
|
||||||
|
if ((pos84.alt - activeHeight) > gap2 / 2) {
|
||||||
|
activeHeight = activeHeight + gap2
|
||||||
|
}
|
||||||
|
material.uniforms.mouseHeight = pos84.alt
|
||||||
|
material.uniforms.mousePosition = cartesian
|
||||||
|
activeHeightElm.innerHTML = `${activeHeight.toFixed(0)}`
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
activeHeightElm.style.display = 'none'
|
||||||
|
}
|
||||||
|
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE)
|
||||||
|
sdk.viewer.scene.globe.material = material;
|
||||||
|
}
|
||||||
|
function hideContour(sdk) {
|
||||||
|
if (handler) {
|
||||||
|
handler.destroy()
|
||||||
|
handler = null
|
||||||
|
}
|
||||||
|
if (sdk.viewer.container.getElementsByClassName('YJ-customize-active-height-elm')[0]) {
|
||||||
|
activeHeightElm.style.display = 'none'
|
||||||
|
sdk.viewer.container.removeChild(activeHeightElm)
|
||||||
|
}
|
||||||
|
sdk.viewer.scene.globe.material = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createMaterial() {
|
function createMaterial() {
|
||||||
Cesium.Material._materialCache._materials.ElevationContour.fabric.source = `
|
Cesium.Material._materialCache._materials.ElevationContour.fabric.source = `
|
||||||
uniform vec4 color;
|
uniform vec4 activeColor; // 选中颜色
|
||||||
uniform vec4 secondaryLinesColor;
|
uniform float spacing; // 等高距
|
||||||
uniform float spacing;
|
|
||||||
uniform float width;
|
// 计曲线
|
||||||
uniform float secondaryLinesWidth;
|
uniform bool indexContourShow;
|
||||||
|
uniform float indexContourWidth;
|
||||||
|
uniform vec4 indexContourColor;
|
||||||
|
// 首曲线
|
||||||
|
uniform bool intermediateContourShow;
|
||||||
|
uniform float intermediateContourWidth;
|
||||||
|
uniform vec4 intermediateContourColor;
|
||||||
|
// 间曲线
|
||||||
|
uniform bool halfIntervalContourShow;
|
||||||
|
uniform float halfIntervalContourWidth;
|
||||||
|
uniform vec4 halfIntervalContourColor;
|
||||||
|
// 助曲线
|
||||||
|
uniform bool supplementaryContourShow;
|
||||||
|
uniform float supplementaryContourWidth;
|
||||||
|
uniform vec4 supplementaryContourColor;
|
||||||
|
|
||||||
uniform float mouseHeight;
|
uniform float mouseHeight;
|
||||||
|
|
||||||
uniform float secondaryLinesCount; // 0=无次线, 1=1条次线, 2=2条次线...
|
uniform float secondaryLinesCount; // 0=无次线, 1=1条次线, 2=2条次线...
|
||||||
|
|
||||||
czm_material czm_getMaterial(czm_materialInput materialInput)
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||||||
@ -175,24 +478,60 @@ czm_material czm_getMaterial(czm_materialInput materialInput)
|
|||||||
#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))
|
#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))
|
||||||
float dxc = abs(dFdx(materialInput.height));
|
float dxc = abs(dFdx(materialInput.height));
|
||||||
float dyc = abs(dFdy(materialInput.height));
|
float dyc = abs(dFdy(materialInput.height));
|
||||||
float dFMain = max(dxc, dyc) * czm_pixelRatio * width;
|
float dFMain = max(dxc, dyc) * czm_pixelRatio * indexContourWidth;
|
||||||
#else
|
#else
|
||||||
float dFMain = czm_pixelRatio * width;
|
float dFMain = czm_pixelRatio * indexContourWidth;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool isMainContour = distanceToMainContour < dFMain;
|
bool isMainContour = distanceToMainContour < dFMain;
|
||||||
bool isSecondaryContour = false;
|
bool isSecondaryContour = false;
|
||||||
float dFSecondary = 0.0;
|
float dFSecondary = 0.0;
|
||||||
float secondarySpacing = 0.0;
|
float secondarySpacing = 0.0;
|
||||||
|
bool isHalfInterval = false;
|
||||||
|
bool isIntermediate= false;
|
||||||
|
|
||||||
|
// 计算当前高度所属的等高线高度
|
||||||
|
float mainContourHeight = floor(materialInput.height / spacing) * spacing;
|
||||||
|
float secondaryContourHeight = floor(materialInput.height / spacing * (secondaryLinesCount + 1.0)) * spacing / (secondaryLinesCount + 1.0);
|
||||||
|
|
||||||
|
// 计算次线在两条主等高线之间的相对位置
|
||||||
|
float relativeHeight = materialInput.height - mainContourHeight;
|
||||||
|
float normalizedPosition = relativeHeight / spacing;
|
||||||
|
|
||||||
|
// 计算次线索引(从主等高线开始计数)
|
||||||
|
float lineIndex = floor(normalizedPosition * (secondaryLinesCount + 1.0));
|
||||||
|
|
||||||
// 只有当存在次线时才计算次线
|
// 只有当存在次线时才计算次线
|
||||||
if(secondaryLinesCount > 0.0) {
|
if(secondaryLinesCount > 0.0) {
|
||||||
|
float secondaryLinesWidth = supplementaryContourWidth;
|
||||||
secondarySpacing = spacing / (secondaryLinesCount + 1.0);
|
secondarySpacing = spacing / (secondaryLinesCount + 1.0);
|
||||||
float distanceToSecondaryContour = mod(materialInput.height, secondarySpacing);
|
float distanceToSecondaryContour = mod(materialInput.height, secondarySpacing);
|
||||||
|
|
||||||
// 确保次线不会与主线重叠
|
// 确保次线不会与主线重叠
|
||||||
float minDistanceToMain = min(distanceToMainContour, spacing - distanceToMainContour);
|
float minDistanceToMain = min(distanceToMainContour, spacing - distanceToMainContour);
|
||||||
bool notCloseToMain = minDistanceToMain > dFMain * 2.0; // 2倍线宽缓冲
|
bool notCloseToMain = minDistanceToMain > dFMain * 2.0; // 2倍线宽缓冲
|
||||||
|
|
||||||
|
|
||||||
|
if (lineIndex > 0.0 && lineIndex < secondaryLinesCount) {
|
||||||
|
// 使用mod函数检查余数是否接近0(考虑浮点数精度问题)
|
||||||
|
isHalfInterval = abs(mod(lineIndex, 2.0)) < 0.01;
|
||||||
|
if(isHalfInterval) {
|
||||||
|
secondaryLinesWidth = halfIntervalContourWidth;
|
||||||
|
}
|
||||||
|
// 使用mod函数检查余数是否接近0(考虑浮点数精度问题)
|
||||||
|
isIntermediate = abs(mod(lineIndex, 4.0)) < 0.01;
|
||||||
|
if(isIntermediate) {
|
||||||
|
secondaryLinesWidth = intermediateContourWidth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))
|
#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))
|
||||||
dFSecondary = max(dxc, dyc) * czm_pixelRatio * secondaryLinesWidth;
|
dFSecondary = max(dxc, dyc) * czm_pixelRatio * secondaryLinesWidth;
|
||||||
@ -203,10 +542,6 @@ czm_material czm_getMaterial(czm_materialInput materialInput)
|
|||||||
isSecondaryContour = (distanceToSecondaryContour < dFSecondary) && notCloseToMain;
|
isSecondaryContour = (distanceToSecondaryContour < dFSecondary) && notCloseToMain;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算当前高度所属的等高线高度
|
|
||||||
float mainContourHeight = floor(materialInput.height / spacing) * spacing;
|
|
||||||
float secondaryContourHeight = floor(materialInput.height / spacing * (secondaryLinesCount + 1.0)) * spacing / (secondaryLinesCount + 1.0);
|
|
||||||
|
|
||||||
// 高亮判断
|
// 高亮判断
|
||||||
bool shouldHighlight = false;
|
bool shouldHighlight = false;
|
||||||
if(isMainContour && abs(mainContourHeight - mouseHeight) < 0.5 * (spacing/(secondaryLinesCount+1.0))) {
|
if(isMainContour && abs(mainContourHeight - mouseHeight) < 0.5 * (spacing/(secondaryLinesCount+1.0))) {
|
||||||
@ -218,15 +553,41 @@ czm_material czm_getMaterial(czm_materialInput materialInput)
|
|||||||
// 颜色输出
|
// 颜色输出
|
||||||
vec4 outColor;
|
vec4 outColor;
|
||||||
if(shouldHighlight) {
|
if(shouldHighlight) {
|
||||||
outColor = vec4(1.0, 0.0, 0.0, 1.0);
|
outColor = czm_gammaCorrect(vec4(activeColor.rgb, activeColor.a));
|
||||||
} else if(isMainContour) {
|
} else if(isMainContour) {
|
||||||
outColor = czm_gammaCorrect(vec4(color.rgb, color.a));
|
float a = indexContourColor.a;
|
||||||
|
if(!indexContourShow) {
|
||||||
|
a = 0.0;
|
||||||
|
}
|
||||||
|
outColor = czm_gammaCorrect(vec4(indexContourColor.rgb, a));
|
||||||
} else if(isSecondaryContour) {
|
} else if(isSecondaryContour) {
|
||||||
outColor = czm_gammaCorrect(vec4(secondaryLinesColor.rgb, secondaryLinesColor.a));
|
float a = supplementaryContourColor.a;
|
||||||
|
if(!supplementaryContourShow) {
|
||||||
|
a = 0.0;
|
||||||
|
}
|
||||||
|
outColor = czm_gammaCorrect(vec4(supplementaryContourColor.rgb, a));
|
||||||
|
if(isHalfInterval) {
|
||||||
|
float a = halfIntervalContourColor.a;
|
||||||
|
if(!halfIntervalContourShow) {
|
||||||
|
a = 0.0;
|
||||||
|
}
|
||||||
|
outColor = czm_gammaCorrect(vec4(halfIntervalContourColor.rgb, a));
|
||||||
|
}
|
||||||
|
if(isIntermediate) {
|
||||||
|
float a = intermediateContourColor.a;
|
||||||
|
if(!intermediateContourShow) {
|
||||||
|
a = 0.0;
|
||||||
|
}
|
||||||
|
outColor = czm_gammaCorrect(vec4(intermediateContourColor.rgb, a));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
outColor = vec4(0.0);
|
outColor = vec4(0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(materialInput.height<0.0) {
|
||||||
|
outColor = vec4(0.0);
|
||||||
|
}
|
||||||
|
|
||||||
material.diffuse = outColor.rgb;
|
material.diffuse = outColor.rgb;
|
||||||
material.alpha = outColor.a;
|
material.alpha = outColor.a;
|
||||||
return material;
|
return material;
|
||||||
@ -237,14 +598,25 @@ czm_material czm_getMaterial(czm_materialInput materialInput)
|
|||||||
fabric: {
|
fabric: {
|
||||||
type: "ElevationContour",
|
type: "ElevationContour",
|
||||||
uniforms: {
|
uniforms: {
|
||||||
width: 2,
|
spacing: 10 * 5,
|
||||||
secondaryLinesWidth: 1, // 次级线宽度
|
activeColor: Cesium.Color.fromCssColorString(activeColor),
|
||||||
spacing: 200,
|
|
||||||
color: Cesium.Color.fromCssColorString('#ffd000'),
|
|
||||||
secondaryLinesColor: Cesium.Color.fromCssColorString('#0dff00').withAlpha(0.5),
|
|
||||||
mouseHeight: -100000,
|
mouseHeight: -100000,
|
||||||
mousePosition: new Cesium.Cartesian3(0, 0, 0),
|
mousePosition: new Cesium.Cartesian3(0, 0, 0),
|
||||||
secondaryLinesCount: 3
|
secondaryLinesCount: secondaryLinesCount,
|
||||||
|
cameraHeight: 0,
|
||||||
|
|
||||||
|
indexContourShow: indexContourShow,
|
||||||
|
indexContourWidth: indexContourWidth,
|
||||||
|
indexContourColor: Cesium.Color.fromCssColorString(indexContourColor),
|
||||||
|
intermediateContourShow: intermediateContourShow,
|
||||||
|
intermediateContourWidth: intermediateContourWidth,
|
||||||
|
intermediateContourColor: Cesium.Color.fromCssColorString(intermediateContourColor),
|
||||||
|
halfIntervalContourShow: halfIntervalContourShow,
|
||||||
|
halfIntervalContourWidth: halfIntervalContourWidth,
|
||||||
|
halfIntervalContourColor: Cesium.Color.fromCssColorString(halfIntervalContourColor),
|
||||||
|
supplementaryContourShow: supplementaryContourShow,
|
||||||
|
supplementaryContourWidth: supplementaryContourWidth,
|
||||||
|
supplementaryContourColor: Cesium.Color.fromCssColorString(supplementaryContourColor),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -263,7 +263,7 @@ async function MapPrint(sdk, thumbnailImg, rectangle, originalImg) {
|
|||||||
updateCanvas()
|
updateCanvas()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
let borderColorPicker = new ewPlugins('colorpicker', {
|
let borderColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName('border-color')[0],
|
el: contentElm.getElementsByClassName('border-color')[0],
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: false, //是否开启透明度
|
alpha: false, //是否开启透明度
|
||||||
@ -564,7 +564,7 @@ async function MapPrint(sdk, thumbnailImg, rectangle, originalImg) {
|
|||||||
|
|
||||||
function changeMapBorderColor(color) {
|
function changeMapBorderColor(color) {
|
||||||
border.color = color || '#000000'
|
border.color = color || '#000000'
|
||||||
new ewPlugins('colorpicker', {
|
new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName('border-color')[0],
|
el: contentElm.getElementsByClassName('border-color')[0],
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: false, //是否开启透明度
|
alpha: false, //是否开启透明度
|
||||||
@ -1420,11 +1420,11 @@ async function MapPrint(sdk, thumbnailImg, rectangle, originalImg) {
|
|||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
let downloadElement = document.createElement('a');
|
let downloadElement = document.createElement('a');
|
||||||
downloadElement.href = url;
|
downloadElement.href = url;
|
||||||
downloadElement.download = `高清出图-${getDateTimeString()}.jpg`;
|
downloadElement.download = `高清出图-${getDateTimeString()}.png`;
|
||||||
document.body.appendChild(downloadElement);
|
document.body.appendChild(downloadElement);
|
||||||
downloadElement.click();
|
downloadElement.click();
|
||||||
document.body.removeChild(downloadElement);
|
document.body.removeChild(downloadElement);
|
||||||
}, 'image/jpeg', 0.95);
|
}, 'image/png', 0.95);
|
||||||
exporting = false;
|
exporting = false;
|
||||||
exportBtn.innerHTML = '打印';
|
exportBtn.innerHTML = '打印';
|
||||||
// canvas2.toBlob(function (blob) {
|
// canvas2.toBlob(function (blob) {
|
||||||
|
|||||||
@ -94,6 +94,10 @@ function off(sdk) {
|
|||||||
activeViewer = null
|
activeViewer = null
|
||||||
syncObject = {}
|
syncObject = {}
|
||||||
}
|
}
|
||||||
|
sdk.entityMap.forEach((item, key) => {
|
||||||
|
item.showView = undefined
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function syncData2(sdk, id, entityId) {
|
async function syncData2(sdk, id, entityId) {
|
||||||
@ -119,7 +123,11 @@ async function syncData2(sdk, id, entityId) {
|
|||||||
options.heightMode = 0
|
options.heightMode = 0
|
||||||
options.height = 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')) {
|
||||||
|
if(that.showView==3) {
|
||||||
|
options.show=false
|
||||||
|
}
|
||||||
let newObject = await new that.constructor(sdk2D, options)
|
let newObject = await new that.constructor(sdk2D, options)
|
||||||
newObject.onClick = that.onClick
|
newObject.onClick = that.onClick
|
||||||
newObject.onRightClick = that.onRightClick
|
newObject.onRightClick = that.onRightClick
|
||||||
|
|||||||
@ -278,7 +278,7 @@ async function init(sdk) {
|
|||||||
sdk.viewer.scene.preRender.addEventListener(syncViewer, syncObject)
|
sdk.viewer.scene.preRender.addEventListener(syncViewer, syncObject)
|
||||||
|
|
||||||
// sdk.viewer.imageryLayers.layerAdded.addEventListener(syncImageryLayerAdded);
|
// sdk.viewer.imageryLayers.layerAdded.addEventListener(syncImageryLayerAdded);
|
||||||
// sdk.viewer.imageryLayers.layerMoved.addEventListener(syncImageryLayerMoved);
|
sdk.viewer.imageryLayers.layerMoved.addEventListener(syncImageryLayerMoved);
|
||||||
// sdk.viewer.imageryLayers.layerRemoved.addEventListener(syncImageryLayerRemoved);
|
// sdk.viewer.imageryLayers.layerRemoved.addEventListener(syncImageryLayerRemoved);
|
||||||
// sdk.viewer.imageryLayers.layerShownOrHidden.addEventListener(syncImageryLayerShownOrHidden);
|
// sdk.viewer.imageryLayers.layerShownOrHidden.addEventListener(syncImageryLayerShownOrHidden);
|
||||||
|
|
||||||
@ -517,7 +517,7 @@ async function setSplitDirection(v, id, isoff = false, entityId) {
|
|||||||
thatD.textShow = thatP.textShow
|
thatD.textShow = thatP.textShow
|
||||||
}
|
}
|
||||||
if (thatP.label && thatP.labelShow) {
|
if (thatP.label && thatP.labelShow) {
|
||||||
thatP.label.entity.show = true
|
thatP.labelShow = true
|
||||||
}
|
}
|
||||||
if (thatD.label) {
|
if (thatD.label) {
|
||||||
thatD.label.options.ground = false
|
thatD.label.options.ground = false
|
||||||
@ -711,6 +711,9 @@ async function setSplitDirection(v, id, isoff = false, entityId) {
|
|||||||
status.P = true
|
status.P = true
|
||||||
status.D = true
|
status.D = true
|
||||||
options.show = true
|
options.show = true
|
||||||
|
if(thatP.type==='layer') {
|
||||||
|
options.layer_index = thatP.layer_index
|
||||||
|
}
|
||||||
target = await new thatP.constructor(sdkD, options)
|
target = await new thatP.constructor(sdkD, options)
|
||||||
if (thatP.onClick) {
|
if (thatP.onClick) {
|
||||||
target.onClick = thatP.onClick
|
target.onClick = thatP.onClick
|
||||||
@ -794,6 +797,9 @@ async function setSplitDirection(v, id, isoff = false, entityId) {
|
|||||||
status.P = false
|
status.P = false
|
||||||
status.D = true
|
status.D = true
|
||||||
options.show = true
|
options.show = true
|
||||||
|
if(thatP.type==='layer') {
|
||||||
|
options.layer_index = thatP.layer_index
|
||||||
|
}
|
||||||
target = await new thatP.constructor(sdkD, options)
|
target = await new thatP.constructor(sdkD, options)
|
||||||
if (thatP.onClick) {
|
if (thatP.onClick) {
|
||||||
target.onClick = thatP.onClick
|
target.onClick = thatP.onClick
|
||||||
@ -1033,7 +1039,13 @@ function syncImageryLayerAdded(layer, index) {
|
|||||||
sdkD.viewer.imageryLayers.addImageryProvider(layer.imageryProvider, index)
|
sdkD.viewer.imageryLayers.addImageryProvider(layer.imageryProvider, index)
|
||||||
}
|
}
|
||||||
function syncImageryLayerMoved(layer, newindxe, oldindex) {
|
function syncImageryLayerMoved(layer, newindxe, oldindex) {
|
||||||
let layerD = sdkD.viewer.imageryLayers._layers[oldindex]
|
let layerD
|
||||||
|
for (let i = 0; i < sdkD.viewer.imageryLayers._layers.length; i++) {
|
||||||
|
if (sdkD.viewer.imageryLayers._layers[i]._id === layer._id) {
|
||||||
|
layerD = sdkD.viewer.imageryLayers._layers[i]
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!layerD) {
|
if (!layerD) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1042,12 +1054,14 @@ function syncImageryLayerMoved(layer, newindxe, oldindex) {
|
|||||||
sdkD.viewer.imageryLayers.lowerToBottom(layerD)
|
sdkD.viewer.imageryLayers.lowerToBottom(layerD)
|
||||||
}
|
}
|
||||||
// 移到最高层
|
// 移到最高层
|
||||||
else if (newindxe === sdk.viewer.imageryLayers._layers.length - 1) {
|
else if (newindxe === sdkD.viewer.imageryLayers._layers.length - 1) {
|
||||||
sdkD.viewer.imageryLayers.raiseToTop(layerD)
|
sdkD.viewer.imageryLayers.raiseToTop(layerD)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (newindxe < oldindex) {
|
if (newindxe < oldindex) {
|
||||||
sdkD.viewer.imageryLayers.lower(layerD)
|
if(newindxe<sdkD.viewer.imageryLayers._layers.length-1) {
|
||||||
|
sdkD.viewer.imageryLayers.lower(layerD)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sdkD.viewer.imageryLayers.raise(layerD)
|
sdkD.viewer.imageryLayers.raise(layerD)
|
||||||
|
|||||||
56
src/Global/efflect/Sunshine/_element.js
Normal file
56
src/Global/efflect/Sunshine/_element.js
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
function html() {
|
||||||
|
return `
|
||||||
|
<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-1">
|
||||||
|
<input class="input" type="number" title="" min="0.01" max="999999" step="10" @model="speed">
|
||||||
|
<span class="arrow"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<span class="label">阴影柔和度</span>
|
||||||
|
<div class="input-number input-number-unit-1">
|
||||||
|
<input class="input" type="number" title="" min="0" max="1" step="0.1" @model="darkness">
|
||||||
|
<span class="arrow"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="div-item">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<span class="label">阴影优化</span>
|
||||||
|
<input class="btn-switch" type="checkbox" @model="softShadow">
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<span class="label" style="flex: 0 0 56px;">日期选择</span>
|
||||||
|
<input class="sunshine-date" type="text" placeholder="YYYY-MM-DD" @model="time">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<span class="custom-divider"></span>
|
||||||
|
<div class="div-item">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<div class="timeline-container">
|
||||||
|
<div class="timeline" id="timeline">
|
||||||
|
<div class="progress" id="progress">
|
||||||
|
<div class="handle" id="handle"></div>
|
||||||
|
<div class="current-time" id="currentTime">00:00:00</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="time-marks">
|
||||||
|
</div>
|
||||||
|
<button id="timePause">暂停</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<span class="custom-divider"></span>
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|
||||||
|
export { html }
|
||||||
92
src/Global/efflect/Sunshine/eventBinding.js
Normal file
92
src/Global/efflect/Sunshine/eventBinding.js
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
class eventBinding {
|
||||||
|
constructor() {
|
||||||
|
this.element = {}
|
||||||
|
}
|
||||||
|
static event = {}
|
||||||
|
|
||||||
|
getEvent(name) {
|
||||||
|
return eventBinding.event[name]
|
||||||
|
}
|
||||||
|
|
||||||
|
getEventAll() {
|
||||||
|
return eventBinding.event
|
||||||
|
}
|
||||||
|
|
||||||
|
setEvent(name, event) {
|
||||||
|
eventBinding.event[name] = event
|
||||||
|
}
|
||||||
|
|
||||||
|
on(that, elements) {
|
||||||
|
for (let i = 0; i < elements.length; i++) {
|
||||||
|
let Event = []
|
||||||
|
let isEvent = false
|
||||||
|
let removeName = []
|
||||||
|
if (!elements[i] || !elements[i].attributes) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (let m of elements[i].attributes) {
|
||||||
|
switch (m.name) {
|
||||||
|
case '@model': {
|
||||||
|
isEvent = true
|
||||||
|
if (elements[i].type == 'checkbox') {
|
||||||
|
Event.push((e) => { that[m.value] = e.target.checked })
|
||||||
|
elements[i].checked = that[m.value]
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Event.push((e) => {
|
||||||
|
let value = e.target.value
|
||||||
|
if (e.target.type == 'number') {
|
||||||
|
value = Number(value)
|
||||||
|
}
|
||||||
|
that[m.value] = value
|
||||||
|
})
|
||||||
|
if (elements[i].nodeName == 'IMG') {
|
||||||
|
elements[i].src = that[m.value]
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
elements[i].value = that[m.value]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.element[m.value]) {
|
||||||
|
this.element[m.value].push(elements[i])
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.element[m.value] = [elements[i]]
|
||||||
|
}
|
||||||
|
removeName.push(m.name)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case '@click': {
|
||||||
|
elements[i].addEventListener('click', (e) => {
|
||||||
|
if (typeof (that.Dialog[m.value]) === 'function') {
|
||||||
|
that.Dialog[m.value](e)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
removeName.push(m.name)
|
||||||
|
// elements[i].attributes.removeNamedItem(m.name)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// elements[i].attributes[m] = undefined
|
||||||
|
}
|
||||||
|
for (let n = 0; n < removeName.length; n++) {
|
||||||
|
elements[i].attributes.removeNamedItem(removeName[n])
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isEvent) {
|
||||||
|
let ventType = 'input'
|
||||||
|
if (elements[i].tagName != 'INPUT' || elements[i].type == 'checkbox') {
|
||||||
|
ventType = 'change'
|
||||||
|
}
|
||||||
|
elements[i].addEventListener(ventType, (e) => {
|
||||||
|
for (let t = 0; t < Event.length; t++) {
|
||||||
|
Event[t](e)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const EventBinding = new eventBinding();
|
||||||
|
export default EventBinding;
|
||||||
245
src/Global/efflect/Sunshine/index.js
Normal file
245
src/Global/efflect/Sunshine/index.js
Normal file
@ -0,0 +1,245 @@
|
|||||||
|
/**
|
||||||
|
* @description 水面
|
||||||
|
*/
|
||||||
|
import Dialog from '../../../Obj/Element/Dialog';
|
||||||
|
import { html } from "./_element";
|
||||||
|
import EventBinding from '../../../Obj/Element/Dialog/eventBinding';
|
||||||
|
import { syncData } from '../../MultiViewportMode'
|
||||||
|
import Tools from '../../../Tools'
|
||||||
|
import TimeLine from './TimeLine'
|
||||||
|
import { setSplitDirection, syncSplitData, setActiveId } from '../../SplitScreen'
|
||||||
|
|
||||||
|
export default class Sunshine {
|
||||||
|
/**
|
||||||
|
* @constructor
|
||||||
|
* @param sdk
|
||||||
|
* @description 光照
|
||||||
|
* @param options {object} 光照属性
|
||||||
|
* @param options.time=当前时间 {string} 当前时间
|
||||||
|
* @param options.speed=1000 {number} 速度倍速
|
||||||
|
* @param options.darkness=0.3 {number} 阴影不透明度--越大越不透明
|
||||||
|
* @param options.softShadow=false {boolean} 阴影优化--true/false}
|
||||||
|
* @param Dialog {object} 弹框对象
|
||||||
|
* @param Dialog.confirmCallBack {function} 弹框确认时的回调
|
||||||
|
* */
|
||||||
|
constructor(sdk, options = {}, _Dialog = {}) {
|
||||||
|
this.viewer = sdk.viewer
|
||||||
|
this.options = { ...options }
|
||||||
|
this.sdk = { ...sdk }
|
||||||
|
this.options.time = options.time || new Date()
|
||||||
|
this.options.speed = options.speed || 1000
|
||||||
|
this.options.darkness = options.darkness || 0.4
|
||||||
|
this.options.softShadow = options.softShadow || true
|
||||||
|
this.options.show = options.show === true ? true : false
|
||||||
|
this.Dialog = _Dialog
|
||||||
|
this.timeLine
|
||||||
|
this._EventBinding = new EventBinding()
|
||||||
|
this._elms = {};
|
||||||
|
Sunshine.start(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static start(that) {
|
||||||
|
that.viewer.scene.globe.enableLighting = true
|
||||||
|
that.viewer.shadows = true
|
||||||
|
that.viewer.scene.globe.enableLighting = true;
|
||||||
|
|
||||||
|
that.viewer.terrainShadows = Cesium.ShadowMode.RECEIVE_ONLY
|
||||||
|
that.viewer.shadowMap.darkness = 1.0 - that.options.darkness //阴影透明度--越大越透明
|
||||||
|
|
||||||
|
const now = new Date();
|
||||||
|
now.setHours(0, 0, 0, 0); // 设置为当天0点
|
||||||
|
that.viewer.clock.currentTime = Cesium.JulianDate.fromDate(now);
|
||||||
|
that.viewer.clock.multiplier = that.options.speed;
|
||||||
|
that.viewer.shadowMap.softShadows = that.options.softShadow;
|
||||||
|
that.viewer.shadowMap.cascadesEnabled = true
|
||||||
|
that.viewer.shadowMap.size = 2048;
|
||||||
|
that.viewer.shadowMap.numberOfCascades = 4; // 增加级联层数(默认3层)
|
||||||
|
that.viewer.shadowMap.maximumDistance = 5000; // 扩大阴影渲染距离
|
||||||
|
const lightCamera = that.viewer.shadowMap._lightCamera;
|
||||||
|
lightCamera.frustum.near = 0.1; // 缩小近平面距离
|
||||||
|
lightCamera.frustum.far = 10000; // 扩大远平面距离
|
||||||
|
that.viewer.shadowMap.normalOffset = true; // 避免深度冲突导致的阴影闪烁
|
||||||
|
|
||||||
|
that.edit(true)
|
||||||
|
}
|
||||||
|
get darkness() {
|
||||||
|
return this.options.darkness
|
||||||
|
}
|
||||||
|
set darkness(v) {
|
||||||
|
this.options.darkness = v
|
||||||
|
this.viewer.shadowMap.darkness = 1.0 - this.options.darkness
|
||||||
|
this._elms.darkness &&
|
||||||
|
this._elms.darkness.forEach(item => {
|
||||||
|
item.value = v
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
get speed() {
|
||||||
|
return this.options.speed
|
||||||
|
}
|
||||||
|
set speed(v) {
|
||||||
|
this.options.speed = v
|
||||||
|
this.viewer.clock.multiplier = this.options.speed;
|
||||||
|
this.timeLine.setSpeed(v)
|
||||||
|
}
|
||||||
|
get softShadow() {
|
||||||
|
return this.options.softShadow
|
||||||
|
}
|
||||||
|
set softShadow(v) {
|
||||||
|
this.options.softShadow = v
|
||||||
|
this.viewer.shadowMap.softShadows = this.options.softShadow;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 编辑框
|
||||||
|
* @param state=false {boolean} 状态: true打开, false关闭
|
||||||
|
*/
|
||||||
|
async edit(state = false) {
|
||||||
|
let tools = new Tools()
|
||||||
|
this.originalOptions = tools.deepCopyObj(this.options)
|
||||||
|
|
||||||
|
// let elms = this.sdk.viewer._container.getElementsByClassName('YJ-custom-base-dialog')
|
||||||
|
// for (let i = elms.length - 1; i >= 0; i--) {
|
||||||
|
// this.sdk.viewer._container.removeChild(elms[i])
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (this._DialogObject && this._DialogObject.close) {
|
||||||
|
this._DialogObject.close()
|
||||||
|
this._DialogObject = null
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state) {
|
||||||
|
let _this = this
|
||||||
|
this._DialogObject = await new Dialog(this.sdk, this.originalOptions, {
|
||||||
|
title: '光照属性', left: '180px', top: '100px',
|
||||||
|
// confirmCallBack: (options) => {
|
||||||
|
// this.originalOptions = tools.deepCopyObj(this.options)
|
||||||
|
// this._DialogObject.close()
|
||||||
|
// this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(this.originalOptions)
|
||||||
|
// syncData(this.sdk, this.options.id)
|
||||||
|
// syncSplitData(this.sdk, this.options.id)
|
||||||
|
// this.remove()
|
||||||
|
// },
|
||||||
|
resetCallBack: () => {
|
||||||
|
this.reset()
|
||||||
|
this.Dialog.resetCallBack && this.Dialog.resetCallBack()
|
||||||
|
},
|
||||||
|
// removeCallBack: () => {
|
||||||
|
// this.Dialog.removeCallBack && this.Dialog.removeCallBack()
|
||||||
|
// },
|
||||||
|
closeCallBack: () => {
|
||||||
|
this.reset()
|
||||||
|
_this.remove()
|
||||||
|
// this.entity.style = new Cesium.Cesium3DTileStyle({
|
||||||
|
// color: "color('rgba(255,255,255," + this.newData.transparency + ")')",
|
||||||
|
// show: true,
|
||||||
|
// });
|
||||||
|
this.Dialog.closeCallBack && this.Dialog.closeCallBack()
|
||||||
|
},
|
||||||
|
showCallBack: (show) => {
|
||||||
|
this.show = show
|
||||||
|
this.Dialog.showCallBack && this.Dialog.showCallBack()
|
||||||
|
}
|
||||||
|
}, true)
|
||||||
|
this._DialogObject._element.body.className = this._DialogObject._element.body.className + ' sun-shine-surface'
|
||||||
|
let contentElm = document.createElement('div');
|
||||||
|
contentElm.innerHTML = html()
|
||||||
|
this._DialogObject.contentAppChild(contentElm)
|
||||||
|
|
||||||
|
//时间轴
|
||||||
|
let _that = this
|
||||||
|
this.timeLine = new TimeLine(this.sdk, this.options.speed)
|
||||||
|
// this.timeLine.setSpeed(1000)
|
||||||
|
this.timeLine.moveComplay(item => {
|
||||||
|
let timeData = _that.time + " " + item
|
||||||
|
_that.viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date(timeData));
|
||||||
|
_that.viewer.scene.requestRender();
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
let jeDateObject
|
||||||
|
let printDateElm = contentElm.getElementsByClassName('sunshine-date')[0]
|
||||||
|
let text
|
||||||
|
|
||||||
|
jeDateObject = jeDate(printDateElm, {
|
||||||
|
format: "YYYY-MM-DD",
|
||||||
|
isinitVal: true,
|
||||||
|
isClear: false,
|
||||||
|
donefun: function (obj) {
|
||||||
|
this.time = obj.val
|
||||||
|
|
||||||
|
const now = new Date();
|
||||||
|
let timeData = now.setHours(0, 0, 0, 0); // 设置为当天0点
|
||||||
|
_that.viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date(timeData));
|
||||||
|
|
||||||
|
_that.timeLine.updateTime(timeData)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (this.time) {
|
||||||
|
jeDateObject.setValue(this.time)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
jeDateObject.nowBtn && jeDateObject.nowBtn()
|
||||||
|
this.time = jeDateObject.getValue()
|
||||||
|
}
|
||||||
|
|
||||||
|
let all_elm = contentElm.getElementsByTagName("*")
|
||||||
|
this._EventBinding.on(this, all_elm)
|
||||||
|
this._elms = this._EventBinding.element
|
||||||
|
this._elms.color = [jeDateObject]
|
||||||
|
} else {
|
||||||
|
// if (this._element_style) {
|
||||||
|
// document.getElementsByTagName('head')[0].removeChild(this._element_style)
|
||||||
|
// this._element_style = null
|
||||||
|
// }
|
||||||
|
// if (this._DialogObject && this._DialogObject.remove) {
|
||||||
|
// this._DialogObject.remove()
|
||||||
|
// this._DialogObject = null
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
reset() {
|
||||||
|
if (!this.viewer.entities.getById(this.options.id)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.time = this.originalOptions.time
|
||||||
|
this.speed = this.originalOptions.speed
|
||||||
|
this.darkness = this.originalOptions.darkness
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 飞到对应实体
|
||||||
|
*/
|
||||||
|
async flyTo(options = {}) {
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
async remove() {
|
||||||
|
|
||||||
|
this.viewer.scene.globe.enableLighting = false
|
||||||
|
this.viewer.shadows = false
|
||||||
|
this.viewer.clock.multiplier = 1.0
|
||||||
|
this.viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date());
|
||||||
|
this.entity = null
|
||||||
|
this.timeLine.clear()
|
||||||
|
|
||||||
|
this.viewer.shadowMap.cascadesEnabled = false
|
||||||
|
this.viewer.shadowMap.size = 1024;
|
||||||
|
this.viewer.shadowMap.numberOfCascades = 3; // 增加级联层数(默认3层)
|
||||||
|
const lightCamera = this.viewer.shadowMap._lightCamera;
|
||||||
|
this.viewer.shadowMap.normalOffset = false; // 避免深度冲突导致的阴影闪烁
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
flicker() { }
|
||||||
|
}
|
||||||
|
|
||||||
172
src/Global/efflect/Sunshine/timeLIne.js
Normal file
172
src/Global/efflect/Sunshine/timeLIne.js
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
export default class TimeLine {
|
||||||
|
constructor(sdk, speed) {
|
||||||
|
this.sdk = { ...sdk };
|
||||||
|
this.progress = document.getElementById('progress');
|
||||||
|
this.handle = document.getElementById('handle');
|
||||||
|
// this.timeline = document.getElementById('timeline');
|
||||||
|
this.timeline = document.getElementsByClassName('timeline-container')[0];
|
||||||
|
this.currentTime = document.getElementById('currentTime');
|
||||||
|
this.timelineCon = document.getElementsByClassName('timeline-container')[0];
|
||||||
|
this.speed = speed;
|
||||||
|
this.animationId;
|
||||||
|
this.startTime = Date.now();
|
||||||
|
this.manualPosition = null;
|
||||||
|
this.isDragging = false;
|
||||||
|
this.pauseed = false;
|
||||||
|
this.time = '';
|
||||||
|
this.update = this.update.bind(this);
|
||||||
|
|
||||||
|
TimeLine.init(this)
|
||||||
|
}
|
||||||
|
static init(that) {
|
||||||
|
for (let i = 0; i <= 24; i++) {
|
||||||
|
if (i % 6 === 0) {
|
||||||
|
const label = document.createElement('div');
|
||||||
|
label.className = 'time-mark';
|
||||||
|
label.textContent = `${i}:00`;
|
||||||
|
label.style.left = `${(i / 24) * 100}%`;
|
||||||
|
document.getElementsByClassName('time-marks')[0].appendChild(label)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
that.startTime = Date.now() - ((that.manualPosition || 0) * 86400 * 1000 / that.speed);
|
||||||
|
|
||||||
|
that.timeline.addEventListener('mousedown', (e) => {
|
||||||
|
if (e.srcElement.className === 'handle') {
|
||||||
|
that.isDragging = true;
|
||||||
|
}
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
|
that.timeline.addEventListener('mousemove', (e) => {
|
||||||
|
if (!that.isDragging) return;
|
||||||
|
|
||||||
|
const rect = that.timeline.getBoundingClientRect();
|
||||||
|
let pos = (e.clientX - rect.left) / rect.width;
|
||||||
|
pos = Math.max(0, Math.min(1, pos));
|
||||||
|
|
||||||
|
that.manualPosition = pos;
|
||||||
|
that.progress.style.width = `${pos * 100}%`;
|
||||||
|
|
||||||
|
const seconds = pos * 86400;
|
||||||
|
that.currentTime.textContent = that.formatTime(seconds);
|
||||||
|
});
|
||||||
|
that.update();
|
||||||
|
|
||||||
|
document.getElementById('timePause').addEventListener('click', function () {
|
||||||
|
that.pauseed = !that.pauseed;
|
||||||
|
if (that.pauseed) {//暂停
|
||||||
|
document.getElementById('timePause').textContent = '播放';
|
||||||
|
that.animationId && cancelAnimationFrame(that.animationId);
|
||||||
|
that.pausedTime = Date.now(); // 记录暂停时刻
|
||||||
|
that.sdk.viewer.clock.shouldAnimate = false
|
||||||
|
} else {//播放
|
||||||
|
document.getElementById('timePause').textContent = '暂停';
|
||||||
|
that.manualPosition = null
|
||||||
|
const pausedDuration = Date.now() - that.pausedTime;
|
||||||
|
that.startTime += pausedDuration; // 补偿暂停期间的时间差
|
||||||
|
|
||||||
|
if (that.changeDate) {//切换日期后让时间从0开始
|
||||||
|
if (that.changeDateGrag) {
|
||||||
|
that.changeDateGrag = undefined
|
||||||
|
} else {
|
||||||
|
that.startTime = Date.now()
|
||||||
|
}
|
||||||
|
that.changeDate = undefined
|
||||||
|
}
|
||||||
|
that.sdk.viewer.clock.shouldAnimate = true
|
||||||
|
that.update(); // 重启动画循环
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
moveComplay(func) {
|
||||||
|
let that = this
|
||||||
|
// that.timeline.addEventListener('mouseup', () => {
|
||||||
|
document.addEventListener('mouseup', () => {
|
||||||
|
if (that.isDragging) {
|
||||||
|
that.isDragging = false;
|
||||||
|
if (that.manualPosition !== null) {
|
||||||
|
// that.sdk.viewer.clock.shouldAnimate = true
|
||||||
|
that.startTime = Date.now() - (that.manualPosition * 86400 * 1000 / that.speed);
|
||||||
|
that.manualPosition = null;
|
||||||
|
that.changeDate && (that.changeDateGrag = true)
|
||||||
|
if (!that.pauseed) {
|
||||||
|
that.update()
|
||||||
|
func(that.time)
|
||||||
|
} else {
|
||||||
|
that.pausedTime = Date.now(); // 记录暂停时刻
|
||||||
|
func(that.currentTime.textContent)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
formatTime(seconds) {
|
||||||
|
const hrs = Math.floor(seconds / 3600).toString().padStart(2, '0');
|
||||||
|
const mins = Math.floor((seconds % 3600) / 60).toString().padStart(2, '0');
|
||||||
|
const secs = Math.floor(seconds % 60).toString().padStart(2, '0');
|
||||||
|
return `${hrs}:${mins}:${secs}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
update() {
|
||||||
|
if (this.manualPosition !== null) return;
|
||||||
|
if (this.changeDate) {//切换日期后让时间从0开始
|
||||||
|
this.startTime = Date.now()
|
||||||
|
}
|
||||||
|
let elapsed = (Date.now() - this.startTime) * this.speed;
|
||||||
|
// if (this.elapsed) {
|
||||||
|
// elapsed = elapsed + this.elapsed
|
||||||
|
// this.elapsed = undefined
|
||||||
|
// }
|
||||||
|
const totalSeconds = elapsed / 1000;//秒
|
||||||
|
const daySeconds = totalSeconds % 86400;//天
|
||||||
|
const percentage = daySeconds / 86400;
|
||||||
|
|
||||||
|
this.progress.style.width = `${percentage * 100}%`;
|
||||||
|
this.time = this.formatTime(daySeconds)
|
||||||
|
this.currentTime.textContent = this.time;
|
||||||
|
if (!this.pauseed) {
|
||||||
|
this.animationId && cancelAnimationFrame(this.animationId);
|
||||||
|
this.animationId = requestAnimationFrame(this.update);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setSpeed(v) {
|
||||||
|
if (!this.pauseed) {
|
||||||
|
const currentProgress = this.manualPosition ??
|
||||||
|
(Date.now() - this.startTime) * this.speed / (86400 * 1000);
|
||||||
|
this.speed = v;
|
||||||
|
this.startTime = Date.now() - (currentProgress * 86400 * 1000 / this.speed);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
let pausedDuration = Date.now() - this.pausedTime;
|
||||||
|
this.startTime += pausedDuration; // 补偿暂停期间的时间差
|
||||||
|
|
||||||
|
const currentProgress = this.manualPosition ??
|
||||||
|
(Date.now() - this.startTime) * this.speed / (86400 * 1000);
|
||||||
|
this.speed = v;
|
||||||
|
this.startTime = Date.now() - (currentProgress * 86400 * 1000 / this.speed);
|
||||||
|
|
||||||
|
this.pausedTime = Date.now(); // 记录切换speed暂停时刻
|
||||||
|
this.speed = v;
|
||||||
|
}
|
||||||
|
this.manualPosition = null;
|
||||||
|
|
||||||
|
// this.update();
|
||||||
|
|
||||||
|
}
|
||||||
|
updateTime() {
|
||||||
|
this.manualPosition = null;
|
||||||
|
this.startTime = Date.now() - ((this.manualPosition || 0) * 86400 * 1000 / this.speed);
|
||||||
|
this.pauseed && (this.changeDate = true)
|
||||||
|
this.changeDateGrag = undefined
|
||||||
|
this.update();
|
||||||
|
}
|
||||||
|
clear() {
|
||||||
|
this.animationId && cancelAnimationFrame(this.animationId);
|
||||||
|
this.progress.style.width = '0%';
|
||||||
|
this.currentTime.textContent = '00:00:00';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -14,6 +14,7 @@ import { getTheme, setTheme } from "../Obj/Element/theme";
|
|||||||
import { setActiveViewer as setMultiViewportActiveViewer } from './MultiViewportMode'
|
import { setActiveViewer as setMultiViewportActiveViewer } from './MultiViewportMode'
|
||||||
import { setActiveViewer as setSplitActiveViewer, getSdk } from './SplitScreen'
|
import { setActiveViewer as setSplitActiveViewer, getSdk } from './SplitScreen'
|
||||||
import { updateCluster } from './cluster/cluster'
|
import { updateCluster } from './cluster/cluster'
|
||||||
|
import { getHost } from "../on";
|
||||||
|
|
||||||
let coordinateSystem = 'EPSG:4326'
|
let coordinateSystem = 'EPSG:4326'
|
||||||
let _cartesian
|
let _cartesian
|
||||||
@ -110,7 +111,7 @@ function CesiumContainer(sdk, options) {
|
|||||||
}
|
}
|
||||||
containerObject[sdk.viewer._element.className] || (containerObject[sdk.viewer._element.className] = {})
|
containerObject[sdk.viewer._element.className] || (containerObject[sdk.viewer._element.className] = {})
|
||||||
containerObject[sdk.viewer._element.className].event && containerObject[sdk.viewer._element.className].event.destroy()
|
containerObject[sdk.viewer._element.className].event && containerObject[sdk.viewer._element.className].event.destroy()
|
||||||
let tools = new Tools()
|
let tools = new Tools(sdk)
|
||||||
let element = sdk.viewer._element
|
let element = sdk.viewer._element
|
||||||
let proj = sdk.proj
|
let proj = sdk.proj
|
||||||
for (let key in options) {
|
for (let key in options) {
|
||||||
@ -173,15 +174,28 @@ function CesiumContainer(sdk, options) {
|
|||||||
}
|
}
|
||||||
let event = new MouseEvent(sdk)
|
let event = new MouseEvent(sdk)
|
||||||
containerObject[sdk.viewer._element.className].event = event
|
containerObject[sdk.viewer._element.className].event = event
|
||||||
|
let lastPickTime = 0;
|
||||||
|
let timeoutEvent
|
||||||
event.mouse_move((movement, cartesian) => {
|
event.mouse_move((movement, cartesian) => {
|
||||||
_cartesian = cartesian
|
_cartesian = cartesian
|
||||||
|
// const now = Date.now();
|
||||||
|
// if (now - lastPickTime < 500) {
|
||||||
|
// clearTimeout(timeoutEvent)
|
||||||
|
// timeoutEvent = setTimeout(() => {
|
||||||
|
// update()
|
||||||
|
// }, 500);
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// lastPickTime = now;
|
||||||
update()
|
update()
|
||||||
})
|
})
|
||||||
function update() {
|
async function update() {
|
||||||
if (!_cartesian) {
|
if (!_cartesian) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// let pos = sdk.viewer.scene.clampToHeight(_cartesian)
|
||||||
let position = tools.cartesian3Towgs84(_cartesian, sdk.viewer)
|
let position = tools.cartesian3Towgs84(_cartesian, sdk.viewer)
|
||||||
|
// position.alt = height
|
||||||
if (coordinateSystem === 'EPSG:4326') {
|
if (coordinateSystem === 'EPSG:4326') {
|
||||||
infoElm.innerHTML = `
|
infoElm.innerHTML = `
|
||||||
<span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span>
|
<span>经度:</span><span>${Number(position.lng.toFixed(6))}° </span>
|
||||||
@ -244,6 +258,16 @@ function setBillboardDefaultUrl(url, name) {
|
|||||||
else {
|
else {
|
||||||
name = 'billboard_default_url'
|
name = 'billboard_default_url'
|
||||||
}
|
}
|
||||||
|
let host = getHost()
|
||||||
|
if (!url.startsWith("http")) {
|
||||||
|
//说明是本地的json,在磁盘中存在的
|
||||||
|
if (!url.includes(":")) {
|
||||||
|
if (host) {
|
||||||
|
let o = new URL(url, host)
|
||||||
|
url = o.href
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
localStorage.setItem(name, url);
|
localStorage.setItem(name, url);
|
||||||
}
|
}
|
||||||
/*获取广告牌默认图标*/
|
/*获取广告牌默认图标*/
|
||||||
@ -426,12 +450,12 @@ function closeViewFollow(sdk) {
|
|||||||
|
|
||||||
/* 方里网状态开关 */
|
/* 方里网状态开关 */
|
||||||
function FlwStatusSwitch(sdk, status) {
|
function FlwStatusSwitch(sdk, status) {
|
||||||
if(!sdk) {
|
if (!sdk) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let layer
|
let layer
|
||||||
let sdkD = getSdk().sdkD
|
let sdkD = getSdk().sdkD
|
||||||
if(sdkD && sdk !== sdkD) {
|
if (sdkD && sdk !== sdkD) {
|
||||||
FlwStatusSwitch(sdkD, status)
|
FlwStatusSwitch(sdkD, status)
|
||||||
}
|
}
|
||||||
for (let i = 0; i < sdk.viewer.imageryLayers._layers.length; i++) {
|
for (let i = 0; i < sdk.viewer.imageryLayers._layers.length; i++) {
|
||||||
@ -466,12 +490,12 @@ function getFlwStatus(sdk) {
|
|||||||
|
|
||||||
/* 经纬网状态开关 */
|
/* 经纬网状态开关 */
|
||||||
function JwwStatusSwitch(sdk, status) {
|
function JwwStatusSwitch(sdk, status) {
|
||||||
if(!sdk) {
|
if (!sdk) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let layer
|
let layer
|
||||||
let sdkD = getSdk().sdkD
|
let sdkD = getSdk().sdkD
|
||||||
if(sdkD && sdk !== sdkD) {
|
if (sdkD && sdk !== sdkD) {
|
||||||
JwwStatusSwitch(sdkD, status)
|
JwwStatusSwitch(sdkD, status)
|
||||||
}
|
}
|
||||||
for (let i = 0; i < sdk.viewer.imageryLayers._layers.length; i++) {
|
for (let i = 0; i < sdk.viewer.imageryLayers._layers.length; i++) {
|
||||||
|
|||||||
@ -25,15 +25,15 @@ function MouseRightMenu(sdk, status, callBack) {
|
|||||||
if (eventListener[sdk.div_id].click) {
|
if (eventListener[sdk.div_id].click) {
|
||||||
document.removeEventListener('click', eventListener[sdk.div_id].click)
|
document.removeEventListener('click', eventListener[sdk.div_id].click)
|
||||||
}
|
}
|
||||||
if(!eventListener[sdk.div_id].callBack) {
|
if (!eventListener[sdk.div_id].callBack) {
|
||||||
eventListener[sdk.div_id].callBack = callBack
|
eventListener[sdk.div_id].callBack = callBack
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sdk !== sdkD) {
|
if (sdk !== sdkD) {
|
||||||
eventListener[sdk.div_id].mouseRightMenuEvent &&
|
eventListener[sdk.div_id].mouseRightMenuEvent &&
|
||||||
eventListener[sdk.div_id].mouseRightMenuEvent.destroy()
|
eventListener[sdk.div_id].mouseRightMenuEvent.destroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
let menuElm = document.getElementById('custom-menu')
|
let menuElm = document.getElementById('custom-menu')
|
||||||
if (menuElm) {
|
if (menuElm) {
|
||||||
_element.removeChild(menuElm)
|
_element.removeChild(menuElm)
|
||||||
@ -87,7 +87,7 @@ function MouseRightMenu(sdk, status, callBack) {
|
|||||||
}
|
}
|
||||||
let entityId = getEntityId(movement)
|
let entityId = getEntityId(movement)
|
||||||
let targetId
|
let targetId
|
||||||
if(Object.prototype.toString.call(entityId) === '[object Object]') {
|
if (Object.prototype.toString.call(entityId) === '[object Object]') {
|
||||||
targetId = entityId.id
|
targetId = entityId.id
|
||||||
entityId = entityId.parentId
|
entityId = entityId.parentId
|
||||||
}
|
}
|
||||||
@ -123,7 +123,7 @@ function MouseRightMenu(sdk, status, callBack) {
|
|||||||
</ul>
|
</ul>
|
||||||
${addedMenu}
|
${addedMenu}
|
||||||
`
|
`
|
||||||
_element.appendChild(menuElm)
|
_element.appendChild(menuElm)
|
||||||
let left = movement.position.x
|
let left = movement.position.x
|
||||||
let top = movement.position.y
|
let top = movement.position.y
|
||||||
if (
|
if (
|
||||||
@ -141,7 +141,7 @@ function MouseRightMenu(sdk, status, callBack) {
|
|||||||
menuElm.style.left = left + 'px'
|
menuElm.style.left = left + 'px'
|
||||||
menuElm.style.top = top + 'px'
|
menuElm.style.top = top + 'px'
|
||||||
|
|
||||||
menuElm.addEventListener('contextmenu', function(event) {
|
menuElm.addEventListener('contextmenu', function (event) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
})
|
})
|
||||||
let liElms = menuElm.getElementsByTagName('li')
|
let liElms = menuElm.getElementsByTagName('li')
|
||||||
@ -162,7 +162,7 @@ function MouseRightMenu(sdk, status, callBack) {
|
|||||||
// this.rotateAround(position)
|
// this.rotateAround(position)
|
||||||
break
|
break
|
||||||
case '属性':
|
case '属性':
|
||||||
if(targetId) {
|
if (targetId) {
|
||||||
object.id = targetId
|
object.id = targetId
|
||||||
object.parentId = that.options.id
|
object.parentId = that.options.id
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,7 +70,7 @@ import {
|
|||||||
import { MouseCoordinate } from '../Global/MouseCoordinate'
|
import { MouseCoordinate } from '../Global/MouseCoordinate'
|
||||||
import { MouseRightMenu } from '../Global/mouseRightMenu'
|
import { MouseRightMenu } from '../Global/mouseRightMenu'
|
||||||
import { dialog as ContourDialog } from '../Global/Contour'
|
import { dialog as ContourDialog } from '../Global/Contour'
|
||||||
import { on as SplitScreenOn, off as SplitScreenOff, setActiveId as SplitScreenSetActiveId ,getSdk } from '../Global/SplitScreen'
|
import { on as SplitScreenOn, off as SplitScreenOff, setActiveId as SplitScreenSetActiveId, getSdk } from '../Global/SplitScreen'
|
||||||
import LocateCurrent from '../Obj/Base/LocateCurrent'
|
import LocateCurrent from '../Obj/Base/LocateCurrent'
|
||||||
|
|
||||||
import { AnalysisClear, SectionClear } from '../Obj/Analysis/clear'
|
import { AnalysisClear, SectionClear } from '../Obj/Analysis/clear'
|
||||||
@ -157,7 +157,7 @@ import WaterSurface from '../Obj/Base/WaterSurface'
|
|||||||
// import ItineraryMove from '../Obj/Base/ItineraryMove'
|
// import ItineraryMove from '../Obj/Base/ItineraryMove'
|
||||||
import TrajectoryMotion from '../Obj/Base/TrajectoryMotion'
|
import TrajectoryMotion from '../Obj/Base/TrajectoryMotion'
|
||||||
import TrajectoryMotionObject from '../Obj/Base/TrajectoryMotionObject'
|
import TrajectoryMotionObject from '../Obj/Base/TrajectoryMotionObject'
|
||||||
import Road from '../Obj/Base/Road'
|
// import Road from '../Obj/Base/Road'
|
||||||
import Graffiti from '../Obj/Base/Graffiti'
|
import Graffiti from '../Obj/Base/Graffiti'
|
||||||
import GroundImage from '../Obj/Base/GroundImage'
|
import GroundImage from '../Obj/Base/GroundImage'
|
||||||
import GroundSvg from '../Obj/Base/GroundSvg'
|
import GroundSvg from '../Obj/Base/GroundSvg'
|
||||||
@ -183,6 +183,8 @@ import Dialog from '../Obj/Element/Dialog'
|
|||||||
import newAirLine from '../Obj/AirLine/pointRoute.js'
|
import newAirLine from '../Obj/AirLine/pointRoute.js'
|
||||||
import Frustum from '../Obj/AirLine/frustum'
|
import Frustum from '../Obj/AirLine/frustum'
|
||||||
import DrawTakeOff from '../Obj/AirLine/DrawTakeOff'
|
import DrawTakeOff from '../Obj/AirLine/DrawTakeOff'
|
||||||
|
import FlowLine from '../Obj/Base/FlowLine'
|
||||||
|
import Sunshine from '../Global/efflect/Sunshine'
|
||||||
|
|
||||||
const YJEarthismeasuring = Symbol('测量状态')
|
const YJEarthismeasuring = Symbol('测量状态')
|
||||||
const screenRecord = Symbol('录屏对象')
|
const screenRecord = Symbol('录屏对象')
|
||||||
@ -234,7 +236,7 @@ if (!window.YJ) {
|
|||||||
Model2,
|
Model2,
|
||||||
TrajectoryMotion,
|
TrajectoryMotion,
|
||||||
TrajectoryMotionObject,
|
TrajectoryMotionObject,
|
||||||
Road,
|
// Road,
|
||||||
Graffiti,
|
Graffiti,
|
||||||
GroundImage,
|
GroundImage,
|
||||||
GroundSvg,
|
GroundSvg,
|
||||||
@ -253,7 +255,8 @@ if (!window.YJ) {
|
|||||||
newAirLine,
|
newAirLine,
|
||||||
FRUSTUN: Frustum,
|
FRUSTUN: Frustum,
|
||||||
// GenerateRoute
|
// GenerateRoute
|
||||||
Dialog
|
Dialog,
|
||||||
|
FlowLine
|
||||||
},
|
},
|
||||||
YJEarth,
|
YJEarth,
|
||||||
Tools,
|
Tools,
|
||||||
@ -292,7 +295,7 @@ if (!window.YJ) {
|
|||||||
cease: FlyRoamCease
|
cease: FlyRoamCease
|
||||||
},
|
},
|
||||||
flyTo,
|
flyTo,
|
||||||
efflect: { rain, snow, fog, nightVision, skyStarry, illumination },
|
efflect: { rain, snow, fog, nightVision, skyStarry, illumination, Sunshine },
|
||||||
CameraController,
|
CameraController,
|
||||||
CesiumContainer,
|
CesiumContainer,
|
||||||
setBillboardDefaultUrl,
|
setBillboardDefaultUrl,
|
||||||
@ -301,7 +304,7 @@ if (!window.YJ) {
|
|||||||
on: multiViewportModeOn,
|
on: multiViewportModeOn,
|
||||||
off: multiViewportModeOff,
|
off: multiViewportModeOff,
|
||||||
get2DView,
|
get2DView,
|
||||||
getSdk:getSdk2
|
getSdk: getSdk2
|
||||||
},
|
},
|
||||||
MouseCoordinate,
|
MouseCoordinate,
|
||||||
MouseRightMenu,
|
MouseRightMenu,
|
||||||
|
|||||||
@ -48,7 +48,7 @@ class MeasureDistance extends Measure {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async computeDisByTowPoint(p1, p2) {
|
async computeDisByTowPoint(p1, p2) {
|
||||||
let d = this.computeDistance([p1, p2])
|
let d = this.computeDistance2([p1, p2])
|
||||||
let meters = 10
|
let meters = 10
|
||||||
let createLabel = (distance) => {
|
let createLabel = (distance) => {
|
||||||
if(this._isDestroy) {
|
if(this._isDestroy) {
|
||||||
@ -80,7 +80,7 @@ class MeasureDistance extends Measure {
|
|||||||
let l = arr.length - 1
|
let l = arr.length - 1
|
||||||
arr.forEach((item, index) => {
|
arr.forEach((item, index) => {
|
||||||
if (index !== l) {
|
if (index !== l) {
|
||||||
let d1 = this.computeDistance([item.position, arr[index + 1].position])
|
let d1 = this.computeDistance2([item.position, arr[index + 1].position])
|
||||||
let d2 = Math.abs(item.position.alt - arr[index + 1].position.alt)
|
let d2 = Math.abs(item.position.alt - arr[index + 1].position.alt)
|
||||||
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
||||||
total_length += d3
|
total_length += d3
|
||||||
@ -131,7 +131,7 @@ class MeasureDistance extends Measure {
|
|||||||
let l = this.clampPositions.length - 1
|
let l = this.clampPositions.length - 1
|
||||||
this.clampPositions.forEach((item, index) => {
|
this.clampPositions.forEach((item, index) => {
|
||||||
if (index !== l) {
|
if (index !== l) {
|
||||||
let d1 = this.computeDistance([item.position, this.clampPositions[index + 1].position])
|
let d1 = this.computeDistance2([item.position, this.clampPositions[index + 1].position])
|
||||||
let d2 = Math.abs(item.position.alt - this.clampPositions[index + 1].position.alt)
|
let d2 = Math.abs(item.position.alt - this.clampPositions[index + 1].position.alt)
|
||||||
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
||||||
total_length += d3
|
total_length += d3
|
||||||
@ -270,7 +270,7 @@ class MeasureDistance extends Measure {
|
|||||||
// if (this.cachePositions.length) {
|
// if (this.cachePositions.length) {
|
||||||
// let cur_point = this.cartesian3Towgs84(car, this.viewer)
|
// let cur_point = this.cartesian3Towgs84(car, this.viewer)
|
||||||
// let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
|
// let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
|
||||||
// let cur_len = this.computeDistance([cur_point, pre_p])
|
// let cur_len = this.computeDistance2([cur_point, pre_p])
|
||||||
// let text = "当前投影距离:" + cur_len + " 米"
|
// let text = "当前投影距离:" + cur_len + " 米"
|
||||||
// // this.tip.set_text(text)
|
// // this.tip.set_text(text)
|
||||||
// }
|
// }
|
||||||
|
|||||||
@ -47,7 +47,7 @@ class MeasureDistance extends Measure {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async computeDisByTowPoint(p1, p2) {
|
async computeDisByTowPoint(p1, p2) {
|
||||||
let d = this.computeDistance([p1, p2])
|
let d = this.computeDistance2([p1, p2])
|
||||||
let meters = 10
|
let meters = 10
|
||||||
let createLabel = (distance) => {
|
let createLabel = (distance) => {
|
||||||
let label = this.getLabel("贴地距离:" + distance.toFixed(2) + "米")
|
let label = this.getLabel("贴地距离:" + distance.toFixed(2) + "米")
|
||||||
@ -84,7 +84,7 @@ class MeasureDistance extends Measure {
|
|||||||
let l = arr.length - 1
|
let l = arr.length - 1
|
||||||
arr.forEach((item, index) => {
|
arr.forEach((item, index) => {
|
||||||
if (index !== l) {
|
if (index !== l) {
|
||||||
let d1 = this.computeDistance([item.position, arr[index + 1].position])
|
let d1 = this.computeDistance2([item.position, arr[index + 1].position])
|
||||||
let d2 = Math.abs(item.position.alt - arr[index + 1].position.alt)
|
let d2 = Math.abs(item.position.alt - arr[index + 1].position.alt)
|
||||||
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
||||||
total_length += d3
|
total_length += d3
|
||||||
@ -135,7 +135,7 @@ class MeasureDistance extends Measure {
|
|||||||
let l = this.clampPositions.length - 1
|
let l = this.clampPositions.length - 1
|
||||||
this.clampPositions.forEach((item, index) => {
|
this.clampPositions.forEach((item, index) => {
|
||||||
if (index !== l) {
|
if (index !== l) {
|
||||||
let d1 = this.computeDistance([item.position, this.clampPositions[index + 1].position])
|
let d1 = this.computeDistance2([item.position, this.clampPositions[index + 1].position])
|
||||||
let d2 = Math.abs(item.position.alt - this.clampPositions[index + 1].position.alt)
|
let d2 = Math.abs(item.position.alt - this.clampPositions[index + 1].position.alt)
|
||||||
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
||||||
total_length += d3
|
total_length += d3
|
||||||
@ -231,7 +231,7 @@ class MeasureDistance extends Measure {
|
|||||||
if (this.ids.length !== 0) {
|
if (this.ids.length !== 0) {
|
||||||
let cur_point = this.cartesian3Towgs84(car, this.viewer)
|
let cur_point = this.cartesian3Towgs84(car, this.viewer)
|
||||||
let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
|
let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
|
||||||
let cur_len = this.computeDistance([cur_point, pre_p])
|
let cur_len = this.computeDistance2([cur_point, pre_p])
|
||||||
let text = "投影距离:" + cur_len + " 米"
|
let text = "投影距离:" + cur_len + " 米"
|
||||||
this.ids.push(MeasureDistance.create_point(car, {label: this.getLabel(text)}, this))
|
this.ids.push(MeasureDistance.create_point(car, {label: this.getLabel(text)}, this))
|
||||||
this.cachePositions.push(car)
|
this.cachePositions.push(car)
|
||||||
@ -250,7 +250,7 @@ class MeasureDistance extends Measure {
|
|||||||
if (this.cachePositions.length) {
|
if (this.cachePositions.length) {
|
||||||
let cur_point = this.cartesian3Towgs84(car, this.viewer)
|
let cur_point = this.cartesian3Towgs84(car, this.viewer)
|
||||||
let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
|
let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
|
||||||
let cur_len = this.computeDistance([cur_point, pre_p])
|
let cur_len = this.computeDistance2([cur_point, pre_p])
|
||||||
let text = "当前投影距离:" + cur_len + " 米"
|
let text = "当前投影距离:" + cur_len + " 米"
|
||||||
this.tip.set_text(text)
|
this.tip.set_text(text)
|
||||||
}
|
}
|
||||||
@ -280,7 +280,7 @@ class MeasureDistance extends Measure {
|
|||||||
}
|
}
|
||||||
|
|
||||||
computeAngle(start, end) {
|
computeAngle(start, end) {
|
||||||
let d1 = this.computeDistance([start, end])
|
let d1 = this.computeDistance2([start, end])
|
||||||
let d2 = Math.abs(start.alt - end.alt)
|
let d2 = Math.abs(start.alt - end.alt)
|
||||||
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
||||||
let cosAlpha = d1 / d3
|
let cosAlpha = d1 / d3
|
||||||
|
|||||||
@ -128,7 +128,7 @@ class MeasureHeight extends Measure {
|
|||||||
this.positions[1] = Cesium.Cartesian3.fromDegrees(this.firstpoint.lng, this.firstpoint.lat, cur_point.alt)
|
this.positions[1] = Cesium.Cartesian3.fromDegrees(this.firstpoint.lng, this.firstpoint.lat, cur_point.alt)
|
||||||
this.positions[2] = cartesian
|
this.positions[2] = cartesian
|
||||||
this.position = this.positions[1]
|
this.position = this.positions[1]
|
||||||
this.circleRadius = this.computeDistance([this.firstpoint, cur_point])
|
this.circleRadius = this.computeDistance2([this.firstpoint, cur_point])
|
||||||
this.height = Number((cur_point.alt - this.firstpoint.alt).toFixed(2))
|
this.height = Number((cur_point.alt - this.firstpoint.alt).toFixed(2))
|
||||||
this.text = "相对高度:" + this.height + " 米"
|
this.text = "相对高度:" + this.height + " 米"
|
||||||
this.tip.set_text("左键完成,右键取消;半径:" + this.circleRadius + " 米")
|
this.tip.set_text("左键完成,右键取消;半径:" + this.circleRadius + " 米")
|
||||||
@ -145,7 +145,7 @@ class MeasureHeight extends Measure {
|
|||||||
this.positions[1] = Cesium.Cartesian3.fromDegrees(this.firstpoint.lng, this.firstpoint.lat, cur_point.alt)
|
this.positions[1] = Cesium.Cartesian3.fromDegrees(this.firstpoint.lng, this.firstpoint.lat, cur_point.alt)
|
||||||
this.positions[2] = cartesian
|
this.positions[2] = cartesian
|
||||||
this.position = this.positions[1]
|
this.position = this.positions[1]
|
||||||
this.circleRadius = this.computeDistance([this.firstpoint, cur_point])
|
this.circleRadius = this.computeDistance2([this.firstpoint, cur_point])
|
||||||
this.height = Number((cur_point.alt - this.firstpoint.alt).toFixed(2))
|
this.height = Number((cur_point.alt - this.firstpoint.alt).toFixed(2))
|
||||||
this.text = "相对高度:" + this.height + " 米"
|
this.text = "相对高度:" + this.height + " 米"
|
||||||
this.tip.set_text("左键完成,右键取消;半径:" + this.circleRadius + " 米")
|
this.tip.set_text("左键完成,右键取消;半径:" + this.circleRadius + " 米")
|
||||||
|
|||||||
@ -73,7 +73,7 @@ class MeasureProjectionDistance extends Measure {
|
|||||||
let l = this.clampPositions.length - 1
|
let l = this.clampPositions.length - 1
|
||||||
this.clampPositions.forEach((item, index) => {
|
this.clampPositions.forEach((item, index) => {
|
||||||
if (index !== l) {
|
if (index !== l) {
|
||||||
let d1 = this.computeDistance([item.position, this.clampPositions[index + 1].position])
|
let d1 = this.computeDistance2([item.position, this.clampPositions[index + 1].position])
|
||||||
let d2 = Math.abs(item.position.alt - this.clampPositions[index + 1].position.alt)
|
let d2 = Math.abs(item.position.alt - this.clampPositions[index + 1].position.alt)
|
||||||
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
||||||
total_length += d3
|
total_length += d3
|
||||||
@ -174,7 +174,7 @@ class MeasureProjectionDistance extends Measure {
|
|||||||
if (this.ids.length !== 0) {
|
if (this.ids.length !== 0) {
|
||||||
let cur_point = this.cartesian3Towgs84(car, this.viewer)
|
let cur_point = this.cartesian3Towgs84(car, this.viewer)
|
||||||
let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
|
let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
|
||||||
let cur_len = this.computeDistance([cur_point, pre_p])
|
let cur_len = this.computeDistance2([cur_point, pre_p])
|
||||||
let text = "投影距离:" + cur_len + " 米"
|
let text = "投影距离:" + cur_len + " 米"
|
||||||
this.ids.push(MeasureProjectionDistance.create_point(car, {label: this.getLabel(text)}, this))
|
this.ids.push(MeasureProjectionDistance.create_point(car, {label: this.getLabel(text)}, this))
|
||||||
this.cachePositions.push(car)
|
this.cachePositions.push(car)
|
||||||
@ -215,7 +215,7 @@ class MeasureProjectionDistance extends Measure {
|
|||||||
if (this.cachePositions.length) {
|
if (this.cachePositions.length) {
|
||||||
let cur_point = this.cartesian3Towgs84(car, this.viewer)
|
let cur_point = this.cartesian3Towgs84(car, this.viewer)
|
||||||
let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
|
let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
|
||||||
let cur_len = this.computeDistance([cur_point, pre_p])
|
let cur_len = this.computeDistance2([cur_point, pre_p])
|
||||||
let text = "当前投影距离:" + cur_len + " 米"
|
let text = "当前投影距离:" + cur_len + " 米"
|
||||||
this.tip.set_text(text)
|
this.tip.set_text(text)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,7 +75,7 @@ class MeasureSlopeDistance extends Measure {
|
|||||||
let l = this.clampPositions.length - 1
|
let l = this.clampPositions.length - 1
|
||||||
this.clampPositions.forEach((item, index) => {
|
this.clampPositions.forEach((item, index) => {
|
||||||
if (index !== l) {
|
if (index !== l) {
|
||||||
let d1 = this.computeDistance([item.position, this.clampPositions[index + 1].position])
|
let d1 = this.computeDistance2([item.position, this.clampPositions[index + 1].position])
|
||||||
let d2 = Math.abs(item.position.alt - this.clampPositions[index + 1].position.alt)
|
let d2 = Math.abs(item.position.alt - this.clampPositions[index + 1].position.alt)
|
||||||
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
||||||
total_length += d3
|
total_length += d3
|
||||||
@ -235,7 +235,7 @@ class MeasureSlopeDistance extends Measure {
|
|||||||
if (this.cachePositions.length) {
|
if (this.cachePositions.length) {
|
||||||
let cur_point = this.cartesian3Towgs84(cartesian, this.viewer)
|
let cur_point = this.cartesian3Towgs84(cartesian, this.viewer)
|
||||||
let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
|
let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
|
||||||
let d1 = this.computeDistance([pre_p, cur_point])
|
let d1 = this.computeDistance2([pre_p, cur_point])
|
||||||
let d2 = Math.abs(pre_p.alt - cur_point.alt)
|
let d2 = Math.abs(pre_p.alt - cur_point.alt)
|
||||||
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
||||||
let cosAlpha = d1 / d3
|
let cosAlpha = d1 / d3
|
||||||
@ -276,7 +276,7 @@ class MeasureSlopeDistance extends Measure {
|
|||||||
}
|
}
|
||||||
|
|
||||||
computeAngle(start, end) {
|
computeAngle(start, end) {
|
||||||
let d1 = this.computeDistance([start, end])
|
let d1 = this.computeDistance2([start, end])
|
||||||
let d2 = Math.abs(start.alt - end.alt)
|
let d2 = Math.abs(start.alt - end.alt)
|
||||||
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
||||||
let cosAlpha = d1 / d3
|
let cosAlpha = d1 / d3
|
||||||
|
|||||||
@ -27,7 +27,7 @@ class MeasureTriangle extends Measure {
|
|||||||
cal_distance(positions) {
|
cal_distance(positions) {
|
||||||
let p1 = this.cartesian3Towgs84(positions[0], this.viewer)
|
let p1 = this.cartesian3Towgs84(positions[0], this.viewer)
|
||||||
let p2 = this.cartesian3Towgs84(positions[1], this.viewer)
|
let p2 = this.cartesian3Towgs84(positions[1], this.viewer)
|
||||||
let dis = this.computeDistance([p1, p2])
|
let dis = this.computeDistance2([p1, p2])
|
||||||
p1.alt = p1.alt.toFixed(2)
|
p1.alt = p1.alt.toFixed(2)
|
||||||
p2.alt = p2.alt.toFixed(2)
|
p2.alt = p2.alt.toFixed(2)
|
||||||
if (p1.alt === p2.alt) {//水平边
|
if (p1.alt === p2.alt) {//水平边
|
||||||
@ -128,10 +128,10 @@ class MeasureTriangle extends Measure {
|
|||||||
let positions2 = this.id_map.get(id2).positions
|
let positions2 = this.id_map.get(id2).positions
|
||||||
let p1 = this.cartesian3Towgs84(positions1[0], this.viewer)
|
let p1 = this.cartesian3Towgs84(positions1[0], this.viewer)
|
||||||
let p2 = this.cartesian3Towgs84(positions1[1], this.viewer)
|
let p2 = this.cartesian3Towgs84(positions1[1], this.viewer)
|
||||||
let shuiping = this.computeDistance([p2, p1])
|
let shuiping = this.computeDistance2([p2, p1])
|
||||||
let p3 = this.cartesian3Towgs84(positions2[0], this.viewer)
|
let p3 = this.cartesian3Towgs84(positions2[0], this.viewer)
|
||||||
let p4 = this.cartesian3Towgs84(positions2[1], this.viewer)
|
let p4 = this.cartesian3Towgs84(positions2[1], this.viewer)
|
||||||
let d = this.computeDistance([p3, p4])
|
let d = this.computeDistance2([p3, p4])
|
||||||
let h = Math.abs(p3.alt - p4.alt)
|
let h = Math.abs(p3.alt - p4.alt)
|
||||||
let x = Math.sqrt(Math.pow(h, 2) + Math.pow(d, 2))
|
let x = Math.sqrt(Math.pow(h, 2) + Math.pow(d, 2))
|
||||||
if (shuiping == 0.00) {
|
if (shuiping == 0.00) {
|
||||||
|
|||||||
@ -47,6 +47,11 @@ class ContourAnalysis {
|
|||||||
YJ.Analysis.AnalysesResults.push(this)
|
YJ.Analysis.AnalysesResults.push(this)
|
||||||
this.createNewLine();
|
this.createNewLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get type() {
|
||||||
|
return 'ContourAnalysis'
|
||||||
|
}
|
||||||
|
|
||||||
createNewLine() {
|
createNewLine() {
|
||||||
ContourAnalysis.interpolatePoint(this);
|
ContourAnalysis.interpolatePoint(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,7 +62,7 @@ class PolygonObject extends Base {
|
|||||||
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
||||||
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
|
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
|
||||||
backgroundColor: options.label.backgroundColor || ['#42c6ef', '#42c6ef'],
|
backgroundColor: options.label.backgroundColor || ['#42c6ef', '#42c6ef'],
|
||||||
lineColor: options.label.lineColor || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
@ -105,7 +105,7 @@ class PolygonObject extends Base {
|
|||||||
this.entity.polygon.material = Cesium.Color.fromCssColorString(v)
|
this.entity.polygon.material = Cesium.Color.fromCssColorString(v)
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -218,7 +218,7 @@ class PolygonObject extends Base {
|
|||||||
this.entity.polyline.material = Cesium.Color.fromCssColorString(v)
|
this.entity.polyline.material = Cesium.Color.fromCssColorString(v)
|
||||||
if (this._elms.lineColor) {
|
if (this._elms.lineColor) {
|
||||||
this._elms.lineColor.forEach((item, i) => {
|
this._elms.lineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -311,7 +311,7 @@ class PolygonObject extends Base {
|
|||||||
this.label.color = v
|
this.label.color = v
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -411,7 +411,7 @@ class PolygonObject extends Base {
|
|||||||
this.label.lineColor = v
|
this.label.lineColor = v
|
||||||
if (this._elms.labelLineColor) {
|
if (this._elms.labelLineColor) {
|
||||||
this._elms.labelLineColor.forEach((item, i) => {
|
this._elms.labelLineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -438,7 +438,7 @@ class PolygonObject extends Base {
|
|||||||
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -464,7 +464,7 @@ class PolygonObject extends Base {
|
|||||||
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1013,7 +1013,7 @@ class PolygonObject extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('polygon-object-edit-tabs', undefined, this.sdk)
|
let tabsElm = new cy_tabs('polygon-object-edit-tabs', undefined, this.sdk)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1027,7 +1027,7 @@ class PolygonObject extends Base {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let linecolorPicker = new ewPlugins('colorpicker', {
|
let linecolorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("lineColor")[0],
|
el: contentElm.getElementsByClassName("lineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1041,7 +1041,7 @@ class PolygonObject extends Base {
|
|||||||
this.lineColor = 'rgba(255,255,255,1)'
|
this.lineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelColor")[0],
|
el: contentElm.getElementsByClassName("labelColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1055,7 +1055,7 @@ class PolygonObject extends Base {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1069,7 +1069,7 @@ class PolygonObject extends Base {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -1083,7 +1083,7 @@ class PolygonObject extends Base {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
|
|||||||
@ -24,7 +24,7 @@ class AssembleObject extends Base {
|
|||||||
* @param options {object} 属性
|
* @param options {object} 属性
|
||||||
* @param options.show=true {boolean} 显示/隐藏
|
* @param options.show=true {boolean} 显示/隐藏
|
||||||
* @param options.name {string} 名称
|
* @param options.name {string} 名称
|
||||||
* @param options.color="#36c4ff" {string} 颜色
|
* @param options.color="#ff000080" {string} 颜色
|
||||||
* @param options.height {number} 高度
|
* @param options.height {number} 高度
|
||||||
* @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式)
|
* @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式)
|
||||||
* @param {Array.<object>} options.positions 坐标数组 [{lon,lat,alt},...]
|
* @param {Array.<object>} options.positions 坐标数组 [{lon,lat,alt},...]
|
||||||
@ -34,13 +34,13 @@ class AssembleObject extends Base {
|
|||||||
constructor(sdk, options = {}, _Dialog = {}) {
|
constructor(sdk, options = {}, _Dialog = {}) {
|
||||||
super(sdk, options);
|
super(sdk, options);
|
||||||
this.options.name = options.name || '未命名对象'
|
this.options.name = options.name || '未命名对象'
|
||||||
this.options.color = options.color || "#36c4ff"
|
this.options.color = options.color || "#ff000080"
|
||||||
this.options.show = (options.show || options.show === false) ? options.show : true
|
this.options.show = (options.show || options.show === false) ? options.show : true
|
||||||
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
|
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
|
||||||
this.options.positions = options.positions || []
|
this.options.positions = options.positions || []
|
||||||
this.options.line = options.line || {}
|
this.options.line = options.line || {}
|
||||||
this.options.line.width = this.options.line.width || 2
|
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(155, 155, 124, 0.89)'
|
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)'
|
||||||
this.options['area-unit'] = options['area-unit'] || '平方米'
|
this.options['area-unit'] = options['area-unit'] || '平方米'
|
||||||
this.entity
|
this.entity
|
||||||
this.event = new MouseEvent(this.sdk)
|
this.event = new MouseEvent(this.sdk)
|
||||||
@ -57,8 +57,8 @@ class AssembleObject extends Base {
|
|||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
||||||
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
|
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 || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
@ -106,31 +106,31 @@ class AssembleObject extends Base {
|
|||||||
return this.options.color
|
return this.options.color
|
||||||
}
|
}
|
||||||
set color(v) {
|
set color(v) {
|
||||||
this.options.color = v
|
this.options.color = v || 'rgba(255, 0, 0, 0.5)'
|
||||||
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) {
|
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let material = Cesium.Color.fromCssColorString(v)
|
let material = Cesium.Color.fromCssColorString(this.options.color)
|
||||||
if (this.sdk.viewer.scene.mode === 2) {
|
if (this.sdk.viewer.scene.mode === 2) {
|
||||||
material = new Cesium.CustomColorMaterialSource({
|
material = new Cesium.CustomColorMaterialSource({
|
||||||
color: v
|
color: this.options.color
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.entity.polygon.material = material
|
this.entity.polygon.material = material
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
defaultColor: v,
|
defaultColor: this.options.color,
|
||||||
disabled: false,//是否禁止打开颜色选择器
|
disabled: false,//是否禁止打开颜色选择器
|
||||||
openPickerAni: 'opacity',//打开颜色选择器动画
|
openPickerAni: 'opacity',//打开颜色选择器动画
|
||||||
sure: (c) => {
|
sure: (c) => {
|
||||||
this.color = c
|
this.color = c
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,0,0,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.color[i] = colorPicker
|
this._elms.color[i] = colorPicker
|
||||||
@ -238,25 +238,25 @@ class AssembleObject extends Base {
|
|||||||
return this.options.line.color
|
return this.options.line.color
|
||||||
}
|
}
|
||||||
set lineColor(v) {
|
set lineColor(v) {
|
||||||
this.options.line.color = v
|
this.options.line.color = v || 'rgba(255, 0, 0, 0.5)'
|
||||||
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) {
|
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.entity.polyline.material = Cesium.Color.fromCssColorString(v)
|
this.entity.polyline.material = Cesium.Color.fromCssColorString(this.options.line.color)
|
||||||
if (this._elms.lineColor) {
|
if (this._elms.lineColor) {
|
||||||
this._elms.lineColor.forEach((item, i) => {
|
this._elms.lineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
defaultColor: v,
|
defaultColor: this.options.line.color,
|
||||||
disabled: false,//是否禁止打开颜色选择器
|
disabled: false,//是否禁止打开颜色选择器
|
||||||
openPickerAni: 'opacity',//打开颜色选择器动画
|
openPickerAni: 'opacity',//打开颜色选择器动画
|
||||||
sure: (c) => {
|
sure: (c) => {
|
||||||
this.lineColor = c
|
this.lineColor = c
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.lineColor = 'rgba(255,255,255,1)'
|
this.lineColor = 'rgba(255,0,0,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.lineColor[i] = lineColorPicker
|
this._elms.lineColor[i] = lineColorPicker
|
||||||
@ -268,10 +268,10 @@ class AssembleObject extends Base {
|
|||||||
return this.options.line.width
|
return this.options.line.width
|
||||||
}
|
}
|
||||||
set lineWidth(v) {
|
set lineWidth(v) {
|
||||||
this.options.line.width = v
|
this.options.line.width = ((v || v === 0) ? v : 3)
|
||||||
this.entity.polyline.width = v
|
this.entity.polyline.width = this.options.line.width
|
||||||
this._elms.lineColor && this._elms.lineColor.forEach((item) => {
|
this._elms.lineColor && this._elms.lineColor.forEach((item) => {
|
||||||
item.value = v
|
item.value = this.options.line.width
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,7 +353,7 @@ class AssembleObject extends Base {
|
|||||||
this.label.color = v
|
this.label.color = v
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -453,7 +453,7 @@ class AssembleObject extends Base {
|
|||||||
this.label.lineColor = v
|
this.label.lineColor = v
|
||||||
if (this._elms.labelLineColor) {
|
if (this._elms.labelLineColor) {
|
||||||
this._elms.labelLineColor.forEach((item, i) => {
|
this._elms.labelLineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -464,7 +464,7 @@ class AssembleObject extends Base {
|
|||||||
this.labelLineColor = color
|
this.labelLineColor = color
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(0,255,255,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.labelLineColor[i] = lineColorPicker
|
this._elms.labelLineColor[i] = lineColorPicker
|
||||||
@ -480,7 +480,7 @@ class AssembleObject extends Base {
|
|||||||
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -506,7 +506,7 @@ class AssembleObject extends Base {
|
|||||||
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1171,7 +1171,7 @@ class AssembleObject extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('assemble-object-edit-tabs', undefined, this.sdk)
|
let tabsElm = new cy_tabs('assemble-object-edit-tabs', undefined, this.sdk)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1185,7 +1185,7 @@ class AssembleObject extends Base {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let linecolorPicker = new ewPlugins('colorpicker', {
|
let linecolorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("lineColor")[0],
|
el: contentElm.getElementsByClassName("lineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1199,7 +1199,7 @@ class AssembleObject extends Base {
|
|||||||
this.lineColor = 'rgba(255,255,255,1)'
|
this.lineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelColor")[0],
|
el: contentElm.getElementsByClassName("labelColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1213,7 +1213,7 @@ class AssembleObject extends Base {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labellineColorPicker = new ewPlugins('colorpicker', {
|
let labellineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1227,7 +1227,7 @@ class AssembleObject extends Base {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -1241,7 +1241,7 @@ class AssembleObject extends Base {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
|
|||||||
@ -24,7 +24,7 @@ class AttackArrowObject extends Base {
|
|||||||
* @param options {object} 属性
|
* @param options {object} 属性
|
||||||
* @param options.show=true {boolean} 显示/隐藏
|
* @param options.show=true {boolean} 显示/隐藏
|
||||||
* @param options.name {string} 名称
|
* @param options.name {string} 名称
|
||||||
* @param options.color="#36c4ff" {string} 颜色
|
* @param options.color="#ff000080" {string} 颜色
|
||||||
* @param options.height {number} 高度
|
* @param options.height {number} 高度
|
||||||
* @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式)
|
* @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式)
|
||||||
* @param {Array.<object>} options.positions 坐标数组 [{lon,lat,alt},...]
|
* @param {Array.<object>} options.positions 坐标数组 [{lon,lat,alt},...]
|
||||||
@ -34,13 +34,13 @@ class AttackArrowObject extends Base {
|
|||||||
constructor(sdk, options = {}, _Dialog = {}) {
|
constructor(sdk, options = {}, _Dialog = {}) {
|
||||||
super(sdk, options);
|
super(sdk, options);
|
||||||
this.options.name = options.name || '未命名对象'
|
this.options.name = options.name || '未命名对象'
|
||||||
this.options.color = options.color || "#36c4ff"
|
this.options.color = options.color || "#ff000080"
|
||||||
this.options.show = (options.show || options.show === false) ? options.show : true
|
this.options.show = (options.show || options.show === false) ? options.show : true
|
||||||
this.options.positions = options.positions || []
|
this.options.positions = options.positions || []
|
||||||
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
|
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
|
||||||
this.options.line = options.line || {}
|
this.options.line = options.line || {}
|
||||||
this.options.line.width = this.options.line.width || 2
|
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(155, 155, 124, 0.89)'
|
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)'
|
||||||
this.options['area-unit'] = options['area-unit'] || '平方米'
|
this.options['area-unit'] = options['area-unit'] || '平方米'
|
||||||
this.entity
|
this.entity
|
||||||
this.event = new MouseEvent(this.sdk)
|
this.event = new MouseEvent(this.sdk)
|
||||||
@ -61,8 +61,8 @@ class AttackArrowObject extends Base {
|
|||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
||||||
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
|
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 || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
@ -110,31 +110,31 @@ class AttackArrowObject extends Base {
|
|||||||
return this.options.color
|
return this.options.color
|
||||||
}
|
}
|
||||||
set color(v) {
|
set color(v) {
|
||||||
this.options.color = v
|
this.options.color = v || 'rgba(255, 0, 0, 0.5)'
|
||||||
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) {
|
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let material = Cesium.Color.fromCssColorString(v)
|
let material = Cesium.Color.fromCssColorString(this.options.color)
|
||||||
if (this.sdk.viewer.scene.mode === 2) {
|
if (this.sdk.viewer.scene.mode === 2) {
|
||||||
material = new Cesium.CustomColorMaterialSource({
|
material = new Cesium.CustomColorMaterialSource({
|
||||||
color: v
|
color: this.options.color
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.entity.polygon.material = material
|
this.entity.polygon.material = material
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
defaultColor: v,
|
defaultColor: this.options.color,
|
||||||
disabled: false,//是否禁止打开颜色选择器
|
disabled: false,//是否禁止打开颜色选择器
|
||||||
openPickerAni: 'opacity',//打开颜色选择器动画
|
openPickerAni: 'opacity',//打开颜色选择器动画
|
||||||
sure: (c) => {
|
sure: (c) => {
|
||||||
this.color = c
|
this.color = c
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,0,0,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.color[i] = colorPicker
|
this._elms.color[i] = colorPicker
|
||||||
@ -243,25 +243,25 @@ class AttackArrowObject extends Base {
|
|||||||
return this.options.line.color
|
return this.options.line.color
|
||||||
}
|
}
|
||||||
set lineColor(v) {
|
set lineColor(v) {
|
||||||
this.options.line.color = v
|
this.options.line.color = v || 'rgba(255, 0, 0, 0.5)'
|
||||||
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) {
|
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.entity.polyline.material = Cesium.Color.fromCssColorString(v)
|
this.entity.polyline.material = Cesium.Color.fromCssColorString(this.options.line.color)
|
||||||
if (this._elms.lineColor) {
|
if (this._elms.lineColor) {
|
||||||
this._elms.lineColor.forEach((item, i) => {
|
this._elms.lineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
defaultColor: v,
|
defaultColor: this.options.line.color,
|
||||||
disabled: false,//是否禁止打开颜色选择器
|
disabled: false,//是否禁止打开颜色选择器
|
||||||
openPickerAni: 'opacity',//打开颜色选择器动画
|
openPickerAni: 'opacity',//打开颜色选择器动画
|
||||||
sure: (c) => {
|
sure: (c) => {
|
||||||
this.lineColor = c
|
this.lineColor = c
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.lineColor = 'rgba(255,255,255,1)'
|
this.lineColor = 'rgba(255,0,0,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.lineColor[i] = lineColorPicker
|
this._elms.lineColor[i] = lineColorPicker
|
||||||
@ -273,8 +273,8 @@ class AttackArrowObject extends Base {
|
|||||||
return this.options.line.width
|
return this.options.line.width
|
||||||
}
|
}
|
||||||
set lineWidth(v) {
|
set lineWidth(v) {
|
||||||
this.options.line.width = v
|
this.options.line.width = ((v || v === 0) ? v : 3)
|
||||||
this.entity.polyline.width = v
|
this.entity.polyline.width = this.options.line.width
|
||||||
this._elms.lineColor && this._elms.lineColor.forEach((item) => {
|
this._elms.lineColor && this._elms.lineColor.forEach((item) => {
|
||||||
item.value = v
|
item.value = v
|
||||||
})
|
})
|
||||||
@ -358,7 +358,7 @@ class AttackArrowObject extends Base {
|
|||||||
this.label.color = v
|
this.label.color = v
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -458,7 +458,7 @@ class AttackArrowObject extends Base {
|
|||||||
this.label.lineColor = v
|
this.label.lineColor = v
|
||||||
if (this._elms.labelLineColor) {
|
if (this._elms.labelLineColor) {
|
||||||
this._elms.labelLineColor.forEach((item, i) => {
|
this._elms.labelLineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -469,7 +469,7 @@ class AttackArrowObject extends Base {
|
|||||||
this.labelLineColor = color
|
this.labelLineColor = color
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(0,255,255,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.labelLineColor[i] = lineColorPicker
|
this._elms.labelLineColor[i] = lineColorPicker
|
||||||
@ -485,7 +485,7 @@ class AttackArrowObject extends Base {
|
|||||||
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -511,7 +511,7 @@ class AttackArrowObject extends Base {
|
|||||||
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1182,7 +1182,7 @@ class AttackArrowObject extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('attack-arrow-object-edit-tabs', undefined, this.sdk)
|
let tabsElm = new cy_tabs('attack-arrow-object-edit-tabs', undefined, this.sdk)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1196,7 +1196,7 @@ class AttackArrowObject extends Base {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let linecolorPicker = new ewPlugins('colorpicker', {
|
let linecolorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("lineColor")[0],
|
el: contentElm.getElementsByClassName("lineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1210,7 +1210,7 @@ class AttackArrowObject extends Base {
|
|||||||
this.lineColor = 'rgba(255,255,255,1)'
|
this.lineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelColor")[0],
|
el: contentElm.getElementsByClassName("labelColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1224,7 +1224,7 @@ class AttackArrowObject extends Base {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labellineColorPicker = new ewPlugins('colorpicker', {
|
let labellineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1238,7 +1238,7 @@ class AttackArrowObject extends Base {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -1252,7 +1252,7 @@ class AttackArrowObject extends Base {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
|
|||||||
@ -33,6 +33,7 @@ class ArcgisLayer extends BaseLayer {
|
|||||||
} else {
|
} else {
|
||||||
this.entity = this.sdk.viewer.imageryLayers.addImageryProvider(imageryProvider,)
|
this.entity = this.sdk.viewer.imageryLayers.addImageryProvider(imageryProvider,)
|
||||||
}
|
}
|
||||||
|
this.entity._id = this.options.id
|
||||||
for (let i = 0; i < this.sdk.viewer.imageryLayers._layers.length; i++) {
|
for (let i = 0; i < this.sdk.viewer.imageryLayers._layers.length; i++) {
|
||||||
if (this.sdk.viewer.imageryLayers._layers[i]._imageryProvider && this.sdk.viewer.imageryLayers._layers[i]._imageryProvider._type && (this.sdk.viewer.imageryLayers._layers[i]._imageryProvider._type === 'flw' || this.sdk.viewer.imageryLayers._layers[i]._imageryProvider._type === 'jww')) {
|
if (this.sdk.viewer.imageryLayers._layers[i]._imageryProvider && this.sdk.viewer.imageryLayers._layers[i]._imageryProvider._type && (this.sdk.viewer.imageryLayers._layers[i]._imageryProvider._type === 'flw' || this.sdk.viewer.imageryLayers._layers[i]._imageryProvider._type === 'jww')) {
|
||||||
let layer = this.sdk.viewer.imageryLayers._layers[i]
|
let layer = this.sdk.viewer.imageryLayers._layers[i]
|
||||||
|
|||||||
@ -30,6 +30,7 @@ class GdImagery extends BaseLayer {
|
|||||||
} else {
|
} else {
|
||||||
this.entity = this.sdk.viewer.imageryLayers.addImageryProvider(gdLayer,)
|
this.entity = this.sdk.viewer.imageryLayers.addImageryProvider(gdLayer,)
|
||||||
}
|
}
|
||||||
|
this.entity._id = this.options.id
|
||||||
for (let i = 0; i < this.sdk.viewer.imageryLayers._layers.length; i++) {
|
for (let i = 0; i < this.sdk.viewer.imageryLayers._layers.length; i++) {
|
||||||
if (this.sdk.viewer.imageryLayers._layers[i]._imageryProvider && this.sdk.viewer.imageryLayers._layers[i]._imageryProvider._type && (this.sdk.viewer.imageryLayers._layers[i]._imageryProvider._type === 'flw' || this.sdk.viewer.imageryLayers._layers[i]._imageryProvider._type === 'jww')) {
|
if (this.sdk.viewer.imageryLayers._layers[i]._imageryProvider && this.sdk.viewer.imageryLayers._layers[i]._imageryProvider._type && (this.sdk.viewer.imageryLayers._layers[i]._imageryProvider._type === 'flw' || this.sdk.viewer.imageryLayers._layers[i]._imageryProvider._type === 'jww')) {
|
||||||
let layer = this.sdk.viewer.imageryLayers._layers[i]
|
let layer = this.sdk.viewer.imageryLayers._layers[i]
|
||||||
|
|||||||
@ -126,6 +126,7 @@ class Layer extends BaseLayer {
|
|||||||
this.entity =
|
this.entity =
|
||||||
this.sdk.viewer.scene.imageryLayers.addImageryProvider(layer,)
|
this.sdk.viewer.scene.imageryLayers.addImageryProvider(layer,)
|
||||||
}
|
}
|
||||||
|
this.entity._id = this.options.id
|
||||||
for (let i = 0; i < this.sdk.viewer.imageryLayers._layers.length; i++) {
|
for (let i = 0; i < this.sdk.viewer.imageryLayers._layers.length; i++) {
|
||||||
if (this.sdk.viewer.imageryLayers._layers[i]._imageryProvider && this.sdk.viewer.imageryLayers._layers[i]._imageryProvider._type && (this.sdk.viewer.imageryLayers._layers[i]._imageryProvider._type === 'flw' || this.sdk.viewer.imageryLayers._layers[i]._imageryProvider._type === 'jww')) {
|
if (this.sdk.viewer.imageryLayers._layers[i]._imageryProvider && this.sdk.viewer.imageryLayers._layers[i]._imageryProvider._type && (this.sdk.viewer.imageryLayers._layers[i]._imageryProvider._type === 'flw' || this.sdk.viewer.imageryLayers._layers[i]._imageryProvider._type === 'jww')) {
|
||||||
let layer = this.sdk.viewer.imageryLayers._layers[i]
|
let layer = this.sdk.viewer.imageryLayers._layers[i]
|
||||||
|
|||||||
@ -37,6 +37,7 @@ class Layer3rdparty extends BaseLayer {
|
|||||||
this.entity =
|
this.entity =
|
||||||
this.sdk.viewer.scene.imageryLayers.addImageryProvider(layer,)
|
this.sdk.viewer.scene.imageryLayers.addImageryProvider(layer,)
|
||||||
}
|
}
|
||||||
|
this.entity._id = this.options.id
|
||||||
for (let i = 0; i < this.sdk.viewer.imageryLayers._layers.length; i++) {
|
for (let i = 0; i < this.sdk.viewer.imageryLayers._layers.length; i++) {
|
||||||
if (this.sdk.viewer.imageryLayers._layers[i]._imageryProvider && this.sdk.viewer.imageryLayers._layers[i]._imageryProvider._type && (this.sdk.viewer.imageryLayers._layers[i]._imageryProvider._type === 'flw' || this.sdk.viewer.imageryLayers._layers[i]._imageryProvider._type === 'jww')) {
|
if (this.sdk.viewer.imageryLayers._layers[i]._imageryProvider && this.sdk.viewer.imageryLayers._layers[i]._imageryProvider._type && (this.sdk.viewer.imageryLayers._layers[i]._imageryProvider._type === 'flw' || this.sdk.viewer.imageryLayers._layers[i]._imageryProvider._type === 'jww')) {
|
||||||
let layer = this.sdk.viewer.imageryLayers._layers[i]
|
let layer = this.sdk.viewer.imageryLayers._layers[i]
|
||||||
|
|||||||
@ -28,11 +28,11 @@ class BaseLayer extends BaseSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get layerIndex() {
|
get layerIndex() {
|
||||||
return this.entity._layerIndex
|
return this.entity ? this.entity._layerIndex : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
get layer_index() {
|
get layer_index() {
|
||||||
return this.entity._layerIndex
|
return this.entity ? this.entity._layerIndex : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
get brightness() {
|
get brightness() {
|
||||||
|
|||||||
@ -56,7 +56,7 @@ function html(that) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<span class="label">视野缩放</span>
|
<span class="label" style="flex: 0 0 60px;">固定大小</span>
|
||||||
<input class="btn-switch" type="checkbox" @model="scaleByDistance">
|
<input class="btn-switch" type="checkbox" @model="scaleByDistance">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -100,8 +100,8 @@ class Model extends BaseModel {
|
|||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
||||||
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
|
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 || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
@ -145,15 +145,7 @@ class Model extends BaseModel {
|
|||||||
if (!this.sdk || !this.sdk.viewer || !this.sdk.viewer.scene) {
|
if (!this.sdk || !this.sdk.viewer || !this.sdk.viewer.scene) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!url.startsWith("http")) {
|
url = this.replaceHost(url, this.options.host)
|
||||||
//说明是本地的json,在磁盘中存在的
|
|
||||||
if (!url.includes(":")) {
|
|
||||||
if (this.options.host) {
|
|
||||||
let o = new URL(url, this.options.host)
|
|
||||||
url = o.href
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// this.handler = new Cesium.ScreenSpaceEventHandler(
|
// this.handler = new Cesium.ScreenSpaceEventHandler(
|
||||||
// this.sdk.viewer.canvas
|
// this.sdk.viewer.canvas
|
||||||
// )
|
// )
|
||||||
@ -447,7 +439,7 @@ class Model extends BaseModel {
|
|||||||
this.entity.color = Cesium.Color.fromCssColorString(v)
|
this.entity.color = Cesium.Color.fromCssColorString(v)
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -679,7 +671,7 @@ class Model extends BaseModel {
|
|||||||
this.label && (this.label.color = v)
|
this.label && (this.label.color = v)
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -780,7 +772,7 @@ class Model extends BaseModel {
|
|||||||
this.label && (this.label.lineColor = v)
|
this.label && (this.label.lineColor = v)
|
||||||
if (this._elms.labelLineColor) {
|
if (this._elms.labelLineColor) {
|
||||||
this._elms.labelLineColor.forEach((item, i) => {
|
this._elms.labelLineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -791,7 +783,7 @@ class Model extends BaseModel {
|
|||||||
this.labelLineColor = color
|
this.labelLineColor = color
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(0,255,255,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.labelLineColor[i] = lineColorPicker
|
this._elms.labelLineColor[i] = lineColorPicker
|
||||||
@ -807,7 +799,7 @@ class Model extends BaseModel {
|
|||||||
this.label && (this.label.backgroundColor = [v, this.label.backgroundColor[1]])
|
this.label && (this.label.backgroundColor = [v, this.label.backgroundColor[1]])
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -833,7 +825,7 @@ class Model extends BaseModel {
|
|||||||
this.label && (this.label.backgroundColor = [this.label.backgroundColor[0], v])
|
this.label && (this.label.backgroundColor = [this.label.backgroundColor[0], v])
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1336,7 +1328,9 @@ class Model extends BaseModel {
|
|||||||
this.name = this.options.name || '未命名对象'
|
this.name = this.options.name || '未命名对象'
|
||||||
this.originalOptions = this.deepCopyObj(this.options)
|
this.originalOptions = this.deepCopyObj(this.options)
|
||||||
this._DialogObject.close()
|
this._DialogObject.close()
|
||||||
this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(this.originalOptions)
|
let cdoptions = this.deepCopyObj(this.options)
|
||||||
|
cdoptions.host = ''
|
||||||
|
this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(cdoptions)
|
||||||
syncData(this.sdk, this.options.id)
|
syncData(this.sdk, this.options.id)
|
||||||
syncSplitData(this.sdk, this.options.id)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
},
|
},
|
||||||
@ -1425,7 +1419,7 @@ class Model extends BaseModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1439,7 +1433,7 @@ class Model extends BaseModel {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelColor")[0],
|
el: contentElm.getElementsByClassName("labelColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1453,7 +1447,7 @@ class Model extends BaseModel {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1467,7 +1461,7 @@ class Model extends BaseModel {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -1481,7 +1475,7 @@ class Model extends BaseModel {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
|
|||||||
@ -381,7 +381,7 @@ class Model2 extends BaseModel {
|
|||||||
this.entity.color = Cesium.Color.fromCssColorString(v)
|
this.entity.color = Cesium.Color.fromCssColorString(v)
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -583,7 +583,7 @@ class Model2 extends BaseModel {
|
|||||||
this.label.color = v
|
this.label.color = v
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -676,7 +676,7 @@ class Model2 extends BaseModel {
|
|||||||
this.label.lineColor = v
|
this.label.lineColor = v
|
||||||
if (this._elms.lineColor) {
|
if (this._elms.lineColor) {
|
||||||
this._elms.lineColor.forEach((item, i) => {
|
this._elms.lineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -704,7 +704,7 @@ class Model2 extends BaseModel {
|
|||||||
this.label.backgroundColor = [v, this.labelBackgroundColorEnd]
|
this.label.backgroundColor = [v, this.labelBackgroundColorEnd]
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -732,7 +732,7 @@ class Model2 extends BaseModel {
|
|||||||
this.label.backgroundColor = [this.labelBackgroundColorStart, v]
|
this.label.backgroundColor = [this.labelBackgroundColorStart, v]
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1098,7 +1098,7 @@ class Model2 extends BaseModel {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('model-edit-tabs', undefined, this.sdk)
|
let tabsElm = new cy_tabs('model-edit-tabs', undefined, this.sdk)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1112,7 +1112,7 @@ class Model2 extends BaseModel {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("label_color")[0],
|
el: contentElm.getElementsByClassName("label_color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1126,7 +1126,7 @@ class Model2 extends BaseModel {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("line_color")[0],
|
el: contentElm.getElementsByClassName("line_color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1140,7 +1140,7 @@ class Model2 extends BaseModel {
|
|||||||
this.lineColor = 'rgba(255,255,255,1)'
|
this.lineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -1154,7 +1154,7 @@ class Model2 extends BaseModel {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
import Dialog from '../../../Element/Dialog';
|
import Dialog from '../../../Element/Dialog';
|
||||||
import { getHost } from "../../../../on";
|
import { getHost } from "../../../../on";
|
||||||
import BaseSource from "../index";
|
import BaseSource from "../index";
|
||||||
import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../../Global/global'
|
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../../Global/global'
|
||||||
import { setSplitDirection, syncSplitData } from '../../../../Global/SplitScreen'
|
import { setSplitDirection, syncSplitData } from '../../../../Global/SplitScreen'
|
||||||
|
|
||||||
class BaseTerrain extends BaseSource {
|
class BaseTerrain extends BaseSource {
|
||||||
@ -78,6 +78,11 @@ class BaseTerrain extends BaseSource {
|
|||||||
close() {
|
close() {
|
||||||
this.sdk.viewer.scene.terrainProvider =
|
this.sdk.viewer.scene.terrainProvider =
|
||||||
new Cesium.EllipsoidTerrainProvider({})
|
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)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
|
|
||||||
clearTimeout(this.#updateModelTimeout)
|
clearTimeout(this.#updateModelTimeout)
|
||||||
@ -156,7 +161,7 @@ class BaseTerrain extends BaseSource {
|
|||||||
}
|
}
|
||||||
setActiveViewer(0)
|
setActiveViewer(0)
|
||||||
closeRotateAround(this.sdk)
|
closeRotateAround(this.sdk)
|
||||||
closeViewFollow(this.sdk)
|
closeViewFollow(this.sdk)
|
||||||
|
|
||||||
if (this.options.customView && this.options.customView.relativePosition && this.options.customView.orientation) {
|
if (this.options.customView && this.options.customView.relativePosition && this.options.customView.orientation) {
|
||||||
let orientation = {
|
let orientation = {
|
||||||
@ -247,7 +252,9 @@ class BaseTerrain extends BaseSource {
|
|||||||
}
|
}
|
||||||
this.originalOptions = this.deepCopyObj(this.options)
|
this.originalOptions = this.deepCopyObj(this.options)
|
||||||
this._DialogObject.close()
|
this._DialogObject.close()
|
||||||
this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(this.originalOptions)
|
let cdoptions = this.deepCopyObj(this.options)
|
||||||
|
cdoptions.host = ''
|
||||||
|
this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(cdoptions)
|
||||||
},
|
},
|
||||||
// resetCallBack: () => {
|
// resetCallBack: () => {
|
||||||
// this.name = this.originalOptions.name
|
// this.name = this.originalOptions.name
|
||||||
|
|||||||
@ -63,9 +63,9 @@ class BillboardObject extends Base {
|
|||||||
*@param options.label {object} 标注文字的参数
|
*@param options.label {object} 标注文字的参数
|
||||||
*@param [options.label.text] {string} 标注中文字
|
*@param [options.label.text] {string} 标注中文字
|
||||||
*@param [options.label.show=true] {boolean} 标注文字显示/隐藏
|
*@param [options.label.show=true] {boolean} 标注文字显示/隐藏
|
||||||
*@param [options.label.fontFamily=0] {number} 标注文字字体 0:思源黑体;1:庞门正道标题体;2:数黑体
|
*@param [options.label.fontFamily=0] {number} 标注文字字体 0:黑体;1:思源黑体;2:庞门正道标题体;3:数黑体
|
||||||
*@param [options.label.fontSize=39] {number} 标注文字大小 单位px,微软雅黑
|
*@param [options.label.fontSize=39] {number} 标注文字大小 单位px,微软雅黑
|
||||||
*@param [options.label.color=#07f8e4] {string} 标注文字颜色
|
*@param [options.label.color=#00ffff] {string} 标注文字颜色
|
||||||
*@param _Dialog {object} 弹框事件
|
*@param _Dialog {object} 弹框事件
|
||||||
*@param _Dialog.confirmCallBack {function} 弹框确认时的回调
|
*@param _Dialog.confirmCallBack {function} 弹框确认时的回调
|
||||||
*@param _Dialog.instructSubmit(id,name,instruct) {function} 提交指令(ID, 名称,指令内容)
|
*@param _Dialog.instructSubmit(id,name,instruct) {function} 提交指令(ID, 名称,指令内容)
|
||||||
@ -107,7 +107,7 @@ class BillboardObject extends Base {
|
|||||||
: true
|
: true
|
||||||
this.options.label.fontFamily = options.label.fontFamily || 0
|
this.options.label.fontFamily = options.label.fontFamily || 0
|
||||||
this.options.label.fontSize = options.label.fontSize || 39
|
this.options.label.fontSize = options.label.fontSize || 39
|
||||||
this.options.label.color = options.label.color || '#FFFF00'
|
this.options.label.color = options.label.color || '#00ffff'
|
||||||
this.options.positions = options.positions = options.positions || {}
|
this.options.positions = options.positions = options.positions || {}
|
||||||
this.options.positions.lng = Number(
|
this.options.positions.lng = Number(
|
||||||
Number(options.positions.lng || 0).toFixed(8)
|
Number(options.positions.lng || 0).toFixed(8)
|
||||||
@ -211,8 +211,9 @@ class BillboardObject extends Base {
|
|||||||
let index = 0
|
let index = 0
|
||||||
|
|
||||||
let font = getFontFamily(that.labelFontFamily) || 'Helvetica'
|
let font = getFontFamily(that.labelFontFamily) || 'Helvetica'
|
||||||
|
let url = that.replaceHost(that.options.billboard.image, that.options.host)
|
||||||
that._frameImages = []
|
that._frameImages = []
|
||||||
if (that.options.billboard.image && that.options.billboard.image.endsWith('gif')) {
|
if (url && url.endsWith('gif')) {
|
||||||
isGlf = true
|
isGlf = true
|
||||||
switch (that.options.heightMode) {
|
switch (that.options.heightMode) {
|
||||||
case 2:
|
case 2:
|
||||||
@ -222,7 +223,7 @@ class BillboardObject extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let gifImg = document.createElement('img')
|
let gifImg = document.createElement('img')
|
||||||
gifImg.setAttribute('rel:animated_src', that.options.billboard.image)
|
gifImg.setAttribute('rel:animated_src', url)
|
||||||
gifImg.setAttribute('rel:auto_play', '1')
|
gifImg.setAttribute('rel:auto_play', '1')
|
||||||
const imgDiv = document.createElement('div')
|
const imgDiv = document.createElement('div')
|
||||||
imgDiv.appendChild(gifImg)
|
imgDiv.appendChild(gifImg)
|
||||||
@ -272,7 +273,7 @@ class BillboardObject extends Base {
|
|||||||
else {
|
else {
|
||||||
let image = new Image()
|
let image = new Image()
|
||||||
image.src =
|
image.src =
|
||||||
that.options.billboard.image ||
|
url ||
|
||||||
that.getSourceRootPath() + '/img/A-ablu-blank.png'
|
that.getSourceRootPath() + '/img/A-ablu-blank.png'
|
||||||
switch (that.options.heightMode) {
|
switch (that.options.heightMode) {
|
||||||
case 2:
|
case 2:
|
||||||
@ -432,11 +433,11 @@ class BillboardObject extends Base {
|
|||||||
value: '链接',
|
value: '链接',
|
||||||
key: 'link'
|
key: 'link'
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
name: 'IP摄像头',
|
// name: 'IP摄像头',
|
||||||
value: 'IP摄像头',
|
// value: 'IP摄像头',
|
||||||
key: 'camera'
|
// key: 'camera'
|
||||||
},
|
// },
|
||||||
// {
|
// {
|
||||||
// name: 'ISC摄像头',
|
// name: 'ISC摄像头',
|
||||||
// value: 'ISC摄像头',
|
// value: 'ISC摄像头',
|
||||||
@ -447,16 +448,16 @@ class BillboardObject extends Base {
|
|||||||
// value: '传感器',
|
// value: '传感器',
|
||||||
// key: 'sensor'
|
// key: 'sensor'
|
||||||
// },
|
// },
|
||||||
{
|
// {
|
||||||
name: '全景图',
|
// name: '全景图',
|
||||||
value: '全景图',
|
// value: '全景图',
|
||||||
key: 'vr'
|
// key: 'vr'
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
name: '物资',
|
// name: '物资',
|
||||||
value: '物资',
|
// value: '物资',
|
||||||
key: 'goods'
|
// key: 'goods'
|
||||||
}
|
// }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,14 +465,24 @@ class BillboardObject extends Base {
|
|||||||
return this.options.show
|
return this.options.show
|
||||||
}
|
}
|
||||||
set show(v) {
|
set show(v) {
|
||||||
this.options.show = v
|
if(!this.isShowView) {
|
||||||
this.originalOptions.show = v
|
this.options.show = v
|
||||||
this.entity && (this.entity.show = v)
|
this.originalOptions.show = v
|
||||||
|
}
|
||||||
|
if(!this.showView || this.showView == 3) {
|
||||||
|
this.entity && (this.entity.show = this.options.show)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.entity && (this.entity.show = false)
|
||||||
|
}
|
||||||
syncData(this.sdk, this.options.id)
|
syncData(this.sdk, this.options.id)
|
||||||
syncSplitData(this.sdk, this.options.id)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
|
|
||||||
if (this._DialogObject && this._DialogObject.showBtn) {
|
if (this._DialogObject && this._DialogObject.showBtn) {
|
||||||
this._DialogObject.showBtn.checked = v
|
this._DialogObject.showBtn.checked = this.options.show
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.isShowView = false
|
||||||
// if (v) {
|
// if (v) {
|
||||||
// if (this.diffuseShow) {
|
// if (this.diffuseShow) {
|
||||||
// this.diffuseShow = true
|
// this.diffuseShow = true
|
||||||
@ -720,11 +731,21 @@ class BillboardObject extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get billboardImage() {
|
get billboardImage() {
|
||||||
return this.options.billboard.image
|
let url = this.options.billboard.image
|
||||||
|
if (url && !url.startsWith("http")) {
|
||||||
|
//说明是本地的json,在磁盘中存在的
|
||||||
|
if (!url.includes(":")) {
|
||||||
|
if (this.options.host) {
|
||||||
|
let o = new URL(url, this.options.host)
|
||||||
|
url = o.href
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return url
|
||||||
}
|
}
|
||||||
set billboardImage(v) {
|
set billboardImage(v) {
|
||||||
let _this = this
|
let _this = this
|
||||||
this.options.billboard.image = v
|
this.options.billboard.image = this.replaceHost(v, this.options.host)
|
||||||
let url =
|
let url =
|
||||||
this.options.billboard.image ||
|
this.options.billboard.image ||
|
||||||
getBillboardDefaultUrl(this.options.billboard.defaultImage) ||
|
getBillboardDefaultUrl(this.options.billboard.defaultImage) ||
|
||||||
@ -755,6 +776,8 @@ class BillboardObject extends Base {
|
|||||||
_this._frameImages = []
|
_this._frameImages = []
|
||||||
superGif.load(function (status) {
|
superGif.load(function (status) {
|
||||||
if (status == 404) {
|
if (status == 404) {
|
||||||
|
let width = 31
|
||||||
|
let height = 36
|
||||||
canvas = document.createElement('canvas')
|
canvas = document.createElement('canvas')
|
||||||
canvas.width = 0
|
canvas.width = 0
|
||||||
canvas.height = 0
|
canvas.height = 0
|
||||||
@ -844,6 +867,8 @@ class BillboardObject extends Base {
|
|||||||
billboardH = height * (31 / width)
|
billboardH = height * (31 / width)
|
||||||
}
|
}
|
||||||
image.onerror = function (err) {
|
image.onerror = function (err) {
|
||||||
|
let width = 31
|
||||||
|
let height = 36
|
||||||
canvas.width = 0
|
canvas.width = 0
|
||||||
canvas.height = 0
|
canvas.height = 0
|
||||||
billboardH = 0
|
billboardH = 0
|
||||||
@ -916,22 +941,22 @@ class BillboardObject extends Base {
|
|||||||
return this.options.label.color
|
return this.options.label.color
|
||||||
}
|
}
|
||||||
set labelColor(v) {
|
set labelColor(v) {
|
||||||
this.options.label.color = v
|
this.options.label.color = v || '#00ffff'
|
||||||
this.renewPoint()
|
this.renewPoint()
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
defaultColor: v,
|
defaultColor: this.options.label.color,
|
||||||
disabled: false, //是否禁止打开颜色选择器
|
disabled: false, //是否禁止打开颜色选择器
|
||||||
openPickerAni: 'opacity', //打开颜色选择器动画
|
openPickerAni: 'opacity', //打开颜色选择器动画
|
||||||
sure: c => {
|
sure: c => {
|
||||||
this.labelColor = c
|
this.labelColor = c
|
||||||
}, //点击确认按钮事件回调
|
}, //点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(0,255,255,1)'
|
||||||
} //点击清空按钮事件回调
|
} //点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.labelColor[i] = colorPicker
|
this._elms.labelColor[i] = colorPicker
|
||||||
@ -993,7 +1018,7 @@ class BillboardObject extends Base {
|
|||||||
// this.options.diffuseColor = v
|
// this.options.diffuseColor = v
|
||||||
// if (this._elms.diffuseColor) {
|
// if (this._elms.diffuseColor) {
|
||||||
// this._elms.diffuseColor.forEach((item, i) => {
|
// this._elms.diffuseColor.forEach((item, i) => {
|
||||||
// let diffuseColorPicker = new ewPlugins('colorpicker', {
|
// let diffuseColorPicker = new YJColorPicker({
|
||||||
// el: item.el,
|
// el: item.el,
|
||||||
// size: 'mini',//颜色box类型
|
// size: 'mini',//颜色box类型
|
||||||
// alpha: false,//是否开启透明度
|
// alpha: false,//是否开启透明度
|
||||||
@ -1069,7 +1094,7 @@ class BillboardObject extends Base {
|
|||||||
// this.options.scanColor = v
|
// this.options.scanColor = v
|
||||||
// if (this._elms.scanColor) {
|
// if (this._elms.scanColor) {
|
||||||
// this._elms.scanColor.forEach((item, i) => {
|
// this._elms.scanColor.forEach((item, i) => {
|
||||||
// let scanColorPicker = new ewPlugins('colorpicker', {
|
// let scanColorPicker = new YJColorPicker({
|
||||||
// el: item.el,
|
// el: item.el,
|
||||||
// size: 'mini',//颜色box类型
|
// size: 'mini',//颜色box类型
|
||||||
// alpha: false,//是否开启透明度
|
// alpha: false,//是否开启透明度
|
||||||
@ -1497,10 +1522,11 @@ class BillboardObject extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set billboardDefaultImage(v) {
|
set billboardDefaultImage(v) {
|
||||||
setBillboardDefaultUrl(v, this.options.billboard.defaultImage)
|
let url = this.replaceHost(v, this.options.host)
|
||||||
|
setBillboardDefaultUrl(url, this.options.billboard.defaultImage)
|
||||||
this._elms.billboardDefaultImage &&
|
this._elms.billboardDefaultImage &&
|
||||||
this._elms.billboardDefaultImage.forEach(item => {
|
this._elms.billboardDefaultImage.forEach(item => {
|
||||||
item.src = v
|
item.src = url
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1575,8 +1601,10 @@ class BillboardObject extends Base {
|
|||||||
}
|
}
|
||||||
this.originalOptions = this.deepCopyObj(this.options)
|
this.originalOptions = this.deepCopyObj(this.options)
|
||||||
this._DialogObject.close()
|
this._DialogObject.close()
|
||||||
|
let cdoptions = this.deepCopyObj(this.options)
|
||||||
|
cdoptions.host = ''
|
||||||
this.Dialog.confirmCallBack &&
|
this.Dialog.confirmCallBack &&
|
||||||
this.Dialog.confirmCallBack(this.originalOptions)
|
this.Dialog.confirmCallBack(cdoptions)
|
||||||
syncData(this.sdk, this.options.id)
|
syncData(this.sdk, this.options.id)
|
||||||
syncSplitData(this.sdk, this.options.id)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
},
|
},
|
||||||
@ -1631,7 +1659,7 @@ class BillboardObject extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('point-object-edit-tabs', undefined, this.sdk)
|
let tabsElm = new cy_tabs('point-object-edit-tabs', undefined, this.sdk)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName('labelColor')[0],
|
el: contentElm.getElementsByClassName('labelColor')[0],
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
@ -1646,7 +1674,7 @@ class BillboardObject extends Base {
|
|||||||
} //点击清空按钮事件回调
|
} //点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
|
|
||||||
// let diffuseColorPicker = new ewPlugins('colorpicker', {
|
// let diffuseColorPicker = new YJColorPicker({
|
||||||
// el: contentElm.getElementsByClassName("diffuseColor")[0],
|
// el: contentElm.getElementsByClassName("diffuseColor")[0],
|
||||||
// size: 'mini',//颜色box类型
|
// size: 'mini',//颜色box类型
|
||||||
// alpha: false,//是否开启透明度
|
// alpha: false,//是否开启透明度
|
||||||
@ -1660,7 +1688,7 @@ class BillboardObject extends Base {
|
|||||||
// this.diffuseColor = 'rgba(255,255,255,1)'
|
// this.diffuseColor = 'rgba(255,255,255,1)'
|
||||||
// },//点击清空按钮事件回调
|
// },//点击清空按钮事件回调
|
||||||
// })
|
// })
|
||||||
// let scanColorPicker = new ewPlugins('colorpicker', {
|
// let scanColorPicker = new YJColorPicker({
|
||||||
// el: contentElm.getElementsByClassName("scanColor")[0],
|
// el: contentElm.getElementsByClassName("scanColor")[0],
|
||||||
// size: 'mini',//颜色box类型
|
// size: 'mini',//颜色box类型
|
||||||
// alpha: false,//是否开启透明度
|
// alpha: false,//是否开启透明度
|
||||||
@ -1812,7 +1840,13 @@ class BillboardObject extends Base {
|
|||||||
case '2':
|
case '2':
|
||||||
case 3:
|
case 3:
|
||||||
case '3':
|
case '3':
|
||||||
this.getClampToHeight(this.options.positions).then(h => {
|
let objectsToExclude = []
|
||||||
|
for (let [key, value] of this.sdk.entityMap) {
|
||||||
|
if (value.type === 'RadarScanStereoscopic' && value.entity) {
|
||||||
|
objectsToExclude.push(value.entity)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.getClampToHeight(this.options.positions, objectsToExclude).then(h => {
|
||||||
this.alt = Number(h.toFixed(2))
|
this.alt = Number(h.toFixed(2))
|
||||||
heightElm.value = this.alt
|
heightElm.value = this.alt
|
||||||
})
|
})
|
||||||
@ -1876,7 +1910,13 @@ class BillboardObject extends Base {
|
|||||||
break
|
break
|
||||||
case 3:
|
case 3:
|
||||||
case '3':
|
case '3':
|
||||||
this.getClampToHeight(this.options.positions).then(h => {
|
let objectsToExclude = []
|
||||||
|
for (let [key, value] of this.sdk.entityMap) {
|
||||||
|
if (value.type === 'RadarScanStereoscopic' && value.entity) {
|
||||||
|
objectsToExclude.push(value.entity)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.getClampToHeight(this.options.positions, objectsToExclude).then(h => {
|
||||||
this.alt = Number(h.toFixed(2))
|
this.alt = Number(h.toFixed(2))
|
||||||
})
|
})
|
||||||
this.heightMode = 3
|
this.heightMode = 3
|
||||||
@ -2318,6 +2358,9 @@ class BillboardObject extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async updateHeight() {
|
async updateHeight() {
|
||||||
|
if (!this.sdk || !this.sdk.viewer || !this.sdk.viewer.scene) {
|
||||||
|
return
|
||||||
|
}
|
||||||
let height
|
let height
|
||||||
let height2
|
let height2
|
||||||
let point1 = new Cesium.Cartesian3.fromDegrees(
|
let point1 = new Cesium.Cartesian3.fromDegrees(
|
||||||
@ -2330,9 +2373,14 @@ class BillboardObject extends Base {
|
|||||||
this.options.positions.lat,
|
this.options.positions.lat,
|
||||||
10000000000000
|
10000000000000
|
||||||
)
|
)
|
||||||
let updatedCartesians = await this.sdk.viewer.scene.clampToHeightMostDetailed(
|
|
||||||
[point1]
|
let objectsToExclude = []
|
||||||
)
|
for (let [key, value] of this.sdk.entityMap) {
|
||||||
|
if (value.type === 'RadarScanStereoscopic' && value.entity) {
|
||||||
|
objectsToExclude.push(value.entity)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let updatedCartesians = await this.sdk.viewer.scene.clampToHeightMostDetailed([point1], objectsToExclude)
|
||||||
if (updatedCartesians && updatedCartesians[0]) {
|
if (updatedCartesians && updatedCartesians[0]) {
|
||||||
height = this.cartesian3Towgs84(updatedCartesians[0], this.sdk.viewer).alt
|
height = this.cartesian3Towgs84(updatedCartesians[0], this.sdk.viewer).alt
|
||||||
}
|
}
|
||||||
@ -2471,7 +2519,13 @@ class BillboardObject extends Base {
|
|||||||
}
|
}
|
||||||
// 如果没有高度值,则获取紧贴高度计算
|
// 如果没有高度值,则获取紧贴高度计算
|
||||||
if (!position.hasOwnProperty('alt')) {
|
if (!position.hasOwnProperty('alt')) {
|
||||||
position.alt = await this.getClampToHeight(position)
|
let objectsToExclude = []
|
||||||
|
for (let [key, value] of this.sdk.entityMap) {
|
||||||
|
if (value.type === 'RadarScanStereoscopic' && value.entity) {
|
||||||
|
objectsToExclude.push(value.entity)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
position.alt = await this.getClampToHeight(position, objectsToExclude)
|
||||||
}
|
}
|
||||||
lng = this.options.customView.relativePosition.lng + position.lng
|
lng = this.options.customView.relativePosition.lng + position.lng
|
||||||
lat = this.options.customView.relativePosition.lat + position.lat
|
lat = this.options.customView.relativePosition.lat + position.lat
|
||||||
@ -2482,7 +2536,13 @@ class BillboardObject extends Base {
|
|||||||
orientation: orientation
|
orientation: orientation
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
let height = await this.getClampToHeight(this.options.positions)
|
let objectsToExclude = []
|
||||||
|
for (let [key, value] of this.sdk.entityMap) {
|
||||||
|
if (value.type === 'RadarScanStereoscopic' && value.entity) {
|
||||||
|
objectsToExclude.push(value.entity)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let height = await this.getClampToHeight(this.options.positions, objectsToExclude)
|
||||||
this.sdk.viewer.camera.flyTo({
|
this.sdk.viewer.camera.flyTo({
|
||||||
orientation: options.orientation,
|
orientation: options.orientation,
|
||||||
destination: Cesium.Cartesian3.fromDegrees(
|
destination: Cesium.Cartesian3.fromDegrees(
|
||||||
@ -2650,7 +2710,13 @@ class BillboardObject extends Base {
|
|||||||
}
|
}
|
||||||
// 如果没有高度值,则获取紧贴高度计算
|
// 如果没有高度值,则获取紧贴高度计算
|
||||||
if (!position.hasOwnProperty('alt')) {
|
if (!position.hasOwnProperty('alt')) {
|
||||||
position.alt = await this.getClampToHeight(position)
|
let objectsToExclude = []
|
||||||
|
for (let [key, value] of this.sdk.entityMap) {
|
||||||
|
if (value.type === 'RadarScanStereoscopic' && value.entity) {
|
||||||
|
objectsToExclude.push(value.entity)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
position.alt = await this.getClampToHeight(position, objectsToExclude)
|
||||||
}
|
}
|
||||||
relativePosition = {
|
relativePosition = {
|
||||||
lng: cameraPosition84.lng - position.lng,
|
lng: cameraPosition84.lng - position.lng,
|
||||||
|
|||||||
@ -75,8 +75,8 @@ class CircleDiffuse extends Base {
|
|||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
||||||
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
|
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 || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
@ -223,16 +223,30 @@ class CircleDiffuse extends Base {
|
|||||||
|
|
||||||
set show(v) {
|
set show(v) {
|
||||||
if (typeof v === "boolean") {
|
if (typeof v === "boolean") {
|
||||||
this.options.show = v
|
if (!this.isShowView) {
|
||||||
this.entity.show = v
|
this.options.show = v
|
||||||
|
}
|
||||||
|
if (!this.showView || this.showView == 3) {
|
||||||
|
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)
|
syncData(this.sdk, this.options.id)
|
||||||
syncSplitData(this.sdk, this.options.id)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
if (this._DialogObject && this._DialogObject.showBtn) {
|
if (this._DialogObject && this._DialogObject.showBtn) {
|
||||||
this._DialogObject.showBtn.checked = v
|
this._DialogObject.showBtn.checked = v
|
||||||
}
|
}
|
||||||
if (this.options.label.show) {
|
|
||||||
this.label.show = v
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
console.error("参数必须为boolean")
|
console.error("参数必须为boolean")
|
||||||
}
|
}
|
||||||
@ -362,6 +376,7 @@ class CircleDiffuse extends Base {
|
|||||||
return this.options.circle
|
return this.options.circle
|
||||||
}
|
}
|
||||||
set circle(v) {
|
set circle(v) {
|
||||||
|
console.log(v)
|
||||||
this.options.circle = v || [{ radius: 10 }]
|
this.options.circle = v || [{ radius: 10 }]
|
||||||
for (let i = 0; i < this.options.circle.length; i++) {
|
for (let i = 0; i < this.options.circle.length; i++) {
|
||||||
if(this.options.circle[i].radius>999999) {
|
if(this.options.circle[i].radius>999999) {
|
||||||
@ -428,7 +443,7 @@ class CircleDiffuse extends Base {
|
|||||||
}
|
}
|
||||||
set labelShow(v) {
|
set labelShow(v) {
|
||||||
this.options.label.show = v
|
this.options.label.show = v
|
||||||
if (this.show) {
|
if (this.show && (!this.showView || this.showView == 3)) {
|
||||||
this.label.show = v
|
this.label.show = v
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -462,7 +477,7 @@ class CircleDiffuse extends Base {
|
|||||||
this.label.color = v
|
this.label.color = v
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -562,7 +577,7 @@ class CircleDiffuse extends Base {
|
|||||||
this.label.lineColor = v
|
this.label.lineColor = v
|
||||||
if (this._elms.labelLineColor) {
|
if (this._elms.labelLineColor) {
|
||||||
this._elms.labelLineColor.forEach((item, i) => {
|
this._elms.labelLineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -573,7 +588,7 @@ class CircleDiffuse extends Base {
|
|||||||
this.labelLineColor = color
|
this.labelLineColor = color
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(0,255,255,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.labelLineColor[i] = lineColorPicker
|
this._elms.labelLineColor[i] = lineColorPicker
|
||||||
@ -589,7 +604,7 @@ class CircleDiffuse extends Base {
|
|||||||
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -615,7 +630,7 @@ class CircleDiffuse extends Base {
|
|||||||
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1104,7 +1119,7 @@ class CircleDiffuse extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('circle-diffuse-edit-tabs', undefined, this.sdk)
|
let tabsElm = new cy_tabs('circle-diffuse-edit-tabs', undefined, this.sdk)
|
||||||
|
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelColor")[0],
|
el: contentElm.getElementsByClassName("labelColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1118,7 +1133,7 @@ class CircleDiffuse extends Base {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1132,7 +1147,7 @@ class CircleDiffuse extends Base {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -1146,7 +1161,7 @@ class CircleDiffuse extends Base {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -1405,7 +1420,7 @@ class CircleDiffuse extends Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._radius = radius
|
this._radius = radius
|
||||||
inputElm.value = value
|
// inputElm.value = value
|
||||||
CircleDiffuse.create(this)
|
CircleDiffuse.create(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1446,11 +1461,11 @@ class CircleDiffuse extends Base {
|
|||||||
|
|
||||||
|
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: circleElm.getElementsByClassName("color")[0],
|
el: circleElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: false,//是否开启透明度
|
alpha: false,//是否开启透明度
|
||||||
defaultColor: this.options.circle[i].color,
|
defaultColor: this.options.circle[i].color || this.options.color,
|
||||||
disabled: false,//是否禁止打开颜色选择器
|
disabled: false,//是否禁止打开颜色选择器
|
||||||
openPickerAni: 'opacity',//打开颜色选择器动画
|
openPickerAni: 'opacity',//打开颜色选择器动画
|
||||||
sure: (color) => {
|
sure: (color) => {
|
||||||
|
|||||||
@ -23,7 +23,7 @@ class CircleObject extends Base {
|
|||||||
* @param options.id {string} 标注id
|
* @param options.id {string} 标注id
|
||||||
* @param options.name {string} 名称
|
* @param options.name {string} 名称
|
||||||
* @param options.show=true {boolean} 显示/隐藏
|
* @param options.show=true {boolean} 显示/隐藏
|
||||||
* @param options.color="#36c4ff" {string} 颜色
|
* @param options.color="#ff000080" {string} 颜色
|
||||||
* @param options.center {object} 位置
|
* @param options.center {object} 位置
|
||||||
* @param options.center.lng {object} 经度
|
* @param options.center.lng {object} 经度
|
||||||
* @param options.center.lat {object} 纬度
|
* @param options.center.lat {object} 纬度
|
||||||
@ -31,21 +31,21 @@ class CircleObject extends Base {
|
|||||||
* @param options.radius=10 {object}半径
|
* @param options.radius=10 {object}半径
|
||||||
* @param options.line {object} 边框
|
* @param options.line {object} 边框
|
||||||
* @param options.line.width=2 {string} 边框宽
|
* @param options.line.width=2 {string} 边框宽
|
||||||
* @param options.line.color="rgba(155, 155, 124, 0.89)" {string} 边框颜色
|
* @param options.line.color="#ff000080" {string} 边框颜色
|
||||||
* @param options.label {object} 标注
|
* @param options.label {object} 标注
|
||||||
* @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式)
|
* @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式)
|
||||||
*/
|
*/
|
||||||
constructor(sdk, options = {}) {
|
constructor(sdk, options = {}) {
|
||||||
super(sdk, options);
|
super(sdk, options);
|
||||||
this.options.name = options.name || '未命名对象'
|
this.options.name = options.name || '未命名对象'
|
||||||
this.options.color = options.color || "#36c4ff"
|
this.options.color = options.color || "#ff000080"
|
||||||
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
|
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
|
||||||
this.options.radius = (options.radius || options.radius === 0) ? options.radius : 10
|
this.options.radius = (options.radius || options.radius === 0) ? options.radius : 10
|
||||||
this.options.show = (options.show || options.show === false) ? options.show : true
|
this.options.show = (options.show || options.show === false) ? options.show : true
|
||||||
this.options.center = options.center || {}
|
this.options.center = options.center || {}
|
||||||
this.options.line = options.line || {}
|
this.options.line = options.line || {}
|
||||||
this.options.line.width = this.options.line.width || 2
|
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(155, 155, 124, 0.89)'
|
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)'
|
||||||
this.options['area-unit'] = options['area-unit'] || '平方米'
|
this.options['area-unit'] = options['area-unit'] || '平方米'
|
||||||
options.label = options.label || {}
|
options.label = options.label || {}
|
||||||
this._elms = {};
|
this._elms = {};
|
||||||
@ -58,8 +58,8 @@ class CircleObject extends Base {
|
|||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
||||||
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
|
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 || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
@ -216,31 +216,31 @@ class CircleObject extends Base {
|
|||||||
return this.options.color
|
return this.options.color
|
||||||
}
|
}
|
||||||
set color(v) {
|
set color(v) {
|
||||||
this.options.color = v
|
this.options.color = v || 'rgba(255, 0, 0, 0.5)'
|
||||||
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) {
|
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let material = Cesium.Color.fromCssColorString(v)
|
let material = Cesium.Color.fromCssColorString(this.options.color)
|
||||||
if (this.sdk.viewer.scene.mode === 2) {
|
if (this.sdk.viewer.scene.mode === 2) {
|
||||||
material = new Cesium.CustomColorMaterialSource({
|
material = new Cesium.CustomColorMaterialSource({
|
||||||
color: v
|
color: this.options.color
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.entity.polygon.material = material
|
this.entity.polygon.material = material
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
defaultColor: v,
|
defaultColor: this.options.color,
|
||||||
disabled: false,//是否禁止打开颜色选择器
|
disabled: false,//是否禁止打开颜色选择器
|
||||||
openPickerAni: 'opacity',//打开颜色选择器动画
|
openPickerAni: 'opacity',//打开颜色选择器动画
|
||||||
sure: (c) => {
|
sure: (c) => {
|
||||||
this.color = c
|
this.color = c
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,0,0,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.color[i] = colorPicker
|
this._elms.color[i] = colorPicker
|
||||||
@ -252,25 +252,25 @@ class CircleObject extends Base {
|
|||||||
return this.options.line.color
|
return this.options.line.color
|
||||||
}
|
}
|
||||||
set lineColor(v) {
|
set lineColor(v) {
|
||||||
this.options.line.color = v
|
this.options.line.color = v || 'rgba(255, 0, 0, 0.5)'
|
||||||
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) {
|
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.entity.polyline.material = Cesium.Color.fromCssColorString(v)
|
this.entity.polyline.material = Cesium.Color.fromCssColorString(this.options.line.color)
|
||||||
if (this._elms.lineColor) {
|
if (this._elms.lineColor) {
|
||||||
this._elms.lineColor.forEach((item, i) => {
|
this._elms.lineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
defaultColor: v,
|
defaultColor: this.options.line.color,
|
||||||
disabled: false,//是否禁止打开颜色选择器
|
disabled: false,//是否禁止打开颜色选择器
|
||||||
openPickerAni: 'opacity',//打开颜色选择器动画
|
openPickerAni: 'opacity',//打开颜色选择器动画
|
||||||
sure: (c) => {
|
sure: (c) => {
|
||||||
this.lineColor = c
|
this.lineColor = c
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.lineColor = 'rgba(255,255,255,1)'
|
this.lineColor = 'rgba(255,0,0,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.lineColor[i] = lineColorPicker
|
this._elms.lineColor[i] = lineColorPicker
|
||||||
@ -282,8 +282,8 @@ class CircleObject extends Base {
|
|||||||
return this.options.line.width
|
return this.options.line.width
|
||||||
}
|
}
|
||||||
set lineWidth(v) {
|
set lineWidth(v) {
|
||||||
this.options.line.width = v
|
this.options.line.width = ((v || v === 0) ? v : 3)
|
||||||
this.entity.polyline.width = v
|
this.entity.polyline.width = this.options.line.width
|
||||||
this._elms.lineWidth && this._elms.lineWidth.forEach((item) => {
|
this._elms.lineWidth && this._elms.lineWidth.forEach((item) => {
|
||||||
item.value = v
|
item.value = v
|
||||||
})
|
})
|
||||||
@ -333,7 +333,7 @@ class CircleObject extends Base {
|
|||||||
}
|
}
|
||||||
set labelShow(v) {
|
set labelShow(v) {
|
||||||
this.options.label.show = v
|
this.options.label.show = v
|
||||||
if (this.show) {
|
if (this.show && (!this.showView || this.showView == 3)) {
|
||||||
this.label.show = v
|
this.label.show = v
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -367,7 +367,7 @@ class CircleObject extends Base {
|
|||||||
this.label.color = v
|
this.label.color = v
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -467,7 +467,7 @@ class CircleObject extends Base {
|
|||||||
this.label.lineColor = v
|
this.label.lineColor = v
|
||||||
if (this._elms.labelLineColor) {
|
if (this._elms.labelLineColor) {
|
||||||
this._elms.labelLineColor.forEach((item, i) => {
|
this._elms.labelLineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -478,7 +478,7 @@ class CircleObject extends Base {
|
|||||||
this.labelLineColor = color
|
this.labelLineColor = color
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(0,255,255,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.labelLineColor[i] = lineColorPicker
|
this._elms.labelLineColor[i] = lineColorPicker
|
||||||
@ -494,7 +494,7 @@ class CircleObject extends Base {
|
|||||||
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -520,7 +520,7 @@ class CircleObject extends Base {
|
|||||||
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1151,7 +1151,7 @@ class CircleObject extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('circle-object-edit-tabs', undefined, this.sdk)
|
let tabsElm = new cy_tabs('circle-object-edit-tabs', undefined, this.sdk)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1165,7 +1165,7 @@ class CircleObject extends Base {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let linecolorPicker = new ewPlugins('colorpicker', {
|
let linecolorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("lineColor")[0],
|
el: contentElm.getElementsByClassName("lineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1179,7 +1179,7 @@ class CircleObject extends Base {
|
|||||||
this.lineColor = 'rgba(255,255,255,1)'
|
this.lineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelColor")[0],
|
el: contentElm.getElementsByClassName("labelColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1193,7 +1193,7 @@ class CircleObject extends Base {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labellineColorPicker = new ewPlugins('colorpicker', {
|
let labellineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1207,7 +1207,7 @@ class CircleObject extends Base {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -1221,7 +1221,7 @@ class CircleObject extends Base {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -1878,7 +1878,7 @@ class CircleObject extends Base {
|
|||||||
entity = null
|
entity = null
|
||||||
}
|
}
|
||||||
endpoint = that.cartesian3Towgs84(cartesian, that.viewer)
|
endpoint = that.cartesian3Towgs84(cartesian, that.viewer)
|
||||||
let radius = that.computeDistance([that.options.center, endpoint])
|
let radius = that.computeDistance2([that.options.center, endpoint])
|
||||||
that.radius = radius
|
that.radius = radius
|
||||||
|
|
||||||
YJ.Measure.SetMeasureStatus(false)
|
YJ.Measure.SetMeasureStatus(false)
|
||||||
@ -1904,7 +1904,7 @@ class CircleObject extends Base {
|
|||||||
that.event.mouse_move((movement, cartesian) => {
|
that.event.mouse_move((movement, cartesian) => {
|
||||||
entity && (entity.show = true)
|
entity && (entity.show = true)
|
||||||
endpoint = that.cartesian3Towgs84(cartesian, that.viewer)
|
endpoint = that.cartesian3Towgs84(cartesian, that.viewer)
|
||||||
moveRadius = that.computeDistance([that.options.center, endpoint])
|
moveRadius = that.computeDistance2([that.options.center, endpoint])
|
||||||
fromDegreesArray = that.createCircle(that.options.center, moveRadius)
|
fromDegreesArray = that.createCircle(that.options.center, moveRadius)
|
||||||
that.tip.setPosition(
|
that.tip.setPosition(
|
||||||
cartesian,
|
cartesian,
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { attributeElm, labelStyleElm1, labelStyleElm2 } from '../../Element/elm_html'
|
import { attributeElm, labelStyleElm1, labelStyleElm2 } from '../../Element/elm_html'
|
||||||
|
|
||||||
function html(that) {
|
function html(that) {
|
||||||
return `
|
return `
|
||||||
<span class="custom-divider"></span>
|
<span class="custom-divider"></span>
|
||||||
<div class="div-item">
|
<div class="div-item">
|
||||||
<div class="row" style="align-items: flex-start;">
|
<div class="row" style="align-items: flex-start;">
|
||||||
@ -9,22 +9,15 @@ function html(that) {
|
|||||||
<span class="label">名称</span>
|
<span class="label">名称</span>
|
||||||
<input class="input" maxlength="40" type="text" @model="name">
|
<input class="input" maxlength="40" type="text" @model="name">
|
||||||
</div>
|
</div>
|
||||||
<div class="col" style="flex: 0 0 54%;">
|
<div class="col" style="flex: 0 0 56%;">
|
||||||
<div>
|
<div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col input-select-unit-box">
|
<div class="col input-select-unit-box">
|
||||||
<span class="label">原始长度:</span>
|
<div class="input-select-unit"></div>
|
||||||
<input class="input input-text" readonly="readonly" type="text" style="flex: 0 0 130px;" @model="length">
|
<input class="input input-text" readonly="readonly" type="text" style="flex: 0 0 130px;" @model="length">
|
||||||
<div class="input-select-unit"></div>
|
<div class="input-select-unit"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
|
||||||
<div class="col input-select-fit-unit-box">
|
|
||||||
<span class="label">拟合长度:</span>
|
|
||||||
<input class="input input-text" readonly="readonly" type="text" style="flex: 0 0 130px;" @model="fitLength">
|
|
||||||
<div class="input-select-fit-unit"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -24,13 +24,13 @@ class CurvelineObject extends Base {
|
|||||||
* @description 折线
|
* @description 折线
|
||||||
* @param options {object} 线属性
|
* @param options {object} 线属性
|
||||||
* @param options.name{string} 名称
|
* @param options.name{string} 名称
|
||||||
* @param options.width=5{number} 线宽
|
* @param options.width=3{number} 线宽
|
||||||
* @param options.color=#0df89e {string} 颜色
|
* @param options.color=#ff0000 {string} 颜色
|
||||||
* @param options.type=0 {number} 材质类型 0-实线 1-虚线 2-泛光
|
* @param options.type=0 {number} 材质类型 0-实线 1-虚线 2-泛光
|
||||||
* @param options.heightMode{number} 高度模式(0:海拔高度;1:相对高度;2:依附模式)
|
* @param options.heightMode{number} 高度模式(0:海拔高度;1:相对高度;2:依附模式)
|
||||||
* @param options['nose-to-tail']=false {boolean} 首尾相连
|
* @param options['nose-to-tail']=false {boolean} 首尾相连
|
||||||
* @param options.extend=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['extend-color']=#ffde00 {number} 线缓冲颜色
|
||||||
* @param options.show=true {boolean} 显隐
|
* @param options.show=true {boolean} 显隐
|
||||||
* @param {Array.<object>} options.positions 坐标数组 [{lng,lat},...]
|
* @param {Array.<object>} options.positions 坐标数组 [{lng,lat},...]
|
||||||
@ -51,18 +51,19 @@ class CurvelineObject extends Base {
|
|||||||
constructor(sdk, options = {}, _Dialog = {}) {
|
constructor(sdk, options = {}, _Dialog = {}) {
|
||||||
super(sdk, options)
|
super(sdk, options)
|
||||||
this.options.name = options.name || '未命名对象'
|
this.options.name = options.name || '未命名对象'
|
||||||
this.options.width = options.width || 10
|
this.options.width = ((options.width || options.width === 0) ? options.width : 3)
|
||||||
this.options.color = options.color || '#0df89e'
|
this.options.color = options.color || '#ff0000'
|
||||||
this.options.type = options.type ? Number(options.type) : 0
|
this.options.type = options.type ? Number(options.type) : 0
|
||||||
this.options['nose-to-tail'] = options['nose-to-tail'] || false
|
this.options['nose-to-tail'] = options['nose-to-tail'] || false
|
||||||
this.options.extend = options.extend || false
|
this.options.extend = options.extend || false
|
||||||
this.options['length-unit'] = options['length-unit'] || '米'
|
this.options['length-unit'] = options['length-unit'] || '米'
|
||||||
this.options['fit-length-unit'] = options['fit-length-unit'] || '米'
|
this.options['fit-length-unit'] = options['fit-length-unit'] || '米'
|
||||||
|
this.options['words-name'] = options['words-name'] || '空间长度'
|
||||||
this.options['extend-width'] =
|
this.options['extend-width'] =
|
||||||
options['extend-width'] || options['extend-width'] === 0
|
options['extend-width'] || options['extend-width'] === 0
|
||||||
? options['extend-width']
|
? options['extend-width']
|
||||||
: 1
|
: 10
|
||||||
this.options['extend-color'] = options['extend-color'] || '#ffde00'
|
this.options['extend-color'] = options['extend-color'] || 'rgba(255,255,80,0.3)'
|
||||||
this.options.show =
|
this.options.show =
|
||||||
options.show || options.show === false ? options.show : true
|
options.show || options.show === false ? options.show : true
|
||||||
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
|
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
|
||||||
@ -86,8 +87,8 @@ class CurvelineObject extends Base {
|
|||||||
options.label.pixelOffset || options.label.pixelOffset === 0
|
options.label.pixelOffset || options.label.pixelOffset === 0
|
||||||
? options.label.pixelOffset
|
? options.label.pixelOffset
|
||||||
: 20,
|
: 20,
|
||||||
backgroundColor: options.label.backgroundColor || ['#42c6ef', '#42c6ef'],
|
backgroundColor: options.label.backgroundColor || ['#00ffff80', '#00ffff80'],
|
||||||
lineColor: options.label.lineColor || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near:
|
near:
|
||||||
options.label.near || options.label.near === 0
|
options.label.near || options.label.near === 0
|
||||||
@ -116,6 +117,7 @@ class CurvelineObject extends Base {
|
|||||||
this.options.attributeType = options.attributeType || 'richText'
|
this.options.attributeType = options.attributeType || 'richText'
|
||||||
this.operate = {}
|
this.operate = {}
|
||||||
this.nodePoints = []
|
this.nodePoints = []
|
||||||
|
this.unitNum = 0
|
||||||
this.Dialog = _Dialog
|
this.Dialog = _Dialog
|
||||||
if (!this.options.positions || this.options.positions.length < 2) {
|
if (!this.options.positions || this.options.positions.length < 2) {
|
||||||
this._error = '线段最少需要两个坐标!'
|
this._error = '线段最少需要两个坐标!'
|
||||||
@ -143,22 +145,22 @@ class CurvelineObject extends Base {
|
|||||||
return this.options.color
|
return this.options.color
|
||||||
}
|
}
|
||||||
set color(v) {
|
set color(v) {
|
||||||
this.options.color = v
|
this.options.color = v || '#ff0000'
|
||||||
this.entity.polyline.material = this.getMaterial(v, this.options.type)
|
this.entity.polyline.material = this.getMaterial(v, this.options.type)
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
defaultColor: v,
|
defaultColor: this.options.color,
|
||||||
disabled: false, //是否禁止打开颜色选择器
|
disabled: false, //是否禁止打开颜色选择器
|
||||||
openPickerAni: 'opacity', //打开颜色选择器动画
|
openPickerAni: 'opacity', //打开颜色选择器动画
|
||||||
sure: c => {
|
sure: c => {
|
||||||
this.color = c
|
this.color = c
|
||||||
}, //点击确认按钮事件回调
|
}, //点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,0,0,1)'
|
||||||
} //点击清空按钮事件回调
|
} //点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.color[i] = colorPicker
|
this._elms.color[i] = colorPicker
|
||||||
@ -172,6 +174,8 @@ class CurvelineObject extends Base {
|
|||||||
|
|
||||||
set length(v) {
|
set length(v) {
|
||||||
this.options.length = v
|
this.options.length = v
|
||||||
|
//判断数值是否大于1000m
|
||||||
|
|
||||||
this._elms.length &&
|
this._elms.length &&
|
||||||
this._elms.length.forEach(item => {
|
this._elms.length.forEach(item => {
|
||||||
item.value = v
|
item.value = v
|
||||||
@ -194,25 +198,60 @@ class CurvelineObject extends Base {
|
|||||||
return this.options['length-unit']
|
return this.options['length-unit']
|
||||||
}
|
}
|
||||||
set lengthUnit(v) {
|
set lengthUnit(v) {
|
||||||
|
this.unitNum++
|
||||||
this.options['length-unit'] = v
|
this.options['length-unit'] = v
|
||||||
this._elms.lengthUnit &&
|
this._elms.lengthUnit &&
|
||||||
this._elms.lengthUnit.forEach(item => {
|
this._elms.lengthUnit.forEach(item => {
|
||||||
item.value = v
|
item.value = v
|
||||||
})
|
})
|
||||||
if (this.options.lengthByMeter) {
|
if (this.options.lengthByMeter) {
|
||||||
switch (v) {
|
if (this.unitNum > 2) {
|
||||||
case '米':
|
switch (v) {
|
||||||
this.length = this.options.lengthByMeter
|
case '米':
|
||||||
break
|
this.length = this.noseToTail ? this.options.fitLengthByMeter : this.options.lengthByMeter
|
||||||
case '千米':
|
|
||||||
this.length = (this.options.lengthByMeter / 1000).toFixed(5)
|
break
|
||||||
break
|
case '千米':
|
||||||
default:
|
this.length = this.noseToTail ? (this.options.fitLengthByMeter / 1000).toFixed(5) : (this.options.lengthByMeter / 1000).toFixed(5)
|
||||||
this.length = this.options.lengthByMeter
|
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
this.length = this.noseToTail ? this.options.fitLengthByMeter : this.options.lengthByMeter
|
||||||
|
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let length = this.noseToTail ? this.options.fitLengthByMeter : this.options.lengthByMeter
|
||||||
|
this.lengthUnit = length > 1000 || length == 1000 ? '千米' : '米'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get wordsName() {
|
||||||
|
return this.options['words-name']
|
||||||
|
}
|
||||||
|
set wordsName(v) {
|
||||||
|
this.options['words-name'] = v
|
||||||
|
this._elms.wordsName &&
|
||||||
|
this._elms.wordsName.forEach(item => {
|
||||||
|
item.value = v
|
||||||
|
})
|
||||||
|
|
||||||
|
let _this = this
|
||||||
|
if (!this.noseToTail) {
|
||||||
|
this.computeDistance(
|
||||||
|
this.smoothHandle(this.options.positions),
|
||||||
|
2,
|
||||||
|
v
|
||||||
|
).then(res => {
|
||||||
|
_this.options.lengthByMeter = res
|
||||||
|
_this.lengthUnit = this.options['length-unit']
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
let fromDegreesArray = this.renewPositions(this.options.positions)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
get fitLengthUnit() {
|
get fitLengthUnit() {
|
||||||
return this.options['fit-length-unit']
|
return this.options['fit-length-unit']
|
||||||
}
|
}
|
||||||
@ -243,10 +282,10 @@ class CurvelineObject extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set lineWidth(v) {
|
set lineWidth(v) {
|
||||||
this.options.width = v
|
this.options.width = (v || v == 0) ? v : 3
|
||||||
this._elms.lineWidth &&
|
this._elms.lineWidth &&
|
||||||
this._elms.lineWidth.forEach(item => {
|
this._elms.lineWidth.forEach(item => {
|
||||||
item.value = v
|
item.value = this.options.width
|
||||||
})
|
})
|
||||||
this.entity &&
|
this.entity &&
|
||||||
this.entity.polyline &&
|
this.entity.polyline &&
|
||||||
@ -310,8 +349,28 @@ class CurvelineObject extends Base {
|
|||||||
)
|
)
|
||||||
this.renewPolygon(fromDegreesArray)
|
this.renewPolygon(fromDegreesArray)
|
||||||
}
|
}
|
||||||
|
this.lengthUnit = this.options['length-unit']
|
||||||
|
// if (v) {
|
||||||
|
// if (this.options.fitLengthByMeter > 1000 || this.options.fitLengthByMeter == 1000) {
|
||||||
|
// let dom = document.getElementsByClassName('input-select-unit')[1]
|
||||||
|
// dom && dom.querySelectorAll('dd')[1] && dom.querySelectorAll('dd')[1].click()
|
||||||
|
// } else {
|
||||||
|
// let dom = document.getElementsByClassName('input-select-unit')[1]
|
||||||
|
// dom && dom.querySelectorAll('dd')[0] && dom.querySelectorAll('dd')[0].click()
|
||||||
|
// }
|
||||||
|
|
||||||
|
// } else {
|
||||||
|
// if (this.options.lengthByMeter > 1000 || this.options.lengthByMeter == 1000) {
|
||||||
|
// let dom = document.getElementsByClassName('input-select-unit')[1]
|
||||||
|
// dom && dom.querySelectorAll('dd')[1] && dom.querySelectorAll('dd')[1].click()
|
||||||
|
// } else {
|
||||||
|
// let dom = document.getElementsByClassName('input-select-unit')[1]
|
||||||
|
// dom && dom.querySelectorAll('dd')[0] && dom.querySelectorAll('dd')[0].click()
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
get heightMode() {
|
get heightMode() {
|
||||||
return this.options.heightMode ? this.options.heightMode : 0
|
return this.options.heightMode ? this.options.heightMode : 0
|
||||||
}
|
}
|
||||||
@ -349,11 +408,11 @@ class CurvelineObject extends Base {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
this.options.lengthByMeter = this.computeDistance(
|
// this.options.lengthByMeter = this.computeDistance2(
|
||||||
this.smoothHandle(this.options.positions),
|
// this.smoothHandle(this.options.positions),
|
||||||
2,
|
// 2,
|
||||||
ground
|
// ground
|
||||||
)
|
// )
|
||||||
this.lengthUnit = this.lengthUnit
|
this.lengthUnit = this.lengthUnit
|
||||||
this._elms.heightMode && (this._elms.heightMode.value = heightModeName)
|
this._elms.heightMode && (this._elms.heightMode.value = heightModeName)
|
||||||
this._elms.heightModeObject && (this._elms.heightModeObject.legp_searchActive(
|
this._elms.heightModeObject && (this._elms.heightModeObject.legp_searchActive(
|
||||||
@ -438,7 +497,7 @@ class CurvelineObject extends Base {
|
|||||||
this.options['extend-color'] = v
|
this.options['extend-color'] = v
|
||||||
if (this._elms.extendColor) {
|
if (this._elms.extendColor) {
|
||||||
this._elms.extendColor.forEach((item, i) => {
|
this._elms.extendColor.forEach((item, i) => {
|
||||||
let extendColorPicker = new ewPlugins('colorpicker', {
|
let extendColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
@ -508,7 +567,7 @@ class CurvelineObject extends Base {
|
|||||||
this.label.color = v
|
this.label.color = v
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
@ -612,7 +671,7 @@ class CurvelineObject extends Base {
|
|||||||
this.label.lineColor = v
|
this.label.lineColor = v
|
||||||
if (this._elms.labelLineColor) {
|
if (this._elms.labelLineColor) {
|
||||||
this._elms.labelLineColor.forEach((item, i) => {
|
this._elms.labelLineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
@ -623,7 +682,7 @@ class CurvelineObject extends Base {
|
|||||||
this.labelLineColor = color
|
this.labelLineColor = color
|
||||||
}, //点击确认按钮事件回调
|
}, //点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(0,255,255,0.5)'
|
||||||
} //点击清空按钮事件回调
|
} //点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.labelLineColor[i] = lineColorPicker
|
this._elms.labelLineColor[i] = lineColorPicker
|
||||||
@ -639,7 +698,7 @@ class CurvelineObject extends Base {
|
|||||||
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
@ -667,7 +726,7 @@ class CurvelineObject extends Base {
|
|||||||
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
@ -1157,22 +1216,35 @@ class CurvelineObject extends Base {
|
|||||||
CurvelineObject.createLabel(that)
|
CurvelineObject.createLabel(that)
|
||||||
// that.entity.polyline.positionsLngLat = positions
|
// that.entity.polyline.positionsLngLat = positions
|
||||||
that.renewPolygon(fromDegreesArray)
|
that.renewPolygon(fromDegreesArray)
|
||||||
that.options.lengthByMeter = that.computeDistance(that.smoothHandle(positions), 2, ground)
|
// that.options.lengthByMeter = that.computeDistance2(that.smoothHandle(positions), 2, ground)
|
||||||
that.lengthUnit = that.options['length-unit']
|
// that.lengthUnit = that.options['length-unit']
|
||||||
syncData(that.sdk, that.options.id)
|
// syncData(that.sdk, that.options.id)
|
||||||
if (that.options.show) {
|
// if (that.options.show) {
|
||||||
setSplitDirection(0, that.options.id)
|
// setSplitDirection(0, that.options.id)
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
that.computeDistance(
|
||||||
|
that.smoothHandle(positions),
|
||||||
|
2,
|
||||||
|
that.options['words-name']
|
||||||
|
).then(res => {
|
||||||
|
that.options.lengthByMeter = res
|
||||||
|
that.lengthUnit = that.options['length-unit']
|
||||||
|
syncData(that.sdk, that.options.id)
|
||||||
|
if (that.options.show) {
|
||||||
|
setSplitDirection(0, that.options.id)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// if (this.options['nose-to-tail']) {
|
// if (this.options['nose-to-tail']) {
|
||||||
// let array = []
|
// let array = []
|
||||||
// for (let i = 0; i < fromDegreesArray.length; i += 2) {
|
// for (let i = 0; i < fromDegreesArray.length; i += 2) {
|
||||||
// array.push({ lng: fromDegreesArray[i], lat: fromDegreesArray[i + 1] })
|
// array.push({ lng: fromDegreesArray[i], lat: fromDegreesArray[i + 1] })
|
||||||
// }
|
// }
|
||||||
// this.options.fit_length = tool.computeDistance(array)
|
// this.options.fit_length = tool.computeDistance2(array)
|
||||||
// }
|
// }
|
||||||
// else {
|
// else {
|
||||||
// this.options.fit_length = tool.computeDistance(positions)
|
// this.options.fit_length = tool.computeDistance2(positions)
|
||||||
// }
|
// }
|
||||||
// if (this.options.fit_length_unit === 'km') {
|
// if (this.options.fit_length_unit === 'km') {
|
||||||
// this.options.fit_length = this.options.fit_length / 1000
|
// this.options.fit_length = this.options.fit_length / 1000
|
||||||
@ -1263,7 +1335,7 @@ class CurvelineObject extends Base {
|
|||||||
this.sdk
|
this.sdk
|
||||||
)
|
)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName('color')[0],
|
el: contentElm.getElementsByClassName('color')[0],
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
@ -1277,7 +1349,7 @@ class CurvelineObject extends Base {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
} //点击清空按钮事件回调
|
} //点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName('labelColor')[0],
|
el: contentElm.getElementsByClassName('labelColor')[0],
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
@ -1291,7 +1363,7 @@ class CurvelineObject extends Base {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
} //点击清空按钮事件回调
|
} //点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let extendColorPicker = new ewPlugins('colorpicker', {
|
let extendColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName('extendColor')[0],
|
el: contentElm.getElementsByClassName('extendColor')[0],
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
@ -1305,7 +1377,7 @@ class CurvelineObject extends Base {
|
|||||||
this.extendColor = 'rgba(255,255,255,1)'
|
this.extendColor = 'rgba(255,255,255,1)'
|
||||||
} //点击清空按钮事件回调
|
} //点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName('labelLineColor')[0],
|
el: contentElm.getElementsByClassName('labelLineColor')[0],
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
@ -1319,7 +1391,7 @@ class CurvelineObject extends Base {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
} //点击清空按钮事件回调
|
} //点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName('labelBackgroundColorStart')[0],
|
el: contentElm.getElementsByClassName('labelBackgroundColorStart')[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -1333,7 +1405,7 @@ class CurvelineObject extends Base {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName('labelBackgroundColorEnd')[0],
|
el: contentElm.getElementsByClassName('labelBackgroundColorEnd')[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -1389,6 +1461,50 @@ class CurvelineObject extends Base {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let nameData = [
|
||||||
|
{
|
||||||
|
name: '空间长度',
|
||||||
|
value: '空间长度'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '投影长度',
|
||||||
|
value: '投影长度'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '地表长度',
|
||||||
|
value: '地表长度'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
let nameDataLegpObject = legp(
|
||||||
|
this._DialogObject._element.content.getElementsByClassName(
|
||||||
|
'input-select-unit-box'
|
||||||
|
)[0],
|
||||||
|
'.input-select-unit'
|
||||||
|
)
|
||||||
|
if (nameDataLegpObject) {
|
||||||
|
nameDataLegpObject.legp_search(nameData)
|
||||||
|
let nameDataLegpElm = this._DialogObject._element.content
|
||||||
|
.getElementsByClassName('input-select-unit')[0]
|
||||||
|
.getElementsByTagName('input')[0]
|
||||||
|
this._elms.wordsName = [nameDataLegpElm]
|
||||||
|
nameDataLegpElm.value = this.options['words-name']
|
||||||
|
for (let i = 0; i < nameData.length; i++) {
|
||||||
|
if (nameData[i].value === nameDataLegpElm.value) {
|
||||||
|
nameDataLegpObject.legp_searchActive(nameData[i].value)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nameDataLegpElm.addEventListener('input', () => {
|
||||||
|
for (let i = 0; i < nameData.length; i++) {
|
||||||
|
if (nameData[i].value === nameDataLegpElm.value) {
|
||||||
|
this.wordsName = nameData[i].value
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 原始长度单位
|
// 原始长度单位
|
||||||
let unitData = [
|
let unitData = [
|
||||||
{
|
{
|
||||||
@ -1405,12 +1521,13 @@ class CurvelineObject extends Base {
|
|||||||
this._DialogObject._element.content.getElementsByClassName(
|
this._DialogObject._element.content.getElementsByClassName(
|
||||||
'input-select-unit-box'
|
'input-select-unit-box'
|
||||||
)[0],
|
)[0],
|
||||||
'.input-select-unit'
|
'.input-select-unit',
|
||||||
|
1
|
||||||
)
|
)
|
||||||
if (unitDataLegpObject) {
|
if (unitDataLegpObject) {
|
||||||
unitDataLegpObject.legp_search(unitData)
|
unitDataLegpObject.legp_search(unitData)
|
||||||
let unitDataLegpElm = this._DialogObject._element.content
|
let unitDataLegpElm = this._DialogObject._element.content
|
||||||
.getElementsByClassName('input-select-unit')[0]
|
.getElementsByClassName('input-select-unit')[1]
|
||||||
.getElementsByTagName('input')[0]
|
.getElementsByTagName('input')[0]
|
||||||
this._elms.lengthUnit = [unitDataLegpElm]
|
this._elms.lengthUnit = [unitDataLegpElm]
|
||||||
unitDataLegpElm.value = this.options['length-unit']
|
unitDataLegpElm.value = this.options['length-unit']
|
||||||
@ -1431,45 +1548,45 @@ class CurvelineObject extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 拟合长度单位
|
// 拟合长度单位
|
||||||
let fitUnitData = [
|
// let fitUnitData = [
|
||||||
{
|
// {
|
||||||
name: '米',
|
// name: '米',
|
||||||
value: '米'
|
// value: '米'
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
name: '千米',
|
// name: '千米',
|
||||||
value: '千米'
|
// value: '千米'
|
||||||
}
|
// }
|
||||||
]
|
// ]
|
||||||
|
|
||||||
let fitUnitDataLegpObject = legp(
|
// let fitUnitDataLegpObject = legp(
|
||||||
this._DialogObject._element.content.getElementsByClassName(
|
// this._DialogObject._element.content.getElementsByClassName(
|
||||||
'input-select-fit-unit-box'
|
// 'input-select-fit-unit-box'
|
||||||
)[0],
|
// )[0],
|
||||||
'.input-select-fit-unit'
|
// '.input-select-fit-unit'
|
||||||
)
|
// )
|
||||||
if (fitUnitDataLegpObject) {
|
// if (fitUnitDataLegpObject) {
|
||||||
fitUnitDataLegpObject.legp_search(fitUnitData)
|
// fitUnitDataLegpObject.legp_search(fitUnitData)
|
||||||
let fitUnitDataLegpElm = this._DialogObject._element.content
|
// let fitUnitDataLegpElm = this._DialogObject._element.content
|
||||||
.getElementsByClassName('input-select-fit-unit')[0]
|
// .getElementsByClassName('input-select-fit-unit')[0]
|
||||||
.getElementsByTagName('input')[0]
|
// .getElementsByTagName('input')[0]
|
||||||
this._elms.fitLengthUnit = [fitUnitDataLegpElm]
|
// this._elms.fitLengthUnit = [fitUnitDataLegpElm]
|
||||||
fitUnitDataLegpElm.value = this.options['fit-length-unit']
|
// fitUnitDataLegpElm.value = this.options['fit-length-unit']
|
||||||
for (let i = 0; i < fitUnitData.length; i++) {
|
// for (let i = 0; i < fitUnitData.length; i++) {
|
||||||
if (fitUnitData[i].value === fitUnitDataLegpElm.value) {
|
// if (fitUnitData[i].value === fitUnitDataLegpElm.value) {
|
||||||
fitUnitDataLegpObject.legp_searchActive(fitUnitData[i].value)
|
// fitUnitDataLegpObject.legp_searchActive(fitUnitData[i].value)
|
||||||
break
|
// break
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
fitUnitDataLegpElm.addEventListener('input', () => {
|
// fitUnitDataLegpElm.addEventListener('input', () => {
|
||||||
for (let i = 0; i < fitUnitData.length; i++) {
|
// for (let i = 0; i < fitUnitData.length; i++) {
|
||||||
if (fitUnitData[i].value === fitUnitDataLegpElm.value) {
|
// if (fitUnitData[i].value === fitUnitDataLegpElm.value) {
|
||||||
this.fitLengthUnit = fitUnitData[i].value
|
// this.fitLengthUnit = fitUnitData[i].value
|
||||||
break
|
// break
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
|
|
||||||
let lineTypeData = [
|
let lineTypeData = [
|
||||||
{
|
{
|
||||||
@ -1848,22 +1965,74 @@ class CurvelineObject extends Base {
|
|||||||
|
|
||||||
|
|
||||||
// 计算长度
|
// 计算长度
|
||||||
let array = []
|
// let array = []
|
||||||
for (let i = 0; i < fromDegreesArray.length; i += 3) {
|
// for (let i = 0; i < fromDegreesArray.length; i += 3) {
|
||||||
array.push({
|
// array.push({
|
||||||
lng: fromDegreesArray[i],
|
// lng: fromDegreesArray[i],
|
||||||
lat: fromDegreesArray[i + 1],
|
// lat: fromDegreesArray[i + 1],
|
||||||
alt: fromDegreesArray[i + 2]
|
// alt: fromDegreesArray[i + 2]
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// this.options.fitLengthByMeter = this.computeDistance2(
|
||||||
|
// array,
|
||||||
|
// 2,
|
||||||
|
// ground
|
||||||
|
// )
|
||||||
|
// this.fitLengthUnit = this.options['fit-length-unit']
|
||||||
|
// this.options.lengthByMeter = this.computeDistance2(this.smoothHandle(positions), 2, ground)
|
||||||
|
// this.lengthUnit = this.options['length-unit']
|
||||||
|
|
||||||
|
|
||||||
|
if (
|
||||||
|
(this.options['nose-to-tail'] &&
|
||||||
|
this.options['nose-to-tail'] !== 'false') ||
|
||||||
|
(this.options.smooth && this.options.smooth !== 'false')
|
||||||
|
) {
|
||||||
|
let array = []
|
||||||
|
for (let i = 0; i < fromDegreesArray.length; i += 3) {
|
||||||
|
array.push({
|
||||||
|
lng: fromDegreesArray[i],
|
||||||
|
lat: fromDegreesArray[i + 1],
|
||||||
|
alt: fromDegreesArray[i + 2]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// this.options.fitLengthByMeter = this.computeDistance(
|
||||||
|
// array,
|
||||||
|
// 2,
|
||||||
|
// ground
|
||||||
|
// )
|
||||||
|
let _this = this
|
||||||
|
this.computeDistance(
|
||||||
|
array,
|
||||||
|
2,
|
||||||
|
this.options['words-name']
|
||||||
|
).then(res => {
|
||||||
|
_this.options.fitLengthByMeter = res
|
||||||
|
_this.lengthUnit = _this.options['length-unit']
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
let _this = this
|
||||||
|
this.computeDistance(
|
||||||
|
_this.smoothHandle(positions),
|
||||||
|
2,
|
||||||
|
this.options['words-name']
|
||||||
|
).then(res => {
|
||||||
|
_this.options.fitLengthByMeter = res
|
||||||
|
_this.lengthUnit = _this.options['length-unit']
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.options.fitLengthByMeter = this.computeDistance(
|
|
||||||
array,
|
let _this = this
|
||||||
|
this.computeDistance(
|
||||||
|
this.smoothHandle(positions),
|
||||||
2,
|
2,
|
||||||
ground
|
this.options['words-name']
|
||||||
)
|
).then(res => {
|
||||||
this.fitLengthUnit = this.options['fit-length-unit']
|
_this.options.lengthByMeter = res
|
||||||
this.options.lengthByMeter = this.computeDistance(this.smoothHandle(positions), 2, ground)
|
_this.lengthUnit = this.options['length-unit']
|
||||||
this.lengthUnit = this.options['length-unit']
|
})
|
||||||
|
|
||||||
return fromDegreesArray
|
return fromDegreesArray
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2035,7 +2204,7 @@ class CurvelineObject extends Base {
|
|||||||
)[0].value
|
)[0].value
|
||||||
) {
|
) {
|
||||||
this.options.attribute.vr.content.push({
|
this.options.attribute.vr.content.push({
|
||||||
name: '全景图' ,
|
name: '全景图',
|
||||||
url: this._DialogObject._element.content.getElementsByClassName(
|
url: this._DialogObject._element.content.getElementsByClassName(
|
||||||
'vr_add'
|
'vr_add'
|
||||||
)[0].value
|
)[0].value
|
||||||
@ -2051,7 +2220,7 @@ class CurvelineObject extends Base {
|
|||||||
|
|
||||||
addAttributeRr(vr) {
|
addAttributeRr(vr) {
|
||||||
this.options.attribute.vr.content.push({
|
this.options.attribute.vr.content.push({
|
||||||
name: '全景图' ,
|
name: '全景图',
|
||||||
url: vr
|
url: vr
|
||||||
})
|
})
|
||||||
this.attributeVr = this.options.attribute.vr.content
|
this.attributeVr = this.options.attribute.vr.content
|
||||||
@ -2234,7 +2403,7 @@ class CurvelineObject extends Base {
|
|||||||
// )
|
// )
|
||||||
// let fromDegreesArray = that.renewPositions(that.options.positions)
|
// let fromDegreesArray = that.renewPositions(that.options.positions)
|
||||||
// that.renewPolygon(fromDegreesArray)
|
// that.renewPolygon(fromDegreesArray)
|
||||||
// that.options.lengthByMeter = that.computeDistance(
|
// that.options.lengthByMeter = that.computeDistance2(
|
||||||
// that.options.positions,
|
// that.options.positions,
|
||||||
// 2,
|
// 2,
|
||||||
// that.ground
|
// that.ground
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* 圆
|
* 椭圆
|
||||||
*/
|
*/
|
||||||
import Dialog from '../../Element/Dialog';
|
import Dialog from '../../Element/Dialog';
|
||||||
import cy_tabs from "../../Element/cy_html_tabs";
|
import cy_tabs from "../../Element/cy_html_tabs";
|
||||||
@ -24,7 +24,7 @@ class EllipseObject extends Base {
|
|||||||
* @param options.name {string} 名称
|
* @param options.name {string} 名称
|
||||||
* @param options.show=true {boolean} 显示/隐藏
|
* @param options.show=true {boolean} 显示/隐藏
|
||||||
* @param options.center {object} 位置
|
* @param options.center {object} 位置
|
||||||
* @param options.color="#36c4ff" {string} 颜色
|
* @param options.color="rgba(255, 0, 0, 0.5)" {string} 颜色
|
||||||
* @param options.center.lng {object} 经度
|
* @param options.center.lng {object} 经度
|
||||||
* @param options.center.lat {object} 维度
|
* @param options.center.lat {object} 维度
|
||||||
* @param options.semiMinorAxis=10 {number} 短半轴长度
|
* @param options.semiMinorAxis=10 {number} 短半轴长度
|
||||||
@ -32,22 +32,22 @@ class EllipseObject extends Base {
|
|||||||
* @param options.bearing=0 {number} 旋转角度
|
* @param options.bearing=0 {number} 旋转角度
|
||||||
* @param options.line {object} 边框
|
* @param options.line {object} 边框
|
||||||
* @param options.line.width=2 {string} 边框宽
|
* @param options.line.width=2 {string} 边框宽
|
||||||
* @param options.line.color="rgba(155, 155, 124, 0.89)" {string} 边框颜色
|
* @param options.line.color="rgba(255, 0, 0, 1)" {string} 边框颜色
|
||||||
* @param options.label {object} 标注
|
* @param options.label {object} 标注
|
||||||
* @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式)
|
* @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式)
|
||||||
*/
|
*/
|
||||||
constructor(sdk, options = {}) {
|
constructor(sdk, options = {}) {
|
||||||
super(sdk, options);
|
super(sdk, options);
|
||||||
this.options.name = options.name || '未命名对象'
|
this.options.name = options.name || '未命名对象'
|
||||||
this.options.color = options.color || "#36c4ff"
|
this.options.color = options.color || "rgba(255, 0, 0, 0.5)"
|
||||||
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
|
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
|
||||||
this.options.semiMinorAxis = (options.semiMinorAxis || options.semiMinorAxis === 0) ? options.semiMinorAxis : 10
|
this.options.semiMinorAxis = (options.semiMinorAxis || options.semiMinorAxis === 0) ? options.semiMinorAxis : 10
|
||||||
this.options.semiMajorAxis = (options.semiMajorAxis || options.semiMajorAxis === 0) ? options.semiMajorAxis : 20
|
this.options.semiMajorAxis = (options.semiMajorAxis || options.semiMajorAxis === 0) ? options.semiMajorAxis : 20
|
||||||
this.options.show = (options.show || options.show === false) ? options.show : true
|
this.options.show = (options.show || options.show === false) ? options.show : true
|
||||||
this.options.center = options.center || {}
|
this.options.center = options.center || {}
|
||||||
this.options.line = options.line || {}
|
this.options.line = options.line || {}
|
||||||
this.options.line.width = this.options.line.width || 2
|
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(155, 155, 124, 0.89)'
|
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)'
|
||||||
this.options['area-unit'] = options['area-unit'] || '平方米'
|
this.options['area-unit'] = options['area-unit'] || '平方米'
|
||||||
options.label = options.label || {}
|
options.label = options.label || {}
|
||||||
this._elms = {};
|
this._elms = {};
|
||||||
@ -60,8 +60,8 @@ class EllipseObject extends Base {
|
|||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
||||||
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
|
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 || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
@ -229,32 +229,32 @@ class EllipseObject extends Base {
|
|||||||
return this.options.color
|
return this.options.color
|
||||||
}
|
}
|
||||||
set color(v) {
|
set color(v) {
|
||||||
this.options.color = v
|
this.options.color = v || 'rgba(255, 0, 0, 0.5)'
|
||||||
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) {
|
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let material = Cesium.Color.fromCssColorString(v)
|
let material = Cesium.Color.fromCssColorString(this.options.color)
|
||||||
if (this.sdk.viewer.scene.mode === 2) {
|
if (this.sdk.viewer.scene.mode === 2) {
|
||||||
material = new Cesium.CustomColorMaterialSource({
|
material = new Cesium.CustomColorMaterialSource({
|
||||||
color: v
|
color: this.options.color
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.entity.polygon.material = material
|
this.entity.polygon.material = material
|
||||||
this.entity.polyline.width = this.lineWidth
|
this.entity.polyline.width = this.lineWidth
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
defaultColor: v,
|
defaultColor: this.options.color,
|
||||||
disabled: false,//是否禁止打开颜色选择器
|
disabled: false,//是否禁止打开颜色选择器
|
||||||
openPickerAni: 'opacity',//打开颜色选择器动画
|
openPickerAni: 'opacity',//打开颜色选择器动画
|
||||||
sure: (c) => {
|
sure: (c) => {
|
||||||
this.color = c
|
this.color = c
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,0,0,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.color[i] = colorPicker
|
this._elms.color[i] = colorPicker
|
||||||
@ -266,25 +266,25 @@ class EllipseObject extends Base {
|
|||||||
return this.options.line.color
|
return this.options.line.color
|
||||||
}
|
}
|
||||||
set lineColor(v) {
|
set lineColor(v) {
|
||||||
this.options.line.color = v
|
this.options.line.color = v || 'rgba(255, 0, 0, 0.5)'
|
||||||
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) {
|
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.entity.polyline.material = Cesium.Color.fromCssColorString(v)
|
this.entity.polyline.material = Cesium.Color.fromCssColorString(this.options.line.color)
|
||||||
if (this._elms.lineColor) {
|
if (this._elms.lineColor) {
|
||||||
this._elms.lineColor.forEach((item, i) => {
|
this._elms.lineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
defaultColor: v,
|
defaultColor: this.options.line.color,
|
||||||
disabled: false,//是否禁止打开颜色选择器
|
disabled: false,//是否禁止打开颜色选择器
|
||||||
openPickerAni: 'opacity',//打开颜色选择器动画
|
openPickerAni: 'opacity',//打开颜色选择器动画
|
||||||
sure: (c) => {
|
sure: (c) => {
|
||||||
this.lineColor = c
|
this.lineColor = c
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.lineColor = 'rgba(255,255,255,1)'
|
this.lineColor = 'rgba(255,0,0,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.lineColor[i] = lineColorPicker
|
this._elms.lineColor[i] = lineColorPicker
|
||||||
@ -296,10 +296,10 @@ class EllipseObject extends Base {
|
|||||||
return this.options.line.width
|
return this.options.line.width
|
||||||
}
|
}
|
||||||
set lineWidth(v) {
|
set lineWidth(v) {
|
||||||
this.options.line.width = v
|
this.options.line.width = ((v || v === 0) ? v : 3)
|
||||||
this.entity.polyline.width = v
|
this.entity.polyline.width = this.options.line.width
|
||||||
this._elms.lineWidth && this._elms.lineWidth.forEach((item) => {
|
this._elms.lineWidth && this._elms.lineWidth.forEach((item) => {
|
||||||
item.value = v
|
item.value = this.options.line.width
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,7 +381,7 @@ class EllipseObject extends Base {
|
|||||||
this.label.color = v
|
this.label.color = v
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -481,7 +481,7 @@ class EllipseObject extends Base {
|
|||||||
this.label.lineColor = v
|
this.label.lineColor = v
|
||||||
if (this._elms.labelLineColor) {
|
if (this._elms.labelLineColor) {
|
||||||
this._elms.labelLineColor.forEach((item, i) => {
|
this._elms.labelLineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -492,7 +492,7 @@ class EllipseObject extends Base {
|
|||||||
this.labelLineColor = color
|
this.labelLineColor = color
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(0,255,255,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.labelLineColor[i] = lineColorPicker
|
this._elms.labelLineColor[i] = lineColorPicker
|
||||||
@ -508,7 +508,7 @@ class EllipseObject extends Base {
|
|||||||
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -534,7 +534,7 @@ class EllipseObject extends Base {
|
|||||||
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1161,7 +1161,7 @@ class EllipseObject extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('circle-object-edit-tabs', undefined, this.sdk)
|
let tabsElm = new cy_tabs('circle-object-edit-tabs', undefined, this.sdk)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1175,7 +1175,7 @@ class EllipseObject extends Base {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let linecolorPicker = new ewPlugins('colorpicker', {
|
let linecolorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("lineColor")[0],
|
el: contentElm.getElementsByClassName("lineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1189,7 +1189,7 @@ class EllipseObject extends Base {
|
|||||||
this.lineColor = 'rgba(255,255,255,1)'
|
this.lineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelColor")[0],
|
el: contentElm.getElementsByClassName("labelColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1203,7 +1203,7 @@ class EllipseObject extends Base {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labellineColorPicker = new ewPlugins('colorpicker', {
|
let labellineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1217,7 +1217,7 @@ class EllipseObject extends Base {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -1231,7 +1231,7 @@ class EllipseObject extends Base {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
|
|||||||
76
src/Obj/Base/FlowLine/_element.js
Normal file
76
src/Obj/Base/FlowLine/_element.js
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
function html() {
|
||||||
|
return `
|
||||||
|
<span class="custom-divider"></span>
|
||||||
|
<div class="div-item">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<span class="label">名称</span>
|
||||||
|
<input class="input" maxlength="40" type="text" @model="name">
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<span class="label">颜色</span>
|
||||||
|
<div class="flowLine-color"></div>
|
||||||
|
</div>
|
||||||
|
</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-1">
|
||||||
|
<input class="input" type="number" title="" min="1" max="99999" @model="pointNumber">
|
||||||
|
<span class="arrow"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<span class="label">飞线宽度</span>
|
||||||
|
<div class="input-number input-number-unit-1">
|
||||||
|
<input class="input" type="number" title="" max="99999" min="1" step="1" @model="width">
|
||||||
|
<span class="arrow"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="div-item">
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col">
|
||||||
|
<span class="label">飞线高度</span>
|
||||||
|
<div class="input-number input-number-unit-1">
|
||||||
|
<input class="input" type="number" title="" min="0" max="999999" step="1" @model="height">
|
||||||
|
<span class="arrow"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<span class="label">飞线高度差</span>
|
||||||
|
<div class="input-number input-number-unit-1">
|
||||||
|
<input class="input" type="number" title="" max="99999" min="0" step="1" @model="heightDifference">
|
||||||
|
<span class="arrow"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="div-item">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<span class="label">单次运动时长(s)</span>
|
||||||
|
<div class="input-number input-number-unit-1">
|
||||||
|
<input class="input" type="number" title="" max="999999999" min="1" step="1" @model="duration">
|
||||||
|
<span class="arrow"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<span class="label">轨迹透明度</span>
|
||||||
|
<div class="input-number input-number-unit-1">
|
||||||
|
<input class="input" type="number" title="" max="1" min="0.01" step="0.01" @model="lineBackAlpha">
|
||||||
|
<span class="arrow"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<span class="custom-divider"></span>
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|
||||||
|
export { html }
|
||||||
92
src/Obj/Base/FlowLine/eventBinding.js
Normal file
92
src/Obj/Base/FlowLine/eventBinding.js
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
class eventBinding {
|
||||||
|
constructor() {
|
||||||
|
this.element = {}
|
||||||
|
}
|
||||||
|
static event = {}
|
||||||
|
|
||||||
|
getEvent(name) {
|
||||||
|
return eventBinding.event[name]
|
||||||
|
}
|
||||||
|
|
||||||
|
getEventAll() {
|
||||||
|
return eventBinding.event
|
||||||
|
}
|
||||||
|
|
||||||
|
setEvent(name, event) {
|
||||||
|
eventBinding.event[name] = event
|
||||||
|
}
|
||||||
|
|
||||||
|
on(that, elements) {
|
||||||
|
for (let i = 0; i < elements.length; i++) {
|
||||||
|
let Event = []
|
||||||
|
let isEvent = false
|
||||||
|
let removeName = []
|
||||||
|
if (!elements[i] || !elements[i].attributes) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (let m of elements[i].attributes) {
|
||||||
|
switch (m.name) {
|
||||||
|
case '@model': {
|
||||||
|
isEvent = true
|
||||||
|
if (elements[i].type == 'checkbox') {
|
||||||
|
Event.push((e) => { that[m.value] = e.target.checked })
|
||||||
|
elements[i].checked = that[m.value]
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Event.push((e) => {
|
||||||
|
let value = e.target.value
|
||||||
|
if (e.target.type == 'number') {
|
||||||
|
value = Number(value)
|
||||||
|
}
|
||||||
|
that[m.value] = value
|
||||||
|
})
|
||||||
|
if (elements[i].nodeName == 'IMG') {
|
||||||
|
elements[i].src = that[m.value]
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
elements[i].value = that[m.value]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.element[m.value]) {
|
||||||
|
this.element[m.value].push(elements[i])
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.element[m.value] = [elements[i]]
|
||||||
|
}
|
||||||
|
removeName.push(m.name)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case '@click': {
|
||||||
|
elements[i].addEventListener('click', (e) => {
|
||||||
|
if (typeof (that.Dialog[m.value]) === 'function') {
|
||||||
|
that.Dialog[m.value](e)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
removeName.push(m.name)
|
||||||
|
// elements[i].attributes.removeNamedItem(m.name)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// elements[i].attributes[m] = undefined
|
||||||
|
}
|
||||||
|
for (let n = 0; n < removeName.length; n++) {
|
||||||
|
elements[i].attributes.removeNamedItem(removeName[n])
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isEvent) {
|
||||||
|
let ventType = 'input'
|
||||||
|
if (elements[i].tagName != 'INPUT' || elements[i].type == 'checkbox') {
|
||||||
|
ventType = 'change'
|
||||||
|
}
|
||||||
|
elements[i].addEventListener(ventType, (e) => {
|
||||||
|
for (let t = 0; t < Event.length; t++) {
|
||||||
|
Event[t](e)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const EventBinding = new eventBinding();
|
||||||
|
export default EventBinding;
|
||||||
504
src/Obj/Base/FlowLine/index.js
Normal file
504
src/Obj/Base/FlowLine/index.js
Normal file
@ -0,0 +1,504 @@
|
|||||||
|
/**
|
||||||
|
* @description 水面
|
||||||
|
*/
|
||||||
|
import Dialog from '../../Element/Dialog';
|
||||||
|
import { html } from "./_element";
|
||||||
|
import EventBinding from '../../Element/Dialog/eventBinding';
|
||||||
|
import Base from "../index";
|
||||||
|
import { syncData } from '../../../Global/MultiViewportMode'
|
||||||
|
import DrawRect from '../../../Draw/drawRect'
|
||||||
|
import drawPolygon from '../../../Draw/drawPolygon'
|
||||||
|
import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen'
|
||||||
|
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global'
|
||||||
|
import FlowLineMaterialProperty from "../../Materail/FlowLineMaterialProperty";
|
||||||
|
|
||||||
|
class FlowLine extends Base {
|
||||||
|
/**
|
||||||
|
* @constructor
|
||||||
|
* @param sdk
|
||||||
|
* @description 流光飞线
|
||||||
|
* @param options {object} 流光飞线属性
|
||||||
|
* @param options.name=未命名对象 {string} 名称
|
||||||
|
* @param options.pointNumber=300 {number} 线数量
|
||||||
|
* @param options.height=200 {number} 线高度
|
||||||
|
* @param options.heightDifference=3000 {number} 线高度差
|
||||||
|
* @param options.width=2 {number} 线宽
|
||||||
|
* @param options.duration=10.0 {number} 单次运动时间
|
||||||
|
* @param options.color=rgba(255,255,255,1) {string} 颜色
|
||||||
|
* @param options.lineBackAlpha=0.05 {number} 轨迹颜色(不能为0)
|
||||||
|
* @param Dialog {object} 弹框对象
|
||||||
|
* @param Dialog.confirmCallBack {function} 弹框确认时的回调
|
||||||
|
* */
|
||||||
|
constructor(sdk, options = {}, _Dialog = {}) {
|
||||||
|
super(sdk, options);
|
||||||
|
this.viewer = this.sdk.viewer
|
||||||
|
this.options.name = options.name || '飞线'
|
||||||
|
this.options.pointNumber = options.pointNumber || 200
|
||||||
|
this.options.height = options.height || 200
|
||||||
|
this.options.heightDifference = options.heightDifference || 3000
|
||||||
|
this.options.width = options.width || 2
|
||||||
|
this.options.duration = options.duration || 10.0
|
||||||
|
this.options.color = options.color || "rgba(255,255,255,1)"
|
||||||
|
this.options.lineBackAlpha = options.lineBackAlpha || 0.05
|
||||||
|
this.options.positions = options.positions || []
|
||||||
|
this.options.show = (options.show || options.show === false) ? options.show : true
|
||||||
|
this.Dialog = _Dialog
|
||||||
|
this._EventBinding = new EventBinding()
|
||||||
|
this._elms = {};
|
||||||
|
this.positionArea = []
|
||||||
|
this.positions = []
|
||||||
|
this.sdk.addIncetance(this.options.id, this)
|
||||||
|
// FlowLine.create(this)
|
||||||
|
FlowLine.drawLine(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建水面
|
||||||
|
static create(that) {
|
||||||
|
// let Draw = new DrawRect(that.sdk)
|
||||||
|
// Draw.start((a, positions) => {
|
||||||
|
// that.positions = positions
|
||||||
|
// that.getLine(that, that.positions)
|
||||||
|
// that.edit(true)
|
||||||
|
// })
|
||||||
|
|
||||||
|
let Draw = new drawPolygon(that.sdk)
|
||||||
|
Draw.start((a, positions) => {
|
||||||
|
that.positionArea = positions
|
||||||
|
let posis = that.getRandomPointsInCesiumPolygon(positions, that.options.pointNumber)
|
||||||
|
that.positions = posis
|
||||||
|
that.getLine(that, posis)
|
||||||
|
that.edit(true)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
static drawLine(that) {
|
||||||
|
that.positionArea = that.options.positions
|
||||||
|
let posis = that.getRandomPointsInCesiumPolygon(that.options.positions, that.options.pointNumber)
|
||||||
|
that.positions = posis
|
||||||
|
that.getLine(that, posis)
|
||||||
|
// that.edit(true)
|
||||||
|
}
|
||||||
|
getRandomPointsInCesiumPolygon(positions, count) {
|
||||||
|
let lons = [], lats = [], posi = []
|
||||||
|
positions.forEach(item => {
|
||||||
|
lons.push(item.lng)
|
||||||
|
lats.push(item.lat)
|
||||||
|
posi.push([item.lng, item.lat])
|
||||||
|
})
|
||||||
|
posi.push([posi[0][0], posi[0][1]])
|
||||||
|
const minLon = Math.min(...lons), maxLon = Math.max(...lons);
|
||||||
|
const minLat = Math.min(...lats), maxLat = Math.max(...lats);
|
||||||
|
|
||||||
|
const points = [];
|
||||||
|
let that = this
|
||||||
|
while (points.length < count) {
|
||||||
|
const lon = minLon + Math.random() * (maxLon - minLon);
|
||||||
|
const lat = minLat + Math.random() * (maxLat - minLat);
|
||||||
|
// const cartesian = Cesium.Cartesian3.fromDegrees(lon, lat);
|
||||||
|
let point = turf.point([lon, lat]);
|
||||||
|
const polygon = turf.polygon([
|
||||||
|
posi
|
||||||
|
]);
|
||||||
|
|
||||||
|
const isInside = turf.booleanPointInPolygon(point, polygon);
|
||||||
|
if (isInside) {
|
||||||
|
let posi = Cesium.Cartesian3.fromDegrees(lon, lat);
|
||||||
|
const cartographic = that.viewer.scene.globe.ellipsoid.cartesianToCartographic(posi);
|
||||||
|
const height = cartographic.height;
|
||||||
|
|
||||||
|
points.push([
|
||||||
|
lon,
|
||||||
|
lat,
|
||||||
|
height
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return points;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
getLine(that, positions) {
|
||||||
|
let num = 0
|
||||||
|
let celiangEntity = null
|
||||||
|
if (that.viewer.entities.getById(that.options.id)) {
|
||||||
|
that.viewer.entities.getById(that.options.id)._children.forEach((item) => {
|
||||||
|
that.viewer.entities.remove(item);
|
||||||
|
});
|
||||||
|
that.viewer.entities.remove(that.viewer.entities.getById(that.options.id))
|
||||||
|
}
|
||||||
|
celiangEntity = that.viewer.entities.add(new Cesium.Entity({ id: that.options.id, show: that.options.show }))
|
||||||
|
|
||||||
|
positions.forEach((item, index) => {
|
||||||
|
let point = item
|
||||||
|
//根据点设置起始点位置
|
||||||
|
// let start = Cesium.Cartesian3.fromDegrees(point[0], point[1], 0)
|
||||||
|
let start = Cesium.Cartesian3.fromDegrees(point[0], point[1], point[2])
|
||||||
|
//根据点设置结束点位置
|
||||||
|
let end = Cesium.Cartesian3.fromDegrees(point[0], point[1], point[2] + that.options.height + Math.random() * that.options.heightDifference)
|
||||||
|
//创建线
|
||||||
|
that.viewer.entities.add({
|
||||||
|
parent: celiangEntity,
|
||||||
|
id: that.options.id + '-' + new Date().getTime() + index,
|
||||||
|
polyline: {
|
||||||
|
positions: [start, end],
|
||||||
|
width: that.options.width,
|
||||||
|
// material:Cesium.Color.RED
|
||||||
|
material: new Cesium.FlowLineMaterialProperty({
|
||||||
|
color: that.options.color,
|
||||||
|
duration: that.options.duration,
|
||||||
|
lineBackAlpha: that.options.lineBackAlpha,
|
||||||
|
num: num
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
get color() {
|
||||||
|
return this.options.color
|
||||||
|
}
|
||||||
|
|
||||||
|
set color(v) {
|
||||||
|
this.options.color = v
|
||||||
|
let entity = this.viewer.entities.getById(this.options.id)
|
||||||
|
if (entity) {
|
||||||
|
entity._children.forEach(item => {
|
||||||
|
item.polyline.material.color = Cesium.Color.fromCssColorString(v)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._elms.color) {
|
||||||
|
this._elms.color.forEach((item, i) => {
|
||||||
|
let picker = new YJColorPicker({
|
||||||
|
el: item.el,
|
||||||
|
size: 'mini',//颜色box类型
|
||||||
|
alpha: true,//是否开启透明度
|
||||||
|
defaultColor: v,
|
||||||
|
disabled: false,//是否禁止打开颜色选择器
|
||||||
|
openPickerAni: 'opacity',//打开颜色选择器动画
|
||||||
|
sure: (c) => {
|
||||||
|
this.color = c
|
||||||
|
},//点击确认按钮事件回调
|
||||||
|
clear: () => {
|
||||||
|
this.color = 'rgba(255,255,255,1)'
|
||||||
|
},//点击清空按钮事件回调
|
||||||
|
})
|
||||||
|
this._elms.color[i] = picker
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
get pointNumber() {
|
||||||
|
return this.options.pointNumber
|
||||||
|
}
|
||||||
|
set pointNumber(v) {
|
||||||
|
this.options.pointNumber = v
|
||||||
|
let entity = this.viewer.entities.getById(this.options.id)
|
||||||
|
if (entity) {
|
||||||
|
let posis = this.getRandomPointsInCesiumPolygon(this.positionArea, this.options.pointNumber)
|
||||||
|
this.positions = posis
|
||||||
|
this.getLine(this, posis)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
get height() {
|
||||||
|
return this.options.height
|
||||||
|
}
|
||||||
|
|
||||||
|
set height(v) {
|
||||||
|
this.options.height = v
|
||||||
|
let entity = this.viewer.entities.getById(this.options.id)
|
||||||
|
if (entity) {
|
||||||
|
this.getLine(this, this.positions)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
get show() {
|
||||||
|
return this.options.show
|
||||||
|
}
|
||||||
|
|
||||||
|
set show(v) {
|
||||||
|
this.options.show = v
|
||||||
|
let entity = this.viewer.entities.getById(this.options.id)
|
||||||
|
if (entity) {
|
||||||
|
entity.show = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
get heightDifference() {
|
||||||
|
return this.options.heightDifference
|
||||||
|
}
|
||||||
|
|
||||||
|
set heightDifference(v) {
|
||||||
|
this.options.heightDifference = v
|
||||||
|
let entity = this.viewer.entities.getById(this.options.id)
|
||||||
|
if (entity) {
|
||||||
|
this.getLine(this, this.positions)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
get width() {
|
||||||
|
return this.options.width
|
||||||
|
}
|
||||||
|
|
||||||
|
set width(v) {
|
||||||
|
this.options.width = v
|
||||||
|
let entity = this.viewer.entities.getById(this.options.id)
|
||||||
|
if (entity) {
|
||||||
|
entity._children.forEach(item => {
|
||||||
|
item.polyline.width = v
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
get duration() {
|
||||||
|
return this.options.duration
|
||||||
|
}
|
||||||
|
set duration(v) {
|
||||||
|
this.options.duration = v
|
||||||
|
let entity = this.viewer.entities.getById(this.options.id)
|
||||||
|
if (entity) {
|
||||||
|
entity._children.forEach(item => {
|
||||||
|
item.polyline.material.duration = v
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
get lineBackAlpha() {
|
||||||
|
return this.options.lineBackAlpha
|
||||||
|
}
|
||||||
|
set lineBackAlpha(v) {
|
||||||
|
this.options.lineBackAlpha = v
|
||||||
|
let entity = this.viewer.entities.getById(this.options.id)
|
||||||
|
if (entity) {
|
||||||
|
entity._children.forEach(item => {
|
||||||
|
item.polyline.material.lineBackAlpha = v
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 编辑框
|
||||||
|
* @param state=false {boolean} 状态: true打开, false关闭
|
||||||
|
*/
|
||||||
|
async edit(state = false) {
|
||||||
|
let _this = this
|
||||||
|
this.originalOptions = this.deepCopyObj(this.options)
|
||||||
|
|
||||||
|
// let elms = this.sdk.viewer._container.getElementsByClassName('YJ-custom-base-dialog')
|
||||||
|
// for (let i = elms.length - 1; i >= 0; i--) {
|
||||||
|
// this.sdk.viewer._container.removeChild(elms[i])
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (this._DialogObject && this._DialogObject.close) {
|
||||||
|
this._DialogObject.close()
|
||||||
|
this._DialogObject = null
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state) {
|
||||||
|
this._DialogObject = await new Dialog(this.sdk, this.originalOptions, {
|
||||||
|
title: '飞线属性', left: '180px', top: '100px',
|
||||||
|
confirmCallBack: (options) => {
|
||||||
|
this.name = this.name.trim()
|
||||||
|
if (!this.name) {
|
||||||
|
// this.name = '未命名对象'
|
||||||
|
this.name = '飞线'
|
||||||
|
}
|
||||||
|
this.originalOptions = this.deepCopyObj(this.options)
|
||||||
|
this._DialogObject.close()
|
||||||
|
this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(this.originalOptions)
|
||||||
|
syncData(this.sdk, this.options.id)
|
||||||
|
syncSplitData(this.sdk, this.options.id)
|
||||||
|
},
|
||||||
|
resetCallBack: () => {
|
||||||
|
this.reset()
|
||||||
|
this.Dialog.resetCallBack && this.Dialog.resetCallBack()
|
||||||
|
},
|
||||||
|
removeCallBack: () => {
|
||||||
|
this.Dialog.removeCallBack && this.Dialog.removeCallBack()
|
||||||
|
},
|
||||||
|
closeCallBack: () => {
|
||||||
|
this.reset()
|
||||||
|
// this.entity.style = new Cesium.Cesium3DTileStyle({
|
||||||
|
// color: "color('rgba(255,255,255," + this.newData.transparency + ")')",
|
||||||
|
// show: true,
|
||||||
|
// });
|
||||||
|
this.Dialog.closeCallBack && this.Dialog.closeCallBack()
|
||||||
|
},
|
||||||
|
showCallBack: (show) => {
|
||||||
|
this.show = show
|
||||||
|
this.Dialog.showCallBack && this.Dialog.showCallBack()
|
||||||
|
}
|
||||||
|
}, true)
|
||||||
|
this._DialogObject._element.body.className = this._DialogObject._element.body.className + ' flow-line-surface'
|
||||||
|
let contentElm = document.createElement('div');
|
||||||
|
contentElm.innerHTML = html()
|
||||||
|
this._DialogObject.contentAppChild(contentElm)
|
||||||
|
// 颜色组件
|
||||||
|
let waterColorPicker = new YJColorPicker({
|
||||||
|
el: contentElm.getElementsByClassName("flowLine-color")[0],
|
||||||
|
size: 'mini',//颜色box类型
|
||||||
|
alpha: true,//是否开启透明度
|
||||||
|
defaultColor: this.color,
|
||||||
|
disabled: false,//是否禁止打开颜色选择器
|
||||||
|
openPickerAni: 'opacity',//打开颜色选择器动画
|
||||||
|
sure: (color) => {
|
||||||
|
this.color = color
|
||||||
|
},//点击确认按钮事件回调
|
||||||
|
clear: () => {
|
||||||
|
this.color = 'rgba(255,255,255,1)'
|
||||||
|
},//点击清空按钮事件回调
|
||||||
|
})
|
||||||
|
|
||||||
|
let all_elm = contentElm.getElementsByTagName("*")
|
||||||
|
this._EventBinding.on(this, all_elm)
|
||||||
|
this._elms = this._EventBinding.element
|
||||||
|
this._elms.color = [waterColorPicker]
|
||||||
|
} else {
|
||||||
|
// if (this._element_style) {
|
||||||
|
// document.getElementsByTagName('head')[0].removeChild(this._element_style)
|
||||||
|
// this._element_style = null
|
||||||
|
// }
|
||||||
|
// if (this._DialogObject && this._DialogObject.remove) {
|
||||||
|
// this._DialogObject.remove()
|
||||||
|
// this._DialogObject = null
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
reset() {
|
||||||
|
if (!this.viewer.entities.getById(this.options.id)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.name = this.originalOptions.name
|
||||||
|
this.pointNumber = this.originalOptions.pointNumber
|
||||||
|
this.height = this.originalOptions.height
|
||||||
|
this.heightDifference = this.originalOptions.heightDifference
|
||||||
|
this.width = this.originalOptions.width
|
||||||
|
this.duration = this.originalOptions.duration
|
||||||
|
this.color = this.originalOptions.color
|
||||||
|
this.lineBackAlpha = this.originalOptions.lineBackAlpha
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 飞到对应实体
|
||||||
|
*/
|
||||||
|
async flyTo(options = {}) {
|
||||||
|
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 = { lng: 0, lat: 0 }
|
||||||
|
if (this.options.position) {
|
||||||
|
position = { ...this.options.position }
|
||||||
|
}
|
||||||
|
else if (this.options.positions) {
|
||||||
|
position = { ...this.options.positions[0] }
|
||||||
|
}
|
||||||
|
else if (this.options.center) {
|
||||||
|
position = { ...this.options.center }
|
||||||
|
}
|
||||||
|
else if (this.options.start) {
|
||||||
|
position = { ...this.options.start }
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (this.options.hasOwnProperty('lng')) {
|
||||||
|
position.lng = this.options.lng
|
||||||
|
}
|
||||||
|
if (this.options.hasOwnProperty('lat')) {
|
||||||
|
position.lat = this.options.lat
|
||||||
|
}
|
||||||
|
if (this.options.hasOwnProperty('alt')) {
|
||||||
|
position.alt = this.options.alt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 如果没有高度值,则获取紧贴高度计算
|
||||||
|
// 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 positionArray = []
|
||||||
|
for (let i = 0; i < this.positions.length; i++) {
|
||||||
|
let a = Cesium.Cartesian3.fromDegrees(
|
||||||
|
this.positions[i][0],
|
||||||
|
this.positions[i][1],
|
||||||
|
this.positions[i][2] + this.options.height + this.options.heightDifference / 2
|
||||||
|
)
|
||||||
|
positionArray.push(a.x, a.y, a.z)
|
||||||
|
}
|
||||||
|
let BoundingSphere = Cesium.BoundingSphere.fromVertices(positionArray)
|
||||||
|
this.viewer.camera.flyToBoundingSphere(BoundingSphere, {
|
||||||
|
offset: {
|
||||||
|
heading: Cesium.Math.toRadians(0.0),
|
||||||
|
pitch: Cesium.Math.toRadians(-20.0),
|
||||||
|
roll: Cesium.Math.toRadians(0.0)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getSphere() {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
// entity没有加载完成时 state 不会等于0 所以设置定时器直到获取到为止
|
||||||
|
const interval = setInterval(() => {
|
||||||
|
const sphere = new Cesium.BoundingSphere()
|
||||||
|
const state = this.sdk.viewer._dataSourceDisplay.getBoundingSphere(
|
||||||
|
this.viewer.entities.getById(this.options.id),
|
||||||
|
false,
|
||||||
|
sphere
|
||||||
|
)
|
||||||
|
if (state === Cesium.BoundingSphereState.DONE) {
|
||||||
|
clearInterval(interval)
|
||||||
|
}
|
||||||
|
}, 1000)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
async remove() {
|
||||||
|
if (this.viewer.entities.getById(this.options.id)) {
|
||||||
|
this.viewer.entities.getById(this.options.id)._children.forEach((item) => {
|
||||||
|
this.viewer.entities.remove(item);
|
||||||
|
});
|
||||||
|
this.viewer.entities.remove(this.viewer.entities.getById(this.options.id))
|
||||||
|
}
|
||||||
|
this.positions = []
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
flicker() { }
|
||||||
|
}
|
||||||
|
|
||||||
|
export default FlowLine
|
||||||
@ -37,7 +37,7 @@ class Graffiti extends Draw {
|
|||||||
this.options.color = v
|
this.options.color = v
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -77,7 +77,7 @@ class Graffiti extends Draw {
|
|||||||
contentElm.innerHTML = html()
|
contentElm.innerHTML = html()
|
||||||
that._DialogObject.contentAppChild(contentElm)
|
that._DialogObject.contentAppChild(contentElm)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
|
|||||||
@ -8,6 +8,7 @@ function html() {
|
|||||||
<input class="input" maxlength="40" type="text" @model="name">
|
<input class="input" maxlength="40" type="text" @model="name">
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
<button class="anchor btn">调整锚点</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -27,9 +28,9 @@ function html() {
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<span class="label">调整大小</span>
|
<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;">
|
<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>
|
<span class="arrow"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import MouseEvent from '../../../Event/index'
|
|||||||
import { syncData } from '../../../Global/MultiViewportMode'
|
import { syncData } from '../../../Global/MultiViewportMode'
|
||||||
import MouseTip from '../../../MouseTip'
|
import MouseTip from '../../../MouseTip'
|
||||||
import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen'
|
import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen'
|
||||||
import { setActiveViewer, closeRotateAround, closeViewFollow} from '../../../Global/global'
|
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global'
|
||||||
|
|
||||||
class GroundImage extends Base {
|
class GroundImage extends Base {
|
||||||
/**
|
/**
|
||||||
@ -24,7 +24,7 @@ class GroundImage extends Base {
|
|||||||
* @param options.flipe.x=false {boolean} 绕X轴翻转
|
* @param options.flipe.x=false {boolean} 绕X轴翻转
|
||||||
* @param options.flipe.y=false {boolean} 绕Y轴翻转
|
* @param options.flipe.y=false {boolean} 绕Y轴翻转
|
||||||
* @param options.url {string} 图片地址
|
* @param options.url {string} 图片地址
|
||||||
* @param {Array.<object>} options.positions 经纬度和高度的列表,值交替 [{lon,lat,alt},...]
|
* @param {Array.<object>} options.position 经纬度和高度的列表,值交替 [{lon,lat,alt},...]
|
||||||
* @param _Dialog {object} 弹框事件
|
* @param _Dialog {object} 弹框事件
|
||||||
* @param _Dialog.confirmCallBack {function} 弹框确认时的回调
|
* @param _Dialog.confirmCallBack {function} 弹框确认时的回调
|
||||||
* */
|
* */
|
||||||
@ -35,7 +35,8 @@ class GroundImage extends Base {
|
|||||||
this.options.url = options.url
|
this.options.url = options.url
|
||||||
this.options.angle = options.angle || 0
|
this.options.angle = options.angle || 0
|
||||||
this.options.scale = (options.scale || options.scale === 0) ? options.scale : 1
|
this.options.scale = (options.scale || options.scale === 0) ? options.scale : 1
|
||||||
this.options.positions = options.positions
|
this.options.position = options.position
|
||||||
|
this.options.offset = options.offset || { x: 0.5, y: 0.5 }
|
||||||
|
|
||||||
this.options.flipe = options.flipe || {}
|
this.options.flipe = options.flipe || {}
|
||||||
this.options.flipe.x = this.options.flipe.x || false
|
this.options.flipe.x = this.options.flipe.x || false
|
||||||
@ -48,7 +49,7 @@ class GroundImage extends Base {
|
|||||||
this.Dialog = _Dialog
|
this.Dialog = _Dialog
|
||||||
this._elms = {};
|
this._elms = {};
|
||||||
this.previous = {
|
this.previous = {
|
||||||
positions: { ...this.options.positions }
|
position: { ...this.options.position }
|
||||||
}
|
}
|
||||||
this._EventBinding = new EventBinding()
|
this._EventBinding = new EventBinding()
|
||||||
this.event = new MouseEvent(this.sdk)
|
this.event = new MouseEvent(this.sdk)
|
||||||
@ -56,6 +57,39 @@ class GroundImage extends Base {
|
|||||||
this.create()
|
this.create()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get offset() {
|
||||||
|
return this.options.offset
|
||||||
|
}
|
||||||
|
set offset(v) {
|
||||||
|
this.options.offset = v
|
||||||
|
const img = new Image();
|
||||||
|
img.crossOrigin = 'Anonymous';
|
||||||
|
img.src = this.replaceHost(this.options.url, this.options.host);
|
||||||
|
img.onload = () => {
|
||||||
|
const canvas = document.createElement('canvas');
|
||||||
|
const ctx = canvas.getContext('2d');
|
||||||
|
|
||||||
|
// 设置画布大小
|
||||||
|
canvas.width = img.width * 2;
|
||||||
|
canvas.height = img.height * 2;
|
||||||
|
|
||||||
|
// 绘制图像
|
||||||
|
if (this.flipeX) {
|
||||||
|
ctx.scale(1, -1);
|
||||||
|
ctx.translate(0, -canvas.height)
|
||||||
|
}
|
||||||
|
if (this.flipeY) {
|
||||||
|
ctx.scale(-1, 1);
|
||||||
|
ctx.translate(-canvas.width, 0);
|
||||||
|
}
|
||||||
|
ctx.drawImage(img, img.width - (img.width * this.options.offset.x), img.height - (img.height * this.options.offset.y));
|
||||||
|
this.entity.rectangle.material = new Cesium.ImageMaterialProperty({
|
||||||
|
image: canvas,
|
||||||
|
transparent: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
get angle() {
|
get angle() {
|
||||||
return this.options.angle
|
return this.options.angle
|
||||||
}
|
}
|
||||||
@ -87,15 +121,17 @@ class GroundImage extends Base {
|
|||||||
if (!this.entity) {
|
if (!this.entity) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const img = new Image();
|
const img = new Image();
|
||||||
img.src = this.options.url;
|
img.crossOrigin = 'Anonymous';
|
||||||
|
img.src = this.replaceHost(this.options.url, this.options.host);
|
||||||
img.onload = () => {
|
img.onload = () => {
|
||||||
const canvas = document.createElement('canvas');
|
const canvas = document.createElement('canvas');
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
|
|
||||||
// 设置画布大小
|
// 设置画布大小
|
||||||
canvas.width = img.width;
|
canvas.width = img.width * 2;
|
||||||
canvas.height = img.height;
|
canvas.height = img.height * 2;
|
||||||
|
|
||||||
// 绘制图像
|
// 绘制图像
|
||||||
if (this.flipeX) {
|
if (this.flipeX) {
|
||||||
@ -106,11 +142,15 @@ class GroundImage extends Base {
|
|||||||
ctx.scale(-1, 1);
|
ctx.scale(-1, 1);
|
||||||
ctx.translate(-canvas.width, 0);
|
ctx.translate(-canvas.width, 0);
|
||||||
}
|
}
|
||||||
ctx.drawImage(img, 0, 0);
|
ctx.drawImage(img, img.width - (img.width * this.options.offset.x), img.height - (img.height * this.options.offset.y));
|
||||||
this.entity && (this.entity.rectangle.material = new Cesium.ImageMaterialProperty({
|
this.entity && (this.entity.rectangle.material = new Cesium.ImageMaterialProperty({
|
||||||
image: canvas,
|
image: canvas,
|
||||||
transparent: true
|
transparent: true
|
||||||
}))
|
}))
|
||||||
|
// this.offset = {
|
||||||
|
// x: Math.abs(this.offset.x - 1),
|
||||||
|
// y: this.offset.y,
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.error("参数必须为boolean")
|
console.error("参数必须为boolean")
|
||||||
@ -125,15 +165,17 @@ class GroundImage extends Base {
|
|||||||
if (!this.entity) {
|
if (!this.entity) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const img = new Image();
|
const img = new Image();
|
||||||
img.src = this.options.url;
|
img.crossOrigin = 'Anonymous';
|
||||||
|
img.src = this.replaceHost(this.options.url, this.options.host);
|
||||||
img.onload = () => {
|
img.onload = () => {
|
||||||
const canvas = document.createElement('canvas');
|
const canvas = document.createElement('canvas');
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
|
|
||||||
// 设置画布大小
|
// 设置画布大小
|
||||||
canvas.width = img.width;
|
canvas.width = img.width * 2;
|
||||||
canvas.height = img.height;
|
canvas.height = img.height * 2;
|
||||||
|
|
||||||
// 绘制图像
|
// 绘制图像
|
||||||
if (this.flipeX) {
|
if (this.flipeX) {
|
||||||
@ -144,11 +186,15 @@ class GroundImage extends Base {
|
|||||||
ctx.scale(-1, 1);
|
ctx.scale(-1, 1);
|
||||||
ctx.translate(-canvas.width, 0);
|
ctx.translate(-canvas.width, 0);
|
||||||
}
|
}
|
||||||
ctx.drawImage(img, 0, 0);
|
ctx.drawImage(img, img.width - (img.width * this.options.offset.x), img.height - (img.height * this.options.offset.y));
|
||||||
this.entity.rectangle.material = new Cesium.ImageMaterialProperty({
|
this.entity.rectangle.material = new Cesium.ImageMaterialProperty({
|
||||||
image: canvas,
|
image: canvas,
|
||||||
transparent: true
|
transparent: true
|
||||||
})
|
})
|
||||||
|
// this.offset = {
|
||||||
|
// x: this.offset.x,
|
||||||
|
// y: Math.abs(this.offset.y - 1),
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.error("参数必须为boolean")
|
console.error("参数必须为boolean")
|
||||||
@ -156,14 +202,14 @@ class GroundImage extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async create() {
|
async create() {
|
||||||
// let gap = Math.abs(Math.cos(Math.PI/180 * this.options.positions.lat)) * (0.0001*this.options.scale)
|
// let gap = Math.abs(Math.cos(Math.PI/180 * this.options.position.lat)) * (0.0001*this.options.scale)
|
||||||
// let fromDegreesArray = [
|
// let fromDegreesArray = [
|
||||||
// this.options.positions.lng - 0.05, this.options.positions.lat - 0.05,
|
// this.options.position.lng - 0.05, this.options.position.lat - 0.05,
|
||||||
// this.options.positions.lng + 0.05, this.options.positions.lat - 0.05,
|
// this.options.position.lng + 0.05, this.options.position.lat - 0.05,
|
||||||
// this.options.positions.lng + 0.05, this.options.positions.lat + 0.05,
|
// this.options.position.lng + 0.05, this.options.position.lat + 0.05,
|
||||||
// this.options.positions.lng - 0.05, this.options.positions.lat + 0.05,
|
// this.options.position.lng - 0.05, this.options.position.lat + 0.05,
|
||||||
// ]
|
// ]
|
||||||
let response = await fetch(this.options.url, {
|
let response = await fetch(this.replaceHost(this.options.url, this.options.host), {
|
||||||
method: 'get',
|
method: 'get',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
@ -174,14 +220,15 @@ class GroundImage extends Base {
|
|||||||
// let arrayBuffer = await data.arrayBuffer()
|
// let arrayBuffer = await data.arrayBuffer()
|
||||||
// const str = String.fromCharCode(...new Uint8Array(arrayBuffer));
|
// const str = String.fromCharCode(...new Uint8Array(arrayBuffer));
|
||||||
const img = new Image();
|
const img = new Image();
|
||||||
img.src = this.options.url;
|
img.crossOrigin = 'Anonymous';
|
||||||
|
img.src = this.replaceHost(this.options.url, this.options.host);
|
||||||
img.onload = () => {
|
img.onload = () => {
|
||||||
const canvas = document.createElement('canvas');
|
const canvas = document.createElement('canvas');
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
|
|
||||||
// 设置画布大小
|
// 设置画布大小
|
||||||
canvas.width = img.width;
|
canvas.width = img.width * 2;
|
||||||
canvas.height = img.height;
|
canvas.height = img.height * 2;
|
||||||
// 绘制图像
|
// 绘制图像
|
||||||
if (this.flipeX) {
|
if (this.flipeX) {
|
||||||
ctx.scale(1, -1);
|
ctx.scale(1, -1);
|
||||||
@ -191,19 +238,45 @@ class GroundImage extends Base {
|
|||||||
ctx.scale(-1, 1);
|
ctx.scale(-1, 1);
|
||||||
ctx.translate(-canvas.width, 0);
|
ctx.translate(-canvas.width, 0);
|
||||||
}
|
}
|
||||||
ctx.drawImage(img, 0, 0);
|
ctx.drawImage(img, img.width - (img.width * this.options.offset.x), img.height - (img.height * this.options.offset.y));
|
||||||
|
|
||||||
this.entity = this.sdk.viewer.entities.add({
|
this.entity = this.sdk.viewer.entities.add({
|
||||||
id: this.options.id,
|
id: this.options.id,
|
||||||
show: this.options.show,
|
show: this.options.show,
|
||||||
rectangle: {
|
rectangle: {
|
||||||
coordinates: new Cesium.CallbackProperty(() => {
|
coordinates: new Cesium.CallbackProperty(() => {
|
||||||
let gap = Math.abs(Math.cos(Math.PI / 180 * this.options.positions.lat)) * (0.0001 * this.options.scale)
|
let gap = Math.abs(Math.cos(Math.PI / 180 * this.options.position.lat)) * (0.0001 * this.options.scale)
|
||||||
|
let offset = {
|
||||||
|
x: this.flipeY ? Math.abs(this.options.offset.x - 1) : this.options.offset.x,
|
||||||
|
y: this.flipeX ? Math.abs(this.options.offset.y - 1) : this.options.offset.y,
|
||||||
|
}
|
||||||
|
offset = {
|
||||||
|
lng: offset.x * ((0.0001 * this.options.scale) * 2),
|
||||||
|
lat: Math.abs(offset.y - 1) * (gap * 2)
|
||||||
|
}
|
||||||
|
// let point1 = [this.options.position.lng - offset.lng + 360, this.options.position.lat - offset.lat];
|
||||||
|
// let point2 = [(this.options.position.lng - offset.lng) + ((0.0001 * this.options.scale) * 2) + 360, (this.options.position.lat - offset.lat) + (gap * 2)];
|
||||||
|
// let midpoint = turf.point([point1[0]+point2[0]/2, point1[1]+point2[1]/2]);
|
||||||
|
// let rotatedPot = turf.transformRotate(midpoint, -Number(this.options.angle), {pivot: [this.options.position.lng, this.options.position.lat]});
|
||||||
|
// console.log(midpoint.geometry.coordinates, rotatedPot.geometry.coordinates, this.options.position)
|
||||||
|
// let fromDegreesArray = [
|
||||||
|
// rotatedPot.geometry.coordinates[0]-(0.0001 * this.options.scale), rotatedPot.geometry.coordinates[1]-(0.0001 * this.options.scale),
|
||||||
|
// rotatedPot.geometry.coordinates[0]+(0.0001 * this.options.scale), rotatedPot.geometry.coordinates[1]+(0.0001 * this.options.scale),
|
||||||
|
|
||||||
|
// ]
|
||||||
let fromDegreesArray = [
|
let fromDegreesArray = [
|
||||||
this.options.positions.lng - (0.0001 * this.options.scale), this.options.positions.lat - gap,
|
// this.options.position.lng - offset.lng, this.options.position.lat - offset.lat,
|
||||||
// this.options.positions.lng + 0.05, this.options.positions.lat - 0.05,
|
// (this.options.position.lng - offset.lng) + ((0.0001 * this.options.scale) * 2), (this.options.position.lat - offset.lat) + (gap * 2),
|
||||||
this.options.positions.lng + (0.0001 * this.options.scale), this.options.positions.lat + gap,
|
|
||||||
// this.options.positions.lng - 0.05, this.options.positions.lat + 0.05,
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
this.options.position.lng - (0.0001 * this.options.scale), this.options.position.lat - gap,
|
||||||
|
// this.options.position.lng + 0.05, this.options.position.lat - 0.05,
|
||||||
|
this.options.position.lng + (0.0001 * this.options.scale), this.options.position.lat + gap,
|
||||||
|
// this.options.position.lng - 0.05, this.options.position.lat + 0.05,
|
||||||
]
|
]
|
||||||
|
|
||||||
return Cesium.Rectangle.fromDegrees(...fromDegreesArray)
|
return Cesium.Rectangle.fromDegrees(...fromDegreesArray)
|
||||||
@ -224,8 +297,8 @@ class GroundImage extends Base {
|
|||||||
this.entity.rectangle.height = 0
|
this.entity.rectangle.height = 0
|
||||||
}
|
}
|
||||||
syncData(this.sdk, this.options.id)
|
syncData(this.sdk, this.options.id)
|
||||||
if(this.options.show) {
|
if (this.options.show) {
|
||||||
|
|
||||||
setSplitDirection(0, this.options.id)
|
setSplitDirection(0, this.options.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -247,12 +320,16 @@ class GroundImage extends Base {
|
|||||||
// 编辑框
|
// 编辑框
|
||||||
async edit(state) {
|
async edit(state) {
|
||||||
let _this = this
|
let _this = this
|
||||||
this.originalOptions = { ...this.options }
|
this.originalOptions = this.deepCopyObj(this.options)
|
||||||
if (this._DialogObject && this._DialogObject.close) {
|
if (this._DialogObject && this._DialogObject.close) {
|
||||||
this._DialogObject.close()
|
this._DialogObject.close()
|
||||||
this._DialogObject = null
|
this._DialogObject = null
|
||||||
}
|
}
|
||||||
if (state) {
|
if (state) {
|
||||||
|
let anchorSetDialogObject
|
||||||
|
let canvas
|
||||||
|
let point
|
||||||
|
let billboardAnchorPosition
|
||||||
this._DialogObject = await new Dialog(this.sdk, this.originalOptions, {
|
this._DialogObject = await new Dialog(this.sdk, this.originalOptions, {
|
||||||
title: '军标属性', left: '180px', top: '100px',
|
title: '军标属性', left: '180px', top: '100px',
|
||||||
confirmCallBack: (options) => {
|
confirmCallBack: (options) => {
|
||||||
@ -274,13 +351,19 @@ class GroundImage extends Base {
|
|||||||
this.Dialog.removeCallBack && this.Dialog.removeCallBack()
|
this.Dialog.removeCallBack && this.Dialog.removeCallBack()
|
||||||
},
|
},
|
||||||
closeCallBack: () => {
|
closeCallBack: () => {
|
||||||
|
this.previous = null
|
||||||
this.reset()
|
this.reset()
|
||||||
// this.entity.style = new Cesium.Cesium3DTileStyle({
|
// this.entity.style = new Cesium.Cesium3DTileStyle({
|
||||||
// color: "color('rgba(255,255,255," + this.newData.transparency + ")')",
|
// color: "color('rgba(255,255,255," + this.newData.transparency + ")')",
|
||||||
// show: true,
|
// show: true,
|
||||||
// });
|
// });
|
||||||
this.positionEditing = false
|
|
||||||
|
if (anchorSetDialogObject && anchorSetDialogObject.close) {
|
||||||
|
anchorSetDialogObject.close()
|
||||||
|
}
|
||||||
this.Dialog.closeCallBack && this.Dialog.closeCallBack()
|
this.Dialog.closeCallBack && this.Dialog.closeCallBack()
|
||||||
|
YJ.Measure.SetMeasureStatus(false)
|
||||||
|
this.positionEditing = false
|
||||||
},
|
},
|
||||||
showCallBack: (show) => {
|
showCallBack: (show) => {
|
||||||
this.show = show
|
this.show = show
|
||||||
@ -315,6 +398,7 @@ class GroundImage extends Base {
|
|||||||
]
|
]
|
||||||
}, true)
|
}, true)
|
||||||
this._DialogObject._element.body.className = this._DialogObject._element.body.className + ' ground-image'
|
this._DialogObject._element.body.className = this._DialogObject._element.body.className + ' ground-image'
|
||||||
|
|
||||||
let contentElm = document.createElement('div');
|
let contentElm = document.createElement('div');
|
||||||
contentElm.innerHTML = html()
|
contentElm.innerHTML = html()
|
||||||
this._DialogObject.contentAppChild(contentElm)
|
this._DialogObject.contentAppChild(contentElm)
|
||||||
@ -322,6 +406,114 @@ class GroundImage extends Base {
|
|||||||
this._EventBinding.on(this, all_elm)
|
this._EventBinding.on(this, all_elm)
|
||||||
this._elms = this._EventBinding.element
|
this._elms = this._EventBinding.element
|
||||||
|
|
||||||
|
let anchorBtn = contentElm.getElementsByClassName('anchor')[0]
|
||||||
|
anchorBtn.addEventListener('click', async () => {
|
||||||
|
if (anchorSetDialogObject && anchorSetDialogObject.close) {
|
||||||
|
anchorSetDialogObject.close()
|
||||||
|
}
|
||||||
|
document.body.addEventListener('mouseup', mouseupEvent)
|
||||||
|
let DialogClientRect = _this._DialogObject._element.body.getBoundingClientRect()
|
||||||
|
let _DialogObject = await new Dialog(this.sdk, this.originalOptions, {
|
||||||
|
title: '锚点设置', left: (DialogClientRect.left + 80) + 'px', top: (DialogClientRect.top + 200) + 'px',
|
||||||
|
confirmCallBack: (options) => {
|
||||||
|
_this.offset = { x: billboardAnchorPosition.x, y: billboardAnchorPosition.y }
|
||||||
|
_DialogObject.close()
|
||||||
|
},
|
||||||
|
closeCallBack: () => {
|
||||||
|
document.body.removeEventListener('mouseup', mouseupEvent)
|
||||||
|
},
|
||||||
|
}, false)
|
||||||
|
anchorSetDialogObject = _DialogObject
|
||||||
|
_DialogObject._element.body.className = _DialogObject._element.body.className + ' anchor-point'
|
||||||
|
let contentElm = document.createElement('div');
|
||||||
|
let image = new Image()
|
||||||
|
image.src = this.replaceHost(this.options.url, this.options.host)
|
||||||
|
image.onload = function () {
|
||||||
|
let ratio = image.width / image.height
|
||||||
|
canvas = document.createElement('canvas')
|
||||||
|
let width = 150
|
||||||
|
let height = 150 / ratio
|
||||||
|
const ctx = canvas.getContext('2d', { willReadFrequently: true })
|
||||||
|
canvas.width = width
|
||||||
|
canvas.height = height;
|
||||||
|
canvas.style.display = 'block';
|
||||||
|
ctx.drawImage(image, 0, 0, width, height)
|
||||||
|
contentElm.appendChild(canvas)
|
||||||
|
_DialogObject.contentAppChild(contentElm)
|
||||||
|
|
||||||
|
point = document.createElement('span')
|
||||||
|
point.className = 'point'
|
||||||
|
contentElm.appendChild(point)
|
||||||
|
billboardAnchorPosition = { x: _this.offset.x, y: _this.offset.y }
|
||||||
|
point.style.top = `calc(${Number(billboardAnchorPosition.y) * 100}% - 6px)`
|
||||||
|
point.style.left = `calc(${Number(billboardAnchorPosition.x) * 100}% - 6px)`
|
||||||
|
|
||||||
|
canvas.addEventListener('click', (e) => {
|
||||||
|
let x = e.offsetX
|
||||||
|
let y = e.offsetY
|
||||||
|
let anchor = { x: Number((x / canvas.width).toFixed(2)), y: Number((y / canvas.height).toFixed(2)) }
|
||||||
|
if (anchor.x < 0) {
|
||||||
|
anchor.x = 0
|
||||||
|
}
|
||||||
|
if (anchor.x > 1) {
|
||||||
|
anchor.x = 1
|
||||||
|
}
|
||||||
|
if (anchor.y < 0) {
|
||||||
|
anchor.y = 0
|
||||||
|
}
|
||||||
|
if (anchor.y > 1) {
|
||||||
|
anchor.y = 1
|
||||||
|
}
|
||||||
|
billboardAnchorPosition = { x: anchor.x, y: anchor.y }
|
||||||
|
|
||||||
|
point.style.top = `calc(${billboardAnchorPosition.y * 100}% - 5px)`
|
||||||
|
point.style.left = `calc(${billboardAnchorPosition.x * 100}% - 5px)`
|
||||||
|
})
|
||||||
|
|
||||||
|
point.addEventListener('mousedown', (e) => {
|
||||||
|
_DialogObject._element.body.addEventListener('mousemove', mousemoveEvent)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
function mousemoveEvent(e) {
|
||||||
|
getDialogBodyElm(e.target)
|
||||||
|
function getDialogBodyElm(elm) {
|
||||||
|
if (!elm) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
else if (elm === anchorSetDialogObject._element.body) {
|
||||||
|
let x = e.x - elm.getBoundingClientRect().left
|
||||||
|
let y = e.y - elm.getBoundingClientRect().top
|
||||||
|
let anchor = { x: Number(((x - 42) / canvas.width).toFixed(2)), y: Number(((y - 71) / canvas.height).toFixed(2)) }
|
||||||
|
if (anchor.x < 0) {
|
||||||
|
anchor.x = 0
|
||||||
|
}
|
||||||
|
if (anchor.x > 1) {
|
||||||
|
anchor.x = 1
|
||||||
|
}
|
||||||
|
if (anchor.y < 0) {
|
||||||
|
anchor.y = 0
|
||||||
|
}
|
||||||
|
if (anchor.y > 1) {
|
||||||
|
anchor.y = 1
|
||||||
|
}
|
||||||
|
billboardAnchorPosition = { x: anchor.x, y: anchor.y }
|
||||||
|
|
||||||
|
point.style.top = `calc(${billboardAnchorPosition.y * 100}% - 5px)`
|
||||||
|
point.style.left = `calc(${billboardAnchorPosition.x * 100}% - 5px)`
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
getDialogBodyElm(elm.offsetParent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function mouseupEvent() {
|
||||||
|
if (anchorSetDialogObject) {
|
||||||
|
anchorSetDialogObject._element.body.removeEventListener('mousemove', mousemoveEvent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (this._DialogObject && this._DialogObject.remove) {
|
if (this._DialogObject && this._DialogObject.remove) {
|
||||||
this._DialogObject.remove()
|
this._DialogObject.remove()
|
||||||
@ -341,17 +533,17 @@ class GroundImage extends Base {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this._positionEditing = status
|
this._positionEditing = status
|
||||||
this.previous = {
|
|
||||||
positions: { ...this.options.positions }
|
|
||||||
}
|
|
||||||
if (status === true) {
|
if (status === true) {
|
||||||
|
this.previous = {
|
||||||
|
position: { ...this.options.position }
|
||||||
|
}
|
||||||
this.tip && this.tip.destroy()
|
this.tip && this.tip.destroy()
|
||||||
this.tip = new MouseTip('点击鼠标左键确认,右键取消', this.sdk)
|
this.tip = new MouseTip('点击鼠标左键确认,右键取消', this.sdk)
|
||||||
this.event.mouse_move((movement, cartesian) => {
|
this.event.mouse_move((movement, cartesian) => {
|
||||||
let positions = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
|
let position = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
|
||||||
this.options.positions.lng = positions.lng
|
this.options.position.lng = position.lng
|
||||||
this.options.positions.lat = positions.lat
|
this.options.position.lat = position.lat
|
||||||
this.options.positions.alt = positions.alt
|
this.options.position.alt = position.alt
|
||||||
this.tip.setPosition(
|
this.tip.setPosition(
|
||||||
cartesian,
|
cartesian,
|
||||||
movement.endPosition.x,
|
movement.endPosition.x,
|
||||||
@ -359,21 +551,22 @@ class GroundImage extends Base {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
this.event.mouse_left((movement, cartesian) => {
|
this.event.mouse_left((movement, cartesian) => {
|
||||||
let positions = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
|
let position = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
|
||||||
this.options.positions.lng = positions.lng
|
this.options.position.lng = position.lng
|
||||||
this.options.positions.lat = positions.lat
|
this.options.position.lat = position.lat
|
||||||
this.options.positions.alt = positions.alt
|
this.options.position.alt = position.alt
|
||||||
this.event.mouse_move(() => { })
|
this.event.mouse_move(() => { })
|
||||||
this.event.mouse_left(() => { })
|
this.event.mouse_left(() => { })
|
||||||
this.event.mouse_right(() => { })
|
this.event.mouse_right(() => { })
|
||||||
this.event.gesture_pinck_start(() => { })
|
this.event.gesture_pinck_start(() => { })
|
||||||
this.event.gesture_pinck_end(() => { })
|
this.event.gesture_pinck_end(() => { })
|
||||||
|
this.previous = null
|
||||||
this.positionEditing = false
|
this.positionEditing = false
|
||||||
})
|
})
|
||||||
this.event.mouse_right((movement, cartesian) => {
|
this.event.mouse_right((movement, cartesian) => {
|
||||||
this.options.positions.lng = this.previous.positions.lng
|
this.options.position.lng = this.previous.position.lng
|
||||||
this.options.positions.lat = this.previous.positions.lat
|
this.options.position.lat = this.previous.position.lat
|
||||||
this.options.positions.alt = this.previous.positions.alt
|
this.options.position.alt = this.previous.position.alt
|
||||||
this.positionEditing = false
|
this.positionEditing = false
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -383,16 +576,16 @@ class GroundImage extends Base {
|
|||||||
let endTime = new Date()
|
let endTime = new Date()
|
||||||
if (endTime - startTime >= 500) {
|
if (endTime - startTime >= 500) {
|
||||||
// 长按取消
|
// 长按取消
|
||||||
this.options.positions.lng = this.previous.positions.lng
|
this.options.position.lng = this.previous.position.lng
|
||||||
this.options.positions.lat = this.previous.positions.lat
|
this.options.position.lat = this.previous.position.lat
|
||||||
this.options.positions.alt = this.previous.positions.alt
|
this.options.position.alt = this.previous.position.alt
|
||||||
this.positionEditing = false
|
this.positionEditing = false
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let positions = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
|
let position = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
|
||||||
this.options.positions.lng = positions.lng
|
this.options.position.lng = position.lng
|
||||||
this.options.positions.lat = positions.lat
|
this.options.position.lat = position.lat
|
||||||
this.options.positions.alt = positions.alt
|
this.options.position.alt = position.alt
|
||||||
this.event.mouse_move(() => { })
|
this.event.mouse_move(() => { })
|
||||||
this.event.mouse_left(() => { })
|
this.event.mouse_left(() => { })
|
||||||
this.event.mouse_right(() => { })
|
this.event.mouse_right(() => { })
|
||||||
@ -412,9 +605,17 @@ class GroundImage extends Base {
|
|||||||
this.event.gesture_pinck_end(() => { })
|
this.event.gesture_pinck_end(() => { })
|
||||||
}
|
}
|
||||||
this.tip && this.tip.destroy()
|
this.tip && this.tip.destroy()
|
||||||
this.options.positions.lng = this.previous.positions.lng
|
if (!this.previous) {
|
||||||
this.options.positions.lat = this.previous.positions.lat
|
this.previous = {
|
||||||
this.options.positions.alt = this.previous.positions.alt
|
position: { ...this.options.position }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.options.position.lng = this.previous.position.lng
|
||||||
|
this.options.position.lat = this.previous.position.lat
|
||||||
|
this.options.position.alt = this.previous.position.alt
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -428,7 +629,7 @@ class GroundImage extends Base {
|
|||||||
async flyTo(options = {}) {
|
async flyTo(options = {}) {
|
||||||
setActiveViewer(0)
|
setActiveViewer(0)
|
||||||
closeRotateAround(this.sdk)
|
closeRotateAround(this.sdk)
|
||||||
closeViewFollow(this.sdk)
|
closeViewFollow(this.sdk)
|
||||||
|
|
||||||
if (this.options.customView && this.options.customView.relativePosition && this.options.customView.orientation) {
|
if (this.options.customView && this.options.customView.relativePosition && this.options.customView.orientation) {
|
||||||
let orientation = {
|
let orientation = {
|
||||||
@ -446,8 +647,8 @@ class GroundImage extends Base {
|
|||||||
if (this.options.position) {
|
if (this.options.position) {
|
||||||
position = { ...this.options.position }
|
position = { ...this.options.position }
|
||||||
}
|
}
|
||||||
else if (this.options.positions) {
|
else if (this.options.position) {
|
||||||
position = { ...this.options.positions[0] }
|
position = { ...this.options.position[0] }
|
||||||
}
|
}
|
||||||
else if (this.options.center) {
|
else if (this.options.center) {
|
||||||
position = { ...this.options.center }
|
position = { ...this.options.center }
|
||||||
@ -480,14 +681,14 @@ class GroundImage extends Base {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let gap = Math.abs(Math.cos(Math.PI / 180 * this.options.positions.lat)) * (0.0001 * this.options.scale)
|
let gap = Math.abs(Math.cos(Math.PI / 180 * this.options.position.lat)) * (0.0001 * this.options.scale)
|
||||||
let fromDegreesArray = [
|
let fromDegreesArray = [
|
||||||
[this.options.positions.lng - (0.0001 * this.options.scale), this.options.positions.lat - gap],
|
[this.options.position.lng - (0.0001 * this.options.scale), this.options.position.lat - gap],
|
||||||
[this.options.positions.lng + (0.0001 * this.options.scale), this.options.positions.lat + gap],
|
[this.options.position.lng + (0.0001 * this.options.scale), this.options.position.lat + gap],
|
||||||
]
|
]
|
||||||
let positionArray = []
|
let positionArray = []
|
||||||
let height = 0
|
let height = 0
|
||||||
let position = this.options.positions
|
let position = this.options.position
|
||||||
let point1 = Cesium.Cartesian3.fromDegrees(position.lng, position.lat, 0);
|
let point1 = Cesium.Cartesian3.fromDegrees(position.lng, position.lat, 0);
|
||||||
let point2 = Cesium.Cartesian3.fromDegrees(position.lng, position.lat, 10000000);
|
let point2 = Cesium.Cartesian3.fromDegrees(position.lng, position.lat, 10000000);
|
||||||
let direction = Cesium.Cartesian3.subtract(point2, point1, new Cesium.Cartesian3());
|
let direction = Cesium.Cartesian3.subtract(point2, point1, new Cesium.Cartesian3());
|
||||||
@ -530,9 +731,14 @@ class GroundImage extends Base {
|
|||||||
if (!this.entity) {
|
if (!this.entity) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.name = this.originalOptions.name
|
this.options = this.deepCopyObj(this.originalOptions)
|
||||||
this.angle = this.originalOptions.angle
|
this.name = this.options.name
|
||||||
this.scale = this.originalOptions.scale
|
this.angle = this.options.angle
|
||||||
|
this.scale = this.options.scale
|
||||||
|
this.offset = this.options.offset
|
||||||
|
this.flipeX = this.options.flipe.x
|
||||||
|
this.flipeY = this.options.flipe.y
|
||||||
|
this.show = this.options.show
|
||||||
}
|
}
|
||||||
|
|
||||||
async remove() {
|
async remove() {
|
||||||
@ -549,9 +755,9 @@ class GroundImage extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setPosition(v) {
|
setPosition(v) {
|
||||||
this.options.positions.lng = v.position.lng
|
this.options.position.lng = v.position.lng
|
||||||
this.options.positions.lat = v.position.lat
|
this.options.position.lat = v.position.lat
|
||||||
this.options.positions.alt = v.position.alt
|
this.options.position.alt = v.position.alt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -123,7 +123,7 @@ class GroundSvg extends Base {
|
|||||||
}
|
}
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -796,7 +796,7 @@ class GroundSvg extends Base {
|
|||||||
await this._DialogObject.contentAppChild(contentElm)
|
await this._DialogObject.contentAppChild(contentElm)
|
||||||
|
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
|
|||||||
@ -108,12 +108,18 @@ class GroundSvg extends Base {
|
|||||||
this._isdrag = false
|
this._isdrag = false
|
||||||
this._EventBinding = new EventBinding()
|
this._EventBinding = new EventBinding()
|
||||||
|
|
||||||
|
if(this.sdk.entityMap.get(this.options.id)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
this.sdk.addIncetance(this.options.id, this)
|
this.sdk.addIncetance(this.options.id, this)
|
||||||
this.picking = true
|
this.picking = true
|
||||||
|
|
||||||
|
|
||||||
if (this.options.show) {
|
if (this.options.show) {
|
||||||
setSplitDirection(0, this.options.id)
|
setSplitDirection(0, this.options.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._entityArray = []
|
||||||
|
|
||||||
this.init()
|
this.init()
|
||||||
}
|
}
|
||||||
@ -153,12 +159,18 @@ class GroundSvg extends Base {
|
|||||||
|
|
||||||
set show(v) {
|
set show(v) {
|
||||||
if (typeof v === "boolean") {
|
if (typeof v === "boolean") {
|
||||||
super.show = v
|
if (this.options.text && this.options.text.show) {
|
||||||
if (this.options.text && this.options.text.show && this.text) {
|
if(this.text) {
|
||||||
this.text.show = v
|
if((!this.showView || this.showView == 3)) {
|
||||||
|
this.text.show = v
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.text.show = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
syncData(this.sdk, this.options.id)
|
super.show = v
|
||||||
syncSplitData(this.sdk, this.options.id)
|
|
||||||
} else {
|
} else {
|
||||||
console.error("参数必须为boolean")
|
console.error("参数必须为boolean")
|
||||||
}
|
}
|
||||||
@ -206,7 +218,7 @@ class GroundSvg extends Base {
|
|||||||
}
|
}
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -304,7 +316,12 @@ class GroundSvg extends Base {
|
|||||||
set textShow(v) {
|
set textShow(v) {
|
||||||
this.options.text.show = v
|
this.options.text.show = v
|
||||||
if (this.show) {
|
if (this.show) {
|
||||||
this.text && (this.text.show = v)
|
if((!this.showView || this.showView == 3)) {
|
||||||
|
this.text && (this.text.show = v)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.text && (this.text.show = false)
|
||||||
|
}
|
||||||
if (this.options.text.position) {
|
if (this.options.text.position) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.options.text.position.alt) {
|
if (this.options.text.position.alt) {
|
||||||
@ -334,7 +351,7 @@ class GroundSvg extends Base {
|
|||||||
this.text && (this.text.color = v)
|
this.text && (this.text.color = v)
|
||||||
if (this._elms.textColor) {
|
if (this._elms.textColor) {
|
||||||
this._elms.textColor.forEach((item, i) => {
|
this._elms.textColor.forEach((item, i) => {
|
||||||
let textColorPicker = new ewPlugins('colorpicker', {
|
let textColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -594,12 +611,13 @@ class GroundSvg extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
let url = this.replaceHost(this.options.url, this.options.host)
|
||||||
syncData(this.sdk, this.options.id)
|
syncData(this.sdk, this.options.id)
|
||||||
this.hierarchys = []
|
this.hierarchys = []
|
||||||
this.originalOptions = this.deepCopyObj(this.options)
|
this.originalOptions = this.deepCopyObj(this.options)
|
||||||
let geometryArray = []
|
let geometryArray = []
|
||||||
const loader = new SVGLoader();
|
const loader = new SVGLoader();
|
||||||
loader.load(this.options.url, (data) => {
|
loader.load(url, (data) => {
|
||||||
if (!this.sdk || !this.sdk.viewer || !this.sdk.viewer.entities) {
|
if (!this.sdk || !this.sdk.viewer || !this.sdk.viewer.entities) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -819,8 +837,13 @@ class GroundSvg extends Base {
|
|||||||
}
|
}
|
||||||
for (let i = 0; i < this.hierarchys.length; i++) {
|
for (let i = 0; i < this.hierarchys.length; i++) {
|
||||||
for (let m = 0; m < this.hierarchys[i].length; m++) {
|
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({
|
let entity = this.sdk.viewer.entities.add({
|
||||||
id: this.options.id + `-${i}_${m}`,
|
id: this.options.id + `-${i}_${m}}`,
|
||||||
show: this.options.show,
|
show: this.options.show,
|
||||||
polygon: {
|
polygon: {
|
||||||
hierarchy: new Cesium.CallbackProperty(() => {
|
hierarchy: new Cesium.CallbackProperty(() => {
|
||||||
@ -853,6 +876,7 @@ class GroundSvg extends Base {
|
|||||||
color: this.geojson.features[i].properties.color
|
color: this.geojson.features[i].properties.color
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this._entityArray.push(entity)
|
||||||
this.entity.add(entity)
|
this.entity.add(entity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -923,7 +947,9 @@ class GroundSvg extends Base {
|
|||||||
this.text && (this.options.text.position = { lng: this.text.position[0], lat: this.text.position[1], alt: this.text.position[2] })
|
this.text && (this.options.text.position = { lng: this.text.position[0], lat: this.text.position[1], alt: this.text.position[2] })
|
||||||
this.originalOptions = this.deepCopyObj(this.options)
|
this.originalOptions = this.deepCopyObj(this.options)
|
||||||
this._DialogObject.close()
|
this._DialogObject.close()
|
||||||
this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(this.originalOptions)
|
let cdoptions = this.deepCopyObj(this.options)
|
||||||
|
cdoptions.host = ''
|
||||||
|
this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(cdoptions)
|
||||||
syncData(this.sdk, this.options.id)
|
syncData(this.sdk, this.options.id)
|
||||||
syncSplitData(this.sdk, this.options.id)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
},
|
},
|
||||||
@ -991,7 +1017,7 @@ class GroundSvg extends Base {
|
|||||||
this.attributeType = this.options.attributeType
|
this.attributeType = this.options.attributeType
|
||||||
|
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1006,7 +1032,7 @@ class GroundSvg extends Base {
|
|||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
|
|
||||||
let textColorPicker = new ewPlugins('colorpicker', {
|
let textColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("textColor")[0],
|
el: contentElm.getElementsByClassName("textColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1988,6 +2014,8 @@ class GroundSvg extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async remove() {
|
async remove() {
|
||||||
|
this._worker.onmessage = (event) => {}
|
||||||
|
await this.sdk.removeIncetance(this.options.id)
|
||||||
if (!this.entity) {
|
if (!this.entity) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1997,12 +2025,11 @@ class GroundSvg extends Base {
|
|||||||
for (let i = this.entity.values.length; i >= 0; i--) {
|
for (let i = this.entity.values.length; i >= 0; i--) {
|
||||||
this.sdk.viewer.entities.remove(this.entity.values[i])
|
this.sdk.viewer.entities.remove(this.entity.values[i])
|
||||||
}
|
}
|
||||||
this.entity = null
|
|
||||||
if (this._DialogObject && !this._DialogObject.isDestroy) {
|
if (this._DialogObject && !this._DialogObject.isDestroy) {
|
||||||
this._DialogObject.close()
|
this._DialogObject.close()
|
||||||
this._DialogObject = null
|
this._DialogObject = null
|
||||||
}
|
}
|
||||||
await this.sdk.removeIncetance(this.options.id)
|
|
||||||
await syncData(this.sdk, this.options.id)
|
await syncData(this.sdk, this.options.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -34,10 +34,10 @@ class LabelObject extends Base {
|
|||||||
}
|
}
|
||||||
this.options.text = textArray.join('\n')
|
this.options.text = textArray.join('\n')
|
||||||
this.options.fontFamily = options.fontFamily || 0
|
this.options.fontFamily = options.fontFamily || 0
|
||||||
this.font = getFontFamily(this.options.fontFamily) || 'Helvetica'
|
this.font = getFontFamily(this.options.fontFamily) || 'SimHei'
|
||||||
this.options.fontSize = options.fontSize || 20
|
this.options.fontSize = options.fontSize || 20
|
||||||
this.options.lineWidth = options.lineWidth || 4
|
this.options.lineWidth = options.lineWidth || 4
|
||||||
this.options.lineColor = options.lineColor || '#fff000'
|
this.options.lineColor = options.lineColor || '#00ffff80'
|
||||||
this.options.color = options.color || '#ffffff'
|
this.options.color = options.color || '#ffffff'
|
||||||
this.options.ground =
|
this.options.ground =
|
||||||
options.ground || options.ground === false ? options.ground : true
|
options.ground || options.ground === false ? options.ground : true
|
||||||
@ -46,8 +46,8 @@ class LabelObject extends Base {
|
|||||||
? options.pixelOffset
|
? options.pixelOffset
|
||||||
: 20
|
: 20
|
||||||
this.options.backgroundColor = options.backgroundColor || [
|
this.options.backgroundColor = options.backgroundColor || [
|
||||||
'#42c6ef',
|
'#00ffff80',
|
||||||
'#42c6ef'
|
'#00ffff80'
|
||||||
]
|
]
|
||||||
this.event = new MouseEvent(this.sdk)
|
this.event = new MouseEvent(this.sdk)
|
||||||
this.entity
|
this.entity
|
||||||
@ -65,6 +65,11 @@ class LabelObject extends Base {
|
|||||||
}
|
}
|
||||||
this.originalOptions = copyObj(this.options)
|
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({
|
this.entity = this.sdk.viewer.entities.add({
|
||||||
show: this.options.show,
|
show: this.options.show,
|
||||||
id: this.options.id + '-label',
|
id: this.options.id + '-label',
|
||||||
@ -407,7 +412,7 @@ class LabelObject extends Base {
|
|||||||
|
|
||||||
set fontFamily(v) {
|
set fontFamily(v) {
|
||||||
this.options.fontFamily = v || 0
|
this.options.fontFamily = v || 0
|
||||||
this.font = getFontFamily(this.options.fontFamily) || 'Helvetica'
|
this.font = getFontFamily(this.options.fontFamily) || 'SimHei'
|
||||||
this.updateBillboardImage()
|
this.updateBillboardImage()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,7 +420,7 @@ class LabelObject extends Base {
|
|||||||
return this.options.lineWidth
|
return this.options.lineWidth
|
||||||
}
|
}
|
||||||
set lineWidth(v) {
|
set lineWidth(v) {
|
||||||
this.options.lineWidth = Number(v)
|
this.options.lineWidth = ((Number(v) || Number(v) === 0) ? Number(v) : 4)
|
||||||
if (!this.entity) {
|
if (!this.entity) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -443,7 +448,7 @@ class LabelObject extends Base {
|
|||||||
return this.options.pixelOffset
|
return this.options.pixelOffset
|
||||||
}
|
}
|
||||||
set lineColor(v) {
|
set lineColor(v) {
|
||||||
this.options.lineColor = v
|
this.options.lineColor = v || '#00ffff80'
|
||||||
if (!this.entity) {
|
if (!this.entity) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -82,18 +82,33 @@ class Flame extends Base {
|
|||||||
|
|
||||||
set show(v) {
|
set show(v) {
|
||||||
if (typeof v === "boolean") {
|
if (typeof v === "boolean") {
|
||||||
this.options.show = v
|
if (!this.isShowView) {
|
||||||
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
|
this.options.show = v
|
||||||
this.entity.show = v
|
|
||||||
}
|
}
|
||||||
|
if (!this.showView || this.showView == 3) {
|
||||||
|
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) {
|
if (this._DialogObject && this._DialogObject.showBtn) {
|
||||||
this._DialogObject.showBtn.checked = v
|
this._DialogObject.showBtn.checked = v
|
||||||
}
|
}
|
||||||
if (this.options.label && this.options.label.show) {
|
|
||||||
this.label.show = v
|
|
||||||
}
|
|
||||||
syncData(this.sdk, this.options.id)
|
syncData(this.sdk, this.options.id)
|
||||||
syncSplitData(this.sdk, this.options.id)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
|
this.isShowView = false
|
||||||
} else {
|
} else {
|
||||||
console.error("参数必须为boolean")
|
console.error("参数必须为boolean")
|
||||||
}
|
}
|
||||||
@ -245,7 +260,7 @@ class Flame extends Base {
|
|||||||
this.particleSystem.startColor = Cesium.Color.fromCssColorString(v)
|
this.particleSystem.startColor = Cesium.Color.fromCssColorString(v)
|
||||||
if (this._elms.startColor) {
|
if (this._elms.startColor) {
|
||||||
this._elms.startColor.forEach((item, i) => {
|
this._elms.startColor.forEach((item, i) => {
|
||||||
let picker = new ewPlugins('colorpicker', {
|
let picker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -273,7 +288,7 @@ class Flame extends Base {
|
|||||||
this.particleSystem.endColor = Cesium.Color.fromCssColorString(v)
|
this.particleSystem.endColor = Cesium.Color.fromCssColorString(v)
|
||||||
if (this._elms.endColor) {
|
if (this._elms.endColor) {
|
||||||
this._elms.endColor.forEach((item, i) => {
|
this._elms.endColor.forEach((item, i) => {
|
||||||
let picker = new ewPlugins('colorpicker', {
|
let picker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -496,7 +511,7 @@ class Flame extends Base {
|
|||||||
contentElm.innerHTML = html()
|
contentElm.innerHTML = html()
|
||||||
this._DialogObject.contentAppChild(contentElm)
|
this._DialogObject.contentAppChild(contentElm)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let startColorPicker = new ewPlugins('colorpicker', {
|
let startColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("start_color")[0],
|
el: contentElm.getElementsByClassName("start_color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -510,7 +525,7 @@ class Flame extends Base {
|
|||||||
this.startColor = 'rgba(255,255,255,1)'
|
this.startColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let endColorPicker = new ewPlugins('colorpicker', {
|
let endColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("end_color")[0],
|
el: contentElm.getElementsByClassName("end_color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
|
|||||||
@ -83,18 +83,31 @@ class Fountain extends Base {
|
|||||||
|
|
||||||
set show(v) {
|
set show(v) {
|
||||||
if (typeof v === "boolean") {
|
if (typeof v === "boolean") {
|
||||||
this.options.show = v
|
if (!this.isShowView) {
|
||||||
if(this.entity && this.sdk.viewer.camera.positionCartographic.height <10000000) {
|
this.options.show = v
|
||||||
this.entity.show = v
|
}
|
||||||
|
if (!this.showView || this.showView == 3) {
|
||||||
|
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) {
|
if(this._DialogObject && this._DialogObject.showBtn) {
|
||||||
this._DialogObject.showBtn.checked = v
|
this._DialogObject.showBtn.checked = v
|
||||||
}
|
}
|
||||||
if (this.options.label && this.options.label.show) {
|
|
||||||
this.label.show = v
|
|
||||||
}
|
|
||||||
syncData(this.sdk, this.options.id)
|
syncData(this.sdk, this.options.id)
|
||||||
syncSplitData(this.sdk, this.options.id)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
|
this.isShowView = false
|
||||||
} else {
|
} else {
|
||||||
console.error("参数必须为boolean")
|
console.error("参数必须为boolean")
|
||||||
}
|
}
|
||||||
@ -269,7 +282,7 @@ class Fountain extends Base {
|
|||||||
this.particleSystem.startColor = Cesium.Color.fromCssColorString(v)
|
this.particleSystem.startColor = Cesium.Color.fromCssColorString(v)
|
||||||
if (this._elms.startColor) {
|
if (this._elms.startColor) {
|
||||||
this._elms.startColor.forEach((item, i) => {
|
this._elms.startColor.forEach((item, i) => {
|
||||||
let picker = new ewPlugins('colorpicker', {
|
let picker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -297,7 +310,7 @@ class Fountain extends Base {
|
|||||||
this.particleSystem.endColor = Cesium.Color.fromCssColorString(v)
|
this.particleSystem.endColor = Cesium.Color.fromCssColorString(v)
|
||||||
if (this._elms.endColor) {
|
if (this._elms.endColor) {
|
||||||
this._elms.endColor.forEach((item, i) => {
|
this._elms.endColor.forEach((item, i) => {
|
||||||
let picker = new ewPlugins('colorpicker', {
|
let picker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -520,7 +533,7 @@ class Fountain extends Base {
|
|||||||
contentElm.innerHTML = html()
|
contentElm.innerHTML = html()
|
||||||
this._DialogObject.contentAppChild(contentElm)
|
this._DialogObject.contentAppChild(contentElm)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let startColorPicker = new ewPlugins('colorpicker', {
|
let startColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("start_color")[0],
|
el: contentElm.getElementsByClassName("start_color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -534,7 +547,7 @@ class Fountain extends Base {
|
|||||||
this.startColor = 'rgba(255,255,255,1)'
|
this.startColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let endColorPicker = new ewPlugins('colorpicker', {
|
let endColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("end_color")[0],
|
el: contentElm.getElementsByClassName("end_color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
|
|||||||
@ -81,18 +81,31 @@ class Smoke extends Base {
|
|||||||
|
|
||||||
set show(v) {
|
set show(v) {
|
||||||
if (typeof v === "boolean") {
|
if (typeof v === "boolean") {
|
||||||
this.options.show = v
|
if (!this.isShowView) {
|
||||||
if(this.entity && this.sdk.viewer.camera.positionCartographic.height <10000000) {
|
this.options.show = v
|
||||||
this.entity.show = v
|
}
|
||||||
|
if (!this.showView || this.showView == 3) {
|
||||||
|
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) {
|
if(this._DialogObject && this._DialogObject.showBtn) {
|
||||||
this._DialogObject.showBtn.checked = v
|
this._DialogObject.showBtn.checked = v
|
||||||
}
|
}
|
||||||
if (this.options.label && this.options.label.show) {
|
|
||||||
this.label.show = v
|
|
||||||
}
|
|
||||||
syncData(this.sdk, this.options.id)
|
syncData(this.sdk, this.options.id)
|
||||||
syncSplitData(this.sdk, this.options.id)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
|
this.isShowView = false
|
||||||
} else {
|
} else {
|
||||||
console.error("参数必须为boolean")
|
console.error("参数必须为boolean")
|
||||||
}
|
}
|
||||||
@ -243,7 +256,7 @@ class Smoke extends Base {
|
|||||||
this.particleSystem.startColor = Cesium.Color.fromCssColorString(v)
|
this.particleSystem.startColor = Cesium.Color.fromCssColorString(v)
|
||||||
if (this._elms.startColor) {
|
if (this._elms.startColor) {
|
||||||
this._elms.startColor.forEach((item, i) => {
|
this._elms.startColor.forEach((item, i) => {
|
||||||
let picker = new ewPlugins('colorpicker', {
|
let picker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -271,7 +284,7 @@ class Smoke extends Base {
|
|||||||
this.particleSystem.endColor = Cesium.Color.fromCssColorString(v)
|
this.particleSystem.endColor = Cesium.Color.fromCssColorString(v)
|
||||||
if (this._elms.endColor) {
|
if (this._elms.endColor) {
|
||||||
this._elms.endColor.forEach((item, i) => {
|
this._elms.endColor.forEach((item, i) => {
|
||||||
let picker = new ewPlugins('colorpicker', {
|
let picker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -494,7 +507,7 @@ class Smoke extends Base {
|
|||||||
contentElm.innerHTML = html()
|
contentElm.innerHTML = html()
|
||||||
this._DialogObject.contentAppChild(contentElm)
|
this._DialogObject.contentAppChild(contentElm)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let startColorPicker = new ewPlugins('colorpicker', {
|
let startColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("start_color")[0],
|
el: contentElm.getElementsByClassName("start_color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -508,7 +521,7 @@ class Smoke extends Base {
|
|||||||
this.startColor = 'rgba(255,255,255,1)'
|
this.startColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let endColorPicker = new ewPlugins('colorpicker', {
|
let endColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("end_color")[0],
|
el: contentElm.getElementsByClassName("end_color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
|
|||||||
@ -84,18 +84,31 @@ class Spout extends Base {
|
|||||||
|
|
||||||
set show(v) {
|
set show(v) {
|
||||||
if (typeof v === "boolean") {
|
if (typeof v === "boolean") {
|
||||||
this.options.show = v
|
if (!this.isShowView) {
|
||||||
if (this.entity && this.sdk.viewer.camera.positionCartographic.height < 10000000) {
|
this.options.show = v
|
||||||
this.entity.show = v
|
|
||||||
}
|
}
|
||||||
if (this._DialogObject && this._DialogObject.showBtn) {
|
if (!this.showView || this.showView == 3) {
|
||||||
|
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
|
this._DialogObject.showBtn.checked = v
|
||||||
}
|
}
|
||||||
if (this.options.label && this.options.label.show) {
|
|
||||||
this.label.show = v
|
|
||||||
}
|
|
||||||
syncData(this.sdk, this.options.id)
|
syncData(this.sdk, this.options.id)
|
||||||
syncSplitData(this.sdk, this.options.id)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
|
this.isShowView = false
|
||||||
} else {
|
} else {
|
||||||
console.error("参数必须为boolean")
|
console.error("参数必须为boolean")
|
||||||
}
|
}
|
||||||
@ -360,7 +373,7 @@ class Spout extends Base {
|
|||||||
this.particleSystem.startColor = Cesium.Color.fromCssColorString(v)
|
this.particleSystem.startColor = Cesium.Color.fromCssColorString(v)
|
||||||
if (this._elms.startColor) {
|
if (this._elms.startColor) {
|
||||||
this._elms.startColor.forEach((item, i) => {
|
this._elms.startColor.forEach((item, i) => {
|
||||||
let picker = new ewPlugins('colorpicker', {
|
let picker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -388,7 +401,7 @@ class Spout extends Base {
|
|||||||
this.particleSystem.endColor = Cesium.Color.fromCssColorString(v)
|
this.particleSystem.endColor = Cesium.Color.fromCssColorString(v)
|
||||||
if (this._elms.endColor) {
|
if (this._elms.endColor) {
|
||||||
this._elms.endColor.forEach((item, i) => {
|
this._elms.endColor.forEach((item, i) => {
|
||||||
let picker = new ewPlugins('colorpicker', {
|
let picker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -634,7 +647,7 @@ class Spout extends Base {
|
|||||||
contentElm.innerHTML = html()
|
contentElm.innerHTML = html()
|
||||||
this._DialogObject.contentAppChild(contentElm)
|
this._DialogObject.contentAppChild(contentElm)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let startColorPicker = new ewPlugins('colorpicker', {
|
let startColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("start_color")[0],
|
el: contentElm.getElementsByClassName("start_color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -648,7 +661,7 @@ class Spout extends Base {
|
|||||||
this.startColor = 'rgba(255,255,255,1)'
|
this.startColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let endColorPicker = new ewPlugins('colorpicker', {
|
let endColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("end_color")[0],
|
el: contentElm.getElementsByClassName("end_color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
|
|||||||
@ -24,7 +24,7 @@ class PincerArrowObject extends Base {
|
|||||||
* @param options {object} 属性
|
* @param options {object} 属性
|
||||||
* @param options.show=true {boolean} 显示/隐藏
|
* @param options.show=true {boolean} 显示/隐藏
|
||||||
* @param options.name {string} 名称
|
* @param options.name {string} 名称
|
||||||
* @param options.color="#36c4ff" {string} 颜色
|
* @param options.color="#ff000080" {string} 颜色
|
||||||
* @param options.height {number} 高度
|
* @param options.height {number} 高度
|
||||||
* @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式)
|
* @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式)
|
||||||
* @param {Array.<object>} options.positions 坐标数组 [{lon,lat,alt},...]
|
* @param {Array.<object>} options.positions 坐标数组 [{lon,lat,alt},...]
|
||||||
@ -34,13 +34,13 @@ class PincerArrowObject extends Base {
|
|||||||
constructor(sdk, options = {}, _Dialog = {}) {
|
constructor(sdk, options = {}, _Dialog = {}) {
|
||||||
super(sdk, options);
|
super(sdk, options);
|
||||||
this.options.name = options.name || '未命名对象'
|
this.options.name = options.name || '未命名对象'
|
||||||
this.options.color = options.color || "#36c4ff"
|
this.options.color = options.color || "#ff000080"
|
||||||
this.options.show = (options.show || options.show === false) ? options.show : true
|
this.options.show = (options.show || options.show === false) ? options.show : true
|
||||||
this.options.positions = options.positions || []
|
this.options.positions = options.positions || []
|
||||||
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
|
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
|
||||||
this.options.line = options.line || {}
|
this.options.line = options.line || {}
|
||||||
this.options.line.width = this.options.line.width || 2
|
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(155, 155, 124, 0.89)'
|
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)'
|
||||||
this.options['area-unit'] = options['area-unit'] || '平方米'
|
this.options['area-unit'] = options['area-unit'] || '平方米'
|
||||||
this.options.height = options.height
|
this.options.height = options.height
|
||||||
this.options.loop = options.loop || false
|
this.options.loop = options.loop || false
|
||||||
@ -62,8 +62,8 @@ class PincerArrowObject extends Base {
|
|||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
||||||
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
|
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 || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
@ -122,31 +122,31 @@ class PincerArrowObject extends Base {
|
|||||||
return this.options.color
|
return this.options.color
|
||||||
}
|
}
|
||||||
set color(v) {
|
set color(v) {
|
||||||
this.options.color = v
|
this.options.color = v || 'rgba(255, 0, 0, 0.5)'
|
||||||
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) {
|
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let material = Cesium.Color.fromCssColorString(v)
|
let material = Cesium.Color.fromCssColorString(this.options.color)
|
||||||
if (this.sdk.viewer.scene.mode === 2) {
|
if (this.sdk.viewer.scene.mode === 2) {
|
||||||
material = new Cesium.CustomColorMaterialSource({
|
material = new Cesium.CustomColorMaterialSource({
|
||||||
color: v
|
color: this.options.color
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.entity.polygon.material = material
|
this.entity.polygon.material = material
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
defaultColor: v,
|
defaultColor: this.options.color,
|
||||||
disabled: false,//是否禁止打开颜色选择器
|
disabled: false,//是否禁止打开颜色选择器
|
||||||
openPickerAni: 'opacity',//打开颜色选择器动画
|
openPickerAni: 'opacity',//打开颜色选择器动画
|
||||||
sure: (c) => {
|
sure: (c) => {
|
||||||
this.color = c
|
this.color = c
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,0,0,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.color[i] = colorPicker
|
this._elms.color[i] = colorPicker
|
||||||
@ -253,25 +253,25 @@ class PincerArrowObject extends Base {
|
|||||||
return this.options.line.color
|
return this.options.line.color
|
||||||
}
|
}
|
||||||
set lineColor(v) {
|
set lineColor(v) {
|
||||||
this.options.line.color = v
|
this.options.line.color = v || 'rgba(255, 0, 0, 0.5)'
|
||||||
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) {
|
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.entity.polyline.material = Cesium.Color.fromCssColorString(v)
|
this.entity.polyline.material = Cesium.Color.fromCssColorString(this.options.line.color)
|
||||||
if (this._elms.lineColor) {
|
if (this._elms.lineColor) {
|
||||||
this._elms.lineColor.forEach((item, i) => {
|
this._elms.lineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
defaultColor: v,
|
defaultColor: this.options.line.color,
|
||||||
disabled: false,//是否禁止打开颜色选择器
|
disabled: false,//是否禁止打开颜色选择器
|
||||||
openPickerAni: 'opacity',//打开颜色选择器动画
|
openPickerAni: 'opacity',//打开颜色选择器动画
|
||||||
sure: (c) => {
|
sure: (c) => {
|
||||||
this.lineColor = c
|
this.lineColor = c
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.lineColor = 'rgba(255,255,255,1)'
|
this.lineColor = 'rgba(255,0,0,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.lineColor[i] = lineColorPicker
|
this._elms.lineColor[i] = lineColorPicker
|
||||||
@ -283,10 +283,10 @@ class PincerArrowObject extends Base {
|
|||||||
return this.options.line.width
|
return this.options.line.width
|
||||||
}
|
}
|
||||||
set lineWidth(v) {
|
set lineWidth(v) {
|
||||||
this.options.line.width = v
|
this.options.line.width = ((v || v === 0) ? v : 3)
|
||||||
this.entity.polyline.width = v
|
this.entity.polyline.width = this.options.line.width
|
||||||
this._elms.lineWidth && this._elms.lineWidth.forEach((item) => {
|
this._elms.lineWidth && this._elms.lineWidth.forEach((item) => {
|
||||||
item.value = v
|
item.value = this.options.line.width
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,7 +368,7 @@ class PincerArrowObject extends Base {
|
|||||||
this.label.color = v
|
this.label.color = v
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -468,7 +468,7 @@ class PincerArrowObject extends Base {
|
|||||||
this.label.lineColor = v
|
this.label.lineColor = v
|
||||||
if (this._elms.labelLineColor) {
|
if (this._elms.labelLineColor) {
|
||||||
this._elms.labelLineColor.forEach((item, i) => {
|
this._elms.labelLineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -479,7 +479,7 @@ class PincerArrowObject extends Base {
|
|||||||
this.labelLineColor = color
|
this.labelLineColor = color
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(0,255,255,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.labelLineColor[i] = lineColorPicker
|
this._elms.labelLineColor[i] = lineColorPicker
|
||||||
@ -495,7 +495,7 @@ class PincerArrowObject extends Base {
|
|||||||
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -521,7 +521,7 @@ class PincerArrowObject extends Base {
|
|||||||
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1192,7 +1192,7 @@ class PincerArrowObject extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('pincer-arrow-object-edit-tabs', undefined, this.sdk)
|
let tabsElm = new cy_tabs('pincer-arrow-object-edit-tabs', undefined, this.sdk)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1206,7 +1206,7 @@ class PincerArrowObject extends Base {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let linecolorPicker = new ewPlugins('colorpicker', {
|
let linecolorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("lineColor")[0],
|
el: contentElm.getElementsByClassName("lineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1220,7 +1220,7 @@ class PincerArrowObject extends Base {
|
|||||||
this.lineColor = 'rgba(255,255,255,1)'
|
this.lineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelColor")[0],
|
el: contentElm.getElementsByClassName("labelColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1234,7 +1234,7 @@ class PincerArrowObject extends Base {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1248,7 +1248,7 @@ class PincerArrowObject extends Base {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -1262,7 +1262,7 @@ class PincerArrowObject extends Base {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
|
|||||||
@ -25,7 +25,7 @@ class PolygonObject extends Base {
|
|||||||
* @param options.id {string} 唯一标识
|
* @param options.id {string} 唯一标识
|
||||||
* @param options.show=true {boolean} 显示/隐藏
|
* @param options.show=true {boolean} 显示/隐藏
|
||||||
* @param options.name {string} 名称
|
* @param options.name {string} 名称
|
||||||
* @param options.color="#36c4ff" {string} 颜色
|
* @param options.color='rgba(255, 0, 0, 0.5)' {string} 颜色
|
||||||
* @param options.height {number} 高度
|
* @param options.height {number} 高度
|
||||||
* @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式)
|
* @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式)
|
||||||
* @param options.line {object} 边框
|
* @param options.line {object} 边框
|
||||||
@ -39,15 +39,15 @@ class PolygonObject extends Base {
|
|||||||
constructor(sdk, options = {}, _Dialog = {}) {
|
constructor(sdk, options = {}, _Dialog = {}) {
|
||||||
super(sdk, options)
|
super(sdk, options)
|
||||||
this.options.name = options.name || '未命名对象'
|
this.options.name = options.name || '未命名对象'
|
||||||
this.options.color = options.color || '#36c4ff'
|
this.options.color = options.color || 'rgba(255, 0, 0, 0.5)'
|
||||||
this.options.show =
|
this.options.show =
|
||||||
options.show || options.show === false ? options.show : true
|
options.show || options.show === false ? options.show : true
|
||||||
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
|
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
|
||||||
this.options.positions = options.positions || []
|
this.options.positions = options.positions || []
|
||||||
this.options.line = options.line || {}
|
this.options.line = options.line || {}
|
||||||
this.options.line.width = this.options.line.width || 2
|
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 =
|
||||||
this.options.line.color || 'rgba(155, 155, 124, 0.89)'
|
this.options.line.color || 'rgba(255, 0, 0, 1)'
|
||||||
this.options['area-unit'] = options['area-unit'] || '平方米'
|
this.options['area-unit'] = options['area-unit'] || '平方米'
|
||||||
this.entity
|
this.entity
|
||||||
this.event = new MouseEvent(this.sdk)
|
this.event = new MouseEvent(this.sdk)
|
||||||
@ -74,8 +74,8 @@ class PolygonObject extends Base {
|
|||||||
options.label.pixelOffset || options.label.pixelOffset === 0
|
options.label.pixelOffset || options.label.pixelOffset === 0
|
||||||
? options.label.pixelOffset
|
? options.label.pixelOffset
|
||||||
: 20,
|
: 20,
|
||||||
backgroundColor: options.label.backgroundColor || ['#42c6ef', '#42c6ef'],
|
backgroundColor: options.label.backgroundColor || ['#00ffff80', '#00ffff80'],
|
||||||
lineColor: options.label.lineColor || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near:
|
near:
|
||||||
options.label.near || options.label.near === 0
|
options.label.near || options.label.near === 0
|
||||||
@ -133,35 +133,35 @@ class PolygonObject extends Base {
|
|||||||
return this.options.color
|
return this.options.color
|
||||||
}
|
}
|
||||||
set color(v) {
|
set color(v) {
|
||||||
this.options.color = v
|
this.options.color = v || 'rgba(255, 0, 0, 0.5)'
|
||||||
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) {
|
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) {
|
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let material = Cesium.Color.fromCssColorString(v)
|
let material = Cesium.Color.fromCssColorString(this.options.color)
|
||||||
if (this.sdk.viewer.scene.mode === 2) {
|
if (this.sdk.viewer.scene.mode === 2) {
|
||||||
this.heightMode = 0
|
this.heightMode = 0
|
||||||
material = new Cesium.CustomColorMaterialSource({
|
material = new Cesium.CustomColorMaterialSource({
|
||||||
color: v
|
color: this.options.color
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.entity.polygon.material = material
|
this.entity.polygon.material = material
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
defaultColor: v,
|
defaultColor: this.options.color,
|
||||||
disabled: false, //是否禁止打开颜色选择器
|
disabled: false, //是否禁止打开颜色选择器
|
||||||
openPickerAni: 'opacity', //打开颜色选择器动画
|
openPickerAni: 'opacity', //打开颜色选择器动画
|
||||||
sure: c => {
|
sure: c => {
|
||||||
this.color = c
|
this.color = c
|
||||||
}, //点击确认按钮事件回调
|
}, //点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,0,0,0.5)'
|
||||||
} //点击清空按钮事件回调
|
} //点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.color[i] = colorPicker
|
this._elms.color[i] = colorPicker
|
||||||
@ -269,25 +269,25 @@ class PolygonObject extends Base {
|
|||||||
return this.options.line.color
|
return this.options.line.color
|
||||||
}
|
}
|
||||||
set lineColor(v) {
|
set lineColor(v) {
|
||||||
this.options.line.color = v
|
this.options.line.color = v || 'rgba(255, 0, 0, 0.5)'
|
||||||
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) {
|
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.entity.polyline.material = Cesium.Color.fromCssColorString(v)
|
this.entity.polyline.material = Cesium.Color.fromCssColorString(this.options.line.color)
|
||||||
if (this._elms.lineColor) {
|
if (this._elms.lineColor) {
|
||||||
this._elms.lineColor.forEach((item, i) => {
|
this._elms.lineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
defaultColor: v,
|
defaultColor: this.options.line.color,
|
||||||
disabled: false, //是否禁止打开颜色选择器
|
disabled: false, //是否禁止打开颜色选择器
|
||||||
openPickerAni: 'opacity', //打开颜色选择器动画
|
openPickerAni: 'opacity', //打开颜色选择器动画
|
||||||
sure: c => {
|
sure: c => {
|
||||||
this.lineColor = c
|
this.lineColor = c
|
||||||
}, //点击确认按钮事件回调
|
}, //点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.lineColor = 'rgba(255,255,255,1)'
|
this.lineColor = 'rgba(255,0,0,0.5)'
|
||||||
} //点击清空按钮事件回调
|
} //点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.lineColor[i] = lineColorPicker
|
this._elms.lineColor[i] = lineColorPicker
|
||||||
@ -299,8 +299,8 @@ class PolygonObject extends Base {
|
|||||||
return this.options.line.width
|
return this.options.line.width
|
||||||
}
|
}
|
||||||
set lineWidth(v) {
|
set lineWidth(v) {
|
||||||
this.options.line.width = v
|
this.options.line.width = ((v || v === 0) ? v : 3)
|
||||||
this.entity.polyline.width = v
|
this.entity.polyline.width = this.options.line.width
|
||||||
this._elms.lineWidth &&
|
this._elms.lineWidth &&
|
||||||
this._elms.lineWidth.forEach(item => {
|
this._elms.lineWidth.forEach(item => {
|
||||||
item.value = v
|
item.value = v
|
||||||
@ -389,7 +389,7 @@ class PolygonObject extends Base {
|
|||||||
this.label.color = v
|
this.label.color = v
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
@ -493,7 +493,7 @@ class PolygonObject extends Base {
|
|||||||
this.label.lineColor = v
|
this.label.lineColor = v
|
||||||
if (this._elms.labelLineColor) {
|
if (this._elms.labelLineColor) {
|
||||||
this._elms.labelLineColor.forEach((item, i) => {
|
this._elms.labelLineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
@ -504,7 +504,7 @@ class PolygonObject extends Base {
|
|||||||
this.labelLineColor = color
|
this.labelLineColor = color
|
||||||
}, //点击确认按钮事件回调
|
}, //点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(0,255,255,0.5)'
|
||||||
} //点击清空按钮事件回调
|
} //点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.labelLineColor[i] = lineColorPicker
|
this._elms.labelLineColor[i] = lineColorPicker
|
||||||
@ -520,7 +520,7 @@ class PolygonObject extends Base {
|
|||||||
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
@ -548,7 +548,7 @@ class PolygonObject extends Base {
|
|||||||
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
@ -1270,7 +1270,7 @@ class PolygonObject extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('polygon-object-edit-tabs', undefined, this.sdk)
|
let tabsElm = new cy_tabs('polygon-object-edit-tabs', undefined, this.sdk)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName('color')[0],
|
el: contentElm.getElementsByClassName('color')[0],
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
@ -1284,7 +1284,7 @@ class PolygonObject extends Base {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
} //点击清空按钮事件回调
|
} //点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let linecolorPicker = new ewPlugins('colorpicker', {
|
let linecolorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName('lineColor')[0],
|
el: contentElm.getElementsByClassName('lineColor')[0],
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
@ -1298,7 +1298,7 @@ class PolygonObject extends Base {
|
|||||||
this.lineColor = 'rgba(255,255,255,1)'
|
this.lineColor = 'rgba(255,255,255,1)'
|
||||||
} //点击清空按钮事件回调
|
} //点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName('labelColor')[0],
|
el: contentElm.getElementsByClassName('labelColor')[0],
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
@ -1312,7 +1312,7 @@ class PolygonObject extends Base {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
} //点击清空按钮事件回调
|
} //点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName('labelLineColor')[0],
|
el: contentElm.getElementsByClassName('labelLineColor')[0],
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
@ -1326,7 +1326,7 @@ class PolygonObject extends Base {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
} //点击清空按钮事件回调
|
} //点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName('labelBackgroundColorStart')[0],
|
el: contentElm.getElementsByClassName('labelBackgroundColorStart')[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -1340,7 +1340,7 @@ class PolygonObject extends Base {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName('labelBackgroundColorEnd')[0],
|
el: contentElm.getElementsByClassName('labelBackgroundColorEnd')[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
|
|||||||
@ -21,6 +21,7 @@ class eventBinding {
|
|||||||
let Event = []
|
let Event = []
|
||||||
let isEvent = false
|
let isEvent = false
|
||||||
let removeName = []
|
let removeName = []
|
||||||
|
let blurEvent = () => { }
|
||||||
if (!elements[i] || !elements[i].attributes) {
|
if (!elements[i] || !elements[i].attributes) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -36,7 +37,8 @@ class eventBinding {
|
|||||||
Event.push((e) => {
|
Event.push((e) => {
|
||||||
let value = e.target.value
|
let value = e.target.value
|
||||||
if (e.target.type == 'number') {
|
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)
|
value = Number(value)
|
||||||
if((e.target.max) && value>Number(e.target.max)) {
|
if((e.target.max) && value>Number(e.target.max)) {
|
||||||
value = Number(e.target.max)
|
value = Number(e.target.max)
|
||||||
@ -57,6 +59,22 @@ class eventBinding {
|
|||||||
that[m.value] = value
|
that[m.value] = value
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
blurEvent = (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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
that[m.value] = value
|
||||||
|
}
|
||||||
if(elements[i].nodeName=='IMG') {
|
if(elements[i].nodeName=='IMG') {
|
||||||
elements[i].src = that[m.value]
|
elements[i].src = that[m.value]
|
||||||
}
|
}
|
||||||
@ -114,6 +132,7 @@ class eventBinding {
|
|||||||
Event[t](e)
|
Event[t](e)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
elements[i].addEventListener('blur', blurEvent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,7 @@ class PolyhedronObject extends Base {
|
|||||||
* @param options.id {string} 唯一标识
|
* @param options.id {string} 唯一标识
|
||||||
* @param options.show=true {boolean} 显示/隐藏
|
* @param options.show=true {boolean} 显示/隐藏
|
||||||
* @param options.name {string} 名称
|
* @param options.name {string} 名称
|
||||||
* @param options.color="#0df7f8" {string} 颜色
|
* @param options.color="#ff0000" {string} 颜色
|
||||||
* @param options.height=10 {number} 高
|
* @param options.height=10 {number} 高
|
||||||
* @param {Array.<object>} options.positions 经纬度和高度的列表,值交替 [{lon,lat,alt},...]
|
* @param {Array.<object>} options.positions 经纬度和高度的列表,值交替 [{lon,lat,alt},...]
|
||||||
* @param _Dialog {object} 弹框事件
|
* @param _Dialog {object} 弹框事件
|
||||||
@ -32,7 +32,7 @@ class PolyhedronObject extends Base {
|
|||||||
* */
|
* */
|
||||||
constructor(sdk, options = {}, _Dialog = {}) {
|
constructor(sdk, options = {}, _Dialog = {}) {
|
||||||
super(sdk, options);
|
super(sdk, options);
|
||||||
this.options.color = options.color || "#0df7f8"
|
this.options.color = options.color || "#ff0000"
|
||||||
this.options.show = (options.show || options.show === false) ? options.show : true
|
this.options.show = (options.show || options.show === false) ? options.show : true
|
||||||
this.options.height = (options.height || options.height === 0) ? options.height : 10
|
this.options.height = (options.height || options.height === 0) ? options.height : 10
|
||||||
if (this.options.height <= 0.01) {
|
if (this.options.height <= 0.01) {
|
||||||
@ -54,8 +54,8 @@ class PolyhedronObject extends Base {
|
|||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
||||||
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
|
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 || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
@ -381,7 +381,7 @@ class PolyhedronObject extends Base {
|
|||||||
return this.options.color
|
return this.options.color
|
||||||
}
|
}
|
||||||
set color(v) {
|
set color(v) {
|
||||||
this.options.color = v
|
this.options.color = v || '#ff0000'
|
||||||
if(!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) {
|
if(!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -394,11 +394,11 @@ class PolyhedronObject extends Base {
|
|||||||
this.entity.polygon.material = material
|
this.entity.polygon.material = material
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
defaultColor: v,
|
defaultColor: this.options.color,
|
||||||
disabled: false,//是否禁止打开颜色选择器
|
disabled: false,//是否禁止打开颜色选择器
|
||||||
openPickerAni: 'opacity',//打开颜色选择器动画
|
openPickerAni: 'opacity',//打开颜色选择器动画
|
||||||
sure: (c) => {
|
sure: (c) => {
|
||||||
@ -551,7 +551,7 @@ class PolyhedronObject extends Base {
|
|||||||
this.label.color = v
|
this.label.color = v
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -651,7 +651,7 @@ class PolyhedronObject extends Base {
|
|||||||
this.label.lineColor = v
|
this.label.lineColor = v
|
||||||
if (this._elms.labelLineColor) {
|
if (this._elms.labelLineColor) {
|
||||||
this._elms.labelLineColor.forEach((item, i) => {
|
this._elms.labelLineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -662,7 +662,7 @@ class PolyhedronObject extends Base {
|
|||||||
this.labelLineColor = color
|
this.labelLineColor = color
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(0,255,255,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.labelLineColor[i] = lineColorPicker
|
this._elms.labelLineColor[i] = lineColorPicker
|
||||||
@ -678,7 +678,7 @@ class PolyhedronObject extends Base {
|
|||||||
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -704,7 +704,7 @@ class PolyhedronObject extends Base {
|
|||||||
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1105,7 +1105,7 @@ class PolyhedronObject extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('polygon-object-edit-tabs', undefined, this.sdk)
|
let tabsElm = new cy_tabs('polygon-object-edit-tabs', undefined, this.sdk)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1119,7 +1119,7 @@ class PolyhedronObject extends Base {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelColor")[0],
|
el: contentElm.getElementsByClassName("labelColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1133,7 +1133,7 @@ class PolyhedronObject extends Base {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1147,7 +1147,7 @@ class PolyhedronObject extends Base {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -1161,7 +1161,7 @@ class PolyhedronObject extends Base {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
|
|||||||
@ -53,8 +53,8 @@ class PolyhedronObject extends Base {
|
|||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
||||||
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
|
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 || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
@ -347,7 +347,7 @@ class PolyhedronObject extends Base {
|
|||||||
this.entity.polygon.material = Cesium.Color.fromCssColorString(v)
|
this.entity.polygon.material = Cesium.Color.fromCssColorString(v)
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -488,7 +488,7 @@ class PolyhedronObject extends Base {
|
|||||||
this.label.color = v
|
this.label.color = v
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -588,7 +588,7 @@ class PolyhedronObject extends Base {
|
|||||||
this.label.lineColor = v
|
this.label.lineColor = v
|
||||||
if (this._elms.labelLineColor) {
|
if (this._elms.labelLineColor) {
|
||||||
this._elms.labelLineColor.forEach((item, i) => {
|
this._elms.labelLineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -599,7 +599,7 @@ class PolyhedronObject extends Base {
|
|||||||
this.labelLineColor = color
|
this.labelLineColor = color
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(0,255,255,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.labelLineColor[i] = lineColorPicker
|
this._elms.labelLineColor[i] = lineColorPicker
|
||||||
@ -615,7 +615,7 @@ class PolyhedronObject extends Base {
|
|||||||
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -641,7 +641,7 @@ class PolyhedronObject extends Base {
|
|||||||
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -890,7 +890,7 @@ class PolyhedronObject extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('polygon-object-edit-tabs', undefined, this.sdk)
|
let tabsElm = new cy_tabs('polygon-object-edit-tabs', undefined, this.sdk)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -904,7 +904,7 @@ class PolyhedronObject extends Base {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelColor")[0],
|
el: contentElm.getElementsByClassName("labelColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -918,7 +918,7 @@ class PolyhedronObject extends Base {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -932,7 +932,7 @@ class PolyhedronObject extends Base {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -946,7 +946,7 @@ class PolyhedronObject extends Base {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { attributeElm, labelStyleElm1, labelStyleElm2 } from '../../Element/elm_html'
|
import { attributeElm, labelStyleElm1, labelStyleElm2 } from '../../Element/elm_html'
|
||||||
|
|
||||||
function html(that) {
|
function html(that) {
|
||||||
return `
|
return `
|
||||||
<span class="custom-divider"></span>
|
<span class="custom-divider"></span>
|
||||||
<div class="div-item">
|
<div class="div-item">
|
||||||
<div class="row" style="align-items: flex-start;">
|
<div class="row" style="align-items: flex-start;">
|
||||||
@ -9,22 +9,15 @@ function html(that) {
|
|||||||
<span class="label">名称</span>
|
<span class="label">名称</span>
|
||||||
<input class="input" maxlength="40" type="text" @model="name">
|
<input class="input" maxlength="40" type="text" @model="name">
|
||||||
</div>
|
</div>
|
||||||
<div class="col" style="flex: 0 0 54%;">
|
<div class="col" style="flex: 0 0 56%;">
|
||||||
<div>
|
<div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col input-select-unit-box">
|
<div class="col input-select-unit-box">
|
||||||
<span class="label">原始长度:</span>
|
<div class="input-select-unit"></div>
|
||||||
<input class="input input-text" readonly="readonly" type="text" style="flex: 0 0 130px;" @model="length">
|
<input class="input input-text" readonly="readonly" type="text" style="flex: 0 0 130px;" @model="length">
|
||||||
<div class="input-select-unit"></div>
|
<div class="input-select-unit"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
|
||||||
<div class="col input-select-fit-unit-box">
|
|
||||||
<span class="label">拟合长度:</span>
|
|
||||||
<input class="input input-text" readonly="readonly" type="text" style="flex: 0 0 130px;" @model="fitLength">
|
|
||||||
<div class="input-select-fit-unit"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -48,7 +41,7 @@ function html(that) {
|
|||||||
<span class="unit">m</span>
|
<span class="unit">m</span>
|
||||||
<span class="arrow"></span>
|
<span class="arrow"></span>
|
||||||
</div>
|
</div>
|
||||||
<button class="confirm height-confirm" style="margin-left: 5px;">确认</button>
|
<button class="confirm height-confirm" style="margin-left: 5px;">应用</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -72,7 +65,7 @@ function html(that) {
|
|||||||
<span class="label">线条颜色</span>
|
<span class="label">线条颜色</span>
|
||||||
<div class="color"></div>
|
<div class="color"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col" style="flex: 0 0 33%;">
|
||||||
<span class="label">线条宽度</span>
|
<span class="label">线条宽度</span>
|
||||||
<div class="input-number input-number-unit-1" style="width: 80px;">
|
<div class="input-number input-number-unit-1" style="width: 80px;">
|
||||||
<input class="input" type="number" title="" min="1" max="999" @model="lineWidth">
|
<input class="input" type="number" title="" min="1" max="999" @model="lineWidth">
|
||||||
@ -80,7 +73,7 @@ function html(that) {
|
|||||||
<span class="arrow"></span>
|
<span class="arrow"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col input-select-line-type-box">
|
<div class="col input-select-line-type-box" style="flex: 0 0 37%;">
|
||||||
<span class="label">线条形式</span>
|
<span class="label">线条形式</span>
|
||||||
<div class="input-select-line-type"></div>
|
<div class="input-select-line-type"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -90,11 +83,11 @@ function html(that) {
|
|||||||
<span class="label">首尾相连</span>
|
<span class="label">首尾相连</span>
|
||||||
<input class="btn-switch" type="checkbox" @model="noseToTail">
|
<input class="btn-switch" type="checkbox" @model="noseToTail">
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col" style="flex: 0 0 33%;">
|
||||||
<span class="label">线段圆滑</span>
|
<span class="label">线段圆滑</span>
|
||||||
<input class="btn-switch" type="checkbox" @model="smooth">
|
<input class="btn-switch" type="checkbox" @model="smooth">
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col" style="flex: 0 0 37%;">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -102,7 +95,7 @@ function html(that) {
|
|||||||
<span class="label">线段缓冲</span>
|
<span class="label">线段缓冲</span>
|
||||||
<input class="btn-switch" type="checkbox" @model="extend">
|
<input class="btn-switch" type="checkbox" @model="extend">
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col" style="flex: 0 0 33%;">
|
||||||
<span class="label">缓冲宽度</span>
|
<span class="label">缓冲宽度</span>
|
||||||
<div class="input-number input-number-unit-1" style="width: 80px;">
|
<div class="input-number input-number-unit-1" style="width: 80px;">
|
||||||
<input class="input" type="number" title="" min="0" data-min="0.01" max="999999" @model="extendWidth">
|
<input class="input" type="number" title="" min="0" data-min="0.01" max="999999" @model="extendWidth">
|
||||||
@ -110,11 +103,32 @@ function html(that) {
|
|||||||
<span class="arrow"></span>
|
<span class="arrow"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col" style="flex: 0 0 37%;">
|
||||||
<span class="label">缓冲颜色</span>
|
<span class="label">缓冲颜色</span>
|
||||||
<div class="extendColor"></div>
|
<div class="extendColor"></div>
|
||||||
</div>
|
</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>
|
||||||
<DIV-cy-tab-pane label="标注风格">
|
<DIV-cy-tab-pane label="标注风格">
|
||||||
${labelStyleElm1()}
|
${labelStyleElm1()}
|
||||||
|
|||||||
@ -22,7 +22,7 @@ class eventBinding {
|
|||||||
let isEvent = false
|
let isEvent = false
|
||||||
let removeName = []
|
let removeName = []
|
||||||
if (!elements[i] || !elements[i].attributes) {
|
if (!elements[i] || !elements[i].attributes) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
for (let m of elements[i].attributes) {
|
for (let m of elements[i].attributes) {
|
||||||
switch (m.name) {
|
switch (m.name) {
|
||||||
@ -38,13 +38,15 @@ class eventBinding {
|
|||||||
if (e.target.type == 'number') {
|
if (e.target.type == 'number') {
|
||||||
if (e.data != '.' && (e.data != '-' || e.target.value)) {
|
if (e.data != '.' && (e.data != '-' || e.target.value)) {
|
||||||
value = Number(value)
|
value = Number(value)
|
||||||
if((e.target.max) && value>Number(e.target.max)) {
|
if ((e.target.max) && value > Number(e.target.max)) {
|
||||||
value = Number(e.target.max)
|
value = Number(e.target.max)
|
||||||
|
e.target.value = value
|
||||||
}
|
}
|
||||||
if((e.target.min) && value<Number(e.target.min)) {
|
if ((e.target.min) && value < Number(e.target.min)) {
|
||||||
value = Number(e.target.min)
|
value = Number(e.target.min)
|
||||||
|
e.target.value = value
|
||||||
}
|
}
|
||||||
if((e.target.dataset.min) && value<Number(e.target.dataset.min)) {
|
if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) {
|
||||||
value = Number(e.target.dataset.min)
|
value = Number(e.target.dataset.min)
|
||||||
}
|
}
|
||||||
that[m.value] = value
|
that[m.value] = value
|
||||||
@ -54,14 +56,14 @@ class eventBinding {
|
|||||||
that[m.value] = value
|
that[m.value] = value
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if(elements[i].nodeName=='IMG') {
|
if (elements[i].nodeName == 'IMG') {
|
||||||
elements[i].src = that[m.value]
|
elements[i].src = that[m.value]
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
elements[i].value = that[m.value]
|
elements[i].value = that[m.value]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(this.element[m.value]) {
|
if (this.element[m.value]) {
|
||||||
this.element[m.value].push(elements[i])
|
this.element[m.value].push(elements[i])
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -84,7 +86,7 @@ class eventBinding {
|
|||||||
isEvent = true
|
isEvent = true
|
||||||
Event.push((e) => {
|
Event.push((e) => {
|
||||||
let value = e.target.value
|
let value = e.target.value
|
||||||
if(e.target.type == 'number' && value!='') {
|
if (e.target.type == 'number' && value != '') {
|
||||||
value = Number(value)
|
value = Number(value)
|
||||||
e.target.value = value
|
e.target.value = value
|
||||||
}
|
}
|
||||||
@ -97,7 +99,7 @@ class eventBinding {
|
|||||||
}
|
}
|
||||||
// elements[i].attributes[m] = undefined
|
// elements[i].attributes[m] = undefined
|
||||||
}
|
}
|
||||||
for(let n=0;n<removeName.length;n++) {
|
for (let n = 0; n < removeName.length; n++) {
|
||||||
elements[i].attributes.removeNamedItem(removeName[n])
|
elements[i].attributes.removeNamedItem(removeName[n])
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,4 +119,4 @@ class eventBinding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const EventBinding = new eventBinding();
|
const EventBinding = new eventBinding();
|
||||||
export default EventBinding;
|
export default EventBinding;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -53,8 +53,8 @@ class RadarScan extends Base {
|
|||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
||||||
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
|
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 || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
@ -246,16 +246,28 @@ class RadarScan extends Base {
|
|||||||
|
|
||||||
set show(v) {
|
set show(v) {
|
||||||
if (typeof v === "boolean") {
|
if (typeof v === "boolean") {
|
||||||
this.options.show = v
|
if (!this.isShowView) {
|
||||||
this.entity.show = v
|
this.options.show = v
|
||||||
|
}
|
||||||
|
if (!this.showView || this.showView == 3) {
|
||||||
|
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) {
|
if (this._DialogObject && this._DialogObject.showBtn) {
|
||||||
this._DialogObject.showBtn.checked = v
|
this._DialogObject.showBtn.checked = v
|
||||||
}
|
}
|
||||||
if (this.options.label.show && this.label) {
|
|
||||||
this.label.show = v
|
|
||||||
}
|
|
||||||
syncData(this.sdk, this.options.id)
|
syncData(this.sdk, this.options.id)
|
||||||
syncSplitData(this.sdk, this.options.id)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
|
this.isShowView = false
|
||||||
} else {
|
} else {
|
||||||
console.error("参数必须为boolean")
|
console.error("参数必须为boolean")
|
||||||
}
|
}
|
||||||
@ -425,7 +437,7 @@ class RadarScan extends Base {
|
|||||||
this.changeMaterial()
|
this.changeMaterial()
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -449,7 +461,7 @@ class RadarScan extends Base {
|
|||||||
}
|
}
|
||||||
set labelShow(v) {
|
set labelShow(v) {
|
||||||
this.options.label.show = v
|
this.options.label.show = v
|
||||||
if (this.show) {
|
if (this.show && (!this.showView || this.showView == 3)) {
|
||||||
this.label.show = v
|
this.label.show = v
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -483,7 +495,7 @@ class RadarScan extends Base {
|
|||||||
this.label.color = v
|
this.label.color = v
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -583,7 +595,7 @@ class RadarScan extends Base {
|
|||||||
this.label.lineColor = v
|
this.label.lineColor = v
|
||||||
if (this._elms.labelLineColor) {
|
if (this._elms.labelLineColor) {
|
||||||
this._elms.labelLineColor.forEach((item, i) => {
|
this._elms.labelLineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -594,7 +606,7 @@ class RadarScan extends Base {
|
|||||||
this.labelLineColor = color
|
this.labelLineColor = color
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(0,255,255,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.labelLineColor[i] = lineColorPicker
|
this._elms.labelLineColor[i] = lineColorPicker
|
||||||
@ -610,7 +622,7 @@ class RadarScan extends Base {
|
|||||||
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -636,7 +648,7 @@ class RadarScan extends Base {
|
|||||||
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1124,7 +1136,7 @@ class RadarScan extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk)
|
let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1138,7 +1150,7 @@ class RadarScan extends Base {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelColor")[0],
|
el: contentElm.getElementsByClassName("labelColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1152,7 +1164,7 @@ class RadarScan extends Base {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1166,7 +1178,7 @@ class RadarScan extends Base {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -1180,7 +1192,7 @@ class RadarScan extends Base {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
|
|||||||
@ -58,8 +58,8 @@ class RadarScanStereoscopic extends Base {
|
|||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
||||||
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
|
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 || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
@ -86,6 +86,10 @@ class RadarScanStereoscopic extends Base {
|
|||||||
RadarScanStereoscopic.radarSolidScan(this)
|
RadarScanStereoscopic.radarSolidScan(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get type() {
|
||||||
|
return 'RadarScanStereoscopic'
|
||||||
|
}
|
||||||
|
|
||||||
static radarSolidScan(that) {
|
static radarSolidScan(that) {
|
||||||
let viewer = that.sdk.viewer
|
let viewer = that.sdk.viewer
|
||||||
let options = that.options
|
let options = that.options
|
||||||
@ -369,7 +373,7 @@ class RadarScanStereoscopic extends Base {
|
|||||||
this.entity.ellipsoid.outlineColor = Cesium.Color.fromCssColorString(v)
|
this.entity.ellipsoid.outlineColor = Cesium.Color.fromCssColorString(v)
|
||||||
if (this._elms.colorOut) {
|
if (this._elms.colorOut) {
|
||||||
this._elms.colorOut.forEach((item, i) => {
|
this._elms.colorOut.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -396,7 +400,7 @@ class RadarScanStereoscopic extends Base {
|
|||||||
this.entity.wall.material = Cesium.Color.fromCssColorString(v)
|
this.entity.wall.material = Cesium.Color.fromCssColorString(v)
|
||||||
if (this._elms.colorIn) {
|
if (this._elms.colorIn) {
|
||||||
this._elms.colorIn.forEach((item, i) => {
|
this._elms.colorIn.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -454,7 +458,7 @@ class RadarScanStereoscopic extends Base {
|
|||||||
this.label.color = v
|
this.label.color = v
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -554,7 +558,7 @@ class RadarScanStereoscopic extends Base {
|
|||||||
this.label.lineColor = v
|
this.label.lineColor = v
|
||||||
if (this._elms.labelLineColor) {
|
if (this._elms.labelLineColor) {
|
||||||
this._elms.labelLineColor.forEach((item, i) => {
|
this._elms.labelLineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -565,7 +569,7 @@ class RadarScanStereoscopic extends Base {
|
|||||||
this.labelLineColor = color
|
this.labelLineColor = color
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(0,255,255,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.labelLineColor[i] = lineColorPicker
|
this._elms.labelLineColor[i] = lineColorPicker
|
||||||
@ -581,7 +585,7 @@ class RadarScanStereoscopic extends Base {
|
|||||||
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -607,7 +611,7 @@ class RadarScanStereoscopic extends Base {
|
|||||||
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1026,7 +1030,7 @@ class RadarScanStereoscopic extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk)
|
let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorOutPicker = new ewPlugins('colorpicker', {
|
let colorOutPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("colorOut")[0],
|
el: contentElm.getElementsByClassName("colorOut")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1040,7 +1044,7 @@ class RadarScanStereoscopic extends Base {
|
|||||||
this.colorOut = 'rgba(255,255,255,1)'
|
this.colorOut = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let colorInPicker = new ewPlugins('colorpicker', {
|
let colorInPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("colorIn")[0],
|
el: contentElm.getElementsByClassName("colorIn")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1054,7 +1058,7 @@ class RadarScanStereoscopic extends Base {
|
|||||||
this.colorIn = 'rgba(255,255,255,1)'
|
this.colorIn = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelColor")[0],
|
el: contentElm.getElementsByClassName("labelColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1068,7 +1072,7 @@ class RadarScanStereoscopic extends Base {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1082,7 +1086,7 @@ class RadarScanStereoscopic extends Base {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -1096,7 +1100,7 @@ class RadarScanStereoscopic extends Base {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
|
|||||||
@ -27,7 +27,7 @@ class Corridor extends Base {
|
|||||||
fromDegreesArray.push(positions[i].lng, positions[i].lat)
|
fromDegreesArray.push(positions[i].lng, positions[i].lat)
|
||||||
}
|
}
|
||||||
|
|
||||||
let length = this.computeDistance(positions)
|
let length = this.computeDistance2(positions)
|
||||||
|
|
||||||
let geometry = new Cesium.CorridorGeometry({
|
let geometry = new Cesium.CorridorGeometry({
|
||||||
positions: Cesium.Cartesian3.fromDegreesArray(fromDegreesArray),
|
positions: Cesium.Cartesian3.fromDegreesArray(fromDegreesArray),
|
||||||
|
|||||||
@ -31,7 +31,7 @@ class Corridor extends Base {
|
|||||||
fromDegreesArray.push(positions[i].lng, positions[i].lat)
|
fromDegreesArray.push(positions[i].lng, positions[i].lat)
|
||||||
}
|
}
|
||||||
|
|
||||||
let length = this.computeDistance(positions)
|
let length = this.computeDistance2(positions)
|
||||||
|
|
||||||
let geometry = new Cesium.CorridorGeometry({
|
let geometry = new Cesium.CorridorGeometry({
|
||||||
positions: Cesium.Cartesian3.fromDegreesArray(fromDegreesArray),
|
positions: Cesium.Cartesian3.fromDegreesArray(fromDegreesArray),
|
||||||
|
|||||||
@ -23,7 +23,7 @@ class SectorObject extends Base {
|
|||||||
* @param options.id {string} 标注id
|
* @param options.id {string} 标注id
|
||||||
* @param options.name {string} 名称
|
* @param options.name {string} 名称
|
||||||
* @param options.show=true {boolean} 显示/隐藏
|
* @param options.show=true {boolean} 显示/隐藏
|
||||||
* @param options.color="#36c4ff" {string} 颜色
|
* @param options.color="rgba(255, 0, 0, 0.5)" {string} 颜色
|
||||||
* @param options.center {object} 位置
|
* @param options.center {object} 位置
|
||||||
* @param options.center.lng {object} 经度
|
* @param options.center.lng {object} 经度
|
||||||
* @param options.center.lat {object} 维度
|
* @param options.center.lat {object} 维度
|
||||||
@ -31,7 +31,7 @@ class SectorObject extends Base {
|
|||||||
* @param options.startAngle=10 {number} 起始方向
|
* @param options.startAngle=10 {number} 起始方向
|
||||||
* @param options.endAngle=0 {number} 结束方向
|
* @param options.endAngle=0 {number} 结束方向
|
||||||
* @param options.line {object} 边框
|
* @param options.line {object} 边框
|
||||||
* @param options.line.width=2 {string} 边框宽
|
* @param options.line.width=3 {string} 边框宽
|
||||||
* @param options.line.color="rgba(155, 155, 124, 0.89)" {string} 边框颜色
|
* @param options.line.color="rgba(155, 155, 124, 0.89)" {string} 边框颜色
|
||||||
* @param options.label {object} 标注
|
* @param options.label {object} 标注
|
||||||
* @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式)
|
* @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式)
|
||||||
@ -39,15 +39,15 @@ class SectorObject extends Base {
|
|||||||
constructor(sdk, options = {}) {
|
constructor(sdk, options = {}) {
|
||||||
super(sdk, options);
|
super(sdk, options);
|
||||||
this.options.name = options.name || '未命名对象'
|
this.options.name = options.name || '未命名对象'
|
||||||
this.options.color = options.color || "#36c4ff"
|
this.options.color = options.color || "rgba(255, 0, 0, 0.5)"
|
||||||
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
|
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
|
||||||
this.options.semiMinorAxis = (options.semiMinorAxis || options.semiMinorAxis === 0) ? options.semiMinorAxis : 10
|
this.options.semiMinorAxis = (options.semiMinorAxis || options.semiMinorAxis === 0) ? options.semiMinorAxis : 10
|
||||||
this.options.semiMajorAxis = (options.semiMajorAxis || options.semiMajorAxis === 0) ? options.semiMajorAxis : 20
|
this.options.semiMajorAxis = (options.semiMajorAxis || options.semiMajorAxis === 0) ? options.semiMajorAxis : 20
|
||||||
this.options.show = (options.show || options.show === false) ? options.show : true
|
this.options.show = (options.show || options.show === false) ? options.show : true
|
||||||
this.options.center = options.center || {}
|
this.options.center = options.center || {}
|
||||||
this.options.line = options.line || {}
|
this.options.line = options.line || {}
|
||||||
this.options.line.width = this.options.line.width || 2
|
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(155, 155, 124, 0.89)'
|
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)'
|
||||||
this.options['area-unit'] = options['area-unit'] || '平方米'
|
this.options['area-unit'] = options['area-unit'] || '平方米'
|
||||||
options.label = options.label || {}
|
options.label = options.label || {}
|
||||||
this._elms = {};
|
this._elms = {};
|
||||||
@ -60,8 +60,8 @@ class SectorObject extends Base {
|
|||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
||||||
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
|
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 || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
@ -226,32 +226,32 @@ class SectorObject extends Base {
|
|||||||
return this.options.color
|
return this.options.color
|
||||||
}
|
}
|
||||||
set color(v) {
|
set color(v) {
|
||||||
this.options.color = v
|
this.options.color = v || 'rgba(255, 0, 0, 0.5)'
|
||||||
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) {
|
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let material = Cesium.Color.fromCssColorString(v)
|
let material = Cesium.Color.fromCssColorString(this.options.color)
|
||||||
if (this.sdk.viewer.scene.mode === 2) {
|
if (this.sdk.viewer.scene.mode === 2) {
|
||||||
material = new Cesium.CustomColorMaterialSource({
|
material = new Cesium.CustomColorMaterialSource({
|
||||||
color: v
|
color: this.options.color
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.entity.polygon.material = material
|
this.entity.polygon.material = material
|
||||||
this.entity.polyline.width = this.lineWidth
|
this.entity.polyline.width = this.lineWidth
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
defaultColor: v,
|
defaultColor: this.options.color,
|
||||||
disabled: false,//是否禁止打开颜色选择器
|
disabled: false,//是否禁止打开颜色选择器
|
||||||
openPickerAni: 'opacity',//打开颜色选择器动画
|
openPickerAni: 'opacity',//打开颜色选择器动画
|
||||||
sure: (c) => {
|
sure: (c) => {
|
||||||
this.color = c
|
this.color = c
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,0,0,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.color[i] = colorPicker
|
this._elms.color[i] = colorPicker
|
||||||
@ -263,25 +263,25 @@ class SectorObject extends Base {
|
|||||||
return this.options.line.color
|
return this.options.line.color
|
||||||
}
|
}
|
||||||
set lineColor(v) {
|
set lineColor(v) {
|
||||||
this.options.line.color = v
|
this.options.line.color = v || 'rgba(255, 0, 0, 0.5)'
|
||||||
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) {
|
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.entity.polyline.material = Cesium.Color.fromCssColorString(v)
|
this.entity.polyline.material = Cesium.Color.fromCssColorString(this.options.line.color)
|
||||||
if (this._elms.lineColor) {
|
if (this._elms.lineColor) {
|
||||||
this._elms.lineColor.forEach((item, i) => {
|
this._elms.lineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
defaultColor: v,
|
defaultColor: this.options.line.color,
|
||||||
disabled: false,//是否禁止打开颜色选择器
|
disabled: false,//是否禁止打开颜色选择器
|
||||||
openPickerAni: 'opacity',//打开颜色选择器动画
|
openPickerAni: 'opacity',//打开颜色选择器动画
|
||||||
sure: (c) => {
|
sure: (c) => {
|
||||||
this.lineColor = c
|
this.lineColor = c
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.lineColor = 'rgba(255,255,255,1)'
|
this.lineColor = 'rgba(255,0,0,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.lineColor[i] = lineColorPicker
|
this._elms.lineColor[i] = lineColorPicker
|
||||||
@ -293,10 +293,10 @@ class SectorObject extends Base {
|
|||||||
return this.options.line.width
|
return this.options.line.width
|
||||||
}
|
}
|
||||||
set lineWidth(v) {
|
set lineWidth(v) {
|
||||||
this.options.line.width = v
|
this.options.line.width = ((v || v === 0) ? v : 3)
|
||||||
this.entity.polyline.width = v
|
this.entity.polyline.width = this.options.line.width
|
||||||
this._elms.lineWidth && this._elms.lineWidth.forEach((item) => {
|
this._elms.lineWidth && this._elms.lineWidth.forEach((item) => {
|
||||||
item.value = v
|
item.value = this.options.line.width
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,7 +378,7 @@ class SectorObject extends Base {
|
|||||||
this.label.color = v
|
this.label.color = v
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -478,7 +478,7 @@ class SectorObject extends Base {
|
|||||||
this.label.lineColor = v
|
this.label.lineColor = v
|
||||||
if (this._elms.labelLineColor) {
|
if (this._elms.labelLineColor) {
|
||||||
this._elms.labelLineColor.forEach((item, i) => {
|
this._elms.labelLineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -489,7 +489,7 @@ class SectorObject extends Base {
|
|||||||
this.labelLineColor = color
|
this.labelLineColor = color
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(0,255,255,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.labelLineColor[i] = lineColorPicker
|
this._elms.labelLineColor[i] = lineColorPicker
|
||||||
@ -505,7 +505,7 @@ class SectorObject extends Base {
|
|||||||
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -531,7 +531,7 @@ class SectorObject extends Base {
|
|||||||
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1175,7 +1175,7 @@ class SectorObject extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('circle-object-edit-tabs', undefined, this.sdk)
|
let tabsElm = new cy_tabs('circle-object-edit-tabs', undefined, this.sdk)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1189,7 +1189,7 @@ class SectorObject extends Base {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let linecolorPicker = new ewPlugins('colorpicker', {
|
let linecolorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("lineColor")[0],
|
el: contentElm.getElementsByClassName("lineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1203,7 +1203,7 @@ class SectorObject extends Base {
|
|||||||
this.lineColor = 'rgba(255,255,255,1)'
|
this.lineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelColor")[0],
|
el: contentElm.getElementsByClassName("labelColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1217,7 +1217,7 @@ class SectorObject extends Base {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labellineColorPicker = new ewPlugins('colorpicker', {
|
let labellineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1231,7 +1231,7 @@ class SectorObject extends Base {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -1245,7 +1245,7 @@ class SectorObject extends Base {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
|
|||||||
@ -24,7 +24,7 @@ class StraightArrowObject extends Base {
|
|||||||
* @param options {object} 属性
|
* @param options {object} 属性
|
||||||
* @param options.show=true {boolean} 显示/隐藏
|
* @param options.show=true {boolean} 显示/隐藏
|
||||||
* @param options.name {string} 名称
|
* @param options.name {string} 名称
|
||||||
* @param options.color="#36c4ff" {string} 颜色
|
* @param options.color="#ff000080" {string} 颜色
|
||||||
* @param options.height {number} 高度
|
* @param options.height {number} 高度
|
||||||
* @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式)
|
* @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式)
|
||||||
* @param {Array.<object>} options.positions 坐标数组 [{lon,lat,alt},...]
|
* @param {Array.<object>} options.positions 坐标数组 [{lon,lat,alt},...]
|
||||||
@ -34,13 +34,13 @@ class StraightArrowObject extends Base {
|
|||||||
constructor(sdk, options = {}, _Dialog = {}) {
|
constructor(sdk, options = {}, _Dialog = {}) {
|
||||||
super(sdk, options);
|
super(sdk, options);
|
||||||
this.options.name = options.name || '未命名对象'
|
this.options.name = options.name || '未命名对象'
|
||||||
this.options.color = options.color || "#36c4ff"
|
this.options.color = options.color || "#ff000080"
|
||||||
this.options.show = (options.show || options.show === false) ? options.show : true
|
this.options.show = (options.show || options.show === false) ? options.show : true
|
||||||
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
|
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
|
||||||
this.options.positions = options.positions || []
|
this.options.positions = options.positions || []
|
||||||
this.options.line = options.line || {}
|
this.options.line = options.line || {}
|
||||||
this.options.line.width = this.options.line.width || 2
|
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(155, 155, 124, 0.89)'
|
this.options.line.color = this.options.line.color || 'rgba(255, 0, 0, 1)'
|
||||||
this.options['area-unit'] = options['area-unit'] || '平方米'
|
this.options['area-unit'] = options['area-unit'] || '平方米'
|
||||||
this.entity
|
this.entity
|
||||||
this.event = new MouseEvent(this.sdk)
|
this.event = new MouseEvent(this.sdk)
|
||||||
@ -60,8 +60,8 @@ class StraightArrowObject extends Base {
|
|||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
||||||
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
|
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 || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
@ -109,24 +109,24 @@ class StraightArrowObject extends Base {
|
|||||||
return this.options.color
|
return this.options.color
|
||||||
}
|
}
|
||||||
set color(v) {
|
set color(v) {
|
||||||
this.options.color = v
|
this.options.color = v || 'rgba(255, 0, 0, 0.5)'
|
||||||
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) {
|
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let material = Cesium.Color.fromCssColorString(v)
|
let material = Cesium.Color.fromCssColorString(this.options.color)
|
||||||
if (this.sdk.viewer.scene.mode === 2) {
|
if (this.sdk.viewer.scene.mode === 2) {
|
||||||
material = new Cesium.CustomColorMaterialSource({
|
material = new Cesium.CustomColorMaterialSource({
|
||||||
color: v
|
color: this.options.color
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.entity.polygon.material = material
|
this.entity.polygon.material = material
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
defaultColor: v,
|
defaultColor: this.options.color,
|
||||||
disabled: false,//是否禁止打开颜色选择器
|
disabled: false,//是否禁止打开颜色选择器
|
||||||
openPickerAni: 'opacity',//打开颜色选择器动画
|
openPickerAni: 'opacity',//打开颜色选择器动画
|
||||||
sure: (c) => {
|
sure: (c) => {
|
||||||
@ -247,7 +247,7 @@ class StraightArrowObject extends Base {
|
|||||||
this.entity.polyline.material = Cesium.Color.fromCssColorString(v)
|
this.entity.polyline.material = Cesium.Color.fromCssColorString(v)
|
||||||
if (this._elms.lineColor) {
|
if (this._elms.lineColor) {
|
||||||
this._elms.lineColor.forEach((item, i) => {
|
this._elms.lineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -355,7 +355,7 @@ class StraightArrowObject extends Base {
|
|||||||
this.label.color = v
|
this.label.color = v
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -455,7 +455,7 @@ class StraightArrowObject extends Base {
|
|||||||
this.label.lineColor = v
|
this.label.lineColor = v
|
||||||
if (this._elms.labelLineColor) {
|
if (this._elms.labelLineColor) {
|
||||||
this._elms.labelLineColor.forEach((item, i) => {
|
this._elms.labelLineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -466,7 +466,7 @@ class StraightArrowObject extends Base {
|
|||||||
this.labelLineColor = color
|
this.labelLineColor = color
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(0,255,255,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.labelLineColor[i] = lineColorPicker
|
this._elms.labelLineColor[i] = lineColorPicker
|
||||||
@ -482,7 +482,7 @@ class StraightArrowObject extends Base {
|
|||||||
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -508,7 +508,7 @@ class StraightArrowObject extends Base {
|
|||||||
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1178,7 +1178,7 @@ class StraightArrowObject extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('assemble-object-edit-tabs', undefined, this.sdk)
|
let tabsElm = new cy_tabs('assemble-object-edit-tabs', undefined, this.sdk)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1192,7 +1192,7 @@ class StraightArrowObject extends Base {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let linecolorPicker = new ewPlugins('colorpicker', {
|
let linecolorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("lineColor")[0],
|
el: contentElm.getElementsByClassName("lineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1206,7 +1206,7 @@ class StraightArrowObject extends Base {
|
|||||||
this.lineColor = 'rgba(255,255,255,1)'
|
this.lineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelColor")[0],
|
el: contentElm.getElementsByClassName("labelColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1220,7 +1220,7 @@ class StraightArrowObject extends Base {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labellineColorPicker = new ewPlugins('colorpicker', {
|
let labellineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1234,7 +1234,7 @@ class StraightArrowObject extends Base {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -1248,7 +1248,7 @@ class StraightArrowObject extends Base {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
|
|||||||
@ -52,7 +52,7 @@ class Text3D extends Base {
|
|||||||
})
|
})
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -236,7 +236,7 @@ class Text3D extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
// let tabsElm = new cy_tabs('radar-scan-edit-tabs')
|
// let tabsElm = new cy_tabs('radar-scan-edit-tabs')
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -250,7 +250,7 @@ class Text3D extends Base {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelColor")[0],
|
el: contentElm.getElementsByClassName("labelColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -264,7 +264,7 @@ class Text3D extends Base {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -278,7 +278,7 @@ class Text3D extends Base {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -292,7 +292,7 @@ class Text3D extends Base {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
|
|||||||
@ -263,7 +263,7 @@ class GroundText extends Base {
|
|||||||
})
|
})
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
@ -401,7 +401,7 @@ class GroundText extends Base {
|
|||||||
this._elms = this._EventBinding.element
|
this._elms = this._EventBinding.element
|
||||||
|
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName('color')[0],
|
el: contentElm.getElementsByClassName('color')[0],
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
|
|||||||
@ -164,7 +164,7 @@ class GroundText extends Base {
|
|||||||
})
|
})
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
@ -302,7 +302,7 @@ class GroundText extends Base {
|
|||||||
this._elms = this._EventBinding.element
|
this._elms = this._EventBinding.element
|
||||||
|
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName('color')[0],
|
el: contentElm.getElementsByClassName('color')[0],
|
||||||
size: 'mini', //颜色box类型
|
size: 'mini', //颜色box类型
|
||||||
alpha: true, //是否开启透明度
|
alpha: true, //是否开启透明度
|
||||||
|
|||||||
@ -94,7 +94,7 @@ class StandText extends Base {
|
|||||||
let minimumHeights = []
|
let minimumHeights = []
|
||||||
let maximumHeights = []
|
let maximumHeights = []
|
||||||
let material = this.getMaterial()
|
let material = this.getMaterial()
|
||||||
let width = this.computeDistance(positions)
|
let width = this.computeDistance2(positions)
|
||||||
let extrudedHeight = this.aspectRatio ? (width / this.aspectRatio) : 0
|
let extrudedHeight = this.aspectRatio ? (width / this.aspectRatio) : 0
|
||||||
for (let i = 0; i < positions.length; i++) {
|
for (let i = 0; i < positions.length; i++) {
|
||||||
fromDegreesArray.push(positions[i].lng, positions[i].lat)
|
fromDegreesArray.push(positions[i].lng, positions[i].lat)
|
||||||
@ -118,7 +118,7 @@ class StandText extends Base {
|
|||||||
this.entity.wall.material = this.getMaterial()
|
this.entity.wall.material = this.getMaterial()
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -303,7 +303,7 @@ class StandText extends Base {
|
|||||||
let minimumHeights = []
|
let minimumHeights = []
|
||||||
let maximumHeights = []
|
let maximumHeights = []
|
||||||
let material = that.getMaterial()
|
let material = that.getMaterial()
|
||||||
let width = that.computeDistance(positions)
|
let width = that.computeDistance2(positions)
|
||||||
let extrudedHeight = that.aspectRatio ? (width / that.aspectRatio) : 0
|
let extrudedHeight = that.aspectRatio ? (width / that.aspectRatio) : 0
|
||||||
// aspectRatio
|
// aspectRatio
|
||||||
for (let i = 0; i < positions.length; i++) {
|
for (let i = 0; i < positions.length; i++) {
|
||||||
@ -403,7 +403,7 @@ class StandText extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
// let tabsElm = new cy_tabs('radar-scan-edit-tabs')
|
// let tabsElm = new cy_tabs('radar-scan-edit-tabs')
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -417,71 +417,11 @@ class StandText extends Base {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
|
||||||
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 ewPlugins('colorpicker', {
|
|
||||||
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 ewPlugins('colorpicker', {
|
|
||||||
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 ewPlugins('colorpicker', {
|
|
||||||
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("*")
|
let all_elm = contentElm.getElementsByTagName("*")
|
||||||
this._EventBinding.on(this, all_elm)
|
this._EventBinding.on(this, all_elm)
|
||||||
this._elms = this._EventBinding.element
|
this._elms = this._EventBinding.element
|
||||||
this._elms.color = [colorPicker]
|
this._elms.color = [colorPicker]
|
||||||
this._elms.labelColor = [labelColorPicker]
|
|
||||||
this._elms.labelLineColor = [lineColorPicker]
|
|
||||||
this._elms.labelBackgroundColorStart = [labelBackgroundColorStartPicker]
|
|
||||||
this._elms.labelBackgroundColorEnd = [labelBackgroundColorEndPicker]
|
|
||||||
} else {
|
} else {
|
||||||
if (this._DialogObject && this._DialogObject.remove) {
|
if (this._DialogObject && this._DialogObject.remove) {
|
||||||
this._DialogObject.remove()
|
this._DialogObject.remove()
|
||||||
@ -503,7 +443,7 @@ class StandText extends Base {
|
|||||||
let fromDegreesArray = []
|
let fromDegreesArray = []
|
||||||
let minimumHeights = []
|
let minimumHeights = []
|
||||||
let maximumHeights = []
|
let maximumHeights = []
|
||||||
let width = this.computeDistance(positions)
|
let width = this.computeDistance2(positions)
|
||||||
let extrudedHeight = this.aspectRatio ? (width / this.aspectRatio) : 0
|
let extrudedHeight = this.aspectRatio ? (width / this.aspectRatio) : 0
|
||||||
// aspectRatio
|
// aspectRatio
|
||||||
for (let i = 0; i < positions.length; i++) {
|
for (let i = 0; i < positions.length; i++) {
|
||||||
@ -602,7 +542,7 @@ class StandText extends Base {
|
|||||||
let fromDegreesArray = []
|
let fromDegreesArray = []
|
||||||
let minimumHeights = []
|
let minimumHeights = []
|
||||||
let maximumHeights = []
|
let maximumHeights = []
|
||||||
let width = that.computeDistance(positions)
|
let width = that.computeDistance2(positions)
|
||||||
let extrudedHeight = that.aspectRatio ? (width / that.aspectRatio) : 0
|
let extrudedHeight = that.aspectRatio ? (width / that.aspectRatio) : 0
|
||||||
for (let i = 0; i < positions.length; i++) {
|
for (let i = 0; i < positions.length; i++) {
|
||||||
fromDegreesArray.push(positions[i].lng, positions[i].lat)
|
fromDegreesArray.push(positions[i].lng, positions[i].lat)
|
||||||
@ -635,7 +575,7 @@ class StandText extends Base {
|
|||||||
fromDegreesArray = []
|
fromDegreesArray = []
|
||||||
minimumHeights = []
|
minimumHeights = []
|
||||||
maximumHeights = []
|
maximumHeights = []
|
||||||
width = that.computeDistance(positions)
|
width = that.computeDistance2(positions)
|
||||||
extrudedHeight = that.aspectRatio ? (width / that.aspectRatio) : 0
|
extrudedHeight = that.aspectRatio ? (width / that.aspectRatio) : 0
|
||||||
for (let i = 0; i < positions.length; i++) {
|
for (let i = 0; i < positions.length; i++) {
|
||||||
fromDegreesArray.push(positions[i].lng, positions[i].lat)
|
fromDegreesArray.push(positions[i].lng, positions[i].lat)
|
||||||
@ -680,7 +620,7 @@ class StandText extends Base {
|
|||||||
fromDegreesArray = []
|
fromDegreesArray = []
|
||||||
minimumHeights = []
|
minimumHeights = []
|
||||||
maximumHeights = []
|
maximumHeights = []
|
||||||
width = that.computeDistance(positions)
|
width = that.computeDistance2(positions)
|
||||||
extrudedHeight = that.aspectRatio ? (width / that.aspectRatio) : 0
|
extrudedHeight = that.aspectRatio ? (width / that.aspectRatio) : 0
|
||||||
for (let i = 0; i < positions.length; i++) {
|
for (let i = 0; i < positions.length; i++) {
|
||||||
fromDegreesArray.push(positions[i].lng, positions[i].lat)
|
fromDegreesArray.push(positions[i].lng, positions[i].lat)
|
||||||
@ -710,7 +650,7 @@ class StandText extends Base {
|
|||||||
fromDegreesArray = []
|
fromDegreesArray = []
|
||||||
minimumHeights = []
|
minimumHeights = []
|
||||||
maximumHeights = []
|
maximumHeights = []
|
||||||
width = that.computeDistance(positions)
|
width = that.computeDistance2(positions)
|
||||||
extrudedHeight = that.aspectRatio ? (width / that.aspectRatio) : 0
|
extrudedHeight = that.aspectRatio ? (width / that.aspectRatio) : 0
|
||||||
for (let i = 0; i < positions.length; i++) {
|
for (let i = 0; i < positions.length; i++) {
|
||||||
fromDegreesArray.push(positions[i].lng, positions[i].lat)
|
fromDegreesArray.push(positions[i].lng, positions[i].lat)
|
||||||
|
|||||||
@ -99,8 +99,8 @@ class TrajectoryMotion extends Base {
|
|||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
||||||
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
|
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 || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
@ -144,37 +144,54 @@ class TrajectoryMotion extends Base {
|
|||||||
|
|
||||||
set show(v) {
|
set show(v) {
|
||||||
if (typeof v === "boolean") {
|
if (typeof v === "boolean") {
|
||||||
this.options.show = v
|
if (!this.isShowView) {
|
||||||
if (this.originalOptions) {
|
this.options.show = v
|
||||||
this.originalOptions.show = v
|
if (this.originalOptions) {
|
||||||
|
this.originalOptions.show = v
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (v) {
|
if (this.options.show) {
|
||||||
if (this.firstPersonView) {
|
if (this.firstPersonView) {
|
||||||
this.model.show = false
|
this.model.show = false
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.model.show = this.modelShow
|
this.model.show = (!this.showView || this.showView == 3) ? this.modelShow : false
|
||||||
}
|
}
|
||||||
|
|
||||||
this.line.polyline.material = this.lineShow ? new Cesium.PolylineDashMaterialProperty({
|
if ((!this.showView || this.showView == 3)) {
|
||||||
color: new Cesium.Color.fromCssColorString('#00ffff'),
|
this.line.polyline.material = this.lineShow ? new Cesium.PolylineDashMaterialProperty({
|
||||||
dashLength: 20,
|
color: new Cesium.Color.fromCssColorString('#00ffff'),
|
||||||
}) : new Cesium.PolylineDashMaterialProperty({
|
dashLength: 20,
|
||||||
color: new Cesium.Color.fromCssColorString('#00ffff00'),
|
}) : new Cesium.PolylineDashMaterialProperty({
|
||||||
dashLength: 20,
|
color: new Cesium.Color.fromCssColorString('#00ffff00'),
|
||||||
})
|
dashLength: 20,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.line.polyline.material = new Cesium.PolylineDashMaterialProperty({
|
||||||
|
color: new Cesium.Color.fromCssColorString('#00ffff00'),
|
||||||
|
dashLength: 20,
|
||||||
|
})
|
||||||
|
}
|
||||||
for (let i = 0; i < this.keyPoints.length; i++) {
|
for (let i = 0; i < this.keyPoints.length; i++) {
|
||||||
this.keyPoints[i].show = this.keyPointShow
|
this.keyPoints[i].show = (!this.showView || this.showView == 3) ? this.keyPointShow : false
|
||||||
}
|
}
|
||||||
if (this.realTimeRoute) {
|
if (this.realTimeRoute) {
|
||||||
this.realTimeLine && (this.realTimeLine.show = true)
|
this.realTimeLine && (this.realTimeLine.show = (!this.showView || this.showView == 3) ? true : false)
|
||||||
}
|
}
|
||||||
this.label && (this.label.show = this.options.label.show)
|
this.label && (this.label.show = (!this.showView || this.showView == 3) ? this.options.label.show : false)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.model.show = v
|
this.model.show = (!this.showView || this.showView == 3) ? this.options.show : false
|
||||||
|
let show = this.options.show
|
||||||
|
if ((!this.showView || this.showView == 3)) {
|
||||||
|
show = this.options.show
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
show = false
|
||||||
|
}
|
||||||
this.realTimeLine && (this.realTimeLine.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'),
|
color: new Cesium.Color.fromCssColorString('#00ffff'),
|
||||||
dashLength: 20,
|
dashLength: 20,
|
||||||
}) : new Cesium.PolylineDashMaterialProperty({
|
}) : new Cesium.PolylineDashMaterialProperty({
|
||||||
@ -182,7 +199,7 @@ class TrajectoryMotion extends Base {
|
|||||||
dashLength: 20,
|
dashLength: 20,
|
||||||
})
|
})
|
||||||
for (let i = 0; i < this.keyPoints.length; i++) {
|
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.label && (this.label.show = false)
|
||||||
this.viewFollow = false
|
this.viewFollow = false
|
||||||
@ -193,6 +210,7 @@ class TrajectoryMotion extends Base {
|
|||||||
}
|
}
|
||||||
syncData(this.sdk, this.options.id)
|
syncData(this.sdk, this.options.id)
|
||||||
syncSplitData(this.sdk, this.options.id)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
|
this.isShowView = false
|
||||||
} else {
|
} else {
|
||||||
console.error("参数必须为boolean")
|
console.error("参数必须为boolean")
|
||||||
}
|
}
|
||||||
@ -656,8 +674,15 @@ class TrajectoryMotion extends Base {
|
|||||||
}
|
}
|
||||||
set modelShow(v) {
|
set modelShow(v) {
|
||||||
this.options.model.show = v
|
this.options.model.show = v
|
||||||
|
let show = v
|
||||||
|
if (this.show && (!this.showView || this.showView == 3)) {
|
||||||
|
show = v
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
show = false
|
||||||
|
}
|
||||||
if (this.model && this.show) {
|
if (this.model && this.show) {
|
||||||
this.model.show = v
|
this.model.show = show
|
||||||
}
|
}
|
||||||
this._elms.modelShow && this._elms.modelShow.forEach((item) => {
|
this._elms.modelShow && this._elms.modelShow.forEach((item) => {
|
||||||
item.checked = v
|
item.checked = v
|
||||||
@ -723,8 +748,15 @@ class TrajectoryMotion extends Base {
|
|||||||
this.realTimeRoute = false
|
this.realTimeRoute = false
|
||||||
}
|
}
|
||||||
this.options.line.show = v
|
this.options.line.show = v
|
||||||
|
let show = v
|
||||||
|
if ((!this.showView || this.showView == 3)) {
|
||||||
|
show = v
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
show = false
|
||||||
|
}
|
||||||
if (this.line && this.show) {
|
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'),
|
color: new Cesium.Color.fromCssColorString('#00ffff'),
|
||||||
dashLength: 20, //短划线长度
|
dashLength: 20, //短划线长度
|
||||||
}) : new Cesium.PolylineDashMaterialProperty({
|
}) : new Cesium.PolylineDashMaterialProperty({
|
||||||
@ -994,7 +1026,14 @@ class TrajectoryMotion extends Base {
|
|||||||
else {
|
else {
|
||||||
CameraController(this.sdk, true)
|
CameraController(this.sdk, true)
|
||||||
if (this.model && this.modelShow && this.show) {
|
if (this.model && this.modelShow && this.show) {
|
||||||
this.model.show = true
|
let show = true
|
||||||
|
if (this.show && (!this.showView || this.showView == 3)) {
|
||||||
|
show = true
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
show = false
|
||||||
|
}
|
||||||
|
this.model.show = show
|
||||||
}
|
}
|
||||||
if (this._DialogObject && this._DialogObject._element.content) {
|
if (this._DialogObject && this._DialogObject._element.content) {
|
||||||
let e_firstPerson = this._DialogObject._element.content.querySelectorAll("button[name='firstPerson']")
|
let e_firstPerson = this._DialogObject._element.content.querySelectorAll("button[name='firstPerson']")
|
||||||
@ -1116,8 +1155,15 @@ class TrajectoryMotion extends Base {
|
|||||||
}
|
}
|
||||||
set labelShow(v) {
|
set labelShow(v) {
|
||||||
this.options.label.show = v
|
this.options.label.show = v
|
||||||
|
let show = v
|
||||||
|
if (this.show && (!this.showView || this.showView == 3)) {
|
||||||
|
show = v
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
show = false
|
||||||
|
}
|
||||||
if (this.show) {
|
if (this.show) {
|
||||||
this.label && (this.label.show = v)
|
this.label && (this.label.show = show)
|
||||||
if (this.options.label.position) {
|
if (this.options.label.position) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.options.label.position.alt) {
|
if (this.options.label.position.alt) {
|
||||||
@ -1162,7 +1208,7 @@ class TrajectoryMotion extends Base {
|
|||||||
this.label && (this.label.color = v)
|
this.label && (this.label.color = v)
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1305,9 +1351,10 @@ class TrajectoryMotion extends Base {
|
|||||||
}
|
}
|
||||||
// 创建模型
|
// 创建模型
|
||||||
static async addModel(that) {
|
static async addModel(that) {
|
||||||
|
let url = that.replaceHost(that.options.model.url, that.options.host)
|
||||||
let options = {
|
let options = {
|
||||||
id: that.options.id,
|
id: that.options.id,
|
||||||
url: that.options.model.url,
|
url: url,
|
||||||
show: that.options.show ? that.options.model.show : false,
|
show: that.options.show ? that.options.model.show : false,
|
||||||
scale: that.options.model.scale,
|
scale: that.options.model.scale,
|
||||||
// minimumPixelSize: that.options.model.pixelSize,
|
// minimumPixelSize: that.options.model.pixelSize,
|
||||||
@ -1861,7 +1908,9 @@ class TrajectoryMotion extends Base {
|
|||||||
// this.options.viewFollowOrientation.roll = Cesium.Math.toDegrees(this.sdk.viewer.camera.roll)
|
// this.options.viewFollowOrientation.roll = Cesium.Math.toDegrees(this.sdk.viewer.camera.roll)
|
||||||
// this.options.viewFollowOrientation.direction = this.sdk.viewer.camera.direction
|
// this.options.viewFollowOrientation.direction = this.sdk.viewer.camera.direction
|
||||||
this._DialogObject.close()
|
this._DialogObject.close()
|
||||||
this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(this.originalOptions)
|
let cdoptions = this.deepCopyObj(this.options)
|
||||||
|
cdoptions.host = ''
|
||||||
|
this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(cdoptions)
|
||||||
syncData(this.sdk, this.options.id)
|
syncData(this.sdk, this.options.id)
|
||||||
syncSplitData(this.sdk, this.options.id)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
},
|
},
|
||||||
@ -1885,10 +1934,10 @@ class TrajectoryMotion extends Base {
|
|||||||
this.tip && this.tip.destroy()
|
this.tip && this.tip.destroy()
|
||||||
this.tip = null
|
this.tip = null
|
||||||
this.ControllerObject.destroy()
|
this.ControllerObject.destroy()
|
||||||
if(this.firstPersonView !== this.originalOptions.firstPersonView) {
|
if (this.firstPersonView !== this.originalOptions.firstPersonView) {
|
||||||
this.firstPersonView = this.originalOptions.firstPersonView;
|
this.firstPersonView = this.originalOptions.firstPersonView;
|
||||||
}
|
}
|
||||||
if(this.firstPersonView && this.modelShow) {
|
if (this.firstPersonView && this.modelShow) {
|
||||||
this.model && (this.model.show = false)
|
this.model && (this.model.show = false)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1914,7 +1963,7 @@ class TrajectoryMotion extends Base {
|
|||||||
this._DialogObject._element.content.getElementsByClassName('model-rotate-btn')[0].className = 'btn model-rotate-btn'
|
this._DialogObject._element.content.getElementsByClassName('model-rotate-btn')[0].className = 'btn model-rotate-btn'
|
||||||
}
|
}
|
||||||
|
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelColor")[0],
|
el: contentElm.getElementsByClassName("labelColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -2161,10 +2210,10 @@ class TrajectoryMotion extends Base {
|
|||||||
this.modelAnimate = this.originalOptions.model.animate;
|
this.modelAnimate = this.originalOptions.model.animate;
|
||||||
this.delay = this.originalOptions.delay;
|
this.delay = this.originalOptions.delay;
|
||||||
(this.ground !== this.originalOptions.ground) && (this.ground = this.originalOptions.ground);
|
(this.ground !== this.originalOptions.ground) && (this.ground = this.originalOptions.ground);
|
||||||
if(this.firstPersonView !== this.originalOptions.firstPersonView) {
|
if (this.firstPersonView !== this.originalOptions.firstPersonView) {
|
||||||
this.firstPersonView = this.originalOptions.firstPersonView;
|
this.firstPersonView = this.originalOptions.firstPersonView;
|
||||||
}
|
}
|
||||||
if(this.firstPersonView && this.modelShow) {
|
if (this.firstPersonView && this.modelShow) {
|
||||||
this.model && (this.model.show = false)
|
this.model && (this.model.show = false)
|
||||||
}
|
}
|
||||||
this.labelShow = this.originalOptions.label.show
|
this.labelShow = this.originalOptions.label.show
|
||||||
@ -2226,7 +2275,6 @@ class TrajectoryMotion extends Base {
|
|||||||
this._DialogObject._element.content.getElementsByClassName('model-rotate-btn')[0].innerHTML = '结束调整'
|
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'
|
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.state = false
|
||||||
this.editObj = new EditGltf(this.sdk, this.model)
|
this.editObj = new EditGltf(this.sdk, this.model)
|
||||||
this.editObj.editRtation()
|
this.editObj.editRtation()
|
||||||
@ -2285,7 +2333,7 @@ class TrajectoryMotion extends Base {
|
|||||||
|
|
||||||
async changeModelUrl(url) {
|
async changeModelUrl(url) {
|
||||||
this.sdk.viewer.scene.primitives.remove(this.model)
|
this.sdk.viewer.scene.primitives.remove(this.model)
|
||||||
this.options.model.url = url
|
this.options.model.url = this.replaceHost(url, this.options.host)
|
||||||
let matrix = this.model.modelMatrix
|
let matrix = this.model.modelMatrix
|
||||||
let position = this.model.position
|
let position = this.model.position
|
||||||
let options = {
|
let options = {
|
||||||
|
|||||||
@ -41,7 +41,7 @@ function html(that) {
|
|||||||
<div class="corner-type"></div>
|
<div class="corner-type"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col material-box">
|
<div class="col material-box">
|
||||||
<span class="label">材质样式</span>
|
<span class="label">墙体样式</span>
|
||||||
<div class="material"></div>
|
<div class="material"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -21,6 +21,7 @@ class eventBinding {
|
|||||||
let Event = []
|
let Event = []
|
||||||
let isEvent = false
|
let isEvent = false
|
||||||
let removeName = []
|
let removeName = []
|
||||||
|
let blurEvent = ()=>{}
|
||||||
if (!elements[i] ||!elements[i].attributes) {
|
if (!elements[i] ||!elements[i].attributes) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -37,14 +38,14 @@ class eventBinding {
|
|||||||
let value = e.target.value
|
let value = e.target.value
|
||||||
if (e.target.type == 'number') {
|
if (e.target.type == 'number') {
|
||||||
if (e.data != '.' && (e.data != '-' || e.target.value)) {
|
if (e.data != '.' && (e.data != '-' || e.target.value)) {
|
||||||
value = Number(value)
|
let v = Number(value)
|
||||||
if((e.target.max) && value>Number(e.target.max)) {
|
if((e.target.max) && v>Number(e.target.max)) {
|
||||||
value = 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)
|
value = Number(e.target.min)
|
||||||
}
|
}
|
||||||
if((e.target.dataset.min) && value<Number(e.target.dataset.min)) {
|
if((e.target.dataset.min) && v<Number(e.target.dataset.min)) {
|
||||||
value = Number(e.target.dataset.min)
|
value = Number(e.target.dataset.min)
|
||||||
}
|
}
|
||||||
that[m.value] = value
|
that[m.value] = value
|
||||||
@ -54,6 +55,22 @@ class eventBinding {
|
|||||||
that[m.value] = value
|
that[m.value] = value
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
blurEvent = (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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
that[m.value] = value
|
||||||
|
}
|
||||||
if(elements[i].nodeName=='IMG') {
|
if(elements[i].nodeName=='IMG') {
|
||||||
elements[i].src = that[m.value]
|
elements[i].src = that[m.value]
|
||||||
}
|
}
|
||||||
@ -111,6 +128,9 @@ class eventBinding {
|
|||||||
Event[t](e)
|
Event[t](e)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
elements[i].addEventListener('blur', (e) => {
|
||||||
|
blurEvent(e)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,7 @@ class WallRealStereoscopic extends Base {
|
|||||||
* @param options['nose-to-tail']=false {boolean} 首尾相连
|
* @param options['nose-to-tail']=false {boolean} 首尾相连
|
||||||
* @param options.extrudedHeight=2.4 {number} 拉伸高度
|
* @param options.extrudedHeight=2.4 {number} 拉伸高度
|
||||||
* @param options.cornerType=0 {string} 拐角类型;0:直角;1:斜角;2:圆角
|
* @param options.cornerType=0 {string} 拐角类型;0:直角;1:斜角;2:圆角
|
||||||
* @param options.material=0 {number} 材质,0:纯色墙;1:砖墙1;2:砖墙2;3:砖墙3
|
* @param options.material=0 {number} 材质,0:纯色墙;1:红砖;2:黄砖;3:灰瓷
|
||||||
* @param {Array.<object>} positions 经纬度和高度的列表,值交替 [{lon,lat,alt},...]
|
* @param {Array.<object>} positions 经纬度和高度的列表,值交替 [{lon,lat,alt},...]
|
||||||
* @param _Dialog {object} 弹框事件
|
* @param _Dialog {object} 弹框事件
|
||||||
* @param _Dialog.confirmCallBack {function} 弹框确认时的回调
|
* @param _Dialog.confirmCallBack {function} 弹框确认时的回调
|
||||||
@ -60,8 +60,8 @@ class WallRealStereoscopic extends Base {
|
|||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
||||||
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
|
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 || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
@ -142,7 +142,7 @@ class WallRealStereoscopic extends Base {
|
|||||||
|
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: false,//是否开启透明度
|
alpha: false,//是否开启透明度
|
||||||
@ -287,7 +287,7 @@ class WallRealStereoscopic extends Base {
|
|||||||
this.label.color = v
|
this.label.color = v
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -387,7 +387,7 @@ class WallRealStereoscopic extends Base {
|
|||||||
this.label.lineColor = v
|
this.label.lineColor = v
|
||||||
if (this._elms.labelLineColor) {
|
if (this._elms.labelLineColor) {
|
||||||
this._elms.labelLineColor.forEach((item, i) => {
|
this._elms.labelLineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -398,7 +398,7 @@ class WallRealStereoscopic extends Base {
|
|||||||
this.labelLineColor = color
|
this.labelLineColor = color
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(0,255,255,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.labelLineColor[i] = lineColorPicker
|
this._elms.labelLineColor[i] = lineColorPicker
|
||||||
@ -414,7 +414,7 @@ class WallRealStereoscopic extends Base {
|
|||||||
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -440,7 +440,7 @@ class WallRealStereoscopic extends Base {
|
|||||||
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1368,20 +1368,20 @@ class WallRealStereoscopic extends Base {
|
|||||||
icon: 'icon-wall'
|
icon: 'icon-wall'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '<i class="icon icon-wall-brick1"></i>砖墙1',
|
name: '<i class="icon icon-wall-brick1"></i>红砖墙',
|
||||||
value: '砖墙1',
|
value: '红砖墙',
|
||||||
key: 1,
|
key: 1,
|
||||||
icon: 'icon-wall-brick1'
|
icon: 'icon-wall-brick1'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '<i class="icon icon-wall-brick2"></i>砖墙2',
|
name: '<i class="icon icon-wall-brick2"></i>黄砖墙',
|
||||||
value: '砖墙2',
|
value: '黄砖墙',
|
||||||
key: 2,
|
key: 2,
|
||||||
icon: 'icon-wall-brick2'
|
icon: 'icon-wall-brick2'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '<i class="icon icon-wall-brick3"></i>砖墙3',
|
name: '<i class="icon icon-wall-brick3"></i>灰瓷墙',
|
||||||
value: '砖墙3',
|
value: '灰瓷墙',
|
||||||
key: 3,
|
key: 3,
|
||||||
icon: 'icon-wall-brick3'
|
icon: 'icon-wall-brick3'
|
||||||
}
|
}
|
||||||
@ -1414,7 +1414,7 @@ class WallRealStereoscopic extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk)
|
let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: false,//是否开启透明度
|
alpha: false,//是否开启透明度
|
||||||
@ -1428,7 +1428,7 @@ class WallRealStereoscopic extends Base {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelColor")[0],
|
el: contentElm.getElementsByClassName("labelColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1442,7 +1442,7 @@ class WallRealStereoscopic extends Base {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1456,7 +1456,7 @@ class WallRealStereoscopic extends Base {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -1470,7 +1470,7 @@ class WallRealStereoscopic extends Base {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
|
|||||||
@ -47,8 +47,8 @@ class WallStereoscopic extends Base {
|
|||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
||||||
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
|
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 || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
@ -92,7 +92,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.entity.corridor.material = Cesium.Color.fromCssColorString(v)
|
this.entity.corridor.material = Cesium.Color.fromCssColorString(v)
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -176,7 +176,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.label.color = v
|
this.label.color = v
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -276,7 +276,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.label.lineColor = v
|
this.label.lineColor = v
|
||||||
if (this._elms.labelLineColor) {
|
if (this._elms.labelLineColor) {
|
||||||
this._elms.labelLineColor.forEach((item, i) => {
|
this._elms.labelLineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -287,7 +287,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.labelLineColor = color
|
this.labelLineColor = color
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(0,255,255,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.labelLineColor[i] = lineColorPicker
|
this._elms.labelLineColor[i] = lineColorPicker
|
||||||
@ -303,7 +303,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -329,7 +329,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -627,7 +627,7 @@ class WallStereoscopic extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('radar-scan-edit-tabs',undefined,this.sdk)
|
let tabsElm = new cy_tabs('radar-scan-edit-tabs',undefined,this.sdk)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -641,7 +641,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelColor")[0],
|
el: contentElm.getElementsByClassName("labelColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -655,7 +655,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -669,7 +669,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -683,7 +683,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
|
|||||||
@ -58,8 +58,8 @@ class WallRealStereoscopic extends Base {
|
|||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
||||||
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
|
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 || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
@ -135,7 +135,7 @@ class WallRealStereoscopic extends Base {
|
|||||||
|
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: false,//是否开启透明度
|
alpha: false,//是否开启透明度
|
||||||
@ -262,7 +262,7 @@ class WallRealStereoscopic extends Base {
|
|||||||
this.label.color = v
|
this.label.color = v
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -362,7 +362,7 @@ class WallRealStereoscopic extends Base {
|
|||||||
this.label.lineColor = v
|
this.label.lineColor = v
|
||||||
if (this._elms.labelLineColor) {
|
if (this._elms.labelLineColor) {
|
||||||
this._elms.labelLineColor.forEach((item, i) => {
|
this._elms.labelLineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -373,7 +373,7 @@ class WallRealStereoscopic extends Base {
|
|||||||
this.labelLineColor = color
|
this.labelLineColor = color
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(0,255,255,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.labelLineColor[i] = lineColorPicker
|
this._elms.labelLineColor[i] = lineColorPicker
|
||||||
@ -389,7 +389,7 @@ class WallRealStereoscopic extends Base {
|
|||||||
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -415,7 +415,7 @@ class WallRealStereoscopic extends Base {
|
|||||||
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1363,7 +1363,7 @@ class WallRealStereoscopic extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk)
|
let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: false,//是否开启透明度
|
alpha: false,//是否开启透明度
|
||||||
@ -1377,7 +1377,7 @@ class WallRealStereoscopic extends Base {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelColor")[0],
|
el: contentElm.getElementsByClassName("labelColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1391,7 +1391,7 @@ class WallRealStereoscopic extends Base {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -1405,7 +1405,7 @@ class WallRealStereoscopic extends Base {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -1419,7 +1419,7 @@ class WallRealStereoscopic extends Base {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
|
|||||||
@ -47,8 +47,8 @@ class WallStereoscopic extends Base {
|
|||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
||||||
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
|
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 || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
@ -92,7 +92,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.entity.corridor.material = Cesium.Color.fromCssColorString(v)
|
this.entity.corridor.material = Cesium.Color.fromCssColorString(v)
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -176,7 +176,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.label.color = v
|
this.label.color = v
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -276,7 +276,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.label.lineColor = v
|
this.label.lineColor = v
|
||||||
if (this._elms.labelLineColor) {
|
if (this._elms.labelLineColor) {
|
||||||
this._elms.labelLineColor.forEach((item, i) => {
|
this._elms.labelLineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -287,7 +287,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.labelLineColor = color
|
this.labelLineColor = color
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(0,255,255,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.labelLineColor[i] = lineColorPicker
|
this._elms.labelLineColor[i] = lineColorPicker
|
||||||
@ -303,7 +303,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -329,7 +329,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -627,7 +627,7 @@ class WallStereoscopic extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('radar-scan-edit-tabs',undefined,this.sdk)
|
let tabsElm = new cy_tabs('radar-scan-edit-tabs',undefined,this.sdk)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -641,7 +641,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelColor")[0],
|
el: contentElm.getElementsByClassName("labelColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -655,7 +655,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -669,7 +669,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -683,7 +683,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
|
|||||||
@ -21,8 +21,9 @@ class eventBinding {
|
|||||||
let Event = []
|
let Event = []
|
||||||
let isEvent = false
|
let isEvent = false
|
||||||
let removeName = []
|
let removeName = []
|
||||||
if (!elements[i] ||!elements[i].attributes) {
|
let blurEvent = () => { }
|
||||||
continue;
|
if (!elements[i] || !elements[i].attributes) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
for (let m of elements[i].attributes) {
|
for (let m of elements[i].attributes) {
|
||||||
switch (m.name) {
|
switch (m.name) {
|
||||||
@ -37,11 +38,11 @@ class eventBinding {
|
|||||||
let value = e.target.value
|
let value = e.target.value
|
||||||
if (e.target.type == 'number') {
|
if (e.target.type == 'number') {
|
||||||
if (e.data != '.' && (e.data != '-' || e.target.value)) {
|
if (e.data != '.' && (e.data != '-' || e.target.value)) {
|
||||||
value = Number(value)
|
let v = Number(value)
|
||||||
if((e.target.max) && value>Number(e.target.max)) {
|
if ((e.target.max) && v > Number(e.target.max)) {
|
||||||
value = 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)
|
value = Number(e.target.min)
|
||||||
}
|
}
|
||||||
that[m.value] = value
|
that[m.value] = value
|
||||||
@ -51,14 +52,32 @@ class eventBinding {
|
|||||||
that[m.value] = value
|
that[m.value] = value
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if(elements[i].nodeName=='IMG') {
|
blurEvent = (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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
that[m.value] = value
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (elements[i].nodeName == 'IMG') {
|
||||||
elements[i].src = that[m.value]
|
elements[i].src = that[m.value]
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
elements[i].value = that[m.value]
|
elements[i].value = that[m.value]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(this.element[m.value]) {
|
if (this.element[m.value]) {
|
||||||
this.element[m.value].push(elements[i])
|
this.element[m.value].push(elements[i])
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -81,7 +100,7 @@ class eventBinding {
|
|||||||
isEvent = true
|
isEvent = true
|
||||||
Event.push((e) => {
|
Event.push((e) => {
|
||||||
let value = e.target.value
|
let value = e.target.value
|
||||||
if(e.target.type == 'number' && value!='') {
|
if (e.target.type == 'number' && value != '') {
|
||||||
value = Number(value)
|
value = Number(value)
|
||||||
e.target.value = value
|
e.target.value = value
|
||||||
}
|
}
|
||||||
@ -94,7 +113,7 @@ class eventBinding {
|
|||||||
}
|
}
|
||||||
// elements[i].attributes[m] = undefined
|
// elements[i].attributes[m] = undefined
|
||||||
}
|
}
|
||||||
for(let n=0;n<removeName.length;n++) {
|
for (let n = 0; n < removeName.length; n++) {
|
||||||
elements[i].attributes.removeNamedItem(removeName[n])
|
elements[i].attributes.removeNamedItem(removeName[n])
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,6 +127,9 @@ class eventBinding {
|
|||||||
Event[t](e)
|
Event[t](e)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
elements[i].addEventListener('blur', (e) => {
|
||||||
|
blurEvent(e)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,10 +32,10 @@ class WallStereoscopic extends Base {
|
|||||||
* */
|
* */
|
||||||
constructor(sdk, options, _Dialog = {}) {
|
constructor(sdk, options, _Dialog = {}) {
|
||||||
super(sdk, options);
|
super(sdk, options);
|
||||||
this.options.color = options.color || "#00d9ff"
|
this.options.color = options.color || "#ff0000"
|
||||||
this.options.extrudedHeight = options.extrudedHeight || 2.4
|
this.options.extrudedHeight = options.extrudedHeight || 2.4
|
||||||
this.options.positions = options.positions
|
this.options.positions = options.positions
|
||||||
this.options.material = Number(options.material) || 0
|
this.options.material = (Number(options.material) || Number(options.material) === 0) ? Number(options.material) : 3
|
||||||
this.options.duration = (options.duration || options.duration === 0) ? options.duration : 1000
|
this.options.duration = (options.duration || options.duration === 0) ? options.duration : 1000
|
||||||
this.options.show = (options.show || options.show === false) ? options.show : true
|
this.options.show = (options.show || options.show === false) ? options.show : true
|
||||||
this.options['nose-to-tail'] = options['nose-to-tail'] || false
|
this.options['nose-to-tail'] = options['nose-to-tail'] || false
|
||||||
@ -51,8 +51,8 @@ class WallStereoscopic extends Base {
|
|||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
||||||
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
|
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 || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
@ -113,15 +113,15 @@ class WallStereoscopic extends Base {
|
|||||||
return this.options.color
|
return this.options.color
|
||||||
}
|
}
|
||||||
set color(v) {
|
set color(v) {
|
||||||
this.options.color = v
|
this.options.color = v || '#ff0000'
|
||||||
this.entity.polylineVolume.material = this.getMaterial()
|
this.entity.polylineVolume.material = this.getMaterial()
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
defaultColor: v,
|
defaultColor: this.options.color,
|
||||||
disabled: false,//是否禁止打开颜色选择器
|
disabled: false,//是否禁止打开颜色选择器
|
||||||
openPickerAni: 'opacity',//打开颜色选择器动画
|
openPickerAni: 'opacity',//打开颜色选择器动画
|
||||||
sure: (c) => {
|
sure: (c) => {
|
||||||
@ -140,10 +140,10 @@ class WallStereoscopic extends Base {
|
|||||||
return this.options.material
|
return this.options.material
|
||||||
}
|
}
|
||||||
set material(v) {
|
set material(v) {
|
||||||
this.options.material = Number(v)
|
this.options.material = (Number(v) || Number(v) === 0) ? Number(v) : 3
|
||||||
this.entity.polylineVolume.material = this.getMaterial()
|
this.entity.polylineVolume.material = this.getMaterial()
|
||||||
this._elms.material && this._elms.material.forEach((item) => {
|
this._elms.material && this._elms.material.forEach((item) => {
|
||||||
item.value = v
|
item.value = this.options.material
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.label.color = v
|
this.label.color = v
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -325,7 +325,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.label.lineColor = v
|
this.label.lineColor = v
|
||||||
if (this._elms.labelLineColor) {
|
if (this._elms.labelLineColor) {
|
||||||
this._elms.labelLineColor.forEach((item, i) => {
|
this._elms.labelLineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -336,7 +336,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.labelLineColor = color
|
this.labelLineColor = color
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(0,255,255,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.labelLineColor[i] = lineColorPicker
|
this._elms.labelLineColor[i] = lineColorPicker
|
||||||
@ -352,7 +352,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -378,7 +378,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -900,7 +900,7 @@ class WallStereoscopic extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk)
|
let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -914,7 +914,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelColor")[0],
|
el: contentElm.getElementsByClassName("labelColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -928,7 +928,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -942,7 +942,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -956,7 +956,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
|
|||||||
@ -47,8 +47,8 @@ class WallStereoscopic extends Base {
|
|||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
||||||
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
|
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 || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
@ -92,7 +92,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.entity.corridor.material = Cesium.Color.fromCssColorString(v)
|
this.entity.corridor.material = Cesium.Color.fromCssColorString(v)
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -176,7 +176,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.label.color = v
|
this.label.color = v
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -276,7 +276,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.label.lineColor = v
|
this.label.lineColor = v
|
||||||
if (this._elms.labelLineColor) {
|
if (this._elms.labelLineColor) {
|
||||||
this._elms.labelLineColor.forEach((item, i) => {
|
this._elms.labelLineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -287,7 +287,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.labelLineColor = color
|
this.labelLineColor = color
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(0,255,255,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.labelLineColor[i] = lineColorPicker
|
this._elms.labelLineColor[i] = lineColorPicker
|
||||||
@ -303,7 +303,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -329,7 +329,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -633,7 +633,7 @@ class WallStereoscopic extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('radar-scan-edit-tabs',undefined,this.sdk)
|
let tabsElm = new cy_tabs('radar-scan-edit-tabs',undefined,this.sdk)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -647,7 +647,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelColor")[0],
|
el: contentElm.getElementsByClassName("labelColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -661,7 +661,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -675,7 +675,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -689,7 +689,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
|
|||||||
@ -47,8 +47,8 @@ class WallStereoscopic2 extends Base {
|
|||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
||||||
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
|
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 || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
@ -112,7 +112,7 @@ class WallStereoscopic2 extends Base {
|
|||||||
this.entity.polylineVolume.material = this.getMaterial()
|
this.entity.polylineVolume.material = this.getMaterial()
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -195,7 +195,7 @@ class WallStereoscopic2 extends Base {
|
|||||||
this.label.color = v
|
this.label.color = v
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -295,7 +295,7 @@ class WallStereoscopic2 extends Base {
|
|||||||
this.label.lineColor = v
|
this.label.lineColor = v
|
||||||
if (this._elms.labelLineColor) {
|
if (this._elms.labelLineColor) {
|
||||||
this._elms.labelLineColor.forEach((item, i) => {
|
this._elms.labelLineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -306,7 +306,7 @@ class WallStereoscopic2 extends Base {
|
|||||||
this.labelLineColor = color
|
this.labelLineColor = color
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(0,255,255,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.labelLineColor[i] = lineColorPicker
|
this._elms.labelLineColor[i] = lineColorPicker
|
||||||
@ -322,7 +322,7 @@ class WallStereoscopic2 extends Base {
|
|||||||
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -348,7 +348,7 @@ class WallStereoscopic2 extends Base {
|
|||||||
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -889,7 +889,7 @@ class WallStereoscopic2 extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk)
|
let tabsElm = new cy_tabs('radar-scan-edit-tabs', undefined, this.sdk)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -903,7 +903,7 @@ class WallStereoscopic2 extends Base {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelColor")[0],
|
el: contentElm.getElementsByClassName("labelColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -917,7 +917,7 @@ class WallStereoscopic2 extends Base {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -931,7 +931,7 @@ class WallStereoscopic2 extends Base {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -945,7 +945,7 @@ class WallStereoscopic2 extends Base {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
|
|||||||
@ -47,8 +47,8 @@ class WallStereoscopic extends Base {
|
|||||||
color: options.label.color || '#ffffff',
|
color: options.label.color || '#ffffff',
|
||||||
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
|
||||||
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
|
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 || '#fff000',
|
lineColor: options.label.lineColor || '#00ffff80',
|
||||||
scaleByDistance: options.label.scaleByDistance || false,
|
scaleByDistance: options.label.scaleByDistance || false,
|
||||||
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
|
||||||
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
|
||||||
@ -92,7 +92,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.entity.corridor.material = Cesium.Color.fromCssColorString(v)
|
this.entity.corridor.material = Cesium.Color.fromCssColorString(v)
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -176,7 +176,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.label.color = v
|
this.label.color = v
|
||||||
if (this._elms.labelColor) {
|
if (this._elms.labelColor) {
|
||||||
this._elms.labelColor.forEach((item, i) => {
|
this._elms.labelColor.forEach((item, i) => {
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -276,7 +276,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.label.lineColor = v
|
this.label.lineColor = v
|
||||||
if (this._elms.labelLineColor) {
|
if (this._elms.labelLineColor) {
|
||||||
this._elms.labelLineColor.forEach((item, i) => {
|
this._elms.labelLineColor.forEach((item, i) => {
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -287,7 +287,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.labelLineColor = color
|
this.labelLineColor = color
|
||||||
},//点击确认按钮事件回调
|
},//点击确认按钮事件回调
|
||||||
clear: () => {
|
clear: () => {
|
||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(0,255,255,0.5)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
this._elms.labelLineColor[i] = lineColorPicker
|
this._elms.labelLineColor[i] = lineColorPicker
|
||||||
@ -303,7 +303,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
this.label.backgroundColor = [v, this.label.backgroundColor[1]]
|
||||||
if (this._elms.labelBackgroundColorStart) {
|
if (this._elms.labelBackgroundColorStart) {
|
||||||
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
this._elms.labelBackgroundColorStart.forEach((item, i) => {
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -329,7 +329,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
this.label.backgroundColor = [this.label.backgroundColor[0], v]
|
||||||
if (this._elms.labelBackgroundColorEnd) {
|
if (this._elms.labelBackgroundColorEnd) {
|
||||||
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
this._elms.labelBackgroundColorEnd.forEach((item, i) => {
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -627,7 +627,7 @@ class WallStereoscopic extends Base {
|
|||||||
// 创建标签页
|
// 创建标签页
|
||||||
let tabsElm = new cy_tabs('radar-scan-edit-tabs',undefined,this.sdk)
|
let tabsElm = new cy_tabs('radar-scan-edit-tabs',undefined,this.sdk)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let colorPicker = new ewPlugins('colorpicker', {
|
let colorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("color")[0],
|
el: contentElm.getElementsByClassName("color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -641,7 +641,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.color = 'rgba(255,255,255,1)'
|
this.color = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelColorPicker = new ewPlugins('colorpicker', {
|
let labelColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelColor")[0],
|
el: contentElm.getElementsByClassName("labelColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -655,7 +655,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.labelColor = 'rgba(255,255,255,1)'
|
this.labelColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let lineColorPicker = new ewPlugins('colorpicker', {
|
let lineColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
el: contentElm.getElementsByClassName("labelLineColor")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -669,7 +669,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.labelLineColor = 'rgba(255,255,255,1)'
|
this.labelLineColor = 'rgba(255,255,255,1)'
|
||||||
},//点击清空按钮事件回调
|
},//点击清空按钮事件回调
|
||||||
})
|
})
|
||||||
let labelBackgroundColorStartPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorStartPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorStart")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
@ -683,7 +683,7 @@ class WallStereoscopic extends Base {
|
|||||||
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
this.labelBackgroundColorStart = 'rgba(255,255,255,1)'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
let labelBackgroundColorEndPicker = new ewPlugins('colorpicker', {
|
let labelBackgroundColorEndPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
el: contentElm.getElementsByClassName("labelBackgroundColorEnd")[0],
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
alpha: true,
|
alpha: true,
|
||||||
|
|||||||
@ -35,7 +35,8 @@ class eventBinding {
|
|||||||
else {
|
else {
|
||||||
Event.push((e) => {
|
Event.push((e) => {
|
||||||
let value = e.target.value
|
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)
|
value = Number(value)
|
||||||
}
|
}
|
||||||
that[m.value] = value
|
that[m.value] = value
|
||||||
|
|||||||
@ -105,7 +105,7 @@ class WaterSurface extends Base {
|
|||||||
this.entity && (this.entity.appearance.material.uniforms.baseWaterColor = Cesium.Color.fromCssColorString(v))
|
this.entity && (this.entity.appearance.material.uniforms.baseWaterColor = Cesium.Color.fromCssColorString(v))
|
||||||
if (this._elms.color) {
|
if (this._elms.color) {
|
||||||
this._elms.color.forEach((item, i) => {
|
this._elms.color.forEach((item, i) => {
|
||||||
let picker = new ewPlugins('colorpicker', {
|
let picker = new YJColorPicker({
|
||||||
el: item.el,
|
el: item.el,
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
@ -232,7 +232,7 @@ class WaterSurface extends Base {
|
|||||||
contentElm.innerHTML = html()
|
contentElm.innerHTML = html()
|
||||||
this._DialogObject.contentAppChild(contentElm)
|
this._DialogObject.contentAppChild(contentElm)
|
||||||
// 颜色组件
|
// 颜色组件
|
||||||
let waterColorPicker = new ewPlugins('colorpicker', {
|
let waterColorPicker = new YJColorPicker({
|
||||||
el: contentElm.getElementsByClassName("water-color")[0],
|
el: contentElm.getElementsByClassName("water-color")[0],
|
||||||
size: 'mini',//颜色box类型
|
size: 'mini',//颜色box类型
|
||||||
alpha: true,//是否开启透明度
|
alpha: true,//是否开启透明度
|
||||||
|
|||||||
@ -6,13 +6,16 @@
|
|||||||
* @update: 2023-12-01 12:12
|
* @update: 2023-12-01 12:12
|
||||||
*/
|
*/
|
||||||
import Tools from "../../Tools";
|
import Tools from "../../Tools";
|
||||||
|
import { getHost, getToken } from "../../on";
|
||||||
import { regLeftClickCallback, regRightClickCallback, regMoveCallback } from "../../Global/ClickCallback";
|
import { regLeftClickCallback, regRightClickCallback, regMoveCallback } from "../../Global/ClickCallback";
|
||||||
import { regLeftClickCallback as regLeftClickCallback2, regRightClickCallback as regRightClickCallback2, regMoveCallback as regMoveCallback2 } from "../../Global/SplitScreen/ClickCallback";
|
import { regLeftClickCallback as regLeftClickCallback2, regRightClickCallback as regRightClickCallback2, regMoveCallback as regMoveCallback2 } from "../../Global/SplitScreen/ClickCallback";
|
||||||
import { setSplitDirection, syncSplitData, getSdk } from "../../Global/SplitScreen";
|
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'
|
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../Global/global'
|
||||||
|
|
||||||
class Base extends Tools {
|
class Base extends Tools {
|
||||||
|
#_showView
|
||||||
|
#_isShowView
|
||||||
constructor(sdk, options = {}) {
|
constructor(sdk, options = {}) {
|
||||||
super(sdk, options);
|
super(sdk, options);
|
||||||
if (!sdk || !sdk.viewer) {
|
if (!sdk || !sdk.viewer) {
|
||||||
@ -27,6 +30,7 @@ class Base extends Tools {
|
|||||||
this.clickCallBack = null
|
this.clickCallBack = null
|
||||||
this.rightClickCallBack = null
|
this.rightClickCallBack = null
|
||||||
this.picking = true
|
this.picking = true
|
||||||
|
this.options.host = this.options.host || getHost()
|
||||||
this.setDefaultValue()
|
this.setDefaultValue()
|
||||||
|
|
||||||
// this.sdk.addIncetance(this.options.id, this)
|
// this.sdk.addIncetance(this.options.id, this)
|
||||||
@ -53,6 +57,50 @@ class Base extends Tools {
|
|||||||
// setSplitDirection(this._splitDirection, this.options.id)
|
// setSplitDirection(this._splitDirection, this.options.id)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
get showView() {
|
||||||
|
return this.#_showView
|
||||||
|
}
|
||||||
|
|
||||||
|
set showView(v) {
|
||||||
|
let sdk2D = get2DSdk().sdkD
|
||||||
|
if(!sdk2D) {
|
||||||
|
v=0
|
||||||
|
}
|
||||||
|
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() {
|
get name() {
|
||||||
return this.options.name
|
return this.options.name
|
||||||
}
|
}
|
||||||
@ -70,19 +118,32 @@ class Base extends Tools {
|
|||||||
|
|
||||||
set show(v) {
|
set show(v) {
|
||||||
if (typeof v === "boolean") {
|
if (typeof v === "boolean") {
|
||||||
this.options.show = v
|
if (!this.isShowView) {
|
||||||
if (this.originalOptions) {
|
this.options.show = v
|
||||||
this.originalOptions.show = v
|
if (this.originalOptions) {
|
||||||
|
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.options.label && this.options.label.show && this.label) {
|
||||||
|
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) {
|
if (this._DialogObject && this._DialogObject.showBtn) {
|
||||||
this._DialogObject.showBtn.checked = v
|
this._DialogObject.showBtn.checked = this.options.show
|
||||||
}
|
|
||||||
if (this.options.label && this.options.label.show && this.label) {
|
|
||||||
this.label.show = v
|
|
||||||
}
|
}
|
||||||
|
|
||||||
syncData(this.sdk, this.options.id)
|
syncData(this.sdk, this.options.id)
|
||||||
syncSplitData(this.sdk, this.options.id)
|
syncSplitData(this.sdk, this.options.id)
|
||||||
|
this.isShowView = false
|
||||||
} else {
|
} else {
|
||||||
console.error("参数必须为boolean")
|
console.error("参数必须为boolean")
|
||||||
}
|
}
|
||||||
@ -261,7 +322,7 @@ class Base extends Tools {
|
|||||||
console.error('val:', val, '不是一个function')
|
console.error('val:', val, '不是一个function')
|
||||||
} else {
|
} else {
|
||||||
let sdkD = getSdk().sdkD
|
let sdkD = getSdk().sdkD
|
||||||
if(sdkD && this.sdk === sdkD) {
|
if (sdkD && this.sdk === sdkD) {
|
||||||
if (this.clickCallBack == null && this.options && this.options.id) {
|
if (this.clickCallBack == null && this.options && this.options.id) {
|
||||||
regLeftClickCallback2(this.options.id, this.leftClickCB, this)
|
regLeftClickCallback2(this.options.id, this.leftClickCB, this)
|
||||||
}
|
}
|
||||||
@ -284,7 +345,7 @@ class Base extends Tools {
|
|||||||
console.error('val:', val, '不是一个function')
|
console.error('val:', val, '不是一个function')
|
||||||
} else {
|
} else {
|
||||||
let sdkD = getSdk().sdkD
|
let sdkD = getSdk().sdkD
|
||||||
if(sdkD && this.sdk === sdkD) {
|
if (sdkD && this.sdk === sdkD) {
|
||||||
if (this.rightClickCallBack == null && this.entity && this.entity.id) {
|
if (this.rightClickCallBack == null && this.entity && this.entity.id) {
|
||||||
regRightClickCallback2(this.entity.id, this.rightClickCB, this)
|
regRightClickCallback2(this.entity.id, this.rightClickCB, this)
|
||||||
}
|
}
|
||||||
@ -307,7 +368,7 @@ class Base extends Tools {
|
|||||||
console.error('val:', val, '不是一个function')
|
console.error('val:', val, '不是一个function')
|
||||||
} else {
|
} else {
|
||||||
let sdkD = getSdk().sdkD
|
let sdkD = getSdk().sdkD
|
||||||
if(sdkD && this.sdk === sdkD) {
|
if (sdkD && this.sdk === sdkD) {
|
||||||
if (this.mouseMoveCallBack == null && this.entity && this.entity.id) {
|
if (this.mouseMoveCallBack == null && this.entity && this.entity.id) {
|
||||||
regMoveCallback2(this.entity.id, this.mouseMoveCB, this)
|
regMoveCallback2(this.entity.id, this.mouseMoveCB, this)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,8 +45,14 @@ class EventBinding {
|
|||||||
let value = e.target.value
|
let value = e.target.value
|
||||||
value = Number(value)
|
value = Number(value)
|
||||||
if (e.data != '.' && (e.data != '-' || e.target.value)) {
|
if (e.data != '.' && (e.data != '-' || e.target.value)) {
|
||||||
if (((!e.target.max) && (!e.target.min)) || ((value <= Number(e.target.max)) && value >= Number(e.target.min))) {
|
if ((e.target.max) && value > Number(e.target.max)) {
|
||||||
that[m.value] = value
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -61,7 +67,7 @@ class EventBinding {
|
|||||||
if ((e.target.min) && value < Number(e.target.min)) {
|
if ((e.target.min) && value < Number(e.target.min)) {
|
||||||
value = Number(e.target.min)
|
value = Number(e.target.min)
|
||||||
}
|
}
|
||||||
if((e.target.dataset.min) && value<Number(e.target.dataset.min)) {
|
if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) {
|
||||||
value = Number(e.target.dataset.min)
|
value = Number(e.target.dataset.min)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,4 +127,4 @@ class EventBinding {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default EventBinding;
|
export default EventBinding;
|
||||||
|
|||||||
@ -2,13 +2,10 @@ import BaseDialog from '../../../BaseDialog';
|
|||||||
|
|
||||||
class Dialog extends BaseDialog {
|
class Dialog extends BaseDialog {
|
||||||
constructor(sdk, info, options, only) {
|
constructor(sdk, info, options, only) {
|
||||||
super(sdk.viewer._container, options);
|
super(sdk.viewer._container, options, only);
|
||||||
this.sdk = sdk
|
this.sdk = sdk
|
||||||
this.viewer = sdk.viewer
|
this.viewer = sdk.viewer
|
||||||
this.info = info
|
this.info = info
|
||||||
if (only) {
|
|
||||||
this.closeAll()
|
|
||||||
}
|
|
||||||
this._init()
|
this._init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,76 +1,77 @@
|
|||||||
class cy_tabs {
|
class cy_tabs {
|
||||||
constructor(id, clickTabCallBack, sdk) {
|
constructor(id, clickTabCallBack, sdk) {
|
||||||
let elm = document.getElementById(id);
|
let elm = document.getElementById(id);
|
||||||
let pane = elm.getElementsByTagName('DIV-cy-tab-pane')
|
let pane = elm.getElementsByTagName('DIV-cy-tab-pane')
|
||||||
|
|
||||||
let tabTop = `<div class="DIV-cy-tab-top">`
|
let tabTop = `<div class="DIV-cy-tab-top">`
|
||||||
let tabContent = `<div class="DIV-cy-tab-content">`
|
let tabContent = `<div class="DIV-cy-tab-content">`
|
||||||
let tabindex = 0
|
let tabindex = 0
|
||||||
for (let i = 0; i < pane.length; i++) {
|
for (let i = 0; i < pane.length; i++) {
|
||||||
let flag = false
|
let flag = false
|
||||||
if (sdk && sdk.tabHide && Array.isArray(sdk.tabHide)) {
|
if (sdk && sdk.tabHide && Array.isArray(sdk.tabHide)) {
|
||||||
for (let m = 0; m < sdk.tabHide.length; m++) {
|
for (let m = 0; m < sdk.tabHide.length; m++) {
|
||||||
if (pane[i].getAttribute('label') === sdk.tabHide[m]) {
|
if (pane[i].getAttribute('label') === sdk.tabHide[m]) {
|
||||||
flag = true
|
flag = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flag) {
|
if (flag) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
let style = 'display: none;'
|
let style = 'display: none;'
|
||||||
let active = ''
|
let active = ''
|
||||||
if (tabindex == 0) {
|
if (tabindex == 0) {
|
||||||
style = ''
|
style = ''
|
||||||
active = 'is-active'
|
active = 'is-active'
|
||||||
}
|
}
|
||||||
tabTop = tabTop + `
|
tabTop = tabTop + `
|
||||||
<div class="DIV-cy-tab-pane-title">
|
<div class="DIV-cy-tab-pane-title">
|
||||||
<div class="DIV-cy-tab-pane-title-p `+ active + `" tabindex="` + tabindex + `"><span>` + pane[i].getAttribute('label') + `</span></div>
|
<div class="DIV-cy-tab-pane-title-p `+ active + `" tabindex="` + tabindex + `"><span>` + pane[i].getAttribute('label') + `</span></div>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
tabContent = tabContent + `<div class="DIV-cy-tab-content-pane ${pane[i].className}" style="` + style + `">` + pane[i].innerHTML + `</div>`
|
tabContent = tabContent + `<div class="DIV-cy-tab-content-pane ${pane[i].className}" style="` + style + `">` + pane[i].innerHTML + `</div>`
|
||||||
tabindex++
|
tabindex++
|
||||||
|
}
|
||||||
|
tabTop = tabTop + `</div>`
|
||||||
|
tabContent = tabContent + `</div>`
|
||||||
|
|
||||||
|
let BoxElm = document.createElement('div');
|
||||||
|
BoxElm.setAttribute('id', id)
|
||||||
|
BoxElm.setAttribute('class', 'DIV-cy-tabs')
|
||||||
|
BoxElm.innerHTML = tabTop + tabContent
|
||||||
|
elm.parentNode.insertBefore(BoxElm, elm);
|
||||||
|
elm.parentNode.removeChild(elm);
|
||||||
|
|
||||||
|
// 点击事件
|
||||||
|
let tabs = BoxElm.getElementsByClassName('DIV-cy-tab-pane-title-p')
|
||||||
|
for (let i = 0; i < tabs.length; i++) {
|
||||||
|
tabs[i].addEventListener('click', (e) => {
|
||||||
|
let tabindex = e.target.getAttribute('tabindex')
|
||||||
|
let contentElm = BoxElm.getElementsByClassName('DIV-cy-tab-content-pane')
|
||||||
|
clickTabCallBack && clickTabCallBack(tabindex)
|
||||||
|
for (let i = 0; i < contentElm.length; i++) {
|
||||||
|
if (i === parseInt(tabindex)) {
|
||||||
|
contentElm[i].style.display = ''
|
||||||
|
tabs[i].className = 'DIV-cy-tab-pane-title-p is-active'
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
contentElm[i].style.display = 'none'
|
||||||
|
tabs[i].className = 'DIV-cy-tab-pane-title-p'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
tabTop = tabTop + `</div>`
|
contentElm[parseInt(tabindex)].style.display = ''
|
||||||
tabContent = tabContent + `</div>`
|
})
|
||||||
|
|
||||||
let BoxElm = document.createElement('div');
|
|
||||||
BoxElm.setAttribute('id', id)
|
|
||||||
BoxElm.setAttribute('class', 'DIV-cy-tabs')
|
|
||||||
BoxElm.innerHTML = tabTop + tabContent
|
|
||||||
elm.parentNode.insertBefore(BoxElm, elm);
|
|
||||||
elm.parentNode.removeChild(elm);
|
|
||||||
|
|
||||||
// 点击事件
|
|
||||||
let tabs = BoxElm.getElementsByClassName('DIV-cy-tab-pane-title-p')
|
|
||||||
for (let i = 0; i < tabs.length; i++) {
|
|
||||||
tabs[i].addEventListener('click', (e) => {
|
|
||||||
let tabindex = e.target.getAttribute('tabindex')
|
|
||||||
let contentElm = BoxElm.getElementsByClassName('DIV-cy-tab-content-pane')
|
|
||||||
for (let i = 0; i < contentElm.length; i++) {
|
|
||||||
if (i === parseInt(tabindex)) {
|
|
||||||
contentElm[i].style.display = ''
|
|
||||||
tabs[i].className = 'DIV-cy-tab-pane-title-p is-active'
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
contentElm[i].style.display = 'none'
|
|
||||||
tabs[i].className = 'DIV-cy-tab-pane-title-p'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
contentElm[parseInt(tabindex)].style.display = ''
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
this.clickTabCallBack = clickTabCallBack
|
|
||||||
}
|
}
|
||||||
|
|
||||||
clickTabCallBack() {
|
this.clickTabCallBack = clickTabCallBack
|
||||||
if (this.clickTabCallBack) {
|
}
|
||||||
this.clickTabCallBack()
|
|
||||||
}
|
clickTabCallBack() {
|
||||||
|
if (this.clickTabCallBack) {
|
||||||
|
this.clickTabCallBack()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default cy_tabs
|
export default cy_tabs
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
var legp = function (parentElement, ele) {
|
var legp = function (parentElement, ele, index = 0) {
|
||||||
let targetValue = null
|
let targetValue = null
|
||||||
return ({
|
return ({
|
||||||
that: Array.prototype.slice.call(parentElement.querySelectorAll(ele), 0),
|
that: Array.prototype.slice.call(parentElement.querySelectorAll(ele), 0),
|
||||||
stopPropagation: function (e) {
|
stopPropagation: function (e) {
|
||||||
e = e || window.event;
|
e = e || window.event;
|
||||||
if (e.stopPropagation) { //W3C阻止冒泡方法
|
if (e.stopPropagation) { //W3C阻止冒泡方法
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
e.cancelBubble = true; //IE阻止冒泡方法
|
e.cancelBubble = true; //IE阻止冒泡方法
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
hide: function () {
|
hide: function () {
|
||||||
@ -16,10 +16,14 @@ var legp = function (parentElement, ele) {
|
|||||||
item.style.cssText += "display:none;";
|
item.style.cssText += "display:none;";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
show: function () {
|
show: function (num) {
|
||||||
legp(parentElement, ele).that.forEach(function (item) {
|
if (num !== undefined) {
|
||||||
item.style.cssText += "display:block;";
|
legp(parentElement, ele).that[num].style.cssText += "display:block;";
|
||||||
});
|
} else {
|
||||||
|
legp(parentElement, ele).that.forEach(function (item) {
|
||||||
|
item.style.cssText += "display:block;";
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
legp_searchList: function (name) {
|
legp_searchList: function (name) {
|
||||||
let arr = [];
|
let arr = [];
|
||||||
@ -28,19 +32,20 @@ var legp = function (parentElement, ele) {
|
|||||||
});
|
});
|
||||||
return arr;
|
return arr;
|
||||||
},
|
},
|
||||||
legp_search: function (tagData, search=false) {
|
legp_search: function (tagData, search = false) {
|
||||||
var domId = legp(parentElement, ele).that[0];
|
// var domId = legp(parentElement, ele).that[0];
|
||||||
|
var domId = legp(parentElement, ele).that[index];
|
||||||
if (!domId) {
|
if (!domId) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var html = `<div class="cy_datalist"><i class="yj-custom-icon-arrow-down"></i>\n ${search ? '<input type="text" placeholder="\u8F93\u5165\u6216\u9009\u62E9" autocomplete="off">' : '<input type="text" class="datalist" readonly="readonly" placeholder="\u8bf7\u9009\u62e9" autocomplete="off">'}\n <dl style="display: none;position: absolute;background: rgba(0, 0, 0, 0.5);color: rgba(var(--color-sdk-base-rgb), 1);border: 1px solid rgba(var(--color-sdk-base-rgb), 0.2);border-radius: 3px;margin: 2px 0px;max-height: 300px;overflow-x: hidden;white-space: nowrap; font-size: 12px;z-index: 8;">\n </dl>\n </div>`;
|
var html = `<div class="cy_datalist"><i class="yj-custom-icon-arrow-down"></i>\n ${search ? '<input type="text" placeholder="\u8F93\u5165\u6216\u9009\u62E9" autocomplete="off">' : `<input type="text" class="datalist ${index}" readonly="readonly" placeholder="\u8bf7\u9009\u62e9" autocomplete="off">`}\n <dl style="display: none;position: absolute;background: rgba(0, 0, 0, 0.5);color: rgba(var(--color-sdk-base-rgb), 1);border: 1px solid rgba(var(--color-sdk-base-rgb), 0.2);border-radius: 3px;margin: 2px 0px;max-height: 300px;overflow-x: hidden;white-space: nowrap; font-size: 12px;z-index: 8;">\n </dl>\n </div>`;
|
||||||
domId.innerHTML = html;
|
domId.innerHTML = html;
|
||||||
// domId.appendChild(dom);
|
// domId.appendChild(dom);
|
||||||
//获取当前广告
|
//获取当前广告
|
||||||
function myClick() {
|
function myClick() {
|
||||||
legp(parentElement, ".cy_datalist dl dd").that.forEach(function (item) {
|
legp(parentElement, ".cy_datalist dl dd").that.forEach(function (item) {
|
||||||
item.onclick = function (e) {
|
item.onclick = function (e) {
|
||||||
if(!this || !this.attributes) {
|
if (!this || !this.attributes) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let value = this.attributes.value.value;
|
let value = this.attributes.value.value;
|
||||||
@ -68,39 +73,42 @@ var legp = function (parentElement, ele) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//筛选
|
//筛选
|
||||||
legp(parentElement, ".cy_datalist input").that[0].oninput = function () {
|
legp(parentElement, ".cy_datalist input").that[index].oninput = function (e) {
|
||||||
var val = this.value; //获取input值
|
var val = this.value; //获取input值
|
||||||
|
legp(parentElement, ".cy_datalist dl").hide();
|
||||||
// legp(parentElement, ".cy_datalist dl").hide();
|
|
||||||
if (tagData.length > 0) {
|
if (tagData.length > 0) {
|
||||||
legp(parentElement, ".cy_datalist dl").show();
|
legp(parentElement, ".cy_datalist dl").show();
|
||||||
var sear_1 = new RegExp(val);
|
var sear_1 = new RegExp(val);
|
||||||
var judge_1 = false;
|
var judge_1 = false;
|
||||||
legp(parentElement, ".cy_datalist dl").that[0].innerHTML = "";
|
legp(parentElement, ".cy_datalist dl").that[index].innerHTML = "";
|
||||||
tagData.forEach(function (item) {
|
tagData.forEach(function (item) {
|
||||||
if (sear_1.test(item.name)) {
|
if (sear_1.test(item.name)) {
|
||||||
judge_1 = true;
|
judge_1 = true;
|
||||||
legp(parentElement, ".cy_datalist dl").that[0].innerHTML += "<dd class=\"" + ((targetValue === item.value) ? 'active' : '') + "\" style=\"margin: 0; padding: 5px 5px; color: #fff;cursor: pointer;\" value=\"" + item.value + "\">" + item.name + "</dd>";
|
legp(parentElement, ".cy_datalist dl").that[index].innerHTML += "<dd class=\"" + ((targetValue === item.value) ? 'active' : '') + "\" style=\"margin: 0; padding: 5px 5px; color: #fff;cursor: pointer;\" value=\"" + item.value + "\">" + item.name + "</dd>";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!judge_1) {
|
if (!judge_1) {
|
||||||
legp(parentElement, ".cy_datalist dl").that[0].innerHTML = "<dd style=\"padding: 10px 20px; color: #fff;\">\u6682\u65E0\u6570\u636E</dd>";
|
legp(parentElement, ".cy_datalist dl").that[index].innerHTML = "<dd style=\"padding: 10px 20px; color: #fff;\">\u6682\u65E0\u6570\u636E</dd>";
|
||||||
}
|
}
|
||||||
myClick();
|
myClick();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
//显示没被选择的
|
//显示没被选择的
|
||||||
legp(parentElement, ".cy_datalist input").that[0].onclick = function (e) {
|
legp(parentElement, ".cy_datalist input").that[index].onclick = function (e) {
|
||||||
if(legp(parentElement, ".cy_datalist dl").that[0].style.display === 'none') {
|
|
||||||
|
legp(parentElement, ".cy_datalist dl").hide();
|
||||||
|
let num = e.srcElement.classList[1] * 1
|
||||||
|
num = num || 0
|
||||||
|
if (legp(parentElement, ".cy_datalist dl").that[num].style.display === 'none') {
|
||||||
if (tagData.length == 0) {
|
if (tagData.length == 0) {
|
||||||
this.innerHTML = "暂无数据";
|
this.innerHTML = "暂无数据";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
legp(parentElement, ".cy_datalist dl").show();
|
legp(parentElement, ".cy_datalist dl").show(num);
|
||||||
}
|
}
|
||||||
legp(parentElement, ".cy_datalist dl").that[0].innerHTML = "";
|
legp(parentElement, ".cy_datalist dl").that[num].innerHTML = "";
|
||||||
tagData.forEach(function (item) {
|
tagData.forEach(function (item) {
|
||||||
legp(parentElement, ".cy_datalist dl").that[0].innerHTML += "<dd class=\"" + ((targetValue === item.value) ? 'active' : '') + "\" style=\"margin: 0; padding: 5px 5px; color: #fff;cursor: pointer;\" value=\"" + item.value + "\">" + item.name + "</dd>";
|
legp(parentElement, ".cy_datalist dl").that[num].innerHTML += "<dd class=\"" + ((targetValue === item.value) ? 'active' : '') + "\" style=\"margin: 0; padding: 5px 5px; color: #fff;cursor: pointer;\" value=\"" + item.value + "\">" + item.name + "</dd>";
|
||||||
});
|
});
|
||||||
myClick();
|
myClick();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,21 +1,27 @@
|
|||||||
let fontData = [
|
let fontData = [
|
||||||
|
{
|
||||||
|
name: '黑体',
|
||||||
|
value: '黑体',
|
||||||
|
font: 'SimHei',
|
||||||
|
key: '0'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: '思源黑体',
|
name: '思源黑体',
|
||||||
value: '思源黑体',
|
value: '思源黑体',
|
||||||
font: 'SourceHanSansTi',
|
font: 'SourceHanSansTi',
|
||||||
key: '0'
|
key: '1'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '庞门正道标题体',
|
name: '庞门正道标题体',
|
||||||
value: '庞门正道标题体',
|
value: '庞门正道标题体',
|
||||||
font: 'PMZDBTTi',
|
font: 'PMZDBTTi',
|
||||||
key: '1'
|
key: '2'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '数黑体',
|
name: '数黑体',
|
||||||
value: '数黑体',
|
value: '数黑体',
|
||||||
font: 'AlimamaShuHeiTi',
|
font: 'AlimamaShuHeiTi',
|
||||||
key: '2'
|
key: '3'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@ -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']
|
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() {
|
function setSvg() {
|
||||||
let svgElm = document.createElement('svg');
|
let svgElm = document.createElement('svg');
|
||||||
svgElm.xmlns = 'http://www.w3.org/2000/svg'
|
svgElm.xmlns = 'http://www.w3.org/2000/svg'
|
||||||
|
|||||||
474
src/Obj/Element/yj-color-picker.js
Normal file
474
src/Obj/Element/yj-color-picker.js
Normal file
@ -0,0 +1,474 @@
|
|||||||
|
class YJColorPicker {
|
||||||
|
constructor(options = {}) {
|
||||||
|
let _this = this
|
||||||
|
let RInput
|
||||||
|
let GInput
|
||||||
|
let BInput
|
||||||
|
let AInput
|
||||||
|
|
||||||
|
let config = {
|
||||||
|
el: options.el,
|
||||||
|
size: "mini",
|
||||||
|
isLog: false,
|
||||||
|
disabled: options.disabled || false, //是否禁止打开颜色选择器
|
||||||
|
alpha: false, //是否开启透明度
|
||||||
|
clickDefineColor: clickDefineColor,
|
||||||
|
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
|
||||||
|
let c = Cesium.Color.fromCssColorString(color)
|
||||||
|
if (AInput) {
|
||||||
|
c = c.withAlpha(AInput.value)
|
||||||
|
this.pickAlphaInputValue = AInput.value
|
||||||
|
}
|
||||||
|
color = c.toCssHexString()
|
||||||
|
if (typeof options.sure == 'function') {
|
||||||
|
options.sure(color)
|
||||||
|
}
|
||||||
|
customizeStyle()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (options.clear) {
|
||||||
|
config.clear = () => {
|
||||||
|
if (AInput) {
|
||||||
|
AInput.value = this.pickAlphaInputValue = 1
|
||||||
|
}
|
||||||
|
this.colorPicker.config.defaultColor = ''
|
||||||
|
customizeStyle()
|
||||||
|
if (typeof options.clear == 'function') {
|
||||||
|
options.clear()
|
||||||
|
}
|
||||||
|
// setTimeout(() => {
|
||||||
|
// this.pickAlphaInputValue = 100
|
||||||
|
// this.colorPicker.$Dom.pickerInput.value = ''
|
||||||
|
// if (options.clear && typeof options.clear == 'function') {
|
||||||
|
// options.clear()
|
||||||
|
// }
|
||||||
|
// customizeStyle()
|
||||||
|
// }, this.colorPicker.config.pickerAnimationTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let CesiumColor
|
||||||
|
if (config.defaultColor) {
|
||||||
|
CesiumColor = Cesium.Color.fromCssColorString(config.defaultColor)
|
||||||
|
}
|
||||||
|
// if (options.predefineColor) {
|
||||||
|
// config.predefineColor = ['rgba(255, 255, 255, 1)', 'rgba(255, 0, 0, 1)', 'rgba(208, 132, 209, 1)', 'rgba(100, 182, 217, 1)', 'rgba(42, 130, 228, 1)', 'rgba(214, 36, 36, 1)', 'rgba(252, 222, 111, 1)', 'rgba(67, 207, 124, 1)', 'rgba(176, 243, 143, 1)', 'rgba(121, 72, 234, 1)', 'rgba(255, 195, 0, 1)', 'rgba(0, 186, 173, 1)', 'rgba(165, 214, 63, 1)', 'rgba(0, 0, 0, 1)', 'rgba(46, 47, 51, 1)', 'rgba(172, 51, 193, 1)', 'rgba(130, 21, 21, 1)', 'rgba(255, 87, 51, 1)', 'rgba(255, 140, 0, 1)', 'rgba(125, 191, 255, 1)']
|
||||||
|
// }
|
||||||
|
config.predefineColor = ['rgba(255, 255, 255, 1)', 'rgba(255, 0, 0, 1)', 'rgba(208, 132, 209, 1)', 'rgba(100, 182, 217, 1)', 'rgba(42, 130, 228, 1)', 'rgba(214, 36, 36, 1)', 'rgba(252, 222, 111, 1)', 'rgba(67, 207, 124, 1)', 'rgba(176, 243, 143, 1)', 'rgba(121, 72, 234, 1)', 'rgba(255, 195, 0, 1)', 'rgba(0, 186, 173, 1)', 'rgba(165, 214, 63, 1)', 'rgba(0, 0, 0, 1)', 'rgba(46, 47, 51, 1)', 'rgba(172, 51, 193, 1)', 'rgba(130, 21, 21, 1)', 'rgba(255, 87, 51, 1)', 'rgba(255, 140, 0, 1)', 'rgba(125, 191, 255, 1)']
|
||||||
|
this.colorPicker = new ewPlugins('colorpicker', config)
|
||||||
|
// window.colorPicker = this.colorPicker
|
||||||
|
|
||||||
|
customizeStyle()
|
||||||
|
|
||||||
|
function customizeStyle() {
|
||||||
|
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 pickAlphaSliderBar = picker.getElementsByClassName('ew-alpha-slider-bar')[0]
|
||||||
|
if (pickAlphaSliderBar) {
|
||||||
|
pickAlphaSliderBar.parentNode.style.width = '16px'
|
||||||
|
pickAlphaSliderBar.parentNode.removeChild(pickAlphaSliderBar)
|
||||||
|
}
|
||||||
|
|
||||||
|
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'
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
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)
|
||||||
|
pickerInput.style.width = '106px'
|
||||||
|
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') {
|
||||||
|
AInput.value = parseInt(_this.pickAlphaInputValue * 100) / 100
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
AInput.value = CesiumColor ? parseInt(CesiumColor.alpha * 100) / 100 : 1
|
||||||
|
}
|
||||||
|
_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')
|
||||||
|
if (colorList) {
|
||||||
|
colorList = JSON.parse(colorList)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
colorList = {}
|
||||||
|
}
|
||||||
|
let customDivider2 = document.createElement('span')
|
||||||
|
customDivider2.className = 'custom-divider'
|
||||||
|
customDivider2.style.margin = '10px 0'
|
||||||
|
let customDivider3 = document.createElement('span')
|
||||||
|
customDivider3.className = 'custom-divider'
|
||||||
|
defineColorContainer.parentNode.insertBefore(customDivider2, defineColorContainer)
|
||||||
|
defineColorContainer.parentNode.insertBefore(customDivider3, defineColorContainer.nextSibling)
|
||||||
|
|
||||||
|
let collectColorContainer = document.createElement('div')
|
||||||
|
collectColorContainer.className = 'yj-pre-collect-color-container'
|
||||||
|
customDivider3.parentNode.insertBefore(collectColorContainer, customDivider3.nextSibling)
|
||||||
|
|
||||||
|
let addColorBtn = document.createElement('div')
|
||||||
|
addColorBtn.innerHTML = '<svg class="icon-add2"><use xlink:href="#yj-icon-add2"></use></svg>'
|
||||||
|
addColorBtn.className = 'yj-pre-collect-color add'
|
||||||
|
|
||||||
|
let subtractColorBtn = document.createElement('div')
|
||||||
|
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)
|
||||||
|
|
||||||
|
let subtractElmList = []
|
||||||
|
for (let key in colorList) {
|
||||||
|
let colorElm = document.createElement('div')
|
||||||
|
colorElm.className = 'yj-pre-collect-color'
|
||||||
|
colorElm.setAttribute('tabindex', '0')
|
||||||
|
colorElm.setAttribute('color-box-id', _this.colorPicker.uid)
|
||||||
|
let colorItemElm = document.createElement('div')
|
||||||
|
colorItemElm.className = 'yj-pre-define-color-item'
|
||||||
|
colorElm.appendChild(colorItemElm)
|
||||||
|
colorItemElm.className = 'yj-pre-define-color-item'
|
||||||
|
let c = Cesium.Color.fromCssColorString(colorList[key])
|
||||||
|
let colorString = c.toCssHexString()
|
||||||
|
colorItemElm.style.backgroundColor = colorString
|
||||||
|
colorItemElm.addEventListener('click', (e) => {
|
||||||
|
_this.colorPicker.updateColor(e)
|
||||||
|
colorElm.className = 'yj-pre-collect-color yj-pre-collect-color-active'
|
||||||
|
clickDefineColor(colorString)
|
||||||
|
})
|
||||||
|
colorElm.addEventListener("blur", function (e) {
|
||||||
|
colorElm.className = 'yj-pre-collect-color'
|
||||||
|
})
|
||||||
|
|
||||||
|
let subtractElm = document.createElement('div')
|
||||||
|
subtractElm.className = 'yj-pre-define-color-item subtract-btn'
|
||||||
|
subtractElm.innerHTML = '<svg class="icon-cross"><use xlink:href="#yj-icon-cross"></use></svg>'
|
||||||
|
subtractElm.style.display = 'none'
|
||||||
|
colorElm.appendChild(subtractElm)
|
||||||
|
|
||||||
|
collectColorContainer.appendChild(colorElm)
|
||||||
|
|
||||||
|
subtractElm.addEventListener('click', () => {
|
||||||
|
delete colorList[key]
|
||||||
|
localStorage.setItem('custom-color', JSON.stringify(colorList))
|
||||||
|
collectColorContainer.removeChild(colorElm)
|
||||||
|
})
|
||||||
|
subtractElmList.push(subtractElm)
|
||||||
|
}
|
||||||
|
|
||||||
|
addColorBtn.addEventListener('click', () => {
|
||||||
|
if (isSubtract) {
|
||||||
|
isSubtract = false
|
||||||
|
for (let i = 0; i < subtractElmList.length; i++) {
|
||||||
|
subtractElmList[i].style.display = 'none'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let colorElm = document.createElement('div')
|
||||||
|
colorElm.className = 'yj-pre-collect-color'
|
||||||
|
colorElm.setAttribute('tabindex', '0')
|
||||||
|
colorElm.setAttribute('color-box-id', _this.colorPicker.uid)
|
||||||
|
let colorItemElm = document.createElement('div')
|
||||||
|
colorItemElm.className = 'yj-pre-define-color-item'
|
||||||
|
colorElm.appendChild(colorItemElm)
|
||||||
|
|
||||||
|
let color = colorRgbaToHex(colorHsbaToRgba(_this.colorPicker.hsba))
|
||||||
|
let c = Cesium.Color.fromCssColorString(color || '#ffffff')
|
||||||
|
if (AInput) {
|
||||||
|
c = c.withAlpha(AInput.value)
|
||||||
|
}
|
||||||
|
let colorString = c.toCssHexString()
|
||||||
|
colorItemElm.style.backgroundColor = colorString
|
||||||
|
colorItemElm.addEventListener('click', (e) => {
|
||||||
|
_this.colorPicker.updateColor(e)
|
||||||
|
colorElm.className = 'yj-pre-collect-color yj-pre-collect-color-active'
|
||||||
|
clickDefineColor(colorString)
|
||||||
|
})
|
||||||
|
colorElm.addEventListener("blur", function (e) {
|
||||||
|
colorElm.className = 'yj-pre-collect-color'
|
||||||
|
})
|
||||||
|
collectColorContainer.appendChild(colorElm)
|
||||||
|
|
||||||
|
let subtractElm = document.createElement('div')
|
||||||
|
subtractElm.className = 'yj-pre-define-color-item subtract-btn'
|
||||||
|
subtractElm.innerHTML = '<svg class="icon-cross"><use xlink:href="#yj-icon-cross"></use></svg>'
|
||||||
|
subtractElm.style.display = 'none'
|
||||||
|
colorElm.appendChild(subtractElm)
|
||||||
|
subtractElmList.push(subtractElm)
|
||||||
|
|
||||||
|
let key = Cesium.createGuid()
|
||||||
|
colorList[key] = colorString
|
||||||
|
localStorage.setItem('custom-color', JSON.stringify(colorList))
|
||||||
|
subtractElm.addEventListener('click', () => {
|
||||||
|
delete colorList[key]
|
||||||
|
localStorage.setItem('custom-color', JSON.stringify(colorList))
|
||||||
|
collectColorContainer.removeChild(colorElm)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
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 (AInput) {
|
||||||
|
let c = Cesium.Color.fromCssColorString(color)
|
||||||
|
AInput.value = parseInt(c.alpha * 100) / 100
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function colorHsbaToRgba(e) {
|
||||||
|
var r, n, o, i = e.a, a = Math.round(e.h), s = Math.round(255 * e.s / 100), l = Math.round(255 * e.b / 100);
|
||||||
|
if (0 === s)
|
||||||
|
r = n = o = l;
|
||||||
|
else {
|
||||||
|
var c = (255 - s) * l / 255
|
||||||
|
, d = a % 60 * (l - c) / 60;
|
||||||
|
360 === a ? (r = l,
|
||||||
|
n = o = 0) : a < 60 ? (r = l,
|
||||||
|
n = c + d,
|
||||||
|
o = c) : a < 120 ? (r = l - d,
|
||||||
|
n = l,
|
||||||
|
o = c) : a < 180 ? (r = c,
|
||||||
|
n = l,
|
||||||
|
o = c + d) : a < 240 ? (r = c,
|
||||||
|
n = l - d,
|
||||||
|
o = l) : a < 300 ? (r = c + d,
|
||||||
|
n = c,
|
||||||
|
o = l) : a < 360 ? (r = l,
|
||||||
|
n = c,
|
||||||
|
o = l - d) : r = n = o = 0
|
||||||
|
}
|
||||||
|
return "rgba(" + Math.round(r) + "," + Math.round(n) + "," + Math.round(o) + "," + i + ")"
|
||||||
|
}
|
||||||
|
|
||||||
|
function colorRgbaToHex(e) {
|
||||||
|
var t = {
|
||||||
|
10: "A",
|
||||||
|
11: "B",
|
||||||
|
12: "C",
|
||||||
|
13: "D",
|
||||||
|
14: "E",
|
||||||
|
15: "F"
|
||||||
|
};
|
||||||
|
if (/rgba?/.test(e)) {
|
||||||
|
var r = e.replace(/rgba?\(/, "").replace(/\)/, "").replace(/[\s+]/g, "").split(",")
|
||||||
|
, n = "";
|
||||||
|
r[3];
|
||||||
|
return r.map(function (e, r) {
|
||||||
|
r <= 2 && (n += function (e) {
|
||||||
|
e = Math.min(Math.round(e), 255);
|
||||||
|
var r = Math.floor(e / 16)
|
||||||
|
, n = e % 16;
|
||||||
|
return "" + (t[r] || r) + (t[n] || n)
|
||||||
|
}(e))
|
||||||
|
}),
|
||||||
|
"#" + 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 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]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.YJColorPicker = YJColorPicker
|
||||||
|
export default YJColorPicker
|
||||||
159
src/Obj/Materail/FlowDashedLineFlowMaterialProperty.js
Normal file
159
src/Obj/Materail/FlowDashedLineFlowMaterialProperty.js
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
/*
|
||||||
|
* @Description: 流动线
|
||||||
|
*/
|
||||||
|
function FlowDashedLine() {
|
||||||
|
class FlowDashedLineFlowMaterialProperty {
|
||||||
|
constructor(options) {
|
||||||
|
this._definitionChanged = new Cesium.Event();
|
||||||
|
this._color = undefined;
|
||||||
|
this._speed = undefined;
|
||||||
|
this._uType = undefined;
|
||||||
|
this._space = undefined;
|
||||||
|
this._dashSize = undefined;
|
||||||
|
this._scale = undefined;
|
||||||
|
this.color = new Cesium.Color.fromCssColorString(options.color || "rgba(255,255,255,1)");
|
||||||
|
this.speed = options.speed != undefined ? options.speed : 1.0;//速度
|
||||||
|
this.space = options.space || 0.0;//速度
|
||||||
|
this.dashSize = options.dashSize || 0.03;//速度
|
||||||
|
this.uType = options.uType === undefined ? 1 : options.uType;//类型:0:普通流动线 1:虚化虚线
|
||||||
|
this.lineBackAlpha = options.lineBackAlpha || 0.05;
|
||||||
|
this.scale = options.scale || 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
get isConstant() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
get definitionChanged() {
|
||||||
|
return this._definitionChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
getType(time) {
|
||||||
|
return Cesium.Material.FlowDashedLineMaterialType;
|
||||||
|
}
|
||||||
|
|
||||||
|
getValue(time, result) {
|
||||||
|
if (!Cesium.defined(result)) {
|
||||||
|
result = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
result.color = Cesium.Property.getValueOrDefault(
|
||||||
|
this._color,
|
||||||
|
time,
|
||||||
|
Cesium.Color.RED,
|
||||||
|
result.color
|
||||||
|
);
|
||||||
|
result.speed = Cesium.Property.getValueOrDefault(
|
||||||
|
this._speed,
|
||||||
|
time,
|
||||||
|
10,
|
||||||
|
result.speed
|
||||||
|
);
|
||||||
|
result.space = Cesium.Property.getValueOrDefault(
|
||||||
|
this._space,
|
||||||
|
time,
|
||||||
|
10,
|
||||||
|
result.space
|
||||||
|
);
|
||||||
|
result.dashSize = Cesium.Property.getValueOrDefault(
|
||||||
|
this._dashSize,
|
||||||
|
time,
|
||||||
|
10,
|
||||||
|
result.dashSize
|
||||||
|
);
|
||||||
|
result.uType = Cesium.Property.getValueOrDefault(
|
||||||
|
this._uType,
|
||||||
|
time,
|
||||||
|
1,
|
||||||
|
result.uType
|
||||||
|
);
|
||||||
|
result.scale = Cesium.Property.getValueOrDefault(
|
||||||
|
this._scale,
|
||||||
|
time,
|
||||||
|
1.0,
|
||||||
|
result.scale
|
||||||
|
);
|
||||||
|
result.lineBackAlpha = this.lineBackAlpha;
|
||||||
|
result.frameNumber = Cesium.getTimestamp();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
equals(other) {
|
||||||
|
return (
|
||||||
|
this === other ||
|
||||||
|
(other instanceof FlowDashedLineFlowMaterialProperty &&
|
||||||
|
Cesium.Property.equals(this._color, other._color) &&
|
||||||
|
Cesium.Property.equals(this._speed, other.speed) &&
|
||||||
|
Cesium.Property.equals(this._uType, other.uType) &&
|
||||||
|
Cesium.Property.equals(this._lineBackAlpha, other.lineBackAlpha) &&
|
||||||
|
Cesium.Property.equals(this._scale, other.scale))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.defineProperties(FlowDashedLineFlowMaterialProperty.prototype, {
|
||||||
|
color: Cesium.createPropertyDescriptor("color"),
|
||||||
|
speed: Cesium.createPropertyDescriptor("speed"),
|
||||||
|
space: Cesium.createPropertyDescriptor("space"),
|
||||||
|
dashSize: Cesium.createPropertyDescriptor("dashSize"),
|
||||||
|
uType: Cesium.createPropertyDescriptor("uType"),
|
||||||
|
transparency: Cesium.createPropertyDescriptor("lineBackAlpha"),
|
||||||
|
scale: Cesium.createPropertyDescriptor("scale"),
|
||||||
|
});
|
||||||
|
|
||||||
|
Cesium.FlowDashedLineFlowMaterialProperty = FlowDashedLineFlowMaterialProperty;
|
||||||
|
Cesium.Material.FlowDashedLineFlowMaterialProperty = "FlowDashedLineFlowMaterialProperty";
|
||||||
|
Cesium.Material.FlowDashedLineMaterialType = "FlowDashedLineMaterialType";
|
||||||
|
Cesium.Material.FlowDashedLineMaterialSource = `
|
||||||
|
uniform vec4 color;
|
||||||
|
uniform float speed;
|
||||||
|
// uniform int uType;
|
||||||
|
uniform float lineBackAlpha;
|
||||||
|
|
||||||
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||||||
|
{
|
||||||
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
||||||
|
vec2 st = materialInput.st;
|
||||||
|
|
||||||
|
float dashSize = 0.1;
|
||||||
|
float gapSize = space;
|
||||||
|
// speed现在表示完成一次完整动画循环的秒数
|
||||||
|
float progress = speed==0.0 ? 0.0 : fract(frameNumber / 1000.0 / speed * scale);
|
||||||
|
float pattern = fract(st.x / dashSize * (1.0 + gapSize) + progress / dashSize * (1.0 + gapSize));
|
||||||
|
float dash1 = step(0.0, pattern) - step(1.0/(1.0 + gapSize), pattern);
|
||||||
|
float dash2 = smoothstep(0.0, 0.2, pattern) -
|
||||||
|
smoothstep(1.0/(1.0 + gapSize),
|
||||||
|
1.0/(1.0 + gapSize) + 0.2,
|
||||||
|
pattern);
|
||||||
|
float dash = (float(uType) != 1.0)?dash1:dash2;
|
||||||
|
material.alpha = dash;
|
||||||
|
material.diffuse = color.rgb;
|
||||||
|
return material;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
Cesium.Material._materialCache.addMaterial(
|
||||||
|
Cesium.Material.FlowDashedLineMaterialType,
|
||||||
|
{
|
||||||
|
fabric: {
|
||||||
|
type: Cesium.Material.FlowDashedLineMaterialType,
|
||||||
|
uniforms: {
|
||||||
|
color: new Cesium.Color(1.0, 1.0, 1.0, 1.0),
|
||||||
|
speed: 1,
|
||||||
|
space: 0.0,
|
||||||
|
scale: 1.0,
|
||||||
|
dashSize: 0.03,
|
||||||
|
frameNumber: Cesium.getTimestamp(),
|
||||||
|
uType: 1,
|
||||||
|
lineBackAlpha: 0.05,
|
||||||
|
},
|
||||||
|
source: Cesium.Material.FlowDashedLineMaterialSource,
|
||||||
|
},
|
||||||
|
translucent: function (material) {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { FlowDashedLine }
|
||||||
113
src/Obj/Materail/FlowLineMaterialProperty.js
Normal file
113
src/Obj/Materail/FlowLineMaterialProperty.js
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
/*
|
||||||
|
* @Description: 流动线
|
||||||
|
*/
|
||||||
|
function FlowLine() {
|
||||||
|
class FlowLineMaterialProperty {
|
||||||
|
constructor(options) {
|
||||||
|
this._definitionChanged = new Cesium.Event();
|
||||||
|
this._color = undefined;
|
||||||
|
this._duration = undefined;
|
||||||
|
this.color = new Cesium.Color.fromCssColorString(options.color || "rgba(255,255,255,1)");
|
||||||
|
this.duration = options.duration || 10.0;
|
||||||
|
this.lineBackAlpha = options.lineBackAlpha || 0.05;
|
||||||
|
}
|
||||||
|
|
||||||
|
get isConstant() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
get definitionChanged() {
|
||||||
|
return this._definitionChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
getType(time) {
|
||||||
|
return Cesium.Material.FlowLineMaterialType;
|
||||||
|
}
|
||||||
|
|
||||||
|
getValue(time, result) {
|
||||||
|
if (!Cesium.defined(result)) {
|
||||||
|
result = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
result.color = Cesium.Property.getValueOrDefault(
|
||||||
|
this._color,
|
||||||
|
time,
|
||||||
|
Cesium.Color.RED,
|
||||||
|
result.color
|
||||||
|
);
|
||||||
|
result.duration = Cesium.Property.getValueOrDefault(
|
||||||
|
this._duration,
|
||||||
|
time,
|
||||||
|
10,
|
||||||
|
result.duration
|
||||||
|
);
|
||||||
|
result.lineBackAlpha = this.lineBackAlpha;
|
||||||
|
result.frameNumber = Cesium.getTimestamp();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
equals(other) {
|
||||||
|
return (
|
||||||
|
this === other ||
|
||||||
|
(other instanceof FlowLineMaterialProperty &&
|
||||||
|
Cesium.Property.equals(this._color, other._color) &&
|
||||||
|
Cesium.Property.equals(this._duration, other.duration) &&
|
||||||
|
Cesium.Property.equals(this.lineBackAlpha, other.lineBackAlpha))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.defineProperties(FlowLineMaterialProperty.prototype, {
|
||||||
|
color: Cesium.createPropertyDescriptor("color"),
|
||||||
|
duration: Cesium.createPropertyDescriptor("duration"),
|
||||||
|
transparency: Cesium.createPropertyDescriptor("lineBackAlpha"),
|
||||||
|
});
|
||||||
|
|
||||||
|
Cesium.FlowLineMaterialProperty = FlowLineMaterialProperty;
|
||||||
|
Cesium.Material.FlowLineMaterialProperty = "FlowLineMaterialProperty";
|
||||||
|
Cesium.Material.FlowLineMaterialType = "FlowLineMaterialType";
|
||||||
|
Cesium.Material.FlowLineMaterialSource = `
|
||||||
|
uniform vec4 color;
|
||||||
|
uniform float duration;
|
||||||
|
uniform float lineBackAlpha;
|
||||||
|
|
||||||
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||||||
|
{
|
||||||
|
//生成默认的基础材质
|
||||||
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
||||||
|
//获取st(uv)
|
||||||
|
vec2 st = materialInput.st;
|
||||||
|
//获取当前帧数,10秒内变化0-1
|
||||||
|
float time = fract(czm_frameNumber / (60.0*duration));
|
||||||
|
//长度1/10
|
||||||
|
time = time * (1.0 + 0.1);
|
||||||
|
//平滑过渡函数
|
||||||
|
float alpha = smoothstep(time-0.1,time,st.s) * step(-time,-st.s);
|
||||||
|
//光带轨迹(不会完全透明)
|
||||||
|
alpha += lineBackAlpha;
|
||||||
|
material.alpha = alpha;
|
||||||
|
material.diffuse = color.rgb;
|
||||||
|
return material;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
Cesium.Material._materialCache.addMaterial(
|
||||||
|
Cesium.Material.FlowLineMaterialType,
|
||||||
|
{
|
||||||
|
fabric: {
|
||||||
|
type: Cesium.Material.FlowLineMaterialType,
|
||||||
|
uniforms: {
|
||||||
|
color: new Cesium.Color(1.0, 1.0, 1.0, 1.0),
|
||||||
|
duration: 10.0,
|
||||||
|
lineBackAlpha: 0.05,
|
||||||
|
},
|
||||||
|
source: Cesium.Material.FlowLineMaterialSource,
|
||||||
|
},
|
||||||
|
translucent: function (material) {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { FlowLine }
|
||||||
123
src/Obj/Materail/LineTextureMaterialProperty.js
Normal file
123
src/Obj/Materail/LineTextureMaterialProperty.js
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
/*
|
||||||
|
* @Description: 流动线
|
||||||
|
*/
|
||||||
|
function LineTexture() {
|
||||||
|
class LineTextureMaterialProperty {
|
||||||
|
constructor(options) {
|
||||||
|
this._definitionChanged = new Cesium.Event();
|
||||||
|
this._image = undefined;
|
||||||
|
this._color = undefined;
|
||||||
|
this._speed = undefined;
|
||||||
|
this._repeat = undefined;
|
||||||
|
this.image = options.image || "";
|
||||||
|
this.color = new Cesium.Color.fromCssColorString(options.color || "rgba(255,255,255,1)");
|
||||||
|
this.speed = options.speed != undefined ? options.speed : 1.0;
|
||||||
|
this.repeat = options.repeat || new Cesium.Cartesian2(1.0, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
get isConstant() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
get definitionChanged() {
|
||||||
|
return this._definitionChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
getType(time) {
|
||||||
|
return Cesium.Material.LineTextureMaterialType;
|
||||||
|
}
|
||||||
|
|
||||||
|
getValue(time, result) {
|
||||||
|
if (!Cesium.defined(result)) {
|
||||||
|
result = {};
|
||||||
|
}
|
||||||
|
result.image = Cesium.Property.getValueOrDefault(
|
||||||
|
this._image,
|
||||||
|
time,
|
||||||
|
"",
|
||||||
|
result.image
|
||||||
|
);
|
||||||
|
result.color = Cesium.Property.getValueOrDefault(
|
||||||
|
this._color,
|
||||||
|
time,
|
||||||
|
Cesium.Color.RED,
|
||||||
|
result.color
|
||||||
|
);
|
||||||
|
result.speed = Cesium.Property.getValueOrDefault(
|
||||||
|
this._speed,
|
||||||
|
time,
|
||||||
|
1.0,
|
||||||
|
result.speed
|
||||||
|
);
|
||||||
|
result.repeat = Cesium.Property.getValueOrDefault(
|
||||||
|
this._repeat,
|
||||||
|
time,
|
||||||
|
new Cesium.Cartesian2(1.0, 1.0),
|
||||||
|
result.repeat
|
||||||
|
);
|
||||||
|
result.frameNumber = Cesium.getTimestamp();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
equals(other) {
|
||||||
|
return (
|
||||||
|
this === other ||
|
||||||
|
(other instanceof LineTextureMaterialProperty &&
|
||||||
|
Cesium.Property.equals(this._image, other._image) &&
|
||||||
|
Cesium.Property.equals(this._color, other._color) &&
|
||||||
|
Cesium.Property.equals(this._imageW, other._imageW) &&
|
||||||
|
Cesium.Property.equals(this._speed, other._speed))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.defineProperties(LineTextureMaterialProperty.prototype, {
|
||||||
|
image: Cesium.createPropertyDescriptor("image"),
|
||||||
|
color: Cesium.createPropertyDescriptor("color"),
|
||||||
|
speed: Cesium.createPropertyDescriptor("speed"),
|
||||||
|
repeat: Cesium.createPropertyDescriptor("repeat"),
|
||||||
|
});
|
||||||
|
|
||||||
|
Cesium.LineTextureMaterialProperty = LineTextureMaterialProperty;
|
||||||
|
Cesium.Material.LineTextureMaterialProperty = "LineTextureMaterialProperty";
|
||||||
|
Cesium.Material.LineTextureMaterialType = "LineTextureMaterialType";
|
||||||
|
Cesium.Material.LineTextureMaterialSource = `
|
||||||
|
uniform vec4 color;
|
||||||
|
uniform sampler2D image;
|
||||||
|
uniform float speed;
|
||||||
|
// uniform float repeat;
|
||||||
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||||||
|
{
|
||||||
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
||||||
|
vec2 st = materialInput.st;
|
||||||
|
st.s *= repeat.x; // 关键:通过repeat控制纹理密度
|
||||||
|
// vec4 colorImage = texture2D(image, vec2(fract(st.s + speed*czm_frameNumber* 0.01), st.t));
|
||||||
|
vec4 colorImage = speed==0.0?texture2D(image, vec2(fract(st.s), st.t)):texture2D(image, vec2(fract(st.s + frameNumber / 1000.0 / speed * repeat.x / repeat.y ), st.t));
|
||||||
|
material.alpha = colorImage.a * color.a;
|
||||||
|
material.diffuse = color.rgb;
|
||||||
|
return material;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
Cesium.Material._materialCache.addMaterial(
|
||||||
|
Cesium.Material.LineTextureMaterialType,
|
||||||
|
{
|
||||||
|
fabric: {
|
||||||
|
type: Cesium.Material.LineTextureMaterialType,
|
||||||
|
uniforms: {
|
||||||
|
color: new Cesium.Color(1.0, 1.0, 1.0, 1.0),
|
||||||
|
image: '',
|
||||||
|
repeat: new Cesium.Cartesian2(1.0, 1.0),
|
||||||
|
speed: 1.0,
|
||||||
|
frameNumber: Cesium.getTimestamp(),
|
||||||
|
uTime: 1
|
||||||
|
},
|
||||||
|
source: Cesium.Material.LineTextureMaterialSource,
|
||||||
|
},
|
||||||
|
translucent: function (material) {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { LineTexture }
|
||||||
131
src/Obj/Materail/PolylineFlowMaterialProperty.js
Normal file
131
src/Obj/Materail/PolylineFlowMaterialProperty.js
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
/*
|
||||||
|
* @Description: 流动线
|
||||||
|
*/
|
||||||
|
function PolylineFlow() {
|
||||||
|
class PolylineFlowMaterialProperty {
|
||||||
|
constructor(options) {
|
||||||
|
this._definitionChanged = new Cesium.Event();
|
||||||
|
this._color = undefined;
|
||||||
|
this._speed = undefined;
|
||||||
|
this._rotate = undefined;
|
||||||
|
this.color = new Cesium.Color.fromCssColorString(options.color || "rgba(255,255,255,1)");
|
||||||
|
this.speed = options.speed != undefined ? options.speed : 1.0;//速度
|
||||||
|
this.lineBackAlpha = options.lineBackAlpha || 0.05;
|
||||||
|
this.rotate = options.rotate;
|
||||||
|
}
|
||||||
|
|
||||||
|
get isConstant() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
get definitionChanged() {
|
||||||
|
return this._definitionChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
getType(time) {
|
||||||
|
return Cesium.Material.PolylineFlowMaterialType;
|
||||||
|
}
|
||||||
|
|
||||||
|
getValue(time, result) {
|
||||||
|
if (!Cesium.defined(result)) {
|
||||||
|
result = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
result.color = Cesium.Property.getValueOrDefault(
|
||||||
|
this._color,
|
||||||
|
time,
|
||||||
|
Cesium.Color.RED,
|
||||||
|
result.color
|
||||||
|
);
|
||||||
|
result.speed = Cesium.Property.getValueOrDefault(
|
||||||
|
this._speed,
|
||||||
|
time,
|
||||||
|
10,
|
||||||
|
result.speed
|
||||||
|
);
|
||||||
|
result.rotate = Cesium.Property.getValueOrDefault(
|
||||||
|
this._rotate,
|
||||||
|
time,
|
||||||
|
true,
|
||||||
|
result.rotate
|
||||||
|
);
|
||||||
|
result.lineBackAlpha = this.lineBackAlpha;
|
||||||
|
result.frameTime = Cesium.getTimestamp();
|
||||||
|
// result.frameNumber = Cesium.getTimestamp();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
equals(other) {
|
||||||
|
return (
|
||||||
|
this === other ||
|
||||||
|
(other instanceof PolylineFlowMaterialProperty &&
|
||||||
|
Cesium.Property.equals(this._color, other._color) &&
|
||||||
|
Cesium.Property.equals(this._speed, other.speed) &&
|
||||||
|
Cesium.Property.equals(this.lineBackAlpha, other.lineBackAlpha))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.defineProperties(PolylineFlowMaterialProperty.prototype, {
|
||||||
|
color: Cesium.createPropertyDescriptor("color"),
|
||||||
|
speed: Cesium.createPropertyDescriptor("speed"),
|
||||||
|
rotate: Cesium.createPropertyDescriptor("rotate"),
|
||||||
|
transparency: Cesium.createPropertyDescriptor("lineBackAlpha"),
|
||||||
|
});
|
||||||
|
|
||||||
|
Cesium.PolylineFlowMaterialProperty = PolylineFlowMaterialProperty;
|
||||||
|
Cesium.Material.PolylineFlowMaterialProperty = "PolylineFlowMaterialProperty";
|
||||||
|
Cesium.Material.PolylineFlowMaterialType = "PolylineFlowMaterialType";
|
||||||
|
Cesium.Material.PolylineFlowMaterialSource = `
|
||||||
|
uniform vec4 color;
|
||||||
|
uniform float speed;
|
||||||
|
uniform float lineBackAlpha;
|
||||||
|
|
||||||
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||||||
|
{
|
||||||
|
//生成默认的基础材质
|
||||||
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
||||||
|
//获取st(uv)
|
||||||
|
vec2 st = materialInput.st;
|
||||||
|
//获取当前帧数,10秒内变化0-1
|
||||||
|
// float time = fract(czm_frameNumber * speed / 60.0);
|
||||||
|
// float time = fract(abs(speed) * czm_frameNumber * 0.01);
|
||||||
|
float time = fract(frameTime / 1000.0 / abs(speed));
|
||||||
|
//长度1/10
|
||||||
|
// time = time * (1.0 + 0.1);
|
||||||
|
float staticAlpha = rotate?smoothstep(0.0,1.0, 1.0-st.s) * step(-1.0,-(1.0-st.s)):smoothstep(0.0,1.0, st.s) * step(-1.0,-st.s);
|
||||||
|
|
||||||
|
//平滑过渡函数
|
||||||
|
float alpha1 = smoothstep(time-0.1,time,1.0-st.s) * step(-time,- (1.0-st.s));
|
||||||
|
float alpha2 = smoothstep(time-0.1,time,st.s) * step(-time,- st.s);
|
||||||
|
float alpha =(speed== 0.0)? staticAlpha:(speed < 0.0)?alpha2:alpha1;
|
||||||
|
//光带轨迹(不会完全透明)
|
||||||
|
alpha += lineBackAlpha;
|
||||||
|
material.alpha = alpha;
|
||||||
|
material.diffuse = color.rgb;
|
||||||
|
return material;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
Cesium.Material._materialCache.addMaterial(
|
||||||
|
Cesium.Material.PolylineFlowMaterialType,
|
||||||
|
{
|
||||||
|
fabric: {
|
||||||
|
type: Cesium.Material.PolylineFlowMaterialType,
|
||||||
|
uniforms: {
|
||||||
|
color: new Cesium.Color(1.0, 1.0, 1.0, 1.0),
|
||||||
|
speed: 0.1,
|
||||||
|
rotate: true,
|
||||||
|
frameTime: Cesium.getTimestamp(),
|
||||||
|
lineBackAlpha: 0.05,
|
||||||
|
},
|
||||||
|
source: Cesium.Material.PolylineFlowMaterialSource,
|
||||||
|
},
|
||||||
|
translucent: function (material) {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { PolylineFlow }
|
||||||
167
src/Obj/Materail/PolylineFlowMultMaterialProperty.js
Normal file
167
src/Obj/Materail/PolylineFlowMultMaterialProperty.js
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
/*
|
||||||
|
* @Description: 流动线
|
||||||
|
*/
|
||||||
|
function PolylineFlowMult() {
|
||||||
|
class PolylineFlowMultMaterialProperty {
|
||||||
|
constructor(options) {
|
||||||
|
this._definitionChanged = new Cesium.Event();
|
||||||
|
this._color = undefined;
|
||||||
|
this._speed = undefined;
|
||||||
|
this._rotate = undefined;
|
||||||
|
this.color = new Cesium.Color.fromCssColorString(options.color || "rgba(255,255,255,1)");
|
||||||
|
this.speed = options.speed != undefined ? options.speed : 1.0;//速度
|
||||||
|
this.lineBackAlpha = options.lineBackAlpha || 0.05;
|
||||||
|
this.rotate = options.rotate;
|
||||||
|
}
|
||||||
|
|
||||||
|
get isConstant() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
get definitionChanged() {
|
||||||
|
return this._definitionChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
getType(time) {
|
||||||
|
return Cesium.Material.PolylineFlowMultMaterialType;
|
||||||
|
}
|
||||||
|
|
||||||
|
getValue(time, result) {
|
||||||
|
if (!Cesium.defined(result)) {
|
||||||
|
result = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
result.color = Cesium.Property.getValueOrDefault(
|
||||||
|
this._color,
|
||||||
|
time,
|
||||||
|
Cesium.Color.RED,
|
||||||
|
result.color
|
||||||
|
);
|
||||||
|
result.speed = Cesium.Property.getValueOrDefault(
|
||||||
|
this._speed,
|
||||||
|
time,
|
||||||
|
10,
|
||||||
|
result.speed
|
||||||
|
);
|
||||||
|
result.rotate = Cesium.Property.getValueOrDefault(
|
||||||
|
this._rotate,
|
||||||
|
time,
|
||||||
|
true,
|
||||||
|
result.rotate
|
||||||
|
);
|
||||||
|
result.lineBackAlpha = this.lineBackAlpha;
|
||||||
|
result.frameTime = Cesium.getTimestamp();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
equals(other) {
|
||||||
|
return (
|
||||||
|
this === other ||
|
||||||
|
(other instanceof PolylineFlowMultMaterialProperty &&
|
||||||
|
Cesium.Property.equals(this._color, other._color) &&
|
||||||
|
Cesium.Property.equals(this._speed, other.speed) &&
|
||||||
|
Cesium.Property.equals(this._rotate, other.rotate) &&
|
||||||
|
Cesium.Property.equals(this.lineBackAlpha, other.lineBackAlpha))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.defineProperties(PolylineFlowMultMaterialProperty.prototype, {
|
||||||
|
color: Cesium.createPropertyDescriptor("color"),
|
||||||
|
speed: Cesium.createPropertyDescriptor("speed"),
|
||||||
|
rotate: Cesium.createPropertyDescriptor("rotate"),
|
||||||
|
transparency: Cesium.createPropertyDescriptor("lineBackAlpha"),
|
||||||
|
});
|
||||||
|
|
||||||
|
Cesium.PolylineFlowMultMaterialProperty = PolylineFlowMultMaterialProperty;
|
||||||
|
Cesium.Material.PolylineFlowMultMaterialProperty = "PolylineFlowMultMaterialProperty";
|
||||||
|
Cesium.Material.PolylineFlowMultMaterialType = "PolylineFlowMultMaterialType";
|
||||||
|
Cesium.Material.PolylineFlowMaterialSource = `
|
||||||
|
uniform vec4 color;
|
||||||
|
uniform float speed;
|
||||||
|
uniform float lineBackAlpha;
|
||||||
|
|
||||||
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||||||
|
{
|
||||||
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
||||||
|
vec2 st = materialInput.st;
|
||||||
|
|
||||||
|
// 基础时间轴(控制主光带)
|
||||||
|
float baseTime = fract(czm_frameNumber * speed / 60.0) * 1.1;
|
||||||
|
|
||||||
|
// 高频时间轴(控制高光点)
|
||||||
|
// float highlightTime = fract(czm_frameNumber * speed * 3.0 / 60.0);
|
||||||
|
// float highlightTime = fract(abs(speed) * czm_frameNumber * 0.01);
|
||||||
|
float highlightTime = fract(frameTime / 1000.0 / abs(speed));
|
||||||
|
float highlightSpacing = 0.3; // 高光点间隔
|
||||||
|
|
||||||
|
// 主光带透明度计算
|
||||||
|
float mainAlpha = smoothstep(baseTime-0.1, baseTime, st.s) * step(-baseTime, -st.s);
|
||||||
|
|
||||||
|
// 多高光点计算(3个周期性光斑)
|
||||||
|
float highlight11 = smoothstep(highlightTime-0.05, highlightTime, st.s) *
|
||||||
|
step(-highlightTime, -st.s) *
|
||||||
|
(1.0 - smoothstep(0.0, highlightSpacing, abs(st.s - highlightTime)));
|
||||||
|
|
||||||
|
float highlight21 = smoothstep(highlightTime+highlightSpacing-0.05,
|
||||||
|
highlightTime+highlightSpacing, st.s) *
|
||||||
|
step(-(highlightTime+highlightSpacing), -st.s) *
|
||||||
|
(1.0 - smoothstep(0.0, highlightSpacing, abs(st.s - (highlightTime+highlightSpacing))));
|
||||||
|
|
||||||
|
float highlight31 = smoothstep(highlightTime+2.0*highlightSpacing-0.05,
|
||||||
|
highlightTime+2.0*highlightSpacing, st.s) *
|
||||||
|
step(-(highlightTime+2.0*highlightSpacing), -st.s) *
|
||||||
|
(1.0 - smoothstep(0.0, highlightSpacing, abs(st.s - (highlightTime+2.0*highlightSpacing))));
|
||||||
|
|
||||||
|
|
||||||
|
float highlight12 = smoothstep(highlightTime-0.05, highlightTime, 1.0 - st.s) *
|
||||||
|
step(-highlightTime, -(1.0-st.s)) *
|
||||||
|
(1.0 - smoothstep(0.0, highlightSpacing, abs(1.0 - st.s - highlightTime)));
|
||||||
|
|
||||||
|
float highlight22 = smoothstep(highlightTime+highlightSpacing-0.05,
|
||||||
|
highlightTime+highlightSpacing, 1.0 - st.s) *
|
||||||
|
step(-(highlightTime+highlightSpacing),-(1.0 - st.s)) *
|
||||||
|
(1.0 - smoothstep(0.0, highlightSpacing, abs(1.0-st.s - (highlightTime+highlightSpacing))));
|
||||||
|
|
||||||
|
float highlight32 = smoothstep(highlightTime+2.0*highlightSpacing-0.05,
|
||||||
|
highlightTime+2.0*highlightSpacing, 1.0 - st.s) *
|
||||||
|
step(-(highlightTime+2.0*highlightSpacing), -(1.0-st.s)) *
|
||||||
|
(1.0 - smoothstep(0.0, highlightSpacing, abs(1.0 - st.s - (highlightTime+2.0*highlightSpacing))));
|
||||||
|
|
||||||
|
|
||||||
|
float highlight1 = !rotate?highlight11:highlight12;
|
||||||
|
float highlight2 = !rotate?highlight21:highlight22;
|
||||||
|
float highlight3 = !rotate?highlight31:highlight32;
|
||||||
|
// 合并效果
|
||||||
|
// material.alpha = mainAlpha * 0.7 +
|
||||||
|
// (highlight1 + highlight2 + highlight3) * 0.5 +
|
||||||
|
// lineBackAlpha;
|
||||||
|
material.alpha = (highlight1 + highlight2 + highlight3) * 0.5 +
|
||||||
|
lineBackAlpha;
|
||||||
|
material.diffuse = color.rgb; // 高光区变亮
|
||||||
|
return material;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
Cesium.Material._materialCache.addMaterial(
|
||||||
|
Cesium.Material.PolylineFlowMultMaterialType,
|
||||||
|
{
|
||||||
|
fabric: {
|
||||||
|
type: Cesium.Material.PolylineFlowMultMaterialType,
|
||||||
|
uniforms: {
|
||||||
|
color: new Cesium.Color(1.0, 1.0, 1.0, 1.0),
|
||||||
|
speed: 0.1,
|
||||||
|
rotate: true,
|
||||||
|
frameTime: Cesium.getTimestamp(),
|
||||||
|
lineBackAlpha: 0.05,
|
||||||
|
},
|
||||||
|
source: Cesium.Material.PolylineFlowMaterialSource,
|
||||||
|
},
|
||||||
|
translucent: function (material) {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { PolylineFlowMult }
|
||||||
@ -2,6 +2,11 @@ import { StreamWall1, StreamWall2 } from './WallMaterialProperty'
|
|||||||
import { RadarScan } from './RadarScanMaterialProperty'
|
import { RadarScan } from './RadarScanMaterialProperty'
|
||||||
import { CustomColorMaterialSource } from './CustomColorMaterialSource'
|
import { CustomColorMaterialSource } from './CustomColorMaterialSource'
|
||||||
import { CustomImageMaterialSource } from './CustomImageMaterialSource'
|
import { CustomImageMaterialSource } from './CustomImageMaterialSource'
|
||||||
|
import { FlowLine } from './FlowLineMaterialProperty'
|
||||||
|
import { PolylineFlow } from './PolylineFlowMaterialProperty'
|
||||||
|
import { PolylineFlowMult } from './PolylineFlowMultMaterialProperty'
|
||||||
|
import { FlowDashedLine } from './FlowDashedLineFlowMaterialProperty'
|
||||||
|
import { LineTexture } from './LineTextureMaterialProperty'
|
||||||
|
|
||||||
function init_material() {
|
function init_material() {
|
||||||
StreamWall1()
|
StreamWall1()
|
||||||
@ -9,6 +14,11 @@ function init_material() {
|
|||||||
RadarScan()
|
RadarScan()
|
||||||
CustomColorMaterialSource()
|
CustomColorMaterialSource()
|
||||||
CustomImageMaterialSource()
|
CustomImageMaterialSource()
|
||||||
|
FlowLine()
|
||||||
|
PolylineFlow()
|
||||||
|
PolylineFlowMult()
|
||||||
|
FlowDashedLine()
|
||||||
|
LineTexture()
|
||||||
}
|
}
|
||||||
|
|
||||||
export { init_material }
|
export { init_material }
|
||||||
|
|||||||
@ -10,6 +10,8 @@ import { Proj } from './proj'
|
|||||||
import { open as projConvertOpen, close as projConvertClose } from './projConvert'
|
import { open as projConvertOpen, close as projConvertClose } from './projConvert'
|
||||||
import { open as projectionConvertOpen, close as projectionConvertClose } from './projectionConvert'
|
import { open as projectionConvertOpen, close as projectionConvertClose } from './projectionConvert'
|
||||||
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../Global/global'
|
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../Global/global'
|
||||||
|
import FlowPictureMaterialProperty from '../Obj/Materail/FlowPictureMaterialProperty'
|
||||||
|
import { syncData, get3DView } from '../Global/MultiViewportMode'
|
||||||
|
|
||||||
class Tools {
|
class Tools {
|
||||||
/**
|
/**
|
||||||
@ -123,6 +125,7 @@ class Tools {
|
|||||||
var lat = Cesium.Math.toDegrees(cartographic.latitude)
|
var lat = Cesium.Math.toDegrees(cartographic.latitude)
|
||||||
var lng = Cesium.Math.toDegrees(cartographic.longitude)
|
var lng = Cesium.Math.toDegrees(cartographic.longitude)
|
||||||
var alt = cartographic.height < 0 ? 0 : cartographic.height
|
var alt = cartographic.height < 0 ? 0 : cartographic.height
|
||||||
|
// var alt = cartographic.height
|
||||||
return {
|
return {
|
||||||
lng: lng,
|
lng: lng,
|
||||||
lat: lat,
|
lat: lat,
|
||||||
@ -138,7 +141,70 @@ class Tools {
|
|||||||
* @param [fractionDigits=2] 保留小数点位数
|
* @param [fractionDigits=2] 保留小数点位数
|
||||||
* @param [ground=true] 是否贴地
|
* @param [ground=true] 是否贴地
|
||||||
* */
|
* */
|
||||||
computeDistance(positions = [], fractionDigits = 2, ground = true) {
|
async computeDistance(positions = [], fractionDigits = 2, type = '空间长度') {
|
||||||
|
if (positions.length < 2) {
|
||||||
|
return 0
|
||||||
|
} else {
|
||||||
|
let length = 0
|
||||||
|
switch (type) {
|
||||||
|
case '空间长度':
|
||||||
|
for (let i = 0; i < positions.length - 1; i++) {
|
||||||
|
const position1 = Cesium.Cartesian3.fromDegrees(positions[i].lng, positions[i].lat, positions[i].alt);
|
||||||
|
const position2 = Cesium.Cartesian3.fromDegrees(positions[i + 1].lng, positions[i + 1].lat, positions[i + 1].alt);
|
||||||
|
const distance = Cesium.Cartesian3.distance(position1, position2);
|
||||||
|
length = length + distance
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case '投影长度':
|
||||||
|
for (let i = 0; i < positions.length - 1; i++) {
|
||||||
|
const position1 = Cesium.Cartesian3.fromDegrees(positions[i].lng, positions[i].lat, 0);
|
||||||
|
const position2 = Cesium.Cartesian3.fromDegrees(positions[i + 1].lng, positions[i + 1].lat, 0);
|
||||||
|
const distance = Cesium.Cartesian3.distance(position1, position2);
|
||||||
|
length = length + distance
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case '地表长度':
|
||||||
|
let meters
|
||||||
|
let lineString2 = []
|
||||||
|
positions.forEach((item) => {
|
||||||
|
lineString2.push([item.lng, item.lat, item.alt])
|
||||||
|
})
|
||||||
|
let line2 = turf.lineString(lineString2)
|
||||||
|
let d = turf.length(line2) * 1000
|
||||||
|
meters = d > 20 ? d / 20 : d
|
||||||
|
|
||||||
|
let res = this.chunkLine(positions, meters)
|
||||||
|
let coordinates = []
|
||||||
|
res.forEach((Feature, index) => {
|
||||||
|
if (index === 0) {
|
||||||
|
coordinates = [...Feature.geometry.coordinates]
|
||||||
|
} else {
|
||||||
|
coordinates.push(Feature.geometry.coordinates[1])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
let arr = []
|
||||||
|
for (const item of coordinates) {
|
||||||
|
const index = coordinates.indexOf(item);
|
||||||
|
let r = await this.sampleHeight({ lng: item[0], lat: item[1], alt: 0 }, index)
|
||||||
|
r.position.alt = r.position.alt < 0 ? 0 : r.position.alt
|
||||||
|
arr.push(r)
|
||||||
|
}
|
||||||
|
let l = arr.length - 1
|
||||||
|
for (let i = 0; i < arr.length - 1; i++) {
|
||||||
|
const position1 = Cesium.Cartesian3.fromDegrees(arr[i].position.lng, arr[i].position.lat, 0);
|
||||||
|
const position2 = Cesium.Cartesian3.fromDegrees(arr[i + 1].position.lng, arr[i + 1].position.lat, 0);
|
||||||
|
const distance = Cesium.Cartesian3.distance(position1, position2);
|
||||||
|
length = length + distance
|
||||||
|
}
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return length.toFixed(fractionDigits)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
computeDistance2(positions = [], fractionDigits = 2, ground = true) {
|
||||||
if (positions.length < 2) {
|
if (positions.length < 2) {
|
||||||
return 0
|
return 0
|
||||||
} else {
|
} else {
|
||||||
@ -163,6 +229,12 @@ class Tools {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async sampleHeight(p1, index) {
|
||||||
|
let p2 = await this.sampleHeightMostDetailed([p1])
|
||||||
|
p1.alt = p2[0].height
|
||||||
|
return { position: p1, index }
|
||||||
|
}
|
||||||
|
|
||||||
/**@description 计算多边形面积
|
/**@description 计算多边形面积
|
||||||
* @method computeArea
|
* @method computeArea
|
||||||
* @memberOf Tools
|
* @memberOf Tools
|
||||||
@ -513,8 +585,20 @@ class Tools {
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
getMaterial(color = '#2ab0c2', type = 0) {
|
getMaterial(color = '#2ab0c2', type = 0, entity = null, newParam = {}) {
|
||||||
let material = ''
|
let material = ''
|
||||||
|
let arr = {
|
||||||
|
'7': 10,
|
||||||
|
'8': 3,
|
||||||
|
'9': 4,
|
||||||
|
'10': 4,
|
||||||
|
'11': 4,
|
||||||
|
'12': 2
|
||||||
|
}
|
||||||
|
if (entity) {
|
||||||
|
arr[type + ''] ? (entity.polyline.width = entity.polyline.oriWidth + arr[type + '']) : (entity.polyline.width = entity.polyline.oriWidth)
|
||||||
|
}
|
||||||
|
|
||||||
switch (Number(type)) {
|
switch (Number(type)) {
|
||||||
|
|
||||||
case 1: //虚线
|
case 1: //虚线
|
||||||
@ -528,6 +612,108 @@ class Tools {
|
|||||||
glowPower: 0.2,
|
glowPower: 0.2,
|
||||||
color: Cesium.Color.fromCssColorString(color),
|
color: Cesium.Color.fromCssColorString(color),
|
||||||
})
|
})
|
||||||
|
break
|
||||||
|
case 3: //尾迹光线
|
||||||
|
material = new Cesium.PolylineFlowMaterialProperty({
|
||||||
|
color: color,
|
||||||
|
speed: newParam.rotate ? newParam.speed : 0 - newParam.speed,
|
||||||
|
rotate: newParam.rotate
|
||||||
|
})
|
||||||
|
break
|
||||||
|
case 4: //多尾迹光线
|
||||||
|
material = new Cesium.PolylineFlowMultMaterialProperty({
|
||||||
|
color: color,
|
||||||
|
speed: newParam.rotate ? newParam.speed : 0 - newParam.speed,
|
||||||
|
rotate: newParam.rotate
|
||||||
|
})
|
||||||
|
break
|
||||||
|
case 5: //普通流动虚线
|
||||||
|
// material = new Cesium.FlowDashedLineFlowMaterialProperty({
|
||||||
|
// color: color,
|
||||||
|
// uType: 0,
|
||||||
|
// speed: newParam.rotate ? newParam.speed : 0 - newParam.speed,
|
||||||
|
// // dashSize: newParam.dashSize,
|
||||||
|
// space: newParam.space,
|
||||||
|
// scale: 1.0
|
||||||
|
// })
|
||||||
|
// break
|
||||||
|
case 6: //流动虚线2
|
||||||
|
let that = this
|
||||||
|
let repeatX
|
||||||
|
material = new Cesium.FlowDashedLineFlowMaterialProperty({
|
||||||
|
color: color,
|
||||||
|
uType: type == 5 ? 0 : 1,
|
||||||
|
speed: newParam.rotate ? newParam.speed : 0 - newParam.speed,
|
||||||
|
// dashSize: newParam.dashSize,
|
||||||
|
space: newParam.space,
|
||||||
|
scale: new Cesium.CallbackProperty(function () {
|
||||||
|
|
||||||
|
if (that.sdk.viewer.scene.mode === Cesium.SceneMode.SCENE3D) {
|
||||||
|
let oriPositions = entity.polyline.positions.getValue();
|
||||||
|
|
||||||
|
if (!Cesium.defined(oriPositions)) {
|
||||||
|
return 1.0;
|
||||||
|
}
|
||||||
|
let distance = 0;
|
||||||
|
for (let i = 0; i < oriPositions.length - 1; ++i) {
|
||||||
|
distance += Cesium.Cartesian3.distance(oriPositions[i], oriPositions[i + 1]);
|
||||||
|
}
|
||||||
|
//屏幕坐标
|
||||||
|
let point1 = new Cesium.Cartesian2(0, that.sdk.viewer.canvas.clientHeight)
|
||||||
|
let point2 = new Cesium.Cartesian2(that.sdk.viewer.canvas.clientWidth / 2, that.sdk.viewer.canvas.clientHeight)
|
||||||
|
let cartesian1 = that.sdk.viewer.scene.pickPosition(point1)
|
||||||
|
let cartesian2 = that.sdk.viewer.scene.pickPosition(point2)
|
||||||
|
if (cartesian1 && cartesian2) {
|
||||||
|
let distance2 = Cesium.Cartesian3.distance(cartesian1, cartesian2);
|
||||||
|
repeatX = distance2 * 2 / distance
|
||||||
|
}
|
||||||
|
return repeatX;
|
||||||
|
} else {
|
||||||
|
let sdk3d = get3DView()
|
||||||
|
let sdk3dEntity = sdk3d.viewer.entities.getById(that.options.id)
|
||||||
|
let oriPositions = sdk3dEntity.polyline.positions.getValue();
|
||||||
|
|
||||||
|
if (!Cesium.defined(oriPositions)) {
|
||||||
|
return 1.0;
|
||||||
|
}
|
||||||
|
let distance = 0;
|
||||||
|
for (let i = 0; i < oriPositions.length - 1; ++i) {
|
||||||
|
distance += Cesium.Cartesian3.distance(oriPositions[i], oriPositions[i + 1]);
|
||||||
|
}
|
||||||
|
//屏幕坐标
|
||||||
|
let point1 = new Cesium.Cartesian2(0, sdk3d.viewer.canvas.clientHeight)
|
||||||
|
let point2 = new Cesium.Cartesian2(sdk3d.viewer.canvas.clientWidth / 2, sdk3d.viewer.canvas.clientHeight)
|
||||||
|
let cartesian1 = sdk3d.viewer.scene.pickPosition(point1)
|
||||||
|
let cartesian2 = sdk3d.viewer.scene.pickPosition(point2)
|
||||||
|
if (cartesian1 && cartesian2) {
|
||||||
|
let distance2 = Cesium.Cartesian3.distance(cartesian1, cartesian2);
|
||||||
|
repeatX = distance2 * 2 / distance
|
||||||
|
}
|
||||||
|
return repeatX;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
break
|
||||||
|
case 7: //流动箭头1
|
||||||
|
case 8: //流动箭头2
|
||||||
|
case 9: //流动箭头3
|
||||||
|
case 10: //流动箭头4
|
||||||
|
case 11: //流动箭头5
|
||||||
|
case 12: //流动箭头6
|
||||||
|
let param = {
|
||||||
|
color: color,
|
||||||
|
image: this.getSourceRootPath() + `/img/arrow/${type - 6}.png`,
|
||||||
|
space: newParam.space,
|
||||||
|
speed: newParam.speed
|
||||||
|
}
|
||||||
|
|
||||||
|
param.speed = newParam.rotate ? param.speed : 0 - param.speed
|
||||||
|
|
||||||
|
this.getFlowTexture(this, param, entity)
|
||||||
|
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
material = Cesium.Color.fromCssColorString(color)
|
material = Cesium.Color.fromCssColorString(color)
|
||||||
@ -536,6 +722,198 @@ class Tools {
|
|||||||
return material
|
return material
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getFlowTexture(that, options, entity) {
|
||||||
|
|
||||||
|
const canvasEle = document.createElement('canvas');
|
||||||
|
const ctx = canvasEle.getContext('2d')
|
||||||
|
const myImg = new Image()
|
||||||
|
// myImg.src = that.getSourceRootPath() + '/img/arrow/1.png'
|
||||||
|
myImg.src = options.image
|
||||||
|
myImg.onload = function () {
|
||||||
|
options.space = Math.max(0.1, options.space);
|
||||||
|
if (options.speed > 0 || options.speed == 0) {
|
||||||
|
canvasEle.width = myImg.width * (options.space + 1)
|
||||||
|
canvasEle.height = myImg.height
|
||||||
|
ctx.drawImage(myImg, myImg.width * (options.space / 2), 0)
|
||||||
|
} else {
|
||||||
|
ctx.clearRect(0, 0, canvasEle.width, canvasEle.height);
|
||||||
|
canvasEle.width = myImg.width * (options.space + 1)
|
||||||
|
canvasEle.height = myImg.height
|
||||||
|
ctx.save(); // 保存当前状态
|
||||||
|
ctx.translate(canvasEle.width / 2, canvasEle.height / 2); // 移动原点至中心
|
||||||
|
ctx.rotate(Math.PI); // (弧度制)
|
||||||
|
ctx.translate(-canvasEle.width / 2, -canvasEle.height / 2); // 移回原点
|
||||||
|
ctx.drawImage(myImg, myImg.width * (options.space / 2), 0)
|
||||||
|
ctx.restore(); // 恢复状态
|
||||||
|
}
|
||||||
|
|
||||||
|
// let repeat = getRepeat()
|
||||||
|
// }, false)
|
||||||
|
// entity.polyline.material.oriRepeat = that.getSceenLine(entity, options, canvasEle)
|
||||||
|
// entity.polyline.material.oriSpeed = undefined
|
||||||
|
let beforeSpeed = 0, repeat = 0
|
||||||
|
entity.polyline.material = new Cesium.LineTextureMaterialProperty(
|
||||||
|
{
|
||||||
|
color: options.color,
|
||||||
|
image: canvasEle,
|
||||||
|
speed: options.speed,
|
||||||
|
repeat: new Cesium.CallbackProperty(function () {
|
||||||
|
|
||||||
|
if (that.sdk.viewer.scene.mode === Cesium.SceneMode.SCENE3D) {
|
||||||
|
let positionProperty = entity.polyline.positions;
|
||||||
|
let positions = positionProperty.getValue(that.sdk.viewer.clock.currentTime);
|
||||||
|
|
||||||
|
if (!Cesium.defined(positions)) {
|
||||||
|
return new Cesium.Cartesian2(1.0, 1.0);
|
||||||
|
// return 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
let distance = 0;
|
||||||
|
for (let i = 0; i < positions.length - 1; ++i) {
|
||||||
|
// if (that.sdk.viewer.scene.mode===Cesium.SceneMode.SCENE2D){}
|
||||||
|
distance += Cesium.Cartesian3.distance(positions[i], positions[i + 1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
let repeatX = distance / entity.polyline.width.getValue();
|
||||||
|
// 根据地图缩放程度调整repeatX
|
||||||
|
let cameraHeight = that.sdk.viewer.camera.positionCartographic.height;
|
||||||
|
let boundingSphere = new Cesium.BoundingSphere(
|
||||||
|
new Cesium.Cartesian3(-1000000, 0, 0), // 中心点坐标
|
||||||
|
500000 // 半径(距离)
|
||||||
|
);
|
||||||
|
|
||||||
|
// 获取绘图缓冲区的宽度和高度(通常是屏幕的分辨率)
|
||||||
|
let drawingBufferWidth = that.sdk.viewer.canvas.clientWidth;
|
||||||
|
let drawingBufferHeight = that.sdk.viewer.canvas.clientHeight;
|
||||||
|
|
||||||
|
// 使用 getPixelSize 方法获取包围球在屏幕上的像素大小
|
||||||
|
let groundResolution = that.sdk.viewer.scene.camera.getPixelSize(boundingSphere, drawingBufferWidth, drawingBufferHeight)
|
||||||
|
let result
|
||||||
|
if (groundResolution > 700) {
|
||||||
|
repeatX *= groundResolution / cameraHeight / (options.space * (canvasEle.width / canvasEle.height * 5) + 1);
|
||||||
|
// if (entity.polyline.material.oriRepeat) {
|
||||||
|
let speed = repeatX / entity.polyline.oriRepeat
|
||||||
|
entity.polyline.oriSpeed = speed
|
||||||
|
entity.polyline.oriRepeatX = repeatX
|
||||||
|
// } else {
|
||||||
|
// entity.polyline.material.oriRepeat = repeatX
|
||||||
|
// }
|
||||||
|
beforeSpeed = speed
|
||||||
|
repeat = repeatX
|
||||||
|
result = new Cesium.Cartesian2(repeatX, speed || 1.0)
|
||||||
|
} else {
|
||||||
|
result = new Cesium.Cartesian2(repeat || entity.polyline.oriRepeatX, beforeSpeed || entity.polyline.oriSpeed)
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
let sdk3d = get3DView()
|
||||||
|
let sdk3dEntity = sdk3d.viewer.entities.getById(that.options.id)
|
||||||
|
let positionProperty = sdk3dEntity.polyline.positions;
|
||||||
|
let positions = positionProperty.getValue(sdk3d.viewer.clock.currentTime);
|
||||||
|
|
||||||
|
if (!Cesium.defined(positions)) {
|
||||||
|
return new Cesium.Cartesian2(1.0, 1.0);
|
||||||
|
// return 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
let distance = 0;
|
||||||
|
for (let i = 0; i < positions.length - 1; ++i) {
|
||||||
|
// if (that.sdk.viewer.scene.mode===Cesium.SceneMode.SCENE2D){}
|
||||||
|
distance += Cesium.Cartesian3.distance(positions[i], positions[i + 1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
let repeatX = distance / sdk3dEntity.polyline.width.getValue();
|
||||||
|
// 根据地图缩放程度调整repeatX
|
||||||
|
let cameraHeight = sdk3d.viewer.camera.positionCartographic.height;
|
||||||
|
let boundingSphere = new Cesium.BoundingSphere(
|
||||||
|
new Cesium.Cartesian3(-1000000, 0, 0), // 中心点坐标
|
||||||
|
500000 // 半径(距离)
|
||||||
|
);
|
||||||
|
|
||||||
|
// 获取绘图缓冲区的宽度和高度(通常是屏幕的分辨率)
|
||||||
|
let drawingBufferWidth = sdk3d.viewer.canvas.clientWidth;
|
||||||
|
let drawingBufferHeight = sdk3d.viewer.canvas.clientHeight;
|
||||||
|
|
||||||
|
// 使用 getPixelSize 方法获取包围球在屏幕上的像素大小
|
||||||
|
let groundResolution = sdk3d.viewer.scene.camera.getPixelSize(boundingSphere, drawingBufferWidth, drawingBufferHeight)
|
||||||
|
let result
|
||||||
|
if (groundResolution > 700) {
|
||||||
|
repeatX *= groundResolution / cameraHeight / (options.space * (canvasEle.width / canvasEle.height * 5) + 1);
|
||||||
|
// if (entity.polyline.material.oriRepeat) {
|
||||||
|
let speed = repeatX / sdk3dEntity.polyline.oriRepeat
|
||||||
|
sdk3dEntity.polyline.oriSpeed = speed
|
||||||
|
sdk3dEntity.polyline.oriRepeatX = repeatX
|
||||||
|
// } else {
|
||||||
|
// entity.polyline.material.oriRepeat = repeatX
|
||||||
|
// }
|
||||||
|
beforeSpeed = speed
|
||||||
|
repeat = repeatX
|
||||||
|
result = new Cesium.Cartesian2(repeatX, speed || 1.0)
|
||||||
|
} else {
|
||||||
|
result = new Cesium.Cartesian2(repeat || sdk3dEntity.polyline.oriRepeatX, beforeSpeed || sdk3dEntity.polyline.oriSpeed)
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// return repeatX;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
let oriRepeat = that.getSceenLine(entity, options, canvasEle)
|
||||||
|
oriRepeat && (entity.polyline.oriRepeat = oriRepeat)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**获取当前满屏横线速度 */
|
||||||
|
getSceenLine(entity, options, canvasEle) {
|
||||||
|
let point1 = new Cesium.Cartesian2(0, this.sdk.viewer.canvas.clientHeight)
|
||||||
|
let point2 = new Cesium.Cartesian2(this.sdk.viewer.canvas.clientWidth / 2, this.sdk.viewer.canvas.clientHeight)
|
||||||
|
// var cartesian1 = this.sdk.viewer.scene.pickPosition(point1)
|
||||||
|
// var cartesian2 = this.sdk.viewer.scene.pickPosition(point2)
|
||||||
|
let ray = this.sdk.viewer.camera.getPickRay(point1);
|
||||||
|
let cartesian1 = this.sdk.viewer.scene.globe.pick(ray, this.sdk.viewer.scene);
|
||||||
|
|
||||||
|
let ray2 = this.sdk.viewer.camera.getPickRay(point2);
|
||||||
|
let cartesian2 = this.sdk.viewer.scene.globe.pick(ray2, this.sdk.viewer.scene);
|
||||||
|
|
||||||
|
var distance = Cesium.Cartesian3.distance(cartesian1, cartesian2);
|
||||||
|
|
||||||
|
var repeatX = distance / entity.polyline.width.getValue();
|
||||||
|
// 根据地图缩放程度调整repeatX
|
||||||
|
var cameraHeight = this.sdk.viewer.camera.positionCartographic.height;
|
||||||
|
var boundingSphere = new Cesium.BoundingSphere(
|
||||||
|
new Cesium.Cartesian3(-1000000, 0, 0), // 中心点坐标
|
||||||
|
500000 // 半径(距离)
|
||||||
|
);
|
||||||
|
|
||||||
|
// 获取绘图缓冲区的宽度和高度(通常是屏幕的分辨率)
|
||||||
|
var drawingBufferWidth = this.sdk.viewer.canvas.clientWidth;
|
||||||
|
var drawingBufferHeight = this.sdk.viewer.canvas.clientHeight;
|
||||||
|
|
||||||
|
// 使用 getPixelSize 方法获取包围球在屏幕上的像素大小
|
||||||
|
var groundResolution = this.sdk.viewer.scene.camera.getPixelSize(boundingSphere, drawingBufferWidth, drawingBufferHeight)
|
||||||
|
// repeatX *= groundResolution / cameraHeight / ((myImg.width / myImg.height * 5) + 1);
|
||||||
|
if (groundResolution > 700) {
|
||||||
|
repeatX *= groundResolution / cameraHeight / (options.space * (canvasEle.width / canvasEle.height * 5) + 1);
|
||||||
|
} else {
|
||||||
|
repeatX = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.sdk.viewer.scene.mode === Cesium.SceneMode.SCENE3D) {
|
||||||
|
return repeatX
|
||||||
|
} else {
|
||||||
|
let sdk3d = get3DView()
|
||||||
|
let sdk3dEntity = sdk3d.viewer.entities.getById(this.options.id)
|
||||||
|
return sdk3dEntity.polyline.oriRepeatX
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/*创建直箭头图片*/
|
/*创建直箭头图片*/
|
||||||
create_arrow1_picture(color) {
|
create_arrow1_picture(color) {
|
||||||
let canvas = new fabric.Canvas('canvas')
|
let canvas = new fabric.Canvas('canvas')
|
||||||
@ -982,8 +1360,8 @@ class Tools {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @desc cmyk转rbg
|
* @desc cmyk转rbg
|
||||||
* @param {*} color
|
* @param {*} color
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
cmykToRgb(color) {
|
cmykToRgb(color) {
|
||||||
let { c, m, y, k } = color
|
let { c, m, y, k } = color
|
||||||
@ -1067,6 +1445,55 @@ class Tools {
|
|||||||
return `${year}${month}${day}${hours}${minutes}${seconds}${milliseconds}`;
|
return `${year}${month}${day}${hours}${minutes}${seconds}${milliseconds}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
replaceHost(url, host) {
|
||||||
|
let newUrl = url
|
||||||
|
if (!url || !host) {
|
||||||
|
return url
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (!url.startsWith("http")) {
|
||||||
|
//说明是本地的json,在磁盘中存在的
|
||||||
|
if (!url.includes(":")) {
|
||||||
|
if (this.options.host) {
|
||||||
|
let o = new URL(url, this.options.host)
|
||||||
|
newUrl = o.href
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return newUrl
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// 移除可能的用户名:密码前缀
|
||||||
|
const authRegex = /^[^@]+@/;
|
||||||
|
if (authRegex.test(url)) {
|
||||||
|
url = url.replace(authRegex, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加协议前缀(如果没有)
|
||||||
|
if (!/^[a-z]+:\/\//i.test(url)) {
|
||||||
|
url = 'http://' + url;
|
||||||
|
}
|
||||||
|
|
||||||
|
const parsedUrl = new URL(url);
|
||||||
|
const parsedUrl2 = new URL(host);
|
||||||
|
let hostname = parsedUrl.hostname;
|
||||||
|
let port = parsedUrl.port;
|
||||||
|
|
||||||
|
// 处理IPv6地址(如果有括号)
|
||||||
|
if (hostname.startsWith('[') && hostname.endsWith(']')) {
|
||||||
|
hostname = hostname.slice(1, -1);
|
||||||
|
}
|
||||||
|
if ((hostname === 'localhost' || hostname === '127.0.0.1') && parseInt(port, 10) !== 55110) {
|
||||||
|
parsedUrl.port = parsedUrl2.port
|
||||||
|
parsedUrl.protocol = parsedUrl2.protocol
|
||||||
|
newUrl = parsedUrl.toString()
|
||||||
|
}
|
||||||
|
return newUrl
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return newUrl
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user