Parcourir la source

极坐标指向图

caoziwu il y a 1 semaine
Parent
commit
1e36ffc226

BIN
src/renderer/src/assets/polar-plot/AM200-1.png


BIN
src/renderer/src/assets/polar-plot/AM200-2.png


BIN
src/renderer/src/assets/polar-plot/IPS-C1.png


BIN
src/renderer/src/assets/polar-plot/IPS-H1.png


BIN
src/renderer/src/assets/polar-plot/IPS-W1-1.png


BIN
src/renderer/src/assets/polar-plot/IPS-W1-2.png


BIN
src/renderer/src/assets/polar-plot/SQ10.png


+ 6 - 2
src/renderer/src/assets/simulator.less

@@ -85,14 +85,18 @@
   display: flex;
   gap: 12px;
   align-items: stretch;
+  .img-box {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+  }
 }
 .tabs-wrap {
   flex: 1;
   min-width: 0;
 }
 .result-wrap {
-  flex: 0 0 260px;
-  min-width: 200px;
+  flex: 0 0 220px;
 }
 
 /* 窄屏下堆叠为上下布局 */

+ 6 - 3
src/renderer/src/components/simulator/ParamsPanel.vue

@@ -16,6 +16,7 @@ const props = defineProps({
       powerMode: '',
       splMax: 0,
       hCov: 0,
+      polarPlot: {},
       vCov: 0
     })
   }
@@ -42,6 +43,7 @@ const modelOptions = devicesConfig.map((d) => ({
   value: d.model,
   horizontalAngle: d.horizontalAngle,
   verticalAngle: d.verticalAngle,
+  polarPlot: d.polarPlot,
   splMax: d.splMax
 }))
 
@@ -52,7 +54,8 @@ const powerMode = ref<string>('')
 const formData = reactive<FormDataType>({
   splMax: null,
   hCov: null,
-  vCov: null
+  vCov: null,
+  polarPlot: null
 })
 
 const currentSplMaxConfig = computed(() => {
@@ -86,6 +89,7 @@ const apply = (): void => {
     powerMode: powerMode.value,
     splMax: formData.splMax,
     hCov: formData.hCov,
+    polarPlot: device.polarPlot,
     vCov: formData.vCov
   }
   const data = {
@@ -102,8 +106,6 @@ const onSelectModel = (model: string | null): void => {
   const val = model || 'custom'
   selectedModel.value = val
   if (selectedModel.value == 'custom') {
-    console.log(selectedModel.value)
-
     powerMode.value = ''
   }
   if (val != 'custom' && powerModeOptions.value.length > 0 && !powerMode.value) {
@@ -133,6 +135,7 @@ watch(
     formData.splMax = newVal.splMax
     formData.hCov = newVal.hCov
     formData.vCov = newVal.vCov
+    formData.polarPlot = newVal.polarPlot
   },
   {
     immediate: true,

+ 12 - 1
src/renderer/src/components/simulator/SpeakerSimulator.vue

@@ -33,6 +33,7 @@ const defaultParams: SpeakerParams = {
   angle: 30,
   d1: 4,
   d2: 20,
+  polarPlot: null,
   d3: 10.39
 }
 
@@ -49,6 +50,7 @@ const deviceState = reactive<DevicePanelState>({
   powerMode: '',
   splMax: params.splMax,
   hCov: params.hCov,
+  polarPlot: params.polarPlot,
   vCov: params.vCov
 })
 const deviceFields: any[] = [
@@ -124,6 +126,10 @@ const updateField = (field: NumberParamKey, value: number): void => {
   params[field] = value
   runCalc()
 }
+const computedImage = () => {
+  const key = params.dir == 'H' ? 'horizontal' : 'vertical'
+  return deviceState.polarPlot[key]
+}
 
 /** 应用设备选型结果:仅覆盖非 null 的项 */
 const applySpec = (spec: DeviceSpec): void => {
@@ -196,7 +202,7 @@ runCalc()
     <NCard size="small" class="panel-card chart-card">
       <div class="chart-result-wrap">
         <div class="tabs-wrap">
-          <NTabs type="line" animated>
+          <NTabs type="line" animated size="small">
             <NTabPane name="diagram" :tab="$t('diagram.panel')">
               <DiagramPanel :params="params" :result="result" />
             </NTabPane>
@@ -211,6 +217,11 @@ runCalc()
             <NTabPane name="chart" :tab="$t('chart.panel')">
               <SPLChartPanel :params="params" :result="result" />
             </NTabPane>
+            <NTabPane name="Polar Plot" :tab="$t('chart.polarPlot')" v-if="deviceState.polarPlot">
+              <div class="img-box">
+                <n-image :src="computedImage()" width="90%"></n-image>
+              </div>
+            </NTabPane>
           </NTabs>
         </div>
         <div class="result-wrap">

+ 14 - 0
src/renderer/src/config/index.ts

@@ -1,3 +1,10 @@
+import AM2001 from '../assets/polar-plot/AM200-1.png'
+import IPSC1 from '../assets/polar-plot/IPS-C1.png'
+import IPSH1 from '../assets/polar-plot/IPS-H1.png'
+import IPSW11 from '../assets/polar-plot/IPS-W1-1.png'
+import IPSW12 from '../assets/polar-plot/IPS-W1-2.png'
+import SQ10 from '../assets/polar-plot/SQ10.png'
+
 export const devicesConfig = [
   {
     model: 'custom',
@@ -12,6 +19,7 @@ export const devicesConfig = [
     model: 'IPS-M1-BW',
     horizontalAngle: 60 * 2,
     verticalAngle: 60 * 2,
+    polarPlot: { horizontal: SQ10, vertical: SQ10 },
     splMax: {
       standalone: [
         { label: 'DC', value: 101 },
@@ -25,6 +33,7 @@ export const devicesConfig = [
     model: 'IPS-M1-D1W',
     horizontalAngle: 60 * 2,
     verticalAngle: 60 * 2,
+    polarPlot: { horizontal: SQ10, vertical: SQ10 },
     splMax: {
       standalone: [
         { label: 'DC', value: 101 },
@@ -38,6 +47,7 @@ export const devicesConfig = [
     model: 'IPS-M1-D2W',
     horizontalAngle: 70 * 2,
     verticalAngle: 70 * 2,
+    polarPlot: { horizontal: AM2001, vertical: AM2001 },
     splMax: {
       standalone: [
         { label: 'DC', value: 98 },
@@ -51,6 +61,7 @@ export const devicesConfig = [
     model: 'IPS-C1',
     horizontalAngle: 60 * 2,
     verticalAngle: 60 * 2,
+    polarPlot: { horizontal: IPSC1, vertical: IPSC1 },
     splMax: {
       standalone: [
         { label: 'DC', value: 97 },
@@ -68,6 +79,7 @@ export const devicesConfig = [
     model: 'IPS-W1',
     horizontalAngle: 60 * 2,
     verticalAngle: 70 * 2,
+    polarPlot: { horizontal: IPSW11, vertical: IPSW12 },
     splMax: {
       standalone: [
         { label: 'DC', value: 95 },
@@ -85,6 +97,7 @@ export const devicesConfig = [
     model: 'IPS-W1-R1',
     horizontalAngle: 60 * 2,
     verticalAngle: 70 * 2,
+    polarPlot: { horizontal: IPSW11, vertical: IPSW12 },
     splMax: {
       standalone: [
         { label: 'DC', value: 95 },
@@ -102,6 +115,7 @@ export const devicesConfig = [
     model: 'IPS-H1',
     horizontalAngle: 60 * 2,
     verticalAngle: 60 * 2,
+    polarPlot: { horizontal: IPSH1, vertical: IPSH1 },
     splMax: {
       standalone: [
         { label: 'DC', value: 118 },

+ 3 - 0
src/renderer/src/lib/speaker/types.ts

@@ -17,6 +17,7 @@ export interface DeviceParams {
   hCov: number
   /** 垂直指向角 (-6 dB) ° */
   vCov: number
+  polarPlot: any
 }
 
 /** 扬声器参数(与原始 HTML 输入一一对应) */
@@ -40,6 +41,7 @@ export interface SpeakerParams {
   /** 声学轴心参考点 m */
   d3: number
   /** 覆盖角度 ° */
+  polarPlot: any
   covAngle?: number
   /** 计算结果 */
   result?: CalcResult
@@ -110,4 +112,5 @@ export interface DevicePanelState {
   hCov: number | null
   /** 垂直指向角 (-6 dB) ° */
   vCov: number | null
+  polarPlot: any
 }

+ 1 - 0
src/renderer/src/locales/lang/en_US.json

@@ -89,6 +89,7 @@
   },
   "chart": {
     "panel": "SPL vs. Distance Chart",
+    "polarPlot": "Polar Plot",
     "empty": "Enter parameters and the SPL chart will be generated",
     "distance": "Distance (m)",
     "spl": "SPL (dB)",

+ 1 - 0
src/renderer/src/locales/lang/zh_CN.json

@@ -91,6 +91,7 @@
   },
   "chart": {
     "panel": "声压级曲线图",
+    "polarPlot": "极坐标指向性图",
     "empty": "请输入参数后自动生成声压级曲线图",
     "distance": "距离 (m)",
     "spl": "声压级 (dB SPL)",