Compare commits

...

2 Commits

View File

@ -653,10 +653,13 @@ class Tools {
'11': 4, '11': 4,
'12': 2 '12': 2
} }
param.speed = newParam.rotate ? param.speed : 0 - param.speed param.speed = newParam.rotate ? param.speed : 0 - param.speed
console.log(entity.polyline.oriWidth, arr[type + ''], type, 'oriWidth')
entity.polyline.width = entity.polyline.oriWidth + arr[type + ''] entity.polyline.width = entity.polyline.oriWidth + arr[type + '']
this.getFlowTexture(this, param, entity) this.getFlowTexture(this, param, entity)
break break
@ -693,8 +696,8 @@ class Tools {
// let repeat = getRepeat() // let repeat = getRepeat()
// }, false) // }, false)
entity.polyline.material.oriRepeat = undefined // entity.polyline.material.oriRepeat = that.getSceenLine(entity, options, canvasEle)
entity.polyline.material.oriSpeed = undefined // entity.polyline.material.oriSpeed = undefined
entity.polyline.material = new Cesium.LineTextureMaterialProperty( entity.polyline.material = new Cesium.LineTextureMaterialProperty(
{ {
color: options.color, color: options.color,
@ -747,9 +750,37 @@ class Tools {
}) })
} }
) )
entity.polyline.material.oriSpeed = options.speed // entity.polyline.material.oriSpeed = options.speed
entity.polyline.material.oriRepeat = that.getSceenLine(entity, options, canvasEle)
} }
} }
/**获取当前满屏横线速度 */
getSceenLine(entity, options, canvasEle) {
let point1 = new Cesium.Cartesian2(0, this.sdk.viewer.canvas.clientHeight)
let point2 = new Cesium.Cartesian2(this.sdk.viewer.canvas.clientWidth / 2, this.sdk.viewer.canvas.clientHeight)
var cartesian1 = this.sdk.viewer.scene.pickPosition(point1)
var cartesian2 = this.sdk.viewer.scene.pickPosition(point2)
var distance = Cesium.Cartesian3.distance(cartesian1, cartesian2);
var repeatX = distance / entity.polyline.width.getValue();
// 根据地图缩放程度调整repeatX
var cameraHeight = this.sdk.viewer.camera.positionCartographic.height;
var boundingSphere = new Cesium.BoundingSphere(
new Cesium.Cartesian3(-1000000, 0, 0), // 中心点坐标
500000 // 半径(距离)
);
// 获取绘图缓冲区的宽度和高度(通常是屏幕的分辨率)
var drawingBufferWidth = this.sdk.viewer.canvas.clientWidth;
var drawingBufferHeight = this.sdk.viewer.canvas.clientHeight;
// 使用 getPixelSize 方法获取包围球在屏幕上的像素大小
var groundResolution = this.sdk.viewer.scene.camera.getPixelSize(boundingSphere, drawingBufferWidth, drawingBufferHeight)
// repeatX *= groundResolution / cameraHeight / ((myImg.width / myImg.height * 5) + 1);
repeatX *= groundResolution / cameraHeight / (options.space * (canvasEle.width / canvasEle.height * 5) + 1);
return repeatX * 2
}
/*创建直箭头图片*/ /*创建直箭头图片*/
create_arrow1_picture(color) { create_arrow1_picture(color) {