/** * 操作符类型 */ export type OperatorType = '==' | '!=' | '>' | '>=' | '<' | '<=' | 'contain' | 'empty'; /** * 字段值类型 */ export type FieldValueType = string | number | boolean; /** * 规则条件 */ export interface RuleCondition { /** 字段名 */ field: string; /** 操作符 */ op: OperatorType; /** 值 */ value: FieldValueType; } /** * 样式规则 */ export interface StyleRule { /** 条件列表 */ condition: (RuleCondition | boolean)[]; /** 颜色 [r, g, b, a],范围 0-1 */ color: [number, number, number, number]; /** 是否显示 */ show: boolean; } /** * 样式数据接口 */ export interface StyleData { /** 样式ID */ id: string; /** 样式名称 */ name: string; /** 样式规则代码 */ code: StyleRule[]; /** 缩略图 */ thumbnail: string; } /** * 字段类型定义 */ export interface FeatureType { /** 字段名 */ key: string; /** 字段类型 */ type: 'string' | 'number' | 'boolean'; } /** * 字段列表项 [显示名称, 字段值] */ export type FieldListItem = [string, string | boolean]; /** * 字段配置项(合并 fieldList 和 featureTypes 的单个元素) * [显示名称, 字段值, 字段类型] */ export type FieldConfigItem = [string, string | boolean, 'string' | 'number' | 'boolean']; /** * 编辑器配置选项 */ export interface TilesetStyleEditorOptions { /** 样式列表数据 */ historyRules?: StyleData[]; /** 字段配置数组(每项包含:显示名称、字段值、字段类型) */ fields?: FieldConfigItem[]; /** 初始规则数据 */ initialRule?: StyleRule[]; applyFunction?: (rule: StyleRule[]) => void; }