模型,车辆优化

main
许宏杰 10 months ago
parent a360e19438
commit 8afd55d7b8

@ -51,6 +51,7 @@ export default {
selectedItems: [], selectedItems: [],
graphicLayer: null, graphicLayer: null,
baseUrl: basePathUrl + "lib/geoJson/tileset.json", baseUrl: basePathUrl + "lib/geoJson/tileset.json",
carUrl: basePathUrl + "lib/car.gltf",
map: null, map: null,
options: { options: {
scene: { scene: {
@ -101,15 +102,16 @@ export default {
* 创建车辆图标 * 创建车辆图标
*/ */
createCar(list) { createCar(list) {
let _this = this;
list.map((item, index) => { list.map((item, index) => {
const graphic = new mars3d.graphic.ModelEntity({ const graphic = new mars3d.graphic.ModelPrimitive({
id: `car${item.carId}`, id: `car${item.carId}`,
position: [parseFloat(item.lng), parseFloat(item.lat)], position: [parseFloat(item.lng), parseFloat(item.lat)],
style: { style: {
heading: parseInt(item.drct), heading: parseInt(item.drct),
url: "//data.mars3d.cn/gltf/imap/ce2fddca7bac436d8d318bcd4fdf2d69/gltf/gltf2.gltf", url: _this.carUrl,
scale: 0.5, scale: 1,
minimumPixelSize: 35, minimumPixelSize: 40,
silhouette: true, silhouette: true,
silhouetteColor: "#025CC1", silhouetteColor: "#025CC1",
silhouetteSize: 2, silhouetteSize: 2,
@ -141,6 +143,10 @@ export default {
attr: { index: index, remark: "Model示例" }, attr: { index: index, remark: "Model示例" },
}); });
graphic.on(mars3d.EventType.click, function (e) {
_this.$router.push({ path: "/carInfo" });
});
this.graphicLayer.addGraphic(graphic); this.graphicLayer.addGraphic(graphic);
}); });
}, },
@ -251,7 +257,12 @@ export default {
const tiles3dLayer = new mars3d.layer.TilesetLayer({ const tiles3dLayer = new mars3d.layer.TilesetLayer({
name: "姑苏区建筑物", name: "姑苏区建筑物",
url: "https://www.jichuanglanhai.com:88/3dtiles/yunkun/tileset.json", url: "https://www.jichuanglanhai.com:88/3dtiles/yunkun/tileset.json",
maximumScreenSpaceError: 1, maximumScreenSpaceError: 16,
maximumMemoryUsage: 1024 / 2,
dynamicScreenSpaceError: false,
skipLevelOfDetail: true,
preferLeaves: true,
flyTo: false,
style: { style: {
color: { color: {
conditions: [["true", `color("rgba(42, 160, 224, 1)")`]], conditions: [["true", `color("rgba(42, 160, 224, 1)")`]],

@ -53,6 +53,7 @@ export default {
}, },
], ],
}, },
carUrl: basePathUrl + "lib/car.gltf",
}; };
}, },
components: { MarsMap, grids }, components: { MarsMap, grids },
@ -77,7 +78,12 @@ export default {
let tiles3dLayer = new mars3d.layer.TilesetLayer({ let tiles3dLayer = new mars3d.layer.TilesetLayer({
name: "姑苏区建筑物", name: "姑苏区建筑物",
url: "https://www.jichuanglanhai.com:88/3dtiles/yunkun/tileset.json", url: "https://www.jichuanglanhai.com:88/3dtiles/yunkun/tileset.json",
maximumScreenSpaceError: 1, maximumScreenSpaceError: 16,
maximumMemoryUsage: 1024 / 2,
dynamicScreenSpaceError: false,
skipLevelOfDetail: true,
preferLeaves: true,
flyTo: false,
style: { style: {
color: { color: {
conditions: [["true", `color("rgba(42, 160, 224, 1)")`]], conditions: [["true", `color("rgba(42, 160, 224, 1)")`]],
@ -115,13 +121,15 @@ export default {
}, },
model: { model: {
show: true, show: true,
url: "//data.mars3d.cn/gltf/imap/ce2fddca7bac436d8d318bcd4fdf2d69/gltf/gltf2.gltf", url: _this.carUrl,
scale: 0.3, scale: 0.3,
heading: -120,
minimumPixelSize: 55, minimumPixelSize: 55,
silhouette: true, silhouette: true,
silhouetteColor: "#fff", silhouetteColor: "#fff",
silhouetteSize: 1, silhouetteSize: 1,
silhouetteAlpha: 0.19, silhouetteAlpha: 0.19,
clampToGround: true,
}, },
// billboard: { // billboard: {
// image: require("../assets/images/car-active.png"), // image: require("../assets/images/car-active.png"),

@ -24,11 +24,11 @@ export default {
options: { options: {
scene: { scene: {
center: { center: {
lat: -13.043317, lat: 2.849636,
lng: 110.564694, lng: 109.828071,
alt: 9535005.7, alt: 12509129.9,
heading: 354.3, heading: 353.3,
pitch: -61.6, pitch: -73.4,
}, },
}, },
control: { control: {
@ -62,10 +62,7 @@ export default {
showSkyBox: false, showSkyBox: false,
showSkyAtmosphere: false, showSkyAtmosphere: false,
sceneMode: 1, sceneMode: 1,
globe: {
// showGroundAtmosphere: false,
// baseColor: "rgba(0,0,0,0)",
},
cameraController: { cameraController: {
enableZoom: false, enableZoom: false,
enableTranslate: false, enableTranslate: false,
@ -93,7 +90,18 @@ export default {
positions: item.positions, positions: item.positions,
style: { style: {
fill: true, fill: true,
color: "#4881a7", lastMaterialType: "Image",
materialOptions: {
materialType: "Image",
image: require("../assets/images/姑苏区.png"),
opacity: 1,
repeat_x: 1,
repeat_y: 1,
transparent: false,
},
materialType: "Image",
opacity: 1, opacity: 1,
outline: true, outline: true,
outlineWidth: 1.5, outlineWidth: 1.5,
@ -101,21 +109,21 @@ export default {
setHeight: 900009, setHeight: 900009,
}, },
}); });
const wall = new mars3d.graphic.WallPrimitive({ // const wall = new mars3d.graphic.WallPrimitive({
positions: item.positions, // positions: item.positions,
style: { // style: {
setHeight: -20000, // setHeight: -20000,
diffHeight: 900000, // // diffHeight: 900000, //
width: 10, // width: 10,
materialType: mars3d.MaterialType.Image2, // materialType: mars3d.MaterialType.Image2,
materialOptions: { // materialOptions: {
image: require("../assets/images/fence-top.png"), // image: require("../assets/images/fence-top.png"),
color: "#0071F8", // color: "#0071F8",
}, // },
}, // },
}); // });
this.mapLayer.china.addGraphic(polygonEntity); this.mapLayer.china.addGraphic(polygonEntity);
this.mapLayer.china.addGraphic(wall); // this.mapLayer.china.addGraphic(wall);
}); });
this.createEchartsLayer(); this.createEchartsLayer();

Loading…
Cancel
Save