da41f0e61ac06259013a35e5cbb0e4e6e65a900c55425f5e1593034bddc7dd96c756ac0d251842831960bbbb13b7c9e07af769f2b925553d136c7830778543 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. import BoundingRect from 'zrender/lib/core/BoundingRect.js';
  2. import { HashMap } from 'zrender/lib/core/util.js';
  3. import { Group } from '../../util/graphic.js';
  4. import { Region } from './Region.js';
  5. export declare type GeoSVGSourceInput = string | Document | SVGElement;
  6. export declare type GeoJSONSourceInput = string | GeoJSON | GeoJSONCompressed;
  7. export interface NameMap {
  8. [regionName: string]: string;
  9. }
  10. export interface GeoSpecialAreas {
  11. [areaName: string]: {
  12. left: number;
  13. top: number;
  14. width?: number;
  15. height?: number;
  16. };
  17. }
  18. export interface GeoJSON extends GeoJSONFeatureCollection<GeoJSONGeometry> {
  19. }
  20. export interface GeoJSONCompressed extends GeoJSONFeatureCollection<GeoJSONGeometryCompressed> {
  21. UTF8Encoding?: boolean;
  22. UTF8Scale?: number;
  23. }
  24. interface GeoJSONFeatureCollection<G> {
  25. type: 'FeatureCollection';
  26. features: GeoJSONFeature<G>[];
  27. }
  28. interface GeoJSONFeature<G = GeoJSONGeometry> {
  29. type: 'Feature';
  30. id?: string | number;
  31. properties: {
  32. name?: string;
  33. cp?: number[];
  34. [key: string]: any;
  35. };
  36. geometry: G;
  37. }
  38. declare type GeoJSONGeometry = GeoJSONGeometryPoint | GeoJSONGeometryMultiPoint | GeoJSONGeometryLineString | GeoJSONGeometryMultiLineString | GeoJSONGeometryPolygon | GeoJSONGeometryMultiPolygon;
  39. declare type GeoJSONGeometryCompressed = GeoJSONGeometryPolygonCompressed | GeoJSONGeometryMultiPolygonCompressed | GeoJSONGeometryLineStringCompressed | GeoJSONGeometryMultiLineStringCompressed;
  40. interface GeoJSONGeometryPoint {
  41. type: 'Point';
  42. coordinates: number[];
  43. }
  44. interface GeoJSONGeometryMultiPoint {
  45. type: 'MultiPoint';
  46. coordinates: number[][];
  47. }
  48. interface GeoJSONGeometryLineString {
  49. type: 'LineString';
  50. coordinates: number[][];
  51. }
  52. interface GeoJSONGeometryLineStringCompressed {
  53. type: 'LineString';
  54. coordinates: string;
  55. encodeOffsets: number[];
  56. }
  57. interface GeoJSONGeometryMultiLineString {
  58. type: 'MultiLineString';
  59. coordinates: number[][][];
  60. }
  61. interface GeoJSONGeometryMultiLineStringCompressed {
  62. type: 'MultiLineString';
  63. coordinates: string[];
  64. encodeOffsets: number[][];
  65. }
  66. export interface GeoJSONGeometryPolygon {
  67. type: 'Polygon';
  68. coordinates: number[][][];
  69. }
  70. interface GeoJSONGeometryPolygonCompressed {
  71. type: 'Polygon';
  72. coordinates: string[];
  73. encodeOffsets: number[][];
  74. }
  75. export interface GeoJSONGeometryMultiPolygon {
  76. type: 'MultiPolygon';
  77. coordinates: number[][][][];
  78. }
  79. interface GeoJSONGeometryMultiPolygonCompressed {
  80. type: 'MultiPolygon';
  81. coordinates: string[][];
  82. encodeOffsets: number[][][];
  83. }
  84. export interface GeoResource {
  85. readonly type: 'geoJSON' | 'geoSVG';
  86. load(nameMap: NameMap, nameProperty: string): {
  87. boundingRect: BoundingRect;
  88. regions: Region[];
  89. regionsMap: HashMap<Region>;
  90. };
  91. }
  92. export interface GeoSVGGraphicRoot extends Group {
  93. isGeoSVGGraphicRoot: boolean;
  94. }
  95. /**
  96. * Geo stream interface compatitable with d3-geo
  97. * See the API detail in https://github.com/d3/d3-geo#streams
  98. */
  99. export interface ProjectionStream {
  100. point(x: number, y: number): void;
  101. lineStart(): void;
  102. lineEnd(): void;
  103. polygonStart(): void;
  104. polygonEnd(): void;
  105. /**
  106. * Not supported yet.
  107. */
  108. sphere(): void;
  109. }
  110. export interface GeoProjection {
  111. project(point: number[]): number[];
  112. unproject(point: number[]): number[];
  113. /**
  114. * Projection stream compatitable to d3-geo projection stream.
  115. *
  116. * When rotate projection is used. It may have antimeridian artifacts.
  117. * So we need to introduce the fule projection stream to do antimeridian clipping.
  118. *
  119. * project will be ignored if projectStream is given.
  120. */
  121. stream?(outStream: ProjectionStream): ProjectionStream;
  122. }
  123. export {};