|
@@ -229,16 +229,18 @@ export default {
|
|
|
* @param Mitem 模型实体
|
|
|
*/
|
|
|
locationSingleModel(Mitem) {
|
|
|
- let entitie = viewer.entities.getById("pointBillboard_" + Mitem.id);
|
|
|
- if (entitie) {
|
|
|
- viewer.flyTo(entitie);
|
|
|
- } else {
|
|
|
- //渲染单个广告牌
|
|
|
- // if (billboardModel.id == Mitem.id) {
|
|
|
- this.DrawBillboard(Mitem);
|
|
|
+ if (Mitem.isAddModel) {
|
|
|
let entitie = viewer.entities.getById("pointBillboard_" + Mitem.id);
|
|
|
- viewer.flyTo(entitie);
|
|
|
- // }
|
|
|
+ if (entitie) {
|
|
|
+ viewer.flyTo(entitie);
|
|
|
+ } else {
|
|
|
+ //渲染单个广告牌
|
|
|
+ // if (billboardModel.id == Mitem.id) {
|
|
|
+ this.DrawBillboard(Mitem);
|
|
|
+ let entitie = viewer.entities.getById("pointBillboard_" + Mitem.id);
|
|
|
+ viewer.flyTo(entitie);
|
|
|
+ // }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
@@ -400,376 +402,378 @@ export default {
|
|
|
* 绘制广告牌
|
|
|
*/
|
|
|
DrawBillboard(billboardModel) {
|
|
|
- if (billboardModel.template) {
|
|
|
- if (typeof billboardModel.template === "string") {
|
|
|
- billboardModel.template = JSON.parse(billboardModel.template);
|
|
|
+ if (billboardModel.isAddModel) {
|
|
|
+ if (billboardModel.template) {
|
|
|
+ if (typeof billboardModel.template === "string") {
|
|
|
+ billboardModel.template = JSON.parse(billboardModel.template);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ billboardModel.template = {};
|
|
|
}
|
|
|
- } else {
|
|
|
- billboardModel.template = {};
|
|
|
- }
|
|
|
|
|
|
- if (billboardModel.templateBottom) {
|
|
|
- if (typeof billboardModel.templateBottom === "string") {
|
|
|
- billboardModel.templateBottom = JSON.parse(
|
|
|
- billboardModel.templateBottom
|
|
|
- );
|
|
|
+ if (billboardModel.templateBottom) {
|
|
|
+ if (typeof billboardModel.templateBottom === "string") {
|
|
|
+ billboardModel.templateBottom = JSON.parse(
|
|
|
+ billboardModel.templateBottom
|
|
|
+ );
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ billboardModel.templateBottom = {};
|
|
|
}
|
|
|
- } else {
|
|
|
- billboardModel.templateBottom = {};
|
|
|
- }
|
|
|
- if (billboardModel.templateCentre) {
|
|
|
- if (typeof billboardModel.templateCentre === "string") {
|
|
|
- billboardModel.templateCentre = JSON.parse(
|
|
|
- billboardModel.templateCentre
|
|
|
- );
|
|
|
+ if (billboardModel.templateCentre) {
|
|
|
+ if (typeof billboardModel.templateCentre === "string") {
|
|
|
+ billboardModel.templateCentre = JSON.parse(
|
|
|
+ billboardModel.templateCentre
|
|
|
+ );
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ billboardModel.templateCentre = {};
|
|
|
}
|
|
|
- } else {
|
|
|
- billboardModel.templateCentre = {};
|
|
|
- }
|
|
|
- if (billboardModel.templateTop) {
|
|
|
- if (typeof billboardModel.templateTop === "string") {
|
|
|
- billboardModel.templateTop = JSON.parse(billboardModel.templateTop);
|
|
|
+ if (billboardModel.templateTop) {
|
|
|
+ if (typeof billboardModel.templateTop === "string") {
|
|
|
+ billboardModel.templateTop = JSON.parse(billboardModel.templateTop);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ billboardModel.templateTop = {};
|
|
|
}
|
|
|
- } else {
|
|
|
- billboardModel.templateTop = {};
|
|
|
- }
|
|
|
|
|
|
- debugger;
|
|
|
- var newposition = Cesium.Cartesian3.fromDegrees(
|
|
|
- billboardModel.x,
|
|
|
- billboardModel.y,
|
|
|
- billboardModel.z
|
|
|
- );
|
|
|
+ debugger;
|
|
|
+ var newposition = Cesium.Cartesian3.fromDegrees(
|
|
|
+ billboardModel.x,
|
|
|
+ billboardModel.y,
|
|
|
+ billboardModel.z
|
|
|
+ );
|
|
|
|
|
|
- if (billboardModel.template) {
|
|
|
- var imageurl = "../../../../static/ModelData/billboard/1.jpg";
|
|
|
- var modelurl = "../../../../static/ModelData/billboard/box.gltf";
|
|
|
- switch (billboardModel.template.ModelType) {
|
|
|
- //矩形广告
|
|
|
- case "rectangleBillboard":
|
|
|
- var orientation = Cesium.Transforms.headingPitchRollQuaternion(
|
|
|
- newposition,
|
|
|
- new Cesium.HeadingPitchRoll(
|
|
|
- Cesium.Math.toRadians(billboardModel.rotateZ),
|
|
|
- Cesium.Math.toRadians(billboardModel.rotateY),
|
|
|
- Cesium.Math.toRadians(billboardModel.rotateX)
|
|
|
- )
|
|
|
- );
|
|
|
- //计算当前实体的xyz
|
|
|
- var p = Cesium.Cartesian3.fromDegrees(
|
|
|
- Number(billboardModel.templateTop.x),
|
|
|
- Number(billboardModel.templateTop.y),
|
|
|
- Number(billboardModel.templateTop.z)
|
|
|
- );
|
|
|
- var topentity = viewer.entities.add({
|
|
|
- id: "top_billboard_" + billboardModel.id,
|
|
|
- name: "gltf",
|
|
|
- show: true,
|
|
|
- position: p,
|
|
|
- /**
|
|
|
- * 长方体
|
|
|
- */
|
|
|
- box: {
|
|
|
- dimensions: new Cesium.Cartesian3(
|
|
|
- Number(billboardModel.templateTop.xL),
|
|
|
- Number(billboardModel.templateTop.zL),
|
|
|
- Number(billboardModel.templateTop.yL)
|
|
|
- ),
|
|
|
+ if (billboardModel.template) {
|
|
|
+ var imageurl = "../../../../static/ModelData/billboard/1.jpg";
|
|
|
+ var modelurl = "../../../../static/ModelData/billboard/box.gltf";
|
|
|
+ switch (billboardModel.template.ModelType) {
|
|
|
+ //矩形广告
|
|
|
+ case "rectangleBillboard":
|
|
|
+ var orientation = Cesium.Transforms.headingPitchRollQuaternion(
|
|
|
+ newposition,
|
|
|
+ new Cesium.HeadingPitchRoll(
|
|
|
+ Cesium.Math.toRadians(billboardModel.rotateZ),
|
|
|
+ Cesium.Math.toRadians(billboardModel.rotateY),
|
|
|
+ Cesium.Math.toRadians(billboardModel.rotateX)
|
|
|
+ )
|
|
|
+ );
|
|
|
+ //计算当前实体的xyz
|
|
|
+ var p = Cesium.Cartesian3.fromDegrees(
|
|
|
+ Number(billboardModel.templateTop.x),
|
|
|
+ Number(billboardModel.templateTop.y),
|
|
|
+ Number(billboardModel.templateTop.z)
|
|
|
+ );
|
|
|
+ var topentity = viewer.entities.add({
|
|
|
+ id: "top_billboard_" + billboardModel.id,
|
|
|
+ name: "gltf",
|
|
|
show: true,
|
|
|
- material: Cesium.Color.LIGHTGREEN,
|
|
|
- },
|
|
|
- orientation: orientation,
|
|
|
- });
|
|
|
- entityList.push(topentity);
|
|
|
+ position: p,
|
|
|
+ /**
|
|
|
+ * 长方体
|
|
|
+ */
|
|
|
+ box: {
|
|
|
+ dimensions: new Cesium.Cartesian3(
|
|
|
+ Number(billboardModel.templateTop.xL),
|
|
|
+ Number(billboardModel.templateTop.zL),
|
|
|
+ Number(billboardModel.templateTop.yL)
|
|
|
+ ),
|
|
|
+ show: true,
|
|
|
+ material: Cesium.Color.LIGHTGREEN,
|
|
|
+ },
|
|
|
+ orientation: orientation,
|
|
|
+ });
|
|
|
+ entityList.push(topentity);
|
|
|
|
|
|
- break;
|
|
|
- // 立杆型广告
|
|
|
- case "postsBillboard":
|
|
|
- var orientation = Cesium.Transforms.headingPitchRollQuaternion(
|
|
|
- newposition,
|
|
|
- new Cesium.HeadingPitchRoll(
|
|
|
- Cesium.Math.toRadians(billboardModel.rotateZ),
|
|
|
- Cesium.Math.toRadians(billboardModel.rotateY),
|
|
|
- Cesium.Math.toRadians(billboardModel.rotateX)
|
|
|
- )
|
|
|
- );
|
|
|
- var c_p = Cesium.Cartesian3.fromDegrees(
|
|
|
- billboardModel.templateCentre.x,
|
|
|
- billboardModel.templateCentre.y,
|
|
|
- billboardModel.templateCentre.z
|
|
|
- );
|
|
|
- var Centreentity = viewer.entities.add({
|
|
|
- id: "Centre_billboard_" + billboardModel.id,
|
|
|
- name: "gltf",
|
|
|
- show: true,
|
|
|
- position: c_p,
|
|
|
- /**
|
|
|
- * 圆柱
|
|
|
- */
|
|
|
- cylinder: {
|
|
|
- length: billboardModel.templateCentre.yL, //圆柱体长度
|
|
|
- topRadius: billboardModel.templateCentre.rL, //圆柱顶部半径
|
|
|
- bottomRadius: billboardModel.templateCentre.rL, //圆柱体底部半径
|
|
|
- material: Cesium.Color.LIGHTGREEN,
|
|
|
- shadows: Cesium.ShadowMode.DISABLED, //指定圆柱体是否从每个光源投射或接收阴影
|
|
|
- },
|
|
|
- orientation: Cesium.Transforms.headingPitchRollQuaternion(
|
|
|
+ break;
|
|
|
+ // 立杆型广告
|
|
|
+ case "postsBillboard":
|
|
|
+ var orientation = Cesium.Transforms.headingPitchRollQuaternion(
|
|
|
newposition,
|
|
|
new Cesium.HeadingPitchRoll(
|
|
|
Cesium.Math.toRadians(billboardModel.rotateZ),
|
|
|
- Cesium.Math.toRadians(0),
|
|
|
- Cesium.Math.toRadians(0)
|
|
|
+ Cesium.Math.toRadians(billboardModel.rotateY),
|
|
|
+ Cesium.Math.toRadians(billboardModel.rotateX)
|
|
|
)
|
|
|
- ),
|
|
|
- });
|
|
|
- entityList.push(Centreentity);
|
|
|
+ );
|
|
|
+ var c_p = Cesium.Cartesian3.fromDegrees(
|
|
|
+ billboardModel.templateCentre.x,
|
|
|
+ billboardModel.templateCentre.y,
|
|
|
+ billboardModel.templateCentre.z
|
|
|
+ );
|
|
|
+ var Centreentity = viewer.entities.add({
|
|
|
+ id: "Centre_billboard_" + billboardModel.id,
|
|
|
+ name: "gltf",
|
|
|
+ show: true,
|
|
|
+ position: c_p,
|
|
|
+ /**
|
|
|
+ * 圆柱
|
|
|
+ */
|
|
|
+ cylinder: {
|
|
|
+ length: billboardModel.templateCentre.yL, //圆柱体长度
|
|
|
+ topRadius: billboardModel.templateCentre.rL, //圆柱顶部半径
|
|
|
+ bottomRadius: billboardModel.templateCentre.rL, //圆柱体底部半径
|
|
|
+ material: Cesium.Color.LIGHTGREEN,
|
|
|
+ shadows: Cesium.ShadowMode.DISABLED, //指定圆柱体是否从每个光源投射或接收阴影
|
|
|
+ },
|
|
|
+ orientation: Cesium.Transforms.headingPitchRollQuaternion(
|
|
|
+ newposition,
|
|
|
+ new Cesium.HeadingPitchRoll(
|
|
|
+ Cesium.Math.toRadians(billboardModel.rotateZ),
|
|
|
+ Cesium.Math.toRadians(0),
|
|
|
+ Cesium.Math.toRadians(0)
|
|
|
+ )
|
|
|
+ ),
|
|
|
+ });
|
|
|
+ entityList.push(Centreentity);
|
|
|
|
|
|
- //计算当前实体的xyz
|
|
|
+ //计算当前实体的xyz
|
|
|
|
|
|
- var t_p = Cesium.Cartesian3.fromDegrees(
|
|
|
- Number(billboardModel.templateTop.x),
|
|
|
- Number(billboardModel.templateTop.y),
|
|
|
- Number(billboardModel.templateTop.z)
|
|
|
- );
|
|
|
- var topentity = viewer.entities.add({
|
|
|
- id: "top_billboard_" + billboardModel.id,
|
|
|
- name: "gltf",
|
|
|
- show: true,
|
|
|
- position: t_p,
|
|
|
- /**
|
|
|
- * 矩形
|
|
|
- */
|
|
|
- box: {
|
|
|
- dimensions: new Cesium.Cartesian3(
|
|
|
- Number(billboardModel.templateTop.xL),
|
|
|
- Number(billboardModel.templateTop.zL),
|
|
|
- Number(billboardModel.templateTop.yL)
|
|
|
+ var t_p = Cesium.Cartesian3.fromDegrees(
|
|
|
+ Number(billboardModel.templateTop.x),
|
|
|
+ Number(billboardModel.templateTop.y),
|
|
|
+ Number(billboardModel.templateTop.z)
|
|
|
+ );
|
|
|
+ var topentity = viewer.entities.add({
|
|
|
+ id: "top_billboard_" + billboardModel.id,
|
|
|
+ name: "gltf",
|
|
|
+ show: true,
|
|
|
+ position: t_p,
|
|
|
+ /**
|
|
|
+ * 矩形
|
|
|
+ */
|
|
|
+ box: {
|
|
|
+ dimensions: new Cesium.Cartesian3(
|
|
|
+ Number(billboardModel.templateTop.xL),
|
|
|
+ Number(billboardModel.templateTop.zL),
|
|
|
+ Number(billboardModel.templateTop.yL)
|
|
|
+ ),
|
|
|
+ material: Cesium.Color.LIGHTGREEN,
|
|
|
+ // outline: false,
|
|
|
+ // outlineColor: Cesium.Color.SPRINGGREEN,
|
|
|
+ // outlineWidth: 1,
|
|
|
+ },
|
|
|
+ orientation: orientation,
|
|
|
+ });
|
|
|
+ entityList.push(topentity);
|
|
|
+
|
|
|
+ break;
|
|
|
+ //底座型立杆广告
|
|
|
+ case "ColumnWithaseBillboard":
|
|
|
+ var orientation = Cesium.Transforms.headingPitchRollQuaternion(
|
|
|
+ newposition,
|
|
|
+ new Cesium.HeadingPitchRoll(
|
|
|
+ Cesium.Math.toRadians(billboardModel.rotateZ),
|
|
|
+ Cesium.Math.toRadians(billboardModel.rotateY),
|
|
|
+ Cesium.Math.toRadians(billboardModel.rotateX)
|
|
|
+ )
|
|
|
+ );
|
|
|
+ var b_p = Cesium.Cartesian3.fromDegrees(
|
|
|
+ billboardModel.templateBottom.x,
|
|
|
+ billboardModel.templateBottom.y,
|
|
|
+ billboardModel.templateBottom.z
|
|
|
+ );
|
|
|
+ var bottomentity = viewer.entities.add({
|
|
|
+ id: "bottom_billboard_" + billboardModel.id,
|
|
|
+ name: "gltf",
|
|
|
+ show: true,
|
|
|
+ position: b_p,
|
|
|
+ /**
|
|
|
+ * 矩形
|
|
|
+ */
|
|
|
+ box: {
|
|
|
+ dimensions: new Cesium.Cartesian3(
|
|
|
+ billboardModel.templateBottom.xL,
|
|
|
+ billboardModel.templateBottom.zL,
|
|
|
+ billboardModel.templateBottom.yL
|
|
|
+ ),
|
|
|
+ material: Cesium.Color.LIGHTGREEN,
|
|
|
+ // outline: false,
|
|
|
+ // outlineColor: Cesium.Color.SPRINGGREEN,
|
|
|
+ // outlineWidth: 1,
|
|
|
+ },
|
|
|
+ orientation: Cesium.Transforms.headingPitchRollQuaternion(
|
|
|
+ newposition,
|
|
|
+ new Cesium.HeadingPitchRoll(
|
|
|
+ Cesium.Math.toRadians(billboardModel.rotateZ),
|
|
|
+ Cesium.Math.toRadians(0),
|
|
|
+ Cesium.Math.toRadians(0)
|
|
|
+ )
|
|
|
),
|
|
|
- material: Cesium.Color.LIGHTGREEN,
|
|
|
- // outline: false,
|
|
|
- // outlineColor: Cesium.Color.SPRINGGREEN,
|
|
|
- // outlineWidth: 1,
|
|
|
- },
|
|
|
- orientation: orientation,
|
|
|
- });
|
|
|
- entityList.push(topentity);
|
|
|
+ });
|
|
|
+ entityList.push(bottomentity);
|
|
|
|
|
|
- break;
|
|
|
- //底座型立杆广告
|
|
|
- case "ColumnWithaseBillboard":
|
|
|
- var orientation = Cesium.Transforms.headingPitchRollQuaternion(
|
|
|
- newposition,
|
|
|
- new Cesium.HeadingPitchRoll(
|
|
|
- Cesium.Math.toRadians(billboardModel.rotateZ),
|
|
|
- Cesium.Math.toRadians(billboardModel.rotateY),
|
|
|
- Cesium.Math.toRadians(billboardModel.rotateX)
|
|
|
- )
|
|
|
- );
|
|
|
- var b_p = Cesium.Cartesian3.fromDegrees(
|
|
|
- billboardModel.templateBottom.x,
|
|
|
- billboardModel.templateBottom.y,
|
|
|
- billboardModel.templateBottom.z
|
|
|
- );
|
|
|
- var bottomentity = viewer.entities.add({
|
|
|
- id: "bottom_billboard_" + billboardModel.id,
|
|
|
- name: "gltf",
|
|
|
- show: true,
|
|
|
- position: b_p,
|
|
|
- /**
|
|
|
- * 矩形
|
|
|
- */
|
|
|
- box: {
|
|
|
- dimensions: new Cesium.Cartesian3(
|
|
|
- billboardModel.templateBottom.xL,
|
|
|
- billboardModel.templateBottom.zL,
|
|
|
- billboardModel.templateBottom.yL
|
|
|
+ var c_p = Cesium.Cartesian3.fromDegrees(
|
|
|
+ billboardModel.templateCentre.x,
|
|
|
+ billboardModel.templateCentre.y,
|
|
|
+ billboardModel.templateCentre.z
|
|
|
+ );
|
|
|
+ var Centreentity = viewer.entities.add({
|
|
|
+ id: "Centre_billboard_" + billboardModel.id,
|
|
|
+ name: "gltf",
|
|
|
+ show: true,
|
|
|
+ position: c_p,
|
|
|
+ /**
|
|
|
+ * 圆柱
|
|
|
+ */
|
|
|
+ cylinder: {
|
|
|
+ length: billboardModel.templateCentre.yL, //圆柱体长度
|
|
|
+ topRadius: billboardModel.templateCentre.rL, //圆柱顶部半径
|
|
|
+ bottomRadius: billboardModel.templateCentre.rL, //圆柱体底部半径
|
|
|
+ material: Cesium.Color.LIGHTGREEN,
|
|
|
+ shadows: Cesium.ShadowMode.DISABLED, //指定圆柱体是否从每个光源投射或接收阴影
|
|
|
+ },
|
|
|
+ orientation: Cesium.Transforms.headingPitchRollQuaternion(
|
|
|
+ newposition,
|
|
|
+ new Cesium.HeadingPitchRoll(
|
|
|
+ Cesium.Math.toRadians(billboardModel.rotateZ),
|
|
|
+ Cesium.Math.toRadians(0),
|
|
|
+ Cesium.Math.toRadians(0)
|
|
|
+ )
|
|
|
),
|
|
|
- material: Cesium.Color.LIGHTGREEN,
|
|
|
- // outline: false,
|
|
|
- // outlineColor: Cesium.Color.SPRINGGREEN,
|
|
|
- // outlineWidth: 1,
|
|
|
- },
|
|
|
- orientation: Cesium.Transforms.headingPitchRollQuaternion(
|
|
|
+ });
|
|
|
+ entityList.push(Centreentity);
|
|
|
+
|
|
|
+ var t_p = Cesium.Cartesian3.fromDegrees(
|
|
|
+ Number(billboardModel.templateTop.x),
|
|
|
+ Number(billboardModel.templateTop.y),
|
|
|
+ Number(billboardModel.templateTop.z)
|
|
|
+ );
|
|
|
+
|
|
|
+ var topentity = viewer.entities.add({
|
|
|
+ id: "top_billboard_" + billboardModel.id,
|
|
|
+ name: "gltf",
|
|
|
+ show: true,
|
|
|
+ position: t_p,
|
|
|
+ /**
|
|
|
+ * 矩形
|
|
|
+ */
|
|
|
+ box: {
|
|
|
+ dimensions: new Cesium.Cartesian3(
|
|
|
+ Number(billboardModel.templateTop.xL),
|
|
|
+ Number(billboardModel.templateTop.zL),
|
|
|
+ Number(billboardModel.templateTop.yL)
|
|
|
+ ),
|
|
|
+ material: Cesium.Color.LIGHTGREEN,
|
|
|
+ // outline: false,
|
|
|
+ // outlineColor: Cesium.Color.SPRINGGREEN,
|
|
|
+ // outlineWidth: 1,
|
|
|
+ },
|
|
|
+ orientation: orientation,
|
|
|
+ });
|
|
|
+ entityList.push(topentity);
|
|
|
+
|
|
|
+ break;
|
|
|
+ //实物型广告(模型型)
|
|
|
+ case "ModelBillboard":
|
|
|
+ var orientation = Cesium.Transforms.headingPitchRollQuaternion(
|
|
|
newposition,
|
|
|
new Cesium.HeadingPitchRoll(
|
|
|
Cesium.Math.toRadians(billboardModel.rotateZ),
|
|
|
- Cesium.Math.toRadians(0),
|
|
|
- Cesium.Math.toRadians(0)
|
|
|
+ Cesium.Math.toRadians(billboardModel.rotateY),
|
|
|
+ Cesium.Math.toRadians(billboardModel.rotateX)
|
|
|
)
|
|
|
- ),
|
|
|
- });
|
|
|
- entityList.push(bottomentity);
|
|
|
-
|
|
|
- var c_p = Cesium.Cartesian3.fromDegrees(
|
|
|
- billboardModel.templateCentre.x,
|
|
|
- billboardModel.templateCentre.y,
|
|
|
- billboardModel.templateCentre.z
|
|
|
- );
|
|
|
- var Centreentity = viewer.entities.add({
|
|
|
- id: "Centre_billboard_" + billboardModel.id,
|
|
|
- name: "gltf",
|
|
|
- show: true,
|
|
|
- position: c_p,
|
|
|
- /**
|
|
|
- * 圆柱
|
|
|
- */
|
|
|
- cylinder: {
|
|
|
- length: billboardModel.templateCentre.yL, //圆柱体长度
|
|
|
- topRadius: billboardModel.templateCentre.rL, //圆柱顶部半径
|
|
|
- bottomRadius: billboardModel.templateCentre.rL, //圆柱体底部半径
|
|
|
- material: Cesium.Color.LIGHTGREEN,
|
|
|
- shadows: Cesium.ShadowMode.DISABLED, //指定圆柱体是否从每个光源投射或接收阴影
|
|
|
- },
|
|
|
- orientation: Cesium.Transforms.headingPitchRollQuaternion(
|
|
|
+ );
|
|
|
+ var p = Cesium.Cartesian3.fromDegrees(
|
|
|
+ Number(billboardModel.templateTop.x),
|
|
|
+ Number(billboardModel.templateTop.y),
|
|
|
+ Number(billboardModel.templateTop.z)
|
|
|
+ );
|
|
|
+ var url = billboardModel.template.templateTopUrl || modelurl;
|
|
|
+ var entity = viewer.entities.add({
|
|
|
+ id: "top_billboard_" + billboardModel.id,
|
|
|
+ name: "gltf",
|
|
|
+ show: true,
|
|
|
+ position: p,
|
|
|
+ /**
|
|
|
+ * 模型
|
|
|
+ */
|
|
|
+ model: {
|
|
|
+ uri: url,
|
|
|
+ scale: billboardModel.templateTop.scaleL,
|
|
|
+ },
|
|
|
+ orientation: orientation,
|
|
|
+ });
|
|
|
+ entityList.push(entity);
|
|
|
+ break;
|
|
|
+ //图片型广告
|
|
|
+ case "imgBillboard":
|
|
|
+ var orientation = Cesium.Transforms.headingPitchRollQuaternion(
|
|
|
newposition,
|
|
|
new Cesium.HeadingPitchRoll(
|
|
|
Cesium.Math.toRadians(billboardModel.rotateZ),
|
|
|
- Cesium.Math.toRadians(0),
|
|
|
- Cesium.Math.toRadians(0)
|
|
|
+ Cesium.Math.toRadians(billboardModel.rotateY),
|
|
|
+ Cesium.Math.toRadians(billboardModel.rotateX)
|
|
|
)
|
|
|
- ),
|
|
|
- });
|
|
|
- entityList.push(Centreentity);
|
|
|
-
|
|
|
- var t_p = Cesium.Cartesian3.fromDegrees(
|
|
|
- Number(billboardModel.templateTop.x),
|
|
|
- Number(billboardModel.templateTop.y),
|
|
|
- Number(billboardModel.templateTop.z)
|
|
|
- );
|
|
|
-
|
|
|
- var topentity = viewer.entities.add({
|
|
|
- id: "top_billboard_" + billboardModel.id,
|
|
|
- name: "gltf",
|
|
|
- show: true,
|
|
|
- position: t_p,
|
|
|
- /**
|
|
|
- * 矩形
|
|
|
- */
|
|
|
- box: {
|
|
|
- dimensions: new Cesium.Cartesian3(
|
|
|
- Number(billboardModel.templateTop.xL),
|
|
|
- Number(billboardModel.templateTop.zL),
|
|
|
- Number(billboardModel.templateTop.yL)
|
|
|
- ),
|
|
|
- material: Cesium.Color.LIGHTGREEN,
|
|
|
- // outline: false,
|
|
|
- // outlineColor: Cesium.Color.SPRINGGREEN,
|
|
|
- // outlineWidth: 1,
|
|
|
- },
|
|
|
- orientation: orientation,
|
|
|
- });
|
|
|
- entityList.push(topentity);
|
|
|
+ );
|
|
|
+ var p = Cesium.Cartesian3.fromDegrees(
|
|
|
+ Number(billboardModel.templateTop.x),
|
|
|
+ Number(billboardModel.templateTop.y),
|
|
|
+ Number(billboardModel.templateTop.z)
|
|
|
+ );
|
|
|
+ var url = billboardModel.template.templateTopUrl || imageurl;
|
|
|
+ var entity = viewer.entities.add({
|
|
|
+ id: "top_billboard_" + billboardModel.id,
|
|
|
+ name: "gltf",
|
|
|
+ show: true,
|
|
|
+ position: p,
|
|
|
+ /**
|
|
|
+ * 广告牌
|
|
|
+ */
|
|
|
+ billboard: {
|
|
|
+ image: url,
|
|
|
+ width: Number(billboardModel.templateTop.xL),
|
|
|
+ height: Number(billboardModel.templateTop.yL),
|
|
|
+ rotation: Number(billboardModel.rotateX),
|
|
|
+ sizeInMeters: true,
|
|
|
+ },
|
|
|
+ orientation: orientation,
|
|
|
+ });
|
|
|
+ entityList.push(entity);
|
|
|
+ break;
|
|
|
+ }
|
|
|
|
|
|
- break;
|
|
|
- //实物型广告(模型型)
|
|
|
- case "ModelBillboard":
|
|
|
- var orientation = Cesium.Transforms.headingPitchRollQuaternion(
|
|
|
- newposition,
|
|
|
- new Cesium.HeadingPitchRoll(
|
|
|
- Cesium.Math.toRadians(billboardModel.rotateZ),
|
|
|
- Cesium.Math.toRadians(billboardModel.rotateY),
|
|
|
- Cesium.Math.toRadians(billboardModel.rotateX)
|
|
|
- )
|
|
|
- );
|
|
|
- var p = Cesium.Cartesian3.fromDegrees(
|
|
|
- Number(billboardModel.templateTop.x),
|
|
|
- Number(billboardModel.templateTop.y),
|
|
|
- Number(billboardModel.templateTop.z)
|
|
|
- );
|
|
|
- var url = billboardModel.template.templateTopUrl || modelurl;
|
|
|
- var entity = viewer.entities.add({
|
|
|
- id: "top_billboard_" + billboardModel.id,
|
|
|
- name: "gltf",
|
|
|
- show: true,
|
|
|
- position: p,
|
|
|
- /**
|
|
|
- * 模型
|
|
|
- */
|
|
|
- model: {
|
|
|
- uri: url,
|
|
|
- scale: billboardModel.templateTop.scaleL,
|
|
|
- },
|
|
|
- orientation: orientation,
|
|
|
- });
|
|
|
- entityList.push(entity);
|
|
|
- break;
|
|
|
- //图片型广告
|
|
|
- case "imgBillboard":
|
|
|
- var orientation = Cesium.Transforms.headingPitchRollQuaternion(
|
|
|
- newposition,
|
|
|
- new Cesium.HeadingPitchRoll(
|
|
|
- Cesium.Math.toRadians(billboardModel.rotateZ),
|
|
|
- Cesium.Math.toRadians(billboardModel.rotateY),
|
|
|
- Cesium.Math.toRadians(billboardModel.rotateX)
|
|
|
- )
|
|
|
- );
|
|
|
- var p = Cesium.Cartesian3.fromDegrees(
|
|
|
+ var h = 0;
|
|
|
+ if (billboardModel.templateTop.yL) {
|
|
|
+ h = Number(billboardModel.templateTop.yL) / 2;
|
|
|
+ }
|
|
|
+ viewer.entities.removeById("pointBillboard_" + billboardModel.id);
|
|
|
+ lodash.remove(
|
|
|
+ entityList,
|
|
|
+ (entity) => entity.id === "pointBillboard_" + billboardModel.id
|
|
|
+ );
|
|
|
+ const point = viewer.entities.add({
|
|
|
+ id: "pointBillboard_" + billboardModel.id,
|
|
|
+ //点
|
|
|
+ position: Cesium.Cartesian3.fromDegrees(
|
|
|
Number(billboardModel.templateTop.x),
|
|
|
Number(billboardModel.templateTop.y),
|
|
|
- Number(billboardModel.templateTop.z)
|
|
|
- );
|
|
|
- var url = billboardModel.template.templateTopUrl || imageurl;
|
|
|
- var entity = viewer.entities.add({
|
|
|
- id: "top_billboard_" + billboardModel.id,
|
|
|
- name: "gltf",
|
|
|
- show: true,
|
|
|
- position: p,
|
|
|
- /**
|
|
|
- * 广告牌
|
|
|
- */
|
|
|
- billboard: {
|
|
|
- image: url,
|
|
|
- width: Number(billboardModel.templateTop.xL),
|
|
|
- height: Number(billboardModel.templateTop.yL),
|
|
|
- rotation: Number(billboardModel.rotateX),
|
|
|
- sizeInMeters: true,
|
|
|
- },
|
|
|
- orientation: orientation,
|
|
|
- });
|
|
|
- entityList.push(entity);
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- var h = 0;
|
|
|
- if (billboardModel.templateTop.yL) {
|
|
|
- h = Number(billboardModel.templateTop.yL) / 2;
|
|
|
- }
|
|
|
- viewer.entities.removeById("pointBillboard_" + billboardModel.id);
|
|
|
- lodash.remove(
|
|
|
- entityList,
|
|
|
- (entity) => entity.id === "pointBillboard_" + billboardModel.id
|
|
|
- );
|
|
|
- const point = viewer.entities.add({
|
|
|
- id: "pointBillboard_" + billboardModel.id,
|
|
|
- //点
|
|
|
- position: Cesium.Cartesian3.fromDegrees(
|
|
|
- Number(billboardModel.templateTop.x),
|
|
|
- Number(billboardModel.templateTop.y),
|
|
|
- Number(billboardModel.templateTop.z) + h
|
|
|
- ),
|
|
|
- label: {
|
|
|
- text: billboardModel.billboardName, //描述内容
|
|
|
- font: "20px Sans-Serif", //字体大小 类型
|
|
|
- fillColor: Cesium.Color.RED, //颜色
|
|
|
- outlineColor: Cesium.Color.GOLD,
|
|
|
- style: Cesium.LabelStyle.CENTER_LABEL,
|
|
|
- // 垂直位置
|
|
|
- verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
|
|
|
- // 中心位置
|
|
|
- pixelOffset: new Cesium.Cartesian2(0, -10),
|
|
|
- //设置背景颜色透明
|
|
|
- backgroundColor: new Cesium.Color(0.0, 0.0, 0.0, 0.0),
|
|
|
- //打开背景 打开背景 (不会被线段覆盖)
|
|
|
- showBackground: true,
|
|
|
- // heightReference: Cesium.HeightReference.RELATIVE_TO_GROUND,
|
|
|
- distanceDisplayCondition: new Cesium.DistanceDisplayCondition(
|
|
|
- 0.0,
|
|
|
- 300.0
|
|
|
+ Number(billboardModel.templateTop.z) + h
|
|
|
),
|
|
|
- heightReference: Cesium.HeightReference.NONE,
|
|
|
- },
|
|
|
- });
|
|
|
- entityList.push(point);
|
|
|
+ label: {
|
|
|
+ text: billboardModel.billboardName, //描述内容
|
|
|
+ font: "20px Sans-Serif", //字体大小 类型
|
|
|
+ fillColor: Cesium.Color.RED, //颜色
|
|
|
+ outlineColor: Cesium.Color.GOLD,
|
|
|
+ style: Cesium.LabelStyle.CENTER_LABEL,
|
|
|
+ // 垂直位置
|
|
|
+ verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
|
|
|
+ // 中心位置
|
|
|
+ pixelOffset: new Cesium.Cartesian2(0, -10),
|
|
|
+ //设置背景颜色透明
|
|
|
+ backgroundColor: new Cesium.Color(0.0, 0.0, 0.0, 0.0),
|
|
|
+ //打开背景 打开背景 (不会被线段覆盖)
|
|
|
+ showBackground: true,
|
|
|
+ // heightReference: Cesium.HeightReference.RELATIVE_TO_GROUND,
|
|
|
+ distanceDisplayCondition: new Cesium.DistanceDisplayCondition(
|
|
|
+ 0.0,
|
|
|
+ 300.0
|
|
|
+ ),
|
|
|
+ heightReference: Cesium.HeightReference.NONE,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ entityList.push(point);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// if (billboardModel.isAddModel) {
|