1ddb6c8dd083d5dc2da3d789c84ff8046fc327589aa7a8196d3ea2e5297ba05eda88e3110e10a269ebae79a5cafa6fa447a9f340ae9fc33ef4ff2c8f54219a 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { SVGParserResultNamedItem } from 'zrender/lib/tool/parseSVG.js';
  2. import Group from 'zrender/lib/graphic/Group.js';
  3. import { HashMap } from 'zrender/lib/core/util.js';
  4. import BoundingRect from 'zrender/lib/core/BoundingRect.js';
  5. import { GeoResource, GeoSVGSourceInput } from './geoTypes.js';
  6. import { GeoSVGRegion } from './Region.js';
  7. export interface GeoSVGGraphicRecord {
  8. root: Group;
  9. boundingRect: BoundingRect;
  10. named: SVGParserResultNamedItem[];
  11. }
  12. export declare class GeoSVGResource implements GeoResource {
  13. readonly type = "geoSVG";
  14. private _mapName;
  15. private _parsedXML;
  16. private _firstGraphic;
  17. private _boundingRect;
  18. private _regions;
  19. private _regionsMap;
  20. private _usedGraphicMap;
  21. private _freedGraphics;
  22. constructor(mapName: string, svg: GeoSVGSourceInput);
  23. load(): {
  24. boundingRect: BoundingRect;
  25. regions: GeoSVGRegion[];
  26. regionsMap: HashMap<GeoSVGRegion, string | number>;
  27. };
  28. private _buildGraphic;
  29. /**
  30. * Consider:
  31. * (1) One graphic element can not be shared by different `geoView` running simultaneously.
  32. * Notice, also need to consider multiple echarts instances share a `mapRecord`.
  33. * (2) Converting SVG to graphic elements is time consuming.
  34. * (3) In the current architecture, `load` should be called frequently to get boundingRect,
  35. * and it is called without view info.
  36. * So we maintain graphic elements in this module, and enables `view` to use/return these
  37. * graphics from/to the pool with it's uid.
  38. */
  39. useGraphic(hostKey: string): GeoSVGGraphicRecord;
  40. freeGraphic(hostKey: string): void;
  41. }