MCPcopy
hub / github.com/apache/echarts / constructor

Method constructor

src/coord/geo/Geo.ts:86–166  ·  view source on GitHub ↗
(
        name: string,
        map: string,
        opt: {
            projection?: GeoProjection;
            // Specify name alias
            nameMap?: NameMap;
            nameProperty?: string;
            aspectScale?: number;
            api: ExtensionAPI;
            ecModel: GlobalModel;
            clip?: boolean;
        }
    )

Source from the content-addressed store, hash-verified

84 resize: resizeGeoType;
85
86 constructor(
87 name: string,
88 map: string,
89 opt: {
90 projection?: GeoProjection;
91 // Specify name alias
92 nameMap?: NameMap;
93 nameProperty?: string;
94 aspectScale?: number;
95 api: ExtensionAPI;
96 ecModel: GlobalModel;
97 clip?: boolean;
98 }
99 ) {
100 super();
101
102 this.name = name;
103 let projection = opt.projection;
104 const source = geoSourceManager.load(
105 map,
106 opt.nameMap,
107 opt.nameProperty
108 );
109 const resource = geoSourceManager.getGeoResource(map);
110 const resourceType = this.resourceType = resource ? resource.type : null;
111 const regions = this.regions = source.regions;
112 const defaultParams = GEO_DEFAULT_PARAMS[resource.type];
113 this._clip = opt.clip;
114
115 // Not invert longitude if projection exits.
116 const invertLongitute = projection ? false : defaultParams.invertLongitute;
117
118 this.view = new View(
119 invertLongitute,
120 useLegacyViewCoordSysCenterBase(opt.ecModel, opt.api),
121 this
122 );
123
124 this.map = map;
125 this._regionsMap = source.regionsMap;
126 this.regions = source.regions;
127
128 if (__DEV__ && projection) {
129 // Do some check
130 if (resourceType === 'geoSVG') {
131 if (__DEV__) {
132 warn(`Map ${map} with SVG source can't use projection. Only GeoJSON source supports projection.`);
133 }
134 projection = null;
135 }
136 if (!(projection.project && projection.unproject)) {
137 if (__DEV__) {
138 warn('project and unproject must be both provided in the projeciton.');
139 }
140 projection = null;
141 }
142 }
143 this.projection = projection;

Callers

nothing calls this directly

Calls 6

warnFunction · 0.90
loadMethod · 0.65
getBoundingRectMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected