Compare commits
2 Commits
09f760b10a
...
5d6679d919
Author | SHA1 | Date | |
---|---|---|---|
5d6679d919 | |||
41c132e506 |
@ -74,33 +74,35 @@ class BatchModel extends Base {
|
|||||||
Draw && Draw.start((a, positions) => {
|
Draw && Draw.start((a, positions) => {
|
||||||
this.options.positions = positions;
|
this.options.positions = positions;
|
||||||
//判断范围是否过大
|
//判断范围是否过大
|
||||||
if (options.type == '面') {
|
if (positions) {
|
||||||
let posi = positions.map(v => {
|
if (options.type == '面') {
|
||||||
return Cesium.Cartesian3.fromDegrees(v.lng, v.lat)
|
let posi = positions.map(v => {
|
||||||
})
|
return Cesium.Cartesian3.fromDegrees(v.lng, v.lat)
|
||||||
let dis1 = Cesium.Cartesian3.distance(posi[0], posi[1])
|
})
|
||||||
let dis2 = Cesium.Cartesian3.distance(posi[1], posi[2])
|
let dis1 = Cesium.Cartesian3.distance(posi[0], posi[1])
|
||||||
let num1 = dis1 / this.options.spacing
|
let dis2 = Cesium.Cartesian3.distance(posi[1], posi[2])
|
||||||
let num2 = dis2 / this.options.spacing
|
let num1 = dis1 / this.options.spacing
|
||||||
if (num1 * num2 > 100) {
|
let num2 = dis2 / this.options.spacing
|
||||||
tools.message({ type: 'warning', text: '数量大于100,请重新绘制' })
|
if (num1 * num2 > 100) {
|
||||||
return;
|
tools.message({ type: 'warning', text: '数量大于100,请重新绘制' })
|
||||||
}
|
return;
|
||||||
} else if (options.type == '线') {
|
}
|
||||||
let posi = positions.map(v => {
|
} else if (options.type == '线') {
|
||||||
return Cesium.Cartesian3.fromDegrees(v.lng, v.lat)
|
let posi = positions.map(v => {
|
||||||
})
|
return Cesium.Cartesian3.fromDegrees(v.lng, v.lat)
|
||||||
let dis = 0
|
})
|
||||||
for (let i = 0; i < posi.length - 2; i++) {
|
let dis = 0
|
||||||
dis += Cesium.Cartesian3.distance(posi[i], posi[i + 1])
|
for (let i = 0; i < posi.length - 2; i++) {
|
||||||
}
|
dis += Cesium.Cartesian3.distance(posi[i], posi[i + 1])
|
||||||
if (dis / this.options.spacing > 100) {
|
}
|
||||||
tools.message({ type: 'warning', text: '数量大于100,请重新绘制' })
|
if (dis / this.options.spacing > 100) {
|
||||||
return;
|
tools.message({ type: 'warning', text: '数量大于100,请重新绘制' })
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// this.callback(this.options);
|
||||||
|
(this.options.positions.length || this.options.positions.lng) && BatchModel.computeDis(this)
|
||||||
}
|
}
|
||||||
// this.callback(this.options);
|
|
||||||
(this.options.positions.length || this.options.positions.lng) && BatchModel.computeDis(this)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -115,51 +117,59 @@ class BatchModel extends Base {
|
|||||||
let posiArr = []
|
let posiArr = []
|
||||||
let array = []
|
let array = []
|
||||||
if (that.options.type == '面') {
|
if (that.options.type == '面') {
|
||||||
that.options.positions.forEach(item => {
|
if (that.options.positions.length != 0) {
|
||||||
fromDegreesArray.push(item.lng, item.lat)
|
that.options.positions.forEach(item => {
|
||||||
})
|
fromDegreesArray.push(item.lng, item.lat)
|
||||||
// arr = that.generateInterpolatedPoints(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray), that.options.spacing)
|
|
||||||
arr = await that.computedArea(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray), that.options.spacing)
|
|
||||||
array[0] = arr
|
|
||||||
array[1] = that.calculateRoadAngle(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)[0], Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)[3])
|
|
||||||
arr.forEach((item, index) => {
|
|
||||||
const cartographic = Cesium.Cartographic.fromCartesian(
|
|
||||||
item // Cartesian3对象 {x, y, z}
|
|
||||||
);
|
|
||||||
const longitude = Cesium.Math.toDegrees(cartographic.longitude);
|
|
||||||
const latitude = Cesium.Math.toDegrees(cartographic.latitude);
|
|
||||||
const height = cartographic.height;
|
|
||||||
posiArr.push({
|
|
||||||
lng: longitude,
|
|
||||||
lat: latitude,
|
|
||||||
alt: height
|
|
||||||
})
|
})
|
||||||
})
|
// arr = that.generateInterpolatedPoints(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray), that.options.spacing)
|
||||||
|
arr = await that.computedArea(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray), that.options.spacing)
|
||||||
|
array[0] = arr
|
||||||
|
array[1] = that.calculateRoadAngle(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)[0], Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)[3])
|
||||||
|
arr.forEach((item, index) => {
|
||||||
|
const cartographic = Cesium.Cartographic.fromCartesian(
|
||||||
|
item // Cartesian3对象 {x, y, z}
|
||||||
|
);
|
||||||
|
const longitude = Cesium.Math.toDegrees(cartographic.longitude);
|
||||||
|
const latitude = Cesium.Math.toDegrees(cartographic.latitude);
|
||||||
|
const height = cartographic.height;
|
||||||
|
posiArr.push({
|
||||||
|
lng: longitude,
|
||||||
|
lat: latitude,
|
||||||
|
alt: height
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
} else if (that.options.type == '线') {
|
} else if (that.options.type == '线') {
|
||||||
that.options.positions.forEach(item => {
|
if (that.options.positions.length != 0) {
|
||||||
fromDegreesArray.push(item.lng, item.lat)
|
that.options.positions.forEach(item => {
|
||||||
})
|
fromDegreesArray.push(item.lng, item.lat)
|
||||||
array = await that.linePoint(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray), that.options.spacing)
|
|
||||||
arr = array[0]
|
|
||||||
that.pointArr = arr
|
|
||||||
arr.forEach((item, index) => {
|
|
||||||
const cartographic = Cesium.Cartographic.fromCartesian(
|
|
||||||
item // Cartesian3对象 {x, y, z}
|
|
||||||
);
|
|
||||||
const longitude = Cesium.Math.toDegrees(cartographic.longitude);
|
|
||||||
const latitude = Cesium.Math.toDegrees(cartographic.latitude);
|
|
||||||
const height = cartographic.height;
|
|
||||||
posiArr.push({
|
|
||||||
lng: longitude,
|
|
||||||
lat: latitude,
|
|
||||||
alt: height
|
|
||||||
})
|
})
|
||||||
})
|
array = await that.linePoint(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray), that.options.spacing)
|
||||||
|
arr = array[0]
|
||||||
|
that.pointArr = arr
|
||||||
|
arr.forEach((item, index) => {
|
||||||
|
const cartographic = Cesium.Cartographic.fromCartesian(
|
||||||
|
item // Cartesian3对象 {x, y, z}
|
||||||
|
);
|
||||||
|
const longitude = Cesium.Math.toDegrees(cartographic.longitude);
|
||||||
|
const latitude = Cesium.Math.toDegrees(cartographic.latitude);
|
||||||
|
const height = cartographic.height;
|
||||||
|
posiArr.push({
|
||||||
|
lng: longitude,
|
||||||
|
lat: latitude,
|
||||||
|
alt: height
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
} else if (that.options.type == '点') {
|
} else if (that.options.type == '点') {
|
||||||
let height = await that.getClampToHeight({ lng: that.options.positions.lng, lat: that.options.positions.lat })
|
if (that.options.positions.lng) {
|
||||||
posiArr = [{ lng: that.options.positions.lng, lat: that.options.positions.lat, alt: height }]
|
let height = await that.getClampToHeight({ lng: that.options.positions.lng, lat: that.options.positions.lat })
|
||||||
// posiArr = [that.options.positions]
|
posiArr = [{ lng: that.options.positions.lng, lat: that.options.positions.lat, alt: height }]
|
||||||
that.pointArr = posiArr
|
// posiArr = [that.options.positions]
|
||||||
|
that.pointArr = posiArr
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
let params = {
|
let params = {
|
||||||
type: that.options.type,
|
type: that.options.type,
|
||||||
|
Reference in New Issue
Block a user