de0c02496dc244085b00b0bb0608f96eb7a35fd777d1817fa9ceb0980d378287ae6966a6e16aeab9b5aadebf7686499bcb46cf7df78bcb7ca75a135b73b9ba 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import ComponentModel from '../../model/Component.js';
  2. import Model from '../../model/Model.js';
  3. import Geo from './Geo.js';
  4. import { ComponentOption, BoxLayoutOptionMixin, ItemStyleOption, ZRColor, LabelOption, DisplayState, RoamOptionMixin, AnimationOptionMixin, StatesOptionMixin, Dictionary, CommonTooltipOption, StatesMixinBase } from '../../util/types.js';
  5. import { GeoProjection, NameMap } from './geoTypes.js';
  6. import GlobalModel from '../../model/Global.js';
  7. export interface GeoItemStyleOption<TCbParams = never> extends ItemStyleOption<TCbParams> {
  8. areaColor?: ZRColor;
  9. }
  10. interface GeoLabelOption extends LabelOption {
  11. formatter?: string | ((params: GeoLabelFormatterDataParams) => string);
  12. }
  13. export interface GeoStateOption {
  14. itemStyle?: GeoItemStyleOption;
  15. label?: GeoLabelOption;
  16. }
  17. interface GeoLabelFormatterDataParams {
  18. name: string;
  19. status: DisplayState;
  20. }
  21. export interface RegoinOption extends GeoStateOption, StatesOptionMixin<GeoStateOption, StatesMixinBase> {
  22. name?: string;
  23. selected?: boolean;
  24. tooltip?: CommonTooltipOption<GeoTooltipFormatterParams>;
  25. }
  26. export interface GeoTooltipFormatterParams {
  27. componentType: 'geo';
  28. geoIndex: number;
  29. name: string;
  30. $vars: ['name'];
  31. }
  32. export interface GeoCommonOptionMixin extends RoamOptionMixin {
  33. map: string;
  34. aspectScale?: number;
  35. layoutCenter?: (number | string)[];
  36. layoutSize?: number | string;
  37. boundingCoords?: number[][];
  38. nameMap?: NameMap;
  39. nameProperty?: string;
  40. /**
  41. * Use raw projection by default
  42. * Only available for GeoJSON source.
  43. *
  44. * NOTE: `center` needs to be the projected coord if projection is used.
  45. */
  46. projection?: GeoProjection;
  47. }
  48. export interface GeoOption extends ComponentOption, BoxLayoutOptionMixin, AnimationOptionMixin, GeoCommonOptionMixin, StatesOptionMixin<GeoStateOption, StatesMixinBase>, GeoStateOption {
  49. mainType?: 'geo';
  50. show?: boolean;
  51. silent?: boolean;
  52. regions?: RegoinOption[];
  53. stateAnimation?: AnimationOptionMixin;
  54. selectedMode?: 'single' | 'multiple' | boolean;
  55. selectedMap?: Dictionary<boolean>;
  56. tooltip?: CommonTooltipOption<GeoTooltipFormatterParams>;
  57. }
  58. declare class GeoModel extends ComponentModel<GeoOption> {
  59. static type: string;
  60. readonly type: string;
  61. coordinateSystem: Geo;
  62. static layoutMode: "box";
  63. private _optionModelMap;
  64. static defaultOption: GeoOption;
  65. init(option: GeoOption, parentModel: Model, ecModel: GlobalModel): void;
  66. optionUpdated(): void;
  67. /**
  68. * Get model of region.
  69. */
  70. getRegionModel(name: string): Model<RegoinOption>;
  71. /**
  72. * Format label
  73. * @param name Region name
  74. */
  75. getFormattedLabel(name: string, status?: DisplayState): string;
  76. setZoom(zoom: number): void;
  77. setCenter(center: number[]): void;
  78. select(name?: string): void;
  79. unSelect(name?: string): void;
  80. toggleSelected(name?: string): void;
  81. isSelected(name?: string): boolean;
  82. }
  83. export default GeoModel;