Compare commits

...

6 Commits

5 changed files with 23 additions and 13 deletions

View File

@ -1335,8 +1335,8 @@ class GroundSvg extends Base {
w = (Math.cos(radiansW) * distance) * 2 w = (Math.cos(radiansW) * distance) * 2
h = (Math.cos(radiansH) * distance) * 2 h = (Math.cos(radiansH) * distance) * 2
// scaleY值 // scaleY值
this.scale.x = w / 3.5 this.scale.x = Math.abs(w) / 3.5
this.scale.y = h / 3.5 this.scale.y = Math.abs(h) / 3.5
break break
case 'svg-control-points_2': case 'svg-control-points_2':
case 'svg-control-points_8': case 'svg-control-points_8':
@ -1407,8 +1407,8 @@ class GroundSvg extends Base {
w = (Math.cos(radiansW) * distance) * 2 w = (Math.cos(radiansW) * distance) * 2
h = (Math.cos(radiansH) * distance) * 2 h = (Math.cos(radiansH) * distance) * 2
// scaleY值 // scaleY值
this.scale.x = w / 3.5 this.scale.x = Math.abs(w) / 3.5
this.scale.y = h / 3.5 this.scale.y = Math.abs(h) / 3.5
break break
case 'svg-control-points_4': case 'svg-control-points_4':
bearingW = (((turf.rhumbBearing(pointC, turf.point(controlPoints[4])) + 360) - this.angle) % 360) bearingW = (((turf.rhumbBearing(pointC, turf.point(controlPoints[4])) + 360) - this.angle) % 360)

View File

@ -53,8 +53,7 @@ class TextBox extends Base {
// 配置CSS样式和内容结构 // 配置CSS样式和内容结构
viewer.cesiumWidget.container.appendChild(dom); viewer.cesiumWidget.container.appendChild(dom);
let posi = Cesium.Cartesian3.fromDegrees(that.options.position.lng.toFixed(4), that.options.position.lat.toFixed(4), that.options.position.alt.toFixed(4)) let posi = Cesium.Cartesian3.fromDegrees(that.options.position.lng, that.options.position.lat, that.options.position.alt)
that.handler = function () { that.handler = function () {
const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates( const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates(
viewer.scene, posi viewer.scene, posi
@ -72,20 +71,31 @@ class TextBox extends Base {
} }
async setHandeler(data) { async setHandeler(data) {
let that = this let that = this
const ray = this.sdk.viewer.camera.getPickRay(new Cesium.Cartesian2(data.x, data.y));
var cartesian = this.sdk.viewer.scene.globe.pick(ray, this.sdk.viewer.scene); let cartesian = this.sdk.viewer.scene.pickPosition(new Cesium.Cartesian2(data.x, data.y)); //屏幕坐标转为笛卡尔空间坐标
// if (!cartesian) return;
// let c = Cesium.Cartographic.fromCartesian(position);
if (!cartesian) {
const ray = this.sdk.viewer.camera.getPickRay(new Cesium.Cartesian2(data.x, data.y));
cartesian = this.sdk.viewer.scene.globe.pick(ray, this.sdk.viewer.scene);
}
if (Cesium.defined(cartesian)) { if (Cesium.defined(cartesian)) {
that.sdk.viewer.scene.postRender.removeEventListener(that.handler); that.sdk.viewer.scene.postRender.removeEventListener(that.handler);
var cartographic = Cesium.Cartographic.fromCartesian(cartesian); var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
var longitude = Cesium.Math.toDegrees(cartographic.longitude); var longitude = Cesium.Math.toDegrees(cartographic.longitude);
var latitude = Cesium.Math.toDegrees(cartographic.latitude); var latitude = Cesium.Math.toDegrees(cartographic.latitude);
let height = await that.getClampToHeight({ lng: longitude, lat: latitude })
that.position = { that.position = {
lng: longitude, lng: longitude,
lat: latitude, lat: latitude,
alt: cartographic.height alt: cartographic.height
// alt: height
} }
let posi = Cesium.Cartesian3.fromDegrees(longitude.toFixed(4), latitude.toFixed(4), cartographic.height.toFixed(4)) let posi = Cesium.Cartesian3.fromDegrees(longitude, latitude, cartographic.height)
that.handler = function () { that.handler = function () {
const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates( const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates(

View File

@ -649,7 +649,7 @@ class GroundText extends Base {
ctx.font = 200 + 'px serif' ctx.font = 200 + 'px serif'
ctx.fillStyle = 'rgba(255, 255, 255, 0)' ctx.fillStyle = 'rgba(255, 255, 255, 0)'
ctx.fillRect(0, 0, maxWidth + 30, 210) ctx.fillRect(0, 0, maxWidth + 30, 210)
ctx.fillStyle = this.options.color ctx.fillStyle = 'rgba(255, 255, 255, 1)'
ctx.font = '200px serif' ctx.font = '200px serif'
ctx.fillText(textArray[i], 0, 210 * (i + 1)) ctx.fillText(textArray[i], 0, 210 * (i + 1))
} }

View File

@ -508,7 +508,7 @@ class StandText extends Base {
ctx.font = 200 + "px serif"; ctx.font = 200 + "px serif";
ctx.fillStyle = 'rgba(255, 255, 255, 0)' ctx.fillStyle = 'rgba(255, 255, 255, 0)'
ctx.fillRect(0, 0, maxWidth + 30, 210) ctx.fillRect(0, 0, maxWidth + 30, 210)
ctx.fillStyle = this.options.color; ctx.fillStyle = 'rgba(255, 255, 255, 1)';
ctx.font = "200px serif"; ctx.font = "200px serif";
ctx.fillText(textArray[i], 0, 210 * (i+1)); ctx.fillText(textArray[i], 0, 210 * (i+1));
} }

View File

@ -238,8 +238,8 @@ function StreamWall2() {
else { else {
material.alpha = 1.0; material.alpha = 1.0;
} }
material.diffuse = color.rgb*0.0; material.diffuse = colorImage.rgb * color.rgb*0.0;
material.emission = color.rgb * 1.0; material.emission = colorImage.rgb * color.rgb * 1.0;
return material; return material;
}`, }`,
components: { components: {