软件升级
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
import { app, screen, globalShortcut, BrowserWindow, ipcMain, dialog } from 'electron'
|
||||
import { join } from "path"
|
||||
import config from './config'
|
||||
import config from './config.js'
|
||||
import './load-serialport'
|
||||
import { keyword } from './KeyWord'
|
||||
|
||||
const child_process = require('child_process')
|
||||
const crypto = require('crypto')
|
||||
import child_process from 'child_process'
|
||||
import crypto from 'crypto'
|
||||
|
||||
function queryPass(passPath: string, passValue: string) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
try {
|
||||
child_process.exec(`reg query ${passPath} /v ${passValue}`, (error: Error, stdout: string, stderr: string) => {
|
||||
child_process.exec(`reg query ${passPath} /v ${passValue}`, (error: Error | null, stdout: string, stderr: string) => {
|
||||
if (error) {
|
||||
reject(error)
|
||||
return
|
||||
@@ -26,7 +26,7 @@ function queryPass(passPath: string, passValue: string) {
|
||||
function queryKey(keyPath: string, keyValue: string) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
try {
|
||||
child_process.exec(`reg query ${keyPath} /v ${keyValue}`, (error: Error, stdout: string, stderr: string) => {
|
||||
child_process.exec(`reg query ${keyPath} /v ${keyValue}`, (error: Error | null, stdout: string, stderr: string) => {
|
||||
if (error) {
|
||||
reject(error)
|
||||
return
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import Store from 'electron-store'
|
||||
// import Store from 'electron-store'
|
||||
const Store = require('electron-store')
|
||||
|
||||
const store = new Store()
|
||||
const set = (key, val) => store.set(key, val)
|
||||
|
||||
const get = (key) => store.get(key)
|
||||
|
||||
export default {set, get}
|
||||
// export default {set, get}
|
||||
module.exports = { set, get }
|
||||
@@ -1,6 +1,6 @@
|
||||
import SerialPort from 'serialport'
|
||||
import InterByteTimeout from '@serialport/parser-inter-byte-timeout'
|
||||
import config from './config'
|
||||
import { SerialPort } from 'serialport'
|
||||
import { InterByteTimeoutParser } from '@serialport/parser-inter-byte-timeout'
|
||||
import config from './config.js'
|
||||
import sendMsg from './ipcRendererManager'
|
||||
import NMEAHandler from './api/NMEAHandler'
|
||||
|
||||
@@ -10,7 +10,6 @@ const getSerialPortConstructorArguments = (ports) => {
|
||||
ports = ports.filter((port) => port.path != 'COM1')
|
||||
if (ports.length == 0) return
|
||||
|
||||
// console.log(ports, '=====================')
|
||||
const serialport = config.get('serialport')
|
||||
const path = ( serialport && serialport.path ) ? serialport.path : ports[0].path
|
||||
const baudRate = ( serialport && serialport.baudRate ) ? serialport.baudRate : DEFAULT_BAUDRATE
|
||||
@@ -27,9 +26,8 @@ const openSerialport = (ports) => {
|
||||
|
||||
const { path, baudRate } = constructorArguments
|
||||
|
||||
// console.log(path, baudRate, '++++++++++++++===');
|
||||
const serialPort = new SerialPort(path, { baudRate })
|
||||
const parser = serialPort.pipe(new InterByteTimeout({interval: 300}))
|
||||
const serialPort = new SerialPort({ path, baudRate })
|
||||
const parser = serialPort.pipe(new InterByteTimeoutParser({interval: 300}))
|
||||
|
||||
NMEAHandler.on('received' , (nmeaStr) => {
|
||||
sendMsg('NMEA_RECEIVED', nmeaStr)
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
<div class="text-center w-1/2 ml-auto">
|
||||
<BaseInfoView ref="baseInfoViewInstance" />
|
||||
</div>
|
||||
<div class="text-white fixed bottom-0 right-0">
|
||||
北斗卫星数据监测展示互动系统V1.0
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -1,58 +1,56 @@
|
||||
<template>
|
||||
<vc-viewer :shouldAnimate="true" :showCredit="false" :infoBox="false" @ready="onViewerReady">
|
||||
<vc-layer-imagery>
|
||||
<vc-provider-imagery-singletile :url="earth" />
|
||||
</vc-layer-imagery>
|
||||
<vc-config-provider :cesiumPath="cesiumPath">
|
||||
<vc-viewer :shouldAnimate="true" :showCredit="false" :infoBox="false" @ready="onViewerReady">
|
||||
<vc-layer-imagery>
|
||||
<vc-imagery-provider-singletile :url="earth" />
|
||||
</vc-layer-imagery>
|
||||
|
||||
<vc-entity :show="show" :position="position">
|
||||
<vc-graphics-billboard :image="pin" :verticalOrigin="1" />
|
||||
</vc-entity>
|
||||
</vc-viewer>
|
||||
<vc-entity :show="show" :position="position">
|
||||
<vc-graphics-billboard :image="pin" :verticalOrigin="1" />
|
||||
</vc-entity>
|
||||
</vc-viewer>
|
||||
</vc-config-provider>
|
||||
</template>
|
||||
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { reactive, computed } from 'vue'
|
||||
import { getPosition } from '../api/util'
|
||||
import pin from '../assets/pin.png'
|
||||
import earth from '../assets/earth.jpg'
|
||||
import { reactive, computed } from "vue";
|
||||
import { getPosition } from "../api/util";
|
||||
import pin from "../assets/pin.png";
|
||||
import earth from "../assets/earth.jpg";
|
||||
|
||||
const position = reactive({ lng: NaN, lat: NaN })
|
||||
const show = computed(() => {
|
||||
const { lng, lat } = position
|
||||
const cesiumPath = (process.env.NODE_ENV === 'development' ? './node_modules/cesium/Build/Cesium/Cesium.js': './Cesium/Cesium.js')
|
||||
const position = reactive({ lng: NaN, lat: NaN });
|
||||
const show = computed(() => {
|
||||
const { lng, lat } = position;
|
||||
|
||||
if (isNaN(lng) || lng > 180 || lng < -180) return false
|
||||
if (isNaN(lat) || lat > 90 || lat < -90 ) return false
|
||||
if (isNaN(lng) || lng > 180 || lng < -180) return false;
|
||||
if (isNaN(lat) || lat > 90 || lat < -90) return false;
|
||||
|
||||
return true
|
||||
})
|
||||
return true;
|
||||
});
|
||||
|
||||
// 设置地球自转动画效果
|
||||
const onViewerReady = ({ Cesium, viewer }) => {
|
||||
const { JulianDate, Cartesian3 } = Cesium
|
||||
const { clock, scene } = viewer
|
||||
const { JulianDate, Cartesian3 } = Cesium;
|
||||
const { clock, scene } = viewer;
|
||||
|
||||
let prev = clock.currentTime
|
||||
let prev = clock.currentTime;
|
||||
clock.onTick.addEventListener(() => {
|
||||
const current = clock.currentTime
|
||||
const current = clock.currentTime;
|
||||
|
||||
const interval = JulianDate.toDate(current) - JulianDate.toDate(prev)
|
||||
prev = current
|
||||
|
||||
scene.camera.rotate(
|
||||
Cartesian3.UNIT_Z,
|
||||
(Math.PI / (24 * 60 * 60)) * interval * 1,
|
||||
);
|
||||
})
|
||||
}
|
||||
const interval = JulianDate.toDate(current) - JulianDate.toDate(prev);
|
||||
prev = current;
|
||||
|
||||
scene.camera.rotate(Cartesian3.UNIT_Z, (Math.PI / (24 * 60 * 60)) * interval * 1);
|
||||
});
|
||||
};
|
||||
|
||||
const update = (nmea) => {
|
||||
const newPosition = getPosition(nmea)
|
||||
if (!newPosition) return
|
||||
|
||||
Object.assign(position, newPosition)
|
||||
}
|
||||
const newPosition = getPosition(nmea);
|
||||
if (!newPosition) return;
|
||||
|
||||
defineExpose({ update })
|
||||
</script>
|
||||
Object.assign(position, newPosition);
|
||||
};
|
||||
|
||||
defineExpose({ update });
|
||||
</script>
|
||||
|
||||
@@ -47,7 +47,7 @@ const option = reactive({
|
||||
inverse: true,
|
||||
axisLine: {show: false},
|
||||
axisTick: {show: false},
|
||||
axisLabel: {color: 'white'}
|
||||
axisLabel: {color: 'white', fontSize: '12'},
|
||||
},
|
||||
series: [{
|
||||
type: 'bar',
|
||||
|
||||
@@ -2,14 +2,10 @@ import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
|
||||
import 'vue-cesium/dist/index.css'
|
||||
import { VcViewer, VcEntity, VcLayerImagery, VcProviderImagerySingletile, VcGraphicsBillboard } from 'vue-cesium'
|
||||
import { VcConfigProvider, VcViewer, VcEntity, VcLayerImagery, VcImageryProviderSingletile, VcGraphicsBillboard } from 'vue-cesium'
|
||||
|
||||
import './main.css'
|
||||
|
||||
const cesiumPath = (process.env.NODE_ENV === 'development' ? './node_modules/cesium/Build/Cesium/Cesium.js': './Cesium/Cesium.js')
|
||||
|
||||
const app = createApp(App)
|
||||
// 局部引入VueCesium
|
||||
app.use(VcViewer).use(VcEntity).use(VcLayerImagery).use(VcProviderImagerySingletile).use(VcGraphicsBillboard)
|
||||
app.config.globalProperties.$VueCesium = { cesiumPath }
|
||||
app.use(VcConfigProvider).use(VcViewer).use(VcEntity).use(VcLayerImagery).use(VcImageryProviderSingletile).use(VcGraphicsBillboard)
|
||||
app.mount('#app')
|
||||
Reference in New Issue
Block a user