import { ESJConditionItem, ESJFillStyle, ESJImageStyle, ESJStrokeStyle, ESJTextStyle } from 'earthsdk3'; /** * 操作符类型 */ export type OperatorType = '==' | '!=' | '>' | '>=' | '<' | '<=' | 'contain' | 'empty'; /** * 字段值类型 */ export type FieldValueType = string | number | boolean; /** * 规则条件 */ export interface RuleCondition { /** 字段名 */ field: string; /** 操作符 */ op: OperatorType; /** 值 */ value: FieldValueType; } /** * 样式规则 */ export interface GeoJsonStyleRule { condition: ESJConditionItem[]; textShow?: boolean; textStyle?: ESJTextStyle; imageShow?: boolean; imageStyle?: ESJImageStyle; stroked?: boolean; strokeStyle?: ESJStrokeStyle; filled?: boolean; fillStyle?: ESJFillStyle; } export interface GeoJsonStyleExampleRule { textShow?: boolean; textStyle?: ESJTextStyle; imageShow?: boolean; imageStyle?: ESJImageStyle; stroked?: boolean; strokeStyle?: ESJStrokeStyle; filled?: boolean; fillStyle?: ESJFillStyle; } /** * 样式数据接口 */ export interface GeoJsonStyleData { /** 样式ID */ id: string; /** 样式名称 */ name: string; /** 样式规则代码 */ code: GeoJsonStyleRule[]; /** 缩略图 */ 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 GeoJsonStyleEditorOptions { /** 样式列表数据 */ historyRules?: GeoJsonStyleData[]; /** 字段配置数组(每项包含:显示名称、字段值、字段类型) */ fields?: FieldConfigItem[]; /** 初始规则数据 */ initialRule?: GeoJsonStyleRule[]; /** 示例规则数据 */ exampleRules?: GeoJsonStyleExampleRule[]; applyFunction?: (rule: GeoJsonStyleRule[]) => void; }