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

Method draw

src/component/helper/MapDraw.ts:164–236  ·  view source on GitHub ↗
(
        mapOrGeoModel: MapOrGeoModel,
        ecModel: GlobalModel,
        api: ExtensionAPI,
        fromView: MapView | GeoView,
        payload: Payload
    )

Source from the content-addressed store, hash-verified

162 }
163
164 draw(
165 mapOrGeoModel: MapOrGeoModel,
166 ecModel: GlobalModel,
167 api: ExtensionAPI,
168 fromView: MapView | GeoView,
169 payload: Payload
170 ): void {
171 const mapDraw = this;
172
173 // Map series has data. GEO model that controlled by map series
174 // will be assigned with map data. Other GEO model has no data.
175 let data = (mapOrGeoModel as MapSeries).getData && (mapOrGeoModel as MapSeries).getData();
176 if (isGeoModel(mapOrGeoModel)) {
177 ecModel.eachComponent({mainType: 'series', subType: 'map'}, function (mapSeries: MapSeries) {
178 if (!data && mapSeries.getHostGeoModel() === mapOrGeoModel) {
179 data = mapSeries.getData();
180 }
181 });
182 }
183
184 const geo = mapOrGeoModel.coordinateSystem;
185 const viewCoordSys = geo.view;
186
187 const regionsGroup = this._regionsGroup;
188 const transformGroup = this._transformGroup;
189
190 // No animation when first draw or in action
191 const isFirstDraw = !regionsGroup.childAt(0) || payload;
192
193 let clipRect: graphic.BoundingRect | NullUndefined;
194 if (geo.shouldClip()) {
195 clipRect = viewCoordSysCopyViewRect(null, viewCoordSys);
196 this.group.setClipPath(new graphic.Rect({shape: clipRect.clone()}));
197 }
198 else {
199 this.group.removeClipPath();
200 }
201
202 applyViewCoordSysTransToElement(
203 transformGroup,
204 VIEW_COORD_SYS_TRANS_ROAM,
205 viewCoordSys,
206 isFirstDraw ? null : mapOrGeoModel,
207 );
208
209 const isVisualEncodedByVisualMap = data
210 && data.getVisual('visualMeta')
211 && data.getVisual('visualMeta').length > 0;
212
213 if (geo.resourceType === 'geoJSON') {
214 this._buildGeoJSON(viewCoordSys, api, geo, mapOrGeoModel, data, isVisualEncodedByVisualMap);
215 }
216 else if (geo.resourceType === 'geoSVG') {
217 this._buildSVG(viewCoordSys, api, geo, mapOrGeoModel, data, isVisualEncodedByVisualMap);
218 }
219
220 updateRoamControllerSimply(
221 mapOrGeoModel,

Callers

nothing calls this directly

Calls 14

_buildGeoJSONMethod · 0.95
_buildSVGMethod · 0.95
viewCoordSysCopyViewRectFunction · 0.90
isGeoModelFunction · 0.85
eachComponentMethod · 0.80
getHostGeoModelMethod · 0.80
shouldClipMethod · 0.80
getDataMethod · 0.65
getVisualMethod · 0.65

Tested by

no test coverage detected