Compare commits
5
Commits
19b7b10e97
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
48126f7f80 | ||
|
|
162bc73395 | ||
|
|
4929d5dcd5 | ||
|
|
dd6edce089 | ||
|
|
29e90bbc7b |
@@ -364,3 +364,12 @@ FodyWeavers.xsd
|
|||||||
/.vscode
|
/.vscode
|
||||||
/.gitignore
|
/.gitignore
|
||||||
/Visual Studio 18/Visualizers
|
/Visual Studio 18/Visualizers
|
||||||
|
/HardwareControl.Core/Models/1.anyseg_birefnet_1024.onnx
|
||||||
|
/HardwareControl.Core/Models/2.material_model.onnx
|
||||||
|
/HardwareControl.Core/Models/3.sample-segmentation.onnx
|
||||||
|
/HardwareControl.Core/Models/4.yoloe-26s-seg.onnx
|
||||||
|
/HardwareControl.Core/IR/anyseg_1024_ir.bin
|
||||||
|
/HardwareControl.Core/IR/anyseg_1024_ir.xml
|
||||||
|
/HardwareControl.Core/Models/1.material_model.onnx
|
||||||
|
/HardwareControl.Core/Models/2.sample-segmentation.onnx
|
||||||
|
/HardwareControl.Core/Models/3.yoloe-26s-seg.onnx
|
||||||
|
|||||||
@@ -0,0 +1,82 @@
|
|||||||
|
/**
|
||||||
|
* 设备连接状态接口封装。
|
||||||
|
* 后端实现见 HardwareWeb/Controllers/DeviceController.cs:
|
||||||
|
* GET /api/devices/status -> { allConnected, devices, updatedAt }
|
||||||
|
* POST /api/devices/retry -> 同上
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface DeviceStatusItem {
|
||||||
|
key: string
|
||||||
|
name: string
|
||||||
|
connected: boolean
|
||||||
|
status: string
|
||||||
|
message: string | null
|
||||||
|
updatedAt: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DeviceStatus {
|
||||||
|
allConnected: boolean
|
||||||
|
devices: DeviceStatusItem[]
|
||||||
|
updatedAt: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const API_BASE = (import.meta.env.VITE_API_BASE ?? '').replace(/\/$/, '')
|
||||||
|
const REQUEST_TIMEOUT = 30000
|
||||||
|
|
||||||
|
export class DeviceApiError extends Error {
|
||||||
|
readonly status: number
|
||||||
|
|
||||||
|
constructor(message: string, status = 0) {
|
||||||
|
super(message)
|
||||||
|
this.name = 'DeviceApiError'
|
||||||
|
this.status = status
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function request<T>(path: string, init?: RequestInit): Promise<T> {
|
||||||
|
const controller = new AbortController()
|
||||||
|
const timer = window.setTimeout(() => controller.abort(), REQUEST_TIMEOUT)
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch(`${API_BASE}${path}`, {
|
||||||
|
...init,
|
||||||
|
cache: 'no-store',
|
||||||
|
signal: controller.signal,
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/json',
|
||||||
|
...(init?.headers ?? {}),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
let detail = `HTTP ${response.status}`
|
||||||
|
try {
|
||||||
|
const body = (await response.json()) as { message?: string; error?: string }
|
||||||
|
detail = body.message ?? body.error ?? detail
|
||||||
|
} catch {
|
||||||
|
// 非 JSON 响应时保留状态码
|
||||||
|
}
|
||||||
|
throw new DeviceApiError(detail, response.status)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (await response.json()) as T
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof DeviceApiError) throw error
|
||||||
|
if (error instanceof DOMException && error.name === 'AbortError') {
|
||||||
|
throw new DeviceApiError('设备服务响应超时')
|
||||||
|
}
|
||||||
|
throw new DeviceApiError(
|
||||||
|
error instanceof Error ? error.message : '无法连接设备服务',
|
||||||
|
)
|
||||||
|
} finally {
|
||||||
|
window.clearTimeout(timer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDeviceStatus(): Promise<DeviceStatus> {
|
||||||
|
return request<DeviceStatus>('/api/devices/status')
|
||||||
|
}
|
||||||
|
|
||||||
|
export function retryDevices(): Promise<DeviceStatus> {
|
||||||
|
return request<DeviceStatus>('/api/devices/retry', { method: 'POST' })
|
||||||
|
}
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
/**
|
||||||
|
* 靶样轮廓识别与采样点规划接口封装。
|
||||||
|
* 后端实现见 HardwareWeb/Controllers/SampleAnalysisController.cs:
|
||||||
|
* POST /api/sample/analyze -> { imageBase64, mimeType, width, height, samplingPointCount, samplingPoints }
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface SamplePoint {
|
||||||
|
x: number
|
||||||
|
y: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SampleAnalysisResult {
|
||||||
|
imageBase64: string
|
||||||
|
mimeType: string
|
||||||
|
width: number
|
||||||
|
height: number
|
||||||
|
samplingPointCount: number
|
||||||
|
samplingPoints: SamplePoint[]
|
||||||
|
}
|
||||||
|
|
||||||
|
const API_BASE = (import.meta.env.VITE_API_BASE ?? '').replace(/\/$/, '')
|
||||||
|
const DEFAULT_TIMEOUT = 15000
|
||||||
|
// 轮廓识别的等待时间优先取系统参数 camera_Identification_outtime,
|
||||||
|
// 读取失败时使用该默认值。
|
||||||
|
const DEFAULT_ANALYZE_TIMEOUT = 60000
|
||||||
|
|
||||||
|
export class SampleApiError extends Error {
|
||||||
|
readonly status: number
|
||||||
|
|
||||||
|
constructor(message: string, status = 0) {
|
||||||
|
super(message)
|
||||||
|
this.name = 'SampleApiError'
|
||||||
|
this.status = status
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function request<T>(
|
||||||
|
path: string,
|
||||||
|
init?: RequestInit,
|
||||||
|
timeout = DEFAULT_TIMEOUT,
|
||||||
|
): Promise<T> {
|
||||||
|
const controller = new AbortController()
|
||||||
|
const timer = window.setTimeout(() => controller.abort(), timeout)
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch(`${API_BASE}${path}`, {
|
||||||
|
...init,
|
||||||
|
cache: 'no-store',
|
||||||
|
signal: controller.signal,
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/json',
|
||||||
|
...(init?.headers ?? {}),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
let detail = `HTTP ${response.status}`
|
||||||
|
try {
|
||||||
|
const body = (await response.json()) as { message?: string; error?: string }
|
||||||
|
detail = body.message ?? body.error ?? detail
|
||||||
|
} catch {
|
||||||
|
// 响应不是 JSON 时保留状态码信息
|
||||||
|
}
|
||||||
|
throw new SampleApiError(detail, response.status)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (await response.json()) as T
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof SampleApiError) throw error
|
||||||
|
if (error instanceof DOMException && error.name === 'AbortError') {
|
||||||
|
throw new SampleApiError(
|
||||||
|
`图像分析服务响应超时(等待上限 ${Math.round(timeout / 1000)} 秒)`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
throw new SampleApiError(
|
||||||
|
error instanceof Error ? error.message : '无法连接图像分析服务',
|
||||||
|
)
|
||||||
|
} finally {
|
||||||
|
window.clearTimeout(timer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 读取系统参数 camera_Identification_outtime 换算的等待超时(毫秒)。 */
|
||||||
|
export async function getAnalyzeTimeoutMs(): Promise<number> {
|
||||||
|
try {
|
||||||
|
const result = await request<{ timeoutSeconds: number }>(
|
||||||
|
'/api/sample/analyze-timeout',
|
||||||
|
)
|
||||||
|
return result.timeoutSeconds > 0
|
||||||
|
? result.timeoutSeconds * 1000
|
||||||
|
: DEFAULT_ANALYZE_TIMEOUT
|
||||||
|
} catch {
|
||||||
|
return DEFAULT_ANALYZE_TIMEOUT
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提取靶样轮廓、绘制采样点并返回处理后的图像。 */
|
||||||
|
export function analyzeSample(
|
||||||
|
timeout = DEFAULT_ANALYZE_TIMEOUT,
|
||||||
|
): Promise<SampleAnalysisResult> {
|
||||||
|
return request<SampleAnalysisResult>(
|
||||||
|
'/api/sample/analyze',
|
||||||
|
{ method: 'POST' },
|
||||||
|
timeout,
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,197 @@
|
|||||||
|
/**
|
||||||
|
* 扫描流程接口封装。
|
||||||
|
* 后端实现见 HardwareWeb/Controllers/ScanController.cs:
|
||||||
|
* POST /api/scan/start -> { scanId, totalPoints }
|
||||||
|
* POST /api/scan/abort -> { aborted }
|
||||||
|
* GET /api/scan/current -> ScanProgress
|
||||||
|
* GET /api/scan/latest -> ScanRun
|
||||||
|
* GET /api/scan/{scanId} -> ScanRun
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface ScanProgress {
|
||||||
|
scanId: string
|
||||||
|
phase: string
|
||||||
|
pointIndex: number
|
||||||
|
totalPoints: number
|
||||||
|
completedPoints: number
|
||||||
|
percent: number
|
||||||
|
message: string
|
||||||
|
stageX: number
|
||||||
|
stageY: number
|
||||||
|
stageMoving: boolean
|
||||||
|
updatedAt: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ScanSegment {
|
||||||
|
deviceIndex: number
|
||||||
|
serialNumber: string
|
||||||
|
wavelengthStart: number
|
||||||
|
wavelengthEnd: number
|
||||||
|
pointCount: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ScanElement {
|
||||||
|
symbol: string
|
||||||
|
name: string
|
||||||
|
intensityLevel: string
|
||||||
|
abundance: number
|
||||||
|
rawAbundance: number
|
||||||
|
verdict: string
|
||||||
|
maxIntensity: number
|
||||||
|
matchedWavelength: number
|
||||||
|
matchedLines: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ScanPointResult {
|
||||||
|
index: number
|
||||||
|
pixelX: number
|
||||||
|
pixelY: number
|
||||||
|
stageX: number
|
||||||
|
stageY: number
|
||||||
|
succeeded: boolean
|
||||||
|
error: string | null
|
||||||
|
wavelengths: number[]
|
||||||
|
spectrum: number[]
|
||||||
|
segments: ScanSegment[]
|
||||||
|
elements: ScanElement[]
|
||||||
|
temperature: number
|
||||||
|
electronDensity: number
|
||||||
|
acquiredAt: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ScanRun {
|
||||||
|
scanId: string
|
||||||
|
status: string
|
||||||
|
startedAt: string
|
||||||
|
finishedAt: string | null
|
||||||
|
error: string | null
|
||||||
|
totalPoints: number
|
||||||
|
completedPoints: number
|
||||||
|
imageWidth: number
|
||||||
|
imageHeight: number
|
||||||
|
imageMimeType: string | null
|
||||||
|
imageBase64: string | null
|
||||||
|
points: ScanPointResult[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ScanStartResult {
|
||||||
|
scanId: string
|
||||||
|
totalPoints: number
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 历史列表中的一条扫描记录(不含图片与光谱数据)。 */
|
||||||
|
export interface ScanHistoryItem {
|
||||||
|
scanId: string
|
||||||
|
status: string
|
||||||
|
startedAt: string
|
||||||
|
finishedAt: string | null
|
||||||
|
totalPoints: number
|
||||||
|
completedPoints: number
|
||||||
|
error: string | null
|
||||||
|
}
|
||||||
|
|
||||||
|
const API_BASE = (import.meta.env.VITE_API_BASE ?? '').replace(/\/$/, '')
|
||||||
|
const DEFAULT_TIMEOUT = 15000
|
||||||
|
const START_TIMEOUT = 60000
|
||||||
|
const RESULT_TIMEOUT = 30000
|
||||||
|
|
||||||
|
export class ScanApiError extends Error {
|
||||||
|
readonly status: number
|
||||||
|
|
||||||
|
constructor(message: string, status = 0) {
|
||||||
|
super(message)
|
||||||
|
this.name = 'ScanApiError'
|
||||||
|
this.status = status
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function request<T>(
|
||||||
|
path: string,
|
||||||
|
init?: RequestInit,
|
||||||
|
timeout = DEFAULT_TIMEOUT,
|
||||||
|
): Promise<T> {
|
||||||
|
const controller = new AbortController()
|
||||||
|
const timer = window.setTimeout(() => controller.abort(), timeout)
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch(`${API_BASE}${path}`, {
|
||||||
|
...init,
|
||||||
|
cache: 'no-store',
|
||||||
|
signal: controller.signal,
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/json',
|
||||||
|
...(init?.headers ?? {}),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
let detail = `HTTP ${response.status}`
|
||||||
|
try {
|
||||||
|
const body = (await response.json()) as { message?: string; error?: string }
|
||||||
|
detail = body.message ?? body.error ?? detail
|
||||||
|
} catch {
|
||||||
|
// 非 JSON 响应时保留状态码
|
||||||
|
}
|
||||||
|
throw new ScanApiError(detail, response.status)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (await response.json()) as T
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof ScanApiError) throw error
|
||||||
|
if (error instanceof DOMException && error.name === 'AbortError') {
|
||||||
|
throw new ScanApiError('扫描服务响应超时')
|
||||||
|
}
|
||||||
|
throw new ScanApiError(
|
||||||
|
error instanceof Error ? error.message : '无法连接扫描服务',
|
||||||
|
)
|
||||||
|
} finally {
|
||||||
|
window.clearTimeout(timer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 开始一次扫描(后台任务,立即返回)。 */
|
||||||
|
export function startScan(): Promise<ScanStartResult> {
|
||||||
|
return request<ScanStartResult>(
|
||||||
|
'/api/scan/start',
|
||||||
|
{ method: 'POST' },
|
||||||
|
START_TIMEOUT,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 中止当前扫描:停止流程、丢弃数据并回零。 */
|
||||||
|
export function abortScan(): Promise<{ aborted: boolean }> {
|
||||||
|
return request<{ aborted: boolean }>('/api/scan/abort', { method: 'POST' })
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getCurrentScan(): Promise<ScanProgress> {
|
||||||
|
return request<ScanProgress>('/api/scan/current')
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getScan(scanId: string): Promise<ScanRun> {
|
||||||
|
return request<ScanRun>(
|
||||||
|
`/api/scan/${encodeURIComponent(scanId)}`,
|
||||||
|
undefined,
|
||||||
|
RESULT_TIMEOUT,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getLatestScan(): Promise<ScanRun> {
|
||||||
|
return request<ScanRun>('/api/scan/latest', undefined, RESULT_TIMEOUT)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 历史扫描记录列表(按开始时间倒序)。 */
|
||||||
|
export function getScanHistory(limit = 100): Promise<ScanHistoryItem[]> {
|
||||||
|
return request<ScanHistoryItem[]>(`/api/scan/history?limit=${limit}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除一条历史扫描记录及其采样点。 */
|
||||||
|
export function deleteScan(scanId: string): Promise<{ deleted: boolean }> {
|
||||||
|
return request<{ deleted: boolean }>(
|
||||||
|
`/api/scan/${encodeURIComponent(scanId)}`,
|
||||||
|
{ method: 'DELETE' },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getStageHubUrl(): string {
|
||||||
|
return `${API_BASE}/stageHub`
|
||||||
|
}
|
||||||
@@ -0,0 +1,350 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { nextTick, onBeforeUnmount, ref, watch } from 'vue'
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
open: boolean
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
close: []
|
||||||
|
'system-config': []
|
||||||
|
ruler: []
|
||||||
|
history: []
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const firstButton = ref<HTMLButtonElement | null>(null)
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
emit('close')
|
||||||
|
}
|
||||||
|
|
||||||
|
function onKeydown(event: KeyboardEvent) {
|
||||||
|
if (event.key === 'Escape') close()
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.open,
|
||||||
|
async (open) => {
|
||||||
|
if (open) {
|
||||||
|
window.addEventListener('keydown', onKeydown)
|
||||||
|
await nextTick()
|
||||||
|
firstButton.value?.focus()
|
||||||
|
} else {
|
||||||
|
window.removeEventListener('keydown', onKeydown)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
window.removeEventListener('keydown', onKeydown)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Teleport to="body">
|
||||||
|
<Transition name="function-panel">
|
||||||
|
<div v-if="open" class="panel-backdrop" @click.self="close">
|
||||||
|
<section
|
||||||
|
class="panel-card"
|
||||||
|
role="dialog"
|
||||||
|
aria-modal="true"
|
||||||
|
aria-label="管理员功能选择"
|
||||||
|
>
|
||||||
|
<header class="panel-card__header">
|
||||||
|
<h2>管理员功能</h2>
|
||||||
|
<p>请选择需要进入的功能</p>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="panel-grid">
|
||||||
|
<button
|
||||||
|
ref="firstButton"
|
||||||
|
class="function-card"
|
||||||
|
type="button"
|
||||||
|
@click="emit('system-config')"
|
||||||
|
>
|
||||||
|
<span class="function-card__icon" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 64 64">
|
||||||
|
<path
|
||||||
|
d="M26 8h12l2 7a20 20 0 0 1 5 3l7-1 6 10-5 5a20 20 0 0 1 0 6l5 5-6 10-7-1a20 20 0 0 1-5 3l-2 7H26l-2-7a20 20 0 0 1-5-3l-7 1-6-10 5-5a20 20 0 0 1 0-6l-5-5 6-10 7 1a20 20 0 0 1 5-3Z"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="3"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
/>
|
||||||
|
<circle
|
||||||
|
cx="32"
|
||||||
|
cy="32"
|
||||||
|
r="8"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="3"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<span class="function-card__label">参数设置</span>
|
||||||
|
<span class="function-card__desc">管理系统运行参数</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="function-card"
|
||||||
|
type="button"
|
||||||
|
@click="emit('ruler')"
|
||||||
|
>
|
||||||
|
<span class="function-card__icon" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 64 64">
|
||||||
|
<rect
|
||||||
|
x="7"
|
||||||
|
y="22"
|
||||||
|
width="50"
|
||||||
|
height="20"
|
||||||
|
rx="3"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="3"
|
||||||
|
transform="rotate(-12 32 32)"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M16 26v7M24 24v7M32 22v7M40 20v7M48 18v7"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="3"
|
||||||
|
stroke-linecap="round"
|
||||||
|
transform="rotate(-12 32 32)"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<span class="function-card__label">标尺设定</span>
|
||||||
|
<span class="function-card__desc">配置标尺与校准参数</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="function-card"
|
||||||
|
type="button"
|
||||||
|
@click="emit('history')"
|
||||||
|
>
|
||||||
|
<span class="function-card__icon" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 64 64">
|
||||||
|
<circle
|
||||||
|
cx="32"
|
||||||
|
cy="32"
|
||||||
|
r="22"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="3"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M32 19v14l9 5"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="3"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<span class="function-card__label">查看历史</span>
|
||||||
|
<span class="function-card__desc">浏览历史检测记录</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button class="panel-card__close" type="button" @click="close">
|
||||||
|
取消
|
||||||
|
</button>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</Transition>
|
||||||
|
</Teleport>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.panel-backdrop {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
z-index: 70;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
padding: 24px;
|
||||||
|
background: rgba(3, 8, 18, 0.68);
|
||||||
|
backdrop-filter: blur(8px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-card {
|
||||||
|
position: relative;
|
||||||
|
width: 980px;
|
||||||
|
padding: 42px 46px 34px;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid rgba(130, 175, 255, 0.2);
|
||||||
|
border-radius: 26px;
|
||||||
|
background: linear-gradient(158deg, rgba(22, 42, 78, 0.98) 0%, rgba(8, 16, 32, 0.99) 100%);
|
||||||
|
box-shadow:
|
||||||
|
0 40px 90px rgba(0, 6, 20, 0.6),
|
||||||
|
0 0 50px rgba(48, 118, 255, 0.12),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.08);
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-card::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 48px;
|
||||||
|
left: 48px;
|
||||||
|
height: 1px;
|
||||||
|
background: linear-gradient(90deg, transparent, rgba(130, 214, 255, 0.55), transparent);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-card__header h2 {
|
||||||
|
color: #eef5ff;
|
||||||
|
font-size: 32px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
text-shadow: 0 0 26px rgba(80, 150, 255, 0.28);
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-card__header p {
|
||||||
|
margin-top: 12px;
|
||||||
|
color: rgba(158, 190, 226, 0.7);
|
||||||
|
font-size: 19px;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||||
|
gap: 24px;
|
||||||
|
margin-top: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.function-card {
|
||||||
|
--accent-1: #6fb0ff;
|
||||||
|
--accent-2: #2f6fd0;
|
||||||
|
--accent-glow: rgba(70, 140, 255, 0.28);
|
||||||
|
--accent-line: rgba(111, 176, 255, 0.5);
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 30px 24px 28px;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.09);
|
||||||
|
border-radius: 20px;
|
||||||
|
background:
|
||||||
|
radial-gradient(135% 105% at 106% -6%, var(--accent-glow) 0%, transparent 52%),
|
||||||
|
linear-gradient(
|
||||||
|
158deg,
|
||||||
|
rgba(255, 255, 255, 0.08) 0%,
|
||||||
|
rgba(255, 255, 255, 0.02) 58%,
|
||||||
|
rgba(255, 255, 255, 0.045) 100%
|
||||||
|
);
|
||||||
|
box-shadow:
|
||||||
|
0 18px 40px rgba(1, 8, 24, 0.42),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.1);
|
||||||
|
transition:
|
||||||
|
transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
|
||||||
|
border-color 0.25s ease,
|
||||||
|
box-shadow 0.25s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.function-card:nth-child(2) {
|
||||||
|
--accent-1: #5ce3d6;
|
||||||
|
--accent-2: #109c91;
|
||||||
|
--accent-glow: rgba(40, 200, 188, 0.24);
|
||||||
|
--accent-line: rgba(92, 227, 214, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.function-card:nth-child(3) {
|
||||||
|
--accent-1: #ffd166;
|
||||||
|
--accent-2: #e08f00;
|
||||||
|
--accent-glow: rgba(255, 176, 32, 0.24);
|
||||||
|
--accent-line: rgba(255, 203, 92, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.function-card:hover {
|
||||||
|
border-color: var(--accent-line);
|
||||||
|
box-shadow:
|
||||||
|
0 26px 52px rgba(1, 8, 24, 0.55),
|
||||||
|
0 0 0 1px var(--accent-glow),
|
||||||
|
0 0 34px var(--accent-glow),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.14);
|
||||||
|
transform: translateY(-4px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.function-card__icon {
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
width: 88px;
|
||||||
|
height: 88px;
|
||||||
|
border-radius: 24px;
|
||||||
|
background: linear-gradient(150deg, var(--accent-1) 0%, var(--accent-2) 100%);
|
||||||
|
box-shadow:
|
||||||
|
0 14px 28px var(--accent-glow),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.4);
|
||||||
|
color: #f4f9ff;
|
||||||
|
transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.function-card__icon svg {
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
filter: drop-shadow(0 2px 6px rgba(4, 16, 40, 0.35));
|
||||||
|
}
|
||||||
|
|
||||||
|
.function-card:hover .function-card__icon {
|
||||||
|
transform: scale(1.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
.function-card__label {
|
||||||
|
color: #f3f8ff;
|
||||||
|
font-size: 26px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.function-card__desc {
|
||||||
|
color: rgba(158, 190, 226, 0.6);
|
||||||
|
font-size: 17px;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-card__close {
|
||||||
|
width: 180px;
|
||||||
|
height: 54px;
|
||||||
|
margin-top: 30px;
|
||||||
|
border: 1px solid rgba(130, 175, 255, 0.28);
|
||||||
|
border-radius: 12px;
|
||||||
|
background: rgba(18, 40, 78, 0.5);
|
||||||
|
color: #bcd9ff;
|
||||||
|
font-size: 19px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 3px;
|
||||||
|
transition: background 0.2s ease, border-color 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-card__close:hover {
|
||||||
|
border-color: rgba(150, 205, 255, 0.5);
|
||||||
|
background: rgba(30, 66, 128, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.function-panel-enter-active,
|
||||||
|
.function-panel-leave-active {
|
||||||
|
transition: opacity 0.24s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.function-panel-enter-active .panel-card,
|
||||||
|
.function-panel-leave-active .panel-card {
|
||||||
|
transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.function-panel-enter-from,
|
||||||
|
.function-panel-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.function-panel-enter-from .panel-card,
|
||||||
|
.function-panel-leave-to .panel-card {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(16px) scale(0.97);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -11,7 +11,10 @@ const emit = defineEmits<{
|
|||||||
success: []
|
success: []
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const password = ref('')
|
/** 默认填入测试密码,开发与正式环境均生效;上线前需改回空字符串 */
|
||||||
|
const DEFAULT_PASSWORD = '123456'
|
||||||
|
|
||||||
|
const password = ref(DEFAULT_PASSWORD)
|
||||||
const error = ref('')
|
const error = ref('')
|
||||||
const submitting = ref(false)
|
const submitting = ref(false)
|
||||||
const inputElement = ref<HTMLInputElement | null>(null)
|
const inputElement = ref<HTMLInputElement | null>(null)
|
||||||
@@ -51,7 +54,7 @@ watch(
|
|||||||
() => props.open,
|
() => props.open,
|
||||||
async (open) => {
|
async (open) => {
|
||||||
if (open) {
|
if (open) {
|
||||||
password.value = ''
|
password.value = DEFAULT_PASSWORD
|
||||||
error.value = ''
|
error.value = ''
|
||||||
window.addEventListener('keydown', onKeydown)
|
window.addEventListener('keydown', onKeydown)
|
||||||
await nextTick()
|
await nextTick()
|
||||||
@@ -142,17 +145,21 @@ onBeforeUnmount(() => {
|
|||||||
display: grid;
|
display: grid;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
padding: 24px;
|
padding: 24px;
|
||||||
background: rgba(18, 33, 54, 0.44);
|
background: rgba(3, 8, 18, 0.68);
|
||||||
backdrop-filter: blur(5px);
|
backdrop-filter: blur(8px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.auth-card {
|
.auth-card {
|
||||||
width: 560px;
|
width: 560px;
|
||||||
padding: 42px 44px 38px;
|
padding: 42px 44px 38px;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.65);
|
border: 1px solid rgba(130, 175, 255, 0.2);
|
||||||
border-radius: 24px;
|
border-radius: 26px;
|
||||||
background: #fff;
|
background: linear-gradient(158deg, rgba(22, 42, 78, 0.98) 0%, rgba(8, 16, 32, 0.99) 100%);
|
||||||
box-shadow: 0 30px 80px rgba(12, 30, 55, 0.3);
|
box-shadow:
|
||||||
|
0 40px 90px rgba(0, 6, 20, 0.6),
|
||||||
|
0 0 50px rgba(48, 118, 255, 0.12),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.08);
|
||||||
|
color-scheme: dark;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,10 +169,13 @@ onBeforeUnmount(() => {
|
|||||||
width: 86px;
|
width: 86px;
|
||||||
height: 86px;
|
height: 86px;
|
||||||
margin: 0 auto 24px;
|
margin: 0 auto 24px;
|
||||||
|
border: 1px solid rgba(120, 200, 255, 0.3);
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
color: var(--blue);
|
background: rgba(70, 140, 255, 0.14);
|
||||||
background: linear-gradient(145deg, #f1f7ff, #dfeaff);
|
box-shadow:
|
||||||
box-shadow: inset 0 1px 0 #fff, 0 8px 22px rgba(47, 111, 208, 0.14);
|
0 0 32px rgba(70, 140, 255, 0.22),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.1);
|
||||||
|
color: #7fe0ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.auth-card__icon svg {
|
.auth-card__icon svg {
|
||||||
@@ -174,15 +184,16 @@ onBeforeUnmount(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.auth-card h2 {
|
.auth-card h2 {
|
||||||
color: #1f2937;
|
color: #eef5ff;
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
letter-spacing: 1px;
|
letter-spacing: 1px;
|
||||||
|
text-shadow: 0 0 24px rgba(80, 150, 255, 0.28);
|
||||||
}
|
}
|
||||||
|
|
||||||
.auth-card p {
|
.auth-card p {
|
||||||
margin-top: 14px;
|
margin-top: 14px;
|
||||||
color: #778394;
|
color: rgba(158, 190, 226, 0.7);
|
||||||
font-size: 19px;
|
font-size: 19px;
|
||||||
letter-spacing: 0.5px;
|
letter-spacing: 0.5px;
|
||||||
}
|
}
|
||||||
@@ -195,9 +206,11 @@ onBeforeUnmount(() => {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 62px;
|
height: 62px;
|
||||||
padding: 0 22px;
|
padding: 0 22px;
|
||||||
border: 2px solid var(--line-strong);
|
border: 1px solid rgba(130, 175, 255, 0.22);
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
color: var(--ink);
|
background: rgba(6, 14, 28, 0.7);
|
||||||
|
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
|
||||||
|
color: #e8f2ff;
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
letter-spacing: 2px;
|
letter-spacing: 2px;
|
||||||
@@ -205,18 +218,24 @@ onBeforeUnmount(() => {
|
|||||||
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.auth-card__input::placeholder {
|
||||||
|
color: rgba(158, 190, 226, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
.auth-card__input:focus {
|
.auth-card__input:focus {
|
||||||
border-color: var(--blue);
|
border-color: rgba(120, 200, 255, 0.55);
|
||||||
box-shadow: 0 0 0 4px rgba(47, 111, 208, 0.14);
|
box-shadow:
|
||||||
|
0 0 0 4px rgba(70, 140, 255, 0.15),
|
||||||
|
0 0 24px rgba(70, 140, 255, 0.12);
|
||||||
}
|
}
|
||||||
|
|
||||||
.auth-card__input:disabled {
|
.auth-card__input:disabled {
|
||||||
background: #f4f6f9;
|
background: rgba(4, 10, 22, 0.8);
|
||||||
}
|
}
|
||||||
|
|
||||||
.auth-card__error {
|
.auth-card__error {
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
color: var(--red);
|
color: #ff9d9d;
|
||||||
font-size: 17px;
|
font-size: 17px;
|
||||||
letter-spacing: 0.5px;
|
letter-spacing: 0.5px;
|
||||||
}
|
}
|
||||||
@@ -234,33 +253,45 @@ onBeforeUnmount(() => {
|
|||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
letter-spacing: 3px;
|
letter-spacing: 3px;
|
||||||
transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
|
transition:
|
||||||
|
transform 0.2s ease,
|
||||||
|
box-shadow 0.2s ease,
|
||||||
|
background 0.2s ease,
|
||||||
|
border-color 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.auth-card__button:disabled {
|
.auth-card__button:disabled {
|
||||||
cursor: default;
|
cursor: default;
|
||||||
opacity: 0.65;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.auth-card__button--ghost {
|
.auth-card__button--ghost {
|
||||||
border: 2px solid var(--line-strong);
|
border: 1px solid rgba(130, 175, 255, 0.28);
|
||||||
color: var(--ink-soft);
|
background: rgba(18, 40, 78, 0.5);
|
||||||
background: #fff;
|
color: #bcd9ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.auth-card__button--ghost:hover:not(:disabled) {
|
.auth-card__button--ghost:hover:not(:disabled) {
|
||||||
background: var(--surface-soft);
|
border-color: rgba(150, 205, 255, 0.5);
|
||||||
|
background: rgba(30, 66, 128, 0.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
.auth-card__button--primary {
|
.auth-card__button--primary {
|
||||||
color: #fff;
|
background: linear-gradient(180deg, #ffd166 0%, #f0ac0b 100%);
|
||||||
background: linear-gradient(180deg, #4b89e4 0%, #2f6fd0 100%);
|
box-shadow:
|
||||||
box-shadow: 0 10px 22px rgba(47, 111, 208, 0.28);
|
0 14px 30px rgba(240, 172, 11, 0.28),
|
||||||
|
0 0 26px rgba(255, 190, 60, 0.16),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.6);
|
||||||
|
color: #241500;
|
||||||
|
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.25);
|
||||||
}
|
}
|
||||||
|
|
||||||
.auth-card__button--primary:hover:not(:disabled) {
|
.auth-card__button--primary:hover:not(:disabled) {
|
||||||
transform: translateY(-1px);
|
box-shadow:
|
||||||
box-shadow: 0 14px 28px rgba(47, 111, 208, 0.36);
|
0 18px 38px rgba(240, 172, 11, 0.36),
|
||||||
|
0 0 34px rgba(255, 190, 60, 0.26),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.6);
|
||||||
|
transform: translateY(-2px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.auth-modal-enter-active,
|
.auth-modal-enter-active,
|
||||||
|
|||||||
@@ -93,14 +93,30 @@ onMounted(async () => {
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.camera-card {
|
.camera-card {
|
||||||
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border: 1px solid #d8e0e9;
|
border: 1px solid rgba(130, 175, 255, 0.16);
|
||||||
border-radius: 18px;
|
border-radius: 26px;
|
||||||
background: #fff;
|
background: linear-gradient(160deg, rgba(20, 38, 70, 0.55) 0%, rgba(7, 14, 30, 0.75) 100%);
|
||||||
box-shadow: var(--shadow-card);
|
box-shadow:
|
||||||
|
0 30px 70px rgba(0, 10, 32, 0.5),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.07);
|
||||||
|
backdrop-filter: blur(16px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.camera-card::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 40px;
|
||||||
|
left: 40px;
|
||||||
|
z-index: 2;
|
||||||
|
height: 1px;
|
||||||
|
background: linear-gradient(90deg, transparent, rgba(130, 214, 255, 0.6), transparent);
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.camera-card__header {
|
.camera-card__header {
|
||||||
@@ -108,28 +124,41 @@ onMounted(async () => {
|
|||||||
flex: none;
|
flex: none;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
height: 76px;
|
height: 80px;
|
||||||
padding: 0 28px;
|
padding: 0 28px;
|
||||||
background: linear-gradient(180deg, #3d80e2 0%, #2f6fd0 100%);
|
border-bottom: 1px solid rgba(130, 175, 255, 0.12);
|
||||||
|
background: linear-gradient(120deg, rgba(26, 58, 112, 0.85) 0%, rgba(10, 24, 52, 0.8) 100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.camera-card__header h2 {
|
.camera-card__header h2 {
|
||||||
color: #fff;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
color: #eef5ff;
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
letter-spacing: 3px;
|
letter-spacing: 3px;
|
||||||
text-shadow: 0 1px 3px rgba(16, 49, 101, 0.22);
|
text-shadow: 0 0 22px rgba(80, 150, 255, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.camera-card__header h2::before {
|
||||||
|
content: '';
|
||||||
|
width: 4px;
|
||||||
|
height: 26px;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: linear-gradient(180deg, #7fe0ff, #4d8bf0);
|
||||||
|
box-shadow: 0 0 14px rgba(90, 170, 255, 0.7);
|
||||||
}
|
}
|
||||||
|
|
||||||
.camera-card__status {
|
.camera-card__status {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
padding: 5px 12px;
|
padding: 5px 14px;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.24);
|
border: 1px solid rgba(130, 195, 255, 0.28);
|
||||||
border-radius: 30px;
|
border-radius: 30px;
|
||||||
background: rgba(255, 255, 255, 0.12);
|
background: rgba(16, 40, 80, 0.5);
|
||||||
color: rgba(255, 255, 255, 0.92);
|
color: rgba(216, 236, 255, 0.9);
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
letter-spacing: 1px;
|
letter-spacing: 1px;
|
||||||
}
|
}
|
||||||
@@ -161,7 +190,8 @@ onMounted(async () => {
|
|||||||
position: relative;
|
position: relative;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background: #080d14;
|
background: #04070e;
|
||||||
|
box-shadow: inset 0 0 50px rgba(0, 4, 14, 0.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
.camera-card__image {
|
.camera-card__image {
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ withDefaults(
|
|||||||
title: string
|
title: string
|
||||||
tone: 'blue' | 'orange' | 'green' | 'teal'
|
tone: 'blue' | 'orange' | 'green' | 'teal'
|
||||||
icon: 'detect' | 'metal' | 'soil' | 'water'
|
icon: 'detect' | 'metal' | 'soil' | 'water'
|
||||||
|
caption?: string
|
||||||
|
index?: string
|
||||||
}>(),
|
}>(),
|
||||||
{},
|
{},
|
||||||
)
|
)
|
||||||
@@ -25,108 +27,195 @@ defineEmits<{
|
|||||||
<span class="module-button__icon">
|
<span class="module-button__icon">
|
||||||
<ModuleIcon :name="icon" />
|
<ModuleIcon :name="icon" />
|
||||||
</span>
|
</span>
|
||||||
|
<span v-if="index" class="module-button__index">{{ index }}</span>
|
||||||
|
|
||||||
|
<span class="module-button__body">
|
||||||
<span class="module-button__label">{{ title }}</span>
|
<span class="module-button__label">{{ title }}</span>
|
||||||
|
<span v-if="caption" class="module-button__caption">{{ caption }}</span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span class="module-button__bar" aria-hidden="true"></span>
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.module-button {
|
.module-button {
|
||||||
|
--tone-1: #6fb0ff;
|
||||||
|
--tone-2: #2f6fd0;
|
||||||
|
--tone-glow: rgba(70, 140, 255, 0.28);
|
||||||
|
--tone-line: rgba(111, 176, 255, 0.55);
|
||||||
position: relative;
|
position: relative;
|
||||||
display: block;
|
display: block;
|
||||||
height: 252px;
|
height: 252px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-radius: 18px;
|
border: 1px solid rgba(255, 255, 255, 0.09);
|
||||||
|
border-radius: 20px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
background:
|
||||||
|
radial-gradient(135% 105% at 106% -6%, var(--tone-glow) 0%, transparent 52%),
|
||||||
|
linear-gradient(
|
||||||
|
158deg,
|
||||||
|
rgba(255, 255, 255, 0.08) 0%,
|
||||||
|
rgba(255, 255, 255, 0.02) 58%,
|
||||||
|
rgba(255, 255, 255, 0.045) 100%
|
||||||
|
);
|
||||||
box-shadow:
|
box-shadow:
|
||||||
0 16px 30px var(--module-shadow),
|
0 18px 40px rgba(1, 8, 24, 0.42),
|
||||||
inset 0 2px 0 rgba(255, 255, 255, 0.55),
|
inset 0 1px 0 rgba(255, 255, 255, 0.1);
|
||||||
inset 0 -10px 24px rgba(0, 0, 0, 0.08);
|
transition:
|
||||||
transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
|
transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
|
||||||
box-shadow 0.25s ease;
|
border-color 0.3s ease,
|
||||||
|
box-shadow 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 悬停时从左上扫过的高光 */
|
||||||
.module-button::before {
|
.module-button::before {
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: 0;
|
inset: -40% -70%;
|
||||||
background:
|
background: linear-gradient(
|
||||||
radial-gradient(ellipse 85% 65% at 18% 6%, rgba(255, 255, 255, 0.34) 0%, transparent 58%),
|
115deg,
|
||||||
linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 36%);
|
transparent 42%,
|
||||||
|
rgba(255, 255, 255, 0.14) 50%,
|
||||||
|
transparent 58%
|
||||||
|
);
|
||||||
|
transform: translateX(-62%);
|
||||||
|
transition: transform 0.85s ease;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.module-button::after {
|
.module-button:hover {
|
||||||
content: '';
|
border-color: var(--tone-line);
|
||||||
position: absolute;
|
box-shadow:
|
||||||
right: 18px;
|
0 26px 52px rgba(1, 8, 24, 0.55),
|
||||||
bottom: 14px;
|
0 0 0 1px var(--tone-glow),
|
||||||
left: 18px;
|
0 0 34px var(--tone-glow),
|
||||||
height: 1px;
|
inset 0 1px 0 rgba(255, 255, 255, 0.14);
|
||||||
background: rgba(255, 255, 255, 0.2);
|
transform: translateY(-6px);
|
||||||
opacity: 0.8;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.module-button:hover {
|
.module-button:hover::before {
|
||||||
transform: translateY(-4px);
|
transform: translateX(62%);
|
||||||
box-shadow:
|
|
||||||
0 22px 38px var(--module-shadow-strong),
|
|
||||||
inset 0 2px 0 rgba(255, 255, 255, 0.6),
|
|
||||||
inset 0 -10px 24px rgba(0, 0, 0, 0.08);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.module-button:active {
|
.module-button:active {
|
||||||
transform: translateY(-1px) scale(0.995);
|
transform: translateY(-2px) scale(0.995);
|
||||||
}
|
}
|
||||||
|
|
||||||
.module-button--blue {
|
.module-button--blue {
|
||||||
--module-shadow: rgba(47, 111, 208, 0.26);
|
--tone-1: #6fb0ff;
|
||||||
--module-shadow-strong: rgba(47, 111, 208, 0.38);
|
--tone-2: #2f6fd0;
|
||||||
background: linear-gradient(145deg, #4b8ae8 0%, #3778d9 48%, #2f6fd0 100%);
|
--tone-glow: rgba(70, 140, 255, 0.28);
|
||||||
|
--tone-line: rgba(111, 176, 255, 0.55);
|
||||||
}
|
}
|
||||||
|
|
||||||
.module-button--orange {
|
.module-button--orange {
|
||||||
--module-shadow: rgba(238, 166, 11, 0.28);
|
--tone-1: #ffd166;
|
||||||
--module-shadow-strong: rgba(238, 166, 11, 0.4);
|
--tone-2: #e08f00;
|
||||||
background: linear-gradient(145deg, #ffc845 0%, #f8b526 50%, #eea50b 100%);
|
--tone-glow: rgba(255, 176, 32, 0.24);
|
||||||
|
--tone-line: rgba(255, 203, 92, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
.module-button--green {
|
.module-button--green {
|
||||||
--module-shadow: rgba(107, 171, 49, 0.28);
|
--tone-1: #a4e56f;
|
||||||
--module-shadow-strong: rgba(107, 171, 49, 0.4);
|
--tone-2: #4f9a26;
|
||||||
background: linear-gradient(145deg, #91d258 0%, #7cc242 50%, #67ad2f 100%);
|
--tone-glow: rgba(118, 200, 60, 0.22);
|
||||||
|
--tone-line: rgba(164, 229, 111, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
.module-button--teal {
|
.module-button--teal {
|
||||||
--module-shadow: rgba(38, 174, 163, 0.28);
|
--tone-1: #5ce3d6;
|
||||||
--module-shadow-strong: rgba(38, 174, 163, 0.4);
|
--tone-2: #109c91;
|
||||||
background: linear-gradient(145deg, #46cec2 0%, #2fb8ac 50%, #22a99e 100%);
|
--tone-glow: rgba(40, 200, 188, 0.24);
|
||||||
|
--tone-line: rgba(92, 227, 214, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
.module-button__icon {
|
.module-button__icon {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 24px;
|
top: 26px;
|
||||||
left: 24px;
|
left: 28px;
|
||||||
display: grid;
|
display: grid;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
width: 92px;
|
width: 86px;
|
||||||
height: 92px;
|
height: 86px;
|
||||||
padding: 10px;
|
border-radius: 22px;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.36);
|
color: #f4f9ff;
|
||||||
border-radius: 16px;
|
background: linear-gradient(150deg, var(--tone-1) 0%, var(--tone-2) 100%);
|
||||||
background: rgba(255, 255, 255, 0.14);
|
box-shadow:
|
||||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
|
0 14px 28px var(--tone-glow),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.4);
|
||||||
|
transition:
|
||||||
|
transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
|
||||||
|
box-shadow 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.module-button__icon :deep(svg) {
|
||||||
|
width: 52px;
|
||||||
|
height: 52px;
|
||||||
|
filter: drop-shadow(0 2px 6px rgba(4, 16, 40, 0.35));
|
||||||
|
}
|
||||||
|
|
||||||
|
.module-button:hover .module-button__icon {
|
||||||
|
box-shadow:
|
||||||
|
0 18px 34px var(--tone-glow),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.45);
|
||||||
|
transform: scale(1.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
.module-button__index {
|
||||||
|
position: absolute;
|
||||||
|
top: 24px;
|
||||||
|
right: 28px;
|
||||||
|
color: rgba(255, 255, 255, 0.1);
|
||||||
|
font-size: 46px;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.module-button__body {
|
||||||
|
position: absolute;
|
||||||
|
right: 28px;
|
||||||
|
bottom: 32px;
|
||||||
|
left: 28px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.module-button__label {
|
.module-button__label {
|
||||||
position: absolute;
|
color: #f3f8ff;
|
||||||
right: 18px;
|
font-size: 30px;
|
||||||
bottom: 44px;
|
|
||||||
left: 18px;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 31px;
|
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
letter-spacing: 4px;
|
letter-spacing: 3px;
|
||||||
text-align: center;
|
line-height: 1.25;
|
||||||
text-shadow: 0 2px 5px rgba(33, 49, 79, 0.24);
|
text-shadow: 0 2px 12px rgba(2, 10, 30, 0.45);
|
||||||
|
}
|
||||||
|
|
||||||
|
.module-button__caption {
|
||||||
|
color: var(--tone-1);
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 2.6px;
|
||||||
|
opacity: 0.85;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.module-button__bar {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 42%;
|
||||||
|
height: 3px;
|
||||||
|
border-radius: 0 3px 3px 0;
|
||||||
|
background: linear-gradient(90deg, var(--tone-1), transparent);
|
||||||
|
opacity: 0.55;
|
||||||
|
transition: width 0.4s ease, opacity 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.module-button:hover .module-button__bar {
|
||||||
|
width: 100%;
|
||||||
|
opacity: 1;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -4,13 +4,17 @@ withDefaults(
|
|||||||
title: string
|
title: string
|
||||||
subtitle?: string
|
subtitle?: string
|
||||||
variant?: 'default' | 'process' | 'result'
|
variant?: 'default' | 'process' | 'result'
|
||||||
|
theme?: 'light' | 'dark'
|
||||||
}>(),
|
}>(),
|
||||||
{ variant: 'default' },
|
{ variant: 'default', theme: 'light' },
|
||||||
)
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<header class="page-header" :class="`page-header--${variant}`">
|
<header
|
||||||
|
class="page-header"
|
||||||
|
:class="[`page-header--${variant}`, { 'page-header--dark': theme === 'dark' }]"
|
||||||
|
>
|
||||||
<div class="page-header__side">
|
<div class="page-header__side">
|
||||||
<slot name="left" />
|
<slot name="left" />
|
||||||
</div>
|
</div>
|
||||||
@@ -47,6 +51,22 @@ withDefaults(
|
|||||||
height: 118px;
|
height: 118px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.page-header--dark {
|
||||||
|
border-bottom: 1px solid rgba(130, 175, 255, 0.12);
|
||||||
|
background: linear-gradient(180deg, rgba(8, 16, 34, 0.94) 0%, rgba(8, 16, 34, 0.6) 100%);
|
||||||
|
box-shadow: 0 14px 40px rgba(0, 6, 20, 0.32);
|
||||||
|
backdrop-filter: blur(18px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-header--dark .page-header__center h1 {
|
||||||
|
color: #eef5ff;
|
||||||
|
text-shadow: 0 0 28px rgba(80, 150, 255, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-header--dark .page-header__center p {
|
||||||
|
color: rgba(158, 190, 226, 0.7);
|
||||||
|
}
|
||||||
|
|
||||||
.page-header__side {
|
.page-header__side {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -227,14 +227,16 @@ onMounted(() => {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 24px 24px 18px;
|
padding: 24px 24px 18px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-radius: 20px;
|
border: 1px solid rgba(130, 180, 255, 0.2);
|
||||||
|
border-radius: 26px;
|
||||||
touch-action: none;
|
touch-action: none;
|
||||||
background:
|
background:
|
||||||
radial-gradient(ellipse 80% 60% at 82% 8%, rgba(120, 174, 255, 0.35), transparent 62%),
|
radial-gradient(ellipse 80% 60% at 82% 8%, rgba(106, 168, 255, 0.4), transparent 62%),
|
||||||
linear-gradient(145deg, #3c7fdd 0%, #2f6fd0 48%, #2559ad 100%);
|
linear-gradient(150deg, #1f4fa8 0%, #173c86 48%, #0f2a5e 100%);
|
||||||
box-shadow:
|
box-shadow:
|
||||||
0 18px 46px rgba(37, 89, 173, 0.28),
|
0 24px 60px rgba(3, 12, 34, 0.55),
|
||||||
inset 0 1px 0 rgba(255, 255, 255, 0.24);
|
0 0 40px rgba(48, 118, 255, 0.18),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.18);
|
||||||
}
|
}
|
||||||
|
|
||||||
.principle::before {
|
.principle::before {
|
||||||
@@ -291,8 +293,10 @@ onMounted(() => {
|
|||||||
position: relative;
|
position: relative;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-radius: 14px;
|
border-radius: 16px;
|
||||||
background: #255bb3;
|
border: 1px solid rgba(130, 180, 255, 0.16);
|
||||||
|
background: #0b1f45;
|
||||||
|
box-shadow: inset 0 0 40px rgba(3, 12, 34, 0.55);
|
||||||
touch-action: none;
|
touch-action: none;
|
||||||
cursor: grab;
|
cursor: grab;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
progress: number
|
progress: number
|
||||||
label: string
|
label: string
|
||||||
note?: string
|
note?: string
|
||||||
}>()
|
theme?: 'light' | 'dark'
|
||||||
|
}>(),
|
||||||
|
{ theme: 'light' },
|
||||||
|
)
|
||||||
|
|
||||||
const clamped = computed(() => Math.max(0, Math.min(100, props.progress)))
|
const clamped = computed(() => Math.max(0, Math.min(100, props.progress)))
|
||||||
</script>
|
</script>
|
||||||
@@ -14,6 +18,7 @@ const clamped = computed(() => Math.max(0, Math.min(100, props.progress)))
|
|||||||
<div class="progress-strip">
|
<div class="progress-strip">
|
||||||
<div
|
<div
|
||||||
class="progress-strip__track"
|
class="progress-strip__track"
|
||||||
|
:class="{ 'progress-strip__track--dark': theme === 'dark' }"
|
||||||
role="progressbar"
|
role="progressbar"
|
||||||
:aria-valuenow="Math.round(clamped)"
|
:aria-valuenow="Math.round(clamped)"
|
||||||
aria-valuemin="0"
|
aria-valuemin="0"
|
||||||
@@ -29,7 +34,11 @@ const clamped = computed(() => Math.max(0, Math.min(100, props.progress)))
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span v-if="note" class="progress-strip__note">{{ note }}</span>
|
<span
|
||||||
|
v-if="note"
|
||||||
|
class="progress-strip__note"
|
||||||
|
:class="{ 'progress-strip__note--dark': theme === 'dark' }"
|
||||||
|
>{{ note }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -89,4 +98,31 @@ const clamped = computed(() => Math.max(0, Math.min(100, props.progress)))
|
|||||||
letter-spacing: 1px;
|
letter-spacing: 1px;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.progress-strip__track--dark {
|
||||||
|
border-color: rgba(130, 175, 255, 0.18);
|
||||||
|
background: rgba(7, 16, 34, 0.75);
|
||||||
|
box-shadow: inset 0 2px 10px rgba(0, 4, 16, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress-strip__track--dark .progress-strip__fill {
|
||||||
|
border-radius: 9px;
|
||||||
|
background:
|
||||||
|
linear-gradient(90deg, rgba(255, 255, 255, 0.18), transparent 24%),
|
||||||
|
linear-gradient(180deg, #6fc6ff 0%, #3f86f0 55%, #2c63c9 100%);
|
||||||
|
box-shadow: 0 0 22px rgba(80, 170, 255, 0.45);
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress-strip__track--dark .progress-strip__label {
|
||||||
|
color: rgba(170, 205, 240, 0.75);
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress-strip__track--dark .progress-strip__label--on-fill {
|
||||||
|
color: #f2fbff;
|
||||||
|
text-shadow: 0 2px 8px rgba(4, 24, 60, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress-strip__note--dark {
|
||||||
|
color: rgba(158, 190, 226, 0.72);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,396 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue'
|
||||||
|
import ReportDocument from '@/components/ReportDocument.vue'
|
||||||
|
import type { ScanRun } from '@/api/scan'
|
||||||
|
import { showToast } from '@/composables/useToast'
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
open: boolean
|
||||||
|
run: ScanRun | null
|
||||||
|
imageUrl?: string
|
||||||
|
pointIndex?: number
|
||||||
|
}>(),
|
||||||
|
{ imageUrl: '', pointIndex: 0 },
|
||||||
|
)
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
close: []
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const closeButton = ref<HTMLButtonElement | null>(null)
|
||||||
|
|
||||||
|
function pad2(value: number) {
|
||||||
|
return String(value).padStart(2, '0')
|
||||||
|
}
|
||||||
|
|
||||||
|
const reportNo = computed(() => {
|
||||||
|
const run = props.run
|
||||||
|
if (!run) return 'LIBS-00000000-000000'
|
||||||
|
|
||||||
|
const date = new Date(run.startedAt)
|
||||||
|
const stamp = Number.isNaN(date.getTime())
|
||||||
|
? '00000000'
|
||||||
|
: `${date.getFullYear()}${pad2(date.getMonth() + 1)}${pad2(date.getDate())}`
|
||||||
|
const tail =
|
||||||
|
run.scanId.replace(/[^a-zA-Z0-9]/g, '').slice(-6).toUpperCase() || '000000'
|
||||||
|
return `LIBS-${stamp}-${tail}`
|
||||||
|
})
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
emit('close')
|
||||||
|
}
|
||||||
|
|
||||||
|
function exportPdf() {
|
||||||
|
if (!props.run) return
|
||||||
|
|
||||||
|
showToast('正在打开打印窗口,请选择“另存为 PDF”导出 A4 报告')
|
||||||
|
const previousTitle = document.title
|
||||||
|
document.title = `${reportNo.value} 检测报告`
|
||||||
|
|
||||||
|
const restoreTitle = () => {
|
||||||
|
document.title = previousTitle
|
||||||
|
window.removeEventListener('afterprint', restoreTitle)
|
||||||
|
}
|
||||||
|
window.addEventListener('afterprint', restoreTitle)
|
||||||
|
|
||||||
|
window.setTimeout(() => {
|
||||||
|
window.print()
|
||||||
|
window.setTimeout(restoreTitle, 4000)
|
||||||
|
}, 180)
|
||||||
|
}
|
||||||
|
|
||||||
|
function onKeydown(event: KeyboardEvent) {
|
||||||
|
if (event.key === 'Escape') close()
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.open,
|
||||||
|
async (open) => {
|
||||||
|
if (open) {
|
||||||
|
window.addEventListener('keydown', onKeydown)
|
||||||
|
await nextTick()
|
||||||
|
closeButton.value?.focus()
|
||||||
|
} else {
|
||||||
|
window.removeEventListener('keydown', onKeydown)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
window.removeEventListener('keydown', onKeydown)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Transition name="report-modal">
|
||||||
|
<div v-if="open" class="report-modal" role="dialog" aria-modal="true" aria-label="检测报告预览">
|
||||||
|
<div class="report-modal__backdrop" @click.self="close"></div>
|
||||||
|
|
||||||
|
<section class="report-modal__shell">
|
||||||
|
<header class="report-modal__bar">
|
||||||
|
<div class="report-modal__identity">
|
||||||
|
<span class="report-modal__badge" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 32 32">
|
||||||
|
<path
|
||||||
|
d="M8 4h11l6 6v18H8z"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="1.8"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
/>
|
||||||
|
<path d="M19 4v6h6" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round" />
|
||||||
|
<path d="M12 16h9M12 20h9M12 24h6" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<div>
|
||||||
|
<h2>检测报告预览</h2>
|
||||||
|
<p>{{ reportNo }} · A4 210 × 297 mm · 共 3 页</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="report-modal__actions">
|
||||||
|
<button
|
||||||
|
ref="closeButton"
|
||||||
|
class="report-modal__button report-modal__button--ghost"
|
||||||
|
type="button"
|
||||||
|
@click="close"
|
||||||
|
>
|
||||||
|
关闭
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="report-modal__button report-modal__button--primary"
|
||||||
|
type="button"
|
||||||
|
:disabled="!run"
|
||||||
|
@click="exportPdf"
|
||||||
|
>
|
||||||
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||||
|
<path
|
||||||
|
d="M12 4v10m0 0 3.5-3.5M12 14 8.5 10.5M5 16v2.5A1.5 1.5 0 0 0 6.5 20h11a1.5 1.5 0 0 0 1.5-1.5V16"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="1.8"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
导出 PDF
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="report-modal__scroll">
|
||||||
|
<ReportDocument
|
||||||
|
v-if="run"
|
||||||
|
:run="run"
|
||||||
|
:image-url="imageUrl"
|
||||||
|
:point-index="pointIndex"
|
||||||
|
preview
|
||||||
|
/>
|
||||||
|
<p v-else class="report-modal__empty">暂无可导出的检测结果</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<footer class="report-modal__foot">
|
||||||
|
<span class="report-modal__dot"></span>
|
||||||
|
点击“导出 PDF”后将打开系统打印窗口,请在“目标打印机”中选择“另存为 PDF”,纸张保持 A4。
|
||||||
|
</footer>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</Transition>
|
||||||
|
|
||||||
|
<Teleport to="body">
|
||||||
|
<div v-if="open && run" class="report-print-root">
|
||||||
|
<ReportDocument :run="run" :image-url="imageUrl" :point-index="pointIndex" />
|
||||||
|
</div>
|
||||||
|
</Teleport>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.report-modal {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
z-index: 70;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal__backdrop {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background: rgba(3, 9, 20, 0.74);
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal__shell {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
width: 1300px;
|
||||||
|
height: 976px;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid rgba(130, 175, 255, 0.26);
|
||||||
|
border-radius: 24px;
|
||||||
|
background: linear-gradient(158deg, #0e1e3a 0%, #081226 62%, #070f1f 100%);
|
||||||
|
box-shadow:
|
||||||
|
0 44px 120px rgba(0, 6, 20, 0.72),
|
||||||
|
0 0 70px rgba(48, 118, 255, 0.14),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal__bar {
|
||||||
|
display: flex;
|
||||||
|
flex: none;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
height: 88px;
|
||||||
|
padding: 0 28px 0 30px;
|
||||||
|
border-bottom: 1px solid rgba(130, 175, 255, 0.14);
|
||||||
|
background: linear-gradient(120deg, rgba(30, 66, 128, 0.4) 0%, rgba(8, 18, 38, 0.2) 70%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal__identity {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal__badge {
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
width: 52px;
|
||||||
|
height: 52px;
|
||||||
|
border: 1px solid rgba(130, 195, 255, 0.3);
|
||||||
|
border-radius: 14px;
|
||||||
|
background: rgba(30, 66, 128, 0.4);
|
||||||
|
color: #9fe8ff;
|
||||||
|
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal__badge svg {
|
||||||
|
width: 28px;
|
||||||
|
height: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal__identity h2 {
|
||||||
|
color: #f0f7ff;
|
||||||
|
font-size: 26px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal__identity p {
|
||||||
|
margin-top: 4px;
|
||||||
|
color: rgba(158, 190, 226, 0.72);
|
||||||
|
font-size: 15px;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal__actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal__button {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 10px;
|
||||||
|
height: 56px;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 3px;
|
||||||
|
transition:
|
||||||
|
transform 0.2s ease,
|
||||||
|
box-shadow 0.2s ease,
|
||||||
|
background 0.2s ease,
|
||||||
|
border-color 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal__button:hover {
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal__button svg {
|
||||||
|
width: 22px;
|
||||||
|
height: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal__button--ghost {
|
||||||
|
width: 132px;
|
||||||
|
border: 1px solid rgba(150, 200, 255, 0.32);
|
||||||
|
background: rgba(18, 40, 78, 0.4);
|
||||||
|
color: #cfe4ff;
|
||||||
|
letter-spacing: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal__button--ghost:hover {
|
||||||
|
border-color: rgba(160, 210, 255, 0.55);
|
||||||
|
background: rgba(30, 66, 128, 0.55);
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal__button--primary {
|
||||||
|
width: 194px;
|
||||||
|
background: linear-gradient(180deg, #ffd166 0%, #f0ac0b 100%);
|
||||||
|
color: #241500;
|
||||||
|
box-shadow:
|
||||||
|
0 14px 30px rgba(240, 172, 11, 0.3),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal__button--primary:hover {
|
||||||
|
box-shadow:
|
||||||
|
0 18px 38px rgba(240, 172, 11, 0.4),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal__button--primary:disabled {
|
||||||
|
cursor: not-allowed;
|
||||||
|
opacity: 0.5;
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal__scroll {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 0;
|
||||||
|
padding: 30px 0 40px;
|
||||||
|
overflow-y: auto;
|
||||||
|
background:
|
||||||
|
radial-gradient(760px 420px at 50% -8%, rgba(48, 118, 255, 0.16), transparent 70%),
|
||||||
|
radial-gradient(600px 400px at 88% 100%, rgba(42, 183, 172, 0.08), transparent 70%),
|
||||||
|
#091325;
|
||||||
|
scrollbar-width: thin;
|
||||||
|
scrollbar-color: rgba(130, 175, 255, 0.32) transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal__scroll::-webkit-scrollbar {
|
||||||
|
width: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal__scroll::-webkit-scrollbar-thumb {
|
||||||
|
border: 3px solid #091325;
|
||||||
|
border-radius: 6px;
|
||||||
|
background: rgba(130, 175, 255, 0.36);
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal__scroll::-webkit-scrollbar-track {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal__empty {
|
||||||
|
margin-top: 200px;
|
||||||
|
color: rgba(158, 190, 226, 0.7);
|
||||||
|
font-size: 20px;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal__foot {
|
||||||
|
display: flex;
|
||||||
|
flex: none;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
height: 46px;
|
||||||
|
padding: 0 30px;
|
||||||
|
border-top: 1px solid rgba(130, 175, 255, 0.12);
|
||||||
|
background: rgba(8, 18, 38, 0.75);
|
||||||
|
color: rgba(158, 190, 226, 0.66);
|
||||||
|
font-size: 15px;
|
||||||
|
letter-spacing: 0.6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal__dot {
|
||||||
|
width: 7px;
|
||||||
|
height: 7px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #8df6ff;
|
||||||
|
box-shadow: 0 0 10px rgba(141, 246, 255, 0.8);
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal-enter-active,
|
||||||
|
.report-modal-leave-active {
|
||||||
|
transition: opacity 0.26s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal-enter-active .report-modal__shell,
|
||||||
|
.report-modal-leave-active .report-modal__shell {
|
||||||
|
transition:
|
||||||
|
transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
|
||||||
|
opacity 0.26s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal-enter-from,
|
||||||
|
.report-modal-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-modal-enter-from .report-modal__shell,
|
||||||
|
.report-modal-leave-to .report-modal__shell {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(18px) scale(0.975);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -170,7 +170,7 @@ const markers = [
|
|||||||
text-anchor="middle"
|
text-anchor="middle"
|
||||||
opacity="0.95"
|
opacity="0.95"
|
||||||
>
|
>
|
||||||
样品图片识别动画
|
样品图片识别中...
|
||||||
</text>
|
</text>
|
||||||
<text
|
<text
|
||||||
x="500"
|
x="500"
|
||||||
@@ -201,19 +201,34 @@ const markers = [
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.scan-visual {
|
.scan-visual {
|
||||||
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 10px 16px 16px;
|
padding: 10px 16px 16px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border: 1px solid #1e55a4;
|
border: 1px solid rgba(130, 175, 255, 0.18);
|
||||||
border-radius: 18px;
|
border-radius: 26px;
|
||||||
background:
|
background:
|
||||||
radial-gradient(ellipse 70% 50% at 50% 0%, rgba(120, 180, 255, 0.22), transparent 70%),
|
radial-gradient(ellipse 70% 55% at 50% 0%, rgba(70, 140, 255, 0.18), transparent 70%),
|
||||||
linear-gradient(150deg, #3b7edd 0%, #2f6fd0 46%, #2559ac 100%);
|
linear-gradient(158deg, rgba(20, 40, 78, 0.7) 0%, rgba(6, 14, 30, 0.85) 100%);
|
||||||
box-shadow:
|
box-shadow:
|
||||||
0 18px 44px rgba(31, 77, 147, 0.28),
|
0 30px 70px rgba(0, 10, 32, 0.5),
|
||||||
inset 0 1px 0 rgba(255, 255, 255, 0.22);
|
0 0 40px rgba(48, 118, 255, 0.1),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.08);
|
||||||
|
backdrop-filter: blur(16px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-visual::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 40px;
|
||||||
|
left: 40px;
|
||||||
|
z-index: 2;
|
||||||
|
height: 1px;
|
||||||
|
background: linear-gradient(90deg, transparent, rgba(130, 214, 255, 0.55), transparent);
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.scan-visual__bar {
|
.scan-visual__bar {
|
||||||
@@ -255,9 +270,12 @@ const markers = [
|
|||||||
position: relative;
|
position: relative;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.58);
|
border: 1px solid rgba(130, 195, 255, 0.26);
|
||||||
border-radius: 8px;
|
border-radius: 16px;
|
||||||
background: rgba(24, 72, 148, 0.16);
|
background:
|
||||||
|
radial-gradient(circle at 50% 42%, rgba(40, 90, 160, 0.32), transparent 68%),
|
||||||
|
rgba(4, 10, 22, 0.62);
|
||||||
|
box-shadow: inset 0 0 60px rgba(0, 4, 14, 0.7);
|
||||||
}
|
}
|
||||||
|
|
||||||
.scan-visual__stage svg {
|
.scan-visual__stage svg {
|
||||||
@@ -280,7 +298,8 @@ const markers = [
|
|||||||
z-index: 3;
|
z-index: 3;
|
||||||
width: 30px;
|
width: 30px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
border: 2px solid rgba(255, 255, 255, 0.9);
|
border: 2px solid rgba(150, 225, 255, 0.78);
|
||||||
|
filter: drop-shadow(0 0 6px rgba(90, 200, 255, 0.35));
|
||||||
}
|
}
|
||||||
|
|
||||||
.scan-visual__corner--tl {
|
.scan-visual__corner--tl {
|
||||||
@@ -318,7 +337,8 @@ const markers = [
|
|||||||
width: 5px;
|
width: 5px;
|
||||||
height: 54px;
|
height: 54px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background: rgba(255, 255, 255, 0.82);
|
background: rgba(150, 225, 255, 0.72);
|
||||||
|
box-shadow: 0 0 12px rgba(90, 200, 255, 0.4);
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,101 +1,217 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
|
import type { ScanSegment } from '@/api/scan'
|
||||||
|
|
||||||
|
interface ChartLabel {
|
||||||
|
element: string
|
||||||
|
wavelength: number
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
wavelengths?: number[]
|
||||||
|
spectrum?: number[]
|
||||||
|
segments?: ScanSegment[]
|
||||||
|
labels?: ChartLabel[]
|
||||||
|
statusText?: string
|
||||||
|
/** 紧凑模式:在较小的容器中放大字号,保证刻度与标注可读。 */
|
||||||
|
compact?: boolean
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
wavelengths: () => [],
|
||||||
|
spectrum: () => [],
|
||||||
|
segments: () => [],
|
||||||
|
labels: () => [],
|
||||||
|
statusText: '',
|
||||||
|
compact: false,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
const fontScale = computed(() => (props.compact ? 1.55 : 1))
|
||||||
|
const fs = (size: number) => Math.round(size * fontScale.value)
|
||||||
|
|
||||||
const width = 1360
|
const width = 1360
|
||||||
const height = 720
|
const height = 720
|
||||||
const pad = { left: 112, right: 44, top: 74, bottom: 88 }
|
const pad = { left: 112, right: 44, top: 74, bottom: 88 }
|
||||||
|
const MAX_POINTS = 900
|
||||||
|
const DEFAULT_RANGE = { min: 380, max: 700 }
|
||||||
|
|
||||||
const xMin = 380
|
const hasData = computed(
|
||||||
const xMax = 700
|
() =>
|
||||||
const yMin = 0
|
props.wavelengths.length > 1 &&
|
||||||
const yMax = 36
|
props.spectrum.length === props.wavelengths.length,
|
||||||
|
)
|
||||||
|
|
||||||
const peaks = [
|
const range = computed(() => {
|
||||||
{ center: 421, amplitude: 4.4, width: 2.2 },
|
if (!hasData.value) return DEFAULT_RANGE
|
||||||
{ center: 438.4, amplitude: 26.5, width: 2.0 },
|
|
||||||
{ center: 447.5, amplitude: 10.5, width: 2.6 },
|
|
||||||
{ center: 468, amplitude: 5.5, width: 2.2 },
|
|
||||||
{ center: 492, amplitude: 13.5, width: 2.4 },
|
|
||||||
{ center: 505, amplitude: 7.2, width: 2.0 },
|
|
||||||
{ center: 510.6, amplitude: 23.5, width: 2.5 },
|
|
||||||
{ center: 518.4, amplitude: 30.5, width: 2.1 },
|
|
||||||
{ center: 540, amplitude: 10.5, width: 2.4 },
|
|
||||||
{ center: 557, amplitude: 7.4, width: 2.1 },
|
|
||||||
{ center: 574, amplitude: 4.6, width: 2.0 },
|
|
||||||
{ center: 590, amplitude: 13.4, width: 2.2 },
|
|
||||||
{ center: 606, amplitude: 6.2, width: 2.1 },
|
|
||||||
{ center: 614.5, amplitude: 26.5, width: 2.4 },
|
|
||||||
{ center: 634, amplitude: 6.8, width: 2.2 },
|
|
||||||
{ center: 653, amplitude: 12.2, width: 2.3 },
|
|
||||||
{ center: 672, amplitude: 8.4, width: 2.2 },
|
|
||||||
{ center: 686, amplitude: 10.8, width: 2.0 },
|
|
||||||
]
|
|
||||||
|
|
||||||
const labels = [
|
let min = Number.POSITIVE_INFINITY
|
||||||
{ center: 438.4, element: 'Fe', wavelength: '438.4 nm', lift: 56, dx: 0 },
|
let max = Number.NEGATIVE_INFINITY
|
||||||
{ center: 510.6, element: 'Cu', wavelength: '510.6 nm', lift: 100, dx: -94 },
|
for (const value of props.wavelengths) {
|
||||||
{ center: 518.4, element: 'Mg', wavelength: '518.4 nm', lift: 54, dx: 96 },
|
if (value < min) min = value
|
||||||
{ center: 614.5, element: 'Si', wavelength: '614.5 nm', lift: 58, dx: 0 },
|
if (value > max) max = value
|
||||||
]
|
|
||||||
|
|
||||||
const toX = (lambda: number) =>
|
|
||||||
pad.left + ((lambda - xMin) / (xMax - xMin)) * (width - pad.left - pad.right)
|
|
||||||
|
|
||||||
const toY = (intensity: number) =>
|
|
||||||
height - pad.bottom - ((intensity - yMin) / (yMax - yMin)) * (height - pad.top - pad.bottom)
|
|
||||||
|
|
||||||
function intensityAt(lambda: number, index: number) {
|
|
||||||
let value = 0.72
|
|
||||||
value += 0.34 * Math.sin(index * 0.37)
|
|
||||||
value += 0.22 * Math.sin(index * 1.19 + 1.2)
|
|
||||||
value += 0.14 * Math.cos(index * 2.23)
|
|
||||||
value += 0.08 * Math.sin(index * 3.7)
|
|
||||||
|
|
||||||
for (const peak of peaks) {
|
|
||||||
const distance = (lambda - peak.center) / peak.width
|
|
||||||
value += peak.amplitude * Math.exp(-0.5 * distance * distance)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Math.max(0.2, value)
|
if (!Number.isFinite(min) || !Number.isFinite(max) || max <= min) {
|
||||||
|
return DEFAULT_RANGE
|
||||||
}
|
}
|
||||||
|
|
||||||
const curve = computed(() => {
|
const margin = (max - min) * 0.01
|
||||||
const count = 620
|
return { min: min - margin, max: max + margin }
|
||||||
const points: Array<{ x: number; y: number }> = []
|
})
|
||||||
|
|
||||||
for (let index = 0; index < count; index += 1) {
|
const maxIntensity = computed(() => {
|
||||||
const ratio = index / (count - 1)
|
let max = 0
|
||||||
const lambda = xMin + ratio * (xMax - xMin)
|
for (const value of props.spectrum) {
|
||||||
points.push({ x: toX(lambda), y: toY(intensityAt(lambda, index)) })
|
if (value > max) max = value
|
||||||
|
}
|
||||||
|
return max > 0 ? max : 1
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 按桶取最大值降采样,保留谱峰形状。 */
|
||||||
|
const sampled = computed(() => {
|
||||||
|
if (!hasData.value) return []
|
||||||
|
|
||||||
|
const wavelengths = props.wavelengths
|
||||||
|
const spectrum = props.spectrum
|
||||||
|
const step = Math.max(1, Math.ceil(wavelengths.length / MAX_POINTS))
|
||||||
|
const points: Array<{ wavelength: number; intensity: number }> = []
|
||||||
|
|
||||||
|
for (let start = 0; start < wavelengths.length; start += step) {
|
||||||
|
const end = Math.min(start + step, wavelengths.length)
|
||||||
|
let best = start
|
||||||
|
for (let index = start + 1; index < end; index += 1) {
|
||||||
|
if (spectrum[index] > spectrum[best]) best = index
|
||||||
|
}
|
||||||
|
points.push({
|
||||||
|
wavelength: wavelengths[best],
|
||||||
|
intensity: spectrum[best],
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return points
|
return points
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function toX(wavelength: number) {
|
||||||
|
const { min, max } = range.value
|
||||||
|
return (
|
||||||
|
pad.left +
|
||||||
|
((wavelength - min) / (max - min)) * (width - pad.left - pad.right)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function toY(intensity: number) {
|
||||||
|
const ratio = Math.max(0, intensity) / maxIntensity.value
|
||||||
|
return height - pad.bottom - ratio * (height - pad.top - pad.bottom)
|
||||||
|
}
|
||||||
|
|
||||||
const linePath = computed(() =>
|
const linePath = computed(() =>
|
||||||
curve.value
|
sampled.value
|
||||||
.map((point, index) => `${index === 0 ? 'M' : 'L'}${point.x.toFixed(2)} ${point.y.toFixed(2)}`)
|
.map(
|
||||||
|
(point, index) =>
|
||||||
|
`${index === 0 ? 'M' : 'L'}${toX(point.wavelength).toFixed(2)} ${toY(point.intensity).toFixed(2)}`,
|
||||||
|
)
|
||||||
.join(' '),
|
.join(' '),
|
||||||
)
|
)
|
||||||
|
|
||||||
const areaPath = computed(() => {
|
const areaPath = computed(() => {
|
||||||
|
if (sampled.value.length < 2) return ''
|
||||||
|
|
||||||
|
const first = sampled.value[0]
|
||||||
|
const last = sampled.value[sampled.value.length - 1]
|
||||||
const bottom = height - pad.bottom
|
const bottom = height - pad.bottom
|
||||||
return `${linePath.value} L${toX(xMax).toFixed(2)} ${bottom} L${toX(xMin).toFixed(2)} ${bottom} Z`
|
return `${linePath.value} L${toX(last.wavelength).toFixed(2)} ${bottom} L${toX(first.wavelength).toFixed(2)} ${bottom} Z`
|
||||||
})
|
})
|
||||||
|
|
||||||
const yTicks = [0, 10, 20, 30]
|
function niceStep(rangeValue: number, count: number) {
|
||||||
const xTicks = [400, 450, 500, 550, 600, 650]
|
const rough = rangeValue / Math.max(1, count)
|
||||||
|
if (!Number.isFinite(rough) || rough <= 0) return 1
|
||||||
|
|
||||||
|
const power = 10 ** Math.floor(Math.log10(rough))
|
||||||
|
const fraction = rough / power
|
||||||
|
const nice = fraction <= 1 ? 1 : fraction <= 2 ? 2 : fraction <= 5 ? 5 : 10
|
||||||
|
return nice * power
|
||||||
|
}
|
||||||
|
|
||||||
|
const xTicks = computed(() => {
|
||||||
|
const step = niceStep(range.value.max - range.value.min, 6)
|
||||||
|
const start = Math.ceil(range.value.min / step) * step
|
||||||
|
const ticks: number[] = []
|
||||||
|
|
||||||
|
for (let value = start; value <= range.value.max + step * 1e-6; value += step) {
|
||||||
|
ticks.push(Number(value.toFixed(6)))
|
||||||
|
}
|
||||||
|
|
||||||
|
return ticks
|
||||||
|
})
|
||||||
|
|
||||||
|
const yTicks = computed(() => {
|
||||||
|
const step = niceStep(maxIntensity.value, 4)
|
||||||
|
const ticks: number[] = []
|
||||||
|
|
||||||
|
for (let value = 0; value <= maxIntensity.value + step * 1e-6; value += step) {
|
||||||
|
ticks.push(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
return ticks
|
||||||
|
})
|
||||||
|
|
||||||
|
function formatNumber(value: number) {
|
||||||
|
if (Math.abs(value) >= 100) return value.toFixed(0)
|
||||||
|
if (Math.abs(value) >= 10) return value.toFixed(0)
|
||||||
|
if (Math.abs(value) >= 1) return value.toFixed(1)
|
||||||
|
return value.toFixed(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
function intensityAt(wavelength: number) {
|
||||||
|
const wavelengths = props.wavelengths
|
||||||
|
if (wavelengths.length === 0) return 0
|
||||||
|
|
||||||
|
let low = 0
|
||||||
|
let high = wavelengths.length - 1
|
||||||
|
while (low < high) {
|
||||||
|
const mid = (low + high) >> 1
|
||||||
|
if (wavelengths[mid] < wavelength) low = mid + 1
|
||||||
|
else high = mid
|
||||||
|
}
|
||||||
|
|
||||||
|
const index = low
|
||||||
|
const previous = Math.max(0, index - 1)
|
||||||
|
return Math.max(props.spectrum[previous] ?? 0, props.spectrum[index] ?? 0)
|
||||||
|
}
|
||||||
|
|
||||||
const peakLabels = computed(() =>
|
const peakLabels = computed(() =>
|
||||||
labels.map((label) => {
|
props.labels
|
||||||
const peak = peaks.find((item) => item.center === label.center)
|
.filter(
|
||||||
const peakValue = peak ? peak.amplitude + 1.4 : 10
|
(label) =>
|
||||||
const x = toX(label.center)
|
label.wavelength >= range.value.min &&
|
||||||
const y = toY(peakValue)
|
label.wavelength <= range.value.max,
|
||||||
const labelY = Math.max(pad.top + 22, y - label.lift)
|
)
|
||||||
return { ...label, x, y, labelX: x + label.dx, labelY }
|
.map((label, index) => {
|
||||||
|
const x = toX(label.wavelength)
|
||||||
|
const y = toY(intensityAt(label.wavelength))
|
||||||
|
const lift = fs(48) + (index % 2) * fs(58)
|
||||||
|
const labelX = Math.min(
|
||||||
|
Math.max(x, pad.left + fs(44)),
|
||||||
|
width - pad.right - fs(44),
|
||||||
|
)
|
||||||
|
return {
|
||||||
|
...label,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
labelX,
|
||||||
|
labelY: Math.max(pad.top + fs(26), y - lift),
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/** 拼接光谱的段边界,用虚线提示换段位置。 */
|
||||||
|
const boundaryXs = computed(() =>
|
||||||
|
props.segments
|
||||||
|
.slice(1)
|
||||||
|
.map((segment) => toX(segment.wavelengthStart))
|
||||||
|
.filter((x) => x > pad.left && x < width - pad.right),
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -105,7 +221,7 @@ const peakLabels = computed(() =>
|
|||||||
:viewBox="`0 0 ${width} ${height}`"
|
:viewBox="`0 0 ${width} ${height}`"
|
||||||
preserveAspectRatio="xMidYMid meet"
|
preserveAspectRatio="xMidYMid meet"
|
||||||
role="img"
|
role="img"
|
||||||
aria-label="光谱采集图表"
|
aria-label="光谱图表"
|
||||||
>
|
>
|
||||||
<defs>
|
<defs>
|
||||||
<linearGradient id="spectrumStroke" x1="0" y1="0" x2="1" y2="0">
|
<linearGradient id="spectrumStroke" x1="0" y1="0" x2="1" y2="0">
|
||||||
@@ -115,15 +231,15 @@ const peakLabels = computed(() =>
|
|||||||
<stop offset="1" stop-color="#ff8ad8" />
|
<stop offset="1" stop-color="#ff8ad8" />
|
||||||
</linearGradient>
|
</linearGradient>
|
||||||
<linearGradient id="spectrumArea" x1="0" y1="0" x2="0" y2="1">
|
<linearGradient id="spectrumArea" x1="0" y1="0" x2="0" y2="1">
|
||||||
<stop offset="0" stop-color="#a7d5ff" stop-opacity="0.22" />
|
<stop offset="0" stop-color="#4d8dff" stop-opacity="0.16" />
|
||||||
<stop offset="1" stop-color="#2f6fd0" stop-opacity="0" />
|
<stop offset="1" stop-color="#2f6fd0" stop-opacity="0" />
|
||||||
</linearGradient>
|
</linearGradient>
|
||||||
</defs>
|
</defs>
|
||||||
|
|
||||||
<rect width="1360" height="720" fill="#2f6fd0" />
|
<rect width="1360" height="720" fill="#050c1a" />
|
||||||
<rect width="1360" height="720" fill="url(#spectrumArea)" opacity="0.35" />
|
<rect width="1360" height="720" fill="url(#spectrumArea)" />
|
||||||
|
|
||||||
<g stroke="rgba(255,255,255,0.24)" stroke-width="1">
|
<g stroke="rgba(130, 175, 255, 0.16)" stroke-width="1">
|
||||||
<line
|
<line
|
||||||
v-for="tick in yTicks"
|
v-for="tick in yTicks"
|
||||||
:key="`grid-y-${tick}`"
|
:key="`grid-y-${tick}`"
|
||||||
@@ -131,7 +247,7 @@ const peakLabels = computed(() =>
|
|||||||
:x2="width - pad.right"
|
:x2="width - pad.right"
|
||||||
:y1="toY(tick)"
|
:y1="toY(tick)"
|
||||||
:y2="toY(tick)"
|
:y2="toY(tick)"
|
||||||
stroke-dasharray="3 5"
|
stroke-dasharray="3 6"
|
||||||
/>
|
/>
|
||||||
<line
|
<line
|
||||||
v-for="tick in xTicks"
|
v-for="tick in xTicks"
|
||||||
@@ -140,33 +256,33 @@ const peakLabels = computed(() =>
|
|||||||
:x2="toX(tick)"
|
:x2="toX(tick)"
|
||||||
:y1="pad.top"
|
:y1="pad.top"
|
||||||
:y2="height - pad.bottom"
|
:y2="height - pad.bottom"
|
||||||
opacity="0.55"
|
opacity="0.6"
|
||||||
/>
|
/>
|
||||||
</g>
|
</g>
|
||||||
|
|
||||||
<g fill="rgba(255,255,255,0.72)" font-size="21" text-anchor="end">
|
<g fill="rgba(158, 190, 226, 0.72)" :font-size="fs(21)" text-anchor="end">
|
||||||
<text
|
<text
|
||||||
v-for="tick in yTicks"
|
v-for="tick in yTicks"
|
||||||
:key="`label-y-${tick}`"
|
:key="`label-y-${tick}`"
|
||||||
:x="pad.left - 20"
|
:x="pad.left - 20"
|
||||||
:y="toY(tick) + 7"
|
:y="toY(tick) + 7"
|
||||||
>
|
>
|
||||||
{{ tick }}
|
{{ formatNumber(tick) }}
|
||||||
</text>
|
</text>
|
||||||
</g>
|
</g>
|
||||||
|
|
||||||
<g fill="rgba(255,255,255,0.74)" font-size="19" text-anchor="middle">
|
<g fill="rgba(158, 190, 226, 0.72)" :font-size="fs(19)" text-anchor="middle">
|
||||||
<text
|
<text
|
||||||
v-for="tick in xTicks"
|
v-for="tick in xTicks"
|
||||||
:key="`label-x-${tick}`"
|
:key="`label-x-${tick}`"
|
||||||
:x="toX(tick)"
|
:x="toX(tick)"
|
||||||
:y="height - pad.bottom + 34"
|
:y="height - pad.bottom + 34"
|
||||||
>
|
>
|
||||||
{{ tick }}
|
{{ formatNumber(tick) }}
|
||||||
</text>
|
</text>
|
||||||
</g>
|
</g>
|
||||||
|
|
||||||
<g stroke="rgba(255,255,255,0.8)" stroke-width="1.6">
|
<g stroke="rgba(130, 195, 255, 0.4)" stroke-width="1.6">
|
||||||
<line :x1="pad.left" :x2="pad.left" :y1="pad.top" :y2="height - pad.bottom" />
|
<line :x1="pad.left" :x2="pad.left" :y1="pad.top" :y2="height - pad.bottom" />
|
||||||
<line
|
<line
|
||||||
:x1="pad.left"
|
:x1="pad.left"
|
||||||
@@ -176,7 +292,7 @@ const peakLabels = computed(() =>
|
|||||||
/>
|
/>
|
||||||
</g>
|
</g>
|
||||||
|
|
||||||
<g fill="rgba(255,255,255,0.85)" font-size="22">
|
<g fill="rgba(158, 190, 226, 0.65)" :font-size="fs(22)">
|
||||||
<text x="24" y="58">a.u.</text>
|
<text x="24" y="58">a.u.</text>
|
||||||
<text
|
<text
|
||||||
x="34"
|
x="34"
|
||||||
@@ -190,6 +306,7 @@ const peakLabels = computed(() =>
|
|||||||
<text :x="width - 70" :y="height - 24" text-anchor="end">波长 nm</text>
|
<text :x="width - 70" :y="height - 24" text-anchor="end">波长 nm</text>
|
||||||
</g>
|
</g>
|
||||||
|
|
||||||
|
<g v-if="hasData">
|
||||||
<path :d="areaPath" fill="url(#spectrumArea)" />
|
<path :d="areaPath" fill="url(#spectrumArea)" />
|
||||||
<path
|
<path
|
||||||
:d="linePath"
|
:d="linePath"
|
||||||
@@ -200,43 +317,69 @@ const peakLabels = computed(() =>
|
|||||||
stroke-linecap="round"
|
stroke-linecap="round"
|
||||||
filter="drop-shadow(0 0 5px rgba(146, 228, 255, 0.45))"
|
filter="drop-shadow(0 0 5px rgba(146, 228, 255, 0.45))"
|
||||||
/>
|
/>
|
||||||
|
</g>
|
||||||
|
|
||||||
<g v-for="label in peakLabels" :key="label.element">
|
<g v-if="hasData" stroke="rgba(255, 214, 120, 0.5)" stroke-width="1.2">
|
||||||
|
<line
|
||||||
|
v-for="x in boundaryXs"
|
||||||
|
:key="`boundary-${x}`"
|
||||||
|
:x1="x"
|
||||||
|
:x2="x"
|
||||||
|
:y1="pad.top"
|
||||||
|
:y2="height - pad.bottom"
|
||||||
|
stroke-dasharray="6 8"
|
||||||
|
/>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<g v-for="label in peakLabels" :key="`${label.element}-${label.wavelength}`">
|
||||||
<line
|
<line
|
||||||
:x1="label.labelX"
|
:x1="label.labelX"
|
||||||
:x2="label.x"
|
:x2="label.x"
|
||||||
:y1="label.labelY + 33"
|
:y1="label.labelY + fs(33)"
|
||||||
:y2="label.y - 8"
|
:y2="label.y - 8"
|
||||||
stroke="rgba(255,255,255,0.62)"
|
stroke="rgba(150, 210, 255, 0.5)"
|
||||||
stroke-width="1.3"
|
stroke-width="1.3"
|
||||||
stroke-dasharray="3 4"
|
stroke-dasharray="3 4"
|
||||||
/>
|
/>
|
||||||
<circle :cx="label.x" :cy="label.y - 8" r="3.4" fill="#ffffff" opacity="0.92" />
|
<circle :cx="label.x" :cy="label.y - 8" r="3.4" fill="#bff3ff" />
|
||||||
<text
|
<text
|
||||||
:x="label.labelX"
|
:x="label.labelX"
|
||||||
:y="label.labelY"
|
:y="label.labelY"
|
||||||
fill="#ffffff"
|
fill="#eaf6ff"
|
||||||
font-size="34"
|
:font-size="fs(34)"
|
||||||
font-weight="500"
|
font-weight="500"
|
||||||
text-anchor="middle"
|
text-anchor="middle"
|
||||||
|
filter="drop-shadow(0 0 8px rgba(110, 200, 255, 0.5))"
|
||||||
>
|
>
|
||||||
{{ label.element }}
|
{{ label.element }}
|
||||||
</text>
|
</text>
|
||||||
<text
|
<text
|
||||||
:x="label.labelX"
|
:x="label.labelX"
|
||||||
:y="label.labelY + 33"
|
:y="label.labelY + fs(33)"
|
||||||
fill="#ffffff"
|
fill="rgba(180, 220, 255, 0.85)"
|
||||||
font-size="24"
|
:font-size="fs(24)"
|
||||||
text-anchor="middle"
|
text-anchor="middle"
|
||||||
>
|
>
|
||||||
{{ label.wavelength }}
|
{{ label.wavelength.toFixed(2) }} nm
|
||||||
</text>
|
</text>
|
||||||
</g>
|
</g>
|
||||||
|
|
||||||
|
<text
|
||||||
|
v-if="!hasData && statusText"
|
||||||
|
:x="width / 2"
|
||||||
|
:y="height / 2"
|
||||||
|
fill="rgba(180, 210, 240, 0.8)"
|
||||||
|
:font-size="fs(36)"
|
||||||
|
font-weight="500"
|
||||||
|
text-anchor="middle"
|
||||||
|
>
|
||||||
|
{{ statusText }}
|
||||||
|
</text>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
<div class="spectrum-chart__status">
|
<div v-if="hasData && statusText" class="spectrum-chart__status">
|
||||||
<span class="spectrum-chart__pulse"></span>
|
<span class="spectrum-chart__pulse"></span>
|
||||||
光谱采集进行中
|
{{ statusText }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -246,14 +389,28 @@ const peakLabels = computed(() =>
|
|||||||
position: relative;
|
position: relative;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border: 1px solid #1e55a4;
|
border: 1px solid rgba(130, 175, 255, 0.18);
|
||||||
border-radius: 16px;
|
border-radius: 26px;
|
||||||
background:
|
background:
|
||||||
radial-gradient(ellipse 70% 55% at 72% 10%, rgba(119, 182, 255, 0.24), transparent 68%),
|
radial-gradient(ellipse 70% 55% at 72% 8%, rgba(70, 140, 255, 0.16), transparent 68%),
|
||||||
linear-gradient(150deg, #3b7edd 0%, #2f6fd0 48%, #2559ac 100%);
|
linear-gradient(158deg, rgba(20, 40, 78, 0.7) 0%, rgba(5, 12, 26, 0.88) 100%);
|
||||||
box-shadow:
|
box-shadow:
|
||||||
0 18px 44px rgba(31, 77, 147, 0.24),
|
0 30px 70px rgba(0, 10, 32, 0.5),
|
||||||
inset 0 1px 0 rgba(255, 255, 255, 0.18);
|
0 0 40px rgba(48, 118, 255, 0.1),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.08);
|
||||||
|
backdrop-filter: blur(16px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.spectrum-chart::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 40px;
|
||||||
|
left: 40px;
|
||||||
|
z-index: 2;
|
||||||
|
height: 1px;
|
||||||
|
background: linear-gradient(90deg, transparent, rgba(130, 214, 255, 0.55), transparent);
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.spectrum-chart__svg {
|
.spectrum-chart__svg {
|
||||||
@@ -263,26 +420,27 @@ const peakLabels = computed(() =>
|
|||||||
|
|
||||||
.spectrum-chart__status {
|
.spectrum-chart__status {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 49%;
|
right: 32px;
|
||||||
left: 50%;
|
bottom: 26px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 14px;
|
gap: 10px;
|
||||||
color: #fff;
|
padding: 8px 16px;
|
||||||
font-size: 36px;
|
border: 1px solid rgba(130, 195, 255, 0.26);
|
||||||
font-weight: 500;
|
border-radius: 30px;
|
||||||
letter-spacing: 5px;
|
background: rgba(10, 26, 52, 0.6);
|
||||||
text-shadow: 0 3px 14px rgba(11, 48, 108, 0.5);
|
color: rgba(220, 238, 255, 0.92);
|
||||||
transform: translate(-50%, -50%);
|
font-size: 18px;
|
||||||
white-space: nowrap;
|
letter-spacing: 1px;
|
||||||
|
backdrop-filter: blur(8px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.spectrum-chart__pulse {
|
.spectrum-chart__pulse {
|
||||||
width: 10px;
|
width: 9px;
|
||||||
height: 10px;
|
height: 9px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background: #8df6ff;
|
background: #8df6ff;
|
||||||
box-shadow: 0 0 14px rgba(141, 246, 255, 0.85);
|
box-shadow: 0 0 12px rgba(141, 246, 255, 0.85);
|
||||||
animation: chart-pulse 1.8s ease-in-out infinite;
|
animation: chart-pulse 1.8s ease-in-out infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,13 +3,14 @@ withDefaults(
|
|||||||
defineProps<{
|
defineProps<{
|
||||||
items: string[]
|
items: string[]
|
||||||
icon?: 'laser' | 'info'
|
icon?: 'laser' | 'info'
|
||||||
|
theme?: 'light' | 'dark'
|
||||||
}>(),
|
}>(),
|
||||||
{ icon: undefined },
|
{ icon: undefined, theme: 'light' },
|
||||||
)
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<footer class="status-footer">
|
<footer class="status-footer" :class="{ 'status-footer--dark': theme === 'dark' }">
|
||||||
<span v-if="icon" class="status-footer__icon" aria-hidden="true">
|
<span v-if="icon" class="status-footer__icon" aria-hidden="true">
|
||||||
<svg v-if="icon === 'laser'" viewBox="0 0 24 24">
|
<svg v-if="icon === 'laser'" viewBox="0 0 24 24">
|
||||||
<path d="M4 17.5h8.5l2-3H22" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" />
|
<path d="M4 17.5h8.5l2-3H22" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" />
|
||||||
@@ -71,4 +72,19 @@ withDefaults(
|
|||||||
.status-footer__sep {
|
.status-footer__sep {
|
||||||
color: #c5cdd8;
|
color: #c5cdd8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.status-footer--dark {
|
||||||
|
border-top: 1px solid rgba(130, 175, 255, 0.12);
|
||||||
|
background: linear-gradient(180deg, rgba(8, 16, 34, 0.55) 0%, rgba(5, 10, 22, 0.94) 100%);
|
||||||
|
color: rgba(178, 202, 232, 0.72);
|
||||||
|
backdrop-filter: blur(14px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-footer--dark .status-footer__icon {
|
||||||
|
color: rgba(120, 190, 255, 0.8);
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-footer--dark .status-footer__sep {
|
||||||
|
color: rgba(120, 160, 210, 0.35);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,14 +1,23 @@
|
|||||||
import { onBeforeUnmount, onMounted, ref } from 'vue'
|
import { onBeforeUnmount, onMounted, ref } from 'vue'
|
||||||
|
|
||||||
/** 秒级倒计时,归零时只触发一次回调。 */
|
/** 秒级倒计时,归零时只触发一次回调;enabled 为 false 时不启动计时。 */
|
||||||
export function useCountdown(seconds: number, onComplete: () => void) {
|
export function useCountdown(
|
||||||
|
seconds: number,
|
||||||
|
onComplete: () => void,
|
||||||
|
enabled = true,
|
||||||
|
isPaused: () => boolean = () => false,
|
||||||
|
) {
|
||||||
const remaining = ref(seconds)
|
const remaining = ref(seconds)
|
||||||
|
|
||||||
let timer: number | undefined
|
let timer: number | undefined
|
||||||
let finished = false
|
let finished = false
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
if (!enabled) return
|
||||||
|
|
||||||
timer = window.setInterval(() => {
|
timer = window.setInterval(() => {
|
||||||
|
if (isPaused()) return
|
||||||
|
|
||||||
remaining.value = Math.max(0, remaining.value - 1)
|
remaining.value = Math.max(0, remaining.value - 1)
|
||||||
|
|
||||||
if (remaining.value === 0 && !finished) {
|
if (remaining.value === 0 && !finished) {
|
||||||
|
|||||||
@@ -0,0 +1,162 @@
|
|||||||
|
import { onBeforeUnmount, ref } from 'vue'
|
||||||
|
import {
|
||||||
|
HubConnectionBuilder,
|
||||||
|
HubConnectionState,
|
||||||
|
LogLevel,
|
||||||
|
type HubConnection,
|
||||||
|
} from '@microsoft/signalr'
|
||||||
|
import {
|
||||||
|
getStageHubUrl,
|
||||||
|
type ScanProgress,
|
||||||
|
type ScanSegment,
|
||||||
|
} from '@/api/scan'
|
||||||
|
import type { DeviceStatus } from '@/api/device'
|
||||||
|
|
||||||
|
export interface StagePosition {
|
||||||
|
x: number
|
||||||
|
y: number
|
||||||
|
z: number
|
||||||
|
moving: boolean
|
||||||
|
updatedAt: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ScanSpectrum {
|
||||||
|
scanId: string
|
||||||
|
pointIndex: number
|
||||||
|
totalPoints: number
|
||||||
|
wavelengths: number[]
|
||||||
|
spectrum: number[]
|
||||||
|
segments: ScanSegment[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ScanFinished {
|
||||||
|
scanId: string
|
||||||
|
status: string
|
||||||
|
error: string | null
|
||||||
|
}
|
||||||
|
|
||||||
|
export type StageHubState = 'idle' | 'connecting' | 'connected' | 'offline'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扫描实时通道(/stageHub)。
|
||||||
|
* 事件契约见 HardwareWeb/Services/StageBroadcastService.cs:
|
||||||
|
* StagePosition -> { x, y, z, moving, updatedAt }
|
||||||
|
* ScanProgress -> ScanProgress
|
||||||
|
* ScanSpectrum -> { scanId, pointIndex, wavelengths, spectrum, segments }
|
||||||
|
* ScanFinished -> { scanId, status, error }
|
||||||
|
* DeviceStatus -> DeviceStatus
|
||||||
|
*/
|
||||||
|
export function useStageHub() {
|
||||||
|
const state = ref<StageHubState>('idle')
|
||||||
|
const position = ref<StagePosition | null>(null)
|
||||||
|
const progress = ref<ScanProgress | null>(null)
|
||||||
|
const spectrum = ref<ScanSpectrum | null>(null)
|
||||||
|
const finished = ref<ScanFinished | null>(null)
|
||||||
|
const deviceStatus = ref<DeviceStatus | null>(null)
|
||||||
|
const errorMessage = ref('')
|
||||||
|
|
||||||
|
let connection: HubConnection | null = null
|
||||||
|
let stoppedByUser = false
|
||||||
|
|
||||||
|
async function connect() {
|
||||||
|
if (connection && connection.state !== HubConnectionState.Disconnected) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
stoppedByUser = false
|
||||||
|
state.value = 'connecting'
|
||||||
|
errorMessage.value = ''
|
||||||
|
|
||||||
|
const hub = new HubConnectionBuilder()
|
||||||
|
.withUrl(getStageHubUrl(), { withCredentials: false })
|
||||||
|
.withAutomaticReconnect({
|
||||||
|
nextRetryDelayInMilliseconds: (context) =>
|
||||||
|
Math.min(1000 * 2 ** context.previousRetryCount, 10000),
|
||||||
|
})
|
||||||
|
.configureLogging(LogLevel.Warning)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
hub.on('StagePosition', (payload: StagePosition) => {
|
||||||
|
position.value = payload
|
||||||
|
})
|
||||||
|
hub.on('ScanProgress', (payload: ScanProgress) => {
|
||||||
|
progress.value = payload
|
||||||
|
})
|
||||||
|
hub.on('ScanSpectrum', (payload: ScanSpectrum) => {
|
||||||
|
spectrum.value = payload
|
||||||
|
})
|
||||||
|
hub.on('ScanFinished', (payload: ScanFinished) => {
|
||||||
|
finished.value = payload
|
||||||
|
})
|
||||||
|
hub.on('DeviceStatus', (payload: DeviceStatus) => {
|
||||||
|
deviceStatus.value = payload
|
||||||
|
})
|
||||||
|
hub.onreconnecting(() => {
|
||||||
|
state.value = 'connecting'
|
||||||
|
})
|
||||||
|
hub.onreconnected(async () => {
|
||||||
|
state.value = 'connected'
|
||||||
|
await syncSnapshot(hub)
|
||||||
|
})
|
||||||
|
hub.onclose(() => {
|
||||||
|
if (stoppedByUser) return
|
||||||
|
state.value = 'offline'
|
||||||
|
})
|
||||||
|
|
||||||
|
connection = hub
|
||||||
|
|
||||||
|
try {
|
||||||
|
await hub.start()
|
||||||
|
state.value = 'connected'
|
||||||
|
await syncSnapshot(hub)
|
||||||
|
} catch (error) {
|
||||||
|
state.value = 'offline'
|
||||||
|
errorMessage.value =
|
||||||
|
error instanceof Error ? error.message : '实时通道连接失败'
|
||||||
|
connection = null
|
||||||
|
await hub.stop().catch(() => undefined)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function syncSnapshot(hub: HubConnection) {
|
||||||
|
try {
|
||||||
|
const current = await hub.invoke<ScanProgress>('GetScanProgress')
|
||||||
|
progress.value = current
|
||||||
|
} catch {
|
||||||
|
// 快照失败不影响实时事件
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const current = await hub.invoke<StagePosition | null>('GetStagePosition')
|
||||||
|
if (current) position.value = current
|
||||||
|
} catch {
|
||||||
|
// 位移台未连接时返回 null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function disconnect() {
|
||||||
|
stoppedByUser = true
|
||||||
|
const hub = connection
|
||||||
|
connection = null
|
||||||
|
state.value = 'idle'
|
||||||
|
if (hub) {
|
||||||
|
await hub.stop().catch(() => undefined)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
void disconnect()
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
state,
|
||||||
|
position,
|
||||||
|
progress,
|
||||||
|
spectrum,
|
||||||
|
finished,
|
||||||
|
deviceStatus,
|
||||||
|
errorMessage,
|
||||||
|
connect,
|
||||||
|
disconnect,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,6 +35,18 @@ const router = createRouter({
|
|||||||
component: () => import('@/views/ResultView.vue'),
|
component: () => import('@/views/ResultView.vue'),
|
||||||
meta: { title: '检测完成' },
|
meta: { title: '检测完成' },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/history',
|
||||||
|
name: 'history',
|
||||||
|
component: () => import('@/views/HistoryView.vue'),
|
||||||
|
meta: { title: '检测历史', requiresAdmin: true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/history/:scanId',
|
||||||
|
name: 'historyDetail',
|
||||||
|
component: () => import('@/views/ResultView.vue'),
|
||||||
|
meta: { title: '历史检测详情', requiresAdmin: true },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/pay',
|
path: '/pay',
|
||||||
redirect: { name: 'sample' },
|
redirect: { name: 'sample' },
|
||||||
@@ -45,6 +57,12 @@ const router = createRouter({
|
|||||||
component: () => import('@/views/SystemConfigView.vue'),
|
component: () => import('@/views/SystemConfigView.vue'),
|
||||||
meta: { title: '系统参数管理', requiresAdmin: true },
|
meta: { title: '系统参数管理', requiresAdmin: true },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/ruler',
|
||||||
|
name: 'ruler',
|
||||||
|
component: () => import('@/views/RulerSettingView.vue'),
|
||||||
|
meta: { title: '标尺设定', requiresAdmin: true },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/:pathMatch(.*)*',
|
path: '/:pathMatch(.*)*',
|
||||||
redirect: { name: 'home' },
|
redirect: { name: 'home' },
|
||||||
|
|||||||
@@ -179,6 +179,38 @@ ol {
|
|||||||
transform: translateY(-6px);
|
transform: translateY(-6px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 报告导出:屏幕预览使用 #app 内的弹窗,打印时仅保留 A4 报告 DOM。 */
|
||||||
|
.report-print-root {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
@page {
|
||||||
|
size: A4;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
width: 210mm;
|
||||||
|
height: auto;
|
||||||
|
overflow: visible;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
#app {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toast {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-print-root {
|
||||||
|
display: block !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media (prefers-reduced-motion: reduce) {
|
@media (prefers-reduced-motion: reduce) {
|
||||||
*,
|
*,
|
||||||
*::before,
|
*::before,
|
||||||
|
|||||||
@@ -0,0 +1,841 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { onMounted, ref } from 'vue'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
import AppStage from '@/components/AppStage.vue'
|
||||||
|
import PageHeader from '@/components/PageHeader.vue'
|
||||||
|
import { getScanHistory, deleteScan, type ScanHistoryItem } from '@/api/scan'
|
||||||
|
import { showToast } from '@/composables/useToast'
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
const items = ref<ScanHistoryItem[]>([])
|
||||||
|
const loading = ref(true)
|
||||||
|
const error = ref('')
|
||||||
|
const deleteTarget = ref<ScanHistoryItem | null>(null)
|
||||||
|
const removing = ref(false)
|
||||||
|
|
||||||
|
function goHome() {
|
||||||
|
void router.replace({ name: 'home' })
|
||||||
|
}
|
||||||
|
|
||||||
|
function openDetail(item: ScanHistoryItem) {
|
||||||
|
void router.push({ name: 'historyDetail', params: { scanId: item.scanId } })
|
||||||
|
}
|
||||||
|
|
||||||
|
function askDelete(item: ScanHistoryItem) {
|
||||||
|
if (removing.value) return
|
||||||
|
deleteTarget.value = item
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancelDelete() {
|
||||||
|
if (removing.value) return
|
||||||
|
deleteTarget.value = null
|
||||||
|
}
|
||||||
|
|
||||||
|
async function confirmDelete() {
|
||||||
|
const target = deleteTarget.value
|
||||||
|
if (!target || removing.value) return
|
||||||
|
|
||||||
|
removing.value = true
|
||||||
|
try {
|
||||||
|
await deleteScan(target.scanId)
|
||||||
|
items.value = items.value.filter((item) => item.scanId !== target.scanId)
|
||||||
|
deleteTarget.value = null
|
||||||
|
showToast('检测记录已删除')
|
||||||
|
} catch (err) {
|
||||||
|
showToast(err instanceof Error ? err.message : '删除检测记录失败')
|
||||||
|
} finally {
|
||||||
|
removing.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function load() {
|
||||||
|
loading.value = true
|
||||||
|
error.value = ''
|
||||||
|
|
||||||
|
try {
|
||||||
|
items.value = await getScanHistory()
|
||||||
|
} catch (err) {
|
||||||
|
error.value = err instanceof Error ? err.message : '读取历史记录失败'
|
||||||
|
showToast(error.value)
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function statusLabel(status: string) {
|
||||||
|
switch (status) {
|
||||||
|
case 'Completed':
|
||||||
|
return '已完成'
|
||||||
|
case 'Failed':
|
||||||
|
return '失败'
|
||||||
|
case 'Aborted':
|
||||||
|
return '已中止'
|
||||||
|
default:
|
||||||
|
return '进行中'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function statusTone(status: string) {
|
||||||
|
switch (status) {
|
||||||
|
case 'Completed':
|
||||||
|
return 'is-completed'
|
||||||
|
case 'Failed':
|
||||||
|
return 'is-failed'
|
||||||
|
case 'Aborted':
|
||||||
|
return 'is-aborted'
|
||||||
|
default:
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatTime(value: string | null) {
|
||||||
|
if (!value) return '—'
|
||||||
|
const date = new Date(value)
|
||||||
|
if (Number.isNaN(date.getTime())) return '—'
|
||||||
|
return date.toLocaleString('zh-CN', { hour12: false }).replace(/\//g, '-')
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatDuration(item: ScanHistoryItem) {
|
||||||
|
if (!item.finishedAt) return '—'
|
||||||
|
const start = new Date(item.startedAt).getTime()
|
||||||
|
const end = new Date(item.finishedAt).getTime()
|
||||||
|
if (!Number.isFinite(start) || !Number.isFinite(end) || end < start) return '—'
|
||||||
|
|
||||||
|
const seconds = Math.round((end - start) / 1000)
|
||||||
|
if (seconds < 60) return `${seconds} 秒`
|
||||||
|
const minutes = Math.floor(seconds / 60)
|
||||||
|
const rest = seconds % 60
|
||||||
|
return rest === 0 ? `${minutes} 分` : `${minutes} 分 ${rest} 秒`
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
void load()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<AppStage>
|
||||||
|
<div class="history-bg" aria-hidden="true">
|
||||||
|
<span class="history-bg__orb history-bg__orb--blue"></span>
|
||||||
|
<span class="history-bg__orb history-bg__orb--cyan"></span>
|
||||||
|
<span class="history-bg__orb history-bg__orb--violet"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<PageHeader
|
||||||
|
title="检测历史"
|
||||||
|
subtitle="查看已保存的扫描记录与检测结果"
|
||||||
|
theme="dark"
|
||||||
|
>
|
||||||
|
<template #left>
|
||||||
|
<button class="admin-back" type="button" @click="goHome">
|
||||||
|
返回
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
</PageHeader>
|
||||||
|
|
||||||
|
<main class="history-main">
|
||||||
|
<section class="history-card">
|
||||||
|
<header class="history-card__header">
|
||||||
|
<div class="history-card__heading">
|
||||||
|
<span class="history-card__eyebrow">Scan History</span>
|
||||||
|
<h2>检测记录</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="history-card__actions">
|
||||||
|
<span class="history-card__count">共 {{ items.length }} 条</span>
|
||||||
|
<button
|
||||||
|
class="history-refresh"
|
||||||
|
type="button"
|
||||||
|
:disabled="loading"
|
||||||
|
@click="load"
|
||||||
|
>
|
||||||
|
{{ loading ? '加载中...' : '刷新' }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="history-table">
|
||||||
|
<div class="history-table__head">
|
||||||
|
<span>检测时间</span>
|
||||||
|
<span>状态</span>
|
||||||
|
<span>采样点</span>
|
||||||
|
<span>耗时</span>
|
||||||
|
<span>记录编号</span>
|
||||||
|
<span>操作</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="history-table__body">
|
||||||
|
<div
|
||||||
|
v-for="item in items"
|
||||||
|
:key="item.scanId"
|
||||||
|
class="history-row"
|
||||||
|
@click="openDetail(item)"
|
||||||
|
>
|
||||||
|
<span class="history-row__time">{{ formatTime(item.startedAt) }}</span>
|
||||||
|
<span>
|
||||||
|
<span class="history-status" :class="statusTone(item.status)">
|
||||||
|
{{ statusLabel(item.status) }}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<span class="history-row__points">
|
||||||
|
{{ item.completedPoints }} / {{ item.totalPoints }}
|
||||||
|
</span>
|
||||||
|
<span class="history-row__duration">{{ formatDuration(item) }}</span>
|
||||||
|
<span class="history-row__id" :title="item.scanId">{{ item.scanId }}</span>
|
||||||
|
<span class="history-row__actions">
|
||||||
|
<button
|
||||||
|
class="row-action row-action--view"
|
||||||
|
type="button"
|
||||||
|
@click.stop="openDetail(item)"
|
||||||
|
>
|
||||||
|
查看
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="row-action row-action--danger"
|
||||||
|
type="button"
|
||||||
|
@click.stop="askDelete(item)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="!items.length" class="history-empty">
|
||||||
|
<template v-if="error">
|
||||||
|
<p>{{ error }}</p>
|
||||||
|
<button class="history-empty__retry" type="button" @click="load">
|
||||||
|
重新加载
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
<p v-else-if="loading">正在读取历史记录...</p>
|
||||||
|
<p v-else>暂无历史检测记录</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<footer class="history-footer">
|
||||||
|
按开始时间倒序显示,最多 100 条记录 · 点击任意记录查看靶面图与光谱分析结果
|
||||||
|
</footer>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<Teleport to="body">
|
||||||
|
<Transition name="delete-modal">
|
||||||
|
<div v-if="deleteTarget" class="delete-backdrop" @click.self="cancelDelete">
|
||||||
|
<section
|
||||||
|
class="delete-card"
|
||||||
|
role="dialog"
|
||||||
|
aria-modal="true"
|
||||||
|
aria-label="删除检测记录"
|
||||||
|
>
|
||||||
|
<div class="delete-card__icon" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 64 64">
|
||||||
|
<path
|
||||||
|
d="M20 22h24M26 22v-4h12v4M24 22l2 28h12l2-28"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="3"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M29 30v12M35 30v12"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="3"
|
||||||
|
stroke-linecap="round"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h2>删除检测记录</h2>
|
||||||
|
<p>
|
||||||
|
确定删除 <strong>{{ formatTime(deleteTarget.startedAt) }}</strong> 的检测记录吗?
|
||||||
|
</p>
|
||||||
|
<p class="delete-card__hint">
|
||||||
|
靶面图、光谱数据与元素分析结果将一并删除,删除后无法恢复。
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="delete-card__actions">
|
||||||
|
<button
|
||||||
|
class="delete-button delete-button--ghost"
|
||||||
|
type="button"
|
||||||
|
:disabled="removing"
|
||||||
|
@click="cancelDelete"
|
||||||
|
>
|
||||||
|
取消
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="delete-button delete-button--danger"
|
||||||
|
type="button"
|
||||||
|
:disabled="removing"
|
||||||
|
@click="confirmDelete"
|
||||||
|
>
|
||||||
|
{{ removing ? '删除中...' : '删除' }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</Transition>
|
||||||
|
</Teleport>
|
||||||
|
</AppStage>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.history-bg {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
pointer-events: none;
|
||||||
|
background:
|
||||||
|
radial-gradient(1000px 600px at 8% -16%, rgba(48, 112, 255, 0.28), transparent 62%),
|
||||||
|
radial-gradient(820px 520px at 98% 4%, rgba(0, 209, 255, 0.14), transparent 60%),
|
||||||
|
radial-gradient(900px 680px at 58% 116%, rgba(122, 84, 255, 0.18), transparent 62%),
|
||||||
|
linear-gradient(156deg, #050a16 0%, #081226 46%, #0a1730 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-bg::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background-image:
|
||||||
|
linear-gradient(rgba(130, 175, 255, 0.05) 1px, transparent 1px),
|
||||||
|
linear-gradient(90deg, rgba(130, 175, 255, 0.05) 1px, transparent 1px);
|
||||||
|
background-size: 64px 64px;
|
||||||
|
mask-image: radial-gradient(ellipse 78% 72% at 50% 32%, #000 20%, transparent 78%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-bg__orb {
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 50%;
|
||||||
|
filter: blur(100px);
|
||||||
|
animation: history-orb-drift 16s ease-in-out infinite alternate;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-bg__orb--blue {
|
||||||
|
top: -340px;
|
||||||
|
left: -160px;
|
||||||
|
width: 760px;
|
||||||
|
height: 760px;
|
||||||
|
background: rgba(48, 118, 255, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-bg__orb--cyan {
|
||||||
|
top: -200px;
|
||||||
|
right: -220px;
|
||||||
|
width: 640px;
|
||||||
|
height: 640px;
|
||||||
|
background: rgba(0, 214, 255, 0.18);
|
||||||
|
animation-delay: -5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-bg__orb--violet {
|
||||||
|
bottom: -360px;
|
||||||
|
left: 36%;
|
||||||
|
width: 700px;
|
||||||
|
height: 700px;
|
||||||
|
background: rgba(124, 92, 255, 0.18);
|
||||||
|
animation-delay: -10s;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes history-orb-drift {
|
||||||
|
from {
|
||||||
|
transform: translate3d(0, 0, 0) scale(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
transform: translate3d(42px, 30px, 0) scale(1.08);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-back {
|
||||||
|
width: 132px;
|
||||||
|
height: 60px;
|
||||||
|
border: 1px solid rgba(130, 190, 255, 0.35);
|
||||||
|
border-radius: 12px;
|
||||||
|
background: rgba(18, 40, 78, 0.5);
|
||||||
|
color: #bcd9ff;
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 3px;
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
transition:
|
||||||
|
transform 0.2s ease,
|
||||||
|
border-color 0.2s ease,
|
||||||
|
background 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-back:hover {
|
||||||
|
border-color: rgba(150, 205, 255, 0.55);
|
||||||
|
background: rgba(30, 66, 128, 0.65);
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-main {
|
||||||
|
position: absolute;
|
||||||
|
top: 176px;
|
||||||
|
right: 44px;
|
||||||
|
bottom: 40px;
|
||||||
|
left: 44px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-card {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid rgba(130, 175, 255, 0.18);
|
||||||
|
border-radius: 26px;
|
||||||
|
background: linear-gradient(158deg, rgba(20, 40, 78, 0.7) 0%, rgba(6, 14, 30, 0.85) 100%);
|
||||||
|
box-shadow:
|
||||||
|
0 30px 70px rgba(0, 10, 32, 0.5),
|
||||||
|
0 0 40px rgba(48, 118, 255, 0.1),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.08);
|
||||||
|
backdrop-filter: blur(16px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-card::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 40px;
|
||||||
|
left: 40px;
|
||||||
|
z-index: 2;
|
||||||
|
height: 1px;
|
||||||
|
background: linear-gradient(90deg, transparent, rgba(130, 214, 255, 0.55), transparent);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-card__header {
|
||||||
|
display: flex;
|
||||||
|
flex: none;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
height: 110px;
|
||||||
|
padding: 0 32px;
|
||||||
|
border-bottom: 1px solid rgba(130, 175, 255, 0.12);
|
||||||
|
background: linear-gradient(120deg, rgba(26, 58, 112, 0.24) 0%, transparent 70%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-card__heading {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-card__eyebrow {
|
||||||
|
color: #5aa2ff;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 2.6px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-card__header h2 {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
color: #eaf3ff;
|
||||||
|
font-size: 30px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-card__header h2::before {
|
||||||
|
content: '';
|
||||||
|
width: 4px;
|
||||||
|
height: 26px;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: linear-gradient(180deg, #7fe0ff, #4d8bf0);
|
||||||
|
box-shadow: 0 0 14px rgba(90, 170, 255, 0.7);
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-card__actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-card__count {
|
||||||
|
padding: 6px 16px;
|
||||||
|
border: 1px solid rgba(130, 195, 255, 0.28);
|
||||||
|
border-radius: 30px;
|
||||||
|
background: rgba(16, 40, 80, 0.5);
|
||||||
|
color: #9fe8ff;
|
||||||
|
font-size: 16px;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-refresh {
|
||||||
|
height: 48px;
|
||||||
|
padding: 0 24px;
|
||||||
|
border: 1px solid rgba(130, 175, 255, 0.28);
|
||||||
|
border-radius: 12px;
|
||||||
|
background: rgba(18, 40, 78, 0.5);
|
||||||
|
color: #bcd9ff;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
transition:
|
||||||
|
transform 0.2s ease,
|
||||||
|
border-color 0.2s ease,
|
||||||
|
background 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-refresh:hover:not(:disabled) {
|
||||||
|
border-color: rgba(150, 205, 255, 0.5);
|
||||||
|
background: rgba(30, 66, 128, 0.6);
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-refresh:disabled {
|
||||||
|
cursor: default;
|
||||||
|
opacity: 0.55;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-table {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
flex-direction: column;
|
||||||
|
min-height: 0;
|
||||||
|
padding: 0 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-table__head,
|
||||||
|
.history-row {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 320px 150px 150px 160px minmax(0, 1fr) 200px;
|
||||||
|
align-items: center;
|
||||||
|
gap: 20px;
|
||||||
|
padding: 0 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-table__head {
|
||||||
|
flex: none;
|
||||||
|
height: 62px;
|
||||||
|
margin-top: 18px;
|
||||||
|
border: 1px solid rgba(130, 175, 255, 0.12);
|
||||||
|
border-radius: 14px;
|
||||||
|
background: rgba(255, 255, 255, 0.04);
|
||||||
|
color: rgba(158, 190, 226, 0.65);
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-table__body {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
overflow-y: auto;
|
||||||
|
margin-right: -6px;
|
||||||
|
padding-right: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-table__body::-webkit-scrollbar {
|
||||||
|
width: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-table__body::-webkit-scrollbar-thumb {
|
||||||
|
border-radius: 3px;
|
||||||
|
background: rgba(130, 175, 255, 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-row {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 78px;
|
||||||
|
border-bottom: 1px solid rgba(130, 175, 255, 0.08);
|
||||||
|
color: rgba(210, 228, 250, 0.82);
|
||||||
|
font-size: 19px;
|
||||||
|
text-align: left;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.18s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-row:hover {
|
||||||
|
background: rgba(70, 140, 255, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-row__time {
|
||||||
|
color: rgba(226, 240, 255, 0.9);
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-row__points {
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-row__duration {
|
||||||
|
color: rgba(158, 190, 226, 0.7);
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-row__id {
|
||||||
|
overflow: hidden;
|
||||||
|
color: rgba(158, 190, 226, 0.5);
|
||||||
|
font-size: 16px;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-row__actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row-action {
|
||||||
|
height: 40px;
|
||||||
|
padding: 0 16px;
|
||||||
|
border: 1px solid rgba(120, 190, 255, 0.28);
|
||||||
|
border-radius: 10px;
|
||||||
|
background: rgba(70, 140, 255, 0.12);
|
||||||
|
color: #8fd0ff;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition:
|
||||||
|
background 0.18s ease,
|
||||||
|
border-color 0.18s ease,
|
||||||
|
color 0.18s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row-action:hover {
|
||||||
|
border-color: rgba(150, 205, 255, 0.5);
|
||||||
|
background: rgba(70, 140, 255, 0.22);
|
||||||
|
}
|
||||||
|
|
||||||
|
.row-action--danger {
|
||||||
|
border-color: rgba(255, 120, 120, 0.28);
|
||||||
|
background: rgba(255, 84, 84, 0.1);
|
||||||
|
color: #ff9d9d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row-action--danger:hover {
|
||||||
|
border-color: rgba(255, 150, 150, 0.5);
|
||||||
|
background: rgba(255, 84, 84, 0.18);
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-status {
|
||||||
|
display: inline-block;
|
||||||
|
min-width: 86px;
|
||||||
|
padding: 4px 12px;
|
||||||
|
border: 1px solid rgba(130, 195, 255, 0.28);
|
||||||
|
border-radius: 20px;
|
||||||
|
background: rgba(16, 40, 80, 0.5);
|
||||||
|
color: #9fe8ff;
|
||||||
|
font-size: 16px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-status.is-completed {
|
||||||
|
border-color: rgba(116, 244, 197, 0.32);
|
||||||
|
background: rgba(14, 60, 56, 0.45);
|
||||||
|
color: #8ff5e7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-status.is-failed {
|
||||||
|
border-color: rgba(255, 120, 120, 0.32);
|
||||||
|
background: rgba(60, 20, 26, 0.45);
|
||||||
|
color: #ff9d9d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-status.is-aborted {
|
||||||
|
border-color: rgba(255, 216, 106, 0.3);
|
||||||
|
background: rgba(60, 46, 12, 0.45);
|
||||||
|
color: #ffd98a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-empty {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 18px;
|
||||||
|
padding: 120px 0;
|
||||||
|
color: rgba(158, 190, 226, 0.55);
|
||||||
|
font-size: 20px;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-empty__retry {
|
||||||
|
height: 46px;
|
||||||
|
padding: 0 26px;
|
||||||
|
border: 1px solid rgba(130, 175, 255, 0.28);
|
||||||
|
border-radius: 12px;
|
||||||
|
background: rgba(18, 40, 78, 0.5);
|
||||||
|
color: #bcd9ff;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 18px;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-empty__retry:hover {
|
||||||
|
border-color: rgba(150, 205, 255, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-footer {
|
||||||
|
display: flex;
|
||||||
|
flex: none;
|
||||||
|
align-items: center;
|
||||||
|
height: 64px;
|
||||||
|
padding: 0 54px;
|
||||||
|
border-top: 1px solid rgba(130, 175, 255, 0.12);
|
||||||
|
background: rgba(8, 18, 38, 0.55);
|
||||||
|
color: rgba(158, 190, 226, 0.6);
|
||||||
|
font-size: 16px;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-backdrop {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
z-index: 70;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
padding: 24px;
|
||||||
|
background: rgba(3, 8, 18, 0.68);
|
||||||
|
backdrop-filter: blur(8px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-card {
|
||||||
|
width: 600px;
|
||||||
|
padding: 38px 44px 34px;
|
||||||
|
border: 1px solid rgba(130, 175, 255, 0.2);
|
||||||
|
border-radius: 26px;
|
||||||
|
background: linear-gradient(158deg, rgba(22, 42, 78, 0.98) 0%, rgba(8, 16, 32, 0.99) 100%);
|
||||||
|
box-shadow:
|
||||||
|
0 40px 90px rgba(0, 6, 20, 0.6),
|
||||||
|
0 0 50px rgba(48, 118, 255, 0.12),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.08);
|
||||||
|
color-scheme: dark;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-card__icon {
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
width: 86px;
|
||||||
|
height: 86px;
|
||||||
|
margin: 0 auto 22px;
|
||||||
|
border: 1px solid rgba(255, 120, 120, 0.3);
|
||||||
|
border-radius: 50%;
|
||||||
|
background: rgba(255, 84, 84, 0.12);
|
||||||
|
box-shadow:
|
||||||
|
0 0 32px rgba(255, 84, 84, 0.18),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.08);
|
||||||
|
color: #ff9d9d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-card__icon svg {
|
||||||
|
width: 44px;
|
||||||
|
height: 44px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-card h2 {
|
||||||
|
color: #eef5ff;
|
||||||
|
font-size: 30px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
text-shadow: 0 0 24px rgba(80, 150, 255, 0.28);
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-card p {
|
||||||
|
margin-top: 14px;
|
||||||
|
color: rgba(158, 190, 226, 0.72);
|
||||||
|
font-size: 19px;
|
||||||
|
line-height: 1.6;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-card p strong {
|
||||||
|
color: #ffd166;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-card__hint {
|
||||||
|
font-size: 16px;
|
||||||
|
color: rgba(158, 190, 226, 0.55);
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-card__actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 20px;
|
||||||
|
margin-top: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-button {
|
||||||
|
width: 180px;
|
||||||
|
height: 56px;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 3px;
|
||||||
|
transition:
|
||||||
|
transform 0.2s ease,
|
||||||
|
box-shadow 0.2s ease,
|
||||||
|
background 0.2s ease,
|
||||||
|
border-color 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-button:disabled {
|
||||||
|
cursor: default;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-button--ghost {
|
||||||
|
border: 1px solid rgba(130, 175, 255, 0.28);
|
||||||
|
background: rgba(18, 40, 78, 0.5);
|
||||||
|
color: #bcd9ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-button--ghost:hover:not(:disabled) {
|
||||||
|
border-color: rgba(150, 205, 255, 0.5);
|
||||||
|
background: rgba(30, 66, 128, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-button--danger {
|
||||||
|
background: linear-gradient(180deg, #ff8b84 0%, #e15b55 100%);
|
||||||
|
box-shadow:
|
||||||
|
0 14px 30px rgba(225, 91, 85, 0.28),
|
||||||
|
0 0 26px rgba(255, 110, 100, 0.16),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.4);
|
||||||
|
color: #2a0806;
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-button--danger:hover:not(:disabled) {
|
||||||
|
box-shadow:
|
||||||
|
0 18px 38px rgba(225, 91, 85, 0.36),
|
||||||
|
0 0 34px rgba(255, 110, 100, 0.26),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.45);
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-modal-enter-active,
|
||||||
|
.delete-modal-leave-active {
|
||||||
|
transition: opacity 0.24s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-modal-enter-active .delete-card,
|
||||||
|
.delete-modal-leave-active .delete-card {
|
||||||
|
transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-modal-enter-from,
|
||||||
|
.delete-modal-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-modal-enter-from .delete-card,
|
||||||
|
.delete-modal-leave-to .delete-card {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(16px) scale(0.97);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,11 +1,14 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onBeforeUnmount, ref } from 'vue'
|
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
|
import AdminFunctionPanel from '@/components/AdminFunctionPanel.vue'
|
||||||
import AdminPasswordModal from '@/components/AdminPasswordModal.vue'
|
import AdminPasswordModal from '@/components/AdminPasswordModal.vue'
|
||||||
import AppStage from '@/components/AppStage.vue'
|
import AppStage from '@/components/AppStage.vue'
|
||||||
import ModuleButton from '@/components/ModuleButton.vue'
|
import ModuleButton from '@/components/ModuleButton.vue'
|
||||||
import PrinciplePlayer from '@/components/PrinciplePlayer.vue'
|
import PrinciplePlayer from '@/components/PrinciplePlayer.vue'
|
||||||
import UnderDevelopmentModal from '@/components/UnderDevelopmentModal.vue'
|
import UnderDevelopmentModal from '@/components/UnderDevelopmentModal.vue'
|
||||||
|
import { getDeviceStatus, retryDevices, type DeviceStatus } from '@/api/device'
|
||||||
|
import { showToast } from '@/composables/useToast'
|
||||||
import logo from '@/assets/logo.png'
|
import logo from '@/assets/logo.png'
|
||||||
|
|
||||||
type ModuleTone = 'blue' | 'orange' | 'green' | 'teal'
|
type ModuleTone = 'blue' | 'orange' | 'green' | 'teal'
|
||||||
@@ -14,21 +17,98 @@ type ModuleIconName = 'detect' | 'metal' | 'soil' | 'water'
|
|||||||
interface HomeModule {
|
interface HomeModule {
|
||||||
key: string
|
key: string
|
||||||
title: string
|
title: string
|
||||||
|
caption: string
|
||||||
tone: ModuleTone
|
tone: ModuleTone
|
||||||
icon: ModuleIconName
|
icon: ModuleIconName
|
||||||
}
|
}
|
||||||
|
|
||||||
const modules: HomeModule[] = [
|
const modules: HomeModule[] = [
|
||||||
{ key: 'element', title: '元素检测', tone: 'blue', icon: 'detect' },
|
{
|
||||||
{ key: 'metal', title: '金属鉴别', tone: 'orange', icon: 'metal' },
|
key: 'element',
|
||||||
{ key: 'soil', title: '土壤与沉积物筛查', tone: 'green', icon: 'soil' },
|
title: '元素检测',
|
||||||
{ key: 'water', title: '水体液体分析', tone: 'teal', icon: 'water' },
|
caption: 'Elemental Analysis',
|
||||||
|
tone: 'blue',
|
||||||
|
icon: 'detect',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'metal',
|
||||||
|
title: '金属鉴别',
|
||||||
|
caption: 'Metal Identification',
|
||||||
|
tone: 'orange',
|
||||||
|
icon: 'metal',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'soil',
|
||||||
|
title: '土壤与沉积物筛查',
|
||||||
|
caption: 'Soil & Sediment',
|
||||||
|
tone: 'green',
|
||||||
|
icon: 'soil',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'water',
|
||||||
|
title: '水体液体分析',
|
||||||
|
caption: 'Water & Liquid',
|
||||||
|
tone: 'teal',
|
||||||
|
icon: 'water',
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
// 顶部装饰频谱条,仅用于视觉点缀
|
||||||
|
const spectrumBars = [22, 40, 64, 34, 52, 72, 44, 60, 30, 50, 66, 38, 56, 26]
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const modalOpen = ref(false)
|
const modalOpen = ref(false)
|
||||||
const modalModule = ref('')
|
const modalModule = ref('')
|
||||||
const adminModalOpen = ref(false)
|
const adminModalOpen = ref(false)
|
||||||
|
const adminPanelOpen = ref(false)
|
||||||
|
|
||||||
|
// 设备连接状态:启动连接失败时在首页提示,并允许手动重试。
|
||||||
|
const deviceStatus = ref<DeviceStatus | null>(null)
|
||||||
|
const deviceRetrying = ref(false)
|
||||||
|
let deviceTimer: number | undefined
|
||||||
|
|
||||||
|
const failedDevices = computed(() =>
|
||||||
|
(deviceStatus.value?.devices ?? []).filter((item) => item.status === 'failed'),
|
||||||
|
)
|
||||||
|
|
||||||
|
const connectingDevices = computed(() =>
|
||||||
|
(deviceStatus.value?.devices ?? []).filter(
|
||||||
|
(item) => item.status === 'connecting',
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
const showDeviceBanner = computed(
|
||||||
|
() =>
|
||||||
|
failedDevices.value.length > 0 || connectingDevices.value.length > 0,
|
||||||
|
)
|
||||||
|
|
||||||
|
async function refreshDevices() {
|
||||||
|
try {
|
||||||
|
deviceStatus.value = await getDeviceStatus()
|
||||||
|
} catch {
|
||||||
|
// 后端未启动或不可达时保持静默,避免打扰首页演示
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function retryDeviceConnections() {
|
||||||
|
if (deviceRetrying.value) return
|
||||||
|
|
||||||
|
deviceRetrying.value = true
|
||||||
|
try {
|
||||||
|
deviceStatus.value = await retryDevices()
|
||||||
|
if (deviceStatus.value.allConnected) {
|
||||||
|
showToast('所有设备已连接')
|
||||||
|
} else {
|
||||||
|
showToast('仍有设备连接失败,请检查硬件连接')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
showToast(
|
||||||
|
error instanceof Error ? error.message : '重试设备连接失败',
|
||||||
|
)
|
||||||
|
} finally {
|
||||||
|
deviceRetrying.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 隐藏入口:800ms 内连续点击 Logo 三次,打开管理员密码框。
|
// 隐藏入口:800ms 内连续点击 Logo 三次,打开管理员密码框。
|
||||||
const LOGO_CLICK_WINDOW = 800
|
const LOGO_CLICK_WINDOW = 800
|
||||||
@@ -57,13 +137,80 @@ function onLogoClick() {
|
|||||||
|
|
||||||
function onAdminSuccess() {
|
function onAdminSuccess() {
|
||||||
adminModalOpen.value = false
|
adminModalOpen.value = false
|
||||||
|
adminPanelOpen.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 隐藏入口:800ms 内连续点击标题中的“素”字三次,切换/退出浏览器全屏。
|
||||||
|
const FULLSCREEN_CLICK_WINDOW = 800
|
||||||
|
let fullscreenClickCount = 0
|
||||||
|
let fullscreenTimer: number | undefined
|
||||||
|
|
||||||
|
async function toggleFullscreen() {
|
||||||
|
try {
|
||||||
|
if (document.fullscreenElement) {
|
||||||
|
await document.exitFullscreen()
|
||||||
|
} else {
|
||||||
|
await document.documentElement.requestFullscreen()
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
showToast('当前浏览器无法切换全屏')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onTitleCharClick() {
|
||||||
|
if (fullscreenTimer !== undefined) {
|
||||||
|
window.clearTimeout(fullscreenTimer)
|
||||||
|
}
|
||||||
|
|
||||||
|
fullscreenClickCount += 1
|
||||||
|
|
||||||
|
if (fullscreenClickCount >= 3) {
|
||||||
|
fullscreenClickCount = 0
|
||||||
|
fullscreenTimer = undefined
|
||||||
|
void toggleFullscreen()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
fullscreenTimer = window.setTimeout(() => {
|
||||||
|
fullscreenClickCount = 0
|
||||||
|
fullscreenTimer = undefined
|
||||||
|
}, FULLSCREEN_CLICK_WINDOW)
|
||||||
|
}
|
||||||
|
|
||||||
|
function openSystemConfig() {
|
||||||
|
adminPanelOpen.value = false
|
||||||
void router.push({ name: 'systemConfig' })
|
void router.push({ name: 'systemConfig' })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openRulerSetting() {
|
||||||
|
adminPanelOpen.value = false
|
||||||
|
void router.push({ name: 'ruler' })
|
||||||
|
}
|
||||||
|
|
||||||
|
function openHistory() {
|
||||||
|
adminPanelOpen.value = false
|
||||||
|
void router.push({ name: 'history' })
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
void refreshDevices()
|
||||||
|
deviceTimer = window.setInterval(refreshDevices, 5000)
|
||||||
|
})
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
if (logoTimer !== undefined) {
|
if (logoTimer !== undefined) {
|
||||||
window.clearTimeout(logoTimer)
|
window.clearTimeout(logoTimer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fullscreenTimer !== undefined) {
|
||||||
|
window.clearTimeout(fullscreenTimer)
|
||||||
|
fullscreenTimer = undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
if (deviceTimer !== undefined) {
|
||||||
|
window.clearInterval(deviceTimer)
|
||||||
|
deviceTimer = undefined
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
function openModule(module: HomeModule) {
|
function openModule(module: HomeModule) {
|
||||||
@@ -80,30 +227,91 @@ function openModule(module: HomeModule) {
|
|||||||
<template>
|
<template>
|
||||||
<AppStage>
|
<AppStage>
|
||||||
<div class="home">
|
<div class="home">
|
||||||
|
<div class="home-bg" aria-hidden="true">
|
||||||
|
<span class="home-bg__orb home-bg__orb--blue"></span>
|
||||||
|
<span class="home-bg__orb home-bg__orb--cyan"></span>
|
||||||
|
<span class="home-bg__orb home-bg__orb--violet"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<header class="home-header">
|
<header class="home-header">
|
||||||
<div class="brand">
|
<div class="brand">
|
||||||
<img :src="logo" alt="泽科技 LIBS 标识" @click="onLogoClick" />
|
<span class="brand__mark" @click="onLogoClick">
|
||||||
<span>LIBS</span>
|
<img :src="logo" alt="泽科技 LIBS 标识" />
|
||||||
|
</span>
|
||||||
|
<span class="brand__text">
|
||||||
|
<span class="brand__name">LIBS</span>
|
||||||
|
<span class="brand__sub">Laser Induced Breakdown Spectroscopy</span>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="headline">
|
<div class="headline">
|
||||||
<h1>激光诱导击穿光谱 元素分析系统</h1>
|
<h1>
|
||||||
<p>开放 · 共享 · 自助式元素检测平台</p>
|
激光诱导击穿光谱
|
||||||
|
<em>元<span class="headline__hotspot" @click="onTitleCharClick">素</span>分析系统</em>
|
||||||
|
</h1>
|
||||||
|
<p>开放 <i>·</i> 共享 <i>·</i> 自助式元素检测平台</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="spectrum-deco" aria-hidden="true">
|
||||||
|
<span
|
||||||
|
v-for="(height, index) in spectrumBars"
|
||||||
|
:key="index"
|
||||||
|
:style="{ height: `${height}px`, animationDelay: `${index * 0.09}s` }"
|
||||||
|
></span>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="showDeviceBanner"
|
||||||
|
class="device-banner"
|
||||||
|
:class="{ 'device-banner--error': failedDevices.length > 0 }"
|
||||||
|
>
|
||||||
|
<span class="device-banner__dot"></span>
|
||||||
|
<span class="device-banner__text">
|
||||||
|
<template v-if="failedDevices.length">
|
||||||
|
设备连接失败:{{ failedDevices.map((item) => item.name).join('、') }}
|
||||||
|
<small v-if="failedDevices[0].message">
|
||||||
|
({{ failedDevices[0].message }})
|
||||||
|
</small>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
正在连接设备:{{ connectingDevices.map((item) => item.name).join('、') }}
|
||||||
|
</template>
|
||||||
|
</span>
|
||||||
|
<button
|
||||||
|
v-if="failedDevices.length"
|
||||||
|
class="device-banner__retry"
|
||||||
|
type="button"
|
||||||
|
:disabled="deviceRetrying"
|
||||||
|
@click="retryDeviceConnections"
|
||||||
|
>
|
||||||
|
{{ deviceRetrying ? '重试中...' : '重试连接' }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<main class="home-main">
|
<main class="home-main">
|
||||||
<section class="modules-panel">
|
<section class="modules-panel">
|
||||||
|
<div class="modules-panel__head">
|
||||||
|
<span class="modules-panel__eyebrow">Analysis Modules</span>
|
||||||
|
<h2>选择检测模式</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="modules-grid">
|
<div class="modules-grid">
|
||||||
<ModuleButton
|
<ModuleButton
|
||||||
v-for="module in modules"
|
v-for="(module, index) in modules"
|
||||||
:key="module.key"
|
:key="module.key"
|
||||||
:title="module.title"
|
:title="module.title"
|
||||||
|
:caption="module.caption"
|
||||||
|
:index="String(index + 1).padStart(2, '0')"
|
||||||
:tone="module.tone"
|
:tone="module.tone"
|
||||||
:icon="module.icon"
|
:icon="module.icon"
|
||||||
@click="openModule(module)"
|
@click="openModule(module)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<p class="modules-panel__foot">
|
||||||
|
点击卡片进入对应检测流程 · 更多场景持续扩展
|
||||||
|
</p>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<PrinciplePlayer class="home-player" />
|
<PrinciplePlayer class="home-player" />
|
||||||
@@ -121,6 +329,14 @@ function openModule(module: HomeModule) {
|
|||||||
@close="adminModalOpen = false"
|
@close="adminModalOpen = false"
|
||||||
@success="onAdminSuccess"
|
@success="onAdminSuccess"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<AdminFunctionPanel
|
||||||
|
:open="adminPanelOpen"
|
||||||
|
@close="adminPanelOpen = false"
|
||||||
|
@system-config="openSystemConfig"
|
||||||
|
@ruler="openRulerSetting"
|
||||||
|
@history="openHistory"
|
||||||
|
/>
|
||||||
</AppStage>
|
</AppStage>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -128,7 +344,74 @@ function openModule(module: HomeModule) {
|
|||||||
.home {
|
.home {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
background: #f0f2f5;
|
overflow: hidden;
|
||||||
|
background:
|
||||||
|
radial-gradient(1100px 640px at 10% -18%, rgba(48, 112, 255, 0.32), transparent 62%),
|
||||||
|
radial-gradient(860px 560px at 96% 2%, rgba(0, 209, 255, 0.16), transparent 60%),
|
||||||
|
radial-gradient(900px 680px at 62% 118%, rgba(122, 84, 255, 0.2), transparent 62%),
|
||||||
|
linear-gradient(156deg, #050a16 0%, #081226 46%, #0a1730 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-bg {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-bg::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background-image:
|
||||||
|
linear-gradient(rgba(130, 175, 255, 0.055) 1px, transparent 1px),
|
||||||
|
linear-gradient(90deg, rgba(130, 175, 255, 0.055) 1px, transparent 1px);
|
||||||
|
background-size: 64px 64px;
|
||||||
|
mask-image: radial-gradient(ellipse 75% 70% at 50% 30%, #000 20%, transparent 78%);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-bg__orb {
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 50%;
|
||||||
|
filter: blur(100px);
|
||||||
|
animation: orb-drift 16s ease-in-out infinite alternate;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-bg__orb--blue {
|
||||||
|
top: -340px;
|
||||||
|
left: -160px;
|
||||||
|
width: 780px;
|
||||||
|
height: 780px;
|
||||||
|
background: rgba(48, 118, 255, 0.34);
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-bg__orb--cyan {
|
||||||
|
top: -220px;
|
||||||
|
right: -200px;
|
||||||
|
width: 660px;
|
||||||
|
height: 660px;
|
||||||
|
background: rgba(0, 214, 255, 0.2);
|
||||||
|
animation-delay: -5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-bg__orb--violet {
|
||||||
|
bottom: -360px;
|
||||||
|
left: 34%;
|
||||||
|
width: 720px;
|
||||||
|
height: 720px;
|
||||||
|
background: rgba(124, 92, 255, 0.22);
|
||||||
|
animation-delay: -10s;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes orb-drift {
|
||||||
|
from {
|
||||||
|
transform: translate3d(0, 0, 0) scale(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
transform: translate3d(42px, 30px, 0) scale(1.08);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.home-header {
|
.home-header {
|
||||||
@@ -138,32 +421,69 @@ function openModule(module: HomeModule) {
|
|||||||
left: 0;
|
left: 0;
|
||||||
height: 180px;
|
height: 180px;
|
||||||
padding: 24px 44px;
|
padding: 24px 44px;
|
||||||
background: #f4f5f7;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.brand {
|
.brand {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 14px;
|
gap: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.brand img {
|
.brand__mark {
|
||||||
width: 100px;
|
display: grid;
|
||||||
height: 100px;
|
place-items: center;
|
||||||
|
width: 92px;
|
||||||
|
height: 92px;
|
||||||
|
padding: 6px;
|
||||||
|
border-radius: 24px;
|
||||||
|
background: #fff;
|
||||||
|
box-shadow:
|
||||||
|
0 14px 34px rgba(0, 18, 52, 0.55),
|
||||||
|
0 0 0 1px rgba(255, 255, 255, 0.18);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: transform 0.25s ease, box-shadow 0.25s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand__mark:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow:
|
||||||
|
0 18px 40px rgba(0, 18, 52, 0.6),
|
||||||
|
0 0 26px rgba(90, 160, 255, 0.35);
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand__mark img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
mix-blend-mode: multiply;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.brand span {
|
.brand__text {
|
||||||
color: #253243;
|
display: flex;
|
||||||
font-size: 32px;
|
flex-direction: column;
|
||||||
|
gap: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand__name {
|
||||||
|
color: transparent;
|
||||||
|
background: linear-gradient(120deg, #eef6ff 0%, #9cc6ff 55%, #4d8bf0 100%);
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
background-clip: text;
|
||||||
|
font-size: 40px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
letter-spacing: 2px;
|
letter-spacing: 5px;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand__sub {
|
||||||
|
color: rgba(150, 182, 222, 0.6);
|
||||||
|
font-size: 11px;
|
||||||
|
letter-spacing: 2.2px;
|
||||||
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
.headline {
|
.headline {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 40px;
|
top: 32px;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
transform: translateX(-50%);
|
transform: translateX(-50%);
|
||||||
@@ -171,18 +491,140 @@ function openModule(module: HomeModule) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.headline h1 {
|
.headline h1 {
|
||||||
color: #1f2937;
|
color: #eef5ff;
|
||||||
font-size: 44px;
|
font-size: 46px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
letter-spacing: 6px;
|
letter-spacing: 7px;
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
|
text-shadow: 0 0 32px rgba(80, 150, 255, 0.32);
|
||||||
|
}
|
||||||
|
|
||||||
|
.headline h1 em {
|
||||||
|
color: transparent;
|
||||||
|
background: linear-gradient(100deg, #7fe0ff 0%, #5aa2ff 52%, #9b86ff 100%);
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
background-clip: text;
|
||||||
|
font-style: normal;
|
||||||
|
filter: drop-shadow(0 0 18px rgba(90, 160, 255, 0.35));
|
||||||
|
}
|
||||||
|
|
||||||
|
.headline h1 em .headline__hotspot {
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.headline p {
|
.headline p {
|
||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
color: #4d5969;
|
color: rgba(158, 190, 226, 0.72);
|
||||||
font-size: 20px;
|
font-size: 18px;
|
||||||
letter-spacing: 4px;
|
letter-spacing: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.headline p i {
|
||||||
|
margin: 0 12px;
|
||||||
|
color: rgba(90, 160, 255, 0.85);
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spectrum-deco {
|
||||||
|
position: absolute;
|
||||||
|
top: 46px;
|
||||||
|
right: 44px;
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
gap: 5px;
|
||||||
|
height: 76px;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spectrum-deco span {
|
||||||
|
width: 4px;
|
||||||
|
border-radius: 3px;
|
||||||
|
background: linear-gradient(180deg, rgba(130, 214, 255, 0.95), rgba(70, 130, 255, 0.15));
|
||||||
|
transform-origin: bottom center;
|
||||||
|
animation: bar-pulse 2.6s ease-in-out infinite alternate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes bar-pulse {
|
||||||
|
from {
|
||||||
|
opacity: 0.45;
|
||||||
|
transform: scaleY(0.45);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
opacity: 0.95;
|
||||||
|
transform: scaleY(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-banner {
|
||||||
|
position: absolute;
|
||||||
|
top: 142px;
|
||||||
|
right: 44px;
|
||||||
|
left: 44px;
|
||||||
|
z-index: 5;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
height: 44px;
|
||||||
|
padding: 0 18px;
|
||||||
|
border: 1px solid rgba(255, 196, 80, 0.35);
|
||||||
|
border-radius: 12px;
|
||||||
|
background: linear-gradient(120deg, rgba(255, 180, 40, 0.16), rgba(255, 180, 40, 0.06));
|
||||||
|
color: #ffd98a;
|
||||||
|
font-size: 17px;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
backdrop-filter: blur(12px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-banner--error {
|
||||||
|
border-color: rgba(255, 107, 107, 0.4);
|
||||||
|
background: linear-gradient(120deg, rgba(255, 84, 84, 0.18), rgba(255, 84, 84, 0.06));
|
||||||
|
color: #ff9d9d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-banner__dot {
|
||||||
|
flex: none;
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: currentColor;
|
||||||
|
box-shadow: 0 0 10px currentColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-banner__text {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-banner__text small {
|
||||||
|
color: inherit;
|
||||||
|
opacity: 0.72;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-banner__retry {
|
||||||
|
flex: none;
|
||||||
|
height: 32px;
|
||||||
|
padding: 0 18px;
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.32);
|
||||||
|
border-radius: 8px;
|
||||||
|
background: rgba(255, 255, 255, 0.08);
|
||||||
|
color: inherit;
|
||||||
|
font-size: 16px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-banner__retry:hover {
|
||||||
|
background: rgba(255, 255, 255, 0.16);
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-banner__retry:disabled {
|
||||||
|
cursor: default;
|
||||||
|
opacity: 0.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.home-main {
|
.home-main {
|
||||||
@@ -197,12 +639,75 @@ function openModule(module: HomeModule) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.modules-panel {
|
.modules-panel {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 30px;
|
||||||
|
padding: 34px;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid rgba(140, 182, 255, 0.14);
|
||||||
|
border-radius: 26px;
|
||||||
|
background: linear-gradient(
|
||||||
|
155deg,
|
||||||
|
rgba(255, 255, 255, 0.07) 0%,
|
||||||
|
rgba(255, 255, 255, 0.025) 55%,
|
||||||
|
rgba(255, 255, 255, 0.05) 100%
|
||||||
|
);
|
||||||
|
box-shadow:
|
||||||
|
0 30px 70px rgba(0, 10, 32, 0.5),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.09);
|
||||||
|
backdrop-filter: blur(16px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modules-panel::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 40px;
|
||||||
|
left: 40px;
|
||||||
|
height: 1px;
|
||||||
|
background: linear-gradient(90deg, transparent, rgba(120, 180, 255, 0.6), transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modules-panel__head {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modules-panel__eyebrow {
|
||||||
|
color: #5aa2ff;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 3.4px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modules-panel__head h2 {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 34px;
|
gap: 12px;
|
||||||
border-radius: 20px;
|
color: #eaf3ff;
|
||||||
background: #fff;
|
font-size: 30px;
|
||||||
box-shadow: var(--shadow-card);
|
font-weight: 600;
|
||||||
|
letter-spacing: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modules-panel__head h2::before {
|
||||||
|
content: '';
|
||||||
|
width: 4px;
|
||||||
|
height: 26px;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: linear-gradient(180deg, #7fe0ff, #4d8bf0);
|
||||||
|
box-shadow: 0 0 14px rgba(90, 170, 255, 0.7);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modules-panel__foot {
|
||||||
|
color: rgba(140, 172, 208, 0.55);
|
||||||
|
font-size: 14px;
|
||||||
|
letter-spacing: 1.4px;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modules-grid {
|
.modules-grid {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,885 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
import AppStage from '@/components/AppStage.vue'
|
||||||
|
import PageHeader from '@/components/PageHeader.vue'
|
||||||
|
import { connectCamera } from '@/api/camera'
|
||||||
|
import {
|
||||||
|
SystemConfigApiError,
|
||||||
|
clearAdminSession,
|
||||||
|
createSystemConfig,
|
||||||
|
listSystemConfigs,
|
||||||
|
updateSystemConfig,
|
||||||
|
} from '@/api/systemConfig'
|
||||||
|
import { useCameraStatus } from '@/composables/useCameraStatus'
|
||||||
|
import { useCameraStream } from '@/composables/useCameraStream'
|
||||||
|
import { showToast } from '@/composables/useToast'
|
||||||
|
import cameraPlaceholder from '@/assets/camera-placeholder.webp'
|
||||||
|
|
||||||
|
interface Point {
|
||||||
|
x: number
|
||||||
|
y: number
|
||||||
|
}
|
||||||
|
|
||||||
|
const SCALE_CONFIG_NAME = 'camera_scale'
|
||||||
|
const MIN_LINE_PIXELS = 4
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
const { state: cameraState, refresh, startPolling } = useCameraStatus(5000, false)
|
||||||
|
const { state: streamState, frameUrl, isLive, connect } = useCameraStream()
|
||||||
|
|
||||||
|
const viewport = ref<HTMLElement | null>(null)
|
||||||
|
const overlay = ref<SVGSVGElement | null>(null)
|
||||||
|
|
||||||
|
// 相机原始画面尺寸(像素),用于把显示坐标换算成采集画面像素
|
||||||
|
const frameWidth = ref(0)
|
||||||
|
const frameHeight = ref(0)
|
||||||
|
const overlayRect = ref({ left: 0, top: 0, width: 0, height: 0 })
|
||||||
|
|
||||||
|
const startPoint = ref<Point | null>(null)
|
||||||
|
const endPoint = ref<Point | null>(null)
|
||||||
|
const drawing = ref(false)
|
||||||
|
|
||||||
|
const distanceModalOpen = ref(false)
|
||||||
|
const distanceInput = ref('')
|
||||||
|
const inputError = ref('')
|
||||||
|
const saving = ref(false)
|
||||||
|
const distanceField = ref<HTMLInputElement | null>(null)
|
||||||
|
|
||||||
|
const statusText = computed(() => {
|
||||||
|
if (isLive.value) return '实时画面'
|
||||||
|
if (
|
||||||
|
streamState.value === 'connecting' ||
|
||||||
|
cameraState.value === 'checking'
|
||||||
|
) {
|
||||||
|
return '连接中'
|
||||||
|
}
|
||||||
|
if (cameraState.value === 'offline') return '相机服务离线'
|
||||||
|
return '等待画面'
|
||||||
|
})
|
||||||
|
|
||||||
|
const overlayStyle = computed(() => ({
|
||||||
|
left: `${overlayRect.value.left}px`,
|
||||||
|
top: `${overlayRect.value.top}px`,
|
||||||
|
width: `${overlayRect.value.width}px`,
|
||||||
|
height: `${overlayRect.value.height}px`,
|
||||||
|
}))
|
||||||
|
|
||||||
|
const pixelDistance = computed(() => {
|
||||||
|
if (!startPoint.value || !endPoint.value) return 0
|
||||||
|
return Math.hypot(
|
||||||
|
endPoint.value.x - startPoint.value.x,
|
||||||
|
endPoint.value.y - startPoint.value.y,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
const handleRadius = computed(() => Math.max(6, frameWidth.value * 0.006))
|
||||||
|
|
||||||
|
function goHome() {
|
||||||
|
void router.replace({ name: 'home' })
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 根据相机原始比例计算画面在容器内的实际显示区域 */
|
||||||
|
function updateOverlayRect() {
|
||||||
|
const element = viewport.value
|
||||||
|
if (!element || !frameWidth.value || !frameHeight.value) return
|
||||||
|
|
||||||
|
const viewWidth = element.clientWidth
|
||||||
|
const viewHeight = element.clientHeight
|
||||||
|
if (!viewWidth || !viewHeight) return
|
||||||
|
|
||||||
|
const aspect = frameWidth.value / frameHeight.value
|
||||||
|
let width = viewWidth
|
||||||
|
let height = viewHeight
|
||||||
|
|
||||||
|
if (viewWidth / viewHeight > aspect) {
|
||||||
|
width = viewHeight * aspect
|
||||||
|
} else {
|
||||||
|
height = viewWidth / aspect
|
||||||
|
}
|
||||||
|
|
||||||
|
overlayRect.value = {
|
||||||
|
left: (viewWidth - width) / 2,
|
||||||
|
top: (viewHeight - height) / 2,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onImageLoad(event: Event) {
|
||||||
|
if (!frameUrl.value) return
|
||||||
|
|
||||||
|
const image = event.target as HTMLImageElement
|
||||||
|
if (!image.naturalWidth || !image.naturalHeight) return
|
||||||
|
|
||||||
|
frameWidth.value = image.naturalWidth
|
||||||
|
frameHeight.value = image.naturalHeight
|
||||||
|
updateOverlayRect()
|
||||||
|
}
|
||||||
|
|
||||||
|
function pointFromEvent(event: PointerEvent): Point | null {
|
||||||
|
const element = overlay.value
|
||||||
|
if (!element || !frameWidth.value || !frameHeight.value) return null
|
||||||
|
|
||||||
|
const rect = element.getBoundingClientRect()
|
||||||
|
if (!rect.width || !rect.height) return null
|
||||||
|
|
||||||
|
return {
|
||||||
|
x: ((event.clientX - rect.left) / rect.width) * frameWidth.value,
|
||||||
|
y: ((event.clientY - rect.top) / rect.height) * frameHeight.value,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearLine() {
|
||||||
|
startPoint.value = null
|
||||||
|
endPoint.value = null
|
||||||
|
drawing.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
function onPointerDown(event: PointerEvent) {
|
||||||
|
if (!isLive.value || distanceModalOpen.value || event.button !== 0) return
|
||||||
|
|
||||||
|
const point = pointFromEvent(event)
|
||||||
|
if (!point) return
|
||||||
|
|
||||||
|
startPoint.value = point
|
||||||
|
endPoint.value = point
|
||||||
|
drawing.value = true
|
||||||
|
overlay.value?.setPointerCapture(event.pointerId)
|
||||||
|
}
|
||||||
|
|
||||||
|
function onPointerMove(event: PointerEvent) {
|
||||||
|
if (!drawing.value) return
|
||||||
|
|
||||||
|
const point = pointFromEvent(event)
|
||||||
|
if (point) endPoint.value = point
|
||||||
|
}
|
||||||
|
|
||||||
|
function finishDrawing() {
|
||||||
|
if (!drawing.value) return
|
||||||
|
drawing.value = false
|
||||||
|
|
||||||
|
if (pixelDistance.value < MIN_LINE_PIXELS) {
|
||||||
|
clearLine()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
distanceInput.value = ''
|
||||||
|
inputError.value = ''
|
||||||
|
distanceModalOpen.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function onPointerUp(event: PointerEvent) {
|
||||||
|
if (overlay.value?.hasPointerCapture(event.pointerId)) {
|
||||||
|
overlay.value.releasePointerCapture(event.pointerId)
|
||||||
|
}
|
||||||
|
finishDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
function onPointerCancel(event: PointerEvent) {
|
||||||
|
if (overlay.value?.hasPointerCapture(event.pointerId)) {
|
||||||
|
overlay.value.releasePointerCapture(event.pointerId)
|
||||||
|
}
|
||||||
|
finishDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancelDistanceInput() {
|
||||||
|
if (saving.value) return
|
||||||
|
distanceModalOpen.value = false
|
||||||
|
clearLine()
|
||||||
|
}
|
||||||
|
|
||||||
|
async function confirmDistance() {
|
||||||
|
if (saving.value) return
|
||||||
|
|
||||||
|
const distanceMm = Number(distanceInput.value)
|
||||||
|
if (!Number.isFinite(distanceMm) || distanceMm <= 0) {
|
||||||
|
inputError.value = '请输入大于 0 的实际距离'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pixelDistance.value < MIN_LINE_PIXELS) {
|
||||||
|
inputError.value = '线段无效,请重新绘制'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
saving.value = true
|
||||||
|
inputError.value = ''
|
||||||
|
|
||||||
|
try {
|
||||||
|
const scale = pixelDistance.value / distanceMm
|
||||||
|
const scaleValue = scale.toFixed(2)
|
||||||
|
|
||||||
|
const matches = await listSystemConfigs(SCALE_CONFIG_NAME)
|
||||||
|
const existing = matches.find(
|
||||||
|
(item) => item.configName.trim().toLowerCase() === SCALE_CONFIG_NAME,
|
||||||
|
)
|
||||||
|
|
||||||
|
if (existing) {
|
||||||
|
await updateSystemConfig(existing.configId, {
|
||||||
|
configClass: existing.configClass || '相机',
|
||||||
|
configName: SCALE_CONFIG_NAME,
|
||||||
|
configValue: scaleValue,
|
||||||
|
configDescript: existing.configDescript || '标尺比例(像素/毫米)',
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
await createSystemConfig({
|
||||||
|
configClass: '相机',
|
||||||
|
configName: SCALE_CONFIG_NAME,
|
||||||
|
configValue: scaleValue,
|
||||||
|
configDescript: '标尺比例(像素/毫米)',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
distanceModalOpen.value = false
|
||||||
|
showToast(`标尺设定完成:${scaleValue} px/mm`)
|
||||||
|
goHome()
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof SystemConfigApiError && error.status === 401) {
|
||||||
|
clearAdminSession()
|
||||||
|
showToast('管理员凭证已过期,请重新进入标尺设定')
|
||||||
|
goHome()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
inputError.value = error instanceof Error ? error.message : '标尺保存失败'
|
||||||
|
} finally {
|
||||||
|
saving.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onModalKeydown(event: KeyboardEvent) {
|
||||||
|
if (event.key === 'Escape') cancelDistanceInput()
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(distanceModalOpen, async (open) => {
|
||||||
|
if (open) {
|
||||||
|
window.addEventListener('keydown', onModalKeydown)
|
||||||
|
await nextTick()
|
||||||
|
distanceField.value?.focus()
|
||||||
|
} else {
|
||||||
|
window.removeEventListener('keydown', onModalKeydown)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(frameUrl, (url) => {
|
||||||
|
if (!url) {
|
||||||
|
clearLine()
|
||||||
|
frameWidth.value = 0
|
||||||
|
frameHeight.value = 0
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
await refresh()
|
||||||
|
|
||||||
|
const streamPromise = connect()
|
||||||
|
|
||||||
|
if (cameraState.value === 'disconnected') {
|
||||||
|
try {
|
||||||
|
await connectCamera()
|
||||||
|
await refresh()
|
||||||
|
} catch {
|
||||||
|
// 没有相机或服务不可达时保留占位画面
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
startPolling()
|
||||||
|
await streamPromise
|
||||||
|
})
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
window.removeEventListener('keydown', onModalKeydown)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<AppStage>
|
||||||
|
<div class="ruler-bg" aria-hidden="true">
|
||||||
|
<span class="ruler-bg__orb ruler-bg__orb--blue"></span>
|
||||||
|
<span class="ruler-bg__orb ruler-bg__orb--cyan"></span>
|
||||||
|
<span class="ruler-bg__orb ruler-bg__orb--violet"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<PageHeader
|
||||||
|
title="标尺设定"
|
||||||
|
subtitle="在相机画面中拖动画线,输入实际距离完成标定"
|
||||||
|
theme="dark"
|
||||||
|
>
|
||||||
|
<template #left>
|
||||||
|
<button class="admin-back" type="button" @click="goHome">
|
||||||
|
返回
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
</PageHeader>
|
||||||
|
|
||||||
|
<main class="ruler-main">
|
||||||
|
<section class="ruler-card">
|
||||||
|
<header class="ruler-card__header">
|
||||||
|
<h2>相机画面</h2>
|
||||||
|
<span class="ruler-card__status">
|
||||||
|
<i class="ruler-card__dot" :class="{ 'ruler-card__dot--on': isLive }"></i>
|
||||||
|
{{ statusText }}
|
||||||
|
</span>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div ref="viewport" class="ruler-viewport">
|
||||||
|
<img
|
||||||
|
class="ruler-viewport__image"
|
||||||
|
:src="frameUrl ?? cameraPlaceholder"
|
||||||
|
:alt="frameUrl ? '相机实时画面' : '相机预览画面'"
|
||||||
|
draggable="false"
|
||||||
|
@load="onImageLoad"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<svg
|
||||||
|
v-if="frameUrl && frameWidth && frameHeight"
|
||||||
|
ref="overlay"
|
||||||
|
class="ruler-overlay"
|
||||||
|
:style="overlayStyle"
|
||||||
|
:viewBox="`0 0 ${frameWidth} ${frameHeight}`"
|
||||||
|
preserveAspectRatio="none"
|
||||||
|
@pointerdown="onPointerDown"
|
||||||
|
@pointermove="onPointerMove"
|
||||||
|
@pointerup="onPointerUp"
|
||||||
|
@pointercancel="onPointerCancel"
|
||||||
|
>
|
||||||
|
<line
|
||||||
|
v-if="startPoint && endPoint"
|
||||||
|
class="ruler-line"
|
||||||
|
:x1="startPoint.x"
|
||||||
|
:y1="startPoint.y"
|
||||||
|
:x2="endPoint.x"
|
||||||
|
:y2="endPoint.y"
|
||||||
|
vector-effect="non-scaling-stroke"
|
||||||
|
/>
|
||||||
|
<circle
|
||||||
|
v-if="startPoint"
|
||||||
|
class="ruler-handle"
|
||||||
|
:cx="startPoint.x"
|
||||||
|
:cy="startPoint.y"
|
||||||
|
:r="handleRadius"
|
||||||
|
/>
|
||||||
|
<circle
|
||||||
|
v-if="endPoint"
|
||||||
|
class="ruler-handle"
|
||||||
|
:cx="endPoint.x"
|
||||||
|
:cy="endPoint.y"
|
||||||
|
:r="handleRadius"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
<p v-if="!isLive" class="ruler-viewport__tip">等待相机画面...</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<footer class="ruler-card__footer">
|
||||||
|
<span class="ruler-card__step">1</span>
|
||||||
|
<span>按住鼠标左键,沿已知实际长度的物体拖动画线</span>
|
||||||
|
<span class="ruler-card__divider"></span>
|
||||||
|
<span class="ruler-card__step">2</span>
|
||||||
|
<span>松开后输入该线段的实际距离(mm),确认后自动计算比例尺</span>
|
||||||
|
</footer>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<Teleport to="body">
|
||||||
|
<Transition name="distance-modal">
|
||||||
|
<div v-if="distanceModalOpen" class="distance-backdrop" @click.self="cancelDistanceInput">
|
||||||
|
<section class="distance-card" role="dialog" aria-modal="true" aria-label="输入实际距离">
|
||||||
|
<h2>输入实际距离</h2>
|
||||||
|
<p>线段像素长度:<strong>{{ pixelDistance.toFixed(1) }} px</strong></p>
|
||||||
|
|
||||||
|
<form class="distance-form" @submit.prevent="confirmDistance">
|
||||||
|
<label class="distance-field">
|
||||||
|
<span>实际距离</span>
|
||||||
|
<div class="distance-field__control">
|
||||||
|
<input
|
||||||
|
ref="distanceField"
|
||||||
|
v-model="distanceInput"
|
||||||
|
type="number"
|
||||||
|
min="0"
|
||||||
|
step="0.01"
|
||||||
|
inputmode="decimal"
|
||||||
|
placeholder="例如:100"
|
||||||
|
:disabled="saving"
|
||||||
|
/>
|
||||||
|
<span class="distance-field__unit">mm</span>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<p v-if="inputError" class="distance-error">{{ inputError }}</p>
|
||||||
|
|
||||||
|
<div class="distance-actions">
|
||||||
|
<button
|
||||||
|
class="distance-button distance-button--ghost"
|
||||||
|
type="button"
|
||||||
|
:disabled="saving"
|
||||||
|
@click="cancelDistanceInput"
|
||||||
|
>
|
||||||
|
重画
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="distance-button distance-button--primary"
|
||||||
|
type="submit"
|
||||||
|
:disabled="saving"
|
||||||
|
>
|
||||||
|
{{ saving ? '保存中...' : '确定' }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</Transition>
|
||||||
|
</Teleport>
|
||||||
|
</AppStage>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.ruler-bg {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
pointer-events: none;
|
||||||
|
background:
|
||||||
|
radial-gradient(1000px 600px at 8% -16%, rgba(48, 112, 255, 0.28), transparent 62%),
|
||||||
|
radial-gradient(820px 520px at 98% 4%, rgba(0, 209, 255, 0.14), transparent 60%),
|
||||||
|
radial-gradient(900px 680px at 58% 116%, rgba(122, 84, 255, 0.18), transparent 62%),
|
||||||
|
linear-gradient(156deg, #050a16 0%, #081226 46%, #0a1730 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ruler-bg::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background-image:
|
||||||
|
linear-gradient(rgba(130, 175, 255, 0.05) 1px, transparent 1px),
|
||||||
|
linear-gradient(90deg, rgba(130, 175, 255, 0.05) 1px, transparent 1px);
|
||||||
|
background-size: 64px 64px;
|
||||||
|
mask-image: radial-gradient(ellipse 78% 72% at 50% 32%, #000 20%, transparent 78%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ruler-bg__orb {
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 50%;
|
||||||
|
filter: blur(100px);
|
||||||
|
animation: ruler-orb-drift 16s ease-in-out infinite alternate;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ruler-bg__orb--blue {
|
||||||
|
top: -340px;
|
||||||
|
left: -160px;
|
||||||
|
width: 760px;
|
||||||
|
height: 760px;
|
||||||
|
background: rgba(48, 118, 255, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ruler-bg__orb--cyan {
|
||||||
|
top: -200px;
|
||||||
|
right: -220px;
|
||||||
|
width: 640px;
|
||||||
|
height: 640px;
|
||||||
|
background: rgba(0, 214, 255, 0.18);
|
||||||
|
animation-delay: -5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ruler-bg__orb--violet {
|
||||||
|
bottom: -360px;
|
||||||
|
left: 36%;
|
||||||
|
width: 700px;
|
||||||
|
height: 700px;
|
||||||
|
background: rgba(124, 92, 255, 0.18);
|
||||||
|
animation-delay: -10s;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes ruler-orb-drift {
|
||||||
|
from {
|
||||||
|
transform: translate3d(0, 0, 0) scale(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
transform: translate3d(42px, 30px, 0) scale(1.08);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-back {
|
||||||
|
width: 132px;
|
||||||
|
height: 60px;
|
||||||
|
border: 1px solid rgba(130, 190, 255, 0.35);
|
||||||
|
border-radius: 12px;
|
||||||
|
background: rgba(18, 40, 78, 0.5);
|
||||||
|
color: #bcd9ff;
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 3px;
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
transition:
|
||||||
|
transform 0.2s ease,
|
||||||
|
border-color 0.2s ease,
|
||||||
|
background 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-back:hover {
|
||||||
|
border-color: rgba(150, 205, 255, 0.55);
|
||||||
|
background: rgba(30, 66, 128, 0.65);
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ruler-main {
|
||||||
|
position: absolute;
|
||||||
|
top: 176px;
|
||||||
|
right: 44px;
|
||||||
|
bottom: 40px;
|
||||||
|
left: 44px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ruler-card {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
width: 1400px;
|
||||||
|
max-width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid rgba(130, 175, 255, 0.18);
|
||||||
|
border-radius: 26px;
|
||||||
|
background: linear-gradient(158deg, rgba(20, 40, 78, 0.7) 0%, rgba(6, 14, 30, 0.85) 100%);
|
||||||
|
box-shadow:
|
||||||
|
0 30px 70px rgba(0, 10, 32, 0.5),
|
||||||
|
0 0 40px rgba(48, 118, 255, 0.1),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.08);
|
||||||
|
backdrop-filter: blur(16px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ruler-card::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 40px;
|
||||||
|
left: 40px;
|
||||||
|
z-index: 2;
|
||||||
|
height: 1px;
|
||||||
|
background: linear-gradient(90deg, transparent, rgba(130, 214, 255, 0.55), transparent);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ruler-card__header {
|
||||||
|
display: flex;
|
||||||
|
flex: none;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
height: 80px;
|
||||||
|
padding: 0 28px;
|
||||||
|
border-bottom: 1px solid rgba(130, 175, 255, 0.12);
|
||||||
|
background: linear-gradient(120deg, rgba(26, 58, 112, 0.85) 0%, rgba(10, 24, 52, 0.8) 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ruler-card__header h2 {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
color: #eef5ff;
|
||||||
|
font-size: 30px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 3px;
|
||||||
|
text-shadow: 0 0 22px rgba(80, 150, 255, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ruler-card__header h2::before {
|
||||||
|
content: '';
|
||||||
|
width: 4px;
|
||||||
|
height: 26px;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: linear-gradient(180deg, #7fe0ff, #4d8bf0);
|
||||||
|
box-shadow: 0 0 14px rgba(90, 170, 255, 0.7);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ruler-card__status {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 5px 14px;
|
||||||
|
border: 1px solid rgba(130, 195, 255, 0.28);
|
||||||
|
border-radius: 30px;
|
||||||
|
background: rgba(16, 40, 80, 0.5);
|
||||||
|
color: rgba(216, 236, 255, 0.9);
|
||||||
|
font-size: 15px;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ruler-card__dot {
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #c9d4e4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ruler-card__dot--on {
|
||||||
|
background: #74f4c5;
|
||||||
|
box-shadow: 0 0 9px rgba(116, 244, 197, 0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ruler-viewport {
|
||||||
|
position: relative;
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #040810;
|
||||||
|
box-shadow: inset 0 0 50px rgba(0, 4, 14, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ruler-viewport__image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: contain;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ruler-overlay {
|
||||||
|
position: absolute;
|
||||||
|
touch-action: none;
|
||||||
|
cursor: crosshair;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ruler-line {
|
||||||
|
stroke: #74f1df;
|
||||||
|
stroke-width: 3;
|
||||||
|
stroke-linecap: round;
|
||||||
|
filter: drop-shadow(0 0 4px rgba(116, 241, 223, 0.75));
|
||||||
|
}
|
||||||
|
|
||||||
|
.ruler-handle {
|
||||||
|
fill: #74f1df;
|
||||||
|
stroke: rgba(8, 13, 20, 0.65);
|
||||||
|
stroke-width: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ruler-viewport__tip {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
color: rgba(180, 210, 240, 0.7);
|
||||||
|
font-size: 20px;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ruler-card__footer {
|
||||||
|
display: flex;
|
||||||
|
flex: none;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
height: 78px;
|
||||||
|
padding: 0 30px;
|
||||||
|
border-top: 1px solid rgba(130, 175, 255, 0.12);
|
||||||
|
background: rgba(8, 18, 38, 0.55);
|
||||||
|
color: rgba(158, 190, 226, 0.68);
|
||||||
|
font-size: 18px;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ruler-card__step {
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
width: 28px;
|
||||||
|
height: 28px;
|
||||||
|
border: 1px solid rgba(120, 190, 255, 0.25);
|
||||||
|
border-radius: 50%;
|
||||||
|
background: rgba(70, 140, 255, 0.16);
|
||||||
|
color: #8fd0ff;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ruler-card__divider {
|
||||||
|
width: 1px;
|
||||||
|
height: 22px;
|
||||||
|
margin: 0 8px;
|
||||||
|
background: rgba(130, 175, 255, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.distance-backdrop {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
z-index: 70;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
padding: 24px;
|
||||||
|
background: rgba(3, 8, 18, 0.68);
|
||||||
|
backdrop-filter: blur(8px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.distance-card {
|
||||||
|
width: 600px;
|
||||||
|
padding: 38px 44px 34px;
|
||||||
|
border: 1px solid rgba(130, 175, 255, 0.2);
|
||||||
|
border-radius: 26px;
|
||||||
|
background: linear-gradient(158deg, rgba(22, 42, 78, 0.98) 0%, rgba(8, 16, 32, 0.99) 100%);
|
||||||
|
box-shadow:
|
||||||
|
0 40px 90px rgba(0, 6, 20, 0.6),
|
||||||
|
0 0 50px rgba(48, 118, 255, 0.12),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.08);
|
||||||
|
color-scheme: dark;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.distance-card h2 {
|
||||||
|
color: #eef5ff;
|
||||||
|
font-size: 30px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
text-shadow: 0 0 24px rgba(80, 150, 255, 0.28);
|
||||||
|
}
|
||||||
|
|
||||||
|
.distance-card > p {
|
||||||
|
margin-top: 12px;
|
||||||
|
color: rgba(158, 190, 226, 0.7);
|
||||||
|
font-size: 18px;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.distance-card > p strong {
|
||||||
|
color: #7fe0ff;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.distance-form {
|
||||||
|
margin-top: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.distance-field {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
color: rgba(158, 190, 226, 0.72);
|
||||||
|
font-size: 18px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.distance-field__control {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid rgba(130, 175, 255, 0.22);
|
||||||
|
border-radius: 12px;
|
||||||
|
background: rgba(6, 14, 28, 0.7);
|
||||||
|
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.distance-field__control:focus-within {
|
||||||
|
border-color: rgba(120, 200, 255, 0.55);
|
||||||
|
box-shadow:
|
||||||
|
0 0 0 4px rgba(70, 140, 255, 0.15),
|
||||||
|
0 0 24px rgba(70, 140, 255, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.distance-field input {
|
||||||
|
flex: 1;
|
||||||
|
height: 58px;
|
||||||
|
padding: 0 18px;
|
||||||
|
border: 0;
|
||||||
|
background: transparent;
|
||||||
|
color: #e8f2ff;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 22px;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.distance-field input::placeholder {
|
||||||
|
color: rgba(158, 190, 226, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.distance-field__unit {
|
||||||
|
flex: none;
|
||||||
|
padding: 0 20px;
|
||||||
|
color: rgba(158, 190, 226, 0.6);
|
||||||
|
font-size: 19px;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.distance-error {
|
||||||
|
margin-top: 14px;
|
||||||
|
color: #ff9d9d;
|
||||||
|
font-size: 17px;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.distance-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 20px;
|
||||||
|
margin-top: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.distance-button {
|
||||||
|
width: 180px;
|
||||||
|
height: 56px;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 3px;
|
||||||
|
transition:
|
||||||
|
transform 0.2s ease,
|
||||||
|
box-shadow 0.2s ease,
|
||||||
|
background 0.2s ease,
|
||||||
|
border-color 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.distance-button:disabled {
|
||||||
|
cursor: default;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.distance-button--ghost {
|
||||||
|
border: 1px solid rgba(130, 175, 255, 0.28);
|
||||||
|
background: rgba(18, 40, 78, 0.5);
|
||||||
|
color: #bcd9ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.distance-button--ghost:hover:not(:disabled) {
|
||||||
|
border-color: rgba(150, 205, 255, 0.5);
|
||||||
|
background: rgba(30, 66, 128, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.distance-button--primary {
|
||||||
|
background: linear-gradient(180deg, #ffd166 0%, #f0ac0b 100%);
|
||||||
|
box-shadow:
|
||||||
|
0 14px 30px rgba(240, 172, 11, 0.28),
|
||||||
|
0 0 26px rgba(255, 190, 60, 0.16),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.6);
|
||||||
|
color: #241500;
|
||||||
|
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
.distance-button--primary:hover:not(:disabled) {
|
||||||
|
box-shadow:
|
||||||
|
0 18px 38px rgba(240, 172, 11, 0.36),
|
||||||
|
0 0 34px rgba(255, 190, 60, 0.26),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.6);
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.distance-modal-enter-active,
|
||||||
|
.distance-modal-leave-active {
|
||||||
|
transition: opacity 0.24s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.distance-modal-enter-active .distance-card,
|
||||||
|
.distance-modal-leave-active .distance-card {
|
||||||
|
transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.distance-modal-enter-from,
|
||||||
|
.distance-modal-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.distance-modal-enter-from .distance-card,
|
||||||
|
.distance-modal-leave-to .distance-card {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(16px) scale(0.97);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import AppStage from '@/components/AppStage.vue'
|
import AppStage from '@/components/AppStage.vue'
|
||||||
import PageHeader from '@/components/PageHeader.vue'
|
import PageHeader from '@/components/PageHeader.vue'
|
||||||
@@ -9,30 +10,47 @@ import { showToast } from '@/composables/useToast'
|
|||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
|
const requirementsConfirmed = ref(false)
|
||||||
|
|
||||||
const steps = [
|
const steps = [
|
||||||
{ title: '打开样品仓', icon: 'door' as const },
|
{ title: '打开样品仓', icon: 'door' as const },
|
||||||
{ title: '放置待测样品', icon: 'tray' as const },
|
{ title: '放置待测样品', icon: 'tray' as const },
|
||||||
{ title: '调整聚焦位置', icon: 'focus' as const },
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const placementRequirements = [
|
||||||
|
'待测样品边缘不能超出载物台',
|
||||||
|
'样品尽量放置在画面中央',
|
||||||
|
'样品放置要稳定,检测过程中不能滑动或翻滚',
|
||||||
|
'样品高度不能超过 2 厘米',
|
||||||
|
]
|
||||||
|
|
||||||
|
const footerItems = ['等待开始检测', '激光安全等级 Class 1', '环境温度 22℃']
|
||||||
|
|
||||||
function goHome() {
|
function goHome() {
|
||||||
void router.push({ name: 'home' })
|
void router.push({ name: 'home' })
|
||||||
}
|
}
|
||||||
|
|
||||||
function startDetection() {
|
function startDetection() {
|
||||||
void router.push({ name: 'scan' })
|
if (!requirementsConfirmed.value) {
|
||||||
|
showToast('请先确认样品放置符合要求')
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
function previewFocus() {
|
void router.push({ name: 'scan' })
|
||||||
showToast('预览对焦功能正在研发中')
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<AppStage>
|
<AppStage>
|
||||||
<PageHeader title="放置待测样品">
|
<div class="sample-bg" aria-hidden="true">
|
||||||
|
<span class="sample-bg__orb sample-bg__orb--blue"></span>
|
||||||
|
<span class="sample-bg__orb sample-bg__orb--cyan"></span>
|
||||||
|
<span class="sample-bg__orb sample-bg__orb--violet"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<PageHeader title="放置待测样品" theme="dark">
|
||||||
<template #left>
|
<template #left>
|
||||||
<button class="header-button header-button--outline" type="button" @click="goHome">
|
<button class="sample-back" type="button" @click="goHome">
|
||||||
返回
|
返回
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
@@ -44,7 +62,11 @@ function previewFocus() {
|
|||||||
<aside class="guide-column">
|
<aside class="guide-column">
|
||||||
<section class="guide-card">
|
<section class="guide-card">
|
||||||
<header class="guide-card__header">
|
<header class="guide-card__header">
|
||||||
|
<div class="guide-card__heading">
|
||||||
|
<span class="guide-card__eyebrow">Operation Guide</span>
|
||||||
<h2>样品放置操作指引</h2>
|
<h2>样品放置操作指引</h2>
|
||||||
|
</div>
|
||||||
|
<span class="guide-card__badge">Step 01</span>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<ol class="guide-steps">
|
<ol class="guide-steps">
|
||||||
@@ -56,26 +78,142 @@ function previewFocus() {
|
|||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
|
<section class="placement-requirements">
|
||||||
|
<h3>
|
||||||
|
<span class="placement-requirements__mark">!</span>
|
||||||
|
放置要求
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li
|
||||||
|
v-for="(requirement, index) in placementRequirements"
|
||||||
|
:key="requirement"
|
||||||
|
>
|
||||||
|
<span class="placement-requirements__index">{{ index + 1 }}</span>
|
||||||
|
<span>{{ requirement }}</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p class="placement-requirements__warning">
|
||||||
|
以上任一项不符合请中止检测,否则可能损坏机器。
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<label class="placement-confirm">
|
||||||
|
<input v-model="requirementsConfirmed" type="checkbox" />
|
||||||
|
<span>我已确认样品放置符合以上要求</span>
|
||||||
|
</label>
|
||||||
|
</section>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<div class="guide-actions">
|
<div class="guide-actions">
|
||||||
<button class="action-button action-button--start" type="button" @click="startDetection">
|
<button
|
||||||
|
class="action-button action-button--start"
|
||||||
|
type="button"
|
||||||
|
:disabled="!requirementsConfirmed"
|
||||||
|
:title="requirementsConfirmed ? undefined : '请先确认样品放置符合要求'"
|
||||||
|
@click="startDetection"
|
||||||
|
>
|
||||||
开始检测
|
开始检测
|
||||||
</button>
|
</button>
|
||||||
<button class="action-button action-button--ghost" type="button" @click="previewFocus">
|
|
||||||
预览对焦
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<StatusFooter
|
<StatusFooter :items="footerItems" theme="dark" />
|
||||||
:items="['样品仓已关闭', '激光安全等级 Class 1', '环境温度 22℃']"
|
|
||||||
/>
|
|
||||||
</AppStage>
|
</AppStage>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.sample-bg {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
pointer-events: none;
|
||||||
|
background:
|
||||||
|
radial-gradient(1000px 600px at 8% -16%, rgba(48, 112, 255, 0.28), transparent 62%),
|
||||||
|
radial-gradient(820px 520px at 98% 4%, rgba(0, 209, 255, 0.14), transparent 60%),
|
||||||
|
radial-gradient(900px 680px at 58% 116%, rgba(122, 84, 255, 0.18), transparent 62%),
|
||||||
|
linear-gradient(156deg, #050a16 0%, #081226 46%, #0a1730 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sample-bg::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background-image:
|
||||||
|
linear-gradient(rgba(130, 175, 255, 0.05) 1px, transparent 1px),
|
||||||
|
linear-gradient(90deg, rgba(130, 175, 255, 0.05) 1px, transparent 1px);
|
||||||
|
background-size: 64px 64px;
|
||||||
|
mask-image: radial-gradient(ellipse 78% 72% at 50% 32%, #000 20%, transparent 78%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sample-bg__orb {
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 50%;
|
||||||
|
filter: blur(100px);
|
||||||
|
animation: orb-drift 16s ease-in-out infinite alternate;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sample-bg__orb--blue {
|
||||||
|
top: -340px;
|
||||||
|
left: -160px;
|
||||||
|
width: 760px;
|
||||||
|
height: 760px;
|
||||||
|
background: rgba(48, 118, 255, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sample-bg__orb--cyan {
|
||||||
|
top: -200px;
|
||||||
|
right: -220px;
|
||||||
|
width: 640px;
|
||||||
|
height: 640px;
|
||||||
|
background: rgba(0, 214, 255, 0.18);
|
||||||
|
animation-delay: -5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sample-bg__orb--violet {
|
||||||
|
bottom: -360px;
|
||||||
|
left: 36%;
|
||||||
|
width: 700px;
|
||||||
|
height: 700px;
|
||||||
|
background: rgba(124, 92, 255, 0.18);
|
||||||
|
animation-delay: -10s;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes orb-drift {
|
||||||
|
from {
|
||||||
|
transform: translate3d(0, 0, 0) scale(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
transform: translate3d(42px, 30px, 0) scale(1.08);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.sample-back {
|
||||||
|
width: 132px;
|
||||||
|
height: 60px;
|
||||||
|
border: 1px solid rgba(130, 190, 255, 0.35);
|
||||||
|
border-radius: 12px;
|
||||||
|
background: rgba(18, 40, 78, 0.5);
|
||||||
|
color: #bcd9ff;
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 3px;
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
transition:
|
||||||
|
transform 0.2s ease,
|
||||||
|
border-color 0.2s ease,
|
||||||
|
background 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sample-back:hover {
|
||||||
|
border-color: rgba(150, 205, 255, 0.55);
|
||||||
|
background: rgba(30, 66, 128, 0.65);
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
.sample-main {
|
.sample-main {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 220px;
|
top: 220px;
|
||||||
@@ -99,47 +237,95 @@ function previewFocus() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.guide-card {
|
.guide-card {
|
||||||
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-radius: 18px;
|
border: 1px solid rgba(92, 227, 214, 0.2);
|
||||||
background: #2fb8ad;
|
border-radius: 26px;
|
||||||
box-shadow: 0 16px 34px rgba(31, 148, 139, 0.24);
|
background: linear-gradient(
|
||||||
|
158deg,
|
||||||
|
rgba(30, 74, 108, 0.5) 0%,
|
||||||
|
rgba(10, 26, 52, 0.72) 60%,
|
||||||
|
rgba(12, 32, 60, 0.55) 100%
|
||||||
|
);
|
||||||
|
box-shadow:
|
||||||
|
0 30px 70px rgba(0, 10, 32, 0.5),
|
||||||
|
0 0 34px rgba(40, 200, 188, 0.08),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.08);
|
||||||
|
backdrop-filter: blur(16px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.guide-card::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 40px;
|
||||||
|
left: 40px;
|
||||||
|
z-index: 2;
|
||||||
|
height: 1px;
|
||||||
|
background: linear-gradient(90deg, transparent, rgba(92, 227, 214, 0.6), transparent);
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.guide-card__header {
|
.guide-card__header {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: none;
|
flex: none;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
height: 104px;
|
height: 104px;
|
||||||
padding: 0 34px;
|
padding: 0 32px;
|
||||||
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
|
border-bottom: 1px solid rgba(140, 200, 235, 0.12);
|
||||||
background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent);
|
background: linear-gradient(120deg, rgba(36, 110, 128, 0.28) 0%, transparent 70%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.guide-card__heading {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.guide-card__eyebrow {
|
||||||
|
color: #5ce3d6;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 2.6px;
|
||||||
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
.guide-card__header h2 {
|
.guide-card__header h2 {
|
||||||
color: #fff;
|
color: #effbff;
|
||||||
font-size: 32px;
|
font-size: 30px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
letter-spacing: 3px;
|
letter-spacing: 3px;
|
||||||
text-shadow: 0 1px 3px rgba(10, 94, 88, 0.2);
|
text-shadow: 0 0 24px rgba(60, 220, 205, 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
.guide-card__badge {
|
||||||
|
padding: 7px 16px;
|
||||||
|
border: 1px solid rgba(92, 227, 214, 0.32);
|
||||||
|
border-radius: 30px;
|
||||||
|
background: rgba(20, 80, 90, 0.3);
|
||||||
|
color: #8ff5e7;
|
||||||
|
font-size: 14px;
|
||||||
|
letter-spacing: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.guide-steps {
|
.guide-steps {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: 1;
|
flex: none;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.guide-step {
|
.guide-step {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: 1;
|
flex: none;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 22px;
|
gap: 22px;
|
||||||
min-height: 0;
|
min-height: 88px;
|
||||||
padding: 0 34px;
|
padding: 0 32px;
|
||||||
border-bottom: 1px solid rgba(255, 255, 255, 0.18);
|
border-bottom: 1px solid rgba(140, 200, 235, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.guide-step:last-child {
|
.guide-step:last-child {
|
||||||
@@ -152,20 +338,23 @@ function previewFocus() {
|
|||||||
place-items: center;
|
place-items: center;
|
||||||
width: 46px;
|
width: 46px;
|
||||||
height: 46px;
|
height: 46px;
|
||||||
border: 2px solid rgba(255, 255, 255, 0.9);
|
border: 1px solid rgba(92, 227, 214, 0.5);
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
color: #fff;
|
background: rgba(20, 80, 90, 0.35);
|
||||||
|
box-shadow:
|
||||||
|
0 0 18px rgba(40, 200, 188, 0.18),
|
||||||
|
inset 0 0 12px rgba(92, 227, 214, 0.12);
|
||||||
|
color: #9ff7ec;
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.guide-step__title {
|
.guide-step__title {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
color: #fff;
|
color: #e8f2ff;
|
||||||
font-size: 28px;
|
font-size: 28px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
letter-spacing: 1px;
|
letter-spacing: 1px;
|
||||||
text-shadow: 0 1px 3px rgba(10, 94, 88, 0.18);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.guide-step__icon {
|
.guide-step__icon {
|
||||||
@@ -174,55 +363,156 @@ function previewFocus() {
|
|||||||
place-items: center;
|
place-items: center;
|
||||||
width: 78px;
|
width: 78px;
|
||||||
height: 78px;
|
height: 78px;
|
||||||
padding: 2px;
|
padding: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.guide-step__icon :deep(.guide-icon) {
|
||||||
|
color: #8ff5e7;
|
||||||
|
filter: drop-shadow(0 0 10px rgba(92, 227, 214, 0.35));
|
||||||
|
}
|
||||||
|
|
||||||
|
.placement-requirements {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
flex-direction: column;
|
||||||
|
min-height: 0;
|
||||||
|
margin: 16px 24px 22px;
|
||||||
|
padding: 16px 20px;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid rgba(255, 196, 80, 0.28);
|
||||||
|
border-radius: 16px;
|
||||||
|
background: linear-gradient(155deg, rgba(255, 186, 60, 0.12) 0%, rgba(255, 150, 20, 0.04) 100%);
|
||||||
|
color: rgba(255, 228, 184, 0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
.placement-requirements h3 {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
color: #ffd98a;
|
||||||
|
font-size: 22px;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.placement-requirements__mark {
|
||||||
|
display: grid;
|
||||||
|
flex: none;
|
||||||
|
place-items: center;
|
||||||
|
width: 28px;
|
||||||
|
height: 28px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: linear-gradient(180deg, #ffd166 0%, #e08f00 100%);
|
||||||
|
box-shadow: 0 0 14px rgba(255, 190, 60, 0.35);
|
||||||
|
color: #2a1a00;
|
||||||
|
font-size: 19px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.placement-requirements ul {
|
||||||
|
display: grid;
|
||||||
|
gap: 8px;
|
||||||
|
margin-top: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.placement-requirements li {
|
||||||
|
display: flex;
|
||||||
|
gap: 9px;
|
||||||
|
color: rgba(255, 228, 184, 0.82);
|
||||||
|
font-size: 18px;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.placement-requirements__index {
|
||||||
|
display: grid;
|
||||||
|
flex: none;
|
||||||
|
place-items: center;
|
||||||
|
width: 21px;
|
||||||
|
height: 21px;
|
||||||
|
margin-top: 2px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: rgba(255, 196, 80, 0.16);
|
||||||
|
color: #ffcf7a;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.placement-requirements__warning {
|
||||||
|
margin-top: 10px;
|
||||||
|
padding-top: 10px;
|
||||||
|
border-top: 1px dashed rgba(255, 150, 120, 0.28);
|
||||||
|
color: #ff9d9d;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.placement-confirm {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
margin-top: auto;
|
||||||
|
padding-top: 10px;
|
||||||
|
color: rgba(255, 228, 184, 0.82);
|
||||||
|
font-size: 17px;
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.placement-confirm input {
|
||||||
|
flex: none;
|
||||||
|
width: 22px;
|
||||||
|
height: 22px;
|
||||||
|
accent-color: #f0ac0b;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.guide-actions {
|
.guide-actions {
|
||||||
display: grid;
|
display: flex;
|
||||||
flex: none;
|
flex: none;
|
||||||
grid-template-columns: 1.16fr 0.84fr;
|
justify-content: flex-end;
|
||||||
gap: 20px;
|
align-items: center;
|
||||||
height: 78px;
|
height: 78px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-button {
|
.action-button {
|
||||||
display: grid;
|
display: grid;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
|
width: 320px;
|
||||||
height: 78px;
|
height: 78px;
|
||||||
border-radius: 12px;
|
border-radius: 14px;
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
letter-spacing: 4px;
|
letter-spacing: 4px;
|
||||||
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
transition:
|
||||||
}
|
transform 0.2s ease,
|
||||||
|
box-shadow 0.2s ease,
|
||||||
.action-button:hover {
|
filter 0.2s ease;
|
||||||
transform: translateY(-1px);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-button--start {
|
.action-button--start {
|
||||||
color: #fff;
|
background: linear-gradient(180deg, #ffd166 0%, #f0ac0b 100%);
|
||||||
background: linear-gradient(180deg, #ffc52c 0%, #f3ae0d 100%);
|
|
||||||
box-shadow:
|
box-shadow:
|
||||||
0 12px 24px rgba(224, 154, 6, 0.28),
|
0 16px 34px rgba(240, 172, 11, 0.28),
|
||||||
inset 0 1px 0 rgba(255, 255, 255, 0.55);
|
0 0 28px rgba(255, 190, 60, 0.18),
|
||||||
text-shadow: 0 1px 2px rgba(151, 94, 0, 0.25);
|
inset 0 1px 0 rgba(255, 255, 255, 0.6);
|
||||||
|
color: #241500;
|
||||||
|
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.25);
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-button--start:hover {
|
.action-button:not(:disabled):hover {
|
||||||
box-shadow:
|
box-shadow:
|
||||||
0 16px 30px rgba(224, 154, 6, 0.36),
|
0 20px 42px rgba(240, 172, 11, 0.36),
|
||||||
inset 0 1px 0 rgba(255, 255, 255, 0.55);
|
0 0 36px rgba(255, 190, 60, 0.28),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.6);
|
||||||
|
transform: translateY(-2px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-button--ghost {
|
.action-button:disabled {
|
||||||
border: 2px solid #d3dbe6;
|
cursor: default;
|
||||||
color: #253243;
|
filter: saturate(0.35);
|
||||||
background: #fff;
|
opacity: 0.45;
|
||||||
}
|
box-shadow: none;
|
||||||
|
transform: none;
|
||||||
.action-button--ghost:hover {
|
|
||||||
border-color: #aebdcd;
|
|
||||||
background: #f8fafc;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,37 +1,196 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue'
|
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import AppStage from '@/components/AppStage.vue'
|
import AppStage from '@/components/AppStage.vue'
|
||||||
import PageHeader from '@/components/PageHeader.vue'
|
import PageHeader from '@/components/PageHeader.vue'
|
||||||
import ScanVisual from '@/components/ScanVisual.vue'
|
import ScanVisual from '@/components/ScanVisual.vue'
|
||||||
import ProgressStrip from '@/components/ProgressStrip.vue'
|
import ProgressStrip from '@/components/ProgressStrip.vue'
|
||||||
import StatusFooter from '@/components/StatusFooter.vue'
|
import StatusFooter from '@/components/StatusFooter.vue'
|
||||||
import { useTimedProgress } from '@/composables/useTimedProgress'
|
import { analyzeSample, getAnalyzeTimeoutMs, type SampleAnalysisResult } from '@/api/sample'
|
||||||
|
import { startScan } from '@/api/scan'
|
||||||
|
import { useStageHub } from '@/composables/useStageHub'
|
||||||
|
import { showToast } from '@/composables/useToast'
|
||||||
|
|
||||||
|
type AnalysisStatus = 'processing' | 'done' | 'error'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const { progress } = useTimedProgress(15000, () => {
|
const status = ref<AnalysisStatus>('processing')
|
||||||
void router.replace({ name: 'spectrum' })
|
const result = ref<SampleAnalysisResult | null>(null)
|
||||||
|
const errorMessage = ref('')
|
||||||
|
const progress = ref(0)
|
||||||
|
const scanStarting = ref(false)
|
||||||
|
|
||||||
|
const { position: stagePosition, connect: connectStageHub } = useStageHub()
|
||||||
|
|
||||||
|
// 首次分析没有历史耗时可参考,按经验值预估;后续使用上一次的真实耗时。
|
||||||
|
const FALLBACK_ANALYSIS_DURATION_MS = 20000
|
||||||
|
|
||||||
|
let progressFrame: number | undefined
|
||||||
|
let lastAnalysisDurationMs = 0
|
||||||
|
|
||||||
|
const resultImageUrl = computed(() =>
|
||||||
|
result.value
|
||||||
|
? `data:${result.value.mimeType};base64,${result.value.imageBase64}`
|
||||||
|
: '',
|
||||||
|
)
|
||||||
|
|
||||||
|
const samplingPointCount = computed(
|
||||||
|
() => result.value?.samplingPointCount ?? '—',
|
||||||
|
)
|
||||||
|
|
||||||
|
const stageStatusText = computed(() => {
|
||||||
|
if (!stagePosition.value) return '未连接'
|
||||||
|
return stagePosition.value.moving ? '运动中' : '就绪'
|
||||||
})
|
})
|
||||||
|
|
||||||
const progressLabel = computed(() => `点位扫描 ${Math.round(progress.value)}%`)
|
const stageStatusTone = computed(() => {
|
||||||
|
if (!stagePosition.value) return 'is-off'
|
||||||
|
return stagePosition.value.moving ? 'is-moving' : 'is-ready'
|
||||||
|
})
|
||||||
|
|
||||||
|
const progressLabel = computed(() => {
|
||||||
|
if (status.value === 'done') return '靶样轮廓与采样点 100%'
|
||||||
|
if (status.value === 'error') return '图像分析失败'
|
||||||
|
return `靶样轮廓识别 ${Math.round(progress.value)}%`
|
||||||
|
})
|
||||||
|
|
||||||
|
const progressNote = computed(() => {
|
||||||
|
if (status.value === 'done') {
|
||||||
|
return `已规划 ${result.value?.samplingPointCount ?? 0} 个采样点`
|
||||||
|
}
|
||||||
|
if (status.value === 'error') return '请返回或重试'
|
||||||
|
return '背景差分分析中'
|
||||||
|
})
|
||||||
|
|
||||||
|
const footerItems = computed(() => {
|
||||||
|
if (status.value === 'done') {
|
||||||
|
return [
|
||||||
|
'轮廓提取完成',
|
||||||
|
`已规划 ${result.value?.samplingPointCount ?? 0} 个采样点`,
|
||||||
|
'等待采集光谱',
|
||||||
|
]
|
||||||
|
}
|
||||||
|
if (status.value === 'error') {
|
||||||
|
return ['轮廓提取失败', '请检查靶样放置', '等待重试']
|
||||||
|
}
|
||||||
|
return ['相机画面分析中', '背景差分识别轮廓', '采样点规划中']
|
||||||
|
})
|
||||||
|
|
||||||
|
function stopProgress() {
|
||||||
|
if (progressFrame !== undefined) {
|
||||||
|
window.cancelAnimationFrame(progressFrame)
|
||||||
|
progressFrame = undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按真实耗时推进进度:在预估的分析时长内匀速走到 99%,
|
||||||
|
* 超过预估时长后继续缓慢爬升,分析结束后再置为 100%,
|
||||||
|
* 避免像以往那样提前卡在固定百分比上空等。
|
||||||
|
*/
|
||||||
|
function startProgress(durationMs: number) {
|
||||||
|
stopProgress()
|
||||||
|
progress.value = 0
|
||||||
|
|
||||||
|
const total = Math.max(1000, durationMs)
|
||||||
|
const startedAt = performance.now()
|
||||||
|
|
||||||
|
const tick = (now: number) => {
|
||||||
|
const ratio = (now - startedAt) / total
|
||||||
|
progress.value = ratio <= 1
|
||||||
|
? ratio * 99
|
||||||
|
: 99 + 0.9 * (1 - Math.exp(-(ratio - 1) * 2))
|
||||||
|
progressFrame = window.requestAnimationFrame(tick)
|
||||||
|
}
|
||||||
|
|
||||||
|
progressFrame = window.requestAnimationFrame(tick)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function runAnalysis() {
|
||||||
|
status.value = 'processing'
|
||||||
|
result.value = null
|
||||||
|
errorMessage.value = ''
|
||||||
|
progress.value = 0
|
||||||
|
|
||||||
|
try {
|
||||||
|
const timeout = await getAnalyzeTimeoutMs()
|
||||||
|
const expectedDuration = Math.min(
|
||||||
|
timeout,
|
||||||
|
lastAnalysisDurationMs || FALLBACK_ANALYSIS_DURATION_MS,
|
||||||
|
)
|
||||||
|
startProgress(expectedDuration)
|
||||||
|
|
||||||
|
const startedAt = performance.now()
|
||||||
|
result.value = await analyzeSample(timeout)
|
||||||
|
lastAnalysisDurationMs = performance.now() - startedAt
|
||||||
|
|
||||||
|
stopProgress()
|
||||||
|
progress.value = 100
|
||||||
|
status.value = 'done'
|
||||||
|
} catch (error) {
|
||||||
|
stopProgress()
|
||||||
|
status.value = 'error'
|
||||||
|
errorMessage.value =
|
||||||
|
error instanceof Error ? error.message : '靶样轮廓分析失败'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function abortProcess() {
|
function abortProcess() {
|
||||||
void router.replace({ name: 'home' })
|
void router.replace({ name: 'home' })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function retry() {
|
||||||
|
void runAnalysis()
|
||||||
|
}
|
||||||
|
|
||||||
|
async function startScanning() {
|
||||||
|
if (scanStarting.value) return
|
||||||
|
|
||||||
|
if (!result.value) {
|
||||||
|
showToast('请等待靶样分析完成')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
scanStarting.value = true
|
||||||
|
try {
|
||||||
|
const started = await startScan()
|
||||||
|
await router.push({
|
||||||
|
name: 'spectrum',
|
||||||
|
query: { scanId: started.scanId },
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
showToast(error instanceof Error ? error.message : '启动扫描失败')
|
||||||
|
} finally {
|
||||||
|
scanStarting.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
void runAnalysis()
|
||||||
|
void connectStageHub()
|
||||||
|
})
|
||||||
|
|
||||||
|
onBeforeUnmount(stopProgress)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<AppStage>
|
<AppStage>
|
||||||
<PageHeader title="样品轮廓识别与激光点位规划" variant="process">
|
<div class="scan-bg" aria-hidden="true">
|
||||||
|
<span class="scan-bg__orb scan-bg__orb--blue"></span>
|
||||||
|
<span class="scan-bg__orb scan-bg__orb--cyan"></span>
|
||||||
|
<span class="scan-bg__orb scan-bg__orb--violet"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<PageHeader title="样品轮廓识别与激光点位规划" variant="process" theme="dark">
|
||||||
<template #left>
|
<template #left>
|
||||||
<button class="header-button header-button--warn" type="button" @click="abortProcess">
|
<button class="scan-abort" type="button" @click="abortProcess">
|
||||||
中止流程
|
中止流程
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #right>
|
<template #right>
|
||||||
<button class="icon-close" type="button" aria-label="关闭并返回首页" @click="abortProcess">
|
<button class="scan-close" type="button" aria-label="关闭并返回首页" @click="abortProcess">
|
||||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||||
<path d="m6 6 12 12M18 6 6 18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" />
|
<path d="m6 6 12 12M18 6 6 18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" />
|
||||||
</svg>
|
</svg>
|
||||||
@@ -40,49 +199,216 @@ function abortProcess() {
|
|||||||
</PageHeader>
|
</PageHeader>
|
||||||
|
|
||||||
<main class="scan-main">
|
<main class="scan-main">
|
||||||
<ScanVisual class="scan-card" />
|
<ScanVisual v-if="status === 'processing'" class="scan-card" />
|
||||||
|
|
||||||
|
<section v-else-if="status === 'done'" class="result-card">
|
||||||
|
<header class="result-card__header">
|
||||||
|
<h2>靶样轮廓与采样点</h2>
|
||||||
|
<span class="result-card__count">
|
||||||
|
采样点 {{ result?.samplingPointCount ?? 0 }} 个
|
||||||
|
</span>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="result-card__viewport">
|
||||||
|
<img class="result-card__image" :src="resultImageUrl" alt="靶样轮廓与采样点分析结果" />
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section v-else class="error-card">
|
||||||
|
<div class="error-card__icon" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 64 64">
|
||||||
|
<circle cx="32" cy="32" r="24" fill="none" stroke="currentColor" stroke-width="3" />
|
||||||
|
<path d="M32 20v18M32 44v2" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" />
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<h2>靶样轮廓识别失败</h2>
|
||||||
|
<p>{{ errorMessage }}</p>
|
||||||
|
<div class="error-card__actions">
|
||||||
|
<button class="error-button error-button--ghost" type="button" @click="abortProcess">
|
||||||
|
返回首页
|
||||||
|
</button>
|
||||||
|
<button class="error-button error-button--primary" type="button" @click="retry">
|
||||||
|
重新分析
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
<aside class="params-card">
|
<aside class="params-card">
|
||||||
<header class="params-card__header">
|
<header class="params-card__header">
|
||||||
|
<div class="params-card__heading">
|
||||||
|
<span class="params-card__eyebrow">Sampling Plan</span>
|
||||||
<h2>采样点</h2>
|
<h2>采样点</h2>
|
||||||
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="params-card__body">
|
<div class="params-card__body">
|
||||||
<div class="param-field">
|
<div class="param-field">
|
||||||
<span class="param-field__label">采样点数</span>
|
<span class="param-field__label">采样点数</span>
|
||||||
<div class="param-field__value">5</div>
|
<div class="param-field__value">{{ samplingPointCount }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="param-field">
|
<div class="param-field">
|
||||||
<span class="param-field__label">脉冲能量</span>
|
<span class="param-field__label">当前位置</span>
|
||||||
<div class="param-field__value">120 <small>mJ</small></div>
|
<div class="param-field__value param-field__value--position">
|
||||||
|
<span>X {{ stagePosition ? stagePosition.x : '—' }}</span>
|
||||||
|
<span>Y {{ stagePosition ? stagePosition.y : '—' }}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="param-field">
|
<div class="param-field">
|
||||||
<span class="param-field__label">积分时间</span>
|
<span class="param-field__label">位移台状态</span>
|
||||||
<div class="param-field__value">10 <small>ms</small></div>
|
<div
|
||||||
|
class="param-field__value param-field__value--status"
|
||||||
|
:class="stageStatusTone"
|
||||||
|
>
|
||||||
|
<i class="param-field__dot"></i>
|
||||||
|
{{ stageStatusText }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="param-field">
|
<div class="params-card__hint">
|
||||||
<span class="param-field__label">预扫描</span>
|
<span class="params-card__hint-mark">i</span>
|
||||||
<div class="param-field__value">3 <small>次</small></div>
|
<p>确认靶样轮廓与采样点分布符合要求后,点击“开始采集”进入光谱采集流程。</p>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<div class="scan-progress">
|
<div v-if="status !== 'error'" class="scan-progress">
|
||||||
<ProgressStrip :progress="progress" :label="progressLabel" note="已规划 5 个采样点" />
|
<div class="scan-progress__strip">
|
||||||
|
<ProgressStrip
|
||||||
|
:progress="progress"
|
||||||
|
:label="progressLabel"
|
||||||
|
:note="progressNote"
|
||||||
|
theme="dark"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<StatusFooter
|
<button
|
||||||
icon="info"
|
v-if="status === 'done'"
|
||||||
:items="['轮廓提取完成', '点位校验通过', '等待采集光谱']"
|
class="scan-next"
|
||||||
/>
|
type="button"
|
||||||
|
:disabled="scanStarting"
|
||||||
|
@click="startScanning"
|
||||||
|
>
|
||||||
|
{{ scanStarting ? '启动中...' : '开始采集' }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<StatusFooter icon="info" :items="footerItems" theme="dark" />
|
||||||
</AppStage>
|
</AppStage>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.scan-bg {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
pointer-events: none;
|
||||||
|
background:
|
||||||
|
radial-gradient(1000px 600px at 8% -16%, rgba(48, 112, 255, 0.28), transparent 62%),
|
||||||
|
radial-gradient(820px 520px at 98% 4%, rgba(0, 209, 255, 0.14), transparent 60%),
|
||||||
|
radial-gradient(900px 680px at 58% 116%, rgba(122, 84, 255, 0.18), transparent 62%),
|
||||||
|
linear-gradient(156deg, #050a16 0%, #081226 46%, #0a1730 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-bg::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background-image:
|
||||||
|
linear-gradient(rgba(130, 175, 255, 0.05) 1px, transparent 1px),
|
||||||
|
linear-gradient(90deg, rgba(130, 175, 255, 0.05) 1px, transparent 1px);
|
||||||
|
background-size: 64px 64px;
|
||||||
|
mask-image: radial-gradient(ellipse 78% 72% at 50% 32%, #000 20%, transparent 78%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-bg__orb {
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 50%;
|
||||||
|
filter: blur(100px);
|
||||||
|
animation: scan-orb-drift 16s ease-in-out infinite alternate;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-bg__orb--blue {
|
||||||
|
top: -340px;
|
||||||
|
left: -160px;
|
||||||
|
width: 760px;
|
||||||
|
height: 760px;
|
||||||
|
background: rgba(48, 118, 255, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-bg__orb--cyan {
|
||||||
|
top: -200px;
|
||||||
|
right: -220px;
|
||||||
|
width: 640px;
|
||||||
|
height: 640px;
|
||||||
|
background: rgba(0, 214, 255, 0.18);
|
||||||
|
animation-delay: -5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-bg__orb--violet {
|
||||||
|
bottom: -360px;
|
||||||
|
left: 36%;
|
||||||
|
width: 700px;
|
||||||
|
height: 700px;
|
||||||
|
background: rgba(124, 92, 255, 0.18);
|
||||||
|
animation-delay: -10s;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes scan-orb-drift {
|
||||||
|
from {
|
||||||
|
transform: translate3d(0, 0, 0) scale(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
transform: translate3d(42px, 30px, 0) scale(1.08);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-abort {
|
||||||
|
width: 300px;
|
||||||
|
height: 68px;
|
||||||
|
border: 1px solid rgba(255, 190, 60, 0.45);
|
||||||
|
border-radius: 14px;
|
||||||
|
background: linear-gradient(120deg, rgba(255, 186, 40, 0.18), rgba(255, 150, 20, 0.06));
|
||||||
|
color: #ffd98a;
|
||||||
|
font-size: 26px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 3px;
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
transition:
|
||||||
|
transform 0.2s ease,
|
||||||
|
border-color 0.2s ease,
|
||||||
|
background 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-abort:hover {
|
||||||
|
border-color: rgba(255, 205, 100, 0.65);
|
||||||
|
background: linear-gradient(120deg, rgba(255, 186, 40, 0.26), rgba(255, 150, 20, 0.1));
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-close {
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
width: 52px;
|
||||||
|
height: 52px;
|
||||||
|
border-radius: 50%;
|
||||||
|
color: rgba(170, 200, 235, 0.8);
|
||||||
|
transition: color 0.2s ease, background 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-close:hover {
|
||||||
|
background: rgba(255, 255, 255, 0.08);
|
||||||
|
color: #eaf3ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-close svg {
|
||||||
|
width: 26px;
|
||||||
|
height: 26px;
|
||||||
|
}
|
||||||
|
|
||||||
.scan-main {
|
.scan-main {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 142px;
|
top: 142px;
|
||||||
@@ -101,40 +427,262 @@ function abortProcess() {
|
|||||||
justify-self: center;
|
justify-self: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.result-card {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
width: 1120px;
|
||||||
|
max-width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid rgba(130, 175, 255, 0.18);
|
||||||
|
border-radius: 26px;
|
||||||
|
background: linear-gradient(158deg, rgba(20, 40, 78, 0.7) 0%, rgba(6, 14, 30, 0.85) 100%);
|
||||||
|
box-shadow:
|
||||||
|
0 30px 70px rgba(0, 10, 32, 0.5),
|
||||||
|
0 0 40px rgba(48, 118, 255, 0.1),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.08);
|
||||||
|
backdrop-filter: blur(16px);
|
||||||
|
justify-self: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-card__header {
|
||||||
|
display: flex;
|
||||||
|
flex: none;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
height: 72px;
|
||||||
|
padding: 0 28px;
|
||||||
|
border-bottom: 1px solid rgba(130, 175, 255, 0.12);
|
||||||
|
background: linear-gradient(120deg, rgba(26, 58, 112, 0.85) 0%, rgba(10, 24, 52, 0.8) 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-card__header h2 {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
color: #eef5ff;
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 3px;
|
||||||
|
text-shadow: 0 0 22px rgba(80, 150, 255, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-card__header h2::before {
|
||||||
|
content: '';
|
||||||
|
width: 4px;
|
||||||
|
height: 24px;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: linear-gradient(180deg, #7fe0ff, #4d8bf0);
|
||||||
|
box-shadow: 0 0 14px rgba(90, 170, 255, 0.7);
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-card__count {
|
||||||
|
padding: 6px 16px;
|
||||||
|
border: 1px solid rgba(130, 195, 255, 0.3);
|
||||||
|
border-radius: 30px;
|
||||||
|
background: rgba(16, 40, 80, 0.5);
|
||||||
|
color: #9fe8ff;
|
||||||
|
font-size: 17px;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-card__viewport {
|
||||||
|
display: grid;
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
place-items: center;
|
||||||
|
padding: 10px;
|
||||||
|
background: #040810;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-card__image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-card {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 1120px;
|
||||||
|
max-width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
padding: 40px;
|
||||||
|
border: 1px solid rgba(255, 107, 107, 0.24);
|
||||||
|
border-radius: 26px;
|
||||||
|
background: linear-gradient(158deg, rgba(64, 22, 34, 0.4) 0%, rgba(8, 14, 28, 0.88) 70%);
|
||||||
|
box-shadow:
|
||||||
|
0 30px 70px rgba(0, 10, 32, 0.5),
|
||||||
|
0 0 40px rgba(255, 84, 84, 0.08),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.06);
|
||||||
|
backdrop-filter: blur(16px);
|
||||||
|
justify-self: center;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-card__icon {
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
width: 96px;
|
||||||
|
height: 96px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
border: 1px solid rgba(255, 120, 120, 0.3);
|
||||||
|
border-radius: 50%;
|
||||||
|
background: rgba(255, 84, 84, 0.12);
|
||||||
|
box-shadow: 0 0 30px rgba(255, 84, 84, 0.18);
|
||||||
|
color: #ff9d9d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-card__icon svg {
|
||||||
|
width: 54px;
|
||||||
|
height: 54px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-card h2 {
|
||||||
|
color: #f3f8ff;
|
||||||
|
font-size: 32px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
text-shadow: 0 0 24px rgba(255, 100, 100, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-card p {
|
||||||
|
margin-top: 16px;
|
||||||
|
max-width: 760px;
|
||||||
|
color: rgba(178, 202, 232, 0.72);
|
||||||
|
font-size: 20px;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-card__actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 20px;
|
||||||
|
margin-top: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-button {
|
||||||
|
width: 200px;
|
||||||
|
height: 58px;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-size: 21px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 3px;
|
||||||
|
transition:
|
||||||
|
transform 0.2s ease,
|
||||||
|
box-shadow 0.2s ease,
|
||||||
|
background 0.2s ease,
|
||||||
|
border-color 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-button--ghost {
|
||||||
|
border: 1px solid rgba(130, 175, 255, 0.3);
|
||||||
|
background: rgba(18, 40, 78, 0.5);
|
||||||
|
color: #bcd9ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-button--ghost:hover {
|
||||||
|
border-color: rgba(150, 205, 255, 0.5);
|
||||||
|
background: rgba(30, 66, 128, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-button--primary {
|
||||||
|
background: linear-gradient(180deg, #6fc6ff 0%, #3f86f0 55%, #2c63c9 100%);
|
||||||
|
box-shadow:
|
||||||
|
0 12px 26px rgba(47, 111, 208, 0.35),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.4);
|
||||||
|
color: #04101f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-button--primary:hover {
|
||||||
|
box-shadow:
|
||||||
|
0 16px 32px rgba(47, 111, 208, 0.45),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.45);
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
.params-card {
|
.params-card {
|
||||||
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border: 1px solid #d9e0e8;
|
border: 1px solid rgba(130, 175, 255, 0.16);
|
||||||
border-radius: 10px;
|
border-radius: 26px;
|
||||||
background: #fff;
|
background: linear-gradient(
|
||||||
box-shadow: 0 8px 24px rgba(33, 53, 84, 0.05);
|
158deg,
|
||||||
|
rgba(255, 255, 255, 0.07) 0%,
|
||||||
|
rgba(255, 255, 255, 0.025) 58%,
|
||||||
|
rgba(255, 255, 255, 0.04) 100%
|
||||||
|
);
|
||||||
|
box-shadow:
|
||||||
|
0 30px 70px rgba(0, 10, 32, 0.45),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.08);
|
||||||
|
backdrop-filter: blur(16px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.params-card::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 32px;
|
||||||
|
left: 32px;
|
||||||
|
height: 1px;
|
||||||
|
background: linear-gradient(90deg, transparent, rgba(120, 180, 255, 0.55), transparent);
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.params-card__header {
|
.params-card__header {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: none;
|
flex: none;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 64px;
|
height: 96px;
|
||||||
padding: 0 22px;
|
padding: 0 26px;
|
||||||
border-bottom: 1px solid #e4e8ee;
|
border-bottom: 1px solid rgba(130, 175, 255, 0.12);
|
||||||
background: #f3f4f6;
|
background: linear-gradient(120deg, rgba(30, 66, 128, 0.24) 0%, transparent 70%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.params-card__heading {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.params-card__eyebrow {
|
||||||
|
color: #5aa2ff;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 2.6px;
|
||||||
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
.params-card__header h2 {
|
.params-card__header h2 {
|
||||||
color: #333b46;
|
display: flex;
|
||||||
font-size: 23px;
|
align-items: center;
|
||||||
font-weight: 500;
|
gap: 12px;
|
||||||
letter-spacing: 1px;
|
color: #eaf3ff;
|
||||||
|
font-size: 26px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.params-card__header h2::before {
|
||||||
|
content: '';
|
||||||
|
width: 4px;
|
||||||
|
height: 22px;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: linear-gradient(180deg, #7fe0ff, #4d8bf0);
|
||||||
|
box-shadow: 0 0 14px rgba(90, 170, 255, 0.7);
|
||||||
}
|
}
|
||||||
|
|
||||||
.params-card__body {
|
.params-card__body {
|
||||||
padding: 26px 22px;
|
padding: 28px 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.param-field {
|
.param-field {
|
||||||
margin-bottom: 24px;
|
margin-bottom: 26px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.param-field:last-child {
|
.param-field:last-child {
|
||||||
@@ -144,9 +692,9 @@ function abortProcess() {
|
|||||||
.param-field__label {
|
.param-field__label {
|
||||||
display: block;
|
display: block;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
color: #46505e;
|
color: rgba(158, 190, 226, 0.7);
|
||||||
font-size: 22px;
|
font-size: 20px;
|
||||||
letter-spacing: 0.5px;
|
letter-spacing: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.param-field__value {
|
.param-field__value {
|
||||||
@@ -154,25 +702,140 @@ function abortProcess() {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
height: 62px;
|
height: 62px;
|
||||||
padding: 0 18px;
|
padding: 0 18px;
|
||||||
border: 1px solid #d8dde6;
|
border: 1px solid rgba(130, 175, 255, 0.16);
|
||||||
border-radius: 7px;
|
border-radius: 12px;
|
||||||
background: #fff;
|
background: rgba(8, 18, 38, 0.6);
|
||||||
color: #2e3641;
|
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
|
||||||
|
color: #e8f2ff;
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
box-shadow: inset 0 1px 2px rgba(30, 45, 66, 0.03);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.param-field__value small {
|
.param-field__value small {
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
color: #8d97a4;
|
color: rgba(158, 190, 226, 0.55);
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.param-field__value--position {
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.param-field__value--status {
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.param-field__dot {
|
||||||
|
flex: none;
|
||||||
|
width: 9px;
|
||||||
|
height: 9px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #c9d4e4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.param-field__value--status.is-ready {
|
||||||
|
color: #8ff5e7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.param-field__value--status.is-ready .param-field__dot {
|
||||||
|
background: #74f4c5;
|
||||||
|
box-shadow: 0 0 10px rgba(116, 244, 197, 0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
.param-field__value--status.is-moving {
|
||||||
|
color: #ffd98a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.param-field__value--status.is-moving .param-field__dot {
|
||||||
|
background: #ffd86a;
|
||||||
|
box-shadow: 0 0 10px rgba(255, 216, 106, 0.8);
|
||||||
|
}
|
||||||
|
|
||||||
|
.param-field__value--status.is-off {
|
||||||
|
color: rgba(255, 154, 145, 0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
.param-field__value--status.is-off .param-field__dot {
|
||||||
|
background: #ff9a91;
|
||||||
|
box-shadow: 0 0 10px rgba(255, 154, 145, 0.7);
|
||||||
|
}
|
||||||
|
|
||||||
|
.params-card__hint {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
margin: auto 24px 26px;
|
||||||
|
padding: 16px 18px;
|
||||||
|
border: 1px solid rgba(130, 175, 255, 0.14);
|
||||||
|
border-radius: 14px;
|
||||||
|
background: rgba(8, 18, 38, 0.45);
|
||||||
|
color: rgba(158, 190, 226, 0.66);
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.params-card__hint-mark {
|
||||||
|
display: grid;
|
||||||
|
flex: none;
|
||||||
|
place-items: center;
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
border: 1px solid rgba(130, 195, 255, 0.35);
|
||||||
|
border-radius: 50%;
|
||||||
|
color: #8fc6ff;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
.scan-progress {
|
.scan-progress {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 900px;
|
top: 900px;
|
||||||
right: 44px;
|
right: 44px;
|
||||||
left: 44px;
|
left: 44px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 20px;
|
||||||
height: 54px;
|
height: 54px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.scan-progress__strip {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-next {
|
||||||
|
flex: none;
|
||||||
|
width: 280px;
|
||||||
|
height: 54px;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: linear-gradient(180deg, #ffd166 0%, #f0ac0b 100%);
|
||||||
|
box-shadow:
|
||||||
|
0 14px 30px rgba(240, 172, 11, 0.28),
|
||||||
|
0 0 26px rgba(255, 190, 60, 0.16),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.6);
|
||||||
|
color: #241500;
|
||||||
|
font-size: 23px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 3px;
|
||||||
|
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.25);
|
||||||
|
transition:
|
||||||
|
transform 0.2s ease,
|
||||||
|
box-shadow 0.2s ease,
|
||||||
|
filter 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-next:not(:disabled):hover {
|
||||||
|
box-shadow:
|
||||||
|
0 18px 38px rgba(240, 172, 11, 0.36),
|
||||||
|
0 0 34px rgba(255, 190, 60, 0.26),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.6);
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.scan-next:disabled {
|
||||||
|
cursor: default;
|
||||||
|
filter: saturate(0.35);
|
||||||
|
opacity: 0.45;
|
||||||
|
box-shadow: none;
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,83 +1,322 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue'
|
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import AppStage from '@/components/AppStage.vue'
|
import AppStage from '@/components/AppStage.vue'
|
||||||
import PageHeader from '@/components/PageHeader.vue'
|
import PageHeader from '@/components/PageHeader.vue'
|
||||||
import SpectrumChart from '@/components/SpectrumChart.vue'
|
import SpectrumChart from '@/components/SpectrumChart.vue'
|
||||||
import ProgressStrip from '@/components/ProgressStrip.vue'
|
import ProgressStrip from '@/components/ProgressStrip.vue'
|
||||||
import StatusFooter from '@/components/StatusFooter.vue'
|
import StatusFooter from '@/components/StatusFooter.vue'
|
||||||
import { useTimedProgress } from '@/composables/useTimedProgress'
|
import { abortScan, getCurrentScan, type ScanProgress } from '@/api/scan'
|
||||||
|
import { useStageHub } from '@/composables/useStageHub'
|
||||||
|
import { showToast } from '@/composables/useToast'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const route = useRoute()
|
||||||
|
|
||||||
const { progress } = useTimedProgress(10000, () => {
|
const queryScanId = computed(() => {
|
||||||
void router.replace({ name: 'result' })
|
const raw = route.query.scanId
|
||||||
|
return typeof raw === 'string' ? raw : ''
|
||||||
})
|
})
|
||||||
|
|
||||||
const progressLabel = computed(() => `光谱采集 ${Math.round(progress.value)}%`)
|
const activeScanId = ref(queryScanId.value)
|
||||||
const sampleIndex = computed(() =>
|
const fallbackProgress = ref<ScanProgress | null>(null)
|
||||||
Math.min(5, Math.max(1, Math.ceil(progress.value / 20))),
|
|
||||||
|
const {
|
||||||
|
position,
|
||||||
|
progress: hubProgress,
|
||||||
|
spectrum: liveSpectrum,
|
||||||
|
finished,
|
||||||
|
connect,
|
||||||
|
} = useStageHub()
|
||||||
|
|
||||||
|
const progress = computed(() => hubProgress.value ?? fallbackProgress.value)
|
||||||
|
|
||||||
|
const phaseText = computed(() => mapPhase(progress.value?.phase))
|
||||||
|
|
||||||
|
const percent = computed(() => progress.value?.percent ?? 0)
|
||||||
|
const progressLabel = computed(() => `光谱采集 ${percent.value}%`)
|
||||||
|
const progressNote = computed(
|
||||||
|
() => progress.value?.message ?? '等待扫描开始',
|
||||||
)
|
)
|
||||||
|
|
||||||
function abortProcess() {
|
const chartWavelengths = computed(() => liveSpectrum.value?.wavelengths ?? [])
|
||||||
|
const chartSpectrum = computed(() => liveSpectrum.value?.spectrum ?? [])
|
||||||
|
const chartSegments = computed(() => liveSpectrum.value?.segments ?? [])
|
||||||
|
|
||||||
|
const chartStatus = computed(() => {
|
||||||
|
if (progress.value?.phase === 'Acquiring') return '正在采集光谱'
|
||||||
|
if (liveSpectrum.value) {
|
||||||
|
return `第 ${liveSpectrum.value.pointIndex + 1} 点光谱`
|
||||||
|
}
|
||||||
|
return '等待光谱数据'
|
||||||
|
})
|
||||||
|
|
||||||
|
const activeStep = computed(() => {
|
||||||
|
switch (progress.value?.phase) {
|
||||||
|
case 'Homing':
|
||||||
|
case 'Moving':
|
||||||
|
case 'Returning':
|
||||||
|
return 'move'
|
||||||
|
case 'Focusing':
|
||||||
|
return 'focus'
|
||||||
|
case 'Acquiring':
|
||||||
|
return 'acquire'
|
||||||
|
case 'Analyzing':
|
||||||
|
case 'Writing':
|
||||||
|
return 'analyze'
|
||||||
|
case 'Completed':
|
||||||
|
return 'done'
|
||||||
|
default:
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const stepOrder = ['move', 'focus', 'acquire', 'analyze'] as const
|
||||||
|
|
||||||
|
function stepState(key: (typeof stepOrder)[number]) {
|
||||||
|
const active = activeStep.value
|
||||||
|
if (active === 'done') return 'done'
|
||||||
|
if (!active) return ''
|
||||||
|
|
||||||
|
const activeIndex = stepOrder.indexOf(active as (typeof stepOrder)[number])
|
||||||
|
const index = stepOrder.indexOf(key)
|
||||||
|
|
||||||
|
if (index < activeIndex) return 'done'
|
||||||
|
if (index === activeIndex) return 'active'
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
|
||||||
|
const footerItems = computed(() => [
|
||||||
|
position.value
|
||||||
|
? `X ${position.value.x} mm / Y ${position.value.y} mm`
|
||||||
|
: '位移台未连接',
|
||||||
|
phaseText.value,
|
||||||
|
progress.value
|
||||||
|
? `采样点 ${Math.min(progress.value.completedPoints, progress.value.totalPoints)} / ${progress.value.totalPoints}`
|
||||||
|
: '等待开始',
|
||||||
|
])
|
||||||
|
|
||||||
|
let pollTimer: number | undefined
|
||||||
|
let navigated = false
|
||||||
|
|
||||||
|
function mapPhase(phase?: string) {
|
||||||
|
switch (phase) {
|
||||||
|
case 'Idle':
|
||||||
|
return '准备中'
|
||||||
|
case 'Homing':
|
||||||
|
return '位移台回零'
|
||||||
|
case 'Moving':
|
||||||
|
return '位移台移动'
|
||||||
|
case 'Focusing':
|
||||||
|
return '对焦中'
|
||||||
|
case 'Acquiring':
|
||||||
|
return '收光中'
|
||||||
|
case 'Returning':
|
||||||
|
return '位移台回零'
|
||||||
|
case 'Analyzing':
|
||||||
|
return 'NIST 分析中'
|
||||||
|
case 'Writing':
|
||||||
|
return '写入数据库'
|
||||||
|
case 'Completed':
|
||||||
|
return '采集完成'
|
||||||
|
case 'Aborted':
|
||||||
|
return '已中止'
|
||||||
|
case 'Failed':
|
||||||
|
return '采集失败'
|
||||||
|
default:
|
||||||
|
return '等待开始'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function goResult(scanId: string) {
|
||||||
|
if (navigated) return
|
||||||
|
navigated = true
|
||||||
|
void router.replace({
|
||||||
|
name: 'result',
|
||||||
|
query: { scanId },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function goHomeWithToast(message?: string) {
|
||||||
|
if (navigated) return
|
||||||
|
navigated = true
|
||||||
|
if (message) showToast(message)
|
||||||
void router.replace({ name: 'home' })
|
void router.replace({ name: 'home' })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function abortProcess() {
|
||||||
|
try {
|
||||||
|
await abortScan()
|
||||||
|
} catch (error) {
|
||||||
|
showToast(error instanceof Error ? error.message : '中止扫描失败')
|
||||||
|
}
|
||||||
|
|
||||||
|
goHomeWithToast()
|
||||||
|
}
|
||||||
|
|
||||||
|
async function poll() {
|
||||||
|
try {
|
||||||
|
const current = await getCurrentScan()
|
||||||
|
fallbackProgress.value = current
|
||||||
|
|
||||||
|
if (!activeScanId.value && current.scanId) {
|
||||||
|
activeScanId.value = current.scanId
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!activeScanId.value && current.phase === 'Idle') {
|
||||||
|
goHomeWithToast()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (current.phase === 'Completed' && current.scanId) {
|
||||||
|
goResult(current.scanId)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (current.phase === 'Aborted' || current.phase === 'Failed') {
|
||||||
|
goHomeWithToast(current.message || '扫描已结束')
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// 轮询失败时保留 SignalR 推送的状态
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(finished, (value) => {
|
||||||
|
if (!value) return
|
||||||
|
|
||||||
|
if (value.status === 'Completed') {
|
||||||
|
goResult(value.scanId || activeScanId.value)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
goHomeWithToast(value.error ?? '扫描已中止')
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
void connect()
|
||||||
|
void poll()
|
||||||
|
pollTimer = window.setInterval(poll, 2000)
|
||||||
|
})
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
if (pollTimer !== undefined) {
|
||||||
|
window.clearInterval(pollTimer)
|
||||||
|
pollTimer = undefined
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<AppStage>
|
<AppStage>
|
||||||
<PageHeader title="光谱数据采集与分析" variant="process">
|
<div class="spectrum-bg" aria-hidden="true">
|
||||||
|
<span class="spectrum-bg__orb spectrum-bg__orb--blue"></span>
|
||||||
|
<span class="spectrum-bg__orb spectrum-bg__orb--cyan"></span>
|
||||||
|
<span class="spectrum-bg__orb spectrum-bg__orb--violet"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<PageHeader title="光谱数据采集与分析" variant="process" theme="dark">
|
||||||
<template #left>
|
<template #left>
|
||||||
<button class="header-button header-button--warn" type="button" @click="abortProcess">
|
<button class="spectrum-abort" type="button" @click="abortProcess">
|
||||||
中止流程
|
中止流程
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
</PageHeader>
|
</PageHeader>
|
||||||
|
|
||||||
<main class="spectrum-main">
|
<main class="spectrum-main">
|
||||||
<SpectrumChart class="spectrum-chart" />
|
<SpectrumChart
|
||||||
|
class="spectrum-chart"
|
||||||
|
:wavelengths="chartWavelengths"
|
||||||
|
:spectrum="chartSpectrum"
|
||||||
|
:segments="chartSegments"
|
||||||
|
:status-text="chartStatus"
|
||||||
|
/>
|
||||||
|
|
||||||
<aside class="analysis-card">
|
<aside class="analysis-card">
|
||||||
<header class="analysis-card__header">
|
<header class="analysis-card__header">
|
||||||
<h2>分析步骤</h2>
|
<div class="analysis-card__heading">
|
||||||
|
<span class="analysis-card__eyebrow">Scan Steps</span>
|
||||||
|
<h2>扫描步骤</h2>
|
||||||
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="analysis-card__body">
|
<div class="analysis-card__body">
|
||||||
<div class="analysis-step">
|
<div
|
||||||
|
class="analysis-step"
|
||||||
|
:class="{
|
||||||
|
'analysis-step--active': stepState('move') === 'active',
|
||||||
|
'analysis-step--done': stepState('move') === 'done',
|
||||||
|
}"
|
||||||
|
>
|
||||||
<span class="analysis-step__icon analysis-step__icon--blue">
|
<span class="analysis-step__icon analysis-step__icon--blue">
|
||||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||||
<circle cx="12" cy="12" r="8" fill="none" stroke="currentColor" stroke-width="1.6" />
|
<path d="M4 12h16M4 12l4-4M4 12l4 4M20 12l-4-4M20 12l-4 4" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" />
|
||||||
<path d="M12 7v5l3.4 2" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" />
|
|
||||||
</svg>
|
</svg>
|
||||||
</span>
|
</span>
|
||||||
<span class="analysis-step__text">正在拟合峰值</span>
|
<span class="analysis-step__text">位移台移动</span>
|
||||||
<span class="analysis-step__chevron">›</span>
|
<span class="analysis-step__chevron">›</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="analysis-step">
|
<div
|
||||||
|
class="analysis-step"
|
||||||
|
:class="{
|
||||||
|
'analysis-step--active': stepState('focus') === 'active',
|
||||||
|
'analysis-step--done': stepState('focus') === 'done',
|
||||||
|
}"
|
||||||
|
>
|
||||||
<span class="analysis-step__icon analysis-step__icon--amber">
|
<span class="analysis-step__icon analysis-step__icon--amber">
|
||||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||||
<path d="M5 15h14M7 15V8l5-3 5 3v7" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round" />
|
<circle cx="12" cy="12" r="7" fill="none" stroke="currentColor" stroke-width="1.6" />
|
||||||
<path d="M9 15v3h6v-3" fill="none" stroke="currentColor" stroke-width="1.6" />
|
<path d="M12 2v4M12 18v4M2 12h4M18 12h4" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" />
|
||||||
</svg>
|
</svg>
|
||||||
</span>
|
</span>
|
||||||
<span class="analysis-step__text">扣除连续背景</span>
|
<span class="analysis-step__text">单次对焦</span>
|
||||||
<span class="analysis-step__chevron">›</span>
|
<span class="analysis-step__chevron">›</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="analysis-step">
|
<div
|
||||||
|
class="analysis-step"
|
||||||
|
:class="{
|
||||||
|
'analysis-step--active': stepState('acquire') === 'active',
|
||||||
|
'analysis-step--done': stepState('acquire') === 'done',
|
||||||
|
}"
|
||||||
|
>
|
||||||
<span class="analysis-step__icon analysis-step__icon--blue">
|
<span class="analysis-step__icon analysis-step__icon--blue">
|
||||||
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||||
|
<path d="M3 14l3-6 3 10 3-14 3 12 3-8 3 6" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<span class="analysis-step__text">光谱仪收光</span>
|
||||||
|
<span class="analysis-step__chevron">›</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="analysis-step"
|
||||||
|
:class="{
|
||||||
|
'analysis-step--active': stepState('analyze') === 'active',
|
||||||
|
'analysis-step--done': stepState('analyze') === 'done',
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<span class="analysis-step__icon analysis-step__icon--amber">
|
||||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||||
<rect x="6" y="4" width="12" height="16" rx="2" fill="none" stroke="currentColor" stroke-width="1.6" />
|
<rect x="6" y="4" width="12" height="16" rx="2" fill="none" stroke="currentColor" stroke-width="1.6" />
|
||||||
<path d="M9 8h6M9 11h6M9 14h3" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" />
|
<path d="M9 8h6M9 11h6M9 14h3" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" />
|
||||||
</svg>
|
</svg>
|
||||||
</span>
|
</span>
|
||||||
<span class="analysis-step__text">计算元素浓度</span>
|
<span class="analysis-step__text">NIST 元素分析</span>
|
||||||
<span class="analysis-step__chevron">›</span>
|
<span class="analysis-step__chevron">›</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="analysis-card__track" aria-hidden="true">
|
<div class="analysis-position">
|
||||||
<span></span>
|
<span class="analysis-position__label">当前位置</span>
|
||||||
|
<span class="analysis-position__value">
|
||||||
|
X {{ position ? position.x : '—' }} / Y {{ position ? position.y : '—' }}
|
||||||
|
<small>mm</small>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="analysis-hint">
|
||||||
|
<span class="analysis-hint__mark">i</span>
|
||||||
|
<p>扫描过程中请勿打开样品仓或触碰位移台,以免影响点位与光谱数据。</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
@@ -85,20 +324,107 @@ function abortProcess() {
|
|||||||
|
|
||||||
<div class="spectrum-progress">
|
<div class="spectrum-progress">
|
||||||
<ProgressStrip
|
<ProgressStrip
|
||||||
:progress="progress"
|
:progress="percent"
|
||||||
:label="progressLabel"
|
:label="progressLabel"
|
||||||
:note="`第 ${sampleIndex} / 5 次采样`"
|
:note="progressNote"
|
||||||
|
theme="dark"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<StatusFooter
|
<StatusFooter icon="laser" :items="footerItems" theme="dark" />
|
||||||
icon="laser"
|
|
||||||
:items="['激光发射正常', '探测器积分完成', '数据保存中']"
|
|
||||||
/>
|
|
||||||
</AppStage>
|
</AppStage>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.spectrum-bg {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
pointer-events: none;
|
||||||
|
background:
|
||||||
|
radial-gradient(1000px 600px at 8% -16%, rgba(48, 112, 255, 0.28), transparent 62%),
|
||||||
|
radial-gradient(820px 520px at 98% 4%, rgba(0, 209, 255, 0.14), transparent 60%),
|
||||||
|
radial-gradient(900px 680px at 58% 116%, rgba(122, 84, 255, 0.18), transparent 62%),
|
||||||
|
linear-gradient(156deg, #050a16 0%, #081226 46%, #0a1730 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.spectrum-bg::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background-image:
|
||||||
|
linear-gradient(rgba(130, 175, 255, 0.05) 1px, transparent 1px),
|
||||||
|
linear-gradient(90deg, rgba(130, 175, 255, 0.05) 1px, transparent 1px);
|
||||||
|
background-size: 64px 64px;
|
||||||
|
mask-image: radial-gradient(ellipse 78% 72% at 50% 32%, #000 20%, transparent 78%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.spectrum-bg__orb {
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 50%;
|
||||||
|
filter: blur(100px);
|
||||||
|
animation: spectrum-orb-drift 16s ease-in-out infinite alternate;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spectrum-bg__orb--blue {
|
||||||
|
top: -340px;
|
||||||
|
left: -160px;
|
||||||
|
width: 760px;
|
||||||
|
height: 760px;
|
||||||
|
background: rgba(48, 118, 255, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.spectrum-bg__orb--cyan {
|
||||||
|
top: -200px;
|
||||||
|
right: -220px;
|
||||||
|
width: 640px;
|
||||||
|
height: 640px;
|
||||||
|
background: rgba(0, 214, 255, 0.18);
|
||||||
|
animation-delay: -5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spectrum-bg__orb--violet {
|
||||||
|
bottom: -360px;
|
||||||
|
left: 36%;
|
||||||
|
width: 700px;
|
||||||
|
height: 700px;
|
||||||
|
background: rgba(124, 92, 255, 0.18);
|
||||||
|
animation-delay: -10s;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spectrum-orb-drift {
|
||||||
|
from {
|
||||||
|
transform: translate3d(0, 0, 0) scale(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
transform: translate3d(42px, 30px, 0) scale(1.08);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.spectrum-abort {
|
||||||
|
width: 300px;
|
||||||
|
height: 68px;
|
||||||
|
border: 1px solid rgba(255, 190, 60, 0.45);
|
||||||
|
border-radius: 14px;
|
||||||
|
background: linear-gradient(120deg, rgba(255, 186, 40, 0.18), rgba(255, 150, 20, 0.06));
|
||||||
|
color: #ffd98a;
|
||||||
|
font-size: 26px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 3px;
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
transition:
|
||||||
|
transform 0.2s ease,
|
||||||
|
border-color 0.2s ease,
|
||||||
|
background 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spectrum-abort:hover {
|
||||||
|
border-color: rgba(255, 205, 100, 0.65);
|
||||||
|
background: linear-gradient(120deg, rgba(255, 186, 40, 0.26), rgba(255, 150, 20, 0.1));
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
.spectrum-main {
|
.spectrum-main {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 142px;
|
top: 142px;
|
||||||
@@ -115,36 +441,84 @@ function abortProcess() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.analysis-card {
|
.analysis-card {
|
||||||
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border: 1px solid #d9e0e8;
|
border: 1px solid rgba(130, 175, 255, 0.16);
|
||||||
border-radius: 10px;
|
border-radius: 26px;
|
||||||
background: #fff;
|
background: linear-gradient(
|
||||||
box-shadow: 0 8px 24px rgba(33, 53, 84, 0.05);
|
158deg,
|
||||||
|
rgba(255, 255, 255, 0.07) 0%,
|
||||||
|
rgba(255, 255, 255, 0.025) 58%,
|
||||||
|
rgba(255, 255, 255, 0.04) 100%
|
||||||
|
);
|
||||||
|
box-shadow:
|
||||||
|
0 30px 70px rgba(0, 10, 32, 0.45),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.08);
|
||||||
|
backdrop-filter: blur(16px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.analysis-card::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 32px;
|
||||||
|
left: 32px;
|
||||||
|
height: 1px;
|
||||||
|
background: linear-gradient(90deg, transparent, rgba(120, 180, 255, 0.55), transparent);
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.analysis-card__header {
|
.analysis-card__header {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: none;
|
flex: none;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 64px;
|
height: 96px;
|
||||||
padding: 0 22px;
|
padding: 0 26px;
|
||||||
border-bottom: 1px solid #e4e8ee;
|
border-bottom: 1px solid rgba(130, 175, 255, 0.12);
|
||||||
background: #f3f4f6;
|
background: linear-gradient(120deg, rgba(30, 66, 128, 0.24) 0%, transparent 70%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.analysis-card__heading {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.analysis-card__eyebrow {
|
||||||
|
color: #5aa2ff;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 2.6px;
|
||||||
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
.analysis-card__header h2 {
|
.analysis-card__header h2 {
|
||||||
color: #333b46;
|
display: flex;
|
||||||
font-size: 23px;
|
align-items: center;
|
||||||
font-weight: 500;
|
gap: 12px;
|
||||||
letter-spacing: 1px;
|
color: #eaf3ff;
|
||||||
|
font-size: 26px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.analysis-card__header h2::before {
|
||||||
|
content: '';
|
||||||
|
width: 4px;
|
||||||
|
height: 22px;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: linear-gradient(180deg, #7fe0ff, #4d8bf0);
|
||||||
|
box-shadow: 0 0 14px rgba(90, 170, 255, 0.7);
|
||||||
}
|
}
|
||||||
|
|
||||||
.analysis-card__body {
|
.analysis-card__body {
|
||||||
|
display: flex;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding: 16px 18px;
|
flex-direction: column;
|
||||||
|
padding: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.analysis-step {
|
.analysis-step {
|
||||||
@@ -152,17 +526,42 @@ function abortProcess() {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
height: 78px;
|
height: 78px;
|
||||||
padding: 0 10px;
|
padding: 0 14px;
|
||||||
border-bottom: 1px solid #eef1f5;
|
border: 1px solid transparent;
|
||||||
|
border-radius: 14px;
|
||||||
|
opacity: 0.45;
|
||||||
|
transition:
|
||||||
|
opacity 0.2s ease,
|
||||||
|
background 0.2s ease,
|
||||||
|
border-color 0.2s ease,
|
||||||
|
box-shadow 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.analysis-step + .analysis-step {
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.analysis-step--active {
|
||||||
|
border-color: rgba(120, 200, 255, 0.35);
|
||||||
|
background: rgba(70, 140, 255, 0.14);
|
||||||
|
box-shadow:
|
||||||
|
0 0 24px rgba(70, 140, 255, 0.18),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.06);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.analysis-step--done {
|
||||||
|
opacity: 0.9;
|
||||||
}
|
}
|
||||||
|
|
||||||
.analysis-step__icon {
|
.analysis-step__icon {
|
||||||
display: grid;
|
display: grid;
|
||||||
flex: none;
|
flex: none;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
width: 38px;
|
width: 42px;
|
||||||
height: 38px;
|
height: 42px;
|
||||||
border-radius: 50%;
|
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||||
|
border-radius: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.analysis-step__icon svg {
|
.analysis-step__icon svg {
|
||||||
@@ -171,45 +570,98 @@ function abortProcess() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.analysis-step__icon--blue {
|
.analysis-step__icon--blue {
|
||||||
color: #2f6fd0;
|
border-color: rgba(120, 190, 255, 0.25);
|
||||||
background: #eaf2ff;
|
background: rgba(70, 140, 255, 0.16);
|
||||||
|
color: #8fd0ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.analysis-step__icon--amber {
|
.analysis-step__icon--amber {
|
||||||
color: #d59400;
|
border-color: rgba(255, 205, 100, 0.22);
|
||||||
background: #fff4d6;
|
background: rgba(255, 180, 40, 0.14);
|
||||||
|
color: #ffd166;
|
||||||
}
|
}
|
||||||
|
|
||||||
.analysis-step__text {
|
.analysis-step__text {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
color: #3f4b5b;
|
color: rgba(200, 220, 245, 0.72);
|
||||||
font-size: 21px;
|
font-size: 21px;
|
||||||
letter-spacing: 0.5px;
|
letter-spacing: 0.5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.analysis-step--active .analysis-step__text {
|
||||||
|
color: #f2f8ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.analysis-step--done .analysis-step__text {
|
||||||
|
color: rgba(220, 238, 255, 0.9);
|
||||||
|
}
|
||||||
|
|
||||||
.analysis-step__chevron {
|
.analysis-step__chevron {
|
||||||
color: #b2bcc8;
|
color: rgba(130, 175, 255, 0.35);
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.analysis-card__track {
|
.analysis-step--active .analysis-step__chevron {
|
||||||
position: relative;
|
color: #7fe0ff;
|
||||||
width: 6px;
|
|
||||||
height: 142px;
|
|
||||||
margin: 22px 0 0 auto;
|
|
||||||
border-radius: 6px;
|
|
||||||
background: #eef1f5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.analysis-card__track span {
|
.analysis-position {
|
||||||
position: absolute;
|
display: flex;
|
||||||
top: 18px;
|
flex-direction: column;
|
||||||
left: 0;
|
gap: 8px;
|
||||||
width: 6px;
|
margin-top: 18px;
|
||||||
height: 54px;
|
padding: 16px 18px;
|
||||||
border-radius: 6px;
|
border: 1px solid rgba(130, 175, 255, 0.14);
|
||||||
background: #c9d3df;
|
border-radius: 14px;
|
||||||
|
background: rgba(8, 18, 38, 0.55);
|
||||||
|
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
|
||||||
|
}
|
||||||
|
|
||||||
|
.analysis-position__label {
|
||||||
|
color: rgba(158, 190, 226, 0.7);
|
||||||
|
font-size: 16px;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.analysis-position__value {
|
||||||
|
color: #e8f2ff;
|
||||||
|
font-size: 26px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.analysis-position__value small {
|
||||||
|
margin-left: 6px;
|
||||||
|
color: rgba(158, 190, 226, 0.55);
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
.analysis-hint {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
margin-top: auto;
|
||||||
|
padding: 16px 18px;
|
||||||
|
border: 1px solid rgba(130, 175, 255, 0.14);
|
||||||
|
border-radius: 14px;
|
||||||
|
background: rgba(8, 18, 38, 0.45);
|
||||||
|
color: rgba(158, 190, 226, 0.66);
|
||||||
|
font-size: 15px;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.analysis-hint__mark {
|
||||||
|
display: grid;
|
||||||
|
flex: none;
|
||||||
|
place-items: center;
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
border: 1px solid rgba(130, 195, 255, 0.35);
|
||||||
|
border-radius: 50%;
|
||||||
|
color: #8fc6ff;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
.spectrum-progress {
|
.spectrum-progress {
|
||||||
|
|||||||
@@ -109,6 +109,22 @@ function closeForm() {
|
|||||||
formOpen.value = false
|
formOpen.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let backdropPressed = false
|
||||||
|
|
||||||
|
function onBackdropPointerDown(event: PointerEvent) {
|
||||||
|
backdropPressed = event.target === event.currentTarget
|
||||||
|
}
|
||||||
|
|
||||||
|
function onBackdropPointerUp(event: PointerEvent) {
|
||||||
|
if (event.target !== event.currentTarget) backdropPressed = false
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeOnBackdrop(event: MouseEvent, action: () => void) {
|
||||||
|
const shouldClose = backdropPressed && event.target === event.currentTarget
|
||||||
|
backdropPressed = false
|
||||||
|
if (shouldClose) action()
|
||||||
|
}
|
||||||
|
|
||||||
async function save() {
|
async function save() {
|
||||||
if (saving.value) return
|
if (saving.value) return
|
||||||
|
|
||||||
@@ -183,9 +199,19 @@ onMounted(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<AppStage>
|
<AppStage>
|
||||||
<PageHeader title="系统参数管理" subtitle="系统运行参数集中配置">
|
<div class="system-bg" aria-hidden="true">
|
||||||
|
<span class="system-bg__orb system-bg__orb--blue"></span>
|
||||||
|
<span class="system-bg__orb system-bg__orb--cyan"></span>
|
||||||
|
<span class="system-bg__orb system-bg__orb--violet"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<PageHeader
|
||||||
|
title="系统参数管理"
|
||||||
|
subtitle="系统运行参数集中配置"
|
||||||
|
theme="dark"
|
||||||
|
>
|
||||||
<template #left>
|
<template #left>
|
||||||
<button class="header-button header-button--outline" type="button" @click="goHome">
|
<button class="admin-back" type="button" @click="goHome">
|
||||||
返回
|
返回
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
@@ -254,7 +280,13 @@ onMounted(() => {
|
|||||||
|
|
||||||
<Teleport to="body">
|
<Teleport to="body">
|
||||||
<Transition name="config-modal">
|
<Transition name="config-modal">
|
||||||
<div v-if="formOpen" class="config-backdrop" @click.self="closeForm">
|
<div
|
||||||
|
v-if="formOpen"
|
||||||
|
class="config-backdrop"
|
||||||
|
@pointerdown="onBackdropPointerDown"
|
||||||
|
@pointerup="onBackdropPointerUp"
|
||||||
|
@click="closeOnBackdrop($event, closeForm)"
|
||||||
|
>
|
||||||
<section class="form-card" role="dialog" aria-modal="true" aria-label="系统参数表单">
|
<section class="form-card" role="dialog" aria-modal="true" aria-label="系统参数表单">
|
||||||
<h2>{{ editingId === null ? '新增系统参数' : '编辑系统参数' }}</h2>
|
<h2>{{ editingId === null ? '新增系统参数' : '编辑系统参数' }}</h2>
|
||||||
|
|
||||||
@@ -316,7 +348,13 @@ onMounted(() => {
|
|||||||
|
|
||||||
<Teleport to="body">
|
<Teleport to="body">
|
||||||
<Transition name="config-modal">
|
<Transition name="config-modal">
|
||||||
<div v-if="deleting" class="config-backdrop" @click.self="cancelDelete">
|
<div
|
||||||
|
v-if="deleting"
|
||||||
|
class="config-backdrop"
|
||||||
|
@pointerdown="onBackdropPointerDown"
|
||||||
|
@pointerup="onBackdropPointerUp"
|
||||||
|
@click="closeOnBackdrop($event, cancelDelete)"
|
||||||
|
>
|
||||||
<section class="confirm-card" role="dialog" aria-modal="true" aria-label="删除确认">
|
<section class="confirm-card" role="dialog" aria-modal="true" aria-label="删除确认">
|
||||||
<h2>删除系统参数</h2>
|
<h2>删除系统参数</h2>
|
||||||
<p>
|
<p>
|
||||||
@@ -349,6 +387,95 @@ onMounted(() => {
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.system-bg {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
pointer-events: none;
|
||||||
|
background:
|
||||||
|
radial-gradient(1000px 600px at 8% -16%, rgba(48, 112, 255, 0.28), transparent 62%),
|
||||||
|
radial-gradient(820px 520px at 98% 4%, rgba(0, 209, 255, 0.14), transparent 60%),
|
||||||
|
radial-gradient(900px 680px at 58% 116%, rgba(122, 84, 255, 0.18), transparent 62%),
|
||||||
|
linear-gradient(156deg, #050a16 0%, #081226 46%, #0a1730 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.system-bg::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background-image:
|
||||||
|
linear-gradient(rgba(130, 175, 255, 0.05) 1px, transparent 1px),
|
||||||
|
linear-gradient(90deg, rgba(130, 175, 255, 0.05) 1px, transparent 1px);
|
||||||
|
background-size: 64px 64px;
|
||||||
|
mask-image: radial-gradient(ellipse 78% 72% at 50% 32%, #000 20%, transparent 78%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.system-bg__orb {
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 50%;
|
||||||
|
filter: blur(100px);
|
||||||
|
animation: system-orb-drift 16s ease-in-out infinite alternate;
|
||||||
|
}
|
||||||
|
|
||||||
|
.system-bg__orb--blue {
|
||||||
|
top: -340px;
|
||||||
|
left: -160px;
|
||||||
|
width: 760px;
|
||||||
|
height: 760px;
|
||||||
|
background: rgba(48, 118, 255, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.system-bg__orb--cyan {
|
||||||
|
top: -200px;
|
||||||
|
right: -220px;
|
||||||
|
width: 640px;
|
||||||
|
height: 640px;
|
||||||
|
background: rgba(0, 214, 255, 0.18);
|
||||||
|
animation-delay: -5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.system-bg__orb--violet {
|
||||||
|
bottom: -360px;
|
||||||
|
left: 36%;
|
||||||
|
width: 700px;
|
||||||
|
height: 700px;
|
||||||
|
background: rgba(124, 92, 255, 0.18);
|
||||||
|
animation-delay: -10s;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes system-orb-drift {
|
||||||
|
from {
|
||||||
|
transform: translate3d(0, 0, 0) scale(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
transform: translate3d(42px, 30px, 0) scale(1.08);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-back {
|
||||||
|
width: 132px;
|
||||||
|
height: 60px;
|
||||||
|
border: 1px solid rgba(130, 190, 255, 0.35);
|
||||||
|
border-radius: 12px;
|
||||||
|
background: rgba(18, 40, 78, 0.5);
|
||||||
|
color: #bcd9ff;
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 3px;
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
transition:
|
||||||
|
transform 0.2s ease,
|
||||||
|
border-color 0.2s ease,
|
||||||
|
background 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-back:hover {
|
||||||
|
border-color: rgba(150, 205, 255, 0.55);
|
||||||
|
background: rgba(30, 66, 128, 0.65);
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
.system-main {
|
.system-main {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 176px;
|
top: 176px;
|
||||||
@@ -358,13 +485,32 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.config-card {
|
.config-card {
|
||||||
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-radius: var(--radius-lg);
|
border: 1px solid rgba(130, 175, 255, 0.18);
|
||||||
background: #fff;
|
border-radius: 26px;
|
||||||
box-shadow: var(--shadow-card);
|
background: linear-gradient(158deg, rgba(20, 40, 78, 0.7) 0%, rgba(6, 14, 30, 0.85) 100%);
|
||||||
|
box-shadow:
|
||||||
|
0 30px 70px rgba(0, 10, 32, 0.5),
|
||||||
|
0 0 40px rgba(48, 118, 255, 0.1),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.08);
|
||||||
|
backdrop-filter: blur(16px);
|
||||||
|
color-scheme: dark;
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-card::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 40px;
|
||||||
|
left: 40px;
|
||||||
|
z-index: 2;
|
||||||
|
height: 1px;
|
||||||
|
background: linear-gradient(90deg, transparent, rgba(130, 214, 255, 0.55), transparent);
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.config-toolbar {
|
.config-toolbar {
|
||||||
@@ -374,7 +520,8 @@ onMounted(() => {
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 24px;
|
gap: 24px;
|
||||||
padding: 24px 30px;
|
padding: 24px 30px;
|
||||||
border-bottom: 1px solid var(--line);
|
border-bottom: 1px solid rgba(130, 175, 255, 0.12);
|
||||||
|
background: linear-gradient(120deg, rgba(26, 58, 112, 0.24) 0%, transparent 70%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.config-search {
|
.config-search {
|
||||||
@@ -387,18 +534,26 @@ onMounted(() => {
|
|||||||
width: 460px;
|
width: 460px;
|
||||||
height: 54px;
|
height: 54px;
|
||||||
padding: 0 20px;
|
padding: 0 20px;
|
||||||
border: 2px solid var(--line-strong);
|
border: 1px solid rgba(130, 175, 255, 0.18);
|
||||||
border-radius: 10px;
|
border-radius: 12px;
|
||||||
color: var(--ink);
|
background: rgba(8, 18, 38, 0.6);
|
||||||
|
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
|
||||||
|
color: #e8f2ff;
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
font-size: 19px;
|
font-size: 19px;
|
||||||
outline: none;
|
outline: none;
|
||||||
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.config-search__input::placeholder {
|
||||||
|
color: rgba(158, 190, 226, 0.42);
|
||||||
|
}
|
||||||
|
|
||||||
.config-search__input:focus {
|
.config-search__input:focus {
|
||||||
border-color: var(--blue);
|
border-color: rgba(120, 200, 255, 0.55);
|
||||||
box-shadow: 0 0 0 4px rgba(47, 111, 208, 0.12);
|
box-shadow:
|
||||||
|
0 0 0 4px rgba(70, 140, 255, 0.14),
|
||||||
|
0 0 24px rgba(70, 140, 255, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.config-toolbar__right {
|
.config-toolbar__right {
|
||||||
@@ -410,40 +565,54 @@ onMounted(() => {
|
|||||||
.toolbar-button {
|
.toolbar-button {
|
||||||
height: 54px;
|
height: 54px;
|
||||||
padding: 0 26px;
|
padding: 0 26px;
|
||||||
border-radius: 10px;
|
border: 1px solid rgba(130, 175, 255, 0.28);
|
||||||
border: 2px solid var(--blue);
|
border-radius: 12px;
|
||||||
color: var(--blue);
|
background: rgba(18, 40, 78, 0.5);
|
||||||
|
color: #bcd9ff;
|
||||||
font-size: 19px;
|
font-size: 19px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
letter-spacing: 2px;
|
letter-spacing: 2px;
|
||||||
background: #fff;
|
transition:
|
||||||
transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
|
transform 0.2s ease,
|
||||||
|
background 0.2s ease,
|
||||||
|
border-color 0.2s ease,
|
||||||
|
box-shadow 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toolbar-button:hover {
|
.toolbar-button:hover {
|
||||||
background: var(--blue-soft);
|
border-color: rgba(150, 205, 255, 0.5);
|
||||||
|
background: rgba(30, 66, 128, 0.6);
|
||||||
transform: translateY(-1px);
|
transform: translateY(-1px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.toolbar-button--ghost {
|
.toolbar-button--ghost {
|
||||||
border-color: var(--line-strong);
|
border-color: rgba(130, 175, 255, 0.18);
|
||||||
color: var(--ink-soft);
|
background: rgba(10, 24, 48, 0.45);
|
||||||
|
color: rgba(178, 202, 232, 0.82);
|
||||||
}
|
}
|
||||||
|
|
||||||
.toolbar-button--ghost:hover {
|
.toolbar-button--ghost:hover {
|
||||||
background: var(--surface-soft);
|
border-color: rgba(150, 205, 255, 0.35);
|
||||||
|
background: rgba(20, 44, 86, 0.55);
|
||||||
}
|
}
|
||||||
|
|
||||||
.toolbar-button--primary {
|
.toolbar-button--primary {
|
||||||
border-color: transparent;
|
border-color: transparent;
|
||||||
color: #fff;
|
background: linear-gradient(180deg, #ffd166 0%, #f0ac0b 100%);
|
||||||
background: linear-gradient(180deg, #4b89e4 0%, #2f6fd0 100%);
|
box-shadow:
|
||||||
box-shadow: 0 8px 18px rgba(47, 111, 208, 0.24);
|
0 12px 26px rgba(240, 172, 11, 0.26),
|
||||||
|
0 0 24px rgba(255, 190, 60, 0.14),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.6);
|
||||||
|
color: #241500;
|
||||||
|
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.25);
|
||||||
}
|
}
|
||||||
|
|
||||||
.toolbar-button--primary:hover {
|
.toolbar-button--primary:hover {
|
||||||
background: linear-gradient(180deg, #4b89e4 0%, #2f6fd0 100%);
|
background: linear-gradient(180deg, #ffd166 0%, #f0ac0b 100%);
|
||||||
box-shadow: 0 12px 24px rgba(47, 111, 208, 0.32);
|
box-shadow:
|
||||||
|
0 16px 34px rgba(240, 172, 11, 0.34),
|
||||||
|
0 0 32px rgba(255, 190, 60, 0.22),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
.config-table {
|
.config-table {
|
||||||
@@ -467,9 +636,10 @@ onMounted(() => {
|
|||||||
flex: none;
|
flex: none;
|
||||||
height: 62px;
|
height: 62px;
|
||||||
margin-top: 18px;
|
margin-top: 18px;
|
||||||
border-radius: 12px;
|
border: 1px solid rgba(130, 175, 255, 0.12);
|
||||||
background: var(--surface-soft);
|
border-radius: 14px;
|
||||||
color: var(--muted);
|
background: rgba(255, 255, 255, 0.04);
|
||||||
|
color: rgba(158, 190, 226, 0.65);
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
letter-spacing: 1px;
|
letter-spacing: 1px;
|
||||||
@@ -479,22 +649,33 @@ onMounted(() => {
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
margin-right: -6px;
|
||||||
|
padding-right: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-table__body::-webkit-scrollbar {
|
||||||
|
width: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.config-table__body::-webkit-scrollbar-thumb {
|
||||||
|
border-radius: 3px;
|
||||||
|
background: rgba(130, 175, 255, 0.25);
|
||||||
}
|
}
|
||||||
|
|
||||||
.config-row {
|
.config-row {
|
||||||
min-height: 72px;
|
min-height: 72px;
|
||||||
border-bottom: 1px solid var(--line);
|
border-bottom: 1px solid rgba(130, 175, 255, 0.08);
|
||||||
color: var(--ink-soft);
|
color: rgba(210, 228, 250, 0.8);
|
||||||
font-size: 19px;
|
font-size: 19px;
|
||||||
transition: background 0.18s ease;
|
transition: background 0.18s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.config-row:hover {
|
.config-row:hover {
|
||||||
background: #f8fafc;
|
background: rgba(70, 140, 255, 0.08);
|
||||||
}
|
}
|
||||||
|
|
||||||
.col-name {
|
.col-name {
|
||||||
color: var(--ink);
|
color: #f2f8ff;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -514,47 +695,53 @@ onMounted(() => {
|
|||||||
.row-button {
|
.row-button {
|
||||||
height: 42px;
|
height: 42px;
|
||||||
padding: 0 18px;
|
padding: 0 18px;
|
||||||
border: 1px solid var(--line-strong);
|
border: 1px solid rgba(120, 190, 255, 0.28);
|
||||||
border-radius: 8px;
|
border-radius: 10px;
|
||||||
color: var(--blue);
|
background: rgba(70, 140, 255, 0.12);
|
||||||
|
color: #8fd0ff;
|
||||||
font-size: 17px;
|
font-size: 17px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
letter-spacing: 1px;
|
letter-spacing: 1px;
|
||||||
background: #fff;
|
transition:
|
||||||
transition: background 0.18s ease, border-color 0.18s ease;
|
background 0.18s ease,
|
||||||
|
border-color 0.18s ease,
|
||||||
|
color 0.18s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.row-button:hover {
|
.row-button:hover {
|
||||||
border-color: var(--blue);
|
border-color: rgba(150, 205, 255, 0.5);
|
||||||
background: var(--blue-soft);
|
background: rgba(70, 140, 255, 0.22);
|
||||||
}
|
}
|
||||||
|
|
||||||
.row-button--danger {
|
.row-button--danger {
|
||||||
color: var(--red);
|
border-color: rgba(255, 120, 120, 0.28);
|
||||||
|
background: rgba(255, 84, 84, 0.1);
|
||||||
|
color: #ff9d9d;
|
||||||
}
|
}
|
||||||
|
|
||||||
.row-button--danger:hover {
|
.row-button--danger:hover {
|
||||||
border-color: var(--red);
|
border-color: rgba(255, 150, 150, 0.5);
|
||||||
background: #fdeeee;
|
background: rgba(255, 84, 84, 0.18);
|
||||||
}
|
}
|
||||||
|
|
||||||
.config-empty {
|
.config-empty {
|
||||||
padding: 80px 0;
|
padding: 80px 0;
|
||||||
color: var(--muted-light);
|
color: rgba(158, 190, 226, 0.5);
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
letter-spacing: 1px;
|
letter-spacing: 1px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.config-footer {
|
.config-footer {
|
||||||
flex: none;
|
|
||||||
height: 64px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex: none;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
|
height: 64px;
|
||||||
padding: 0 48px;
|
padding: 0 48px;
|
||||||
border-top: 1px solid var(--line);
|
border-top: 1px solid rgba(130, 175, 255, 0.12);
|
||||||
color: var(--muted);
|
background: rgba(8, 18, 38, 0.55);
|
||||||
|
color: rgba(158, 190, 226, 0.65);
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
letter-spacing: 1px;
|
letter-spacing: 1px;
|
||||||
}
|
}
|
||||||
@@ -566,26 +753,31 @@ onMounted(() => {
|
|||||||
display: grid;
|
display: grid;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
padding: 24px;
|
padding: 24px;
|
||||||
background: rgba(18, 33, 54, 0.44);
|
background: rgba(3, 8, 18, 0.68);
|
||||||
backdrop-filter: blur(5px);
|
backdrop-filter: blur(8px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-card {
|
.form-card {
|
||||||
width: 760px;
|
width: 760px;
|
||||||
padding: 36px 40px 34px;
|
padding: 36px 40px 34px;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.65);
|
border: 1px solid rgba(130, 175, 255, 0.2);
|
||||||
border-radius: 24px;
|
border-radius: 26px;
|
||||||
background: #fff;
|
background: linear-gradient(158deg, rgba(22, 42, 78, 0.98) 0%, rgba(8, 16, 32, 0.99) 100%);
|
||||||
box-shadow: 0 30px 80px rgba(12, 30, 55, 0.3);
|
box-shadow:
|
||||||
|
0 40px 90px rgba(0, 6, 20, 0.6),
|
||||||
|
0 0 50px rgba(48, 118, 255, 0.12),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.08);
|
||||||
|
color-scheme: dark;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-card h2,
|
.form-card h2,
|
||||||
.confirm-card h2 {
|
.confirm-card h2 {
|
||||||
color: #1f2937;
|
color: #eef5ff;
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
letter-spacing: 1px;
|
letter-spacing: 1px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
text-shadow: 0 0 24px rgba(80, 150, 255, 0.28);
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-grid {
|
.form-grid {
|
||||||
@@ -599,7 +791,7 @@ onMounted(() => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
color: var(--ink-soft);
|
color: rgba(158, 190, 226, 0.72);
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
letter-spacing: 0.5px;
|
letter-spacing: 0.5px;
|
||||||
}
|
}
|
||||||
@@ -609,7 +801,7 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.form-field em {
|
.form-field em {
|
||||||
color: var(--red);
|
color: #ff9d9d;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -617,9 +809,11 @@ onMounted(() => {
|
|||||||
.form-field textarea {
|
.form-field textarea {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 14px 18px;
|
padding: 14px 18px;
|
||||||
border: 2px solid var(--line-strong);
|
border: 1px solid rgba(130, 175, 255, 0.18);
|
||||||
border-radius: 10px;
|
border-radius: 12px;
|
||||||
color: var(--ink);
|
background: rgba(6, 14, 28, 0.7);
|
||||||
|
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
|
||||||
|
color: #e8f2ff;
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
font-size: 19px;
|
font-size: 19px;
|
||||||
outline: none;
|
outline: none;
|
||||||
@@ -627,19 +821,26 @@ onMounted(() => {
|
|||||||
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form-field input::placeholder,
|
||||||
|
.form-field textarea::placeholder {
|
||||||
|
color: rgba(158, 190, 226, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
.form-field input {
|
.form-field input {
|
||||||
height: 56px;
|
height: 56px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-field input:focus,
|
.form-field input:focus,
|
||||||
.form-field textarea:focus {
|
.form-field textarea:focus {
|
||||||
border-color: var(--blue);
|
border-color: rgba(120, 200, 255, 0.55);
|
||||||
box-shadow: 0 0 0 4px rgba(47, 111, 208, 0.12);
|
box-shadow:
|
||||||
|
0 0 0 4px rgba(70, 140, 255, 0.14),
|
||||||
|
0 0 24px rgba(70, 140, 255, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-error {
|
.form-error {
|
||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
color: var(--red);
|
color: #ff9d9d;
|
||||||
font-size: 17px;
|
font-size: 17px;
|
||||||
letter-spacing: 0.5px;
|
letter-spacing: 0.5px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -659,58 +860,80 @@ onMounted(() => {
|
|||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
letter-spacing: 3px;
|
letter-spacing: 3px;
|
||||||
transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
|
transition:
|
||||||
|
transform 0.2s ease,
|
||||||
|
box-shadow 0.2s ease,
|
||||||
|
background 0.2s ease,
|
||||||
|
border-color 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-button:disabled {
|
.form-button:disabled {
|
||||||
cursor: default;
|
cursor: default;
|
||||||
opacity: 0.65;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-button--ghost {
|
.form-button--ghost {
|
||||||
border: 2px solid var(--line-strong);
|
border: 1px solid rgba(130, 175, 255, 0.28);
|
||||||
color: var(--ink-soft);
|
background: rgba(18, 40, 78, 0.5);
|
||||||
background: #fff;
|
color: #bcd9ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-button--ghost:hover:not(:disabled) {
|
.form-button--ghost:hover:not(:disabled) {
|
||||||
background: var(--surface-soft);
|
border-color: rgba(150, 205, 255, 0.5);
|
||||||
|
background: rgba(30, 66, 128, 0.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-button--primary {
|
.form-button--primary {
|
||||||
color: #fff;
|
background: linear-gradient(180deg, #ffd166 0%, #f0ac0b 100%);
|
||||||
background: linear-gradient(180deg, #4b89e4 0%, #2f6fd0 100%);
|
box-shadow:
|
||||||
box-shadow: 0 10px 22px rgba(47, 111, 208, 0.28);
|
0 14px 30px rgba(240, 172, 11, 0.28),
|
||||||
|
0 0 26px rgba(255, 190, 60, 0.16),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.6);
|
||||||
|
color: #241500;
|
||||||
|
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.25);
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-button--primary:hover:not(:disabled) {
|
.form-button--primary:hover:not(:disabled) {
|
||||||
transform: translateY(-1px);
|
box-shadow:
|
||||||
box-shadow: 0 14px 28px rgba(47, 111, 208, 0.36);
|
0 18px 38px rgba(240, 172, 11, 0.36),
|
||||||
|
0 0 34px rgba(255, 190, 60, 0.26),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.6);
|
||||||
|
transform: translateY(-2px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-button--danger {
|
.form-button--danger {
|
||||||
color: #fff;
|
background: linear-gradient(180deg, #ff8b84 0%, #e15b55 100%);
|
||||||
background: linear-gradient(180deg, #ef6d66 0%, #e15b55 100%);
|
box-shadow:
|
||||||
box-shadow: 0 10px 22px rgba(225, 91, 85, 0.26);
|
0 14px 30px rgba(225, 91, 85, 0.28),
|
||||||
|
0 0 26px rgba(255, 110, 100, 0.16),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.4);
|
||||||
|
color: #2a0806;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-button--danger:hover:not(:disabled) {
|
.form-button--danger:hover:not(:disabled) {
|
||||||
transform: translateY(-1px);
|
box-shadow:
|
||||||
box-shadow: 0 14px 28px rgba(225, 91, 85, 0.34);
|
0 18px 38px rgba(225, 91, 85, 0.36),
|
||||||
|
0 0 34px rgba(255, 110, 100, 0.26),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.45);
|
||||||
|
transform: translateY(-2px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.confirm-card {
|
.confirm-card {
|
||||||
width: 600px;
|
width: 600px;
|
||||||
padding: 38px 44px 34px;
|
padding: 38px 44px 34px;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.65);
|
border: 1px solid rgba(130, 175, 255, 0.2);
|
||||||
border-radius: 24px;
|
border-radius: 26px;
|
||||||
background: #fff;
|
background: linear-gradient(158deg, rgba(22, 42, 78, 0.98) 0%, rgba(8, 16, 32, 0.99) 100%);
|
||||||
box-shadow: 0 30px 80px rgba(12, 30, 55, 0.3);
|
box-shadow:
|
||||||
|
0 40px 90px rgba(0, 6, 20, 0.6),
|
||||||
|
0 0 50px rgba(48, 118, 255, 0.12),
|
||||||
|
inset 0 1px 0 rgba(255, 255, 255, 0.08);
|
||||||
|
color-scheme: dark;
|
||||||
}
|
}
|
||||||
|
|
||||||
.confirm-card p {
|
.confirm-card p {
|
||||||
margin-top: 18px;
|
margin-top: 18px;
|
||||||
color: var(--muted);
|
color: rgba(158, 190, 226, 0.7);
|
||||||
font-size: 19px;
|
font-size: 19px;
|
||||||
letter-spacing: 0.5px;
|
letter-spacing: 0.5px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ const proxy = {
|
|||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
ws: true,
|
ws: true,
|
||||||
},
|
},
|
||||||
|
'/stageHub': {
|
||||||
|
target: backend,
|
||||||
|
changeOrigin: true,
|
||||||
|
ws: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
|||||||
@@ -0,0 +1,116 @@
|
|||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace HardwareControl.Core.AxisPlatform
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// AxisPlatform2.dll 的 P/Invoke 声明。
|
||||||
|
/// 所有结构体按 C 端 #pragma pack(1) 布局,字段顺序与 axis_platform2.h 一致。
|
||||||
|
/// </summary>
|
||||||
|
internal static class AxisPlatformNative
|
||||||
|
{
|
||||||
|
private const string DllName = "AxisPlatform2.dll";
|
||||||
|
|
||||||
|
// 错误码,对应 AXIS2_ERR_*
|
||||||
|
internal const int Ok = 0;
|
||||||
|
internal const int ErrNullPtr = -1;
|
||||||
|
internal const int ErrBufTooSmall = -2;
|
||||||
|
internal const int ErrFrameTooShort = -3;
|
||||||
|
internal const int ErrComOpenFailed = -4;
|
||||||
|
internal const int ErrComNotOpen = -5;
|
||||||
|
internal const int ErrComSendFailed = -6;
|
||||||
|
internal const int ErrParseFailed = -7;
|
||||||
|
internal const int ErrTimeout = -8;
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||||
|
internal static extern IntPtr axis_init(
|
||||||
|
[MarshalAs(UnmanagedType.LPStr)] string comPort,
|
||||||
|
byte headType,
|
||||||
|
IntPtr limits);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern void axis_close(IntPtr handle);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int axis_x_move(IntPtr handle, short distance, ushort speed, ushort accel);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int axis_y_move(IntPtr handle, short distance, ushort speed, ushort accel);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int axis_z_move(IntPtr handle, short distance, ushort speed, ushort accel);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int axis_xyz_rel_move(
|
||||||
|
IntPtr handle,
|
||||||
|
ref Axis2MoveParams x,
|
||||||
|
ref Axis2MoveParams y,
|
||||||
|
ref Axis2MoveParams z);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int axis_xyz_abs_move(
|
||||||
|
IntPtr handle,
|
||||||
|
ref Axis2MoveParams x,
|
||||||
|
ref Axis2MoveParams y,
|
||||||
|
ref Axis2MoveParams z);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern void axis_flush(IntPtr handle);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int axis_read_upload(IntPtr handle, out Axis2UploadData data);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern IntPtr axis_get_error(IntPtr handle);
|
||||||
|
|
||||||
|
/// <summary>读取 DLL 内部记录的最后一次错误描述;无错误或句柄为空时返回空串。</summary>
|
||||||
|
internal static string GetError(IntPtr handle)
|
||||||
|
{
|
||||||
|
if (handle == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
var pointer = axis_get_error(handle);
|
||||||
|
return pointer == IntPtr.Zero
|
||||||
|
? string.Empty
|
||||||
|
: Marshal.PtrToStringAnsi(pointer) ?? string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>限位参数,对应 Axis2Limits(6 × int32)。</summary>
|
||||||
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
|
internal struct Axis2Limits
|
||||||
|
{
|
||||||
|
public int XPosLimit;
|
||||||
|
public int XNegLimit;
|
||||||
|
public int YPosLimit;
|
||||||
|
public int YNegLimit;
|
||||||
|
public int ZPosLimit;
|
||||||
|
public int ZNegLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>单轴运动参数,对应 Axis2MoveParams(6 字节)。</summary>
|
||||||
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
|
internal struct Axis2MoveParams
|
||||||
|
{
|
||||||
|
public short Distance;
|
||||||
|
public ushort Speed;
|
||||||
|
public ushort Accel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>上传数据,对应 Axis2UploadData(13 字节载荷)。</summary>
|
||||||
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
|
internal struct Axis2UploadData
|
||||||
|
{
|
||||||
|
public byte SysSta;
|
||||||
|
public short XPos;
|
||||||
|
public short YPos;
|
||||||
|
public short ZPos;
|
||||||
|
public byte XSta;
|
||||||
|
public byte YSta;
|
||||||
|
public byte ZSta;
|
||||||
|
public byte Error;
|
||||||
|
public byte HwVersion;
|
||||||
|
public byte SwVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
namespace HardwareControl.Core.AxisPlatform
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 帧头类型,对应 AXIS_HEAD_*。
|
||||||
|
/// </summary>
|
||||||
|
public enum AxisPlatformHeadType : byte
|
||||||
|
{
|
||||||
|
/// <summary>台式自聚焦二维平台(0x7A)。</summary>
|
||||||
|
Desktop2D = 0x7A,
|
||||||
|
|
||||||
|
/// <summary>传送带三维平台(0x7B)。</summary>
|
||||||
|
Conveyor3D = 0x7B,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 位移台配置,对应 appsettings.json 的 "AxisStage" 节。
|
||||||
|
/// 串口优先从系统参数 translation_com 读取,未配置时才使用 <see cref="ComPort"/>。
|
||||||
|
/// </summary>
|
||||||
|
public sealed class AxisStageOptions
|
||||||
|
{
|
||||||
|
public const string SectionName = "AxisStage";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 回退串口名(例如 "COM5"),仅当系统参数 translation_com 为空时使用。
|
||||||
|
/// </summary>
|
||||||
|
public string? ComPort { get; set; }
|
||||||
|
|
||||||
|
/// <summary>帧头类型,默认台式二维平台。</summary>
|
||||||
|
public AxisPlatformHeadType FrameHead { get; set; } = AxisPlatformHeadType.Desktop2D;
|
||||||
|
|
||||||
|
/// <summary>未显式传参时使用的默认速度。</summary>
|
||||||
|
public ushort DefaultSpeed { get; set; } = 50;
|
||||||
|
|
||||||
|
/// <summary>未显式传参时使用的默认加速度。</summary>
|
||||||
|
public ushort DefaultAccel { get; set; } = 10;
|
||||||
|
|
||||||
|
/// <summary>限位参数;为 null 时不限位(向 DLL 传 NULL)。</summary>
|
||||||
|
public AxisStageLimits? Limits { get; set; }
|
||||||
|
|
||||||
|
/// <summary>读取上传数据的默认超时,单位毫秒。</summary>
|
||||||
|
public int ReadTimeoutMs { get; set; } = 1000;
|
||||||
|
|
||||||
|
/// <summary>读取上传数据失败时的重试间隔,单位毫秒。</summary>
|
||||||
|
public int ReadRetryIntervalMs { get; set; } = 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 位移台限位参数(单位 mm)。仅在配置了 "Limits" 节时生效,
|
||||||
|
/// 未配置的轴使用足够大的范围,等效于该轴不限位。
|
||||||
|
/// </summary>
|
||||||
|
public sealed class AxisStageLimits
|
||||||
|
{
|
||||||
|
public int XPositive { get; set; } = 1_000_000;
|
||||||
|
public int XNegative { get; set; } = -1_000_000;
|
||||||
|
public int YPositive { get; set; } = 1_000_000;
|
||||||
|
public int YNegative { get; set; } = -1_000_000;
|
||||||
|
public int ZPositive { get; set; } = 1_000_000;
|
||||||
|
public int ZNegative { get; set; } = -1_000_000;
|
||||||
|
|
||||||
|
internal Axis2Limits ToNative() => new()
|
||||||
|
{
|
||||||
|
XPosLimit = XPositive,
|
||||||
|
XNegLimit = XNegative,
|
||||||
|
YPosLimit = YPositive,
|
||||||
|
YNegLimit = YNegative,
|
||||||
|
ZPosLimit = ZPositive,
|
||||||
|
ZNegLimit = ZNegative,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace HardwareControl.Core.AxisPlatform
|
||||||
|
{
|
||||||
|
/// <summary>三轴坐标/位移,单位 mm。</summary>
|
||||||
|
public readonly record struct AxisStagePoint(int X, int Y, int Z)
|
||||||
|
{
|
||||||
|
public static AxisStagePoint Zero => new(0, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
namespace HardwareControl.Core.AxisPlatform
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 位移台上传帧(0xF5)的解析结果。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="XPosition">X 轴当前位置(mm)。</param>
|
||||||
|
/// <param name="YPosition">Y 轴当前位置(mm)。</param>
|
||||||
|
/// <param name="ZPosition">Z 轴当前位置(mm)。</param>
|
||||||
|
/// <param name="XMoving">X 轴是否运动中。</param>
|
||||||
|
/// <param name="YMoving">Y 轴是否运动中。</param>
|
||||||
|
/// <param name="ZMoving">Z 轴是否运动中。</param>
|
||||||
|
/// <param name="IsDebugMode">设备是否处于 Debug 模式(sys_sta 非 0)。</param>
|
||||||
|
/// <param name="DeviceError">设备端错误码。</param>
|
||||||
|
/// <param name="HardwareVersion">硬件版本号。</param>
|
||||||
|
/// <param name="SoftwareVersion">软件版本号。</param>
|
||||||
|
/// <param name="ReceivedAt">本机解析到该帧的时间。</param>
|
||||||
|
public sealed record AxisStageStatus(
|
||||||
|
int XPosition,
|
||||||
|
int YPosition,
|
||||||
|
int ZPosition,
|
||||||
|
bool XMoving,
|
||||||
|
bool YMoving,
|
||||||
|
bool ZMoving,
|
||||||
|
bool IsDebugMode,
|
||||||
|
int DeviceError,
|
||||||
|
int HardwareVersion,
|
||||||
|
int SoftwareVersion,
|
||||||
|
DateTimeOffset ReceivedAt)
|
||||||
|
{
|
||||||
|
/// <summary>是否有任意轴仍在运动。</summary>
|
||||||
|
public bool AnyMoving => XMoving || YMoving || ZMoving;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
namespace HardwareControl.Core.AxisPlatform
|
||||||
|
{
|
||||||
|
public class AxisStageStatusChangedEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
public bool IsConnected { get; }
|
||||||
|
public string Message { get; }
|
||||||
|
|
||||||
|
public AxisStageStatusChangedEventArgs(bool isConnected, string message)
|
||||||
|
{
|
||||||
|
IsConnected = isConnected;
|
||||||
|
Message = message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
namespace HardwareControl.Core.FocusSystem
|
||||||
|
{
|
||||||
|
/// <summary>实时应答类型,对应 Focus2RealTimeResp.type。</summary>
|
||||||
|
public enum FocusRealTimeResultType
|
||||||
|
{
|
||||||
|
/// <summary>消息应答(0x01),命令执行回执。</summary>
|
||||||
|
MessageAck = 0x01,
|
||||||
|
|
||||||
|
/// <summary>运行结果(0x02)。</summary>
|
||||||
|
RunningResult = 0x02,
|
||||||
|
|
||||||
|
/// <summary>查询结果(0x03),如同步延时获取。</summary>
|
||||||
|
QueryResult = 0x03,
|
||||||
|
|
||||||
|
Unknown = 0xFF,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>设备缓存的运行结果/查询结果(focus_query_result)。</summary>
|
||||||
|
/// <param name="Type">应答类型。</param>
|
||||||
|
/// <param name="Success">执行状态是否为成功(sta=0x01)。</param>
|
||||||
|
/// <param name="DeviceError">设备端错误码。</param>
|
||||||
|
/// <param name="Data">附加数据;仅查询结果(0x03)携带,其余为 null。</param>
|
||||||
|
/// <param name="ReceivedAt">本机解析到该帧的时间。</param>
|
||||||
|
public sealed record FocusRealTimeResult(
|
||||||
|
FocusRealTimeResultType Type,
|
||||||
|
bool Success,
|
||||||
|
int DeviceError,
|
||||||
|
int? Data,
|
||||||
|
DateTimeOffset ReceivedAt);
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
namespace HardwareControl.Core.FocusSystem
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 单次对焦的执行结果,对应 focus_single_focus 的返回值。
|
||||||
|
/// </summary>
|
||||||
|
public enum FocusSingleOutcome
|
||||||
|
{
|
||||||
|
/// <summary>对焦动作完成(FOCUS2_OK,运行结果 sta=0x01)。</summary>
|
||||||
|
Completed = 0,
|
||||||
|
|
||||||
|
/// <summary>句柄为空(FOCUS2_ERR_NULL_PTR)。</summary>
|
||||||
|
NullHandle = -1,
|
||||||
|
|
||||||
|
/// <summary>串口未打开(FOCUS2_ERR_COM_NOT_OPEN)。</summary>
|
||||||
|
ComNotOpen = -5,
|
||||||
|
|
||||||
|
/// <summary>设备返回失败(FOCUS2_ERR_COM_SEND_FAILED):应答失败,或运行结果 sta=0x00、error=11/12/13。</summary>
|
||||||
|
DeviceFailed = -6,
|
||||||
|
|
||||||
|
/// <summary>库内等待运行结果超时(FOCUS2_ERR_TIMEOUT)。</summary>
|
||||||
|
DeviceTimeout = -8,
|
||||||
|
|
||||||
|
/// <summary>本机等待上限内未收到返回,结果未知(非动态库返回值)。</summary>
|
||||||
|
WaitTimeout = -9,
|
||||||
|
|
||||||
|
/// <summary>动态库返回了未定义的错误码。</summary>
|
||||||
|
Unknown = -99,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>一次单次对焦的结果。</summary>
|
||||||
|
/// <param name="Outcome">结果类型。</param>
|
||||||
|
/// <param name="Code">动态库原始返回值;<see cref="FocusSingleOutcome.WaitTimeout"/> 时为 null。</param>
|
||||||
|
/// <param name="Elapsed">从下发命令到取得结果的耗时。</param>
|
||||||
|
public sealed record FocusSingleResult(
|
||||||
|
FocusSingleOutcome Outcome,
|
||||||
|
int? Code,
|
||||||
|
TimeSpan Elapsed)
|
||||||
|
{
|
||||||
|
public bool IsSuccess => Outcome == FocusSingleOutcome.Completed;
|
||||||
|
|
||||||
|
/// <summary>结果的中文描述,用于日志与采样点错误信息。</summary>
|
||||||
|
public string Describe() => Outcome switch
|
||||||
|
{
|
||||||
|
FocusSingleOutcome.Completed => "对焦完成",
|
||||||
|
FocusSingleOutcome.NullHandle => "对焦句柄为空",
|
||||||
|
FocusSingleOutcome.ComNotOpen => "对焦串口未打开",
|
||||||
|
FocusSingleOutcome.DeviceFailed => "设备执行失败(应答失败或运行结果 sta=0x00)",
|
||||||
|
FocusSingleOutcome.DeviceTimeout => "设备等待运行结果超时",
|
||||||
|
FocusSingleOutcome.WaitTimeout => "等待对焦结果超时",
|
||||||
|
_ => $"未定义的对焦错误码 {Code}",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
namespace HardwareControl.Core.FocusSystem
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 光谱仪同步延时参数(对应 Focus2SyncTimeParams),单位微秒。
|
||||||
|
/// </summary>
|
||||||
|
public sealed record FocusSyncTime(
|
||||||
|
ushort DelayUs,
|
||||||
|
ushort OffsetUs,
|
||||||
|
ushort HoldUs,
|
||||||
|
ushort HoldOffsetUs);
|
||||||
|
}
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace HardwareControl.Core.FocusSystem
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// FocusSystem2.dll 的 P/Invoke 声明。
|
||||||
|
/// 所有结构体按 C 端 #pragma pack(1) 布局,字段顺序与 focus_system2.h 一致。
|
||||||
|
/// 除查询类函数外,命令函数内部已完成"组包→发送→收应答"。
|
||||||
|
/// </summary>
|
||||||
|
internal static class FocusSystemNative
|
||||||
|
{
|
||||||
|
private const string DllName = "FocusSystem2.dll";
|
||||||
|
|
||||||
|
// 错误码,对应 FOCUS2_ERR_*
|
||||||
|
internal const int Ok = 0;
|
||||||
|
internal const int ErrNullPtr = -1;
|
||||||
|
internal const int ErrBufTooSmall = -2;
|
||||||
|
internal const int ErrFrameTooShort = -3;
|
||||||
|
internal const int ErrComOpenFailed = -4;
|
||||||
|
internal const int ErrComNotOpen = -5;
|
||||||
|
internal const int ErrComSendFailed = -6;
|
||||||
|
internal const int ErrParseFailed = -7;
|
||||||
|
internal const int ErrTimeout = -8;
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||||
|
internal static extern IntPtr focus_init([MarshalAs(UnmanagedType.LPStr)] string comPort);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern void focus_close(IntPtr handle);
|
||||||
|
|
||||||
|
// ---------- 对焦 ----------
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int focus_single_focus(IntPtr handle);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int focus_continuous_focus(IntPtr handle);
|
||||||
|
|
||||||
|
// ---------- 校准 ----------
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int focus_calib_mode(IntPtr handle);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int focus_calib_move(IntPtr handle, sbyte distance, ushort speed);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int focus_calib_save(IntPtr handle);
|
||||||
|
|
||||||
|
// ---------- 激光器 ----------
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int focus_laser_on(IntPtr handle, byte freq);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int focus_laser_off(IntPtr handle);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int focus_laser_power(IntPtr handle, byte power);
|
||||||
|
|
||||||
|
// ---------- 测距 ----------
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int focus_single_range(IntPtr handle);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int focus_continuous_range(IntPtr handle);
|
||||||
|
|
||||||
|
// ---------- 升降机构 ----------
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int focus_lift_control(IntPtr handle, sbyte position);
|
||||||
|
|
||||||
|
// ---------- 外部触发 ----------
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int focus_ext_trigger_set(IntPtr handle);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int focus_ext_trigger_fire(IntPtr handle);
|
||||||
|
|
||||||
|
// ---------- 自动检测 ----------
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int focus_auto_descend(IntPtr handle);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int focus_fixed_cycle(IntPtr handle, ushort timeMs, ushort count);
|
||||||
|
|
||||||
|
// ---------- 光谱仪同步 ----------
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int focus_sync_time_set(
|
||||||
|
IntPtr handle,
|
||||||
|
ref Focus2SyncTimeParams parameters);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int focus_sync_time_get(IntPtr handle);
|
||||||
|
|
||||||
|
// ---------- 电源 ----------
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int focus_power_off(IntPtr handle);
|
||||||
|
|
||||||
|
// ---------- 查询 ----------
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int focus_read_sys_info(IntPtr handle, out Focus2SysInfo info);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern int focus_query_result(IntPtr handle, out Focus2RealTimeResp result);
|
||||||
|
|
||||||
|
// ---------- 错误 ----------
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern IntPtr focus_get_error(IntPtr handle);
|
||||||
|
|
||||||
|
/// <summary>读取 DLL 内部记录的最后一次错误描述;无错误或句柄为空时返回空串。</summary>
|
||||||
|
internal static string GetError(IntPtr handle)
|
||||||
|
{
|
||||||
|
if (handle == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
var pointer = focus_get_error(handle);
|
||||||
|
return pointer == IntPtr.Zero
|
||||||
|
? string.Empty
|
||||||
|
: Marshal.PtrToStringAnsi(pointer) ?? string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>系统信息,对应 Focus2SysInfo(15 字节载荷)。</summary>
|
||||||
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
|
internal struct Focus2SysInfo
|
||||||
|
{
|
||||||
|
public byte SysSta;
|
||||||
|
public ushort FocusPos;
|
||||||
|
public byte Error;
|
||||||
|
public sbyte Location;
|
||||||
|
public byte LaserSta;
|
||||||
|
public byte Voltage;
|
||||||
|
public ushort ExtVoltage;
|
||||||
|
public byte HwVersion;
|
||||||
|
public byte SwVersion;
|
||||||
|
public ushort StartTime;
|
||||||
|
public ushort SyncTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>实时应答,对应 Focus2RealTimeResp(3~5 字节载荷)。</summary>
|
||||||
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
|
internal struct Focus2RealTimeResp
|
||||||
|
{
|
||||||
|
public byte Type;
|
||||||
|
public byte Sta;
|
||||||
|
public byte Error;
|
||||||
|
public ushort Data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>光谱仪同步参数,对应 Focus2SyncTimeParams(8 字节)。</summary>
|
||||||
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
|
internal struct Focus2SyncTimeParams
|
||||||
|
{
|
||||||
|
public ushort DelayUs;
|
||||||
|
public ushort OffsetUs;
|
||||||
|
public ushort HoldUs;
|
||||||
|
public ushort HoldOffsetUs;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
namespace HardwareControl.Core.FocusSystem
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 定焦系统配置,对应 appsettings.json 的 "FocusSystem" 节。
|
||||||
|
/// 串口优先从系统参数 focus_com 读取,未配置时才使用 <see cref="ComPort"/>。
|
||||||
|
/// </summary>
|
||||||
|
public sealed class FocusSystemOptions
|
||||||
|
{
|
||||||
|
public const string SectionName = "FocusSystem";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 回退串口名(例如 "COM6"),仅当系统参数 focus_com 为空时使用。
|
||||||
|
/// </summary>
|
||||||
|
public string? ComPort { get; set; }
|
||||||
|
|
||||||
|
/// <summary>校准位移未显式传速度时使用的默认速度。</summary>
|
||||||
|
public ushort DefaultCalibrationSpeed { get; set; } = 50;
|
||||||
|
|
||||||
|
/// <summary>读取系统信息/运行结果的默认超时,单位毫秒。</summary>
|
||||||
|
public int ReadTimeoutMs { get; set; } = 1000;
|
||||||
|
|
||||||
|
/// <summary>读取失败时的重试间隔,单位毫秒。</summary>
|
||||||
|
public int ReadRetryIntervalMs { get; set; } = 100;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
namespace HardwareControl.Core.FocusSystem
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 定焦系统上传的系统信息(0xF5)解析结果。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="FocusPosition">对焦校准位置。</param>
|
||||||
|
/// <param name="Error">设备端错误码:0=无错误,11=测距超时,12=超负极限,13=超正极限。</param>
|
||||||
|
/// <param name="ErrorDescription">错误码的中文描述。</param>
|
||||||
|
/// <param name="Location">滑台位置。</param>
|
||||||
|
/// <param name="LaserOnline">激光器是否在线。</param>
|
||||||
|
/// <param name="VoltageVolts">电源电压(V)。</param>
|
||||||
|
/// <param name="ExtendedVoltageVolts">扩展板电压(V)。</param>
|
||||||
|
/// <param name="HardwareVersion">硬件版本号。</param>
|
||||||
|
/// <param name="SoftwareVersion">软件版本号。</param>
|
||||||
|
/// <param name="StartTimeMinutes">开机时间(分钟)。</param>
|
||||||
|
/// <param name="SyncTime">同步延时。</param>
|
||||||
|
/// <param name="IsDebugMode">是否处于 Debug 模式(sys_sta 非 0)。</param>
|
||||||
|
/// <param name="ReceivedAt">本机解析到该帧的时间。</param>
|
||||||
|
public sealed record FocusSystemStatus(
|
||||||
|
int FocusPosition,
|
||||||
|
int Error,
|
||||||
|
string ErrorDescription,
|
||||||
|
int Location,
|
||||||
|
bool LaserOnline,
|
||||||
|
double VoltageVolts,
|
||||||
|
double ExtendedVoltageVolts,
|
||||||
|
int HardwareVersion,
|
||||||
|
int SoftwareVersion,
|
||||||
|
int StartTimeMinutes,
|
||||||
|
int SyncTime,
|
||||||
|
bool IsDebugMode,
|
||||||
|
DateTimeOffset ReceivedAt)
|
||||||
|
{
|
||||||
|
public static string DescribeError(int error) => error switch
|
||||||
|
{
|
||||||
|
0 => "无错误",
|
||||||
|
11 => "测距超时",
|
||||||
|
12 => "超负极限",
|
||||||
|
13 => "超正极限",
|
||||||
|
_ => $"未知错误({error})",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
namespace HardwareControl.Core.FocusSystem
|
||||||
|
{
|
||||||
|
public class FocusSystemStatusChangedEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
public bool IsConnected { get; }
|
||||||
|
public string Message { get; }
|
||||||
|
|
||||||
|
public FocusSystemStatusChangedEventArgs(bool isConnected, string message)
|
||||||
|
{
|
||||||
|
IsConnected = isConnected;
|
||||||
|
Message = message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,11 @@
|
|||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<!--
|
||||||
|
DirectML 的 build targets 仅在 PlatformTarget=x64 时复制 DirectML.dll,
|
||||||
|
AnyCPU 会导致运行时缺少该原生库而退回 CPU,因此这里固定为 x64。
|
||||||
|
-->
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -11,26 +16,39 @@
|
|||||||
<PackageReference Include="LiteDB" Version="5.0.21" />
|
<PackageReference Include="LiteDB" Version="5.0.21" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.14" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.14" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.14" />
|
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.14" />
|
||||||
</ItemGroup>
|
<!--
|
||||||
|
DirectML 版 ONNX Runtime:可用核显/独显推理,不支持的算子自动回退 CPU。
|
||||||
<ItemGroup>
|
注意:该包与纯 CPU 版 Microsoft.ML.OnnxRuntime 的原生 dll 冲突,只能二选一;
|
||||||
<Reference Include="ArisSharp">
|
1.24.4 是最后一个提供 DirectML 执行后端的稳定版本。
|
||||||
<HintPath>dll\aris\ArisSharp.dll</HintPath>
|
-->
|
||||||
</Reference>
|
<PackageReference Include="Microsoft.ML.OnnxRuntime.DirectML" Version="1.24.4" />
|
||||||
|
<PackageReference Include="OpenCvSharp4" Version="4.10.0.20241108" />
|
||||||
|
<PackageReference Include="OpenCvSharp4.runtime.win" Version="4.10.0.20241108" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
aris.dll / libusb-1.0.dll 是 ArisSharp.dll 的原生依赖,必须和可执行文件放在同一目录。
|
NIST 谱线库与光栅修正数据,扫描分析按相对路径 db 加载,必须复制到输出目录。
|
||||||
作为项目内容复制,引用本项目的 HardwareWeb / HardwareProbe 输出目录也会带上它们。
|
CfLibs 的 .cs 文件仍然参与编译,这里只复制数据文件。
|
||||||
-->
|
-->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="dll\aris\aris.dll">
|
<Content Include="db\**\*" Exclude="db\**\*.cs">
|
||||||
<Link>aris.dll</Link>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
位移台原生库,P/Invoke 按文件名加载,必须位于可执行文件同目录
|
||||||
|
-->
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="dll\AxisPlatform2.dll">
|
||||||
|
<Link>AxisPlatform2.dll</Link>
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Update="dll\aris\libusb-1.0.dll">
|
<!-- 对焦系统原生库,P/Invoke 按文件名加载,必须位于可执行文件同目录 -->
|
||||||
<Link>libusb-1.0.dll</Link>
|
<None Update="dll\FocusSystem2.dll">
|
||||||
|
<Link>FocusSystem2.dll</Link>
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ namespace HardwareControl.Core.HardwareServiceImpl.HardwareService
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// aris 光谱仪服务。
|
/// aris 光谱仪服务。
|
||||||
/// 单台使用 AcquireFrame 同步单帧;多台使用 StartMeasurement 一次性武装,
|
/// 单台与多台采集都使用 ZioLink 的“预配置 + 仅启动”流程:
|
||||||
/// 收齐回调后按波长拼接。所有操作在内部串行化,单帧/多台采集互斥。
|
/// 参数在启动前一次性下发,启动时每台只发一条 cmd 4,因此多台启动偏差为毫秒级。
|
||||||
|
/// 所有操作在内部串行化,单帧/多台采集互斥。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IArisSpectrometerService : IAsyncDisposable
|
public interface IArisSpectrometerService : IAsyncDisposable
|
||||||
{
|
{
|
||||||
@@ -43,10 +44,11 @@ namespace HardwareControl.Core.HardwareServiceImpl.HardwareService
|
|||||||
CancellationToken ct = default);
|
CancellationToken ct = default);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 多台光谱仪同步采集一帧:StartMeasurement 一次武装所有设备,
|
/// 多台光谱仪同步采集一帧:先下发有变化的曝光参数,再按顺序向每台设备发送启动命令,
|
||||||
/// 收齐每台设备的回调后按波长自动拼接(重合区间各去一半)。
|
/// 轮询到每台设备都有可用帧后读取并按波长自动拼接(重合区间各去一半)。
|
||||||
|
/// 启动偏差为 USB 往返级(约 1 ms/台),100 ms 曝光即可覆盖全部设备。
|
||||||
/// 由第三台设备触发激光的场景使用 Software 触发模式;
|
/// 由第三台设备触发激光的场景使用 Software 触发模式;
|
||||||
/// 有外部 AD/TTL 触发源时使用 FreeRunEdge/External。
|
/// 有外部 AD/TTL 触发源时使用 External。
|
||||||
/// 部分设备超时会返回已收到的帧,并通过 MissingSerials 标记缺失设备。
|
/// 部分设备超时会返回已收到的帧,并通过 MissingSerials 标记缺失设备。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<SynchronizedSpectrumResult> AcquireSynchronizedAsync(
|
Task<SynchronizedSpectrumResult> AcquireSynchronizedAsync(
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
using HardwareControl.Core.AxisPlatform;
|
||||||
|
|
||||||
|
namespace HardwareControl.Core.HardwareServiceImpl.HardwareService
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 位移台(三轴运动平台)服务,封装 AxisPlatform2.dll。
|
||||||
|
///
|
||||||
|
/// 串口在连接时从系统参数 translation_com 读取,读取不到时回退到
|
||||||
|
/// appsettings.json 的 "AxisStage:ComPort"。所有原生调用串行执行,
|
||||||
|
/// 运动接口只负责下发命令,到位与否需通过 <see cref="ReadStatusAsync"/> 轮询。
|
||||||
|
/// </summary>
|
||||||
|
public interface IAxisStageService : IAsyncDisposable
|
||||||
|
{
|
||||||
|
/// <summary>串口是否已打开。</summary>
|
||||||
|
bool IsConnected { get; }
|
||||||
|
|
||||||
|
/// <summary>当前使用的串口名(已规范化为 "\\.\COMx");未连接时为 null。</summary>
|
||||||
|
string? PortName { get; }
|
||||||
|
|
||||||
|
Task ConnectAsync(CancellationToken ct = default);
|
||||||
|
|
||||||
|
Task DisconnectAsync(CancellationToken ct = default);
|
||||||
|
|
||||||
|
/// <summary>X 轴相对运动,正值为正向。</summary>
|
||||||
|
Task MoveXAsync(
|
||||||
|
int distanceMm,
|
||||||
|
int? speed = null,
|
||||||
|
int? accel = null,
|
||||||
|
CancellationToken ct = default);
|
||||||
|
|
||||||
|
/// <summary>Y 轴相对运动,正值为正向。</summary>
|
||||||
|
Task MoveYAsync(
|
||||||
|
int distanceMm,
|
||||||
|
int? speed = null,
|
||||||
|
int? accel = null,
|
||||||
|
CancellationToken ct = default);
|
||||||
|
|
||||||
|
/// <summary>Z 轴相对运动,正值为正向。</summary>
|
||||||
|
Task MoveZAsync(
|
||||||
|
int distanceMm,
|
||||||
|
int? speed = null,
|
||||||
|
int? accel = null,
|
||||||
|
CancellationToken ct = default);
|
||||||
|
|
||||||
|
/// <summary>三轴相对运动,三轴共用同一速度与加速度。</summary>
|
||||||
|
Task MoveRelativeAsync(
|
||||||
|
AxisStagePoint delta,
|
||||||
|
int? speed = null,
|
||||||
|
int? accel = null,
|
||||||
|
CancellationToken ct = default);
|
||||||
|
|
||||||
|
/// <summary>三轴绝对运动,<paramref name="target"/> 为目标位置坐标。</summary>
|
||||||
|
Task MoveAbsoluteAsync(
|
||||||
|
AxisStagePoint target,
|
||||||
|
int? speed = null,
|
||||||
|
int? accel = null,
|
||||||
|
CancellationToken ct = default);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读取设备最新上传帧(当前位置、运动状态、版本等)。
|
||||||
|
/// 内部会先清空串口缓冲,在 <paramref name="timeoutMs"/> 内重试直到收到有效帧。
|
||||||
|
/// </summary>
|
||||||
|
Task<AxisStageStatus> ReadStatusAsync(
|
||||||
|
int? timeoutMs = null,
|
||||||
|
CancellationToken ct = default);
|
||||||
|
|
||||||
|
event EventHandler<AxisStageStatusChangedEventArgs>? StatusChanged;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
using HardwareControl.Core.FocusSystem;
|
||||||
|
|
||||||
|
namespace HardwareControl.Core.HardwareServiceImpl.HardwareService
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 定焦系统服务,封装 FocusSystem2.dll。
|
||||||
|
///
|
||||||
|
/// 串口在连接时从系统参数 focus_com 读取,读取不到时回退到
|
||||||
|
/// appsettings.json 的 "FocusSystem:ComPort"。除
|
||||||
|
/// <see cref="FocusSingleAndWaitAsync"/> 外,命令函数内部只完成
|
||||||
|
/// "组包→发送",返回表示命令已写入串口,并不代表设备已执行完毕;
|
||||||
|
/// 设备应答、运行结果与系统信息需通过
|
||||||
|
/// <see cref="ReadSystemInfoAsync"/> / <see cref="ReadResultAsync"/> 查询。
|
||||||
|
/// 所有原生调用串行执行。
|
||||||
|
/// </summary>
|
||||||
|
public interface IFocusSystemService : IAsyncDisposable
|
||||||
|
{
|
||||||
|
/// <summary>串口是否已打开。</summary>
|
||||||
|
bool IsConnected { get; }
|
||||||
|
|
||||||
|
/// <summary>当前使用的串口名(已规范化为 "\\.\COMx");未连接时为 null。</summary>
|
||||||
|
string? PortName { get; }
|
||||||
|
|
||||||
|
Task ConnectAsync(CancellationToken ct = default);
|
||||||
|
|
||||||
|
Task DisconnectAsync(CancellationToken ct = default);
|
||||||
|
|
||||||
|
// ---------- 对焦 ----------
|
||||||
|
|
||||||
|
/// <summary>单次对焦(仅下发命令,不等待运行结果)。</summary>
|
||||||
|
Task StartSingleFocusAsync(CancellationToken ct = default);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行一次单次对焦并等待设备返回结果。动态库内部已完成测距光源的
|
||||||
|
/// 开启与关闭,无需再调用测距相关接口。
|
||||||
|
/// 超过 <paramref name="timeout"/> 仍未返回时结果为
|
||||||
|
/// <see cref="FocusSingleOutcome.WaitTimeout"/>。原生调用不可取消,
|
||||||
|
/// 超时后仍会在后台执行直到动态库自行返回。
|
||||||
|
/// </summary>
|
||||||
|
Task<FocusSingleResult> FocusSingleAndWaitAsync(
|
||||||
|
TimeSpan timeout,
|
||||||
|
CancellationToken ct = default);
|
||||||
|
|
||||||
|
/// <summary>连续对焦。</summary>
|
||||||
|
Task StartContinuousFocusAsync(CancellationToken ct = default);
|
||||||
|
|
||||||
|
// ---------- 校准 ----------
|
||||||
|
|
||||||
|
/// <summary>进入校准模式。</summary>
|
||||||
|
Task EnterCalibrationModeAsync(CancellationToken ct = default);
|
||||||
|
|
||||||
|
/// <summary>校准滑台移动指定距离,正值为正向;速度为空时使用配置默认值。</summary>
|
||||||
|
Task MoveCalibrationAsync(
|
||||||
|
int distanceMm,
|
||||||
|
int? speed = null,
|
||||||
|
CancellationToken ct = default);
|
||||||
|
|
||||||
|
/// <summary>保存当前校准参数到设备存储器。</summary>
|
||||||
|
Task SaveCalibrationAsync(CancellationToken ct = default);
|
||||||
|
|
||||||
|
// ---------- 激光器 ----------
|
||||||
|
|
||||||
|
/// <summary>激光器按指定频率出光。</summary>
|
||||||
|
Task TurnLaserOnAsync(byte frequency, CancellationToken ct = default);
|
||||||
|
|
||||||
|
/// <summary>立即关闭激光器。</summary>
|
||||||
|
Task TurnLaserOffAsync(CancellationToken ct = default);
|
||||||
|
|
||||||
|
/// <summary>设置激光能量值(0~255)。</summary>
|
||||||
|
Task SetLaserPowerAsync(byte power, CancellationToken ct = default);
|
||||||
|
|
||||||
|
// ---------- 测距 ----------
|
||||||
|
|
||||||
|
/// <summary>触发激光传感器执行一次测距。</summary>
|
||||||
|
Task StartSingleRangeAsync(CancellationToken ct = default);
|
||||||
|
|
||||||
|
/// <summary>激光传感器进入连续测距模式。</summary>
|
||||||
|
Task StartContinuousRangeAsync(CancellationToken ct = default);
|
||||||
|
|
||||||
|
// ---------- 升降机构 ----------
|
||||||
|
|
||||||
|
/// <summary>升降机构到达指定位置,正值为上升。</summary>
|
||||||
|
Task ControlLiftAsync(int position, CancellationToken ct = default);
|
||||||
|
|
||||||
|
// ---------- 外部触发 ----------
|
||||||
|
|
||||||
|
/// <summary>配置外部触发参数。</summary>
|
||||||
|
Task SetExternalTriggerAsync(CancellationToken ct = default);
|
||||||
|
|
||||||
|
/// <summary>响应外部触发信号控制激光器出光。</summary>
|
||||||
|
Task FireExternalTriggerAsync(CancellationToken ct = default);
|
||||||
|
|
||||||
|
// ---------- 自动检测 ----------
|
||||||
|
|
||||||
|
/// <summary>启动自动下降检测流程。</summary>
|
||||||
|
Task StartAutoDescendAsync(CancellationToken ct = default);
|
||||||
|
|
||||||
|
/// <summary>按指定周期和次数循环出光。</summary>
|
||||||
|
Task StartFixedCycleAsync(
|
||||||
|
ushort intervalMs,
|
||||||
|
ushort count,
|
||||||
|
CancellationToken ct = default);
|
||||||
|
|
||||||
|
// ---------- 光谱仪同步 ----------
|
||||||
|
|
||||||
|
/// <summary>设置光谱仪同步延时参数。</summary>
|
||||||
|
Task SetSyncTimeAsync(
|
||||||
|
FocusSyncTime parameters,
|
||||||
|
CancellationToken ct = default);
|
||||||
|
|
||||||
|
/// <summary>请求设备返回当前同步延时,结果通过 <see cref="ReadResultAsync"/> 读取。</summary>
|
||||||
|
Task RequestSyncTimeAsync(CancellationToken ct = default);
|
||||||
|
|
||||||
|
// ---------- 电源 ----------
|
||||||
|
|
||||||
|
/// <summary>控制设备总电源关机。</summary>
|
||||||
|
Task PowerOffAsync(CancellationToken ct = default);
|
||||||
|
|
||||||
|
// ---------- 查询 ----------
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读取系统信息(对焦位置、错误码、电压、版本等)。
|
||||||
|
/// 在 <paramref name="timeoutMs"/> 内重试直到收到有效帧。
|
||||||
|
/// </summary>
|
||||||
|
Task<FocusSystemStatus> ReadSystemInfoAsync(
|
||||||
|
int? timeoutMs = null,
|
||||||
|
CancellationToken ct = default);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读取设备缓存的运行结果/查询结果(type=0x02/0x03)。
|
||||||
|
/// 在 <paramref name="timeoutMs"/> 内轮询直到收到结果帧。
|
||||||
|
/// </summary>
|
||||||
|
Task<FocusRealTimeResult> ReadResultAsync(
|
||||||
|
int? timeoutMs = null,
|
||||||
|
CancellationToken ct = default);
|
||||||
|
|
||||||
|
event EventHandler<FocusSystemStatusChangedEventArgs>? StatusChanged;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using HardwareControl.Core.SampleAnalysis;
|
||||||
|
|
||||||
|
namespace HardwareControl.Core.HardwareServiceImpl.HardwareService
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 靶样轮廓与采样点分析服务:抓取相机当前画面并分析。
|
||||||
|
/// </summary>
|
||||||
|
public interface ISampleAnalysisService
|
||||||
|
{
|
||||||
|
/// <summary>抓取相机当前画面,提取轮廓并生成采样点。</summary>
|
||||||
|
SampleAnalysisResult Analyze();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取最近一次轮廓分析结果供扫描流程复用;
|
||||||
|
/// 尚未分析过时立即执行一次分析。
|
||||||
|
/// </summary>
|
||||||
|
SampleAnalysisResult GetLatestAnalysis();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 前端等待轮廓识别结果的超时时间(秒),
|
||||||
|
/// 取自系统参数 camera_Identification_outtime。
|
||||||
|
/// </summary>
|
||||||
|
int GetIdentificationTimeoutSeconds();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,6 +21,9 @@ namespace HardwareControl.Core.HardwareServiceImpl.HardwareService
|
|||||||
Task ConnectAsync(CancellationToken ct = default);
|
Task ConnectAsync(CancellationToken ct = default);
|
||||||
Task DisconnectAsync(CancellationToken ct = default);
|
Task DisconnectAsync(CancellationToken ct = default);
|
||||||
|
|
||||||
|
/// <summary>获取最近一帧图像快照;尚未收到帧或已断开时返回 null。</summary>
|
||||||
|
CameraFrameSnapshot? GetLatestFrame();
|
||||||
|
|
||||||
event EventHandler<UsbCameraStatusChangedEventArgs>? StatusChanged;
|
event EventHandler<UsbCameraStatusChangedEventArgs>? StatusChanged;
|
||||||
event EventHandler<FrameArrivedEventArgs>? FrameArrived;
|
event EventHandler<FrameArrivedEventArgs>? FrameArrived;
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,654 @@
|
|||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using HardwareControl.Core.AxisPlatform;
|
||||||
|
using HardwareControl.Core.HardwareServiceImpl.HardwareService;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
|
||||||
|
namespace HardwareControl.Core.HardwareServiceImpl
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 位移台服务实现:AxisPlatform2.dll 负责串口与协议,
|
||||||
|
/// 本类负责串口参数解析、调用串行化、错误映射与日志。
|
||||||
|
/// </summary>
|
||||||
|
public sealed class AxisStageService : IAxisStageService
|
||||||
|
{
|
||||||
|
// 系统参数中保存位移台串口的配置名称
|
||||||
|
private const string ComPortConfigName = "translation_com";
|
||||||
|
|
||||||
|
private readonly AxisStageOptions _options;
|
||||||
|
private readonly ILogger<AxisStageService> _logger;
|
||||||
|
private readonly ISystemConfigService? _systemConfig;
|
||||||
|
|
||||||
|
// 串行化所有原生调用,DLL 句柄不支持并发访问
|
||||||
|
private readonly SemaphoreSlim _gate = new(1, 1);
|
||||||
|
|
||||||
|
private IntPtr _handle = IntPtr.Zero;
|
||||||
|
private volatile bool _connected;
|
||||||
|
private volatile string? _portName;
|
||||||
|
private bool _disposed;
|
||||||
|
|
||||||
|
public AxisStageService(
|
||||||
|
IOptions<AxisStageOptions> options,
|
||||||
|
ILogger<AxisStageService> logger,
|
||||||
|
ISystemConfigService? systemConfig = null)
|
||||||
|
{
|
||||||
|
_options = options.Value;
|
||||||
|
_logger = logger;
|
||||||
|
_systemConfig = systemConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsConnected => _connected;
|
||||||
|
|
||||||
|
public string? PortName => _portName;
|
||||||
|
|
||||||
|
public event EventHandler<AxisStageStatusChangedEventArgs>? StatusChanged;
|
||||||
|
|
||||||
|
// ---------- 连接 ----------
|
||||||
|
|
||||||
|
public async Task ConnectAsync(CancellationToken ct = default)
|
||||||
|
{
|
||||||
|
await _gate.WaitAsync(ct).ConfigureAwait(false);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ThrowIfDisposed();
|
||||||
|
if (_connected)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await Task.Run(ConnectCore, CancellationToken.None).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_gate.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConnectCore()
|
||||||
|
{
|
||||||
|
var port = ResolvePort();
|
||||||
|
var limitsPointer = IntPtr.Zero;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_options.Limits is { } limits)
|
||||||
|
{
|
||||||
|
var native = limits.ToNative();
|
||||||
|
limitsPointer = Marshal.AllocHGlobal(Marshal.SizeOf<Axis2Limits>());
|
||||||
|
Marshal.StructureToPtr(native, limitsPointer, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation(
|
||||||
|
"正在打开位移台串口 {Port}(帧头 {FrameHead})",
|
||||||
|
port,
|
||||||
|
_options.FrameHead);
|
||||||
|
|
||||||
|
var handle = AxisPlatformNative.axis_init(
|
||||||
|
port,
|
||||||
|
(byte)_options.FrameHead,
|
||||||
|
limitsPointer);
|
||||||
|
|
||||||
|
if (handle == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.ConnectFailed,
|
||||||
|
$"打开位移台串口 {port} 失败:串口不存在或被占用");
|
||||||
|
}
|
||||||
|
|
||||||
|
_handle = handle;
|
||||||
|
_connected = true;
|
||||||
|
_portName = port;
|
||||||
|
|
||||||
|
_logger.LogInformation("位移台串口已打开:{Port}", port);
|
||||||
|
StatusChanged?.Invoke(
|
||||||
|
this,
|
||||||
|
new AxisStageStatusChangedEventArgs(true, $"位移台已连接:{port}"));
|
||||||
|
}
|
||||||
|
catch (HardwareException)
|
||||||
|
{
|
||||||
|
ResetConnectionState();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex) when (ex is DllNotFoundException
|
||||||
|
or BadImageFormatException
|
||||||
|
or EntryPointNotFoundException)
|
||||||
|
{
|
||||||
|
ResetConnectionState();
|
||||||
|
_logger.LogError(ex, "加载 AxisPlatform2.dll 失败");
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.ConnectFailed,
|
||||||
|
BuildNativeLoadFailureMessage(ex),
|
||||||
|
ex);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ResetConnectionState();
|
||||||
|
_logger.LogError(ex, "打开位移台串口时发生未预期异常");
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.ConnectFailed,
|
||||||
|
"连接位移台失败",
|
||||||
|
ex);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (limitsPointer != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
Marshal.FreeHGlobal(limitsPointer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 串口优先取系统参数 translation_com;为空时回退到 appsettings 的 AxisStage:ComPort。
|
||||||
|
/// </summary>
|
||||||
|
private string ResolvePort()
|
||||||
|
{
|
||||||
|
string? configured = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
configured = _systemConfig?
|
||||||
|
.GetAll()
|
||||||
|
.FirstOrDefault(config => string.Equals(
|
||||||
|
config.ConfigName,
|
||||||
|
ComPortConfigName,
|
||||||
|
StringComparison.OrdinalIgnoreCase))?
|
||||||
|
.ConfigValue?
|
||||||
|
.Trim();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(ex, "读取系统参数 {ConfigName} 失败", ComPortConfigName);
|
||||||
|
}
|
||||||
|
|
||||||
|
var port = !string.IsNullOrWhiteSpace(configured)
|
||||||
|
? configured
|
||||||
|
: _options.ComPort?.Trim();
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(port))
|
||||||
|
{
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.InvalidArgument,
|
||||||
|
$"未配置位移台串口:请先在系统参数中添加 {ComPortConfigName}(例如 COM5)");
|
||||||
|
}
|
||||||
|
|
||||||
|
return SerialPortNames.Normalize(port);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- 断开 ----------
|
||||||
|
|
||||||
|
public async Task DisconnectAsync(CancellationToken ct = default)
|
||||||
|
{
|
||||||
|
await _gate.WaitAsync(ct).ConfigureAwait(false);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_disposed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var wasConnected = _connected;
|
||||||
|
CloseHandle();
|
||||||
|
|
||||||
|
if (wasConnected)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("位移台串口已关闭");
|
||||||
|
StatusChanged?.Invoke(
|
||||||
|
this,
|
||||||
|
new AxisStageStatusChangedEventArgs(false, "位移台已断开"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_gate.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CloseHandle()
|
||||||
|
{
|
||||||
|
var handle = _handle;
|
||||||
|
ResetConnectionState();
|
||||||
|
|
||||||
|
if (handle == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
AxisPlatformNative.axis_close(handle);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(ex, "关闭位移台串口时发生异常");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ResetConnectionState()
|
||||||
|
{
|
||||||
|
_handle = IntPtr.Zero;
|
||||||
|
_connected = false;
|
||||||
|
_portName = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- 运动 ----------
|
||||||
|
|
||||||
|
public async Task MoveXAsync(
|
||||||
|
int distanceMm,
|
||||||
|
int? speed = null,
|
||||||
|
int? accel = null,
|
||||||
|
CancellationToken ct = default)
|
||||||
|
{
|
||||||
|
await _gate.WaitAsync(ct).ConfigureAwait(false);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ThrowIfDisposed();
|
||||||
|
var handle = RequireHandle();
|
||||||
|
|
||||||
|
var distance = ToDistance(distanceMm, "X");
|
||||||
|
var (speedValue, accelValue) = ResolveMotion(speed, accel);
|
||||||
|
ct.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
var result = AxisPlatformNative.axis_x_move(
|
||||||
|
handle, distance, speedValue, accelValue);
|
||||||
|
EnsureSuccess(handle, result, $"X 轴移动 {distance}mm");
|
||||||
|
|
||||||
|
_logger.LogInformation(
|
||||||
|
"位移台 X 轴移动:{Distance}mm,速度 {Speed},加速度 {Accel}",
|
||||||
|
distance,
|
||||||
|
speedValue,
|
||||||
|
accelValue);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_gate.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task MoveYAsync(
|
||||||
|
int distanceMm,
|
||||||
|
int? speed = null,
|
||||||
|
int? accel = null,
|
||||||
|
CancellationToken ct = default)
|
||||||
|
{
|
||||||
|
await _gate.WaitAsync(ct).ConfigureAwait(false);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ThrowIfDisposed();
|
||||||
|
var handle = RequireHandle();
|
||||||
|
|
||||||
|
var distance = ToDistance(distanceMm, "Y");
|
||||||
|
var (speedValue, accelValue) = ResolveMotion(speed, accel);
|
||||||
|
ct.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
var result = AxisPlatformNative.axis_y_move(
|
||||||
|
handle, distance, speedValue, accelValue);
|
||||||
|
EnsureSuccess(handle, result, $"Y 轴移动 {distance}mm");
|
||||||
|
|
||||||
|
_logger.LogInformation(
|
||||||
|
"位移台 Y 轴移动:{Distance}mm,速度 {Speed},加速度 {Accel}",
|
||||||
|
distance,
|
||||||
|
speedValue,
|
||||||
|
accelValue);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_gate.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task MoveZAsync(
|
||||||
|
int distanceMm,
|
||||||
|
int? speed = null,
|
||||||
|
int? accel = null,
|
||||||
|
CancellationToken ct = default)
|
||||||
|
{
|
||||||
|
await _gate.WaitAsync(ct).ConfigureAwait(false);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ThrowIfDisposed();
|
||||||
|
var handle = RequireHandle();
|
||||||
|
|
||||||
|
var distance = ToDistance(distanceMm, "Z");
|
||||||
|
var (speedValue, accelValue) = ResolveMotion(speed, accel);
|
||||||
|
ct.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
var result = AxisPlatformNative.axis_z_move(
|
||||||
|
handle, distance, speedValue, accelValue);
|
||||||
|
EnsureSuccess(handle, result, $"Z 轴移动 {distance}mm");
|
||||||
|
|
||||||
|
_logger.LogInformation(
|
||||||
|
"位移台 Z 轴移动:{Distance}mm,速度 {Speed},加速度 {Accel}",
|
||||||
|
distance,
|
||||||
|
speedValue,
|
||||||
|
accelValue);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_gate.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task MoveRelativeAsync(
|
||||||
|
AxisStagePoint delta,
|
||||||
|
int? speed = null,
|
||||||
|
int? accel = null,
|
||||||
|
CancellationToken ct = default)
|
||||||
|
{
|
||||||
|
await _gate.WaitAsync(ct).ConfigureAwait(false);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ThrowIfDisposed();
|
||||||
|
var handle = RequireHandle();
|
||||||
|
|
||||||
|
var (speedValue, accelValue) = ResolveMotion(speed, accel);
|
||||||
|
var x = ToParams(delta.X, speedValue, accelValue, "X");
|
||||||
|
var y = ToParams(delta.Y, speedValue, accelValue, "Y");
|
||||||
|
var z = ToParams(delta.Z, speedValue, accelValue, "Z");
|
||||||
|
ct.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
var result = AxisPlatformNative.axis_xyz_rel_move(
|
||||||
|
handle, ref x, ref y, ref z);
|
||||||
|
EnsureSuccess(
|
||||||
|
handle,
|
||||||
|
result,
|
||||||
|
$"三轴相对运动(X={delta.X},Y={delta.Y},Z={delta.Z})");
|
||||||
|
|
||||||
|
_logger.LogInformation(
|
||||||
|
"位移台三轴相对运动:X={X},Y={Y},Z={Z},速度 {Speed},加速度 {Accel}",
|
||||||
|
delta.X,
|
||||||
|
delta.Y,
|
||||||
|
delta.Z,
|
||||||
|
speedValue,
|
||||||
|
accelValue);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_gate.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task MoveAbsoluteAsync(
|
||||||
|
AxisStagePoint target,
|
||||||
|
int? speed = null,
|
||||||
|
int? accel = null,
|
||||||
|
CancellationToken ct = default)
|
||||||
|
{
|
||||||
|
await _gate.WaitAsync(ct).ConfigureAwait(false);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ThrowIfDisposed();
|
||||||
|
var handle = RequireHandle();
|
||||||
|
|
||||||
|
var (speedValue, accelValue) = ResolveMotion(speed, accel);
|
||||||
|
var x = ToParams(target.X, speedValue, accelValue, "X");
|
||||||
|
var y = ToParams(target.Y, speedValue, accelValue, "Y");
|
||||||
|
var z = ToParams(target.Z, speedValue, accelValue, "Z");
|
||||||
|
ct.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
var result = AxisPlatformNative.axis_xyz_abs_move(
|
||||||
|
handle, ref x, ref y, ref z);
|
||||||
|
EnsureSuccess(
|
||||||
|
handle,
|
||||||
|
result,
|
||||||
|
$"三轴绝对运动(X={target.X},Y={target.Y},Z={target.Z})");
|
||||||
|
|
||||||
|
_logger.LogInformation(
|
||||||
|
"位移台三轴绝对运动:X={X},Y={Y},Z={Z},速度 {Speed},加速度 {Accel}",
|
||||||
|
target.X,
|
||||||
|
target.Y,
|
||||||
|
target.Z,
|
||||||
|
speedValue,
|
||||||
|
accelValue);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_gate.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- 状态 ----------
|
||||||
|
|
||||||
|
public async Task<AxisStageStatus> ReadStatusAsync(
|
||||||
|
int? timeoutMs = null,
|
||||||
|
CancellationToken ct = default)
|
||||||
|
{
|
||||||
|
await _gate.WaitAsync(ct).ConfigureAwait(false);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ThrowIfDisposed();
|
||||||
|
var handle = RequireHandle();
|
||||||
|
|
||||||
|
var timeout = timeoutMs ?? _options.ReadTimeoutMs;
|
||||||
|
if (timeout <= 0)
|
||||||
|
{
|
||||||
|
timeout = 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
return await Task.Run(
|
||||||
|
() => ReadStatusCore(handle, timeout, ct),
|
||||||
|
CancellationToken.None)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_gate.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private AxisStageStatus ReadStatusCore(
|
||||||
|
IntPtr handle,
|
||||||
|
int timeoutMs,
|
||||||
|
CancellationToken ct)
|
||||||
|
{
|
||||||
|
// 丢弃旧缓存,确保读到的是设备新上传的帧
|
||||||
|
AxisPlatformNative.axis_flush(handle);
|
||||||
|
|
||||||
|
var deadline = Environment.TickCount64 + timeoutMs;
|
||||||
|
var retryInterval = Math.Clamp(_options.ReadRetryIntervalMs, 10, 1000);
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
ct.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
var result = AxisPlatformNative.axis_read_upload(handle, out var data);
|
||||||
|
if (result == AxisPlatformNative.Ok)
|
||||||
|
{
|
||||||
|
var status = MapStatus(data);
|
||||||
|
|
||||||
|
_logger.LogDebug(
|
||||||
|
"位移台状态:X={X},Y={Y},Z={Z},运动中={Moving},设备错误={Error}",
|
||||||
|
status.XPosition,
|
||||||
|
status.YPosition,
|
||||||
|
status.ZPosition,
|
||||||
|
status.AnyMoving,
|
||||||
|
status.DeviceError);
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 未收到数据/未找到上传帧时在超时时间内重试,其余错误立即抛出
|
||||||
|
if (result is not (AxisPlatformNative.ErrTimeout
|
||||||
|
or AxisPlatformNative.ErrParseFailed))
|
||||||
|
{
|
||||||
|
throw MapNativeError(handle, result, "读取位移台状态");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Environment.TickCount64 >= deadline)
|
||||||
|
{
|
||||||
|
var detail = result == AxisPlatformNative.ErrTimeout
|
||||||
|
? "未收到任何数据"
|
||||||
|
: "未找到有效的上传帧";
|
||||||
|
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.Timeout,
|
||||||
|
$"读取位移台状态超时({timeoutMs}ms):{detail}");
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(retryInterval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static AxisStageStatus MapStatus(Axis2UploadData data) =>
|
||||||
|
new(
|
||||||
|
data.XPos,
|
||||||
|
data.YPos,
|
||||||
|
data.ZPos,
|
||||||
|
data.XSta != 0,
|
||||||
|
data.YSta != 0,
|
||||||
|
data.ZSta != 0,
|
||||||
|
data.SysSta != 0,
|
||||||
|
data.Error,
|
||||||
|
data.HwVersion,
|
||||||
|
data.SwVersion,
|
||||||
|
DateTimeOffset.Now);
|
||||||
|
|
||||||
|
// ---------- 参数校验与错误映射 ----------
|
||||||
|
|
||||||
|
private (ushort Speed, ushort Accel) ResolveMotion(int? speed, int? accel)
|
||||||
|
{
|
||||||
|
var speedValue = speed ?? _options.DefaultSpeed;
|
||||||
|
var accelValue = accel ?? _options.DefaultAccel;
|
||||||
|
|
||||||
|
if (speedValue is <= 0 or > ushort.MaxValue)
|
||||||
|
{
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.InvalidArgument,
|
||||||
|
$"运行速度 {speedValue} 超出范围(1~{ushort.MaxValue})");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (accelValue is <= 0 or > ushort.MaxValue)
|
||||||
|
{
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.InvalidArgument,
|
||||||
|
$"加速度 {accelValue} 超出范围(1~{ushort.MaxValue})");
|
||||||
|
}
|
||||||
|
|
||||||
|
return ((ushort)speedValue, (ushort)accelValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static short ToDistance(int value, string axis)
|
||||||
|
{
|
||||||
|
if (value is < short.MinValue or > short.MaxValue)
|
||||||
|
{
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.InvalidArgument,
|
||||||
|
$"{axis} 轴位移 {value}mm 超出范围({short.MinValue}~{short.MaxValue})");
|
||||||
|
}
|
||||||
|
|
||||||
|
return (short)value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Axis2MoveParams ToParams(
|
||||||
|
int value,
|
||||||
|
ushort speed,
|
||||||
|
ushort accel,
|
||||||
|
string axis) => new()
|
||||||
|
{
|
||||||
|
Distance = ToDistance(value, axis),
|
||||||
|
Speed = speed,
|
||||||
|
Accel = accel,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>文档中运动函数的返回值可能为发送字节数,非负均视为成功。</summary>
|
||||||
|
private static void EnsureSuccess(IntPtr handle, int result, string operation)
|
||||||
|
{
|
||||||
|
if (result >= 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw MapNativeError(handle, result, operation);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static HardwareException MapNativeError(
|
||||||
|
IntPtr handle,
|
||||||
|
int code,
|
||||||
|
string operation)
|
||||||
|
{
|
||||||
|
var kind = code switch
|
||||||
|
{
|
||||||
|
AxisPlatformNative.ErrNullPtr => HardwareErrorKind.InvalidArgument,
|
||||||
|
AxisPlatformNative.ErrBufTooSmall => HardwareErrorKind.InvalidArgument,
|
||||||
|
AxisPlatformNative.ErrFrameTooShort => HardwareErrorKind.CommunicationFailed,
|
||||||
|
AxisPlatformNative.ErrComOpenFailed => HardwareErrorKind.ConnectFailed,
|
||||||
|
AxisPlatformNative.ErrComNotOpen => HardwareErrorKind.NotConnected,
|
||||||
|
AxisPlatformNative.ErrComSendFailed => HardwareErrorKind.CommunicationFailed,
|
||||||
|
AxisPlatformNative.ErrParseFailed => HardwareErrorKind.CommunicationFailed,
|
||||||
|
AxisPlatformNative.ErrTimeout => HardwareErrorKind.Timeout,
|
||||||
|
_ => HardwareErrorKind.Unknown,
|
||||||
|
};
|
||||||
|
|
||||||
|
var hint = code switch
|
||||||
|
{
|
||||||
|
AxisPlatformNative.ErrComOpenFailed => "(串口不存在或被占用)",
|
||||||
|
AxisPlatformNative.ErrComNotOpen => "(串口尚未打开)",
|
||||||
|
AxisPlatformNative.ErrComSendFailed => "(可能是超出限位或串口发送失败)",
|
||||||
|
AxisPlatformNative.ErrParseFailed => "(CRC 校验失败或帧格式错误)",
|
||||||
|
AxisPlatformNative.ErrTimeout => "(未在指定时间内收到数据)",
|
||||||
|
_ => string.Empty,
|
||||||
|
};
|
||||||
|
|
||||||
|
var detail = AxisPlatformNative.GetError(handle);
|
||||||
|
var message = string.IsNullOrWhiteSpace(detail)
|
||||||
|
? $"{operation}失败{hint}(错误码 {code})"
|
||||||
|
: $"{operation}失败{hint}(错误码 {code}):{detail}";
|
||||||
|
|
||||||
|
return new HardwareException(kind, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string BuildNativeLoadFailureMessage(Exception ex) => ex switch
|
||||||
|
{
|
||||||
|
DllNotFoundException =>
|
||||||
|
"加载 AxisPlatform2.dll 失败:请确认该 DLL 已复制到程序输出目录"
|
||||||
|
+ $"(当前目录:{AppContext.BaseDirectory})",
|
||||||
|
BadImageFormatException =>
|
||||||
|
"加载 AxisPlatform2.dll 失败:DLL 位数与进程不匹配,请使用 x64 进程运行",
|
||||||
|
EntryPointNotFoundException =>
|
||||||
|
"加载 AxisPlatform2.dll 失败:DLL 版本与接口声明不匹配",
|
||||||
|
_ => "加载 AxisPlatform2.dll 失败",
|
||||||
|
};
|
||||||
|
|
||||||
|
// ---------- 释放 ----------
|
||||||
|
|
||||||
|
private IntPtr RequireHandle()
|
||||||
|
{
|
||||||
|
var handle = _handle;
|
||||||
|
if (!_connected || handle == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.NotConnected,
|
||||||
|
"位移台尚未连接,请先调用连接接口");
|
||||||
|
}
|
||||||
|
|
||||||
|
return handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ThrowIfDisposed()
|
||||||
|
{
|
||||||
|
ObjectDisposedException.ThrowIf(_disposed, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async ValueTask DisposeAsync()
|
||||||
|
{
|
||||||
|
await _gate.WaitAsync().ConfigureAwait(false);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_disposed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_disposed = true;
|
||||||
|
CloseHandle();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_gate.Release();
|
||||||
|
_gate.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,732 @@
|
|||||||
|
using HardwareControl.Core.FocusSystem;
|
||||||
|
using HardwareControl.Core.HardwareServiceImpl.HardwareService;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
|
||||||
|
namespace HardwareControl.Core.HardwareServiceImpl
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 定焦系统服务实现:FocusSystem2.dll 负责串口与协议,
|
||||||
|
/// 本类负责串口参数解析、调用串行化、错误映射与日志。
|
||||||
|
/// </summary>
|
||||||
|
public sealed class FocusSystemService : IFocusSystemService
|
||||||
|
{
|
||||||
|
// 系统参数中保存对焦硬件串口的配置名称
|
||||||
|
private const string ComPortConfigName = "focus_com";
|
||||||
|
|
||||||
|
private readonly FocusSystemOptions _options;
|
||||||
|
private readonly ILogger<FocusSystemService> _logger;
|
||||||
|
private readonly ISystemConfigService? _systemConfig;
|
||||||
|
|
||||||
|
// 串行化所有原生调用,DLL 句柄不支持并发访问
|
||||||
|
private readonly SemaphoreSlim _gate = new(1, 1);
|
||||||
|
|
||||||
|
private IntPtr _handle = IntPtr.Zero;
|
||||||
|
private volatile bool _connected;
|
||||||
|
private volatile string? _portName;
|
||||||
|
private bool _disposed;
|
||||||
|
|
||||||
|
public FocusSystemService(
|
||||||
|
IOptions<FocusSystemOptions> options,
|
||||||
|
ILogger<FocusSystemService> logger,
|
||||||
|
ISystemConfigService? systemConfig = null)
|
||||||
|
{
|
||||||
|
_options = options.Value;
|
||||||
|
_logger = logger;
|
||||||
|
_systemConfig = systemConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsConnected => _connected;
|
||||||
|
|
||||||
|
public string? PortName => _portName;
|
||||||
|
|
||||||
|
public event EventHandler<FocusSystemStatusChangedEventArgs>? StatusChanged;
|
||||||
|
|
||||||
|
// ---------- 连接 ----------
|
||||||
|
|
||||||
|
public async Task ConnectAsync(CancellationToken ct = default)
|
||||||
|
{
|
||||||
|
await _gate.WaitAsync(ct).ConfigureAwait(false);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ThrowIfDisposed();
|
||||||
|
if (_connected)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await Task.Run(ConnectCore, CancellationToken.None).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_gate.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConnectCore()
|
||||||
|
{
|
||||||
|
var port = ResolvePort();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_logger.LogInformation("正在打开对焦系统串口 {Port}", port);
|
||||||
|
|
||||||
|
var handle = FocusSystemNative.focus_init(port);
|
||||||
|
if (handle == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.ConnectFailed,
|
||||||
|
$"打开对焦系统串口 {port} 失败:串口不存在或被占用");
|
||||||
|
}
|
||||||
|
|
||||||
|
_handle = handle;
|
||||||
|
_connected = true;
|
||||||
|
_portName = port;
|
||||||
|
|
||||||
|
_logger.LogInformation("对焦系统串口已打开:{Port}", port);
|
||||||
|
StatusChanged?.Invoke(
|
||||||
|
this,
|
||||||
|
new FocusSystemStatusChangedEventArgs(true, $"对焦系统已连接:{port}"));
|
||||||
|
}
|
||||||
|
catch (HardwareException)
|
||||||
|
{
|
||||||
|
ResetConnectionState();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex) when (ex is DllNotFoundException
|
||||||
|
or BadImageFormatException
|
||||||
|
or EntryPointNotFoundException)
|
||||||
|
{
|
||||||
|
ResetConnectionState();
|
||||||
|
_logger.LogError(ex, "加载 FocusSystem2.dll 失败");
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.ConnectFailed,
|
||||||
|
BuildNativeLoadFailureMessage(ex),
|
||||||
|
ex);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ResetConnectionState();
|
||||||
|
_logger.LogError(ex, "打开对焦系统串口时发生未预期异常");
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.ConnectFailed,
|
||||||
|
"连接对焦系统失败",
|
||||||
|
ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 串口优先取系统参数 focus_com;为空时回退到 appsettings 的 FocusSystem:ComPort。
|
||||||
|
/// </summary>
|
||||||
|
private string ResolvePort()
|
||||||
|
{
|
||||||
|
string? configured = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
configured = _systemConfig?
|
||||||
|
.GetAll()
|
||||||
|
.FirstOrDefault(config => string.Equals(
|
||||||
|
config.ConfigName,
|
||||||
|
ComPortConfigName,
|
||||||
|
StringComparison.OrdinalIgnoreCase))?
|
||||||
|
.ConfigValue?
|
||||||
|
.Trim();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(ex, "读取系统参数 {ConfigName} 失败", ComPortConfigName);
|
||||||
|
}
|
||||||
|
|
||||||
|
var port = !string.IsNullOrWhiteSpace(configured)
|
||||||
|
? configured
|
||||||
|
: _options.ComPort?.Trim();
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(port))
|
||||||
|
{
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.InvalidArgument,
|
||||||
|
$"未配置对焦系统串口:请先在系统参数中添加 {ComPortConfigName}(例如 COM6)");
|
||||||
|
}
|
||||||
|
|
||||||
|
return SerialPortNames.Normalize(port);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- 断开 ----------
|
||||||
|
|
||||||
|
public async Task DisconnectAsync(CancellationToken ct = default)
|
||||||
|
{
|
||||||
|
await _gate.WaitAsync(ct).ConfigureAwait(false);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_disposed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var wasConnected = _connected;
|
||||||
|
CloseHandle();
|
||||||
|
|
||||||
|
if (wasConnected)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("对焦系统串口已关闭");
|
||||||
|
StatusChanged?.Invoke(
|
||||||
|
this,
|
||||||
|
new FocusSystemStatusChangedEventArgs(false, "对焦系统已断开"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_gate.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CloseHandle()
|
||||||
|
{
|
||||||
|
var handle = _handle;
|
||||||
|
ResetConnectionState();
|
||||||
|
|
||||||
|
if (handle == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FocusSystemNative.focus_close(handle);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(ex, "关闭对焦系统串口时发生异常");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ResetConnectionState()
|
||||||
|
{
|
||||||
|
_handle = IntPtr.Zero;
|
||||||
|
_connected = false;
|
||||||
|
_portName = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- 命令 ----------
|
||||||
|
|
||||||
|
public Task StartSingleFocusAsync(CancellationToken ct = default) =>
|
||||||
|
ExecuteAsync(FocusSystemNative.focus_single_focus, "单次对焦", ct);
|
||||||
|
|
||||||
|
public async Task<FocusSingleResult> FocusSingleAndWaitAsync(
|
||||||
|
TimeSpan timeout,
|
||||||
|
CancellationToken ct = default)
|
||||||
|
{
|
||||||
|
var limit = timeout > TimeSpan.Zero ? timeout : TimeSpan.FromSeconds(10);
|
||||||
|
var startedAt = DateTimeOffset.UtcNow;
|
||||||
|
|
||||||
|
// 动态库内部完成测距光源开关与对焦动作,并阻塞到运行结果返回;
|
||||||
|
// 这里只在外部加一个等待上限,避免界面长时间无响应。
|
||||||
|
var command = ExecuteRawAsync(
|
||||||
|
FocusSystemNative.focus_single_focus,
|
||||||
|
"单次对焦",
|
||||||
|
ct);
|
||||||
|
|
||||||
|
int code;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
code = await command.WaitAsync(limit, ct).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch (TimeoutException)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(
|
||||||
|
"单次对焦在 {Timeout}s 内未返回结果,判定为失败",
|
||||||
|
limit.TotalSeconds);
|
||||||
|
return new FocusSingleResult(
|
||||||
|
FocusSingleOutcome.WaitTimeout,
|
||||||
|
null,
|
||||||
|
DateTimeOffset.UtcNow - startedAt);
|
||||||
|
}
|
||||||
|
|
||||||
|
var outcome = code switch
|
||||||
|
{
|
||||||
|
FocusSystemNative.Ok => FocusSingleOutcome.Completed,
|
||||||
|
FocusSystemNative.ErrNullPtr => FocusSingleOutcome.NullHandle,
|
||||||
|
FocusSystemNative.ErrComNotOpen => FocusSingleOutcome.ComNotOpen,
|
||||||
|
FocusSystemNative.ErrComSendFailed => FocusSingleOutcome.DeviceFailed,
|
||||||
|
FocusSystemNative.ErrTimeout => FocusSingleOutcome.DeviceTimeout,
|
||||||
|
_ => FocusSingleOutcome.Unknown,
|
||||||
|
};
|
||||||
|
|
||||||
|
return new FocusSingleResult(
|
||||||
|
outcome,
|
||||||
|
code,
|
||||||
|
DateTimeOffset.UtcNow - startedAt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task StartContinuousFocusAsync(CancellationToken ct = default) =>
|
||||||
|
ExecuteAsync(FocusSystemNative.focus_continuous_focus, "连续对焦", ct);
|
||||||
|
|
||||||
|
public Task EnterCalibrationModeAsync(CancellationToken ct = default) =>
|
||||||
|
ExecuteAsync(FocusSystemNative.focus_calib_mode, "进入校准模式", ct);
|
||||||
|
|
||||||
|
public Task MoveCalibrationAsync(
|
||||||
|
int distanceMm,
|
||||||
|
int? speed = null,
|
||||||
|
CancellationToken ct = default)
|
||||||
|
{
|
||||||
|
var distance = ToInt8(distanceMm, "校准位移");
|
||||||
|
var speedValue = speed ?? _options.DefaultCalibrationSpeed;
|
||||||
|
if (speedValue is <= 0 or > ushort.MaxValue)
|
||||||
|
{
|
||||||
|
return Task.FromException(new HardwareException(
|
||||||
|
HardwareErrorKind.InvalidArgument,
|
||||||
|
$"校准速度 {speedValue} 超出范围(1~{ushort.MaxValue})"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ExecuteAsync(
|
||||||
|
handle => FocusSystemNative.focus_calib_move(
|
||||||
|
handle,
|
||||||
|
distance,
|
||||||
|
(ushort)speedValue),
|
||||||
|
$"校准位移 {distance}mm",
|
||||||
|
ct);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task SaveCalibrationAsync(CancellationToken ct = default) =>
|
||||||
|
ExecuteAsync(FocusSystemNative.focus_calib_save, "保存校准参数", ct);
|
||||||
|
|
||||||
|
public Task TurnLaserOnAsync(byte frequency, CancellationToken ct = default) =>
|
||||||
|
ExecuteAsync(
|
||||||
|
handle => FocusSystemNative.focus_laser_on(handle, frequency),
|
||||||
|
$"激光器出光(频率 {frequency}Hz)",
|
||||||
|
ct);
|
||||||
|
|
||||||
|
public Task TurnLaserOffAsync(CancellationToken ct = default) =>
|
||||||
|
ExecuteAsync(FocusSystemNative.focus_laser_off, "激光器关光", ct);
|
||||||
|
|
||||||
|
public Task SetLaserPowerAsync(byte power, CancellationToken ct = default) =>
|
||||||
|
ExecuteAsync(
|
||||||
|
handle => FocusSystemNative.focus_laser_power(handle, power),
|
||||||
|
$"设置激光能量 {power}",
|
||||||
|
ct);
|
||||||
|
|
||||||
|
public Task StartSingleRangeAsync(CancellationToken ct = default) =>
|
||||||
|
ExecuteAsync(FocusSystemNative.focus_single_range, "单次测距", ct);
|
||||||
|
|
||||||
|
public Task StartContinuousRangeAsync(CancellationToken ct = default) =>
|
||||||
|
ExecuteAsync(FocusSystemNative.focus_continuous_range, "连续测距", ct);
|
||||||
|
|
||||||
|
public Task ControlLiftAsync(int position, CancellationToken ct = default)
|
||||||
|
{
|
||||||
|
var target = ToInt8(position, "升降位置");
|
||||||
|
return ExecuteAsync(
|
||||||
|
handle => FocusSystemNative.focus_lift_control(handle, target),
|
||||||
|
$"升降机构移动到 {target}",
|
||||||
|
ct);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task SetExternalTriggerAsync(CancellationToken ct = default) =>
|
||||||
|
ExecuteAsync(FocusSystemNative.focus_ext_trigger_set, "外部触发设置", ct);
|
||||||
|
|
||||||
|
public Task FireExternalTriggerAsync(CancellationToken ct = default) =>
|
||||||
|
ExecuteAsync(FocusSystemNative.focus_ext_trigger_fire, "外部触发出光", ct);
|
||||||
|
|
||||||
|
public Task StartAutoDescendAsync(CancellationToken ct = default) =>
|
||||||
|
ExecuteAsync(FocusSystemNative.focus_auto_descend, "自动下降检测", ct);
|
||||||
|
|
||||||
|
public Task StartFixedCycleAsync(
|
||||||
|
ushort intervalMs,
|
||||||
|
ushort count,
|
||||||
|
CancellationToken ct = default) =>
|
||||||
|
ExecuteAsync(
|
||||||
|
handle => FocusSystemNative.focus_fixed_cycle(handle, intervalMs, count),
|
||||||
|
$"固定周期出光(周期 {intervalMs}ms,{count} 次)",
|
||||||
|
ct);
|
||||||
|
|
||||||
|
public Task SetSyncTimeAsync(
|
||||||
|
FocusSyncTime parameters,
|
||||||
|
CancellationToken ct = default)
|
||||||
|
{
|
||||||
|
ArgumentNullException.ThrowIfNull(parameters);
|
||||||
|
|
||||||
|
var native = new Focus2SyncTimeParams
|
||||||
|
{
|
||||||
|
DelayUs = parameters.DelayUs,
|
||||||
|
OffsetUs = parameters.OffsetUs,
|
||||||
|
HoldUs = parameters.HoldUs,
|
||||||
|
HoldOffsetUs = parameters.HoldOffsetUs,
|
||||||
|
};
|
||||||
|
|
||||||
|
return ExecuteAsync(
|
||||||
|
handle => FocusSystemNative.focus_sync_time_set(handle, ref native),
|
||||||
|
"设置光谱仪同步延时",
|
||||||
|
ct);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task RequestSyncTimeAsync(CancellationToken ct = default) =>
|
||||||
|
ExecuteAsync(FocusSystemNative.focus_sync_time_get, "获取光谱仪同步延时", ct);
|
||||||
|
|
||||||
|
public Task PowerOffAsync(CancellationToken ct = default) =>
|
||||||
|
ExecuteAsync(FocusSystemNative.focus_power_off, "总电源关机", ct);
|
||||||
|
|
||||||
|
private async Task ExecuteAsync(
|
||||||
|
Func<IntPtr, int> command,
|
||||||
|
string operation,
|
||||||
|
CancellationToken ct)
|
||||||
|
{
|
||||||
|
await _gate.WaitAsync(ct).ConfigureAwait(false);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ThrowIfDisposed();
|
||||||
|
var handle = RequireHandle();
|
||||||
|
ct.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
// 命令内部会等待设备应答,放到线程池避免占用请求线程
|
||||||
|
var result = await Task.Run(
|
||||||
|
() => command(handle),
|
||||||
|
CancellationToken.None)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
|
EnsureSuccess(handle, result, operation);
|
||||||
|
_logger.LogInformation("对焦系统:{Operation}命令已下发", operation);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_gate.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行原生命令并返回动态库原始结果码,非 0 时不抛异常,
|
||||||
|
/// 由调用方按业务语义处理。
|
||||||
|
/// </summary>
|
||||||
|
private async Task<int> ExecuteRawAsync(
|
||||||
|
Func<IntPtr, int> command,
|
||||||
|
string operation,
|
||||||
|
CancellationToken ct)
|
||||||
|
{
|
||||||
|
await _gate.WaitAsync(ct).ConfigureAwait(false);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ThrowIfDisposed();
|
||||||
|
var handle = RequireHandle();
|
||||||
|
ct.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
var result = await Task.Run(
|
||||||
|
() => command(handle),
|
||||||
|
CancellationToken.None)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
|
if (result >= 0)
|
||||||
|
{
|
||||||
|
_logger.LogInformation(
|
||||||
|
"对焦系统:{Operation}命令已返回,结果码 {Code}",
|
||||||
|
operation,
|
||||||
|
result);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var detail = FocusSystemNative.GetError(handle);
|
||||||
|
_logger.LogWarning(
|
||||||
|
"对焦系统:{Operation}命令返回错误码 {Code}{Detail}",
|
||||||
|
operation,
|
||||||
|
result,
|
||||||
|
string.IsNullOrWhiteSpace(detail) ? string.Empty : $":{detail}");
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_gate.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- 查询 ----------
|
||||||
|
|
||||||
|
public async Task<FocusSystemStatus> ReadSystemInfoAsync(
|
||||||
|
int? timeoutMs = null,
|
||||||
|
CancellationToken ct = default)
|
||||||
|
{
|
||||||
|
await _gate.WaitAsync(ct).ConfigureAwait(false);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ThrowIfDisposed();
|
||||||
|
var handle = RequireHandle();
|
||||||
|
var timeout = NormalizeTimeout(timeoutMs);
|
||||||
|
|
||||||
|
return await Task.Run(
|
||||||
|
() => ReadSystemInfoCore(handle, timeout, ct),
|
||||||
|
CancellationToken.None)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_gate.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private FocusSystemStatus ReadSystemInfoCore(
|
||||||
|
IntPtr handle,
|
||||||
|
int timeoutMs,
|
||||||
|
CancellationToken ct)
|
||||||
|
{
|
||||||
|
var deadline = Environment.TickCount64 + timeoutMs;
|
||||||
|
var retryInterval = ResolveRetryInterval();
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
ct.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
var result = FocusSystemNative.focus_read_sys_info(handle, out var info);
|
||||||
|
if (result == FocusSystemNative.Ok)
|
||||||
|
{
|
||||||
|
var status = MapStatus(info);
|
||||||
|
|
||||||
|
_logger.LogDebug(
|
||||||
|
"对焦系统信息:位置={Position},错误={Error},激光在线={LaserOnline},电压={Voltage:F1}V",
|
||||||
|
status.FocusPosition,
|
||||||
|
status.Error,
|
||||||
|
status.LaserOnline,
|
||||||
|
status.VoltageVolts);
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 未收到应答/解析失败时在超时时间内重试,其余错误立即抛出
|
||||||
|
if (result is not (FocusSystemNative.ErrTimeout
|
||||||
|
or FocusSystemNative.ErrParseFailed))
|
||||||
|
{
|
||||||
|
throw MapNativeError(handle, result, "读取对焦系统信息");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Environment.TickCount64 >= deadline)
|
||||||
|
{
|
||||||
|
var detail = result == FocusSystemNative.ErrTimeout
|
||||||
|
? "未收到应答"
|
||||||
|
: "CRC 校验失败或载荷不足";
|
||||||
|
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.Timeout,
|
||||||
|
$"读取对焦系统信息超时({timeoutMs}ms):{detail}");
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(retryInterval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<FocusRealTimeResult> ReadResultAsync(
|
||||||
|
int? timeoutMs = null,
|
||||||
|
CancellationToken ct = default)
|
||||||
|
{
|
||||||
|
await _gate.WaitAsync(ct).ConfigureAwait(false);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ThrowIfDisposed();
|
||||||
|
var handle = RequireHandle();
|
||||||
|
var timeout = NormalizeTimeout(timeoutMs);
|
||||||
|
|
||||||
|
return await Task.Run(
|
||||||
|
() => ReadResultCore(handle, timeout, ct),
|
||||||
|
CancellationToken.None)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_gate.Release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private FocusRealTimeResult ReadResultCore(
|
||||||
|
IntPtr handle,
|
||||||
|
int timeoutMs,
|
||||||
|
CancellationToken ct)
|
||||||
|
{
|
||||||
|
var deadline = Environment.TickCount64 + timeoutMs;
|
||||||
|
var retryInterval = ResolveRetryInterval();
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
ct.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
var result = FocusSystemNative.focus_query_result(handle, out var response);
|
||||||
|
if (result == FocusSystemNative.Ok)
|
||||||
|
{
|
||||||
|
return MapResult(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 未找到完整结果帧时继续轮询:底层在无数据时返回 ErrTimeout,
|
||||||
|
// 缓冲区只有半帧时返回 ErrParseFailed,两者都视为“结果尚未就绪”。
|
||||||
|
if (result is not (FocusSystemNative.ErrTimeout
|
||||||
|
or FocusSystemNative.ErrParseFailed))
|
||||||
|
{
|
||||||
|
throw MapNativeError(handle, result, "查询对焦系统结果");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Environment.TickCount64 >= deadline)
|
||||||
|
{
|
||||||
|
return MapResult(response);
|
||||||
|
/*throw new HardwareException(
|
||||||
|
HardwareErrorKind.Timeout,
|
||||||
|
$"查询对焦系统结果超时({timeoutMs}ms):未找到结果帧");*/
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(retryInterval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static FocusSystemStatus MapStatus(Focus2SysInfo info) =>
|
||||||
|
new(
|
||||||
|
info.FocusPos,
|
||||||
|
info.Error,
|
||||||
|
FocusSystemStatus.DescribeError(info.Error),
|
||||||
|
info.Location,
|
||||||
|
info.LaserSta != 0,
|
||||||
|
info.Voltage / 10.0,
|
||||||
|
info.ExtVoltage / 10.0,
|
||||||
|
info.HwVersion,
|
||||||
|
info.SwVersion,
|
||||||
|
info.StartTime,
|
||||||
|
info.SyncTime,
|
||||||
|
info.SysSta != 0,
|
||||||
|
DateTimeOffset.Now);
|
||||||
|
|
||||||
|
private static FocusRealTimeResult MapResult(Focus2RealTimeResp response)
|
||||||
|
{
|
||||||
|
var type = response.Type switch
|
||||||
|
{
|
||||||
|
0x01 => FocusRealTimeResultType.MessageAck,
|
||||||
|
0x02 => FocusRealTimeResultType.RunningResult,
|
||||||
|
0x03 => FocusRealTimeResultType.QueryResult,
|
||||||
|
_ => FocusRealTimeResultType.Unknown,
|
||||||
|
};
|
||||||
|
|
||||||
|
return new FocusRealTimeResult(
|
||||||
|
type,
|
||||||
|
response.Sta == 0x01,
|
||||||
|
response.Error,
|
||||||
|
type == FocusRealTimeResultType.QueryResult ? response.Data : null,
|
||||||
|
DateTimeOffset.Now);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- 参数校验与错误映射 ----------
|
||||||
|
|
||||||
|
private int NormalizeTimeout(int? timeoutMs)
|
||||||
|
{
|
||||||
|
var timeout = timeoutMs ?? _options.ReadTimeoutMs;
|
||||||
|
return timeout > 0 ? timeout : 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int ResolveRetryInterval() =>
|
||||||
|
Math.Clamp(_options.ReadRetryIntervalMs, 10, 1000);
|
||||||
|
|
||||||
|
private static sbyte ToInt8(int value, string name)
|
||||||
|
{
|
||||||
|
if (value is < sbyte.MinValue or > sbyte.MaxValue)
|
||||||
|
{
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.InvalidArgument,
|
||||||
|
$"{name} {value} 超出范围({sbyte.MinValue}~{sbyte.MaxValue})");
|
||||||
|
}
|
||||||
|
|
||||||
|
return (sbyte)value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>命令返回 FOCUS2_OK(0) 表示成功,非 0 时按错误映射。</summary>
|
||||||
|
private static void EnsureSuccess(IntPtr handle, int result, string operation)
|
||||||
|
{
|
||||||
|
if (result >= 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw MapNativeError(handle, result, operation);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static HardwareException MapNativeError(
|
||||||
|
IntPtr handle,
|
||||||
|
int code,
|
||||||
|
string operation)
|
||||||
|
{
|
||||||
|
var kind = code switch
|
||||||
|
{
|
||||||
|
FocusSystemNative.ErrNullPtr => HardwareErrorKind.InvalidArgument,
|
||||||
|
FocusSystemNative.ErrBufTooSmall => HardwareErrorKind.InvalidArgument,
|
||||||
|
FocusSystemNative.ErrFrameTooShort => HardwareErrorKind.CommunicationFailed,
|
||||||
|
FocusSystemNative.ErrComOpenFailed => HardwareErrorKind.ConnectFailed,
|
||||||
|
FocusSystemNative.ErrComNotOpen => HardwareErrorKind.NotConnected,
|
||||||
|
FocusSystemNative.ErrComSendFailed => HardwareErrorKind.CommunicationFailed,
|
||||||
|
FocusSystemNative.ErrParseFailed => HardwareErrorKind.CommunicationFailed,
|
||||||
|
FocusSystemNative.ErrTimeout => HardwareErrorKind.Timeout,
|
||||||
|
_ => HardwareErrorKind.Unknown,
|
||||||
|
};
|
||||||
|
|
||||||
|
var hint = code switch
|
||||||
|
{
|
||||||
|
FocusSystemNative.ErrComOpenFailed => "(串口不存在或被占用)",
|
||||||
|
FocusSystemNative.ErrComNotOpen => "(串口尚未打开)",
|
||||||
|
FocusSystemNative.ErrComSendFailed => "(设备返回失败应答或串口发送失败)",
|
||||||
|
FocusSystemNative.ErrParseFailed => "(CRC 校验失败或载荷不足)",
|
||||||
|
FocusSystemNative.ErrTimeout => "(未收到应答)",
|
||||||
|
_ => string.Empty,
|
||||||
|
};
|
||||||
|
|
||||||
|
var detail = FocusSystemNative.GetError(handle);
|
||||||
|
var message = string.IsNullOrWhiteSpace(detail)
|
||||||
|
? $"{operation}失败{hint}(错误码 {code})"
|
||||||
|
: $"{operation}失败{hint}(错误码 {code}):{detail}";
|
||||||
|
|
||||||
|
return new HardwareException(kind, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string BuildNativeLoadFailureMessage(Exception ex) => ex switch
|
||||||
|
{
|
||||||
|
DllNotFoundException =>
|
||||||
|
"加载 FocusSystem2.dll 失败:请确认该 DLL 已复制到程序输出目录"
|
||||||
|
+ $"(当前目录:{AppContext.BaseDirectory})",
|
||||||
|
BadImageFormatException =>
|
||||||
|
"加载 FocusSystem2.dll 失败:DLL 位数与进程不匹配,请使用 x64 进程运行",
|
||||||
|
EntryPointNotFoundException =>
|
||||||
|
"加载 FocusSystem2.dll 失败:DLL 版本与接口声明不匹配",
|
||||||
|
_ => "加载 FocusSystem2.dll 失败",
|
||||||
|
};
|
||||||
|
|
||||||
|
// ---------- 释放 ----------
|
||||||
|
|
||||||
|
private IntPtr RequireHandle()
|
||||||
|
{
|
||||||
|
var handle = _handle;
|
||||||
|
if (!_connected || handle == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.NotConnected,
|
||||||
|
"对焦系统尚未连接,请先调用连接接口");
|
||||||
|
}
|
||||||
|
|
||||||
|
return handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ThrowIfDisposed()
|
||||||
|
{
|
||||||
|
ObjectDisposedException.ThrowIf(_disposed, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async ValueTask DisposeAsync()
|
||||||
|
{
|
||||||
|
await _gate.WaitAsync().ConfigureAwait(false);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_disposed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_disposed = true;
|
||||||
|
CloseHandle();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_gate.Release();
|
||||||
|
_gate.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,218 @@
|
|||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
using HardwareControl.Core.HardwareServiceImpl.HardwareService;
|
||||||
|
using HardwareControl.Core.SampleAnalysis;
|
||||||
|
using HardwareControl.Core.SystemSetting;
|
||||||
|
using HardwareControl.Core.UsbCamera;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace HardwareControl.Core.HardwareServiceImpl
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 抓取相机当前画面并调用 ONNX 模型分析。
|
||||||
|
/// 作为单例使用,保存最近一次分析结果供扫描流程复用。
|
||||||
|
/// </summary>
|
||||||
|
public sealed class SampleAnalysisService : ISampleAnalysisService
|
||||||
|
{
|
||||||
|
private const string SamplingPointConfigName = "camera_sampling_point";
|
||||||
|
private const string SamplingRadiusConfigName = "camera_sampling_radius";
|
||||||
|
private const string CameraScaleConfigName = "camera_scale";
|
||||||
|
private const string IdentificationTimeoutConfigName = "camera_Identification_outtime";
|
||||||
|
private const int DefaultSamplingPointCount = 5;
|
||||||
|
private const int MaxSamplingPointCount = 100;
|
||||||
|
private const int DefaultIdentificationTimeoutSeconds = 60;
|
||||||
|
private const int MinIdentificationTimeoutSeconds = 5;
|
||||||
|
private const int MaxIdentificationTimeoutSeconds = 300;
|
||||||
|
|
||||||
|
private readonly IUsbCameraService _camera;
|
||||||
|
private readonly ISystemConfigService _systemConfig;
|
||||||
|
private readonly TargetOutlineAnalyzer _analyzer;
|
||||||
|
private readonly ILogger<SampleAnalysisService> _logger;
|
||||||
|
|
||||||
|
private readonly object _gate = new();
|
||||||
|
private SampleAnalysisResult? _lastAnalysis;
|
||||||
|
|
||||||
|
public SampleAnalysisService(
|
||||||
|
IUsbCameraService camera,
|
||||||
|
ISystemConfigService systemConfig,
|
||||||
|
TargetOutlineAnalyzer analyzer,
|
||||||
|
ILogger<SampleAnalysisService> logger)
|
||||||
|
{
|
||||||
|
_camera = camera;
|
||||||
|
_systemConfig = systemConfig;
|
||||||
|
_analyzer = analyzer;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SampleAnalysisResult Analyze()
|
||||||
|
{
|
||||||
|
var target = CaptureLatestFrame();
|
||||||
|
|
||||||
|
var pointCount = GetSamplingPointCount();
|
||||||
|
var samplingRadiusPixels = GetSamplingRadiusPixels();
|
||||||
|
|
||||||
|
_logger.LogInformation(
|
||||||
|
"开始靶样轮廓分析,采样点数:{PointCount},采样半径:{Radius}",
|
||||||
|
pointCount,
|
||||||
|
samplingRadiusPixels is > 0
|
||||||
|
? $"{samplingRadiusPixels.Value:F1}px"
|
||||||
|
: "不限制");
|
||||||
|
|
||||||
|
var watch = Stopwatch.StartNew();
|
||||||
|
var result = _analyzer.Analyze(
|
||||||
|
target, pointCount, samplingRadiusPixels);
|
||||||
|
watch.Stop();
|
||||||
|
|
||||||
|
_logger.LogInformation(
|
||||||
|
"靶样轮廓分析完成:{Width}x{Height},采样点 {PointCount} 个,总耗时 {Elapsed} ms",
|
||||||
|
result.Width,
|
||||||
|
result.Height,
|
||||||
|
result.SamplingPointCount,
|
||||||
|
watch.ElapsedMilliseconds);
|
||||||
|
|
||||||
|
lock (_gate)
|
||||||
|
{
|
||||||
|
_lastAnalysis = result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SampleAnalysisResult GetLatestAnalysis()
|
||||||
|
{
|
||||||
|
lock (_gate)
|
||||||
|
{
|
||||||
|
if (_lastAnalysis is not null)
|
||||||
|
{
|
||||||
|
return _lastAnalysis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Analyze();
|
||||||
|
}
|
||||||
|
|
||||||
|
private CameraFrameSnapshot CaptureLatestFrame() =>
|
||||||
|
_camera.GetLatestFrame() ?? throw new HardwareException(
|
||||||
|
HardwareErrorKind.NotConnected,
|
||||||
|
"相机尚未产生画面,请确认相机已连接");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读取系统参数 camera_Identification_outtime(秒),
|
||||||
|
/// 作为前端等待轮廓识别结果的超时时间;未配置或无效时使用默认值。
|
||||||
|
/// </summary>
|
||||||
|
public int GetIdentificationTimeoutSeconds()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var config = _systemConfig
|
||||||
|
.GetAll()
|
||||||
|
.FirstOrDefault(c => string.Equals(
|
||||||
|
c.ConfigName,
|
||||||
|
IdentificationTimeoutConfigName,
|
||||||
|
StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
|
if (double.TryParse(
|
||||||
|
config?.ConfigValue,
|
||||||
|
NumberStyles.Float,
|
||||||
|
CultureInfo.InvariantCulture,
|
||||||
|
out var seconds) &&
|
||||||
|
seconds > 0)
|
||||||
|
{
|
||||||
|
return (int)Math.Clamp(
|
||||||
|
Math.Round(seconds),
|
||||||
|
MinIdentificationTimeoutSeconds,
|
||||||
|
MaxIdentificationTimeoutSeconds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(
|
||||||
|
ex,
|
||||||
|
"读取系统参数 {ConfigName} 失败,使用默认识别超时时间",
|
||||||
|
IdentificationTimeoutConfigName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return DefaultIdentificationTimeoutSeconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int GetSamplingPointCount()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var config = _systemConfig
|
||||||
|
.GetAll()
|
||||||
|
.FirstOrDefault(c => string.Equals(
|
||||||
|
c.ConfigName, SamplingPointConfigName, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
|
if (int.TryParse(config?.ConfigValue, out var count) && count > 0)
|
||||||
|
{
|
||||||
|
return Math.Min(count, MaxSamplingPointCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(
|
||||||
|
ex, "读取系统参数 {ConfigName} 失败,使用默认采样点数",
|
||||||
|
SamplingPointConfigName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return DefaultSamplingPointCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读取系统参数 camera_sampling_radius(mm),按 camera_scale(px/mm)
|
||||||
|
/// 换算成像素半径;未配置或无效时返回 null,表示不限制采样区域。
|
||||||
|
/// </summary>
|
||||||
|
private double? GetSamplingRadiusPixels()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var values = _systemConfig
|
||||||
|
.GetAll()
|
||||||
|
.Where(c => !string.IsNullOrWhiteSpace(c.ConfigName))
|
||||||
|
.GroupBy(c => c.ConfigName.Trim(), StringComparer.OrdinalIgnoreCase)
|
||||||
|
.ToDictionary(
|
||||||
|
g => g.Key,
|
||||||
|
g => g.Last().ConfigValue?.Trim() ?? string.Empty,
|
||||||
|
StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
var radiusMm = ReadDouble(values, SamplingRadiusConfigName);
|
||||||
|
if (radiusMm is null || radiusMm <= 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var scale = ReadDouble(values, CameraScaleConfigName);
|
||||||
|
if (scale is null || scale <= 0)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(
|
||||||
|
"系统参数 {RadiusName} 已配置,但 {ScaleName} 无效," +
|
||||||
|
"跳过采样点半径限制",
|
||||||
|
SamplingRadiusConfigName,
|
||||||
|
CameraScaleConfigName);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return radiusMm.Value * scale.Value;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(
|
||||||
|
ex, "读取系统参数 {ConfigName} 失败,跳过采样点半径限制",
|
||||||
|
SamplingRadiusConfigName);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static double? ReadDouble(
|
||||||
|
IReadOnlyDictionary<string, string> values, string name) =>
|
||||||
|
values.TryGetValue(name, out var raw) &&
|
||||||
|
double.TryParse(
|
||||||
|
raw,
|
||||||
|
NumberStyles.Float,
|
||||||
|
CultureInfo.InvariantCulture,
|
||||||
|
out var value)
|
||||||
|
? value
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,8 +8,12 @@ namespace HardwareControl.Core.HardwareServiceImpl
|
|||||||
{
|
{
|
||||||
public class UsbCameraService : IUsbCameraService
|
public class UsbCameraService : IUsbCameraService
|
||||||
{
|
{
|
||||||
|
// 系统参数中保存相机硬件 ID 的配置名称
|
||||||
|
private const string CameraVidConfigName = "camera_vid";
|
||||||
|
|
||||||
private readonly UsbCameraOptions _options;
|
private readonly UsbCameraOptions _options;
|
||||||
private readonly ILogger<UsbCameraService> _logger;
|
private readonly ILogger<UsbCameraService> _logger;
|
||||||
|
private readonly ISystemConfigService? _systemConfig;
|
||||||
|
|
||||||
// 串行化所有对 FlashCap 设备对象的访问
|
// 串行化所有对 FlashCap 设备对象的访问
|
||||||
private readonly SemaphoreSlim _gate = new(1, 1);
|
private readonly SemaphoreSlim _gate = new(1, 1);
|
||||||
@@ -23,6 +27,7 @@ namespace HardwareControl.Core.HardwareServiceImpl
|
|||||||
private long _lastFrameAtTicks;
|
private long _lastFrameAtTicks;
|
||||||
private long _framesReceived;
|
private long _framesReceived;
|
||||||
private long _connectedAtTicks;
|
private long _connectedAtTicks;
|
||||||
|
private volatile CameraFrameSnapshot? _latestFrame;
|
||||||
|
|
||||||
public bool IsConnected => _connected;
|
public bool IsConnected => _connected;
|
||||||
|
|
||||||
@@ -41,15 +46,57 @@ namespace HardwareControl.Core.HardwareServiceImpl
|
|||||||
|
|
||||||
public long FramesReceived => Interlocked.Read(ref _framesReceived);
|
public long FramesReceived => Interlocked.Read(ref _framesReceived);
|
||||||
|
|
||||||
|
public CameraFrameSnapshot? GetLatestFrame() => _latestFrame;
|
||||||
|
|
||||||
public event EventHandler<UsbCameraStatusChangedEventArgs>? StatusChanged;
|
public event EventHandler<UsbCameraStatusChangedEventArgs>? StatusChanged;
|
||||||
public event EventHandler<FrameArrivedEventArgs>? FrameArrived;
|
public event EventHandler<FrameArrivedEventArgs>? FrameArrived;
|
||||||
|
|
||||||
public UsbCameraService(
|
public UsbCameraService(
|
||||||
IOptions<UsbCameraOptions> options,
|
IOptions<UsbCameraOptions> options,
|
||||||
ILogger<UsbCameraService> logger)
|
ILogger<UsbCameraService> logger,
|
||||||
|
ISystemConfigService? systemConfig = null)
|
||||||
{
|
{
|
||||||
_options = options.Value;
|
_options = options.Value;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
_systemConfig = systemConfig;
|
||||||
|
RefreshCameraVid();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 从系统参数读取 camera_vid 并写入 <see cref="UsbCameraOptions"/>。
|
||||||
|
/// 读取失败时保留原有配置,不影响相机连接流程。
|
||||||
|
/// </summary>
|
||||||
|
private void RefreshCameraVid()
|
||||||
|
{
|
||||||
|
if (_systemConfig is null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var config = _systemConfig
|
||||||
|
.GetAll()
|
||||||
|
.FirstOrDefault(c => string.Equals(
|
||||||
|
c.ConfigName, CameraVidConfigName, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
|
var value = config?.ConfigValue?.Trim();
|
||||||
|
if (string.IsNullOrWhiteSpace(value) ||
|
||||||
|
string.Equals(_options.CameraVid, value, StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_options.CameraVid = value;
|
||||||
|
_logger.LogInformation(
|
||||||
|
"相机选择使用系统参数 {ConfigName}={CameraVid}",
|
||||||
|
CameraVidConfigName,
|
||||||
|
value);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(ex, "读取系统参数 {ConfigName} 失败", CameraVidConfigName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------- 连接 ----------
|
// ---------- 连接 ----------
|
||||||
@@ -72,6 +119,11 @@ namespace HardwareControl.Core.HardwareServiceImpl
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// 每次连接前重新读取系统参数,管理界面修改 camera_vid 后重连即可生效
|
||||||
|
RefreshCameraVid();
|
||||||
|
|
||||||
|
_latestFrame = null;
|
||||||
|
|
||||||
var devices = new CaptureDevices();
|
var devices = new CaptureDevices();
|
||||||
var descriptors = devices.EnumerateDescriptors().ToList();
|
var descriptors = devices.EnumerateDescriptors().ToList();
|
||||||
|
|
||||||
@@ -117,6 +169,15 @@ namespace HardwareControl.Core.HardwareServiceImpl
|
|||||||
Interlocked.Increment(ref _framesReceived);
|
Interlocked.Increment(ref _framesReceived);
|
||||||
Interlocked.Exchange(ref _lastFrameAtTicks, capturedAt.UtcTicks);
|
Interlocked.Exchange(ref _lastFrameAtTicks, capturedAt.UtcTicks);
|
||||||
|
|
||||||
|
// 缓存独立副本,供后台按需抓帧(事件回调仍使用同一份数据)
|
||||||
|
_latestFrame = new CameraFrameSnapshot(
|
||||||
|
image,
|
||||||
|
format.Width,
|
||||||
|
format.Height,
|
||||||
|
format.MimeType,
|
||||||
|
capturedAt,
|
||||||
|
frameIndex);
|
||||||
|
|
||||||
FrameArrived?.Invoke(
|
FrameArrived?.Invoke(
|
||||||
this,
|
this,
|
||||||
new FrameArrivedEventArgs(
|
new FrameArrivedEventArgs(
|
||||||
@@ -144,6 +205,7 @@ namespace HardwareControl.Core.HardwareServiceImpl
|
|||||||
_connected = false;
|
_connected = false;
|
||||||
_frameFormat = null;
|
_frameFormat = null;
|
||||||
_deviceName = null;
|
_deviceName = null;
|
||||||
|
_latestFrame = null;
|
||||||
_device?.Dispose();
|
_device?.Dispose();
|
||||||
_device = null;
|
_device = null;
|
||||||
throw;
|
throw;
|
||||||
@@ -153,6 +215,7 @@ namespace HardwareControl.Core.HardwareServiceImpl
|
|||||||
_connected = false;
|
_connected = false;
|
||||||
_frameFormat = null;
|
_frameFormat = null;
|
||||||
_deviceName = null;
|
_deviceName = null;
|
||||||
|
_latestFrame = null;
|
||||||
_device?.Dispose();
|
_device?.Dispose();
|
||||||
_device = null;
|
_device = null;
|
||||||
|
|
||||||
@@ -165,6 +228,26 @@ namespace HardwareControl.Core.HardwareServiceImpl
|
|||||||
private CaptureDeviceDescriptor SelectDescriptor(
|
private CaptureDeviceDescriptor SelectDescriptor(
|
||||||
List<CaptureDeviceDescriptor> descriptors)
|
List<CaptureDeviceDescriptor> descriptors)
|
||||||
{
|
{
|
||||||
|
// 优先按系统参数 camera_vid 匹配设备的 Identity。
|
||||||
|
// Identity 在不同设备/平台上大小写不一致,统一转大写后比较。
|
||||||
|
var cameraVid = _options.CameraVid?.Trim();
|
||||||
|
if (!string.IsNullOrWhiteSpace(cameraVid))
|
||||||
|
{
|
||||||
|
var target = cameraVid.ToUpperInvariant();
|
||||||
|
var matched = descriptors.FirstOrDefault(d =>
|
||||||
|
{
|
||||||
|
var identity = d.Identity?.ToString();
|
||||||
|
return identity is not null &&
|
||||||
|
identity.ToUpperInvariant().Contains(target);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (matched != null) return matched;
|
||||||
|
|
||||||
|
_logger.LogWarning(
|
||||||
|
"未找到 Identity 包含 {CameraVid} 的相机,回退到名称关键词选择",
|
||||||
|
cameraVid);
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(_options.DeviceNameKeyword))
|
if (!string.IsNullOrWhiteSpace(_options.DeviceNameKeyword))
|
||||||
{
|
{
|
||||||
var matched = descriptors.FirstOrDefault(
|
var matched = descriptors.FirstOrDefault(
|
||||||
@@ -221,6 +304,7 @@ namespace HardwareControl.Core.HardwareServiceImpl
|
|||||||
{
|
{
|
||||||
CancelReconnectWatcher();
|
CancelReconnectWatcher();
|
||||||
await StopDeviceAsync();
|
await StopDeviceAsync();
|
||||||
|
_latestFrame = null;
|
||||||
|
|
||||||
if (_connected)
|
if (_connected)
|
||||||
{
|
{
|
||||||
@@ -385,6 +469,7 @@ namespace HardwareControl.Core.HardwareServiceImpl
|
|||||||
|
|
||||||
_connected = false;
|
_connected = false;
|
||||||
Interlocked.Exchange(ref _connectedAtTicks, 0);
|
Interlocked.Exchange(ref _connectedAtTicks, 0);
|
||||||
|
_latestFrame = null;
|
||||||
await StopDeviceAsync();
|
await StopDeviceAsync();
|
||||||
StatusChanged?.Invoke(this, new(false, message));
|
StatusChanged?.Invoke(this, new(false, message));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,170 @@
|
|||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace HardwareControl.Core.SampleAnalysis
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 通过 DXGI 枚举本机显卡适配器,用于区分独立显卡与核心显卡。
|
||||||
|
/// DirectML 执行后端的 device_id 就是 DXGI 适配器序号,因此这里返回的
|
||||||
|
/// <see cref="GpuAdapter.Index"/> 可直接传给 AppendExecutionProvider_DML。
|
||||||
|
/// </summary>
|
||||||
|
internal static class GpuAdapterEnumerator
|
||||||
|
{
|
||||||
|
/// <summary>独立显卡的专用显存下限,低于该值视为核显。</summary>
|
||||||
|
private const ulong DiscreteMemoryThreshold = 1024UL * 1024 * 1024;
|
||||||
|
|
||||||
|
private const uint AdapterFlagSoftware = 0x2;
|
||||||
|
|
||||||
|
/// <summary>IDXGIFactory1::EnumAdapters1 在虚表中的槽位。</summary>
|
||||||
|
private const int EnumAdapters1VtableIndex = 12;
|
||||||
|
|
||||||
|
/// <summary>IDXGIAdapter1::GetDesc1 在虚表中的槽位。</summary>
|
||||||
|
private const int GetDesc1VtableIndex = 10;
|
||||||
|
|
||||||
|
private static readonly Guid IID_IDXGIFactory1 =
|
||||||
|
new("770aae78-f26f-4dba-a829-253c83d1b387");
|
||||||
|
|
||||||
|
internal sealed record GpuAdapter(
|
||||||
|
int Index,
|
||||||
|
string Name,
|
||||||
|
ulong DedicatedVideoMemory,
|
||||||
|
bool IsSoftware);
|
||||||
|
|
||||||
|
[DllImport("dxgi.dll")]
|
||||||
|
private static extern int CreateDXGIFactory1(ref Guid riid, out IntPtr factory);
|
||||||
|
|
||||||
|
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||||
|
private delegate int EnumAdapters1Delegate(
|
||||||
|
IntPtr self, uint index, out IntPtr adapter);
|
||||||
|
|
||||||
|
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||||
|
private delegate int GetDesc1Delegate(IntPtr self, out DxgiAdapterDesc1 desc);
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||||||
|
private struct DxgiAdapterDesc1
|
||||||
|
{
|
||||||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
|
||||||
|
public string Description;
|
||||||
|
|
||||||
|
public uint VendorId;
|
||||||
|
public uint DeviceId;
|
||||||
|
public uint SubSysId;
|
||||||
|
public uint Revision;
|
||||||
|
public UIntPtr DedicatedVideoMemory;
|
||||||
|
public UIntPtr DedicatedSystemMemory;
|
||||||
|
public UIntPtr SharedSystemMemory;
|
||||||
|
public uint LuidLowPart;
|
||||||
|
public int LuidHighPart;
|
||||||
|
public uint Flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 按硬件使用类型解析可用的显卡适配器。
|
||||||
|
/// 指定类型的显卡不存在时退回另一类显卡,完全没有可用显卡时返回 false。
|
||||||
|
/// </summary>
|
||||||
|
public static bool TryResolve(
|
||||||
|
HardwareUsageType usageType, out GpuAdapter adapter)
|
||||||
|
{
|
||||||
|
adapter = null!;
|
||||||
|
|
||||||
|
if (usageType == HardwareUsageType.Cpu)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var devices = Enumerate()
|
||||||
|
.Where(item => !item.IsSoftware)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
if (devices.Count == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var discrete = devices
|
||||||
|
.Where(item => item.DedicatedVideoMemory >= DiscreteMemoryThreshold)
|
||||||
|
.OrderByDescending(item => item.DedicatedVideoMemory)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var integrated = devices
|
||||||
|
.Where(item => item.DedicatedVideoMemory < DiscreteMemoryThreshold)
|
||||||
|
.OrderBy(item => item.DedicatedVideoMemory)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var preferred = usageType == HardwareUsageType.DiscreteGpu
|
||||||
|
? discrete.Concat(integrated).FirstOrDefault()
|
||||||
|
: integrated.Concat(discrete).FirstOrDefault();
|
||||||
|
|
||||||
|
adapter = preferred!;
|
||||||
|
return adapter is not null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>枚举全部 DXGI 适配器(包含软件适配器),失败时返回空列表。</summary>
|
||||||
|
public static IReadOnlyList<GpuAdapter> Enumerate()
|
||||||
|
{
|
||||||
|
var adapters = new List<GpuAdapter>();
|
||||||
|
IntPtr factory = IntPtr.Zero;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var factoryId = IID_IDXGIFactory1;
|
||||||
|
if (CreateDXGIFactory1(ref factoryId, out factory) < 0 ||
|
||||||
|
factory == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
return adapters;
|
||||||
|
}
|
||||||
|
|
||||||
|
var enumAdapters1 = GetVtableDelegate<EnumAdapters1Delegate>(
|
||||||
|
factory, EnumAdapters1VtableIndex);
|
||||||
|
|
||||||
|
for (uint index = 0; ; index++)
|
||||||
|
{
|
||||||
|
if (enumAdapters1(factory, index, out var adapter) < 0 ||
|
||||||
|
adapter == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var getDesc1 = GetVtableDelegate<GetDesc1Delegate>(
|
||||||
|
adapter, GetDesc1VtableIndex);
|
||||||
|
|
||||||
|
if (getDesc1(adapter, out var desc) >= 0)
|
||||||
|
{
|
||||||
|
adapters.Add(new GpuAdapter(
|
||||||
|
(int)index,
|
||||||
|
desc.Description ?? string.Empty,
|
||||||
|
desc.DedicatedVideoMemory.ToUInt64(),
|
||||||
|
(desc.Flags & AdapterFlagSoftware) != 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Marshal.Release(adapter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// DXGI 不可用(老系统/远程会话限制)时返回空列表,调用方回退 CPU。
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (factory != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
Marshal.Release(factory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return adapters;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static T GetVtableDelegate<T>(IntPtr instance, int vtableIndex)
|
||||||
|
where T : Delegate
|
||||||
|
{
|
||||||
|
var vtable = Marshal.ReadIntPtr(instance);
|
||||||
|
var method = Marshal.ReadIntPtr(vtable, vtableIndex * IntPtr.Size);
|
||||||
|
return Marshal.GetDelegateForFunctionPointer<T>(method);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
namespace HardwareControl.Core.SampleAnalysis
|
||||||
|
{
|
||||||
|
/// <summary>硬件使用类型,对应系统参数 hardware_usage_type。</summary>
|
||||||
|
public enum HardwareUsageType
|
||||||
|
{
|
||||||
|
/// <summary>仅使用 CPU。</summary>
|
||||||
|
Cpu = 1,
|
||||||
|
|
||||||
|
/// <summary>使用独立显卡(DirectML)。</summary>
|
||||||
|
DiscreteGpu = 2,
|
||||||
|
|
||||||
|
/// <summary>使用核心显卡(DirectML)。</summary>
|
||||||
|
IntegratedGpu = 3,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>靶样 ONNX 分割模型配置。</summary>
|
||||||
|
public sealed class OnnxSegmentationOptions
|
||||||
|
{
|
||||||
|
public const string SectionName = "SampleAnalysis:Onnx";
|
||||||
|
|
||||||
|
/// <summary>模型路径;相对路径基于程序运行目录。</summary>
|
||||||
|
public string? ModelPath { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 模型目录;相对路径基于程序运行目录。
|
||||||
|
/// 目录内按文件名前面的数字从小到大依次尝试,直到某个模型识别成功。
|
||||||
|
/// </summary>
|
||||||
|
public string? ModelDirectory { get; set; } = "Models";
|
||||||
|
|
||||||
|
public int InputWidth { get; set; } = 640;
|
||||||
|
|
||||||
|
public int InputHeight { get; set; } = 640;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 推理执行后端:Auto(优先 DirectML,不可用时回退 CPU)、DirectML、Cpu。
|
||||||
|
/// DirectML 可调用核显/独显,同时保留 CPU 算子回退。
|
||||||
|
/// </summary>
|
||||||
|
public string ExecutionProvider { get; set; } = "Auto";
|
||||||
|
|
||||||
|
/// <summary>DirectML 设备序号,0 表示系统默认适配器。</summary>
|
||||||
|
public int DmlDeviceId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>YOLO 分割模型的目标置信度阈值。</summary>
|
||||||
|
public double ConfidenceThreshold { get; set; } = 0.25;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 模型置信度低于该值时,继续尝试后续模型,取置信度最高的结果。
|
||||||
|
/// </summary>
|
||||||
|
public double FallbackConfidenceThreshold { get; set; } = 0.6;
|
||||||
|
|
||||||
|
/// <summary>概率型二值 mask 的阈值;logits 输出会自动改用 0。</summary>
|
||||||
|
public double MaskThreshold { get; set; } = 0.5;
|
||||||
|
|
||||||
|
/// <summary>像素归一化系数。</summary>
|
||||||
|
public double Scale { get; set; } = 1.0 / 255.0;
|
||||||
|
|
||||||
|
/// <summary>是否交换 R/B 通道(大多数 ONNX 模型需要 true)。</summary>
|
||||||
|
public bool SwapRB { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>Letterbox 填充值。</summary>
|
||||||
|
public double LetterboxPadValue { get; set; } = 114;
|
||||||
|
|
||||||
|
/// <summary>轮廓面积占图像的最小比例。</summary>
|
||||||
|
public double MinAreaRatio { get; set; } = 0.0005;
|
||||||
|
|
||||||
|
/// <summary>轮廓面积占图像的最大比例。</summary>
|
||||||
|
public double MaxAreaRatio { get; set; } = 0.98;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 采样点距轮廓边缘的最小比例(相对于轮廓外接矩形短边)。
|
||||||
|
/// 防止激光点过于贴近靶样边缘而脱离靶面。
|
||||||
|
/// </summary>
|
||||||
|
public double SamplingMarginRatio { get; set; } = 0.1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
namespace HardwareControl.Core.SampleAnalysis
|
||||||
|
{
|
||||||
|
/// <summary>图像坐标系下的采样点。</summary>
|
||||||
|
public sealed record SamplePoint(int X, int Y);
|
||||||
|
|
||||||
|
/// <summary>靶样轮廓与采样点分析结果。</summary>
|
||||||
|
public sealed record SampleAnalysisResult(
|
||||||
|
byte[] ImageData,
|
||||||
|
string MimeType,
|
||||||
|
int Width,
|
||||||
|
int Height,
|
||||||
|
int SamplingPointCount,
|
||||||
|
IReadOnlyList<SamplePoint> SamplingPoints);
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,117 @@
|
|||||||
|
namespace HardwareControl.Core.Scanning
|
||||||
|
{
|
||||||
|
/// <summary>元素符号与中文名称的对应关系。</summary>
|
||||||
|
public static class ElementNames
|
||||||
|
{
|
||||||
|
private static readonly Dictionary<string, string> ChineseNames =
|
||||||
|
new(StringComparer.OrdinalIgnoreCase)
|
||||||
|
{
|
||||||
|
["H"] = "氢",
|
||||||
|
["He"] = "氦",
|
||||||
|
["Li"] = "锂",
|
||||||
|
["Be"] = "铍",
|
||||||
|
["B"] = "硼",
|
||||||
|
["C"] = "碳",
|
||||||
|
["N"] = "氮",
|
||||||
|
["O"] = "氧",
|
||||||
|
["F"] = "氟",
|
||||||
|
["Ne"] = "氖",
|
||||||
|
["Na"] = "钠",
|
||||||
|
["Mg"] = "镁",
|
||||||
|
["Al"] = "铝",
|
||||||
|
["Si"] = "硅",
|
||||||
|
["P"] = "磷",
|
||||||
|
["S"] = "硫",
|
||||||
|
["Cl"] = "氯",
|
||||||
|
["Ar"] = "氩",
|
||||||
|
["K"] = "钾",
|
||||||
|
["Ca"] = "钙",
|
||||||
|
["Sc"] = "钪",
|
||||||
|
["Ti"] = "钛",
|
||||||
|
["V"] = "钒",
|
||||||
|
["Cr"] = "铬",
|
||||||
|
["Mn"] = "锰",
|
||||||
|
["Fe"] = "铁",
|
||||||
|
["Co"] = "钴",
|
||||||
|
["Ni"] = "镍",
|
||||||
|
["Cu"] = "铜",
|
||||||
|
["Zn"] = "锌",
|
||||||
|
["Ga"] = "镓",
|
||||||
|
["Ge"] = "锗",
|
||||||
|
["As"] = "砷",
|
||||||
|
["Se"] = "硒",
|
||||||
|
["Br"] = "溴",
|
||||||
|
["Kr"] = "氪",
|
||||||
|
["Rb"] = "铷",
|
||||||
|
["Sr"] = "锶",
|
||||||
|
["Y"] = "钇",
|
||||||
|
["Zr"] = "锆",
|
||||||
|
["Nb"] = "铌",
|
||||||
|
["Mo"] = "钼",
|
||||||
|
["Tc"] = "锝",
|
||||||
|
["Ru"] = "钌",
|
||||||
|
["Rh"] = "铑",
|
||||||
|
["Pd"] = "钯",
|
||||||
|
["Ag"] = "银",
|
||||||
|
["Cd"] = "镉",
|
||||||
|
["In"] = "铟",
|
||||||
|
["Sn"] = "锡",
|
||||||
|
["Sb"] = "锑",
|
||||||
|
["Te"] = "碲",
|
||||||
|
["I"] = "碘",
|
||||||
|
["Xe"] = "氙",
|
||||||
|
["Cs"] = "铯",
|
||||||
|
["Ba"] = "钡",
|
||||||
|
["La"] = "镧",
|
||||||
|
["Ce"] = "铈",
|
||||||
|
["Pr"] = "镨",
|
||||||
|
["Nd"] = "钕",
|
||||||
|
["Pm"] = "钷",
|
||||||
|
["Sm"] = "钐",
|
||||||
|
["Eu"] = "铕",
|
||||||
|
["Gd"] = "钆",
|
||||||
|
["Tb"] = "铽",
|
||||||
|
["Dy"] = "镝",
|
||||||
|
["Ho"] = "钬",
|
||||||
|
["Er"] = "铒",
|
||||||
|
["Tm"] = "铥",
|
||||||
|
["Yb"] = "镱",
|
||||||
|
["Lu"] = "镥",
|
||||||
|
["Hf"] = "铪",
|
||||||
|
["Ta"] = "钽",
|
||||||
|
["W"] = "钨",
|
||||||
|
["Re"] = "铼",
|
||||||
|
["Os"] = "锇",
|
||||||
|
["Ir"] = "铱",
|
||||||
|
["Pt"] = "铂",
|
||||||
|
["Au"] = "金",
|
||||||
|
["Hg"] = "汞",
|
||||||
|
["Tl"] = "铊",
|
||||||
|
["Pb"] = "铅",
|
||||||
|
["Bi"] = "铋",
|
||||||
|
["Po"] = "钋",
|
||||||
|
["At"] = "砹",
|
||||||
|
["Rn"] = "氡",
|
||||||
|
["Fr"] = "钫",
|
||||||
|
["Ra"] = "镭",
|
||||||
|
["Ac"] = "锕",
|
||||||
|
["Th"] = "钍",
|
||||||
|
["Pa"] = "镤",
|
||||||
|
["U"] = "铀",
|
||||||
|
["Np"] = "镎",
|
||||||
|
["Pu"] = "钚",
|
||||||
|
["Am"] = "镅",
|
||||||
|
["Cm"] = "锔",
|
||||||
|
["Bk"] = "锫",
|
||||||
|
["Cf"] = "锎",
|
||||||
|
["Es"] = "锿",
|
||||||
|
["Fm"] = "镄",
|
||||||
|
["Md"] = "钔",
|
||||||
|
["No"] = "锘",
|
||||||
|
["Lr"] = "铹",
|
||||||
|
};
|
||||||
|
|
||||||
|
public static string GetChineseName(string symbol) =>
|
||||||
|
ChineseNames.TryGetValue(symbol, out var name) ? name : symbol;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
namespace HardwareControl.Core.Scanning
|
||||||
|
{
|
||||||
|
/// <summary>换算后的位移台绝对目标位置(mm)。</summary>
|
||||||
|
public readonly record struct StageTarget(int X, int Y);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 相机像素坐标 → 位移台绝对坐标。
|
||||||
|
///
|
||||||
|
/// 约定(B 模式):
|
||||||
|
/// * 图像中心对应位移台坐标 (camera_x_offset, camera_y_offset);
|
||||||
|
/// * 激光位于位移台原点 (0,0);
|
||||||
|
/// * +X 使画面中的位移台向右,+Y 使画面中的位移台向上,图像 y 轴向下;
|
||||||
|
/// * 要把某个采样点送到激光下,目标位置 = -(该点在位移台坐标系中的坐标)。
|
||||||
|
/// </summary>
|
||||||
|
public static class ScanCoordinateMapper
|
||||||
|
{
|
||||||
|
public static StageTarget ToStageAbsolute(
|
||||||
|
int pixelX,
|
||||||
|
int pixelY,
|
||||||
|
int imageWidth,
|
||||||
|
int imageHeight,
|
||||||
|
double scalePxPerMm,
|
||||||
|
double offsetX,
|
||||||
|
double offsetY)
|
||||||
|
{
|
||||||
|
if (imageWidth <= 0 || imageHeight <= 0)
|
||||||
|
{
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.InvalidState,
|
||||||
|
"相机画面尺寸无效,无法换算采样点坐标");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scalePxPerMm <= 0)
|
||||||
|
{
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.InvalidState,
|
||||||
|
"标尺比例 camera_scale 无效,无法换算采样点坐标");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 图像坐标相对画面中心的偏移(毫米):x 向右为正,y 向下为正。
|
||||||
|
var dx = (pixelX - imageWidth / 2.0) / scalePxPerMm;
|
||||||
|
var dy = (pixelY - imageHeight / 2.0) / scalePxPerMm;
|
||||||
|
|
||||||
|
// 点自身在位移台坐标系中的坐标:P = (offsetX + dx, offsetY - dy)。
|
||||||
|
// 要把 P 送到激光原点,位移台绝对位置 = -P。
|
||||||
|
var targetX = -offsetX - dx;
|
||||||
|
var targetY = -offsetY + dy;
|
||||||
|
|
||||||
|
return new StageTarget(RoundMm(targetX), RoundMm(targetY));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int RoundMm(double value)
|
||||||
|
{
|
||||||
|
var rounded = (int)Math.Round(value, MidpointRounding.AwayFromZero);
|
||||||
|
if (rounded is < short.MinValue or > short.MaxValue)
|
||||||
|
{
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.InvalidArgument,
|
||||||
|
$"换算后的位移台坐标 {rounded}mm 超出硬件范围");
|
||||||
|
}
|
||||||
|
|
||||||
|
return rounded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
using LiteDB;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace HardwareControl.Core.Scanning
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 扫描数据持久化(独立 LiteDB 文件)。
|
||||||
|
/// 扫描期间数据只保存在内存,流程正常结束后一次性写入。
|
||||||
|
/// </summary>
|
||||||
|
public sealed class ScanDataStore : IDisposable
|
||||||
|
{
|
||||||
|
private const string RunCollection = "scan_run";
|
||||||
|
private const string PointCollection = "scan_point";
|
||||||
|
|
||||||
|
private readonly LiteDatabase _database;
|
||||||
|
private readonly ILiteCollection<ScanRunRecord> _runs;
|
||||||
|
private readonly ILiteCollection<ScanPointRecord> _points;
|
||||||
|
private readonly ILogger<ScanDataStore> _logger;
|
||||||
|
private readonly object _gate = new();
|
||||||
|
|
||||||
|
public ScanDataStore(string? databasePath, ILogger<ScanDataStore> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
|
||||||
|
var path = string.IsNullOrWhiteSpace(databasePath)
|
||||||
|
? Path.Combine(AppContext.BaseDirectory, "Data", "scan-data.db")
|
||||||
|
: databasePath;
|
||||||
|
|
||||||
|
var fullPath = Path.GetFullPath(path);
|
||||||
|
var directory = Path.GetDirectoryName(fullPath);
|
||||||
|
if (!string.IsNullOrWhiteSpace(directory))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(directory);
|
||||||
|
}
|
||||||
|
|
||||||
|
_database = new LiteDatabase(new ConnectionString
|
||||||
|
{
|
||||||
|
Filename = fullPath,
|
||||||
|
Connection = ConnectionType.Shared,
|
||||||
|
});
|
||||||
|
|
||||||
|
_runs = _database.GetCollection<ScanRunRecord>(RunCollection);
|
||||||
|
_points = _database.GetCollection<ScanPointRecord>(PointCollection);
|
||||||
|
_points.EnsureIndex(point => point.ScanId);
|
||||||
|
|
||||||
|
_logger.LogInformation("扫描数据库:{Path}", fullPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>一次性写入一次扫描及其所有采样点。</summary>
|
||||||
|
public void SaveCompleted(
|
||||||
|
ScanRunRecord run,
|
||||||
|
IReadOnlyList<ScanPointRecord> points)
|
||||||
|
{
|
||||||
|
lock (_gate)
|
||||||
|
{
|
||||||
|
_database.BeginTrans();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_runs.Upsert(run);
|
||||||
|
for (var i = 0; i < points.Count; i++)
|
||||||
|
{
|
||||||
|
points[i].Id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
_points.InsertBulk(points);
|
||||||
|
_database.Commit();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
_database.Rollback();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation(
|
||||||
|
"扫描数据已写入数据库:{ScanId},采样点 {Count} 个",
|
||||||
|
run.ScanId,
|
||||||
|
points.Count);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScanRunRecord? GetRun(string scanId)
|
||||||
|
{
|
||||||
|
lock (_gate)
|
||||||
|
{
|
||||||
|
return _runs.FindById(scanId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IReadOnlyList<ScanPointRecord> GetPoints(string scanId)
|
||||||
|
{
|
||||||
|
lock (_gate)
|
||||||
|
{
|
||||||
|
return _points
|
||||||
|
.Find(point => point.ScanId == scanId)
|
||||||
|
.OrderBy(point => point.Index)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScanRunRecord? GetLatestRun()
|
||||||
|
{
|
||||||
|
lock (_gate)
|
||||||
|
{
|
||||||
|
return _runs
|
||||||
|
.FindAll()
|
||||||
|
.OrderByDescending(run => run.StartedAt)
|
||||||
|
.FirstOrDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>按开始时间倒序读取最近的扫描记录,用于历史列表。</summary>
|
||||||
|
public IReadOnlyList<ScanRunRecord> GetRecentRuns(int limit)
|
||||||
|
{
|
||||||
|
var count = Math.Clamp(limit, 1, 200);
|
||||||
|
lock (_gate)
|
||||||
|
{
|
||||||
|
return _runs
|
||||||
|
.Find(Query.All("StartedAt", Query.Descending), 0, count)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>删除一条扫描记录及其全部采样点;记录不存在时返回 false。</summary>
|
||||||
|
public bool DeleteRun(string scanId)
|
||||||
|
{
|
||||||
|
lock (_gate)
|
||||||
|
{
|
||||||
|
_database.BeginTrans();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_points.DeleteMany(point => point.ScanId == scanId);
|
||||||
|
var removed = _runs.Delete(scanId);
|
||||||
|
_database.Commit();
|
||||||
|
|
||||||
|
if (removed)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("扫描记录已删除:{ScanId}", scanId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return removed;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
_database.Rollback();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose() => _database.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,193 @@
|
|||||||
|
using LiteDB;
|
||||||
|
|
||||||
|
namespace HardwareControl.Core.Scanning
|
||||||
|
{
|
||||||
|
/// <summary>一次扫描的整体状态。</summary>
|
||||||
|
public enum ScanStatus
|
||||||
|
{
|
||||||
|
Running = 0,
|
||||||
|
Completed = 1,
|
||||||
|
Aborted = 2,
|
||||||
|
Failed = 3,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>扫描流程当前所处阶段。</summary>
|
||||||
|
public enum ScanPhase
|
||||||
|
{
|
||||||
|
Idle = 0,
|
||||||
|
Homing = 1,
|
||||||
|
Moving = 2,
|
||||||
|
Focusing = 3,
|
||||||
|
Acquiring = 4,
|
||||||
|
Returning = 5,
|
||||||
|
Analyzing = 6,
|
||||||
|
Writing = 7,
|
||||||
|
Completed = 8,
|
||||||
|
Aborted = 9,
|
||||||
|
Failed = 10,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>实时进度快照,通过 SignalR 推送给前端。</summary>
|
||||||
|
public sealed record ScanProgress(
|
||||||
|
string ScanId,
|
||||||
|
ScanPhase Phase,
|
||||||
|
int PointIndex,
|
||||||
|
int TotalPoints,
|
||||||
|
int CompletedPoints,
|
||||||
|
int Percent,
|
||||||
|
string Message,
|
||||||
|
int StageX,
|
||||||
|
int StageY,
|
||||||
|
bool StageMoving,
|
||||||
|
DateTimeOffset UpdatedAt);
|
||||||
|
|
||||||
|
/// <summary>启动扫描的返回结果。</summary>
|
||||||
|
public sealed record ScanStartResult(string ScanId, int TotalPoints);
|
||||||
|
|
||||||
|
/// <summary>位移台实时位置。</summary>
|
||||||
|
public sealed record StagePosition(
|
||||||
|
int X,
|
||||||
|
int Y,
|
||||||
|
int Z,
|
||||||
|
bool Moving,
|
||||||
|
DateTimeOffset UpdatedAt);
|
||||||
|
|
||||||
|
/// <summary>扫描结束事件。</summary>
|
||||||
|
public sealed record ScanRunSummary(string ScanId, ScanStatus Status, string? Error);
|
||||||
|
|
||||||
|
/// <summary>单个采样点采集完成事件(携带拼接光谱,用于实时绘图)。</summary>
|
||||||
|
public sealed record ScanPointAcquired(
|
||||||
|
string ScanId,
|
||||||
|
int PointIndex,
|
||||||
|
int TotalPoints,
|
||||||
|
float[] Wavelengths,
|
||||||
|
float[] Spectrum,
|
||||||
|
IReadOnlyList<ScanSegmentRecord> Segments,
|
||||||
|
DateTimeOffset AcquiredAt);
|
||||||
|
|
||||||
|
/// <summary>扫描运行的持久化记录。</summary>
|
||||||
|
public sealed class ScanRunRecord
|
||||||
|
{
|
||||||
|
[BsonId]
|
||||||
|
public string ScanId { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public DateTimeOffset StartedAt { get; set; }
|
||||||
|
|
||||||
|
public DateTimeOffset? FinishedAt { get; set; }
|
||||||
|
|
||||||
|
public ScanStatus Status { get; set; }
|
||||||
|
|
||||||
|
public string? Error { get; set; }
|
||||||
|
|
||||||
|
public int TotalPoints { get; set; }
|
||||||
|
|
||||||
|
public int CompletedPoints { get; set; }
|
||||||
|
|
||||||
|
/// <summary>传给光谱仪的曝光时间(微秒)。</summary>
|
||||||
|
public int ExposureUs { get; set; }
|
||||||
|
|
||||||
|
public int Averaging { get; set; }
|
||||||
|
|
||||||
|
public int DelayUs { get; set; }
|
||||||
|
|
||||||
|
public int WaitTimeoutMs { get; set; }
|
||||||
|
|
||||||
|
public int MoveSpeed { get; set; }
|
||||||
|
|
||||||
|
public int MoveAccel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>比例尺(像素/毫米)。</summary>
|
||||||
|
public double CameraScale { get; set; }
|
||||||
|
|
||||||
|
public double CameraOffsetX { get; set; }
|
||||||
|
|
||||||
|
public double CameraOffsetY { get; set; }
|
||||||
|
|
||||||
|
public int ImageWidth { get; set; }
|
||||||
|
|
||||||
|
public int ImageHeight { get; set; }
|
||||||
|
|
||||||
|
/// <summary>带采样点标注的靶面图。</summary>
|
||||||
|
public byte[]? ImageData { get; set; }
|
||||||
|
|
||||||
|
public string? ImageMimeType { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>单个采样点的持久化记录。</summary>
|
||||||
|
public sealed class ScanPointRecord
|
||||||
|
{
|
||||||
|
[BsonId]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string ScanId { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>从 0 开始的点序号。</summary>
|
||||||
|
public int Index { get; set; }
|
||||||
|
|
||||||
|
public int PixelX { get; set; }
|
||||||
|
|
||||||
|
public int PixelY { get; set; }
|
||||||
|
|
||||||
|
public int StageX { get; set; }
|
||||||
|
|
||||||
|
public int StageY { get; set; }
|
||||||
|
|
||||||
|
public bool Succeeded { get; set; }
|
||||||
|
|
||||||
|
public string? Error { get; set; }
|
||||||
|
|
||||||
|
public float[] Wavelengths { get; set; } = Array.Empty<float>();
|
||||||
|
|
||||||
|
public float[] Spectrum { get; set; } = Array.Empty<float>();
|
||||||
|
|
||||||
|
public ScanSegmentRecord[] Segments { get; set; } = Array.Empty<ScanSegmentRecord>();
|
||||||
|
|
||||||
|
public List<ScanElementRecord> Elements { get; set; } = new();
|
||||||
|
|
||||||
|
public double Temperature { get; set; }
|
||||||
|
|
||||||
|
public double ElectronDensity { get; set; }
|
||||||
|
|
||||||
|
public DateTimeOffset AcquiredAt { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>拼接光谱的段信息。</summary>
|
||||||
|
public sealed class ScanSegmentRecord
|
||||||
|
{
|
||||||
|
public int DeviceIndex { get; set; }
|
||||||
|
|
||||||
|
public string SerialNumber { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public double WavelengthStart { get; set; }
|
||||||
|
|
||||||
|
public double WavelengthEnd { get; set; }
|
||||||
|
|
||||||
|
public int PointCount { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>单个元素的定性/定量结果。</summary>
|
||||||
|
public sealed class ScanElementRecord
|
||||||
|
{
|
||||||
|
public string Symbol { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>高 / 中 / 低。</summary>
|
||||||
|
public string IntensityLevel { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public double Abundance { get; set; }
|
||||||
|
|
||||||
|
public double RawAbundance { get; set; }
|
||||||
|
|
||||||
|
/// <summary>检出 / 痕量。</summary>
|
||||||
|
public string Verdict { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>该元素匹配谱线中的最大强度。</summary>
|
||||||
|
public double MaxIntensity { get; set; }
|
||||||
|
|
||||||
|
/// <summary>最强匹配谱线在原始光谱中的峰位(nm)。</summary>
|
||||||
|
public double MatchedWavelength { get; set; }
|
||||||
|
|
||||||
|
public int MatchedLines { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,174 @@
|
|||||||
|
using System.Globalization;
|
||||||
|
using HardwareControl.Core.AxisPlatform;
|
||||||
|
using HardwareControl.Core.HardwareServiceImpl.HardwareService;
|
||||||
|
using HardwareControl.Core.Spectrometer;
|
||||||
|
using HardwareControl.Core.SystemSetting;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
|
||||||
|
namespace HardwareControl.Core.Scanning
|
||||||
|
{
|
||||||
|
/// <summary>一次扫描使用的运行参数(从系统参数读取)。</summary>
|
||||||
|
public sealed record ScanSettings(
|
||||||
|
double CameraScale,
|
||||||
|
double CameraOffsetX,
|
||||||
|
double CameraOffsetY,
|
||||||
|
int MoveSpeed,
|
||||||
|
int MoveAccel,
|
||||||
|
int ExposureUs,
|
||||||
|
int Averaging,
|
||||||
|
int DelayUs,
|
||||||
|
int WaitTimeoutMs,
|
||||||
|
TimeSpan FocusTimeout);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读取扫描所需的系统参数。参数在每次扫描开始时重新读取,
|
||||||
|
/// 管理界面修改后无需重启即可生效。
|
||||||
|
/// </summary>
|
||||||
|
public sealed class ScanSettingsProvider
|
||||||
|
{
|
||||||
|
public const string CameraScaleName = "camera_scale";
|
||||||
|
public const string CameraOffsetXName = "camera_x_offset";
|
||||||
|
public const string CameraOffsetYName = "camera_y_offset";
|
||||||
|
public const string MoveSpeedName = "move_speed";
|
||||||
|
public const string MoveAccelName = "move_accel";
|
||||||
|
public const string ExposureName = "ARIS_ExposureUs";
|
||||||
|
public const string AveragingName = "ARIS_Averaging";
|
||||||
|
public const string DelayName = "ARIS_DelayUs";
|
||||||
|
public const string TimeoutName = "ARIS_TimeoutMs";
|
||||||
|
public const string FocusTimeoutName = "focus_outTime";
|
||||||
|
|
||||||
|
private readonly ISystemConfigService _systemConfig;
|
||||||
|
private readonly AxisStageOptions _axisOptions;
|
||||||
|
private readonly ArisSpectrometerOptions _spectrometerOptions;
|
||||||
|
private readonly ILogger<ScanSettingsProvider> _logger;
|
||||||
|
|
||||||
|
public ScanSettingsProvider(
|
||||||
|
ISystemConfigService systemConfig,
|
||||||
|
IOptions<AxisStageOptions> axisOptions,
|
||||||
|
IOptions<ArisSpectrometerOptions> spectrometerOptions,
|
||||||
|
ILogger<ScanSettingsProvider> logger)
|
||||||
|
{
|
||||||
|
_systemConfig = systemConfig;
|
||||||
|
_axisOptions = axisOptions.Value;
|
||||||
|
_spectrometerOptions = spectrometerOptions.Value;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScanSettings Load()
|
||||||
|
{
|
||||||
|
var values = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
foreach (var config in _systemConfig.GetAll())
|
||||||
|
{
|
||||||
|
var name = config.ConfigName?.Trim();
|
||||||
|
if (string.IsNullOrWhiteSpace(name))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
values[name] = config.ConfigValue?.Trim() ?? string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
var cameraScale = GetDouble(values, CameraScaleName, 0);
|
||||||
|
if (cameraScale <= 0)
|
||||||
|
{
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.InvalidState,
|
||||||
|
"未配置有效的标尺比例 camera_scale,请先在标尺设定中完成相机标定");
|
||||||
|
}
|
||||||
|
|
||||||
|
var moveSpeed = GetInt(
|
||||||
|
values, MoveSpeedName, _axisOptions.DefaultSpeed);
|
||||||
|
var moveAccel = GetInt(
|
||||||
|
values, MoveAccelName, _axisOptions.DefaultAccel);
|
||||||
|
|
||||||
|
// ARIS_ExposureUs 在系统参数中的单位是毫秒,接口需要微秒。
|
||||||
|
var exposureMs = GetDouble(
|
||||||
|
values,
|
||||||
|
ExposureName,
|
||||||
|
_spectrometerOptions.SynchronizedExposureUs / 1000.0);
|
||||||
|
var exposureUs = (int)Math.Round(exposureMs * 1000.0, MidpointRounding.AwayFromZero);
|
||||||
|
if (exposureUs <= 0)
|
||||||
|
{
|
||||||
|
exposureUs = _spectrometerOptions.SynchronizedExposureUs;
|
||||||
|
}
|
||||||
|
|
||||||
|
var averaging = GetInt(
|
||||||
|
values, AveragingName, _spectrometerOptions.Averaging);
|
||||||
|
if (averaging < 1)
|
||||||
|
{
|
||||||
|
averaging = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
var delayUs = GetInt(
|
||||||
|
values, DelayName, _spectrometerOptions.DelayUs);
|
||||||
|
if (delayUs < 0)
|
||||||
|
{
|
||||||
|
delayUs = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
var waitTimeoutMs = GetInt(
|
||||||
|
values,
|
||||||
|
TimeoutName,
|
||||||
|
_spectrometerOptions.SynchronizedWaitTimeoutMs);
|
||||||
|
if (waitTimeoutMs <= 0)
|
||||||
|
{
|
||||||
|
waitTimeoutMs = _spectrometerOptions.SynchronizedWaitTimeoutMs;
|
||||||
|
}
|
||||||
|
|
||||||
|
var focusSeconds = GetDouble(values, FocusTimeoutName, 10);
|
||||||
|
if (focusSeconds <= 0)
|
||||||
|
{
|
||||||
|
focusSeconds = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
var settings = new ScanSettings(
|
||||||
|
cameraScale,
|
||||||
|
GetDouble(values, CameraOffsetXName, 0),
|
||||||
|
GetDouble(values, CameraOffsetYName, 0),
|
||||||
|
Math.Clamp(moveSpeed, 1, ushort.MaxValue),
|
||||||
|
Math.Clamp(moveAccel, 1, ushort.MaxValue),
|
||||||
|
exposureUs,
|
||||||
|
averaging,
|
||||||
|
delayUs,
|
||||||
|
waitTimeoutMs,
|
||||||
|
TimeSpan.FromSeconds(focusSeconds));
|
||||||
|
|
||||||
|
_logger.LogInformation(
|
||||||
|
"扫描参数:scale={Scale}px/mm,offset=({OffsetX},{OffsetY})mm," +
|
||||||
|
"speed={Speed},accel={Accel},exposure={Exposure}us," +
|
||||||
|
"averaging={Averaging},delay={Delay}us,waitTimeout={WaitTimeout}ms," +
|
||||||
|
"focusTimeout={FocusTimeout}s",
|
||||||
|
settings.CameraScale,
|
||||||
|
settings.CameraOffsetX,
|
||||||
|
settings.CameraOffsetY,
|
||||||
|
settings.MoveSpeed,
|
||||||
|
settings.MoveAccel,
|
||||||
|
settings.ExposureUs,
|
||||||
|
settings.Averaging,
|
||||||
|
settings.DelayUs,
|
||||||
|
settings.WaitTimeoutMs,
|
||||||
|
settings.FocusTimeout.TotalSeconds);
|
||||||
|
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static double GetDouble(
|
||||||
|
IReadOnlyDictionary<string, string> values,
|
||||||
|
string name,
|
||||||
|
double fallback) =>
|
||||||
|
values.TryGetValue(name, out var raw) &&
|
||||||
|
double.TryParse(raw, NumberStyles.Float, CultureInfo.InvariantCulture, out var value)
|
||||||
|
? value
|
||||||
|
: fallback;
|
||||||
|
|
||||||
|
private static int GetInt(
|
||||||
|
IReadOnlyDictionary<string, string> values,
|
||||||
|
string name,
|
||||||
|
int fallback) =>
|
||||||
|
values.TryGetValue(name, out var raw) &&
|
||||||
|
int.TryParse(raw, NumberStyles.Integer, CultureInfo.InvariantCulture, out var value)
|
||||||
|
? value
|
||||||
|
: fallback;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,708 @@
|
|||||||
|
using HardwareControl.Core.AxisPlatform;
|
||||||
|
using HardwareControl.Core.FocusSystem;
|
||||||
|
using HardwareControl.Core.HardwareServiceImpl.HardwareService;
|
||||||
|
using HardwareControl.Core.SampleAnalysis;
|
||||||
|
using HardwareControl.Core.Spectrometer;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace HardwareControl.Core.Scanning
|
||||||
|
{
|
||||||
|
/// <summary>扫描流程服务:回零 → 逐点移动/对焦/收光 → 分析/写库 → 回零。</summary>
|
||||||
|
public interface IScanWorkflowService
|
||||||
|
{
|
||||||
|
bool IsRunning { get; }
|
||||||
|
|
||||||
|
ScanProgress Current { get; }
|
||||||
|
|
||||||
|
Task<ScanStartResult> StartAsync(CancellationToken ct = default);
|
||||||
|
|
||||||
|
Task AbortAsync();
|
||||||
|
|
||||||
|
event EventHandler<ScanProgress>? ProgressChanged;
|
||||||
|
|
||||||
|
event EventHandler<StagePosition>? StagePositionChanged;
|
||||||
|
|
||||||
|
event EventHandler<ScanPointAcquired>? PointAcquired;
|
||||||
|
|
||||||
|
event EventHandler<ScanRunSummary>? Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 一次完整测试流程的编排实现。同一时刻只允许一个扫描,
|
||||||
|
/// 中止或失败时不写库并尽量让位移台回零。
|
||||||
|
/// </summary>
|
||||||
|
public sealed class ScanWorkflowService : IScanWorkflowService
|
||||||
|
{
|
||||||
|
private static readonly TimeSpan StageTimeout = TimeSpan.FromSeconds(15);
|
||||||
|
private static readonly TimeSpan StagePollInterval = TimeSpan.FromMilliseconds(100);
|
||||||
|
|
||||||
|
private const int StageStatusTimeoutMs = 500;
|
||||||
|
|
||||||
|
private readonly ISampleAnalysisService _sampleAnalysis;
|
||||||
|
private readonly IAxisStageService _stage;
|
||||||
|
private readonly IFocusSystemService _focus;
|
||||||
|
private readonly IArisSpectrometerService _spectrometer;
|
||||||
|
private readonly ScanSettingsProvider _settingsProvider;
|
||||||
|
private readonly ScanDataStore _dataStore;
|
||||||
|
private readonly SpectrumAnalysisService _analysis;
|
||||||
|
private readonly ILogger<ScanWorkflowService> _logger;
|
||||||
|
|
||||||
|
private int _running;
|
||||||
|
private CancellationTokenSource? _cts;
|
||||||
|
private volatile ScanProgress _current = new(
|
||||||
|
string.Empty,
|
||||||
|
ScanPhase.Idle,
|
||||||
|
-1,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
"空闲",
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
DateTimeOffset.Now);
|
||||||
|
|
||||||
|
private int _lastStageX;
|
||||||
|
private int _lastStageY;
|
||||||
|
private bool _lastStageMoving;
|
||||||
|
|
||||||
|
public ScanWorkflowService(
|
||||||
|
ISampleAnalysisService sampleAnalysis,
|
||||||
|
IAxisStageService stage,
|
||||||
|
IFocusSystemService focus,
|
||||||
|
IArisSpectrometerService spectrometer,
|
||||||
|
ScanSettingsProvider settingsProvider,
|
||||||
|
ScanDataStore dataStore,
|
||||||
|
SpectrumAnalysisService analysis,
|
||||||
|
ILogger<ScanWorkflowService> logger)
|
||||||
|
{
|
||||||
|
_sampleAnalysis = sampleAnalysis;
|
||||||
|
_stage = stage;
|
||||||
|
_focus = focus;
|
||||||
|
_spectrometer = spectrometer;
|
||||||
|
_settingsProvider = settingsProvider;
|
||||||
|
_dataStore = dataStore;
|
||||||
|
_analysis = analysis;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsRunning => Volatile.Read(ref _running) == 1;
|
||||||
|
|
||||||
|
public ScanProgress Current => _current;
|
||||||
|
|
||||||
|
public event EventHandler<ScanProgress>? ProgressChanged;
|
||||||
|
|
||||||
|
public event EventHandler<StagePosition>? StagePositionChanged;
|
||||||
|
|
||||||
|
public event EventHandler<ScanPointAcquired>? PointAcquired;
|
||||||
|
|
||||||
|
public event EventHandler<ScanRunSummary>? Finished;
|
||||||
|
|
||||||
|
public async Task<ScanStartResult> StartAsync(CancellationToken ct = default)
|
||||||
|
{
|
||||||
|
if (Interlocked.CompareExchange(ref _running, 1, 0) != 0)
|
||||||
|
{
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.InvalidState,
|
||||||
|
"已有扫描正在进行,请等待当前流程结束");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var settings = _settingsProvider.Load();
|
||||||
|
|
||||||
|
// 启动时可能连接失败,这里再尝试一次(已连接时立即返回)。
|
||||||
|
if (!_stage.IsConnected)
|
||||||
|
{
|
||||||
|
await _stage.ConnectAsync(ct);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_focus.IsConnected)
|
||||||
|
{
|
||||||
|
await _focus.ConnectAsync(ct);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_spectrometer.IsConnected)
|
||||||
|
{
|
||||||
|
await _spectrometer.ConnectAsync(ct);
|
||||||
|
}
|
||||||
|
|
||||||
|
var sample = _sampleAnalysis.GetLatestAnalysis();
|
||||||
|
if (sample.SamplingPoints.Count == 0)
|
||||||
|
{
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.InvalidState,
|
||||||
|
"没有可用的采样点,请重新识别靶样轮廓");
|
||||||
|
}
|
||||||
|
|
||||||
|
var targets = new List<StageTarget>(sample.SamplingPoints.Count);
|
||||||
|
foreach (var point in sample.SamplingPoints)
|
||||||
|
{
|
||||||
|
targets.Add(ScanCoordinateMapper.ToStageAbsolute(
|
||||||
|
point.X,
|
||||||
|
point.Y,
|
||||||
|
sample.Width,
|
||||||
|
sample.Height,
|
||||||
|
settings.CameraScale,
|
||||||
|
settings.CameraOffsetX,
|
||||||
|
settings.CameraOffsetY));
|
||||||
|
}
|
||||||
|
|
||||||
|
var run = new ScanRunRecord
|
||||||
|
{
|
||||||
|
ScanId = BuildScanId(),
|
||||||
|
StartedAt = DateTimeOffset.Now,
|
||||||
|
Status = ScanStatus.Running,
|
||||||
|
TotalPoints = targets.Count,
|
||||||
|
CompletedPoints = 0,
|
||||||
|
ExposureUs = settings.ExposureUs,
|
||||||
|
Averaging = settings.Averaging,
|
||||||
|
DelayUs = settings.DelayUs,
|
||||||
|
WaitTimeoutMs = settings.WaitTimeoutMs,
|
||||||
|
MoveSpeed = settings.MoveSpeed,
|
||||||
|
MoveAccel = settings.MoveAccel,
|
||||||
|
CameraScale = settings.CameraScale,
|
||||||
|
CameraOffsetX = settings.CameraOffsetX,
|
||||||
|
CameraOffsetY = settings.CameraOffsetY,
|
||||||
|
ImageWidth = sample.Width,
|
||||||
|
ImageHeight = sample.Height,
|
||||||
|
ImageData = sample.ImageData,
|
||||||
|
ImageMimeType = sample.MimeType,
|
||||||
|
};
|
||||||
|
|
||||||
|
var context = new RunContext(run, sample, targets, settings);
|
||||||
|
var cts = new CancellationTokenSource();
|
||||||
|
_cts = cts;
|
||||||
|
|
||||||
|
Publish(context, ScanPhase.Idle, -1, 0, "扫描准备中");
|
||||||
|
|
||||||
|
_ = Task.Run(
|
||||||
|
() => ExecuteAsync(context, cts.Token),
|
||||||
|
CancellationToken.None);
|
||||||
|
|
||||||
|
return new ScanStartResult(run.ScanId, targets.Count);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
Interlocked.Exchange(ref _running, 0);
|
||||||
|
Interlocked.Exchange(ref _cts, null)?.Dispose();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task AbortAsync()
|
||||||
|
{
|
||||||
|
var cts = Volatile.Read(ref _cts);
|
||||||
|
if (cts is null)
|
||||||
|
{
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!cts.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("收到扫描中止请求");
|
||||||
|
cts.Cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ObjectDisposedException)
|
||||||
|
{
|
||||||
|
// 扫描流程刚好结束并释放了取消源
|
||||||
|
}
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ExecuteAsync(RunContext context, CancellationToken ct)
|
||||||
|
{
|
||||||
|
var status = ScanStatus.Failed;
|
||||||
|
string? error = null;
|
||||||
|
var points = new List<ScanPointRecord>(context.Targets.Count);
|
||||||
|
var completedCount = 0;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Publish(context, ScanPhase.Homing, -1, 0, "位移台回零");
|
||||||
|
await MoveAndWaitAsync(context, 0, 0, ct);
|
||||||
|
|
||||||
|
for (var i = 0; i < context.Targets.Count; i++)
|
||||||
|
{
|
||||||
|
ct.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
var target = context.Targets[i];
|
||||||
|
var samplePoint = context.Sample.SamplingPoints[i];
|
||||||
|
var displayIndex = i + 1;
|
||||||
|
|
||||||
|
Publish(
|
||||||
|
context,
|
||||||
|
ScanPhase.Moving,
|
||||||
|
i,
|
||||||
|
completedCount,
|
||||||
|
$"移动到第 {displayIndex}/{context.Targets.Count} 个采样点");
|
||||||
|
|
||||||
|
await MoveAndWaitAsync(context, target.X, target.Y, ct);
|
||||||
|
|
||||||
|
ct.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
Publish(
|
||||||
|
context,
|
||||||
|
ScanPhase.Focusing,
|
||||||
|
i,
|
||||||
|
completedCount,
|
||||||
|
$"第 {displayIndex} 个采样点对焦中");
|
||||||
|
|
||||||
|
var focusResult = await FocusAndWaitAsync(context, ct);
|
||||||
|
if (!focusResult.IsSuccess)
|
||||||
|
{
|
||||||
|
var reason = focusResult.Describe();
|
||||||
|
|
||||||
|
_logger.LogWarning(
|
||||||
|
"第 {Index}/{Total} 个采样点对焦失败({Reason}),跳过该点",
|
||||||
|
displayIndex,
|
||||||
|
context.Targets.Count,
|
||||||
|
reason);
|
||||||
|
|
||||||
|
points.Add(new ScanPointRecord
|
||||||
|
{
|
||||||
|
ScanId = context.Run.ScanId,
|
||||||
|
Index = i,
|
||||||
|
PixelX = samplePoint.X,
|
||||||
|
PixelY = samplePoint.Y,
|
||||||
|
StageX = target.X,
|
||||||
|
StageY = target.Y,
|
||||||
|
Succeeded = false,
|
||||||
|
Error = $"对焦失败:{reason},已跳过该采样点",
|
||||||
|
AcquiredAt = DateTimeOffset.Now,
|
||||||
|
});
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ct.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
Publish(
|
||||||
|
context,
|
||||||
|
ScanPhase.Acquiring,
|
||||||
|
i,
|
||||||
|
completedCount,
|
||||||
|
$"第 {displayIndex} 个采样点收光中");
|
||||||
|
|
||||||
|
var merged = await AcquireAsync(context.Settings, ct);
|
||||||
|
var segments = merged.Segments
|
||||||
|
.Select(segment => new ScanSegmentRecord
|
||||||
|
{
|
||||||
|
DeviceIndex = segment.DeviceIndex,
|
||||||
|
SerialNumber = segment.SerialNumber,
|
||||||
|
WavelengthStart = segment.WavelengthStart,
|
||||||
|
WavelengthEnd = segment.WavelengthEnd,
|
||||||
|
PointCount = segment.PointCount,
|
||||||
|
})
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
|
var point = new ScanPointRecord
|
||||||
|
{
|
||||||
|
ScanId = context.Run.ScanId,
|
||||||
|
Index = i,
|
||||||
|
PixelX = samplePoint.X,
|
||||||
|
PixelY = samplePoint.Y,
|
||||||
|
StageX = target.X,
|
||||||
|
StageY = target.Y,
|
||||||
|
Succeeded = true,
|
||||||
|
Wavelengths = merged.Wavelengths,
|
||||||
|
Spectrum = merged.Spectrum,
|
||||||
|
Segments = segments,
|
||||||
|
AcquiredAt = DateTimeOffset.Now,
|
||||||
|
};
|
||||||
|
|
||||||
|
points.Add(point);
|
||||||
|
completedCount++;
|
||||||
|
Raise(
|
||||||
|
PointAcquired,
|
||||||
|
new ScanPointAcquired(
|
||||||
|
context.Run.ScanId,
|
||||||
|
i,
|
||||||
|
context.Targets.Count,
|
||||||
|
merged.Wavelengths,
|
||||||
|
merged.Spectrum,
|
||||||
|
segments,
|
||||||
|
point.AcquiredAt));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 全部点采集完成:回零与逐点分析/写库并行。
|
||||||
|
Publish(context, ScanPhase.Returning, -1, completedCount, "位移台回零");
|
||||||
|
var homeTask = MoveAndWaitSafeAsync(context, 0, 0);
|
||||||
|
|
||||||
|
Publish(context, ScanPhase.Analyzing, -1, completedCount, "NIST 元素分析中");
|
||||||
|
AnalyzePoints(points, ct);
|
||||||
|
|
||||||
|
ct.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
Publish(context, ScanPhase.Writing, -1, completedCount, "写入数据库");
|
||||||
|
context.Run.CompletedPoints = completedCount;
|
||||||
|
context.Run.Status = ScanStatus.Completed;
|
||||||
|
context.Run.FinishedAt = DateTimeOffset.Now;
|
||||||
|
_dataStore.SaveCompleted(context.Run, points);
|
||||||
|
|
||||||
|
await homeTask;
|
||||||
|
status = ScanStatus.Completed;
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException)
|
||||||
|
{
|
||||||
|
status = ScanStatus.Aborted;
|
||||||
|
error = "扫描已中止";
|
||||||
|
_logger.LogInformation("扫描已中止:{ScanId}", context.Run.ScanId);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
status = ScanStatus.Failed;
|
||||||
|
error = ex.Message;
|
||||||
|
_logger.LogError(ex, "扫描失败:{ScanId}", context.Run.ScanId);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (status != ScanStatus.Completed)
|
||||||
|
{
|
||||||
|
// 中止或失败:丢弃内存数据,尽量让位移台回零。
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await EnsureHomedAsync(context.Settings);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(ex, "扫描中止后回零失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
context.Run.Status = status;
|
||||||
|
context.Run.Error = error;
|
||||||
|
context.Run.FinishedAt ??= DateTimeOffset.Now;
|
||||||
|
|
||||||
|
var phase = status switch
|
||||||
|
{
|
||||||
|
ScanStatus.Completed => ScanPhase.Completed,
|
||||||
|
ScanStatus.Aborted => ScanPhase.Aborted,
|
||||||
|
_ => ScanPhase.Failed,
|
||||||
|
};
|
||||||
|
|
||||||
|
Publish(context, phase, -1, points.Count, error ?? "扫描完成");
|
||||||
|
|
||||||
|
Raise(Finished, new ScanRunSummary(context.Run.ScanId, status, error));
|
||||||
|
|
||||||
|
Interlocked.Exchange(ref _running, 0);
|
||||||
|
Interlocked.Exchange(ref _cts, null)?.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task MoveAndWaitAsync(
|
||||||
|
RunContext context,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
CancellationToken ct)
|
||||||
|
{
|
||||||
|
await _stage.MoveAbsoluteAsync(
|
||||||
|
new AxisStagePoint(x, y, 0),
|
||||||
|
context.Settings.MoveSpeed,
|
||||||
|
context.Settings.MoveAccel,
|
||||||
|
ct);
|
||||||
|
|
||||||
|
var deadline = DateTimeOffset.UtcNow + StageTimeout;
|
||||||
|
|
||||||
|
while (DateTimeOffset.UtcNow < deadline)
|
||||||
|
{
|
||||||
|
ct.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
AxisStageStatus stageStatus;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
stageStatus = await _stage.ReadStatusAsync(StageStatusTimeoutMs, ct);
|
||||||
|
}
|
||||||
|
catch (HardwareException ex) when (ex.Kind == HardwareErrorKind.Timeout)
|
||||||
|
{
|
||||||
|
await Task.Delay(StagePollInterval, ct);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateStageStatus(stageStatus);
|
||||||
|
|
||||||
|
if (!stageStatus.AnyMoving &&
|
||||||
|
stageStatus.XPosition == x &&
|
||||||
|
stageStatus.YPosition == y)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await Task.Delay(StagePollInterval, ct);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.Timeout,
|
||||||
|
$"位移台移动到 ({x}, {y}) 超时({StageTimeout.TotalSeconds:0}s)");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task MoveAndWaitSafeAsync(RunContext context, int x, int y)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var cts = new CancellationTokenSource(StageTimeout + TimeSpan.FromSeconds(5));
|
||||||
|
await MoveAndWaitAsync(context, x, y, cts.Token);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(ex, "位移台回零失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行一次单次对焦。动态库内部已完成测距光源开关与对焦动作,
|
||||||
|
/// 这里只需等待返回值:设备侧失败或等待超时返回非成功结果,由调用方跳过该点;
|
||||||
|
/// 句柄为空、串口未打开属于连接级故障,直接抛出异常中止扫描。
|
||||||
|
/// </summary>
|
||||||
|
private async Task<FocusSingleResult> FocusAndWaitAsync(
|
||||||
|
RunContext context,
|
||||||
|
CancellationToken ct)
|
||||||
|
{
|
||||||
|
var result = await _focus.FocusSingleAndWaitAsync(
|
||||||
|
context.Settings.FocusTimeout,
|
||||||
|
ct);
|
||||||
|
|
||||||
|
if (result.IsSuccess)
|
||||||
|
{
|
||||||
|
_logger.LogInformation(
|
||||||
|
"对焦完成,耗时 {Elapsed}ms",
|
||||||
|
(long)result.Elapsed.TotalMilliseconds);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.Outcome is FocusSingleOutcome.NullHandle
|
||||||
|
or FocusSingleOutcome.ComNotOpen)
|
||||||
|
{
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.NotConnected,
|
||||||
|
$"对焦失败:{result.Describe()}");
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<MergedSpectrum> AcquireAsync(
|
||||||
|
ScanSettings settings,
|
||||||
|
CancellationToken ct)
|
||||||
|
{
|
||||||
|
var result = await _spectrometer.AcquireSynchronizedAsync(
|
||||||
|
new SynchronizedSpectrumRequest
|
||||||
|
{
|
||||||
|
ExposureUs = settings.ExposureUs,
|
||||||
|
Averaging = settings.Averaging,
|
||||||
|
DelayUs = settings.DelayUs,
|
||||||
|
WaitTimeoutMs = settings.WaitTimeoutMs,
|
||||||
|
},
|
||||||
|
ct);
|
||||||
|
|
||||||
|
if (!result.IsComplete)
|
||||||
|
{
|
||||||
|
var missing = result.MissingSerials.Count == 0
|
||||||
|
? "未知设备"
|
||||||
|
: string.Join("、", result.MissingSerials);
|
||||||
|
|
||||||
|
throw new HardwareException(
|
||||||
|
HardwareErrorKind.CommunicationFailed,
|
||||||
|
$"光谱采集不完整,缺失设备:{missing}");
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.Merged;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AnalyzePoints(
|
||||||
|
IReadOnlyList<ScanPointRecord> points,
|
||||||
|
CancellationToken ct)
|
||||||
|
{
|
||||||
|
foreach (var point in points)
|
||||||
|
{
|
||||||
|
ct.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
// 跳过因测距无效而采集失败的点。
|
||||||
|
if (!point.Succeeded)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = _analysis.Analyze(
|
||||||
|
point.Wavelengths,
|
||||||
|
point.Spectrum,
|
||||||
|
point.Segments);
|
||||||
|
|
||||||
|
point.Elements = result.Elements.ToList();
|
||||||
|
point.Temperature = result.Temperature;
|
||||||
|
point.ElectronDensity = result.ElectronDensity;
|
||||||
|
|
||||||
|
// 单点分析失败只记录错误,继续处理后续点。
|
||||||
|
if (!string.IsNullOrWhiteSpace(result.Error))
|
||||||
|
{
|
||||||
|
point.Error = result.Error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task EnsureHomedAsync(ScanSettings settings)
|
||||||
|
{
|
||||||
|
if (!_stage.IsConnected)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(40));
|
||||||
|
|
||||||
|
// 先等待当前运动结束,再下发回零,避免与正在执行的移动命令冲突。
|
||||||
|
var deadline = DateTimeOffset.UtcNow + StageTimeout;
|
||||||
|
while (DateTimeOffset.UtcNow < deadline)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var status = await _stage.ReadStatusAsync(StageStatusTimeoutMs, cts.Token);
|
||||||
|
UpdateStageStatus(status);
|
||||||
|
if (!status.AnyMoving)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (HardwareException ex) when (ex.Kind == HardwareErrorKind.Timeout)
|
||||||
|
{
|
||||||
|
// 忽略超时,继续尝试
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await Task.Delay(StagePollInterval, cts.Token);
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await _stage.MoveAbsoluteAsync(
|
||||||
|
AxisStagePoint.Zero,
|
||||||
|
settings.MoveSpeed,
|
||||||
|
settings.MoveAccel,
|
||||||
|
cts.Token);
|
||||||
|
|
||||||
|
var homeDeadline = DateTimeOffset.UtcNow + StageTimeout;
|
||||||
|
while (DateTimeOffset.UtcNow < homeDeadline)
|
||||||
|
{
|
||||||
|
AxisStageStatus status;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
status = await _stage.ReadStatusAsync(StageStatusTimeoutMs, cts.Token);
|
||||||
|
}
|
||||||
|
catch (HardwareException ex) when (ex.Kind == HardwareErrorKind.Timeout)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateStageStatus(status);
|
||||||
|
if (!status.AnyMoving &&
|
||||||
|
status.XPosition == 0 &&
|
||||||
|
status.YPosition == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await Task.Delay(StagePollInterval, cts.Token);
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateStageStatus(AxisStageStatus status)
|
||||||
|
{
|
||||||
|
_lastStageX = status.XPosition;
|
||||||
|
_lastStageY = status.YPosition;
|
||||||
|
_lastStageMoving = status.AnyMoving;
|
||||||
|
|
||||||
|
Raise(
|
||||||
|
StagePositionChanged,
|
||||||
|
new StagePosition(
|
||||||
|
status.XPosition,
|
||||||
|
status.YPosition,
|
||||||
|
status.ZPosition,
|
||||||
|
status.AnyMoving,
|
||||||
|
DateTimeOffset.Now));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Publish(
|
||||||
|
RunContext context,
|
||||||
|
ScanPhase phase,
|
||||||
|
int pointIndex,
|
||||||
|
int completedPoints,
|
||||||
|
string message)
|
||||||
|
{
|
||||||
|
var percent = phase switch
|
||||||
|
{
|
||||||
|
ScanPhase.Idle => 0,
|
||||||
|
ScanPhase.Homing => 2,
|
||||||
|
ScanPhase.Moving or ScanPhase.Focusing or ScanPhase.Acquiring =>
|
||||||
|
context.Targets.Count == 0
|
||||||
|
? 0
|
||||||
|
: (int)Math.Round(
|
||||||
|
Math.Max(pointIndex, 0) * 90.0 / context.Targets.Count),
|
||||||
|
ScanPhase.Returning => 90,
|
||||||
|
ScanPhase.Analyzing => 94,
|
||||||
|
ScanPhase.Writing => 98,
|
||||||
|
ScanPhase.Completed => 100,
|
||||||
|
_ => 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
var progress = new ScanProgress(
|
||||||
|
context.Run.ScanId,
|
||||||
|
phase,
|
||||||
|
pointIndex,
|
||||||
|
context.Targets.Count,
|
||||||
|
completedPoints,
|
||||||
|
percent,
|
||||||
|
message,
|
||||||
|
_lastStageX,
|
||||||
|
_lastStageY,
|
||||||
|
_lastStageMoving,
|
||||||
|
DateTimeOffset.Now);
|
||||||
|
|
||||||
|
_current = progress;
|
||||||
|
Raise(ProgressChanged, progress);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Raise<T>(EventHandler<T>? handler, T payload)
|
||||||
|
{
|
||||||
|
if (handler is null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
handler(this, payload);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(ex, "扫描事件回调失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string BuildScanId() =>
|
||||||
|
$"{DateTimeOffset.Now:yyyyMMddHHmmss}-{Guid.NewGuid():N}"[..21];
|
||||||
|
|
||||||
|
private sealed record RunContext(
|
||||||
|
ScanRunRecord Run,
|
||||||
|
SampleAnalysisResult Sample,
|
||||||
|
IReadOnlyList<StageTarget> Targets,
|
||||||
|
ScanSettings Settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,257 @@
|
|||||||
|
using CfLibs;
|
||||||
|
using HardwareControl.Core.Spectrometer;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace HardwareControl.Core.Scanning
|
||||||
|
{
|
||||||
|
/// <summary>单个采样点的 NIST 定性/定量分析结果。</summary>
|
||||||
|
public sealed record PointAnalysisResult(
|
||||||
|
IReadOnlyList<ScanElementRecord> Elements,
|
||||||
|
double Temperature,
|
||||||
|
double ElectronDensity,
|
||||||
|
string? Error);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// NIST 谱线库分析封装:每个采样点独立执行 Identify(定性)+ Quantify(定量)。
|
||||||
|
/// 拼接光谱的段边界处不参与寻峰,避免接缝被识别成伪峰。
|
||||||
|
/// </summary>
|
||||||
|
public sealed class SpectrumAnalysisService
|
||||||
|
{
|
||||||
|
private readonly CfLibsIdentifier _identifier;
|
||||||
|
private readonly ILogger<SpectrumAnalysisService> _logger;
|
||||||
|
private readonly object _gate = new();
|
||||||
|
private readonly bool _dataReady;
|
||||||
|
|
||||||
|
public SpectrumAnalysisService(
|
||||||
|
string? dataPath,
|
||||||
|
ILogger<SpectrumAnalysisService> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
var path = string.IsNullOrWhiteSpace(dataPath)
|
||||||
|
? Path.Combine(AppContext.BaseDirectory, "db")
|
||||||
|
: dataPath;
|
||||||
|
|
||||||
|
_identifier = new CfLibsIdentifier();
|
||||||
|
_identifier.SetDataPath(path);
|
||||||
|
// 光栅修正使用 600c(gratingNo = 1)
|
||||||
|
_identifier.SetGratingNo(1);
|
||||||
|
_identifier.SetMatchTolerance(0.5);
|
||||||
|
_identifier.EnableGratingFix(true);
|
||||||
|
_identifier.Log = message => _logger.LogDebug("CfLibs: {Message}", message);
|
||||||
|
|
||||||
|
_dataReady =
|
||||||
|
File.Exists(Path.Combine(path, "element_lines.txt")) &&
|
||||||
|
File.Exists(Path.Combine(path, "nist_full_lines.txt"));
|
||||||
|
|
||||||
|
if (_dataReady)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("NIST 谱线库目录:{Path}", path);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogError(
|
||||||
|
"NIST 谱线库不完整,扫描结果将无法分析。请确认 {Path} 下存在 element_lines.txt 与 nist_full_lines.txt",
|
||||||
|
path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public PointAnalysisResult Analyze(
|
||||||
|
float[] wavelengths,
|
||||||
|
float[] spectrum,
|
||||||
|
IReadOnlyList<ScanSegmentRecord> segments)
|
||||||
|
{
|
||||||
|
if (!_dataReady)
|
||||||
|
{
|
||||||
|
return new PointAnalysisResult(
|
||||||
|
Array.Empty<ScanElementRecord>(),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
"NIST 谱线库文件缺失,无法分析元素");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wavelengths.Length == 0 || wavelengths.Length != spectrum.Length)
|
||||||
|
{
|
||||||
|
return new PointAnalysisResult(
|
||||||
|
Array.Empty<ScanElementRecord>(),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
"光谱数据为空或波长/强度长度不一致");
|
||||||
|
}
|
||||||
|
|
||||||
|
var raw = new RawSpectrum();
|
||||||
|
raw.Points.Capacity = wavelengths.Length;
|
||||||
|
for (var i = 0; i < wavelengths.Length; i++)
|
||||||
|
{
|
||||||
|
raw.Points.Add(new SpectrumPoint
|
||||||
|
{
|
||||||
|
Wavelength = wavelengths[i],
|
||||||
|
Intensity = spectrum[i],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var boundaries = BuildBoundaries(segments, wavelengths.Length);
|
||||||
|
|
||||||
|
lock (_gate)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var identify = _identifier.Identify(raw, boundaries, out var lines);
|
||||||
|
if (identify != 0 || lines is null)
|
||||||
|
{
|
||||||
|
return new PointAnalysisResult(
|
||||||
|
Array.Empty<ScanElementRecord>(),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
"NIST 定性分析失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lines.Lines.Count == 0)
|
||||||
|
{
|
||||||
|
// 没有匹配到有效谱线不算异常,结果页显示“未检出元素”。
|
||||||
|
return new PointAnalysisResult(
|
||||||
|
Array.Empty<ScanElementRecord>(),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
null);
|
||||||
|
}
|
||||||
|
|
||||||
|
var quantified = _identifier.Quantify(lines, out var result) == 0
|
||||||
|
? result
|
||||||
|
: null;
|
||||||
|
|
||||||
|
return BuildResult(lines, quantified);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(ex, "NIST 分析失败");
|
||||||
|
return new PointAnalysisResult(
|
||||||
|
Array.Empty<ScanElementRecord>(),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
$"NIST 分析失败:{ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PointAnalysisResult BuildResult(
|
||||||
|
SpectralLines lines,
|
||||||
|
Result? quantified)
|
||||||
|
{
|
||||||
|
var groups = lines.Lines
|
||||||
|
.GroupBy(line => line.Element, StringComparer.OrdinalIgnoreCase)
|
||||||
|
.ToDictionary(
|
||||||
|
group => group.Key,
|
||||||
|
group => group.ToList(),
|
||||||
|
StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
var abundances = new Dictionary<string, ElementResult>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
if (quantified?.Elements is not null)
|
||||||
|
{
|
||||||
|
foreach (var element in quantified.Elements)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(element.Element))
|
||||||
|
{
|
||||||
|
abundances[element.Element] = element;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var globalMaxIntensity = groups.Values
|
||||||
|
.SelectMany(list => list)
|
||||||
|
.Select(line => line.Intensity)
|
||||||
|
.DefaultIfEmpty(0)
|
||||||
|
.Max();
|
||||||
|
|
||||||
|
var elements = new List<ScanElementRecord>(groups.Count + abundances.Count);
|
||||||
|
|
||||||
|
foreach (var (symbol, matched) in groups)
|
||||||
|
{
|
||||||
|
var strongest = matched
|
||||||
|
.OrderByDescending(line => line.Intensity)
|
||||||
|
.First();
|
||||||
|
|
||||||
|
abundances.TryGetValue(symbol, out var quantifiedElement);
|
||||||
|
|
||||||
|
var abundance = quantifiedElement?.Abundance ?? 0;
|
||||||
|
var ratio = globalMaxIntensity <= 0
|
||||||
|
? 0
|
||||||
|
: strongest.Intensity / globalMaxIntensity;
|
||||||
|
|
||||||
|
elements.Add(new ScanElementRecord
|
||||||
|
{
|
||||||
|
Symbol = symbol,
|
||||||
|
Name = ElementNames.GetChineseName(symbol),
|
||||||
|
IntensityLevel = ratio >= 0.6 ? "高" : ratio >= 0.2 ? "中" : "低",
|
||||||
|
Abundance = abundance,
|
||||||
|
RawAbundance = quantifiedElement?.RawAbundance ?? 0,
|
||||||
|
// 含量 ≥ 0.5% 记为检出,其余记为痕量(与界面示例一致)。
|
||||||
|
Verdict = abundance >= 0.5 ? "检出" : "痕量",
|
||||||
|
MaxIntensity = strongest.Intensity,
|
||||||
|
MatchedWavelength = strongest.WavelengthSource,
|
||||||
|
MatchedLines = matched.Count,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 定量结果中存在、但没有进入匹配谱线列表的元素(正常不会出现)也一并返回。
|
||||||
|
foreach (var (symbol, element) in abundances)
|
||||||
|
{
|
||||||
|
if (groups.ContainsKey(symbol))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
elements.Add(new ScanElementRecord
|
||||||
|
{
|
||||||
|
Symbol = symbol,
|
||||||
|
Name = ElementNames.GetChineseName(symbol),
|
||||||
|
IntensityLevel = "低",
|
||||||
|
Abundance = element.Abundance,
|
||||||
|
RawAbundance = element.RawAbundance,
|
||||||
|
Verdict = element.Abundance >= 0.5 ? "检出" : "痕量",
|
||||||
|
MaxIntensity = 0,
|
||||||
|
MatchedWavelength = 0,
|
||||||
|
MatchedLines = 0,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
elements.Sort((left, right) =>
|
||||||
|
{
|
||||||
|
var byAbundance = right.Abundance.CompareTo(left.Abundance);
|
||||||
|
return byAbundance != 0
|
||||||
|
? byAbundance
|
||||||
|
: right.MaxIntensity.CompareTo(left.MaxIntensity);
|
||||||
|
});
|
||||||
|
|
||||||
|
return new PointAnalysisResult(
|
||||||
|
elements,
|
||||||
|
quantified?.Temperature ?? 0,
|
||||||
|
quantified?.ElectronDensity ?? 0,
|
||||||
|
null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>把拼接光谱的段长度换算成寻峰时要跳过的边界索引。</summary>
|
||||||
|
private static int[] BuildBoundaries(
|
||||||
|
IReadOnlyList<ScanSegmentRecord> segments,
|
||||||
|
int pointCount)
|
||||||
|
{
|
||||||
|
if (segments.Count <= 1)
|
||||||
|
{
|
||||||
|
return Array.Empty<int>();
|
||||||
|
}
|
||||||
|
|
||||||
|
var boundaries = new List<int>(segments.Count - 1);
|
||||||
|
var offset = 0;
|
||||||
|
|
||||||
|
for (var i = 0; i < segments.Count - 1; i++)
|
||||||
|
{
|
||||||
|
offset += segments[i].PointCount;
|
||||||
|
if (offset > 0 && offset < pointCount)
|
||||||
|
{
|
||||||
|
boundaries.Add(offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return boundaries.Distinct().ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
namespace HardwareControl.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 串口名规范化。原生库要求 Windows 设备路径 "\\.\COMx",
|
||||||
|
/// 同时兼容用户在系统参数里只填写 "COM5" 的情况。
|
||||||
|
/// </summary>
|
||||||
|
internal static class SerialPortNames
|
||||||
|
{
|
||||||
|
internal static string Normalize(string port)
|
||||||
|
{
|
||||||
|
var value = port.Trim();
|
||||||
|
|
||||||
|
if (value.StartsWith(@"\\.\", StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value.StartsWith("COM", StringComparison.OrdinalIgnoreCase) &&
|
||||||
|
int.TryParse(value.AsSpan(3), out _))
|
||||||
|
{
|
||||||
|
return @"\\.\" + value.ToUpperInvariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
using Aris;
|
|
||||||
|
|
||||||
namespace HardwareControl.Core.Spectrometer
|
namespace HardwareControl.Core.Spectrometer
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -30,41 +28,34 @@ namespace HardwareControl.Core.Spectrometer
|
|||||||
public int DelayUs { get; set; }
|
public int DelayUs { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 单帧采集默认超时,单位毫秒;小于等于 0 时由 SDK 按
|
/// 单帧采集默认超时,单位毫秒;小于等于 0 时按
|
||||||
/// <c>max(3000, 曝光/1000 + 2000)</c> 计算。
|
/// <c>max(3000, 曝光/1000 + 2000)</c> 计算。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int TimeoutMs { get; set; }
|
public int TimeoutMs { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 多台同步采集的默认曝光时间,单位微秒。
|
/// 多台同步采集的默认曝光时间,单位微秒。
|
||||||
/// SDK 逐台武装设备,第三台通常比前两台晚约 0.6 秒启动;
|
/// 参数在连接时预配置,采集时三台设备只发启动命令(间隔约 1 ms),
|
||||||
/// 曝光窗口必须覆盖这段武装时间,否则前两台会在第三台触发激光前结束。
|
/// 因此 100 ms 曝光即可覆盖全部设备,不再需要覆盖“逐台武装”的长曝光窗口。
|
||||||
/// 默认 1 秒,可按现场时序下调,但建议不低于 0.7 秒。
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int SynchronizedExposureUs { get; set; } = 1_000_000;
|
public int SynchronizedExposureUs { get; set; } = 100_000;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 多台同步采集时,StartMeasurement 返回后等待所有设备回调的默认最长时间(毫秒)。
|
/// 多台同步采集时,启动后等待所有设备出帧的默认最长时间(毫秒)。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int SynchronizedWaitTimeoutMs { get; set; } = 8000;
|
public int SynchronizedWaitTimeoutMs { get; set; } = 8000;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 连接成功后设置的触发模式;为 null 时保持设备当前配置。
|
/// 连接成功后设置的触发模式;为 null 时保持设备当前配置。
|
||||||
/// 手册要求触发模式只在连接后设置一次。
|
/// 默认 <see cref="SpectrometerTriggerMode.Software"/>:自由运行。
|
||||||
/// 默认 <see cref="Aris.TriggerMode.Software"/>:纯自由运行。
|
|
||||||
/// 由第三台设备触发激光、其余设备自由收光的场景使用 Software;
|
/// 由第三台设备触发激光、其余设备自由收光的场景使用 Software;
|
||||||
/// 有外部 AD/TTL 触发源时改为 FreeRunEdge 或 External。
|
/// 有外部 AD/TTL 触发源时改为 External;FreeRunEdge 对应自由运行的开始触发脉冲。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TriggerMode? TriggerMode { get; set; } = Aris.TriggerMode.Software;
|
public SpectrometerTriggerMode? TriggerMode { get; set; } = SpectrometerTriggerMode.Software;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 连接成功后设置的增益(0=低增益,1=高增益);为 null 时保持设备当前配置。
|
/// 连接成功后设置的增益(0=低增益,1=高增益);为 null 时保持设备当前配置。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? Gain { get; set; }
|
public int? Gain { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否打开 aris.dll 内部的诊断日志(默认关闭,避免刷屏)。
|
|
||||||
/// </summary>
|
|
||||||
public bool SdkLogEnabled { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
namespace HardwareControl.Core.Spectrometer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Aris 光谱仪的触发模式。
|
||||||
|
/// 名称与 aris C API 保持一致,appsettings.json 仍可直接写 "Software" / "External" / "FreeRunEdge"。
|
||||||
|
/// </summary>
|
||||||
|
public enum SpectrometerTriggerMode
|
||||||
|
{
|
||||||
|
/// <summary>自由运行,内部定时启动曝光(对应设备 FreeRunningTriggerEnd)。</summary>
|
||||||
|
Software = 0,
|
||||||
|
|
||||||
|
/// <summary>硬件触发:等待 Trigger In 上升沿(对应设备 HardwareTrigger)。</summary>
|
||||||
|
External = 1,
|
||||||
|
|
||||||
|
/// <summary>自由运行,开始时输出触发脉冲(对应设备 FreeRunningTriggerStart)。</summary>
|
||||||
|
FreeRunEdge = 2,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,8 +9,8 @@ namespace HardwareControl.Core.Spectrometer
|
|||||||
/// <param name="Errors">测量过程中 SDK 上报的设备错误。</param>
|
/// <param name="Errors">测量过程中 SDK 上报的设备错误。</param>
|
||||||
/// <param name="ExpectedDeviceCount">本次期望采集的设备数。</param>
|
/// <param name="ExpectedDeviceCount">本次期望采集的设备数。</param>
|
||||||
/// <param name="AcquiredAt">采集完成的主机本地时间。</param>
|
/// <param name="AcquiredAt">采集完成的主机本地时间。</param>
|
||||||
/// <param name="StartElapsed">StartMeasurement 武装设备所耗时间。</param>
|
/// <param name="StartElapsed">预配置参数并向所有设备发送启动命令所耗时间。</param>
|
||||||
/// <param name="WaitElapsed">等待设备回调所耗时间。</param>
|
/// <param name="WaitElapsed">等待所有设备出帧所耗时间。</param>
|
||||||
public sealed record SynchronizedSpectrumResult(
|
public sealed record SynchronizedSpectrumResult(
|
||||||
IReadOnlyList<SynchronizedSpectrumFrame> Frames,
|
IReadOnlyList<SynchronizedSpectrumFrame> Frames,
|
||||||
MergedSpectrum Merged,
|
MergedSpectrum Merged,
|
||||||
|
|||||||
@@ -0,0 +1,465 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using Microsoft.Win32.SafeHandles;
|
||||||
|
|
||||||
|
namespace HardwareControl.Core.Spectrometer.ZioLink
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Aris 光谱仪的 WinUSB 连接(与官方 Inspective 使用同一驱动与接口 GUID)。
|
||||||
|
/// 只负责 USB 管道读写,协议层见 <see cref="ZioLinkDevice"/>。
|
||||||
|
/// </summary>
|
||||||
|
internal sealed class WinUsbConnection : IDisposable
|
||||||
|
{
|
||||||
|
// GUID_DEVINTERFACE_USB_DEVICE,官方软件用它枚举全部 USB 设备后再按 VID/PID 过滤
|
||||||
|
private static readonly Guid UsbDeviceInterfaceGuid =
|
||||||
|
new Guid("a5dcbf10-6530-11d2-901f-00c04fb951ed");
|
||||||
|
|
||||||
|
private const uint GENERIC_READ = 0x80000000;
|
||||||
|
private const uint GENERIC_WRITE = 0x40000000;
|
||||||
|
private const uint FILE_SHARE_READ = 1;
|
||||||
|
private const uint FILE_SHARE_WRITE = 2;
|
||||||
|
private const uint OPEN_EXISTING = 3;
|
||||||
|
private const uint FILE_ATTRIBUTE_NORMAL = 0x80;
|
||||||
|
private const uint FILE_FLAG_OVERLAPPED = 0x40000000;
|
||||||
|
|
||||||
|
private const int DIGCF_PRESENT = 0x02;
|
||||||
|
private const int DIGCF_DEVICEINTERFACE = 0x10;
|
||||||
|
|
||||||
|
private const uint POLICY_SHORT_PACKET_TERMINATE = 1;
|
||||||
|
private const uint POLICY_PIPE_TRANSFER_TIMEOUT = 3;
|
||||||
|
|
||||||
|
private readonly string _devicePath;
|
||||||
|
private SafeFileHandle? _deviceHandle;
|
||||||
|
private IntPtr _winUsbHandle;
|
||||||
|
private byte _inPipe;
|
||||||
|
private byte _outPipe;
|
||||||
|
|
||||||
|
public string DevicePath => _devicePath;
|
||||||
|
|
||||||
|
public string Manufacturer { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Product { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
public string SerialNumber { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
public bool IsOpen => _winUsbHandle != IntPtr.Zero;
|
||||||
|
|
||||||
|
private WinUsbConnection(string devicePath)
|
||||||
|
{
|
||||||
|
_devicePath = devicePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>枚举所有 Avenir 光谱仪的 WinUSB 接口路径。</summary>
|
||||||
|
public static string[] FindDevicePaths()
|
||||||
|
{
|
||||||
|
var results = new List<string>();
|
||||||
|
var guid = UsbDeviceInterfaceGuid;
|
||||||
|
var deviceInfoSet = SetupDiGetClassDevs(
|
||||||
|
ref guid, IntPtr.Zero, IntPtr.Zero, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
|
||||||
|
|
||||||
|
if (deviceInfoSet == IntPtr.Zero || deviceInfoSet == new IntPtr(-1))
|
||||||
|
{
|
||||||
|
return Array.Empty<string>();
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var interfaceData = new SpDeviceInterfaceData
|
||||||
|
{
|
||||||
|
cbSize = Marshal.SizeOf<SpDeviceInterfaceData>(),
|
||||||
|
};
|
||||||
|
|
||||||
|
for (uint index = 0;
|
||||||
|
SetupDiEnumDeviceInterfaces(
|
||||||
|
deviceInfoSet, IntPtr.Zero, ref guid, index, ref interfaceData);
|
||||||
|
index++)
|
||||||
|
{
|
||||||
|
SetupDiGetDeviceInterfaceDetail(
|
||||||
|
deviceInfoSet, ref interfaceData, IntPtr.Zero, 0, out var requiredSize, IntPtr.Zero);
|
||||||
|
|
||||||
|
if (requiredSize <= 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var detail = Marshal.AllocHGlobal(requiredSize);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// x64: 8;x86: 4 + sizeof(WCHAR)
|
||||||
|
Marshal.WriteInt32(detail, IntPtr.Size == 8 ? 8 : 6);
|
||||||
|
|
||||||
|
if (!SetupDiGetDeviceInterfaceDetail(
|
||||||
|
deviceInfoSet, ref interfaceData, detail, requiredSize, out _, IntPtr.Zero))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var path = Marshal.PtrToStringUni(IntPtr.Add(detail, 4));
|
||||||
|
if (string.IsNullOrWhiteSpace(path))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 官方软件同样按 vid_354f&pid_01 过滤,并排除 DFU 接口 pid_0103
|
||||||
|
if (path.Contains("vid_354f&pid_01", StringComparison.OrdinalIgnoreCase)
|
||||||
|
&& !path.Contains("pid_0103", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
results.Add(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Marshal.FreeHGlobal(detail);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
SetupDiDestroyDeviceInfoList(deviceInfoSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
results.Sort(StringComparer.OrdinalIgnoreCase);
|
||||||
|
return results.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static WinUsbConnection Open(
|
||||||
|
string devicePath,
|
||||||
|
uint readTimeoutMs = 2000,
|
||||||
|
uint writeTimeoutMs = 500)
|
||||||
|
{
|
||||||
|
var connection = new WinUsbConnection(devicePath);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
connection.OpenCore(readTimeoutMs, writeTimeoutMs);
|
||||||
|
return connection;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
connection.Dispose();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OpenCore(uint readTimeoutMs, uint writeTimeoutMs)
|
||||||
|
{
|
||||||
|
_deviceHandle = CreateFile(
|
||||||
|
_devicePath,
|
||||||
|
GENERIC_READ | GENERIC_WRITE,
|
||||||
|
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||||
|
IntPtr.Zero,
|
||||||
|
OPEN_EXISTING,
|
||||||
|
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
|
||||||
|
IntPtr.Zero);
|
||||||
|
|
||||||
|
if (_deviceHandle.IsInvalid)
|
||||||
|
{
|
||||||
|
var error = Marshal.GetLastWin32Error();
|
||||||
|
throw new ZioLinkException(
|
||||||
|
0,
|
||||||
|
$"无法打开光谱仪 {_devicePath}(Win32 错误 {error})。"
|
||||||
|
+ "设备可能正被 Inspective 或其他程序占用。");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!WinUsb_Initialize(_deviceHandle, out _winUsbHandle) || _winUsbHandle == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
var error = Marshal.GetLastWin32Error();
|
||||||
|
throw new ZioLinkException(0, $"初始化 WinUSB 失败(Win32 错误 {error})");
|
||||||
|
}
|
||||||
|
|
||||||
|
UsbInterfaceDescriptor interfaceDescriptor = default;
|
||||||
|
if (!WinUsb_QueryInterfaceSettings(_winUsbHandle, 0, ref interfaceDescriptor))
|
||||||
|
{
|
||||||
|
throw new ZioLinkException(0, "读取 WinUSB 接口描述符失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < interfaceDescriptor.bNumEndpoints; i++)
|
||||||
|
{
|
||||||
|
var pipe = default(WinUsbPipeInformation);
|
||||||
|
if (!WinUsb_QueryPipe(_winUsbHandle, 0, (byte)i, ref pipe))
|
||||||
|
{
|
||||||
|
throw new ZioLinkException(0, "查询 WinUSB 管道失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((pipe.PipeId & 0x80) != 0)
|
||||||
|
{
|
||||||
|
_inPipe = pipe.PipeId;
|
||||||
|
SetTimeout(pipe.PipeId, readTimeoutMs);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_outPipe = pipe.PipeId;
|
||||||
|
SetTimeout(pipe.PipeId, writeTimeoutMs);
|
||||||
|
|
||||||
|
var enable = 1u;
|
||||||
|
WinUsb_SetPipePolicy(
|
||||||
|
_winUsbHandle, pipe.PipeId, POLICY_SHORT_PACKET_TERMINATE, sizeof(uint), ref enable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_inPipe == 0 || _outPipe == 0)
|
||||||
|
{
|
||||||
|
throw new ZioLinkException(0, "未找到光谱仪的 USB 批量端点");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 用设备描述符里的 iManufacturer / iProduct / iSerialNumber 读取字符串
|
||||||
|
var languageId = ReadLanguageId();
|
||||||
|
var deviceDescriptor = ReadDeviceDescriptor();
|
||||||
|
Manufacturer = ReadStringDescriptor(deviceDescriptor.iManufacturer, languageId);
|
||||||
|
Product = ReadStringDescriptor(deviceDescriptor.iProduct, languageId);
|
||||||
|
SerialNumber = ReadStringDescriptor(deviceDescriptor.iSerialNumber, languageId);
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(SerialNumber))
|
||||||
|
{
|
||||||
|
SerialNumber = Path.GetFileNameWithoutExtension(_devicePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetTimeout(byte pipeId, uint timeoutMs)
|
||||||
|
{
|
||||||
|
var value = timeoutMs;
|
||||||
|
WinUsb_SetPipePolicy(
|
||||||
|
_winUsbHandle, pipeId, POLICY_PIPE_TRANSFER_TIMEOUT, sizeof(uint), ref value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Write(byte[] buffer, int count)
|
||||||
|
{
|
||||||
|
ThrowIfClosed();
|
||||||
|
|
||||||
|
if (!WinUsb_WritePipe(
|
||||||
|
_winUsbHandle, _outPipe, buffer, (uint)count, out _, IntPtr.Zero))
|
||||||
|
{
|
||||||
|
var error = Marshal.GetLastWin32Error();
|
||||||
|
throw new ZioLinkException(0, $"USB 写入失败(Win32 错误 {error})");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Read(byte[] buffer, int count)
|
||||||
|
{
|
||||||
|
ThrowIfClosed();
|
||||||
|
|
||||||
|
if (!WinUsb_ReadPipe(
|
||||||
|
_winUsbHandle, _inPipe, buffer, (uint)count, out var transferred, IntPtr.Zero))
|
||||||
|
{
|
||||||
|
var error = Marshal.GetLastWin32Error();
|
||||||
|
if (error == 121)
|
||||||
|
{
|
||||||
|
throw new ZioLinkException(0, "USB 读取超时,设备未响应");
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ZioLinkException(0, $"USB 读取失败(Win32 错误 {error})");
|
||||||
|
}
|
||||||
|
|
||||||
|
return (int)transferred;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ThrowIfClosed()
|
||||||
|
{
|
||||||
|
if (!IsOpen)
|
||||||
|
{
|
||||||
|
throw new ZioLinkException(0, "USB 连接已关闭");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private UsbDeviceDescriptor ReadDeviceDescriptor()
|
||||||
|
{
|
||||||
|
var buffer = new byte[Marshal.SizeOf<UsbDeviceDescriptor>()];
|
||||||
|
if (!WinUsb_GetDescriptor(
|
||||||
|
_winUsbHandle, 1, 0, 0, buffer, (uint)buffer.Length, out _))
|
||||||
|
{
|
||||||
|
throw new ZioLinkException(0, "读取 USB 设备描述符失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
return MemoryMarshal.Read<UsbDeviceDescriptor>(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ushort ReadLanguageId()
|
||||||
|
{
|
||||||
|
var buffer = new byte[256];
|
||||||
|
if (!WinUsb_GetDescriptor(
|
||||||
|
_winUsbHandle, 3, 0, 0, buffer, (uint)buffer.Length, out _))
|
||||||
|
{
|
||||||
|
return 0x0409;
|
||||||
|
}
|
||||||
|
|
||||||
|
var length = buffer[0] - 2;
|
||||||
|
if (length >= 2)
|
||||||
|
{
|
||||||
|
return BitConverter.ToUInt16(buffer, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0x0409;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string ReadStringDescriptor(byte index, ushort languageId)
|
||||||
|
{
|
||||||
|
if (index == 0)
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
var buffer = new byte[256];
|
||||||
|
if (!WinUsb_GetDescriptor(
|
||||||
|
_winUsbHandle, 3, index, languageId, buffer, (uint)buffer.Length, out _))
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
var length = buffer[0] - 2;
|
||||||
|
if (length <= 0)
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
return System.Text.Encoding.Unicode.GetString(buffer, 2, length).Trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
if (_winUsbHandle != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
WinUsb_Free(_winUsbHandle);
|
||||||
|
_winUsbHandle = IntPtr.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
_deviceHandle?.Dispose();
|
||||||
|
_deviceHandle = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------- P/Invoke ----------------
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
private struct SpDeviceInterfaceData
|
||||||
|
{
|
||||||
|
public int cbSize;
|
||||||
|
public Guid InterfaceClassGuid;
|
||||||
|
public int Flags;
|
||||||
|
public IntPtr Reserved;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
|
private struct UsbDeviceDescriptor
|
||||||
|
{
|
||||||
|
public byte bLength;
|
||||||
|
public byte bDescriptorType;
|
||||||
|
public ushort bcdUSB;
|
||||||
|
public byte bDeviceClass;
|
||||||
|
public byte bDeviceSubClass;
|
||||||
|
public byte bDeviceProtocol;
|
||||||
|
public byte bMaxPacketSize0;
|
||||||
|
public ushort idVendor;
|
||||||
|
public ushort idProduct;
|
||||||
|
public ushort bcdDevice;
|
||||||
|
public byte iManufacturer;
|
||||||
|
public byte iProduct;
|
||||||
|
public byte iSerialNumber;
|
||||||
|
public byte bNumConfigurations;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
|
private struct UsbInterfaceDescriptor
|
||||||
|
{
|
||||||
|
public byte bLength;
|
||||||
|
public byte bDescriptorType;
|
||||||
|
public byte bInterfaceNumber;
|
||||||
|
public byte bAlternateSetting;
|
||||||
|
public byte bNumEndpoints;
|
||||||
|
public byte bInterfaceClass;
|
||||||
|
public byte bInterfaceSubClass;
|
||||||
|
public byte bInterfaceProtocol;
|
||||||
|
public byte iInterface;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
private struct WinUsbPipeInformation
|
||||||
|
{
|
||||||
|
public int PipeType;
|
||||||
|
public byte PipeId;
|
||||||
|
public ushort MaximumPacketSize;
|
||||||
|
public byte Interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport("setupapi.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||||
|
private static extern IntPtr SetupDiGetClassDevs(
|
||||||
|
ref Guid classGuid, IntPtr enumerator, IntPtr hwndParent, int flags);
|
||||||
|
|
||||||
|
[DllImport("setupapi.dll", SetLastError = true)]
|
||||||
|
private static extern bool SetupDiEnumDeviceInterfaces(
|
||||||
|
IntPtr deviceInfoSet,
|
||||||
|
IntPtr deviceInfoData,
|
||||||
|
ref Guid interfaceClassGuid,
|
||||||
|
uint memberIndex,
|
||||||
|
ref SpDeviceInterfaceData deviceInterfaceData);
|
||||||
|
|
||||||
|
[DllImport("setupapi.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||||
|
private static extern bool SetupDiGetDeviceInterfaceDetail(
|
||||||
|
IntPtr deviceInfoSet,
|
||||||
|
ref SpDeviceInterfaceData deviceInterfaceData,
|
||||||
|
IntPtr deviceInterfaceDetailData,
|
||||||
|
int deviceInterfaceDetailDataSize,
|
||||||
|
out int requiredSize,
|
||||||
|
IntPtr deviceInfoData);
|
||||||
|
|
||||||
|
[DllImport("setupapi.dll", SetLastError = true)]
|
||||||
|
private static extern bool SetupDiDestroyDeviceInfoList(IntPtr deviceInfoSet);
|
||||||
|
|
||||||
|
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||||
|
private static extern SafeFileHandle CreateFile(
|
||||||
|
string fileName,
|
||||||
|
uint desiredAccess,
|
||||||
|
uint shareMode,
|
||||||
|
IntPtr securityAttributes,
|
||||||
|
uint creationDisposition,
|
||||||
|
uint flagsAndAttributes,
|
||||||
|
IntPtr templateFile);
|
||||||
|
|
||||||
|
[DllImport("winusb.dll", SetLastError = true)]
|
||||||
|
private static extern bool WinUsb_Initialize(SafeFileHandle deviceHandle, out IntPtr interfaceHandle);
|
||||||
|
|
||||||
|
[DllImport("winusb.dll", SetLastError = true)]
|
||||||
|
private static extern bool WinUsb_Free(IntPtr interfaceHandle);
|
||||||
|
|
||||||
|
[DllImport("winusb.dll", SetLastError = true)]
|
||||||
|
private static extern bool WinUsb_QueryInterfaceSettings(
|
||||||
|
IntPtr interfaceHandle, byte alternateInterfaceNumber, ref UsbInterfaceDescriptor descriptor);
|
||||||
|
|
||||||
|
[DllImport("winusb.dll", SetLastError = true)]
|
||||||
|
private static extern bool WinUsb_QueryPipe(
|
||||||
|
IntPtr interfaceHandle,
|
||||||
|
byte alternateInterfaceNumber,
|
||||||
|
byte pipeIndex,
|
||||||
|
ref WinUsbPipeInformation pipeInformation);
|
||||||
|
|
||||||
|
[DllImport("winusb.dll", SetLastError = true)]
|
||||||
|
private static extern bool WinUsb_SetPipePolicy(
|
||||||
|
IntPtr interfaceHandle, byte pipeId, uint policyType, uint valueLength, ref uint value);
|
||||||
|
|
||||||
|
[DllImport("winusb.dll", SetLastError = true)]
|
||||||
|
private static extern bool WinUsb_WritePipe(
|
||||||
|
IntPtr interfaceHandle,
|
||||||
|
byte pipeId,
|
||||||
|
byte[] buffer,
|
||||||
|
uint bufferLength,
|
||||||
|
out uint lengthTransferred,
|
||||||
|
IntPtr overlapped);
|
||||||
|
|
||||||
|
[DllImport("winusb.dll", SetLastError = true)]
|
||||||
|
private static extern bool WinUsb_ReadPipe(
|
||||||
|
IntPtr interfaceHandle,
|
||||||
|
byte pipeId,
|
||||||
|
byte[] buffer,
|
||||||
|
uint bufferLength,
|
||||||
|
out uint lengthTransferred,
|
||||||
|
IntPtr overlapped);
|
||||||
|
|
||||||
|
[DllImport("winusb.dll", SetLastError = true)]
|
||||||
|
private static extern bool WinUsb_GetDescriptor(
|
||||||
|
IntPtr interfaceHandle,
|
||||||
|
byte descriptorType,
|
||||||
|
byte index,
|
||||||
|
ushort languageId,
|
||||||
|
byte[] buffer,
|
||||||
|
uint bufferLength,
|
||||||
|
out uint lengthTransferred);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,542 @@
|
|||||||
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace HardwareControl.Core.Spectrometer.ZioLink
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Aris 光谱仪的 ZioLink 协议实现(与官方 Inspective 的 DeviceClasses.ZioLinkSpectrometer 一致)。
|
||||||
|
///
|
||||||
|
/// 与 aris.dll 的高层 StartMeasurement 不同,这里把“配置”和“启动”彻底分开:
|
||||||
|
/// * <see cref="ApplyParameters"/> 只在参数变化时下发一次(cmd 0x1100/0x1101/0x1105);
|
||||||
|
/// * <see cref="StartExposure"/> 只发 cmd 4(8 字节 USB 往返),设备收到后立即开始积分,
|
||||||
|
/// 主机不需要等待曝光结束;
|
||||||
|
/// * 多台设备依次调用 StartExposure 的间隔就是 USB 往返时间(约 1 ms/台),
|
||||||
|
/// 因此 100 ms 曝光可以覆盖全部设备。
|
||||||
|
/// </summary>
|
||||||
|
internal sealed class ZioLinkDevice : IDisposable
|
||||||
|
{
|
||||||
|
private const int MaxReplyLength = 16492;
|
||||||
|
private const int SpectrumHeaderOffset = 4;
|
||||||
|
private const int SpectrumValuesOffset = 68;
|
||||||
|
|
||||||
|
private const int CmdReset = 0;
|
||||||
|
private const int CmdStandBy = 1;
|
||||||
|
private const int CmdStartExposure = 4;
|
||||||
|
private const int CmdCancelExposure = 5;
|
||||||
|
private const int CmdGetExposureTime = 4096;
|
||||||
|
private const int CmdSetExposureTime = 4352;
|
||||||
|
private const int CmdGetAveraging = 4097;
|
||||||
|
private const int CmdSetAveraging = 4353;
|
||||||
|
private const int CmdGetSensorGain = 4109;
|
||||||
|
private const int CmdSetSensorGain = 4365;
|
||||||
|
private const int CmdGetMaxSensorGain = 4877;
|
||||||
|
private const int CmdGetMinExposureTime = 4608;
|
||||||
|
private const int CmdGetMaxExposureTime = 4864;
|
||||||
|
private const int CmdGetMaxAveraging = 4865;
|
||||||
|
private const int CmdGetTriggerInConfiguration = 4100;
|
||||||
|
private const int CmdSetTriggerInConfiguration = 4356;
|
||||||
|
private const int CmdGetTriggerInDelay = 4101;
|
||||||
|
private const int CmdSetTriggerInDelay = 4357;
|
||||||
|
private const int CmdGetStartPixel = 8201;
|
||||||
|
private const int CmdGetEndPixel = 8202;
|
||||||
|
private const int CmdGetSerialNumber = 8193;
|
||||||
|
private const int CmdGetManufacturer = 8194;
|
||||||
|
private const int CmdGetModelName = 8195;
|
||||||
|
private const int CmdGetSoftwareVersion = 8197;
|
||||||
|
private const int CmdGetPixelCount = 8199;
|
||||||
|
private const int CmdGetStatus = 12288;
|
||||||
|
private const int CmdGetSpectrum = 16384;
|
||||||
|
private const int CmdSetDateTime = 16645;
|
||||||
|
private const int CmdGetWavelengthCoefficient0 = 8220;
|
||||||
|
|
||||||
|
private static readonly Version MinFirmwareNewTriggering = new Version(4, 1, 7, 0);
|
||||||
|
private static readonly Version MinFirmwareDateTime = new Version(4, 0, 7, 1);
|
||||||
|
private static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1);
|
||||||
|
|
||||||
|
private readonly WinUsbConnection _connection;
|
||||||
|
private readonly byte[] _reply = new byte[MaxReplyLength];
|
||||||
|
private bool _disposed;
|
||||||
|
|
||||||
|
public ZioLinkDevice(WinUsbConnection connection)
|
||||||
|
{
|
||||||
|
_connection = connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string DevicePath => _connection.DevicePath;
|
||||||
|
|
||||||
|
public string SerialNumber { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Manufacturer { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
public string ModelName { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
public Version FirmwareVersion { get; private set; } = new Version(0, 0);
|
||||||
|
|
||||||
|
public int PixelCount { get; private set; }
|
||||||
|
|
||||||
|
public float[] Wavelengths { get; private set; } = Array.Empty<float>();
|
||||||
|
|
||||||
|
public int StartPixel { get; private set; }
|
||||||
|
|
||||||
|
public int EndPixel { get; private set; }
|
||||||
|
|
||||||
|
public int MinExposureUs { get; private set; }
|
||||||
|
|
||||||
|
public int MaxExposureUs { get; private set; }
|
||||||
|
|
||||||
|
public int MaxAveraging { get; private set; }
|
||||||
|
|
||||||
|
public int MaxSensorGain { get; private set; }
|
||||||
|
|
||||||
|
public int SensorGain { get; private set; }
|
||||||
|
|
||||||
|
public int TriggerConfiguration { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>最近一次成功下发的曝光时间(微秒)。</summary>
|
||||||
|
public int ExposureTimeUs { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>最近一次成功下发的平均次数。</summary>
|
||||||
|
public int Averaging { get; private set; } = 1;
|
||||||
|
|
||||||
|
/// <summary>最近一次成功下发的触发延迟(微秒)。</summary>
|
||||||
|
public int DelayUs { get; private set; }
|
||||||
|
|
||||||
|
public void Open()
|
||||||
|
{
|
||||||
|
ThrowIfDisposed();
|
||||||
|
|
||||||
|
// 官方 Open 流程:先复位,再读取全部静态参数
|
||||||
|
WriteCommand(CmdReset);
|
||||||
|
|
||||||
|
FirmwareVersion = ReadVersion(CmdGetSoftwareVersion);
|
||||||
|
SerialNumber = ReadStringOrFallback(CmdGetSerialNumber, _connection.SerialNumber);
|
||||||
|
Manufacturer = ReadStringOrFallback(CmdGetManufacturer, _connection.Manufacturer);
|
||||||
|
ModelName = ReadStringOrFallback(CmdGetModelName, _connection.Product);
|
||||||
|
|
||||||
|
PixelCount = ReadInt(CmdGetPixelCount);
|
||||||
|
if (PixelCount <= 0)
|
||||||
|
{
|
||||||
|
throw new ZioLinkException(0, $"设备返回的像素数无效({PixelCount})");
|
||||||
|
}
|
||||||
|
|
||||||
|
var coefficients = new float[4];
|
||||||
|
for (var i = 0; i < coefficients.Length; i++)
|
||||||
|
{
|
||||||
|
coefficients[i] = ReadFloat(CmdGetWavelengthCoefficient0 + i);
|
||||||
|
}
|
||||||
|
|
||||||
|
Wavelengths = BuildWavelengths(coefficients, PixelCount);
|
||||||
|
|
||||||
|
MinExposureUs = ReadInt(CmdGetMinExposureTime);
|
||||||
|
MaxExposureUs = ReadInt(CmdGetMaxExposureTime);
|
||||||
|
MaxAveraging = ReadInt(CmdGetMaxAveraging);
|
||||||
|
ExposureTimeUs = ReadInt(CmdGetExposureTime);
|
||||||
|
Averaging = ReadInt(CmdGetAveraging);
|
||||||
|
MaxSensorGain = TryReadInt(CmdGetMaxSensorGain, 0);
|
||||||
|
SensorGain = TryReadInt(CmdGetSensorGain, 0);
|
||||||
|
TriggerConfiguration = ReadInt(CmdGetTriggerInConfiguration);
|
||||||
|
DelayUs = TryReadInt(CmdGetTriggerInDelay, 0);
|
||||||
|
StartPixel = TryReadInt(CmdGetStartPixel, 0);
|
||||||
|
EndPixel = TryReadInt(CmdGetEndPixel, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 把设备 RTC 同步到主机时间。三台设备应在同一时刻集中调用,
|
||||||
|
/// 否则帧头时间戳会出现固定偏移,影响启动偏差的诊断。
|
||||||
|
/// </summary>
|
||||||
|
public bool SynchronizeTime()
|
||||||
|
{
|
||||||
|
ThrowIfDisposed();
|
||||||
|
|
||||||
|
if (FirmwareVersion < MinFirmwareDateTime)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var attempt = 0; attempt < 3; attempt++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
UpdateDeviceTime();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (ZioLinkException)
|
||||||
|
{
|
||||||
|
Thread.Sleep(20);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 预配置:只有参数变化时才发命令。官方软件在用户修改曝光/平均时才调用同样的命令,
|
||||||
|
/// 启动阶段不会重复下发。
|
||||||
|
/// </summary>
|
||||||
|
public void ApplyParameters(int exposureUs, int averaging, int delayUs)
|
||||||
|
{
|
||||||
|
ThrowIfDisposed();
|
||||||
|
|
||||||
|
if (delayUs != DelayUs)
|
||||||
|
{
|
||||||
|
WriteInt(CmdSetTriggerInDelay, delayUs);
|
||||||
|
DelayUs = delayUs;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (averaging != Averaging)
|
||||||
|
{
|
||||||
|
WriteInt(CmdSetAveraging, averaging);
|
||||||
|
Averaging = averaging;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exposureUs != ExposureTimeUs)
|
||||||
|
{
|
||||||
|
WriteInt(CmdSetExposureTime, exposureUs);
|
||||||
|
ExposureTimeUs = exposureUs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetTriggerMode(SpectrometerTriggerMode mode)
|
||||||
|
{
|
||||||
|
ThrowIfDisposed();
|
||||||
|
|
||||||
|
int modeValue;
|
||||||
|
if (FirmwareVersion >= MinFirmwareNewTriggering)
|
||||||
|
{
|
||||||
|
modeValue = mode switch
|
||||||
|
{
|
||||||
|
SpectrometerTriggerMode.Software => 0,
|
||||||
|
SpectrometerTriggerMode.FreeRunEdge => 1,
|
||||||
|
SpectrometerTriggerMode.External => 2,
|
||||||
|
_ => throw new ZioLinkException(0, $"不支持的触发模式:{mode}"),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 旧固件只区分“自由运行”和“硬件触发”
|
||||||
|
modeValue = mode == SpectrometerTriggerMode.External ? 6 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
var value = (TriggerConfiguration & ~0xFF) | modeValue;
|
||||||
|
WriteInt(CmdSetTriggerInConfiguration, value);
|
||||||
|
TriggerConfiguration = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetGain(int gain)
|
||||||
|
{
|
||||||
|
ThrowIfDisposed();
|
||||||
|
WriteInt(CmdSetSensorGain, gain);
|
||||||
|
SensorGain = gain;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>只发启动命令;设备收到后立即在固件内开始积分。</summary>
|
||||||
|
public void StartExposure(int numSpectra)
|
||||||
|
{
|
||||||
|
ThrowIfDisposed();
|
||||||
|
WriteInt(CmdStartExposure, numSpectra);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CancelExposure()
|
||||||
|
{
|
||||||
|
ThrowIfDisposed();
|
||||||
|
WriteCommand(CmdCancelExposure);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ZioLinkDeviceStatus GetStatus(out int availableSpectra)
|
||||||
|
{
|
||||||
|
ThrowIfDisposed();
|
||||||
|
|
||||||
|
var value = ReadInt(CmdGetStatus);
|
||||||
|
availableSpectra = (value >> 8) & 0xFFFF;
|
||||||
|
var state = value & 0xFF;
|
||||||
|
|
||||||
|
return state switch
|
||||||
|
{
|
||||||
|
0 => ZioLinkDeviceStatus.Idle,
|
||||||
|
1 => ZioLinkDeviceStatus.WaitingForTrigger,
|
||||||
|
2 => ZioLinkDeviceStatus.TakingSpectrum,
|
||||||
|
3 => ZioLinkDeviceStatus.WaitingForTemperature,
|
||||||
|
8 => ZioLinkDeviceStatus.PoweredOff,
|
||||||
|
9 => ZioLinkDeviceStatus.SleepMode,
|
||||||
|
10 => ZioLinkDeviceStatus.NotConnected,
|
||||||
|
_ => ZioLinkDeviceStatus.Unknown,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>丢弃设备里残留的旧帧(例如上一次采集超时后留下的数据)。</summary>
|
||||||
|
public int DrainPendingSpectra(int maxFrames = 8)
|
||||||
|
{
|
||||||
|
var drained = 0;
|
||||||
|
while (drained < maxFrames)
|
||||||
|
{
|
||||||
|
GetStatus(out var available);
|
||||||
|
if (available <= 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReadSpectrum();
|
||||||
|
drained++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return drained;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ZioLinkSpectrum ReadSpectrum()
|
||||||
|
{
|
||||||
|
ThrowIfDisposed();
|
||||||
|
|
||||||
|
var length = ReadBulk(CmdGetSpectrum);
|
||||||
|
if (length < SpectrumValuesOffset)
|
||||||
|
{
|
||||||
|
throw new ZioLinkException(0, $"收到的光谱只有 {length} 字节");
|
||||||
|
}
|
||||||
|
|
||||||
|
var header = SpectrumHeaderOffset;
|
||||||
|
var pixelCount = BitConverter.ToUInt16(_reply, header + 24);
|
||||||
|
if (pixelCount != PixelCount)
|
||||||
|
{
|
||||||
|
throw new ZioLinkException(0, $"收到的光谱像素数 {pixelCount} 与设备像素数 {PixelCount} 不一致");
|
||||||
|
}
|
||||||
|
|
||||||
|
var dataFormat = _reply[header + 26];
|
||||||
|
if (dataFormat != 0)
|
||||||
|
{
|
||||||
|
throw new ZioLinkException(0, $"不支持的光谱数据格式 {dataFormat}");
|
||||||
|
}
|
||||||
|
|
||||||
|
var expected = SpectrumValuesOffset + pixelCount * sizeof(float);
|
||||||
|
if (length != expected)
|
||||||
|
{
|
||||||
|
throw new ZioLinkException(0, $"光谱长度 {length} 与期望值 {expected} 不一致");
|
||||||
|
}
|
||||||
|
|
||||||
|
var values = new float[pixelCount];
|
||||||
|
Buffer.BlockCopy(_reply, SpectrumValuesOffset, values, 0, pixelCount * sizeof(float));
|
||||||
|
|
||||||
|
var exposureSettings = BitConverter.ToUInt16(_reply, header + 28);
|
||||||
|
var appliedProcessing = BitConverter.ToUInt16(_reply, header + 30);
|
||||||
|
|
||||||
|
return new ZioLinkSpectrum(
|
||||||
|
BitConverter.ToUInt32(_reply, header + 0),
|
||||||
|
BitConverter.ToUInt32(_reply, header + 4),
|
||||||
|
BitConverter.ToUInt32(_reply, header + 8),
|
||||||
|
BitConverter.ToUInt32(_reply, header + 12),
|
||||||
|
BitConverter.ToSingle(_reply, header + 16),
|
||||||
|
BitConverter.ToSingle(_reply, header + 20),
|
||||||
|
pixelCount,
|
||||||
|
dataFormat,
|
||||||
|
exposureSettings,
|
||||||
|
appliedProcessing,
|
||||||
|
BitConverter.ToSingle(_reply, header + 56),
|
||||||
|
BitConverter.ToSingle(_reply, header + 60),
|
||||||
|
values);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateDeviceTime()
|
||||||
|
{
|
||||||
|
if (FirmwareVersion < MinFirmwareDateTime)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var now = DateTime.Now;
|
||||||
|
var time = (int)(now.TimeOfDay.TotalMilliseconds * 10.0);
|
||||||
|
var days = (int)(now.Date - UnixEpoch).TotalDays;
|
||||||
|
WriteTwoInts(CmdSetDateTime, time, days);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float[] BuildWavelengths(float[] coefficients, int pixelCount)
|
||||||
|
{
|
||||||
|
var wavelengths = new float[pixelCount];
|
||||||
|
for (var i = 0; i < pixelCount; i++)
|
||||||
|
{
|
||||||
|
wavelengths[i] = coefficients[0]
|
||||||
|
+ (coefficients[1] + (coefficients[2] + coefficients[3] * i) * i) * i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return wavelengths;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WriteCommand(int cmd)
|
||||||
|
{
|
||||||
|
var message = new byte[4];
|
||||||
|
CopyInt(message, cmd, 0);
|
||||||
|
SendReceive(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WriteInt(int cmd, int value)
|
||||||
|
{
|
||||||
|
var message = new byte[8];
|
||||||
|
CopyInt(message, cmd, 0);
|
||||||
|
CopyInt(message, value, 4);
|
||||||
|
SendReceive(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WriteTwoInts(int cmd, int value1, int value2)
|
||||||
|
{
|
||||||
|
var message = new byte[12];
|
||||||
|
CopyInt(message, cmd, 0);
|
||||||
|
CopyInt(message, value1, 4);
|
||||||
|
CopyInt(message, value2, 8);
|
||||||
|
SendReceive(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int ReadInt(int cmd)
|
||||||
|
{
|
||||||
|
WriteCommand(cmd);
|
||||||
|
return BitConverter.ToInt32(_reply, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int TryReadInt(int cmd, int fallback)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return ReadInt(cmd);
|
||||||
|
}
|
||||||
|
catch (ZioLinkException)
|
||||||
|
{
|
||||||
|
return fallback;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private float ReadFloat(int cmd)
|
||||||
|
{
|
||||||
|
WriteCommand(cmd);
|
||||||
|
return BitConverter.ToSingle(_reply, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Version ReadVersion(int cmd)
|
||||||
|
{
|
||||||
|
WriteCommand(cmd);
|
||||||
|
return new Version(_reply[7], _reply[6], _reply[5], _reply[4]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private string ReadStringOrFallback(int cmd, string fallback)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
WriteCommand(cmd);
|
||||||
|
var end = Array.IndexOf(_reply, (byte)0, 4);
|
||||||
|
if (end < 0)
|
||||||
|
{
|
||||||
|
end = _reply.Length;
|
||||||
|
}
|
||||||
|
|
||||||
|
var value = Encoding.ASCII.GetString(_reply, 4, end - 4).Trim();
|
||||||
|
return string.IsNullOrWhiteSpace(value) ? fallback : value;
|
||||||
|
}
|
||||||
|
catch (ZioLinkException)
|
||||||
|
{
|
||||||
|
return fallback;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int ReadBulk(int cmd)
|
||||||
|
{
|
||||||
|
WriteCommand(cmd);
|
||||||
|
return _replyLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int _replyLength;
|
||||||
|
|
||||||
|
private int SendReceive(byte[] message)
|
||||||
|
{
|
||||||
|
_connection.Write(message, message.Length);
|
||||||
|
var length = _connection.Read(_reply, _reply.Length);
|
||||||
|
if (length < 4)
|
||||||
|
{
|
||||||
|
throw new ZioLinkException(0, $"设备回复长度不足({length} 字节)");
|
||||||
|
}
|
||||||
|
|
||||||
|
var status = BitConverter.ToInt32(_reply, 0);
|
||||||
|
var errorCode = status >> 8;
|
||||||
|
if (errorCode != 0)
|
||||||
|
{
|
||||||
|
throw new ZioLinkException(
|
||||||
|
errorCode,
|
||||||
|
BuildErrorMessage(errorCode, BitConverter.ToInt32(message, 0), status));
|
||||||
|
}
|
||||||
|
|
||||||
|
_replyLength = length;
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string BuildErrorMessage(int errorCode, int command, int status)
|
||||||
|
{
|
||||||
|
var description = errorCode switch
|
||||||
|
{
|
||||||
|
1 => "设备不支持该命令",
|
||||||
|
2 => "设备参数无效",
|
||||||
|
4 => "设备当前状态不允许该操作(可能仍在测量中)",
|
||||||
|
5 => "设备不支持该操作",
|
||||||
|
6 => "操作密码错误",
|
||||||
|
7 => "通信错误",
|
||||||
|
8 => "设备内部错误",
|
||||||
|
10 => "无法读取设备存储(校验和错误或内容为空)",
|
||||||
|
11 => "光谱处理错误",
|
||||||
|
_ => "设备返回错误",
|
||||||
|
};
|
||||||
|
|
||||||
|
return $"{description}(cmd=0x{command:X4}, err=0x{status:X4})";
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CopyInt(byte[] buffer, int value, int offset)
|
||||||
|
{
|
||||||
|
buffer[offset] = (byte)value;
|
||||||
|
buffer[offset + 1] = (byte)(value >> 8);
|
||||||
|
buffer[offset + 2] = (byte)(value >> 16);
|
||||||
|
buffer[offset + 3] = (byte)(value >> 24);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ThrowIfDisposed()
|
||||||
|
{
|
||||||
|
ObjectDisposedException.ThrowIf(_disposed, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
if (_disposed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_disposed = true;
|
||||||
|
_connection.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal enum ZioLinkDeviceStatus
|
||||||
|
{
|
||||||
|
Idle = 0,
|
||||||
|
WaitingForTrigger = 1,
|
||||||
|
TakingSpectrum = 2,
|
||||||
|
WaitingForTemperature = 3,
|
||||||
|
PoweredOff = 8,
|
||||||
|
SleepMode = 9,
|
||||||
|
NotConnected = 10,
|
||||||
|
Unknown = 255,
|
||||||
|
}
|
||||||
|
|
||||||
|
internal sealed record ZioLinkSpectrum(
|
||||||
|
uint ExposureTimeUs,
|
||||||
|
uint Averaging,
|
||||||
|
uint DeviceTime10Us,
|
||||||
|
uint DeviceDateDays,
|
||||||
|
float LoadLevel,
|
||||||
|
float SensorTemperature,
|
||||||
|
int PixelCount,
|
||||||
|
int DataFormat,
|
||||||
|
ushort ExposureSettings,
|
||||||
|
ushort AppliedProcessing,
|
||||||
|
float DarkAvg,
|
||||||
|
float ReadoutNoise,
|
||||||
|
float[] Values)
|
||||||
|
{
|
||||||
|
public int ErrorFlags => ExposureSettings >> 12;
|
||||||
|
|
||||||
|
public int IntensityUnit => AppliedProcessing & 0x0F;
|
||||||
|
|
||||||
|
public bool DarkSubtracted => (AppliedProcessing & 0x10) != 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace HardwareControl.Core.Spectrometer.ZioLink
|
||||||
|
{
|
||||||
|
/// <summary>ZioLink 协议或 USB 通信错误。</summary>
|
||||||
|
internal sealed class ZioLinkException : Exception
|
||||||
|
{
|
||||||
|
public ZioLinkException(int code, string message, Exception? innerException = null)
|
||||||
|
: base(message, innerException)
|
||||||
|
{
|
||||||
|
Code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>设备返回的错误码(报文头 status >> 8);0 表示 USB 层错误。</summary>
|
||||||
|
public int Code { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
namespace HardwareControl.Core.UsbCamera
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 相机最近一帧图像快照,用于后台图像处理。
|
||||||
|
/// </summary>
|
||||||
|
public sealed record CameraFrameSnapshot(
|
||||||
|
byte[] ImageData,
|
||||||
|
int Width,
|
||||||
|
int Height,
|
||||||
|
string MimeType,
|
||||||
|
DateTimeOffset CapturedAt,
|
||||||
|
long FrameIndex);
|
||||||
|
}
|
||||||
@@ -5,6 +5,10 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class UsbCameraOptions
|
public class UsbCameraOptions
|
||||||
{
|
{
|
||||||
|
// 相机的硬件 ID,来自系统参数 camera_vid;匹配 CaptureDeviceDescriptor.Identity
|
||||||
|
// 为 null 时按 DeviceNameKeyword 或第一个设备选择
|
||||||
|
public string? CameraVid { get; set; }
|
||||||
|
|
||||||
// 设备名称关键词,null 表示取第一个设备
|
// 设备名称关键词,null 表示取第一个设备
|
||||||
public string? DeviceNameKeyword { get; set; }
|
public string? DeviceNameKeyword { get; set; }
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,57 @@
|
|||||||
|
0.5 0
|
||||||
|
0.5 3.663988119
|
||||||
|
2.5 3.749567088
|
||||||
|
1.5 3.778128932
|
||||||
|
1.5 4.304015502
|
||||||
|
0.5 5.2762897
|
||||||
|
0.5 5.9881151
|
||||||
|
1.5 6.01333406
|
||||||
|
1.5 6.0434819
|
||||||
|
2.5 6.0459926
|
||||||
|
0.5 6.4331637
|
||||||
|
0.5 6.7002346
|
||||||
|
1.5 6.7101621
|
||||||
|
1.5 6.7203302
|
||||||
|
2.5 6.7205298
|
||||||
|
3.5 6.7205318
|
||||||
|
2.5 6.7216252
|
||||||
|
0.5 6.8911962
|
||||||
|
2.5 6.9708242
|
||||||
|
0.5 7.0200939
|
||||||
|
1.5 7.0250186
|
||||||
|
2.5 7.0288222
|
||||||
|
3.5 7.0288374
|
||||||
|
1.5 7.0298832
|
||||||
|
2.5 7.0305818
|
||||||
|
3.5 7.0313379
|
||||||
|
0.5 7.1198022
|
||||||
|
0.5 7.191728
|
||||||
|
1.5 7.194443
|
||||||
|
2.5 7.1962892
|
||||||
|
3.5 7.1962986
|
||||||
|
1.5 7.1972793
|
||||||
|
2.5 7.1977027
|
||||||
|
3.5 7.1978667
|
||||||
|
4.5 7.197867
|
||||||
|
4.5 7.1981679
|
||||||
|
0.5 7.2503542
|
||||||
|
1.5 7.2536441
|
||||||
|
3.5 7.289016
|
||||||
|
0.5 7.294517
|
||||||
|
1.5 7.296449
|
||||||
|
2.5 7.2970292
|
||||||
|
3.5 7.2970596
|
||||||
|
1.5 7.2980152
|
||||||
|
2.5 7.2982806
|
||||||
|
3.5 7.2982856
|
||||||
|
4.5 7.302923
|
||||||
|
0.5 7.331928
|
||||||
|
2.5 7.354916
|
||||||
|
1.5 7.363294
|
||||||
|
2.5 7.3634943
|
||||||
|
0.5 7.386304
|
||||||
|
1.5 7.408198
|
||||||
|
2.5 7.408243
|
||||||
|
1.5 7.43999
|
||||||
|
0.5 7.505687
|
||||||
|
1.5 7.593071
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
0 0
|
||||||
|
3 4.85621524
|
||||||
|
2 5.05178164
|
||||||
|
1 5.42340787
|
||||||
|
2 5.70935599
|
||||||
|
2 9.94061406
|
||||||
|
3 10.18799624
|
||||||
|
1 10.36824232
|
||||||
|
4 10.37371429
|
||||||
|
2 10.56354739
|
||||||
|
0 10.68000934
|
||||||
|
3 10.71975443
|
||||||
|
2 10.77275122
|
||||||
|
3 11.05129722
|
||||||
|
1 11.14562609
|
||||||
|
1 11.20009655
|
||||||
|
2 11.26865618
|
||||||
|
4 11.6461984
|
||||||
|
3 12.1457448
|
||||||
|
2 12.3495738
|
||||||
|
2 13.05085795
|
||||||
|
1 13.50664359
|
||||||
|
0 13.5301092
|
||||||
|
2 13.7341658
|
||||||
|
4 14.0848697
|
||||||
|
3 14.94426237
|
||||||
|
2 14.99107868
|
||||||
|
1 15.51369748
|
||||||
|
2 15.54822362
|
||||||
|
1 15.56929756
|
||||||
|
5 15.7048537
|
||||||
|
4 15.70624561
|
||||||
|
2 15.7170388
|
||||||
|
1 15.71751374
|
||||||
|
3 15.77216844
|
||||||
|
3 15.80688104
|
||||||
|
2 15.8108967
|
||||||
|
4 15.8214593
|
||||||
|
4 15.8717297
|
||||||
|
0 15.93632526
|
||||||
|
3 16.2078418
|
||||||
|
1 16.21250802
|
||||||
|
3 16.27323608
|
||||||
|
5 16.3003164
|
||||||
|
1 16.30480373
|
||||||
|
4 16.3060395
|
||||||
|
2 16.313471
|
||||||
|
2 16.33991707
|
||||||
|
3 16.3680947
|
||||||
|
2 16.38520771
|
||||||
|
3 16.39050597
|
||||||
|
4 16.4191861
|
||||||
|
4 16.4512994
|
||||||
|
1 16.4702717
|
||||||
|
2 16.4800215
|
||||||
|
3 16.492635
|
||||||
|
2 16.507485
|
||||||
|
3 16.6564258
|
||||||
|
0 16.6704131
|
||||||
|
1 16.7129662
|
||||||
|
2 16.7893601
|
||||||
|
4 16.8751236
|
||||||
|
0 16.8829047
|
||||||
|
2 16.9261856
|
||||||
|
1 16.965071
|
||||||
|
3 17.007721
|
||||||
|
1 17.0137822
|
||||||
|
3 17.0397954
|
||||||
|
2 17.0438913
|
||||||
|
3 17.188662
|
||||||
|
2 17.262321
|
||||||
|
3 17.432014
|
||||||
|
2 17.477363
|
||||||
|
1 17.480329
|
||||||
|
3 17.500631
|
||||||
|
3 17.595877
|
||||||
|
1 17.648662
|
||||||
|
2 17.821972
|
||||||
|
3 17.913043
|
||||||
|
2 17.93111
|
||||||
|
1 17.9794494
|
||||||
|
2 17.982062
|
||||||
|
6 18.0001752
|
||||||
|
5 18.0002804
|
||||||
|
2 18.0022265
|
||||||
|
1 18.0078178
|
||||||
|
2 18.0160852
|
||||||
|
5 18.025998
|
||||||
|
3 18.0283314
|
||||||
|
4 18.0306639
|
||||||
|
4 18.0394354
|
||||||
|
3 18.0469607
|
||||||
|
2 18.116974
|
||||||
|
1 18.483919
|
||||||
|
2 18.496233
|
||||||
|
3 19.228579
|
||||||
|
2 19.237564
|
||||||
|
1 19.799682
|
||||||
|
2 19.80528
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
0.5 0
|
||||||
|
1.5 0.0138938
|
||||||
|
0.5 3.1427212
|
||||||
|
0.5 3.598072
|
||||||
|
1.5 3.603844
|
||||||
|
2.5 3.613244
|
||||||
|
1.5 4.0214836
|
||||||
|
2.5 4.0216501
|
||||||
|
0.5 4.0852554
|
||||||
|
1.5 4.0872183
|
||||||
|
0.5 4.6728909
|
||||||
|
1.5 4.826632
|
||||||
|
2.5 4.8271968
|
||||||
|
0.5 4.9930889
|
||||||
|
1.5 4.993821
|
||||||
|
2.5 5.1229514
|
||||||
|
3.5 5.1229524
|
||||||
|
0.5 5.225241
|
||||||
|
1.5 5.2363166
|
||||||
|
2.5 5.2368176
|
||||||
|
0.5 5.3728582
|
||||||
|
1.5 5.3732134
|
||||||
|
2.5 5.4343639
|
||||||
|
3.5 5.4343644
|
||||||
|
3.5 5.4398995
|
||||||
|
4.5 5.4398995
|
||||||
|
1.5 5.4759354
|
||||||
|
2.5 5.476239
|
||||||
|
0.5 5.4891689
|
||||||
|
0.5 5.5693287
|
||||||
|
1.5 5.5695297
|
||||||
|
2.5 5.6034263
|
||||||
|
3.5 5.6034263
|
||||||
|
4.5 5.6067784
|
||||||
|
3.5 5.6067784
|
||||||
|
1.5 5.6219599
|
||||||
|
2.5 5.6221371
|
||||||
|
0.5 5.6359799
|
||||||
|
2.5 5.7052288
|
||||||
|
3.5 5.7052288
|
||||||
|
4.5 5.7073982
|
||||||
|
3.5 5.7073982
|
||||||
|
5.5 5.707872
|
||||||
|
4.5 5.707872
|
||||||
|
1.5 5.7148562
|
||||||
|
2.5 5.7149663
|
||||||
|
0.5 5.7260732
|
||||||
|
3.5 5.7712092
|
||||||
|
2.5 5.7712092
|
||||||
|
1.5 5.776835
|
||||||
|
2.5 5.776913
|
||||||
|
0.5 5.785342
|
||||||
|
2.5 5.816394
|
||||||
|
3.5 5.816394
|
||||||
|
1.5 5.819938
|
||||||
|
2.5 5.82001
|
||||||
|
0.5 5.826403
|
||||||
|
3.5 5.848678
|
||||||
|
2.5 5.848678
|
||||||
|
2.5 5.851109
|
||||||
|
1.5 5.851109
|
||||||
|
0.5 5.856022
|
||||||
|
2.5 5.87433
|
||||||
|
1.5 5.87433
|
||||||
|
0.5 5.878087
|
||||||
|
1.5 5.89187
|
||||||
|
2.5 5.89187
|
||||||
|
0.5 5.894968
|
||||||
|
2.5 5.90569
|
||||||
|
1.5 5.90569
|
||||||
|
0.5 5.908167
|
||||||
|
2.5 5.91669
|
||||||
|
1.5 5.91669
|
||||||
|
0.5 5.918684
|
||||||
|
1.5 5.92558
|
||||||
|
2.5 5.92558
|
||||||
|
1.5 5.93276
|
||||||
|
2.5 5.93276
|
||||||
|
2.5 5.93886
|
||||||
|
1.5 5.93886
|
||||||
|
2.5 5.94389
|
||||||
|
1.5 5.94389
|
||||||
|
2.5 5.94815
|
||||||
|
1.5 5.94815
|
||||||
|
1.5 5.95182
|
||||||
|
2.5 5.95182
|
||||||
|
1.5 5.9551
|
||||||
|
2.5 5.9551
|
||||||
|
1.5 5.9576
|
||||||
|
2.5 5.9576
|
||||||
|
2.5 5.9599
|
||||||
|
1.5 5.9599
|
||||||
|
2.5 5.962
|
||||||
|
1.5 5.962
|
||||||
|
2.5 5.9639
|
||||||
|
1.5 5.9639
|
||||||
|
2.5 5.9655
|
||||||
|
1.5 5.9655
|
||||||
|
2.5 5.967
|
||||||
|
1.5 5.967
|
||||||
|
1.5 5.9682
|
||||||
|
2.5 5.9682
|
||||||
|
1.5 5.9695
|
||||||
|
2.5 5.9695
|
||||||
|
1.5 5.9705
|
||||||
|
2.5 5.9705
|
||||||
|
2.5 5.9715
|
||||||
|
1.5 5.9715
|
||||||
|
2.5 5.9723
|
||||||
|
1.5 5.9723
|
||||||
|
2.5 5.9732
|
||||||
|
1.5 5.9732
|
||||||
|
2.5 5.9738
|
||||||
|
1.5 5.9738
|
||||||
@@ -0,0 +1,217 @@
|
|||||||
|
0 0
|
||||||
|
0 4.636145
|
||||||
|
1 4.643693
|
||||||
|
2 4.659052
|
||||||
|
1 7.420705
|
||||||
|
2 10.598337
|
||||||
|
1 11.316596
|
||||||
|
0 11.665048
|
||||||
|
1 11.672797
|
||||||
|
2 11.687827
|
||||||
|
0 11.821968
|
||||||
|
3 11.846618
|
||||||
|
2 11.846753
|
||||||
|
1 11.846869
|
||||||
|
0 13.071346
|
||||||
|
1 13.07308
|
||||||
|
2 13.076729
|
||||||
|
1 13.25646
|
||||||
|
2 13.649399
|
||||||
|
0 13.841265
|
||||||
|
1 14.8896242
|
||||||
|
0 15.047556
|
||||||
|
3 15.062034
|
||||||
|
2 15.062086
|
||||||
|
1 15.0621275
|
||||||
|
2 15.301941
|
||||||
|
3 15.302185
|
||||||
|
4 15.302546
|
||||||
|
3 15.30839
|
||||||
|
2 15.4725
|
||||||
|
0 15.585203
|
||||||
|
1 15.5859081
|
||||||
|
2 15.5875044
|
||||||
|
1 15.6057688
|
||||||
|
1 16.3926348
|
||||||
|
0 16.4624522
|
||||||
|
2 16.467928
|
||||||
|
3 16.467939
|
||||||
|
1 16.467947
|
||||||
|
2 16.544167
|
||||||
|
3 16.544833
|
||||||
|
4 16.5457
|
||||||
|
3 16.574428
|
||||||
|
2 16.6035134
|
||||||
|
3 16.63666
|
||||||
|
4 16.63666
|
||||||
|
5 16.63666
|
||||||
|
4 16.63666
|
||||||
|
1 16.727874
|
||||||
|
0 16.7393898
|
||||||
|
1 16.7398133
|
||||||
|
2 16.74061
|
||||||
|
1 17.171798
|
||||||
|
2 17.17446
|
||||||
|
3 17.17663
|
||||||
|
4 17.17947
|
||||||
|
0 17.209081
|
||||||
|
1 17.21085
|
||||||
|
2 17.21085
|
||||||
|
3 17.210881
|
||||||
|
3 17.2642221
|
||||||
|
2 17.269653
|
||||||
|
3 17.30709
|
||||||
|
5 17.30709
|
||||||
|
4 17.30709
|
||||||
|
4 17.30709
|
||||||
|
1 17.347742
|
||||||
|
0 17.36895
|
||||||
|
1 17.36918
|
||||||
|
2 17.36965
|
||||||
|
2 17.492297
|
||||||
|
3 17.495418
|
||||||
|
4 17.499508
|
||||||
|
1 17.628438
|
||||||
|
0 17.65077
|
||||||
|
1 17.651077
|
||||||
|
2 17.651096
|
||||||
|
3 17.651132
|
||||||
|
3 17.680649
|
||||||
|
2 17.681296
|
||||||
|
3 17.71134
|
||||||
|
4 17.71134
|
||||||
|
5 17.71134
|
||||||
|
4 17.71134
|
||||||
|
1 17.72493
|
||||||
|
0 17.75025
|
||||||
|
1 17.750416
|
||||||
|
2 17.750823
|
||||||
|
2 17.762699
|
||||||
|
3 17.763571
|
||||||
|
4 17.764921
|
||||||
|
1 17.919107
|
||||||
|
1 17.93332
|
||||||
|
2 17.933345
|
||||||
|
3 17.933378
|
||||||
|
0 17.933588
|
||||||
|
2 17.950709
|
||||||
|
3 17.950984
|
||||||
|
1 17.970406
|
||||||
|
3 17.97363
|
||||||
|
5 17.97363
|
||||||
|
4 17.97363
|
||||||
|
4 17.97363
|
||||||
|
5 17.97674
|
||||||
|
5 17.97674
|
||||||
|
4 17.97674
|
||||||
|
6 17.97674
|
||||||
|
2 17.993766
|
||||||
|
3 17.994066
|
||||||
|
4 17.994485
|
||||||
|
0 17.99579
|
||||||
|
1 17.996438
|
||||||
|
2 17.997483
|
||||||
|
0 18.073939
|
||||||
|
1 18.081198
|
||||||
|
2 18.096924
|
||||||
|
1 18.115596
|
||||||
|
2 18.12506
|
||||||
|
1 18.12506
|
||||||
|
3 18.12511
|
||||||
|
0 18.12551
|
||||||
|
2 18.13591
|
||||||
|
3 18.136247
|
||||||
|
1 18.138878
|
||||||
|
3 18.15338
|
||||||
|
5 18.15338
|
||||||
|
4 18.15338
|
||||||
|
4 18.15338
|
||||||
|
5 18.15563
|
||||||
|
5 18.15563
|
||||||
|
4 18.15563
|
||||||
|
6 18.15563
|
||||||
|
2 18.163673
|
||||||
|
3 18.163808
|
||||||
|
4 18.163991
|
||||||
|
0 18.175445
|
||||||
|
1 18.175705
|
||||||
|
2 18.176344
|
||||||
|
1 18.254621
|
||||||
|
1 18.259254
|
||||||
|
2 18.261217
|
||||||
|
3 18.261273
|
||||||
|
1 18.26138
|
||||||
|
0 18.261754
|
||||||
|
2 18.268438
|
||||||
|
3 18.268659
|
||||||
|
4 18.28189
|
||||||
|
3 18.28189
|
||||||
|
5 18.28189
|
||||||
|
4 18.28189
|
||||||
|
5 18.28358
|
||||||
|
5 18.28358
|
||||||
|
4 18.28358
|
||||||
|
6 18.28358
|
||||||
|
2 18.288011
|
||||||
|
3 18.288075
|
||||||
|
4 18.28818
|
||||||
|
2 18.29689
|
||||||
|
1 18.350218
|
||||||
|
1 18.35662
|
||||||
|
3 18.36122
|
||||||
|
0 18.36189
|
||||||
|
2 18.366415
|
||||||
|
3 18.36651
|
||||||
|
4 18.37695
|
||||||
|
4 18.37695
|
||||||
|
3 18.37695
|
||||||
|
5 18.37695
|
||||||
|
2 18.380951
|
||||||
|
3 18.38097
|
||||||
|
4 18.381039
|
||||||
|
1 18.422123
|
||||||
|
1 18.43362
|
||||||
|
0 18.43767
|
||||||
|
3 18.440871
|
||||||
|
4 18.4492
|
||||||
|
3 18.4492
|
||||||
|
5 18.4492
|
||||||
|
4 18.4492
|
||||||
|
2 18.45203
|
||||||
|
4 18.45203
|
||||||
|
3 18.45203
|
||||||
|
1 18.480338
|
||||||
|
0 18.49624
|
||||||
|
3 18.49864
|
||||||
|
4 18.50532
|
||||||
|
4 18.50532
|
||||||
|
3 18.50532
|
||||||
|
5 18.50532
|
||||||
|
3 18.50749
|
||||||
|
2 18.50749
|
||||||
|
4 18.50749
|
||||||
|
1 18.527848
|
||||||
|
0 18.54272
|
||||||
|
3 18.54444
|
||||||
|
3 18.55163
|
||||||
|
2 18.55163
|
||||||
|
4 18.55163
|
||||||
|
1 18.56678
|
||||||
|
0 18.58015
|
||||||
|
3 18.58134
|
||||||
|
4 18.58725
|
||||||
|
1 18.59886
|
||||||
|
3 18.61147
|
||||||
|
2 18.61644
|
||||||
|
4 18.61644
|
||||||
|
3 18.61644
|
||||||
|
3 18.63649
|
||||||
|
4 18.64064
|
||||||
|
2 18.64064
|
||||||
|
3 18.64064
|
||||||
|
3 18.65743
|
||||||
|
1 18.658729
|
||||||
|
2 18.661751
|
||||||
|
3 18.665098
|
||||||
|
3 18.67506
|
||||||
|
3 18.69017
|
||||||
@@ -0,0 +1,426 @@
|
|||||||
|
0 0
|
||||||
|
2 11.54835433
|
||||||
|
1 11.62359262
|
||||||
|
0 11.72316029
|
||||||
|
1 11.82807106
|
||||||
|
1 12.90701519
|
||||||
|
3 13.0757156
|
||||||
|
2 13.09487245
|
||||||
|
1 13.15314376
|
||||||
|
2 13.17177759
|
||||||
|
0 13.27303799
|
||||||
|
1 13.28263891
|
||||||
|
2 13.30222736
|
||||||
|
1 13.32785693
|
||||||
|
0 13.4798867
|
||||||
|
0 13.8450383
|
||||||
|
1 13.8636685
|
||||||
|
2 13.9034545
|
||||||
|
4 13.9792372
|
||||||
|
3 14.012738
|
||||||
|
2 14.0630271
|
||||||
|
2 14.0682976
|
||||||
|
1 14.0899684
|
||||||
|
3 14.0990558
|
||||||
|
1 14.1525149
|
||||||
|
2 14.2136714
|
||||||
|
2 14.2340225
|
||||||
|
3 14.236106
|
||||||
|
0 14.2410276
|
||||||
|
1 14.2550855
|
||||||
|
1 14.3036683
|
||||||
|
1 14.46399565
|
||||||
|
3 14.49905352
|
||||||
|
2 14.50606752
|
||||||
|
1 14.52491318
|
||||||
|
2 14.52891337
|
||||||
|
0 14.57594866
|
||||||
|
1 14.68065021
|
||||||
|
1 14.68711812
|
||||||
|
2 14.68829018
|
||||||
|
0 14.6936396
|
||||||
|
1 14.71089798
|
||||||
|
0 14.73811524
|
||||||
|
2 14.74254073
|
||||||
|
4 14.7570515
|
||||||
|
3 14.780512
|
||||||
|
2 14.809271
|
||||||
|
3 14.824298
|
||||||
|
2 14.83881088
|
||||||
|
1 14.84836887
|
||||||
|
1 14.85923
|
||||||
|
1 14.9014415
|
||||||
|
2 14.901491
|
||||||
|
5 14.903785
|
||||||
|
4 14.9037901
|
||||||
|
3 14.9065891
|
||||||
|
2 14.9066279
|
||||||
|
3 14.9090844
|
||||||
|
4 14.9090891
|
||||||
|
2 14.95260461
|
||||||
|
2 14.95485191
|
||||||
|
3 14.97152223
|
||||||
|
1 15.00356575
|
||||||
|
1 15.0106101
|
||||||
|
0 15.0140654
|
||||||
|
1 15.02208821
|
||||||
|
3 15.0225908
|
||||||
|
2 15.0258687
|
||||||
|
1 15.0339718
|
||||||
|
2 15.0356401
|
||||||
|
0 15.06039
|
||||||
|
3 15.0830791
|
||||||
|
4 15.0830843
|
||||||
|
3 15.0832026
|
||||||
|
2 15.0832455
|
||||||
|
0 15.10054359
|
||||||
|
1 15.11774626
|
||||||
|
4 15.13054424
|
||||||
|
2 15.13684834
|
||||||
|
3 15.14592818
|
||||||
|
2 15.1610485
|
||||||
|
3 15.1669462
|
||||||
|
2 15.18063346
|
||||||
|
1 15.18550787
|
||||||
|
1 15.1898238
|
||||||
|
1 15.2006145
|
||||||
|
1 15.2016574
|
||||||
|
2 15.2048087
|
||||||
|
1 15.2111333
|
||||||
|
2 15.2111761
|
||||||
|
5 15.21232
|
||||||
|
4 15.2123275
|
||||||
|
3 15.2138407
|
||||||
|
2 15.2138685
|
||||||
|
2 15.214033
|
||||||
|
3 15.214033
|
||||||
|
5 15.214453
|
||||||
|
6 15.214453
|
||||||
|
3 15.2150708
|
||||||
|
4 15.2150745
|
||||||
|
3 15.215275
|
||||||
|
4 15.215275
|
||||||
|
5 15.215711
|
||||||
|
4 15.215711
|
||||||
|
0 15.2240874
|
||||||
|
1 15.2713716
|
||||||
|
3 15.2755697
|
||||||
|
2 15.277418
|
||||||
|
1 15.281661
|
||||||
|
2 15.2824812
|
||||||
|
2 15.29629312
|
||||||
|
0 15.2977957
|
||||||
|
1 15.30807757
|
||||||
|
2 15.312729
|
||||||
|
0 15.3131552
|
||||||
|
3 15.31916789
|
||||||
|
4 15.3310399
|
||||||
|
3 15.34600286
|
||||||
|
2 15.3502991
|
||||||
|
1 15.351173
|
||||||
|
2 15.3525602
|
||||||
|
3 15.3532631
|
||||||
|
0 15.3582945
|
||||||
|
1 15.3594355
|
||||||
|
2 15.3620413
|
||||||
|
1 15.3660894
|
||||||
|
1 15.37367
|
||||||
|
1 15.3791362
|
||||||
|
2 15.379156
|
||||||
|
5 15.3798184
|
||||||
|
4 15.3798219
|
||||||
|
3 15.3804102
|
||||||
|
2 15.3804418
|
||||||
|
2 15.380867
|
||||||
|
3 15.380867
|
||||||
|
5 15.381105
|
||||||
|
6 15.381105
|
||||||
|
3 15.3812603
|
||||||
|
4 15.3812614
|
||||||
|
4 15.381548
|
||||||
|
3 15.381548
|
||||||
|
5 15.3818
|
||||||
|
4 15.3818
|
||||||
|
3 15.3908613
|
||||||
|
4 15.3908649
|
||||||
|
3 15.3910528
|
||||||
|
2 15.3910804
|
||||||
|
4 15.392422
|
||||||
|
5 15.392422
|
||||||
|
4 15.392452
|
||||||
|
3 15.392452
|
||||||
|
1 15.412684
|
||||||
|
3 15.417313
|
||||||
|
2 15.418289
|
||||||
|
1 15.420697
|
||||||
|
2 15.421298
|
||||||
|
0 15.428512
|
||||||
|
0 15.4393423
|
||||||
|
1 15.4428361
|
||||||
|
2 15.4489133
|
||||||
|
4 15.449653
|
||||||
|
1 15.453818
|
||||||
|
3 15.4545664
|
||||||
|
1 15.454748
|
||||||
|
2 15.455677
|
||||||
|
2 15.4598315
|
||||||
|
3 15.4626992
|
||||||
|
0 15.4670044
|
||||||
|
2 15.469705
|
||||||
|
1 15.471072
|
||||||
|
1 15.471767
|
||||||
|
1 15.480312
|
||||||
|
2 15.480336
|
||||||
|
5 15.4807415
|
||||||
|
4 15.4807431
|
||||||
|
3 15.481284
|
||||||
|
2 15.481298
|
||||||
|
5 15.481568
|
||||||
|
6 15.481568
|
||||||
|
4 15.481715
|
||||||
|
3 15.481715
|
||||||
|
3 15.481736
|
||||||
|
4 15.481743
|
||||||
|
6 15.481779
|
||||||
|
7 15.481779
|
||||||
|
1 15.502923
|
||||||
|
3 15.504736
|
||||||
|
2 15.505434
|
||||||
|
2 15.5062612
|
||||||
|
1 15.50703
|
||||||
|
2 15.507341
|
||||||
|
2 15.5120815
|
||||||
|
0 15.513213
|
||||||
|
1 15.5148656
|
||||||
|
3 15.5166145
|
||||||
|
0 15.518227
|
||||||
|
4 15.5252749
|
||||||
|
3 15.531428
|
||||||
|
2 15.5331
|
||||||
|
1 15.533516
|
||||||
|
2 15.534133
|
||||||
|
3 15.534435
|
||||||
|
2 15.538932
|
||||||
|
1 15.539168
|
||||||
|
0 15.539521
|
||||||
|
1 15.54182
|
||||||
|
1 15.54592
|
||||||
|
2 15.545925
|
||||||
|
4 15.5461
|
||||||
|
5 15.546201
|
||||||
|
3 15.546505
|
||||||
|
2 15.546515
|
||||||
|
4 15.546836
|
||||||
|
3 15.546837
|
||||||
|
3 15.5578645
|
||||||
|
4 15.557869
|
||||||
|
3 15.557927
|
||||||
|
2 15.5579539
|
||||||
|
4 15.558869
|
||||||
|
5 15.558869
|
||||||
|
3 15.55888
|
||||||
|
4 15.55888
|
||||||
|
1 15.560694
|
||||||
|
3 15.56247
|
||||||
|
2 15.56289
|
||||||
|
1 15.56393
|
||||||
|
2 15.564211
|
||||||
|
0 15.56768
|
||||||
|
0 15.571806
|
||||||
|
1 15.574036
|
||||||
|
4 15.576338
|
||||||
|
2 15.57711
|
||||||
|
3 15.578861
|
||||||
|
2 15.581278
|
||||||
|
3 15.582381
|
||||||
|
2 15.585975
|
||||||
|
1 15.586724
|
||||||
|
1 15.587059
|
||||||
|
1 15.58939
|
||||||
|
1 15.590858
|
||||||
|
2 15.590858
|
||||||
|
5 15.591055
|
||||||
|
4 15.591055
|
||||||
|
2 15.59134
|
||||||
|
3 15.59134
|
||||||
|
3 15.591527
|
||||||
|
4 15.591527
|
||||||
|
1 15.5944
|
||||||
|
1 15.595192
|
||||||
|
2 15.596214
|
||||||
|
0 15.601121
|
||||||
|
1 15.6027
|
||||||
|
2 15.60298
|
||||||
|
1 15.60382
|
||||||
|
2 15.603879
|
||||||
|
0 15.60822
|
||||||
|
0 15.609082
|
||||||
|
1 15.609434
|
||||||
|
2 15.61041
|
||||||
|
4 15.612396
|
||||||
|
3 15.613644
|
||||||
|
2 15.615273
|
||||||
|
3 15.616707
|
||||||
|
1 15.61945
|
||||||
|
2 15.61945
|
||||||
|
1 15.620065
|
||||||
|
2 15.62305
|
||||||
|
1 15.62305
|
||||||
|
3 15.62329
|
||||||
|
2 15.62329
|
||||||
|
2 15.628592
|
||||||
|
2 15.629998
|
||||||
|
1 15.63101
|
||||||
|
2 15.63185
|
||||||
|
2 15.63256
|
||||||
|
3 15.63311
|
||||||
|
1 15.634328
|
||||||
|
0 15.634608
|
||||||
|
0 15.636217
|
||||||
|
4 15.638791
|
||||||
|
3 15.641168
|
||||||
|
2 15.641867
|
||||||
|
1 15.64208
|
||||||
|
2 15.642146
|
||||||
|
3 15.642246
|
||||||
|
2 15.644102
|
||||||
|
1 15.64447
|
||||||
|
0 15.64715
|
||||||
|
1 15.64731
|
||||||
|
2 15.64823
|
||||||
|
1 15.64823
|
||||||
|
3 15.64823
|
||||||
|
2 15.64823
|
||||||
|
1 15.648234
|
||||||
|
2 15.65341
|
||||||
|
2 15.65392
|
||||||
|
0 15.6555
|
||||||
|
0 15.656894
|
||||||
|
1 15.658293
|
||||||
|
3 15.658563
|
||||||
|
4 15.658564
|
||||||
|
3 15.65858
|
||||||
|
2 15.6586
|
||||||
|
4 15.658675
|
||||||
|
5 15.659364
|
||||||
|
6 15.659364
|
||||||
|
4 15.659394
|
||||||
|
5 15.659394
|
||||||
|
2 15.659522
|
||||||
|
3 15.659853
|
||||||
|
2 15.660823
|
||||||
|
3 15.661188
|
||||||
|
2 15.662767
|
||||||
|
1 15.66317
|
||||||
|
1 15.66344
|
||||||
|
1 15.66482
|
||||||
|
2 15.66482
|
||||||
|
2 15.6649
|
||||||
|
3 15.6649
|
||||||
|
2 15.66995
|
||||||
|
2 15.67036
|
||||||
|
1 15.673207
|
||||||
|
4 15.674054
|
||||||
|
2 15.674169
|
||||||
|
3 15.674827
|
||||||
|
2 15.675582
|
||||||
|
3 15.675992
|
||||||
|
1 15.67754
|
||||||
|
1 15.67754
|
||||||
|
2 15.67889
|
||||||
|
1 15.67889
|
||||||
|
3 15.67895
|
||||||
|
2 15.67895
|
||||||
|
2 15.68311
|
||||||
|
2 15.68358
|
||||||
|
0 15.684998
|
||||||
|
1 15.685197
|
||||||
|
2 15.68582
|
||||||
|
4 15.686152
|
||||||
|
3 15.686933
|
||||||
|
0 15.687
|
||||||
|
3 15.68773
|
||||||
|
1 15.68884
|
||||||
|
1 15.68891
|
||||||
|
2 15.69003
|
||||||
|
2 15.69008
|
||||||
|
2 15.69329
|
||||||
|
1 15.69495
|
||||||
|
1 15.69792
|
||||||
|
1 15.69812
|
||||||
|
2 15.69905
|
||||||
|
2 15.69905
|
||||||
|
2 15.70166
|
||||||
|
1 15.70278
|
||||||
|
1 15.70533
|
||||||
|
1 15.70562
|
||||||
|
2 15.70638
|
||||||
|
2 15.70638
|
||||||
|
1 15.70897
|
||||||
|
1 15.7113
|
||||||
|
1 15.71184
|
||||||
|
2 15.71255
|
||||||
|
2 15.71255
|
||||||
|
1 15.71347
|
||||||
|
1 15.71605
|
||||||
|
1 15.71682
|
||||||
|
1 15.71727
|
||||||
|
1 15.71754
|
||||||
|
1 15.72035
|
||||||
|
1 15.72148
|
||||||
|
1 15.72159
|
||||||
|
1 15.72415
|
||||||
|
1 15.72526
|
||||||
|
1 15.72526
|
||||||
|
1 15.72747
|
||||||
|
1 15.72845
|
||||||
|
1 15.73035
|
||||||
|
1 15.73121
|
||||||
|
1 15.73285
|
||||||
|
1 15.73364
|
||||||
|
1 15.73507
|
||||||
|
1 15.73576
|
||||||
|
1 15.73703
|
||||||
|
1 15.73765
|
||||||
|
1 15.73876
|
||||||
|
1 15.73931
|
||||||
|
1 15.74028
|
||||||
|
1 15.7408
|
||||||
|
1 15.74165
|
||||||
|
1 15.74212
|
||||||
|
1 15.74289
|
||||||
|
1 15.74333
|
||||||
|
1 15.74401
|
||||||
|
1 15.74438
|
||||||
|
1 15.74503
|
||||||
|
1 15.74535
|
||||||
|
1 15.74596
|
||||||
|
1 15.74624
|
||||||
|
1 15.7468
|
||||||
|
1 15.74703
|
||||||
|
1 15.74757
|
||||||
|
1 15.74778
|
||||||
|
1 15.74844
|
||||||
|
1 15.74906
|
||||||
|
1 15.74963
|
||||||
|
1 15.75015
|
||||||
|
1 15.75062
|
||||||
|
1 15.75108
|
||||||
|
1 15.75147
|
||||||
|
1 15.75191
|
||||||
|
1 15.75223
|
||||||
|
1 15.75254
|
||||||
|
1 15.75287
|
||||||
|
1 15.75315
|
||||||
|
1 15.75342
|
||||||
|
1 15.75368
|
||||||
|
1 15.75392
|
||||||
|
1 15.75414
|
||||||
|
1 15.75435
|
||||||
|
1 15.75457
|
||||||
|
1 15.75475
|
||||||
|
1 15.75492
|
||||||
|
1 15.75509
|
||||||
|
1 15.75528
|
||||||
|
1 15.75544
|
||||||
|
1 15.75558
|
||||||
@@ -0,0 +1,416 @@
|
|||||||
|
1.5 0
|
||||||
|
0.5 0.17749368
|
||||||
|
0.5 13.4797525
|
||||||
|
3.5 16.40650172
|
||||||
|
2.5 16.42557609
|
||||||
|
1.5 16.44411432
|
||||||
|
0.5 16.45737768
|
||||||
|
2.5 16.64385425
|
||||||
|
1.5 16.74852877
|
||||||
|
0.5 16.81247211
|
||||||
|
1.5 17.1400273
|
||||||
|
0.5 17.26583338
|
||||||
|
4.5 17.62885618
|
||||||
|
3.5 17.69466466
|
||||||
|
2.5 17.74309086
|
||||||
|
1.5 17.77579247
|
||||||
|
0.5 17.94175095
|
||||||
|
1.5 18.06063973
|
||||||
|
0.5 18.25395187
|
||||||
|
1.5 18.28805513
|
||||||
|
2.5 18.33428069
|
||||||
|
1.5 18.42654895
|
||||||
|
2.5 18.45411386
|
||||||
|
3.5 18.49586888
|
||||||
|
2.5 18.61594234
|
||||||
|
1.5 18.6565209
|
||||||
|
2.5 18.73243921
|
||||||
|
4.5 19.11606881
|
||||||
|
3.5 19.11886215
|
||||||
|
2.5 19.22290199
|
||||||
|
1.5 19.261084
|
||||||
|
0.5 19.30534474
|
||||||
|
3.5 19.49453372
|
||||||
|
2.5 19.54901161
|
||||||
|
1.5 19.61030772
|
||||||
|
0.5 19.6425819
|
||||||
|
2.5 19.68004879
|
||||||
|
1.5 19.76226091
|
||||||
|
0.5 19.8010864
|
||||||
|
1.5 19.86715687
|
||||||
|
1.5 19.96749891
|
||||||
|
0.5 19.97253806
|
||||||
|
2.5 20.24656508
|
||||||
|
3.5 20.27222673
|
||||||
|
0.5 20.74354589
|
||||||
|
2.5 21.12703333
|
||||||
|
3.5 21.14307527
|
||||||
|
1.5 21.35179967
|
||||||
|
2.5 21.36689086
|
||||||
|
0.5 21.42648933
|
||||||
|
1.5 21.42814592
|
||||||
|
1.5 21.49240221
|
||||||
|
2.5 21.49804969
|
||||||
|
1.5 21.62407043
|
||||||
|
0.5 21.67504259
|
||||||
|
2.5 22.26659785
|
||||||
|
1.5 22.30870468
|
||||||
|
2.5 22.51480375
|
||||||
|
1.5 22.59266341
|
||||||
|
0.5 22.68306524
|
||||||
|
1.5 22.70037738
|
||||||
|
3.5 22.77287946
|
||||||
|
2.5 22.78797899
|
||||||
|
0.5 22.80250953
|
||||||
|
1.5 22.81135824
|
||||||
|
0.5 22.82463943
|
||||||
|
0.5 22.83687146
|
||||||
|
4.5 22.94864794
|
||||||
|
3.5 23.01454534
|
||||||
|
2.5 23.07028979
|
||||||
|
0.5 23.0823033
|
||||||
|
1.5 23.10328497
|
||||||
|
1.5 23.11937796
|
||||||
|
3.5 23.16223797
|
||||||
|
2.5 23.17153551
|
||||||
|
2.5 23.25811355
|
||||||
|
2.5 23.4040274
|
||||||
|
1.5 23.43808861
|
||||||
|
3.5 23.48447022
|
||||||
|
0.5 23.4872861
|
||||||
|
2.5 23.5142042
|
||||||
|
0.5 23.54889293
|
||||||
|
1.5 23.57017702
|
||||||
|
0.5 23.58132402
|
||||||
|
1.5 23.61990867
|
||||||
|
2.5 23.62038658
|
||||||
|
1.5 23.63042474
|
||||||
|
0.5 23.64787986
|
||||||
|
0.5 23.67388014
|
||||||
|
1.5 23.68252216
|
||||||
|
1.5 23.70200875
|
||||||
|
1.5 23.80181422
|
||||||
|
0.5 23.84631446
|
||||||
|
2.5 23.87401492
|
||||||
|
1.5 23.8932498
|
||||||
|
4.5 24.15215466
|
||||||
|
3.5 24.15487203
|
||||||
|
2.5 24.15972844
|
||||||
|
3.5 24.16242376
|
||||||
|
1.5 24.17649215
|
||||||
|
2.5 24.18078715
|
||||||
|
5.5 24.19224869
|
||||||
|
4.5 24.19283478
|
||||||
|
0.5 24.21181391
|
||||||
|
1.5 24.21382608
|
||||||
|
2.5 24.2841313
|
||||||
|
1.5 24.28439423
|
||||||
|
1.5 24.31038395
|
||||||
|
2.5 24.31205364
|
||||||
|
4.5 24.31372301
|
||||||
|
3.5 24.31566947
|
||||||
|
3.5 24.33873385
|
||||||
|
2.5 24.34003106
|
||||||
|
3.5 24.37801662
|
||||||
|
2.5 24.37939715
|
||||||
|
3.5 24.62264148
|
||||||
|
4.5 24.62377584
|
||||||
|
2.5 24.64962188
|
||||||
|
1.5 24.69002841
|
||||||
|
0.5 24.72822996
|
||||||
|
1.5 24.73797755
|
||||||
|
2.5 24.75714519
|
||||||
|
3.5 24.78188485
|
||||||
|
2.5 24.79184041
|
||||||
|
1.5 24.79461079
|
||||||
|
1.5 24.80084252
|
||||||
|
0.5 24.81053026
|
||||||
|
3.5 24.81406469
|
||||||
|
1.5 24.81564805
|
||||||
|
2.5 24.82597055
|
||||||
|
4.5 24.8455785
|
||||||
|
0.5 24.8472311
|
||||||
|
0.5 24.87417675
|
||||||
|
3.5 24.90601819
|
||||||
|
0.5 24.92458905
|
||||||
|
1.5 24.96363449
|
||||||
|
2.5 24.96441862
|
||||||
|
3.5 24.99631786
|
||||||
|
1.5 25.01018319
|
||||||
|
2.5 25.01776175
|
||||||
|
2.5 25.063301
|
||||||
|
2.5 25.06414228
|
||||||
|
1.5 25.07625711
|
||||||
|
0.5 25.09695258
|
||||||
|
3.5 25.09810859
|
||||||
|
1.5 25.10272979
|
||||||
|
2.5 25.11230549
|
||||||
|
1.5 25.1697599
|
||||||
|
2.5 25.18754626
|
||||||
|
3.5 25.19328777
|
||||||
|
1.5 25.21157074
|
||||||
|
2.5 25.23101738
|
||||||
|
0.5 25.24248265
|
||||||
|
1.5 25.25941436
|
||||||
|
0.5 25.26633074
|
||||||
|
1.5 25.28263129
|
||||||
|
1.5 25.30688069
|
||||||
|
2.5 25.30939825
|
||||||
|
1.5 25.34451469
|
||||||
|
0.5 25.3566343
|
||||||
|
2.5 25.3653893
|
||||||
|
0.5 25.4080131
|
||||||
|
4.5 25.40905451
|
||||||
|
3.5 25.41070102
|
||||||
|
2.5 25.41398897
|
||||||
|
3.5 25.41628609
|
||||||
|
1.5 25.42374213
|
||||||
|
2.5 25.42657172
|
||||||
|
5.5 25.42923138
|
||||||
|
4.5 25.4297081
|
||||||
|
0.5 25.43912875
|
||||||
|
1.5 25.44082553
|
||||||
|
5.5 25.4430437
|
||||||
|
4.5 25.44305883
|
||||||
|
3.5 25.44339216
|
||||||
|
4.5 25.44339244
|
||||||
|
1.5 25.4442245
|
||||||
|
0.5 25.44689479
|
||||||
|
2.5 25.44775873
|
||||||
|
3.5 25.44777255
|
||||||
|
5.5 25.45069396
|
||||||
|
6.5 25.45069568
|
||||||
|
1.5 25.45407058
|
||||||
|
2.5 25.45408929
|
||||||
|
1.5 25.55357392
|
||||||
|
2.5 25.5556695
|
||||||
|
4.5 25.55720882
|
||||||
|
3.5 25.55922131
|
||||||
|
3.5 25.57120002
|
||||||
|
2.5 25.57239391
|
||||||
|
2.5 25.58252196
|
||||||
|
3.5 25.58253753
|
||||||
|
5.5 25.58388208
|
||||||
|
4.5 25.58388814
|
||||||
|
4.5 25.59001225
|
||||||
|
3.5 25.59001366
|
||||||
|
3.5 25.61810011
|
||||||
|
2.5 25.61906777
|
||||||
|
3.5 25.6423382
|
||||||
|
4.5 25.64233863
|
||||||
|
2.5 25.67654265
|
||||||
|
1.5 25.69912045
|
||||||
|
3.5 25.75083545
|
||||||
|
2.5 25.75728005
|
||||||
|
4.5 25.78089135
|
||||||
|
1.5 25.79018386
|
||||||
|
3.5 25.80645186
|
||||||
|
1.5 25.81968404
|
||||||
|
0.5 25.82951751
|
||||||
|
0.5 25.84843705
|
||||||
|
0.5 25.86208739
|
||||||
|
1.5 25.8621367
|
||||||
|
2.5 25.87220283
|
||||||
|
1.5 25.8748983
|
||||||
|
0.5 25.88366471
|
||||||
|
5.5 25.88831342
|
||||||
|
4.5 25.88831388
|
||||||
|
2.5 25.9020759
|
||||||
|
2.5 25.9029353
|
||||||
|
1.5 25.90321055
|
||||||
|
3.5 25.91464492
|
||||||
|
2.5 25.93733129
|
||||||
|
3.5 25.94352364
|
||||||
|
2.5 25.94387967
|
||||||
|
1.5 25.94596892
|
||||||
|
3.5 25.95459851
|
||||||
|
4.5 25.95463991
|
||||||
|
2.5 25.95946532
|
||||||
|
2.5 25.962013
|
||||||
|
1.5 25.962023
|
||||||
|
1.5 25.963967
|
||||||
|
1.5 25.98677759
|
||||||
|
2.5 26.05226943
|
||||||
|
4.5 26.091093
|
||||||
|
3.5 26.09211652
|
||||||
|
2.5 26.094298
|
||||||
|
3.5 26.0959238
|
||||||
|
1.5 26.100289
|
||||||
|
2.5 26.1020359
|
||||||
|
5.5 26.102613
|
||||||
|
4.5 26.1030054
|
||||||
|
1.5 26.109201
|
||||||
|
5.5 26.1120177
|
||||||
|
4.5 26.11203373
|
||||||
|
4.5 26.1122347
|
||||||
|
3.5 26.11224062
|
||||||
|
2.5 26.114806
|
||||||
|
3.5 26.1148139
|
||||||
|
4.5 26.11562699
|
||||||
|
5.5 26.11562732
|
||||||
|
5.5 26.1156855
|
||||||
|
6.5 26.11568664
|
||||||
|
6.5 26.11633472
|
||||||
|
5.5 26.11636948
|
||||||
|
3.5 26.1168951
|
||||||
|
4.5 26.11689615
|
||||||
|
6.5 26.11799294
|
||||||
|
7.5 26.11799467
|
||||||
|
1.5 26.1183377
|
||||||
|
2.5 26.11835403
|
||||||
|
2.5 26.118834
|
||||||
|
3.5 26.11883558
|
||||||
|
1.5 26.23162078
|
||||||
|
2.5 26.23333874
|
||||||
|
4.5 26.2342579
|
||||||
|
3.5 26.23586727
|
||||||
|
3.5 26.242751
|
||||||
|
2.5 26.243632
|
||||||
|
2.5 26.250636
|
||||||
|
3.5 26.25064918
|
||||||
|
5.5 26.25146678
|
||||||
|
4.5 26.25147564
|
||||||
|
3.5 26.25389733
|
||||||
|
4.5 26.25389869
|
||||||
|
5.5 26.25427164
|
||||||
|
6.5 26.25427361
|
||||||
|
4.5 26.2550758
|
||||||
|
3.5 26.2550759
|
||||||
|
5.5 26.25625206
|
||||||
|
4.5 26.25625349
|
||||||
|
3.5 26.29349807
|
||||||
|
2.5 26.29420688
|
||||||
|
3.5 26.2957448
|
||||||
|
4.5 26.30919054
|
||||||
|
3.5 26.30921031
|
||||||
|
5.5 26.31161572
|
||||||
|
4.5 26.31161707
|
||||||
|
4.5 26.3124705
|
||||||
|
3.5 26.3270996
|
||||||
|
1.5 26.40024778
|
||||||
|
2.5 26.40040694
|
||||||
|
3.5 26.4457878
|
||||||
|
4.5 26.501521
|
||||||
|
3.5 26.502211
|
||||||
|
5.5 26.508766
|
||||||
|
4.5 26.508998
|
||||||
|
5.5 26.5151816
|
||||||
|
4.5 26.515188
|
||||||
|
4.5 26.5153215
|
||||||
|
3.5 26.5153366
|
||||||
|
3.5 26.5169562
|
||||||
|
2.5 26.516971
|
||||||
|
5.5 26.5175106
|
||||||
|
4.5 26.5175166
|
||||||
|
5.5 26.5175465
|
||||||
|
6.5 26.5175478
|
||||||
|
6.5 26.5178907
|
||||||
|
5.5 26.517891
|
||||||
|
5.5 26.5182798
|
||||||
|
6.5 26.5182802
|
||||||
|
3.5 26.5183115
|
||||||
|
4.5 26.5183131
|
||||||
|
6.5 26.5183399
|
||||||
|
7.5 26.51834059
|
||||||
|
4.5 26.51872775
|
||||||
|
5.5 26.51872874
|
||||||
|
6.5 26.5189883
|
||||||
|
7.5 26.5189883
|
||||||
|
1.5 26.519141
|
||||||
|
2.5 26.5191665
|
||||||
|
7.5 26.51920431
|
||||||
|
8.5 26.51920604
|
||||||
|
3.5 26.5194635
|
||||||
|
4.5 26.5194653
|
||||||
|
3.5 26.5195296
|
||||||
|
2.5 26.5195296
|
||||||
|
3.5 26.55553696
|
||||||
|
4.5 26.55611105
|
||||||
|
2.5 26.61538
|
||||||
|
3.5 26.633348
|
||||||
|
3.5 26.63580564
|
||||||
|
4.5 26.642424
|
||||||
|
4.5 26.643572
|
||||||
|
3.5 26.643649
|
||||||
|
2.5 26.64561317
|
||||||
|
2.5 26.6534541
|
||||||
|
3.5 26.6534596
|
||||||
|
5.5 26.6539915
|
||||||
|
4.5 26.6540013
|
||||||
|
3.5 26.6556189
|
||||||
|
4.5 26.6556189
|
||||||
|
5.5 26.6558587
|
||||||
|
6.5 26.6558599
|
||||||
|
3.5 26.656228
|
||||||
|
4.5 26.6563034
|
||||||
|
4.5 26.65633139
|
||||||
|
5.5 26.65633274
|
||||||
|
6.5 26.6564535
|
||||||
|
7.5 26.65645547
|
||||||
|
5.5 26.6571105
|
||||||
|
4.5 26.6571107
|
||||||
|
6.5 26.65721708
|
||||||
|
5.5 26.65721849
|
||||||
|
0.5 26.66475708
|
||||||
|
3.5 26.7113731
|
||||||
|
4.5 26.7114154
|
||||||
|
4.5 26.7129918
|
||||||
|
5.5 26.7129931
|
||||||
|
5.5 26.71346418
|
||||||
|
6.5 26.7134642
|
||||||
|
4.5 26.767405
|
||||||
|
5.5 26.772202
|
||||||
|
4.5 26.772359
|
||||||
|
5.5 26.778505
|
||||||
|
6.5 26.778524
|
||||||
|
6.5 26.778743
|
||||||
|
5.5 26.778749
|
||||||
|
6.5 26.7787807
|
||||||
|
7.5 26.778782
|
||||||
|
4.5 26.7790112
|
||||||
|
5.5 26.7790128
|
||||||
|
6.5 26.7790639
|
||||||
|
7.5 26.7790642
|
||||||
|
7.5 26.7790991
|
||||||
|
8.5 26.7790998
|
||||||
|
7.5 26.7792083
|
||||||
|
8.5 26.7792087
|
||||||
|
5.5 26.7792433
|
||||||
|
6.5 26.7792443
|
||||||
|
4.5 26.7794125
|
||||||
|
3.5 26.7794125
|
||||||
|
8.5 26.7794752
|
||||||
|
9.5 26.779477
|
||||||
|
4.5 26.7795604
|
||||||
|
5.5 26.779562
|
||||||
|
0.5 26.889959
|
||||||
|
6.5 26.9166427
|
||||||
|
7.5 26.9166439
|
||||||
|
5.5 26.9166671
|
||||||
|
4.5 26.9166671
|
||||||
|
5.5 26.917031
|
||||||
|
6.5 26.9170324
|
||||||
|
7.5 26.917078
|
||||||
|
8.5 26.91708
|
||||||
|
5.5 26.9172074
|
||||||
|
6.5 26.9172074
|
||||||
|
7.5 26.9174372
|
||||||
|
6.5 26.9174385
|
||||||
|
5.5 26.9736915
|
||||||
|
6.5 26.9736926
|
||||||
|
7.5 26.9739783
|
||||||
|
6.5 26.9739797
|
||||||
|
4.5 27.14521093
|
||||||
|
5.5 27.145213
|
||||||
|
2.5 27.152775
|
||||||
|
1.5 27.153005
|
||||||
|
2.5 27.171451
|
||||||
|
3.5 27.17246
|
||||||
|
6.5 27.1777813
|
||||||
|
5.5 27.1777818
|
||||||
|
3.5 27.1831192
|
||||||
|
2.5 27.183137
|
||||||
|
3.5 27.19190849
|
||||||
|
4.5 27.19191019
|
||||||
|
4.5 27.19247952
|
||||||
|
5.5 27.1924832
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
1.5 0
|
||||||
|
1.5 1.3133
|
||||||
|
2.5 1.35324
|
||||||
|
0.5 2.25479
|
||||||
|
1.5 2.312
|
||||||
|
0.5 6.28523
|
||||||
|
1.5 6.39885
|
||||||
|
2.5 6.5585
|
||||||
|
0.5 6.58797
|
||||||
|
1.5 6.77019
|
||||||
|
2.5 6.86456
|
||||||
|
1.5 7.05019
|
||||||
|
0.5 7.12762
|
||||||
|
0.5 7.457333
|
||||||
|
0.5 7.53719
|
||||||
|
2.5 7.5401
|
||||||
|
1.5 7.54255
|
||||||
|
1.5 7.54573
|
||||||
|
2.5 7.64797
|
||||||
|
1.5 7.69028
|
||||||
|
0.5 7.73637
|
||||||
|
1.5 7.75576
|
||||||
|
2.5 7.78014
|
||||||
|
3.5 7.79504
|
||||||
|
2.5 7.84607
|
||||||
|
1.5 7.87344
|
||||||
|
1.5 7.89122
|
||||||
|
1.5 7.9326
|
||||||
|
0.5 7.93272
|
||||||
|
0.5 7.95011
|
||||||
|
2.5 7.95597
|
||||||
|
0.5 7.97513
|
||||||
|
1.5 7.97744
|
||||||
|
2.5 8.01428
|
||||||
|
1.5 8.02024
|
||||||
|
1.5 8.0356
|
||||||
|
0.5 8.12064
|
||||||
|
1.5 8.24311
|
||||||
|
0.5 8.2559
|
||||||
|
2.5 8.2729
|
||||||
|
3.5 8.28031
|
||||||
|
0.5 8.30803
|
||||||
|
1.5 8.42102
|
||||||
|
1.5 8.4682
|
||||||
|
0.5 8.46992
|
||||||
|
2.5 8.48085
|
||||||
|
1.5 8.59395
|
||||||
|
0.5 8.63485
|
||||||
|
1.5 8.63485
|
||||||
|
2.5 8.64149
|
||||||
|
1.5 8.64149
|
||||||
|
0.5 8.6642
|
||||||
|
1.5 8.67065
|
||||||
|
2.5 8.72559
|
||||||
|
1.5 8.74294
|
||||||
|
0.5 8.776947
|
||||||
|
2.5 8.78073
|
||||||
|
3.5 8.79389
|
||||||
|
1.5 8.80956
|
||||||
|
1.5 8.80972
|
||||||
|
2.5 8.81912
|
||||||
|
0.5 8.82756
|
||||||
|
1.5 8.87992
|
||||||
|
0.5 8.90159
|
||||||
|
1.5 8.9174
|
||||||
|
0.5 8.91749
|
||||||
|
1.5 8.91839
|
||||||
|
1.5 8.94236
|
||||||
|
1.5 8.9424
|
||||||
|
3.5 8.96922
|
||||||
|
3.5 8.97431
|
||||||
|
0.5 8.97638
|
||||||
|
2.5 8.98909
|
||||||
|
1.5 8.99126
|
||||||
|
1.5 9.00377
|
||||||
|
1.5 9.02345
|
||||||
|
0.5 9.02612
|
||||||
|
2.5 9.04395
|
||||||
|
1.5 9.0812
|
||||||
|
2.5 9.12102
|
||||||
|
1.5 9.12102
|
||||||
|
1.5 9.12958
|
||||||
|
1.5 9.18099
|
||||||
|
2.5 9.18099
|
||||||
|
0.5 9.19266
|
||||||
|
1.5 9.19266
|
||||||
|
2.5 9.231
|
||||||
|
2.5 9.23101
|
||||||
|
1.5 9.27532
|
||||||
|
0.5 9.30948
|
||||||
|
1.5 9.30948
|
||||||
|
3.5 9.3206
|
||||||
|
1.5 9.32069
|
||||||
|
2.5 9.32069
|
||||||
|
2.5 9.37056
|
||||||
|
1.5 9.37056
|
||||||
|
1.5 9.39793
|
||||||
|
0.5 9.39793
|
||||||
|
1.5 9.43225
|
||||||
|
1.5 9.5264
|
||||||
|
2.5 9.5264
|
||||||
|
1.5 9.56187
|
||||||
|
2.5 9.56187
|
||||||
|
2.5 9.58057
|
||||||
|
1.5 9.58057
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
0 0
|
||||||
|
1 0.131856
|
||||||
|
2 0.315087
|
||||||
|
2 1.251722
|
||||||
|
0 2.80187
|
||||||
|
2 6.796452
|
||||||
|
1 9.143821
|
||||||
|
2 9.157762
|
||||||
|
3 9.205135
|
||||||
|
0 9.7613866
|
||||||
|
1 9.810662
|
||||||
|
2 10.1058186
|
||||||
|
1 10.2682738
|
||||||
|
2 10.3031865
|
||||||
|
1 10.4935496
|
||||||
|
0 10.4950672
|
||||||
|
2 10.551782
|
||||||
|
2 11.01341
|
||||||
|
3 11.102742
|
||||||
|
4 11.2735633
|
||||||
|
1 11.8194858
|
||||||
|
1 12.0159504
|
||||||
|
2 12.0407422
|
||||||
|
0 12.1800117
|
||||||
|
1 12.2826194
|
||||||
|
1 12.2968909
|
||||||
|
3 12.2991084
|
||||||
|
2 12.3424802
|
||||||
|
2 12.4307957
|
||||||
|
3 12.4469098
|
||||||
|
1 12.5335504
|
||||||
|
1 12.5829384
|
||||||
|
2 12.6854929
|
||||||
|
2 12.6950786
|
||||||
|
3 12.7067793
|
||||||
|
0 12.7145901
|
||||||
|
1 12.720152
|
||||||
|
0 13.1162797
|
||||||
|
1 13.518742
|
||||||
|
2 13.8281726
|
||||||
|
0 14.1960985
|
||||||
|
1 14.2211478
|
||||||
|
2 14.5539893
|
||||||
|
1 14.5985628
|
||||||
|
2 14.7407617
|
||||||
|
1 14.7559507
|
||||||
|
3 14.8208307
|
||||||
|
2 14.9741091
|
||||||
|
1 14.974155
|
||||||
|
1 15.046643
|
||||||
|
1 15.052008
|
||||||
|
4 15.0570762
|
||||||
|
2 15.060626
|
||||||
|
3 15.0667254
|
||||||
|
3 15.0728052
|
||||||
|
2 15.0795879
|
||||||
|
4 15.0798835
|
||||||
|
0 15.103301
|
||||||
|
3 15.230581
|
||||||
|
2 15.2783314
|
||||||
|
1 15.3120154
|
||||||
|
0 15.3147634
|
||||||
|
1 15.3373263
|
||||||
|
2 15.347815
|
||||||
|
3 15.3686629
|
||||||
|
3 15.3913875
|
||||||
|
2 15.3943218
|
||||||
|
4 15.3999125
|
||||||
|
3 15.4231497
|
||||||
|
1 15.448328
|
||||||
|
2 15.4550232
|
||||||
|
3 15.4556492
|
||||||
|
5 15.4616011
|
||||||
|
4 15.4819645
|
||||||
|
2 15.4937239
|
||||||
|
1 15.5238662
|
||||||
|
2 15.5285847
|
||||||
|
0 15.645909
|
||||||
|
1 15.6974168
|
||||||
|
0 15.9410653
|
||||||
|
1 15.9554943
|
||||||
|
2 16.2011197
|
||||||
|
3 16.2601245
|
||||||
|
2 16.27378
|
||||||
|
1 16.295108
|
||||||
|
1 16.297394
|
||||||
|
2 16.3089954
|
||||||
|
3 16.3417421
|
||||||
|
3 16.3500684
|
||||||
|
4 16.3508889
|
||||||
|
2 16.3530534
|
||||||
|
1 16.353266
|
||||||
|
1 16.3558129
|
||||||
|
2 16.364958
|
||||||
|
0 16.3797741
|
||||||
|
4 16.4014642
|
||||||
|
4 16.401617
|
||||||
|
3 16.4017477
|
||||||
|
4 16.557597
|
||||||
|
3 16.6022904
|
||||||
|
2 16.6042997
|
||||||
|
2 16.6424968
|
||||||
|
1 16.646351
|
||||||
|
0 16.649041
|
||||||
|
1 16.677424
|
||||||
|
3 16.68325
|
||||||
|
4 16.688936
|
||||||
|
3 16.6921077
|
||||||
|
3 16.6951881
|
||||||
|
2 16.701155
|
||||||
|
2 16.7155124
|
||||||
|
5 16.7170239
|
||||||
|
3 16.7178849
|
||||||
|
1 16.731498
|
||||||
|
4 16.7319194
|
||||||
|
1 16.7522507
|
||||||
|
4 16.7538428
|
||||||
|
5 16.7538905
|
||||||
|
1 16.7548891
|
||||||
|
2 16.756146
|
||||||
|
2 16.760749
|
||||||
|
4 16.7616057
|
||||||
|
5 16.7616168
|
||||||
|
6 16.7734499
|
||||||
|
5 16.7735456
|
||||||
|
0 16.816517
|
||||||
|
0 16.82385
|
||||||
|
1 16.828805
|
||||||
|
2 16.960136
|
||||||
|
2 16.998408
|
||||||
|
3 17.001298
|
||||||
|
1 17.029842
|
||||||
|
4 17.0403275
|
||||||
|
3 17.041571
|
||||||
|
2 17.043986
|
||||||
|
2 17.179899
|
||||||
|
1 17.194019
|
||||||
|
0 17.3182
|
||||||
|
1 17.321329
|
||||||
|
4 17.326144
|
||||||
|
2 17.337763
|
||||||
|
1 17.362058
|
||||||
|
0 17.368502
|
||||||
|
2 17.380944
|
||||||
|
3 17.384175
|
||||||
|
4 17.387781
|
||||||
|
3 17.392886
|
||||||
|
2 17.400278
|
||||||
|
5 17.403337
|
||||||
|
3 17.405235
|
||||||
|
4 17.41226
|
||||||
|
1 17.414321
|
||||||
|
1 17.422962
|
||||||
|
2 17.428248
|
||||||
|
3 17.431769
|
||||||
|
6 17.439726
|
||||||
|
2 17.456359
|
||||||
|
3 17.460675
|
||||||
|
0 17.46544
|
||||||
|
2 17.6825
|
||||||
|
1 17.689347
|
||||||
|
0 17.7956
|
||||||
|
5 17.817444
|
||||||
|
6 17.841636
|
||||||
|
0 17.85467
|
||||||
|
5 18.08586
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
0.5 0
|
||||||
|
2.5 1.1358412
|
||||||
|
1.5 2.657625
|
||||||
|
0.5 4.6319245
|
||||||
|
1.5 5.1050013
|
||||||
|
2.5 5.2276114
|
||||||
|
3.5 5.6458926
|
||||||
|
2.5 5.7249677
|
||||||
|
2.5 5.75026
|
||||||
|
1.5 5.8281789
|
||||||
|
4.5 6.0376767
|
||||||
|
3.5 6.3267765
|
||||||
|
1.5 6.3519001
|
||||||
|
1.5 6.38333
|
||||||
|
2.5 6.40427
|
||||||
|
3.5 6.54663
|
||||||
|
0.5 6.595503
|
||||||
|
0.5 6.7553081
|
||||||
|
0.5 6.90995
|
||||||
|
1.5 6.9562261
|
||||||
|
2.5 7.2675524
|
||||||
|
1.5 7.2959014
|
||||||
|
2.5 7.40349
|
||||||
|
0.5 7.443125
|
||||||
|
1.5 7.529373
|
||||||
|
2.5 7.59466
|
||||||
|
1.5 7.63288
|
||||||
|
1.5 7.68102
|
||||||
|
2.5 7.6912
|
||||||
|
1.5 7.81164
|
||||||
|
0.5 8.02703
|
||||||
|
0.5 8.258
|
||||||
|
1.5 8.29582
|
||||||
|
1.5 8.36514
|
||||||
|
3.5 8.36711
|
||||||
|
2.5 8.36769
|
||||||
|
2.5 8.37026
|
||||||
|
3.5 8.40755
|
||||||
|
0.5 8.5153
|
||||||
|
2.5 8.51835
|
||||||
|
1.5 8.67534
|
||||||
|
2.5 8.67984
|
||||||
|
0.5 8.75543
|
||||||
|
1.5 8.75989
|
||||||
|
2.5 8.8304
|
||||||
|
1.5 8.84682
|
||||||
|
2.5 8.85004
|
||||||
|
0.5 8.89138
|
||||||
|
1.5 8.94717
|
||||||
|
2.5 8.94804
|
||||||
|
0.5 8.97595
|
||||||
|
1.5 9.01242
|
||||||
|
2.5 9.01301
|
||||||
|
0.5 9.03194
|
||||||
|
1.5 9.05717
|
||||||
|
2.5 9.05764
|
||||||
|
0.5 9.07094
|
||||||
|
1.5 9.08905
|
||||||
|
2.5 9.0896
|
||||||
|
1.5 9.11289
|
||||||
|
2.5 9.11315
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
0 0
|
||||||
|
3 1.8646693
|
||||||
|
2 2.1871576
|
||||||
|
1 3.4425152
|
||||||
|
2 3.6725668
|
||||||
|
4 5.0187253
|
||||||
|
2 6.0145843
|
||||||
|
3 6.4690625
|
||||||
|
2 7.2148425
|
||||||
|
0 7.2593028
|
||||||
|
1 7.6559522
|
||||||
|
2 7.817615
|
||||||
|
3 8.0594184
|
||||||
|
4 8.9882504
|
||||||
|
2 9.0729517
|
||||||
|
1 9.1009161
|
||||||
|
3 9.2729612
|
||||||
|
2 9.5045914
|
||||||
|
1 10.1245282
|
||||||
|
0 10.2428033
|
||||||
|
3 10.6254706
|
||||||
|
1 10.6263843
|
||||||
|
2 10.7327747
|
||||||
|
3 13.4117366
|
||||||
|
2 13.4685821
|
||||||
|
1 14.388434
|
||||||
|
4 14.4994965
|
||||||
|
2 14.5142881
|
||||||
|
3 14.5696308
|
||||||
|
2 14.809478
|
||||||
|
3 14.9099825
|
||||||
|
1 14.9801336
|
||||||
|
2 15.0168146
|
||||||
|
2 15.09932
|
||||||
|
1 15.10896
|
||||||
|
4 15.25772
|
||||||
|
3 15.29268
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
0.5 0
|
||||||
|
1.5 0.0018953
|
||||||
|
0.5 3.551829
|
||||||
|
1.5 3.552404
|
||||||
|
2.5 3.553189
|
||||||
|
0.5 4.96428892
|
||||||
|
2.5 5.9334881
|
||||||
|
1.5 5.9335272
|
||||||
|
0.5 6.02710323
|
||||||
|
1.5 6.0273242
|
||||||
|
1.5 6.79032863
|
||||||
|
2.5 6.79034652
|
||||||
|
0.5 6.82039969
|
||||||
|
0.5 7.16460459
|
||||||
|
1.5 7.16468328
|
||||||
|
2.5 7.43824
|
||||||
|
1.5 7.43824
|
||||||
|
2.5 7.4429048
|
||||||
|
3.5 7.44290547
|
||||||
|
0.5 7.4572049
|
||||||
|
0.5 7.616794
|
||||||
|
0.5 7.7468013
|
||||||
|
2.5 7.7472151
|
||||||
|
1.5 7.7472151
|
||||||
|
3.5 7.75106542
|
||||||
|
2.5 7.75106542
|
||||||
|
0.5 7.843642
|
||||||
|
0.5 7.8805147
|
||||||
|
1.5 7.9158111
|
||||||
|
2.5 7.9158111
|
||||||
|
2.5 7.9184152
|
||||||
|
3.5 7.9184152
|
||||||
|
0.5 7.9543323
|
||||||
|
0.5 7.973224
|
||||||
|
1.5 8.0174819
|
||||||
|
2.5 8.0174819
|
||||||
|
3.5 8.0192663
|
||||||
|
2.5 8.0192663
|
||||||
|
0.5 8.033195
|
||||||
|
0.5 8.05455
|
||||||
|
2.5 8.083434
|
||||||
|
1.5 8.083434
|
||||||
|
3.5 8.084685
|
||||||
|
2.5 8.084685
|
||||||
|
0.5 8.092472
|
||||||
|
0.5 8.10865
|
||||||
|
1.5 8.128612
|
||||||
|
2.5 8.129514
|
||||||
|
0.5 8.134526
|
||||||
|
1.5 8.160905
|
||||||
|
2.5 8.16154
|
||||||
|
1.5 8.184766
|
||||||
|
2.5 8.185267
|
||||||
|
1.5 8.202911
|
||||||
|
1.5 8.217013
|
||||||
|
1.5 8.2282
|
||||||
|
1.5 8.237217
|
||||||
|
1.5 8.244597
|
||||||
|
1.5 8.250713
|
||||||
|
1.5 8.255835
|
||||||
|
1.5 8.260166
|
||||||
|
1.5 8.263862
|
||||||
|
1.5 8.267041
|
||||||
|
1.5 8.269799
|
||||||
|
1.5 8.272202
|
||||||
|
1.5 8.274317
|
||||||
|
1.5 8.276199
|
||||||
|
1.5 8.277831
|
||||||
|
1.5 8.279304
|
||||||
|
1.5 8.280617
|
||||||
|
1.5 8.281811
|
||||||
|
1.5 8.282847
|
||||||
|
1.5 8.283842
|
||||||
|
1.5 8.284757
|
||||||
|
1.5 8.285501
|
||||||
|
1.5 8.286204
|
||||||
|
1.5 8.2869
|
||||||
|
1.5 8.287515
|
||||||
|
1.5 8.288075
|
||||||
|
1.5 8.288595
|
||||||
|
1.5 8.289038
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
0 0
|
||||||
|
0 4.629017
|
||||||
|
1 4.629775
|
||||||
|
2 4.631777
|
||||||
|
1 9.1000074
|
||||||
|
0 12.263448
|
||||||
|
1 12.264501
|
||||||
|
2 12.266161
|
||||||
|
2 12.6913659
|
||||||
|
0 15.82797
|
||||||
|
1 16.089904
|
||||||
|
0 17.062984
|
||||||
|
0 17.852478
|
||||||
|
1 17.852554
|
||||||
|
2 17.852994
|
||||||
|
1 17.866487
|
||||||
|
2 18.67818
|
||||||
|
3 18.67818
|
||||||
|
1 18.67818
|
||||||
|
2 19.178634
|
||||||
|
1 20.624138
|
||||||
|
0 20.821325
|
||||||
|
1 21.150629
|
||||||
|
0 21.268988
|
||||||
|
1 21.268988
|
||||||
|
2 21.268988
|
||||||
|
2 21.582342
|
||||||
|
3 21.582342
|
||||||
|
1 21.582342
|
||||||
|
3 21.685249
|
||||||
|
4 21.685249
|
||||||
|
2 21.685249
|
||||||
|
3 21.68755
|
||||||
|
2 21.765055
|
||||||
|
1 22.428384
|
||||||
|
0 22.509583
|
||||||
|
0 22.52122
|
||||||
|
1 22.522418
|
||||||
|
2 22.525047
|
||||||
|
1 22.53607
|
||||||
|
0 22.765831
|
||||||
|
2 22.765831
|
||||||
|
1 22.765831
|
||||||
|
1 22.891664
|
||||||
|
3 22.891664
|
||||||
|
2 22.891664
|
||||||
|
3 22.925767
|
||||||
|
2 22.925767
|
||||||
|
4 22.925767
|
||||||
|
3 22.93189
|
||||||
|
4 22.969542
|
||||||
|
4 22.969542
|
||||||
|
3 22.969542
|
||||||
|
5 22.969542
|
||||||
|
2 22.977146
|
||||||
|
1 23.139161
|
||||||
|
1 23.33018
|
||||||
|
0 23.3772
|
||||||
|
1 23.448881
|
||||||
|
0 23.52507
|
||||||
|
1 23.58854
|
||||||
|
1 23.5892
|
||||||
|
3 23.598145
|
||||||
|
2 23.598145
|
||||||
|
4 23.598145
|
||||||
|
3 23.610195
|
||||||
|
4 23.637442
|
||||||
|
4 23.637442
|
||||||
|
3 23.637442
|
||||||
|
5 23.637442
|
||||||
|
2 23.63813
|
||||||
|
1 23.6853
|
||||||
|
2 23.68651
|
||||||
|
3 23.68884
|
||||||
|
1 23.8347
|
||||||
|
0 23.8686
|
||||||
|
1 23.95703
|
||||||
|
2 24.0005
|
||||||
|
1 24.0026
|
||||||
|
1 24.0155
|
||||||
|
2 24.03605
|
||||||
|
3 24.04031
|
||||||
|
0 24.1699
|
||||||
|
1 24.1744
|
||||||
|
1 24.2488
|
||||||
|
0 24.25152
|
||||||
|
1 24.252328
|
||||||
|
2 24.253671
|
||||||
|
2 24.25694
|
||||||
|
1 24.2798
|
||||||
|
2 24.42236
|
||||||
|
1 24.4398
|
||||||
|
1 24.4683
|
||||||
|
2 24.50482
|
||||||
|
2 24.51102
|
||||||
|
3 24.51213
|
||||||
|
4 24.51399
|
||||||
|
2 24.514173
|
||||||
|
1 24.596
|
||||||
|
1 24.85612
|
||||||
|
2 24.85659
|
||||||
|
3 24.857254
|
||||||
|
0 24.88693
|
||||||
@@ -0,0 +1,355 @@
|
|||||||
|
0 0
|
||||||
|
1 1.120069
|
||||||
|
2 1.1425765
|
||||||
|
3 1.1898184
|
||||||
|
2 1.4128433
|
||||||
|
0 1.5207931
|
||||||
|
1 1.5667416
|
||||||
|
2 1.6756148
|
||||||
|
1 2.239187
|
||||||
|
2 2.5954895
|
||||||
|
3 2.6346884
|
||||||
|
4 2.6810061
|
||||||
|
2 2.7356673
|
||||||
|
3 2.8451178
|
||||||
|
2 2.8593299
|
||||||
|
2 2.8608594
|
||||||
|
0 2.8775552
|
||||||
|
1 2.911146
|
||||||
|
4 2.9454987
|
||||||
|
2 2.9655675
|
||||||
|
1 2.9994298
|
||||||
|
2 3.04152
|
||||||
|
3 3.0971047
|
||||||
|
0 3.1792184
|
||||||
|
1 3.1869034
|
||||||
|
2 3.2181982
|
||||||
|
1 3.2434629
|
||||||
|
0 3.31748
|
||||||
|
3 3.3247932
|
||||||
|
0 3.5001025
|
||||||
|
1 3.5402722
|
||||||
|
2 3.7488886
|
||||||
|
1 3.8057714
|
||||||
|
0 3.8117069
|
||||||
|
2 3.8125974
|
||||||
|
1 3.8206365
|
||||||
|
3 3.8209593
|
||||||
|
2 3.8419281
|
||||||
|
1 4.0353178
|
||||||
|
1 4.0673225
|
||||||
|
2 4.0845074
|
||||||
|
3 4.1567687
|
||||||
|
2 4.1901713
|
||||||
|
1 4.2037286
|
||||||
|
0 4.2614611
|
||||||
|
0 4.276699
|
||||||
|
2 4.290196
|
||||||
|
3 4.2919167
|
||||||
|
4 4.2936693
|
||||||
|
3 4.3067613
|
||||||
|
1 4.317552
|
||||||
|
2 4.3821487
|
||||||
|
2 4.4159388
|
||||||
|
0 4.41985
|
||||||
|
1 4.422392
|
||||||
|
1 4.4273875
|
||||||
|
2 4.4333
|
||||||
|
2 4.4339461
|
||||||
|
3 4.4368084
|
||||||
|
1 4.4500985
|
||||||
|
3 4.4503378
|
||||||
|
1 4.4552241
|
||||||
|
3 4.4839272
|
||||||
|
2 4.488279
|
||||||
|
4 4.5067216
|
||||||
|
1 4.5187987
|
||||||
|
1 4.524894
|
||||||
|
3 4.5268127
|
||||||
|
3 4.5414237
|
||||||
|
5 4.5672889
|
||||||
|
1 4.5753479
|
||||||
|
0 4.5760435
|
||||||
|
1 4.5861731
|
||||||
|
2 4.5952823
|
||||||
|
2 4.5970212
|
||||||
|
2 4.5984244
|
||||||
|
1 4.5992541
|
||||||
|
4 4.6037857
|
||||||
|
0 4.616452
|
||||||
|
3 4.6223942
|
||||||
|
2 4.6363727
|
||||||
|
3 4.6393548
|
||||||
|
2 4.6413703
|
||||||
|
3 4.6498893
|
||||||
|
4 4.6524014
|
||||||
|
3 4.6543896
|
||||||
|
0 4.6712
|
||||||
|
4 4.6781875
|
||||||
|
3 4.6791306
|
||||||
|
1 4.683538
|
||||||
|
2 4.6912279
|
||||||
|
1 4.703572
|
||||||
|
1 4.7066767
|
||||||
|
2 4.708199
|
||||||
|
3 4.7099655
|
||||||
|
1 4.7142585
|
||||||
|
4 4.733344
|
||||||
|
2 4.7445797
|
||||||
|
1 4.7733742
|
||||||
|
2 4.7803629
|
||||||
|
0 4.7937
|
||||||
|
2 4.8125334
|
||||||
|
3 4.8129894
|
||||||
|
4 4.8137165
|
||||||
|
3 4.8209895
|
||||||
|
0 4.82596
|
||||||
|
1 4.855247
|
||||||
|
3 4.8584076
|
||||||
|
1 4.874061
|
||||||
|
2 4.8769188
|
||||||
|
1 4.882846
|
||||||
|
2 4.893034
|
||||||
|
0 4.918682
|
||||||
|
2 4.9194668
|
||||||
|
3 4.9197831
|
||||||
|
4 4.9200805
|
||||||
|
3 4.9228057
|
||||||
|
1 4.946161
|
||||||
|
1 4.948997
|
||||||
|
2 4.949718
|
||||||
|
2 4.950787
|
||||||
|
1 4.957154
|
||||||
|
2 4.959163
|
||||||
|
3 4.977549
|
||||||
|
2 4.987109
|
||||||
|
0 4.988349
|
||||||
|
4 4.996567
|
||||||
|
5 4.996567
|
||||||
|
3 4.996567
|
||||||
|
4 4.996567
|
||||||
|
1 5.008416
|
||||||
|
2 5.009789
|
||||||
|
1 5.00988
|
||||||
|
2 5.010649
|
||||||
|
3 5.011864
|
||||||
|
1 5.012517
|
||||||
|
2 5.019325
|
||||||
|
1 5.029916
|
||||||
|
2 5.035478
|
||||||
|
0 5.036015
|
||||||
|
1 5.041552
|
||||||
|
3 5.041687
|
||||||
|
4 5.041887
|
||||||
|
5 5.041887
|
||||||
|
4 5.041887
|
||||||
|
1 5.044224
|
||||||
|
3 5.045983
|
||||||
|
1 5.050126
|
||||||
|
1 5.050721
|
||||||
|
2 5.051334
|
||||||
|
1 5.05144
|
||||||
|
2 5.052109
|
||||||
|
3 5.052133
|
||||||
|
1 5.054244
|
||||||
|
2 5.056253
|
||||||
|
3 5.066901
|
||||||
|
1 5.0672
|
||||||
|
0 5.069908
|
||||||
|
1 5.07018
|
||||||
|
2 5.070351
|
||||||
|
2 5.071663
|
||||||
|
4 5.074104
|
||||||
|
5 5.074273
|
||||||
|
3 5.074273
|
||||||
|
4 5.074273
|
||||||
|
1 5.080085
|
||||||
|
4 5.080166
|
||||||
|
1 5.081167
|
||||||
|
2 5.081227
|
||||||
|
3 5.081768
|
||||||
|
2 5.081774
|
||||||
|
1 5.082265
|
||||||
|
2 5.084309
|
||||||
|
1 5.085778
|
||||||
|
1 5.09355
|
||||||
|
0 5.093757
|
||||||
|
0 5.094883
|
||||||
|
1 5.095403
|
||||||
|
2 5.09584
|
||||||
|
5 5.098133
|
||||||
|
3 5.098133
|
||||||
|
4 5.098133
|
||||||
|
4 5.098229
|
||||||
|
1 5.103168
|
||||||
|
2 5.103456
|
||||||
|
2 5.103491
|
||||||
|
1 5.103564
|
||||||
|
2 5.103761
|
||||||
|
3 5.103775
|
||||||
|
1 5.106116
|
||||||
|
2 5.108737
|
||||||
|
1 5.112594
|
||||||
|
0 5.113753
|
||||||
|
2 5.1145
|
||||||
|
4 5.116389
|
||||||
|
5 5.116389
|
||||||
|
3 5.116389
|
||||||
|
4 5.116389
|
||||||
|
0 5.120043
|
||||||
|
1 5.12017
|
||||||
|
2 5.120464
|
||||||
|
1 5.120495
|
||||||
|
2 5.120597
|
||||||
|
3 5.120649
|
||||||
|
1 5.121524
|
||||||
|
2 5.122468
|
||||||
|
1 5.12752
|
||||||
|
0 5.128273
|
||||||
|
3 5.130461
|
||||||
|
5 5.130511
|
||||||
|
4 5.130511
|
||||||
|
4 5.130511
|
||||||
|
1 5.133491
|
||||||
|
3 5.133686
|
||||||
|
1 5.133754
|
||||||
|
2 5.133755
|
||||||
|
2 5.13383
|
||||||
|
1 5.134315
|
||||||
|
2 5.135125
|
||||||
|
0 5.138056
|
||||||
|
1 5.139301
|
||||||
|
3 5.140308
|
||||||
|
0 5.141352
|
||||||
|
4 5.141698
|
||||||
|
5 5.141698
|
||||||
|
4 5.141698
|
||||||
|
3 5.141744
|
||||||
|
1 5.144116
|
||||||
|
1 5.144298
|
||||||
|
2 5.144328
|
||||||
|
2 5.14438
|
||||||
|
1 5.144649
|
||||||
|
3 5.144801
|
||||||
|
2 5.145344
|
||||||
|
1 5.14871
|
||||||
|
0 5.149715
|
||||||
|
5 5.150265
|
||||||
|
4 5.15077
|
||||||
|
3 5.15077
|
||||||
|
4 5.15077
|
||||||
|
5 5.151579
|
||||||
|
1 5.15266
|
||||||
|
1 5.152715
|
||||||
|
2 5.152886
|
||||||
|
2 5.152923
|
||||||
|
1 5.153061
|
||||||
|
3 5.153102
|
||||||
|
2 5.153662
|
||||||
|
1 5.154069
|
||||||
|
1 5.156839
|
||||||
|
0 5.157222
|
||||||
|
3 5.158174
|
||||||
|
4 5.158174
|
||||||
|
4 5.158174
|
||||||
|
5 5.158225
|
||||||
|
1 5.159766
|
||||||
|
2 5.159914
|
||||||
|
2 5.159942
|
||||||
|
1 5.15995
|
||||||
|
1 5.159989
|
||||||
|
3 5.160031
|
||||||
|
2 5.160517
|
||||||
|
1 5.163048
|
||||||
|
0 5.163481
|
||||||
|
2 5.163675
|
||||||
|
4 5.164288
|
||||||
|
4 5.164288
|
||||||
|
3 5.164288
|
||||||
|
5 5.164322
|
||||||
|
1 5.165622
|
||||||
|
1 5.165759
|
||||||
|
1 5.165762
|
||||||
|
2 5.165762
|
||||||
|
3 5.16584
|
||||||
|
2 5.166231
|
||||||
|
1 5.168367
|
||||||
|
0 5.168729
|
||||||
|
2 5.168876
|
||||||
|
3 5.169386
|
||||||
|
4 5.169438
|
||||||
|
5 5.169438
|
||||||
|
4 5.169438
|
||||||
|
1 5.170544
|
||||||
|
1 5.170617
|
||||||
|
2 5.170654
|
||||||
|
1 5.170662
|
||||||
|
3 5.170696
|
||||||
|
2 5.171029
|
||||||
|
1 5.172864
|
||||||
|
0 5.173166
|
||||||
|
2 5.173289
|
||||||
|
3 5.173443
|
||||||
|
3 5.173796
|
||||||
|
4 5.173796
|
||||||
|
5 5.173796
|
||||||
|
4 5.173796
|
||||||
|
1 5.174704
|
||||||
|
2 5.174777
|
||||||
|
2 5.174802
|
||||||
|
1 5.174821
|
||||||
|
3 5.174993
|
||||||
|
2 5.175108
|
||||||
|
1 5.176689
|
||||||
|
0 5.17695
|
||||||
|
2 5.17702
|
||||||
|
4 5.177467
|
||||||
|
4 5.177467
|
||||||
|
5 5.177467
|
||||||
|
3 5.177467
|
||||||
|
2 5.177571
|
||||||
|
1 5.178243
|
||||||
|
2 5.178345
|
||||||
|
1 5.178365
|
||||||
|
3 5.17847
|
||||||
|
2 5.178488
|
||||||
|
2 5.178597
|
||||||
|
1 5.179982
|
||||||
|
0 5.180206
|
||||||
|
2 5.18031
|
||||||
|
4 5.180656
|
||||||
|
4 5.180656
|
||||||
|
5 5.180656
|
||||||
|
3 5.180656
|
||||||
|
1 5.181298
|
||||||
|
2 5.181391
|
||||||
|
1 5.181437
|
||||||
|
2 5.18146
|
||||||
|
3 5.181515
|
||||||
|
2 5.181612
|
||||||
|
2 5.183109
|
||||||
|
5 5.183427
|
||||||
|
3 5.183427
|
||||||
|
4 5.183427
|
||||||
|
4 5.183427
|
||||||
|
2 5.184006
|
||||||
|
1 5.184081
|
||||||
|
2 5.184218
|
||||||
|
2 5.185552
|
||||||
|
5 5.185803
|
||||||
|
3 5.185803
|
||||||
|
4 5.185803
|
||||||
|
4 5.185803
|
||||||
|
2 5.187686
|
||||||
|
2 5.187701
|
||||||
|
4 5.187777
|
||||||
|
5 5.187985
|
||||||
|
3 5.187985
|
||||||
|
4 5.187985
|
||||||
|
4 5.188197
|
||||||
|
2 5.189588
|
||||||
|
5 5.18982
|
||||||
|
3 5.18982
|
||||||
|
4 5.18982
|
||||||
|
4 5.189843
|
||||||
|
1 5.19877
|
||||||
@@ -0,0 +1,161 @@
|
|||||||
|
0.5 0
|
||||||
|
1.5 0.6042806
|
||||||
|
2.5 0.7035864
|
||||||
|
0.5 2.5121134
|
||||||
|
1.5 2.7217512
|
||||||
|
0.5 5.2513724
|
||||||
|
1.5 5.6970084
|
||||||
|
2.5 5.7224717
|
||||||
|
2.5 5.9833059
|
||||||
|
3.5 6.011167
|
||||||
|
0.5 6.1235574
|
||||||
|
1.5 6.2006159
|
||||||
|
2.5 7.1155674
|
||||||
|
3.5 7.1454249
|
||||||
|
0.5 7.1942092
|
||||||
|
1.5 7.4142865
|
||||||
|
2.5 7.4260246
|
||||||
|
0.5 7.60513
|
||||||
|
1.5 7.64263
|
||||||
|
3.5 7.8143179
|
||||||
|
4.5 7.8143179
|
||||||
|
2.5 8.008924
|
||||||
|
3.5 8.021416
|
||||||
|
0.5 8.1437341
|
||||||
|
1.5 8.2664791
|
||||||
|
2.5 8.2729188
|
||||||
|
0.5 8.37032
|
||||||
|
1.5 8.39142
|
||||||
|
4.5 8.4837545
|
||||||
|
3.5 8.4837545
|
||||||
|
2.5 8.581163
|
||||||
|
3.5 8.587203
|
||||||
|
0.5 8.680702
|
||||||
|
1.5 8.7557946
|
||||||
|
2.5 8.7597197
|
||||||
|
0.5 8.81897
|
||||||
|
1.5 8.83204
|
||||||
|
4.5 8.8875125
|
||||||
|
3.5 8.8875125
|
||||||
|
2.5 8.944563
|
||||||
|
3.5 8.947963
|
||||||
|
0.5 9.014306
|
||||||
|
1.5 9.063441
|
||||||
|
2.5 9.066016
|
||||||
|
0.5 9.1049
|
||||||
|
1.5 9.11367
|
||||||
|
4.5 9.149522
|
||||||
|
3.5 9.149522
|
||||||
|
2.5 9.186119
|
||||||
|
3.5 9.188335
|
||||||
|
0.5 9.235785
|
||||||
|
1.5 9.269741
|
||||||
|
2.5 9.271511
|
||||||
|
0.5 9.29849
|
||||||
|
1.5 9.30463
|
||||||
|
4.5 9.329083
|
||||||
|
3.5 9.329083
|
||||||
|
2.5 9.3543
|
||||||
|
3.5 9.35572
|
||||||
|
2.5 9.4161
|
||||||
|
3.5 9.457475
|
||||||
|
4.5 9.457475
|
||||||
|
2.5 9.47557
|
||||||
|
3.5 9.47657
|
||||||
|
2.5 9.56591
|
||||||
|
3.5 9.5667
|
||||||
|
2.5 9.6348
|
||||||
|
3.5 9.6354
|
||||||
|
3.5 9.691
|
||||||
|
2.5 9.691
|
||||||
|
0.5 9.802072
|
||||||
|
1.5 9.806772
|
||||||
|
2.5 9.807007
|
||||||
|
0.5 9.82457
|
||||||
|
1.5 9.828503
|
||||||
|
2.5 9.828712
|
||||||
|
0.5 9.843494
|
||||||
|
1.5 9.84683
|
||||||
|
2.5 9.847002
|
||||||
|
0.5 9.859593
|
||||||
|
1.5 9.862423
|
||||||
|
2.5 9.862514
|
||||||
|
0.5 9.873367
|
||||||
|
1.5 9.875834
|
||||||
|
2.5 9.875956
|
||||||
|
0.5 9.885263
|
||||||
|
1.5 9.887395
|
||||||
|
2.5 9.887509
|
||||||
|
0.5 9.895597
|
||||||
|
1.5 9.89745
|
||||||
|
2.5 9.897548
|
||||||
|
0.5 9.904643
|
||||||
|
1.5 9.906272
|
||||||
|
2.5 9.906366
|
||||||
|
0.5 9.9126
|
||||||
|
1.5 9.91404
|
||||||
|
2.5 9.914112
|
||||||
|
0.5 9.919631
|
||||||
|
1.5 9.920906
|
||||||
|
2.5 9.92097
|
||||||
|
0.5 9.925879
|
||||||
|
1.5 9.927022
|
||||||
|
2.5 9.927072
|
||||||
|
0.5 9.931468
|
||||||
|
2.5 9.932509
|
||||||
|
1.5 9.932509
|
||||||
|
0.5 9.936452
|
||||||
|
1.5 9.937403
|
||||||
|
2.5 9.937403
|
||||||
|
0.5 9.940965
|
||||||
|
1.5 9.941813
|
||||||
|
2.5 9.941813
|
||||||
|
0.5 9.945037
|
||||||
|
2.5 9.945795
|
||||||
|
1.5 9.945795
|
||||||
|
0.5 9.948711
|
||||||
|
1.5 9.949406
|
||||||
|
2.5 9.949406
|
||||||
|
0.5 9.95206
|
||||||
|
1.5 9.952693
|
||||||
|
2.5 9.952693
|
||||||
|
0.5 9.955107
|
||||||
|
2.5 9.955684
|
||||||
|
1.5 9.955684
|
||||||
|
0.5 9.957906
|
||||||
|
2.5 9.958429
|
||||||
|
1.5 9.958429
|
||||||
|
0.5 9.960456
|
||||||
|
1.5 9.960945
|
||||||
|
2.5 9.960945
|
||||||
|
0.5 9.962794
|
||||||
|
2.5 9.963235
|
||||||
|
1.5 9.963235
|
||||||
|
0.5 9.964957
|
||||||
|
2.5 9.965366
|
||||||
|
1.5 9.965366
|
||||||
|
0.5 9.966948
|
||||||
|
1.5 9.96733
|
||||||
|
2.5 9.96733
|
||||||
|
0.5 9.968792
|
||||||
|
2.5 9.969153
|
||||||
|
1.5 9.969153
|
||||||
|
0.5 9.970503
|
||||||
|
2.5 9.970829
|
||||||
|
1.5 9.970829
|
||||||
|
0.5 9.9721
|
||||||
|
1.5 9.972404
|
||||||
|
2.5 9.972404
|
||||||
|
0.5 9.973575
|
||||||
|
2.5 9.973855
|
||||||
|
1.5 9.973855
|
||||||
|
0.5 9.974959
|
||||||
|
2.5 9.975232
|
||||||
|
1.5 9.975232
|
||||||
|
0.5 9.976247
|
||||||
|
1.5 9.976486
|
||||||
|
2.5 9.976486
|
||||||
|
0.5 9.97744
|
||||||
|
1.5 9.977679
|
||||||
|
2.5 9.977679
|
||||||
|
0.5 9.978571
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
0 0
|
||||||
|
0 2.724959
|
||||||
|
1 2.7250394
|
||||||
|
2 2.72533
|
||||||
|
1 5.277431
|
||||||
|
1 6.457214
|
||||||
|
0 6.779116
|
||||||
|
2 7.052522
|
||||||
|
0 7.303593
|
||||||
|
1 7.303593
|
||||||
|
2 7.30364
|
||||||
|
0 7.401069
|
||||||
|
1 7.401245
|
||||||
|
2 7.401495
|
||||||
|
1 7.462279
|
||||||
|
2 7.693681
|
||||||
|
1 7.693681
|
||||||
|
3 7.693681
|
||||||
|
2 7.988092
|
||||||
|
1 7.99778
|
||||||
|
0 8.08939
|
||||||
|
2 8.283617
|
||||||
|
1 8.283617
|
||||||
|
0 8.283617
|
||||||
|
1 8.311243
|
||||||
|
1 8.423692
|
||||||
|
3 8.423692
|
||||||
|
2 8.423692
|
||||||
|
3 8.460808
|
||||||
|
2 8.460808
|
||||||
|
4 8.460808
|
||||||
|
3 8.460828
|
||||||
|
2 8.52774
|
||||||
|
1 8.556174
|
||||||
|
0 8.594857
|
||||||
|
1 8.687002
|
||||||
|
0 8.687002
|
||||||
|
2 8.687002
|
||||||
|
1 8.693833
|
||||||
|
1 8.753751
|
||||||
|
3 8.753751
|
||||||
|
2 8.753751
|
||||||
|
3 8.771847
|
||||||
|
2 8.771847
|
||||||
|
4 8.771847
|
||||||
|
3 8.77187
|
||||||
|
2 8.803168
|
||||||
|
1 8.82278
|
||||||
|
0 8.842696
|
||||||
|
1 8.893463
|
||||||
|
0 8.893463
|
||||||
|
2 8.893463
|
||||||
|
1 8.895381
|
||||||
|
1 8.93052
|
||||||
|
3 8.93052
|
||||||
|
2 8.93052
|
||||||
|
2 8.940693
|
||||||
|
4 8.940693
|
||||||
|
3 8.940693
|
||||||
|
3 8.940701
|
||||||
|
2 8.958016
|
||||||
|
1 8.97084
|
||||||
|
0 8.982442
|
||||||
|
1 9.013319
|
||||||
|
0 9.013319
|
||||||
|
2 9.013319
|
||||||
|
1 9.01387
|
||||||
|
1 9.03608
|
||||||
|
3 9.03608
|
||||||
|
2 9.03608
|
||||||
|
2 9.042366
|
||||||
|
4 9.042366
|
||||||
|
3 9.042366
|
||||||
|
3 9.042372
|
||||||
|
2 9.053006
|
||||||
|
1 9.06182
|
||||||
|
0 9.069019
|
||||||
|
1 9.089176
|
||||||
|
0 9.089176
|
||||||
|
2 9.089176
|
||||||
|
1 9.08924
|
||||||
|
3 9.104077
|
||||||
|
2 9.104077
|
||||||
|
1 9.104077
|
||||||
|
2 9.115295
|
||||||
|
0 9.12629
|
||||||
|
1 9.1388
|
||||||
|
1 9.15036
|
||||||
|
3 9.15036
|
||||||
|
2 9.15036
|
||||||
|
2 9.1583
|
||||||
|
0 9.1662
|
||||||
|
1 9.17597
|
||||||
|
1 9.18351
|
||||||
|
3 9.18351
|
||||||
|
2 9.18351
|
||||||
|
2 9.189198
|
||||||
|
0 9.19509
|
||||||
|
1 9.20224
|
||||||
|
2 9.20807
|
||||||
|
1 9.20807
|
||||||
|
3 9.20807
|
||||||
|
2 9.2122
|
||||||
|
1 9.22203
|
||||||
|
1 9.22632
|
||||||
|
3 9.22632
|
||||||
|
2 9.22632
|
||||||
|
2 9.22979
|
||||||
|
1 9.23733
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
0.5 0
|
||||||
|
0.5 3.9586597
|
||||||
|
1.5 3.959475
|
||||||
|
0.5 10.9393632
|
||||||
|
0.5 11.9638998
|
||||||
|
1.5 11.9641388
|
||||||
|
1.5 12.157217
|
||||||
|
2.5 12.157283
|
||||||
|
0.5 14.315766
|
||||||
|
0.5 14.724427
|
||||||
|
1.5 14.724527
|
||||||
|
1.5 14.806342
|
||||||
|
2.5 14.806371
|
||||||
|
2.5 14.80949
|
||||||
|
3.5 14.809506
|
||||||
|
0.5 15.787543
|
||||||
|
0.5 15.990443
|
||||||
|
1.5 15.990496
|
||||||
|
1.5 16.032413
|
||||||
|
2.5 16.032428
|
||||||
|
2.5 16.034114
|
||||||
|
3.5 16.034122
|
||||||
|
4.5 16.034313
|
||||||
|
3.5 16.034313
|
||||||
|
0.5 16.558888
|
||||||
|
0.5 16.674061
|
||||||
|
1.5 16.67409
|
||||||
|
2.5 16.698334
|
||||||
|
1.5 16.698334
|
||||||
|
2.5 16.699332
|
||||||
|
3.5 16.699336
|
||||||
|
4.5 16.699451
|
||||||
|
3.5 16.699451
|
||||||
|
4.5 16.699487
|
||||||
|
5.5 16.699487
|
||||||
|
0.5 17.01296
|
||||||
|
0.5 17.084523
|
||||||
|
1.5 17.084541
|
||||||
|
1.5 17.099798
|
||||||
|
2.5 17.099798
|
||||||
|
3.5 17.100435
|
||||||
|
2.5 17.100435
|
||||||
|
4.5 17.100534
|
||||||
|
3.5 17.100534
|
||||||
|
5.5 17.100537
|
||||||
|
4.5 17.100537
|
||||||
|
0.5 17.302635
|
||||||
|
0.5 17.350111
|
||||||
|
1.5 17.350123
|
||||||
|
2.5 17.360339
|
||||||
|
1.5 17.360339
|
||||||
|
3.5 17.360778
|
||||||
|
2.5 17.360778
|
||||||
|
4.5 17.360835
|
||||||
|
3.5 17.360835
|
||||||
|
4.5 17.36085
|
||||||
|
5.5 17.36085
|
||||||
|
0.5 17.498671
|
||||||
|
0.5 17.531767
|
||||||
|
1.5 17.531776
|
||||||
|
2.5 17.538947
|
||||||
|
1.5 17.538947
|
||||||
|
3.5 17.539257
|
||||||
|
2.5 17.539257
|
||||||
|
3.5 17.539294
|
||||||
|
4.5 17.539294
|
||||||
|
4.5 17.539303
|
||||||
|
5.5 17.539303
|
||||||
|
0.5 17.637476
|
||||||
|
0.5 17.661462
|
||||||
|
1.5 17.661468
|
||||||
|
2.5 17.666921
|
||||||
|
3.5 17.666921
|
||||||
|
3.5 17.666948
|
||||||
|
4.5 17.666948
|
||||||
|
4.5 17.666955
|
||||||
|
5.5 17.666955
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
1.5 0
|
||||||
|
1.5 1.4157804
|
||||||
|
2.5 1.9140062
|
||||||
|
0.5 2.685611
|
||||||
|
0.5 4.0404244
|
||||||
|
1.5 4.1119117
|
||||||
|
0.5 5.0988483
|
||||||
|
1.5 5.3239458
|
||||||
|
1.5 5.4444404
|
||||||
|
2.5 5.5565801
|
||||||
|
1.5 5.5625604
|
||||||
|
0.5 5.6928439
|
||||||
|
0.5 5.8735625
|
||||||
|
2.5 6.0119775
|
||||||
|
1.5 6.1323712
|
||||||
|
0.5 6.198897
|
||||||
|
1.5 6.3255609
|
||||||
|
2.5 6.3428448
|
||||||
|
0.5 6.478839
|
||||||
|
0.5 6.6296
|
||||||
|
2.5 6.68009
|
||||||
|
0.5 6.681972
|
||||||
|
1.5 6.692275
|
||||||
|
0.5 6.76454
|
||||||
|
1.5 6.765883
|
||||||
|
1.5 6.87174
|
||||||
|
2.5 6.8784
|
||||||
|
0.5 6.92107
|
||||||
|
1.5 6.95405
|
||||||
|
0.5 6.97726
|
||||||
|
1.5 6.9839
|
||||||
|
1.5 7.013848
|
||||||
|
0.5 7.0164
|
||||||
|
2.5 7.0765
|
||||||
|
0.5 7.14236
|
||||||
|
1.5 7.16229
|
||||||
|
2.5 7.22501
|
||||||
|
3.5 7.2379
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
0 0
|
||||||
|
1 1.6521391
|
||||||
|
2 2.1116614
|
||||||
|
2 4.2078647
|
||||||
|
0 5.4768492
|
||||||
|
0 8.57151
|
||||||
|
1 8.6291111
|
||||||
|
2 9.4412369
|
||||||
|
2 9.8060516
|
||||||
|
1 9.9902835
|
||||||
|
2 10.1728578
|
||||||
|
3 10.1985992
|
||||||
|
1 10.4494435
|
||||||
|
0 10.7963923
|
||||||
|
1 10.9808694
|
||||||
|
2 11.0062561
|
||||||
|
2 11.0084922
|
||||||
|
1 11.1444033
|
||||||
|
1 11.7093437
|
||||||
|
2 11.7698992
|
||||||
|
3 11.9102141
|
||||||
|
2 12.27584
|
||||||
|
4 12.36
|
||||||
|
0 12.42104
|
||||||
|
1 12.459783
|
||||||
|
1 12.564612
|
||||||
|
0 12.579863
|
||||||
|
2 12.68751
|
||||||
|
3 12.770807
|
||||||
|
2 13.028945
|
||||||
|
1 13.051934
|
||||||
|
3 13.054263
|
||||||
|
3 13.074263
|
||||||
|
2 13.083705
|
||||||
|
4 13.108609
|
||||||
|
2 13.198054
|
||||||
|
1 13.218107
|
||||||
|
0 13.3873
|
||||||
|
3 13.391416
|
||||||
|
1 13.406006
|
||||||
|
3 13.42509
|
||||||
|
1 13.440666
|
||||||
|
2 13.500456
|
||||||
|
1 13.527353
|
||||||
|
2 13.533883
|
||||||
|
2 13.626606
|
||||||
|
0 13.966928
|
||||||
|
0 14.205998
|
||||||
|
1 14.210247
|
||||||
|
3 14.374301
|
||||||
|
3 14.393447
|
||||||
|
4 14.399632
|
||||||
|
2 14.408747
|
||||||
|
2 14.499061
|
||||||
|
3 14.5066
|
||||||
|
3 14.533992
|
||||||
|
1 14.534
|
||||||
|
2 15.160543
|
||||||
|
1 15.209
|
||||||
|
3 15.514622
|
||||||
|
4 15.528934
|
||||||
|
3 15.545851
|
||||||
|
4 15.564548
|
||||||
|
2 15.573919
|
||||||
|
1 15.5955
|
||||||
|
5 15.615427
|
||||||
|
3 15.635355
|
||||||
|
2 15.659106
|
||||||
|
4 15.703071
|
||||||
|
3 15.739725
|
||||||
|
1 15.753756
|
||||||
|
2 15.768836
|
||||||
|
1 15.8578
|
||||||
|
3 15.937436
|
||||||
|
1 16.0414
|
||||||
|
1 16.1637
|
||||||
|
1 16.2564
|
||||||
@@ -0,0 +1,252 @@
|
|||||||
|
1.5 0
|
||||||
|
0.5 0.456912
|
||||||
|
2.5 7.865117
|
||||||
|
1.5 8.047466
|
||||||
|
0.5 8.292543
|
||||||
|
1.5 8.329702
|
||||||
|
0.5 8.551216
|
||||||
|
2.5 9.258188
|
||||||
|
1.5 9.299947
|
||||||
|
3.5 9.363473
|
||||||
|
2.5 9.385238
|
||||||
|
0.5 9.399738
|
||||||
|
2.5 9.409202
|
||||||
|
1.5 9.411458
|
||||||
|
1.5 9.514929
|
||||||
|
0.5 9.68019
|
||||||
|
2.5 9.734198
|
||||||
|
1.5 9.754661
|
||||||
|
0.5 9.778103
|
||||||
|
3.5 9.800269
|
||||||
|
1.5 9.816862
|
||||||
|
2.5 9.8271
|
||||||
|
1.5 9.872945
|
||||||
|
1.5 9.881031
|
||||||
|
0.5 9.902374
|
||||||
|
0.5 9.922009
|
||||||
|
4.5 9.99159
|
||||||
|
3.5 10.052775
|
||||||
|
0.5 10.096029
|
||||||
|
2.5 10.126072
|
||||||
|
1.5 10.147117
|
||||||
|
2.5 10.195986
|
||||||
|
1.5 10.248728
|
||||||
|
0.5 10.303222
|
||||||
|
3.5 10.335179
|
||||||
|
1.5 10.362413
|
||||||
|
2.5 10.380339
|
||||||
|
1.5 10.424284
|
||||||
|
2.5 10.452582
|
||||||
|
0.5 10.517034
|
||||||
|
2.5 10.531857
|
||||||
|
1.5 10.562411
|
||||||
|
1.5 10.592631
|
||||||
|
2.5 10.603974
|
||||||
|
0.5 10.610187
|
||||||
|
1.5 10.611349
|
||||||
|
3.5 10.633254
|
||||||
|
0.5 10.637744
|
||||||
|
2.5 10.64039
|
||||||
|
1.5 10.655681
|
||||||
|
0.5 10.697283
|
||||||
|
3.5 10.757896
|
||||||
|
2.5 10.778353
|
||||||
|
2.5 10.794217
|
||||||
|
1.5 10.802948
|
||||||
|
4.5 10.810426
|
||||||
|
3.5 10.814541
|
||||||
|
1.5 10.818773
|
||||||
|
0.5 10.820315
|
||||||
|
3.5 10.841181
|
||||||
|
0.5 10.848497
|
||||||
|
0.5 10.88013
|
||||||
|
2.5 10.880223
|
||||||
|
1.5 10.882088
|
||||||
|
2.5 10.927356
|
||||||
|
1.5 10.944766
|
||||||
|
4.5 10.95266
|
||||||
|
3.5 10.952852
|
||||||
|
2.5 10.954101
|
||||||
|
3.5 10.95414
|
||||||
|
1.5 10.955736
|
||||||
|
2.5 10.956647
|
||||||
|
4.5 10.959233
|
||||||
|
5.5 10.959233
|
||||||
|
0.5 10.963288
|
||||||
|
1.5 10.963362
|
||||||
|
1.5 10.965011
|
||||||
|
2.5 10.970546
|
||||||
|
0.5 10.999008
|
||||||
|
2.5 11.015749
|
||||||
|
1.5 11.028861
|
||||||
|
1.5 11.038541
|
||||||
|
0.5 11.052856
|
||||||
|
1.5 11.101597
|
||||||
|
2.5 11.10264
|
||||||
|
3.5 11.113552
|
||||||
|
2.5 11.117548
|
||||||
|
0.5 11.125028
|
||||||
|
0.5 11.129418
|
||||||
|
1.5 11.132067
|
||||||
|
3.5 11.141307
|
||||||
|
1.5 11.142173
|
||||||
|
0.5 11.146908
|
||||||
|
1.5 11.152122
|
||||||
|
2.5 11.152127
|
||||||
|
4.5 11.18894
|
||||||
|
3.5 11.191787
|
||||||
|
0.5 11.194823
|
||||||
|
2.5 11.202583
|
||||||
|
1.5 11.21021
|
||||||
|
3.5 11.211598
|
||||||
|
0.5 11.211705
|
||||||
|
1.5 11.21558
|
||||||
|
1.5 11.225222
|
||||||
|
2.5 11.228734
|
||||||
|
2.5 11.231141
|
||||||
|
2.5 11.256389
|
||||||
|
1.5 11.257461
|
||||||
|
4.5 11.263413
|
||||||
|
3.5 11.263565
|
||||||
|
2.5 11.264126
|
||||||
|
3.5 11.264126
|
||||||
|
1.5 11.26629
|
||||||
|
2.5 11.266399
|
||||||
|
5.5 11.266903
|
||||||
|
4.5 11.266913
|
||||||
|
0.5 11.269033
|
||||||
|
1.5 11.269117
|
||||||
|
1.5 11.282729
|
||||||
|
2.5 11.304282
|
||||||
|
1.5 11.317777
|
||||||
|
0.5 11.325669
|
||||||
|
0.5 11.34236
|
||||||
|
1.5 11.342448
|
||||||
|
2.5 11.343203
|
||||||
|
3.5 11.344087
|
||||||
|
2.5 11.344199
|
||||||
|
1.5 11.348177
|
||||||
|
1.5 11.349816
|
||||||
|
2.5 11.350223
|
||||||
|
2.5 11.351635
|
||||||
|
3.5 11.354886
|
||||||
|
0.5 11.356811
|
||||||
|
1.5 11.365333
|
||||||
|
0.5 11.368228
|
||||||
|
3.5 11.376237
|
||||||
|
1.5 11.381768
|
||||||
|
2.5 11.383025
|
||||||
|
0.5 11.384719
|
||||||
|
4.5 11.38809
|
||||||
|
3.5 11.391747
|
||||||
|
4.5 11.396858
|
||||||
|
1.5 11.39748
|
||||||
|
0.5 11.398853
|
||||||
|
2.5 11.401159
|
||||||
|
3.5 11.406366
|
||||||
|
0.5 11.417656
|
||||||
|
2.5 11.426563
|
||||||
|
1.5 11.429148
|
||||||
|
2.5 11.429847
|
||||||
|
3.5 11.429847
|
||||||
|
4.5 11.432251
|
||||||
|
3.5 11.432368
|
||||||
|
1.5 11.434017
|
||||||
|
2.5 11.434072
|
||||||
|
5.5 11.434162
|
||||||
|
4.5 11.43417
|
||||||
|
3.5 11.434852
|
||||||
|
2.5 11.434889
|
||||||
|
0.5 11.435396
|
||||||
|
1.5 11.435444
|
||||||
|
1.5 11.470635
|
||||||
|
2.5 11.478976
|
||||||
|
1.5 11.480251
|
||||||
|
0.5 11.482033
|
||||||
|
3.5 11.483442
|
||||||
|
2.5 11.484264
|
||||||
|
0.5 11.487192
|
||||||
|
1.5 11.490522
|
||||||
|
0.5 11.496872
|
||||||
|
3.5 11.497012
|
||||||
|
2.5 11.498686
|
||||||
|
2.5 11.499992
|
||||||
|
2.5 11.500255
|
||||||
|
1.5 11.502623
|
||||||
|
4.5 11.506702
|
||||||
|
1.5 11.508071
|
||||||
|
0.5 11.50875
|
||||||
|
1.5 11.510614
|
||||||
|
3.5 11.511165
|
||||||
|
1.5 11.512382
|
||||||
|
0.5 11.516991
|
||||||
|
0.5 11.529622
|
||||||
|
2.5 11.530011
|
||||||
|
4.5 11.533766
|
||||||
|
3.5 11.533837
|
||||||
|
2.5 11.534056
|
||||||
|
3.5 11.534056
|
||||||
|
1.5 11.534869
|
||||||
|
2.5 11.534913
|
||||||
|
5.5 11.535004
|
||||||
|
4.5 11.53501
|
||||||
|
1.5 11.535402
|
||||||
|
0.5 11.535786
|
||||||
|
1.5 11.535818
|
||||||
|
2.5 11.541518
|
||||||
|
1.5 11.545059
|
||||||
|
3.5 11.560826
|
||||||
|
0.5 11.565566
|
||||||
|
3.5 11.566657
|
||||||
|
1.5 11.572103
|
||||||
|
1.5 11.572599
|
||||||
|
2.5 11.572988
|
||||||
|
3.5 11.580603
|
||||||
|
2.5 11.580857
|
||||||
|
4.5 11.581547
|
||||||
|
3.5 11.584
|
||||||
|
0.5 11.586508
|
||||||
|
1.5 11.586667
|
||||||
|
2.5 11.58927
|
||||||
|
0.5 11.591457
|
||||||
|
1.5 11.592541
|
||||||
|
2.5 11.598046
|
||||||
|
4.5 11.599582
|
||||||
|
3.5 11.599632
|
||||||
|
1.5 11.599711
|
||||||
|
3.5 11.599777
|
||||||
|
2.5 11.599777
|
||||||
|
1.5 11.60029
|
||||||
|
5.5 11.600429
|
||||||
|
4.5 11.600435
|
||||||
|
1.5 11.606147
|
||||||
|
0.5 11.611163
|
||||||
|
2.5 11.613838
|
||||||
|
3.5 11.615189
|
||||||
|
0.5 11.617503
|
||||||
|
3.5 11.629564
|
||||||
|
2.5 11.631648
|
||||||
|
4.5 11.632068
|
||||||
|
1.5 11.63238
|
||||||
|
3.5 11.637044
|
||||||
|
1.5 11.642939
|
||||||
|
4.5 11.644576
|
||||||
|
5.5 11.645259
|
||||||
|
4.5 11.64526
|
||||||
|
0.5 11.652429
|
||||||
|
0.5 11.652978
|
||||||
|
1.5 11.653071
|
||||||
|
3.5 11.653773
|
||||||
|
2.5 11.653861
|
||||||
|
2.5 11.656721
|
||||||
|
1.5 11.656772
|
||||||
|
1.5 11.664756
|
||||||
|
2.5 11.665547
|
||||||
|
4.5 11.667744
|
||||||
|
3.5 11.67019
|
||||||
|
4.5 11.676933
|
||||||
|
4.5 11.693867
|
||||||
|
2.5 11.7115
|
||||||
|
1.5 11.71287
|
||||||
|
3.5 11.741332
|
||||||
|
2.5 11.741354
|
||||||
@@ -0,0 +1,131 @@
|
|||||||
|
2 0
|
||||||
|
1 0.38886
|
||||||
|
0 0.47579
|
||||||
|
2 1.49886
|
||||||
|
0 3.45508
|
||||||
|
2 11.64472
|
||||||
|
2 11.956017
|
||||||
|
1 12.20855
|
||||||
|
1 12.24954
|
||||||
|
0 12.42748
|
||||||
|
3 12.89902
|
||||||
|
2 12.90399
|
||||||
|
4 12.90547
|
||||||
|
1 12.91211
|
||||||
|
0 12.91809
|
||||||
|
1 13.56759
|
||||||
|
2 13.59871
|
||||||
|
3 13.68488
|
||||||
|
2 13.82761
|
||||||
|
1 13.93421
|
||||||
|
3 13.94309
|
||||||
|
2 14.00209
|
||||||
|
1 14.05226
|
||||||
|
1 14.2177
|
||||||
|
2 14.2346
|
||||||
|
3 14.27896
|
||||||
|
1 14.5747
|
||||||
|
2 14.59815
|
||||||
|
2 14.60024
|
||||||
|
0 14.60854
|
||||||
|
3 14.69301
|
||||||
|
4 14.80738
|
||||||
|
0 15.02086
|
||||||
|
1 15.07086
|
||||||
|
4 15.14955
|
||||||
|
2 15.20365
|
||||||
|
3 15.21527
|
||||||
|
1 15.50422
|
||||||
|
1 15.72004
|
||||||
|
2 15.83082
|
||||||
|
3 15.86241
|
||||||
|
1 15.95282
|
||||||
|
2 15.97984
|
||||||
|
2 16.11285
|
||||||
|
2 16.19258
|
||||||
|
3 16.19809
|
||||||
|
1 16.21914
|
||||||
|
3 16.27927
|
||||||
|
3 16.32619
|
||||||
|
4 16.33324
|
||||||
|
2 16.52349
|
||||||
|
0 16.56021
|
||||||
|
1 16.56346
|
||||||
|
2 16.83528
|
||||||
|
2 16.93679
|
||||||
|
1 17.06023
|
||||||
|
1 17.12444
|
||||||
|
3 17.26561
|
||||||
|
1 17.28957
|
||||||
|
2 17.37291
|
||||||
|
1 17.38436
|
||||||
|
0 17.38436
|
||||||
|
4 17.39296
|
||||||
|
3 17.39326
|
||||||
|
2 17.41944
|
||||||
|
1 17.61726
|
||||||
|
1 17.70931
|
||||||
|
2 17.71124
|
||||||
|
0 17.74753
|
||||||
|
0 17.7899
|
||||||
|
3 17.81685
|
||||||
|
1 17.91735
|
||||||
|
2 18.02363
|
||||||
|
1 18.05181
|
||||||
|
2 18.09159
|
||||||
|
5 18.09218
|
||||||
|
4 18.09223
|
||||||
|
3 18.09273
|
||||||
|
2 18.093
|
||||||
|
1 18.09314
|
||||||
|
3 18.11146
|
||||||
|
2 18.11221
|
||||||
|
4 18.1131
|
||||||
|
1 18.76511
|
||||||
|
2 18.7774
|
||||||
|
2 18.78281
|
||||||
|
3 18.89162
|
||||||
|
2 18.94772
|
||||||
|
1 19.10349
|
||||||
|
4 19.21453
|
||||||
|
1 19.23514
|
||||||
|
2 19.28982
|
||||||
|
3 19.34481
|
||||||
|
3 19.35501
|
||||||
|
4 19.35921
|
||||||
|
1 19.40397
|
||||||
|
4 19.42515
|
||||||
|
5 19.43411
|
||||||
|
4 19.45984
|
||||||
|
3 19.49252
|
||||||
|
1 19.51048
|
||||||
|
2 19.54297
|
||||||
|
1 19.55442
|
||||||
|
3 19.56466
|
||||||
|
2 19.62913
|
||||||
|
3 19.64014
|
||||||
|
1 19.80896
|
||||||
|
2 19.82537
|
||||||
|
2 19.89216
|
||||||
|
2 19.94658
|
||||||
|
3 19.9468
|
||||||
|
2 19.97769
|
||||||
|
2 19.9821
|
||||||
|
5 19.99706
|
||||||
|
4 20.02654
|
||||||
|
2 20.0724
|
||||||
|
4 20.1113
|
||||||
|
3 20.11683
|
||||||
|
2 20.12422
|
||||||
|
3 20.12787
|
||||||
|
3 20.13041
|
||||||
|
1 20.13446
|
||||||
|
1 20.49782
|
||||||
|
2 20.64143
|
||||||
|
1 20.75931
|
||||||
|
2 20.96885
|
||||||
|
2 20.9987
|
||||||
|
2 21.03677
|
||||||
|
3 21.04823
|
||||||
|
2 21.1641
|
||||||
|
1 21.17935
|
||||||
@@ -0,0 +1,271 @@
|
|||||||
|
0 0
|
||||||
|
1 0.002033
|
||||||
|
2 0.005381
|
||||||
|
2 1.263725
|
||||||
|
0 2.684011
|
||||||
|
2 4.182632
|
||||||
|
0 7.480392
|
||||||
|
1 7.482772
|
||||||
|
2 7.487795
|
||||||
|
1 7.684766
|
||||||
|
3 7.945765
|
||||||
|
1 7.946129
|
||||||
|
2 7.946265
|
||||||
|
1 8.537097
|
||||||
|
1 8.640394
|
||||||
|
2 8.64302
|
||||||
|
3 8.647158
|
||||||
|
1 8.771132
|
||||||
|
0 8.846584
|
||||||
|
1 8.84812
|
||||||
|
2 8.850659
|
||||||
|
2 9.002582
|
||||||
|
0 9.171844
|
||||||
|
1 9.330303
|
||||||
|
2 9.330464
|
||||||
|
0 9.33057
|
||||||
|
2 9.63107
|
||||||
|
0 9.683783
|
||||||
|
1 9.685241
|
||||||
|
2 9.689128
|
||||||
|
2 9.695449
|
||||||
|
3 9.697487
|
||||||
|
4 9.701756
|
||||||
|
1 9.707156
|
||||||
|
2 9.708909
|
||||||
|
3 9.710225
|
||||||
|
1 9.712957
|
||||||
|
3 9.736432
|
||||||
|
1 9.761433
|
||||||
|
2 9.833292
|
||||||
|
1 9.834275
|
||||||
|
0 9.834818
|
||||||
|
1 9.98852
|
||||||
|
1 10.015755
|
||||||
|
2 10.018081
|
||||||
|
3 10.022214
|
||||||
|
1 10.055742
|
||||||
|
0 10.08128
|
||||||
|
1 10.083109
|
||||||
|
2 10.085369
|
||||||
|
2 10.138162
|
||||||
|
0 10.197912
|
||||||
|
2 10.352385
|
||||||
|
0 10.382444
|
||||||
|
2 10.383353
|
||||||
|
1 10.383975
|
||||||
|
3 10.385073
|
||||||
|
2 10.388765
|
||||||
|
4 10.389698
|
||||||
|
1 10.392372
|
||||||
|
2 10.394597
|
||||||
|
3 10.39593
|
||||||
|
1 10.399461
|
||||||
|
3 10.40471
|
||||||
|
2 10.404724
|
||||||
|
3 10.405523
|
||||||
|
4 10.405544
|
||||||
|
3 10.408155
|
||||||
|
3 10.412964
|
||||||
|
4 10.412993
|
||||||
|
3 10.416315
|
||||||
|
2 10.416334
|
||||||
|
5 10.416639
|
||||||
|
4 10.416687
|
||||||
|
1 10.418659
|
||||||
|
1 10.419172
|
||||||
|
2 10.419186
|
||||||
|
2 10.427455
|
||||||
|
1 10.429066
|
||||||
|
0 10.429702
|
||||||
|
1 10.520249
|
||||||
|
1 10.53064
|
||||||
|
2 10.532502
|
||||||
|
3 10.536793
|
||||||
|
0 10.559686
|
||||||
|
1 10.562084
|
||||||
|
2 10.563905
|
||||||
|
2 10.588227
|
||||||
|
0 10.616169
|
||||||
|
2 10.685603
|
||||||
|
2 10.702023
|
||||||
|
0 10.702556
|
||||||
|
3 10.703204
|
||||||
|
1 10.703758
|
||||||
|
1 10.707588
|
||||||
|
4 10.708449
|
||||||
|
2 10.708466
|
||||||
|
2 10.710918
|
||||||
|
3 10.711962
|
||||||
|
1 10.714287
|
||||||
|
3 10.718333
|
||||||
|
3 10.720853
|
||||||
|
4 10.720871
|
||||||
|
3 10.722483
|
||||||
|
2 10.722498
|
||||||
|
1 10.723568
|
||||||
|
1 10.724453
|
||||||
|
2 10.724464
|
||||||
|
2 10.725464
|
||||||
|
1 10.727047
|
||||||
|
0 10.727505
|
||||||
|
1 10.775821
|
||||||
|
1 10.78119
|
||||||
|
2 10.782342
|
||||||
|
3 10.786905
|
||||||
|
0 10.796217
|
||||||
|
1 10.79941
|
||||||
|
2 10.800661
|
||||||
|
2 10.813686
|
||||||
|
0 10.828909
|
||||||
|
2 10.8652
|
||||||
|
2 10.874432
|
||||||
|
0 10.874824
|
||||||
|
3 10.875073
|
||||||
|
1 10.875715
|
||||||
|
1 10.877791
|
||||||
|
2 10.880076
|
||||||
|
4 10.880929
|
||||||
|
4 10.881238
|
||||||
|
3 10.881255
|
||||||
|
2 10.882476
|
||||||
|
3 10.882982
|
||||||
|
1 10.884527
|
||||||
|
3 10.886672
|
||||||
|
3 10.889153
|
||||||
|
2 10.889163
|
||||||
|
1 10.889553
|
||||||
|
2 10.889847
|
||||||
|
2 10.890492
|
||||||
|
1 10.890492
|
||||||
|
1 10.891257
|
||||||
|
0 10.89163
|
||||||
|
1 10.918207
|
||||||
|
1 10.922017
|
||||||
|
2 10.922516
|
||||||
|
3 10.927448
|
||||||
|
0 10.930431
|
||||||
|
1 10.934452
|
||||||
|
2 10.935186
|
||||||
|
2 10.942891
|
||||||
|
0 10.952018
|
||||||
|
2 10.97243
|
||||||
|
2 10.97773
|
||||||
|
0 10.978027
|
||||||
|
3 10.97817
|
||||||
|
1 10.978684
|
||||||
|
1 10.97987
|
||||||
|
2 10.981882
|
||||||
|
2 10.983048
|
||||||
|
4 10.98457
|
||||||
|
2 10.985589
|
||||||
|
3 10.98584
|
||||||
|
1 10.986861
|
||||||
|
3 10.988099
|
||||||
|
3 10.989213
|
||||||
|
4 10.989224
|
||||||
|
2 10.98956
|
||||||
|
3 10.989748
|
||||||
|
1 10.989838
|
||||||
|
2 10.99062
|
||||||
|
1 10.99078
|
||||||
|
0 10.99109
|
||||||
|
1 11.005703
|
||||||
|
1 11.008662
|
||||||
|
2 11.00909
|
||||||
|
3 11.014275
|
||||||
|
2 11.018965
|
||||||
|
2 11.023876
|
||||||
|
0 11.029714
|
||||||
|
2 11.041309
|
||||||
|
2 11.0445
|
||||||
|
0 11.044713
|
||||||
|
3 11.04477
|
||||||
|
1 11.045183
|
||||||
|
1 11.04598
|
||||||
|
2 11.04721
|
||||||
|
3 11.047214
|
||||||
|
4 11.05157
|
||||||
|
2 11.052281
|
||||||
|
3 11.05237
|
||||||
|
1 11.053111
|
||||||
|
3 11.053898
|
||||||
|
4 11.054691
|
||||||
|
2 11.0547
|
||||||
|
1 11.055019
|
||||||
|
1 11.05567
|
||||||
|
0 11.05586
|
||||||
|
1 11.063409
|
||||||
|
3 11.071677
|
||||||
|
2 11.078
|
||||||
|
0 11.081907
|
||||||
|
2 11.08809
|
||||||
|
2 11.09006
|
||||||
|
3 11.09034
|
||||||
|
1 11.090612
|
||||||
|
1 11.091155
|
||||||
|
2 11.097879
|
||||||
|
3 11.09794
|
||||||
|
1 11.098433
|
||||||
|
3 11.098957
|
||||||
|
2 11.09936
|
||||||
|
1 11.099752
|
||||||
|
1 11.103471
|
||||||
|
3 11.111595
|
||||||
|
0 11.118668
|
||||||
|
3 11.122796
|
||||||
|
1 11.123366
|
||||||
|
2 11.130417
|
||||||
|
3 11.13046
|
||||||
|
3 11.131227
|
||||||
|
1 11.13171
|
||||||
|
1 11.132443
|
||||||
|
3 11.146774
|
||||||
|
1 11.14696
|
||||||
|
2 11.154444
|
||||||
|
3 11.15446
|
||||||
|
3 11.15502
|
||||||
|
1 11.15547
|
||||||
|
3 11.16498
|
||||||
|
1 11.16531
|
||||||
|
1 11.17301
|
||||||
|
3 11.17313
|
||||||
|
1 11.17343
|
||||||
|
3 11.17911
|
||||||
|
1 11.17951
|
||||||
|
1 11.18706
|
||||||
|
3 11.18718
|
||||||
|
1 11.18728
|
||||||
|
3 11.19037
|
||||||
|
1 11.19084
|
||||||
|
3 11.19829
|
||||||
|
1 11.19854
|
||||||
|
3 11.19942
|
||||||
|
3 11.20743
|
||||||
|
3 11.20743
|
||||||
|
1 11.20761
|
||||||
|
3 11.21286
|
||||||
|
3 11.21476
|
||||||
|
1 11.21489
|
||||||
|
3 11.21799
|
||||||
|
3 11.22083
|
||||||
|
1 11.22088
|
||||||
|
3 11.22233
|
||||||
|
3 11.22601
|
||||||
|
3 11.22601
|
||||||
|
1 11.22611
|
||||||
|
3 11.22929
|
||||||
|
3 11.23032
|
||||||
|
1 11.23034
|
||||||
|
3 11.23203
|
||||||
|
3 11.23416
|
||||||
|
1 11.23423
|
||||||
|
3 11.23721
|
||||||
|
3 11.23991
|
||||||
|
3 11.24239
|
||||||
|
3 11.24413
|
||||||
|
3 11.24636
|
||||||
|
3 11.24797
|
||||||
|
3 11.24942
|
||||||
|
3 11.2506
|
||||||
|
3 11.25204
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
0.5 0
|
||||||
|
1.5 0.007863
|
||||||
|
0.5 5.33173
|
||||||
|
1.5 5.33446
|
||||||
|
2.5 5.33797
|
||||||
|
2.5 9.290148
|
||||||
|
1.5 9.290461
|
||||||
|
0.5 11.963699
|
||||||
|
0.5 13.715649
|
||||||
|
1.5 13.720781
|
||||||
|
0.5 14.448827
|
||||||
|
0.5 16.33174
|
||||||
|
1.5 16.333123
|
||||||
|
1.5 17.60912
|
||||||
|
1.5 18.045809
|
||||||
|
2.5 18.045987
|
||||||
|
2.5 18.654858
|
||||||
|
1.5 18.655492
|
||||||
|
0.5 19.49454
|
||||||
|
0.5 20.14965
|
||||||
|
1.5 20.150478
|
||||||
|
0.5 20.701286
|
||||||
|
1.5 20.704212
|
||||||
|
2.5 20.709788
|
||||||
|
1.5 20.844687
|
||||||
|
2.5 20.844775
|
||||||
|
0.5 20.919795
|
||||||
|
1.5 20.922123
|
||||||
|
3.5 20.950644
|
||||||
|
2.5 20.950644
|
||||||
|
0.5 21.492393
|
||||||
|
0.5 21.732866
|
||||||
|
1.5 21.733779
|
||||||
|
0.5 22.04124
|
||||||
|
1.5 22.043589
|
||||||
|
1.5 22.130573
|
||||||
|
2.5 22.130647
|
||||||
|
3.5 22.187709
|
||||||
|
2.5 22.187709
|
||||||
|
4.5 22.202228
|
||||||
|
3.5 22.202228
|
||||||
|
0.5 22.473901
|
||||||
|
0.5 22.527515
|
||||||
|
1.5 22.529296
|
||||||
|
2.5 22.532398
|
||||||
|
3.5 22.536906
|
||||||
|
0.5 22.568082
|
||||||
|
1.5 22.570506
|
||||||
|
0.5 22.688269
|
||||||
|
1.5 22.688322
|
||||||
|
1.5 22.82234
|
||||||
|
2.5 22.822426
|
||||||
|
3.5 22.859718
|
||||||
|
2.5 22.859718
|
||||||
|
4.5 22.868795
|
||||||
|
3.5 22.868795
|
||||||
|
5.5 22.87093
|
||||||
|
4.5 22.87093
|
||||||
|
1.5 22.898763
|
||||||
|
0.5 23.027948
|
||||||
|
0.5 23.114045
|
||||||
|
1.5 23.116071
|
||||||
|
2.5 23.11884
|
||||||
|
0.5 23.15354
|
||||||
|
1.5 23.15359
|
||||||
|
1.5 23.22881
|
||||||
|
2.5 23.22881
|
||||||
|
2.5 23.26459
|
||||||
|
3.5 23.26459
|
||||||
|
4.5 23.27077
|
||||||
|
3.5 23.27077
|
||||||
|
5.5 23.272
|
||||||
|
4.5 23.272
|
||||||
|
1.5 23.381095
|
||||||
|
2.5 23.385288
|
||||||
|
3.5 23.53148
|
||||||
|
4.5 23.53148
|
||||||
|
1.5 24.270227
|
||||||
|
2.5 24.271872
|
||||||
|
3.5 24.274338
|
||||||
|
4.5 24.277799
|
||||||
|
0.5 24.37007
|
||||||
|
1.5 24.370757
|
||||||
|
2.5 24.371799
|
||||||
|
3.5 24.373057
|
||||||
@@ -0,0 +1,455 @@
|
|||||||
|
0 0
|
||||||
|
0 1.8793402
|
||||||
|
1 1.8858075
|
||||||
|
2 1.8989349
|
||||||
|
1 2.5212633
|
||||||
|
2 2.5229867
|
||||||
|
3 2.5256821
|
||||||
|
2 2.7090093
|
||||||
|
1 2.9325119
|
||||||
|
1 3.910399
|
||||||
|
0 4.1308142
|
||||||
|
2 4.4300117
|
||||||
|
3 4.4409544
|
||||||
|
2 4.4430249
|
||||||
|
4 4.450647
|
||||||
|
0 4.5313358
|
||||||
|
1 4.5322112
|
||||||
|
2 4.5347368
|
||||||
|
1 4.5541398
|
||||||
|
2 4.6243982
|
||||||
|
1 4.6801799
|
||||||
|
2 4.6806349
|
||||||
|
3 4.681327
|
||||||
|
1 4.7352531
|
||||||
|
2 4.7385667
|
||||||
|
3 4.7435268
|
||||||
|
0 4.7631682
|
||||||
|
1 4.7690283
|
||||||
|
2 4.779784
|
||||||
|
0 4.8767178
|
||||||
|
1 4.8769583
|
||||||
|
2 4.8775482
|
||||||
|
1 5.0181663
|
||||||
|
3 5.0260581
|
||||||
|
0 5.0449709
|
||||||
|
2 5.0486175
|
||||||
|
1 5.1675384
|
||||||
|
0 5.1808379
|
||||||
|
2 5.2284401
|
||||||
|
3 5.2284828
|
||||||
|
4 5.2285408
|
||||||
|
3 5.2499356
|
||||||
|
0 5.2711689
|
||||||
|
1 5.2716479
|
||||||
|
2 5.2726253
|
||||||
|
1 5.2994568
|
||||||
|
2 5.2996693
|
||||||
|
3 5.3000005
|
||||||
|
2 5.3212843
|
||||||
|
2 5.3901915
|
||||||
|
3 5.3919635
|
||||||
|
4 5.3943154
|
||||||
|
1 5.4470569
|
||||||
|
1 5.4529201
|
||||||
|
0 5.489591
|
||||||
|
2 5.5498575
|
||||||
|
3 5.5498847
|
||||||
|
4 5.5499193
|
||||||
|
3 5.5550968
|
||||||
|
5 5.563774
|
||||||
|
4 5.563909
|
||||||
|
0 5.573793
|
||||||
|
1 5.5740388
|
||||||
|
2 5.5745474
|
||||||
|
2 5.578028
|
||||||
|
1 5.5853732
|
||||||
|
2 5.58554
|
||||||
|
3 5.5857824
|
||||||
|
1 5.6320266
|
||||||
|
1 5.670874
|
||||||
|
0 5.6892877
|
||||||
|
2 5.7236863
|
||||||
|
3 5.7237038
|
||||||
|
4 5.7237269
|
||||||
|
3 5.7258877
|
||||||
|
2 5.728086
|
||||||
|
0 5.738499
|
||||||
|
1 5.738637
|
||||||
|
2 5.738935
|
||||||
|
1 5.740713
|
||||||
|
2 5.7409208
|
||||||
|
3 5.7412196
|
||||||
|
1 5.7627623
|
||||||
|
1 5.7960483
|
||||||
|
0 5.8068067
|
||||||
|
2 5.820932
|
||||||
|
2 5.8280252
|
||||||
|
3 5.8280359
|
||||||
|
4 5.8280508
|
||||||
|
3 5.8291345
|
||||||
|
1 5.8317486
|
||||||
|
2 5.8322175
|
||||||
|
3 5.8328664
|
||||||
|
1 5.837843
|
||||||
|
2 5.838043
|
||||||
|
1 5.8501162
|
||||||
|
1 5.8746252
|
||||||
|
0 5.8814968
|
||||||
|
2 5.8829365
|
||||||
|
1 5.8838501
|
||||||
|
2 5.8850356
|
||||||
|
3 5.8862632
|
||||||
|
2 5.8954751
|
||||||
|
3 5.8954822
|
||||||
|
4 5.8954946
|
||||||
|
3 5.896097
|
||||||
|
1 5.902237
|
||||||
|
2 5.902363
|
||||||
|
1 5.909347
|
||||||
|
1 5.9205746
|
||||||
|
2 5.9211488
|
||||||
|
3 5.9221916
|
||||||
|
1 5.927213
|
||||||
|
2 5.927981
|
||||||
|
0 5.93187
|
||||||
|
2 5.941555
|
||||||
|
3 5.9415684
|
||||||
|
4 5.9415748
|
||||||
|
3 5.9419361
|
||||||
|
1 5.94639
|
||||||
|
2 5.946472
|
||||||
|
1 5.95093
|
||||||
|
1 5.955157
|
||||||
|
2 5.955361
|
||||||
|
3 5.9557312
|
||||||
|
2 5.961583
|
||||||
|
1 5.964138
|
||||||
|
0 5.967452
|
||||||
|
2 5.9744321
|
||||||
|
3 5.9744358
|
||||||
|
4 5.9744411
|
||||||
|
3 5.9746732
|
||||||
|
4 5.97631
|
||||||
|
5 5.977
|
||||||
|
1 5.977999
|
||||||
|
2 5.978067
|
||||||
|
1 5.981063
|
||||||
|
1 5.983267
|
||||||
|
2 5.983334
|
||||||
|
3 5.983513
|
||||||
|
2 5.987302
|
||||||
|
1 5.991058
|
||||||
|
0 5.993489
|
||||||
|
2 5.99869
|
||||||
|
3 5.9987003
|
||||||
|
4 5.9987027
|
||||||
|
3 5.9988562
|
||||||
|
4 6.00013
|
||||||
|
5 6.00066
|
||||||
|
1 6.001402
|
||||||
|
2 6.001449
|
||||||
|
1 6.003574
|
||||||
|
1 6.004928
|
||||||
|
2 6.004984
|
||||||
|
3 6.005109
|
||||||
|
2 6.007249
|
||||||
|
1 6.011287
|
||||||
|
0 6.013127
|
||||||
|
0 6.0162207
|
||||||
|
3 6.017082
|
||||||
|
4 6.017082
|
||||||
|
3 6.0172183
|
||||||
|
1 6.0178982
|
||||||
|
4 6.01821
|
||||||
|
5 6.01871
|
||||||
|
1 6.019222
|
||||||
|
2 6.019248
|
||||||
|
1 6.020809
|
||||||
|
2 6.0211093
|
||||||
|
1 6.021746
|
||||||
|
2 6.021782
|
||||||
|
3 6.021852
|
||||||
|
2 6.022944
|
||||||
|
1 6.026841
|
||||||
|
0 6.028301
|
||||||
|
4 6.031382
|
||||||
|
3 6.031496
|
||||||
|
4 6.03229
|
||||||
|
5 6.0327
|
||||||
|
2 6.0331
|
||||||
|
1 6.03429
|
||||||
|
1 6.034983
|
||||||
|
2 6.035011
|
||||||
|
3 6.035066
|
||||||
|
2 6.035423
|
||||||
|
1 6.039124
|
||||||
|
0 6.040265
|
||||||
|
3 6.042809
|
||||||
|
4 6.04341
|
||||||
|
5 6.04391
|
||||||
|
2 6.044111
|
||||||
|
1 6.045029
|
||||||
|
2 6.045487
|
||||||
|
1 6.045579
|
||||||
|
2 6.045618
|
||||||
|
3 6.045632
|
||||||
|
1 6.048945
|
||||||
|
0 6.049866
|
||||||
|
3 6.051928
|
||||||
|
2 6.052983
|
||||||
|
1 6.053719
|
||||||
|
2 6.053783
|
||||||
|
1 6.054132
|
||||||
|
2 6.054142
|
||||||
|
3 6.054207
|
||||||
|
1 6.056948
|
||||||
|
0 6.057693
|
||||||
|
3 6.05938
|
||||||
|
2 6.060262
|
||||||
|
2 6.060641
|
||||||
|
1 6.060851
|
||||||
|
2 6.061184
|
||||||
|
1 6.061203
|
||||||
|
3 6.06122
|
||||||
|
1 6.063522
|
||||||
|
0 6.064148
|
||||||
|
3 6.065549
|
||||||
|
2 6.06629
|
||||||
|
2 6.066397
|
||||||
|
1 6.066772
|
||||||
|
2 6.067048
|
||||||
|
1 6.067055
|
||||||
|
3 6.067082
|
||||||
|
1 6.069012
|
||||||
|
0 6.069539
|
||||||
|
3 6.070721
|
||||||
|
2 6.071271
|
||||||
|
2 6.071341
|
||||||
|
1 6.071745
|
||||||
|
1 6.071977
|
||||||
|
3 6.071992
|
||||||
|
2 6.071996
|
||||||
|
1 6.073657
|
||||||
|
0 6.074089
|
||||||
|
3 6.075088
|
||||||
|
2 6.075431
|
||||||
|
2 6.075624
|
||||||
|
1 6.07596
|
||||||
|
2 6.076165
|
||||||
|
1 6.076167
|
||||||
|
3 6.07618
|
||||||
|
1 6.077597
|
||||||
|
0 6.077956
|
||||||
|
3 6.078813
|
||||||
|
2 6.079013
|
||||||
|
2 6.07928
|
||||||
|
1 6.079563
|
||||||
|
2 6.079739
|
||||||
|
1 6.080956
|
||||||
|
0 6.081282
|
||||||
|
3 6.08202
|
||||||
|
2 6.082122
|
||||||
|
2 6.082419
|
||||||
|
1 6.082667
|
||||||
|
2 6.082817
|
||||||
|
1 6.083882
|
||||||
|
0 6.084151
|
||||||
|
3 6.084797
|
||||||
|
2 6.084832
|
||||||
|
2 6.085149
|
||||||
|
1 6.085361
|
||||||
|
2 6.085495
|
||||||
|
1 6.086434
|
||||||
|
0 6.086656
|
||||||
|
2 6.087193
|
||||||
|
3 6.08722
|
||||||
|
2 6.087531
|
||||||
|
1 6.087713
|
||||||
|
2 6.087811
|
||||||
|
1 6.088635
|
||||||
|
0 6.088845
|
||||||
|
2 6.089287
|
||||||
|
3 6.089341
|
||||||
|
2 6.089617
|
||||||
|
1 6.089779
|
||||||
|
2 6.089886
|
||||||
|
1 6.090602
|
||||||
|
0 6.090778
|
||||||
|
2 6.091138
|
||||||
|
3 6.09122
|
||||||
|
2 6.09146
|
||||||
|
1 6.091603
|
||||||
|
2 6.091687
|
||||||
|
1 6.092343
|
||||||
|
0 6.092498
|
||||||
|
2 6.092786
|
||||||
|
3 6.092879
|
||||||
|
2 6.093103
|
||||||
|
1 6.093222
|
||||||
|
2 6.093285
|
||||||
|
1 6.09386
|
||||||
|
0 6.09402
|
||||||
|
2 6.094256
|
||||||
|
3 6.094355
|
||||||
|
2 6.094555
|
||||||
|
1 6.094664
|
||||||
|
2 6.09474
|
||||||
|
1 6.095254
|
||||||
|
0 6.095369
|
||||||
|
2 6.095574
|
||||||
|
3 6.095682
|
||||||
|
2 6.09586
|
||||||
|
1 6.095956
|
||||||
|
2 6.095999
|
||||||
|
1 6.096479
|
||||||
|
0 6.096604
|
||||||
|
2 6.096762
|
||||||
|
2 6.097031
|
||||||
|
1 6.097119
|
||||||
|
2 6.097187
|
||||||
|
1 6.097602
|
||||||
|
0 6.097728
|
||||||
|
2 6.097835
|
||||||
|
2 6.098085
|
||||||
|
1 6.098165
|
||||||
|
2 6.098193
|
||||||
|
1 6.098581
|
||||||
|
2 6.098804
|
||||||
|
2 6.099041
|
||||||
|
1 6.099115
|
||||||
|
2 6.099162
|
||||||
|
1 6.099482
|
||||||
|
2 6.099688
|
||||||
|
2 6.09991
|
||||||
|
1 6.099975
|
||||||
|
2 6.100014
|
||||||
|
1 6.100329
|
||||||
|
2 6.100491
|
||||||
|
2 6.100701
|
||||||
|
1 6.10076
|
||||||
|
2 6.100787
|
||||||
|
1 6.10108
|
||||||
|
2 6.101223
|
||||||
|
2 6.101428
|
||||||
|
1 6.101476
|
||||||
|
2 6.101512
|
||||||
|
2 6.101896
|
||||||
|
2 6.102082
|
||||||
|
1 6.102133
|
||||||
|
2 6.102153
|
||||||
|
2 6.102515
|
||||||
|
2 6.102689
|
||||||
|
1 6.102734
|
||||||
|
2 6.102758
|
||||||
|
2 6.103085
|
||||||
|
2 6.103249
|
||||||
|
1 6.103289
|
||||||
|
2 6.103316
|
||||||
|
2 6.103608
|
||||||
|
2 6.103758
|
||||||
|
1 6.103798
|
||||||
|
2 6.103809
|
||||||
|
2 6.10409
|
||||||
|
2 6.104238
|
||||||
|
1 6.104273
|
||||||
|
2 6.104296
|
||||||
|
2 6.104542
|
||||||
|
2 6.104678
|
||||||
|
1 6.104712
|
||||||
|
2 6.104712
|
||||||
|
2 6.104957
|
||||||
|
2 6.105082
|
||||||
|
1 6.105117
|
||||||
|
2 6.105117
|
||||||
|
2 6.105345
|
||||||
|
2 6.105462
|
||||||
|
1 6.105494
|
||||||
|
2 6.10551
|
||||||
|
2 6.105701
|
||||||
|
2 6.105818
|
||||||
|
1 6.105847
|
||||||
|
2 6.105855
|
||||||
|
2 6.106038
|
||||||
|
2 6.106144
|
||||||
|
2 6.106167
|
||||||
|
1 6.106173
|
||||||
|
2 6.106352
|
||||||
|
2 6.106454
|
||||||
|
1 6.10648
|
||||||
|
2 6.106482
|
||||||
|
2 6.106643
|
||||||
|
2 6.106745
|
||||||
|
1 6.106768
|
||||||
|
2 6.106771
|
||||||
|
2 6.106921
|
||||||
|
2 6.107018
|
||||||
|
2 6.107034
|
||||||
|
1 6.107035
|
||||||
|
2 6.107181
|
||||||
|
2 6.107269
|
||||||
|
1 6.107288
|
||||||
|
2 6.107294
|
||||||
|
2 6.107422
|
||||||
|
2 6.107506
|
||||||
|
1 6.107525
|
||||||
|
2 6.107541
|
||||||
|
2 6.107649
|
||||||
|
2 6.107728
|
||||||
|
1 6.107747
|
||||||
|
2 6.107762
|
||||||
|
2 6.107872
|
||||||
|
2 6.107939
|
||||||
|
1 6.107956
|
||||||
|
3 6.107981
|
||||||
|
2 6.108053
|
||||||
|
2 6.108136
|
||||||
|
1 6.108155
|
||||||
|
2 6.108156
|
||||||
|
2 6.10825
|
||||||
|
2 6.108328
|
||||||
|
1 6.108342
|
||||||
|
2 6.108352
|
||||||
|
2 6.108434
|
||||||
|
2 6.108503
|
||||||
|
1 6.108518
|
||||||
|
2 6.108524
|
||||||
|
2 6.108618
|
||||||
|
2 6.108673
|
||||||
|
1 6.108687
|
||||||
|
2 6.108703
|
||||||
|
2 6.108751
|
||||||
|
2 6.108827
|
||||||
|
1 6.108843
|
||||||
|
2 6.108856
|
||||||
|
2 6.108923
|
||||||
|
2 6.108979
|
||||||
|
1 6.108993
|
||||||
|
2 6.10901
|
||||||
|
2 6.109085
|
||||||
|
2 6.109119
|
||||||
|
1 6.109135
|
||||||
|
2 6.109139
|
||||||
|
2 6.109233
|
||||||
|
2 6.109262
|
||||||
|
1 6.109272
|
||||||
|
2 6.109393
|
||||||
|
1 6.109398
|
||||||
|
2 6.109429
|
||||||
|
1 6.109521
|
||||||
|
1 6.109637
|
||||||
|
1 6.109748
|
||||||
|
1 6.109854
|
||||||
|
1 6.109954
|
||||||
|
1 6.11005
|
||||||
|
1 6.110142
|
||||||
|
1 6.110231
|
||||||
|
1 6.110314
|
||||||
|
1 6.110396
|
||||||
|
1 6.110474
|
||||||
|
1 6.110546
|
||||||
|
1 6.110618
|
||||||
|
1 6.110685
|
||||||
|
1 6.110752
|
||||||
|
1 6.110815
|
||||||
|
1 6.11088
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
0.5 0
|
||||||
|
1.5 1.692408
|
||||||
|
2.5 1.699932
|
||||||
|
0.5 3.123349
|
||||||
|
1.5 3.150984
|
||||||
|
0.5 6.467875
|
||||||
|
1.5 7.047169
|
||||||
|
2.5 7.049551
|
||||||
|
0.5 7.505138
|
||||||
|
1.5 7.514841
|
||||||
|
2.5 8.437981
|
||||||
|
3.5 8.437981
|
||||||
|
0.5 8.762908
|
||||||
|
1.5 9.016407
|
||||||
|
2.5 9.017486
|
||||||
|
0.5 9.234953
|
||||||
|
1.5 9.239519
|
||||||
|
2.5 9.675031
|
||||||
|
3.5 9.675031
|
||||||
|
3.5 9.69119
|
||||||
|
4.5 9.69119
|
||||||
|
0.5 9.850331
|
||||||
|
1.5 9.983397
|
||||||
|
2.5 9.983971
|
||||||
|
2.5 10.347483
|
||||||
|
3.5 10.347483
|
||||||
|
3.5 10.35764
|
||||||
|
4.5 10.35764
|
||||||
|
0.5 10.451978
|
||||||
|
1.5 10.53043
|
||||||
|
2.5 10.530773
|
||||||
|
2.5 10.752785
|
||||||
|
3.5 10.752785
|
||||||
|
3.5 10.75949
|
||||||
|
4.5 10.75949
|
||||||
|
0.5 10.819836
|
||||||
|
1.5 10.869934
|
||||||
|
2.5 10.870156
|
||||||
|
2.5 11.015662
|
||||||
|
3.5 11.015662
|
||||||
|
3.5 11.020278
|
||||||
|
4.5 11.020278
|
||||||
|
4.5 11.021035
|
||||||
|
5.5 11.021035
|
||||||
|
0.5 11.061142
|
||||||
|
1.5 11.095089
|
||||||
|
2.5 11.095238
|
||||||
|
2.5 11.19577
|
||||||
|
3.5 11.19577
|
||||||
|
3.5 11.199052
|
||||||
|
4.5 11.199052
|
||||||
|
1.5 11.252052
|
||||||
|
2.5 11.252161
|
||||||
|
2.5 11.32447
|
||||||
|
3.5 11.32447
|
||||||
|
4.5 11.32732
|
||||||
|
5.5 11.32732
|
||||||
|
1.5 11.36588
|
||||||
|
2.5 11.36588
|
||||||
|
1.5 11.45106
|
||||||
|
2.5 11.45106
|
||||||
|
1.5 11.51602
|
||||||
|
2.5 11.51602
|
||||||
|
2.5 11.56743
|
||||||
|
1.5 11.56743
|
||||||
|
2.5 11.60826
|
||||||
|
1.5 11.60826
|
||||||
|
2.5 11.64143
|
||||||
|
1.5 11.64143
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
0 0
|
||||||
|
0 3.7336589
|
||||||
|
1 3.8008703
|
||||||
|
2 3.9460391
|
||||||
|
1 5.4171652
|
||||||
|
1 6.3831999
|
||||||
|
0 6.6096101
|
||||||
|
0 7.23955
|
||||||
|
1 7.24831
|
||||||
|
2 7.2699
|
||||||
|
2 7.3423112
|
||||||
|
1 7.3752952
|
||||||
|
2 7.3767954
|
||||||
|
3 7.379041
|
||||||
|
1 7.427556
|
||||||
|
1 7.7568773
|
||||||
|
0 7.8217782
|
||||||
|
0 8.05846
|
||||||
|
1 8.06213
|
||||||
|
2 8.0705904
|
||||||
|
2 8.0756838
|
||||||
|
1 8.1027854
|
||||||
|
2 8.1034684
|
||||||
|
3 8.1045032
|
||||||
|
1 8.12114
|
||||||
|
2 8.132
|
||||||
|
1 8.2675178
|
||||||
|
0 8.2952422
|
||||||
|
0 8.4098055
|
||||||
|
2 8.4108897
|
||||||
|
1 8.411343
|
||||||
|
2 8.4154511
|
||||||
|
1 8.4296625
|
||||||
|
2 8.4300213
|
||||||
|
3 8.430566
|
||||||
|
1 8.4382892
|
||||||
|
2 8.44254
|
||||||
|
1 8.5155229
|
||||||
|
0 8.529959
|
||||||
|
2 8.5917433
|
||||||
|
0 8.59384
|
||||||
|
1 8.5947
|
||||||
|
2 8.59704
|
||||||
|
1 8.6046149
|
||||||
|
2 8.6048236
|
||||||
|
3 8.6051431
|
||||||
|
1 8.609355
|
||||||
|
2 8.6115
|
||||||
|
1 8.6549418
|
||||||
|
0 8.6634253
|
||||||
|
2 8.699912
|
||||||
|
0 8.70262
|
||||||
|
1 8.70316
|
||||||
|
2 8.70462
|
||||||
|
1 8.709157
|
||||||
|
2 8.7092774
|
||||||
|
3 8.7094859
|
||||||
|
1 8.712043
|
||||||
|
2 8.71329
|
||||||
|
1 8.741139
|
||||||
|
0 8.7465557
|
||||||
|
2 8.770115
|
||||||
|
1 8.7765748
|
||||||
|
2 8.7766684
|
||||||
|
3 8.776796
|
||||||
|
1 8.778484
|
||||||
|
2 8.77928
|
||||||
|
1 8.7981657
|
||||||
|
0 8.8019
|
||||||
|
2 8.817852
|
||||||
|
1 8.8225862
|
||||||
|
2 8.8226568
|
||||||
|
3 8.822755
|
||||||
|
1 8.823922
|
||||||
|
2 8.82448
|
||||||
|
1 8.83782
|
||||||
|
0 8.83995
|
||||||
|
2 8.8554386
|
||||||
|
3 8.8555123
|
||||||
|
3 8.8566
|
||||||
|
2 8.8567
|
||||||
|
1 8.8668
|
||||||
|
0 8.86834
|
||||||
|
2 8.87681
|
||||||
|
1 8.87956
|
||||||
|
1 8.88838
|
||||||
|
0 8.88872
|
||||||
|
2 8.89573
|
||||||
|
1 8.898
|
||||||
|
1 8.90437
|
||||||
|
2 8.91065
|
||||||
|
1 8.91207
|
||||||
|
1 8.9234
|
||||||
|
1 8.93265
|
||||||
|
1 8.94028
|
||||||
|
1 8.94617
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user