|
@@ -118,7 +118,7 @@ var measureLineSpace = function (cb) {
|
|
|
handler.setInputAction(function (movement) {
|
|
|
tooltip.style.left = movement.endPosition.x + 3 + "px";
|
|
|
tooltip.style.top = movement.endPosition.y - 25 + "px";
|
|
|
- tooltip.innerHTML = '<p>单击开始,双击结束</p>';
|
|
|
+ tooltip.innerHTML = '<p>单击开始,右键结束</p>';
|
|
|
|
|
|
///////=================================
|
|
|
|
|
@@ -169,7 +169,9 @@ var measureLineSpace = function (cb) {
|
|
|
floatingPoint = viewer.entities.add({
|
|
|
name: '空间直线距离',
|
|
|
position: positions[positions.length - 1],
|
|
|
+ eyeoffset: new Cartesian3(0, 0, -10000000),
|
|
|
point: {
|
|
|
+ eyeoffset: new Cartesian3(0, 0, -10000000),
|
|
|
pixelSize: 5,
|
|
|
color: Color.RED,
|
|
|
outlineColor: Color.WHITE,
|
|
@@ -182,7 +184,9 @@ var measureLineSpace = function (cb) {
|
|
|
floatingLabel = viewer.entities.add({
|
|
|
name: '空间直线距离2',
|
|
|
position: center,
|
|
|
+ eyeoffset: new Cartesian3(0, 0, -10000000),
|
|
|
label: {
|
|
|
+ eyeoffset: new Cartesian3(0, 0, -10000000),
|
|
|
text: textDisance,
|
|
|
font: '18px sans-serif',
|
|
|
fillColor: Color.GOLD,
|
|
@@ -196,9 +200,9 @@ var measureLineSpace = function (cb) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ var timeout = null
|
|
|
handler.setInputAction(function (movement) {
|
|
|
- // cartesian = viewer.scene.camera.pickEllipsoid(movement.position, viewer.scene.globe.ellipsoid);
|
|
|
- // cartesian = viewer.scene.pickPosition(movement.position);
|
|
|
+
|
|
|
if (positions.length == 0) {
|
|
|
positions.push(cartesian.clone());
|
|
|
}
|
|
@@ -210,9 +214,9 @@ var measureLineSpace = function (cb) {
|
|
|
handler.setInputAction(function (movement) {
|
|
|
|
|
|
handler.destroy();//关闭事件句柄
|
|
|
- positions.pop();//最后一个点无效
|
|
|
- viewer.entities.remove(floatingPoint);
|
|
|
- viewer.entities.remove(floatingLabel);
|
|
|
+ // positions.pop();//最后一个点无效
|
|
|
+ // viewer.entities.remove(floatingPoint);
|
|
|
+ // viewer.entities.remove(floatingLabel);
|
|
|
if (positions.length > 2) {
|
|
|
positions.push({...positions[0]});
|
|
|
zdis = getSpaceDistance(positions);
|
|
@@ -220,8 +224,10 @@ var measureLineSpace = function (cb) {
|
|
|
}
|
|
|
viewer.entities.add({
|
|
|
name: '多边形面积',
|
|
|
- position: positions[positions.length - 1],
|
|
|
+ position: positions[2],
|
|
|
+ eyeoffset: new Cartesian3(0, 0, -10000000),
|
|
|
label: {
|
|
|
+ eyeoffset: new Cartesian3(0, 0, -10000000),
|
|
|
text: getArea(positions, transfroms(positions)) + '平方公里',
|
|
|
font: '18px sans-serif',
|
|
|
fillColor: Color.GOLD,
|
|
@@ -235,7 +241,7 @@ var measureLineSpace = function (cb) {
|
|
|
|
|
|
|
|
|
cb(positions)
|
|
|
- }, ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
|
|
|
+ }, ScreenSpaceEventType.RIGHT_CLICK);
|
|
|
|
|
|
var PolyLinePrimitive = (function () {
|
|
|
function _(positions) {
|
|
@@ -297,13 +303,16 @@ export const getLongLat = () => {
|
|
|
|
|
|
getHandler.setInputAction(function (movement) {
|
|
|
var position = viewer.scene.pickPosition(movement.position);
|
|
|
+ console.log(position)
|
|
|
var pixelOffset = new Cartesian2(20, -20)
|
|
|
-
|
|
|
+ let t = transfromItem(position)
|
|
|
points.push(
|
|
|
viewer.entities.add({
|
|
|
+ eyeoffset: new Cartesian3(0, 0, -10000000),
|
|
|
name: '经纬度',
|
|
|
position: position,
|
|
|
point: {
|
|
|
+ eyeoffset: new Cartesian3(0, 0, -10000000),
|
|
|
pixelSize: 5,
|
|
|
color: Color.RED,
|
|
|
outlineColor: Color.WHITE,
|
|
@@ -311,7 +320,8 @@ export const getLongLat = () => {
|
|
|
heightReference: HeightReference.NONE
|
|
|
},
|
|
|
label: {
|
|
|
- text: JSON.stringify(transfromItem(position)),
|
|
|
+ eyeoffset: new Cartesian3(0, 0, -10000000),
|
|
|
+ text: `经纬度:${t.lat.toFixed(2) + ',' + t.lon.toFixed(2)} 高度:${t.hei.toFixed(2)}`,
|
|
|
font: '16px sans-serif',
|
|
|
fillColor: Color.GOLD,
|
|
|
style: LabelStyle.FILL_AND_OUTLINE,
|