From 00b733dc6ae372be365a01046ead5c062d8f5617 Mon Sep 17 00:00:00 2001
From: ansel0926 <ansel0926@gmail.com>
Date: 星期二, 17 五月 2022 18:43:44 +0800
Subject: [PATCH] 更换字体图片
---
assets/map/map3D.js | 65 ++++++++++++++++++++++++++++++--
1 files changed, 60 insertions(+), 5 deletions(-)
diff --git a/assets/map/map3D.js b/assets/map/map3D.js
index 2113bfa..269e21d 100644
--- a/assets/map/map3D.js
+++ b/assets/map/map3D.js
@@ -294,7 +294,8 @@
let title=entity.title;
let lineColor=entity._polyline._material._color._value.toCssHexString();
let lineSize=entity._polyline._width._value;
- iframe.child(id,title,lineColor,lineSize,pick);
+ let attributes = pick.primitive.getGeometryInstanceAttributes(pick.id);
+ iframe.child(id,title,lineColor,lineSize,attributes);
}
});
}
@@ -982,8 +983,7 @@
});
}
-function updateLine(type,id,val,pick){//淇敼绾匡細zzf
- let attributes = pick.primitive.getGeometryInstanceAttributes( pick.id );
+function updateLine(type,id,val,attributes){//淇敼绾匡細zzf
let signPointEntity = viewer.entities.getById(id);
let saveData;
if(type==1){//绾垮悕绉�
@@ -1434,6 +1434,9 @@
else if(data.rows[i].type=="label"){
drawAjaxLabel(data.rows[i])
}
+ else if(data.rows[i].type=="text"){
+ drawAjaxText(data.rows[i])
+ }
}
}
},
@@ -1454,10 +1457,11 @@
label: {
text: drawEntity.content,
font: drawEntity.fontsize+'px '+drawEntity.fontstyle,
- fillColor: Cesium.Color.fromCssColorString(drawEntity.color),
+ fillColor: drawEntity.color?Cesium.Color.fromCssColorString(drawEntity.color):Cesium.Color.WHITE,
outlineColor: Cesium.Color.BLACK,
outlineWidth: 2,
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
+ eyeOffset:new Cesium.Cartesian3(0,20,0),
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
disableDepthTestDistance: Number.POSITIVE_INFINITY,
@@ -1612,10 +1616,12 @@
label: {
text: drawEntity.content,
font: drawEntity.fontsize+'px '+drawEntity.fontstyle,
- fillColor: Cesium.Color.fromCssColorString(drawEntity.color),
+ fillColor: drawEntity.color?Cesium.Color.fromCssColorString(drawEntity.color):Cesium.Color.WHITE,
outlineColor: Cesium.Color.BLACK,
outlineWidth: 2,
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
+ //pixelOffset: new Cesium.Cartesian2(0.0, 5.0),
+ eyeOffset:new Cesium.Cartesian3(0,20,0),
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
disableDepthTestDistance: Number.POSITIVE_INFINITY,
@@ -1664,4 +1670,53 @@
"lat": Cesium.Math.toDegrees(cartographic.latitude)
}
}, "4");
+}
+
+function drawAjaxText(drawEntity){//鍔犺浇鏍囩
+ let cartesian = Cesium.Cartesian3.fromDegrees(drawEntity.longitude, drawEntity.latitude, drawEntity.height);
+ var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
+ var entity=viewer.entities.add({
+ id:drawEntity.id,
+ name:"drawTextEtity",
+ position:cartesian,
+ label: {
+ text: drawEntity.content?drawEntity.content:new Date(drawEntity.createTime).format("yyyyMMddhhmmss"),
+ font: drawEntity.fontsize+'px '+drawEntity.fontstyle,
+ fillColor: drawEntity.color?Cesium.Color.fromCssColorString(drawEntity.color):Cesium.Color.WHITE,
+ outlineColor: Cesium.Color.BLACK,
+ outlineWidth: 2,
+ style: Cesium.LabelStyle.FILL_AND_OUTLINE,
+ //pixelOffset: new Cesium.Cartesian2(0.0, 5.0),
+ eyeOffset:new Cesium.Cartesian3(0,20,0),
+ verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
+ horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
+ disableDepthTestDistance: Number.POSITIVE_INFINITY,
+ heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
+ distanceDisplayCondition: window.localStorage.getItem("visualDistance")?new Cesium.DistanceDisplayCondition(0, window.localStorage.getItem("visualDistance")):new Cesium.DistanceDisplayCondition(0, 100000.0)
+ },
+ });
+ let popup = new Popup({
+ viewer:viewer,
+ geometry:cartesian,
+ entity:entity,
+ id: "pop_" + entity.id,
+ type:'label',
+ content:drawEntity.popContent?drawEntity.popContent:null,
+ })
+ if( drawEntity.popContent!=null&& drawEntity.popContent!=""){
+ $("#pop_" + entity.id).children(".bx-popup-content-ctn").children(".bx-popup-content").children(".textarea")[0].innerHTML = drawEntity.popContent;
+ }
+ document.getElementById("pop_" +entity.id).style.display="none";
+ addTreeNode({
+ "title": entity.title,
+ "id": entity.id,
+ "field": "Entity",
+ "checked": true,
+ "spread": true,
+ "children": [],
+ "ext": {
+ "lng": Cesium.Math.toDegrees(cartographic.longitude),
+ "lat": Cesium.Math.toDegrees(cartographic.latitude)
+ }
+ }, "4");
}
\ No newline at end of file
--
Gitblit v1.9.1