创建新仓库
This commit is contained in:
1422
src/renderer/views/dashboard/index.vue
Normal file
1422
src/renderer/views/dashboard/index.vue
Normal file
File diff suppressed because it is too large
Load Diff
1329
src/renderer/views/dashboard/index_b.vue
Normal file
1329
src/renderer/views/dashboard/index_b.vue
Normal file
File diff suppressed because it is too large
Load Diff
146
src/renderer/views/dashboard/modelTransform.js
Normal file
146
src/renderer/views/dashboard/modelTransform.js
Normal file
@ -0,0 +1,146 @@
|
||||
import {Fbx2glb} from "../../../main/back/convert/fbx2gltf";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
transformTypes: [
|
||||
{
|
||||
title: "osgb转换为tileset",
|
||||
name: "osgbToglb",
|
||||
selectType: "openDirectory",
|
||||
placeholder: '请选择xml文件所在文件夹',
|
||||
outplaceholder: '请输入文件夹路径',
|
||||
},
|
||||
{
|
||||
title: "shape转换为tileset",
|
||||
name: "shapeToglb",
|
||||
filters: {
|
||||
name: "",
|
||||
extensions: ['shp'],
|
||||
},
|
||||
selectType: "openFile",
|
||||
outplaceholder: '请输入文件夹路径'
|
||||
},
|
||||
{
|
||||
title: "obj转换为glb",
|
||||
name: "objToglb",
|
||||
filters: {
|
||||
name: "",
|
||||
extensions: ['obj'],
|
||||
},
|
||||
|
||||
selectType: "openFile"
|
||||
}, {
|
||||
title: "fbx转换为glb",
|
||||
name: "Fbx2glb",
|
||||
filters: {
|
||||
name: "",
|
||||
extensions: ['fbx','FBX'],
|
||||
},
|
||||
selectType: "openFile"
|
||||
},
|
||||
{
|
||||
title: "b3dm转换为glb",
|
||||
name: "b3dmToglb",
|
||||
|
||||
selectType: "openFile",
|
||||
filters: {
|
||||
name: "",
|
||||
extensions: ['b3dm'],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "dae转换为gltf",
|
||||
name: "daeTogltf",
|
||||
|
||||
selectType: "openFile",
|
||||
filters: {
|
||||
name: "",
|
||||
extensions: ['dae'],
|
||||
},
|
||||
},
|
||||
],
|
||||
transformTypeActiveName: "",
|
||||
input: "",
|
||||
output: ""
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeActive() {
|
||||
this.output = ''
|
||||
this.input = ''
|
||||
},
|
||||
transform() {
|
||||
|
||||
if (this.input && this.output) {
|
||||
$root_home_index.fullScreenLoading=true
|
||||
|
||||
this.$sendElectronChanel("transformModel", {
|
||||
fun: this.transformTypeActiveName,
|
||||
input: this.input,
|
||||
output: this.output
|
||||
});
|
||||
this.$recvElectronChanel("transformModelRes", (e, msg,err) => {
|
||||
console.log(msg)
|
||||
console.log(err)
|
||||
$root_home_index.fullScreenLoading=false
|
||||
|
||||
this.$message.info(msg)
|
||||
// cb(paths);
|
||||
});
|
||||
}
|
||||
|
||||
// window[this.transformTypeActiveName](this.input, this.output)
|
||||
else
|
||||
this.$message.warning("确保存在源文件路径和存放路径")
|
||||
},
|
||||
openDialog({selectType, filters}) {
|
||||
let option = {
|
||||
properties: [selectType, /*"multiSelections"*/],
|
||||
filters: [filters]
|
||||
}
|
||||
this.$sendElectronChanel("open-directory-dialog", option);
|
||||
this.$recvElectronChanel("selectedItem", (e, paths) => {
|
||||
console.log(paths)
|
||||
this.input = paths[0];
|
||||
// cb(paths);
|
||||
});
|
||||
},
|
||||
openSaveDialog({selectType, name}) {
|
||||
|
||||
if (selectType == 'openDirectory' || name == 'shapeToglb') {
|
||||
let option = {
|
||||
properties: ["openDirectory", /*"multiSelections"*/],
|
||||
}
|
||||
this.$sendElectronChanel("open-directory-dialog", option);
|
||||
this.$recvElectronChanel("selectedItem", (e, paths) => {
|
||||
console.log(paths)
|
||||
this.output = paths[0];
|
||||
// cb(paths);
|
||||
});
|
||||
} else {
|
||||
let filename = "文件", extensions = 'glb'
|
||||
if (name == 'daeTogltf') {
|
||||
extensions = 'gltf'
|
||||
}
|
||||
if (this.input) {
|
||||
let arr = this.input.split("/")
|
||||
|
||||
filename = arr[arr.length - 1]
|
||||
filename = filename.split(".")[0]
|
||||
}
|
||||
this.$sendElectronChanel("saveFile", {
|
||||
title: "保存文件",
|
||||
filename,
|
||||
filters: [{
|
||||
name: "",
|
||||
extensions: [extensions],
|
||||
}]
|
||||
})
|
||||
this.$recvElectronChanel("selectedFileItem", (e, path) => {
|
||||
this.output = path
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
272
src/renderer/views/dashboard/test.js
Normal file
272
src/renderer/views/dashboard/test.js
Normal file
@ -0,0 +1,272 @@
|
||||
import {get_source_list} from "../../api/gisAPI";
|
||||
|
||||
const test = {
|
||||
data() {
|
||||
return {
|
||||
earthsDom: ['earth', 'earths'],
|
||||
|
||||
};
|
||||
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
callback(Event) {
|
||||
console.log(Event)
|
||||
this.earthsDom.forEach(dom => {
|
||||
$("#" + dom).removeClass("selectedEarthCss")
|
||||
})
|
||||
$("#" + Event.path[4].id).addClass("selectedEarthCss")
|
||||
|
||||
if (Event.path[4].id == "earths") {
|
||||
window.Earth1 = window.Earths
|
||||
copy(window.right_entityMap)
|
||||
} else {
|
||||
window.Earth1 = window.Earth
|
||||
copy(window.left_entityMap)
|
||||
}
|
||||
|
||||
function copy(map) {
|
||||
if (map == "undefined") {
|
||||
map = new Map()
|
||||
}
|
||||
window._entityMap.clear()
|
||||
// empty = null
|
||||
window._entityMap = new Map([...map])
|
||||
console.log("copy之后")
|
||||
console.log(_entityMap)
|
||||
console.log(left_entityMap)
|
||||
console.log(right_entityMap)
|
||||
// console.log(Earth1)
|
||||
// console.log(Earth)
|
||||
// console.log(Earths)
|
||||
}
|
||||
},
|
||||
tongbu() {
|
||||
let _this = this.$refs.tree
|
||||
|
||||
// this.$refs.tree.
|
||||
// $("#earths").click()
|
||||
window.Earth1 = window.Earths
|
||||
$("#earths").addClass("selectedEarthCss")
|
||||
$("#earth").removeClass("selectedEarthCss")
|
||||
get_source_list().then(response => {
|
||||
if ([0, 200].includes(response.code)) {
|
||||
let data = JSON.parse(JSON.stringify(response.data.list || []))
|
||||
data.sort(_this.keysort('tree_index'))
|
||||
//给node设置树形如icon;是否允许添加子节点,以及右键菜单
|
||||
|
||||
if (window.right_entityMap == 'undefined')
|
||||
window.right_entityMap = new Map()
|
||||
|
||||
console.log("被同步的数据", data)
|
||||
console.log("被同步的数据", window.Earth1)
|
||||
console.log("window.right_entityMap", window.right_entityMap)
|
||||
data.forEach(node => {
|
||||
console.log("node.source_type", node.source_type, ['point', 'line', 'panel',
|
||||
'circle', 'attackArrow',
|
||||
'pincerArrow', 'groundImage',
|
||||
'layer', 'ArcgisWXImagery'].includes(node.source_type))
|
||||
|
||||
if (!window.right_entityMap.get(node.source_id) &&
|
||||
['model', 'point', 'line', 'panel',
|
||||
'circle', 'attackArrow',
|
||||
'pincerArrow', 'groundImage',
|
||||
'layer', 'ArcgisWXImagery'].includes(node.source_type)) {
|
||||
if (node.detail)
|
||||
node.detail = JSON.parse(node.detail)
|
||||
|
||||
//设置树上图标,并渲染到地球上
|
||||
_this.setOptions(node)
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
if (window.right_entityMap == 'undefined')
|
||||
window.right_entityMap = new Map()
|
||||
window.right_entityMap = new Map([...window._entityMap])
|
||||
}
|
||||
})
|
||||
},
|
||||
/* twoscreen() {
|
||||
|
||||
// window.earth = null
|
||||
//
|
||||
|
||||
this.$changeComponentShow(".tongbu", true)
|
||||
|
||||
this.halfEarth = !this.halfEarth
|
||||
|
||||
console.log(this.halfEarth)
|
||||
if (this.halfEarth) {
|
||||
$("#earth").addClass("halfEarth")
|
||||
$("#earths").addClass("halfEarth")
|
||||
$("#earths")[0].style.left = "50%"
|
||||
|
||||
|
||||
let earths = new YJ.YJEarth('earths')
|
||||
// YJ.setSecondEarth(earths.earth)
|
||||
// earths.earth.czm.viewer.scene.mode = Cesium.SceneMode.SCENE2D
|
||||
// earths.earth.czm.viewer.scene.screenSpaceCameraController.enableTranslate = true
|
||||
window.Earths = earths
|
||||
// console.log("earth", earths)
|
||||
// console.log(
|
||||
// earths.earth.sceneTree.$refs
|
||||
// )
|
||||
YJ.Global.setMode2D(earths.earth)
|
||||
|
||||
$("#earth").addClass("selectedEarthCss")
|
||||
|
||||
this.earthsDom.forEach(dom => {
|
||||
$("#" + dom)[0].addEventListener("click", this.callback, {capture: true})
|
||||
})
|
||||
|
||||
window.right_entityMap = new Map()
|
||||
window.left_entityMap = new Map([...window._entityMap])
|
||||
} else {
|
||||
this.$changeComponentShow(".tongbu", false)
|
||||
this.earthsDom.forEach(dom => {
|
||||
$("#" + dom)[0].removeEventListener("click", this.callback, {capture: true})
|
||||
$("#" + dom).removeClass("halfEarth")
|
||||
$("#" + dom).removeClass("selectedEarthCss")
|
||||
})
|
||||
window._entityMap = window.left_entityMap
|
||||
window.Earth1 = window.Earth
|
||||
window.Earths.earth.destroy()
|
||||
$("#earths").empty();
|
||||
window.Earths = null
|
||||
}
|
||||
|
||||
},*/
|
||||
tongbu2D() {
|
||||
let _this = this.$refs.tree
|
||||
get_source_list().then(response => {
|
||||
if ([0, 200].includes(response.code)) {
|
||||
let data = JSON.parse(JSON.stringify(response.data.list || []))
|
||||
data.sort(_this.keysort('tree_index'))
|
||||
//给node设置树形如icon;是否允许添加子节点,以及右键菜单
|
||||
|
||||
if (!window.right_entityMap)
|
||||
window.right_entityMap = new Map()
|
||||
|
||||
console.log("被同步的数据", data)
|
||||
console.log("被同步的数据", window.Earth1)
|
||||
console.log("window.right_entityMap", window.right_entityMap)
|
||||
data.forEach(node => {
|
||||
|
||||
|
||||
if (!window.right_entityMap.get(node.source_id) &&
|
||||
['model', 'point', 'line', 'panel',
|
||||
'circle', 'attackArrow',
|
||||
'pincerArrow', 'groundImage',
|
||||
'layer', 'ArcgisWXImagery'].includes(node.source_type)) {
|
||||
if (node.detail)
|
||||
node.detail = JSON.parse(node.detail)
|
||||
|
||||
//设置树上图标,并渲染到地球上
|
||||
_this.setOptions2d(node)
|
||||
}
|
||||
|
||||
})
|
||||
/*if (window.right_entityMap == 'undefined')
|
||||
window.right_entityMap = new Map()
|
||||
window.right_entityMap = new Map([...window._entityMap])*/
|
||||
}
|
||||
})
|
||||
},
|
||||
map2d() {
|
||||
this.$changeComponentShow(".tongbu", true)
|
||||
this.halfEarth = !this.halfEarth
|
||||
if (this.halfEarth) {
|
||||
$("#earth").addClass("halfEarth")
|
||||
$("#map2d").addClass("halfEarth")
|
||||
$("#map2d")[0].style.left = "50%"
|
||||
YJMap.on().then(() => {
|
||||
window.map2d = new YJMap.Map("map2d")
|
||||
new YJMap.Obj.Tms(map2d, {
|
||||
url: 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer',
|
||||
})
|
||||
|
||||
/* const projection = new ol.proj.Projection({
|
||||
code: 'EPSG:4326',
|
||||
extent: [-180, -90, 180, 90],
|
||||
metersPerUnit: 2 * Math.PI * 6378137 / 360
|
||||
})
|
||||
let GGLWLayer = new ol.layer.Tile({
|
||||
|
||||
source: new ol.source.XYZ({
|
||||
attributions:
|
||||
'Tiles © <a href="https://services.arcgisonline.com/ArcGIS/' +
|
||||
'rest/services/World_Topo_Map/MapServer">ArcGIS</a>',
|
||||
url:
|
||||
'https://server.arcgisonline.com/ArcGIS/rest/services/' +
|
||||
'World_Topo_Map/MapServer/tile/{z}/{y}/{x}',
|
||||
}),
|
||||
/!* source: new ol.source.XYZ({
|
||||
url: "http://t4.tianditu.com/DataServer?T=vec_c&x={x}&y={y}&l={z}&tk=d0cf74b31931aab68af181d23fa23d8d"
|
||||
}),
|
||||
visible: false*!/
|
||||
})
|
||||
window.Map = new ol.Map({
|
||||
target: "map2d",
|
||||
layers: [
|
||||
GGLWLayer
|
||||
],
|
||||
view: new ol.View({
|
||||
center: [106.814931000, 34.945231000, 16000],
|
||||
projection: projection,
|
||||
minZoom: 4,
|
||||
maxZoom: 21,
|
||||
// extent : maxExtent, //限定到地图视图拖动范围
|
||||
zoom: 5 // 地图初始化的缩放级别
|
||||
})
|
||||
})*/
|
||||
|
||||
$(".ol-control")[0].style.bottom = ".5em"
|
||||
$(".ol-zoom").css("top", '')
|
||||
})
|
||||
|
||||
} else {
|
||||
this.$changeComponentShow(".tongbu", false)
|
||||
this.earthsDom.forEach(dom => {
|
||||
$("#" + dom)[0].removeEventListener("click", this.callback, {capture: true})
|
||||
$("#" + dom).removeClass("halfEarth")
|
||||
$("#" + dom).removeClass("selectedEarthCss")
|
||||
})
|
||||
window._entityMap = window.left_entityMap
|
||||
// window.Earth1 = window.Earth
|
||||
// window.Earths.earth.destroy()
|
||||
$("#map2d").empty();
|
||||
window.Earths = null
|
||||
}
|
||||
},
|
||||
testglb() {
|
||||
|
||||
// let rocketPrimitive: Cesium.Model
|
||||
let position = Cesium.Cartesian3.fromDegrees(106.31598580143364, 29.62610729142745, 264.2444551526038);
|
||||
const hpRoll = new Cesium.HeadingPitchRoll();
|
||||
const fixedFrameTransform = Cesium.Transforms.localFrameToFixedFrameGenerator("north", "west");
|
||||
const rocketPrimitive = window.Earth1.earth._viewer.scene.primitives.add(
|
||||
Cesium.Model.fromGltf({
|
||||
url: "https://assets.agi.com/models/launchvehicle.glb",
|
||||
modelMatrix: Cesium.Transforms.headingPitchRollToFixedFrame(
|
||||
position,
|
||||
hpRoll,
|
||||
Cesium.Ellipsoid.WGS84,
|
||||
fixedFrameTransform
|
||||
),
|
||||
minimumPixelSize: 128,
|
||||
})
|
||||
);
|
||||
|
||||
/*rocketPrimitive.setArticulationStage( //对应属性改变参数值
|
||||
'SRBFlames Size',
|
||||
1
|
||||
);
|
||||
rocketPrimitive.applyArticulations(); //使得修改的属性生效*/
|
||||
window.rocketPrimitive = rocketPrimitive
|
||||
}
|
||||
}
|
||||
};
|
||||
export default test;
|
||||
Reference in New Issue
Block a user