ec99c24d6e27ff921e3cc854b8c5ca8d7b083f79d1b543700463dd48c9750aef064f9adfefd041da8b020752c67f54ca31546b99d658b24dabaf3fb5725c45 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import * as matrix from 'zrender/lib/core/matrix.js';
  2. import BoundingRect from 'zrender/lib/core/BoundingRect.js';
  3. import Transformable from 'zrender/lib/core/Transformable.js';
  4. import { CoordinateSystemMaster, CoordinateSystem } from './CoordinateSystem.js';
  5. import GlobalModel from '../model/Global.js';
  6. import { ParsedModelFinder } from '../util/model.js';
  7. import type ExtensionAPI from '../core/ExtensionAPI.js';
  8. export declare type ViewCoordSysTransformInfoPart = Pick<Transformable, 'x' | 'y' | 'scaleX' | 'scaleY'>;
  9. declare class View extends Transformable implements CoordinateSystemMaster, CoordinateSystem {
  10. readonly type: string;
  11. static dimensions: string[];
  12. readonly dimensions: string[];
  13. readonly name: string;
  14. zoomLimit: {
  15. max?: number;
  16. min?: number;
  17. };
  18. /**
  19. * Represents the transform brought by roam/zoom.
  20. * If `View['_viewRect']` applies roam transform,
  21. * we can get the final displayed rect.
  22. */
  23. private _roamTransformable;
  24. /**
  25. * Represents the transform from `View['_rect']` to `View['_viewRect']`.
  26. */
  27. protected _rawTransformable: Transformable;
  28. private _rawTransform;
  29. /**
  30. * This is a user specified point on the source, which will be
  31. * located to the center of the `View['_viewRect']`.
  32. * The unit this the same as `View['_rect']`.
  33. */
  34. private _center;
  35. private _zoom;
  36. /**
  37. * The rect of the source, where the measure is used by "data" and "center".
  38. * Has nothing to do with roam/zoom.
  39. * The unit is defined by the source. For example,
  40. * for geo source the unit is lat/lng,
  41. * for SVG source the unit is the same as the width/height defined in SVG.
  42. */
  43. private _rect;
  44. /**
  45. * The visible rect on the canvas. Has nothing to do with roam/zoom.
  46. * The unit of `View['_viewRect']` is pixel of the canvas.
  47. */
  48. private _viewRect;
  49. constructor(name?: string);
  50. setBoundingRect(x: number, y: number, width: number, height: number): BoundingRect;
  51. /**
  52. * @return {module:zrender/core/BoundingRect}
  53. */
  54. getBoundingRect(): BoundingRect;
  55. setViewRect(x: number, y: number, width: number, height: number): void;
  56. /**
  57. * Transformed to particular position and size
  58. */
  59. protected _transformTo(x: number, y: number, width: number, height: number): void;
  60. /**
  61. * Set center of view
  62. */
  63. setCenter(centerCoord: (number | string)[], api: ExtensionAPI): void;
  64. setZoom(zoom: number): void;
  65. /**
  66. * Get default center without roam
  67. */
  68. getDefaultCenter(): number[];
  69. getCenter(): number[];
  70. getZoom(): number;
  71. getRoamTransform(): matrix.MatrixArray;
  72. /**
  73. * Remove roam
  74. */
  75. private _updateCenterAndZoom;
  76. /**
  77. * Update transform props on `this` based on the current
  78. * `this._roamTransformable` and `this._rawTransformable`.
  79. */
  80. protected _updateTransform(): void;
  81. getTransformInfo(): {
  82. roam: ViewCoordSysTransformInfoPart;
  83. raw: ViewCoordSysTransformInfoPart;
  84. };
  85. getViewRect(): BoundingRect;
  86. /**
  87. * Get view rect after roam transform
  88. */
  89. getViewRectAfterRoam(): BoundingRect;
  90. /**
  91. * Convert a single (lon, lat) data item to (x, y) point.
  92. */
  93. dataToPoint(data: number[], noRoam?: boolean, out?: number[]): number[];
  94. /**
  95. * Convert a (x, y) point to (lon, lat) data
  96. */
  97. pointToData(point: number[]): number[];
  98. convertToPixel(ecModel: GlobalModel, finder: ParsedModelFinder, value: number[]): number[];
  99. convertFromPixel(ecModel: GlobalModel, finder: ParsedModelFinder, pixel: number[]): number[];
  100. /**
  101. * @implements
  102. */
  103. containPoint(point: number[]): boolean;
  104. }
  105. export default View;