页面分离修改
This commit is contained in:
@ -35,12 +35,12 @@ class CircleViewShed extends Tools {
|
||||
this.Dialog = _Dialog
|
||||
this._EventBinding = new EventBinding()
|
||||
this.html = null
|
||||
let tools = new Tools(sdk)
|
||||
this.tools = new Tools(sdk)
|
||||
YJ.Analysis.AnalysesResults.push(this)
|
||||
// CircleViewShed.edit(this)
|
||||
let terrainAvailability = this.viewer.terrainProvider.availability;
|
||||
if (!terrainAvailability) {
|
||||
tools.message({ type: 'warning', text: '未加载地形数据!' })
|
||||
this.tools.message({ type: 'warning', text: '未加载地形数据!' })
|
||||
// window.ELEMENT && window.ELEMENT.Message({
|
||||
// message: '未加载地形数据!',
|
||||
// type: 'warning',
|
||||
@ -48,6 +48,9 @@ class CircleViewShed extends Tools {
|
||||
// });
|
||||
return
|
||||
}
|
||||
// CircleViewShed.create(this)
|
||||
}
|
||||
draw() {
|
||||
CircleViewShed.create(this)
|
||||
}
|
||||
|
||||
@ -69,6 +72,20 @@ class CircleViewShed extends Tools {
|
||||
item.value = viewPointHeight
|
||||
})
|
||||
}
|
||||
get viewPointHeights() {
|
||||
return this.viewPointHeight
|
||||
}
|
||||
|
||||
set viewPointHeights(v) {
|
||||
let viewPointHeight = Math.floor(Number(v) * 10) / 10
|
||||
if (isNaN(viewPointHeight)) {
|
||||
viewPointHeight = 1.8
|
||||
}
|
||||
if (viewPointHeight < 0) {
|
||||
viewPointHeight = 0
|
||||
}
|
||||
this.viewPointHeight = viewPointHeight
|
||||
}
|
||||
|
||||
get precision() {
|
||||
return this.options.precision
|
||||
@ -87,8 +104,25 @@ class CircleViewShed extends Tools {
|
||||
item.value = precision
|
||||
})
|
||||
}
|
||||
get precisions() {
|
||||
return this.precision
|
||||
}
|
||||
|
||||
set precisions(val) {
|
||||
this.precision = val
|
||||
}
|
||||
|
||||
static create(that) {
|
||||
let terrainAvailability = that.viewer.terrainProvider.availability;
|
||||
if (!terrainAvailability) {
|
||||
that.tools.message({ type: 'warning', text: '未加载地形数据!' })
|
||||
// window.ELEMENT && window.ELEMENT.Message({
|
||||
// message: '未加载地形数据!',
|
||||
// type: 'warning',
|
||||
// duration: 1500
|
||||
// });
|
||||
return
|
||||
}
|
||||
let count = 0
|
||||
if (!YJ.Measure.GetMeasureStatus()) {
|
||||
if (that._DialogObject && that._DialogObject.close) {
|
||||
|
@ -4,19 +4,15 @@ import Tools from '../../../Tools';
|
||||
class ContourAnalysis {
|
||||
/**
|
||||
* @constructor 等高线分析
|
||||
* @param sdk
|
||||
* @param sdk
|
||||
* **/
|
||||
constructor(sdk, options = {}) {
|
||||
this.viewer = sdk.viewer
|
||||
this.tools = new Tools(sdk)
|
||||
let terrainAvailability = this.viewer.terrainProvider.availability;
|
||||
if (!terrainAvailability) {
|
||||
this.error = '未加载地形数据!'
|
||||
window.ELEMENT && window.ELEMENT.Message({
|
||||
message: '未加载地形数据!',
|
||||
type: 'warning',
|
||||
duration: 1500
|
||||
});
|
||||
console.warn(this.error)
|
||||
this.tools.message({ type: 'warning', text: this.error })
|
||||
return
|
||||
}
|
||||
this.positions = options.positions
|
||||
@ -153,7 +149,7 @@ class ContourAnalysis {
|
||||
// },
|
||||
// }))
|
||||
// element.label = new Cesium.LabelGraphics({
|
||||
|
||||
|
||||
// })
|
||||
let cur_index = that.getObjectIndex(
|
||||
breaks,
|
||||
@ -178,7 +174,7 @@ class ContourAnalysis {
|
||||
}
|
||||
let line = turf.lineString(array);
|
||||
let distance = turf.length(line, { units: "kilometers" });
|
||||
let along = turf.along(line, distance/2, { units: "kilometers" });
|
||||
let along = turf.along(line, distance / 2, { units: "kilometers" });
|
||||
return Cesium.Cartesian3.fromDegrees(along.geometry.coordinates[0], along.geometry.coordinates[1], 0);
|
||||
}
|
||||
}
|
||||
@ -210,4 +206,4 @@ class ContourAnalysis {
|
||||
this.countorLineList = [];
|
||||
}
|
||||
}
|
||||
export default ContourAnalysis;
|
||||
export default ContourAnalysis;
|
||||
|
@ -1,12 +1,13 @@
|
||||
import Dialog from '../../../BaseDialog';
|
||||
import { html } from "./_element";
|
||||
import Tools from "../../../Tools";
|
||||
// import CreatePolygon from "./CreatePolygon";
|
||||
import DrawPolygon from "../../../Draw/drawPolygon"
|
||||
|
||||
class CutFillAnalysis {
|
||||
/**
|
||||
* @constructor 填挖方分析
|
||||
* @param sdk
|
||||
* @param sdk
|
||||
* **/
|
||||
constructor(sdk, options = {}, _Dialog = {}) {
|
||||
this.sdk = sdk;
|
||||
@ -26,21 +27,20 @@ class CutFillAnalysis {
|
||||
noArea: "",
|
||||
}
|
||||
this.entities = []
|
||||
this.tools = new Tools(this.sdk)
|
||||
this.Draw = new DrawPolygon(this.sdk)
|
||||
YJ.Analysis.AnalysesResults.push(this)
|
||||
CutFillAnalysis.EditBox(this)
|
||||
// CutFillAnalysis.EditBox(this)
|
||||
}
|
||||
|
||||
create() {
|
||||
this.clean()
|
||||
this.Draw.start((a, positions) => {
|
||||
if(!positions || positions.length<3) {
|
||||
if (!positions || positions.length < 3) {
|
||||
let _error = '最少需要三个坐标!'
|
||||
console.warn(_error)
|
||||
window.ELEMENT && window.ELEMENT.Message({
|
||||
message: _error,
|
||||
this.tools.message({
|
||||
text: _error,
|
||||
type: 'warning',
|
||||
duration: 1500
|
||||
});
|
||||
return
|
||||
}
|
||||
@ -52,6 +52,7 @@ class CutFillAnalysis {
|
||||
this.createPolygonGeo(this.positions);
|
||||
this.result = this.VolumeAnalysis();
|
||||
this.viewer.scene.screenSpaceCameraController.enableCollisionDetection = false; //允许相机进入地下
|
||||
this.clickCallBack()
|
||||
})
|
||||
// const $this = this;
|
||||
// if (!this.cp) {
|
||||
@ -336,6 +337,65 @@ class CutFillAnalysis {
|
||||
});
|
||||
}
|
||||
|
||||
get heights() {
|
||||
return this.height
|
||||
}
|
||||
set heights(val) {
|
||||
this.height = val
|
||||
}
|
||||
get precisions() {
|
||||
return this.precision
|
||||
}
|
||||
set precisions(val) {
|
||||
this.precision = val
|
||||
}
|
||||
get allArea() {
|
||||
return Number(this.result.allArea.toFixed(4))
|
||||
}
|
||||
set allArea(val) {
|
||||
this.result.allArea = val
|
||||
}
|
||||
get fillArea() {
|
||||
return Number(this.result.fillArea.toFixed(4))
|
||||
}
|
||||
set fillArea(val) {
|
||||
this.result.fillArea = val
|
||||
}
|
||||
get fillVolume() {
|
||||
return Number(this.result.fillVolume.toFixed(4))
|
||||
}
|
||||
set fillVolume(val) {
|
||||
this.result.fillVolume = val
|
||||
}
|
||||
get cutArea() {
|
||||
return Number(this.result.cutArea.toFixed(4))
|
||||
}
|
||||
set cutArea(val) {
|
||||
this.result.cutArea = val
|
||||
}
|
||||
get cutVolume() {
|
||||
return Number(this.result.cutVolume.toFixed(4))
|
||||
}
|
||||
set cutVolume(val) {
|
||||
this.result.cutVolume = val
|
||||
}
|
||||
get noArea() {
|
||||
return Number(this.result.noArea.toFixed(4))
|
||||
}
|
||||
set noArea(val) {
|
||||
this.result.noArea = val
|
||||
}
|
||||
get onEnd() {
|
||||
return this.clickCallBack
|
||||
}
|
||||
set onEnd(val) {
|
||||
if (val && typeof val !== 'function') {
|
||||
console.error('val:', val, '不是一个function')
|
||||
} else {
|
||||
this.clickCallBack = val
|
||||
}
|
||||
}
|
||||
|
||||
clean() {
|
||||
this.Draw && this.Draw.end()
|
||||
for (let i = 0; i < this.entities.length; i++) {
|
||||
@ -351,4 +411,4 @@ class CutFillAnalysis {
|
||||
}
|
||||
}
|
||||
}
|
||||
export default CutFillAnalysis;
|
||||
export default CutFillAnalysis;
|
||||
|
@ -172,26 +172,29 @@ class Profile extends Draw {
|
||||
return positions_Inter
|
||||
}
|
||||
formatter(xy, tipData) {
|
||||
const pointOption = {
|
||||
show: true,
|
||||
pixelSize: 10,
|
||||
color: Cesium.Color.GREEN,
|
||||
outlineColor: Cesium.Color.SKYBLUE,
|
||||
outlineWidth: 3,
|
||||
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
||||
}
|
||||
if (!this.tipEntity) {
|
||||
this.tipEntity = this.sdk.viewer.entities.add({
|
||||
position: Cesium.Cartesian3.fromDegrees(xy[0], xy[1], Number(tipData[1])),
|
||||
point: pointOption
|
||||
})
|
||||
} else {
|
||||
this.tipEntity.position = Cesium.Cartesian3.fromDegrees(
|
||||
xy[0],
|
||||
xy[1],
|
||||
Number(tipData[1])
|
||||
)
|
||||
if (this.polyline) {
|
||||
const pointOption = {
|
||||
show: true,
|
||||
pixelSize: 10,
|
||||
color: Cesium.Color.GREEN,
|
||||
outlineColor: Cesium.Color.SKYBLUE,
|
||||
outlineWidth: 3,
|
||||
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
||||
}
|
||||
if (!this.tipEntity) {
|
||||
this.tipEntity = this.sdk.viewer.entities.add({
|
||||
position: Cesium.Cartesian3.fromDegrees(xy[0], xy[1], Number(tipData[1])),
|
||||
point: pointOption
|
||||
})
|
||||
} else {
|
||||
this.tipEntity.position = Cesium.Cartesian3.fromDegrees(
|
||||
xy[0],
|
||||
xy[1],
|
||||
Number(tipData[1])
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static async edit(that, points) {
|
||||
|
@ -5,25 +5,23 @@ import MouseEvent from '../../../Event/index'
|
||||
class SlopeAspect extends Tools {
|
||||
/**
|
||||
* @constructor 坡度坡向分析
|
||||
* @param sdk
|
||||
* @param sdk
|
||||
* **/
|
||||
constructor(sdk) {
|
||||
super(sdk)
|
||||
this.viewer = sdk.viewer;
|
||||
let terrainAvailability = this.viewer.terrainProvider.availability;
|
||||
if (!terrainAvailability) {
|
||||
this.error = '未加载地形数据!'
|
||||
window.ELEMENT && window.ELEMENT.Message({
|
||||
message: '未加载地形数据!',
|
||||
type: 'warning',
|
||||
duration: 1500
|
||||
});
|
||||
return
|
||||
}
|
||||
|
||||
this.event
|
||||
this.result = []; //存储创建的坡度分析结果,primitive集合
|
||||
this.handler = undefined;
|
||||
this.toolTip = "";
|
||||
this.tools = new Tools(sdk)
|
||||
let terrainAvailability = this.viewer.terrainProvider.availability;
|
||||
if (!terrainAvailability) {
|
||||
this.error = '未加载地形数据!'
|
||||
this.tools.message({ type: 'warning', text: this.error })
|
||||
return
|
||||
}
|
||||
YJ.Analysis.AnalysesResults.push(this)
|
||||
this.Draw = new DrawPolygon(this.sdk)
|
||||
// this.createNew4Distance()
|
||||
@ -39,11 +37,7 @@ class SlopeAspect extends Tools {
|
||||
const viewer = this.viewer;
|
||||
this.Draw.start((e, positions) => {
|
||||
if (!positions || positions.length <= 2) {
|
||||
window.ELEMENT && window.ELEMENT.Message({
|
||||
message: '至少拥有三个坐标位置!',
|
||||
type: 'warning',
|
||||
duration: 1500
|
||||
});
|
||||
this.tools.message({ type: 'warning', text: '至少拥有三个坐标位置!' })
|
||||
return
|
||||
}
|
||||
let boundary = [];
|
||||
@ -73,7 +67,7 @@ class SlopeAspect extends Tools {
|
||||
let num = n
|
||||
this.Draw.start((e, positions) => {
|
||||
if (!positions || positions.length <= 2) {
|
||||
console.warn('至少拥有三个坐标位置!')
|
||||
this.tools.message({ type: 'warning', text: '至少拥有三个坐标位置!' })
|
||||
return
|
||||
}
|
||||
let boundary = [];
|
||||
@ -204,8 +198,8 @@ class SlopeAspect extends Tools {
|
||||
let _this = this
|
||||
// 点位过多,分为三份计算
|
||||
let num = (Math.floor(boxResults.length / 3) + '')
|
||||
num = Number(num.substring(0, num.length - 1))*10
|
||||
let i=0
|
||||
num = Number(num.substring(0, num.length - 1)) * 10
|
||||
let i = 0
|
||||
let points = boxResults.slice(i * num, (i + 1) * num)
|
||||
if (points.length > 0) {
|
||||
sampleTerrainMostDetailed(points)
|
||||
@ -239,7 +233,7 @@ class SlopeAspect extends Tools {
|
||||
_this.calculateSlope(ellipseResults);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
createPolygonInsrance(points, color, curSlope) {
|
||||
@ -514,4 +508,4 @@ class SlopeAspect extends Tools {
|
||||
this.sdk.viewer.scene.preRender.removeEventListener(this._watchEvent, this)
|
||||
}
|
||||
}
|
||||
export default SlopeAspect;
|
||||
export default SlopeAspect;
|
||||
|
@ -36,13 +36,13 @@ class Submerge extends Tools {
|
||||
that.Draw.start((a, positions) => {
|
||||
if (!positions || positions.length < 3) {
|
||||
let _error = '至少需要三个坐标!'
|
||||
this.tools.message({
|
||||
message: _error,
|
||||
that.tools.message({
|
||||
text: _error,
|
||||
type: 'warning',
|
||||
});
|
||||
return
|
||||
}
|
||||
Submerge.destroy()
|
||||
that.destroy()
|
||||
if (!positions || positions.length == 0) {
|
||||
that.positions = []
|
||||
that._positions = []
|
||||
@ -62,6 +62,18 @@ class Submerge extends Tools {
|
||||
}
|
||||
fromDegreesArray.push(positions[i].lng, positions[i].lat)
|
||||
}
|
||||
|
||||
that.options.maxWaterLevel = positions[0].alt
|
||||
for (let i = 0; i < positions.length; i++) {
|
||||
if (that.options.minWaterLevel < positions[i].alt) {
|
||||
that.options.maxWaterLevel = positions[i].alt
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// for (let i = 0; i < positions.length; i++) {
|
||||
// fromDegreesArray.push(positions[i].lng, positions[i].lat, that.options.minWaterLevel)
|
||||
// }
|
||||
@ -84,11 +96,16 @@ class Submerge extends Tools {
|
||||
TWEEN.remove(that.TweenAnimate)
|
||||
that.TweenAnimate = null
|
||||
}
|
||||
let contentElm = that._DialogObject._element.body
|
||||
let pauseBtn = contentElm.getElementsByClassName('pause')[0];
|
||||
let startBtn = contentElm.getElementsByClassName('start')[0];
|
||||
startBtn.style.display = 'flex'
|
||||
pauseBtn.style.display = 'none'
|
||||
|
||||
that.waterLevel = that.options.maxWaterLevel - that.options.minWaterLevel
|
||||
that.options.waterVolume = Number((that.waterLevel * that.area).toFixed(4))
|
||||
|
||||
that.clickCallBack(that.area, that._positions)
|
||||
// let contentElm = that._DialogObject._element.body
|
||||
// let pauseBtn = contentElm.getElementsByClassName('pause')[0];
|
||||
// let startBtn = contentElm.getElementsByClassName('start')[0];
|
||||
// startBtn.style.display = 'flex'
|
||||
// pauseBtn.style.display = 'none'
|
||||
// that.move()
|
||||
// Submerge.EditBox(that)
|
||||
})
|
||||
@ -105,7 +122,7 @@ class Submerge extends Tools {
|
||||
that._DialogObject = await new Dialog(that.sdk.viewer._container, {
|
||||
title: '淹没分析', left: '180px', top: '100px',
|
||||
closeCallBack: () => {
|
||||
Submerge.destroy()
|
||||
that.destroy()
|
||||
that.Dialog.closeCallBack && that.Dialog.closeCallBack()
|
||||
},
|
||||
})
|
||||
@ -316,6 +333,22 @@ class Submerge extends Tools {
|
||||
})
|
||||
}
|
||||
|
||||
get onEnd() {
|
||||
return this.clickCallBack
|
||||
}
|
||||
set onEnd(val) {
|
||||
if (val && typeof val !== 'function') {
|
||||
console.error('val:', val, '不是一个function')
|
||||
} else {
|
||||
this.clickCallBack = val
|
||||
}
|
||||
}
|
||||
get waterLevels() {
|
||||
return this.waterLevel
|
||||
}
|
||||
set waterLevels(val) {
|
||||
this.waterLevel = val
|
||||
}
|
||||
get waterVolume() {
|
||||
return this.options.waterVolume
|
||||
}
|
||||
@ -327,6 +360,7 @@ class Submerge extends Tools {
|
||||
}
|
||||
set minWaterLevel(val) {
|
||||
this.options.minWaterLevel = val
|
||||
this.currentWaterLaver = this.options.minWaterLevel
|
||||
}
|
||||
get maxWaterLevel() {
|
||||
return this.options.maxWaterLevel
|
||||
@ -340,10 +374,10 @@ class Submerge extends Tools {
|
||||
set risingSpeed(val) {
|
||||
this.options.risingSpeed = val
|
||||
}
|
||||
get area() {
|
||||
get areas() {
|
||||
return this.area
|
||||
}
|
||||
set area(val) {
|
||||
set areas(val) {
|
||||
this.area = val
|
||||
}
|
||||
|
||||
@ -357,11 +391,11 @@ class Submerge extends Tools {
|
||||
this.TweenAnimate = new TWEEN.Tween({ waterLevel: this.options.minWaterLevel }).to({ waterLevel: this.options.maxWaterLevel }, totalTime).delay(this.delay).easing(TWEEN.Easing.Linear.None).onUpdate(async (r, a) => {
|
||||
this.currentWaterLaver = r.waterLevel
|
||||
}).start()
|
||||
let contentElm = this._DialogObject._element.body
|
||||
let pauseBtn = contentElm.getElementsByClassName('pause')[0];
|
||||
let startBtn = contentElm.getElementsByClassName('start')[0];
|
||||
startBtn.style.display = 'none'
|
||||
pauseBtn.style.display = 'flex'
|
||||
// let contentElm = this._DialogObject._element.body
|
||||
// let pauseBtn = contentElm.getElementsByClassName('pause')[0];
|
||||
// let startBtn = contentElm.getElementsByClassName('start')[0];
|
||||
// startBtn.style.display = 'none'
|
||||
// pauseBtn.style.display = 'flex'
|
||||
}
|
||||
|
||||
restart() {
|
||||
@ -420,11 +454,11 @@ class Submerge extends Tools {
|
||||
})
|
||||
}
|
||||
|
||||
static destroy() {
|
||||
destroy() {
|
||||
if (this.TweenAnimate) {
|
||||
TWEEN.remove(this.TweenAnimate)
|
||||
}
|
||||
this.Draw.end()
|
||||
this.Draw && this.Draw.end()
|
||||
this.sdk.viewer.entities.remove(this.entity)
|
||||
this.entity = null
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ class TerrainExcavation extends Tools {
|
||||
this.wallMaterial = Cesium.Material.fromType('Color', {
|
||||
color: Cesium.Color.fromAlpha(Cesium.Color.fromCssColorString('#976b4e'))
|
||||
})
|
||||
this.tools = new Tools(this.sdk)
|
||||
let imageBottom = new Image();
|
||||
let wallBottom = new Image();
|
||||
imageBottom.src = this.bottomImg;
|
||||
@ -71,7 +72,7 @@ class TerrainExcavation extends Tools {
|
||||
}
|
||||
}
|
||||
|
||||
this.init();
|
||||
// this.init();
|
||||
}
|
||||
get show() {
|
||||
return this.options.show
|
||||
@ -153,19 +154,11 @@ class TerrainExcavation extends Tools {
|
||||
startCreate() {
|
||||
this.Draw.start((e, positions) => {
|
||||
if (!positions || positions.length <= 2) {
|
||||
window.ELEMENT && window.ELEMENT.Message({
|
||||
message: '至少拥有三个坐标位置!',
|
||||
type: 'warning',
|
||||
duration: 1500
|
||||
});
|
||||
this.tools.message({ type: 'warning', text: '至少拥有三个坐标位置!' })
|
||||
return
|
||||
}
|
||||
if(!this.isConvex(positions)) {
|
||||
window.ELEMENT && window.ELEMENT.Message({
|
||||
message: '不支持凹多边形',
|
||||
type: 'warning',
|
||||
duration: 1500
|
||||
});
|
||||
if (!this.isConvex(positions)) {
|
||||
this.tools.message({ type: 'warning', text: '至少拥有三个坐标位置!' })
|
||||
console.log('不支持凹多边形')
|
||||
return
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -27,9 +27,11 @@ class VisibilityAnalysis extends Tools {
|
||||
this.viewPointHeight = options.viewPointHeight
|
||||
this.Dialog = _Dialog
|
||||
this._EventBinding = new EventBinding()
|
||||
this.tools = new Tools(this.sdk)
|
||||
YJ.Analysis.AnalysesResults.push(this)
|
||||
// VisibilityAnalysis.edit(this)
|
||||
VisibilityAnalysis.create(this)
|
||||
|
||||
}
|
||||
|
||||
get viewPointHeight() {
|
||||
@ -182,29 +184,33 @@ class VisibilityAnalysis extends Tools {
|
||||
that.tip.setPosition(cartesian, movement.endPosition.x, movement.endPosition.y)
|
||||
})
|
||||
that.event.mouse_right((movement, cartesian) => {
|
||||
end()
|
||||
that.end()
|
||||
})
|
||||
that.event.gesture_pinck_start((movement, cartesian) => {
|
||||
let startTime = new Date()
|
||||
that.event.gesture_pinck_end(() => {
|
||||
let endTime = new Date()
|
||||
if (endTime - startTime >= 500) {
|
||||
end()
|
||||
that.end()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
else {
|
||||
console.log('上一次测量未结束')
|
||||
that.tools.message({
|
||||
text: '上一次测量未结束',
|
||||
type: 'warning',
|
||||
});
|
||||
}
|
||||
|
||||
function end() {
|
||||
YJ.Measure.SetMeasureStatus(false)
|
||||
that.tip.destroy()
|
||||
that.event.destroy()
|
||||
that.tip = null
|
||||
that.event = null
|
||||
}
|
||||
|
||||
}
|
||||
end() {
|
||||
YJ.Measure.SetMeasureStatus(false)
|
||||
this.tip && this.tip.destroy()
|
||||
this.event && this.event.destroy()
|
||||
this.tip = null
|
||||
this.event = null
|
||||
}
|
||||
|
||||
// static update(that) {
|
||||
|
@ -5,6 +5,7 @@ import Draw from '../../../Draw/draw'
|
||||
import MouseTip from '../../../MouseTip'
|
||||
import MouseEvent from '../../../Event'
|
||||
import Dialog from '../../../BaseDialog';
|
||||
import Tools from "../../../Tools";
|
||||
import EventBinding from '../../Element/Dialog/eventBinding';
|
||||
import { html } from "./_element";
|
||||
import { CameraController } from '../../../Global/global'
|
||||
@ -12,7 +13,7 @@ import { CameraController } from '../../../Global/global'
|
||||
class Graffiti extends Draw {
|
||||
/**
|
||||
* @constructor
|
||||
* @param sdk
|
||||
* @param sdk
|
||||
* @description 涂鸦
|
||||
* @param options {object} 线属性
|
||||
* @param options.width=10{number} 宽度
|
||||
@ -23,6 +24,7 @@ class Graffiti extends Draw {
|
||||
this.options.width = options.width || 1
|
||||
this.options.color = options.color || '#ff0000'
|
||||
this._elms = {};
|
||||
this.tools = new Tools(sdk)
|
||||
this._EventBinding = new EventBinding()
|
||||
Graffiti.edit(this, true)
|
||||
}
|
||||
@ -31,7 +33,7 @@ class Graffiti extends Draw {
|
||||
return this.options.color
|
||||
}
|
||||
set color(v) {
|
||||
if(!this.options.color) {
|
||||
if (!this.options.color) {
|
||||
return
|
||||
}
|
||||
this.options.color = v
|
||||
@ -69,14 +71,15 @@ class Graffiti extends Draw {
|
||||
// 编辑框
|
||||
static async edit(that, state) {
|
||||
if (state) {
|
||||
that._DialogObject = await new Dialog(that.sdk.viewer._container, {
|
||||
title: '涂鸦参数',
|
||||
})
|
||||
await that._DialogObject.init()
|
||||
let contentElm = document.createElement('div');
|
||||
contentElm.innerHTML = html()
|
||||
that._DialogObject.contentAppChild(contentElm)
|
||||
// that._DialogObject = await new Dialog(that.sdk.viewer._container, {
|
||||
// title: '涂鸦参数',
|
||||
// })
|
||||
// await that._DialogObject.init()
|
||||
// let contentElm = document.createElement('div');
|
||||
// contentElm.innerHTML = html()
|
||||
// that._DialogObject.contentAppChild(contentElm)
|
||||
// 颜色组件
|
||||
let contentElm = document.getElementsByClassName('graffiti')[0]
|
||||
let colorPicker = new YJColorPicker({
|
||||
el: contentElm.getElementsByClassName("color")[0],
|
||||
size: 'mini',//颜色box类型
|
||||
@ -91,20 +94,20 @@ class Graffiti extends Draw {
|
||||
that.color = 'rgba(255,255,255,1)'
|
||||
},//点击清空按钮事件回调
|
||||
})
|
||||
that._DialogObject._element.body.className = that._DialogObject._element.body.className + ' graffiti'
|
||||
// that._DialogObject._element.body.className = that._DialogObject._element.body.className + ' graffiti'
|
||||
let all_elm = contentElm.getElementsByTagName("*")
|
||||
that._EventBinding.on(that, all_elm)
|
||||
that._elms = that._EventBinding.element
|
||||
that._elms.color = [colorPicker]
|
||||
|
||||
let confirmBtn = document.createElement('button');
|
||||
confirmBtn.className = 'confirm';
|
||||
confirmBtn.innerHTML = '确认'
|
||||
that._DialogObject.footAppChild(confirmBtn)
|
||||
confirmBtn.addEventListener('click', () => {
|
||||
that.start()
|
||||
Graffiti.edit(that, false)
|
||||
});
|
||||
// let confirmBtn = document.createElement('button');
|
||||
// confirmBtn.className = 'confirm';
|
||||
// confirmBtn.innerHTML = '确认'
|
||||
// that._DialogObject.footAppChild(confirmBtn)
|
||||
// confirmBtn.addEventListener('click', () => {
|
||||
// that.start()
|
||||
// Graffiti.edit(that, false)
|
||||
// });
|
||||
}
|
||||
else {
|
||||
if (that._DialogObject && that._DialogObject.close) {
|
||||
@ -122,7 +125,7 @@ class Graffiti extends Draw {
|
||||
start() {
|
||||
let _this = this
|
||||
if (YJ.Measure.GetMeasureStatus()) {
|
||||
console.log('上一次测量未结束')
|
||||
this.tools.message({ type: 'warning', text: '上一次测量未结束' })
|
||||
} else {
|
||||
let viewer = this.sdk.viewer
|
||||
CameraController(this.sdk, false)
|
||||
@ -160,7 +163,7 @@ class Graffiti extends Draw {
|
||||
})
|
||||
})
|
||||
this.event.mouse_left_up((movement, cartesian) => {
|
||||
polylineArray[polylineArray.length-1].polyline.positions = positions
|
||||
polylineArray[polylineArray.length - 1].polyline.positions = positions
|
||||
this.event.mouse_move((movement, cartesian) => {
|
||||
this.tip.setPosition(
|
||||
cartesian,
|
||||
@ -221,7 +224,7 @@ class Graffiti extends Draw {
|
||||
}
|
||||
}
|
||||
|
||||
flicker() {}
|
||||
flicker() { }
|
||||
}
|
||||
|
||||
export default Graffiti
|
||||
|
@ -4,6 +4,7 @@ import Dialog from '../../../BaseDialog'
|
||||
import MouseEvent from '../../../Event/index'
|
||||
import MouseTip from '../../../MouseTip'
|
||||
import { html, css } from './_element'
|
||||
import Tools from "../../../Tools";
|
||||
|
||||
class RoutePlanning extends Base {
|
||||
/**
|
||||
@ -27,6 +28,7 @@ class RoutePlanning extends Base {
|
||||
lng: null,
|
||||
lat: null
|
||||
}
|
||||
this.tools = new Tools(sdk)
|
||||
this.init()
|
||||
}
|
||||
|
||||
@ -43,11 +45,12 @@ class RoutePlanning extends Base {
|
||||
} else {
|
||||
this.startEntity.show = false
|
||||
}
|
||||
|
||||
|
||||
this.startEntity.position = new Cesium.CallbackProperty(() => {
|
||||
let pos = this.sdk.viewer.scene.clampToHeight(
|
||||
new Cesium.Cartesian3.fromDegrees(this.startLng, this.startLat)
|
||||
)
|
||||
this.clickCallBack({ start: pos, end: this.endEntity.position })
|
||||
return pos
|
||||
}, false)
|
||||
this.startEntity.billboard = {
|
||||
@ -73,6 +76,7 @@ class RoutePlanning extends Base {
|
||||
let pos = this.sdk.viewer.scene.clampToHeight(
|
||||
new Cesium.Cartesian3.fromDegrees(this.endLng, this.endLat)
|
||||
)
|
||||
this.clickCallBack({ start: this.startEntity.position, end: pos })
|
||||
return pos
|
||||
}, false)
|
||||
this.endEntity.billboard = {
|
||||
@ -82,10 +86,21 @@ class RoutePlanning extends Base {
|
||||
width: 32,
|
||||
height: 32
|
||||
}
|
||||
this.edit(true)
|
||||
// this.edit(true)
|
||||
this.clear()
|
||||
}
|
||||
|
||||
get onEnd() {
|
||||
return this.clickCallBack
|
||||
}
|
||||
set onEnd(val) {
|
||||
if (val && typeof val !== 'function') {
|
||||
console.error('val:', val, '不是一个function')
|
||||
} else {
|
||||
this.clickCallBack = val
|
||||
}
|
||||
}
|
||||
|
||||
get startLng() {
|
||||
return this.start.lng
|
||||
}
|
||||
@ -253,7 +268,7 @@ class RoutePlanning extends Base {
|
||||
end: [this.endLng, this.endLat]
|
||||
})
|
||||
} else {
|
||||
console.error('请先设置起点和终点坐标!')
|
||||
this.tools.message({ type: 'warning', text: '请先设置起点和终点坐标!' })
|
||||
}
|
||||
})
|
||||
div.appendChild(queryBtn)
|
||||
@ -696,6 +711,6 @@ class RoutePlanning extends Base {
|
||||
}
|
||||
}
|
||||
|
||||
flicker() {}
|
||||
flicker() { }
|
||||
}
|
||||
export default RoutePlanning
|
||||
|
Reference in New Issue
Block a user