|
@@ -1,20 +1,20 @@
|
|
|
|
|
|
/*
|
|
|
-九、绘制弓形
|
|
|
+九、绘制弓形线
|
|
|
*/
|
|
|
-class DrawArc {
|
|
|
+class DrawBowLine {
|
|
|
constructor(arg) {
|
|
|
this.viewer = arg.viewer;
|
|
|
this.Cesium = arg.Cesium;
|
|
|
this.tt = 0.4;
|
|
|
this.floatingPoint = null; //标识点
|
|
|
this.drawHandler = null; //画事件
|
|
|
- this.DrawArc = null; //弓形
|
|
|
- this._DrawArcLast = null; //最后一个弓形
|
|
|
+ this.DrawBowLine = null; //弓形
|
|
|
+ this._DrawBowLineLast = null; //最后一个弓形
|
|
|
this._positions = []; //活动点
|
|
|
this._entities_point = []; //脏数据
|
|
|
this._entities_PincerArrow = []; //脏数据
|
|
|
- this._DrawArcData = null; //用于构造弓形
|
|
|
+ this._DrawBowLineData = null; //用于构造弓形
|
|
|
this.DrawStartEvent = new Cesium.Event(); //开始绘制事件
|
|
|
this.DrawEndEvent = new Cesium.Event(); //结束绘制事件
|
|
|
|
|
@@ -39,12 +39,12 @@ class DrawArc {
|
|
|
|
|
|
//返回弓形
|
|
|
get PincerArrow() {
|
|
|
- return this._DrawArcLast;
|
|
|
+ return this._DrawBowLineLast;
|
|
|
}
|
|
|
|
|
|
//返回弓形数据用于加载弓形
|
|
|
getData() {
|
|
|
- return this._DrawArcData;
|
|
|
+ return this._DrawBowLineData;
|
|
|
}
|
|
|
|
|
|
// 修改编辑调用计算
|
|
@@ -53,14 +53,14 @@ class DrawArc {
|
|
|
if (data.length < 3) {
|
|
|
return;
|
|
|
}
|
|
|
- var DrawArc = [];
|
|
|
+ var DrawBowLine = [];
|
|
|
let positions = [];
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
|
positions.push($this.cartesianToLatlng(data[i]));
|
|
|
var cart3 = $this.lonLatToMercator($this.cartesianToLatlng(data[i]));
|
|
|
- DrawArc.push(cart3);
|
|
|
+ DrawBowLine.push(cart3);
|
|
|
}
|
|
|
- let [pnt1, pnt2, pnt3, startAngle, endAngle] = [DrawArc[0], DrawArc[2], DrawArc[1], null, null];
|
|
|
+ let [pnt1, pnt2, pnt3, startAngle, endAngle] = [DrawBowLine[0], DrawBowLine[2], DrawBowLine[1], null, null];
|
|
|
let center = $this.getCircleCenterOfThreePoints(pnt1, pnt2, pnt3)
|
|
|
let radius = $this.MathDistance(pnt1, center)
|
|
|
let angle1 = $this.getAzimuth(pnt1, center)
|
|
@@ -78,7 +78,7 @@ class DrawArc {
|
|
|
var cart3 = $this.LatlngTocartesian($this.WebMercator2lonLat(getArcPoint[l]));
|
|
|
pHierarchy.push(cart3);
|
|
|
}
|
|
|
- $this._DrawArcData = positions
|
|
|
+ $this._DrawBowLineData = positions
|
|
|
return pHierarchy
|
|
|
}
|
|
|
|
|
@@ -88,12 +88,12 @@ class DrawArc {
|
|
|
if (data.length < 3) {
|
|
|
return;
|
|
|
}
|
|
|
- var DrawArc = [];
|
|
|
+ var DrawBowLine = [];
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
|
var cart3 = $this.lonLatToMercator(data[i]);
|
|
|
- DrawArc.push(cart3);
|
|
|
+ DrawBowLine.push(cart3);
|
|
|
}
|
|
|
- let [pnt1, pnt2, pnt3, startAngle, endAngle] = [DrawArc[0], DrawArc[2], DrawArc[1], null, null];
|
|
|
+ let [pnt1, pnt2, pnt3, startAngle, endAngle] = [DrawBowLine[0], DrawBowLine[2], DrawBowLine[1], null, null];
|
|
|
let center = $this.getCircleCenterOfThreePoints(pnt1, pnt2, pnt3)
|
|
|
let radius = $this.MathDistance(pnt1, center)
|
|
|
let angle1 = $this.getAzimuth(pnt1, center)
|
|
@@ -113,7 +113,7 @@ class DrawArc {
|
|
|
pHierarchy.push(cart3);
|
|
|
}
|
|
|
var arrowEntity = $this.viewer.entities.add({
|
|
|
- Type: 'DrawArc',
|
|
|
+ Type: 'DrawBowLine',
|
|
|
Position: data,
|
|
|
id: data.id || $this.objId,
|
|
|
polyline: {
|
|
@@ -180,11 +180,11 @@ class DrawArc {
|
|
|
return;
|
|
|
}
|
|
|
//console.log("点击地图移动采集的点:",cartesian);
|
|
|
- if (!$this.Cesium.defined($this.DrawArc)) {
|
|
|
- $this.DrawArc = $this.createDrawArc();
|
|
|
+ if (!$this.Cesium.defined($this.DrawBowLine)) {
|
|
|
+ $this.DrawBowLine = $this.createDrawBowLine();
|
|
|
}
|
|
|
$this.floatingPoint.position.setValue(cartesian);
|
|
|
- if ($this.DrawArc) {
|
|
|
+ if ($this.DrawBowLine) {
|
|
|
//替换最后一个点
|
|
|
// _positions.pop();
|
|
|
// _positions.push(cartesian);
|
|
@@ -204,18 +204,18 @@ class DrawArc {
|
|
|
this.handler.setInputAction(function(movement) {
|
|
|
|
|
|
if ($this._positions.length >= 3) {
|
|
|
- $this._DrawArcData = $this._positions.concat();
|
|
|
- $this.viewer.entities.remove($this.DrawArc); //移除
|
|
|
- $this.DrawArc = null;
|
|
|
+ $this._DrawBowLineData = $this._positions.concat();
|
|
|
+ $this.viewer.entities.remove($this.DrawBowLine); //移除
|
|
|
+ $this.DrawBowLine = null;
|
|
|
var lnglatArr = [];
|
|
|
- for (var i = 0; i < $this._DrawArcData.length; i++) {
|
|
|
- var lnglat = $this.cartesianToLatlng($this._DrawArcData[i]);
|
|
|
+ for (var i = 0; i < $this._DrawBowLineData.length; i++) {
|
|
|
+ var lnglat = $this.cartesianToLatlng($this._DrawBowLineData[i]);
|
|
|
lnglatArr.push(lnglat)
|
|
|
}
|
|
|
- $this._DrawArcData = lnglatArr;
|
|
|
+ $this._DrawBowLineData = lnglatArr;
|
|
|
var pincerArrow = $this.addload(lnglatArr); //加载
|
|
|
$this._entities_PincerArrow.push(pincerArrow);
|
|
|
- $this._DrawArcLast = pincerArrow;
|
|
|
+ $this._DrawBowLineLast = pincerArrow;
|
|
|
$this.viewer.entities.remove($this.floatingPoint);
|
|
|
$this.floatingPoint = null;
|
|
|
|
|
@@ -228,20 +228,20 @@ class DrawArc {
|
|
|
}
|
|
|
|
|
|
//创建弓形
|
|
|
- createDrawArc() {
|
|
|
+ createDrawBowLine() {
|
|
|
let $this = this
|
|
|
- var DrawArcEntity = $this.viewer.entities.add({
|
|
|
+ var DrawBowLineEntity = $this.viewer.entities.add({
|
|
|
polyline: {
|
|
|
positions: new $this.Cesium.CallbackProperty(function() {
|
|
|
if ($this._positions.length < 3) {
|
|
|
return;
|
|
|
}
|
|
|
- var DrawArc = [];
|
|
|
+ var DrawBowLine = [];
|
|
|
for (var i = 0; i < $this._positions.length; i++) {
|
|
|
var cart3 = $this.lonLatToMercator($this.cartesianToLatlng($this._positions[i]));
|
|
|
- DrawArc.push(cart3);
|
|
|
+ DrawBowLine.push(cart3);
|
|
|
}
|
|
|
- let [pnt1, pnt2, pnt3, startAngle, endAngle] = [DrawArc[0], DrawArc[2], DrawArc[1], null, null];
|
|
|
+ let [pnt1, pnt2, pnt3, startAngle, endAngle] = [DrawBowLine[0], DrawBowLine[2], DrawBowLine[1], null, null];
|
|
|
let center = $this.getCircleCenterOfThreePoints(pnt1, pnt2, pnt3)
|
|
|
let radius = $this.MathDistance(pnt1, center)
|
|
|
let angle1 = $this.getAzimuth(pnt1, center)
|
|
@@ -268,10 +268,10 @@ class DrawArc {
|
|
|
clampToGround: true
|
|
|
}
|
|
|
})
|
|
|
- //$this._entities_DrawArc.push(DrawArcEntity);
|
|
|
- // DrawArcEntity.valueFlag = "value";
|
|
|
- $this._entities_PincerArrow.push(DrawArcEntity);
|
|
|
- return DrawArcEntity
|
|
|
+ //$this._entities_DrawBowLine.push(DrawBowLineEntity);
|
|
|
+ // DrawBowLineEntity.valueFlag = "value";
|
|
|
+ $this._entities_PincerArrow.push(DrawBowLineEntity);
|
|
|
+ return DrawBowLineEntity
|
|
|
}
|
|
|
|
|
|
//创建点
|
|
@@ -306,7 +306,7 @@ class DrawArc {
|
|
|
}
|
|
|
|
|
|
clearPoint() {
|
|
|
- this.DrawEndEvent.raiseEvent(this._DrawArcLast, this._DrawArcData, this.drawType);
|
|
|
+ this.DrawEndEvent.raiseEvent(this._DrawBowLineLast, this._DrawBowLineData, this.drawType);
|
|
|
for (var i = 0; i < this._entities_point.length; i++) {
|
|
|
this.viewer.entities.remove(this._entities_point[i]);
|
|
|
}
|
|
@@ -531,4 +531,4 @@ class DrawArc {
|
|
|
|
|
|
}
|
|
|
|
|
|
-export default DrawArc
|
|
|
+export default DrawBowLine
|