缺少代码差异信息,无法生成具体的commit message。请提供code differences内容以便分析并生成符合Angular规范的提交信息。
当您提供代码差异后,我将按照以下格式生成: ``` <type>(<scope>): <subject> <body> ``` 其中type会根据更改类型选择(feat、fix、docs、style、refactor等),scope表示影响范围,subject简要描述变更内容,body详细说明修改内容。
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import Foundation
|
||||
import CoreGraphics
|
||||
import SwiftData
|
||||
|
||||
enum IndicatorStatus: String, Codable, CaseIterable {
|
||||
@@ -55,6 +56,14 @@ final class Indicator {
|
||||
/// 录入来源(IndicatorSource.rawValue)。带默认值 → SwiftData 轻量迁移,旧记录视为手动。
|
||||
var sourceRaw: String = IndicatorSource.manual.rawValue
|
||||
|
||||
/// VL 从报告原图中定位到的指标证据。页码为 0-based;box 为原图归一化坐标(0...1)。
|
||||
/// 全部可选以兼容旧数据、手动录入和无定位的模型输出。
|
||||
var sourcePageIndex: Int?
|
||||
var sourceBoxX: Double?
|
||||
var sourceBoxY: Double?
|
||||
var sourceBoxWidth: Double?
|
||||
var sourceBoxHeight: Double?
|
||||
|
||||
init(name: String,
|
||||
value: String,
|
||||
unit: String,
|
||||
@@ -66,7 +75,12 @@ final class Indicator {
|
||||
asset: Asset? = nil,
|
||||
pinned: Bool = false,
|
||||
seriesKey: String? = nil,
|
||||
source: IndicatorSource = .manual) {
|
||||
source: IndicatorSource = .manual,
|
||||
sourcePageIndex: Int? = nil,
|
||||
sourceBoxX: Double? = nil,
|
||||
sourceBoxY: Double? = nil,
|
||||
sourceBoxWidth: Double? = nil,
|
||||
sourceBoxHeight: Double? = nil) {
|
||||
self.name = name
|
||||
self.value = value
|
||||
self.unit = unit
|
||||
@@ -79,6 +93,11 @@ final class Indicator {
|
||||
self.pinned = pinned
|
||||
self.seriesKey = seriesKey
|
||||
self.sourceRaw = source.rawValue
|
||||
self.sourcePageIndex = sourcePageIndex
|
||||
self.sourceBoxX = sourceBoxX
|
||||
self.sourceBoxY = sourceBoxY
|
||||
self.sourceBoxWidth = sourceBoxWidth
|
||||
self.sourceBoxHeight = sourceBoxHeight
|
||||
}
|
||||
|
||||
var status: IndicatorStatus {
|
||||
@@ -88,6 +107,22 @@ final class Indicator {
|
||||
var source: IndicatorSource {
|
||||
IndicatorSource(rawValue: sourceRaw) ?? .manual
|
||||
}
|
||||
|
||||
var hasEvidenceBox: Bool {
|
||||
evidenceRect != nil && sourcePageIndex != nil
|
||||
}
|
||||
|
||||
var evidenceRect: CGRect? {
|
||||
guard let x = sourceBoxX,
|
||||
let y = sourceBoxY,
|
||||
let width = sourceBoxWidth,
|
||||
let height = sourceBoxHeight,
|
||||
x >= 0, y >= 0, width > 0, height > 0,
|
||||
x + width <= 1, y + height <= 1 else {
|
||||
return nil
|
||||
}
|
||||
return CGRect(x: x, y: y, width: width, height: height)
|
||||
}
|
||||
}
|
||||
|
||||
@Model
|
||||
|
||||
Reference in New Issue
Block a user