Compare commits
4 Commits
a9594ccec2
...
de4aead219
Author | SHA1 | Date | |
---|---|---|---|
de4aead219 | |||
ef2c158727 | |||
9ecb3c7269 | |||
1936a142b1 |
@ -63,11 +63,15 @@ class VisibilityAnalysis extends Tools {
|
||||
that.tip.set_text("左键创建视角终点,右键结束通视分析")
|
||||
if (!that.resultObject.viewPoint) {
|
||||
let pos84 = that.cartesian3Towgs84(cartesian, that.viewer)
|
||||
let positions = await Cesium.sampleTerrainMostDetailed(
|
||||
that.sdk.viewer.terrainProvider,
|
||||
[Cesium.Cartographic.fromDegrees(pos84.lng, pos84.lat)]
|
||||
);
|
||||
if (positions[0].height > pos84.alt) {
|
||||
let positions
|
||||
if(that.sdk.viewer.terrainProvider.availability)
|
||||
{
|
||||
positions = await Cesium.sampleTerrainMostDetailed(
|
||||
that.sdk.viewer.terrainProvider,
|
||||
[Cesium.Cartographic.fromDegrees(pos84.lng, pos84.lat)]
|
||||
);
|
||||
}
|
||||
if (positions && positions[0].height > pos84.alt) {
|
||||
pos84.alt = positions[0].height
|
||||
}
|
||||
pos84.alt = pos84.alt + that.viewPointHeight
|
||||
|
@ -54,7 +54,7 @@ function html(that) {
|
||||
<div class="row">
|
||||
<div class="col" style="flex: 5;">
|
||||
<span class="label">文字内容</span>
|
||||
<input class="input" type="text" @model="textValue">
|
||||
<input class="input" type="text" @model="textValue" maxlength="30">
|
||||
</div>
|
||||
<div class="col">
|
||||
<button class="btn" @click="textPosPick">设置位置</span>
|
||||
|
@ -10,6 +10,7 @@ import { FontLoader } from '../../../../static/3rdparty/three/jsm/loaders/FontLo
|
||||
import { TextGeometry } from '../../../../static/3rdparty/three/jsm/geometries/TextGeometry.js';
|
||||
import * as variable from '../../../../static/3rdparty/three/fonts/FZZongYi-M05S_regular.typeface.json'
|
||||
import Base from "../index";
|
||||
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global'
|
||||
import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen'
|
||||
|
||||
class GroundSvg extends Base {
|
||||
@ -2171,6 +2172,59 @@ class GroundSvg extends Base {
|
||||
}
|
||||
this._update()
|
||||
}
|
||||
|
||||
async flyTo(options = {}) {
|
||||
if (this._error) {
|
||||
return
|
||||
}
|
||||
setActiveViewer(0)
|
||||
closeRotateAround(this.sdk)
|
||||
closeViewFollow(this.sdk)
|
||||
|
||||
if (this.options.customView && this.options.customView.relativePosition && this.options.customView.orientation) {
|
||||
let orientation = {
|
||||
heading: Cesium.Math.toRadians(this.options.customView.orientation.heading || 0.0),
|
||||
pitch: Cesium.Math.toRadians(this.options.customView.orientation.pitch || -60.0),
|
||||
roll: Cesium.Math.toRadians(this.options.customView.orientation.roll || 0.0)
|
||||
}
|
||||
|
||||
let lng = this.options.customView.relativePosition.lng
|
||||
let lat = this.options.customView.relativePosition.lat
|
||||
let alt = this.options.customView.relativePosition.alt
|
||||
let destination = Cesium.Cartesian3.fromDegrees(lng, lat, alt)
|
||||
|
||||
let position = { ...this.options.position }
|
||||
// 如果没有高度值,则获取紧贴高度计算
|
||||
if (!position.hasOwnProperty('alt')) {
|
||||
position.alt = await this.getClampToHeight(position)
|
||||
}
|
||||
lng = this.options.customView.relativePosition.lng + position.lng
|
||||
lat = this.options.customView.relativePosition.lat + position.lat
|
||||
alt = this.options.customView.relativePosition.alt + position.alt
|
||||
destination = Cesium.Cartesian3.fromDegrees(lng, lat, alt)
|
||||
this.sdk.viewer.camera.flyTo({
|
||||
destination: destination,
|
||||
orientation: orientation
|
||||
})
|
||||
}
|
||||
else {
|
||||
let array = []
|
||||
for (let i = 0; i < this.controlPoints.length; i++) {
|
||||
let height = await this.getClampToHeight({lng: this.controlPoints[i][0], lat: this.controlPoints[i][1]})
|
||||
let cartesian = Cesium.Cartesian3.fromDegrees(this.controlPoints[i][0], this.controlPoints[i][1], height)
|
||||
array.push(cartesian.x, cartesian.y, cartesian.z)
|
||||
}
|
||||
let BoundingSphere = Cesium.BoundingSphere.fromVertices(array)
|
||||
|
||||
this.sdk.viewer.camera.flyToBoundingSphere(BoundingSphere, {
|
||||
offset: options.orientation || {
|
||||
heading: Cesium.Math.toRadians(0.0),
|
||||
pitch: Cesium.Math.toRadians(-60.0),
|
||||
roll: Cesium.Math.toRadians(0.0)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default GroundSvg
|
@ -160,6 +160,64 @@ class YJColorPicker {
|
||||
let dropbtns = picker.getElementsByClassName('ew-color-dropbtns')[0]
|
||||
picker.insertBefore(colorInputBox, dropbtns)
|
||||
|
||||
RInput.addEventListener('blur', (e) => {
|
||||
let value = e.target.value
|
||||
if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) {
|
||||
value = Number(value)
|
||||
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)
|
||||
}
|
||||
RInput.value = parseInt(value)
|
||||
_this.colorPicker.hsba = colorRgbaToHsba(`rgb(${RInput.value}, ${GInput.value}, ${BInput.value})`)
|
||||
_this.colorPicker.changeColor(_this.colorPicker, _this.colorPicker.pickerPanel.offsetWidth,_this.colorPicker.pickerPanel.offsetHeight)
|
||||
}
|
||||
})
|
||||
GInput.addEventListener('blur', (e) => {
|
||||
let value = e.target.value
|
||||
if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) {
|
||||
value = Number(value)
|
||||
if ((e.target.max) && value > Number(e.target.max)) {
|
||||
value = Number(e.target.max)
|
||||
}
|
||||
if ((e.target.min) && value < Number(e.target.min)) {
|
||||
value = Number(e.target.min)
|
||||
}
|
||||
if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) {
|
||||
value = Number(e.target.dataset.min)
|
||||
}
|
||||
GInput.value = parseInt(value)
|
||||
_this.colorPicker.hsba = colorRgbaToHsba(`rgb(${RInput.value}, ${GInput.value}, ${BInput.value})`)
|
||||
_this.colorPicker.changeColor(_this.colorPicker, _this.colorPicker.pickerPanel.offsetWidth,_this.colorPicker.pickerPanel.offsetHeight)
|
||||
}
|
||||
})
|
||||
BInput.addEventListener('blur', (e) => {
|
||||
let value = e.target.value
|
||||
if (e.target.value || (e.target.dataset.null !== 'undefined' && e.target.dataset.null !== '' && !Boolean(e.target.dataset.null))) {
|
||||
value = Number(value)
|
||||
if ((e.target.max) && value > Number(e.target.max)) {
|
||||
value = Number(e.target.max)
|
||||
}
|
||||
if ((e.target.min) && value < Number(e.target.min)) {
|
||||
value = Number(e.target.min)
|
||||
}
|
||||
if ((e.target.dataset.min) && value < Number(e.target.dataset.min)) {
|
||||
value = Number(e.target.dataset.min)
|
||||
}
|
||||
BInput.value = parseInt(value)
|
||||
_this.colorPicker.hsba = colorRgbaToHsba(`rgb(${RInput.value}, ${GInput.value}, ${BInput.value})`)
|
||||
_this.colorPicker.changeColor(_this.colorPicker, _this.colorPicker.pickerPanel.offsetWidth,_this.colorPicker.pickerPanel.offsetHeight)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
if (options.alpha) {
|
||||
Inputs[0].style.width = '52px'
|
||||
Inputs[1].style.width = '52px'
|
||||
@ -170,7 +228,6 @@ class YJColorPicker {
|
||||
<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]
|
||||
@ -202,7 +259,7 @@ class YJColorPicker {
|
||||
AInput.value = parseInt(_this.pickAlphaInputValue * 100) / 100
|
||||
}
|
||||
else {
|
||||
AInput.value = CesiumColor ? parseInt(CesiumColor.alpha * 100) / 100 : 1
|
||||
AInput.value = CesiumColor ? parseInt(Number(CesiumColor.alpha.toFixed(2)) * 100) / 100 : 1
|
||||
}
|
||||
_this.pickAlphaInputValue = AInput.value
|
||||
box.style.background = Cesium.Color.fromCssColorString(_this.colorPicker.config.defaultColor || '#ffffff').withAlpha(AInput.value).toCssColorString()
|
||||
@ -374,7 +431,7 @@ class YJColorPicker {
|
||||
function clickDefineColor(color) {
|
||||
if (AInput) {
|
||||
let c = Cesium.Color.fromCssColorString(color)
|
||||
AInput.value = parseInt(c.alpha * 100) / 100
|
||||
AInput.value = parseInt(Number(c.alpha.toFixed(2)) * 100) / 100
|
||||
}
|
||||
}
|
||||
|
||||
@ -459,6 +516,44 @@ class YJColorPicker {
|
||||
}
|
||||
}
|
||||
|
||||
function colorRgbaToHsba(e) {
|
||||
var t = e.slice(e.indexOf("(") + 1, e.lastIndexOf(")")).split(",")
|
||||
, r = t.length < 4 ? 1 : Number(t[3])
|
||||
, n = Number(t[0]) / 255
|
||||
, o = Number(t[1]) / 255
|
||||
, i = Number(t[2]) / 255
|
||||
, a = void 0
|
||||
, s = void 0
|
||||
, l = void 0
|
||||
, c = Math.min(n, o, i)
|
||||
, d = l = Math.max(n, o, i)
|
||||
, u = d - c;
|
||||
if (d === c)
|
||||
a = 0;
|
||||
else {
|
||||
switch (d) {
|
||||
case n:
|
||||
a = (o - i) / u + (o < i ? 6 : 0);
|
||||
break;
|
||||
case o:
|
||||
a = 2 + (i - n) / u;
|
||||
break;
|
||||
case i:
|
||||
a = 4 + (n - o) / u
|
||||
}
|
||||
a = Math.round(60 * a)
|
||||
}
|
||||
s = 0 === d ? 0 : 1 - c / d;
|
||||
return s = Math.round(100 * s),
|
||||
l = Math.round(100 * l),
|
||||
{
|
||||
h: a,
|
||||
s: s,
|
||||
b: l,
|
||||
a: r
|
||||
}
|
||||
}
|
||||
|
||||
function pickerInputChange(v) {
|
||||
if (_this.colorPicker && _this.colorPicker.pickerInput) {
|
||||
let rgbaColor = colorHexToRgba(v || _this.colorPicker.pickerInput.value)
|
||||
|
1
static/3rdparty/ewPlugins.min.js
vendored
1
static/3rdparty/ewPlugins.min.js
vendored
@ -810,6 +810,7 @@
|
||||
else
|
||||
this.init(o, this.config)
|
||||
}
|
||||
this.changeColor = g
|
||||
this.close = () => {
|
||||
this.pickerFlag = !this.pickerFlag,
|
||||
this.picker.style.opacity = 0
|
||||
|
Reference in New Issue
Block a user